Id
int64
1.68k
75.6M
PostTypeId
int64
1
2
AcceptedAnswerId
int64
1.7k
75.6M
ParentId
int64
1.68k
75.6M
Score
int64
-60
3.16k
ViewCount
int64
8
2.68M
Body
stringlengths
1
41.1k
Title
stringlengths
14
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
1
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
1
21.3M
Tags
list
5,157,998
1
5,158,031
null
2
2,042
I want to resize the images to fixed width and height (i.e. 150px). However, theres a problem, if there is lots of difference in height and width of original photo (for example, panoramic photo), the resized thumbnail looks bad. Is there any any smart solution to resize the photos to a fixed width and height? For example, please have a look at this image: ![enter image description here](https://i.stack.imgur.com/Erhs2.png) Here's my code: ``` <?php $params = getimagesize($tempFile); $width = $params[0]; $height = $params[1]; $newwidth=150; $newheight= 150; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); imagejpeg($tmp,$img_name,80); imagedestroy($src); imagedestroy($tmp); ?> ``` Is there any smart way to resize the images in smart way? Thanks.
Resize panoramic image to fixed size
CC BY-SA 2.5
null
2011-03-01T17:23:12.557
2011-03-01T17:39:10.033
null
null
625,072
[ "php", "resize" ]
5,158,048
1
5,158,963
null
0
1,232
What I am having problem is that when a user first time login to this facebook iframe app then he is sent to a blank page with a facebook logo. Followin is screen shot. ![enter image description here](https://i.stack.imgur.com/3KcZD.jpg) Following is my code, I am using new PHP Sdk: ``` $facebook = new Facebook(array( 'appId' => 'xxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'cookie' => true, )); $this->facebook=$facebook; $this->session = $facebook->getSession(); $this->me = null; // Session based API call. if(!$this->session){ if (!$this->session) { //echo $loginUrl = $facebook->getLoginUrl($par); $loginUrl = $facebook->getLoginUrl( array( 'canvas' => 1, 'fbconnect' => 0, 'display' => 'page', 'req_perms' => 'email,publish_stream,status_update,user_birthday,user_location,user_work_history' )); $this->request->redirect($loginUrl); } } if ($this->session) { try { $this->uid = $facebook->getUser(); $this->user = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); } } ```
Problem at first time going to facebook app
CC BY-SA 2.5
null
2011-03-01T17:28:09.113
2011-03-01T18:53:25.083
2011-03-01T18:21:56.697
513,302
513,302
[ "facebook", "facebook-php-sdk" ]
5,158,220
1
5,158,269
null
7
962
I am looking to read the value that is located in address 302H. The purpose is to read an input from hardware (a part of a 104pc stack). When I run the following code a get this error: `Unhandled exception at 0x004134b9 in setOutput.exe: 0xC0000005: Access violation reading location 0x00000302.` ``` #include <stdlib.h> #define PORTBASE 0x302 int _tmain(int argc, char *argv[]) { int value; int volatile * port = (int *) PORTBASE; printf("port = %d\n", port); value = *port; printf("port value = %d\n", value); } ``` EDIT: I am running this under widows xp. Only Documentation I can find on the board is below![enter image description here](https://i.stack.imgur.com/cIkA4.png) EDIT: From your answers below, I can see that I need to write a driver for the board. Can someone point me to a resource on how to do so?
How to read a value of an hard coded address in C++?
CC BY-SA 2.5
0
2011-03-01T17:42:11.397
2011-03-01T19:20:51.030
2011-03-01T17:51:20.167
323,332
323,332
[ "c++", "pc104" ]
5,158,271
1
5,424,051
null
0
608
The problem is to position dots in certain sectors of a circle starting in the center. ![](https://i.stack.imgur.com/0rSlD.jpg) We could use PHP or javascript. I can imagine a function to mimic a centripetal force. Or maybe some procedure of analytic geometry. Or whatever... Any idea is welcome. THX.-
Position dots in certain sectors of a circle starting in the center
CC BY-SA 2.5
0
2011-03-01T17:46:17.477
2011-03-24T18:54:01.090
null
null
333,061
[ "php", "javascript", "geometry", "positioning" ]
5,158,274
1
5,158,314
null
0
237
I am new to qt, qmake, etc. I've created a .pri file that includes: ``` INCLUDEPATH += $$QXMPP_INCLUDE_DIR \ /path/to/mysql-connector-c++-1.0.5/ LIBS += $$QXMPP_LIBS \ -lmysqlcppconn ``` When I qmake -o Makefile make ./myProject or simply hit run in the Netbeans IDE my project compiles and runs successfully. However, my Netbeans IDE does not realize I have included the mysqlcppconn library I think because I have errors in my code as shown in the pictures below. How can I get rid of these errors? My suspicion is that I should I tell Netbeans that I've included the mysqlcppconn library. If that is correct how can I do that? Or is there something else I should do? Thanks! ![error](https://i.stack.imgur.com/ebZcr.png) ![error](https://i.stack.imgur.com/OnnGW.png)
Netbeans errors on files that compile
CC BY-SA 2.5
null
2011-03-01T17:46:43.427
2015-03-12T21:18:24.393
2015-03-12T21:18:24.393
null
471,321
[ "c++", "qt", "netbeans", "mysql-connector" ]
5,158,457
1
5,159,232
null
1
9,682
Problem: Values constantly change on db. Need to auto-reload certain elements values without reloading all page. Very similar to collective bidding pages as attached image. ![enter image description here](https://i.stack.imgur.com/b4PGg.png) A simple page Dashboard type with three columns of grid organized data. How can I effectively reload (AJAX CALL) certain class types, content? Since these column values change as time goes from db, they have to auto refresh on time interval. Code Sample: ``` <div class="autovalue">26</div> <div class="autovalue">20</div> <div class="autovalue">96</div> ``` Maybe Jquery has a method.
Javascript Auto-Refresh Class Elements
CC BY-SA 2.5
0
2011-03-01T18:03:06.377
2011-03-01T19:27:18.080
null
null
64,742
[ "javascript", "ajax", "dom", "jquery" ]
5,158,443
1
8,945,330
null
1
1,334
I'm curious to see if anyone can shed some light on some strange text rendering behavior in the Spark RichEditableText component. ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="handleApplicationCreationComplete()" > <fx:Script> <![CDATA[ import flashx.textLayout.conversion.TextConverter; private static const DATA:Array = [ "First sentence. This is a test of text rendering. How's it look?", "Let's see if this actually works correctly.", "Add some variety with the <b>bold</b> tag...", "Throw in a <a href='http://www.example.com'>link</a> as well!", "Well?! Does it work as expected? I think not..." ]; private var currentIdx:int; protected function handleNextClick():void { currentIdx++; if(currentIdx >= DATA.length) currentIdx = 0; display(currentIdx); } protected function handleApplicationCreationComplete():void { currentIdx = 0; display(currentIdx); } private function display(idx:int):void { contentDisplay.textFlow = TextConverter.importToFlow(DATA[idx], TextConverter.TEXT_FIELD_HTML_FORMAT); } ]]> </fx:Script> <s:layout> <s:VerticalLayout /> </s:layout> <s:VGroup width="100"> <s:RichEditableText id="contentDisplay" width="100%" enabled="false" mouseEnabled="false" editable="false" focusEnabled="false" /> </s:VGroup> <s:Button label="Next" click="handleNextClick()" /> </s:Application> ``` The above application simply navigates through the five sentences in the `DATA` array (every time the `Next` button is pressed). For whatever reason, `RichEditableText` component doesn't completely reset its view (by clearing the previous text) before setting new content. From what I can gather, this faulty rendering is somehow based on the combination of line count and relative width. I also discovered that if I set the `width` property of the `RichEditableText` component to an absolute value (say, `100`) as opposed to relative (percentage, `100%`) the text is rendered correctly. As far as I can see, this behavior is unintended and is, in fact, a bug. ![Text on startup](https://i.stack.imgur.com/CaOQj.jpg) ![Text after "next" is clicked](https://i.stack.imgur.com/kIx6u.jpg) ![Text after "next" is clicked again](https://i.stack.imgur.com/0Stwr.jpg)
Flex 4 text rendering in s:RichEditableText component
CC BY-SA 2.5
null
2011-03-01T18:01:59.603
2013-03-15T08:29:09.920
2011-03-02T19:03:49.673
350,103
350,103
[ "apache-flex", "flex4" ]
5,158,566
1
5,423,576
null
0
1,117
I'm using a rich calendar control with manual suggestions enabled, and a date string of "dd MMM yyyy". Something like: ``` <rich:calendar id="calStartDateTime" label="Test Calendar" popup="true" datePattern="dd MMM yyyy" /> ``` Our QA department found an odd little quirk. If you type a date with the month in all caps, like "15 MAR 2011", and then popup the calendar control, the calendar trips out. It displays "undefined" for the month and "NaN" for the year, and the days of the month are filled in from 1 to 42. ![enter image description here](https://i.stack.imgur.com/SRoES.jpg) I haven't found this bug reported anywhere, but it's possible I'm not searching for it right. Can anyone suggest a fix or workaround? We're using RichFaces 3.3.1.GA, and it would be difficult for us to change that at this moment.
Odd rich:calendar bug
CC BY-SA 2.5
null
2011-03-01T18:14:22.583
2011-03-24T18:13:29.923
2011-03-02T20:56:43.870
26,457
175,142
[ "calendar", "richfaces" ]
5,158,686
1
5,172,443
null
2
1,089
I tried to running a website in debug more (F5), and I get the following error message. Note, that I am using a local IIS 7 server on windows 7 64 bit machine. How can I get the debugger to work? ![enter image description here](https://i.stack.imgur.com/bt4uI.png)
Debugging not working with IIS 7
CC BY-SA 2.5
null
2011-03-01T18:25:46.613
2011-05-20T21:52:45.193
2011-03-05T04:12:01.293
11,182
173,432
[ "asp.net", "visual-studio", "iis", "iis-7" ]
5,158,726
1
5,158,868
null
2
2,193
I need help with my `iPhone` application. I currently have 5 `UIButtons` in a view linked with different `IBActions`. The buttons are placed one close to each other. I would like to know how to make the user able to press just by dragging his finger on the buttons instead of pulling the finger away from the screen of his device and tap on a different button. If you can't understand how the buttons are placed here's a picture ^.^ ![enter image description here](https://i.stack.imgur.com/4PSMw.png) Thanks!
How start an IBAction by dragging on a UIButton?
CC BY-SA 2.5
0
2011-03-01T18:28:17.093
2011-03-01T18:50:47.703
null
null
514,481
[ "iphone", "objective-c", "xcode", "uibutton" ]
5,158,783
1
5,159,126
null
0
129
In Eclipse, whenever I need to create something automatically (like delegate methods or similar), there is a checkbox beside each method thus making selection very precise and easy. IntelliJ IDEA does not have such check boxes so we have to use CTRL or SHIFT button. Does such feature exist and how to turn it on? If not, where can we vote for it. The main thing with IntelliJ IDEA (and the main reason people and myself like it) is the speed. In that respect, I was very surprised such way of selecting isn't the default one. For better understanding of this issue, please look at the pic (IntelliJ IDE without check boxes). ![enter image description here](https://i.stack.imgur.com/lrpeV.png)
Checkboxes to select autogenerated methods, properties, etc
CC BY-SA 2.5
null
2011-03-01T18:35:41.940
2011-03-01T19:07:47.940
null
null
437,039
[ "intellij-idea" ]
5,159,028
1
null
null
0
1,131
Hi I am using an automatic image slider by [Soh Tanaka](http://www.sohtanaka.com/web-design/automatic-image-slider-w-css-jquery/) in which on my images I have specified round corners using css3 border-radius. ![image when static](https://i.stack.imgur.com/KOlHS.png) The problem I am having is that when the images animate between one another the appearance is that of a rectangular image because the radial corners are moving with each image within the confines of the 'window' wrapper/mask. ![image when in transition](https://i.stack.imgur.com/SnoN3.png) I have considered using artifical corners on the 'window' wrapper using div strips however because I have a transparent background outside of the slider this isn't an option.
How do I maintain round corners on border of automatic image slider
CC BY-SA 2.5
null
2011-03-01T18:58:58.960
2011-03-01T19:55:26.480
2011-03-01T19:38:18.013
247,244
247,244
[ "jquery" ]
5,159,065
1
5,159,405
null
53
83,934
Looking to add in vertical space between plotted graphs to allow a X-Axis label to show: Each graph needs to have space to show the day, currently the last 2 graphs are the only one's that show simply because the graphs are overlapping it. Also curious if I could actually remove the notch labels for the X-Axis for the graphs above the one's marked Thursday/Friday, i.e. the bottom X-axis is the only one that shows. Same for the Y-Axis, but only the graphs on the left having the scale shown. *Unfortunately I can't post an image to show this since I don't have enough rep. Code snippet: ``` import mathlib.pyplot as pyplot fig = pyplot.figure() ax1 = fig.add_subplot(4,2,1) ax1.set_yscale('log') ax2 = fig.add_subplot(4,2,2, sharex=ax1, sharey=ax1) ax3 = fig.add_subplot(4,2,3, sharex=ax2, sharey=ax2) ax4 = fig.add_subplot(4,2,4, sharex=ax3, sharey=ax3) ax5 = fig.add_subplot(4,2,5, sharex=ax4, sharey=ax4) ax6 = fig.add_subplot(4,2,6, sharex=ax5, sharey=ax5) ax7 = fig.add_subplot(4,2,7, sharex=ax6, sharey=ax6) ax1.plot(no_dict["Saturday"],'k.-',label='Saturday') ax1.set_xlabel('Saturday') ax1.axis([0,24,0,10000]) pyplot.suptitle('Title') pyplot.xlabel('Hour in 24 Hour Format') ax2.plot(no_dict["Sunday"],'b.-',label='Sunday') ax2.set_xlabel('Sunday') ... ``` ![too crowded](https://i.stack.imgur.com/biyb4.png)
Need to add space between SubPlots for X axis label, maybe remove labelling of axis notches
CC BY-SA 2.5
0
2011-03-01T19:01:51.203
2019-07-08T18:43:03.917
2011-03-01T19:15:05.960
31,676
632,729
[ "python", "matplotlib" ]
5,159,284
1
5,159,372
null
26
15,748
![enter image description here](https://i.stack.imgur.com/6Epux.jpg) I've majorly refactored my project. I've added some new classes, but I've also RightClick > Deleted classes from within Visual Studio Solution Explorer. What does the ! symbol mean? All of the items marked with ! were things I've deleted in VS2010. Will this delete them from the repository as well?
What does this symbol mean in Mercurial?
CC BY-SA 2.5
0
2011-03-01T19:23:49.507
2011-03-01T20:13:29.297
null
null
null
[ "mercurial" ]
5,159,581
1
7,965,137
null
2
5,584
I'm learning wxPython on Ubuntu Linux - and I would like to define my own widget, which is basically a line, which I'd like to move around the window.. I'm getting somewhere, but the problem is that I cannot get the 'widget' to 'draw' on a transparent background; best I can get is something like this (): ![bad transparency in this wxPython example](https://i.stack.imgur.com/tP492.png) The code I came up with is below. I don't want the whole window transparent ([wxpython - Python drawing on screen - Stack Overflow](https://stackoverflow.com/questions/2323640/python-drawing-on-screen)); I'm aware wx.TRANSPARENT is only for text, and I should try wx.GCDC, which I did, but it isn't working ([wx.PaintDC and SetBackgroundMode( wx.TRANSPARENT ) support - wxPython-users | Google Groups](http://groups.google.com/group/wxpython-users/browse_thread/thread/a02a0c6de6c7ce91)), and apparently, this, on "wxGTK it is not possible" ([wxPython-users - transparent background for a panel widget](http://wxpython-users.1045709.n5.nabble.com/transparent-background-for-a-panel-widget-td2362723.html))... It seems the only way would be to use a transparent bitmap/Image, and then use that as background for a custom widget, would that be correct? If so, is there a possibility to generate this bitmap/image directly in wxPython () ? And if this is a possible approach, can someone point me to a minimal working example ().. Thanks in advance for any help, Cheers! code that generated image above: ``` #!/usr/bin/python # -*- coding: utf-8 -*- import wx class CustomLine(wx.Panel): #PyControl """ A custom class for a line Modified from http://wiki.wxpython.org/CreatingCustomControls """ def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name="CustomLine"): """ Default class constructor. @param parent: Parent window. Must not be None. @param id: CustomLine identifier. A value of -1 indicates a default value. @param label: Text to be displayed next to the checkbox. @param pos: CustomLine position. If the position (-1, -1) is specified then a default position is chosen. @param size: CustomLine size. If the default size (-1, -1) is specified then a default size is chosen. @param style: not used in this demo, CustomLine has only 2 state @param validator: Window validator. @param name: Window name. """ #~ wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name) wx.Panel.__init__(self, parent, id, pos, size, style) # Bind the events related to our control: first of all, we use a # combination of wx.BufferedPaintDC and an empty handler for # wx.EVT_ERASE_BACKGROUND (see later) to reduce flicker self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.lpen = wx.Pen('yellow', 2, wx.SOLID) self.imagebkg = wx.EmptyImage( 10, 10 ) #~ self.imagebkg.SetData((255,255,255)) #~ self.imagebkg.SetAlphaData((1)) def OnPaint(self, event): """ Handles the wx.EVT_PAINT event for CustomLine. """ # If you want to reduce flicker, a good starting point is to # use wx.BufferedPaintDC. pdc = wx.BufferedPaintDC(self) dc = wx.GCDC(pdc) # Is is advisable that you don't overcrowd the OnPaint event # (or any other event) with a lot of code, so let's do the # actual drawing in the Draw() method, passing the newly # initialized wx.BufferedPaintDC self.Draw(dc) def Draw(self, dc): """ Actually performs the drawing operations, for the bitmap and for the text, positioning them centered vertically. """ # Get the actual client size of ourselves width, height = self.GetClientSize() if not width or not height: # Nothing to do, we still don't have dimensions! return # Initialize the wx.BufferedPaintDC, assigning a background # colour and a foreground colour (to draw the text) #~ backColour = self.GetBackgroundColour() #~ backBrush = wx.Brush((1,1,1,150), wx.TRANSPARENT) # backColour #~ backBrush = wx.Brush((10,10,1,150)) # backColour dc.SetBackground(wx.TRANSPARENT_BRUSH) #() backBrush #~ dc.SetBackgroundMode(wx.TRANSPARENT) dc.Clear() dc.SetPen(self.lpen) dc.DrawLine(0, 0, 100, 100) def OnEraseBackground(self, event): """ Handles the wx.EVT_ERASE_BACKGROUND event for CustomLine. """ # This is intentionally empty, because we are using the combination # of wx.BufferedPaintDC + an empty OnEraseBackground event to # reduce flicker pass class MyTestFrame(wx.Frame): def __init__(self, parent, title): super(MyTestFrame, self).__init__(parent, title=title, size=(250, 150)) # the master panel of the frame - "Add a panel so it looks correct on all platforms" self.panel = wx.Panel(self, wx.ID_ANY) # self.panel.SetBackgroundColour(wx.Colour(124, 224, 124)) # to confirm the square is the panel self.mpanelA = wx.Panel(self.panel, -1, size=(200,50)) self.mpanelA.SetBackgroundColour((200,100,200)) self.mpanelB = wx.Panel(self.panel, -1, size=(50,200), pos=(50,30)) self.mpanelB.SetBackgroundColour(wx.Colour(200,100,100,100)) self.cline = CustomLine(self.panel, -1, size=(-1,200)) self.Centre() self.Show() if __name__ == '__main__': app = wx.App() MyTestFrame(None, 'Test') app.MainLoop() ```
wxPython - drawing on transparent/alpha background (for custom widgets/panels)
CC BY-SA 2.5
null
2011-03-01T19:53:04.870
2011-11-01T10:26:28.197
2017-05-23T12:30:36.590
-1
277,826
[ "background", "wxpython", "widget", "transparency", "alpha" ]
5,159,752
1
5,159,950
null
1
254
hopefully this is a really easy question. I'm trying to achieve the following style of formatting without using tables, as illustrated in the first picture. Is there a way to style the text content using span and/or div tags to make it look like the example at the bottom? Your insight is appreciated. ![Table Formatting](https://i.stack.imgur.com/G2J51.png) ![enter image description here](https://i.stack.imgur.com/T4Pto.png) Update: Thank you all for your suggestions, I wasn't sure if it was standard to use tables in this case or not.
HTML text formatting
CC BY-SA 2.5
0
2011-03-01T20:10:29.217
2011-03-01T20:59:14.143
2011-03-01T20:59:14.143
94,541
94,541
[ "html", "css" ]
5,159,846
1
5,260,246
null
9
1,794
How can I know, in Xul, if the network is (dis)connected? Using: ``` function observe(aSubject, aTopic, aState) { if (aTopic == "network:offline-status-changed") { write("STATUS CHANGED!"); } } var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); os.addObserver(observe, "network:offline-status-changed", false); ``` and the preference: ``` pref("network.manage-offline-status", true); ``` it's not working.. There's a [bug report here](https://bugzilla.mozilla.org/show_bug.cgi?id=339814), but I don't think it has something to do with it. -- I think it's not possible to be notified, as even in Firefox we're never notified, and the user need to manually mark "work offline" if he wants the browser to know that it's offline.. -- Screenshot my of Firefox "about:config" filtering for "offline" string, unfortunately, there no "network.manage-offline-status": ![enter image description here](https://i.stack.imgur.com/2oQfv.png)
How to know if the network is (dis)connected?
CC BY-SA 2.5
0
2011-03-01T20:19:12.977
2011-04-20T09:13:44.210
2011-03-02T20:11:11.630
287,316
287,316
[ "javascript", "xul", "xulrunner" ]
5,160,173
1
5,160,242
null
0
277
I have a sprite called `gameSprite`, it contains all elements in the game. I have an object called `myCell`, and I am trying to make the cell be always in the middle of the screen, which is 800x600. This one works: ``` var panX:Number = myCell.x - 800.0 / 2; var panY:Number = myCell.y - 600.0 / 2; ``` But my problem is that I am trying to allow players to zoom in and out. Zooming in and out adjusts the `gameSprite.scaleX` and `gameSprite.scaleY` (note they are scaleX is always equal to scaleY). scaleX is 1.0 for original size, and the lower it is, the more zoomed out the player is. Then I changed it so it would work with the zoom, but for some reason it doesn't work: ``` var panX:Number = myCell.x - 800.0 / 2 / gameSprite.scaleX; var panY:Number = myCell.y - 600.0 / 2 / gameSprite.scaleY; ``` I have no idea about what I did wrong. Here's a screenshot without any zoom: ![](https://i.stack.imgur.com/cQhKe.png) And the more I zoom, the more the camera moves away from the 0, 0 position: ![](https://i.stack.imgur.com/X0dw4.png)
Problem with zooming in and out in my game
CC BY-SA 2.5
null
2011-03-01T20:49:05.113
2011-03-02T01:41:23.023
null
null
null
[ "actionscript-3" ]
5,160,289
1
6,053,845
null
2
1,090
Here's how standard section header views handle scrolling/overlaping: ![enter image description here](https://i.stack.imgur.com/E4Qrj.jpg) I'm trying to replicate the same behavior with custom section headers but all I get is this: ![enter image description here](https://i.stack.imgur.com/1UTwG.jpg) It seems that in the default behavior, the top 1px line of the bottom header view overlaps the bottom 1px line of the top header view. This can also be observed below the navbar, where that same top 1px line disappears underneath it. Setting a contentInset on the tableview fixes the navbar situation, but not the overlapping issue. I've also tried playing with the maskToBounds and clipToBounds properties, but no luck. Any clue?
UITableView section header 1px gloss/shadow overlapping
CC BY-SA 2.5
null
2011-03-01T21:01:26.067
2011-05-19T04:41:24.857
2011-03-01T23:13:32.827
87,158
87,158
[ "iphone", "uitableview", "uiview", "scroll" ]
5,160,441
1
5,161,028
null
0
159
I'm trying to lay the header of my page out so that it looks like this: --- ![layout example](https://i.stack.imgur.com/izUp4.png) --- I would like to avoid using tables if posible. I'm html and css beginer co I cannot get it working :(. This is my best try till now: Html: ``` <div class="rightAlign" > <div class="notificationArea"> <img src="../bigHeaderImage.png" /> </div> <div> <div> <img src="../smallImage.png" />Some info<br/> Other info </div> <div> <div class="ignoreRightAlign"> <a href="#" >Menu1</a> <a href="#" >Menu2</a> </div> <a href="#" >Menu3</a> </div> </div> </div> ``` CSS: ``` .rightAlign { clear: both; text-align: right; } .ignoreRightAlign { float: left; } ``` It does not work as desired of cause: Menu line is not on the bottom aligned to bottom of "Big header picture". Thank you for any help, ideas and advices
How can I lay out desired design using html and CSS?
CC BY-SA 2.5
0
2011-03-01T21:15:25.113
2011-03-03T16:37:16.060
null
null
311,865
[ "html", "css" ]
5,160,448
1
5,160,961
null
2
5,033
Is it possible to change the size of the tabs displayed in a `TabActivity`? I'm currently only putting text in my tabs and I'd really like to minimize the size as much as possible. Also, is there a way to use icons for my activity that aren't 48x48? I'd like to do something more rectangular as opposed to square. I just want to use my screen real-estate the best I can :) How is the YouTube app doing this? (See screenshot, and I know that the YouTube app isn't open source) ![enter image description here](https://i.stack.imgur.com/MCOh3.png) ![enter image description here](https://i.stack.imgur.com/aaz22.png) It seems that they're also making it possible to scroll left and right for more tabs. Any ideas on how they're doing this?
Change tab height in a TabView?
CC BY-SA 2.5
0
2011-03-01T21:16:28.333
2012-04-09T11:50:35.080
2011-03-01T22:05:33.557
128,967
128,967
[ "android", "android-tabhost", "tabview" ]
5,160,583
1
5,163,399
null
0
335
I have a drawing app where the user can draw on the screen with their finger. The drawing happens to an off-screen bitmap, and is then posted to the screen in onDraw(). When the user is switched away from the application, via a call or by hitting home, then returns to the app, the drawing screen is shown with the previous drawing, except the drawings edges now have artifacts. Cycling through a number of home -> resume -> home -> resume cycles results in the artifacts getting worse each time. See attached images for the results after five cycles. Has anyone seen this before? Any idea why this is happening? Thanks Original drawing: ![enter image description here](https://i.stack.imgur.com/UXaoU.png) After 5 Cycles: ![enter image description here](https://i.stack.imgur.com/Ue1MS.png) EDIT: More details: As the user touches the screen, I intercept the touches and store them as Path's on an offscreen Bitmap, mBitmap. The Paths are drawn with a Paint that has the flag Paint.ANTI_ALIAS_FLAG enabled. The in onDraw(), I write them to the screen via: ``` @Override protected void onDraw(Canvas canvas) { // wipe the canvas canvas.drawColor(0xffffffff); // draw the stored paths canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); // draw any active paths if (mStrokePath != null) { canvas.drawPath(mStrokePath, mStrokePaint); } } ``` Where mBitmapPaint is defined as: ``` mBitmapPaint = new Paint(Paint.DITHER_FLAG); ``` EDIT 2: Ok, got it figured out My issue was that in the onResume for the Activity that creates the Canvas-based View, I was reloading the shapes onto the canvas ON TOP of the restored Bitmap, which already had the shapes, thus the deterioration of the anti-aliasing.
Android: Restored Canvas-based Bitmap Deteriorating?
CC BY-SA 2.5
0
2011-03-01T21:28:45.113
2011-03-02T04:28:42.377
2011-03-02T04:25:25.467
357,801
357,801
[ "android", "bitmap" ]
5,160,622
1
null
null
1
205
I want to create an axiom-action tha will enable an agent to move up or down between doors if the robot is in a lift node, and if a route connects the two lift nodes ![enter image description here](https://i.stack.imgur.com/StZ8E.jpg) > A map which shows the structure of the building. Each node either represent a room (Rn) or a lift (Ln). The robot can either move between rooms (solid lines), or move between oors (dashed lines). The robots needs to specify the direction (up/down) when taking the lift. : isRobot(r) and isEdge(e) and isLift(x) and isLift(y) and isFloor(Floor1) and isFloor(Floor2) and -(x==y) and -(Floor1==Floor2) and at(inside(r,x),Floor1) and edgeFrom(e,x,y)ad=>goUp(inside(r,y),Floor2) or goDown(inside(r,y),Floor2) : move(x,y)- edgeFrom(x,y,z)- at(x,y) inside(x,y)- dusting(x,y)- isClean(x)- isRoom(x)- isEdge(x)- isFloor(x)- goUp(x,y)- goDown(x,y) isLift(x) isRobot(x) Did I formalized the action right?If not what should I do?
Actions and effect axioms
CC BY-SA 2.5
null
2011-03-01T21:32:40.390
2011-11-29T06:35:31.553
2011-03-02T20:36:46.860
630,756
630,756
[ "artificial-intelligence", "predicate" ]
5,160,842
1
5,161,131
null
0
963
I have the following code that creates my UITableViewCell... ``` - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSNumberFormatter *numberFormatter = nil; if (numberFormatter == nil) { numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; [numberFormatter setMaximumFractionDigits:3]; } static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; UIImage *image = [UIImage imageNamed:@"home1"]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height); button.frame = frame; button.tag = indexPath.row; [button setBackgroundImage:image forState:UIControlStateNormal]; [button addTarget:self action:@selector(setHomeButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; button.backgroundColor = [UIColor clearColor]; cell.accessoryView = button; UIImage *imageShare = [UIImage imageNamed:@"arrows-share"]; UIButton *buttonRight = [UIButton buttonWithType:UIButtonTypeCustom]; buttonRight.autoresizingMask = UIViewAutoresizingFlexibleRightMargin; [buttonRight setBackgroundImage:imageShare forState:UIControlStateNormal]; [buttonRight setFrame: CGRectMake( 220.0f, 0.0f, imageShare.size.width, imageShare.size.height)]; [buttonRight addTarget:self action:@selector(shareLink:) forControlEvents:UIControlEventTouchUpInside]; [cell addSubview:buttonRight]; } Event *event = (Event *)[eventsArray objectAtIndex:indexPath.row]; cell.textLabel.text = [event name]; NSString *string = [NSString stringWithFormat:@"%@, %@", [numberFormatter stringFromNumber:[event lat]], [numberFormatter stringFromNumber:[event lon]]]; cell.detailTextLabel.text = string; return cell; } ``` This works fine in portrait but in Landscape when rotated the UIButton "buttonRight" doesn't stay next to the accessory View. Is this possible without creating the whole thing in IB? ![enter image description here](https://i.stack.imgur.com/fKgFq.png)
Rotation with UITableViewCell
CC BY-SA 2.5
null
2011-03-01T21:53:32.690
2011-03-01T22:28:57.490
null
null
103,999
[ "iphone", "uitableview" ]
5,160,936
1
5,170,565
null
0
129
I am having a problem with a `TextView` containing a lot of text. On Android 2.1update1 (Eclair) the text isn't wrapping but on Android 2.2 (Froyo) it is. This is happening on the emulators as well as a couple test devices that I've tried. Sample code and screenshots below. LongtextActivity.java: ``` package com.example.longtext; import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ScrollView; import android.widget.TextView; public class LongtextActivity extends Activity { private static final String LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eleifend sodales vulputate. Aenean quis mattis tellus. Morbi fringilla sagittis turpis, scelerisque tempus velit molestie a. Suspendisse ut lectus nec nibh posuere commodo. Aliquam id purus eros. Quisque condimentum enim vitae odio ultricies posuere. Integer at lectus dolor. Etiam ultricies posuere neque, ut sagittis tellus tempus et. Aliquam vitae diam augue, vel vehicula tellus. Nullam dignissim magna luctus odio commodo cursus. Aenean magna justo, interdum in ultricies vitae, tincidunt at risus. Vivamus elit magna, sagittis a egestas non, suscipit a mi. Nam blandit, mauris nec adipiscing egestas, neque risus vestibulum lacus, eu iaculis lacus dui id sapien. Cras vitae nunc felis, sit amet fermentum est. Suspendisse dui ligula, sodales nec varius eget, cursus et urna. Ut eget turpis non lorem rutrum interdum. Morbi bibendum convallis adipiscing. Nam commodo, lectus lobortis feugiat ullamcorper, dui mi tincidunt tellus, a consectetur quam odio eget urna. Fusce adipiscing congue ipsum et luctus. Quisque nisi eros, porttitor nec tempor non, ultrices eget mi. Sed ac magna sit amet nulla facilisis porttitor non eget odio. Cras blandit tempus urna, quis molestie ante bibendum sit amet. Proin id cursus leo. Aenean malesuada bibendum turpis, in vehicula purus gravida sed. Suspendisse potenti. Curabitur dapibus, eros ut dapibus mattis, turpis nibh convallis nulla, et commodo nibh eros eu diam. Nunc nisl sem, rhoncus eget lobortis a, fringilla vel lorem. Curabitur vitae massa et est rhoncus dictum sit amet nec nisl. Maecenas id orci leo. Curabitur id auctor sapien. Praesent ac malesuada nunc. In leo libero, sollicitudin sed feugiat sit amet, feugiat non augue. Donec faucibus, augue vel rutrum scelerisque, sem erat posuere libero, vitae accumsan turpis justo vitae felis. Suspendisse bibendum auctor eros non semper. Sed in porta ipsum. Fusce ipsum mauris, porta eu sodales laoreet, suscipit ac urna. Etiam quam nunc, vestibulum a tempor dignissim, accumsan consequat lorem. Vivamus sed massa tortor. Curabitur odio ante, semper vitae sollicitudin eu, accumsan non sapien. Donec malesuada leo quis neque interdum at tristique nibh consequat. Suspendisse tincidunt dapibus elit et tincidunt. Sed ut massa eu ipsum imperdiet scelerisque dictum id ante. Duis iaculis congue purus, eu dictum risus varius ac. Pellentesque leo arcu, iaculis in eleifend in, elementum mollis augue. Donec vitae mi justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce ut nisi est, ut tempor ante. Donec nisi nisl, accumsan sed pellentesque et, pellentesque at ipsum. Ut in nibh ipsum. Morbi orci nisi, tempor eu accumsan ac, vehicula consectetur dui. Aenean accumsan leo vitae enim posuere vel commodo neque adipiscing. Sed felis odio, tempor quis convallis a, lacinia non metus. Maecenas euismod egestas arcu, sed luctus felis tincidunt eu. In mollis accumsan tellus venenatis dignissim. Quisque ultrices malesuada quam, at luctus est lobortis sed. Etiam aliquam est euismod mauris feugiat nec cursus sem ornare. Etiam molestie luctus dolor, nec laoreet lacus lacinia id. Fusce posuere aliquet orci quis tincidunt. Nunc fermentum tincidunt sollicitudin. Pellentesque et lacinia massa. Mauris id elit nisi. Donec et luctus nulla. Mauris pretium, ante sed porta ultrices, metus metus interdum risus, nec mollis quam elit et neque. Nulla sed sem sapien, eget feugiat nibh. Pellentesque ornare mollis dui, a porta turpis facilisis vel. Ut consequat interdum venenatis. Integer ac fermentum sapien. Fusce quis nulla eu leo pellentesque ornare ut a orci. Morbi id nibh sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi faucibus rhoncus sodales. Vivamus elit urna, ultricies ac dapibus non, congue quis arcu. Cras condimentum ipsum et nisl pellentesque eu cursus justo congue. Quisque vitae lacus ac sapien imperdiet ullamcorper. Duis ac est et felis pulvinar consequat porttitor ut massa. Nunc porttitor pharetra orci, non aliquam magna aliquam sit amet. Etiam non enim ut justo blandit congue et a nibh. Maecenas ac lorem at justo tempus vehicula at nec risus. Etiam venenatis semper lectus vel faucibus. Fusce nec sem at libero euismod laoreet quis vel dui."; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView bodyField = new TextView(this); // bodyField.setHorizontallyScrolling(false); No effect bodyField.setText(LONG_TEXT); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(bodyField, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); ScrollView scrollView = new ScrollView(this); scrollView.setFillViewport(true); scrollView.addView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); setContentView(scrollView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } } ``` Screenshots: Eclair: ![2.1 emulator screenshot](https://i.stack.imgur.com/6rcxA.png) Froyo: ![2.2 emulator screenshot](https://i.stack.imgur.com/Q4ZUd.png) Any ideas how I can make this work on Eclair? I need to support Eclair and up for my application. Thanks in advance! I usually do programmatic UI generation because of the extreme run-time customization required of my real application, but by request here's an XML version that exhibits the same behavior. Again I tried it with and without the `scrollHorizontally="false"` attribute with no difference. longtext.xml: ``` <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TextView android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollHorizontally="false" /> </LinearLayout> </ScrollView> ``` LongtextActivity.java: ``` package com.example.longtext; import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ScrollView; import android.widget.TextView; public class LongtextActivity extends Activity { private static final String LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eleifend sodales vulputate. Aenean quis mattis tellus. Morbi fringilla sagittis turpis, scelerisque tempus velit molestie a. Suspendisse ut lectus nec nibh posuere commodo. Aliquam id purus eros. Quisque condimentum enim vitae odio ultricies posuere. Integer at lectus dolor. Etiam ultricies posuere neque, ut sagittis tellus tempus et. Aliquam vitae diam augue, vel vehicula tellus. Nullam dignissim magna luctus odio commodo cursus. Aenean magna justo, interdum in ultricies vitae, tincidunt at risus. Vivamus elit magna, sagittis a egestas non, suscipit a mi. Nam blandit, mauris nec adipiscing egestas, neque risus vestibulum lacus, eu iaculis lacus dui id sapien. Cras vitae nunc felis, sit amet fermentum est. Suspendisse dui ligula, sodales nec varius eget, cursus et urna. Ut eget turpis non lorem rutrum interdum. Morbi bibendum convallis adipiscing. Nam commodo, lectus lobortis feugiat ullamcorper, dui mi tincidunt tellus, a consectetur quam odio eget urna. Fusce adipiscing congue ipsum et luctus. Quisque nisi eros, porttitor nec tempor non, ultrices eget mi. Sed ac magna sit amet nulla facilisis porttitor non eget odio. Cras blandit tempus urna, quis molestie ante bibendum sit amet. Proin id cursus leo. Aenean malesuada bibendum turpis, in vehicula purus gravida sed. Suspendisse potenti. Curabitur dapibus, eros ut dapibus mattis, turpis nibh convallis nulla, et commodo nibh eros eu diam. Nunc nisl sem, rhoncus eget lobortis a, fringilla vel lorem. Curabitur vitae massa et est rhoncus dictum sit amet nec nisl. Maecenas id orci leo. Curabitur id auctor sapien. Praesent ac malesuada nunc. In leo libero, sollicitudin sed feugiat sit amet, feugiat non augue. Donec faucibus, augue vel rutrum scelerisque, sem erat posuere libero, vitae accumsan turpis justo vitae felis. Suspendisse bibendum auctor eros non semper. Sed in porta ipsum. Fusce ipsum mauris, porta eu sodales laoreet, suscipit ac urna. Etiam quam nunc, vestibulum a tempor dignissim, accumsan consequat lorem. Vivamus sed massa tortor. Curabitur odio ante, semper vitae sollicitudin eu, accumsan non sapien. Donec malesuada leo quis neque interdum at tristique nibh consequat. Suspendisse tincidunt dapibus elit et tincidunt. Sed ut massa eu ipsum imperdiet scelerisque dictum id ante. Duis iaculis congue purus, eu dictum risus varius ac. Pellentesque leo arcu, iaculis in eleifend in, elementum mollis augue. Donec vitae mi justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce ut nisi est, ut tempor ante. Donec nisi nisl, accumsan sed pellentesque et, pellentesque at ipsum. Ut in nibh ipsum. Morbi orci nisi, tempor eu accumsan ac, vehicula consectetur dui. Aenean accumsan leo vitae enim posuere vel commodo neque adipiscing. Sed felis odio, tempor quis convallis a, lacinia non metus. Maecenas euismod egestas arcu, sed luctus felis tincidunt eu. In mollis accumsan tellus venenatis dignissim. Quisque ultrices malesuada quam, at luctus est lobortis sed. Etiam aliquam est euismod mauris feugiat nec cursus sem ornare. Etiam molestie luctus dolor, nec laoreet lacus lacinia id. Fusce posuere aliquet orci quis tincidunt. Nunc fermentum tincidunt sollicitudin. Pellentesque et lacinia massa. Mauris id elit nisi. Donec et luctus nulla. Mauris pretium, ante sed porta ultrices, metus metus interdum risus, nec mollis quam elit et neque. Nulla sed sem sapien, eget feugiat nibh. Pellentesque ornare mollis dui, a porta turpis facilisis vel. Ut consequat interdum venenatis. Integer ac fermentum sapien. Fusce quis nulla eu leo pellentesque ornare ut a orci. Morbi id nibh sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi faucibus rhoncus sodales. Vivamus elit urna, ultricies ac dapibus non, congue quis arcu. Cras condimentum ipsum et nisl pellentesque eu cursus justo congue. Quisque vitae lacus ac sapien imperdiet ullamcorper. Duis ac est et felis pulvinar consequat porttitor ut massa. Nunc porttitor pharetra orci, non aliquam magna aliquam sit amet. Etiam non enim ut justo blandit congue et a nibh. Maecenas ac lorem at justo tempus vehicula at nec risus. Etiam venenatis semper lectus vel faucibus. Fusce nec sem at libero euismod laoreet quis vel dui."; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.longtext); TextView tv = (TextView) findViewById(android.R.id.text1); tv.setText(LONG_TEXT); } } ```
TextView not wrapping on Android 2.1 Eclair
CC BY-SA 3.0
0
2011-03-01T22:02:59.823
2018-04-10T15:03:33.887
2018-04-10T15:03:33.887
886,001
237,820
[ "android", "textview" ]
5,161,046
1
5,161,742
null
4
9,112
![enter image description here](https://i.stack.imgur.com/dPup5.jpg) Hi, I am trying to design a web site, using 5 different divs as shown above. - - - - - Can you help me about this, I tried but failed, and another issue is "B","C","D" and "e" should be in the center always when resizing the window or with different screen resolutions "" and y "" should resize when resizing the window. : between left wall to "B" : between C and right wall
html div positions and display
CC BY-SA 2.5
0
2011-03-01T22:12:59.983
2013-12-11T07:22:09.190
null
null
326,947
[ "html" ]
5,161,467
1
5,161,638
null
0
3,235
I was wondering if you could give me some helpful hints on how to correct this issue? I have a main menu on my site, the code for it is as follows: ``` li:hover { background-color: #222222; padding-top: 8px; padding-bottom: 9px; } ``` And here's a demo of what it actually looks like: ![menu li overflow in browsers other than IE](https://i.stack.imgur.com/C349W.png) The problem is that when I hover over a menu option (li), the background appears, but it overflows to the outside of the menu's background, and makes it look really dodgy/crap/cheap/yuck! Note that (obviously) when I change the padding to make it display correctly in these browsers, it appears too small in height in IE! So I'm screwed either way. How can I make little imperfections like this look the same in all browsers? # Update: HTML (The menu): ``` <ul class="menu"> <li class="currentPage" href="index.php"><a>Home</a></li> <li><a href="services.php">Services</a></li> <li><a href="support.php">Support</a></li> <li><a href="contact.php">Contact Us</a></li> <li><a href="myaccount/" class="myaccount">My Account</a></li> </ul> ``` The CSS: ``` .menu { margin-top: 5px; margin-right: 5px; width: 345px; float: right; } li { font-size: 9pt; color: whitesmoke; padding-left: 6px; padding-right: 8px; display: inline; list-style: none; } li:hover { background-color: #222222; padding-top: 8px; padding-bottom: 9px; } ```
Cross-browser padding/margins
CC BY-SA 2.5
null
2011-03-01T23:01:13.650
2011-03-01T23:31:37.153
2011-03-01T23:12:39.233
null
null
[ "html", "css", "internet-explorer", "cross-browser" ]
5,161,465
1
null
null
119
53,749
I am animating a `CALayer` along a `CGPath` (QuadCurve) quite nicely in iOS. But I'd like to use a more interesting easing function than the few [provided](https://developer.apple.com/library/archive/#documentation/Cocoa/Reference/CAMediaTimingFunction_class/Introduction/Introduction.html#//apple_ref/doc/constant_group/Predefined_Timing_Functions) by Apple (EaseIn/EaseOut etc). For instance, a bounce or elastic function. These things are possible to do with MediaTimingFunction (bezier): ![enter image description here](https://i.stack.imgur.com/cxJuW.png) But I'd like to create that are more complex. Problem is that media timing seems to require a cubic bezier which is not powerful enough to create these effects: [](https://i.stack.imgur.com/IIZqM.png) [sparrow-framework.org](http://wiki.sparrow-framework.org/_media/manual/transitions.png) The [code](https://github.com/PrimaryFeather/Sparrow-Framework/blob/master/sparrow/src/Classes/SPTransitions.m#L86) to create the above is simple enough in other frameworks, which makes this very frustrating. Note that the curves are mapping input time to output time (T-t curve) and not time-position curves. For instance, returns a new . Then that is used to plot the movement (or whatever property we should animate). `CAMediaTimingFunction` Here is a concrete example in to steps. Very educational :) 1. I want to animate an object along a line from point a to b, but I want it to "bounce" its movement along the line using the easeOutBounce curve above. This means it will follow the exact line from a to b, but will accelerate and decelerate in a more complex way than what is possible using the current bezier-based CAMediaTimingFunction. 2. Lets make that line any arbitrary curve movement specified with CGPath. It should still move along that curve, but it should accelerate and decelerate the same way as in the line example. In theory I think it should work like this: Lets describe the movement curve as a keyframe animation , where is time [0..1], is position calculated at time . So returns the position at the start of curve, the exact middle and at end. Using a an timing function to provide the values for should give me what I want. For a bouncing effect, the timing function should return the same values for and (just an example). Just replace the timing function to get a different effect. (Yes, it's possible to do line-bouncing by creating and joining four line segments which goes back and forth, but that shouldn't be necessary. After all, it's just a simple linear function which maps values to positions.) I hope I'm making sense here.
How to create custom easing function with Core Animation?
CC BY-SA 4.0
0
2011-03-01T23:01:05.440
2020-03-29T21:30:04.017
2019-08-09T05:14:02.997
4,751,173
53,328
[ "iphone", "cocoa-touch", "core-animation", "tween" ]
5,161,543
1
5,161,752
null
1
1,524
I have a `CSliderCtrl` and to give the users more information about what they are selecting I wish to have simple text below each Tic to display it's value. I have done this with simple statics as shown here. ![Slider Tic Labels](https://i.stack.imgur.com/AGzuW.png) However these are statically placed and I am concerned that under different themes and versions of Windows these will not be aligned correctly. Is there a way to have the `CSliderCtrl` print these labels or a way to get the co-ordinates of the Tic marks so that I can align them correctly.
CSliderCtrl tic labels
CC BY-SA 2.5
null
2011-03-01T23:09:59.170
2011-03-01T23:42:49.073
null
null
1,675
[ "mfc" ]
5,161,872
1
5,161,928
null
2
309
Works fine in Chrome/Safari, but in FF and IE the very bottom black bar text (with copyright) the text is not aligned centrally for some reason. [Working Demonstration URL](http://69.24.73.172/demos/index.html) HTML: ``` <div class="copyright"> Copyright &copy; 2011 Scirra.com. All rights reserved. </div> </body> </html> ``` CSS: ``` .copyright { color: white; text-align:center; background-color: #000000; font-size: 12px; padding: 3px; } ``` Answer solves the alignment, but firefox only has the horizontal scroll bug: ![enter image description here](https://i.stack.imgur.com/coqms.png)
Text not centrally aligned in IE and FF
CC BY-SA 2.5
null
2011-03-01T23:51:57.077
2011-03-02T00:43:50.487
2011-03-02T00:20:55.917
356,635
356,635
[ "html", "css", "cross-browser", "text-align" ]
5,162,088
1
5,162,223
null
4
16,886
I am trying to play a youtube video in a Video View. I have laid out the xml like this: ``` <VideoView android:id="@+id/VideoView" android:layout_height="fill_parent" android:layout_width="fill_parent" /> ``` and the code is like this: ``` setContentView(R.layout.webview); VideoView vv = (VideoView) findViewById(R.id.VideoView); MediaController mc=new MediaController(this); mc.setEnabled(true); mc.show(0); vv.setMediaController(mc); vv.setVideoURI(Uri.parse("http://www.youtube.com/watch?v=XS998HaGk9M")); vv.requestFocus(); vv.showContextMenu(); vv.start(); ``` I have added the permission within the manifest. When I load the application a dialog appears stating the video cannot be played. I would appreciate any advice on this. Thanks ![enter image description here](https://i.stack.imgur.com/75PgY.jpg)
Video View not playing youtube video
CC BY-SA 2.5
0
2011-03-02T00:28:22.163
2012-06-06T14:49:33.383
null
null
608,658
[ "android", "android-videoview" ]
5,162,126
1
5,171,134
null
3
173
It appears that creating a public property (that returns an anonymous object) in your code-behind of type 'dynamic' and exposing it to your aspx page converts the variable to type 'object'. Is this correct? Anytime I try to do this I get an exception saying > 'object' does not contain a definition for val1 Here is an example: ``` public dynamic showMe { get { return new { val1 = 5, val2 = "This is val2", val3 = new List<int>(){1,2,3,4,5} }; } } ``` On the ASPX page I have: ``` <h2><%= showMe.val1 %></h2> ``` and with this image you can see that on my aspx page it does indeed know about the properties inside the dynamic object. ![Debugger on aspx page showing the contents of showMe](https://i.stack.imgur.com/xONTB.jpg) Does anyone know of a way to refer to properties of anonymous objects via embedded code, or is it simply not possible with the type system? Thanks.
Using a c# variable of type dynamic in embedded code
CC BY-SA 2.5
null
2011-03-02T00:33:34.703
2018-06-25T07:22:12.473
2018-06-25T07:22:12.473
584,518
16,508
[ "c#", "asp.net", ".net" ]
5,162,164
1
5,162,202
null
2
152
Quite simple really. I'm curious what programmers and developers use to promote their mobile apps on said device on a web page. I basically am trying to recreate something like this ![example](https://i.stack.imgur.com/ceNNC.png) [http://www.line2.com/images/01_Home.png](http://www.line2.com/images/01_Home.png) I doubt the guy/gal actually just starts the app on the mobile device and takes a pic of it. Is this just photoshop?
Create an image of an iphone with a mobile app splashscreen?
CC BY-SA 3.0
null
2011-03-02T00:39:25.203
2011-11-30T03:36:05.133
2011-11-30T03:36:05.133
234,976
640,358
[ "graphics" ]
5,162,213
1
5,162,576
null
2
2,236
I try to extract coefficient from equations (system of equations) into list (matrix). I have tried `CoefficientList[poly, {var1, var2, ...}]` but without success. This simple example should explain my problem: ``` Eq1 = a D[U[x1, x2], {x1, 2}] + b D[V[x1, x2], {x2, 2}] ``` ![reproduce problem](https://i.stack.imgur.com/I91iq.png) Any advice? Daniel's Lichtblau solution is very clear (thanks you), but what if the equation that looks like this? ``` Eq1 = a D[U[x1, x2], {x1, 2}] + b D[V[x1, x2], {x2, 2}] + c W[x1, x2] ``` A simple example can be resolved as follows: ![additional question](https://i.stack.imgur.com/hHZHU.png) Is there any more elegant solution? (particularly for more complex expressions) Ps I can't understand why, but this solution gives me the correct result. ![reproduce problem](https://i.stack.imgur.com/eDOuR.png)
List/matrix of coefficients equation (system of equations)
CC BY-SA 2.5
0
2011-03-02T00:46:26.667
2011-03-02T21:18:47.740
2011-03-02T21:18:47.740
364,358
364,358
[ "wolfram-mathematica" ]
5,162,405
1
5,167,640
null
2
511
How do I partially fade a rectangle or an image in xna like so: ![enter image description here](https://i.stack.imgur.com/t2p43.png) I'm using xna 3.1 and `SpriteBatch.Draw()`. I need it to be partially transparent so I can see what is behind it.
Image/Rectangle partial fade in xna
CC BY-SA 2.5
0
2011-03-02T01:23:46.573
2011-03-03T04:09:07.307
null
null
400,861
[ "xna" ]
5,162,458
1
null
null
3
8,958
I'm trying to control some RGB LEDs and fade from red to violet. I'm using an HSV to RGB conversion so that I can just sweep from hue 0 to hue 300 (beyond that it moves back towards red). The problem I noticed though is that it seems to spend far to much time in the cyan and blue section of the spectrum. So I looked up what the HSV spectrum is supposed to look like, and found thisL ![enter image description here](https://i.stack.imgur.com/BE73L.png) I didn't realize that more than half the spectrum was spent between green and blue. But I'd really like it to look much more like this: ![enter image description here](https://i.stack.imgur.com/pm7ie.jpg) With a nice even blend of that "standard" rainbow colors. I'd imagine that this would end up being some sort of s-curve of the normal hue values, but am not really sure how to calculate that curve. An actual HSV to RGB algorithm that handles this internally would be great (any code really, though it's for an Arduino) but even just an explanation of how I could calculate that hue curve would be greatly appreciated.
Fade through more more natural rainbow spectrum in HSV/HSB
CC BY-SA 2.5
0
2011-03-02T01:31:54.657
2018-07-30T02:59:09.420
null
null
194
[ "colors", "rgb", "hsv" ]
5,162,560
1
null
null
0
2,924
I have a maven project in Hudson that builds with the following build options: ![Screenshot of Hudson maven config](https://i.stack.imgur.com/628zB.gif) The build often fails with an OutOfMemoryError: Java heap space but I don't know why. The failure looks like this: ``` [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 38 seconds [INFO] Finished at: Mon Feb 28 17:04:28 EST 2011 [INFO] Final Memory: 48M/95M [INFO] ------------------------------------------------------------------------ channel stopped Deploying artifacts to http://test/archiva/repository/snapshots Deploying the main artifact pom.xml [INFO ] Retrieving previous build number from test-archiva-default [INFO ] Uploading project information for home-buildings 2.0-SNAPSHOT [INFO ] Retrieving previous metadata from test-archiva-default [INFO ] Uploading repository metadata for: 'snapshot com.test.home:core:2.0-SNAPSHOT' [INFO ] Retrieving previous metadata from test-archiva-default [INFO ] Uploading repository metadata for: 'artifact com.test.home:core' Deploying the main artifact core.ear [INFO ] Retrieving previous build number from test-archiva-default [INFO ] Retrieving previous metadata from test-archiva-default [INFO ] Uploading repository metadata for: 'snapshot com.test.home:core-ear:2.0-SNAPSHOT' [INFO ] Retrieving previous metadata from test-archiva-default [INFO ] Uploading repository metadata for: 'artifact com.test.home:core-ear' [INFO ] Uploading project information for core-ear 2.0-SNAPSHOT Deploying the main artifact core.war [INFO ] Retrieving previous build number from test-archiva-default FATAL: Java heap space java.lang.OutOfMemoryError: Java heap space ``` Does anyone have any idea of how to stop this from occurring?
Hudson -> java.lang.OutOfMemoryError: Java heap space on maven clean test package -P deploy in Hudson
CC BY-SA 2.5
0
2011-03-02T01:47:49.903
2011-03-02T02:02:35.777
null
null
205,971
[ "maven", "hudson", "out-of-memory" ]
5,162,950
1
5,163,480
null
24
36,702
I created a map where a user inputs a zipcode and a radius (miles) and I want the map to center on the point created from the zipcode and only display (roughly) the area that would be within that radius. I am creating a Circle with the radius and trying to get the map to fit to that circle. Right now it centers correctly but the area being shown is way more than the radius given. ``` me.center_map = function(latlng, r) { // latlng is the point of the zipcode var circ = new google.maps.Circle(); circ.setRadius(r * 1609.0); circ.setCenter(latlng); map.setCenter(latlng); map.fitBounds(circ.getBounds()); // updates markers google.maps.event.trigger(map,'dragend'); }; ``` Drew the circle that I am using. Ideally the map would be zoomed in to the area within the radius. ![enter image description here](https://i.stack.imgur.com/VUlQe.png)
Google Maps API v3 set zoom level to show a given radius?
CC BY-SA 2.5
0
2011-03-02T03:02:22.063
2021-05-05T07:41:48.853
null
null
49,887
[ "javascript", "google-maps" ]
5,162,972
1
5,163,025
null
2
3,991
I have data aggregator, organize the data from different source by specific manner. Sometimes the images given in the source type is not available or the source refused to serve the images. In this case, I want to remove the space given for image tag. Is it possible? ![enter image description here](https://i.stack.imgur.com/XP7wY.png) I want to hide the highlighted area space when no image found or serve refused to serve the image.
How to hide space for image when no images found in the server?
CC BY-SA 2.5
null
2011-03-02T03:06:48.033
2018-01-29T09:20:54.107
null
null
null
[ "html", "css" ]
5,163,026
1
5,163,045
null
0
188
i've seen this cool kind of menu in different apps, so i guess it is part of the android SDK. but i could not figure out its name. anyone already used it and knows how to create it? ![Drop-out menu](https://i.stack.imgur.com/NwfYE.png)
What's the name of this drop-out menu?
CC BY-SA 2.5
null
2011-03-02T03:15:50.990
2011-03-02T03:30:49.580
null
null
356,224
[ "android", "menu" ]
5,163,055
1
5,163,076
null
1
4,656
![enter image description here](https://i.stack.imgur.com/PIhwT.png) example:I want delete friendsmap.
How can I delete a folder under Google Code SVN?
CC BY-SA 2.5
0
2011-03-02T03:24:42.437
2012-11-07T10:33:29.453
2012-07-25T07:47:06.880
1,374,267
515,568
[ "svn", "google-code" ]
5,163,175
1
5,163,252
null
1
1,584
I am joining two tables using SQL. I'm joining a table which contains charter flight information and a table which contains the crew assigned. In my results, I only want to display the rows that only have a value of "Pilot" in the the crew table and not "Copilot" or both. ![enter image description here](https://i.stack.imgur.com/BV9FL.png)
SQL JOIN limit results to rows where specific value does not exist
CC BY-SA 2.5
null
2011-03-02T03:49:36.487
2011-03-02T05:25:13.223
2011-03-02T04:01:45.343
492,536
492,536
[ "sql", "join", "where-clause" ]
5,163,425
1
5,163,586
null
1
139
Eclipse allows to show more than one code editor at the same time... so you can have something like this: ![enter image description here](https://i.stack.imgur.com/Fe4Gl.png) Can I do something like that using IntelliJ Idea?
How to show two or more editors at the same time?
CC BY-SA 2.5
0
2011-03-02T04:33:53.180
2011-03-14T18:40:11.187
null
null
244,296
[ "java", "intellij-idea" ]
5,163,484
1
5,163,656
null
1
3,389
Recently I found about this tool `easy_install` that help me to easy install additional python modules. The problem is that for each module it creates additional `*.egg` folder (sometime there is only an egg file?) (no source?) and I don't know how to setup eclipse paths. By default I have included `C:\Python26\Lib\site-packages` and this is enough when I install python modules from source... but not when I'm using `easy_intall` For example `django` instaled with `easy_install` is located in `C:\Python26\Lib\site-packages\django-1.2.5-py2.6.egg\django` and installed from source it's located in `C:\Python26\Lib\site-packages\django` In fact when I'm using `easy_install` all installed modules are working without a problem, the only problem is that eclipse can't locate where is the source and gives me a false unresolved import errors Where I'm wrong? ![Eclipse Setup](https://i.stack.imgur.com/1dxQS.png)
Easy Install for Python and Eclipse Library Paths
CC BY-SA 2.5
null
2011-03-02T04:44:45.923
2011-03-02T05:16:14.503
2011-03-02T04:50:54.570
44,537
44,537
[ "python", "eclipse", "easy-install" ]
5,163,622
1
5,163,721
null
0
322
![this is the web page](https://i.stack.imgur.com/EYJc3.jpg) when i click on the page a line equal to the height of table start blinking on left side of the page. i want to remove that blinking any one can help me ?
blinking line in web page
CC BY-SA 2.5
null
2011-03-02T05:10:27.047
2011-03-02T05:25:32.540
null
null
543,154
[ "html", "css" ]
5,163,797
1
5,163,807
null
1
1,172
I am using Apple Push Notification in my application. when my application is installed on device i want application to ask user if they want allow application to use notification or not, how can i implement so? something like this application. ![enter image description here](https://i.stack.imgur.com/O8VOb.png) Thanks.
alert for allow or dont allow Apple push notification in iphone application
CC BY-SA 2.5
0
2011-03-02T05:36:12.093
2012-04-10T16:49:02.790
null
null
392,924
[ "iphone", "apple-push-notifications" ]
5,164,411
1
null
null
2
470
I'm trying to size the rows of a NSTableView to exactly 9 rows fit. I've tried `[menuTableView setRowHeight:floor(menuRect.size.height / 9)];` and I've tried `[menuTableView setRowHeight:(menuRect.size.height / 9)];` and `[menuTableView setRowHeight:ceil(menuRect.size.height / 9)];` but all of them have the same issue, if I've selected row 0 then row 9 is clipped at the bottom and if I select row 9 then row 0 is clipped at the top. How can I set up a NSTableView to show 9 full rows so no matter what there is never a partial row visible? Thanks, : Yes menuRect is the frame for the menuTableView : Below is the full method I use to position the NSTableView and set the row height I've tried to remove any rounding issues with the use of the `rowHeight` variable. You can see with the attached screen shot that the last row isn't fully displayed ``` - (void) updateGUIPositions { NSRect screenRect = [self frame]; NSRect menuRect; // Set the menu location on screen NSInteger spacer = screenRect.size.width / 9; menuRect.size.width = floor(screenRect.size.width - (spacer * 3)) / 2; menuRect.size.height = ceil(screenRect.size.height - (spacer * 2)); NSInteger rowHeight = menuRect.size.height / 9; menuRect.size.height = rowHeight * 9; menuRect.origin.x = menuRect.size.width + (spacer * 2); menuRect.origin.y = spacer; [menuScrollView setFrame:menuRect]; // Setup the row height [menuTableView setRowHeight:rowHeight]; } ``` ![enter image description here](https://i.stack.imgur.com/OxVK8.png)
NSTableView - Trying to fit exactly 9 rows
CC BY-SA 2.5
null
2011-03-02T07:05:07.380
2011-10-21T18:44:12.363
2011-03-02T07:30:19.267
308,079
308,079
[ "objective-c", "nstableview" ]
5,164,769
1
null
null
0
3,789
I've tried to use Ajax Control Tool Kits on SharePoint 2010 Web Site, but Im having some trouble with registration. I've searched a lot on google for a solution. I've found some ways, but my problem is not solved. When I open my web site, still getting registration error. ![enter image description here](https://i.stack.imgur.com/oVSiF.jpg) The problem is registration of Ajax Tool Kit. Here is my steps. 1 - Downloaded Ajax Control Tool Kit latest version. 2 - Added following line to my page ``` <%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> ``` 3 - Added following line to my master page (v4.master) ``` <%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> ``` 4 - Replaced this tag ``` <asp:ScriptManager> ``` with ``` <ajaxToolkit:ToolkitScriptManager> ``` but problem not solved.. Still getting same registration error. I need your suggestions about implementing Ajax Control Tool Kits on Share Point 2010. Thank you.
How to register Ajax Tool Kit to SharePoint 2010
CC BY-SA 2.5
null
2011-03-02T07:50:02.847
2011-03-02T08:00:44.917
null
null
378,765
[ "c#", "asp.net", "sharepoint-2010", "ajaxcontroltoolkit" ]
5,165,132
1
5,170,937
null
1
798
The problem is that when I tried to use "<<" operator, ruby mode thinks this as an error and all codes below lost their syntax highlights, similar situation to lost brackets or quotes. Anyway to solve this?? Emacs 22 23 both applies. As shown below: ![enter image description here](https://i.stack.imgur.com/4t14t.png)
emacs syntax highlight under ruby mode won't work with "<<" operator
CC BY-SA 3.0
null
2011-03-02T08:38:08.357
2011-08-04T05:58:31.090
2011-08-04T05:58:31.090
323,941
323,941
[ "ruby", "emacs" ]
5,165,193
1
5,168,050
null
2
149
I want to mapping following simple entities: ``` public class AnimalsOwner { public AnimalsOwner() { Cats = new List<Cat>(); Dogs = new List<Dog>(); } public virtual int Id { get; set; } public virtual IList<Cat> Cats { get; set; } public virtual IList<Dog> Dogs { get; set; } } public abstract class Animal { public virtual int Id { get; set; } public virtual AnimalsOwner AnimalsOwner { get; set; } } public class Dog : Animal { public virtual string DogsProperty { get; set; } } public class Cat : Animal { public virtual string CatsProperty { get; set; } } ``` With the following mappings: ``` public OwnerMapping() { this.Table("Owners"); Id(x => x.Id) .GeneratedBy.Native(); HasMany(x => x.Cats).AsBag().Cascade.SaveUpdate(); HasMany(x => x.Dogs).AsBag().Cascade.SaveUpdate(); } } public class AnimalMapping : ClassMap<Animal> { public AnimalMapping() { this.Table("Animals"); Id(x => x.Id).GeneratedBy.Native(); References(x => x.AnimalsOwner).Not.Nullable(); } } public class DogMap : SubclassMap<Dog> { public DogMap() { this.Table("Dogs"); this.KeyColumn("AnimalId"); Map(x => x.DogsProperty); } } public class CatMap : SubclassMap<Cat> { public CatMap() { this.Table("Cats"); this.KeyColumn("AnimalId"); Map(x => x.CatsProperty); } } ``` With such mappings everything works fine, but generated schema looks like following: ![Db schema](https://i.stack.imgur.com/sgFJa.png) And such code: ``` var owner = new AnimalsOwner(); owner.Cats.Add(new Cat() { AnimalsOwner = owner, CatsProperty = "cat" }); ``` Makes inserts in all three tables (Animals, Cats, Dogs) of column OwnderId. But isn't it enough to have it only in Animals table? If yes then how to achieve it? If NHibernate acts as expected then why is he doing such a duplication?
Nhibernate duplicating column
CC BY-SA 2.5
null
2011-03-02T08:44:58.653
2011-03-02T13:23:08.223
null
null
72,174
[ "c#", ".net", "nhibernate", "fluent-nhibernate", "nhibernate-mapping" ]
5,165,390
1
null
null
0
652
i am using a seek bar in my application.When i drag the seek bar into the the lay out, it is coming very short. that is i can seek a small area. i checked in the properties, but i cant find out any property to increase the seek area.any body know means please tell me. this is the screen shot of the application ![enter image description here](https://i.stack.imgur.com/dzbqS.png)
how can i extend the seek bar
CC BY-SA 2.5
null
2011-03-02T09:10:28.040
2011-04-17T10:09:19.827
2011-03-02T09:46:04.477
607,853
607,853
[ "android", "seekbar" ]
5,165,587
1
5,179,624
null
15
6,549
I'm trying to remove the sinusoidal noise in this image: ![enter image description here](https://i.stack.imgur.com/i7w0S.png) Here is its DFT spectrum (after applying log and arbitrary intensity scaling): ![enter image description here](https://i.stack.imgur.com/S3174.png) I already have a Butterworth filter to apply to this image. It will knock out the mid-frequency peaks. I'm taking care to scale it from [0..255] to [0..1.0] after loading. Here's the filter: ![enter image description here](https://i.stack.imgur.com/YlllG.png) The results aren't great: ![enter image description here](https://i.stack.imgur.com/eSzZH.png) My questions: - - - I've taken the image (cropped) and filter from the book [Digital Image Processing](http://www.imageprocessingplace.com/) by Gonzalez and Woods. In their example, the periodic noise is completely removed by the filtering, and the mean intensity of the image remains the same. My source code for loading the image and filter, DFT, filtering, IDFT is below: ``` import cv def unshift_crop(comp, width, height): result = cv.CreateImage((width, height), cv.IPL_DEPTH_8U, 1) for x in range(height): for y in range(width): real, _, _, _ = cv.Get2D(comp, x, y) real = int(real) * ((-1)**(x+y)) cv.Set2D(result, x, y, cv.Scalar(real)) return result def load_filter(fname): loaded = cv.LoadImage(fname, cv.CV_LOAD_IMAGE_GRAYSCALE) flt = cv.CreateImage(cv.GetSize(loaded), cv.IPL_DEPTH_32F, 2) width, height = cv.GetSize(loaded) for i in range(width*height): px, _, _, _ = cv.Get1D(loaded, i) #cv.Set1D(flt, i, cv.Scalar(px/255.0, 0)) cv.Set1D(flt, i, cv.Scalar(px/255.0, px/255.0)) return flt if __name__ == '__main__': import sys fname, filt_name, ofname = sys.argv[1:] img = cv.LoadImage(fname, cv.CV_LOAD_IMAGE_GRAYSCALE) width, height = cv.GetSize(img) src = cv.CreateImage((width*2, height*2), cv.IPL_DEPTH_32F, 2) dst = cv.CreateImage((width*2, height*2), cv.IPL_DEPTH_32F, 2) cv.SetZero(src) for x in range(height): for y in range(width): px, _, _, _ = cv.Get2D(img, x, y) px = float(px) * ((-1) ** (x+y)) cv.Set2D(src, x, y, cv.Scalar(px, 0)) cv.DFT(src, dst, cv.CV_DXT_FORWARD) flt = load_filter(filt_name) cv.Mul(dst, flt, src) cv.DFT(src, dst, cv.CV_DXT_INV_SCALE) result = unshift_crop(dst, width, height) cv.SaveImage(ofname, result) ``` There was a bug in the original source where the filter imaginary components were loaded as zero. This is what caused the result image to appear darker than it really was. I've fixed this and commented the related line. Using the fixed source and the filter that @0x69 provided (yeah, I know it's not really a Butterworth filter, but at this stage I'm happy to try anything), this is the result: ![enter image description here](https://i.stack.imgur.com/qijv7.png) Better than what I had to start with, but still not as good as I'm hoping for. Can anyone beat this? I suspect putting more notches in to take out the remaining peaks may be of some benefit. I've contacted the author. This is their response: > The problem is that the image used in the experiment was floating point, while the one shown in the book (and the original provided in the downloads) are 8 bits. This is required for printing, etc.In order to duplicate the experiment, you have to start with the noise-free image and then add your own noise to it.
Removing sinusoidal noise with Butterworth filter
CC BY-SA 2.5
0
2011-03-02T09:31:41.627
2018-12-17T05:42:11.447
2011-03-07T04:27:05.430
356,020
356,020
[ "python", "image-processing", "opencv" ]
5,165,682
1
null
null
62
52,553
Is there an easy way to create expandable/collapsible blocks like seen in official market app? Screenshot of Market app, when you click on "More" button, the description section expands with animation: ![enter image description here](https://i.stack.imgur.com/0hqno.jpg) I know of [SlidingDrawer](http://developer.android.com/reference/android/widget/SlidingDrawer.html) but it doesn't seem to be suited for stuff like this--it's supposed to be put in overlay, and doesn't support half-open states. Here's my half-working solution. It's a custom widget that extends `LinearLayout`. It kind-of works, but doesn't handle edge cases well, like content height smaller than `collapsedHeight` parameter. I'm sure with enough staring, digging in code and experimenting the quirks could be fixed. Was hoping to avoid doing that, and save some time by using a ready-made official or 3rd party solution. Anyway, here it is, code: ``` package com.example.androidapp.widgets; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.LinearLayout; import com.example.androidapp.R; public class ExpandablePanel extends LinearLayout { private final int mHandleId; private final int mContentId; private View mHandle; private View mContent; private boolean mExpanded = true; private int mCollapsedHeight = 0; private int mContentHeight = 0; public ExpandablePanel(Context context) { this(context, null); } public ExpandablePanel(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ExpandablePanel, 0, 0); // How high the content should be in "collapsed" state mCollapsedHeight = (int) a.getDimension( R.styleable.ExpandablePanel_collapsedHeight, 0.0f); int handleId = a.getResourceId(R.styleable.ExpandablePanel_handle, 0); if (handleId == 0) { throw new IllegalArgumentException( "The handle attribute is required and must refer " + "to a valid child."); } int contentId = a.getResourceId(R.styleable.ExpandablePanel_content, 0); if (contentId == 0) { throw new IllegalArgumentException( "The content attribute is required and must refer " + "to a valid child."); } mHandleId = handleId; mContentId = contentId; a.recycle(); } @Override protected void onFinishInflate() { super.onFinishInflate(); mHandle = findViewById(mHandleId); if (mHandle == null) { throw new IllegalArgumentException( "The handle attribute is must refer to an" + " existing child."); } mContent = findViewById(mContentId); if (mContent == null) { throw new IllegalArgumentException( "The content attribute is must refer to an" + " existing child."); } mHandle.setOnClickListener(new PanelToggler()); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mContentHeight == 0) { // First, measure how high content wants to be mContent.measure(widthMeasureSpec, MeasureSpec.UNSPECIFIED); mContentHeight = mContent.getMeasuredHeight(); } // Then let the usual thing happen super.onMeasure(widthMeasureSpec, heightMeasureSpec); } private class PanelToggler implements OnClickListener { public void onClick(View v) { Animation a; if (mExpanded) { a = new ExpandAnimation(mContentHeight, mCollapsedHeight); } else { a = new ExpandAnimation(mCollapsedHeight, mContentHeight); } a.setDuration(500); mContent.startAnimation(a); mExpanded = !mExpanded; } } private class ExpandAnimation extends Animation { private final int mStartHeight; private final int mDeltaHeight; public ExpandAnimation(int startHeight, int endHeight) { mStartHeight = startHeight; mDeltaHeight = endHeight - startHeight; } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { android.view.ViewGroup.LayoutParams lp = mContent.getLayoutParams(); lp.height = (int) (mStartHeight + mDeltaHeight * interpolatedTime); mContent.setLayoutParams(lp); } @Override public boolean willChangeBounds() { // TODO Auto-generated method stub return true; } } } ``` Here's `res/values/attrs.xml`: ``` <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="ExpandablePanel"> <attr name="handle" format="reference" /> <attr name="content" format="reference" /> <attr name="collapsedHeight" format="dimension" /> </declare-styleable> </resources> ``` And here's how I use it in layout: ``` <com.example.androidapp.widgets.ExpandablePanel android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="fill_parent" example:handle="@+id/expand" example:content="@+id/value" example:collapsedHeight="50dip"> <TextView android:id="@id/value" android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxHeight="50dip" /> <Button android:id="@id/expand" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="More" /> </com.example.androidapp.widgets.ExpandablePanel> ```
How to implement expandable panels in Android?
CC BY-SA 3.0
0
2011-03-02T09:42:30.463
2013-04-03T11:55:12.920
2011-05-23T17:56:15.510
5,821
5,821
[ "android", "widget" ]
5,165,774
1
5,165,850
null
0
1,864
i have an UISearchBar with bookmark button on right. Like this: ![enter image description here](https://i.stack.imgur.com/T7d9r.png) Now, i have a UITextField with a text on leftView and a button on right view: ![enter image description here](https://i.stack.imgur.com/PDeyA.png) I created button on textField using default buttons ``` [UIButton buttonWithType:UIButtonTypeContactAdd] ``` Is there a way to add in UITextField, on rightView, a bookmark button like the button in UISearchBar??? thanks.
Add bookmark button to UITextField.rightView?
CC BY-SA 2.5
null
2011-03-02T09:52:57.017
2011-03-02T14:00:41.250
null
null
88,461
[ "iphone", "objective-c", "ipad", "uitextfield", "uisearchbar" ]
5,166,062
1
5,166,089
null
1
695
Im unable to add a reference to System.Data.Linq to my project, I get the following error > The referenced component 'System.Data.Linq' could not be found. Even though i added it through the Add reference screen and my other projects add it without issue. This is how it looks in my project ![Failed Load](https://i.stack.imgur.com/A7I7c.png) And this is how it appears in my other project using the same reference ![Added Fine](https://i.stack.imgur.com/Qf0SK.png) Any ideas why this happens, both projects us framework 3.5 Thanks Sp
c# Linq reference unable to load
CC BY-SA 2.5
null
2011-03-02T10:22:51.467
2011-03-02T10:25:18.237
null
null
350,794
[ "c#", "linq", ".net-3.5" ]
5,166,125
1
5,167,259
null
-1
7,608
I have a report that takes a date as a parameter. If I use `=Parameters!Date.Value`, the report runs fine. However, if I use `=DateAdd("d", 1, Parameters!Date.Value)`, the report is left blank, even though the formats are exactly the same:![screenshot of what this looks like](https://i.stack.imgur.com/eDhOb.png). (Note: it simply cannot run. It's not that there are no values to return as the field names don't return either.) --- I have also tried `=DateAdd(DateInterval.Date, 1, Parameters!Date.Value)` `=DateAdd("d", 1, Parameters!Date.Value)` `=DateValue(FormatDateTime(DateAdd("d", 1, Parameters!Date.Value), DateFormat.ShortDate ))` and many variations thereof but I can't seem to crack it! --- ## Update If I use `DateInterval.Month` instead of `DateInterval.Day` then the date is still incremented as desired (12/22/2010) but the table shows up! Interesting how my local settings are and these dates are .
DateAdd() returns faulty Date in SQL Server Reporting Services
CC BY-SA 2.5
null
2011-03-02T10:28:38.763
2011-03-02T13:38:48.573
2011-03-02T13:38:48.573
106,941
106,941
[ "ssrs-2008", "dateadd" ]
5,166,170
1
5,166,219
null
0
128
I have a dropdown menu on my page but there are some problem i.e when the dropdown appear and moved down to certain limit it will disappear as shown in image. ![enter image description here](https://i.stack.imgur.com/gfn9B.png) 1 ) when the dropdown appear for Mobile App Development as shown in image and moved down to Black berry its work but when i move mouse pointer to Palm the menu disappeared.css code is``` /* menu styles */ nav, #nav ul{ margin:0; padding:0; list-style-type:none; list-style-position:outside; position:relative; line-height:1.5em; } nav a{ display:block; padding:0px 5px; border:1px solid #333; color:#fff; text-decoration:none; text-align: center; background-color:#333; width:80px; } nav a:hover{ background-color:#fff; color:#333; } nav li{ float:left; position:relative; border-right: 1px solid white; } nav ul { position:absolute; display:none; width:12em; top:1.5em; } nav li ul a{ width:12em; height:auto; float:left; } nav ul ul{ top:auto; } nav li ul ul { left:12em; margin:0px 0 0 10px; } nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul{ display:none; } nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul{ display:block; } ``` what should i do in css so that my menu will appear on my other div.
problem with multilevel menu
CC BY-SA 2.5
null
2011-03-02T10:32:27.770
2011-03-02T10:37:07.817
2011-03-02T10:37:07.817
113,208
501,751
[ "css" ]
5,166,303
1
8,972,479
null
40
2,257
Imagine the following (simplified) database layout: ![Database Layout](https://i.stack.imgur.com/mAxRf.png) We have many "holiday" records that relate to going to a particular Accommodation on a certain date etc. I would like to pull from the database the "best" holiday going to each accommodation (i.e. lowest price), given a set of search criteria (e.g. duration, departure airport etc). There will be multiple records with the same price, so then we need to choose by offer saving (descending), then by departure date ascending. I can write SQL to do this that looks like this (I'm not saying this is necessarily the most optimal way): ``` SELECT * FROM Holiday h1 INNER JOIN ( SELECT h2.HolidayID, h2.AccommodationID, ROW_NUMBER() OVER ( PARTITION BY h2.AccommodationID ORDER BY OfferSaving DESC ) AS RowNum FROM Holiday h2 INNER JOIN ( SELECT AccommodationID, MIN(price) as MinPrice FROM Holiday WHERE TradeNameID = 58001 /*** Other Criteria Here ***/ GROUP BY AccommodationID ) mp ON mp.AccommodationID = h2.AccommodationID AND mp.MinPrice = h2.price WHERE TradeNameID = 58001 /*** Other Criteria Here ***/ ) x on h1.HolidayID = x.HolidayID and x.RowNum = 1 ``` As you can see, this uses a subquery within another subquery. However, for several reasons my preference would be to achieve this same result in NHibernate. Ideally, this would be done with QueryOver - the reason being that I build up the search criteria dynamically and this is much easier with QueryOver's fluent interface. (I had started out hoping to use NHibernate Linq, but unfortunately it's not mature enough). After a lot of effort (being a relative newbie to NHibernate) I was able to re-create the very inner query that fetches all accommodations and their min price. ``` public IEnumerable<HolidaySearchDataDto> CriteriaFindAccommodationFromPricesForOffers(IEnumerable<IHolidayFilter<PackageHoliday>> filters, int skip, int take, out bool hasMore) { IQueryOver<PackageHoliday, PackageHoliday> queryable = NHibernateSession.CurrentFor(NHibernateSession.DefaultFactoryKey).QueryOver<PackageHoliday>(); queryable = queryable.Where(h => h.TradeNameId == website.TradeNameID); var accommodation = Null<Accommodation>(); var accommodationUnit = Null<AccommodationUnit>(); var dto = Null<HolidaySearchDataDto>(); // Apply search criteria foreach (var filter in filters) queryable = filter.ApplyFilter(queryable, accommodationUnit, accommodation); var query1 = queryable .JoinQueryOver(h => h.AccommodationUnit, () => accommodationUnit) .JoinQueryOver(h => h.Accommodation, () => accommodation) .SelectList(hols => hols .SelectGroup(() => accommodation.Id).WithAlias(() => dto.AccommodationId) .SelectMin(h => h.Price).WithAlias(() => dto.Price) ); var list = query1.OrderByAlias(() => dto.Price).Asc .Skip(skip).Take(take+1) .Cacheable().CacheMode(CacheMode.Normal).List<object[]>(); // Cacheing doesn't work this way... /*.TransformUsing(Transformers.AliasToBean<HolidaySearchDataDto>()) .Cacheable().CacheMode(CacheMode.Normal).List<HolidaySearchDataDto>();*/ hasMore = list.Count() == take; var dtos = list.Take(take).Select(h => new HolidaySearchDataDto { AccommodationId = (string)h[0], Price = (decimal)h[1], }); return dtos; } ``` Any ideas on how to achieve what I want using QueryOver, or if necessary Criteria API? I'd prefer not to use HQL but if it is necessary than I'm willing to see how it can be done with that too (it makes it harder (or more messy) to build up the search criteria though). If this just isn't doable using NHibernate, then I could use a SQL query. In which case, my question is can the SQL be improved/optimised?
How can I recreate this complex SQL Query using NHibernate QueryOver?
CC BY-SA 2.5
0
2011-03-02T10:42:18.597
2012-01-23T13:36:04.650
null
null
32,055
[ "nhibernate", "subquery", "queryover" ]
5,166,488
1
null
null
2
2,173
python and Tkinter are processing Unicode characters correctly. But they are not able to display Unicode encoded characters correctly. I am using Python 3.1 and Tkinter in Ubuntu. I am trying to use Tamil Unicode characters. All the processing is done correctly. But the display is wrong? Here is the Wrong display as in Tkinter ![wrong](https://i.stack.imgur.com/HF81f.png) Here is the Correct display (as in gedit) ![correct](https://i.stack.imgur.com/dVmVv.png) --- Still not solved: ``` from tkinter import * root = Tk() root.geometry('200x200') var = StringVar() label = Label( root, textvariable=var, relief=RAISED ) Entry(text="Placeholder text").pack() var.set("கற்றதனால் ஆய பயனென்கொல் வாலறிவன்\nநற்றாள்தொழாஅர் எனின். ") label.pack() root.mainloop() ``` Manjaro: [](https://i.stack.imgur.com/V1T3w.png) Windows: [](https://i.stack.imgur.com/G8r72.png)
Tkinter cannot display Unicode characters correctly in Manjaro
CC BY-SA 4.0
0
2011-03-02T10:58:10.533
2021-06-11T15:42:35.587
2021-06-11T15:19:31.017
5,033,247
641,040
[ "python", "tkinter", "unicode", "manjaro", "tamil" ]
5,166,510
1
null
null
2
6,503
How to show only a fixed number of labels in X-Axis ?? I have tried "LabelSkip", but I think it works only with an interval and not with fixed number of labels. Here is a print-screen of my chart: ![enter image description here](https://i.stack.imgur.com/krNsk.jpg)
PChart - Show a fixed number of lablels in X-Axis
CC BY-SA 3.0
null
2011-03-02T11:00:05.307
2012-06-23T15:58:53.793
2012-03-31T16:18:42.503
203,458
536,116
[ "pchart" ]
5,166,904
1
5,167,005
null
1
2,089
We use UCM for development. We create streams under streams, like this ![child_streams](https://i.stack.imgur.com/ICkhc.jpg) Question is how to find new files in a given stream. In the example "`feat1`" would have new files relative to its parent `lis1` (lis=local integration stream). The new files could be from "`feat1`" or its child streams like "`developer1`". How could I identify new files in `lis1`? One option is to create dynamic views on a stream (say feat1) and its parent stream(lis1) and take diff and figure out files new in the child stream. Another option is to use `cleartool deliver -preview` and get list of versions and then somehow (I do not know it yet) figure out the list of files. The problem is the child stream is not necessarily rebased to its parent, and we enforce a "rebase to latest baseline before delivery" rule. I hope there is a better and correct way :)
How to find new undelivered files for a given UCM "stream"
CC BY-SA 3.0
0
2011-03-02T11:36:23.983
2015-01-15T09:22:02.673
2015-01-15T09:22:02.673
6,309
54,506
[ "clearcase", "cleartool", "clearcase-ucm" ]
5,167,167
1
5,167,390
null
1
947
Stackers, I need to put shadows around my tabs previously created using [JQueryUI Tabs](http://jqueryui.com/demos/tabs/) plugin. Shadows must be on the right and top of tabs. Using moz-box-shadow or similar could be great, but my application should be view on IE too. My JQuery code (very simple): ``` $("#tabs").tabs(); ``` This is how it looks: ![Tabs](https://i.stack.imgur.com/fYAqe.jpg) Anybody know how to do this? Thanks!
JQueryUI Tabs with shadows
CC BY-SA 2.5
0
2011-03-02T12:01:51.930
2011-03-02T12:21:49.963
null
null
552,669
[ "jquery", "css", "jquery-ui", "jquery-ui-tabs", "shadow" ]
5,167,774
1
5,922,680
null
13
700
Given n integers between [0,10000] as D,D...,D, where there may be duplicates, and n can be huge: I want to find k distinct representative integers (for example k=5) between [0,10000] as R,R,...,R, so the sum of errors of all the representative integers is minimized. The error of a representative integer is defined below: Assuming we have k representative integers in ascending order as {R,R...,R}, the error of R is : ![enter image description here](https://i.stack.imgur.com/8BffW.png) and i want to minimize the sum of errors of the k representative integers: ![enter image description here](https://i.stack.imgur.com/AJlKD.png) how can this be done efficiently? The smallest of the k representative integers must be the smallest number in {D,D...,D} The largest of the k representative integers must be the largest number in {D,D...,D} plus 1. For example when the largest number in {D,D...,D} is 9787 then R is 9788. A concrete example is here: D={1,3,3,7,8,14,14,14,30} and if k=5 and R is picked as {1,6,10,17,31} then the sum of errors is : sum of errors=(1-1)+(3-1)*2+(7-6)+(8-6)+(14-10)*3+(30-17)=32 this is because 1<=1,3,3<6 , 6<=7,8<10, 10<=14,14,14<17, 17<=30<31
Minimize the sum of errors of representative integers
CC BY-SA 3.0
0
2011-03-02T12:56:39.930
2011-05-20T16:17:41.663
2011-05-12T23:59:04.877
618,728
437,472
[ "arrays", "algorithm", "optimization", "combinations" ]
5,167,805
1
6,069,964
null
1
110
Does anyone know how to open the Options context menu with keyboard shortcut? ![enter image description here](https://i.stack.imgur.com/V0f0P.png) Oh nevermind: SHIFT-ALT-F10
Visual Studio display the 'options context menu' in intellisense
CC BY-SA 2.5
null
2011-03-02T12:59:09.763
2011-05-20T09:30:33.113
null
null
168,425
[ "visual-studio", "intellisense" ]
5,167,867
1
5,173,880
null
30
35,274
I've a progressbar whose text changes dynamically. I want to update the appearance of it such that as soon as progress comes over text then text color should update. Something like this. ![enter image description here](https://i.stack.imgur.com/14C6l.png) I need text color of text (black) appearing above blue background should automatically change to white. However text having white background should remain black.
Progress bar with dynamic text & text color update
CC BY-SA 3.0
0
2011-03-02T13:05:35.360
2013-11-09T16:05:09.087
2013-11-09T16:05:09.087
351,708
351,708
[ "wpf", "progress-bar" ]
5,167,940
1
5,169,493
null
0
2,737
How can I get 5x5 Table in my iPhone application ? (Using `UICustomViewCell` I can have only one column). EDIT : I am talking about the below table. Can I get it like that in iPhone? ![Table](https://i.stack.imgur.com/DAWbE.png)
Rows and Columns in iPhone Application Programming
CC BY-SA 3.0
0
2011-03-02T13:11:48.780
2016-10-09T22:07:08.570
2016-10-09T22:07:08.570
4,370,109
380,277
[ "ios", "iphone", "xcode", "uitableview" ]
5,167,937
1
null
null
3
3,763
I am writing C# code in VS2010 to achieve the following. I am trying to draw text on a transparent bitmap and running into ugly looking text. Below is the pic of three texts (i.e. A, B and C) Note: A and C have transparent background, B has White as background.![enter image description here](https://i.stack.imgur.com/8un6c.png) Problem: A: I have a bitmap with ARGB pixel format. And I want to draw a text into it. The text drawn has sharp edges and it does not honor the transparency. B: I write the exact same code, but only difference from A is that the pixels in bitmap are not transparent anymore. (I will fill in a rectangle). But if you notince the pixels of the text, you will see a smooth blend of black (text color) and white (background color). C: This is what I am expecting the text to look when I am drawing a text onto a bitmap with transparent pixels. ``` public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } private void UserControl1_Paint(object sender, PaintEventArgs e) { //e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0, Color.Red)), e.ClipRectangle); e.Graphics.DrawString("0123456789", new Font("Verdana", 20), Brushes.Red, new PointF(5, 10)); e.Graphics.DrawEllipse(Pens.Black, e.ClipRectangle); } // This is a public method, using which I want to save my usercontrol to an image to save to file later. public Image ToImage(Size size, PixelFormat p) { Bitmap b = new Bitmap(Width, Height, p); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; PaintEventArgs e = new PaintEventArgs(g, new Rectangle(0, 0, size.Width, size.Height)); base.OnPaint(e); this.OnPaint(e); } return b; } ``` How do I make A look like C with the transparent background. I am pretty sure this can be done, because softwares like photoshop, paint.net handle this very nicely. Thanks a lot! Datte
Ugly looking text problem
CC BY-SA 2.5
0
2011-03-02T13:11:44.930
2011-06-20T23:15:24.747
2011-03-02T14:09:58.140
65,912
65,912
[ "c#", ".net", "gdi+" ]
5,168,069
1
5,168,098
null
1
1,703
How can I write a console form looking like the one seen on the screenshot using python. This means that I can write something like ``` print(x=6, y=2, "z/VM ONLINE") ``` This code should place the text almost in the upper left corner as seen on the screenshot. Importantly the output text should never make all the other text scroll. It is also important that I can place the cursor at any coordinate and that the user is able to input text at that place. EDIT: I need something that works under Windows. ![enter image description here](https://i.stack.imgur.com/U60v2.gif)
Creating old fashion console form using Python
CC BY-SA 2.5
null
2011-03-02T13:25:25.550
2011-03-02T13:31:45.607
2011-03-02T13:31:45.607
163,461
163,461
[ "python", "command-prompt", "command-line-interface" ]
5,168,097
1
7,058,203
null
1
951
I am getting following error while I am connecting my iPhone to organizer. ![enter image description here](https://i.stack.imgur.com/MDbba.png) I perform following steps to avoid collecting data every time I connect my device to Mac. To do this, simply go to the /Developer/Platforms/iPhoneOS.platform/DeviceSupport folder and manually copy the Symbols subfolder and/or the DeveloperDiskImage.* files from 4.2 (8C134) to 4.2.1 (8C148) (or whatever release folder Organizer creates for your device). What can be done?
Getting Error : Symbol extraction process failed in Organizer
CC BY-SA 2.5
null
2011-03-02T13:28:18.617
2011-08-15T09:16:40.717
null
null
566,431
[ "iphone", "objective-c", "cocoa-touch", "xcode", "ios4" ]
5,168,224
1
5,169,492
null
0
332
I upgraded to django 1.2 and I now get this error message which looks related to i18n. Can you tell what I should do? thanks ``` global name '_' is not defined Traceback (most recent call last): File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 515, in __call__ handler.get(*groups) File "/base/data/home/apps/classifiedsmarket/blobstore.348713784647505124/i18n.py", line 252, in get loginmsg = loginmsg + '<a href=\"%s\">%s</a>' % ('login',_("Log in")) NameError: global name '_' is not defined ``` UPDATE after having added the new import statement the code looks like ``` # let user choose authenticator for p in openIdProviders: p_name = p.split('.')[0] # take "AOL" from "AOL.com" p_url = p.lower() # "AOL.com" -> "aol.com" loginmsg = loginmsg + '<a href="%s">%s</a> ' % ( #'','') # users.create_login_url(federated_identity=p_url), p_name) 'google.com', p_name) loginmsg = loginmsg + '<a href=\"%s\">%s</a>' % ('login',_("Log in")) ``` and in template ``` <ul><li><a href="ai">{% trans "Add" %}</a></li> <li><a href="li">{{ latest.modified|date:"d M" }}</a></li> <li>{% if user %}<a href="{{ user_url|fix_ampersands }}">{% trans "Log out" %}</a> {% else %}{% trans "Log in" %}{{loginmsg}}{% endif %}</li> </ul> ``` leading the junk on the view like the image here where the expected output is links and buttons. Could you inform a bit more? Thanks ![enter image description here](https://i.stack.imgur.com/8kVTY.png) Now inspected the HTML it appears that it's something with the escpae coding. COuld you tell? ``` <ul><li><a href="ai">Add</a></li><li><a href="li">03 Mar</a></li> <li>Log in&lt;a href=&quot;google.com&quot;&gt;Google&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;Yahoo&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;MySpace&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;AOL&lt;/a&gt; &lt;a href=&quot;login&quot;&gt;Log in&lt;/a&gt;</li> </ul> ```
Problems with GAE + django 1.2
CC BY-SA 2.5
0
2011-03-02T13:38:18.727
2011-03-03T06:23:30.407
2011-03-03T06:23:30.407
108,207
108,207
[ "python", "html", "django", "google-app-engine", "escaping" ]
5,168,632
1
null
null
0
432
Is there something like `Canvas.IsVisible(point)` ? I have a `Canvas` inside a `ScrollViewer`. Inside the canvas I have a custom control that should be always in the visible part of the Canvas. ![enter image description here](https://i.stack.imgur.com/GKfFu.jpg) Is there a way to identify the Canvas rectangle or point?
WPF: Is there something like Canvas.IsVisible(point)?
CC BY-SA 3.0
null
2011-03-02T14:13:47.270
2014-01-06T16:58:40.440
2014-01-06T16:58:40.440
759,866
185,593
[ ".net", "wpf", "wpf-controls" ]
5,168,772
1
5,269,720
null
6
16,379
I am trying to update some rows in an oracle Database, using an OLEDB Command but whenever i try specifying the Sql Command this is what i get ``` An OLEDB record is available. Source: "OraOLEDB" Hresult:0x80040E51 Description: "Provider cannot derive parameter information and SetParameterInfo has not been called." ``` I have tried using > "Native OLE DB\Oracle Provider for OLE DB" provider and i tried changing to > "Native OLE DB\Microsoft OLE BD Provider for Oracle" provider but i get the same error, please help, I am using ssis 2008 Here is the setup : The Connection Manager is as below ![enter image description here](https://i.stack.imgur.com/rMbtQ.jpg) When i test it, it succeeds ![enter image description here](https://i.stack.imgur.com/bW1WI.jpg) Now when i come to configuring the OLEDBCommand., I pass in the Connenction Manager ![enter image description here](https://i.stack.imgur.com/9dbjN.jpg) specify the command ![enter image description here](https://i.stack.imgur.com/EbwKg.jpg) now when i move to configure the parameters, nothing is displayed and i receive this error ![enter image description here](https://i.stack.imgur.com/tSLoH.jpg) thanks for the help
Update a row in oracle using OLEDB command(SSIS)
CC BY-SA 2.5
0
2011-03-02T14:23:33.310
2012-08-27T13:42:32.800
2011-03-03T09:45:19.063
526,858
526,858
[ "oracle", "oledbcommand" ]
5,169,068
1
6,474,572
null
2
3,983
I'd like to render a symfony form this way: ![form with radio buttons](https://i.stack.imgur.com/bYKtV.png) My problem concerns the radio buttons widget: I don't know how to render each choice individually, in order to display other fields between those radio buttons. Is there a way to achieve this with symfony forms? Thanks!
How to display radio buttons of a sfWidgetFormChoice individually?
CC BY-SA 2.5
0
2011-03-02T14:41:32.783
2012-12-25T11:54:03.537
null
null
354,578
[ "symfony1", "symfony-1.4", "symfony-forms" ]
5,169,096
1
null
null
0
424
Folks, I am having a doubt. I wish to make a website. I am stuck at one concept. Suppose my web page look like the below image. ![enter image description here](https://i.stack.imgur.com/fTtCo.jpg) Now, my doubt is how to make a `textbox` with blue color such that if anyone clicks on the tabs (like Home, About Us etc) on the background green web page, that p'cular content should appear in the blue box which is above the green box. Should `css` should be used here ? Sample code ? --- PS : Excuse me for this very image file (Done in MSPaint) and also if I am not able to present my question correctly. Please feel free to modify my question in case you get my question. Any help would be greatly appreciated. Thanks
How to make a informative textbox inside html page
CC BY-SA 2.5
null
2011-03-02T14:43:55.420
2011-03-02T15:32:49.830
null
null
202,375
[ "html", "css", "textbox" ]
5,169,366
1
5,169,453
null
11
10,668
Say we have the following simple data-frame of date-value pairs, where some dates are missing in the sequence (i.e. Jan 12 thru Jan 14). When I plot the points, it shows these missing dates on the x-axis, but there are no points corresponding to those dates. I want to prevent these missing dates from showing up in the x-axis, so that the point sequence has no breaks. Any suggestions on how to do this? Thanks! ``` dts <- c(as.Date( c('2011-01-10', '2011-01-11', '2011-01-15', '2011-01-16'))) df <- data.frame(dt = dts, val = seq_along(dts)) ggplot(df, aes(dt,val)) + geom_point() + scale_x_date(format = '%d%b', major='days') ``` ![enter image description here](https://i.stack.imgur.com/sf2As.png)
R + ggplot2: how to hide missing dates from x-axis?
CC BY-SA 2.5
0
2011-03-02T15:03:34.277
2016-05-25T23:01:02.687
null
null
415,690
[ "r", "plot", "ggplot2" ]
5,169,639
1
null
null
1
652
I was messing arround with code and i can't figure out to do this: ![Node Tree](https://i.stack.imgur.com/o46UN.png) I have a Table in the database like this: ``` CREATE TABLE IF NOT EXISTS `nodetree` ( `node` int(11) NOT NULL, `prevnode` int(11) NOT NULL, `nextnode` int(11) NOT NULL, `nodename` varchar(30) NOT NULL, `nodelink` varchar(255) NOT NULL, PRIMARY KEY (`node`,`prevnode`, `nextnode`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ``` What i want to do is to get php build that graph automatically with tables. Each node is a clickable link to node description. Thanks in advance.
php/mysql special tree
CC BY-SA 2.5
null
2011-03-02T15:25:36.013
2013-09-04T21:02:11.940
2013-09-04T21:02:11.940
null
641,449
[ "php", "mysql", "tree" ]
5,169,631
1
null
null
0
1,154
I'm creating an analog clock input method that users can use to pick a time. Users can click on the inner circle to set the short hand (hour) and can click on the outer circle to set the long hand (minute). ![javascript clock](https://i.stack.imgur.com/XquBj.png) The problem is that users are free to click any point on the clock and therefor can pick an invalid position of the hands. Is there any way (algoritm) to detect this? ``` window.addEvent('domready', function() { var handLong = [10, 20, 30, 40, 50, 60, 70, 80]; var handShort = [10, 20, 30, 40, 50]; injectHands('clock', handShort, handLong); $('clock').addEvent('click', function(e) { var x = correctX(e.page.x - e.target.getPosition().x, true); var y = correctY(e.page.y - e.target.getPosition().y, true); var angle = calculateAngle(x, y); // grote wijzer positioneren if (insideOuter(x, y)) { moveHand(handLong, 'Long', angle); } // kleine wijzer positioneren else if (insideInner(x, y)) { moveHand(handShort, 'Short', angle); } }); }); // Valt punt (x, y) binnen een cirkel met middenpunt (x, y) en radius r function insideCircle(pointX, pointY, circleX, circleY, radius) { dX = pointX - circleX; dY = pointY - circleY; return ((dX * dX) + (dY * dY)) <= (radius * radius); } // Valt punt (x, y) (enkel) binnen de buitenste cirkel (grote wijzer) function insideOuter(pointX, pointY) { return !insideInner(pointX, pointY) && insideCircle(pointX, pointY, 0, 0, 100); } // Valt punt (x, y) (enkel) binnen de binnenste cirkel (grote wijzer) function insideInner(pointX, pointY) { return insideCircle(pointX, pointY, 0, 0, 50); } // corrigeer x as (100 => 0) (0 => 100) function correctX(x, nn) { if (nn) { return x - 100; } return x + 100; } // corrigeer y as (100 => 0) (0 => 100) function correctY(y, nn) { if (nn) { return -y + 100; } return Math.abs(y - 100); } function calculateAngle(x, y) { if ((x >= 0) && (y >= 0)) { return Math.atan(x / y) * (180 / Math.PI); } else if (((x >= 0) && (y < 0)) || ((x < 0) && (y < 0))) { return 180 + Math.atan(x / y) * (180 / Math.PI); } else if ((x < 0) && (y >= 0)) { return 360 - Math.abs(Math.atan(x / y) * (180/ Math.PI)); } } function roundAngleByMinute(angle) { } function calculateX(angle, hypotenuse) { return Math.sin((Math.PI / 180) * angle) * hypotenuse; } function calculateY(angle, hypotenuse) { return Math.cos((Math.PI / 180) * angle) * hypotenuse; } function injectHands(div, handShort, handLong) { for (var i = 0; i < handShort.length; i++) { $(div).grab(new Element('img', {src: 'images/red_8x8.png', class: 'hands handShort', id: 'handShort-' + handShort[i]})); } for (var i = 0; i < handLong.length; i++) { $(div).grab(new Element('img', {src: 'images/blue_8x8.png', class: 'hands handLong', id: 'handLong-' + handLong[i]})); } $(div).grab(new Element('img', {src: 'images/black_8x8.png', class: 'hands', id: 'hand-center'})); $$('img.hands').hide(); $('hand-center').show(); } function moveHand(hand, whichHand, angle) { for (var i = 0; i < hand.length; i++) { var hypotenuse = hand[i]; var x = calculateX(angle, hypotenuse) - 5; var y = calculateY(angle, hypotenuse) + 5; var left = correctX(x); var top = correctY(y); $('hand' + whichHand + '-' + hypotenuse).set('styles', {'left': left + 'px', 'top': top + 'px'}); } $$('img.hand' + whichHand).show(); } ```
Check if the hands of an analog clock are positioned correctely
CC BY-SA 2.5
0
2011-03-02T15:25:02.970
2018-11-30T06:38:09.263
2011-03-02T16:11:27.173
138,779
138,779
[ "javascript", "math", "clock", "angle" ]
5,169,647
1
5,170,911
null
4
7,438
I've got a JButton which is painted using a custom UI delegate (CustomButtonUI extends BasicButtonUI). The CustomButtonUI's paint() method draws the button with rounded "antialiased" corners, to make the apperance as "smooth" as possible. Somehow the "antialiased" edges of the button disappears each time i drag the mouse over the button. This makes the button edges look "pixelized". However, once I add a line of code to repaint the parent of the button, the antialiasing kicks in even when i drag the mouse over the button. Now, my question relates to wether this is a good idea? I do after all repaint the parent component from a child component. I wonder if this lead to a loop of repaints? If the parent tries to repaint its children and the children tries to repaint its parent - then i assume we're talking about a loop. I've attached my code as a reference. Any comments are very welcome! ``` public class JCustomButtonUI extends BasicButtonUI { @Override public void installUI(JComponent c) { super.installUI(c); AbstractButton b = (AbstractButton) c; b.setBorderPainted(false); } @Override public void paint(Graphics g, JComponent c) { //Cast the Graphics instance to a Graphics2D instance. Graphics2D g2d = (Graphics2D) g; JButton b = (JButton) c; //Repaint parent component to make sure that we get "antialiased" //edges. b.getParent().repaint(); //Get the component's height and width. int w = (int) g.getClipBounds().getWidth(); int h = ((int) g.getClipBounds().getHeight()); //Make sure the button is drawn with "antialiased" edges. g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.GRAY); g2d.fillRoundRect(0, 0, w, h, w, h); } } ``` ### Update 1 Just to illustrate the alias and antialiased border, please have a look at the below two pictures. When i (from the ButtonUI's paint() method) manually invoke the parent JPanel's repaint method, all borders are perfectly antialiased all the time. However, when i do not manually invoke the parent JPanel's repaint method, then the borders are no longer antialiased once i hoover the mouse over the button. ![Aliased](https://i.stack.imgur.com/mMwE6.png) ![Antialiased](https://i.stack.imgur.com/vGVdU.png) ### Update 2 I have shared the entire "component" which consists of a JPanel, a JSlider and a couple of JButtons on Snipt. Please get it from [http://snipt.org/wnllg](http://snipt.org/wnllg). ### Update 3 It seems that i have managed to get it working. Instead of painting the JPanel's background in its paintComponent() method, i created a JCustomPanelUI which i installed on the JPanel. I don't think that was the solution itself, but instead of using width and height from the Graphics instance, I tried using widht and height from the JPanel itself. I'm not quite sure why things go wrong when i use width and height from the Graphics instance. I thought the width and height from the Graphics instance was already "prepared" with regard to dimensions from the JPanel component. You can have a look at the final component here: [http://snipt.org/wnlli](http://snipt.org/wnlli),
When does a JPanel paint (or repaint) its child components?
CC BY-SA 2.5
0
2011-03-02T15:26:19.473
2011-03-05T18:05:58.553
2011-03-03T09:13:56.993
355,232
355,232
[ "java", "swing", "custom-painting" ]
5,169,819
1
null
null
1
2,875
![enter image description here](https://i.stack.imgur.com/krtHH.png) The problem is as follows: If a visitor try to access a page in Admin folder he must be redirected to login page located in Admin folder, here I will take his username and password and then I will check this in SQL Server table, if he is authenticated then he will be redirected to Default page and he can access any page in Admin folder, but not any page in User folder Here is one thing is important and that is login page in Admin folder and login page in User folder are different Same scenario is for User folder Please tell me what is the right way to achieve this functionality Please explain your answer
Forms Authentication for folders with different login page
CC BY-SA 2.5
0
2011-03-02T15:40:35.050
2011-04-29T21:17:46.103
null
null
606,537
[ "c#", "asp.net", "security", "forms-authentication" ]
5,170,010
1
5,172,692
null
34
11,235
I am banging my head on the wall trying to understand this. See the next picture. Suppose I have an iPhone resting on a table. At this time the rotation readings thru core motion are 0,0,0 for yaw, roll and pitch (picture A). Then I roll it 90 degrees. Now it is sitting on the table with its left side, home button on the right. Now it reads 0,0,0 (picture B). Now I yaw it 180 degrees. It is now sitting with its right side on the table. Home button on the left. It now reads 180,0,0 (picture C). The problem comes if I roll it now. Suppose I roll it -45 degrees. I should be reading 180,-45,0 but instead I am reading 180,-45,180???? (picture D). Why is that? Why is it giving me a value for pitch if I never changed that? How can be pitch influenced by a rotation in other angles? thanks. ![enter image description here](https://i.stack.imgur.com/UL0RY.png)
iPhone - understanding iPhone rotation
CC BY-SA 2.5
0
2011-03-02T15:55:42.413
2011-03-02T22:39:22.713
2011-03-02T16:08:18.623
316,469
316,469
[ "iphone", "core-motion" ]
5,170,028
1
5,563,898
null
17
6,673
I'm currently writing an app which uses an embedded WebView to display its content or to sometimes query data from the user using input forms. The input fields in these forms are styled using -webkit-css Styles. This works fine on all Devices (tested on Nexus One, LG Optimus 500, Samsung Galaxy S) so far, except on Devices with HTC Sense. On Devices with HTC Sense the styling gets lost if the input element gets selected. Using `input:focus {}` in the css doesn't help, the HTC Devices with Sense simply ignore. This image illustrates it, the "Nickname" is currently selected but should still be styled the same way like "Vorname" and "Nachname" are. ![Focus Problem](https://i.stack.imgur.com/xFjnY.png) Any ideas to maybe workaround this problem? Here is a sample HTML page (upon request): ``` <html> <head> <meta name="viewport" content="target-densitydpi=low-dpi" /> <style type="text/css"> input[type="number"], input[type="text"]{ border: 1px solid #CDFF3C; background: #F3FECA; width: 220px; -webkit-border-radius: 4px; -webkit-box-shadow: inset 1px 1px 4px #AAA; -webkit-tap-highlight-color: rgba(205, 255, 60, 0.5); } body { background:#ebffb9; margin-right:0; margin-left:0; font-size: 14px; } </style> </head> <body> <form name="data" action="/im/postdata" method="get" accept-charset="UTF-8"> <p class="edit"> <b>Vorname</b> <br/> <input type="text" name="3"/> </input> </p> </form> </body> </html> ``` No need to embed this into an app, simply put it on a web server somewhere and use the built in web browser to open it.
Input-Elements in WebViews always have the same style if highlighted on HTC Devices
CC BY-SA 3.0
0
2011-03-02T15:56:47.443
2012-08-09T06:20:14.543
2012-08-09T06:20:14.543
31,671
641,132
[ "android", "htcsense" ]
5,170,041
1
9,973,312
null
0
11,314
The sample page: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Button test</title> <style> * { border: none; margin: 0; padding: 0; } body { padding: 5em; } span { background: lightblue; display: inline-block; } button { background: red; outline: 1px solid red } button div { background: yellow; } button::-moz-focus-inner { padding: 0; border: 0; } button { -webkit-appearance: none; -webkit-box-sizing: content-box; -webkit-box-align: start; -webkit-border-fit: lines; -webkit-margin-collapse: discard; } </style> </head> <body> <span>Adjacent text</span><button><div>Button</div></button> </body> </html> ``` Here is the image: ![](https://i.stack.imgur.com/F832v.png) You can see the extra white padding in the button. Is it possible to get rid of that padding in Safari browser?
<button> extra padding problem in Safari
CC BY-SA 2.5
null
2011-03-02T15:57:41.367
2012-11-16T06:31:10.013
null
null
273,075
[ "html", "css", "button", "safari", "padding" ]
5,170,436
1
5,170,504
null
1
4,647
I've a website, and in my main page page scroll bar is gone. There are six collapsible panels, all of them fixed by always visible control extender. After I add them main page, it broke. I'm working with asp.net 4.0. ![enter image description here](https://i.stack.imgur.com/4Rbwz.jpg)
fix vertical scroll bar in asp.net
CC BY-SA 3.0
null
2011-03-02T16:29:16.863
2012-10-01T13:01:43.807
2012-10-01T13:01:43.807
542,416
576,114
[ "asp.net", "scrollbar" ]
5,171,037
1
5,181,847
null
17
19,210
I want to take an object, let's say this object: ``` public class BenchmarkList { public string ListName { get; set; } public IList<Benchmark> Benchmarks { get; set; } } ``` and have that object display its ListName as the "name" part of the PropertiesGrid ("Benchmark" would be good), and for the "value" part of the PropertyGrid, to have a drop-down list of the IList<> of Benchmarks: here is the Benchmark object ``` public class Benchmark { public int ID {get; set;} public string Name { get; set; } public Type Type { get; set; } } ``` I would want the drop-down to show the Name property of the Benchmark for what the users can see. Here is a visual example: ![enter image description here](https://i.stack.imgur.com/tTq5q.png) So, essentially, I'm trying to get a collection of Benchmark objects into a drop-down list, and those objects should show their Name property as the value in the drop-down. I've read other articles on using the PropertiesGrid, including [THIS](http://www.codeproject.com/KB/tabs/customizingcollectiondata.aspx#StartGoal) and [THIS](http://www.codeproject.com/KB/miscctrl/bending_property.aspx), but they are more complex than what I'm trying to do. I usually work on server-side stuff, and don't deal with UI via WebForms or WinForms, so this PropertiesGrid is really taking me for a ride... I do know my solution lies in implementing "ICustomTypeDescriptor", which will allow me to tell the PropertiesGrid what values it should be displaying regardless of the properties of the object to which I want to bind into the drop-down list, but I'm just not sure how or where to implement it. Any pointers/help would be much appreciated. Thanks, Mike UPDATE: Okay, so I'm changing the details around a little. I was going overboard before with the objects I thought should be involved, so here is my new approach. I have an object called Analytic. This is the object that should be bound to the PropertiesGrid. Now, if I expose a property that is of an enum type, PropertiesGrid will take care of the drop-down list for me, which is very nice of it. If I expose a property that is a collection of a custom type, PropertiesGrid is not so nice... Here is the code for Analytic, the object I want to bind to the PropertiesGrid: ``` public class Analytic { public enum Period { Daily, Monthly, Quarterly, Yearly }; public Analytic() { this.Benchmark = new List<IBenchmark>(); } public List<IBenchmark> Benchmark { get; set; } public Period Periods { get; set; } public void AddBenchmark(IBenchmark benchmark) { if (!this.Benchmark.Contains(benchmark)) { this.Benchmark.Add(benchmark); } } } ``` Here is a short example of two objects that implement the IBenchmark interface: ``` public class Vehicle : IBenchmark { public Vehicle() { this.ID = "00000000-0000-0000-0000-000000000000"; this.Type = this.GetType(); this.Name = "Vehicle Name"; } public string ID {get;set;} public Type Type {get;set;} public string Name {get;set;} } public class PrimaryBenchmark : IBenchmark { public PrimaryBenchmark() { this.ID = "PrimaryBenchmark"; this.Type = this.GetType(); this.Name = "Primary Benchmark"; } public string ID {get;set;} public Type Type {get;set;} public string Name {get;set;} } ``` These two objects will be added to the Analytic object's Benchmark List collection in the WinForms code: ``` private void Form1_Load(object sender, EventArgs e) { Analytic analytic = new Analytic(); analytic.AddBenchmark(new PrimaryBenchmark()); analytic.AddBenchmark(new Vehicle()); propertyGrid1.SelectedObject = analytic; } ``` Here is a screen-grab of the output in the PropertiesGrid. Note that the property exposed as an enum gets a nice drop-down list with no work, but the property exposed as an of List on gets a value of (Collection). When you click on (Collection), you get the Collection editor and then can see each object, and their respective properties: ![enter image description here](https://i.stack.imgur.com/dXs2J.png) This is not what I'm looking for. Like in my first screen grab in this post, I'm trying to render the property Benchmark collection of List as a drop-down list that shows the object's name property as the text of what can be displayed... Thanks
display list of custom objects as a drop-down in the PropertiesGrid
CC BY-SA 2.5
0
2011-03-02T17:20:29.417
2016-09-09T11:27:11.490
2013-01-31T16:28:50.940
830,923
618,056
[ "c#", "winforms", "propertygrid" ]
5,171,095
1
5,175,604
null
3
12,976
I'm trying to combine images in my app into one file and write it to disk. ``` NSMutableArray *array = [NSMutableArray arrayWithObjects: [NSData dataWithContentsOfFile:@"0.png"], [NSData dataWithContentsOfFile:@"1.png"], [NSData dataWithContentsOfFile:@"2.png"], nil]; NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array]; NSError *error = nil; NSString *path=@"/Users/myusername/Desktop/_stuff.dat"; [data writeToFile:path options:NSDataWritingAtomic error:&error]; ``` or ``` NSArray *array = [NSArray arrayWithObjects: [NSImage imageNamed:@"0"], [NSImage imageNamed:@"1"], [NSImage imageNamed:@"2"], nil]; NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array]; NSError *error = nil; NSString *path=@"/Users/myusername/Desktop/_stuff.dat"; [data writeToFile:path options:NSDataWritingAtomic error:&error]; ``` But both produce a file that is 4KB (empty). If I `NSLog` the error it is `(null)`. Am I making the data the wrong way? Edit: If I open the resulting file with a text editor, it looks like this: ![enter image description here](https://i.stack.imgur.com/PrskS.png)
Write to file not working
CC BY-SA 2.5
0
2011-03-02T17:25:36.217
2014-08-09T17:42:55.910
2011-03-02T17:40:13.137
456,851
456,851
[ "objective-c", "cocoa", "macos" ]
5,171,263
1
5,171,329
null
99
240,759
I don't use ggplot2 that much, but today I thought I'd give it a go on some graphs. But I can't figure out how to manually control colors in `geom_line()` I'm sure I'm overlooking something simple, but here's my test code: ``` x <- c(1:20, 1:20) variable <- c(rep("y1", 20), rep("y2", 20) ) value <- c(rnorm(20), rnorm(20,.5) ) df <- data.frame(x, variable, value ) d <- ggplot(df, aes(x=x, y=value, group=variable, colour=variable ) ) + geom_line(size=2) d ``` which gives me the expected output: ![enter image description here](https://i.stack.imgur.com/xN5gh.png) I thought all I had to do was something simple like: ``` d + scale_fill_manual(values=c("#CC6666", "#9999CC")) ``` But that changes nothing. What am I missing?
Changing line colors with ggplot()
CC BY-SA 3.0
0
2011-03-02T17:40:06.490
2022-03-20T10:01:14.397
2017-03-06T12:51:33.707
792,066
37,751
[ "r", "ggplot2" ]
5,171,597
1
5,337,923
null
6
8,174
I want to add a file to an existing folder in Xcode. I have a folder in the file system that I have added to my resources. Now when I add a file to that folder, and try to drag and drop that file onto the folder reference in Xcode, I am out of luck. Even if I delete the reference and drag the whole folder over again, it does not work, as it imports all files that were in the folder when I originally imported it, but not the new ones. Any ideas on that one? ![screenshot](https://i.stack.imgur.com/xtofl.png)
Xcode: How to add a file to a folder reference
CC BY-SA 3.0
0
2011-03-02T18:13:25.243
2017-09-29T19:19:59.207
2017-09-29T19:19:37.080
1,032,372
406,652
[ "xcode" ]
5,171,600
1
5,171,941
null
1
509
I am trying to recreate an example from Chapter-5 of book Pro Asp.net MVC2. But as soon as I add Menu code server stops working. Any Problem with the code? ``` public class NavController : Controller { private IProductRepository productsRepository; public NavController(IProductRepository productsRepository) { this.productsRepository = productsRepository; } public ViewResult Menu() { Func<string, NavLink> makeLink = categoryName => new NavLink { Text = categoryName ?? "Home", RouteValues = new RouteValueDictionary( new { controller = "Products", action = "List", category = categoryName, page = 1 }) }; List<NavLink> navLinks = new List<NavLink>(); navLinks.Add(makeLink(null)); var categories = productsRepository.Products.Select(x => x.Category); foreach (string categoryName in categories.Distinct().OrderBy(x => x)) navLinks.Add(makeLink(categoryName)); return View(navLinks); } } ``` Menu.cshtml ``` @model IEnumerable<SStore.WebUI.Models.NavLink> @foreach (var link in Model) { Html.RouteLink(link.Text, link.RouteValues); } ``` If I remove this line from my master page then server works ``` @{ Html.RenderAction("Menu", "Nav"); } ``` otherwise getting this error ![enter image description here](https://i.stack.imgur.com/w4U30.png)
Pro Asp.net mvc 2: Problem in example
CC BY-SA 2.5
0
2011-03-02T18:13:39.697
2011-03-02T19:01:49.540
2011-03-02T19:01:13.440
29,407
277,696
[ "asp.net-mvc", "asp.net-mvc-3", "razor" ]
5,171,611
1
5,178,254
null
1
237
I'm not an DB expert, so I've been around for a while, reading as much as I can and thanks to the community answers I could make several changes to my query and tables structure. Even after reading a lot of stuff I got stuck, so I came to make my first question. I have a website where the users post their own stories. Each story can have genres, warnings, multiple authors, multiple characters assigned, etc. We're running MySQL 5.x, tables are InnoDB, website written in PHP. Using GROUP_CONCAT to return a single row per story on the result. Tried previously using GROUP BY story id, but every query was taking around 16 secs to complete, was very slow. With this new one, they take 0.175, but for example, if the genre in WHERE doesn't exists, the query takes 23 secs! For the tests, every table has 1 million records, authors table with 1.5 million. I've tried to place some extra indexes to see which one MySQL will use. I've tried to get things normalized with one to many relationship. Here I'll present only a few tables as the solution will probably cover the entire problem. Any help is greatly appreciated, thanks for your time! ``` CREATE TABLE `fanfiction_authors` ( `uid` int(11) NOT NULL AUTO_INCREMENT, `penname` varchar(100) NOT NULL, `penname_url` varchar(100) NOT NULL, PRIMARY KEY (`uid`), KEY `penname_url` (`penname_url`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1000000 ; -- -------------------------------------------------------- CREATE TABLE `fanfiction_stories` ( `sid` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(200) NOT NULL, `sinopse` text NOT NULL, PRIMARY KEY (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1000000 ; -- -------------------------------------------------------- CREATE TABLE `fanfiction_stories_authors` ( `sid` int(11) NOT NULL, `uid` int(11) NOT NULL, KEY `sid_uid` (`sid`,`uid`), KEY `sid` (`sid`), KEY `uid` (`uid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- CREATE TABLE `fanfiction_stories_genres` ( `key_id` int(11) NOT NULL AUTO_INCREMENT, `sid` int(11) NOT NULL, `genre_id` int(11) NOT NULL, PRIMARY KEY (`key_id`), KEY `sid` (`sid`), KEY `genre_id` (`genre_id`), KEY `sid_genreid` (`sid`,`genre_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1000000 ; -- -------------------------------------------------------- CREATE TABLE `fanfiction_stories_stats` ( `sid` int(11) NOT NULL, `reviews` int(11) NOT NULL, `recomendacoes` int(11) NOT NULL, PRIMARY KEY (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- CREATE TABLE `fanfiction_stories_warnings` ( `key_id` int(11) NOT NULL AUTO_INCREMENT, `sid` int(11) NOT NULL, `warning_id` int(11) NOT NULL, PRIMARY KEY (`key_id`), KEY `sid` (`sid`), KEY `warning_id` (`warning_id`), KEY `warningid_sid` (`sid`,`warning_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1000000 ; ---- ``` ``` SELECT st.sid, st.title, st.sinopse, (SELECT GROUP_CONCAT(CAST(genre_id AS CHAR)) FROM fanfiction_stories_genres WHERE sid = st.sid) as genres, stats.reviews, stats.recomendacoes, (SELECT GROUP_CONCAT(CAST(warning_id AS CHAR)) FROM fanfiction_stories_warnings WHERE sid = st.sid) as warnings_ids FROM fanfiction_stories AS st LEFT JOIN fanfiction_stories_stats AS stats ON st.sid = stats.sid WHERE st.sid IN (SELECT sid FROM fanfiction_stories_warnings WHERE warning_id = 5) AND st.sid IN (SELECT sid FROM fanfiction_stories_genres WHERE genre_id = 300) ORDER BY st.sid ASC LIMIT 20 ``` This is the explain extended when we have a valid genre (You will find stories with genre number 300). ![explain](https://i.stack.imgur.com/4swFI.png) [http://dl.dropbox.com/u/14508898/Printscreen/stackoverflow_explain_print_001.PNG](http://dl.dropbox.com/u/14508898/Printscreen/stackoverflow_explain_print_001.PNG) This is the explain extended when we have a invalid genre (You will NOT find stories with genre number 900). ![invalid genre explain](https://i.stack.imgur.com/ZTnn6.png) [http://dl.dropbox.com/u/14508898/Printscreen/stackoverflow_explain_print_002.PNG](http://dl.dropbox.com/u/14508898/Printscreen/stackoverflow_explain_print_002.PNG) Can you guys help me, please? Is my normalization correct? What am I doing wrong? Thanks in advance!
Problems to optimize large query and tables structure
CC BY-SA 2.5
null
2011-03-02T18:14:44.913
2011-03-03T08:59:53.727
2011-03-02T18:54:09.423
128,245
null
[ "mysql", "query-optimization", "subquery", "innodb", "normalization" ]
5,171,722
1
null
null
1
1,772
I've got a db table that has a date field, a username field, and an integer points balance field. There is a record for every day, storing the balance at the end of the business day. I'm looking for the most efficient way of calculating the average daily increase for each user, sorting highest average daily increase to the lowest. ![enter image description here](https://i.stack.imgur.com/v6q5M.png)
Sql for average daily increase
CC BY-SA 2.5
null
2011-03-02T18:26:33.590
2011-03-02T18:46:32.217
null
null
149,358
[ "tsql" ]
5,171,787
1
5,225,298
null
9
2,312
I have a height map for an image, which tells me the offset of each pixel in the Z direction. My goal is to flatten a distorted image using only it's height map. How would I go about doing this? I know the position of the camera, if that helps. --- To do this, I was thinking about assuming that each pixel was a point on a plane, and then to translate each of those points vertically according to the Z-value I get from the height map, and from that translation (imagine you are looking at the points from above; the shift will cause the point to move around from your perspective). From that projected shift, I could extract X and Y-shift of each pixel, which I could feed into `cv.Remap()`. But I have no idea how I could get the projected 3D offset of a point with OpenCV, let alone construct a offset map out of it. --- Here are my reference images for what I'm doing: ![Calibration Image](https://i.stack.imgur.com/wnaGn.jpg) ![Warped Image](https://i.stack.imgur.com/IGWb4.jpg) I know the angle of the lasers (45 degrees), and from the calibration images, I can calculate the height of the book really easily: ``` h(x) = sin(theta) * abs(calibration(x) - actual(x)) ``` I do this for both lines and linearly interpolate the two lines to generate a surface using this approach (Python code. It's inside a loop): ``` height_grid[x][y] = heights_top[x] * (cv.GetSize(image)[1] - y) + heights_bottom[x] * y ``` I hope this helps ;) --- Right now, this is what I have to dewarp the image. All that strange stuff in the middle projects a 3D coordinate onto the camera plane, given it's position (and the camera's location, rotation, etc.): ``` class Point: def __init__(self, x = 0, y = 0, z = 0): self.x = x self.y = y self.z = z mapX = cv.CreateMat(cv.GetSize(image)[1], cv.GetSize(image)[0], cv.CV_32FC1) mapY = cv.CreateMat(cv.GetSize(image)[1], cv.GetSize(image)[0], cv.CV_32FC1) c = Point(CAMERA_POSITION[0], CAMERA_POSITION[1], CAMERA_POSITION[2]) theta = Point(CAMERA_ROTATION[0], CAMERA_ROTATION[1], CAMERA_ROTATION[2]) d = Point() e = Point(0, 0, CAMERA_POSITION[2] + SENSOR_OFFSET) costx = cos(theta.x) costy = cos(theta.y) costz = cos(theta.z) sintx = sin(theta.x) sinty = sin(theta.y) sintz = sin(theta.z) for x in xrange(cv.GetSize(image)[0]): for y in xrange(cv.GetSize(image)[1]): a = Point(x, y, heights_top[x / 2] * (cv.GetSize(image)[1] - y) + heights_bottom[x / 2] * y) b = Point() d.x = costy * (sintz * (a.y - c.y) + costz * (a.x - c.x)) - sinty * (a.z - c.z) d.y = sintx * (costy * (a.z - c.z) + sinty * (sintz * (a.y - c.y) + costz * (a.x - c.x))) + costx * (costz * (a.y - c.y) - sintz * (a.x - c.x)) d.z = costx * (costy * (a.z - c.z) + sinty * (sintz * (a.y - c.y) + costz * (a.x - c.x))) - sintx * (costz * (a.y - c.y) - sintz * (a.x - c.x)) mapX[y, x] = x + (d.x - e.x) * (e.z / d.z) mapY[y, x] = y + (d.y - e.y) * (e.z / d.z) print print 'Remapping original image using map...' remapped = cv.CreateImage(cv.GetSize(image), 8, 3) cv.Remap(image, remapped, mapX, mapY, cv.CV_INTER_LINEAR) ``` This is turning into a huge thread of images and code now... Anyways, this code chunk takes my 7 minutes to run on a 18MP camera image; that's too long, and in the end, this approach does nothing to the image (the offset for each pixel is `<< 1`). Any ideas?
Distorting an image using a height map?
CC BY-SA 2.5
0
2011-03-02T18:33:01.917
2011-03-07T21:11:15.307
2020-06-20T09:12:55.060
-1
464,744
[ "c++", "python", "image-processing", "opencv", "unwarp" ]
5,171,869
1
5,174,334
null
0
63
Any idea or link of how to declare / use a particular image or icon to represent a custom or commonly used class / object in U.M.L. (Custom U.M.L. extension), not just "<< my stereotype >>" ? By example, U.M.L. 2.* has custom images for 3 - layers methodology: ![Custom image for layers](https://i.stack.imgur.com/51IJ7.png)
UML Custom Image Extension
CC BY-SA 2.5
null
2011-03-02T18:40:51.610
2011-03-03T09:35:29.160
2011-03-02T19:33:35.910
535,724
535,724
[ "uml" ]
5,172,091
1
null
null
5
1,142
Found an interesting problem that I first found in WinForms, and found again in Silverlight, and more than likely WPF as well when it comes to databinding. I have a tab control with several tabs. As users click across the tabs, each time should be valid before allowing the user to switch from the tab. For example, user is in a text box which is updated. Binding of text boxes is not flushed until the control loses focus. Loss of focus occurs when the cursor is moved from the control, and focus is given to another control. In this scenario, the user tabs into a control (let's use text box for this example), and updates the text box. At this point the databinding has not flushed the control, and hence the VM has not yet seen the change. The user then uses their mouse to click the next tab of the control. At this point things get interesting. I used the PreviewSelectionChanged (Telerik RadTabControl), as I want to check things out before the jump to the next tab occurs, and it also gives me the ability to cancel the event. However, when I look at the VM, in this event, it still does not have the updated data. I see the VM is clean, and go ahead and allow the jump to the next tab. As soon as this event is over however, the databindings flush, and the VM gets updated. what now? The events are out of sync! When the mouse was used to click the next tab, the textbox should have lost focus, flushed it's bindings, before the Preview of the Tab click! It's to late to jump back and say oops we didn't catch that in time! I think I found an interesting work around to this issue - but I'm not 100% sure it will work 100% of the time. I cancel the current event, but then I use the Dispatcher and create a delegate pointing to another method with the same signature as the current event. The Dispatcher will add this message to the message pump, which by this time will now (hopefully?) be behind the messages of the VM updating... ![Code Snippet delaying the event](https://i.stack.imgur.com/5WY2g.jpg) My two questions are: 1) I'm assuming that the textbox control either didn't flush when the mouse left the control, or the process that was fired was too slow and hence the preview message was on the pump before the databinding - either way I see this to be a major issue. 2) Is the workaround a good solution?
Databinding falls behind event notification - discussion
CC BY-SA 2.5
0
2011-03-02T19:04:22.737
2011-04-13T16:38:07.760
2011-03-28T23:42:06.370
176,338
176,338
[ "wpf", "silverlight", "events", "data-binding", "mvvm" ]
5,172,182
1
5,172,469
null
3
1,462
I asked yesterday [a question](https://stackoverflow.com/questions/5161046/html-div-positions-and-display) about css div positioning, now I solved my issue with your answers, but now I have another problem let me try to explain, ![enter image description here](https://i.stack.imgur.com/MXpSO.jpg) I have a page as shown above, I want that "B" div has 100% height but there is something wrong with absolute divs when "C" has long content then "B" is not following "C" and the 100% height doesn't work. When the position property of is set to fixed then it works on IE but not on chrome. Here is the CSS code, ``` * { padding: 0; margin: 0; } #container { background-color: Fuchsia; height:100%; width:100%; position: absolute; } #a { width: 100%; height: 100%; background-image: url(images/img01.jpg); background-repeat: repeat-x; position: absolute; z-index:0; } #b { margin-left: 40px; float: left; background-image: url(images/left_menu_filler.jpg); background-repeat: repeat-y; position: absolute; margin-top: 0px; height: 100%; } #c { width: 800px; height: 10200px; margin-top: 125px; margin-left: 230px; background-color: #999999; position: absolute; } #d { width: 0px; height: 0px; margin: 10px 20px 0px 0px; background-color: #ff0220; position: absolute; } #e { width: 300px; height: 26px; margin: 0px 80px 0px 0px; float: right; background-color: #ff0220; } ``` Can you please help me with that problem ? Which properties should I change ?
CSS 100% height DIVs
CC BY-SA 2.5
0
2011-03-02T19:12:32.470
2011-03-02T19:46:14.513
2017-05-23T12:30:36.930
-1
326,947
[ "html", "css" ]
5,172,332
1
5,172,367
null
0
709
OK, pulling my hair out! Why doesn't my type `MoreViewController` change when I change the NIB: ![See MoreViewController that should be changed when I do pic number two](https://i.stack.imgur.com/pn0Lf.png) ![Ok I changed it so change IB? WTF?](https://i.stack.imgur.com/6RJpE.png)
Why won't Interface Builder change my type of ViewController?
CC BY-SA 2.5
null
2011-03-02T19:24:36.310
2011-03-02T19:32:47.830
2011-03-02T19:27:35.853
23,897
307,428
[ "iphone", "ios", "uiviewcontroller", "viewcontroller" ]
5,172,533
1
5,172,652
null
0
259
I have an unordered list of items, I want to display each item as a box with two lines of text inside, each line with different properties (font, size, text-align...). The markup I am using for each item looks like this: ``` <li id="1"> <p class="first"><!-- First line of text --></p> <p class="last"><!-- Second line of text --></p> </li> ``` Using CSS I want it to display sort of like this: ![Layout](https://i.stack.imgur.com/ps7uz.png) My questions are: 1. I know this can be achieved in various ways with CSS, but what is the right way or best practice to do it for best cross-browser support? can you point me to a CSS example for something similar? the first text label should be 2 px from the top border and the second one 2 px from the bottom. 2. Is this the right markup for the text labels? or should I be using other tags instead of <p>? maybe <div>? I am using `display: block` for the `<li>` tags, with fixed `width` and `height`. Thanks in advance.
CSS layout for box with two text labels?
CC BY-SA 2.5
null
2011-03-02T19:44:10.500
2011-03-03T03:05:47.163
null
null
483,780
[ "html", "css", "layout" ]
5,173,120
1
null
null
5
483
I'm having the weirdest issue in IE (7, specifically) when implementing CSS borders. I first noticed this a few months ago. The CSS is literally this: `#donate {border:1px solid #299ae5;}` As you can see from the attached image, both of these screenshots were taken in IE7, from the same website, different pages - same template file. It's like the border has a "tail" in the bottom left corner. ![enter image description here](https://i.stack.imgur.com/8oOoc.png) Does anyone have any insight about this??? Edit: Here is the HTML (although I've seen this also on random sites in IE7 recently on input fields as well) ``` <li><a href=""><span>Donate</span></a></li> ``` And here's the CSS: ``` li { display: inline; } li a { color: #fff; display: block; float: left; margin-right: 8px; padding-right: 8px; line-height: 1.2em; } li a span { background: url(bg-gradient.png) repeat-x 0 0; border: 1px solid #299a35; padding: 1px 5px 2px 4px; } ``` Thanks in advance!
Border rendering issue in IE
CC BY-SA 3.0
null
2011-03-02T20:36:30.683
2011-08-24T12:34:58.703
2011-07-21T15:04:26.390
128,662
439,260
[ "css", "internet-explorer-7", "border" ]
5,173,835
1
5,175,431
null
2
287
I'm outputting categories with subcategories listed underneath. Each subcategory gets a comma prepended to it if it's not the first item in the loop. Also, I am only displaying four results, so if the record count is more than four, I need to append `...` to the end of the fourth loop result. The problem is that in instances where `...` has been applied there is an extra space after each subcategory. See below: ![enter image description here](https://i.stack.imgur.com/HkWPW.png) See how there is a space before the comma? Code: ``` <ul class="defaultUL" style="float:right;"> <cfloop query="getParent" startrow="7" endrow="12"> <cfquery name="getSubCategory" datasource="dss"> SELECT Name, ID FROM Category WHERE ParentID = #getParent.ID# </cfquery> <cfset SubNumb = getSubCategory.recordcount> <li><h3><a href="?Page=#Application.Utility.qsEncode(getParent.Name)#">#getParent.Name#</a></h3> <cfloop query="getSubCategory" startrow="1" endrow="#SubNumb#"> <cfif SubNumb gt 4> <cfif getSubCategory.currentRow lt 4 AND getSubCategory.currentRow gt 1> , #getSubCategory.Name# <cfelseif getSubCategory.currentRow eq 1> #getSubCategory.Name# <cfelseif getSubCategory.currentRow eq 4> #getSubCategory.Name#... </cfif> <cfelse> #getSubCategory.Name#, </cfif> </cfloop> </li> </cfloop> </ul> ``` I made sure that the data in the database didn't have whitespace at the end.
Output creating undesired whitespace
CC BY-SA 3.0
null
2011-03-02T21:39:28.060
2012-12-10T20:59:48.443
2012-12-10T20:59:48.443
128,421
445,303
[ "coldfusion", "whitespace" ]
5,173,860
1
5,174,926
null
2
6,445
I have a layouting problem with my android application: I have a Listview consiting of items which are using the following layout: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:minHeight="40px" android:orientation="horizontal"> <TextView android:layout_gravity="center_vertical" android:textSize="20px" android:id="@+id/track_position" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> <LinearLayout android:layout_width="wrap_content" android:layout_height="fill_parent" android:orientation="vertical" android:layout_gravity="center_vertical" > <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/track_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:paddingLeft="8dip" android:textSize="14px" /> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/track_artist" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:paddingLeft="8dip" android:textSize="8px" /> ``` This comes up with the following result: ![enter image description here](https://i.stack.imgur.com/PsN9v.png) But i would like to have the tracks title and subtitle centered as well. like that: ![enter image description here](https://i.stack.imgur.com/DPT1T.png) So AFAIK i did everything so that this would be the result.
Vertically center content of ListItem in ListView
CC BY-SA 2.5
0
2011-03-02T21:41:19.057
2011-03-02T23:42:58.250
2011-03-02T22:00:26.320
638,344
638,344
[ "android", "android-layout", "listitem" ]
5,173,915
1
5,174,107
null
3
864
Searched and found many results and tried everything but couldnt figure it out! Created an app in VS 2008 and published to an existing iis6 server and works fine. We just got a new Windows 2008 RC2 server with iis7.5 and when I publish there I get this error (on the local machine) ![enter image description here](https://i.stack.imgur.com/CyQv0.jpg) I installed the AJAX Libs and toolkit also tried adding things to the web.config. I can provide any necessary information. Thanks!
.net iis cannot load file assembly
CC BY-SA 2.5
null
2011-03-02T21:46:14.170
2011-03-03T01:22:13.793
2011-03-03T01:22:13.793
104,267
413,401
[ ".net", "web-config", "iis-7.5", ".net-assembly" ]