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,913,875
1
5,913,926
null
2
928
It may sound obvious: I'm used to design mockups of my webpages with illustrator.When I translate everything to css and test the page into my browser I can see that fonts are bigger in the illustrator mockup even if I used the same font setting on the css side. ![enter image description here](https://i.stack.imgur.com/JTsUC.jpg) ``` //in css i have body{font:Georgia,"Times New Roman",Times,serif;font-size:16px; font-weight:normal;} //I wrapped the example text inside "h1" tags h1{font-size:24px;font-weight:normal;} //in illustrator I have font georgia,24px,font-style "regular" selected ``` thanks Luca
mockup web layout font is smaller than illustrator
CC BY-SA 3.0
null
2011-05-06T15:50:17.293
2011-05-06T16:01:29.550
null
null
505,762
[ "css", "font-size", "adobe-illustrator", "mockups" ]
5,913,943
1
5,914,010
null
0
210
Hey guys I'm trying to create something similar to the image below. As you can see I have 2 containers both will be of varying sizes. ({DEPARTMENT OF BUSINESS} {-------}) The left container will have text, and the right container a line image. I basically want the 2 to take up 100% of that space. I think my code should explain what I'm trying to do. I don't even know if I'm going about this the correct way because even if I use the line as the background image how would I then push it down to make it vertically center? I'm getting no where with margins and padding. ![enter image description here](https://i.stack.imgur.com/sjujY.png) Here's my code: ``` <div id="DepartmentHeader" class="clearfix" style="width: 626px"> <div id="DepartmentHeaderText" style="float:left">DEPARTMENT OF BUSINESS</div> <div id="DepartmentHeaderDivider" style="float: left; width: 50%; background: url('images/DepartmentHeaderDividerLine.png') repeat-x;">&nbsp;</div> </div> ```
CSS 2 div's varying size 1 with image
CC BY-SA 3.0
null
2011-05-06T15:57:02.970
2011-05-06T16:13:55.293
null
null
546,489
[ "css" ]
5,913,950
1
null
null
13
5,091
I've been searching struggling with this for a while now and need some help. I just want to draw 25 lines from the centre of my display (160,200) at 14.4 degrees separation. I have been using this line of code in a for loop where x is the 14.4 degree multiplier - ``` UIImage*backgroundImage = [UIImage imageNamed:@"Primate Background Only.png"]; [backgroundImage drawInRect:CGRectMake(0, 0, 320, 480)]; ``` // Draw Outer Circle ``` rect = CGRectMake(0.0, 35.0, 320.0, 320.0); CGContextRef contextRef = UIGraphicsGetCurrentContext(); // Get the contextRef CGContextSetLineWidth (contextRef, 0.5); // Set the border width CGContextSetRGBFillColor (contextRef, (219.0f/255.0f), (219.0f/255.0f), (219.0f/255.0f), 0.05f); // Set the circle fill color to GREEN CGContextSetRGBStrokeColor (contextRef, 0.0, 0.0, 0.0, 0.2); // Set the circle border color to BLACK CGContextFillEllipseInRect (contextRef, rect); // Fill the circle with the fill color CGContextStrokeEllipseInRect (contextRef, rect); // Draw the circle border ``` // Draw Inner Circle ``` rect = CGRectMake(25.0, 60.0, 270.0, 270.0); // Get the contextRef CGContextSetLineWidth (contextRef, 0.5); // Set the border width CGContextSetRGBFillColor (contextRef, (219.0f/255.0f), (219.0f/255.0f), (219.0f/255.0f), 0.25f); CGContextSetRGBStrokeColor (contextRef, 0.0, 0.0, 0.0, 0.2); // Set the circle border color to BLACK CGContextFillEllipseInRect (contextRef, rect); // Fill the circle with the fill color CGContextStrokeEllipseInRect (contextRef, rect); ``` // Draw Segments ``` CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0.0, 0.0); for (x=1; x<26; x++) { CGContextSetLineWidth (context, 0.5); CGContextSetRGBStrokeColor (context, 0.0, 0.0, 0.0, 0.25); CGContextMoveToPoint (context, 160, 200); CGContextAddLineToPoint (context, (160.0 * (cos((x*14.4)*(M_PI/180)))), (160.0 * (sin((x*14.4)*(M_PI/180))))); // The angle is in degrees CGContextAddLineToPoint (context, 200, 65); CGContextAddLineToPoint (context, 160, 200); CGContextStrokePath(context); // Why is this not showing both line color and infill? CGContextSetFillColorWithColor (context, [UIColor whiteColor].CGColor); CGContextFillPath (context); CGContextRef context = UIGraphicsGetCurrentContext(); } ``` (I intended to post an image here but it won't permit me!) Can someone please correct my trig functions. This is meant to draw 25 lines clockwise from 12:00 o'clock to 24:00. Instead it draws backwards only 90 degrees then returns, all lines are way out in length also. Very grateful Above is a bigger sample of the code used to draw tow outer circles and the interior segments as requested. I'll try and upload the image next. ![enter image description here](https://i.stack.imgur.com/udFT3.png)
Core Graphics - drawing a line at an angle
CC BY-SA 3.0
0
2011-05-06T15:57:36.160
2011-05-08T04:01:05.143
2011-05-08T03:02:40.300
73,681
742,069
[ "iphone", "objective-c", "core-graphics" ]
5,914,334
1
5,914,341
null
4
1,651
After using Visual Studio for a week, I find CodeBlocks and other IDEs in Linux far inferior. I don't know if I am missing something, but I would love to have an IDE like VS in Linux. I have tried gdb, but I find it difficult to use. For instance, is there anything in Linux that can inspect values of a linked list like how Visual Studio shows. ![enter image description here](https://i.stack.imgur.com/zUf3J.png) I need to try out DDD. (the interface looks so 1980s :()
Debugging C++ in Linux
CC BY-SA 3.0
0
2011-05-06T16:31:24.690
2019-03-28T17:39:36.737
2011-05-06T16:46:33.523
94,169
94,169
[ "c++", "linux", "debugging", "linked-list" ]
5,914,660
1
5,915,180
null
1
1,233
I have a javascript function that builds an URI fragment using some captured parameters, and then submits my form. Example: ``` function consultResource(contextName){ var form = document.forms[0]; var f1 = form.thename.value;//accepts strings without special symbols var f2 = escape(form.thedate.value); //accepts only strings in the form 'dd/mm/yyyy' var action = "/"+contextName+"/CtrlComparison?name="+f1+"&date="+f2; form.action = action; form.submit(); } ``` An example generated URI fragment would be `/MyContext/CtrlComparison?name=report01&date=06/05/2011` This snippet works, submitting the form and bringing a PDF document OK for: - - - - But I need it to work in Internet Explorer 9 too. Currently when I submit the same info in IE9 I get the following message: ![real result](https://i.stack.imgur.com/tBS9l.png) instead of something like this: ![expected result](https://i.stack.imgur.com/2oD6U.png) IE9 is not escaping the `/` and taking them as part of path separators on URI. The question is: Thanks in advance.
Escaping "/" doesn't work in IE9
CC BY-SA 3.0
null
2011-05-06T16:59:36.813
2011-05-06T19:52:43.743
2011-05-06T17:05:52.507
218,717
218,717
[ "javascript", "cross-browser", "escaping", "uri", "internet-explorer-9" ]
5,914,855
1
5,915,339
null
0
2,059
I'm having this problem where a `TableLayout` of `Button`s is relocating all `Button` objects whenever i call `Button.setText(String)`. i've given no indication that the `View` should be moved... and i really don't want it to. if anyone knows how to keep these `Views` from moving (without a whole lot of hassle if possible), please let me know. i'm using some unorthodox methods for getting the screen setup. here's the code: static_grid_layout.xml: ``` <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:stretchColumns="*" android:gravity="center"> <TableRow android:layout_height="fill_parent" android:layout_width="fill_parent"> <Button android:id="@+id/btn1" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn2" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn3" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn4" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn5" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn6" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn7" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn8" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn9" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn10" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn11" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn12" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn13" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn14" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn15" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn16" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn17" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn18" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> <TableRow> <Button android:id="@+id/btn19" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn20" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> <Button android:id="@+id/btn21" android:layout_width="100dip" android:layout_height="80dip" android:gravity="center" android:ellipsize="marquee"/> </TableRow> </TableLayout> ``` MainActivity.java: the part of particular interest will be here: ``` query = "SELECT * FROM "+DbSchema.ProductSchema.TABLE_NAME+ " ORDER BY "+DbSchema.ProductSchema.COLUMN_PRIORITY+" ASC"; updateList(listQuery(query)); fillPage(mPage); setContentView(mPage); ``` toward the bottom of the code in the `onResume()` override. here is the undesired behavior in an image. the `Button`s ONLY get that retarded y offset when i call setText(). if i call setText("") [empty String] the location of the button does not change. what gives? ![](https://i335.photobucket.com/albums/m470/jmartin866/fedup.png)
android: calling Button.setText() causes undesired relocation of Button
CC BY-SA 3.0
null
2011-05-06T17:21:24.647
2011-05-07T10:59:37.100
2017-02-08T14:32:08.273
-1
329,993
[ "java", "android", "button", "view", "tablelayout" ]
5,915,036
1
5,915,446
null
0
1,074
I have added "Images" folder inside "src" folder in Java project. For setting top left image on title bar I am using image from Image folder. To do that I have written code `Image img=Toolkit.getDefaultToolkit().getImage("src/Images/Sell Smart2 copy.jpg"); frame.setIconImage(img);` This works fine when project run through Netbeans But when I run jar of that project through command line using command "java -jar project.jar" then Image is not shown. Why this problem coming ? Any solution for that Thanks, Image added for refernce. ![enter image description here](https://i.stack.imgur.com/p0blF.png)
Relative path does not work when jar run through command line but works when run through Netbean
CC BY-SA 3.0
null
2011-05-06T17:41:49.537
2011-05-06T18:26:15.983
null
null
656,389
[ "java", "swing", "netbeans" ]
5,915,314
1
5,916,313
null
2
1,432
I have this in several areas of an app I'm working on and I can see no way to replicate it outside of this app. I can't create a sscce since I can't manage to replicate this at all - This leads me to believe that it must be something caused by the parent frame / app, but I have no idea where to look. What I see is that part of the left hand side of popup menus are not painted. I see this behaviour with JCombobox popups as well as JPopupMenu's. I've attached a couple of images to show what I mean. most of these did work properly previously and without any changes to the code where the popupmenu's are created or displayed, this problem has spread to a lot of other places now. I'm not mixing heavyweight and lightweight components, as we only use Swing components and the two examples I show below are in completely different parts of the app. The first one is in a fairly simple panel with very little functionality, but the second example (JPoopupMenu) is in a very complex legacy panel. On both of these and other place where I see it, I'm not altering the parent's clipping region at all and in all case, these popups are constructed and displayed on the EDT. I know this question is rather vague, but that is because of the nature of the problem. I'll provide any requested info. ![JComboBox popup issue](https://i.stack.imgur.com/73oGz.jpg) This specific case happens to be a custom combobox model, but we've seen it when using the DefaultComboBoxModel as well: ``` public class GroupListModel extends AbstractListModel implements ComboBoxModel{ private List<groupObject> groups; private groupObject selectedItem = null; public GroupListModel() { this(new ArrayList<groupObject>()); } public GroupListModel(List<groupObject> groups) { this.groups = groups; } @Override public int getSize() { return groups.size(); } @Override public Object getElementAt(int index) { if(index>=groups.size()){ throw new IndexOutOfBoundsException(); } return groups.get(index); } public void setGroups(List<groupObject> groups){ this.groups = groups; fireContentsChanged(this, 0, groups.size()); } public void addElement(groupObject group){ groups.add(group); fireIntervalAdded(this, groups.size()-1, groups.size()-1); } public void addElement(groupObject group, int index){ groups.add(index, group); fireIntervalAdded(this, index, index+1); } @Override public void setSelectedItem(Object anItem) { if(anItem instanceof groupObject){ selectedItem = (groupObject) anItem; }else{ throw new IllegalArgumentException(); } fireContentsChanged(this, 0, groups.size()); } @Override public Object getSelectedItem() { return selectedItem; } ``` This is a JPopupMenu that gets displayed when you right click using the following code: ![JPopupMenu paint problem](https://i.stack.imgur.com/MUNve.jpg) ``` public void mouseClicked(MouseEvent e) { if( e.getButton()==e.BUTTON3 ){ lastClickedID = tmp.getUniqueID(); lastClickedGui = (bigEventGui) gui; itmComplete.setText( completed ? ctOne.getLang("uncomplete") : ctOne.getLang("complete") ); itmComplete.setIcon( (completed ? iconFramework.getIcon( iconFramework.UNCOMPLETE_ITEM, 24, false) : iconFramework.getIcon( iconFramework.COMPLETE_ITEM, 24, false) )); popRCEvent.show(gui, e.getX(), e.getY() ); } ```
Swing Popup menus are not completely painted
CC BY-SA 3.0
null
2011-05-06T18:07:45.010
2011-05-06T19:47:30.460
2011-05-06T19:23:50.320
436,176
436,176
[ "java", "swing", "jcombobox", "jpopupmenu" ]
5,915,566
1
null
null
1
272
The VEVO app on iPhone sets a great sample for video oriented apps. I'm working on something similar, and I want to now how to customize the video controller as VEVO does. My current app is based on the built-in controller. It's OK, but I want to make it tremendous. I've attached a screenshot. How to implement the progress bar? ![VEVO Screen Shot](https://i.stack.imgur.com/Ivipc.png)
How to make an app like VEVO?
CC BY-SA 3.0
0
2011-05-06T18:30:07.847
2011-05-07T04:29:38.933
2011-05-07T04:29:38.933
525,301
525,301
[ "iphone", "ios", "video", "customization" ]
5,916,215
1
5,916,358
null
2
740
I'm running an asp.mvc web application on localhost on iis7 (win7) and I don't get my normal yellow screen of death with the call stack. I always get a page full of random unreadable characters. Has anyone ever seen this? How do I get my callstack back? ![Error Stack Characters](https://i.stack.imgur.com/VxTFi.png)
asp mvc iis7 debug mode errors page outputs unreadable characters
CC BY-SA 3.0
null
2011-05-06T19:37:39.437
2011-05-06T19:53:03.253
null
null
8,772
[ "asp.net-mvc", "iis-7", "stack-trace" ]
5,916,226
1
5,916,263
null
19
21,388
I have a JFrame which contains just one JPanel. I have tried setting the Panel's size and packing the frame, but that has no effect. If I set the JFrame's size, it will change the size so it includes the title bar and borders. How do I set the "actual size" so it doesn't include the title bar and borders? Example: ![Example](https://i.stack.imgur.com/PU93n.jpg) Thanks in advance, guys
Java Swing set "actual" Frame size (inside)
CC BY-SA 3.0
0
2011-05-06T19:39:35.087
2017-01-15T14:38:49.437
null
null
700,144
[ "java", "swing", "frame" ]
5,916,345
1
5,919,827
null
0
1,127
I am using VS2010. I am trying to make reports using Report Viewer. This is how I have arranged my fields (using Table). ![enter image description here](https://i.stack.imgur.com/rDwha.png) I want to make it look like this ![enter image description here](https://i.stack.imgur.com/NIwAq.png)
How to arrange fields in a vb.net report
CC BY-SA 3.0
0
2011-05-06T19:51:17.257
2011-05-07T07:57:50.083
null
null
722,000
[ "vb.net", "reportviewer", "report" ]
5,916,466
1
5,916,713
null
1
530
Sorry I had to rephrase my question, I have a list preference with some option ![enter image description here](https://i.stack.imgur.com/5peTo.png) I want to change the value of a variable depending on the option selected. I have no idea how to get the selected index or where to start from.
Performing an action when a listpreference option is selected
CC BY-SA 3.0
null
2011-05-06T20:05:59.907
2016-05-12T15:49:44.120
2016-05-12T15:49:44.120
750,510
647,423
[ "android", "multithreading", "preferences" ]
5,916,581
1
5,917,849
null
12
11,612
Trying to understand the relationship between UIView and CALayer. I read Apple documentation but it doesn't describe in detail the relationship between the two. 1. Why is it that when I add the background image to view "customViewController.view", I get the unwanted black color of the image. 2. And when I add the background image to the layer "customViewController.view.layer", the black area of the image is gone (which is what I wanted), but the background image is flipped upside down. Why is that? 3. If I were to add labels/views/buttons/etc. to the view, will the layer's background image block them because CAlayer is backed by UIView? 4. When you set the background color of a UIView does it automatically set the background color of the associated layer? - (void)viewDidLoad { [super viewDidLoad]; customViewController = [[CustomViewController alloc] init]; customViewController.view.frame = CGRectMake(213, 300, 355, 315); customViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"login_background.png"]]; // customViewController.view.layer.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"login_background.png"]].CGColor; [self.view addSubview:customViewController.view]; } Background image in view: ![background in view](https://lh4.googleusercontent.com/_d2JwJUrXxVM/TcROGNhnmWI/AAAAAAAABhU/GjaR_Lh_-KM/s400/secondscreen.png) ``` - (void)viewDidLoad { [super viewDidLoad]; customViewController = [[CustomViewController alloc] init]; customViewController.view.frame = CGRectMake(213, 300, 355, 315); // customViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"login_background.png"]]; customViewController.view.layer.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"login_background.png"]].CGColor; [self.view addSubview:customViewController.view]; } ``` Background image in view.layer: ![background image in layer](https://lh5.googleusercontent.com/_d2JwJUrXxVM/TcROBJTA72I/AAAAAAAABhQ/l_jgSYNMZa8/s400/firstscreen.png)
Relationship between UIVIew and CALayer regarding background image on iOS
CC BY-SA 3.0
0
2011-05-06T20:19:01.573
2011-05-07T17:20:34.630
2011-05-06T22:25:08.533
296,387
514,744
[ "iphone", "ios", "uiview", "uikit", "calayer" ]
5,916,607
1
5,916,628
null
1
1,701
Question: - - - Here's a screenshot of the Access Runtime Application: ![App Screenshot](https://i.stack.imgur.com/uG1aN.jpg) The User selects Search Criteria: - - - - Male / Female Lowest Rate table displays: - - - All Rates Table displays: - - - Carrier Information table (when user clicks on a carrier name) displays: - - - - - - Any helpful answers will get an up-vote! Thanks for looking!
ASP.NET - Iframe Equivalent to Display Multiple Gridviews using Ajax or UpdatePanel
CC BY-SA 3.0
0
2011-05-06T20:23:01.500
2011-05-24T19:19:31.440
2011-05-24T19:19:31.440
606,805
606,805
[ "asp.net", "ajax", "gridview", "iframe", "updatepanel" ]
5,916,913
1
null
null
2
2,880
I have the below as part of a web application(asp.net) is there any way to convert it to excel? The problem is printing it. Landscape is the desired format and persons in the organization are very novice so to improve usability i want to allow it to be in landscape. I tried activex and sendkeys commands. This works but not what i desire.. Please help.... ![Budget Application](https://i.stack.imgur.com/wAo5E.png)
Convert a website to Html to Excel
CC BY-SA 3.0
null
2011-05-06T20:54:25.370
2017-04-05T04:03:38.217
null
null
641,852
[ "c#", "asp.net", "html", "excel" ]
5,916,939
1
5,917,269
null
2
5,616
My goal is to add different Controls/UserControls in a WPF ListView. The Controls can be of any types. Here is an example of what it would look like with 3 different Controls/UserControls: ![enter image description here](https://i.stack.imgur.com/RlQQl.jpg) This would work if I use the following XAML and code: ``` <ListView Name="ControlsListView"> <ListView.View> <GridView> <GridViewColumn Header="Control"/> </GridView> </ListView.View> </ListView> ``` Here is the code: ``` ObservableCollection<Control> Controls { get; set; } //... ControlsListView.ItemsSource = Controls; //... Controls.Add(new ThresholdControl()); Controls.Add(new CheckBox()); Controls.Add(new Button() { Content = "Test" }); ``` My problem is when I want to add a level of indirection in the ObservableCollection. Instead of using directly a collection of Control, I would like to have a collection of MyItem. MyItem would itself contain the Control to display. Something like this: ``` class MyItem { public Control MyControl { get; set; } } ``` ``` ObservableCollection<MyItem> Controls { get; set; } ``` And I would bind my ListView like this: ``` <GridViewColumn Header="Control" DisplayMemberBinding="{Binding MyControl}"/> ``` When displaying a string, this will work ok, but for displaying a Control, this won't work. In fact, in my example, it would display the string representing the class of the Control inserted in the list instead of the Control itself. What do I need to do to bind to the Controls in my list? DisplayMemberBinding doesn't seem to be the good choice here. Thanks!
ListView databinding to display usercontrols
CC BY-SA 3.0
0
2011-05-06T20:56:59.687
2011-05-06T23:14:35.470
2011-05-06T21:03:27.953
638,167
638,167
[ "wpf", "data-binding", "listview" ]
5,916,981
1
5,917,165
null
1
223
I am testing how many requests my web server can respond to, and I'm using a Test project in VS 2010, using a LoadTest running 1 single actual test method. I'm getting results, but I'm not sure what they mean. In the graph below, "Test Response Time", I'm not sure what scale these numbers are from. Any have the legend available? ![enter image description here](https://i.stack.imgur.com/LsvRk.png)
ASP.Net Load Test -- what do these values mean?
CC BY-SA 3.0
null
2011-05-06T21:03:14.037
2011-05-06T21:24:16.547
null
null
232
[ "visual-studio-2010", "load-testing" ]
5,917,313
1
null
null
3
778
I'm looking to have a count of the number of comments left under an article and display it on the index page beside that particular article - like the example here in red circles. Any suggestions as to how I might do this? The picture is an example of what I'm trying to do, its not my site. ![enter image description here](https://i.stack.imgur.com/jz4vQ.png)
RoR - How To Count & Display Comments
CC BY-SA 3.0
null
2011-05-06T21:41:34.813
2011-05-07T13:32:42.230
2011-05-07T13:32:42.230
372,237
372,237
[ "ruby-on-rails-3" ]
5,917,703
1
5,964,531
null
0
1,057
Sorry if this was already answered before. I did a little searching and found nothing that could solve my problem. I created an application with Spring Roo, then converted to a GWT app. All the code generated by Spring Roo is only for CRUD. Now i want to add a Calendar for make appointments, so i need to move to another page. I´ve added this code to ``` public ScaffoldDesktopShell() { initWidget(BINDER.createAndBindUi(this)); startButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { RootLayoutPanel.get().add(new NovoPainel()); } }); } ... ``` Then created a new UIbinder, called it and added this code: ``` public NovoPainel() { initWidget(uiBinder.createAndBindUi(this)); botao.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { RootLayoutPanel.get().clear(); RootLayoutPanel.get().add (new ScaffoldDesktopShell()); } }); } ``` Everything goes fine moving from my root panel to NovoPainel, but when i need to go back to rootPanel the page doesn´t render correctly. EX: Doesn´t show ** ValuePicker ** to click on left panel and render on center. This is my RootPanel ![http://www.flickr.com/photos/martinhoarantes/5694616812/in/photostream](https://i.stack.imgur.com/QEzrT.jpg) and this image is when navigate from rootPanel to NovoPainel ![enter image description here](https://i.stack.imgur.com/YuQAR.jpg) and finally this one is returning from NovoPainel to RootPanel ![enter image description here](https://i.stack.imgur.com/z2idA.jpg)
GWT RootLayoutPanel - Problem rendering page from second to first (first works fine)
CC BY-SA 3.0
null
2011-05-06T22:31:29.750
2011-05-15T16:02:03.953
null
null
420,662
[ "java", "gwt", "spring-roo", "uibinder" ]
5,918,002
1
5,918,566
null
0
321
Is there an example somewhere of how to make different irregular shaped parts of an image clickable? For example the different buttons in this image? ![A sample dpad image](https://i.stack.imgur.com/phrgw.png)
Making clickable regions in an image in android
CC BY-SA 3.0
0
2011-05-06T23:22:57.507
2011-05-07T01:30:35.260
2011-05-07T00:53:33.180
727,425
727,425
[ "android", "widget" ]
5,918,171
1
5,918,241
null
1
576
This is continued question from [Par1](https://stackoverflow.com/questions/5910281/jquery-dependent-drop-down-boxes-populate-how). Scenario: I've drop down shown below. ![enter image description here](https://i.stack.imgur.com/PcTa2.jpg) Lets say today is . From drop down shown above, if the user selects the hour drop should contain . But, if the user selects then the Start Date Hour Drop down should contain . could anyone guide me if this is possible at all using JQuery please?
Jquery dependent drop down boxes populate- how Part II
CC BY-SA 3.0
null
2011-05-06T23:59:09.857
2011-05-07T02:59:20.020
2017-05-23T12:13:29.403
-1
656,348
[ "jquery" ]
5,918,216
1
5,920,446
null
15
3,193
I'm working in a custom control which mix two windows controls (listview and treeview). In some point, I need to draw the image which uses windows 7 (with themes enabled) to identify the parent nodes, I'm using the [DrawThemeBackground](http://msdn.microsoft.com/en-us/library/bb773289%28v=vs.85%29.aspx) function with the `TVP_GLYPH` part and the `GLPS_CLOSED` state (I tried with all the parts and states related to the `TREEVIEW` class without luck), but the result image always is the (+) or (-). This image show the issue ![enter image description here](https://i.stack.imgur.com/DWgDc.png) I want to draw the image (inside of black circle) instead of the (+) sign (inside of orange circle). This is the sample code which I use to draw the image. ``` uses UxTheme; procedure TForm40.Button1Click(Sender: TObject); var iPartId : integer; iStateId: integer; hTheme : THandle; begin hTheme := OpenThemeData(Handle, VSCLASS_TREEVIEW); iPartId := TVP_GLYPH; iStateId:= GLPS_CLOSED; //iPartId := TVP_TREEITEM; //iStateId:= TREIS_NORMAL; if hTheme <> 0 then try //if (IsThemeBackgroundPartiallyTransparent(hTheme, iPartId, iStateId)) then // DrawThemeParentBackground(Handle, PaintBox1.Canvas.Handle, nil); DrawThemeBackground(hTheme, PaintBox1.Canvas.Handle, iPartId, iStateId, Rect(0, 0, 31, 31), nil); finally CloseThemeData(hTheme); end; end; ``` I check a couple of tools like the [application](https://stackoverflow.com/questions/4009701/windows-visual-themes-gallery-of-parts-and-states/4009712#4009712) made by [Andreas Rejbrand](https://stackoverflow.com/users/282848/andreas-rejbrand) and [this](http://www.codeproject.com/KB/miscctrl/VisualStyleElementBrowser.aspx) too, but I can't find the image which I want. My question is : how I can obtain the image? Thanks to the answer posted for [Stigma](https://stackoverflow.com/users/207504/stigma) I found additional resources to the values of the parts and states of the `Explorer::Treeview` class. - [VisualStyleRenderer and themes](https://stackoverflow.com/questions/3014816/visualstylerenderer-and-themes-winforms)- [CodeProject](http://www.codeproject.com/KB/list/ObjectListView.aspx?msg=3492581#xx3492581xx)
How can obtain the image which uses windows 7 to draw the parent nodes in a treeview control?
CC BY-SA 4.0
0
2011-05-07T00:08:02.787
2021-03-14T01:35:37.430
2021-03-14T01:35:37.430
91,299
91,299
[ "delphi", "winapi", "custom-controls" ]
5,918,595
1
5,920,323
null
59
28,453
On the left is the original PNG and on the right are versions reduced to roughly half the original size using `width` and `height`. Why does the resized image look so fuzzy in Firefox? Is there anything I can do about it without changing the image file? The fuzziness is particular annoying if the image contains large amounts of math or text. ![enter image description here](https://i.stack.imgur.com/PtWbZ.png)
Make Firefox image scaling down similar to the results in Chrome or IE
CC BY-SA 4.0
0
2011-05-06T22:05:22.430
2021-02-17T17:01:49.463
2021-02-17T17:01:49.463
2,065,702
385,513
[ "image", "firefox", "resize" ]
5,918,610
1
5,918,939
null
1
201
I have two users ( & ) authenticated with my app. The two users have different permissions allowed for the app. Both users are friends with . When I try to get the content at this URL: ``` https://www.facebook.com/other_user/posts/10150177165252500 ``` It works for , but not for . gets ``` resp=false ``` Here are the permissions for , who can get the content: ![enter image description here](https://i.stack.imgur.com/BMWKr.png) ![enter image description here](https://i.stack.imgur.com/2oNps.png) Here are the permissions for , who can NOT get the content: ![enter image description here](https://i.stack.imgur.com/om2ha.png) What permission does have that allows them to get the content, that does not have? EDIT: Forgot to mention, both users can SEE the content through the Facebook webpage.
What Facebook permission am I missing that is causing this simple request to not work?
CC BY-SA 3.0
null
2011-05-07T01:48:45.573
2011-05-07T03:34:13.727
2011-05-07T03:00:03.470
173,634
173,634
[ "facebook", "api", "facebook-graph-api" ]
5,918,616
1
5,918,792
null
3
247
I know this is a long shot but, I've been having trouble with a linker error that I specifically don't understand. Please refer to the picture below. ![enter image description here](https://i.stack.imgur.com/OIK7m.png) The project contains 4 targets. This error points specifically to one target that is a BSD/Shell helper tool written in `c`. I'm sorry for being vague, as I don't fully understand what might be the problem. Any suggestions? Thank you.
Linking error in Xcode 4
CC BY-SA 3.0
null
2011-05-07T01:50:09.757
2011-05-07T02:40:09.333
null
null
378,698
[ "objective-c", "macos", "linker", "xcode4" ]
5,918,938
1
5,921,679
null
2
5,442
I have [setup my versioned API](http://www.starkiller.net/2011/03/17/versioned-api-1/) like this with only a small tweak for backwards compatibility. In my routes I have: ``` scope '(api(/:version))', :module => :api, :version => /v\d+?/ do … scope '(categories/:category_id)', :category_id => /\d+/ do … resources :sounds … end end ``` with the successful goal already reached of having the following URL's reach the same place ``` /api/v1/categories/1/sounds/2 /api/categories/1/sounds/2 /categories/1/sounds/2 /sounds/2 ``` My directory structure is like this: ![enter image description here](https://i.stack.imgur.com/dw61y.png) The problem I am seeing is in my link generations in my views. For example, on the sound show page I have a `button_to` to delete the sound ``` <%= button_to 'Delete', @sound, :confirm => 'Are you sure?', :method => :delete %> ``` Which generates the following url in the form `action`: ``` "/api/sounds/1371?version=1371" ``` And furthermore, the `delete` method is not working, instead it is being sent as a `POST` The interesting parts of `rake routes` are: ``` sounds GET (/api(/:version))(/categories/:category_id)/sounds(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"index", :category_id=>/\d+/} POST (/api(/:version))(/categories/:category_id)/sounds(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"create", :category_id=>/\d+/} new_sound GET (/api(/:version))(/categories/:category_id)/sounds/new(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"new", :category_id=>/\d+/} edit_sound GET (/api(/:version))(/categories/:category_id)/sounds/:id/edit(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"edit", :category_id=>/\d+/} sound GET (/api(/:version))(/categories/:category_id)/sounds/:id(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"show", :category_id=>/\d+/} PUT (/api(/:version))(/categories/:category_id)/sounds/:id(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"update", :category_id=>/\d+/} DELETE (/api(/:version))(/categories/:category_id)/sounds/:id(.:format) {:controller=>"api/sounds", :version=>/v\d+?/, :action=>"destroy", :category_id=>/\d+/} ``` and the server logs show: ``` Started POST "/api/sounds/1371?version=1371" for 127.0.0.1 at Fri May 06 23:28:27 -0400 2011 Processing by Api::SoundsController#show as HTML Parameters: {"authenticity_token"=>"W+QlCKjONG5i/buIgLqsrm3IHi5gdQVzFGYGREpmWYs=", "id"=>"1371", "version"=>371} ``` I am using JQuery as my UJS and have the most recent version of rails.js for JQuery: ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <!-- must be >= 1.4.4 for the rails 3 link js to work—> <script src="/javascripts/jquery-ujs/src/rails.js?1304736923" type="text/javascript"></script> ``` I know this is `tl;dr` but my question is: "" I have tried just about every combination I can think of but can never get them to end up in the right place.
Rails 3 routing with resources under an optional scope
CC BY-SA 3.0
null
2011-05-07T03:33:49.147
2013-11-26T22:39:56.050
2011-05-07T14:09:00.343
69,634
69,634
[ "ruby-on-rails", "ruby-on-rails-3", "routes", "nested-routes", "custom-routes" ]
5,919,243
1
5,919,384
null
0
2,244
What permission do I need to obtain from the user in order to access a post from one of the users friends to another of the users friends wall? Here is a screenshot example. & are both friends of the user. has posted something on 's wall. From my application I need to get this content from the authorization of their mutual friend. ![enter image description here](https://i.stack.imgur.com/3KQTK.png) At the moment, the permissions I have from the user include this: ![enter image description here](https://i.stack.imgur.com/deTZ6.png) With these permissions I cannot access the content. The following error occurs ``` GraphMethodException: Unsupported get request. ``` How can I access the content?
What permission do I need to get from a user so that I can access a post between two of the users' friends?
CC BY-SA 3.0
null
2011-05-07T05:07:03.273
2012-01-02T07:09:09.230
null
null
173,634
[ "facebook", "facebook-graph-api" ]
5,919,298
1
6,634,668
null
83
24,757
I have a set of rectangles and I would like to "reduce" the set so I have the fewest number of rectangles to describe the same area as the original set. If possible, I would like it to also be fast, but I am more concerned with getting the number of rectangles as low as possible. I have an approach now which works most of the time. Currently, I start at the top-left most rectangle and see if I can expand it out right and down while keeping it a rectangle. I do that until it can't expand anymore, remove and split all intersecting rectangles, and add the expanded rectangle back in the list. Then I start the process again with the next top-left most rectangle, and so on. But in some cases, it doesn't work. For example: ![enter image description here](https://i.stack.imgur.com/XUvZs.png) With this set of three rectangles, the correct solution would end up with two rectangles, like this: ![enter image description here](https://i.stack.imgur.com/6FI93.png) However, in this case, my algorithm starts by processing the blue rectangle. This expand downwards and splits the yellow rectangle (correctly). But then when the remainder of the yellow rectangle is processed, instead of expanding downwards, it expands right first and takes back the portion that was previously split off. Then the last rectangle is processed and it can't expand right or down, so the original set of rectangles is left. I could tweak the algorithm to expand down first and then right. That would fix this case, but it would cause the same problem in a similar scenario that was flipped. Just to clarify, the original set of rectangles do not overlap and do not have to be connected. And if a subset of rectangles are connected, the polygon which completely covers them can have holes in it.
Algorithm for finding the fewest rectangles to cover a set of rectangles without overlapping
CC BY-SA 3.0
0
2011-05-07T05:21:13.177
2022-04-21T19:35:26.070
2016-11-22T12:50:51.983
815,724
489,645
[ "algorithm", "language-agnostic", "geometry", "rectangles" ]
5,919,777
1
8,015,594
null
2
358
I have a python script that takes a movie file name and it does it job of splitting and converting videos. However, there are red error messages that constantly pop up on the console saying: ``` [buffer @ 0xa124320] Buffering several frames is not supported. Please consume all available frames before adding a new one. ``` How can i correct this? Is there something i need to do to the videos before running ffmpeg on them? Worse, i have the screenshot below where some message gets repeated THOUSANDS of times, slowing down everything! ![A repeating (error) message which essentially slows down the splitting and converting of video files](https://i.stack.imgur.com/VGsmi.png) Any help or insight is greatly appreciated!
ffmpeg - help understanding + correcting error message
CC BY-SA 3.0
0
2011-05-07T07:47:08.400
2011-11-04T20:52:51.343
null
null
605,948
[ "python", "ffmpeg" ]
5,919,791
1
null
null
2
1,641
![enter image description here](https://i.stack.imgur.com/LOLy6.png) In Google Analytics: "Visits" - in AWStats: "Number of visits" I realize the difference between log-based and JS-based tracking, as well as bots spoofing their user agent and being counted as a human in AWStats... but I found this a little over the top. Is there something I can do with my AWStats config (currently 6.95, build 1.943) to find a happy medium between these two extremes?
Visitor count gap between AWStats and Google Analytics keeps growing
CC BY-SA 3.0
null
2011-05-07T07:50:26.867
2011-05-11T00:07:39.613
2011-05-11T00:07:39.613
697,809
697,809
[ "google-analytics", "analytics", "awstats" ]
5,919,981
1
5,920,811
null
10
13,954
I was asked to draw a graph like this one ![enter image description here](https://i.stack.imgur.com/xnD2V.png) using Latex (more precisely, tikz and/or pgf). This would not be a problem if I had the data, but I don't. All I have is the [website](http://www.google.com/transparencyreport/traffic/) from where graphs can be displayed, but I don't know how to get the data from there. I spent the day today trying to get this data, including writing to Google and using a type of software which traces the line and infers the points of a graph, such as Datathief and DigitizeIt, but I was unsuccessful. I think the latter did not work because the lines in the graph are too thin and have more than one shade of blue. Of course, I tried to improve the picture quality using Paint and Gimp but I still couldn't make it work. I also tried using eps2pgf, a Java script which transforms eps figures into pgf code, but even that was not working for the graphs I saved using Image Capture (mac) and Print Screen (Windows), and to be honest this would be my last option since it is a "brute force approach", spitting an ugly code that you can't really improve on. After all that I decided to start learning Python, because my supervisor, the person who asked me to draw this picture using tikz, said that there is a Python code to get data from websites like this. Now I am not even sure Python will do the job (though I am happy for the excuse to learn it) and of course it takes time to learn a new language and do something like that, so I want to know whether there is really a way to get the data from that website, using preferably Python but if not, any other method.
Getting data from a chart that is displayed on a website
CC BY-SA 3.0
0
2011-05-07T08:34:43.030
2011-05-08T21:35:26.363
2011-05-08T21:35:26.363
347,646
347,646
[ "python", "latex", "tikz" ]
5,920,048
1
5,932,398
null
2
812
I changed the background color for my app, but other elements keep the same background color. Looks like I missed some easy configuration, bsc for NSTabViewItems item colors is deprecated by docs, and using current theme... ![enter image description here](https://i.stack.imgur.com/wPjiu.png)
Background for Mac OS X app and other elements like NSButton, NSTabView
CC BY-SA 3.0
0
2011-05-07T08:50:37.073
2011-06-12T07:33:17.127
2011-05-07T09:09:51.067
253,056
493,920
[ "cocoa", "macos" ]
5,920,137
1
null
null
0
302
![enter image description here](https://i.stack.imgur.com/cNel9.png) Little confused with the design in android..suppose i need to position two blocks as in the figure..what shall i do?..if we use pixels the design looks different in different phones. Design should be fixed in all phones..but how without using px we can design as above
Design problem with android
CC BY-SA 3.0
null
2011-05-07T09:09:54.827
2011-05-07T10:17:19.247
2011-05-07T09:57:50.287
598,084
598,084
[ "java", "android", "xml", "design-patterns" ]
5,920,140
1
5,920,341
null
4
1,451
Before mouse over: ![enter image description here](https://i.stack.imgur.com/4Zb5X.png) ![enter image description here](https://i.stack.imgur.com/yhFX9.png) after mouse over: ![enter image description here](https://i.stack.imgur.com/REFMa.png) ![enter image description here](https://i.stack.imgur.com/81PzB.png) Seems like the glow effect will change its shape according to the image shape. Is this a NSShadow? How to implement this in code? Any clues or examples? Thanks a lot.
How can I make the shiny glow effect around an icon/image? (Pics provided inside)
CC BY-SA 3.0
0
2011-05-07T09:10:09.143
2015-07-02T03:18:45.987
null
null
115,271
[ "objective-c", "cocoa" ]
5,920,391
1
5,920,465
null
0
3,603
I'm try to get a java website and java applet up and running together. I've setup an eclipse tomcat project and created a java applet, which runs fine in the AppletViewer. However i'm having trouble launching the applet in the browser. AppletMain.class is missing for the WebContent folder what is the best way to get it to deploy correctly? Eclipse project: ![Eclipse Project](https://i.stack.imgur.com/n1NFd.png) Applet source file: ![enter image description here](https://i.stack.imgur.com/Jr2iF.png) index.jsp ![enter image description here](https://i.stack.imgur.com/2gacK.png)
Deploying Java Applet using eclipse
CC BY-SA 3.0
null
2011-05-07T10:07:05.563
2013-09-10T20:37:46.347
2013-09-10T20:37:46.347
573,032
null
[ "java", "eclipse", "appletviewer" ]
5,920,400
1
5,923,085
null
1
2,868
When I'm trying to create android application in intellij idea I get the following ``` The project wasn't generated by 'android' tool : can't find sdkmanager.jar /Users/timon/development/android-sdk-mac_x86/tools/android: line 30: dirname: command not found /Users/timon/development/android-sdk-mac_x86/tools/android: line 33: basename: command not found /Users/timon/development/android-sdk-mac_x86/tools/android: line 40: dirname: command not found /Users/timon/development/android-sdk-mac_x86/tools/android: line 44: dirname: command not found /Users/timon/development/android-sdk-mac_x86/tools/android: line 48: basename: command not found ``` showing the window: ![error](https://i.stack.imgur.com/92h4y.png) I tried to set up PATH variables locating android SDK but it doesn't help. Android SDK is installed correctly and I can create and run android projects in Eclipse. What am I doing wrong? It seems like very common error. Please help!
intellij IDEA - create android app failed
CC BY-SA 3.0
null
2011-05-07T10:09:57.287
2012-01-25T04:45:48.350
2011-05-07T11:00:24.027
1,614,955
1,614,955
[ "android", "intellij-idea" ]
5,920,722
1
6,027,376
null
0
1,592
In my iPhone app I have a UIView with a tiled background image created via `view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"IndexCard.png"]];` On my iOS3.1 device, when the view gets resized, the background image gets squashed - i.e. it tiles the same number of times but the height of each tile is reduced. Instead I would like each tile to stay the same size but the number of repeats to adjust according to the new view size. If I clear the background and then reset it the problem gets fixed, but that seems like a particular innefficient solution to the problem. On the iOS4.3 simulator it works correctly. Here's the original image - 12 lines: ![The original image](https://i.stack.imgur.com/jv0jV.png) Here's what I'm seeing when I resize the view - it still has 12 lines: ![What I'm seeing - the image is squashed](https://i.stack.imgur.com/hCaiH.png) Whereas here's what I'd really like to see - the background would be cropped to 5 lines: ![What I want to see - the image cropped](https://i.stack.imgur.com/nnHuO.png) Any ideas?
UIView background image gets squashed
CC BY-SA 3.0
null
2011-05-07T11:24:31.187
2011-05-17T07:03:59.317
2011-05-08T08:32:33.833
4,397
4,397
[ "iphone", "iphone-sdk-3.0", "ios-3.x" ]
5,920,800
1
5,920,835
null
2
264
in android i m trying to make a simple form with two buttons.. but i am facing alignment issue. can you please help in that.. here is the code ``` <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns = "1" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="UserName"></TextView> <EditText android:text="EditText" android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Password"></TextView> <EditText android:text="EditText" android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button1" android:text="save"></Button> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button2" android:text="cancel"></Button> </TableRow> </TableLayout> ``` ![enter image description here](https://i.stack.imgur.com/RZPj5.png) with this code,i am getting UI like this,but i want the buttons to be aligned,please help me
Layout design problem
CC BY-SA 3.0
null
2011-05-07T11:42:35.373
2011-05-13T15:58:42.953
null
null
164,683
[ "android", "android-emulator", "android-layout", "android-widget" ]
5,921,014
1
5,921,506
null
2
215
I have to do a homework where i have to implement user registration and login in ASP.NET. I am reading my book and it says that the first thing I should do is use `aspnet_regsql.exe` to configure, but when I went to pick the the database I get this error: ![enter image description here](https://i.stack.imgur.com/MVfFV.png) I keep trying to fix this problem, but I dont know how. At this [link](http://msdn.microsoft.com/en-us/library/x28wfk74.aspx) I found a note that says: > The database elements that are installed in the feature database will always be owned by the SQL Server database owner account (dbo). In order to install the feature database, a SQL Server login must be permitted to the db_ddladmin and dd_securityadmin roles for the SQL Server database. However, you do not need to be a system administrator for the SQL Server in order to install the feature database. I don't understand what I am missing. -What should I do? -Where can I find `db_ddladmin` and `dd_securityadmin`? As the above step looks like is not able to find the database, i thought i better create it manually. so this is what i do Step 1: ![enter image description here](https://i.stack.imgur.com/SN0Uo.png) Step 2: ![enter image description here](https://i.stack.imgur.com/IqvJV.png) Why is this happening? I just need to prepare my work enviroment to use form-based authentification. I cannot do my homework if i cant configure my working enviroment first. Can someone give me a hand to fix this? Does it have to do something with permisions or other?
First time using security in ASP.NET
CC BY-SA 3.0
null
2011-05-07T12:25:18.877
2012-06-09T09:02:31.290
2011-11-21T02:42:06.820
3,043
614,141
[ "c#", "asp.net", "sql-server", "security" ]
5,921,132
1
5,998,771
null
0
1,372
I placed a admob advertisement in my Android App ([Block Crusher](https://market.android.com/details?id=com.peerkesoftware.blockcrusher&feature=search_result)) and on QVGA the advertisment is smaller then the screen. On bigger resolutions there is no problem. ![Admob advertisment to small](https://i.stack.imgur.com/l7knw.png) I used the following xml to add the admob advertisement to the relative layout: ``` <com.google.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:adSize="BANNER" app:adUnitId="0000000000" /> ``` The width of my view is set to fill_parent and when I watch the hierarchy viewer I see that the view is the full width. Still the advertisment is shown as above. I have this problem both in the emulator as on a QVGA phone. Anybody else has this problem? And know how to resolve this?
Admob advertisement (Android) is to small
CC BY-SA 3.0
null
2011-05-07T12:45:39.117
2011-05-21T06:47:10.070
2011-05-13T23:34:50.103
359,156
359,156
[ "android", "view", "admob", "android-relativelayout" ]
5,921,139
1
5,935,897
null
2
248
I am coding an asian language learning module for my mojoportal-based iphone-optimized website (work in progress, english resources are not fully translated: [http://ilearn.dandandin.it/kanatrainer.aspx](http://ilearn.dandandin.it/kanatrainer.aspx)) It's a simple "guess how to read this" game, with the right answer stored in a Session object. I don't understand why, but, expecially using Safari, users will get someone else's Session value This is an excerpt from the code (i removed some stuff, translated the variables) ``` protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ... generateRandom(); } } protected void generateRandom() { int i, j = 0, livello = 5, chance = 0; System.Random acaso = new Random(); ... while (j <= 0) { j = acaso.Next((Convert.ToInt32(TextBoxlunghezza.Text) + 1)); } ... for (int k = 0; k < j; k++) { i = acaso.Next(livello); Session["randomLetters"] += (globals.asianCharacters[i]); ... } ... } protected void AnswerButton_Click(object sender, EventArgs e) { string compare = Server.HtmlEncode(InputTextBox.Text.ToLower()); if (compare == "") { Label1.Text = ("You did not write anything"); return; } if (Session["randomLetters"].ToString() != compare) { Label1.Text = ("Wrong!" + Session["randomLetters"]); } else { Label1.Text = ("Right!" + Session["randomLetters"]); } ... } ``` What happens in visual studio, with every browser: randomLetters is "hello". User writes "hello" in the textbox, and "hello" is compared to "hello". Label says "Right! hello". What happens in iis, only in webkit-based browsers: randomLetters is "hello". User writes "hello" in the textbox, but "hello" is compared to "goodbye". Label says "Wrong! goodbye". Public vs private code: ![the code](https://i.stack.imgur.com/1lVAN.jpg)
Why with some browsers i get a wrong value for my Session object?
CC BY-SA 3.0
null
2011-05-07T12:47:56.957
2011-05-09T10:57:29.670
null
null
118,073
[ "c#", "asp.net" ]
5,921,175
1
5,921,868
null
18
238,772
I'm developing Snake game using Java. Board's (where all action takes it place) width and height should be fixed (640 pixels * 480 pixels). Structure: - - In class I have something like... ``` setSize( 1024, 768 ); ``` ...and in Board class I have... ``` setSize( BOARDS_WIDTH, BOARDS_HEIGHT ); ``` Problem is that main and only windows seems to be like 1024 * 768, but panel inside it - not like 640 * 480. I have as well and background is filled more than 640 * 480. Is there any way to make Board's width and height like 640 * 480, but main windows width and height - as much as Board's width and height are correct? Right now it looks like this... ![Width and height are ~1000 * ~750, not 640 * 480.](https://i.stack.imgur.com/Rur4C.jpg) All works... almost. class: ``` add( new Board(), BorderLayout.CENTER ); pack(); setResizable( false ); setLocationRelativeTo( null ); setVisible( true ); setDefaultCloseOperation( EXIT_ON_CLOSE ); setTitle( "Snake (by daGrevis)" ); ``` class: ``` setPreferredSize( new Dimension( 640, 480 ) ); ``` Gray background is 642 * 482! Like there would be border that wraps all by 1 pixel!
How to Set JPanel's Width and Height?
CC BY-SA 3.0
0
2011-05-07T12:53:04.717
2013-06-19T20:42:21.420
2011-05-07T13:29:34.287
458,610
458,610
[ "java", "swing", "fixed-width" ]
5,921,396
1
7,866,921
null
3
1,956
I want to draw a triangle as a border background. One way of doing this is by using a DrawingBrush, but at smaller sizes anti-aliasing is distorting the triangle and making it blurry. ``` <Border> <Border.Background> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Brush="Red"> <GeometryDrawing.Geometry> <PathGeometry> <PathGeometry.Figures> <PathFigureCollection> <PathFigure IsClosed="True" StartPoint="0,3" IsFilled="True"> <PathFigure.Segments> <LineSegment Point="3,0" /> <LineSegment Point="6,3" /> </PathFigure.Segments> </PathFigure> </PathFigureCollection> </PathGeometry.Figures> </PathGeometry> </GeometryDrawing.Geometry> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Border.Background> </Border> ``` I've tried setting RenderOptions.EdgeMode="Aliased" and SnapsToDevicePixels="true" on all possible elements, but that hasn't worked... This is what the drawn triangle looks like at Width=17; Height=12 (zoomed to 800%): ![Blurry triangle](https://i.stack.imgur.com/yfF1B.jpg) As you can see the edges are anti-aliased. All the usual options for disabling anti-aliasing don't seem to be working...
How to turn off anti-aliasing for DrawingBrush?
CC BY-SA 3.0
null
2011-05-07T13:34:44.990
2013-03-28T20:27:16.697
2011-05-08T08:46:23.153
392,048
392,048
[ "wpf" ]
5,921,410
1
null
null
4
3,845
I am trying to write a program that uses Linq-to-SQL to interface with the database (MS SQL Server 2008). Adding and deleting seem to be ok but I can't get my head around updates. The entity has a version column on it which is a timestamp column on the database and used for the optimistic locking that comes built in to Linq-to-SQL. I have set the Update Check property for all of the fields on the entity to be Never. I have the following SaveTaskCommand which is used to insert and update entities, depending on whether or not the particular task has been added to the database already. ``` public class SaveTaskCommand : CustomCommand { private Task _task; private TaskDetailsViewModel _taskDetails; public SaveTaskCommand(Task task, TaskDetailsViewModel taskDetails) { _task = task; _taskDetails = taskDetails; } public override void Execute(object parameter) { TaskRepository taskRepository = new TaskRepository(); if (!taskRepository.ContainsTask(_task)) { taskRepository.AddTask(_task); _taskDetails.Mediator.NotifyColleagues(ViewModelMessages.TaskAdded, _task); } else { taskRepository.UpdateTask(_task); _taskDetails.Mediator.NotifyColleagues( ViewModelMessages.TaskAmended, null); } } public override bool CanExecute(object parameter) { return _task.IsValid(); } } ``` The CustomCommand class is just a class that wraps up an ICommand and deals with the CanExecuteChanged event so that I didn't have to repeat the code in each of the commands. As you can see a TaskRepository is created in the Execute() method of the command which firstly checks if the task is already in the database and then chooses whether to insert or update. The code for the TaskRepository is below. ``` public class TaskRepository : IRepository { private DataContextDataContext _dataContext; public TaskRepository() { _dataContext = new DataContextDataContext(); } public List<Task> GetAllTasks() { return _dataContext.Tasks.ToList(); } public Task GetForKeyTable(int keyTable) { return _dataContext.Tasks.Where(t => t.KeyTable == keyTable). FirstOrDefault(); } public void AddTask(Task task) { task.Project = _dataContext.Projects.SingleOrDefault( p => p.KeyTable == task.KeyProject); _dataContext.Tasks.InsertOnSubmit(task); _dataContext.SubmitChanges(); } public void UpdateTask(Task task) { //exception occurs here _dataContext.Tasks.Attach(task, GetForKeyTable(task.KeyTable)); _dataContext.SubmitChanges(); } public void DeleteTask(Task task) { _dataContext.Tasks.Attach(task, GetForKeyTable(task.KeyTable)); _dataContext.Tasks.DeleteOnSubmit(task); _dataContext.SubmitChanges(); } public bool ContainsTask(Task task) { return GetForKeyTable(task.KeyTable) != null; } } ``` At the line indicated, I get the following exception: > An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported. I don't understand why I get this exception when I am passing in the original version of the entity. I get the same exception if I change the commented line to ``` _dataContext.Tasks.Attach(task, true); ``` Any help would be greatly appreciated. I have made my repository implement IDisposable and changed everywhere that calls the constructor use the `using (TaskRepository taskRepository = new TaskRepository)`. In the `Dispose()` method of `TaskRepository`, I have called `Dispose()` on my data context. I have also changed the `Update()` method to call `Detach()` on my Task object. My code now looks like this: ``` public class TaskRepository : IRepository, IDisposable { private DataContextDataContext _dataContext; public TaskRepository() { _dataContext = new DataContextDataContext(); DataLoadOptions dlo = new DataLoadOptions(); dlo.LoadWith<Task>(t => t.Project); dlo.LoadWith<Task>(t => t.Priority); _dataContext.LoadOptions = dlo; } public List<Task> GetAllTasks() { return _dataContext.Tasks.ToList(); } public Task GetForKeyTable(int keyTable) { return _dataContext.Tasks.Where(t => t.KeyTable == keyTable).FirstOrDefault(); } public void AddTask(Task task) { task.Project = _dataContext.Projects.SingleOrDefault(p => p.KeyTable == task.KeyProject); _dataContext.Tasks.InsertOnSubmit(task); _dataContext.SubmitChanges(); } public void UpdateTask(Task task) { task.Detach(); _dataContext.Tasks.Attach(task, true); //exception occurs here _dataContext.Refresh(RefreshMode.KeepCurrentValues, task); _dataContext.SubmitChanges(); } public void DeleteTask(Task task) { _dataContext.Tasks.Attach(task, GetForKeyTable(task.KeyTable)); _dataContext.Tasks.DeleteOnSubmit(task); _dataContext.SubmitChanges(); } public bool ContainsTask(Task task) { return GetForKeyTable(task.KeyTable) != null; } #region IDisposable Members public void Dispose() { _dataContext.Dispose(); } #endregion } ``` The Detach() method on Task is this: ``` public void Detach() { this._Project = default(EntityRef<Project>); this._Priority = default(EntityRef<Priority>); } ``` For reference, my entities look like this: ![Database layout](https://i.stack.imgur.com/J31qi.png) I now get the following exception at the line indicated. > Cannot add an entity with a key that is already in use.
Updating an entity using Linq-to-SQL - attaching an entity that is not new
CC BY-SA 3.0
0
2011-05-07T13:38:29.723
2011-05-08T14:35:51.323
2011-05-08T14:35:51.323
336,752
336,752
[ "c#", "linq-to-sql", "repository" ]
5,921,500
1
5,921,589
null
0
632
Take this Window as an example: ``` <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" ResizeMode="NoResize" SizeToContent="WidthAndHeight" SnapsToDevicePixels="True"> <Grid Width="17" Margin="1"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <RepeatButton Grid.Row="0" SnapsToDevicePixels="True"> <Polyline RenderOptions.EdgeMode="Aliased" Stretch="Uniform" Margin="1" Fill="Red"> <Polyline.Points> <Point X="0" Y="3" /> <Point X="3" Y="0" /> <Point X="6" Y="3" /> </Polyline.Points> </Polyline> </RepeatButton> <RepeatButton Grid.Row="1" SnapsToDevicePixels="True"> <Polyline RenderOptions.EdgeMode="Aliased" Stretch="Uniform" Margin="1" Fill="Red"> <Polyline.Points> <Point X="0" Y="3" /> <Point X="3" Y="0" /> <Point X="6" Y="3" /> </Polyline.Points> </Polyline> </RepeatButton> </Grid> </Window> ``` Once the application has been ran, the topmost RepeatButton is taller than the bottom one (consequently the top triangle is also bigger than the bottom one). Why? If I create 4 rows of identical RepeatButtons, then the 1-st and 3-rd RepeatButtons are of equal size and are bigger than the 2-nd and 4-th RepeatButton?!? I'm thinking this must be a bug in the WPF layout system, but how to work around this problem? I can't use fixed heights (which does solve the problem), because I need the RepeatButtons and triangles to strecth as the container gets bigger (the example I provided is simplifed just to show the issue, I know I can't resize the example window...). # Edit: In reply to Ben's comments: Yes, with the added style the triangles do come out as 9px and 8px tall (I could just as well through out the RepeatButtons alltogether and leave only the polylines as the grids children, that would give the same result). Because the triangles are equal sided, then giving the grid a width of 17 will indeed cause the height to become 17 as well, which of course is not enough for two equal height triangles.. What I'm actually trying to do is create a NumericUpDown control. I've found that by default a spinner width of 17 and a UserControl MinHeight of 24 looks very good. The only problem is, that if I drop this UserControl into a Grid, then the top triangle always pushes itself 1px to tall, ruining the look. No matter how I've tried to mingle with the internal Margins and Paddings, the top triangle always makes itself 1px taller than necessary. So in essence what I want is to have a NumericUpDown, that when put into a Grid, doesn't distort itself. By default it should look perfect from the get go (no Grid RowHeight="Auto") and scale properly (no fixed heights). It must be possible, because by looking at the pixels physically then everything can fit into the given dimensions nicely. Here is my NumericUpDown, I've stripped out all the non essential things to make it more compact: ``` <UserControl x:Class="HRS.NumericUpDown" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" MinWidth="40" MinHeight="24" Name="ucNUPD" Background="White" SnapsToDevicePixels="True"> <UserControl.Resources> <Style TargetType="{x:Type RepeatButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RepeatButton}"> <Border Name="borderOuter" BorderThickness="1" BorderBrush="Red"> <Border Name="borderInner" BorderThickness="1" BorderBrush="Blue"> <ContentPresenter Margin="2,1" /> </Border> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="triangleStyle" TargetType="{x:Type ContentControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContentControl}"> <Polyline HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="Green" RenderOptions.EdgeMode="Aliased" Stretch="Uniform"> <Polyline.Points> <Point X="0" Y="3" /> <Point X="3" Y="0" /> <Point X="6" Y="3" /> </Polyline.Points> </Polyline> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Border BorderThickness="1" BorderBrush="#ABADB3"> <DockPanel> <UniformGrid Margin="1" DockPanel.Dock="Right" Rows="2" MinWidth="17" Width="17"> <RepeatButton Name="repeatButtonUp" Grid.Row="0"> <ContentControl Style="{StaticResource triangleStyle}" /> </RepeatButton> <RepeatButton Name="repeatButtonDown" Grid.Row="1"> <ContentControl Style="{StaticResource triangleStyle}" RenderTransformOrigin="0.5, 0.5"> <ContentControl.RenderTransform> <ScaleTransform ScaleY="-1" /> </ContentControl.RenderTransform> </ContentControl> </RepeatButton> </UniformGrid> <TextBox BorderThickness="0" VerticalContentAlignment="Center" Text="0" /> </DockPanel> </Border> </UserControl> ``` Here is a picture of what the end result looks like: ![Result](https://i.stack.imgur.com/zBX1h.jpg) (The image doesn't fit a 100%, but you can still see all the relevant details). On the right side you can see a zoom-in of the NumericUpDowns. The bottom one looks correct, but only because the grid's row Height is set to Auto. The top one is distorted, but by default I want it to look exactly like the bottom one. I might just have found a workable solution: It seems that by setting the Margin of the ContentPresenter in my NumericUpDown to "3,1", everything looks perfect. Preliminary testing is very promising as everything seems to be exactly the way it should be... I'll test it some more tommorow and if all goes good will mark Ben's answer as correct :)
Why does WPF render two identical objects differently?
CC BY-SA 3.0
null
2011-05-07T13:54:28.663
2011-05-07T21:56:23.037
2011-05-07T21:56:23.037
392,048
392,048
[ "wpf" ]
5,921,551
1
5,924,040
null
0
174
I have set up a 'blog' website with secure log-in and sign-up functionality. My question is where does rails hide the html mark-up for these as I want to add some styling? I don't want to style the comments form though, if they are the same source mark-up. I have checked all the 'view's and cannot find the code for the log-in/out form? ![enter image description here](https://i.stack.imgur.com/4geD3.png)
Rails Log In Form HTML?
CC BY-SA 3.0
null
2011-05-07T14:03:33.780
2011-05-07T21:19:52.550
null
null
372,237
[ "html", "ruby-on-rails-3" ]
5,921,882
1
5,922,233
null
2
722
Have anybody had a isse with comments `<!--´comment -->` and XML data binding in delphi. Im tryng to load the xml with the wizard but im getting error. XML looks like this: ``` <!-- For more info go: https://www.energia.ee/et/home/electricity/rates --> <settings> <!-- Electrical energy basic rate (Elektrienergia põhitariif) --> <electrical_basic_rate>3.19</electrical_basic_rate> <!-- Network service basic rate (Võrguteenuse põhitariif) --> <network_service_basic_rate>4.13</network_service_basic_rate> <!-- Renewable energy charge (Taastuvenergia tasu) --> <renewable_energy_charge>0.61</renewable_energy_charge> <!-- Electricity excise tax (Elektriaktsiis) --> <electricity_excise_tax>0.447</electricity_excise_tax> </settings> ``` I get error on the 3-d line. Error message looks like this: ![enter image description here](https://i.stack.imgur.com/SFeJG.png) Strange is that the first comment is not giving a error. Looks like a Delphi XE bug to me..
XML comments and Delphi XMl Data Binding
CC BY-SA 3.0
null
2011-05-07T15:07:39.067
2011-05-11T19:46:21.717
2011-05-11T19:46:21.717
91,299
655,134
[ "xml", "delphi", "delphi-xe" ]
5,922,355
1
5,923,361
null
0
294
I have something that I'm working on and am running to an issues I cant seem to resolve (Like that's a shocker right). One of my classes isn't recognizing Complex Types, or Function Imports. It keeps asking for which is clearly in the Function Imports. Here's the screen shots to verify it's there: ![Complex Types](https://i.stack.imgur.com/CFDKa.png) ![Function Imports](https://i.stack.imgur.com/ta16m.png) ![StoredProcedure](https://i.stack.imgur.com/6E9vq.png) ![enter image description here](https://i.stack.imgur.com/d1o26.png) And this is the only piece of code that uses any of those: ``` public class StoreIndexViewModel { public IEnumerable<GetCategories> storeCategories { get; set; } } ``` This is the error returned on IEnumerable > Error 1 The type or namespace name 'GetCategories' could not be found (are you missing a using directive or an assembly reference?) F:\Projects\GodsCreationTaxidermySVN\GodsCreationTaxidermy\ViewModels\StoreIndexViewModel.cs 11 28 GodsCreationTaxidermy Can anyone tell me why this class (and only this class) has this problem? I also noticed that the Complex Types show up in my TT's but not the Function Imports
Business Layer not recognizing Function Imports or Complex Typed
CC BY-SA 3.0
null
2011-05-07T16:15:27.473
2011-05-07T19:09:29.310
2011-05-07T16:30:24.800
88,230
88,230
[ "asp.net-mvc-2", "entity-framework-4" ]
5,922,433
1
5,922,580
null
4
7,496
I try to reach classic navigation menu item from website in c#, asp.net. My navigation menu like that : ![menu](https://i.stack.imgur.com/MA0UW.png) How can I reach My Profile NavigateURL and change it? I tried this but `mi` is `null`: ``` Menu m = (Menu)Master.FindControl("NavigationMenu"); MenuItem mi = new MenuItem(); mi = m.FindItem("Account,My Profile"); mi.NavigateUrl = "~/MyProfile.aspx?userid=" + userid; ``` Please help :(
Dynamically set NavigateUrl for a menu item in asp.net c#
CC BY-SA 3.0
null
2011-05-07T16:29:22.880
2011-05-24T00:51:49.353
2011-05-24T00:51:49.353
732,945
688,217
[ "c#", "asp.net", "web" ]
5,922,622
1
5,958,664
null
19
12,848
iTunes uses an [ID3](http://en.wikipedia.org/wiki/ID3) tag called , and for one album to be actually grouped as an album in iTunes, both the Album Name and Album Artist must be the same. As far as I'm concerned, Album Artist isn't an official [ID3](http://en.wikipedia.org/wiki/ID3) tag, and from the [ID3](http://en.wikipedia.org/wiki/ID3) libraries I've seen so far, none supported "Album Artist". ![Preview](https://i.stack.imgur.com/rwovY.png) Does anyone know more about this strange tag, and how to set it in java (or with any command line utility).
What's this "Album artist" tag iTunes uses? Any way to set it using java?
CC BY-SA 3.0
0
2011-05-07T16:56:38.080
2011-05-11T02:44:04.423
2011-05-07T17:14:09.973
21,234
700,144
[ "java", "mp3", "id3" ]
5,922,775
1
5,923,615
null
2
3,649
I am trying to resize the height of my row in UITableView based on the text length. I have the following code: ``` - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellText =[[topics objectAtIndex:indexPath.row] name]; UIFont *cellFont = [UIFont fontWithName:@"ArialMT" size:17.0]; CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT); CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap]; return labelSize.height + 20; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; cell.textLabel.numberOfLines = 0; cell.textLabel.font = [UIFont fontWithName:@"ArialMT" size:17.0]; } } ``` However, it messes up with the UIImageView and the UIDetailText, image shown below: ![enter image description here](https://i.stack.imgur.com/ViO1V.png) How do I fix this? I've tried: ``` [cell.imageView setContentMode:UIViewContentModeScaleToFill]; [cell.imageView setFrame:CGRectMake(0, 0, 16,16)]; [cell.imageView setBounds:CGRectMake(0, 0, 16,16)]; [cell.imageView setAutoresizingMask:UIViewAutoresizingNone]; [cell.imageView setAutoresizesSubviews:NO]; ``` and none seems to work
struggling with formatting dynamic row height in UITableView
CC BY-SA 3.0
0
2011-05-07T17:20:16.010
2011-05-07T20:09:25.693
2011-05-07T18:00:05.370
721,937
721,937
[ "iphone", "objective-c", "ipad" ]
5,922,941
1
5,923,350
null
0
129
I wonder why? By the way anyone can see the screen shot?![Screen Shot](https://i.stack.imgur.com/LWYlj.png) ![It looks like simple expression works. When the number of dots become 2 it no longer does.](https://i.stack.imgur.com/rcvGS.png)
NSLog Can see what Expression Watcher Cannot in Xcode
CC BY-SA 3.0
null
2011-05-07T17:52:43.900
2011-05-09T14:38:13.197
2011-05-09T14:38:13.197
700,663
700,663
[ "objective-c", "xcode" ]
5,923,140
1
5,924,063
null
2
677
I am trying to show the UIToolBar in the RootView of a UISplitView application, the code is the following: ``` self.navigationController.toolbarHidden = NO; UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)]; self.toolbarItems = [NSArray arrayWithObjects:refreshItem, nil]; [refreshItem release]; ``` However, what I see is: ![enter image description here](https://i.stack.imgur.com/D9YdH.png) There's black bar on top (I don't know where this came from, I don't need this) also the bar at the bottom, is there a way to resize it? What I want is to get something like this: ![enter image description here](https://i.stack.imgur.com/irLym.jpg)
UIToolbar in UISplitView application
CC BY-SA 3.0
null
2011-05-07T18:27:58.607
2011-07-24T16:27:18.557
2011-05-13T14:17:32.200
165,059
721,937
[ "iphone", "objective-c", "ipad" ]
5,923,257
1
5,924,854
null
2
8,270
> [Embedding YouTube videos on iOS](https://stackoverflow.com/questions/5117617/embedding-youtube-videos-on-ios) I am trying to embed youtube videos on iOS, so that when a user clicks a button, youtube video is shown without leavign the app, and once the video is done, the user is returned to the app. I found a tutorial online showing how to do this, and i followed it. I create a YouTubeView: ``` #import "YouTubeView.h" @implementation YouTubeView - (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame { self = [super init]; if (self) { // Create webview with requested frame size self = [[UIWebView alloc] initWithFrame:frame]; // HTML to embed YouTube video NSString *youTubeVideoHTML = @"<html><head>\ <body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; // Populate HTML with the URL and requested frame size NSString *html = [NSString stringWithFormat:youTubeVideoHTML, urlString, frame.size.width, frame.size.height]; // Load the html into the webview [self loadHTMLString:html baseURL:nil]; } return self; } #pragma mark - #pragma mark Cleanup - (void)dealloc { [super dealloc]; } @end ``` and I am instantiating it like this: (case 2) ``` - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { SongInfoTableVC *infoVC; YouTubeView *youTubeView; switch (buttonIndex) { case 0: NSLog(@"hello"); [self setLyrics]; break; case 1: infoVC = [[SongInfoTableVC alloc] initWithStyle:UITableViewStyleGrouped]; [infoVC setBook:data]; [infoVC setTitle:@"Song Info"]; [[self navigationController] pushViewController:infoVC animated:YES]; [infoVC release]; break; case 2: youTubeView = [[YouTubeView alloc] initWithStringAsURL:@"http://www.youtube.com/watch?v=xli2E2i8GZ4" frame:CGRectMake(0, 0, 320, 480)]; [[[self navigationController] view] addSubview:youTubeView]; break; default: break; } } ``` but this bring up a blank white screen. What am I doing wrong? Here's the screenshot: ![enter image description here](https://i.stack.imgur.com/gnNYS.png) Thanks
Embedding Youtube videos in iOS
CC BY-SA 3.0
0
2011-05-07T18:52:32.953
2011-05-08T00:16:08.287
2017-05-23T12:19:48.617
-1
635,064
[ "cocoa-touch", "ios", "uiwebview", "uiviewcontroller", "youtube" ]
5,923,291
1
5,923,494
null
0
114
I am following a tutorial to learn how to use form based security in ASP.NET but i got stuck at step 3, when i have to create the create the membership database. I am a newbie, could you give me a hand? This is the tutorial i am following: [http://msdn.microsoft.com/en-us/library/ff649314.aspx](http://msdn.microsoft.com/en-us/library/ff649314.aspx) And this is my problem: ![enter image description here](https://i.stack.imgur.com/OSQsm.png) Just in case the image is small, the error says: > An error has occurred. Details of the exception: A network-related or instance-specific error occurred while establishing a conne ction to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a conne ction to SQL Server) Could someone more experienced, help me solving this? I already posted a similar question today, but i cant fix it, i don't understand what i should do. Ill appreciate a lot your help. I tried to verified the connection as recommended in this link: [http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.ii.doc/opt/tlsmss08.htm](http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.ii.doc/opt/tlsmss08.htm) But something goes wrong: ![enter image description here](https://i.stack.imgur.com/CHAOR.png) I followed sehe's suggestion and i made the query for retrieving the date pass. So i assumed i was connected. The next thing i did was, try to grant database access as says in the tutorial, but i cant make the queries pass: This are the queries just incase the image is small: > -- Create a SQL Server login for the Network Service account sp_grantlogin 'NT AUTHORITY\Network Service'-- Grant the login access to the membership database USE aspnetdb GO sp_grantdbaccess 'NT AUTHORITY\Network Service', 'Network Service'-- Add user to database role USE aspnetdb GO sp_addrolemember 'aspnet_Membership_FullAccess', 'Network Service' Only the first one seem to pass ok. Any suggestions? ![enter image description here](https://i.stack.imgur.com/HY81m.png)
Problem following microsoft tutorial. (Stuck at step 3)
CC BY-SA 3.0
null
2011-05-07T18:58:51.703
2011-05-07T20:09:10.673
2011-05-07T20:09:10.673
614,141
614,141
[ "c#", ".net", "asp.net", "security", "authentication" ]
5,923,447
1
null
null
3
3,455
here is some UI behavior I don't understand... What I want: ![This is what I would like to achieve](https://i.stack.imgur.com/HsDlj.png) What I got: ![This is real result](https://i.stack.imgur.com/9w822.png) My code: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/black_to_white" /> <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/blue_to_red" /> </LinearLayout> ``` backgrounds code: (same code for both, except the colors) ``` <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#000000" android:endColor="#ffffff" android:angle="270" /> </shape> ``` How can I make my 2nd gradient start blue at the middle of the screen? (I noticed the gradient works fine on android 3.0 view mode, but not on other versions)
Gradient shape background on bottom layout
CC BY-SA 3.0
0
2011-05-07T19:22:01.883
2012-12-17T09:33:51.347
2011-05-08T17:52:41.283
247,221
743,352
[ "android", "background", "gradient", "shapes" ]
5,923,783
1
5,930,548
null
3
849
I am trying to create a Block View filtering by the path's (actually an alias) third argument, but can't succeed. The path where the block is displayed is `sitename.com/first/second/third`. Actually the third argument is the node's author, in the end, I am trying to display a block where only the content created be the author of the node the block is in... I.e: in the content type Garage node created by user Joe, there should be a block of content type Cars created by Joe. The node's path would then be `garagecars.com/garages/spain/joe`. I have tried setting 3 `Global:Null` arguments and then `User:Uid` but it doesn't work. ![Caption of the Arguments in the View](https://i.stack.imgur.com/mWqUz.png) Help? Any other way to filter by node author? (have been a long while searching and the "filter by path arguments" approach seemed the good one, but I must be missing something then). : in the Views preview the path `garages/spain/joe` works but it doesn't in the page itself `http://garagecars.com/garages/spain/joe`... which has me ever more puzzled. I was inserting the blog programatically throught the `views_embed_view($viewName, $display_id, $args)`... that's why it DID work on preview but when the page was rendered, the arguments set programmatically overrode the one's in the path, thus not working.
Filter by third argument in Drupal Views
CC BY-SA 3.0
null
2011-05-07T20:27:14.297
2013-05-31T00:45:19.153
2013-05-31T00:45:19.153
225,647
357,452
[ "drupal", "drupal-views", "drupal-contextual-filters" ]
5,924,113
1
5,924,227
null
2
5,432
Using RailsAdmin. I have a Post model and a User model. Each post belongs to a user. I use the following code to get RailsAdmin to handle the association for me and automatically set the user_id when a Post is created: ``` config.model Post do edit do field :user_id do # use a form_field instead of the default drop-down partial :form_field # hide the input view_helper :hidden_field # set the value to current_user.id def value bindings[:view]._current_user.id end end end end ``` This code works, it sets the user_id to that of the current_user and it also hides the form_field (the html input) from view so that user is not even aware that it is being set on their behalf. There is one small problem though. Whilst I'm able to hide the form_field, I can't hide it's associated label (i.e. the label that reads "User" which appears next to the input) - which means my users see this: ![enter image description here](https://i.stack.imgur.com/F9IiO.png) As you can see, there is a label "User" with an empty space next to it, and the word "Required" underneath. Is there anyway to hide an input's associated label too (and not just the input itself) so that it's not confusing to the user? Is there something wrong with my code? Thanks in advance
RailsAdmin - hidden form fields and labels
CC BY-SA 3.0
0
2011-05-07T21:29:07.210
2021-10-12T21:37:26.297
2013-01-03T14:49:29.897
274,811
227,863
[ "ruby-on-rails", "rails-admin" ]
5,924,224
1
5,925,421
null
2
1,415
When I scale my sprite, it's stretches out to the lower right, when the desired effect is for it to stay put and 'grow' in concentric circles. I fiddled around with the origin, but it seems to only affect rotation. I've also thought about using the bounding rectangle to scale it, but I'm looking for a best practice so as not to get into a bad habit right out of the gate. Here's the code where I make the call. The only arg that changes is Scale: ``` SpriteBatch.Draw(Texture, // Texture Position, // Position null, // Source Rectangle Color, // Color 0f, // Rotation Vector2.Zero, // Origin Scale, // Current Scale SpriteEffects.None, // Mirroring options Depth); // z-depth ``` And here's a screenshot of the orange rings expanding without staying 'stacked':![Expanding Rings](https://i.stack.imgur.com/5Vjv6.png) Thanks for your time. Here's a detail of the fixed version if it helps anyone:![enter image description here](https://i.stack.imgur.com/yhfHH.png)
XNA Sprite Scaling: looking for uniform expansion from the center of the sprite
CC BY-SA 3.0
null
2011-05-07T21:52:24.833
2011-05-08T13:45:23.703
2011-05-08T13:45:23.703
187,099
187,099
[ "xna", "sprite", "scaling" ]
5,924,244
1
5,924,284
null
11
12,344
I have this stack panel (contains four fractions): ![enter image description here](https://i.stack.imgur.com/NxK6I.jpg) (Fractions are just text with new lines and hyphens.) If I add a fifth fraction, it'll go to the right of 10/12, instead of forming a second row. How do I configure my StackPanel so that it'll overflow into a second row (and stay within the bounds of the StackPanel) instead of overflowing invisibly? Markup: ``` <StackPanel Name="_fractionContainer" Width="700" Height="600" Orientation="Horizontal" Margin="8, 8, 8, 8" Background="White" /> ```
Two Rows in a Horizontal Stack Panel? (WPF)
CC BY-SA 3.0
0
2011-05-07T21:56:23.360
2011-05-07T22:02:50.037
null
null
210,780
[ "wpf", "containers", "stackpanel" ]
5,924,331
1
5,924,893
null
1
1,533
This is my assignment: ![enter image description here](https://i.stack.imgur.com/GI9WG.png) My attempt was: a) If Fred is a father of Mike, then Fred is an ancestor of Mike. ``` father( X, Y ). /* X is father of Y */ ancestor( fred, mike ) :- father( fred, mike ). ``` b) An animal is a mammal if it is a human or its parents were mammals. ``` parent( X, Y ). /* X is parent of Y */ human( X ). /* X is human */ mammal( X ) :- human( X ). mammal( X ) :- parent( P, X ), mammal( P ). ``` c) You have attained the ultimate state if you are happy, healthy, and wise. ``` happy( X ). /* X is happy */ healthy( X ). /* X is healthy */ wise( X ). /* X is wise */ attain_ultimate_state( X ) :- happy( X ), healthy( X ), wise( X ). ``` d) Every dog likes all people. ``` dog( X ). /* X is a dog */ people( Y ). /* Y is human */ like( X, Y ) :- dog( X ), people( Y ). ``` e) The Lakers will win games 2, 3, 5, and 7, but lose the other 3 games in the series with New Orleans. ``` game( one ). game( two ). game( three ). game( four ). game( five ). game( six ). game( seven ). win( laker, new_orleans, game( two ) ). win( laker, new_orleans, game( three ) ). win( laker, new_orleans, game( five ) ). win( laker, new_orleans, game( seven ) ). lose( laker, new_orleans, game( one ) ). lose( laker, new_orleans, game( four ) ). lose( laker, new_orleans, game( six ) ). ``` f) If P and Q, then R or S ``` and( X, Y ). /* X and Y */ or( X, Y ). /* X or Y */ imply( X, Y ). /* X imply Y */ or( r, s ) :- and( p, q ). ``` g) P implies Q is equivalent to the disjunction of not P with Q. ``` and( X, Y ). /* X and Y */ or( X, Y ). /* X or Y */ imply( X, Y ). /* X imply Y */ imply( p, q ) == or( not( p ), q ). ``` h) P exclusive_or Q is when P inclusive_or Q, but not (P and Q). ``` and( X, Y ). /* X and Y */ or( X, Y ). /* X or Y */ imply( X, Y ). /* X imply Y */ imply( p, q ) == or( not( p ), q ). exclusive_or( X, Y ). /* X exclusive or Y */ inclusive_or( X, Y ). /* X inclusive or Y */ exclusive_or( p, q ) :- inclusive_or( p, q ), not( and( p, q ) ). ``` i) Jack is disappointed when it rains and any student misses class. ``` disappointed( X ). /* X is disappointed */ missed_class( X ). /* X missed class */ rain. /* it rains */ disappointed( jack ) :- rain, missed_class( _ ). ``` j) To be or not to be, that is the question. ``` to_be( X ). question( X ) :- to_be( X ). question( X ) :- not( to_be( X ) ). ``` We're using `Concepts of Programming Languages by Robert W. Sebesta` as our textbook for this course. Unfortunately, there are very few examples about how to convert from logic rules to Prolog notation in the book. Although I finished them all, most of my answer was guessing. So I wonder if someone could give me a hint, or suggestion on my work above. Any idea or feedback are welcome. Thank you,
How to convert logic rules to Prolog notation?
CC BY-SA 3.0
0
2011-05-07T22:11:27.540
2012-05-19T19:19:33.823
null
null
398,398
[ "prolog" ]
5,924,738
1
5,924,770
null
6
1,599
I'm banging my head with the problem that has more to do with 2nd grade mathematics than programming. Here goes: four `<div>` elements are placed one after another, horizontally. When you click one, script places it in front. You click another one, and it's also placed in front, etc. You get the picture. Now, what I'd like to do is to sort remaining `<div>` elements (all but the first one) using original order. Maybe this pic will make things clear: ![enter image description here](https://i.stack.imgur.com/Ac9TG.png) After step #3, `C` should be placed after `B`, so it should go like this: `D A B C`. Here's a sample code: ``` <html> <head> <title>mixit</title> <style type="text/css"> .insidebox{ width: 50px; height: 50px; line-height: 50px; margin: 0 0 0 20px; text-align: center; float: left; border: black solid 3px; font-family: sans-serif; cursor: pointer; } </style> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script> <script type="text/javascript"> </script> </head> <body> <div id="container"> <div id="a" class="insidebox">A</div> <div id="b" class="insidebox">B</div> <div id="c" class="insidebox">C</div> <div id="d" class="insidebox">D</div> </div> </body> </html> ``` Now, I understand that I can use `.insertAfter()` to place element in front, but how should I tackle the sorting part? The keyword is , not alphabetical order. Letters and boxes are given just for illustrative purposes.
Sort sibling <div>s with jQuery
CC BY-SA 3.0
null
2011-05-07T23:42:13.500
2011-05-07T23:59:16.043
2011-05-07T23:49:01.433
457,898
457,898
[ "javascript", "jquery", "dom" ]
5,925,301
1
5,926,613
null
0
357
Here is a screenshot from the attribute inspector: ![Screenshot](https://i.stack.imgur.com/VnKui.png)
How to use Webview's Identifier which's set in IB's Attribute inspector?
CC BY-SA 3.0
null
2011-05-08T02:48:48.877
2012-06-11T06:46:58.560
2012-06-11T06:46:58.560
937,870
429,712
[ "cocoa", "interface-builder" ]
5,925,422
1
null
null
1
1,151
I want to add few text boxes at dynamic position in a form. Say something like this ![enter image description here](https://i.stack.imgur.com/9FSxT.jpg) I have JavaScript like this: ``` function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement('<input type="checkbox" name="chk">'); cell1.appendChild(element1); var cell4 = row.insertCell(3); var element4 = document.createElement('<INPUT type="text" name="SubpartID"/>'); cell4.appendChild(element4); var cell5 = row.insertCell(4); var element5 = document.createElement('<INPUT type="text" name="Quantity" value="1" />'); cell5.appendChild(element5); } ``` but problem with this script is, When I click "Add Subpart Input Row" button, I am able to see a new row added but only with check box in that. I guess `cell4.appendChild(element4);` and `cell5.appendChild(element5);` does not work. So the output looks like this, ![enter image description here](https://i.stack.imgur.com/H2Gvy.jpg) Could you please help?
Adding textbox at dynamic positions in JavaScript
CC BY-SA 3.0
null
2011-05-08T03:32:25.893
2011-05-08T05:04:16.663
2011-05-08T03:47:36.913
157,882
610,741
[ "javascript", "dynamic", "textbox", "position" ]
5,925,449
1
5,925,473
null
39
25,046
I am using Eclipse. You see this ending curly bracket next to `catch(FileNotFoundException fne) {`: ![enter image description here](https://i.stack.imgur.com/i1Ux3.jpg) How do I make it more noticeable when I select on starting curly brackets so I can clearly see where it ends?
Eclipse: make curly bracket more noticeable
CC BY-SA 3.0
0
2011-05-08T03:40:35.180
2022-07-10T16:24:31.320
2012-05-22T06:52:50.620
275,567
272,501
[ "java", "eclipse" ]
5,925,511
1
null
null
0
94
I am trying to achieve this->![ideal layout](https://i.stack.imgur.com/JRIo1.jpg) (Black box is a signup/login section, blue is a nav bar, red is a header area with some # text content) I am trying to get to that outcome with this css: ``` @import url(//fonts.googleapis.com/css?family=Droid+Sans:regular,bold&subset=latin); html, body { margin:0; padding:0; background-color:#fff; font-family: 'Droid Sans', arial, serif; color: #777; font-size: 14px; } a { color: #2e4987; text-decoration: none; } img { border: 0; width: 250 px; height: 250px; margin: auto; } #nwtBox { margin: 0 auto; width: 960px; height: 800px; } #nwtBox h1 { color: #333; font-weight: normal; margin: 0 0 20px 0; padding: 0; } #nwtBox h1 span { float: right; font-size: 14px; font-weight: normal; } #nwtBox h2 { font-weight: normal; font-size: 20px; padding: 0; margin: 0 0 10px 0; color: #333; } #nwtBox h3 { padding:0; margin: 0; } #nwtBox h3 img { vertical-align: middle; } #nwtBox #header { width: 960px; background-color:#fff; height: 100px; border: solid; border-width:thin; border-color: red; } #nwtBox #header h1 { text-align: center; } #nwtBox #navigation { width: 960px; background-color:#fff; height: 100px; border: solid; border-width:thin; border-color:blue; } #nwtBox #navigation ul { list-style-type: none; padding: 0; margin: 0; } #nwtBox #navigation ul li { padding: 0 30px 0 0; font-weight: bold; } #nwtBox #navigation ul li a { color: #a8a8a8; text-decoration: none; } #nwtBox #navigation ul li a:hover { color: #2e4987; } #nwtBox #navigation .main-nav { width: 500px; overflow: auto; } #nwtBox #navigation { float: left; padding: 35px 0 0 0; } #nwtBox #navigation ul { list-style-type: none; padding: 0; margin: 0; } #nwtBox #navigation ul li { float: left; padding: 0 30px 0 0; font-weight: bold; } #nwtBox #navigation ul li a { color: #a8a8a8; text-decoration: none; } #nwtBox #navigation ul li a:hover { color: #2e4987; } #nwtBox #navigation .main-nav { width: 500px; overflow: auto; } #nwtBox #signupLogin { float:right; width: 400px; overflow: none; padding: 32px 0 0 0; text-align: right; color: #999999; border: solid; border-width:thin; border-color:red; } ``` and this HTML ``` <body> <div id ="nwtBox"> <div id ="signupLogin"> <ul> <li> <a href =''> Sign Up</a> </li> <li> <a href =''> Log In</a> </li> </ul> </div> <div id = "navigation"> <ul class="main-nav"> <li class="main-nav-selected"> <a href="index.php">HOME</a> </li> <li> <a href="stuff.php">STUFF</a> </li> <li> <a href='stuff.php'>STUFF</a> </li> </ul> </div> <div id ="header"> <h1> TEXT</h1> </div> </body> ``` instead of the desired outcome, I get: ![bad layout](https://i.stack.imgur.com/wHFhf.jpg) what's wrong?
Problem positioning these blocks in CSS
CC BY-SA 3.0
null
2011-05-08T04:01:42.943
2011-05-08T04:24:25.040
null
null
648,927
[ "html", "css" ]
5,925,561
1
5,925,602
null
10
4,863
I'm trying to recreate the paragraphs and indentations from the output of OCR'd image text, like so: (imagine that this is an image, not typed): ![enter image description here](https://i.stack.imgur.com/YOkbd.png) (with a few mistakes): ![enter image description here](https://i.stack.imgur.com/j2YvI.png) As you can see, no paragraph breaks or indentations are preserved. Using Python, I tried an approach like this, but it doesn't work (fails too often): : ``` def smart_format(text): textList = text.split('\n') temp = '' averageLL = sum([len(line) for line in textList]) / len(textList) for line in textList: if (line.strip().endswith('!') or line.strip().endswith('.') or line.strip().endswith('?')) and not line.strip().endswith('-'): if averageLL - len(line) > 7: temp += '{{ paragraph }}' + line + '\n' else: temp += line + '\n' else: temp += line + '\n' return temp.replace(' -\n', '').replace('-\n', '').replace(' \n', '').replace('\n', ' ').replace('{{ paragraph }}', '\n\n ') ``` Does anyone have any suggestions as how I could recreate this layout? I'm working with old books, so I was hoping to re-typeset them with LaTeX, as it's quite simple to create a Python script to do that. Thanks!
Extracting paragraph breaks from OCR text?
CC BY-SA 3.0
0
2011-05-08T04:20:22.280
2021-01-22T16:49:07.497
2011-05-08T05:22:51.870
31,641
464,744
[ "python", "latex", "ocr", "tesseract" ]
5,925,659
1
5,925,792
null
1
215
i want to merge multiple images ina single image,by using a button click>my problem is ,,if the user touch a image in tableview ,the coresponding image have to merge with the main image in the next page..how can we done this? ![enter image description here](https://i.stack.imgur.com/UzP10.png) this is the main image in the page![this the the uppercloth](https://i.stack.imgur.com/KstjO.png) i have to fix the upper cloth in the caricature
iphone image merging
CC BY-SA 3.0
0
2011-05-08T04:44:54.740
2013-08-09T06:21:25.160
2013-08-09T06:21:25.160
640,731
637,453
[ "ios", "image", "cocoa-touch" ]
5,925,790
1
5,925,805
null
2
6,594
I am trying to get the total count of rows from Sqlite DB. Following is the code snippet of what I am trying to do. I dont know what I am doing wrong here ? ``` public static int getTotalCount(Context _context) { Cursor c = null; try { c = getInstance(_context).db.rawQuery("SELECT COUNT(word) FROM " + WORD_TABLE, null); return c.getInt(c.getColumnIndex(WORD_COL)); } catch (Exception e) { Log.e("getTotalCount", e.toString()); } return 0; ``` Exception message : 05-08 05:21:19.934: ERROR/getTotalCount(440): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1 ![enter image description here](https://i.stack.imgur.com/SDddR.jpg)
How to get the total count of records from SQLite
CC BY-SA 3.0
null
2011-05-08T05:28:37.567
2014-01-04T07:37:13.493
2011-05-08T05:37:40.710
431,359
389,288
[ "android", "sqlite" ]
5,925,804
1
5,958,937
null
0
97
I have 4 tables (Type01, Type02, Type03, Type04) . They have different columns . Table Type01 is a parent of 3 child tables (subtype01, subtype02, subtype03) . And it has a one to one relationship with its children (each record in parent corresponds to one record that exists in only one of the children) . I want to retrieve all (to make life easier) records of all of the 4 tables including related children by order (date of insertion) . So, I created a super table having universal ID for types . See the figure please . ![enter image description here](https://i.stack.imgur.com/g0iIG.jpg) Now, what is the sql query for retrieving all records of the 4 tables including children of table Type01 ? and is this the most efficient design (space & retrieving speed) ? Thanks a lot .
Retrieving records from design containing multiple hierarchy
CC BY-SA 3.0
null
2011-05-08T05:34:28.767
2011-05-11T03:35:47.577
null
null
714,830
[ "database", "hierarchy", "data-retrieval" ]
5,925,814
1
5,925,980
null
0
77
Dont what when wrong here , debuger use to hit the code. But after I delete the emulator and recreate one , after I cant debug the code. I have to log exceptions using Log.e() which is quite painfully. Can you please how to enable debuging ? ![enter image description here](https://i.stack.imgur.com/l5TJN.jpg) ![enter image description here](https://i.stack.imgur.com/PfVdq.jpg) Breakpoints are enable, but they disable ![enter image description here](https://i.stack.imgur.com/7gihS.jpg)
Unable to hit debugger in ( Android)
CC BY-SA 3.0
null
2011-05-08T05:37:29.343
2011-05-08T06:49:17.153
2011-05-08T06:26:00.737
389,288
389,288
[ "java", "android", "eclipse" ]
5,925,907
1
5,927,803
null
2
730
Does anyone understand how Apple manipulated the regular UIPickerView to look like the image below? Instead of two rows, I only need one in the middle. If anyone can point me in the right direction or show me a tutorial I'd really appreciate it.![enter image description here](https://i.stack.imgur.com/sIalP.jpg)
Manipulate UIPickerView to have single rows
CC BY-SA 3.0
null
2011-05-08T06:05:34.103
2011-05-08T13:47:34.650
null
null
253,008
[ "iphone", "ios", "uipickerview", "rows" ]
5,925,905
1
5,925,919
null
7
2,750
I have basically done: ``` $(document).ready(function() { $('#calendar').fullCalendar({ defaultView: 'agendaWeek', firstDay:1, allDaySlot:false, axisFormat: 'h(:mm)tt', slotMinutes: 15, defaultEventMinutes:45, ``` so my left side shows times in 15 minute slots. The problem is, ive set an event to run from 10:00am to 10:45 and it shows the event, but it appears the event ends at 10:30. I've added a screenshot, the event on the left side is set in json like: ``` array( 'id' => 333, 'title' => "John", 'start' => "May 5 2011 10:00:00", 'end' => "May 5 2011 10:45:00", 'url' => "http://yahoo.com/", 'allDay'=> false, 'color' => 'red', // an option! 'textColor'=> 'black' // an option! ), ``` and if you look on the screenshot, ![enter image description here](https://i.stack.imgur.com/9DUMD.jpg) i've added a light blue background where I think the event should end, on the 10:45 slot. Any suggestions?
Events ending too early when 15 minute slotMinutes set in FullCalendar
CC BY-SA 3.0
null
2011-05-08T06:05:01.060
2014-01-09T10:35:47.963
2011-12-12T00:34:49.810
388,787
743,146
[ "javascript", "jquery", "fullcalendar" ]
5,926,199
1
5,957,365
null
1
662
I've never done any item delegates in Qt before, and I think the documentation doesn't explain well about more complex delegates. I need to create 2 styles of Symbian(^3) style lists ![Delegate style 1](https://i.stack.imgur.com/jJNeg.png) This is for common navigation lists, the icon and the lower label are optional. ![Delegate style 2](https://i.stack.imgur.com/c8mHm.png) This is for settings lists, where the pushbutton can be a toggle(on/off)-button or execute a context menu, etc. How would I go on creating these sort of item delegates?
How to create Symbian style list views in Qt
CC BY-SA 3.0
null
2011-05-08T07:26:33.793
2011-05-10T22:46:20.533
null
null
403,018
[ "qt", "user-interface", "symbian", "qlistwidget", "qitemdelegate" ]
5,926,289
1
5,926,303
null
0
2,688
I want to show lines in the `UITextView` like notes application. ![](https://www.amitbhawani.com/blog/Images/I/iPhone-Notes-Apps3.png)
can I show lines in the UITextView control?
CC BY-SA 3.0
null
2011-05-08T07:51:23.467
2011-05-08T08:52:10.577
2017-02-08T14:32:08.647
-1
712,104
[ "iphone", "objective-c", "ipad", "uitextview" ]
5,926,312
1
5,926,331
null
0
2,002
I'm developing a system to generate a water bill for a local area.In it i need to print out the bill from using the data from the database.It would be a greatly appreciated if someone could explain me how to generate & print the bill in vb.net. Thanks in advance. ![For example something like this.....](https://i.stack.imgur.com/qaGpW.gif)
how to generate a document with data from a database for printing purposes in vb.net
CC BY-SA 3.0
0
2011-05-08T07:59:17.007
2011-06-15T21:56:07.740
null
null
458,470
[ "vb.net", "printing" ]
5,926,347
1
5,926,459
null
2
1,731
I am in the process of building a function in MATLAB. As a part of it I have to calculate differences between elements in two matrices and sum them up. Let me explain considering two matrices, ``` 1 2 3 4 5 6 13 14 15 16 17 18 ``` and ``` 7 8 9 10 11 12 19 20 21 22 23 24 ``` The calculations in the first row - only four elements in both matrices are considered at once (zero indicates padding): ``` (1-8)+(2-9)+(3-10)+(4-11): This replaces 1 in initial matrix. (2-9)+(3-10)+(4-11)+(5-12): This replaces 2 in initial matrix. (3-10)+(4-11)+(5-12)+(6-0): This replaces 3 in initial matrix. (4-11)+(5-12)+(6-0)+(0-0): This replaces 4 in initial matrix. And so on ``` I am unable to decide how to code this in MATLAB. How do I do it? I use the following equation. ![Equation](https://i.stack.imgur.com/zedT7.png) Here `i` ranges from `1` to `n(h)`, `n(h)`, the number of distant pairs. It depends on the lag distance chosen. So if I choose a lag distance of `1`, `n(h)` will be `the number of elements - 1`. When I use a 7 X 7 window, considering the central value, n(h) = 4 - 1 = 3 which is the case here.
Summation of difference between matrix elements
CC BY-SA 3.0
null
2011-05-08T08:11:15.453
2012-07-31T16:21:54.253
2012-07-31T16:21:54.253
63,550
553,023
[ "matrix", "matlab" ]
5,926,441
1
null
null
1
1,522
I have a gwt application with various layoutpanels. My layout works fine with all browsers except IE9. The layout is completely broken. Text appears everywhere, images at the bottom of the page or just shown for a 3/4, etc. I have recompiled my app with the newest version of gwt 2.3 but it didn't change anything. Any suggestions? Thanks in advance. Here an image with the broken background: ![enter image description here](https://i.stack.imgur.com/DDdZd.jpg)
Broken layout in IE 9
CC BY-SA 3.0
null
2011-05-08T08:39:17.097
2012-02-03T11:09:24.453
null
null
615,425
[ "html", "css", "gwt", "layout", "internet-explorer-9" ]
5,926,505
1
5,926,552
null
4
1,544
I'm trying to create an icon that displays a piece of text in the system tray. (Obviously, it won't be longer than a couple of characters.) So far I've tried: ``` #include <tchar.h> #include <Windows.h> #include <Windowsx.h> static HICON CreateIcon(LPCTSTR txt) { HICON hIcon = NULL; HDC hDC = NULL; { HDC hDCScreen = GetDC(NULL); if (hDCScreen != NULL) { __try { hDC = CreateCompatibleDC(hDCScreen); } __finally { ReleaseDC(NULL, hDCScreen); } } } if (hDC != NULL) { __try { HFONT hFont = CreateFontIndirect(&ncm.lfMessageFont); if (hFont != NULL) { __try { SelectFont(hDC, hFont); } __finally { DeleteFont(hFont); } } int width = GetSystemMetrics(SM_CXSMICON), height = GetSystemMetrics(SM_CYSMICON); HBITMAP hBmp = CreateCompatibleBitmap(hDC, width, height); if (hBmp != NULL) { __try { HBITMAP hMonoBmp = CreateCompatibleBitmap(hDC, width, height); if (hMonoBmp != NULL) { __try { RECT rect = { 0, 0, width, height }; HGDIOBJ prev = SelectObject(hDC, hBmp); __try { SetBkMode(hDC, TRANSPARENT); SetTextColor(hDC, RGB(255, 255, 255)); ICONINFO ii = { TRUE, 0, 0, hMonoBmp, hBmp }; int textHeight = DrawText(hDC, txt, _tcslen(txt), &rect, 0); if (textHeight != 0) { hIcon = CreateIconIndirect(&ii); } } __finally { SelectObject(hDC, prev); } } __finally { DeleteObject(hMonoBmp); } } } __finally { DeleteObject(hBmp); } } } __finally { DeleteDC(hDC); } } return hIcon; } ``` with this code: ``` static void _tmain(int argc, TCHAR* argv[]) { HICON hIcon = CreateIcon(_T("Hi")); if (hIcon != NULL) { __try { NOTIFYICONDATA nid = { sizeof(nid) }; nid.hWnd = GetConsoleWindow(); BOOL success = Shell_NotifyIcon(NIM_ADD, &nid); if (success) { nid.uFlags = NIF_ICON; nid.hIcon = hIcon; success = Shell_NotifyIcon(NIM_MODIFY, &nid); } } __finally { DestroyIcon(hIcon); } } } ``` but all I get is a monochrome bitmap that says `Hi` in white text on a black background. (If I change the `RGB(255, 255, 255)` even slightly, say to `RGB(255, 255, 254)`, it becomes black, so it's monochrome.) Any ideas? (*Note: I'm looking for MFC, ATL, or any other library solutions, just Win32/GDI calls.) --- Here's what it looks like currently: ![](https://i.stack.imgur.com/3HOVu.png)
How Do I Create a 32-bit Tray Icon With Transparency (using GDI)?
CC BY-SA 3.0
0
2011-05-08T08:57:37.080
2011-05-08T09:24:28.543
2011-05-08T09:20:01.233
541,686
541,686
[ "winapi", "gdi", "system-tray", "trayicon" ]
5,926,790
1
5,927,397
null
3
2,531
I have a user, . There is a post on their wall, made by . ![enter image description here](https://i.stack.imgur.com/h2aUR.png) The URL is ``` https://www.facebook.com/user_1/posts/10150166228506188 ``` I try to get the content using the Graph API, with this request: ``` https://graph.facebook.com/10150166228506188?access_token=ACCESSTOKENUSER_2 ``` I get this error: ``` { "error": { "type": "GraphMethodException", "message": "Unsupported get request." } } ``` The access_token I am using is good, because requests to get things like statuses & images work fine: ``` https://graph.facebook.com/10150233707783933?access_token=ACCESSTOKENUSER_2 ``` Result: ``` { "id": "10150233707783933", "from": { "name": "American Steel", "category": "Professional sports team", "id": "203692078932" }, "tags": { "data": [ etc ``` The error seems to happen whenever I try to get items that have this kind of URL: ``` https://www.facebook.com/username/posts/item_id ``` The permissions my app has include these: ![enter image description here](https://i.stack.imgur.com/7k3Ix.png) Why is this error occurring?
Why do I get this error when I try to access a certain type of object via the Facebook Graph API?
CC BY-SA 3.0
0
2011-05-08T10:06:54.573
2011-05-08T12:36:22.077
null
null
173,634
[ "facebook", "facebook-graph-api" ]
5,926,892
1
5,926,974
null
0
108
I can get only the currently ongoing quiz. How to display the exact time only until the next quiz? ![enter image description here](https://i.stack.imgur.com/aMub4.png)
Exact time remaining to next quiz
CC BY-SA 3.0
null
2011-05-08T10:30:07.420
2011-05-08T11:19:47.430
null
null
707,729
[ "mysql", "sql", "timestamp" ]
5,926,873
1
5,927,105
null
1
2,572
I have following situation. I have a class for accounts, each account has a balance and money can be transfered to it. ``` public class Account { private int balance; public Account() { this.balance = 0; } public void transfer(int amount) { this.balance += amount; } @Override public String toString() { return "Account (balance: " + balance + ")"; } } ``` And I have a transfer manager. A transfer simply takes two accounts and a amount of money to be transfered. The transfer manager can issue transfers by adding it to the array list, kind of transfer queue. After all transfers are added to the queue the performTransfers method can be called which calles the performTransfer method on every transfer. ``` import java.util.ArrayList; public class TransferManager { private ArrayList<Transfer> openTransfers; private int issuedTransfers; private int performedTransfers; public TransferManager() { openTransfers = new ArrayList<Transfer>(); issuedTransfers = 0; performedTransfers = 0; } public void issueTransfer(Account from, Account to, int amount) { openTransfers.add(new Transfer(from, to, amount)); issuedTransfers++; } public void performTransfers() { for(Transfer transaction : openTransfers) { transaction.performTransfer(); performedTransfers++; } openTransfers.clear(); } @Override public String toString() { return "TransferManager (openTransfers: " + openTransfers.size() + "; issuedTransfers: " + issuedTransfers + "; performedTransfers: " + performedTransfers + ")"; } private static class Transfer { private Account from, to; private int amount; public Transfer(Account from, Account to, int amount) { this.from = from; this.to = to; this.amount = amount; } public void performTransfer() { from.transfer(-amount); to.transfer(amount); } } } ``` Now I add multithreading: ``` import java.util.Random; public class BankingTest extends Thread { private Account[] accounts; private static Random random = new Random(); public BankingTest(Account[] accounts) { this.accounts = accounts; } public void run() { final TransferManager manager = new TransferManager(); //simulate some transfers for(int i = 0; i < accounts.length; i++) { final int index = i; Thread thread = new Thread() { public void run() { try { for(int j = 0; j < 10; j++) { manager.issueTransfer(accounts[index], accounts[(index+1)%accounts.length], 100); Thread.sleep(random.nextInt(10)); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); } //wait a bit try { Thread.sleep(60); } catch (InterruptedException e) { e.printStackTrace(); } manager.performTransfers(); System.out.println(manager); } } ``` BankingTest takes an array of say 10 blank accounts. For now it is not synchronized and I try to understand why I get those errors: ``` Exception in thread "Thread-2" java.lang.NullPointerException at gp2.ha5.exercise2.TransferManager.performTransfers(TransferManager.java:23) at gp2.ha5.exercise2.BankingTest.run(BankingTest.java:41) and TransferManager (openTransfers: 0; issuedTransfers: 99; performedTransfers: 99) ``` Any idea why I get those errors and how can synchronization help here? ![enter image description here](https://i.stack.imgur.com/FWuto.png) (you can zoom in to see the details ;)) TransferManager: [http://pastebin.com/Je4ExhUz](http://pastebin.com/Je4ExhUz) BankTest: [http://pastebin.com/cdpWhHPb](http://pastebin.com/cdpWhHPb) Start: [http://pastebin.com/v7pwJ5T1](http://pastebin.com/v7pwJ5T1) --- After I added the synchronized to issueTransfer and performTransfers method I keep getting errors: ![enter image description here](https://i.stack.imgur.com/H4ai1.png)
Threaded bank transfer simulation and synchronization
CC BY-SA 3.0
0
2011-05-08T10:27:24.737
2011-05-08T11:37:23.413
2011-05-08T11:25:23.350
401,025
401,025
[ "java", "multithreading" ]
5,927,005
1
5,927,026
null
0
2,020
I'm trying to fetch the last element according to it's name. I know there is Last() method on .Net 4, but since I must work with .Net 3.5 how can I find it. Example: The xml used as log file. My method signature: GetLast(XName xName), and returns the last element specified (ExecutionReport, Scenario, Function etc.) I would like to get this element in order to add element afterwards. This is the Xml file: ![Xml file](https://i.stack.imgur.com/xoThU.jpg)
Linq to Xml Get last Element - .Net 3.5
CC BY-SA 3.0
null
2011-05-08T10:55:23.280
2011-05-08T11:12:07.170
2011-05-08T11:12:07.170
41,071
739,558
[ "c#", ".net-3.5", "linq-to-xml" ]
5,927,155
1
6,382,992
null
1
96
How Android screens go beyond the simple controls that have Android, look at this for example. How come so that each key responds independently? Is it a single image, several or a drawing? ![enter image description here](https://i.stack.imgur.com/HJKI2.jpg) How to put each circle in the specific country? What if I want a country to be selected? ![enter image description here](https://i.stack.imgur.com/wBYIH.jpg)
How to produce these views? How Android screens go beyond the simple controls that have Android?
CC BY-SA 3.0
null
2011-05-08T11:30:44.467
2011-06-17T08:04:31.750
null
null
672,752
[ "android" ]
5,927,232
1
null
null
0
2,577
when i create a jpa project under eclipse, i encoutered the following problem: when i create the a configuration file, i check creat console, next when i specify jpa as in the tab of the , i get the error message in the top of the wizard: ![enter image description here](https://i.stack.imgur.com/dLTNQ.png) how can i resolve this problem?
jpa project problem in hibernate console configuration
CC BY-SA 3.0
null
2011-05-08T11:48:25.653
2011-05-08T11:52:54.760
null
null
604,019
[ "eclipse", "hibernate", "jpa" ]
5,927,247
1
5,927,276
null
14
9,861
How can I change the z-value, or just send to back or to front the objects in Interface Builder? i.e. I would like to move to front the "Label" in this View: ![example image](https://i.stack.imgur.com/xJvrP.png)
How to assign different z-order to my Interface Builder objects?
CC BY-SA 3.0
0
2011-05-08T11:50:11.060
2019-09-14T13:09:32.817
2012-04-18T18:06:37.900
1,028,709
257,022
[ "xcode", "xcode4", "gui-builder" ]
5,927,412
1
5,927,832
null
0
158
Messing around with some CSS trying to learn some stuff as I haven't done much before and I've come across an issue where I have a small amount of space between an image tag and a ul tag and can't figure out how to get rid of it. ![enter image description here](https://i.stack.imgur.com/bq9en.png) I'm talking about the space between the Image and the black bar as seen in the picture above. Source code for that page is as follows (in asp.net mvc3) ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script> </head> <body> <div id="container"> <div id="header"> <img src="@Url.Content("~/Content/b.png")" alt="Infomaster" /> <ul id="menu" > <li>Home</li></ul> </div> <div id="content"> @RenderBody() </div> <div id="footer"> footer </div> </div> </body> </html> ``` My css looks as follows ``` html, body { font-size: 1.0em; font-family: Arial, sans-serif, Verdana, Garamond, "Segoe UI"; color: #232323; background-color: #414042; height: 100%; /* needed for container min-height */ } div#container { position: relative; /* needed for footer positioning*/ margin: 0 auto; /* center, not in IE5 */ height: auto !important; /* real browsers */ height: 100%; /* IE6: treaded as min-height*/ min-height: 100%; /* real browsers */ background-color: White; border-radius: 15px; min-width: 920px; width: 52%; } div#header { padding: 1% 1% 0px 1%; margin: 0px; } div#footer { position: absolute; width: 100%; bottom: 0; /* stick to bottom */ } #menu { background-color: Black; color: White; list-style: none; margin: 0px; padding: 0px; } ``` I've messed around with various paddings, margins etc but can't seem to get rid of it, also in IE web developer tool bar in the layout pane it shows me there is an offset (and nothing else) but when I change it it has no affect. I think its a small thing I'm missing but would appreciate some help. Cheers
css positioning gap
CC BY-SA 3.0
null
2011-05-08T12:30:14.557
2011-05-08T13:53:10.690
null
null
351,614
[ "css", "positioning" ]
5,927,532
1
5,927,557
null
0
94
I have a black navigation bar (`bar`) and a vertical white page (`page`). The `page` is supposed to run from to to bottom and look like it just comes out from right under the `bar`. The `bar` has a drop shadow which should obviously be 'on' the `page` - like this: ![page beneath](https://i.stack.imgur.com/BtagI.png) The problem with this is that the `page` needs a `z-index` of to look like this (both have a fixed or relative positioning) - and this means (at least in Chrome) that I can't select or click anything on the `page`. When I assign a `z-index` of (bar being ) it obviously doesn't work anymore: ![page on top](https://i.stack.imgur.com/63tq7.png) Yet at least I can click the `page`'s elements.
Place <div> 'under' drop shadow
CC BY-SA 3.0
null
2011-05-08T12:50:26.513
2011-05-08T13:20:51.163
null
null
213,730
[ "z-index", "css" ]
5,927,738
1
5,927,830
null
4
1,326
I am trying to implement a similar effect like the iPhone-alike sliding header in the iPhone contact app (the sliding header that group the contacts by it's starting letter). This is the screen of my app, and what I want to achieve is the following: ![enter image description here](https://i.stack.imgur.com/A4GKh.png) I have a 'guide header' and three 'tabs' for sorting the list. When the user scrolls the list up, I want everything to scroll up (guide header, tabs, list). However, when the tabs reach the top of the screen (and the guide header will just be gone off the screen), I want the tabs to stop and stay there (remain as "sticky header"), and only the list items scroll as in any regular list view. I have a view group (guide header) above a list view. First of all, I want to have the guide header adjust it's position depending on the scrolling position of the list view. My idea was to set an onScrollListener to the list view and change the top margin of the guide header to whatever the scroll position of the first item in the list view is (which would be a negative value). The logic is correct, but is that the guide header view doesn't get redrawn fast enough while I'm scrolling in the list view. The guide header view only updates (to my changed top margin value) when the list view fling comes to an end. Even slow scrolling doesn't work. Invalidating (invalidate()) the guide header view or it's parent also doesn't help, since it would just put an invalidation request to the queue, but the invalidation and redrawing doesn't happen immediately, but only when the UI thread becomes idle, which doesn't seem to happen while the user still has his fingers on the scroll list view. Seems that flinging the list view blocks the whole UI thread or keeps it busy for itself. So the main problem is: changing the margin of the guide header view doesn't become visible immediately while the user is scrolling the list view. The code I'm using it this: ``` @Override public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { // Get the first list item and check it's scroll position. This will be the value (top), that we also // use the scroll the header parallel. View v = mainList.getChildAt(0); final int top = (v==null)?0:v.getTop(); // This logs the current scroll position of the first list item element/view group. Log.d("onScroll", "onScroll: " + top); // Here we finally change the margin (setting a negative margin) to the header element. ((LinearLayout.LayoutParams)(findViewById(R.id.header_container).getLayoutParams())).setMargins(0, top, 0, 0); // was just a test: invalidating the outer container/view group, doesn't help // findViewById(R.id.ll_container).invalidate(); } ``` I do see the "onScroll:" log output I inserted in the code above in the logcat, but the following adjustment of the top margin just doesn't become visible. is to use a scrollview for the guide header + tabs and work with those. Scrolling the guide header (which is then a scroll view) from code with scrollView.scrollTo(0,Math.abs(Math.abs(top)) from the onScroll method of the list view does work and almost immediately shows on the screen, however, it's not very accurate/stable when the user flings the list view very fast - meaning it jumps in intervals and doesn't look smooth; it's only accurate/stable when scrolling slowly. is there any best practice to accomplish such a sliding header effect, and more concrete: is there a way to force the guide header view to be redrawn while the user is still scrolling the list view (in my first mentioned approach).
iPhone alike sliding header, or: how to force immediate redraw on top margin change?
CC BY-SA 3.0
0
2011-05-08T13:32:18.470
2011-09-03T17:38:30.430
2011-05-08T13:41:13.567
241,475
241,475
[ "android-layout", "android" ]
5,927,828
1
5,932,154
null
2
6,176
Is there any way to extract the properties of the image file from vb 6.0? I want to browse the particular photo and then extract the properties like the following from any image format. ![enter image description here](https://i.stack.imgur.com/ZESEz.jpg)
Extract properties from the image file
CC BY-SA 3.0
0
2011-05-08T13:52:33.183
2011-05-09T03:19:52.093
null
null
657,285
[ "image", "vb6" ]
5,927,905
1
5,931,914
null
1
2,185
I have just installed TortoiseGit 1.6.5, Git Extensions 2.21, and SmartGit 2.0.4 on Windows 7 64bit thirty minutes ago. Would this cause any compatibility issues? --- I think TortoiseGit and Git Extensions should coexist well, because by default [Git Source Control Provider](http://gitscc.codeplex.com/) displays commands of both TortoiseGit and Git Extensions in the context menu. From official website of [Git Source Control Provider](http://gitscc.codeplex.com/): ![enter image description here](https://i.stack.imgur.com/El8ZG.png)
Can TortoiseGit, Git Extensions, and SmartGit coexist on Windows 7 64bit?
CC BY-SA 3.0
null
2011-05-08T14:06:45.507
2011-09-04T14:11:32.630
2011-09-04T14:11:32.630
669,202
null
[ "git", "tortoisegit", "git-extensions", "smartgit" ]
5,928,131
1
5,934,728
null
2
1,034
Hello fellow BB programmers, if you look at the native Contacts (Addressbook) application on a Blackberry 6 phone with touch screen - it has a very natural behaviour: 1. On a short tap the default action is being executed - viewing the selected addressbook entry 2. On a long touch and hold a menu with several actions is displayed: ![Addressbook](https://i.stack.imgur.com/EFeIr.png) I'm trying to create an app with a ListField and similar (and intuitive) behaviour myself: . I've searched a lot and unfortunately only managed to create a test app with exactly opposite behaviour sofar: I listen for a TouchGesture.HOVER and run editMenu.run(). And for the short tap a menu comes by itself (I haven't found yet, what makes it appear, some method in MainScreen/Screen?). I've tried running onMenu(0) but the menu appears in the top/right corner instead of screen center. ![MyList app](https://i.stack.imgur.com/YsCvM.png) Below is my very simple test code , please help me to fix it: ``` package mypackage; import java.util.*; import net.rim.device.api.collection.*; import net.rim.device.api.collection.util.*; import net.rim.device.api.system.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.decor.*; import net.rim.device.api.util.*; public class MyList extends UiApplication { public static void main(String args[]) { MyList app = new MyList(); app.enterEventDispatcher(); } public MyList() { pushScreen(new MyScreen()); } } class MyScreen extends MainScreen { ObjectListField myList = new ObjectListField() { protected boolean touchEvent(TouchEvent event) { if (event.getEvent() == TouchEvent.GESTURE) { TouchGesture gesture = event.getGesture(); if (gesture.getEvent() == TouchGesture.HOVER) { System.err.println("XXX hover=" + gesture.getHoverCount() + ", index=" + myList.getSelectedIndex()); editMenu.run(); // onMenu(0); return true; } } return super.touchEvent(event); } }; private final MenuItem addMenu = new MenuItem("Add item", 0, 0) { public void run() { Status.show("Adding new item"); } }; private final MenuItem editMenu = new MenuItem("Edit item", 1, 0) { public void run() { Status.show("Editing existing item: " + myList.getSelectedIndex()); } }; private final MenuItem removeMenu = new MenuItem("Remove item", 2, 0) { public void run() { Status.show("Removing existing item: " + myList.getSelectedIndex()); } }; public MyScreen() { setTitle("How to display menu on long click?"); myList.set(new String[] { "Item 1", "Item 2", "Item 3", "Item 4", }); add(myList); addMenuItem(addMenu); addMenuItem(editMenu); addMenuItem(removeMenu); } } ``` Thank you! Alex
Blackberry 6: display menu on long click, run 1 action on short click
CC BY-SA 3.0
null
2011-05-08T14:51:04.670
2011-11-15T09:30:37.740
2011-11-15T09:30:37.740
165,071
165,071
[ "blackberry", "menu", "touch", "gesture", "tap" ]
5,928,158
1
5,928,217
null
0
513
I didn't know what stack exchange site to put this on, so I put it here. I am trying to determine if there is a correlation between the size of a school and the major that the school specializes in. In order to do this, I programatically collected and analyzed data. In order to make my report, I need to make a few graphs in excel, but I have no clue how to do this. What I'm looking for is a scatter plot, with quantitative values on the Y-Axis (the school size) and qualitative values on the X-Axis, I would like there to be every major listed out (kinda like a bar graph). From there, I want to plot a point above the major that a school specializes in; and have that point be as high as its student size. Any help? Edit: Here is my sample data set. I want it to have categories that are to the right of the data, and points on the graph that correspond. ![enter image description here](https://i.stack.imgur.com/b5zgh.png)
Excel Graphing help
CC BY-SA 3.0
null
2011-05-08T14:56:38.220
2011-05-08T16:03:46.013
2011-05-08T16:03:46.013
221,543
221,543
[ "excel", "graph", "quantization" ]
5,928,191
1
5,928,223
null
1
228
I have a label called dateLabel that displays when did a user last time got logged in: ``` dateLabel.Text = "Sist gang logget inn: " + string.Format("{0:d}\n{0:T}", Session["LastLoginDate"].ToString()); ``` What i want i to display the information in 2 different lines. In the first the date and in the one below the time. - - - Current output: ![enter image description here](https://i.stack.imgur.com/bYIEj.png) Desired output: ![enter image description here](https://i.stack.imgur.com/LKgxF.png) Can someone give me some tips?
How to format a date to be displayed in 2 lines?
CC BY-SA 3.0
null
2011-05-08T15:02:59.443
2011-05-08T18:18:23.460
2020-06-20T09:12:55.060
-1
614,141
[ "c#", "asp.net", "formatting" ]
5,928,194
1
5,937,804
null
5
22,337
I'm trying to create a visualized chart using [Jquery Highcharts](http://www.highcharts.com/) plug-in. But I'm unable to write a Query to create data which is needed to insert the JS. What I need to do is to show the customer, how many unique visitors clicked his Job Ad. You can see the final output what I'm trying to do; ![enter image description here](https://i.stack.imgur.com/TQXwl.png) And this is a part of required JS; ``` xAxis: { categories: ['01.05', '02.05', '03.05', '04.05', '05.05', '06.05', '07.05','08.05'] }, series: [{ name: 'Unique', data: [12,8,9,10,5,4,11,30] }] ``` Table with the statistics; ``` Job_Ad_Statistics ----------------- jobID, jobstat_Date, job_statUnique 1 07.05.2011 0 1 07.05.2011 1 1 07.05.2011 1 2 06.05.2011 1 3 06.05.2011 1 1 05.05.2011 1 1 04.05.2011 1 *Currently, table has 20k rows. ``` I need to get multiple Count where job_statUnique=1 AND jobstat_Date is between now AND 7 days earlier from now in order to insert the data to Series field. ``` Expected Result: ---------------- Day Unique_ViewCount_of_jobID (Assuming ID 1) .... start from 7 days earlier 02.05 0 03.05 0 04.05 1 05.05 1 06.05 0 07.05 2 08.05 0 - today ``` Thanks for help.
How to create Chart Data using SQL query
CC BY-SA 3.0
0
2011-05-08T15:03:45.457
2011-05-09T20:11:25.960
2011-05-08T15:38:42.163
235,555
235,555
[ "sql", "sql-server", "charts", "highcharts" ]
5,928,260
1
5,928,360
null
4
361
Below is the code and the problematic line. When I hover with the mouse on `src.EnergyServiceLevel`, it shows that it's null. How can that be if I'm checking for null in the previous line? My guess was that maybe there are threads that making the problem so I've add a lock, but it didn't helped. ``` public static ServiceLevelsGroup SafeClone(this ServiceLevelsGroup src) { ServiceLevelsGroup res = null; lock (_locker) { if (src != null) { res = new ServiceLevelsGroup(); if (src.EnergyServiceLevel != null) { res.EnergyServiceLevel = new ServiceLevelInfo { ServiceGrade = src.EnergyServiceLevel.ServiceGrade }; if (src.EnergyServiceLevel.Reason != null) res.EnergyServiceLevel.Reason = src.EnergyServiceLevel.Reason; } } } return res; } ``` The exception occurs at the `res.EnergyServiceLevel = ...` line in the above code. Here's a screenshot of the exception occurring in debug mode: ![Screenshot of exception while debugging](https://i.stack.imgur.com/a3Usn.png)
Can't find why do I have a null reference exception
CC BY-SA 3.0
0
2011-05-08T15:11:51.700
2011-05-08T15:42:01.657
2011-05-08T15:33:07.623
22,417
138,627
[ "c#", ".net", "exception", "nullreferenceexception" ]
5,928,395
1
null
null
2
770
``` <?php if(!empty($_GET['pID'])) $the_pID = mysql_real_escape_string($_GET['pID']); if(!empty($_POST['cID'])) $the_cID = mysql_real_escape_string($_POST['cID']); ?> <form action="inc/q/prof.php?pID=<?php echo $the_pID; ?>" method="post"> <select id="courseInfoDD" name="courseInfoDD" tabindex="1"> <?php while($row3 = $sth3->fetch(PDO::FETCH_ASSOC)) {echo "<option>".$row3['prefix']." ".$row3['code']."</option>";} ?> </select> <select id="commQuarter" name="commQuarter" tabindex="2"> <option value="Fall">Fall</option> <option value="Winter">Winter</option> <option value="Spring">Spring</option> <option value="Summer">Summer</option> </select> <select id="commYr" name="commYr" tabindex="3"> <?php $startdate = 2000;$enddate = date("Y");$years = range ($startdate,$enddate);foreach($years as $year){echo "<option value='$year'>$year</option>";}?> </select> <textarea type="text" id="addComment" name="addComment" tabindex="3" value="Enter comment"> </textarea> <input type="hidden" name="pID" value="<?php echo $the_pID; ?>" /> <?php if($sth3->rowCount() > 0) { $row3 = $sth3->fetch(PDO::FETCH_ASSOC); echo "<input type='hidden' name='cID' value='<?php echo $the_cID; ?>' />"; } else { echo "<h1>poop</h1>."; } unset($sth3); ?> <input type="submit" name="submit" id="submit" /> </form> **PHP/MYSQL** <?php // Get select box options $pID3 = filter_input(INPUT_GET, 'pID', FILTER_SANITIZE_NUMBER_INT); $pdo3 = new PDO('mysql:host=##;dbname=###', $u, $p); $pdo3->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sth3 = $pdo3->prepare(' SELECT pID, cID, C.prefix, C.code FROM Department D, Course C, Professor P WHERE pID = ? AND D.dID = C.dID AND D.dID = P.dID; '); $sth3->execute(array( $pID3 )); ?> <?php $connect = mysql_connect("###", $u, $p) or die ("Error , check your server connection."); mysql_select_db("##"); //Get data in local variable if(!empty($_POST['addComment'])) $INFOO=mysql_real_escape_string($_POST['addComment']); if(!empty($_POST['commQuarter'])) $QTRR=mysql_real_escape_string($_POST['commQuarter']); if(!empty($_POST['commYr'])) $YRR=mysql_real_escape_string($_POST['commYr']); if(!empty($_POST['pID'])) $PIDD=mysql_real_escape_string($_POST['pID']); if(!empty($_POST['cID'])) $CIDD=mysql_real_escape_string($_POST['cID']); if(!empty($_POST['courseInfoDD'])) $COURSEE=mysql_real_escape_string($_POST['courseInfoDD']); #print_r($_POST); echo $the_pID; echo $the_cID; // check for null values if (isset($_POST['submit'])) { $query="INSERT INTO Comment (info, Qtr, Yr, pID, cID, CName) VALUES ('$INFOO', '$QTRR', '$YRR', '$PIDD', '$CIDD','$COURSEE')"; mysql_query($query) or die(mysql_error()); echo "Your message has been received"; } #else if(!isset($_POST['submit'])){echo "No blank entries";} #else{echo "Error!";} ?> ``` Sample of What's Submitted: ![img1](https://i.stack.imgur.com/YRjgR.png) The zero shown towards the end is the cID field, why isn't this being submitted?? Its giving no error. In addition, what is wrong with this: ``` <?php if($sth3->rowCount() > 0) { $row3 = $sth3->fetch(PDO::FETCH_ASSOC); echo "<input type='hidden' name='cID' id='cID' value='$row3['cID']' />"; } else { echo "<h1>poop</h1>."; } unset($sth3); ?> ``` It's saying this: `syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in`
Why isn't this hidden field being sent to database?? Mysql/php
CC BY-SA 3.0
null
2011-05-08T15:32:53.093
2011-05-08T17:58:02.217
2011-05-08T17:58:02.217
700,070
700,070
[ "php", "mysql" ]
5,928,432
1
5,928,477
null
1
195
I have a some java code that simulates bank transfers. The account class simply has a balance field and a transfer method that add some balance to the balance field. The TransferManager defines a Transfer class which takes two Account objects to transfer a given amount from the one account to the other that are passed as parameters. The Manager itself has two important methods that need to be synchronized because the both operate on the same resource and they will be called in a threaded way: ``` public synchronized void issueTransfer(Account from, Account to, int amount) { openTransfers.add(new Transfer(from, to, amount)); issuedTransfers++; } public synchronized void performTransfers() { for(Transfer transaction : openTransfers) { transaction.performTransfer(); performedTransfers++; } openTransfers.clear(); } ``` Without the synchronization statement here I get NullPointerExceptions on the arraylist where Transfers are stored and read. BankTest spawns 10 threads, each issues 10 transfers. Just have a look at BankTest.java. The problem is that not always 10*10 transfers are issued. Sometimes there are 98 or 99: ![enter image description here](https://i.stack.imgur.com/1pIud.png) Do I have to add synchronization to BankTest.java? What should I do? Any other ideas or suggestions? : [http://pastebin.com/Je4ExhUz](http://pastebin.com/Je4ExhUz) : [http://pastebin.com/cdpWhHPb](http://pastebin.com/cdpWhHPb) : [http://pastebin.com/v7pwJ5T1](http://pastebin.com/v7pwJ5T1) : [http://pastebin.com/QYEeWy5Z](http://pastebin.com/QYEeWy5Z)
Why is threading is still inconsistent?
CC BY-SA 3.0
0
2011-05-08T15:38:38.337
2011-05-08T16:46:05.070
null
null
401,025
[ "java", "multithreading" ]
5,928,490
1
null
null
0
1,981
I need help to calculate the tangets of a circle in 3D space, this is what I have so far ![enter image description here](https://i.stack.imgur.com/dYc7I.jpg) ![enter image description here](https://i.stack.imgur.com/fh61U.jpg) Tangents are represented by the blue lines, and this is the method I got from a friend to calculate them ``` Vec3D getTangentBetweenTwoPoint( Vec3D p1, Vec3D p2 ) { Vec3D r = new Vec3D( p1.x - p2.x, p1.y - p2.y, p1.z - p2.z ); r.normalize(); return r; } void getTangents() { Vec3D p0, p1; for ( int i = 1; i < curve_length + 1; i++ ) { p0 = points[i % curve_length]; p1 = points[(i+1) % curve_length]; tangents[i % curve_length] = getTangentBetweenTwoPoint( p0, p1 ); } } ``` Any help will be much appreciated
How to calculate tangents of a circle in 3D?
CC BY-SA 3.0
null
2011-05-08T15:51:05.377
2011-11-11T19:24:33.820
2011-05-08T15:52:49.547
21,234
659,149
[ "java", "trigonometry", "geometry", "processing" ]