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,418,155
1
5,418,534
null
7
6,715
I'm trying to create a many-to-many relationship in Entity Framework (code first), according to the following post: [Database design for limited number of choices in MVC and Entity Framework?](https://stackoverflow.com/questions/5153849/database-design-for-limited-number-of-choices-in-mvc-and-entity-framework) However, I can't get it to work properly, and I'm sure I'm doing something very simple the wrong way. Here's the diagram I have no from my attempts: ![enter image description here](https://i.stack.imgur.com/emMAx.jpg) The point of the junction table is that I need to have an extra property, Level, in the relationship, so I can't just go with a direct relationship between Consultant and Program. I added the ConsultantProgramLink entity manually in the designer, and then added associations to Program and Consultant respectively, selecting to add a FK for each, and then made them both primary keys. But when I do it like this it doesn't work as I expected: If I had done a direct association between Consultant and Program, I would have been able to refer to, say, Consultant.Programs in my code. But that doesn't work now with the junction table. Is there any way to remedy this, or do I always have to go through the junction property (Consultant.ConsultantProgramLink.Programs)? In any case, even if I do try to go through the junction property it doesn't help. I can do Consultant.ConsultantProgramLink in my code, but another dot doesn't give me the navigation property Programs (which for some reason also became simply Program, why? Can I just rename them if I eventually get access to them at all?). So what am I doing wrong? Why can't I access the properties through dot notation in my code?
Many to many relationship with junction table in Entity Framework?
CC BY-SA 2.5
0
2011-03-24T11:06:32.203
2011-03-25T08:30:43.190
2017-05-23T11:53:52.973
-1
178,946
[ "asp.net", "asp.net-mvc-3", "entity-framework-4", "junction-table" ]
5,418,219
1
5,418,242
null
0
139
I have two lists declared as follows: ``` Dim lstDBItems As New List(Of DBItem) Dim lstAppItems As New List(Of AppItem) ``` I am trying to do something like this: I've a function which returns List(Of AppItem): ``` Function GetAppItems() As List(Of AppItem) '... End Function ``` In the above function I populate lstDBItems and then write the return statement like follows: ``` Return lstDBItems.Select(Function(x) dim oItem As New AppItem() oItem.Property1 = x.DbProperty1 '... Return oItem End Function) ``` The weird thing is the code compiles, but on rumtime I get a type case error. What is the correct way of doing what I'm trying to achieve...? PS: Excuse the screenshot tampering. ![Error Screenshot](https://i.stack.imgur.com/X1Gtx.png)
Can the select extension method project to a list of instantiated objects
CC BY-SA 2.5
null
2011-03-24T11:13:55.660
2011-03-24T11:22:11.940
2011-03-24T11:15:32.043
43,846
145,682
[ ".net", "vb.net", "extension-methods" ]
5,418,255
1
5,423,156
null
4
2,786
I'm designing an (Natural Language Processing) application in python and I want to use the following (Universal Networking Language) EnConverter that is an executable gui - - application and only works on windows (I don't have its source-code) : ![](https://i.stack.imgur.com/Wnm8V.jpg) So, what I want to know is how can I program a console application that calls this EnConverter and press the "Setting" button then manage to fill the text-boxes in the following image: ![](https://i.stack.imgur.com/Yp2m4.jpg) When I click the "" button, the previous window shows up... I want my application to fill these text-boxes, then press ""... When pressing the "" button the application returns to the first window... The last thing for the application (my application) to do is clicking the "" button in the first window... See the the first image, please. I know this is possible because my professor have done this job in ... And he refused to tell me how!!! I have researched the Internet but I got nothing!
How do I fill text-boxes in a gui application through command line?
CC BY-SA 2.5
0
2011-03-24T11:17:48.947
2011-03-24T17:34:10.397
2011-03-24T12:13:09.650
17,343
278,691
[ "python", "windows", "perl", "console", "ui-automation" ]
5,418,374
1
5,418,888
null
1
3,675
I have recently deployed a web application that makes use of many web service calls. During deveolpment I did not notice any deadlock or contention, but now when the website is live and heavily visited I get this error in my event log a couple of times a day, and the website also freeze/hangs so that I have to restart IIS. > Application pool 'Default AppPool' exceeded its job limit settings. I have found some information on this site [http://support.microsoft.com/kb/821268](http://support.microsoft.com/kb/821268), that looks promising, but I need some help regarding the setting values. Im thinking of tuning these settings: ``` * maxWorkerThreads * minWorkerThreads * maxIoThreads * minFreeThreads * minLocalRequestFreeThreads * maxconnection * executionTimeout ``` First it says I have to do them in Machine.configm but couldnt I just do them in Web.config? Second, what would be the reccomended settings to solve my problem with contention? My (virtual) webserver is running on the following system configuration: ![enter image description here](https://i.stack.imgur.com/17yoF.png) I also know that to solve this permanently, I might have to do something with my code, add caching etc. I welcome tips regarding this aswell.
Contention, poor performance, and deadlocks when making Web service requests from ASP.NET
CC BY-SA 2.5
0
2011-03-24T11:27:36.103
2011-03-24T12:57:11.397
null
null
219,443
[ "asp.net", "iis-7", "web-config", "machine.config" ]
5,418,458
1
5,418,780
null
2
2,509
I am learning WebGL, and would like to do the following: Create a 3D quad with a square hole in it using a fragment shader. It looks like I need to set `gl_FragColor` based on `gl_FragCoord` appropriately. So should I: a) Convert `gl_FragCoord` from window coordinates to model coordinates, do the appropriate geometry check, and set color. OR b) Somehow pass the hole information from the vertex shader to the fragment shader. Maybe use a texture coordinate. I am not clear on this part. I am fuzzy about implementing either of the above, so I'd appreaciate some coding hints on either. My background is that of an OpenGL old timer who has not kept up with the new shading language paradigm, and is now trying to catch up... Edit (27/03/2011): I have been able to successfully implement the above based on the tex coord hint. I've written up this example at the link below: [Quads with holes - example](http://tat-tvam-asi.in/programming/webgl/quads-with-holes/) ![Quads with holes - example](https://i.stack.imgur.com/9aEJX.jpg)
Using gl_FragCoord to create a hole in a quad
CC BY-SA 3.0
null
2011-03-24T11:34:45.693
2017-09-30T14:15:55.057
2017-09-30T14:15:55.057
5,577,765
253,029
[ "glsl", "webgl" ]
5,418,521
1
null
null
0
311
We are a team that just started working with Subversion using Subversive in Eclipse. I have learned from [this guide](http://www.cs.wustl.edu/~cytron/cse132/HelpDocs/Subversive/subversive.htm), (See Resolving Conflicts) that a notification popup alertbox is to be shown when two people make changes to the same file and then try to commit them, resulting in a conflict: ![enter image description here](https://i.stack.imgur.com/rAxlE.gif) In our installation we are not getting this alertbox. I imagine that it may be a setting that we need to set. Does anyone know how to get this alert box to be shown?
Not getting unresolved conflict notification popup alert box in Subversive (SVN in eclipse)
CC BY-SA 3.0
null
2011-03-24T11:39:32.237
2011-07-19T22:22:23.237
2011-07-19T22:22:23.237
280,222
674,759
[ "eclipse-plugin", "subversive" ]
5,418,652
1
5,712,735
null
2
1,681
I want to set the application language in iTunes. It always shows only English, but I want to show two languages in iTunes. I don’t want to make any changes to the application code, as I’m already managing these two languages by device language. ![Sample Image](https://i.stack.imgur.com/PyV9Z.png) The sample image contains multiple languages, like English, Chinese, Dutch, and French.
Setting iOS application languages in iTunes
CC BY-SA 4.0
0
2011-03-24T11:50:46.750
2020-08-18T05:47:37.943
2020-08-18T05:47:37.943
7,395,227
397,636
[ "ios4", "app-store", "universal-binary", "itunes-store" ]
5,418,832
1
5,425,077
null
3
472
I downloaded CHDataStructures source code (r709), and tried to compile the iOS static library under xCode 4. It complained when compiling: ![Xcode build errors](https://i.stack.imgur.com/xhbEh.png) Can anyone give me some ideas how to compile it?
CHDataStructures.framework won't compile for iOS in Xcode 4
CC BY-SA 2.5
null
2011-03-24T12:07:37.420
2011-03-25T14:56:12.483
2011-03-24T21:49:38.547
120,292
213,076
[ "xcode", "ios", "compilation", "chdatastructures" ]
5,419,079
1
null
null
0
205
I really need to know how to make the dropdownTree Menu in ipad. I need to create it in my ipad app. If anyone out there knows it, please share it with me. Thanks a lot in advance.![enter image description here](https://i.stack.imgur.com/ayAor.png)
Do anyone know how to make a dropdowntree menu in ipad?
CC BY-SA 2.5
null
2011-03-24T12:28:08.590
2011-03-24T13:00:01.780
null
null
601,207
[ "iphone", "ipad", "drop-down-menu" ]
5,419,086
1
5,419,711
null
4
8,085
So I have this problem, which has never happened to me before. I am trying to put a text field exactly next to an a button, which I already did and it looks great. The problem is that it looks great on firefox, but on chrome the only issue is the button's height. I dont know why its not taking the specified height. Everything else on my site works great (height wise) its all the same specified hight on all cross-platforms Here is the code: ``` <div> <!-- filter item start --> <p> <a href="#" id="add-friend-feed-link"> Add Friend </a> </p> <form method="post" action="" name="searchFriendForm" id="add-friend-search"> <input type="text"/ name="searchFriendText"> <input type="button" class="small green button" id="add-friend-button"/> </form> <hr> </div> <!-- filter item end --> ``` and ``` /* Absolutes start */ #add-friend-search{ display: block; position: absolute; } #add-friend-search input[type="text"]{ -moz-border-radius:4px 0px 0px 4px; -moz-box-shadow:0 1px 0 #444444; -webkit-border-radius:4px 0px 0px 4px; -webkit-box-shadow:0 1px 0 #444444; border-radius:4px 0px 0px 4px; box-shadow:0 1px 0 #444444; background:none repeat scroll 0 0 #D4D8DF; border:1px solid black; color:#444444; font:13px Arial,sans-serif; height:19px; margin: 20px 4px 4px; padding:5px 6px 4px; width:250px; text-align: center; float: left; display: inline-block; } #add-friend-search{ background:url("../images/small arrow.png") no-repeat scroll 88px 2px transparent; display:block; position:absolute; width:332px; } #add-friend-search input[type="button"]{ background:url("../images/search icon.png"); background-position: center; } #add-friend-button{ border: 1px solid black; border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; -webkit-border-radius: 0 4px 4px 0; display: inline-block; height: 21px !important; margin-right: 33px; margin-top: 20px; position: absolute; right: 0; max-height: 31px; } /*Absolutes end */ ``` this is what it looks like in Firefox ![enter image description here](https://i.stack.imgur.com/VBxrA.png) and this is what it looks like in chrome ![enter image description here](https://i.stack.imgur.com/NPW4c.png) this is the button xcss that contains small, green but I am not supposed to modify this CSS AT ALL ``` /*-------------------------------------------------------------------------------------------- Button Styles Reset - Gets rid of Browser Specific Issues -------------------------------------------------------------------------------------------- */ input[type="button"], button { border:0 none; font:inherit; } *:focus{outline:0 none;} input[type="submit"] {border:1px solid rgba(0, 0, 0, 0.25);} input[type="button"], button {-moz-box-sizing: content-box;} input[type="button"]::-moz-focus-inner, button::-moz-focus-inner { padding:0;border:0 none; }/*fixes mozilla button padding */ .clearfix:after { clear: both; content: '.'; display: block; font-size: 0; line-height: 0; visibility: hidden; width: 0; height: 0; } /*-------------------------------------------------------------------------------------------- General Button Styles, Cascades Down To Every Button -------------------------------------------------------------------------------------------- */ .button { -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; -moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50); -webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50); box-shadow:0 1px 3px rgba(0, 0, 0, 0.50); background:#222222 url(button-images/button-overlay.png) repeat-x; border:1px solid rgba(0, 0, 0, 0.25); color:#FFFFFF !important; cursor:pointer; display:inline-block; font-size:13px; font-weight:bold; line-height:1; overflow:visible; padding:5px 15px 6px; position:relative; text-decoration:none; text-shadow:0 -1px 1px rgba(0, 0, 0, 0.25); width:auto; text-align:center; } .button:hover { background:#111111; color:#FFFFFF; } .button:active { background:#242424; } .green.button { background-color:#91BD09; } .green.button:hover { background-color:#749A02; } .green.button:active { background-color:#a4d50b; } .blue.button { background-color:#0E59AE; } .blue.button:hover { background-color:#063468; } .blue.button:active { background-color:#1169cc; } .purple.button { background-color:#660099; } .purple.button:hover { background-color:#330066; } .purple.button:active { background-color:#7f02bd; } .breen.button { background-color:#2DAEBF; } .breen.button:hover { background-color:#007D9A; } .breen.button:active { background-color:#36cbdf; } .red.button { background-color:#CC0000; } .red.button:hover { background-color:#990000; } .red.button:active { background-color:#ea0202; } .magenta.button { background-color:#A9014B; } .magenta.button:hover { background-color:#630030; } .magenta.button:active { background-color:#ce025c; } .orange.button { background-color:#FF5C00; } .orange.button:hover { background-color:#D45500; } .orange.button:active { background-color:#fd762a; } .yellow.button { background-color:#FFE115; } .yellow.button:hover { background-color:#E4C913; } .yellow.button:active { background-color:#fee539; } .white.button { background-color:#FFFFFF; border:1px solid #CCCCCC; color:#666666 !important; font-weight:normal; text-shadow:0 1px 1px #FFFFFF; } .white.button:hover { background-color:#EEEEEE; } .white.button:active { background-color:#ffffff; } .gray.button { -moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50); background:#FFFFFF url(button-images/button-overlay-black.png) repeat-x; border:1px solid #BBBBBB; color:#555555 !important; text-shadow:0 1px 1px rgba(255, 255, 255, 0.5); } .gray.button:hover { background-color:#EEEEEE; border-color:#999999; color:#444444 !important; } .gray.button:active { background-color:#ffffff; } /*-------------------------------------------------------------------------------------------- Small Buttons -------------------------------------------------------------------------------------------- */ .small.button { font-size:11px; padding:5px 15px 6px; background-image:url(button-images/small-button-overlay.png); } input[type="submit"].small.button, .small.button.input { padding:3px 15px 4px; } input[type="button"].small.button, button.small.button { padding:4px 15px; } /*-------------------------------------------------------------------------------------------- Tall Buttons -------------------------------------------------------------------------------------------- */ .tall.button { font-size:14px; padding:8px 19px 9px; background-image:url(button-images/tall-button-overlay.png); } .tall.gray.button { background-color:#FFFFFF; background-image: url(button-images/tall-black.png); background-repeat:repeat-x; } .tall.gray.button:hover { background-color:#EEEEEE!important; border-color:#999999; color:#444444 !important; } .tall.gray.button:active { background-color:#FFFFFF!important; } .tall.button em { font-size:11.5px; font-style:normal; display:block; margin-top:5px; } /*-------------------------------------------------------------------------------------------- Round Buttons -------------------------------------------------------------------------------------------- */ .round.button { -moz-border-radius:15px; -webkit-border-radius:15px; border-radius:15px; background-image:url(button-images/round-button-overlay.png); border:1px solid rgba(0, 0, 0, 0.25); font-size:13px; padding:0; } .round.button span { -moz-border-radius:14px; -webkit-border-radius:14px; border-radius:14px; display:block; line-height:1; padding:4px 15px 6px; } .round.button.input { padding:3px 13px 4px; } .small.round.button { -moz-border-radius:12px; -webkit-border-radius:12px; border-radius:12px; font-size:11px; } input[type="button"].round.small.button, button.round.small.button { padding:0; } .small.round.button span { -moz-border-radius:11px; -webkit-border-radius:11px; border-radius:11px; padding:6px 15px 6px; } .large.round.button { -moz-border-radius:18px; -webkit-border-radius:18px; border-radius:18px; background-position:left bottom; } .large.round.button span { -moz-border-radius:17px; -webkit-border-radius:17px; border-radius:17px; font-size:14px; padding:7px 20px 9px; } .large.tall.round.button small { display:block; margin-top:5px; } ```
Button height on Chrome
CC BY-SA 3.0
0
2011-03-24T12:28:49.383
2014-09-29T07:52:30.763
2014-09-29T07:52:30.763
3,885,376
554,381
[ "html", "css", "cross-browser" ]
5,419,209
1
5,419,476
null
1
651
So I'm trying to create a new project and I want to create a local Git repository for it. I'm using Xcode 4; I just downloaded and installed the latest version. When I go to make a new project and get to the point where I need to enter a name for my project the "Create local git repository" checkbox it is grayed out. I have already tried to create a symlink to where Xcode thinks Git should be with this command: ``` sudo ln -s /usr/local/git/bin/git /usr/bin/git ``` Here is a screenshot: ![Screenshot showing grayed out checkbox for “Create local git repository”](https://i.stack.imgur.com/tsB92.png)
Xcode not allows me to create local git
CC BY-SA 2.5
null
2011-03-24T12:37:31.530
2011-03-25T08:18:13.247
2011-03-25T08:18:13.247
193,688
640,618
[ "git", "xcode4" ]
5,419,309
1
5,419,420
null
0
3,304
Hi im trying to set the css style for this but I dont know whats happening I have this code from asp (code behind) ``` System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style["float"] = "left"; Image img = new Image(); img.ImageUrl = "~/userdata/2/uploadedimage/batman-for-facebook.jpg"; img.AlternateText = "Test image"; div.Controls.Add(img); test1.Controls.Add(div); System.Web.UI.HtmlControls.HtmlGenericControl div1 = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div1.InnerText = String.Format("{0}", reader.GetString(0)); div1.Style["float"] = "left"; test1.Controls.Add(div1); System.Web.UI.HtmlControls.HtmlGenericControl div2 = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div2.Style["clear"] = "both"; test1.Controls.Add(div2); ``` which does this: ![enter image description here](https://i.stack.imgur.com/51DuU.jpg) My css was originaly this: ``` div#test1 { } div#div { width:90%; z-index:1; padding:27.5px; border-top: thin solid #736F6E; border-bottom: thin solid #736F6E; color:#ffffff; margin:0 auto; white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; } ``` But I dont know how to change the css now to reflect the changes in my code so that I can apply style to it.
style sheet problems from code behind
CC BY-SA 2.5
null
2011-03-24T12:45:05.170
2011-03-24T15:10:43.543
2011-03-24T12:52:10.753
328,193
477,228
[ "c#", "asp.net", "html", "css", "stylesheet" ]
5,419,324
1
5,419,984
null
0
298
I'd like to make something similar what iPhone does with my icons. I'd like to have an icon and also the round red notifier in the upper right side of the icon for showing new updates. ![enter image description here](https://i.stack.imgur.com/guYBK.jpg) How can I make it?
How to make Iphone icon update notifier style icon
CC BY-SA 2.5
0
2011-03-24T12:46:02.623
2011-09-18T01:44:08.547
2011-03-25T11:08:16.547
1,288
574,044
[ "php", "iphone", "dreamweaver", "photoshop" ]
5,419,439
1
null
null
9
6,894
I just installed `numpy` and `matplotlib` on my OS X 10.6.6. I have Python 2.7 from Python.org. When I do an `import matplotlib.pyplot`, I get the following error: ``` ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: no matching architecture in universal wrapper ``` Is there something I missed? How do I fix this? `matplotlib`'s interactive plotting system uses Tcl/Tk/Tkinter to provide a GUI. I installed the 64-bit Python, but I missed the following caveats in the Python.org download pages [link1](http://www.python.org/download/releases/2.7.1/), [link2](http://www.python.org/download/mac/tcltk/): ![http://www.python.org/download/releases/2.7.1/](https://i.stack.imgur.com/isX4J.png) ![http://www.python.org/download/mac/tcltk/](https://i.stack.imgur.com/0IjPV.png) Therefore, I [deleted the 64-bit version](https://stackoverflow.com/q/3819449/366309) and installed the 32-bit version. I would suggest to keep this question open just in case a 64-bit Tcl/Tk/Tkinter comes out for Python 2.7.
Matplotlib.pyplot on OS X with 64-bit Python from Python.org
CC BY-SA 2.5
0
2011-03-24T12:53:27.010
2012-06-14T16:13:02.713
2017-05-23T10:29:46.917
-1
366,309
[ "python", "macos", "matplotlib" ]
5,419,535
1
5,419,719
null
1
6,082
I am creating a barbutton programmatically. But it can't fix into screen. Help me in solve this problem. Screenshot: ![enter image description here](https://i.stack.imgur.com/VQkaL.png) ``` UIImage *image = [UIImage imageNamed:@"request.png"]; UIBarButtonItem *button2; //[button2 setWidth:55]; button2= [[UIBarButtonItem alloc] initWithImage:image style:UIBarStyleDefault target:self action:@selector(requestButton)]; self.navigationItem.rightBarButtonItem = button2; [button2 release]; ```
How to add barbutton programmatically with image
CC BY-SA 2.5
0
2011-03-24T12:58:51.640
2016-07-20T04:26:59.273
2011-03-24T13:05:50.327
598,368
598,368
[ "iphone", "uiimage", "uibarbuttonitem" ]
5,419,516
1
5,419,930
null
1
316
I have been trying all morning to replicate the below however I cannot get the alignment correct, it seems that a row will match the height of the biggest td, I need to replicate this as pixel perfect as possible. ![enter image description here](https://i.stack.imgur.com/hDXWH.jpg) Below is my HTML, ``` <table cellspacing="0" cellpadding="0" border="0" align="center" style="height: 268px; width: 700px;"> <thead> <tr> <th valign="middle" align="center" style="height: 27px;" scope="col">Information</th> <th valign="middle" align="center" style="height: 27px;" scope="col">Education &amp; Training</th> <th valign="middle" align="center" style="height: 27px;" scope="col">Marketing Services</th> <th valign="middle" align="center" style="height: 27px;" scope="col">Digital Media</th> <th valign="middle" align="center" style="height: 27px;" scope="col">Entertainment</th> <th valign="middle" align="center" style="height: 27px;" scope="col">Business Services</th> </tr> </thead> <tbody> <tr> <td valign="middle" align="center" style="height: 27px;">Academic</td> <td valign="middle" align="center" style="height: 27px;">For-profit schools</td> <td valign="middle" align="center" style="height: 27px;">Agency</td> <td valign="middle" align="center" style="height: 27px;">Internet</td> <td valign="middle" align="center" style="height: 27px;">TV and Radio Broadcasting</td> <td valign="middle" align="center" style="height: 27px;">Business Process Outsourcing</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">STM</td> <td valign="middle" align="center" style="height: 27px;">Educational Technology</td> <td valign="middle" align="center" style="height: 27px;">Digital</td> <td valign="middle" align="center" style="height: 27px;">Mobile Distribution</td> <td valign="middle" align="center" style="height: 27px;">Cinema</td> <td valign="middle" align="center" style="height: 27px;">B2B Services</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Financial</td> <td valign="middle" align="center" style="height: 27px;">Educational Services</td> <td valign="middle" align="center" style="height: 27px;">Market Research</td> <td valign="middle" align="center" style="height: 27px;">Online Gaming</td> <td valign="middle" align="center" style="height: 27px;">Film, TV, Music and Sports Content and Rights</td> <td valign="middle" align="center" style="height: 27px;">SaaS</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Business</td> <td valign="middle" align="center" style="height: 27px;">Professional Training</td> <td valign="middle" align="center" style="height: 27px;">Outdoor</td> <td valign="middle" align="center" style="height: 27px;">Social Media</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Trade</td> <td valign="middle" align="center" style="height: 27px;">Vocational Training</td> <td valign="middle" align="center" style="height: 27px;">Public Relations</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Consumer</td> <td valign="middle" align="center" style="height: 27px;">Sales Promotion</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Professional</td> <td valign="middle" align="center" style="height: 27px;">Direct Marketing</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">Lead Generation</td> </tr> <tr> <td valign="middle" align="center" style="height: 27px;">&nbsp;</td> <td valign="middle" align="center" style="height: 27px;">&nbsp;</td> </tr> </tbody> </table> ``` and my CSS, ``` #left table { border:0 none; } #left th { height:43px; background:url(images/th_bg.jpg) top left repeat-x; font-size:14px; color:#fff; font-family:"Times", "Times New Roman", "Serif"; } #left tbody td { text-align:center; background:#99abb9; border-right:1px solid #fff; width:105px; padding:10px 15px 0px 15px; height:17px; } ```
HTML table replicating a sample image
CC BY-SA 4.0
0
2011-03-24T12:57:52.007
2019-01-24T19:53:12.907
2019-01-24T19:53:12.907
4,370,109
307,007
[ "html", "css", "html-table" ]
5,419,939
1
5,420,159
null
1
1,902
why can images not be appended to a div in asp? ``` divHtml.append(img); ``` why do I have to use `div.controls.add(img);`? and why cant I add a string to controls.add say like this ``` div.controls.add(img + String.Format("{0}", reader.GetString(0)); ``` ? Orginally "In the beginning" I had this code: ``` cn.Open(); using (OdbcCommand cmd = new OdbcCommand("SELECT Wallpostings FROM WallPosting WHERE UserID=" + theUserId + " ORDER BY idWallPosting DESC", cn)) using (OdbcDataReader reader = cmd.ExecuteReader()) { var divHtml = new System.Text.StringBuilder(); while (reader.Read()) { divHtml.Append("<div id=test>"); divHtml.Append(String.Format("{0}", reader.GetString(0))); divHtml.Append("</div>"); } test1.InnerHtml = divHtml.ToString(); } } ``` } Which gave me this out put (notice the css is applied and all spacing etc is nice and neat: ![enter image description here](https://i.stack.imgur.com/LTLRG.jpg) Then I did this code: ``` while (reader.Read()) { System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); //div.ID = "test"; div.Style["float"] = "left"; Image img = new Image(); img.ImageUrl = "~/userdata/2/uploadedimage/batman-for-facebook.jpg"; img.AlternateText = "Test image"; div.Controls.Add(img); test1.Controls.Add(div); System.Web.UI.HtmlControls.HtmlGenericControl div1 = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); //div1.ID = "test"; div1.InnerText = String.Format("{0}", reader.GetString(0)); div1.Style["float"] = "left"; test1.Controls.Add(div1); System.Web.UI.HtmlControls.HtmlGenericControl div2 = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); //div2.ID = "test"; div2.Style["clear"] = "both"; test1.Controls.Add(div2); } } } } ``` } And this was my result which is ok but if you notice carefully there is no css between each comment the divs are outside the realm of my css I tryed applying the commented out lines to see if it would work but its just abit funky tbh. Specialy when you look at it in firebug: ![enter image description here](https://i.stack.imgur.com/Fdh2Q.jpg) This is what happens if I try parse the control using the method mentioned below: ``` cn.Open(); using (OdbcCommand cmd = new OdbcCommand("SELECT Wallpostings FROM WallPosting WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { test1.Controls.Clear(); while (reader.Read()) { System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.ID = "test"; div.Style["float"] = "left"; Image img = new Image(); img.ImageUrl = "~/userdata/2/uploadedimage/batman-for-facebook.jpg"; img.AlternateText = "Test image"; div.Controls.Add(img); div.Controls.Add(ParseControl(String.Format("{0}", reader.GetString(0))); test1.Controls.Add(div); ``` ![enter image description here](https://i.stack.imgur.com/MSudO.jpg) Edit: ``` using (OdbcDataReader reader = cmd.ExecuteReader()) { test1.Controls.Clear(); while (reader.Read()) { System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Attributes["class"] = "test"; div.Style["float"] = "left"; div.ID = "test"; //div.Style["float"] = "left"; Image img = new Image(); img.ImageUrl = "~/userdata/2/uploadedimage/batman-for-facebook.jpg"; img.AlternateText = "Test image"; div.Controls.Add(img); div.Controls.Add(ParseControl(String.Format("{0}", reader.GetString(0)))); test1.Controls.Add(div); ``` Shadow managed to get this to work and I used the parse from the other comment aswell. But problem remains now with test1 div not expanding with test divs: ![enter image description here](https://i.stack.imgur.com/9IFyN.jpg) ``` <asp:Button ID="Button1" runat="server" Text="Post Message" Width="98px" onclick="Button1_Click" /> </p> <p> </p> <div id="test1" runat="server" /> //could be this line </asp:Content> ``` Or it could be ``` test1.Controls.Add(div); ``` in my code thats not being picked up or in the correct brackets maybe? css: ``` div#test1 { } div .test { width:90%; z-index:1; padding:27.5px; border-top: thin solid #736F6E; border-bottom: thin solid #736F6E; color:#ffffff; margin:0 auto; white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; } ```
Strings versus controls in ASP.NET WebForms
CC BY-SA 2.5
null
2011-03-24T13:28:06.133
2011-03-24T15:12:09.447
2011-03-24T15:12:09.447
477,228
477,228
[ "c#", "asp.net", "html", "webforms" ]
5,420,007
1
5,420,058
null
0
896
I am using JQuery Syntax highlighter in my asp.net application. [http://www.steamdev.com/snippet/](http://www.steamdev.com/snippet/) I have included the scripts and CSS file as mentioned in the USAGE section. Also the below code: ``` <script> $(document).ready(function(){ $("pre.htmlCode").snippet("html"); // Finds <pre> elements with the class "htmlCode" // and snippet highlights the HTML code within. $("pre.styles").snippet("css",{style:"greenlcd"}); // Finds <pre> elements with the class "styles" // and snippet highlights the CSS code within // using the "greenlcd" styling. $("pre.js").snippet("javascript",{style:"random",transparent:true,showNum:false}); // Finds <pre> elements with the class "js" // and snippet highlights the JAVASCRIPT code within // using a random style from the selection of 39 // with a transparent background // without showing line numbers. }); </script> <script> $(document).ready(function(){ $("pre#dynamic").snippet("php",{style:"navy",clipboard:"js/ZeroClipboard.swf",showNum:false}); // Highlights a snippet of PHP code with the "navy" style // Hides line numbers $("pre#dynamic").click(function(){ $(this).snippet({style:"vampire",transparent:true,showNum:true}); // Changes existing snippet's style to "vampire" // Changes the background to transparent // Shows line numbers }); }); </script> ``` Result: I am getting the code section like below ![Code highlighting](https://i.stack.imgur.com/yP095.jpg) But the code is going out from the highlighter, also I have no option of copy clicpboard. How to include that into my page? While inserting the data I have used `<pre></pre>` tag only. Do I need to specify the language in pre? Because I am also not getting the color code I am calling the JS and CSS file like the below ``` <link href="jquery.snippet.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<%=ResolveUrl("~/JS/jquery.snippet.js")%>" ></script> ``` It is in collapse mode and when I clicked on "text" link I can see all formating are gone. Any suggestion how can I keep the HTML mode in expand format? ![enter image description here](https://i.stack.imgur.com/Tze7F.jpg)
JQuery Syntax Highlighter Snippet
CC BY-SA 2.5
null
2011-03-24T13:32:44.673
2011-03-24T14:25:39.713
2011-03-24T14:25:39.713
609,582
609,582
[ "jquery", "asp.net", "syntax-highlighting" ]
5,420,549
1
5,420,688
null
0
2,605
I have this page, shown below. In the ASCX file, the data is generated using a DataGrid in which a user searches for fields and it displays results based on input criteria. This is using a stored procedure and parameters to perform this search. It then returns the results, populates a datagrid, now my question is how would I go about in my ASPX page having my disk icon allow a user to download a CSV of the data that has been returned in the ASCX page. I obviously need to run a command to generate the CSV file from the database, which I have all the code for, but my question really is how do I know what the user has searched for, or what results were returned I guess best put. Is this possible? ![enter image description here](https://i.stack.imgur.com/n2QtL.png)
ASP.net ASCX and ASPX transfering data from one to the other
CC BY-SA 2.5
null
2011-03-24T14:18:01.633
2011-03-24T14:27:47.737
null
null
595,208
[ "c#", "asp.net" ]
5,420,656
1
5,420,788
null
157
635,690
I have a server app and sometimes, when the client tries to connect, I get the following error: ![enter image description here](https://i.stack.imgur.com/z8LND.jpg) and the line at which it stops ( sThread : line 96 ) is : ``` tcpClient = (TcpClient)client; clientStream = tcpClient.GetStream(); sr = new StreamReader(clientStream); sw = new StreamWriter(clientStream); // line 96: a = sr.ReadLine(); ``` What may be causing this problem? Note that it doesn't happen all the time
Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host
CC BY-SA 3.0
0
2011-03-24T14:24:59.523
2022-12-10T18:55:22.980
2017-05-23T14:58:30.827
133
476,024
[ "c#", ".net", "ioexception" ]
5,420,907
1
null
null
0
1,083
I am trying to build a portfolio application similar to the used by [Whitevoid](http://www.whitevoid.com/portfolio/). I am using Flex 4 and Papervision3D 2. I have everything working except for one issue. When I try to load an external SWF as a material on one of the planes, I can see any native Flex or Flash components in their correct positions, but the papervision objects are not being rendered properly. It looks like the viewport is not being set in the nested swf. I have posted my code for loading the swf below. ``` private function loadMovie(path:String=""):void { loader = new Loader(); request = new URLRequest(path); loader.contentLoaderInfo.addEventListener(Event.INIT, addMaterial); loader.load(request); } private function addMaterial(e:Event):void { movie = new MovieClip(); movie.addChild(e.target.content); var width:Number = 0; var height:Number = 0; width = loader.contentLoaderInfo.width; height = loader.contentLoaderInfo.height; //calculate the aspect ratio of the swf var matAR:Number = width/height; if (matAR > aspectRatio) { plane.scaleY = aspectRatio / matAR; } else if (matAR < aspectRatio) { plane.scaleX = matAR / aspectRatio; } var mat:MovieMaterial = new MovieMaterial(movie, false, true, false, new Rectangle(0, 0, width, height)); mat.interactive = true; mat.smooth = true; plane.material = mat; } ``` Below I have posted two pictures. The first is a shot of the application running by itself. The second is the application as a MovieMaterial on a Plane. You can see how the button created as a spark object in the mxml stays in the correct position, but papervision sphere (which is rotating) is in the wrong location. Is there something I am missing here? ![Sphere](https://i.stack.imgur.com/q5IOc.png) ![Plane](https://i.stack.imgur.com/X07jV.png)
How can I load a Papervision/Flex application (SWF) as a material on a Papervision plane?
CC BY-SA 2.5
null
2011-03-24T14:41:21.250
2011-03-24T17:07:05.200
2011-03-24T17:07:05.200
135,021
135,021
[ "actionscript-3", "flex4", "papervision3d" ]
5,421,224
1
5,422,378
null
0
1,301
But it's there. ![enter image description here](https://i.stack.imgur.com/SZLiz.png) any ideas? It happens when I am trying to get metadata from an image file (this is AppleScript running a shell script): ``` on getMetaData(filePath) -->get meta data try set myCommand to (quoted form of (POSIX path of (pathToExifTool)) & " " & quoted form of (POSIX path of (filePath))) set thisMetaData to (do shell script myCommand) on error errMsg log "Can't find exiftool:" & errMsg end try ... ``` pathToExifTool is this: /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool" and exists. Here's the complete error thrown: "Can't find exiftool:Can't locate Image/ExifTool.pm in @INC (@INC contains: /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/lib /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30. BEGIN failed--compilation aborted at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30." Well the bundle is a mess (lots of .pm files floating about - they look to be duplicates) but the exiftool-->image-->ExifTool.pm path is there. ![enter image description here](https://i.stack.imgur.com/ymwOW.png) ==================================== # Here's the solution h/t to Sherm Apparently my directory structure went all to hell for some reason, either I did it unknowingly or something with XCode as Sherm indicated decided to wreck havoc. Anyway, (bear with my incredibly non-technical description) when working in XCode, yellow folders (or groups as they call them for some odd reason) will not be added to your bundle...hence exiftool (if you look at the first image) had no hierarchy to find its needed files, as evidenced by the bundle screen capture. I basically trashed all the related exiftool files from the app (right click/delete/delete references) and then brought them back in from the finder. You'll note in the third screen cap those directories are now blue. These will be built with the app. ![enter image description here](https://i.stack.imgur.com/bbt4N.png)
Working in Xcode: Can't find exiftool:Can't locate Image/ExifTool.pm
CC BY-SA 2.5
null
2011-03-24T15:04:22.563
2011-03-24T18:49:59.803
2011-03-24T18:49:59.803
468,455
468,455
[ "cocoa", "xcode", "exif" ]
5,421,272
1
null
null
1
2,354
I am new to WCF. I have a scenario where i have ![Error while passing ArrayList](https://i.stack.imgur.com/TLQ9O.jpg). When i am trying to pass the array list it giving the error. Please, have the look to image. ``` [GeneratedCode("System.ServiceModel", "4.0.0.0")] [ServiceContract(ConfigurationName = "FPCommission.ICommissionService")] public interface ICommissionService { [OperationContract(Action = "http://tempuri.org/ICommissionService/GetCommisionResponse", ReplyAction = "http://tempuri.org/ICommissionService/GetCommisionResponseResponse")] object[] GetCommisionResponse(object[] loc_); } ``` I am still not get the solution.
Pass the array list to the WCF application
CC BY-SA 3.0
null
2011-03-24T15:07:21.443
2013-02-19T13:57:35.420
2013-02-19T13:57:35.420
76,337
397,868
[ "web-services", "wcf" ]
5,421,261
1
5,442,479
null
4
5,474
I have a simple mapping and it is working but it's not filling in Output.Details. I am a bit confused, I think it maybe because I am using the source as "Task" for each one. ``` Mapper.CreateMap<Task, Output>(); Mapper.CreateMap<Task, Output.Details>().ForMember( dest => dest.Item, opt => opt.MapFrom(src => src.Name)); ``` As far as i know i have to create 2 maps, 1 for the object and 1 for object contained within. Problem is the source for the OUTPUT and OUTPUT.DETAILS can be found in TASK I tried delving into Details within the first map and specifying Mapfrom but it gives the following error which is why i must create 2 maps ``` must resolve to top-level member. Parameter name: lambdaExpression error IList<Task> tempItems= GetItems(); IList<Output> items = Mapper.Map<IList<Task>, IList<Output>>(tempItems); ``` The map works but my property "Item" availble in Output.Details is NULL What am I doing wrong? Here is my Destination object. It fills in Name no problem, but nothing inside DETAILS... they are left NULL. Task is not my class, but I checked it and all values are there to be copied hence Tag has a value and is a STRING. ``` public class Output { public string Name { get; set; } public Details Summary { get; private set; } public class Details { public string Item{ get; set; } } public Output() { Summary = new Details(); } } ``` Here is an example of the Task class. ![enter image description here](https://i.stack.imgur.com/d6HM9.png) They is a sample vs 2010 project here and it shows exactly the problem. [http://dl.dropbox.com/u/20103903/AutomapperNotWorking.zip](http://dl.dropbox.com/u/20103903/AutomapperNotWorking.zip) and here is an image showing the issue, as you can see Summary Item is "NULL" but it should contain the NAME from Task. ![enter image description here](https://i.stack.imgur.com/Q78M7.png)
Automapper (C#): Nested mappings not working
CC BY-SA 4.0
0
2011-03-24T15:06:51.387
2021-05-13T08:08:50.573
2021-05-13T08:08:50.573
472,495
457,172
[ "c#", "automapper", "inner-classes" ]
5,421,436
1
5,421,530
null
2
3,407
I have a xml file for layout of each row of listview. I have 3 columns. In first column the imageview doesn't show, only the text below it. This is my row.xml: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:padding="6dip"> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:gravity="center_vertical" android:layout_weight="1" android:src="@drawable/icon" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_vertical" android:layout_marginTop="5dip" android:text="hfghfgh" /> </LinearLayout> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <TextView android:layout_height="0dip" android:gravity="center_vertical" android:layout_weight="1" android:text="fghfghfh" android:id="@+id/cena1" android:layout_width="fill_parent"/> <TextView android:id="@+id/cena2" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center_vertical" android:layout_marginTop="5dip" android:text="gghj" /> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:id="@+id/razdalja" android:text="ghjghjgj" android:layout_marginTop="5dip" android:gravity="center_vertical" /> </LinearLayout> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <Button android:background="@drawable/call_button" android:id="@+id/gumb_klic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:focusable="false" android:focusableInTouchMode="false" /> </LinearLayout> </LinearLayout> ``` What i get is this (i draw IMG where imageview should appear): ![enter image description here](https://i.stack.imgur.com/OKgYv.png) Any ideas?
ImageView not shown inside custom row for listview
CC BY-SA 2.5
null
2011-03-24T15:17:36.923
2019-01-22T22:01:37.853
null
null
324,417
[ "android", "listview", "imageview" ]
5,421,468
1
null
null
0
289
Receiving this when attempting to run Pinax 0.7rc1 basic_project for the first time. "Exception Value: cannot import name messages" Pinax installs Django 1.0.3 and I don't think this version has the messages module. Any help? [http://dpaste.com/525105/](http://dpaste.com/525105/) Django 1.0.3 ![enter image description here](https://i.stack.imgur.com/VjEQc.png)
Pinax import error
CC BY-SA 2.5
null
2011-03-24T15:20:23.543
2011-03-24T17:40:25.000
2011-03-24T17:09:09.910
355,697
355,697
[ "django", "pinax" ]
5,421,676
1
5,430,201
null
0
122
hi the following image is UI of my app![enter image description here](https://i.stack.imgur.com/7ixCi.png) in this i have placed rounded table in middle. In that the first three AAAA, BBBB, CCCC are of edit boxes and the other 2 are of textview. When i touch the first 3 edit text the keyboard gets opened. When i click the last two text view the "date picker" gets opened. Now i want to display the date which i set must be viewed in the places of DATE1 and DATE2(TextView boxes). but when i try this it gets crashed. how to solve this please help me.... following is the code of date picker ``` { private void updateDisplay() { this.mDateDisplay.setText( new StringBuilder() // Month is 0 based so add 1 .append(mMonth + 1).append("-") .append(mDay).append("-") .append(mYear).append("-")); } private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplay(); } }; @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay); } return null; } } ```
problem with android UI
CC BY-SA 2.5
null
2011-03-24T15:37:33.873
2011-03-25T08:41:49.027
2011-03-24T15:48:02.453
473,070
596,364
[ "android", "uiview" ]
5,422,042
1
5,422,085
null
-1
180
Im trying to retrieve a path name from my Pictures table the pathname is stored under picturepath in my Pictures table I dont know how to join it on to my current sql syntax it uses the UserID which is set by a session. And im unsure what goes in the commented line for my image url string? ``` using (OdbcCommand cmd = new OdbcCommand("SELECT Wallpostings FROM WallPosting WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { test1.Controls.Clear(); while (reader.Read()) { System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Attributes["class"] = "test"; //div.Style["float"] = "left"; div.ID = "test"; Image img = new Image(); img.ImageUrl = String.Format("{unsure}", reader.GetString(unsure)); // this line needs to be represented in sql syntax img.AlternateText = "Test image"; div.Controls.Add(img); div.Controls.Add(ParseControl(String.Format("{0}", reader.GetString(0)))); div.Style["clear"] = "both"; test1.Controls.Add(div); ``` ![enter image description here](https://i.stack.imgur.com/rypNR.jpg)
sql syntax how to do a join?
CC BY-SA 2.5
null
2011-03-24T16:03:36.593
2011-03-24T19:32:55.357
2011-03-24T19:32:55.357
477,228
477,228
[ "c#", "asp.net", "mysql", "sql" ]
5,422,049
1
5,804,376
null
0
426
I have a table which takes show some data in its cells, which comes from a method using a linq query to get the values from database. What i need to do is tto show 8 columns from a table in the database in a cell of table in the cell of the last column in this Report![enter image description here](https://i.stack.imgur.com/dAHb9.jpg) Is it possible to do that?And if it is, how can i do that? ``` List<KurBakiyeDegiskenleri> kurToplamlist = new List<KurBakiyeDegiskenleri>(); var query = from kur in kurToplamlist //where kurTL.DovizTuruGetSet == dovizTuru //where kur.KurToplamMiktarGetSet>0 join cariBilg in db.TBLP1CARIs on kur.CariIdGetSet equals cariBilg.ID select new { cariBilg.K_FIRMAADI,//FIRMA ADI cariBilg.K_YETKILIADI,//YETKILI ADI cariBilg.K_FIRMATELEFON,//FIRMA TEL cariBilg.K_YETKILITELEFON,//YETKILI TEL BAKIYE = kur.KurToplamMiktarGetSet,//BAKİYE }; return query; ```
Showing 8 columns together in a cell of a table in Microsoft Report Viewer
CC BY-SA 2.5
null
2011-03-24T16:04:14.553
2011-04-27T12:49:24.317
null
null
647,884
[ "c#", "linq", "linq-to-sql", "microsoft-reporting" ]
5,422,101
1
5,422,130
null
5
7,958
I created a brand new blank Visual Studio 2010 solution, and added an existing C# Project to it. I built the solution and it compiled correctly. But when I go the solution folder, I see that the imported C# project is not physically in that folder. It seems it only references the project to wherever it is. Is this intended? Should I even worry about this? How can I create a physical import, meaning the project is copied to the solution folder? ![enter image description here](https://i.stack.imgur.com/UM7zz.jpg)
Question when adding a project to a Visual Studio solution
CC BY-SA 2.5
0
2011-03-24T16:08:11.557
2011-03-24T16:50:56.857
null
null
null
[ "c#", "visual-studio-2010", "solution" ]
5,422,140
1
5,422,234
null
3
3,041
Do you know the awesome looking form of Windows Live that asks you for your cerdentials? [Gmail Notifier](http://toolbar.google.com/gmail-helper/notifier_windows.html) has it too, somehow. Is there any way I can invoke something like this in my application? --- BEHOLD! ![BEHOLD](https://i.stack.imgur.com/bNy46.png) --- I wish to use this dialog for local authentication on a desktop app.
Windows Security login form?
CC BY-SA 2.5
0
2011-03-24T16:11:29.883
2011-03-24T16:30:04.087
2011-03-24T16:16:50.190
485,098
485,098
[ "c#", ".net", "pinvoke", "desktop" ]
5,422,368
1
5,422,442
null
0
933
In an app I'm working on, I've got a few `UIImage`s which for some reason come out really blurry. This specifically applies to two icons I use which are fairly small (80x15 and 65x15). ![Top is original, below is blurry](https://i.stack.imgur.com/Xyd5w.png) ![iPad Simulator](https://i.stack.imgur.com/bOuvU.png) (Update: added iPad Simulator output as well -- it is blurry just as the iPad output) Top left and right are original images, bottom left and right are how they come out on the iPad. I actually got complaints about these being awfully blurry from users, so it's not just me. The code where one of these is put in place looks like this (can show code for other one at request): ``` UIButton *bWeb = [[UIButton alloc] initWithFrame: CGRectMake(attriboffset, height - 20.f, 65.f, 15.f)]; [bWeb addTarget:self action:@selector(clickWebLink:) forControlEvents:UIControlEventTouchUpInside]; bWeb.userInteractionEnabled = YES; [bWeb setImage:[UIImage imageNamed:@"button-weblink-65x15.png"] forState:UIControlStateNormal]; [bWeb setImage:[UIImage imageNamed:@"button-weblink-highlighted-65x15.png"] forState:UIControlStateHighlighted]; [self addSubview:bWeb]; [bWeb release]; ``` The original images are (in case you think it might be a formatting issue with the actual PNG files): ![cc-by.png](https://i.stack.imgur.com/VHTkl.png), ![weblink.png](https://i.stack.imgur.com/LwFSK.png)
Why are these UIImages so "blurry"?
CC BY-SA 2.5
null
2011-03-24T16:26:58.233
2011-03-24T16:50:35.343
2011-03-24T16:32:05.017
271,166
271,166
[ "iphone", "image", "ipad", "image-processing", "uiimage" ]
5,422,545
1
5,465,217
null
3
1,003
When the user clicks 'x' on a Pinned Form OnClose is called. When the user clicks 'x' on an Unpinned Form OnHide is called When the user clicks 'UnPin' on a Pinned Form OnHide is called. I'm trying to synchronise the visible forms with a menu system but I don't know how to determine the difference in the OnHide event between when the user clicks 'x' and when the user clicks 'UnPin'. I want to intercept the 'x' and call Close instead. ![Menu with ticks](https://i.stack.imgur.com/FCdnA.png) Each child is a descendant of TManagerPanel which in turn is a descendant of TForm with the border style set to bsSizeToolWin, Drag Kind set to dkDock and Drag Mode is dmAutomatic. ``` type TPanelManager = class(TForm) ... private ... Panels: TManagerPanelList; Settings: TSettings; //User Settings ... end; ... function TPanelManager.InitChild(ChildClass: TManagerPanelClass): TManagerPanel; var Child: TManagerPanel; begin Child := ChildClass.Create(Self); Child.Connection := MSConnection1; Child.Settings := Settings; Child.Styles := Styles; ... Child.OnPanelClosed := PanelClosed; Child.OnPercentChanged := PercentChanged; ... Child.OnPanelHide := PanelHide; Child.Font := Font; Child.Initialise; Child.ManualDock(DockTarget); Panels.AddPanel(Child); Result := Child; end; procedure TPanelManager.PanelClosed(Sender: TObject; var Action: TCloseAction); var MenuItem: TMenuItem; Child: TManagerPanel; begin if Sender is TManagerPanel then begin Child := TManagerPanel(Sender); Action := caFree; MenuItem := MenuItemFromChild(Child); MenuItem.Checked := False; Settings[RemoveAmpersand(MenuItem.Caption)] := MenuItem.Checked; Panels.Remove(Child); end; end; ``` EDIT: What I mean by a "Pinned" Form: A docked form with the pin set such that it always visible. ![Pinned](https://i.stack.imgur.com/qW2eo.jpg) What I mean by a "UnPinned" Form: A docked form with the pin released such that a tab appears in a dock tab set and the form appears when the tab is selected. ![Unpinned - Expanded](https://i.stack.imgur.com/9IkF4.jpg) ![Unpinned](https://i.stack.imgur.com/VHbGK.jpg) Delphi Version is 2007
Difference between UnPin and Close UnPinned
CC BY-SA 2.5
0
2011-03-24T16:43:06.140
2011-04-11T13:58:55.093
2011-03-28T18:58:57.013
265,419
265,419
[ "delphi", "dock" ]
5,422,596
1
5,423,731
null
4
733
When using the Aero theme, are there resource names for styles that I can hook in to to achieve the same appearance as standard Win7 apps: ![control panel example](https://i.stack.imgur.com/XdhbR.png) In other words, are there already well-known style names for TextBlocks (and other controls) that would let me achieve a similar appearance to what is in the image above? In XAML it would look something like this: ``` <TextBlock Style="{DynamicResource WindowsHeading}" /> ```
WPF Aero theme standard styles
CC BY-SA 2.5
0
2011-03-24T16:48:02.693
2011-08-16T15:43:59.817
2011-08-16T15:43:59.817
305,637
62,505
[ "wpf", "styles", "aero" ]
5,422,597
1
5,423,718
null
1
971
I am trying to upgrade some equations that currently are written against Mathematica 5 to get them to work in Mathematica 7. ``` F = Graphics[ ContourPlot[ x^2 + (2)*y^2 + (-1)*((1)/(3))*x, {x, -1, 1}, {y, -1, 1}, ContourShading -> False, ContourStyle -> {RGBColor[1, 0, 1]}, Contours -> 20, PlotPoints -> 100]]; G = ParametricPlot[{Cos[u], Sin[u]}, {u, 0, 2*Pi}, PlotStyle -> {RGBColor[0, 174/255, 239/255]}]; H = DeleteCases[F, {x_, y_} /; (x^2 + y^2 > 1), 5]; Show[{H, G}, AspectRatio -> Automatic, Frame -> False, Axes -> True, AxesOrigin -> {0, 0}, AxesLabel -> {x, y}, Ticks -> None] ``` It should look like this: ![Should look like this](https://i.stack.imgur.com/HXSVm.gif), but id does look like this: ![does look like this](https://i.stack.imgur.com/dNyfD.gif) and it gives the following error: ``` Thread::tdlen: Objects of unequal length in {{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}}+{{},<<21>>,{}} cannot be combined. >> ``` and if you hover over the image you get the following in a tooltip: ``` The specified setting for the option GraphicsBoxOptions, PlotRange cannot be used. Coordinate index X is out of range for the enclosing GraphicsComplex ``` there are a lot of those Coordinate ones all with different coordinates. --- And the second one I'm having difficulty with is: ``` P1 = {{(5)/10*Cos[u]*Cos[v], (5)/10*Sin[u]*Cos[v], (5)/10*Sin[v]}, {u, 0, 2*Pi}, {v, -Pi/2, Pi/2}}; P2 = {{(5)/10*Cos[u], 0, (5)/10*Sin[u]}, {u, 0, 2*Pi}}; P3 = {{(5)/10*Cos[u], (5)/10*Sin[u], 0}, {u, 0, 2*Pi}}; P4 = {{0, (5)/10*Cos[u], (5)/10*Sin[u]}, {u, 0, 2*Pi}}; U = {P1, P2, P3, P4}; XL = {{-1, 1}, {-1, 1}, {-1, 1}}; XV = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; XS = {"x", "y", "z"}; f[a_, b_, c_] := {a, 1.1*b[[2]]*c}; g[a_, b_] := {(b*# &) /@ a}; T = Text @@@ MapThread[f, {XS, XL, XV}]; A = Line @@@ MapThread[g, {XL, XV}]; F = (ParametricPlot3D[Evaluate[Evaluate @@ #]][[1]] &) /@ U; OPT = {Boxed -> False, Axes -> False, BoxRatios -> {1, 1, 1}, PlotRange -> XL, ViewPoint -> {2.4, 1.3, 2}, DisplayFunction -> Identity}; L = {LightSources -> {{{0.1, 0, 1}, RGBColor[0.68, 0.88, 0.96]}}}; gr1 = (Show[Graphics3D[#], OPT, L] &) /@ {{EdgeForm[], F}, {Dashing[{0.03, 0.03}], GrayLevel[0.7], A}, {T}}; gr2 = DeleteCases[Graphics[Show[Graphics3D[{A, EdgeForm[], F}], OPT, RenderAll -> False]], {__, _Polygon}, 3]; Show[{gr1, gr2}, AspectRatio -> Automatic] ``` This one should look like: ![Should look like this](https://i.stack.imgur.com/LsGbr.gif), but does look like: ![does look like this](https://i.stack.imgur.com/i0Dym.gif) which and it gives these errors: ``` ParametricPlot3D::write: Tag Plus in x^2+y^2 is Protected. >> Graphics3D::optx : Unknown option RenderAll Graphics3D::optx : Unknown option LightSources ``` If I then remove the Unknown options, those errors disappear but it still looks wrong: ![After removing invalid options](https://i.stack.imgur.com/gCeZE.gif) Also, if you hover over the last image in mathematica you get the following message repeated several times in a tooltip ``` Times is not a Graphics3D primitive or directive ```
Upgrade from Mathematica 5 to Mathematica 7
CC BY-SA 2.5
0
2011-03-24T16:48:03.163
2011-03-26T00:43:14.280
null
null
447,454
[ "graph", "wolfram-mathematica", "plot" ]
5,422,675
1
5,422,721
null
6
528
![enter image description here](https://i.stack.imgur.com/q33NQ.jpg) I'm trying to ditch Windows Forms, and learn to use WPF professionally from now on. Pictured above is a form done in Windows Forms that I'd like to recreate in WPF. Here is the XAML I have so far: ``` <Window x:Class="PizzaSoftware.UI.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="297" Width="466" > <Grid ShowGridLines="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width=".20*"/> <ColumnDefinition /> <ColumnDefinition Width=".20*"/> </Grid.ColumnDefinitions> <Rectangle Grid.Column="0"> <Backcolor? </Rectangle> </Grid> </Window> ``` Is this even the right approach, I mean using a Rectangle. In my Windows Forms example, I used a Panel and gave it a .BackColor property. What's the WPF way to achieve this? Thank you.
New to WPF, how would I create these colored bars in my form?
CC BY-SA 2.5
null
2011-03-24T16:54:23.903
2011-03-24T17:13:03.507
null
null
null
[ "c#", "wpf", "grid", "background-color" ]
5,422,774
1
5,422,815
null
1
128
I am trying to follow Steve Sandersons MVC2 book and in Chapter 17 he implements a simple / custom MembershipProvider. However when I "build" my project I get a HUGE array of "...does not implement inherited abstract member..." Can anyone tell me how I state I dont want to currently implement all of these? ![enter image description here](https://i.stack.imgur.com/hx1DO.jpg)
ASP.NET MVC: Errors when tryig to build a new MembershipProvider
CC BY-SA 2.5
null
2011-03-24T17:01:57.780
2011-03-24T17:05:31.040
null
null
545,490
[ "asp.net-mvc", "asp.net-mvc-3", "membership-provider" ]
5,422,791
1
null
null
9
842
For example: ![enter image description here](https://i.stack.imgur.com/qy4z9.png) I was under the impression that `$(...)` was recommended over ```` because it's easier to nest.
vim: Why does the sh colour scheme highlight `$(...)` as an error?
CC BY-SA 2.5
0
2011-03-24T17:03:07.460
2011-03-24T18:34:51.977
2011-03-24T17:08:03.650
71,522
71,522
[ "bash", "shell", "vim" ]
5,422,849
1
null
null
0
379
My map looks like this: ![Screen shot](https://i.stack.imgur.com/LmogB.png) I don't know what it is, but I think it has connection with style o div, in which it is located: ``` div#col_left { width: 140px; float: left; height:auto; margin-bottom:20px; } ```
Wrong rendering of google maps
CC BY-SA 2.5
null
2011-03-24T17:07:28.897
2011-03-25T10:54:36.157
2011-03-24T17:17:25.227
182,668
437,223
[ "javascript", "html", "css", "google-maps" ]
5,422,939
1
5,423,750
null
15
10,197
In Xcode 3 it was easy to get an overview of which files are activated for current active target. I love the new feature in Xcode 4 where you can see all the targets a specific file is active for (its like an inversed view of xcode 3). Is there some mysterious way of getting that good ol' view back? It would be really handy when specifying test-files and nibs for different targets... Image from that good ol' list in xcode 3: ![enter image description here](https://i.stack.imgur.com/SVZkG.png)
xcode 4 list of files with target
CC BY-SA 2.5
0
2011-03-24T17:15:19.877
2012-10-12T22:03:57.600
null
null
202,451
[ "xcode", "xcode4" ]
5,423,038
1
5,423,127
null
1
203
I want to delete all records from `wp_usermeta` with `user_id` whose `meta_value` is "tonetone" which is spam accounts. As you know already, there are many records with one `user_id` in `wp_usermeta`. I tried like this but doesn't work. Thanks to anyone who can show me the way. > All I want to do is delete all records with that user_id but the common value all I can get is "tonetone" ``` DELETE FROM wp_usermeta WHERE user_id = (SELECT user_id FROM wp_usermeta WHERE meta_value = "tonetone") ``` ![](https://cl.ly/1F1i0C420E3L1h360l2t/Screen_shot_2011-03-25_at_12.36.03_AM.png)
Need help with MySql query
CC BY-SA 2.5
0
2011-03-24T17:23:43.550
2014-05-23T09:19:22.520
2017-02-08T14:31:50.460
-1
100,015
[ "mysql" ]
5,423,105
1
5,423,330
null
16
13,721
I am looking for a way to hide one of the aestetic legends from the plot created with the code below. To scale the point color by date, I had to convert the dates into numbers, and I'd rather not show the date legend on the plot. On the other hand, the shape legend is important information to display. I understand that `legend.position="none"` will completely remove the legend, but then that leaves me with the problem of how to communicate the meaning behind the shapes. ``` library(ggplot2) w<-read.table("data.txt", header=TRUE) pt.data <- w[w$dt==min(w$dt),] p <- ggplot(data=w, aes(OAD,RtgValInt,color=dt,shape=Port)) + geom_jitter(size=3, alpha=0.75) + scale_colour_gradient(limits=c(min(w$dt), max(w$dt)), low="#9999FF", high="#000066") + geom_point(data=pt.data, color="red", size=3, aes(shape=Port)) print(p) ``` The `data.txt` file includes the lines below. ``` Date Port OAD RtgValInt dt 12/31/2010 Grp1 1.463771 1.833333 14974 12/31/2010 Grp2 1.193307 2.071429 14974 11/30/2010 Grp1 1.454115 1.833333 14943 11/30/2010 Grp2 1.127755 2.071429 14943 10/29/2010 Grp1 1.434965 2.000000 14911 10/29/2010 Grp2 1.055758 2.071429 14911 09/30/2010 Grp1 1.441773 2.000000 14882 09/30/2010 Grp2 1.077799 2.071429 14882 ``` ![enter image description here](https://i.stack.imgur.com/ctTlR.jpg)
How to remove an aesthetic from a ggplot2 legend
CC BY-SA 2.5
0
2011-03-24T17:29:30.787
2011-03-24T17:51:07.863
2011-03-24T17:50:52.273
338,714
338,714
[ "r", "ggplot2" ]
5,423,128
1
5,423,196
null
0
272
I need to count the number of views of an asset, this asset being embeded in multiple blogs, each blog generating multiple view for that asset. ![UML diagram](https://i.stack.imgur.com/Inqk8.png) I'm using and I was expecting the following to work: ``` class Asset < ActiveRecord::Base has_many :embeds end class Embed < ActiveRecord::Base belongs_to :asset has_many :views end class View < ActiveRecord::Base belongs_to :embed end class Assets < ApplicationController def show asset = Asset.find_by_id(params[:id]) @views = asset.embeds.views.count end end ``` Of course, it didn't work as expected. Why is that? And what would be the best approach to this? (joins, includes, raw SQL...)
Joins associations in Rails 3
CC BY-SA 2.5
null
2011-03-24T17:31:57.070
2011-03-24T17:37:36.007
null
null
346,005
[ "ruby-on-rails-3", "join" ]
5,423,267
1
5,423,479
null
2
1,317
I am trying to load an image into a control that has an image property, like TTrayIcon's Icon, TImage's Picture, in the Delphi IDE (design time), but it gives me an "Out of system resources" error when I have selected my image in the File dialog. This is the Load Image dialog, so you know what I'm talking about. ![Image Dialog](https://i.stack.imgur.com/4WTGZ.png) I got over 1 GB free memory, and I have rebooted several times, whereafter I only open Delphi, but its not helping.. Also, it's only happening for this one project.
EOutOfResources when loading image (icon) in design-time
CC BY-SA 2.5
null
2011-03-24T17:44:22.177
2011-03-24T18:04:33.930
2011-03-24T18:03:21.583
561,545
561,545
[ "image", "delphi", "load", "icons" ]
5,423,281
1
null
null
2
4,371
I can't seem to find it in the Toolbox. I've did a Google search, and found: [http://www.c-sharpcorner.com/UploadFile/mahesh/WPfTimer09292009090518AM/WPfTimer.aspx](http://www.c-sharpcorner.com/UploadFile/mahesh/WPfTimer09292009090518AM/WPfTimer.aspx) However, I can't seem to add a reference to `System.Windows.Threading` because it isn't displayed as an available library. I've even made sure to use the full .NET4 framework, and not the client framework. ![enter image description here](https://i.stack.imgur.com/suxGn.jpg) Any suggestion on what to try next? Thank you.
Does WPF have a Timer control?
CC BY-SA 2.5
null
2011-03-24T17:45:57.743
2011-05-19T09:46:57.817
null
null
null
[ "wpf", "timer" ]
5,423,485
1
5,424,102
null
0
2,875
I have a simple 2 colum layout (left col fixed width 200px, and right col expand 100%). If the 1st element of the right col is a `P` element everything is OK. But `INPUT``width:100%`. The result displayed is below (tested on Chrome, FF, IE): ![enter image description here](https://i.stack.imgur.com/UZhVK.jpg) And how to fix this? The code is here: ``` <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <style type="text/css"> body {background-color: #eeeeee;} div.left {float:left; width:200px; border:1px solid #ff0000;} div.right { margin-left:200px; border:1px solid #00ff00;} div.right p, div.right input {width:100%; border:1px dashed #0000ff;} </style> </head> <body> <div> <div class="left"> <p>left div</p> </div> <div class="right"> <p>I'm a P 100% width inside right div</p> </div> </div> <br> <div> <div class="left"> <p>left div</p> </div> <div class="right"> <input name="name" type="text" value="I'm an INPUT 100% width inside right div, why i'm down???"> </div> </div> </body> </html> ```
input field (width 100%) goes next line on simple 2 colum layout
CC BY-SA 4.0
null
2011-03-24T18:04:58.647
2022-06-13T19:19:25.003
2022-06-13T19:19:25.003
2,756,409
260,080
[ "html", "css" ]
5,423,674
1
5,423,695
null
0
1,449
I need to display some text in a box with an explicit width/height. If the text content exceeds the height of the box, I'd like to be truncated, preferably with an ellipsis. I tried using `overflow: hidden`, like so: ``` <div style="width: 500px; height: 50px; overflow: hidden; border: 1px solid black;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut sem orci. Sed laoreet, diam sed porttitor rhoncus, erat ante volutpat metus, dignissim laoreet lacus dolor a nisi. Fusce elit libero, interdum vel cursus tincidunt, vulputate quis lorem. In accumsan pharetra mauris, id vulputate sapien condimentum in. Etiam quis laoreet lectus </div> ``` But that often results in a line of text being partially visible, like this: ![sliced text image](https://i.stack.imgur.com/IrbOE.png) I thought about counting characters and manually truncating the text, but that won't help when the font is proportional.
Intelligently clipping text that exceeds a box boundary
CC BY-SA 2.5
null
2011-03-24T18:23:08.803
2011-03-24T18:30:39.170
2011-03-24T18:25:24.537
142,162
93,995
[ "html", "css" ]
5,424,078
1
null
null
11
6,614
I'm writing a software renderer which is currently working well, but I'm trying to get perspective correction of texture coordinates and that doesn't seem to be correct. I am using all the same matrix math as opengl for my renderer. To rasterise a triangle I do the following: 1. transform the vertices using the modelview and projection matrixes, and transform into clip coordinates. 2. for each pixel in each triangle, calculate barycentric coordinates to interpolate properties (color, texture coordinates, normals etc.) 3. to correct for perspective I use perspective correct interpolation: (w is depth coordinate of vertex, c is texture coordinate of vertex, b is the barycentric weight of a vertex) > ``` 1/w = b0*(1/w0) + b1*(1/w1) + b2*(1/w2) c/w = b0*(c0/w0) + b1*(c1/w1) + b2*(c2/w2) c = (c/w)/(1/w) ``` This should correct for perspective, and it helps a little, but there is still an obvious perspective problem. Am I missing something here, perhaps some rounding issues (I'm using floats for all math)? See in this image the error in the texture coordinates evident along the diagonal, this is the result having done the division by depth coordinates. ![image showing incorrect perspective correction](https://i.stack.imgur.com/9cdGk.png) Also, this is usually done for texture coordinates... is it necessary for other properties (e.g. normals etc.) as well?
perspective correction of texture coordinates in 3d
CC BY-SA 2.5
0
2011-03-24T18:56:17.140
2011-07-28T09:44:47.530
2011-03-25T20:13:14.117
440,181
440,181
[ "math", "opengl", "3d" ]
5,424,221
1
5,426,776
null
0
1,421
I am using a composite pattern as shown in the class diagram below. Basically my primary leaf (an Allocation) has a single property, Duration, that I want to accumulate in various composites. I also want to have a count of allocations, and the ability to return the allocations as a collection I can use for data binding in presentations. This question is about the C# implementation, specifically: 1. There is an interesting post here that has an extension to do this recursively, as well as an alternative approach that avoids recursion altogether. Would you have a common method to get at the Allocations the way I am doing? I haven't decided yet if the code I wrote feels awkward because I am not comfortable with pattern, or if it is awkward! 2. Do you see any easy opportunities here to cache the results of the first iteration and thereby minimize further iteration? Cheers, Berryl ![this class diagram](https://i.stack.imgur.com/dtXwV.png) # Code in the Composite class ``` public class AllocationComposite : AllocationNode { protected readonly IList<AllocationNode> _children; public AllocationComposite() { _children = new List<AllocationNode>(); } #region Implementation of AllocationNode public override void Adopt(AllocationNode node) ... public override void Adopt(IEnumerable<AllocationNode> nodes)... public override void Orphan(AllocationNode node)... public override void Orphan(IEnumerable<AllocationNode> nodes)... public override IEnumerable<AllocationNode> Descendants { get { return _children.Concat(_children.SelectMany(child => child.Descendants)); } } public override IEnumerable<Allocation> Allocations { get { return Descendants.OfType<Allocation>(); } } public override TimeSpan Duration { get { return Allocations.Aggregate(TimeSpan.Zero, (current, child) => current + child.Duration); } } public override int Count { get { return Allocations.Count(); } } #endregion public override string ToString() { return String.Format("{0} for {1}", "allocation".PluralizeWithCount(Count), "hour".PluralizeWithCount(Duration.TotalHours, "F2")); } } ``` } # Default implementation in abstract Component ``` public abstract class AllocationNode: Entity, IAllocationNode { #region Implementation of AllocationNode public virtual TimeSpan Duration { get { return TimeSpan.Zero; } set { } } public virtual void Adopt(AllocationNode node) { throw new InvalidOperationException(...)); } public virtual void Adopt(IEnumerable<AllocationNode> nodes) { throw new InvalidOperationException(...)); } public virtual void Orphan(AllocationNode node) { throw new InvalidOperationException(...)); } public virtual void Orphan(IEnumerable<AllocationNode> nodes) { throw new InvalidOperationException(...)); } public virtual int Count { get { return 1; } } public virtual IEnumerable<AllocationNode> Descendants { get { return Enumerable.Empty<AllocationNode>(); } } public virtual IEnumerable<Allocation> Allocations { get { return Enumerable.Empty<Allocation>(); } } #endregion } ```
Composite Design pattern & common descendant methods
CC BY-SA 2.5
0
2011-03-24T19:05:51.497
2011-03-24T23:21:19.623
2017-05-23T10:32:35.693
-1
95,245
[ "c#", "linq", "design-patterns", "composite" ]
5,424,285
1
5,426,046
null
0
398
I need to list the most popular assets of a particular user, these assets being embeded in multiple blogs, each blog generating multiple view for that asset. I would need the output to be ActiveRecord formatted, so that I can access the details of every pictures. ![UML diagram](https://i.stack.imgur.com/zdqPb.png) What would be the best practices and how would you do this with and ?
Rails 3 ActiveRecord query
CC BY-SA 2.5
null
2011-03-24T19:11:01.533
2011-03-24T21:53:14.360
null
null
346,005
[ "ruby-on-rails-3", "scope" ]
5,424,555
1
5,426,192
null
28
29,306
I'm trying to draw a pretty simple diagram in dot. ``` digraph untitled { rankdir = LR; {rank=same; S; A} B -> A; B -> S; A -> A; S -> S; A -> S ; S -> A; A -> T; S -> T; } ``` The results I get is ![enter image description here](https://i.stack.imgur.com/MkvVD.png) I really have to change the edge from `S -> S`, but I would also like to change the orientation of the arrows so they loop from left to right.
Changing edge direction in dot
CC BY-SA 2.5
0
2011-03-24T19:37:43.903
2011-03-24T22:08:23.243
null
null
159,438
[ "graphviz", "dot" ]
5,424,680
1
5,424,796
null
0
425
Hi I have an sql syntax error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHE' at line 1 My code: ``` using (OdbcCommand cmd = new OdbcCommand("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN [User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn)) { //("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN [User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn)) using (OdbcDataReader reader = cmd.ExecuteReader()) { test1.Controls.Clear(); while (reader.Read()) { System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Attributes["class"] = "test"; //div.Style["float"] = "left"; div.ID = "test"; Image img = new Image(); img.ImageUrl = String.Format("{1}", reader.GetString(0)); // this line needs to be represented in sql syntax img.AlternateText = "Test image"; div.Controls.Add(img); div.Controls.Add(ParseControl(String.Format("{0}", reader.GetString(0)))); div.Style["clear"] = "both"; test1.Controls.Add(div); } } } } } ``` My database structure: ![enter image description here](https://i.stack.imgur.com/0FUjE.jpg) EDIT: If i take the brackets out of the User in mysql syntax I then get an error: RE EDIT: adding wp. to UserID in WHERE clause gives a new error: Im sure this is due to this line: ``` img.ImageUrl = String.Format("{1}", reader.GetString(0)); ```
error in sql syntax? and in my c# img url string
CC BY-SA 2.5
null
2011-03-24T19:48:42.157
2011-03-24T20:14:25.520
2011-03-24T20:05:36.557
477,228
477,228
[ "c#", "asp.net", "mysql", "sql", "html" ]
5,424,699
1
5,424,854
null
3
3,708
In my custom view, I have the following code: ``` -(void) drawRect:(CGRect) rect { // Drawing code CGContextRef context = UIGraphicsGetCurrentContext(); ![NSString *myString = @"Hello World, This is for\nhttp://www.stackoverflow.com"; // Prepare font CTFontRef font = CTFontCreateWithName(CFSTR("Times"), 12, NULL); // Create an attributed string CFStringRef keys[] = { kCTFontAttributeName }; CFTypeRef values[] = { font }; CFDictionaryRef attr = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFAttributedStringRef attrString = CFAttributedStringCreate(NULL, (CFStringRef)myString, attr); CFRelease(attr); // Draw the string //CTLineRef line = CTLineCreateWithAttributedString(attrString); CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString); CGMutablePathRef path = CGPathCreateMutable(); CGPathAddRect(path, NULL, self.frame); CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL); //CGContextSetTextMatrix(context, CGAffineTransformIdentity); // this line is wrong, use the below line CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1.0, -1.0)); CGContextSetTextPosition(context, 20, 12); CTFrameDraw(frame, context); // Clean up CFRelease(path); CFRelease(frame); CFRelease(attrString); CFRelease(font); } ``` However, that looks like this: ![http://i.stack.imgur.com/iGonN.png](https://i.stack.imgur.com/GnXQb.png) How can I make the text go down, and also start from the top left?
Why is my text drawing from the bottom up?
CC BY-SA 3.0
0
2011-03-24T19:50:33.003
2013-08-28T16:56:55.340
2013-08-28T16:56:55.340
427,309
427,309
[ "ios", "objective-c", "core-text" ]
5,424,810
1
null
null
0
1,359
I'm having a problem with my autocomplete. It works on another one of my pages, but on this one, it doesn't work. It's returning the correct number of entries, but they are all "blank" (or at least black so I can't see it), and selecting one does not put it into the text field either. I'm using this: [http://papermashup.com/jquery-php-ajax-autosuggest/](http://papermashup.com/jquery-php-ajax-autosuggest/) My page right now looks like ![http://i.stack.imgur.com/brT7y.png](https://i.stack.imgur.com/5KoaT.png) Any suggestions? Thanks! I'd post my code, but it's pretty much exactly what's on the site linked above, with some variables changed, and embedded into a PHP. Let me know if you want to see it (I don't want to paste it here and make the page huge and fugly). Oh and this is taking it from a column in a MySQL database.
JQuery AJAX Autocomplete issue with PHP and MySQL
CC BY-SA 2.5
null
2011-03-24T19:59:47.240
2011-03-24T20:09:59.087
null
null
524,731
[ "php", "javascript", "jquery", "ajax", "autocomplete" ]
5,424,982
1
null
null
5
3,186
I am considering using the Registry pattern in my application to store weak pointers to some of app's windows and panes. The general structure of the application is shown below. ![Application diagram](https://i.stack.imgur.com/NFoEN.png) The application has one MainFrame top level window with few child panes within it. There can be many of TabPane type based tabs. I need to reference the ParamsPane panel from all of my TabPane tabs, so I need a pointer to the ParamsPane object to be stored somewhere. There can be a plenty of options, but the most obvious ones are (1) to store the pointer within the Application singleton object or (2) to create a simple registry class. Something like: ``` class Registry { public: static MainApp* application; static MainWindow* mainWindow; }; ``` Is this a good practice? What are the benefits and caveats of such an approach?
The Registry pattern: to use or not to use
CC BY-SA 2.5
0
2011-03-24T20:16:58.537
2011-03-24T20:33:38.617
2011-03-24T20:19:57.720
102,937
446,188
[ "c++", "design-patterns" ]
5,425,042
1
5,425,149
null
0
5,274
I am making multiple custom buttons that look much like this: ![enter image description here](https://i.stack.imgur.com/9uZYl.png) It is a simple button with either the green or gray in the "indicator view". What I need some explanation for is: In interfacebuilder there are four states a button can have; Normal, Highlighted, Selected and Disabled. When I provide images for everything except disabled I thought that normal would be when no touches were made on the button, highlighted is while you hold your finger on it and selected would be when after you release finger. However I do not think thats right now. I use the touch-up-inside event. Is it correct that I need to set the selected/highlighted etc property on the button? Thank you for your time.
UIButton states
CC BY-SA 2.5
0
2011-03-24T20:22:32.037
2012-04-20T18:21:07.657
2012-04-20T18:21:07.657
229,745
454,049
[ "iphone", "ios", "uibutton" ]
5,425,218
1
5,425,620
null
2
341
I have a handful of Eclipse (3.5, OS X) projects using different Team version control providers. I tried to map some hot keys to the VC commands I use often, primarily "diff" with the previous revision/changeset. Ideally I'd like to map the same key combo to work across all Team Providers where it makes sense. The key mappings of course conflict, since the commands are entirely different as far as the IDE is concerned, and Eclipse seems unaware of which Team Provider a project is using: ![Screen shot of Eclipse Key Mapping dialog](https://i.stack.imgur.com/fJcKN.png) Any way around this?
Binding same Eclipse key combination in multiple Team Provider contexts
CC BY-SA 2.5
0
2011-03-24T20:38:08.500
2011-03-24T21:15:14.990
null
null
281,485
[ "eclipse", "svn", "mercurial", "dvcs" ]
5,425,284
1
5,425,576
null
0
1,129
I'm trying to programmatically create the custom horizontal menu for my custom module, but I'm having a lot of trouble. I want to make a horizontal menu like this : ![enter image description here](https://i.stack.imgur.com/gWjuT.png) This is my code so far, but it only displays on the main left vertical sidebar with everything else (this is the pre-packaged Garland theme): ``` /* hook_menu implementation for my 'lab' custom module */ function lab_menu() { $items = array(); $items['lab/admin'] = array( 'title' => 'LAB Admin', 'page callback' => 'some_method', 'access arguments' => array('access content'), 'access callback' => 'user_access', 'type' => MENU_NORMAL_ITEM, ); /* should appear as a 'tabbed' horizontal method */ $items['lab/admin/appoint'] = array( 'title' => 'LAB: Appointment', 'page callback' => 'some_method', 'page arguments' => array(1), 'access callback' => 'node_access', 'access arguments' => array('view', 1), 'type' => MENU_NORMAL_ITEM, ); $items['lab/admin/reviewers'] = array( 'title' => 'Reviewer\'s Link', 'page callback' => 'some_method', 'page arguments' => array(1), 'access callback' => 'node_access', 'access arguments' => array('view', 1), 'type' => MENU_NORMAL_ITEM, ); return $items; } ```
Drupal: Horizontal Menu
CC BY-SA 2.5
null
2011-03-24T20:44:32.177
2011-03-24T21:10:53.910
null
null
449,902
[ "drupal-6", "navigation", "hook-menu" ]
5,425,425
1
5,426,130
null
5
1,686
I am creating a little widget for a page that lists steps in reverse order. I plan on doing this with an `ol` and setting the `value` attribute on the individual `li` tags to force the numbering of the `ol` to be reversed. So far so good. However, I have a design conundrum that I'm not sure can be solved with css. ``` <ol> <li value="5">item 5</li> <li value="4">item 4</li> <li value="3">item 3</li> <li value="2">item 2</li> <li value="1">item 1</li> </ol> ``` Here is an image to illustrate the text treatment I am after. ![Reversed OL with centered text but left-aligned labels](https://i.stack.imgur.com/BWAf2.jpg) It would be a shame if I had to shove extra spans in my markup for something that OLs do automatically.
How can I center the text but not the number label of an HTML ordered list
CC BY-SA 2.5
0
2011-03-24T20:58:06.330
2016-01-27T21:26:31.620
null
null
641,430
[ "html", "css" ]
5,425,808
1
5,425,872
null
0
302
Below UI is something I'd like to aim for. But I have no idea, how they have the "skin" of the app. On my end, the Java application looks like it was made in 1990s. I want to change a look to a more modern style. What components are they using possibly here? JSplitpane for one. but I'm not sure how they created that "Dokument/Vorschau" tabs. ![enter image description here](https://i.stack.imgur.com/5JnAp.png)
how do I create a Java swing UI like this?
CC BY-SA 2.5
null
2011-03-24T21:31:49.423
2011-03-24T23:08:10.833
null
null
364,914
[ "java", "swing" ]
5,425,912
1
5,426,536
null
0
2,570
I have a menu that I've been asked to style so that the items have rounded corners... basically so that they look like buttons. I want to change the black background behind the sub-menu so that it's transparent. White would be OK too. This black isn't the border of the child item's buttons as I can set that to yellow and I see a slight yellow border but still see the black background. I changed all the instances of black to purple as a test and still got this black background. So I can't tell where it's coming from. Thanks. ![Menu Item screen capture](https://i.stack.imgur.com/uV2P4.jpg)
wpf menuitem child item. How to set the color behind the drop-down
CC BY-SA 2.5
null
2011-03-24T21:40:00.680
2011-03-24T22:53:39.710
null
null
457,507
[ "wpf", "xaml", "menuitem" ]
5,425,997
1
5,426,325
null
-1
57
Is it possible to generate results as shown in the attachment using SQL server 2008 Stored Procedures? ![enter image description here](https://i.stack.imgur.com/6IZnH.jpg)
Grouped results with SQL Server Stored Procedures
CC BY-SA 3.0
null
2011-03-24T21:49:03.517
2012-07-13T18:17:34.583
2012-07-13T18:17:34.583
777,408
196,810
[ "sql-server-2008", "stored-procedures", "grouping" ]
5,426,261
1
5,426,283
null
9
6,909
today I hit `F12` in `FF` to load `FireBug` to see what my site was thinking. Then saw this: ![enter image description here](https://i.stack.imgur.com/wm89D.png) The facts showing from above: - - Is FireFox right and should I assess this and if so how do I change it since I think this is crucial for `IE` and is the default CSS3 spec, right? Or is there something else happening thats causing all this things to show up in FireBug? I would be happy to hear what I should do to make all this disappear again, really.
Border-Radius Causing Naughty Errors in FireBug: "Unknown property... Declaration dropped." Should I make this disappear or better keep it my way?
CC BY-SA 4.0
0
2011-03-24T22:18:20.187
2019-07-07T07:38:14.990
2019-07-07T07:38:14.990
1,033,581
509,670
[ "css", "firefox", "firebug" ]
5,426,353
1
5,439,996
null
15
1,927
![Are you sure you want to close this tab? You have entered text on “Stack Overflow”. If you close the tab, your changes will be lost. Do you want to close the tab anyway?](https://i.stack.imgur.com/bZxhm.png) Safari helpfully (?) prompts before closing a tab or window when text has been entered into an input. There are some cases where, as a web developer, this isn’t desirable — for example, when the input is a live search where the user when the window is closed, even though there’s still text in the field. How can I let Safari know that text in a particular input doesn’t need its protection?
Suppress Safari’s “You have entered text…” warning?
CC BY-SA 2.5
0
2011-03-24T22:30:43.217
2014-08-14T13:33:43.853
null
null
84,745
[ "javascript", "html", "safari" ]
5,426,380
1
10,808,968
null
0
5,066
I am loading a grid dynamically in extjs. As you can see below the column "Created" is not wide enough to display whole text in it. I want to set every column's width such that it display's its text completely. ![enter image description here](https://i.stack.imgur.com/zj0g1.png) Is this possible to do? Any suggestion? Thanks for help.
extjs - set grid column's width wide enough to display text in it
CC BY-SA 3.0
null
2011-03-24T22:34:36.700
2012-10-22T00:10:50.960
2012-10-21T22:45:08.770
427,969
427,969
[ "extjs", "grid" ]
5,427,212
1
null
null
0
805
I have a chart control with inverted y axis. It always eats up one day from top. ``` cht1.ChartAreas["TimeOfNight"].AxisY.Minimum = startTime.AddDays(-1).ToOADate(); cht1.ChartAreas["TimeOfNight"].AxisY.Maximum = endTime.AddDays(1).ToOADate(); ``` But chart still eats a day! I created a sample project so that you guys can have a look. Behaviour is quite random :(. Image displaying chart and y axis min/max . See image: ![http://img141.imageshack.us/i/10869903.png/](https://i.stack.imgur.com/0jDx7.png) source code and executable: [Available on Rapidshare](http://rapidshare.com/files/454233079/InvertedYAxis.zip)
MSChart control .net 3.5 sp1 - Inverted Y axis issue
CC BY-SA 3.0
null
2011-03-25T00:23:03.387
2011-11-28T00:58:38.783
2011-11-28T00:58:38.783
null
507,774
[ "c#", ".net", "mschart" ]
5,427,279
1
5,427,333
null
0
3,307
``` <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script> <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css"/> <script> $(document).ready(function() { $("#TextBox1").datepicker(); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> </form> </body> ``` ![JQuery Datepicker without css](https://i.stack.imgur.com/hpPIr.jpg) Should I be linking any other css files? Or is it a problem with Google CDN?
jquery datepicker shows up without theme
CC BY-SA 2.5
0
2011-03-25T00:33:42.427
2011-03-25T23:25:15.877
2011-03-25T01:08:07.963
315,445
315,445
[ "jquery-ui", "jquery-ui-datepicker", "google-cdn" ]
5,427,322
1
5,428,205
null
1
429
I'm trying to create a simple help screen that looks like the the one shown below. I need to have 8 different titles with smaller sized text bodies below them. I have implemented a scroll view, but how do I vary the font sizes? ![enter image description here](https://i.stack.imgur.com/ZwwLf.jpg)
Android: scroll view with titles and text bodies
CC BY-SA 2.5
null
2011-03-25T00:41:45.557
2011-03-25T03:45:34.173
null
null
577,826
[ "android", "view" ]
5,427,356
1
5,428,047
null
3
262
I have the following query.. ``` SELECT Flights.flightno, Flights.timestamp, Flights.route FROM Flights WHERE Flights.adshex = '400662' ORDER BY Flights.timestamp DESC ``` Which returns the following screenshot. ![results](https://i.stack.imgur.com/UK9Pf.png) However I cannot use a simple group by as for example BCS6515 will appear a lot later in the list and I only want to "condense" the rows that are the same next to each other in this list. An example of the output (note BCS6515 twice in this list as they were not adjacent in the first query) ![enter image description here](https://i.stack.imgur.com/jdn69.png) Which is why a GROUP BY flightno will not work.
MySQL Query eliminate duplicates but only adjacent to each other
CC BY-SA 2.5
0
2011-03-25T00:47:20.520
2011-03-25T03:02:46.970
2011-03-25T01:22:43.080
103,999
103,999
[ "mysql" ]
5,427,388
1
5,427,993
null
3
2,637
I'm making a simple custom dialog for my android app, displaying only a seek bar. However, the complications of this simple task are driving me nuts. My layout for the dialog is as follows: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp"> <SeekBar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialogVolumeSlider" android:layout_width="225dp" android:layout_height="wrap_content"/> </LinearLayout> ``` The dialog is created in code: ``` Dialog d = new Dialog(this); d.setContentView(R.layout.custom_dialog); return d; ``` Instead of a simple box wrapping the seekbar, I get this phantom space coming from somewhere: ![Problem screenshot](https://i.stack.imgur.com/endiU.png) What's the issue here? I've tried modifying ``` d.getWindow().getAttributes().height ``` but this creates additional problems as well. Thanks for any help!! EDIT: Stranger things happen when I assigned a fixed "50dp" to my LinearLayout's layout_height: ![Second problem](https://i.stack.imgur.com/BLjcq.png)
Understanding android dialog layouts
CC BY-SA 2.5
null
2011-03-25T00:53:12.810
2013-06-23T20:46:03.320
2011-03-25T01:06:14.320
48,998
48,998
[ "android", "xml", "layout", "dialog" ]
5,427,417
1
5,588,957
null
1
1,638
Alright, I might make this confusing, but hopefully not. So I have a `UITableView` that I want to section in 3: (A), (B), and (C). In the section, I want to just display information in the same way that the Contacts app does, but I don't know how to configure the `UITableViewCell` to display that way. In the section, I want to display a normal section, so I actually got that covered. In the section, I want to have a combination where two cells are normal and will link to other controllers and one cell is just a plain button. Is there something special I need to do for the button cell? Right now I have a mix of buttons, table cells, and labels, so it looks kinda bad, and thus I want to clean it up and make the interface consistent. Here's a drawing of what I want to do: ![enter image description here](https://i.stack.imgur.com/Uw5wA.jpg) And on a side note, after I click on a cell and it slides to the next controller and then I go back, the cell is still selected. How can I get it to un-select itself after the action it's linked to is performed? Thanks in advance for help!
How do I customize a UITableViewCell to display information differently (for dummies, drawing included)?
CC BY-SA 2.5
null
2011-03-25T00:58:19.733
2011-04-07T23:59:59.230
null
null
188,081
[ "xcode", "uitableview", "interface-builder" ]
5,427,459
1
5,427,581
null
21
1,856
I have a requirement to store dates and durations arising from multiple different calendars. In particular I need to store dates that: 1. Span the change to Gregorian calendars in different countries at different times 2. Cover a historic period of at least 500 years 3. Deal with multiple types of calendar - lunar, solar, Chinese, Financial, Christian, UTC, Muslim. 4. Deal with the change, in the UK, of the year end from 31st March to 31st December, and comparable changes in other countries. I also need to store durations which I have defined as the difference between two timestamps (date and time). This implies the need to be able to store a "zero" date - so I can store durations of, say, three and a half hours; or 10 minutes. I have [details](https://rads.stackoverflow.com/amzn/click/com/0521777526) of the computations needed. Firebird's timestamp is based on a date function that starts at January 1st, 100 CE, so is not capable of being used for durations in the way I need to record them. In addition this data type is geared up (like most timestamp functions) to record the number of days since a base date; it is not geared up to record calendar dates. Could anyone suggest: 1. A data structure to store dates and durations that meet the above requirements OR 2. A reference to such a data structure OR 3. Offer guidelines to approach the structuring of such storage OR 4. Any points that may help me to a solution. @Warren P has provided some excellent work in his responses. I obviously have not explained what I am seeking clearly enough, as his work concentrates on the computations and how to go about calculating these. All valuable and useful stuff, but not what I intended my question to convey. I do have details of all the computations needed to convert between various representations of dates, and I have a fairly good idea of how to implement them (using elements such as Warren suggests). However, my requirement is to STORE dates which meet the various criteria listed above. Example: date to be stored - 'Third June 13 Charles II'. I am trying to determine an appropriate structure within which to store such dates. I have amended my proposed schema. I have listed the attributes on each table, and defined the tables and attributes by examples, given in the third section of the entity box. I have used the example given in this [question](https://stackoverflow.com/questions/404013/handling-historical-calendar-dates) and [answer](https://stackoverflow.com/posts/404703) in my definition by example, and have amended the example in my question to correspond. Although I have proved my schema by describing somebody else's example, this schema may still be over complicated; over analysed; miss some obvious simplification and may prove very difficult to implement (Indeed, it may be plain wrong). Any comments or suggestions would be most welcome. ![enter image description here](https://i.stack.imgur.com/UBasX.png)
What data structure is recommended for multiple calendars, dates and durations?
CC BY-SA 2.5
0
2011-03-25T01:05:21.533
2011-03-26T07:38:16.227
2017-05-23T10:32:35.693
-1
441,969
[ "delphi", "datetime", "date", "calendar", "firebird" ]
5,427,565
1
5,427,718
null
2
1,208
I am using ``` console.log(p); console.log(p.datestrshow); ``` However the output in the console is ![console output](https://i.stack.imgur.com/UsZsJ.png) Why is it undefined when it is clearly not? --- doing ``` for(i in p) console.log(i+': ', (typeof p[i] == 'function' ? 'function' : p[i])); ``` results in ![enter image description here](https://i.stack.imgur.com/pcDlj.png)
javascript object literal, value/no value?
CC BY-SA 2.5
null
2011-03-25T01:24:53.677
2011-03-25T01:50:20.973
2011-03-25T01:42:52.553
383,759
383,759
[ "javascript", "console", "object-literal" ]
5,427,598
1
null
null
0
559
I am trying to make a control which would have functionalities similar to the MS Outlook month view calendar. In fact, I did manage to make the entire control, but I bumped into an problem and now I am stuck. Here's how I implemented it: I have created an `ItemsCollection MonthView` container which is vertically oriented. That container contains a collection of horizontally oriented `ItemsCollection WeekView` - each of those controls represents one in the calendar. Every `WeekView` contains a collection of `ItemsCollection DayView` controls which is vertically oriented container and is used to store appointments. Here's a picture that illustrates all this: ![Layout of calendar month view](https://i.stack.imgur.com/ILwfq.png) Each `DayView` collection is binded to the `List<Appointment> Appointments` list and has a filter to show only those appointments which are scheduled for that particular day. It all looks swell, but here's a catch: If an `Appointment appointment` is scheduled for more than one day (multiple days activity), the same entry is visible in more than one `DayView` container, which is logical. I would like to have one appointment control to spread across mulitple `DayView`s if scheduled for more than one day. I don't know how to implement this. Could anyone please let me know what do I need to change in my design and how to define the template for the `Appointment` in order to support this requirement? Thank you.
WPF: Expand collection item across multiple ItemsControl (MS Outlook month view)
CC BY-SA 2.5
null
2011-03-25T01:31:16.860
2013-07-11T12:42:29.637
2011-03-25T08:13:05.327
119,093
119,093
[ "wpf", "user-controls", "wpf-controls" ]
5,428,043
1
5,428,353
null
2
2,114
For some reason, the drawables in my app are blurry. This is especially apparent in menus when I put built-in system icons side-by-side with icons from my project's res folder. ![blurry project icon next to crisp system icon](https://i.stack.imgur.com/Gezrp.png) Here's an example. The left envelope icon is in my app's drawable-hdpi folder. It is scaled down, for some reason. The right one is using the built-in Android resources. As far as I can tell, they are the same 72x72px file--I copied the png straight from the drawable-hdpi folder in SDK to my project's drawable-hdpi folder. Is there some special setting for drawables in my app that I'm missing?
Why are my project's drawables blurry?
CC BY-SA 2.5
0
2011-03-25T02:51:26.147
2011-03-25T03:52:29.573
null
null
560,089
[ "android" ]
5,428,720
1
13,648,004
null
1
432
What is the correct HBM mapping for the scenario below? I need to qualify `ValueItem` in the database as either an Income or Expense item in order for NHibernate to load it into the correct list when loading it. The contetns of the IncomeItems and ExpenseItems collections are the same when retrieving `Container` from the DB. ![Design](https://i.stack.imgur.com/0nvpA.png) ``` public class Container { public virtual IList<ValueItem> IncomeItems { get; set; } public virtual IList<ValueItem> ExpenseItems { get; set; } } public class ValueItem { public virtual double Amount { get; set; } public virtual string Description { get; set; } } ``` ``` <class name="Container"> <id name="Id"> <generator class="hilo" /> </id> <list name="IncomeItems " cascade="all-delete-orphan"> <key column="ContainerId" /> <index column="ItemIndex" /> <one-to-many class="ValueItem"/> </list> <list name="ExpenseItems " cascade="all-delete-orphan"> <key column="ContainerId" /> <index column="ItemIndex" /> <one-to-many class="ValueItem"/> </list> </class> <class name="ValueItem"> <id column="Id" type="int"> <generator class="hilo" /> </id> <property name="Amount" /> <property name="Description" /> </class> ```
NHibernate mapping multiple relationships
CC BY-SA 2.5
0
2011-03-25T05:02:21.267
2016-01-07T20:51:02.930
2011-03-25T17:56:19.023
11,123
11,123
[ "c#", ".net", "nhibernate", "nhibernate-mapping" ]
5,428,908
1
5,429,173
null
0
231
In my application, I use list to display the items. I have a web service result and i bind with list and adding image in to that list. so I used class as `ui-li-icon` but it comes with overlaps the value. see the image ![enter image description here](https://i.stack.imgur.com/cMiOj.png) ``` listItem.innerHTML = "<img class='ui-li-icon' alt='No Image' src='"+ g_listOfBusinessDetails[i].imageURL +"'/><a href='#' data-role='button' data-theme ='e' id='" + i + "' rel='external' data-inline='true'>" + "<h3>"+ g_listOfBusinessDetails[i].name +"</h3>"+ "</a>"; ```
Image in jQuery?
CC BY-SA 2.5
0
2011-03-25T05:35:32.800
2011-03-25T06:13:59.507
null
null
504,130
[ "jquery-ui", "jquery-mobile" ]
5,429,004
1
5,508,014
null
5
3,594
Why is it that the following code ignores the white-space? ![enter image description here](https://i.stack.imgur.com/hAaoq.png) ``` UIColor *textColor = [UIColor colorWithRed:153.0/255.0 green:102.0/255.0 blue:51.0/255.0 alpha:1.0]; CGContextSetFillColorWithColor(ctx, [textColor CGColor]); CGContextSelectFont(ctx, "Helvetica Neue Bold" , 14, kCGEncodingMacRoman); CGContextSetTextMatrix(ctx, CGAffineTransformMakeScale(1, -1)); CGContextSetShadowWithColor(ctx, CGSizeMake(0.0, 1.0), 1.0, [[UIColor whiteColor] CGColor]); //CGContextSetAllowsAntialiasing(ctx, YES); NSString *str = @"test1 test2"; CGContextShowTextAtPoint(ctx, 5, 17, [str UTF8String], str.length); ``` Where as changing the font name to "Helvetica Neue" produces the white space: ![](https://i.stack.imgur.com/pj2rg.png) Does anyone understand whats going on here?
CGContextShowTextAtPoint and white space
CC BY-SA 2.5
null
2011-03-25T05:50:58.137
2011-04-01T00:35:43.480
null
null
573,047
[ "iphone", "ios", "core-graphics", "core-text" ]
5,429,204
1
5,429,802
null
5
4,158
Consider the following arbitrary figure generated in MATLAB as an example. The basic idea is that I have a contour plot and I want to showcase selected slices from it in subplots on the right. Is there an equivalent of subplot in mma? The work around that I have right now is to have just the contour plot with the slices and the arrows and the two slice-plots separately and then put them together in latex. However, I'd like to be able to do this within mma. How do I go about doing this? An idea that I had is to generate a the contour plot with a full vertical & half horizontal aspect ratio, the two plots with half vertical & half horizontal aspect ratio, and then use `GraphicsGrid` to align them up. But this still gave me the plots as a list, not a composite figure. Is this the only way or is there a nicer, more elegant way of doing it? ![enter image description here](https://i.stack.imgur.com/Xj0vt.jpg)
How do I create subplots in Mathematica using LevelScheme?
CC BY-SA 3.0
0
2011-03-25T06:18:55.693
2011-06-05T22:24:05.423
2011-06-05T22:24:05.423
null
null
[ "wolfram-mathematica", "levelscheme" ]
5,429,400
1
null
null
2
556
Could somebody help me with PHP code to read the description of a `.mov` or `.mp4` video file? The getID3() does not get the Description information (screenshot attached to show what I want) ![enter image description here](https://i.stack.imgur.com/RU5XR.png)
How to extract "description" tag from a video file info in PHP?
CC BY-SA 2.5
0
2011-03-25T06:50:01.160
2011-04-04T11:27:42.797
2011-04-04T11:27:42.797
404,434
404,434
[ "php", "video" ]
5,429,461
1
null
null
0
31
Whenever we click on a node, the , i.e. the parts marked in red in below screenshot, is always `Calls`. I prefer it to be `Calls` and `All inbound` (so that I can select its containing class/namespace etc.). Is it possible to do that? Please share. ![enter image description here](https://i.stack.imgur.com/9Vlkb.png)
Is it possible to change the default `node navigation type` when browsing Architecture Explorer
CC BY-SA 2.5
null
2011-03-25T06:59:17.657
2011-07-19T22:54:30.247
null
null
248,616
[ "visual-studio-2010", "architecture", "navigation" ]
5,430,033
1
5,445,217
null
0
2,567
I'm using Glassfish(3.1) from Eclipse(3.6) and it was very easy to get started with. I now have the need to use two domains in Glassfish from my eclipse. I've manually created a second domain (`asadmin create-domain --portbase someNumber domain2`) and I can login to that domain from the browser. What I'm unable to do is to add it as a second server in Eclipse. I try to add a new server but I have no dialog where I can choose the domain. Another odd issue, which I don't know if it's related, is that in the second dialog I see an error message on the top saying: "error testing remote server: localhos" (that's not a typo, it's leaving out the last letter I also tried it with 127.0.0.1 and the same result occured the 1 was ommitted) Attached in the end are screenshots of the dialog. What am I missing? Is it possible that I can only use one glassfish server (no matter how many domains are configured on it)? Thanks, Ittai ![Define a new server dialog part 1](https://i.stack.imgur.com/JpPzS.jpg) ![Define a new server dialog part 2](https://i.stack.imgur.com/XG2RC.png)
How to add a second Glassfish domain in Eclipse
CC BY-SA 2.5
null
2011-03-25T08:20:13.080
2011-03-26T20:51:26.773
null
null
170,013
[ "java", "eclipse", "dns", "glassfish" ]
5,430,149
1
5,430,193
null
0
511
Assume I run a program normally, it calls a certain function (say A() ) which calls itself recursively until the stack overflows (This happened after A() got called for some 10 times) . If I run the same program under gdb, even after A() was called for more than 20 times recursively, the stack did not overflow. Is it because that I ran it under gdb that this happened, or is there any other reason? EDIT: I'll copy paste the backtrace i obtained, Any indications to why the seg fault occured? And the bigger question is how do I locate it? ![enter image description here](https://i.stack.imgur.com/9ZosA.png)
gdb stackoverflow
CC BY-SA 2.5
null
2011-03-25T08:34:35.110
2011-03-25T09:12:16.463
2011-03-25T09:12:16.463
441,575
441,575
[ "c", "gdb", "stack-overflow" ]
5,430,352
1
5,431,164
null
0
439
basically i have this iphone application that fetches data about different modules (subjects studied by student) from the applications sqlite database (from entity: module) and displays them in a uitableview.. at the moment when you click on a cell (that represents a module), it pushes a viewcontroller that contains details of the module. name = module name, body = notes that user can save for the module. i have added an assessment entity and its attributes are: type = exam or assignment, name = name of assignment, data = date that it is due ![Core Data Datamodel](https://i.stack.imgur.com/7tX2s.png) What i want to do is: 1. Ask the user how many assessments they have for a specific module (e.g. "how many aassessments do you have for 'module a'?" 2. And then the user would say a number (e.g. 3), then the application should somehow add e.g. 3, assessments and show information (i.e. textfields etc) for each assessment in the module view page (that gets pushed when user selects a module) If anyone can help, it would be greatly appreciated.. Also apologies if my explanation is a bit confusing..
Using a Core Data data model to instantiate new objects
CC BY-SA 2.5
null
2011-03-25T08:57:07.300
2011-03-25T16:10:18.973
2011-03-25T09:32:08.203
625,567
625,567
[ "iphone", "core-data", "attributes", "entity", "datamodel" ]
5,430,468
1
5,430,882
null
8
3,517
Whats the quickest/easiest way to sort the colors in the System.Media.Colors according to its position in the visible spectrum (red to blue or blue to red doesn't matter) ? EDIT: Here is the result of the sort (hue->saturation->brightness): ![enter image description here](https://i.stack.imgur.com/pMAxT.png) This is probably technically correct but visually it still isn't. Can someone throw light on what the problem is?
Sort System.Media.Colors according to position in visible spectrum
CC BY-SA 2.5
null
2011-03-25T09:10:05.640
2019-02-22T04:43:00.907
2011-03-28T08:17:58.933
190,615
190,615
[ "c#", ".net", "wpf", "colors", "color-space" ]
5,430,476
1
5,430,553
null
1
221
Do you know how to create rows like that? ![cells](https://i.stack.imgur.com/6rhzw.png)
Do you know how to create rows like that? (see picture)
CC BY-SA 2.5
null
2011-03-25T09:10:36.433
2011-05-09T09:13:28.373
2011-03-28T06:25:51.753
631,792
631,792
[ "iphone", "objective-c", "cocoa-touch", "uitableview" ]
5,430,574
1
5,430,645
null
3
5,422
is there an easy (maybe hacky) way to hide the next / prev buttons on apples MPMoviePlayerController? i dont want to change the skin, just "hide" the skip buttons. ![enter image description here](https://i.stack.imgur.com/wFDdA.png) thanks Alex
MPMoviePlayerController hide next prev buttons
CC BY-SA 2.5
0
2011-03-25T09:23:50.910
2015-06-30T08:33:48.987
2011-03-25T09:52:27.833
333,373
333,373
[ "objective-c", "mpmovieplayercontroller" ]
5,430,827
1
5,430,873
null
1
1,391
This is a sort of extension of [this question I asked yesterday](https://stackoverflow.com/questions/5422948/wpf-in-a-usercontrol-set-a-controltemplates-content-to-the-value-of-a-dependency) (the question gave me a contentcontrol that can overlay the current control). I now have a contentcontrol that can be overlayed on the current control via bindings (a modal type window). This works well and I am happy with this. One great feature would be if I could get the overlay to go over its parent. ![outline of display](https://i.stack.imgur.com/PjYdb.jpg) currently the overlay will go into "My Control" control. What I would like is if I can still define it in that control (as that is were it is needed), but when it is displayed it can cover the whole main content area and / or the main window. is this even possible? Thanks
WPF contentcontrol extend beyond the bounds of its parent control
CC BY-SA 2.5
null
2011-03-25T09:48:05.433
2011-03-25T10:31:56.940
2017-05-23T11:48:22.880
-1
6,486
[ "wpf", "overlay", "contentcontrol" ]
5,430,841
1
5,431,771
null
0
2,189
I have two tables - band and band2. Band: ![band table](https://i.stack.imgur.com/ZPd1i.jpg) and band2: ![enter image description here](https://i.stack.imgur.com/LsHd7.jpg) The columns are equals. I'm using Access 2010. I want to SELECT rows WHERE band.Kampas<>band2.Kampas, but there isn't primary key so I can't use JOIN operation. Maybe someone has an idea? The answer: ![enter image description here](https://i.stack.imgur.com/d78pu.jpg) Only in these rows band.Kampas<>band2.Kampas. Thanks in advance.
SQL: How compare cells from different tables?
CC BY-SA 2.5
0
2011-03-25T09:49:37.977
2011-03-25T13:18:02.437
2011-03-25T11:22:34.697
572,853
572,853
[ "sql", "compare", "rows" ]
5,431,010
1
5,431,200
null
1
1,505
I fallowed recommendation in this SO question: [What's the best solution for OpenID with Django?](https://stackoverflow.com/questions/2123369/whats-the-best-solution-for-openid-with-django) and installed `django-openid-auth` for my application. But I just can't get it working, I always get `CSRF verification failed. Request aborted.` when I try to log in. ![django csrf](https://i.stack.imgur.com/C5exB.png) I have checked everything: # 1. `{% csrf_token %}` is present in the template: ``` <form name="fopenid" action="{{ action }}" method="post"> {% csrf_token %} <fieldset> <legend>Sign In Using Your OpenID</legend> <div class="form-row"> <label for="id_openid_identifier">OpenID:</label><br /> {{ form.openid_identifier }} </div> <div class="submit-row "> <input name="bsignin" type="submit" value="Log in"> </div> {% if next %} <input type="hidden" name="next" value="{{ next }}" /> {% endif %} </fieldset> </form> ``` # 2. In the views.py inside of `django_openid_auth` I found, that they use `RequestContext`: ``` return render_to_response(template_name, { 'form': login_form, redirect_field_name: redirect_to }, context_instance=RequestContext(request)) ``` # 3. My `MIDDLEWARE_CLASSES` does contain `CsrfViewMiddleware`: ``` MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) ``` I just can't understand what else could be wrong? Do you have any ideas? I am using Django 1.3 beta. # UPDATE This seem to be my global problem. I've created a simple form and got the same result: ``` def index(request): return render_to_response('index.html', locals(), context_instance=RequestContext(request)) ``` index.html: ``` <form action="/" method="post"> {% csrf_token %} <input type="text" name="test"> <input type="submit"> </form> ``` Rendered HTML: ``` <form action="/" method="post"> <div style="display:none"><input type="hidden" name="csrfmiddlewaretoken" value="1fbd5345560d325bf05809260f7d43c3"></div> <input type="text" name="test"> <input type="submit"> </form> ``` What's wrong!?
django-open-id: CSRF verification failed
CC BY-SA 2.5
null
2011-03-25T10:07:23.827
2011-08-20T02:03:24.570
2017-05-23T12:01:09.963
-1
303,513
[ "python", "django", "django-csrf", "django-openid-auth" ]
5,431,196
1
5,432,048
null
0
114
Make each of the two element take half of the width of their parent. Here is my example: [http://jsfiddle.net/zUqqN/](http://jsfiddle.net/zUqqN/) I just want the div#mapContent_coverage do not show by default,and then the div#mapContent_emap will take all the width of the "mapDiv", when user click the img in the right,the should show,and then " will show at the same time,and I want both of them take half of the width. I have tried use the float and absolute to the div,but it does not work,any idea? BTW,I do not want the scrollbar show in the browser,for exmaple: Now matter how do I resize the browser ,there is not scroll bar . How to make this? ![enter image description here](https://i.stack.imgur.com/d7BQa.png) ## UPDATE: The default page layout: ![enter image description here](https://i.stack.imgur.com/d7Uq1.png) WHen I click the img in the right,the page should change to : ![enter image description here](https://i.stack.imgur.com/TYVds.png)
web element position problem
CC BY-SA 2.5
null
2011-03-25T10:26:54.913
2011-03-25T11:53:31.863
2011-03-25T11:32:35.483
306,719
306,719
[ "html", "css", "position" ]
5,431,202
1
5,444,340
null
15
48,820
I'm building a .Net 4.0 application for remote control of a scanner device. I have tried both TWAIN and WIA libraries, but I have the same problem. Scanning images and . I found a useful article on [WIA scripting in .Net](http://www.codeproject.com/KB/dotnet/wiascriptingdotnet.aspx), and modified it to this: ``` private Image Scan(string deviceName) { WiaClass wiaManager = null; // WIA manager COM object CollectionClass wiaDevs = null; // WIA devices collection COM object ItemClass wiaRoot = null; // WIA root device COM object CollectionClass wiaPics = null; // WIA collection COM object ItemClass wiaItem = null; // WIA image COM object try { // create COM instance of WIA manager wiaManager = new WiaClass(); // call Wia.Devices to get all devices wiaDevs = wiaManager.Devices as CollectionClass; if ((wiaDevs == null) || (wiaDevs.Count == 0)) { throw new Exception("No WIA devices found!"); } object device = null; foreach (IWiaDeviceInfo currentDevice in wiaManager.Devices) { if (currentDevice.Name == deviceName) { device = currentDevice; break; } } if (device == null) { throw new Exception ( "Device with name \"" + deviceName + "\" could not be found." ); } // select device wiaRoot = (ItemClass)wiaManager.Create(ref device); // something went wrong if (wiaRoot == null) { throw new Exception ( "Could not initialize device \"" + deviceName + "\"." ); } wiaPics = wiaRoot.GetItemsFromUI ( WiaFlag.SingleImage, WiaIntent.ImageTypeColor ) as CollectionClass; if (wiaPics == null || wiaPics.Count == 0) { throw new Exception("Could not scan image."); } Image image = null; // enumerate all the pictures the user selected foreach (object wiaObj in wiaPics) { if (image == null) { wiaItem = (ItemClass)Marshal.CreateWrapperOfType ( wiaObj, typeof(ItemClass) ); // create temporary file for image string tempFile = Path.GetTempFileName(); // transfer picture to our temporary file wiaItem.Transfer(tempFile, false); // create Image instance from file image = Image.FromFile(tempFile); } // release enumerated COM object Marshal.ReleaseComObject(wiaObj); } if (image == null) { throw new Exception("Error reading scanned image."); } return image; } finally { // release WIA image COM object if (wiaItem != null) Marshal.ReleaseComObject(wiaItem); // release WIA collection COM object if (wiaPics != null) Marshal.ReleaseComObject(wiaPics); // release WIA root device COM object if (wiaRoot != null) Marshal.ReleaseComObject(wiaRoot); // release WIA devices collection COM object if (wiaDevs != null) Marshal.ReleaseComObject(wiaDevs); // release WIA manager COM object if (wiaManager != null) Marshal.ReleaseComObject(wiaManager); } } ``` With this I actually managed to select the device from configuration (input parameter of the Scan method) and retrieve the resulting image after scan. But the problem with scanning options dialog (Scan using DEVICENAME). As this is a remote control application, dialog will not be visible to the user, so I need to either skip it using default settings, or use settings from a configuration if necessary. Scanning options dialog: ![scanning options dialog](https://i.stack.imgur.com/kdDHj.jpg)
Using a scanner without dialogs in C#
CC BY-SA 2.5
0
2011-03-25T10:28:16.850
2019-04-08T17:49:18.513
2011-05-15T13:23:00.867
21,234
367,107
[ "c#", "wia", "twain", "image-scanner" ]
5,431,519
1
5,431,822
null
3
1,404
I have a nice challenge for you. Here you have the next code (live example: [http://inturnets.com/test/test.html](http://inturnets.com/test/test.html)): ``` <!DOCTYPE html><html><head><title></title> <style type="text/css">* { margin: 0; padding: 0;}a, a:hover { text-decoration: none; } .grid { width: 984px; margin: 0 auto; list-style: none; height: 666px; } .grid li { float: left; position: relative; } .small + .small { position: relative; clear: left; } .large, .large a { width: 393px; height: 222px; } .small, .small a { width: 198px; height: 111px; } .small a, .large a { display: block; cursor: pointer; color: #fff; } .overlay { background: #000; width: 100%; height: 22px; color: #fff; opacity: 0; position: absolute; top: 0; } </style> </head> <body> <ul class="grid"> <li class="item small"><a href="#" title="Title 1"><div class="overlay">Title 1</div><img src="img/squares.png" border="0" width="198" height="111" /></a></li> <li class="item small"><a href="#" title="Title 2"><div class="overlay">Title 2</div><img src="img/space.png" border="0" width="198" height="111" /></a></li> <li class="item large"><a href="#" title="Title 3"><div class="overlay">Title 3</div><img src="img/arch.png" border="0" width="393" height="222" /></a></li> <li class="item large"><a href="#" title="Title 4"><div class="overlay">Title 4</div><img src="img/tree.png" border="0" width="393" height="222" /></a></li> <li class="item large"><a href="#" title="Title 5"><div class="overlay">Title 5</div><img src="img/arch.png" border="0" width="393" height="222" /></a></li> <li class="item large"><a href="#" title="Title 6"><div class="overlay">Title 6</div><img src="img/tree.png" border="0" width="393" height="222" /></a></li> <li class="item small"><a href="#" title="Title 7"><div class="overlay">Title 7</div><img src="img/squares.png" border="0" width="198" height="111" /></a></li> <li class="item small"><a href="#" title="Title 8"><div class="overlay">Title 8</div><img src="img/space.png" border="0" width="198" height="111" /></a></li> <li class="item large"><a href="#" title="Title 9"><div class="overlay">Title 9</div><img src="img/tree.png" border="0" width="393" height="222" /></a></li> <li class="item small"><a href="#" title="Title 10"><div class="overlay">Title 10</div><img src="img/squares.png" border="0" width="198" height="111" /></a></li> <li class="item small"><a href="#" title="Title 11"><div class="overlay">Title 11</div><img src="img/space.png" border="0" width="198" height="111" /></a></li> <li class="item large"><a href="#" title="Title 12"><div class="overlay">Title 12</div><img src="img/arch.png" border="0" width="393" height="222" /></a></li> </ul> </body> </html> ``` - - - ![enter image description here](https://i.stack.imgur.com/tNpKP.jpg) - - - - -
One list, simple float left, different cell sizes
CC BY-SA 2.5
0
2011-03-25T10:57:52.370
2011-06-07T09:29:12.253
2011-06-07T09:29:12.253
468,793
null
[ "html", "css", "layout" ]
5,431,557
1
6,453,633
null
2
2,753
Using the `TabControl` element for Silverlight in Blend I created the following markup: ``` <controls:TabControl> <controls:TabItem Header="TabItem" Style="{StaticResource TabItemStyle1}" /> <controls:TabItem Style="{StaticResource TabItemStyle1}"> <controls:TabItem.Header> <StackPanel Orientation="Horizontal"> <Path Data="M0,14L0,6 5,0 10,6 10,14 0,6 10,6 0,14 10,14" StrokeLineJoin="Round" Margin="0 0 6 0" Stroke="Black"/> <TextBlock Text="TabItem"/> </StackPanel> </controls:TabItem.Header> </controls:TabItem> </controls:TabControl> ``` `TabItemStyle1` is a copy of the default style of a `TabItem`. I altered `TabItemStyle1` by adding a color animation in the `MouseOver` storyboard so that unselected tab items become red when the mouse hovers them: ``` <ColorAnimation BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="HeaderTopUnselected" Storyboard.TargetProperty="(UIElement.Foreground).(SolidColorBrush.Color)" To="Red" /> ``` Now when I hover the second tab, the text becomes red but the Path remains black: ![Hovered second tab header](https://i.stack.imgur.com/tBEYW.png) How should I define the Path Stroke color to make it follow the same rule?
Bind a Path Stroke color to Foreground
CC BY-SA 2.5
0
2011-03-25T11:02:17.320
2015-06-09T18:10:19.247
null
null
183,386
[ "silverlight-4.0", "controltemplate" ]
5,431,614
1
5,446,336
null
0
202
After starting a new Rails 3.0.5 project, I am surprised a little to find that the DOCTYPE it uses is html 5 ``` <!DOCTYPE html> ``` I am guessing it won't choke IE 6 or IE 7 and render the HTML in quirks mode, as IE 6 may not have knowledge of what this DOCTYPE is. Also, even now that IE 9 is released, I think to make it easy to develop and test for IE, it probably is wise to set the Compatibility Mode for IE 7 on our application layout: ``` <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> ``` so that IE 7, 8, and 9 behave all the same, and we don't need to develop and test on each of IE 7, 8, and 9... as of right now, IE 7 still has about 8.5% market share, so probably can't set the Compatibility Mode of IE 8 instead? The following quoted from Wikipedia for IE: (IE 6 still 12%... holy cow...) ![enter image description here](https://i.stack.imgur.com/wokQU.png)
A new Rails 3 project, but should HTML 4.01 Strict and Compatibility of IE 7 mode be used?
CC BY-SA 2.5
null
2011-03-25T11:08:42.557
2011-03-27T00:21:42.517
2011-03-26T23:38:16.327
1,450
325,418
[ "html", "ruby-on-rails-3", "cross-browser", "ie8-compatibility-mode" ]
5,431,761
1
5,434,630
null
2
5,018
I am doing a program like messenger that has all the contacts in a listbox with the relative states of the contacts. Cyclic I get a xml with the contacts were updated over time, then updates the states within a class of binding called "Contacts". The class Contacts has a filter to display only certain contacts by their state, "online, away, busy,.. " but not offline, for example .... Some code: ``` public class Contacts : ObservableCollection<ContactData> { private ContactData.States _state = ContactData.States.Online | ContactData.States.Busy; public ContactData.States Filter { get { return _state; } set { _state = value; } } public IEnumerable<ContactData> FilteredItems { get { return Items.Where(o => o.State == _state || (_state & o.State) == o.State).ToArray(); } } public Contacts() { XDocument doc = XDocument.Load("http://localhost/contact/xml/contactlist.php"); foreach (ContactData data in ContactData.ParseXML(doc)) Add(data); } } ``` Update part: ``` void StatusUpdater(object sender, EventArgs e) { ContactData[] contacts = ((Contacts)contactList.Resources["Contacts"]).ToArray<ContactData>(); XDocument doc = XDocument.Load("http://localhost/contact/xml/status.php"); foreach (XElement node in doc.Descendants("update")) { var item = contacts.Where(i => i.UserID.ToString() == node.Element("uid").Value); ContactData[] its = item.ToArray(); if (its.Length > 0) its[0].Data["state"] = node.Element("state").Value; } contactList.ListBox.ItemsSource = ((Contacts)contactList.Resources["Contacts"]).FilteredItems; } ``` ![Xaml Editor](https://i.stack.imgur.com/zCZuA.jpg) My problem is that when ItemsSource reassigns the value of the listbox, the program lag for a few seconds, until it has finished updating contacts UI (currently 250 simulated). How can I avoid this annoying problem? Edit: I tried with Thread and after with BackgroundWorker but nothing is changed... When i call Dispatcher.Invoke lag happen. Class ContactData ``` public class ContactData : INotifyPropertyChanged { public enum States { Offline = 1, Online = 2, Away = 4, Busy = 8 } public event PropertyChangedEventHandler PropertyChanged; public int UserID { get { return int.Parse(Data["uid"]); } set { Data["uid"] = value.ToString(); NotifyPropertyChanged("UserID"); } } public States State { get { return (States)Enum.Parse(typeof(States), Data["state"]); } //set { Data["state"] = value.ToString(); NotifyPropertyChanged("State"); } //correct way to update, i forgot to notify changes of "ColorState" and "BrushState" set { Data["state"] = value.ToString(); NotifyPropertyChanged("State"); NotifyPropertyChanged("ColorState"); NotifyPropertyChanged("BrushState"); } } public Dictionary<string, string> Data { get; set; } public void Set(string name, string value) { if (Data.Keys.Contains(name)) Data[name] = value; else Data.Add(name, value); NotifyPropertyChanged("Data"); } public Color ColorState { get { return UserStateToColorState(State); } } public Brush BrushState { get { return new SolidColorBrush(ColorState); } } public string FullName { get { return Data["name"] + ' ' + Data["surname"]; } } public ContactData() {} public override string ToString() { try { return FullName; } catch (Exception e) { Console.WriteLine(e.Message); return base.ToString(); } } Color UserStateToColorState(States state) { switch (state) { case States.Online: return Colors.LightGreen; case States.Away: return Colors.Orange; case States.Busy: return Colors.Red; case States.Offline: default: return Colors.Gray; } } public void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public static ContactData[] ParseXML(XDocument xmlDocument) { var result = from entry in xmlDocument.Descendants("contact") select new ContactData { Data = entry.Elements().ToDictionary(e => e.Name.ToString(), e => e.Value) }; return result.ToArray<ContactData>(); } } ```
Programmatically WPF listbox.ItemsSource update
CC BY-SA 2.5
null
2011-03-25T11:24:18.593
2011-03-28T11:01:52.670
2011-03-28T11:01:52.670
628,738
628,738
[ "c#", "wpf" ]
5,431,788
1
5,431,838
null
2
2,688
I've been trying to auto-focus on an input field called #to after someone clicks on my "share" button. Currently, everything works fine with the share. (i.e. user clicks "Share", modal box pops up, they click anywhere OUTSIDE of the box, and it closes. All great there). The problem is when I add the focus() function to the box, it works fine and focuses in the correct input field, but when I click anywhere outside of the box to close it, the "Share" button toggles away (and becomes hidden). This is the input focus toggle (someone on here suggested to use toggle) ``` $(".share-this").toggle("fast", function() { $("#to").focus(); }); ``` This is my entire code ``` // this is for the share $(document).ready(function() { // user clicks on report this button $(".share-this").click(function() { $(".share-this").toggle("fast", function() { $("#to").focus(); }); // confirmation fades in $(".share-box").fadeIn("fast"), // Prevent events from getting pass .share-box $(".share-box").click(function(e){ e.stopPropagation(); }); return false; }); $("body").click(function(){ // hide the share-box if clicked anywhere aside from the box itself $(".share-box").fadeOut().removeClass("active"); }); }); ``` I suspect it has to do with the code that closes the box after anywhere outside of the box is clicked ``` $("body").click(function(){ // hide the share-box if clicked anywhere aside from the box itself $(".share-box").fadeOut().removeClass("active"); }); ``` Any idea what is wrong? EDIT: This is what I'm talking about: ![enter image description here](https://i.stack.imgur.com/gL2Mc.gif) EDIT 2: This is the HTML ``` <li><a class="share-this">Share</a></li> <div class="share-box"> <div class="share-arrow"></div> <ul class="share-sites"> <li><a class="facebook">Facebook</a></li> <li><a class="twitter">Twitter</a></li> <li><a class="reddit">Reddit</a></li> <li><a class="digg">Digg</a></li> <li><a class="delicious">Delicious</a></li> <li><a class="stumbleupon">StumbleUpon</a></li> </ul> <div class="sep"></div><p> <? echo "<form class=\"form\" autocomplete=\"off\" method=\"post\" action=\"\">"; echo "<label class=\"label-share\" id=\"lto\" for=\"email\">To</label>"; echo "<input class=\"input-short\" id=\"to\" type=\"text\" name=\"to\">"; echo "</form>"; } ?> </div> ``` EDIT 3: Got it to work. Here is the updated code. Replaced the selector and the toggle function with fadeIn(). ``` // this is for the share $(document).ready(function() { // user clicks on report this button $(".share-this").click(function() { $(".share-box").fadeIn("fast", function() { $("#to").focus(); }); // confirmation fades in $(".share-box").fadeIn("fast"), // Prevent events from getting pass .share-box $(".share-box").click(function(e){ e.stopPropagation(); }); return false; }); $("body").click(function(){ // hide the share-box if clicked anywhere aside from the box itself $(".share-box").fadeOut().removeClass("active"); }); }); ```
jQuery problem when focusing on hidden element (after unhiding) and using toggle
CC BY-SA 2.5
0
2011-03-25T11:27:06.487
2011-03-25T19:31:16.747
2011-03-25T19:31:16.747
634,877
634,877
[ "javascript", "jquery", "focus", "toggle" ]
5,432,003
1
5,432,042
null
0
468
Hey guys I have a problem im uploading images to my project path the images are contained within ~/userdata/UserID/uploadedimage/image.jpg I used the below method to upload and to store the path of the picture in my database. ``` protected void UploadButton_Click(object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { string theUserId = Session["UserID"].ToString(); OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"); cn.Open(); //string filename = Path.GetFileName(FileUploadControl.FileName); string fileuploadpath = Server.MapPath("~/userdata/" + theUserId + "/uploadedimage/") + Path.GetFileName(FileUploadControl.FileName); FileUploadControl.SaveAs(fileuploadpath); StatusLabel.Text = "Upload status: File uploaded!"; OdbcCommand cmd = new OdbcCommand("INSERT INTO Pictures (UserID, picturepath) VALUES ('" + theUserId + "' , '" + fileuploadpath + "')", cn); cmd.ExecuteNonQuery(); } catch (Exception ex) { StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } } } ``` What I found is the path isnt the path of my project directory its something strange: ![enter image description here](https://i.stack.imgur.com/9UCbp.jpg) Here is a snippet from my database the first one idPictures = 1 is the correct path name I need. idPictures = 2 is the one that the fileupload is inserting into my database? How can I get it so it will give a path name like this: ``` ~/userdata/2/uploadedimage/batman-for-facebook.jpg ``` If I try this: ``` string fileuploadpath = ("~/userdata/"+theUserId+"/uploadedimage/")+Path.GetFileName(FileUploadControl.FileName); FileUploadControl.SaveAs(fileuploadpath); StatusLabel.Text = "Upload status: File uploaded!"; OdbcCommand cmd = new OdbcCommand("INSERT INTO Pictures (UserID, picturepath) VALUES ('"+theUserId+"','"+fileuploadpath+"')", cn); cmd.ExecuteNonQuery(); } catch (Exception ex) { StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } } } ``` I get the error:
strange string format + pathname from fileupload in mysql
CC BY-SA 2.5
null
2011-03-25T11:49:08.167
2011-03-25T12:25:06.450
2011-03-25T12:06:36.873
477,228
477,228
[ "c#", "asp.net", "mysql", "sql", "html" ]
5,432,021
1
5,432,059
null
0
161
Right now I have a GUI that when I click on Add Customer a box pops up and I can enter info such as name, address and so on. When this is done I click Add customer and it adds the info to a .txt file. Now on the original GUI there is a “Refresh” button that when is pressed it enters the info into a text box called “NameTextCustomers”. It doesn’t do this. I have researched it for hours trying to figure it out. I have a line in the code that says “NameTextCustomers.setText ("File Info Here");” After I click the refresh button the words “File Info Here” shows up, so that part works. I’m assuming that the code would be inserted there. I think this is the last part I have to do for my code to work the way I want it to. ``` import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.io.*; import java.util.List; public class FVolume extends JFrame implements ActionListener{ private JTabbedPane jtabbedPane; private JPanel Customers; private List<Customer> customers = new ArrayList<Customer>(); JTextArea NameTextCustomers, ExistTextCustomers, NameTextContractors, ExistTextContractors; JTextField lengthTextPool, widthTextPool, depthTextPool, volumeTextPool; public FVolume(){ setTitle("Volume Calculator"); setSize (300, 200); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); createCustomers(); jtabbedPane = new JTabbedPane(); jtabbedPane.addTab("Customer", Customers); topPanel.add(jtabbedPane, BorderLayout.CENTER); } /* CREATE CUSTOMERS */ public JPanel createCustomers(){ Customers = new JPanel(); Customers.setLayout(null); NameTextCustomers = new JTextArea("Select Add Customer to Add Customer. Select Refresh to Refresh This Pane."); NameTextCustomers.setLineWrap(true); NameTextCustomers.setBounds(10, 10, 390, 150); Customers.add(NameTextCustomers); JButton Exit = new JButton("Exit"); Exit.setBounds(30,170,80,20); Exit.addActionListener(this); Exit.setBackground(Color.white); Customers.add(Exit); JButton AddCustomers = new JButton("Add Customer"); AddCustomers.setBounds(130,170,120,20); AddCustomers.setBackground(Color.white); Customers.add(AddCustomers); JButton Refresh = new JButton("Refresh"); Refresh.setBounds(260,170,80,20); Refresh.setBackground(Color.white); Customers.add(Refresh); ExistTextCustomers = new JTextArea(); ExistTextCustomers.setBounds(10, 200, 390, 60); ExistTextCustomers.setLineWrap(true); Customers.add(ExistTextCustomers); final JTextArea custArea = new JTextArea(6, 30); final JTextArea ExistTextCustomers; ExistTextCustomers = new JTextArea(2, 30); ExistTextCustomers.setLineWrap(true); ExistTextCustomers.setWrapStyleWord(true); AddCustomers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Customers.add(new Customer("Customer")); } }); Customers.add(custArea); Customers.add(AddCustomers); Customers.add(Refresh); Refresh.setMnemonic('R'); Refresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { NameTextCustomers.setText ("File Info Here"); try { File custOpen = new File("customer.txt"); FileReader custAreaIn = new FileReader(custOpen); custArea.read(custAreaIn, custOpen.getAbsolutePath()); ExistTextCustomers.setText("File exists and can be read."); } catch (IOException e3){ ExistTextCustomers.setText("The file could not be read." + e3.getMessage()); } } } ); return Customers; } class Customer extends JFrame { private String[] states = {"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"}; private JComboBox StateList = new JComboBox(states); private JTextField NameText = new JTextField(25); private JTextField AddressText = new JTextField(25); private JTextField CityText = new JTextField(25); private JTextField ZipText = new JTextField(9); private JTextField PhoneText = new JTextField(10); private JTextField ExistTextCustomers = new JTextField(30); private static final long serialVersionUID = 1L; private AddCustButtonHandler addCusHandler = new AddCustButtonHandler(); public Customer(String who) { popUpWindow (who); } public void popUpWindow(final String who) { final JFrame popWindow; popWindow = new JFrame(who); popWindow.setSize(425, 350); popWindow.setLocation(100, 100); popWindow.setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); Container c = new Container(); popWindow.add(c); c.setLayout(new FlowLayout()); JPanel one = new JPanel(); JPanel two = new JPanel(); JPanel three = new JPanel(); JPanel four = new JPanel(); JPanel five = new JPanel(); JPanel six = new JPanel(); one.add(new JLabel(who + " Name ")); one.add(NameText); two.add(new JLabel("Address ")); two.add(AddressText); three.add(new JLabel("City ")); three.add(CityText); four.add(new JLabel("State ")); StateList.setSelectedIndex(0); four.add(StateList); four.add(new JLabel("ZIP")); four.add(ZipText); four.add(new JLabel("Phone")); four.add(PhoneText); JButton addwho = new JButton("Add " + who); addwho.setMnemonic('A'); JButton close = new JButton("Exit"); close.setMnemonic('C'); JButton deleteFile = new JButton("Delete File"); deleteFile.setMnemonic('D'); five.add(addwho); five.add(close); five.add(deleteFile); ExistTextCustomers.setEditable(false); ExistTextCustomers.setHorizontalAlignment(JTextField.CENTER); six.add(ExistTextCustomers); c.add(one); c.add(two); c.add(three); c.add(four); c.add(five); c.add(six); deleteFile.setToolTipText("Delete File"); addwho.setToolTipText("Add "+ who); close.setToolTipText("Exit"); if (who == "Customer") addwho.addActionListener(addCusHandler); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { NameText.setText(""); AddressText.setText(""); CityText.setText(""); ZipText.setText(""); PhoneText.setText(""); ExistTextCustomers.setText(""); popWindow.dispose(); } } ); deleteFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ExistTextCustomers.setText(""); if (who.equals("Customer")) { File file = new File("Customer.txt"); boolean cusFileDeleted = file.delete(); if (cusFileDeleted) { ExistTextCustomers .setText("Customer file has been deleted"); } else { ExistTextCustomers .setText("There was an error in deleting file"); } } } } ); } class AddCustButtonHandler implements ActionListener { public void actionPerformed(ActionEvent addCusHandler) { int StateIndex; try { File file = new File("Customer.txt"); boolean success = file.createNewFile(); if (success) { ExistTextCustomers .setText("Customer.txt file created file added"); } else if (file.canWrite()) { ExistTextCustomers .setText("Writing data to Customer.txt, file added"); } else { ExistTextCustomers.setText("Cannot create file: Customer.txt"); } try { FileWriter fileW = new FileWriter("Customer.txt", true); fileW.write(NameText.getText()); fileW.write(","); fileW.write(AddressText.getText()); fileW.write(","); fileW.write(CityText.getText()); fileW.write(","); StateIndex = StateList.getSelectedIndex(); fileW.write(states[StateIndex]); fileW.write(","); fileW.write(ZipText.getText()); fileW.write(","); fileW.write(PhoneText.getText()); fileW.write("\r\n"); fileW.close(); ExistTextCustomers.setText("A new Customer has been added!"); FileReader fileR = new FileReader("Customer.txt"); BufferedReader buffIn = new BufferedReader(fileR); String textData = buffIn.readLine(); buffIn.close(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, e1.getMessage(), "ERROR", 2); } NameText.setText(""); AddressText.setText(""); CityText.setText(""); ZipText.setText(""); PhoneText.setText(""); } catch (IOException e1) { } } } public void actionPerformed(ActionEvent event){ } private void Exit_pressed(){ System.exit(0); } } public static void main(String[] args){ JFrame frame = new FVolume(); frame.setSize(420, 350); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { } } ``` ![Flow of events](https://i.stack.imgur.com/BojfP.png) After clicking the Refresh button, it should enter the info into the text box.
Linking inputted text info
CC BY-SA 2.5
null
2011-03-25T11:50:13.427
2011-03-25T15:51:24.590
2011-03-25T13:48:32.807
640,015
640,015
[ "java", "eclipse" ]
5,432,354
1
5,432,422
null
1
889
I have an ASP.NET MVC site and my google analytics code is the example code cut/pasted into my layout page. This is how it records root requests: ![enter image description here](https://i.stack.imgur.com/yj1Zc.png) Can anyone tell me how to get it to record only the `/` as the root url? For reference here is my analytics code: ``` <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("my code"); pageTracker._trackPageview(); } catch (err) { } </script> ```
ASP.NET MVC with google analytics tacking root url
CC BY-SA 2.5
null
2011-03-25T12:22:13.970
2011-03-25T12:30:01.830
null
null
178,082
[ "asp.net-mvc", "google-analytics" ]