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
sequence
971,016
1
974,472
null
6
9,768
I'm currently getting the total thread CPU time using JMX in the following manner: ``` private long calculateTotalThreadCpuTime(ThreadMXBean thread) { long totalTime = 0l; for (ThreadInfo threadInfo : thread.dumpAllThreads(false, false)) totalTime += thread.getThreadCpuTime(threadInfo.getThreadId()); return totalTime; } ``` As the ThreadMXBean is actually a remote proxy, performance is , in the order of magnitude of seconds for this actual method call. Is there a faster way of doing this? --- : I'm using this for performance monitoring. The measurements were both 'wall clock' time and JProfiler, which showed about 85% of my time spent in this method. I do have some other MXBean calls ( Runtime, Memory, GC ), but they are much cheaper. Most likely because every call to `thread.getThreadCpuTime` is a remote one. : JProfiler screenshot showing the performance problems. ![alt text](https://i.stack.imgur.com/plvAR.png)
Efficient way of getting thread CPU time using JMX
CC BY-SA 3.0
0
2009-06-09T16:03:46.773
2015-06-19T21:12:33.167
2015-06-19T21:12:33.167
1,159,643
112,671
[ "java", "jmx" ]
971,854
1
971,868
null
1
763
Is there any way to increase code intellisense height on ASP.NET? ![alt text](https://content.screencast.com/users/uzay95/folders/Jing/media/17b0183e-5f57-4e0f-a4b1-1d540f32468e/2009-06-09_2154.png)
Is there any way to increase code intellisense height in Visual Studio?
CC BY-SA 2.5
0
2009-06-09T18:57:15.363
2009-06-09T19:02:37.647
2017-02-08T14:12:42.333
-1
104,085
[ "visual-studio", "intellisense" ]
975,320
1
null
null
1
2,926
Picture is worth more than a thousand words :) ![alt text](https://i239.photobucket.com/albums/ff175/mlakilud/Labels.jpg) Here is the code: ``` // Initialization code UIView *myContentView = self.contentView; UIImage *image = [UIImage imageNamed: @"bg_top.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; self.backgroundView = imageview; [imageview release]; self.label = [self newLabelWithPrimaryColor:[UIColor blackColor] selectedColor:[UIColor redColor] fontSize:15.0 bold:YES]; self.label.textAlignment = UITextAlignmentLeft; [myContentView addSubview:self.label]; [self.label release]; self.textField = [[UITextField alloc] init]; [self.textField setTextColor:[UIColor grayColor]]; self.textField.font = [UIFont systemFontOfSize:13.0]; //self.textField.secureTextEntry = YES; [self.textField setKeyboardType:UIKeyboardTypeEmailAddress]; myContentView.backgroundColor = [UIColor clearColor]; [myContentView addSubview:self.textField]; [self.textField release]; ``` The question is how to remove that ugly white background from labels and make them transparent.
iPhone custom cells - transparent label background
CC BY-SA 2.5
null
2009-06-10T12:43:04.353
2011-01-14T18:28:26.687
2017-02-08T14:12:44.540
-1
115,873
[ "iphone", "label" ]
975,652
1
975,828
null
26
111,136
I have a web page with embedded PDF on it. My code looks like this: ``` <embed type="application/pdf" src="path_to_pdf_document.pdf" id="pdfDocument" width="100%" height="100%"> </embed> ``` I have this javascript code for print my PDF: ``` function printDocument(documentId) { //Wait until PDF is ready to print if (typeof document.getElementById(documentId).print == 'undefined') { setTimeout(function(){printDocument(documentId);}, 1000); } else { var x = document.getElementById(documentId); x.print(); } } ``` When this code is executed Acrobat plug-in opens the well-known print dialog. Something like this: ![PrintDialog](https://i.stack.imgur.com/Couqn.jpg) Two questions: - - A little more info about my system: Windows XP Internet Explorer 7 Acrobat Reader 9
Silent print an embedded PDF
CC BY-SA 3.0
0
2009-06-10T13:35:50.017
2017-08-04T10:05:19.137
2017-08-04T10:05:19.137
1,473,071
27,507
[ "javascript", "html", "pdf", "acrobat" ]
979,750
1
1,263,211
null
10
28,121
I am having problems with properly displaying background image of navigation view. Here is the pic: ![alt text](https://i239.photobucket.com/albums/ff175/mlakilud/Picture3.jpg) Here is the code: ``` - (id)initWithStyle:(UITableViewStyle)style { if (self = [super initWithStyle:style]) { UIImage *image = [UIImage imageNamed: @"bg_table_active.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Settings", @"") style:UIBarButtonItemStyleDone target:self action:@selector(GoToSettings)]; self.navigationItem.titleView = imageview; self.navigationItem.rightBarButtonItem = addButton; self.navigationItem.hidesBackButton = TRUE; } return self; } ``` How can I make the picture stretch to the whole navigation view?
Background image for navigation view
CC BY-SA 3.0
0
2009-06-11T07:19:14.010
2013-06-04T08:16:30.780
2017-02-08T14:12:45.210
-1
115,873
[ "iphone", "uinavigationbar" ]
981,020
1
null
null
45
45,070
I have a problem concerning the listings package in latex. I need to embed a source code of the following XML document [http://www.sparxsystems.com.au/downloads/profiles/EP_Extensions.xml](http://www.sparxsystems.com.au/downloads/profiles/EP_Extensions.xml) in my master thesis' appendix. The problem is, no matter what options I pass to the package, I don't seem to be able to fit it on the page. The lines in the listing are too long, and the listings package doesn't wrap them, which seems odd... What combination of options will do the trick? At the moment I use the following lstset instruction: ``` \lstset{ breakindent=0em, language=XML, basicstyle=\footnotesize, numbers=left, numberstyle=\footnotesize, stepnumber=2, numbersep=5pt, backgroundcolor=\color{white}, showspaces=false, showstringspaces=false, showtabs=false, frame=single, tabsize=2, captionpos=b, breaklines=true, breakatwhitespace=true, breakautoindent=true, escapeinside={\%*}{*)}, linewidth=\textwidth } ``` Which, with no other options set, and combined with the following command: ``` \lstinputlisting{EP_Extensions.xml} ``` Lists the given file's source to the following output: ![alt text](https://files.getdropbox.com/u/214703/2009-06-12-164517.png)
How to force line wrapping in listings package?
CC BY-SA 3.0
0
2009-06-11T13:18:48.403
2018-05-15T19:19:44.250
2017-02-08T14:12:45.880
-1
121,305
[ "latex" ]
981,015
1
987,956
null
0
7,553
We started getting the 'Object reference not set to an instance of an object' error when accessing any reports in our SQL Server 2005 Reporting Services. ![alt text](https://lh3.ggpht.com/_1RtF2lqDv2g/SjEA_OnVmZI/AAAAAAAAGJ8/wx5IqmyORNk/s800/report_error.jpg) If we go to the report designer and debug it, it works. I haven't worked much with reporting services, and I don't really know where to start looking. How can I track down the problem? ### EDIT These reports have been working for months. They just suddenly started showing this error. ### EDIT 2 Found this in event viewer:
Reporting Services Object Reference Error
CC BY-SA 2.5
null
2009-06-11T13:18:25.627
2010-03-22T07:02:29.523
2020-06-20T09:12:55.060
-1
64,334
[ ".net", "sql-server", "sql-server-2005", "reporting-services", "business-intelligence" ]
982,210
1
983,978
null
4
2,347
I'm using the Superfish jQuery menu system and have a requirement to show all children regardless of level. The menu only shows the children of the selected item. Perhaps someone can help me figure how to modify the code to make it work this way. [Superfish menu](http://users.tpg.com.au/j_birch/plugins/superfish/) HTML example of a node: ``` <li class="root"><a href="#" title="Training" class="root">Training</a> <ul> <li class="sub"><a href="#" title="Workshops - Classroom" class="sub">Workshops - Classroom</a> <ul> <li class="sub"><a href="#" title="Business Analytics" class="sub">Business Analytics</a></li> <li class="sub"><a href="#" title="Software Applications" class="sub">Software Applications</a></li> <li class="sub"><a href="#" title="Selling Skills" class="sub">Selling Skills</a></li> <li class="sub"><a href="#" title="Wal-Mart Focused" class="sub">Wal-Mart Focused</a></li> </ul> </li> <li class="sub"><a href="#" title="Public Workshop Schedule &amp; Registration Form" class="sub">Public Workshop Schedule &amp; Registration Form</a></li> <li class="sub"><a href="#" title="Webinars" class="sub">Webinars</a></li> </ul> </li> ``` How it looks now: ![screen shot 1](https://www.delta-assoc.com/da-menu-1.jpg) How it needs to look: ![screen shot 2](https://www.delta-assoc.com/da-menu-2.jpg)
Show all children in Superfish jQuery menu
CC BY-SA 4.0
0
2009-06-11T16:37:32.390
2019-03-25T08:33:31.293
2019-03-25T08:33:31.293
7,079,025
12,252
[ "jquery", "html", "css", "superfish" ]
985,223
1
null
null
1
952
I have a User table and a Group table. Between these is a UserGroups intersection table to allow a user to belong to any number of groups. The groups table is already populated with values. How do I add a group to this user so that in the intersection table the relationship between the user and a group is created? My Primary Keys auto increment. My DB structure: ![alt text](https://cp9ovw.bay.livefilestore.com/y1pQMRIOjmYeZAdBrU9yicqsH3dnYDRi55Y0I1vrbci1H5nDRTPOHhtfjs_OooL88ECkc3BXn2OS8OShGzISyWbRY8Ho6iudHs9/db.jpg) My EF structure: [](https://i.stack.imgur.com/CPw0A.jpg) [livefilestore.com](https://cp9ovw.bay.livefilestore.com/y1p_ukGx2dNfTp3iNn3PnZEP38UvaFxvHB2FkLadSFr97c8nHwX8rfFp7AwQ3h29hm1-Rk1QcpOBJlZSdJkUn40rb9PwmUAm8F6/ef.jpg)
Entitry Framework Add To Intersection Table
CC BY-SA 4.0
null
2009-06-12T06:09:58.613
2023-01-12T06:24:25.553
2023-01-12T06:24:25.553
3,404,097
105,254
[ "entity-framework", "foreign-keys", "entity-relationship", "wcf-data-services" ]
985,529
1
991,575
null
0
7,485
``` <asp:UpdatePanel runat="server"> <ContentTemplate> <div style="padding: 0px 45px 0px 45px"> <asp:FormView ID="fvAccounts" runat="server" DataKeyNames="AccountId" DataSourceID="edsAccounts" EnableModelValidation="True" Width="100%"> <EditItemTemplate> <%-- continuing --%> ``` I want the FormView to be 45px (hippos :P) away from the page's width, so I wrapped it with a div setting its padding to 45 for right and left, but it didn't work; the right side goes out the div. I want it to be minimized within the div. Note the black line in the image, it shows where the edge of the parent is, I want the external right side to be 45px away from it to inside. ![example](https://farm3.static.flickr.com/2466/3619186342_0467eeb875_o.jpg)
Problem with HTML DIV style-padding
CC BY-SA 2.5
null
2009-06-12T07:58:40.100
2012-03-28T02:56:07.383
2017-02-08T14:12:47.927
-1
75,500
[ "html", "css" ]
985,997
1
986,018
null
3
2,170
When you right-click an .exe file, you can see various details, such as file description. I'm looking for way to retrieve that data programmatically (preferably, from C#). (Program's name, program's description, Vendor's name, Vendor's site etc) ![alt text](https://trotsenko.com.ua/stackoverflow/notepad_properties.png)
retrieving executable information
CC BY-SA 2.5
null
2009-06-12T10:20:46.467
2009-06-12T10:28:40.067
2017-02-08T14:12:48.267
-1
58,768
[ "c#", ".net", "shell" ]
987,028
1
987,077
null
6
5,942
I'm kind of lost, I try to deploy my application on a shared dreamhost server. Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together. On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that makes sense. So what do I have to do to make it run? I enabled fastcgi support and mod_rails. Now, how do I get the app constantly running? I keep reading about having to do things to .htaccess and to dispatch.fcgi. But I can't find any dispatch file in my rails app (2.3.2). Do I have to create that one manually? Doesn't really feeld very rails-like to me. I didn't really manage to find out what this dispatch file does, and why it's needed. Any help would be greatly appreciated. I looked at the DH Wiki, but couldn't figure it out ([http://wiki.dreamhost.com/Rails](http://wiki.dreamhost.com/Rails)) : I enabled mod_rails and pointed to the public directory (I had already done that). I keep getting an error: screencast.com/t/KamqVawk Hm, server logs look like there is actually no request, so this might be a problem on dreamhosts end. It's strange I see that the access.log show a new change date, when I try to access the page, but there is no request noted, error.log is empty too. ![screenshot of configuration](https://content.screencast.com/users/RolandStuder/folders/Jing/media/0690b68d-29f9-4679-8eb4-3604c386fd57/00000139.png) : The server was up to date, so that wasn't the problem. They proposed freezing the Gems, which I did (see: [http://wiki.dreamhost.com/Freezing_Gems](http://wiki.dreamhost.com/Freezing_Gems)) But it didn't help. I guess I'm giving up, and looking into hosting which is specialized for rails. Thx for all your help! I got the app working on hostingrails.com, passenger on hostingrails.com showed me errors, which weren't shown by dreamhost or mongrel. By correcting these errors, I got the app working.
How to deploy a Rails app to Dreamhost?
CC BY-SA 2.5
0
2009-06-12T14:46:24.987
2009-07-08T15:04:28.683
2017-02-08T14:12:48.600
-1
2,037,537
[ "ruby-on-rails", "deployment", "dreamhost" ]
987,304
1
987,400
null
1
947
I am using asp.net mvc and I am working on a tab menu which is displaying an unwanted space between each tab. This only happens when I have each image tag on its own line as opposed to having it all in one. ![alt text](https://imgur.com/WjPkX.png) The top images are on their own line which is what is causing the unwanted space: ``` <img src="/Content/Images/Reports_white.png"/> <img src="/Content/Images/Audit_white.png"/> <img src="/Content/Images/Messages_white.png"/> <img src="/Content/Images/Admin_white.png"/> ``` versus the desired effect on the bottom half of the image: ``` <img src="/Content/Images/Reports_white.png"/><img src="/Content/Images/Audit_white.png"/> ... ``` How can I get rid of this space without having to keep them all on one line?
How to get rid of an unwanted space in a tab menu?
CC BY-SA 2.5
null
2009-06-12T15:29:19.237
2009-08-31T12:28:07.207
2009-06-12T15:30:34.990
2,635
117,792
[ "html", "css" ]
991,587
1
991,615
null
2
4,536
I'm working on allowing users to upload profile pictures for my site. The classic example of what I'm trying to avoid is [plentyoffish.com](http://plentyoffish.com) where each users image is skewed and looks very ugly: ![alt text](https://imgur.com/5qz59.png) So, how can I progmatically crop/create standard sized versions of an image without the skewing demonstrated above?
How can I crop/scale user images so I can display fixed sized thumbnails without skewing and stretching?
CC BY-SA 2.5
null
2009-06-13T21:51:09.543
2010-05-08T10:35:06.597
2010-05-08T10:35:06.597
1,431
64,878
[ "image", "image-processing", "crop", "image-scaling", "user-profile" ]
993,273
1
993,552
null
0
2,055
i have a problem on below image: ![alt text](https://content.screencast.com/users/uzay95/folders/Jing/media/6fdd63a3-c6bf-4f46-9654-a80c60d12ce4/2009-06-14_1838.png) I have detailsview, but i can't show border left and right on commandrow cell. Here is the css codes: ``` .dvCommandRow td { border-right: solid 1px #B4B4B2; border-left: solid 1px #B4B4B2; text-align: right; padding: 5px; /* border:solid 1px #B4B4B2; I deleted but still problem continue */ } .dvCommandRow td a { color: #3e6d8e; background-color: #e0eaf1; border: 1px solid #7f9fb6; margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 0pt; padding-top: 3px; padding-right: 4px; padding-bottom: 3px; padding-left: 4px; text-decoration: none; font-size: 90%; line-height: 2.2; white-space: nowrap; } .dvCommandRow td a:hover { background-color: #3e6d8e; color: #e0eaf1; border: 1px solid #33ccff; text-decoration: none; } ``` Where is the problem that causes to unbordered row? If you need to see generated html code: ``` <table class="dv" cellspacing="0" border="0" id="ctl00_cpholder_dvKurumEkle" style="height:50px;width:550px;border-collapse:collapse;"> <tr class="dvHeader"> <td colspan="2"> <div class="dvHeaderLeft"> </div> <div class="dvHeaderCenter"> KURUM EKLE</div> <div class="dvHeaderRight"> </div> </td> </tr><tr class="dvRowEven"> <td class="dvField">Kurum Kapsamı</td><td> <input id="ctl00_cpholder_dvKurumEkle_cbSgKapsamindaEkle" type="checkbox" name="ctl00$cpholder$dvKurumEkle$cbSgKapsamindaEkle" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'ctl00$cpholder$dvKurumEkle$cbSgKapsamindaEkle\',\'\')', 0)" /><label for="ctl00_cpholder_dvKurumEkle_cbSgKapsamindaEkle">SGK</label> <input id="ctl00_cpholder_dvKurumEkle_cbHastaAdinaKurum" type="checkbox" name="ctl00$cpholder$dvKurumEkle$cbHastaAdinaKurum" onclick="javascript:setTimeout('__doPostBack(\'ctl00$cpholder$dvKurumEkle$cbHastaAdinaKurum\',\'\')', 0)" /><label for="ctl00_cpholder_dvKurumEkle_cbHastaAdinaKurum">Hasta Adına</label> </td> </tr><tr class="dvRowOdd"> <td class="dvField">Üst Kurumu</td><td> <select name="ctl00$cpholder$dvKurumEkle$ddlUstKurumEkle" id="ctl00_cpholder_dvKurumEkle_ddlUstKurumEkle"> <option value="0">&#220;st kurumu yok.</option> <option value="5">D&#214;NER SERMAYE</option> <option value="2">VALİLİK</option> <option value="3">MALİYE &#214;DEMELİ BAKANLIK</option> <option value="4">KAYMAKAMLIK</option> <option value="8">SGK</option> <option value="9">BELEDİYE</option> <option value="10">MALİYE BAKANLIĞI</option> </select> </td> </tr><tr class="dvRowEven"> <td class="dvField">Kurum Adı</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtKurumAdiEkle" type="text" maxlength="100" id="ctl00_cpholder_dvKurumEkle_txtKurumAdiEkle" onkeyup="SAPHastaKurumAdiOtomatikTamamla(this,'kurumAdi');" /> <span id="ctl00_cpholder_dvKurumEkle_reqFieldKurumAdiEkle" style="color:Red;visibility:hidden;">*</span> <input type="hidden" name="ctl00$cpholder$dvKurumEkle$hdnHasta_id" id="ctl00_cpholder_dvKurumEkle_hdnHasta_id" /> <div id="kurumAdi"> </div> </td> </tr><tr class="dvRowOdd"> <td class="dvField">Vergi Dairesi</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtVDEkle" type="text" maxlength="50" id="ctl00_cpholder_dvKurumEkle_txtVDEkle" /> </td> </tr><tr class="dvRowEven"> <td class="dvField">Vergi Numarası</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtVNEkle" type="text" maxlength="50" id="ctl00_cpholder_dvKurumEkle_txtVNEkle" /> </td> </tr><tr class="dvRowEven"> <td class="dvField">SAP Kodu</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtSapEkle" type="text" id="ctl00_cpholder_dvKurumEkle_txtSapEkle" onkeyup="SAPHastaKurumAdiOtomatikTamamla(this,'sapKodlari');" /> <span id="ctl00_cpholder_dvKurumEkle_reqFieldSapKoduEkle" style="color:Red;visibility:hidden;">*</span> <div id="sapKodlari"> </div> </td> </tr><tr class="dvRowOdd"> <td class="dvField">Yetkili Adı Soyadı</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtYetkiliAdSoyadEkle" type="text" id="ctl00_cpholder_dvKurumEkle_txtYetkiliAdSoyadEkle" /> </td> </tr><tr class="dvRowEven"> <td class="dvField">Yetkili GSM</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtYetkiliGSMEkle" type="text" id="ctl00_cpholder_dvKurumEkle_txtYetkiliGSMEkle" /> <input type="hidden" name="ctl00$cpholder$dvKurumEkle$txtYetkiliGSMEkle_MaskedEditExtender_ClientState" id="ctl00_cpholder_dvKurumEkle_txtYetkiliGSMEkle_MaskedEditExtender_ClientState" /> </td> </tr><tr class="dvRowOdd"> <td class="dvField">Yetkili Tel</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtYetkiliTelEkle" type="text" id="ctl00_cpholder_dvKurumEkle_txtYetkiliTelEkle" /> <input type="hidden" name="ctl00$cpholder$dvKurumEkle$txtYetkiliTelEkle_MaskedEditExtender_ClientState" id="ctl00_cpholder_dvKurumEkle_txtYetkiliTelEkle_MaskedEditExtender_ClientState" /> </td> </tr><tr class="dvRowEven"> <td class="dvField">Yetkili E-Posta</td><td> <input name="ctl00$cpholder$dvKurumEkle$txtYetkiliEpostaEkle" type="text" id="ctl00_cpholder_dvKurumEkle_txtYetkiliEpostaEkle" /> </td> </tr><tr class="dvCommandRow"> <td colspan="2"><a href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$cpholder$dvKurumEkle$ctl04&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Kaydet</a>&nbsp;<a href="javascript:__doPostBack('ctl00$cpholder$dvKurumEkle','Cancel$-1')">Vazgeç</a></td> </tr><tr class="dvFooter"> <td colspan="2"> <div class="dvFooterLeft"> </div> <div class="dvFooterCenter"> </div> <div class="dvFooterRight"> </div> </td> </tr> </table> ```
How can i add border to the asp.net detailsview commandrow cell?
CC BY-SA 2.5
null
2009-06-14T17:34:14.973
2009-06-15T07:27:32.360
2017-02-08T14:12:51.357
-1
104,085
[ "asp.net", "css", "detailsview" ]
995,705
1
null
null
0
1,867
Here is how the page should look like: ![alt text](https://i239.photobucket.com/albums/ff175/mlakilud/datePicker.jpg) It should have the following functionality: - By clicking the period on segmented control start date gets the value of present time - the interva and end date gets the value of the present time. - By selecting one of the labels Start/End, you are able to change their date with date picker. For now, I have implemented segmented control and date picker. It would be good if you could give me some pointers about label implementation. How to make them selectable, change color on selection, etc. Maybe those are not labels, but some other control. Every help is appreciated :) Thx
Date picker + Segmented control + some labels
CC BY-SA 2.5
0
2009-06-15T11:55:56.020
2009-06-16T14:22:17.437
2017-02-08T14:12:52.060
-1
115,873
[ "iphone", "objective-c", "uipickerview" ]
996,693
1
996,704
null
5
4,346
If I have the following html: ``` <body> <div id="mainTop"> </div> <div id="main"> <h2> <%= Html.Encode(ViewData["Message"]) %></h2> <p> To learn more about ASP.NET MVC visit http://asp.net/mvc</a>. </p> </div> <div id="mainBottom"> </div> </body> ``` With the following CSS: ``` #mainTop { background: url('/Content/Images/bg_top.png') no-repeat; width: 963px; height: 65px; margin: 0 auto; text-align: left; color: #5d676d; } #main { background: url('/Content/Images/bg_middle.png') repeat-y; width: 963px; min-height: 50px; margin: 0 auto; } #mainBottom { background: url('/Content/Images/bg_bottom2.png') no-repeat; width: 963px; height: 128px; margin: 0 auto; } ``` It looks like this: ![alt text](https://imgur.com/zxDQM.png) Why do certain tags like `<p`> and the heading tags cause gaps in my layout? Ideally, I would like to not have those huge spaces in between my content.
Why do the <p> and <h1> elements cause gaps in my layout?
CC BY-SA 2.5
0
2009-06-15T15:13:59.163
2009-06-15T17:39:58.210
2009-06-15T16:53:21.347
41,981
64,878
[ "html", "css" ]
997,086
1
1,022,197
null
5
2,070
I am trying to have a list of large (256x256) icons in a listview similar to vista explorer windows, but the winforms' listview control doesn't look like vista's listview. Before I dig into WPF, can someone tell me if WPF listview can do this? Basically I get this (solid blue selection): ![alt text](https://www.howtogeek.com/wp-content/uploads/2007/10/image77.png) instead of this (semi transparent blue selection): [](https://i.stack.imgur.com/KsEpC.png) Can I even achieve this using WinForms? Btw I use Windows 7.
Vista style explorer/folder view
CC BY-SA 4.0
0
2009-06-15T16:34:47.953
2019-03-22T17:59:45.833
2019-03-22T17:59:45.833
4,751,173
51,816
[ "c#", ".net", "wpf", "winforms", "user-interface" ]
997,106
1
1,013,951
null
15
2,509
I save 100.000 Vectors of in a database. Each vector has a dimension 60. (int vector[60]) Then I take one and want present vectors to the user in order of decreasing similarity to the chosen one. I use [Tanimoto Classifier](http://en.wikipedia.org/wiki/Jaccard_index) to compare 2 vectors: ![alt text](https://upload.wikimedia.org/math/8/4/7/84726b0961f860e4be320367fcdc3db1.png) Is there any methods to avoid doing through all entries in the database? One more thing! I don't need to sort all vectors in the database. I whant to get top 20 the most similar vectors. So maybe we can roughly threshold 60% of entries and use the rest for sorting. What do you think?
Efficient comparison of 100.000 vectors
CC BY-SA 2.5
0
2009-06-15T16:40:18.583
2010-08-11T12:41:27.250
2017-02-08T14:12:52.740
-1
101,375
[ "java", "database", "visual-studio", "math", "vector" ]
998,506
1
998,520
null
1
2,670
please just point me in the right direction or tell me what to look up to solve this: I have a "tree" object that holds "node" objects. (actually it's called a directed graph). Each node holds the fields string "name" and "list" that contains the next nodes. How can I create lists of all possible node names from the head node to the foot node? each list is to hold a path from head to foot. the number of nodes from head to foot is always the same i.e: 6. this is what the tree looks like: ![alt text](https://i631.photobucket.com/albums/uu32/see_sharp_guy/tree.png) that diagram should give me: ``` list 1: n1,n2,n4,n5,n7,n9,n13. lsit 2: n1,n2,n4,n6,n8,n9,n13. list 3: n1,n2,n4,n10,n11,n12,n13 ``` and so on. could some simply point me in the right direction? what kind of recursive algorithm should i use? should i use a recursive method or only loops? (i need to use this on the result of the dikstra algorithm.)
how can i list every path in a directed graph? (C#)
CC BY-SA 2.5
0
2009-06-15T21:31:34.147
2012-10-31T03:02:41.867
2017-02-08T14:12:53.410
-1
123,355
[ "c#", "list", "recursion", "tree" ]
1,000,623
1
1,012,783
null
6
19,906
We are investigating alterntive control libraries for a new project we are working on. One of the requirements is to display data in the form of a surface map, as per the ComponentOne Chart below. ![alt text](https://i.stack.imgur.com/83QXo.jpg) We've used the C1 control in the past but are not entirely happy with it - so wondered if anyone can recommoned some alternatives. Having some trouble finding any, so all help appreciated. NB: This is a .NET 3.5 WinForms application
Alternative to ComponentOne 3D Surface Map Chart
CC BY-SA 3.0
0
2009-06-16T10:13:08.407
2019-03-23T14:59:38.887
2015-06-19T20:47:44.350
1,159,643
770
[ ".net", "winforms", "controls", "charts", "componentone" ]
1,002,373
1
1,002,392
null
3
126
I have a main container div in the center of my webpage. This is already in place and has various elements in it. However, now I'm trying to place a large content div (Div #1) on the left that takes about 70% of the Main Container Div. What I'm having difficulty doing is getting the CSS right for having Div's #1, #2, #3, and #4 arranged like the following image: ![alt text](https://imgur.com/SuZnU.png) What should I do in this case for CSS concerning Div #1 - #4? Should I float Div #1 left, and set it as a percentage/fixed width? And float divs #2 - 4 right? Some guidance with this would be appreciated!
How can I layout some divs in the following arrangment?
CC BY-SA 2.5
null
2009-06-16T15:48:27.310
2009-06-16T16:10:42.667
null
null
64,878
[ "html", "css" ]
1,002,459
1
1,002,856
null
2
4,731
I use a modal popup extender, i followed all the instructions on the toolkit sample page, except that i didn't set the property BackgroundCssClass. this is what happens: ![alt text](https://farm4.static.flickr.com/3322/3632160421_861d1f18e3_o.jpg) Is there a way I can get rude of it without setting the cssclass prop? I don't need any styles. If the answer is NO then please show me an example how to set it with a cssclass (even dummy). Thanks in advance. Here is the code: ``` <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <div style="size: 100%; vertical-align: middle"> <asp:LinkButton ID="lnkUpload" Text="Upload" ToolTip="Upload new file" runat="server" OnClick="lnkUpload_Click" /> <cc1:ModalPopupExtender ID="lnkUpload_ModalPopupExtender" runat="server" Drag="true" PopupDragHandleControlID="pnlUploadTitle" DynamicServicePath="" PopupControlID="pnlUpload" Enabled="True" TargetControlID="lnkUpload" CancelControlID="btnCancel" /> </div> <asp:Panel ID="pnlUploadTitle" runat="server" Visible="false"> <center> Upload file </center> </asp:Panel> <asp:Panel ID="pnlUpload" runat="server" Visible="false"> <center> <br /> <asp:FileUpload ID="upFiles" runat="server" /><br /> <br /> <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" /> &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Cancel" /> <br /> </center> </asp:Panel> </div> </form> ```
Ajax:ModalPopup js exception, BackgroundCssClass is null
CC BY-SA 2.5
null
2009-06-16T16:01:00.733
2012-11-22T09:18:12.033
2017-02-08T14:12:54.503
-1
75,500
[ "exception", "ajaxcontroltoolkit", "modalpopupextender", "css" ]
1,004,944
1
1,005,085
null
13
10,196
I have a simple Indexed View. When I query against it, it's pretty slow. First I show you the schema's and indexes. Then the simple queries. Finally a query plan screnie. ### Update: Proof of Solution at the bottom of this post. ### Schema This is what it looks like :- ``` CREATE view [dbo].[PostsCleanSubjectView] with SCHEMABINDING AS SELECT PostId, PostTypeId, [dbo].[ToUriCleanText]([Subject]) AS CleanedSubject FROM [dbo].[Posts] ``` My udf `ToUriCleanText` just replaces various characters with an empty character. Eg. replaces all '#' chars with ''. Then i've added two indexes on this :- ### Indexes Primary Key Index (ie. Clustered Index) ``` CREATE UNIQUE CLUSTERED INDEX [PK_PostCleanSubjectView] ON [dbo].[PostsCleanSubjectView] ( [PostId] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ``` And a Non-Clustered Index ``` CREATE NONCLUSTERED INDEX [IX_PostCleanSubjectView_PostTypeId_Subject] ON [dbo].[PostsCleanSubjectView] ( [CleanedSubject] ASC, [PostTypeId] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ``` Now, this has around 25K rows. Nothing big at all. When i do the following queries, they both take around 4 odd seconds. WTF? This should be.. basically instant! ### Query 1 ``` SELECT a.PostId FROM PostsCleanSubjectView a WHERE a.CleanedSubject = 'Just-out-of-town' ``` ### Query 2 (added another where clause item) ``` SELECT a.PostId FROM PostsCleanSubjectView a WHERE a.CleanedSubject = 'Just-out-of-town' AND a.PostTypeId = 1 ``` What have I done wrong? Is the UDF screwing things up? I thought that, because i have index'd this view, it would be materialised. As such, it would not have to calculate that string column. Here's a screenie of the query plan, if this helps :- ![alt text](https://i.stack.imgur.com/dwuPB.png) Also, notice the index it's using? Why is it using that index? That index is... ``` CREATE NONCLUSTERED INDEX [IX_Posts_PostTypeId_Subject] ON [dbo].[Posts] ( [PostTypeId] ASC, [Subject] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ``` So yeah, any ideas folks? ### Update 1: Added schema for the udf. ``` CREATE FUNCTION [dbo].[ToUriCleanText] ( @Subject NVARCHAR(300) ) RETURNS NVARCHAR(350) WITH SCHEMABINDING AS BEGIN <snip> // Nothing insteresting in here. //Just lots of SET @foo = REPLACE(@foo, '$', ''), etc. END ``` ### Update 2: Solution Yep, it was because i wasn't using the index on the view and had to manually make sure i didn't expand the view. The server is Sql Server 2008 Standard Edition. The full answer is below. Here's the proof, `WITH (NOEXPAND)` ![alt text](https://i.stack.imgur.com/NXUi5.png) Thank you all for helping me solve this problem :)
How can i speed up this Indexed View?
CC BY-SA 3.0
0
2009-06-17T03:19:27.947
2020-05-17T03:17:36.693
2015-06-19T20:58:45.177
1,159,643
30,674
[ "sql", "sql-server", "tsql", "sql-server-2008", "indexed-view" ]
1,010,617
1
1,012,327
null
5
4,025
I am currently hoping to use a PropertyGrid to allow users to edit some of my classes, however I've hit a wall with passing objects to the UITypeEditor(s) they use. When the user presses the drop down I want to show a listbox of already loaded textures to choose from, if they want to use a texture the application hasn't loaded yet they can click a button to choose one from a file dialog. In case I make no sense here a mock of the form: ![Dropdown Image](https://i.stack.imgur.com/6mhTZ.png). To fill the listbox I need access to the class that manages the list of resources from the UITypeEditor. Now I've solved this problem for my own classes by giving them a reference on creation to their managing object. In the UITypeEditor I then use that reference to access what I need. However I can't do this for classes I haven't written, such as the XNA Texture2D class. Here are what the classes I'm using look like: ``` class StaticGeometryChunk { // Geometry data to draw with. Contains a reference to its managing // class for use in its UITypeEditor. public GeometryData { get; set; } .... } class Material { // These are XNA classes. I can't just add a reference to its managing // class (I think?). public Texture2D Texture1 { get; set; } public Texture2D Texture2 { get; set; } .... } ``` I've been looking at my options and they seem to be: 1. Make the managing classes static. I don't really want to do this. There are several managing classes as each resource is loaded differently. There are also classes that need to be created before these and are passed in. 1. Make the managing classes singletons. I don't really want to do this either. It seems like a quick and dirty way to "hide" the problem instead of "solve" it. I also might want the option of having several managing classes in the future which the singletons eliminate. 1. Create a wrapper class which holds the reference to a managing class and its target (such as the XNA Texture2D). This is currently what I'm thinking of doing. Its would be quite simple and quick to do but something about it nags me but I don't know what. Any thoughts on the above or other methods to pass what I need into the UITypeEditor? Thank you for reading.
Passing objects to a UITypeEditor
CC BY-SA 3.0
0
2009-06-18T03:18:10.513
2015-06-19T20:57:49.587
2015-06-19T20:57:49.587
1,159,643
113,504
[ "c#", "propertygrid", "uitypeeditor" ]
1,011,760
1
13,825,154
null
28
8,116
In [this article](http://www.pcmag.com/article2/0,2817,2339629,00.asp) Jonh Dvorak calls Itanium "". While he describes the over-optimistic market expectations and the dramatic financial outcome of the idea, he doesn't go into the technical details of this epic fail. I had my chance to work with Itanium for some period of time and I personally loved its architecture, it was so clear and simple and straightforward in comparison to the modern x86 processors architecture... So then what are/were the technical reasons of its failure? Under-performance? Incompatibility with x86 code? Complexity of compilers? Why did this "Itanic" sink? ![Itanium processor block](https://upload.wikimedia.org/wikipedia/commons/e/e3/Itanium.png)
What are the technical reasons behind the "Itanium fiasco", if any?
CC BY-SA 2.5
0
2009-06-18T09:36:38.757
2019-05-21T18:47:25.410
2017-02-08T14:12:56.940
-1
2,351,099
[ "hardware", "itanium" ]
1,014,672
1
1,014,711
null
1
366
I am trying to place some text over a button image. I manage to align it center from left to right on the button, but vertical alignment doesn't do the trick for the rest of it. Is there a way in the CSS in order to be able to center that text vertically. ![alt text](https://imgur.com/3whJr.png) ``` .selectedTabOnPlacementMenu { background: url('/Content/Images/Blank_Yellow.png') no-repeat; width:88px; height:28px; text-align:center; font-weight:bold; } ```
How to place text centered over an image?
CC BY-SA 2.5
0
2009-06-18T19:19:18.343
2009-06-19T04:15:34.657
null
null
117,792
[ "html", "css" ]
1,015,120
1
1,015,130
null
1
5,569
My form looks like this with a DataGridView: ![Screenshot](https://i.stack.imgur.com/bwKLW.jpg) I would like to make it look more professional. Can someone recommend a "makeover" for it? Perhaps there is a more attractive way to display this data.
Creating a More Attractive DataGridView
CC BY-SA 3.0
null
2009-06-18T20:49:08.690
2014-06-09T08:56:33.403
2013-07-20T05:54:50.490
2,556,654
117,700
[ "vb.net", "datagridview", "datagrid", "spreadsheet" ]
1,015,174
1
6,000,598
null
1
665
When I navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myfirstproject\202aebd2\f0e764e2\assembly\dl3 in Windows explorer, there are 108 folders with 8 character hexadecimal names. Explorer won't sort this folder by name (or value ). What gives? ![alt text](https://i.stack.imgur.com/YrXR0.png)
Why won't windows explorer sort directories under the 'Temporary ASP.NET Files' directory by name?
CC BY-SA 3.0
null
2009-06-18T21:04:45.133
2015-06-19T21:16:14.693
2015-06-19T21:16:14.693
1,159,643
18,051
[ "asp.net", "sorting", "directory", "explorer", "temporary-files" ]
1,018,679
1
1,018,837
null
4
1,795
I have a view that will look like this: ![alt text](https://imgur.com/85y84.png) I'm trying to figure out how I should represent my ViewModel for this view. Each "Agency" can have multiple "Business Units" and each "Business Unit" can have several "Clients". In the database I easily represent this with a mapping table and foreign keys for the Agency, BusinessUnit and Client tables. However, now I need to use LINQ to query this data out of the database and then construct a ViewModel object that represents this tree-like structure so my View can render it. Can anyone give me tips on what data-structure I should use, or what my ViewModel might look like for this hierarchical structure in C# code? I need to create my ViewModel object to pass on to this view. Any suggestions on how to represent the ViewModel are appreciated!
How should I structure my ViewModel for this hierarchical data I need to display in ASP.NET MVC?
CC BY-SA 2.5
0
2009-06-19T15:44:08.103
2009-06-21T15:04:14.483
2009-06-21T15:04:14.483
64,878
64,878
[ "asp.net-mvc", "treeview", "tree", "viewmodel" ]
1,019,573
1
1,019,587
null
279
43,800
I'm working on a project where the user is able to save their work (most likely to the HDD but also possibly any other media, including floppy disks). Sure, the popular > option is there but what about a toolbar button? By far the most popular icon is the floppy disk. However, the chances the user will write to the floppy are pretty slim. Still, I think the floppy is more representational than literal. In the end, I'll probably stick with the floppy disk icon to keep the convention most users are familiar with but... anybody have any ideas on how to update this old icon? ![alt text](https://farm1.static.flickr.com/24/58322910_fae14a8cb2_o.png)
Save icon: Still a floppy disk?
CC BY-SA 4.0
0
2009-06-19T19:07:06.983
2020-10-28T13:10:46.517
2018-05-30T14:32:36.220
13,860
307,338
[ "user-interface", "icons", "user-experience" ]
1,020,146
1
1,022,648
null
7
2,948
I have this blank project, just to check out System.totalMemory variable. As far as I can see, i get this values: ``` 3076 3092 3096 3088 3092 3096 3100 3104 3108 3112 3117 3121 3125 3129 3133 3137 3141 3145 3149 ... And so on ``` I had no Flash open, no Internet Browser, no other instance of flash. The project is blank, only one static text, and one dynamic text, called 'memory'. One file, that contains this code: ``` package{ import flash.display.Sprite; import flash.events.Event; import flash.system.System; import flash.text.TextField; public class Test extends Sprite { public function Test() { this.addEventListener(Event.ENTER_FRAME,Loop); } public function Loop(e:Event) { memory.text = String(System.totalMemory); } } } ``` These are my Publish Settings. ![http://i.stack.imgur.com/3k1vq.png](https://i.stack.imgur.com/3k1vq.png) ![http://i.stack.imgur.com/rwM1D.png](https://i.stack.imgur.com/rwM1D.png) I tested in the Debug and Published *.swf, same results. I have no clue on this one, so please help.
Why Sytem.totalMemory keeps increasing?
CC BY-SA 3.0
0
2009-06-19T21:39:14.353
2015-06-19T21:14:17.600
2015-06-19T21:14:17.600
1,159,643
80,766
[ "flash", "actionscript-3", "memory", "actionscript" ]
1,020,682
1
1,021,217
null
3
14,934
I have put together an [example page detailing my problem](http://tinyurl.com/lgk9ny) My website is going to have a main wrapper that is set to a max-width property for compatible browsers. It will stretch to 940px across at max. When scaled down I would like the swf to scale proportionately with it. Like an image with width percent applied. The flash movie has the dimensions of 940 × 360 pixels. I can't seem to figure out the correct attributes to add to the embed tag to get it to do this. I am currently using jquery flash embed, but am open to other options, though this is my ideal. In the example I have set the flash background to black. When resize the browser window the flash movie doesn't scale proportionately to the div, only the photo does, leaving a blank canvas (black), while the div height stays the same. I can't add a height value in the CSS. ![alt text](https://i207.photobucket.com/albums/bb261/spliffington/notrightatall.png) How do I make this scale correctly? Adding a noscale param only crops the image. The swf's height doesn't scale also. All of my code can be viewed in the [linked examples source](http://tinyurl.com/lgk9ny).
How to make flash movie to scale proportunatly to div width?
CC BY-SA 2.5
0
2009-06-20T01:04:44.967
2012-04-04T09:22:57.563
2017-02-08T14:13:00.080
-1
73,119
[ "javascript", "jquery", "css", "flash", "actionscript" ]
1,021,548
1
2,053,090
null
1
2,110
I host a WAVE-file, which plays fine, it's URL is entered in Mobile Safari directly. Trying to embed it in a simple HTML page shows me a "can't play" icon: ![](https://i.stack.imgur.com/eKa2z.jpg) What's wrong with my embed code? ``` <embed href="http://localhost/test.wav" type="audio/wav"/> ```
Embed WAVE-files in iPhones' Mobile Safari
CC BY-SA 3.0
null
2009-06-20T12:50:32.290
2018-04-24T05:39:48.647
2018-04-24T05:39:48.647
6,083,675
76,371
[ "iphone", "html", "safari", "quicktime", "mobile-safari" ]
1,021,692
1
1,021,937
null
3
1,043
Trying to map the following schema using the Entity Framework. - - - ![alt text](https://imgur.com/ZbEGD.gif) this results with the following mapping in VS. ![alt text](https://imgur.com/CZyp5.gif) --- Here's the DB Script : ``` USE [TestDb] GO /****** Object: Table [dbo].[Customer] Script Date: 06/20/2009 09:53:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Customer]( [CustomerId] [uniqueidentifier] NOT NULL, [FirstName] [nvarchar](50) NOT NULL, [LastName] [nvarchar](50) NOT NULL, CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ( [CustomerId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[Store] Script Date: 06/20/2009 09:53:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Store]( [StoreId] [uniqueidentifier] NOT NULL, [StoreName] [nvarchar](50) NOT NULL, [TopCustomer] [uniqueidentifier] NULL, CONSTRAINT [PK_Store] PRIMARY KEY CLUSTERED ( [StoreId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[CustomerStore] Script Date: 06/20/2009 09:53:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[CustomerStore]( [CustomerId] [uniqueidentifier] NOT NULL, [StoreId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_CustomerStore] PRIMARY KEY CLUSTERED ( [CustomerId] ASC, [StoreId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: ForeignKey [FK_CustomerStore_Customer] Script Date: 06/20/2009 09:53:52 ******/ ALTER TABLE [dbo].[CustomerStore] WITH CHECK ADD CONSTRAINT [FK_CustomerStore_Customer] FOREIGN KEY([CustomerId]) REFERENCES [dbo].[Customer] ([CustomerId]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[CustomerStore] CHECK CONSTRAINT [FK_CustomerStore_Customer] GO /****** Object: ForeignKey [FK_CustomerStore_Store] Script Date: 06/20/2009 09:53:52 ******/ ALTER TABLE [dbo].[CustomerStore] WITH CHECK ADD CONSTRAINT [FK_CustomerStore_Store] FOREIGN KEY([StoreId]) REFERENCES [dbo].[Store] ([StoreId]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[CustomerStore] CHECK CONSTRAINT [FK_CustomerStore_Store] GO /****** Object: ForeignKey [FK_Store_TopCustomer] Script Date: 06/20/2009 09:53:52 ******/ ALTER TABLE [dbo].[Store] WITH CHECK ADD CONSTRAINT [FK_Store_TopCustomer] FOREIGN KEY([TopCustomer]) REFERENCES [dbo].[Customer] ([CustomerId]) GO ALTER TABLE [dbo].[Store] CHECK CONSTRAINT [FK_Store_TopCustomer] GO ``` --- How can the TopCustomer association be mapped to a single instance of Customer without creating an extra navigation property on the Customer class ?
Entity Framework Mapping Question
CC BY-SA 2.5
0
2009-06-20T14:04:24.043
2009-06-20T16:17:47.070
null
null
199,771
[ "entity-framework", "orm" ]
1,021,721
1
null
null
12
3,685
I would like to write a Python script that would generate a 3D [CAPTCHA](http://en.wikipedia.org/wiki/CAPTCHA) like this one: ![teabag captcha](https://i.stack.imgur.com/60KlL.png) Which graphics libraries can I use? Source: [ocr-research.org.ua](http://ocr-research.org.ua/teabag.html)
Generating a 3D CAPTCHA [pic]
CC BY-SA 3.0
0
2009-06-20T14:30:17.733
2014-09-05T04:09:47.493
2014-09-05T04:09:47.493
31,676
null
[ "python", "graphics", "captcha" ]
1,028,304
1
1,267,921
null
1
1,363
I'm trying to replicate some image filtering software on the Android platform. The desktop version works with bmps but crashes out on png files. When I come to xOr two pictures (The 32 bit ints of each corresponding pixel) I get very different results for the two pieces of software. I'm sure my code isn't wrong as it's such a simple task but here it is; ``` const int aMask = 0xFF000000; int xOrPixels(int p1, int p2) { return (aMask | (p1 ^ p2) ); } ``` The definition for the JAI library used by the Java desktop software can be found [here](http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/XorDescriptor.html) and states; ``` The destination pixel values are defined by the pseudocode: dst[x][y][b] = srcs[0][x][y][b] ^ srcs[1][x][y][b]; ``` Where the b is for band (i.e. R,G,B). Any thoughts? I have a similar problem with AND and OR. Here is an image with the two source images xOr'd at the bottom on Android using a png. The same file as a bitmap xOr'd gives me a bitmap filled with 0xFFFFFFFF (White), no pixels at all. I checked the binary values of the Android ap and it seems right to me.... ![Android](https://lh3.ggpht.com/_EW60jqE5_B0/Sj-9U6PQj2I/AAAAAAAAAFM/dSgxKyz85V0/s800/device.png) Gav NB When i say (Same 32 bit ARGB representation) I mean that android allows you to decode a png file to this format. Whilst this might give room for some error (Is png lossless?) I get completely different colours on the output.
Bitwise operations on a png and bmp give different results? (Same 32 bit ARGB representation)
CC BY-SA 2.5
0
2009-06-22T16:51:59.243
2009-08-12T18:33:48.320
2017-02-08T14:13:01.827
-1
111,734
[ "java", "image-processing" ]
1,028,636
1
1,030,858
null
4
782
The result of my Delaunay triangulation on 1000 unifomally random points doens't look right at all (see image). Some points seem to belong an abnormally high number of triangles... Any idea? ![alt text](https://i.stack.imgur.com/t3NvV.png) Detail: CGAL 3.4, windows XP This is the types I used: ``` typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_2<K> Triangulation; typedef Triangulation::Point Point; ``` The display is as follow: ``` delaunay_c::Triangulation::Edge_iterator eit = T.edges_begin(); delaunay_c::Triangulation::Edge_iterator end = T.edges_end(); for(;eit != end; ++eit) { delaunay_c::Triangulation::Segment s = T.segment(eit); line.m_a = delaunay_c::convert(s.source()); line.m_b = delaunay_c::convert(s.target()); line.draw(); } ``` The function convert simply convert from CGAL Point to another point format EDIT: following the chosen answer, I just change triangulation to delaunay_triangulation: ``` typedef CGAL::Delaunay_triangulation_2<K> Triangulation; ``` And it gave: ![alt text](https://i.stack.imgur.com/lGyAp.png)
CGAL: erroneous Delaunay result?
CC BY-SA 3.0
null
2009-06-22T18:05:25.573
2015-06-19T21:58:53.723
2015-06-19T21:58:53.723
1,159,643
null
[ "c++", "cgal" ]
1,029,041
1
1,029,059
null
3
183
I am working on a web app. One of the views has been divided into different portions in order to display different information utilizing the whole view and make stuff more manageable. The problem is that the beginning of the information on placementContainerRight gets lined up with the last information from placementContainerLeft giving me a big free space on top of the placementContainerRight. My html: ``` <div id="mainContainer"> <%--Start of left container --%> <div id="placementContainerLeft"> <%--This section will handle the three for the specific Enterprise --%> <div class="section"> <div class="sectionTitle"> All Agencies </div> <div class="horLine"></div> <div class="placementFill"> <div class="placementItemTitle"> <div class="placementTableItems"> <table width="100%"> <tr class="placementTableHeading"> <th></th> <th>Number of Accounts</th> <th>Amount of Placement</th> <th>Percentage of Placement</th> <th>NeuPlacement Score</th> </tr> </table> </div> </div> </div> </div> <div class="section">hmmm</div> <%--End of left container --%> </div> <%--Start of right container --%> <div id="placementContainerRight"> <%--This section handles the Bar FusionChart --%> <div class="section"> <div class="sectionTitle"> ``` This are the id's in my css: ``` #mainContainer { width:900px; vertical-align: top; margin-left:20px; float:left; } #placementContainerLeft { width:578px; margin-left:5px; clear:left; } #placementContainerRight { width:267px; margin-left:628px; clear:right; } ``` And this is the way it currently looks: ![alt text](https://imgur.com/hE6fo.png) Does anybody know how to fix this problem?
How can I line up the two containers in view?
CC BY-SA 2.5
null
2009-06-22T19:39:10.913
2009-06-22T19:42:32.000
null
null
117,792
[ "html", "css" ]
1,030,607
1
1,031,012
null
-1
332
I have uploaded [a website to the internet](http://midiamantedegel.com). Firebug claims that no file is missing and yet on both IE and FF it doesn't look good as expected and also the script doesn't work (no errors). Here are the [files](https://dl-web.getdropbox.com/get/Agel%20Premotional%20Site.rar?w=fa40df17). And here is a screenshot: ![](https://i.stack.imgur.com/A6Zl5.jpg) Any thoughts on why this happens? What's missing?
Why does my website work only on my machine?
CC BY-SA 3.0
0
2009-06-23T04:22:11.780
2013-07-29T11:23:29.217
2013-07-29T11:23:29.217
366,904
85,140
[ "html", "css" ]
1,031,135
1
1,299,227
null
23
7,170
I recently used NDepend and it produced a good report on my .net assemblies and related pdbs. The most interesting thing I found in the report was abstractness vs. instability graph. I wanted to understand this in real detail, I read their docs and online metrices but it could only help to an extent. Primarily I wish to understand how to evaluate the graph correctly and techniques to control abstractness with stability. There's a very good article [here](http://www.igloocoder.com/archive/2007/07/25/1277.aspx) that talks on this but what more in addition to this I need is 'how do I control this ? [controlling abstractness with stability]' ![alt text](https://i.stack.imgur.com/bvGya.jpg)
What is Abstractness vs. Instability Graph?
CC BY-SA 3.0
0
2009-06-23T07:39:02.940
2015-08-12T09:12:29.390
2014-10-06T10:51:16.883
2,932,052
89,556
[ "architecture", "code-metrics", "ooad", "ndepend" ]
1,032,743
1
1,032,752
null
35
43,792
Firefox is set as Windows' default browser. I want to change the default browser used by Visual Studio for debugging. Normally the route I'd take to do this is right clicking on an .aspx file and setting the default from the `Browse With...` dialog. Unfortunately, ASP.NET MVC Views don't have the `Browse With...` option. ![alt text](https://i.stack.imgur.com/RvdB5.png) In what other ways can you set the default browser for ASP.NET MVC projects? > [Visual Studio opens the default browser instead of Internet Explorer](https://stackoverflow.com/questions/79954/visual-studio-opens-default-browser-instead-of-ie)
Change Visual Studio Default Browser in an ASP.NET MVC project
CC BY-SA 2.5
0
2009-06-23T14:00:22.420
2017-01-10T22:57:48.240
2017-05-23T11:46:34.517
-1
15,691
[ "asp.net-mvc", "visual-studio" ]
1,041,312
1
1,041,759
null
5
4,255
I have 3 kinds of objects: Agency, BusinessUnit and Client (each with their own respective table) In terms of hierarchy, Agencies own BusinessUnits, and BusinessUnits own Clients. I have 3 C# POCO Objects to represent them (I usually select new {} into them, rather than use the LINQ generated classes): ``` public class Agency { public IEnumerable<BusinessUnit> BusinessUnits { get; set; } } public class BusinessUnit { public IEnumerable<Client> Clients { get; set; } } public class Client { public int NumberOfAccounts { get; set; } public Decimal AmountOfPlacement { get; set; } public Decimal AvgBalance { get; set; } public Double NeuPlacementScore { get; set; } } ``` You can see that Agencies contain a list of BusinessUnits, and BusinessUnits contain a list of Clients. I also have a mapping table called BAC_Map in the database which says which owns which, and it looks something like this: ![alt text](https://imgur.com/O5IvW.png) How can I construct a query, so I can query for and return a list of Agencies? Meaning that, I want each Agency to have its list of BusinessUnit objects set, and I want the list of BusinessObjects to have its list of Clients set. I can do basic LINQ queries, but this is a little over my head concerning the Map table and the multiple? queries. How could I construct a method like GetAllAgencies() which would query, for not only all agencies, but populate its BusinessUnits that Agency owns, and the Clients those BusinessUnits own? --- Edit: Any tips or info is appreciated. Do I need to do joins? Does this need to be multiple queries to return an Agency list, with its submembers populated?
How can I query this hierarchical data using LINQ?
CC BY-SA 2.5
0
2009-06-24T22:20:27.690
2009-06-25T17:07:45.110
2009-06-25T00:58:47.933
64,878
64,878
[ "c#", "linq", "linq-to-sql" ]
1,042,182
1
null
null
2
6,775
![alt text](https://www.codeproject.com/KB/WPF/AdvancedCustomTreeViewLyt/AdvancedCustomTreeViewLayout_before.png) I Have Treeview (shown as above) in my app, I have binded it with collection... now the problem is whenever I expand on by default should get selected, means whenever I expand first item that Node should get selected.. Any Ideas/suggestion Please
WPF Treeview Item select Problem
CC BY-SA 2.5
0
2009-06-25T04:25:36.823
2013-04-19T04:27:56.253
2017-02-08T14:13:06.873
-1
85,606
[ "c#", "wpf", "treeview" ]
1,045,257
1
1,051,725
null
1
432
I have a generated (via MSBuild) Web.config that runs prior to the Build target whose content includes, among other things, <compilation debug="true">. The generated Web.config is copied to the root and put in the Content item group. But when I run the Debug build in Visual Studio 2008 (via F5) I get the following dialog: ![Debugging Not Enabled](https://farm3.static.flickr.com/2450/3659821355_cc668c62ca.jpg) If I select "Add ..." and click OK it appears to add the generated Web.config to the project and it shows up in the IDE as a project file. So maybe the question should be: Why does the Web.config file need to be a part of the project? I'd really like to avoid including generated config files in the project because of source control. If the Web.config file is there when the application runs I don't see why Visual Studio should be concerned. So is there a way for Visual Studio to accept a generated Web.config without it being added through the IDE?
Why does Visual Studio 2008 ask about enabling debugging when debugging is already enabled?
CC BY-SA 2.5
null
2009-06-25T17:39:56.360
2009-06-26T23:44:22.230
2017-02-08T14:13:07.887
-1
59,180
[ "asp.net", "visual-studio-2008", "msbuild", "debugging", "web-config" ]
1,046,029
1
1,046,205
null
9
21,208
I am trying to draw a series of rectangles using OpenGL but some of the ones that should appear below a rectangle appear above it. To enable the depth function I am using ``` glClearDepth(1.0f); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); ``` I am using gluLookAt at the begining of each draw. Here is an image of the problem. The blue rectangles are positioned with higher y values than the green rectangles. ![alt text](https://i.stack.imgur.com/qigRm.png) ![alt text](https://i.stack.imgur.com/ZusMK.png) As you can see in the top image some of the green rectangles appear above the blue ones. Any idea why this is happening and what I can do to fix it? Could it have something to do with the order that I'm drawing the rectangles?
Depth Buffer in OpenGL
CC BY-SA 3.0
0
2009-06-25T20:23:33.613
2018-07-19T20:32:36.587
2015-06-19T21:24:03.710
1,159,643
107,183
[ "opengl" ]
1,046,370
1
1,050,337
null
5
2,076
One last question about Client Profile installation. I downloaded the Microsoft .NET Framework Client Profile Online Installer because we want to put it in the installation CD because our end user might not have either .net framework 3.5 or internet. So we want to be able to handle both cases. In the prerequisites I'm able to select the location of where the file will be, but I don't know where it should be. I want to be able to somehow put the path of the cd, something like d:\ProductName\Prerequisites\DotNetFx35ClientSetup.exe so it can get it and install it from there. Does anyone have an idea of how this can be achieved? Thank you. Here's the prerequisites window: ![alt text](https://i.stack.imgur.com/mDNIg.png)
Client Profile Application prerequisites
CC BY-SA 3.0
0
2009-06-25T21:33:11.820
2019-07-26T17:07:14.063
2015-06-19T20:57:54.170
1,159,643
62,642
[ ".net", "installation", ".net-client-profile" ]
1,048,373
1
null
null
11
28,323
When working in Visual Studio 2005/2008/2010/1012/2013 the dates and times are shown in mm/dd/yyyy hh:MM:ss format. Is there a way to change it to the same settings as the computer?? The displayed date that interests me is in the Watch window. My system is in non English but the Visual Studio 2005 installation is in English. So even when I have a different date format, this setting does not affect VS. ![Tooltip](https://i.stack.imgur.com/nx1Ap.png) ![Quickwatch 1](https://i.stack.imgur.com/7izo7.png) ![Quickwatch 2](https://i.stack.imgur.com/8KGnK.png) ![Computer clock](https://i.stack.imgur.com/71i39.png) ![Computer settings](https://i.stack.imgur.com/YTJAK.png)
Visual Studio change date & time format
CC BY-SA 3.0
0
2009-06-26T10:25:34.130
2017-05-09T15:10:08.520
2015-03-09T21:04:17.987
58,553
null
[ "visual-studio-2010", "visual-studio", "visual-studio-2012", "visual-studio-2013" ]
1,048,885
1
1,062,353
null
0
574
I have a small problem with a SWT.Browser widget who throws a quite puzzling alert. I tried to test the Google StreetView API in a browser so I made this page (actually I did not make anything, juste pasted it from Google's snippet.) and I get the following message : ![alt text](https://www.developpez.net/forums/attachments/p49091d1245854851/java/interfaces-graphiques-java/swt-jface/swt-browser-settext-agit-etrangement/screenshot006.png/) (Puzzling, ain't it ?)My code is very simple (here it is) ``` public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display); shell.setText("Tentative API Google avec un SWT.Browser"); shell.setLayout(new GridLayout()); final Browser browser = new Browser(shell,SWT.BORDER); browser.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true)); browser.setText("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" mlns:v=\"urn:schemas-microsoft-com:vml\">"+ "<head>"+ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>"+ "<script src=\"http://maps.google.com/maps?file=api&v=2.x&key=AnyKey\" type=\"text/javascript\"></script>" + "<title>"+ "Google Maps JavaScript API Example: Simple Streetview Example"+ "</title>" + "<script type=\"text/javascript\">var myPano;function initialize(){var fenwayPark = new GLatLng(42.345573,-71.098326);panoramaOptions = { latlng:fenwayPark };myPano = new GStreetviewPanorama(document.getElementById(\"pano\"), panoramaOptions);GEvent.addListener(myPano, \"error\", handleNoFlash);}function handleNoFlash(errorCode){if(errorCode == FLASH_UNAVAILABLE){alert(\"Error: Flash doesn't appear to be supported by your browser\");return;}}</script>" + "</head>" + "<body onload=\"initialize()\" onunload=\"GUnload()\">" + "<div name=\"pano\" id=\"pano\" style=\"width: 500px; height: 300px\">" + "</div>" + "</body>" + "</html>"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } ``` The problem might come (more or less) from the API because when I do not include it, I get no error. Anyway this very page works perfectly on any standard browser. Even more surprising is that I do not get any error if my second tag is not closed (well then nothing happens and if we go this way, when I have absolutly no code I have absolutly no error...) Here I stand ... A bit confused about what to do ... (Any help is very welcome ...)
Strange Google StreetView Internet Explorer warning
CC BY-SA 2.5
0
2009-06-26T12:29:47.577
2009-06-30T08:05:53.373
2017-02-08T14:13:08.560
-1
112,637
[ "api", "browser", "google-street-view" ]
1,051,090
1
1,136,776
null
28
5,026
Here's a [sample page](http://jsbin.com/omoya) with a couple datepickers. Here's the Drip result for that: [alt text http://www.picvault.info/images/537090308_omoya.png](http://www.picvault.info/images/537090308_omoya.png) This page leaks indefinitely in IE6sp1 when I click the Refresh button repeatedly (IE6sp3+, Opera 9, Chrome2, and FF3+ seem to be good). The memory goes up and never goes down until I actually close the browser completely. I've also tried using the latest nightly of jquery (r6414) and the latest stable UI (1.7.2) but it didn't make any difference. I've tried various things with no success ([CollectGarbage](http://www.mail-archive.com/jquery-dev@googlegroups.com/msg03851.html), [AntiLeak](http://groups.google.com/group/jquery-ui/browse_thread/thread/d0093cf0199e26b4/acd3cecae3f5b055?hl=en&lnk=gst&q=dialog+memory+leak#acd3cecae3f5b055), others). I'm looking for a solution other than "use a different browser!!1" as I don't have any control over that. Any help will be greatly appreciated! I added that button event to a loop and this is what happens (the sudden drop off is when I terminate IE): ![alt text](https://i.stack.imgur.com/6pmp5.png) I filed a [bug report](http://dev.jqueryui.com/ticket/4644) (fingers crossed). This is also on the [mailing list](http://groups.google.com/group/jquery-dev/browse_thread/thread/861282378f94a37e). This (as reported on the mailing list) doesn't work, and in fact makes things worse: ``` $(window).bind("unload", function() { $('.hasDatepicker').datepicker('destroy'); $(window).unbind(); }); ``` It's not enough to just call destroy. I'm still stranded with this one and getting very close to ripping jquery out of the project. I love it (I really do!) but if it's broken, I can't use it. Starting the bounty, another 550 points to one helpful individual! Some more testing has shown that this leak exists in IE6 and IE6sp1, but has been fixed in IE6sp2+. Now, about the answers I have so far... So far all answers have been any one of these: 1. Abandon IE6sp0/sp1 users or ignore them 2. Debug jquery and fix the problem myself 3. I can't repro the problem. I know beggars can't be choosers, but those simply are not answers to my problem. I cannot abandon my users. They make up 25% of the userbase. This is a custom app written for a customer, designed to work on IE6. It's not an option to tell my customers to just deal with it. It leaks so fast that after five minutes, some of the weaker machines are unusable. Further, while I'd love to become a JS ninja so I can hunt down obscure memory leaks in jquery code (granted this is MS's fault, not jquery's), I don't see that happening either. Finally, multiple people have reproduced the problem here and on the mailing list. If you can't repro it, you might have IE6SP2+, or you might not be refreshing enough. Obviously this issue is very important to me (hence the 6 revisions, bounty, etc.) so I'm open to new ideas, but please keep in mind that none of those three suggestions will work for me. Thanks to all for your consideration and insights. Please keep them coming! The bounty has ended and Keith's answer was auto-accepted by SO. I'm sorry that only half the points were awarded (since I didn't select the answer myself), but I'm still really stuck so I think half is fair. I am hopeful that the jquery/jquery-ui team can fix this problem but I'm afraid that I'll have to write this off as "impossible (for now)" and stop using some or all of jquery. Thanks to everyone for your help and consideration. If someone comes along with a real solution to my problem, please post and I'll figure out some way to reward you.
How can I control IE6+jQuery+jQuery-ui memory leaks?
CC BY-SA 3.0
0
2009-06-26T20:21:36.863
2015-06-19T20:37:07.097
2015-06-19T20:37:07.097
1,159,643
29
[ "javascript", "jquery", "jquery-ui", "memory-leaks", "internet-explorer-6" ]
1,054,558
1
1,054,681
null
2,320
748,135
I have a `UILabel` with space for two lines of text. Sometimes, when the text is too short, this text is displayed in the vertical center of the label. How do I vertically align the text to always be at the top of the `UILabel`? ![image representing a UILabel with vertically-centered text](https://i.stack.imgur.com/TxzmG.jpg)
Vertically align text to top within a UILabel
CC BY-SA 3.0
0
2009-06-28T08:54:03.973
2021-09-09T14:23:16.393
2020-01-03T13:45:53.410
74,118
76,371
[ "ios", "cocoa-touch", "uikit", "uilabel", "text-alignment" ]
1,054,675
1
null
null
1
4,434
For the issue pls see the screenshot: ![enter image description here](https://i.stack.imgur.com/fyxl1.jpg) The above code has been generated by the html. ``` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>SYM</title> <style type="text/css" media="all"> @import "test.css"; </style> </head> <body> <div id="container"> <div class="round-box"> <table class="round-box-layout"> <thead><tr><td></td><td></td><td></td></tr></thead> <tbody><tr><td></td><td> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </td><td></td></tr></tbody> <tfoot><tr><td></td><td></td><td></td></tr></tfoot> </table> </div> <div class="round-box2"> <table class="round-box-layout"> <thead><tr><td></td><td></td><td></td></tr></thead> <tbody><tr><td></td><td> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </td><td></td></tr></tbody> <tfoot><tr><td></td><td></td><td></td></tr></tfoot> </table> </div> <body> </html> ``` The test.css is ``` .round-box { width: 250px; } table.round-box-layout { border-collapse: collapse; width: 100%; } table.round-box-layout, .round-box-layout tr, .round-box-layout td { padding: 0; margin: 0; border: solid; } table.round-box-layout tbody td:first-child { background: url(img/borders/l-e.png) repeat-y 0 0; height: 36px; width: 33px; } table.round-box-layout tbody td:last-child { background: url(img/borders/r-e.png) repeat-y 0 0; height: 36px; width: 33px; } table.round-box-layout thead td { background: url(img/borders/t-e.png) repeat-x 0 0; height: 36px; width: 33px; } table.round-box-layout thead td:first-child { background: url(img/borders/tl-c.png) no-repeat 0 0; } table.round-box-layout thead td:last-child { background: url(img/borders/tr-c.png) no-repeat 0 0; } table.round-box-layout tfoot td { background: url(img/borders/b-e.png) repeat-x 0 0; height: 36px; width: 33px; } table.round-box-layout tfoot td:first-child { background: url(img/borders/bl-c.png) no-repeat 0 0; } table.round-box-layout tfoot td:last-child { background: url(img/borders/br-c.png) no-repeat 0 0; } .round-box2 { width: 800px; } ``` is the first and last (third) columns' widths are getting altered. This width seems to depend on the width of container div and the text content. Please advise, how to fix this. .
Table column width increases despite setting it to a fixed value
CC BY-SA 3.0
0
2009-06-28T10:31:53.263
2016-09-29T15:56:40.230
2016-09-29T15:56:40.230
4,370,109
null
[ "html", "css", "css-tables" ]
1,058,991
1
1,059,022
null
77
220,132
We have a j2ee application running on Jboss and we want to monitor its memory usage. Currently we use the following code ``` System.gc(); Runtime rt = Runtime.getRuntime(); long usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024; logger.information(this, "memory usage" + usedMB); ``` This code works fine. That means it shows memory curve which corresponds to reality. When we create a big xml file from a DB a curve goes up, after the extraction is finished it goes down. ![alt text](https://i6.photobucket.com/albums/y231/oleg_pavliv/hc.jpg) A consultant told us that calling gc() explicitly is wrong, "let jvm decide when to run gc". Basically his arguments were the same as [disscussed here](https://stackoverflow.com/questions/66540/system-gc-in-java). But I still don't understand: - -
How to monitor Java memory usage?
CC BY-SA 3.0
0
2009-06-29T15:41:19.490
2021-04-15T13:46:17.433
2017-05-23T12:26:08.287
-1
59,704
[ "java", "garbage-collection", "monitoring", "memory-management" ]
1,059,291
1
1,059,310
null
8
37,488
I am trying to give the effect of general headings in this table and then subdivide such heading into three categories. The table should continue this subdivisions all the way to the end. I see that I can probably insert a table within a row insert, but don't want to saturate myself with tables. Is there a way to get this effect in a simpler way? ![alt text](https://imgur.com/4bWgK.png)
How can I display rows within rows in table?
CC BY-SA 2.5
0
2009-06-29T16:43:57.970
2009-06-29T17:07:33.657
null
null
117,792
[ "html" ]
1,060,799
1
1,060,892
null
1
2,231
I am writing a replacement Windows shell in C#, and the feature I am currently implementing is having all IO inside the same shell window - ie, not opening cmd.exe in another window. Right now, I have a partial solution to output. This is my code (where p is the running Process): ``` while ( !p.HasExited ) { /* ... - irrelevant */ if ( redirect ) { try { p.BeginOutputReadLine(); } catch { } } } ``` The process is set up with all the correct properties, such as`UseShellExecute` = `False`, `RedirectStandard{Input, Output, Error}` = `True`, and the event handlers are set up correctly, but it's inconsistent. I have tried taking out the try/catch (which I know is extremely bad practice), and using a busy bool, which is set to false when the handler runs, but for some reason, I still get an InvalidOperationException on p.BeginOutputReadLine() - stating that there is already an async operation running. Any help would be appreciated, even if it requires a completely different solution to the one above, rather than just fixing it. Thanks. : Here is the code which starts the process: ``` if (redirect) { p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.UseShellExecute = false; p.OutputDataReceived += new DataReceivedEventHandler(redirectHandler_StdOut); p.ErrorDataReceived += new DataReceivedEventHandler(redirectHandler_StdErr); } p.Start(); ``` Also, I've realised that I'm not explaining what I mean by inconsistent. As they say, a picture is worth `2^3` words: ![screenshot](https://lucjon.fogbugz.com/default.asp?pg=pgDownload&pgType=pgFile&ixBugEvent=36&ixAttachment=2&sTicket=&sFileName=lshell%20-%20rdrio.bmp)
C# Shell - IO redirection
CC BY-SA 2.5
0
2009-06-29T22:01:13.680
2009-07-03T03:06:27.077
2009-06-29T22:25:46.033
41,981
41,981
[ "c#", ".net", "io" ]
1,065,408
1
1,065,431
null
7
14,194
I have the following situation, presented in the picture. Grey div is the parent of magenta and blue divs. Magenta div scales vertically with the content. I would like to have blue div always scale to the bottom of the containing grey, div. I've searched and tried various combinations, but all to nil effect. ![alt text](https://imgur.com/mej8W.png) edit: Problem solved! Container needs an overflow: hidden, and the div that I want to stretch to the bottom (blue) needs padding-bottom: 1000px; margin-bottom: -1000; (or larger if you need)
How to make div scale vertically all the way down?
CC BY-SA 2.5
0
2009-06-30T19:05:01.893
2012-12-02T18:44:51.010
2009-07-02T16:19:44.143
68,869
68,869
[ "html", "css" ]
1,066,234
1
1,073,337
null
51
24,305
I just came across this little problem on [UVA's Online Judge](http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=41) and thought, that it may be a good candidate for a little code-golf. You are to design a program to assist an architect in drawing the skyline of a city given the locations of the buildings in the city. To make the problem tractable, all buildings are rectangular in shape and they share a common bottom (the city they are built in is very flat). The city is also viewed as two-dimensional. A building is specified by an ordered triple where and are left and right coordinates, respectively, of building i and is the height of the building. ![alt text](https://imgur.com/SnSjn.gif) In the diagram below buildings are shown on the left with triples ``` (1,11,5), (2,6,7), (3,13,9), (12,7,16), (14,3,25), (19,18,22), (23,13,29), (24,4,28) ``` and the skyline, shown on the right, is represented by the sequence: ``` 1, 11, 3, 13, 9, 0, 12, 7, 16, 3, 19, 18, 22, 3, 23, 13, 29, 0 ``` The output should consist of the vector that describes the skyline as shown in the example above. In the skyline vector , the such that i is an even number represent a horizontal line (height). The such that i is an odd number represent a vertical line (x-coordinate). The skyline vector should represent the "path" taken, for example, by a bug starting at the minimum x-coordinate and traveling horizontally and vertically over all the lines that define the skyline. Thus the last entry in the skyline vector will be a 0. The coordinates must be separated by a blank space. If I will not count declaration of provided (test) buildings and including all spaces and tab characters, my solution, in Python, is characters long. Here is the condensed version: ``` B=[[1,11,5],[2,6,7],[3,13,9],[12,7,16],[14,3,25],[19,18,22],[23,13,29],[24,4,28]] # Solution. R=range v=[0 for e in R(max([y[2] for y in B])+1)] for b in B: for x in R(b[0], b[2]): if b[1]>v[x]: v[x]=b[1] p=1 k=0 for x in R(len(v)): V=v[x] if p and V==0: continue elif V!=k: p=0 print "%s %s" % (str(x), str(V)), k=V ``` I think that I didn't made any mistake but if so - feel free to criticize me. I don't have much reputation, so I will pay only 100 for a bounty - I am curious, if anyone could try to solve this in less than .. lets say, 80 characters. Solution posted by is [101 characters long](https://stackoverflow.com/questions/1066234/the-skyline-problem/1073337#1073337) and currently it is the best one. I thought, that 80 characters is a sick limit for this kind of problem. , with his 46 character solution totaly amazed me - though I must admit, that I spent some time reading his explanation before I partially understood what he had written.
The Skyline Problem‍​​
CC BY-SA 3.0
0
2009-06-30T21:41:55.180
2015-04-03T16:36:01.843
2017-05-23T12:00:17.880
-1
126,781
[ "code-golf", "rosetta-stone" ]
1,066,665
1
1,348,944
null
3
1,479
My Code: ``` foreach (PicasaEntry entryAlbuns in feedAlbuns.Entries) { AlbumAccessor ac = new AlbumAccessor(entryAlbuns); PhotoQuery photos = new PhotoQuery(PicasaQuery.CreatePicasaUri("admin@localhost", ac.AlbumTitle)); PicasaFeed feedPhotos = service.Query(photos); } ``` When debugger step in line PicasaFeed feedPhotos = service.Query(photos); get an error > The remote server returned an error: (404) Not Found. Check parameters accepted: ![alt text](https://i.stack.imgur.com/uN4CN.jpg) PS: Because of security reasons I replaced my email account to admin@localhost.
Picasa API returns "The remote server returned an error: (404) Not Found."
CC BY-SA 4.0
null
2009-06-30T23:48:03.490
2019-03-26T09:02:59.837
2020-06-20T09:12:55.060
-1
127,891
[ "c#", "gdata-api", "picasa" ]
1,066,809
1
1,069,412
null
174
168,804
I'm using subclipse for connecting to my SVN. There are some folders and files I would like to add to svn:ignore, but it's grayed out. Is there an easy way to get subclipse to ignore files and directories? ![subclipse](https://i.stack.imgur.com/i2xoH.png)
Subclipse svn:ignore
CC BY-SA 4.0
0
2009-07-01T00:42:01.493
2022-12-29T03:19:53.990
2022-12-29T03:19:53.990
11,107,541
74,894
[ "eclipse", "svn", "subclipse" ]
1,069,718
1
null
null
1
769
Everytime something gets wrong .. i got to see this. ![alt text](https://i.stack.imgur.com/I2Xb2.png) How can i make a simple Errorpage with stacktrace in jsf ?
How can i make errorpages in jsf?
CC BY-SA 3.0
0
2009-07-01T15:14:38.353
2015-06-19T22:37:34.603
2015-06-19T22:37:34.603
1,159,643
126,040
[ "jsf", "netbeans", "error-handling" ]
1,070,710
1
1,071,009
null
7
1,379
I'm having a tricky issue (bear with me as I'm new to MVC) with trying to use a controller (and a route subsequently) with the name PropertiesController. I believe this is because there is a directory (which I can't really remove) called "Properties" in my solution. Is there a way round this? The route setup is just one simple route: ``` routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Properties", action = "List", id = "" } // Parameter defaults ); ``` and the error I get in IIS7 when requesting "[http://localhost/aptment2/properties/](http://localhost/aptment2/properties/)" is: ![alt text](https://i.stack.imgur.com/ASX8f.png) Surely there is a way round this that I just can't find? Cheers.
ASP.NET MVC Routing with a controller named "PropertiesController"
CC BY-SA 3.0
0
2009-07-01T18:45:39.407
2015-06-19T22:47:29.027
2015-06-19T22:47:29.027
1,159,643
5,777
[ "asp.net", "asp.net-mvc", "iis-7", "routes" ]
1,070,872
1
1,077,132
null
3
1,343
I'm an experienced git user now working with people who use Mercurial. I really miss 'git gui' for helping me with my commits. I see that two tools, [qct](http://qct.sourceforge.net/) and [hgct](http://repo.or.cz/w/hgct.git), both support Mercurial. The things I like best about git gui is that it shows all uncommitted files (and untracked files) and makes it easy for me to add whole files or individual diff hunks into a commit/changeset. With that in mind, , qct or hgct? And from your experience, , and if so what are they? --- ## EDIT I installed qct, hgct, and tortoisehg on a standard Debian testing system. Of the three, qct was the only one to work out of the box. But to do anything interesting, it seems to require a third-party tool like diffmerge. (The web site claims otherwise, but Debian has not yet caught up to reality.) I found qct quite frustrating. Problems include: - - - My tortoisehg installation experience was frustrating. `.deb` files are promised on the web site, but they do not exist. Pulling from the latest stable version gave me a tool that simply produced a stack trace on every invocation. (I found a fix, but really!) After upgrading to the latest Debian hg, however, . It is far and away the best approximation to git gui. And as an afterthought, hgct was a clear loss: ![picture of hgct lossage on Debian testing](https://www.cs.tufts.edu/~nr/stackoverflow/images/hgct.png) .
Which is the better commit tool, qct or hgct/gct?
CC BY-SA 2.5
0
2009-07-01T19:23:45.103
2018-02-28T11:44:57.293
2017-02-08T14:13:14.370
-1
41,661
[ "git", "mercurial", "git-gui" ]
1,071,398
1
1,113,593
null
0
991
I have written an apex class that will create a PDF quote and attach it to an opportunity. I'm trying to figure out how I can access those attachments when I go to send an email from within SalesForce and then click on Attach File. ![alt text](https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000000jYJS&oid=00D80000000bJcu) I want to figure out how to see another location in the drop-down show in the image above that has the PDFs attached to the opportunity.
Add a new file location to the SalesForce File Selector Drop-down
CC BY-SA 2.5
null
2009-07-01T21:05:59.217
2011-05-10T16:54:44.250
2011-05-10T16:54:44.250
21,234
2,863
[ "salesforce", "apex-code" ]
1,071,728
1
1,071,750
null
13
18,131
I am having trouble getting a background-image to overlay the border of another div. We have a sidebar panel with various sidebars, including a navigation menu. To the right is the content panel. We'd like anything selected on the sidebar to appear connected to the content panel: ![alt text](https://imgur.com/8ACzR.jpg) In the example above, there is a background image on the Personal Info `<li>` tag. I'd like to extend this image one pixel to the right so that the line next to the selected value isn't visible. Here is my CSS for the submenu (selected) and the Content area to the right: ``` .submenu-item li span{ padding: 4px 0 4px 16px; min-height: 16px; border-bottom:0px; } .submenu-item li{ font-size:12px; border: none; padding: 0px 0 0px 16px; } .submenu-item span.Active{ background-image: url(../images/submenu-select.png); background-repeat: no-repeat; } #Content { margin-left:190px; border-left: 1px solid #b0b0b0; padding: 20px; background: #FFFFFF; min-height:600px; } ``` Is there a way to do this other than putting a right border on my sidebar (and excluding it on the list item tag)?
Create CSS background image that overlays border?
CC BY-SA 2.5
0
2009-07-01T22:52:44.587
2009-07-02T00:40:44.230
null
null
257,954
[ "html", "css" ]
1,071,959
1
1,072,039
null
1
313
Take a look at the image below. I defined the red boxes inside the blue box however they drift left into the black box. Interestingly enoguh, in older browsers or with compatibility mode checked, they look the way I want them to. It also looks the way I wish it to look in VS2008. Does any one have any ideas? Here is the CSS ``` body { } .left { border: solid 1px black; width: auto; padding: 20px; height: 750px; float: left; font-family: Calibri; font-size: small; } .right { border: solid 1px blue; width: 750px; height: 750px; font-family: Calibri; font-size: small; padding: 20px; } ``` ![alt text](https://imgur.com/2IRYO.png)
CSS Issue with aligning panels within panels
CC BY-SA 2.5
null
2009-07-02T00:24:45.213
2009-07-02T02:19:23.343
2009-07-02T02:19:23.343
120,226
127,257
[ "html", "css", "alignment" ]
1,072,401
1
1,072,464
null
31
16,786
I've inserted a UITableViewController and it's corresponding UITableView into a simple IB document. The goal is to include the UITableView inside of a parent UIWindow (or UIView) with other "stuff" (anything really) adorning the table. Here's what that might look like in Interface Builder. ![enter image description here](https://i.stack.imgur.com/7t9jb.png) I've tried this numerous times and always get to the same place. 1. Build a working subclass of UITableViewController filled with data 2. Customize the UTableView and it's cells including tap targets 3. Add the newly created UITableViewController into an IB document 4. Drag the UITableView out of the UITableViewController and into the main UIView 5. Wire up the UITableViewController to the UITableView 6. Note: adding the UITableViewController in code results in the same problem When running the app in the iPhone emulator or on a device the table displays correctly, but crashes the first time you try and interact with it. A scroll, a tap, anything crashes the app. This seems to be a delegate problem, like the UITableView doesn't know how to communicate back to the UITableViewController, but I have no idea how to correct the problem. So far I have been able to get by by customizing the tableHeaderView to get layouts that suffice, but I'd really prefer to have the other technique work.
Can you add a UITableViewController's TableView to another View?
CC BY-SA 3.0
0
2009-07-02T03:58:33.900
2013-04-17T18:05:54.737
2013-04-17T18:05:54.737
664,177
111,321
[ "iphone", "objective-c", "interface-builder", "uitableview" ]
1,072,574
1
null
null
0
218
I have to write kind of a complicated query to get some statistics for the rules in our system for each Agency we have in our database. It looks something like this: ![alt text](https://imgur.com/wwGyP.png) There will be an arbitrary number of columns (rules) and rows (agencies) for this data. For example, here there are 5 main rule columns shown, but this could just as easily be 1 or 2 columns instead. Each column consists of 3 numbers (Flagged, Percent and Days). What I can't even get my brain around is what datastructure should I even return from my database to represent this? Eventually I need to construct something that looks like this in my ASP.NET MVC view, but right now I'm just trying to get the data out of the database and represent it in a logical datastructure that will be easy to work with when constructing this table. What data structure should I use to represent my tabular data with an arbitrary number of columns/rows? If you had to return this data out of the database in a LINQ query, what kind of container would you put it in?
What datastructure would you use to represent this format of data?
CC BY-SA 2.5
null
2009-07-02T04:54:47.933
2009-07-02T05:03:55.207
null
null
64,878
[ "asp.net-mvc", "linq", "data-structures", "model" ]
1,073,336
1
1,084,899
null
223
178,361
I have a line from A to B and a circle positioned at C with the radius R. ![Image](https://i.stack.imgur.com/QpgMZ.png) What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred?
Circle line-segment collision detection algorithm?
CC BY-SA 3.0
0
2009-07-02T09:15:10.203
2022-03-22T16:02:35.563
2014-12-06T23:51:48.977
202,229
56,763
[ "algorithm", "math", "line", "collision-detection", "geometry" ]
1,073,606
1
1,073,628
null
76
76,043
In a similar way that generates a sawtooth wave. It doesn't have to be continuous. here is what i mean: ``` int m = 10; int x = 0; int i = 0; while (i < m*3) { printf("%d ", x); x++; x = x % m; i++; } ``` generates a sequence 0..9, three times which looks like this: ![sawtooth wave graph](https://i.stack.imgur.com/1C6L1.png) The one-liner in this case is --- What I want is this: ![triangle wave graph](https://i.stack.imgur.com/jGJv5.png) If you know one-liners for the other wave forms (sine, square), that would be good to know as well. : everyone's answers have been very helpful and I have a follow-up question. What would be added to the triangle wave function to make the slope of the lines curve in or out like this: ![bulging waveforms](https://i.stack.imgur.com/BAxer.png) , your varied answers helped me see the problem from a larger perspective. Special thanks to Noldorin for his take on extending the equation to quadratic curves.
Is there a one-line function that generates a triangle wave?
CC BY-SA 3.0
0
2009-07-02T10:23:07.227
2015-07-27T10:46:53.623
2015-07-27T10:46:53.623
411,022
23,973
[ "c" ]
1,073,706
1
1,073,731
null
1
1,899
I'm loading a 8bppIndexed greyscale image into memory and reading the pixel values. The problem is that the values I am getting from the pixels do not seem to match the actual image, they are always darker. My image is a simple grey gradient like this: ![alt text](https://farm3.static.flickr.com/2591/3681486860_85d9189f90_o.jpg) The bottom right pixel is returning 191 and the top left 0. The top left is actually 64 and bottom right is 255. Here is how I am loading my image: ``` Bitmap threshImg = new Bitmap(@"C:\grey.bmp"); ``` Checking the PixelFormat confirms it is in Format8bppIndexed. So I read the bottom right pixel and top left like so: ``` BitmapData data = threshImg.LockBits(new Rectangle(0, 0, rectWidth, rectHeight), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed); unsafe { byte* pixel = (byte*)data.Scan0.ToPointer(); int topVal = (int)(byte)pixel[0]; int bottomVal = (int)(byte)pixel[((threshImg.Height * threshImg.Width)) - 1]; } threshImg.UnlockBits(data); ``` If I convert the image to 24bppRbg (and adjust the code accordingly) I see the correct colour values in the respective corners. Anyone know why I'm getting darker values when using an 8bppIndexed image?
Greyscale darkening problem with Bitmap image in C#
CC BY-SA 2.5
null
2009-07-02T10:52:25.373
2009-07-06T02:22:24.423
2017-02-08T14:13:14.713
-1
3,614
[ "c#", "image", "pointers", "image-processing" ]
1,077,171
1
1,077,277
null
1
2,564
I am creating a business application that has a variable width sidebar and content area, along with a footer. For the life of me, I can't figure out how to make the footer ALWAYS display correctly using CSS, regardless of sidebar height. Here's an illustration of the issue: ![alt text](https://imgur.com/NBQBR.jpg) The footer and sidebar is fine if the content area is larger than the sidebar, but not the reverse (the [faux columns](http://www.alistapart.com/articles/fauxcolumns/) technique doesn't seem to work with a footer, and the [equal height with footer](http://www.ejeliot.com/blog/61) technique only seemed to work if the sidebar is shorter). Any suggestions? I found an answer here that only worked for IE6, but nothing else just using CSS. I'm tempted to make my life easy and use TABLEs, but either way I'd love to know how to do this w/ CSS (a little javascript wouldn't hurt, but w/o is better).
Equal height columns w/ footer using CSS?
CC BY-SA 2.5
null
2009-07-02T23:21:07.660
2009-08-07T08:21:46.547
null
null
257,954
[ "html", "css" ]
1,078,146
1
1,078,209
null
323
167,800
I have run into a bit of a problem here: I had a problem-specific branch `28s` in Git, that I merged in the general `develop` branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge `28s` into `develop`, but git-merge command sees the original merge, and happily announces that all is well and branches have been already merged. What do I do now? Create a 'Revert "Revert "28s -> develop"" ' commit? Doesn't seem to be a good way to do it, but I can't imagine any other at the moment. What the tree structure looks like: ![Git log output](https://imgur.com/uhvLD.png)
Re-doing a reverted merge in Git
CC BY-SA 3.0
0
2009-07-03T07:15:28.257
2021-04-22T04:38:19.587
2016-10-11T16:11:37.723
2,747,593
123,144
[ "git", "git-merge", "git-revert" ]
1,080,638
1
1,081,021
null
4
3,449
I need to initialize some three dimensional points, and I want them to be equally spaced throughout a cube. Are there any creative ways to do this? I am using an iterative Expectation Maximization algorithm and I want my initial vectors to "span" the space evenly. For example, suppose I have eight points that I want to space equally in a cube sized 1x1x1. I would want the points at the corners of a cube with a side length of 0.333, centered within the larger cube. A 2D example is below. Notice that the red points are equidistant from eachother and the edges. I want the same for 3D. ![Equidistant points](https://i.stack.imgur.com/V2HfW.png) In cases where the number of points does not have an integer cube root, I am fine with leaving some "gaps" in the arrangement. Currently I am taking the cube root of the number of points and using that to calculate the number of points and the desired distance between them. Then I iterate through the points and increment the X, Y and Z coordinates (staggered so that Y doesn't increment until X loops back to 0, same for Z with regard for Y). If there's an easy way to do this in MATLAB, I'd gladly use it.
Equidistant points across a cube
CC BY-SA 3.0
0
2009-07-03T19:53:33.127
2017-09-26T13:00:56.570
2017-09-26T13:00:56.570
3,923,281
111,327
[ "algorithm", "matlab", "math", "3d", "expectation-maximization" ]
1,081,132
1
1,081,210
null
3
810
I'm modeling a force-based physics simulation where several particles are interacting with each other. The particles can move in such a way that a static viewport can easily lose track of them (imagine the whole group of particles moving off the screen to the right and the viewport displaying a blank background). My current solution is to simply track the "center" of the particles by finding the min/max of the x's and y's and make the viewport's middle follow that. It works fine (no need to find the true center of mass). Here's a visual: ![Viewport](https://i581.photobucket.com/albums/ss259/colithium/Viewport.png) My problem is I'm attempting to add the ability to manually drag particles around with the mouse. I haven't found an elegant way to do this. The problem is the translation between viewport coordinates and simulation coordinates is constantly changing because the viewport follows the particles' center. When I mouse down on a particle I want it to have a fixed location in the simulation (it ignores all forces on it). When I move the mouse with the button depressed I want the particle to move in the simulation. I have achieved this. However, it produces unpleasant side-effects because of the viewport and the other particles that are still in motion. The particle isn't moving in the simulation when the mouse is depressed and stationary but it is moving on screen because the center of all the particles changes and the viewport adjusts accordingly. The cursor is stationary so the particle "moves" out from under it. When the mouse is moved ever-so-slightly, the particle teleports back under the cursor because the cursor's new position represents radically different simulation coordinates. --- I've already thought of: - - - But they all have other bad side-effects or take away value from the simulation. Also, I think this question is language and platform agnostic so don't attach literal and implementation-specific meanings to "viewport", "viewport coordinates", or "simulation coordinates". Treat them as generic graphics concepts.
Moving Objects in Center-of-Mass Viewport
CC BY-SA 2.5
null
2009-07-03T23:31:41.707
2009-07-04T00:37:35.520
2017-02-08T14:13:16.060
-1
61,332
[ "language-agnostic", "graphics", "viewport" ]
1,081,302
1
1,081,310
null
23
68,714
: A person has zero, one or many pets. Using Linq to Sql, the need is to get an `IQueryable` list of pets for the given personID. Here's the poorly mangled/butchered/obfuscated portion of the ERD: ![alt text](https://i.stack.imgur.com/sbEHt.jpg) ``` public IQueryable<Pet> GetPersonPets(int personID) { var personPets= from p in Person where p.ID == somePersonID select p.Pets; return personPets; //fail // return (IQueryable<Pet>)personPets //also fail // return personPets.AsQueryable<Pet>() //also fail } ``` : Direct casting didn't work: `(IQueryable<MyType>)` Calling collection method `AsQueryable` didn't work: `.AsQueryable<MyType>()` : How can you cast the results of the LinqToSql query properly to `IQueryable`?
Cannot implicitly convert type IEnumerable<T> to IQueryable<T>
CC BY-SA 3.0
0
2009-07-04T01:41:34.267
2015-06-20T02:17:07.977
2015-06-20T02:17:07.977
1,159,643
23,199
[ "linq", "linq-to-sql", "collections", "iqueryable" ]
1,082,683
1
1,082,853
null
5
511
I have a weird problem where after setting `nocheck` on a foreign constraint and re-enabling it, I am getting a same out-dated execution plan that was used with `nocheck` on. Why would SQL server generate an execution plan as if foreign constraint `FKBtoA` is disabled even after adding the check again with following statement? ``` alter table B check constraint FKBtoA ``` --- So far dropping foreign constraint and readding it worked. ``` alter table B drop constraint FKBtoA alter table B add constraint FKBtoA foreign key (AID) references A(ID) ``` But for really big tables, this seems like an overkill - Is there a better way? I had to add `WITH CHECK` in alter statement like following to get the old execution plan ``` alter table B WITH CHECK add constraint FKBtoA foreign key (AID) references A(ID) ``` --- Here is a full SQL statement ``` create table A ( ID int identity primary key ) create table B ( ID int identity primary key, AID int not null constraint FKBtoA references A (ID) ) select * from B where exists (select 1 from A where A.ID = B.AID) alter table B nocheck constraint FKBtoA GO select * from B where exists (select 1 from A where A.ID = B.AID) alter table B check constraint FKBtoA GO select * from B where exists (select 1 from A where A.ID = B.AID) ``` --- Here is the screenshot of execution plans per each `SELECT` statement Before disabling foreign key constraint ![alt text](https://farm3.static.flickr.com/2528/3687888854_73caf86996_o.png) After disabling foreign key constraint ![alt text](https://farm4.static.flickr.com/3567/3687888860_e1b564ab72_o.png) After re-enabling foreign key constraint ![alt text](https://farm3.static.flickr.com/2548/3687888870_7e30d1d2f5_o.png)
Execution plan oddity after re-enabling foreign key constraint
CC BY-SA 2.5
0
2009-07-04T17:56:04.350
2011-06-08T16:54:12.453
2017-02-08T14:13:17.087
-1
4,035
[ "sql", "sql-server", "tsql", "sql-execution-plan" ]
1,082,901
1
1,082,935
null
1
3,478
I'm attempting to solve the Project Euler [Problem 8](https://projecteuler.net/problem=8) with C++, and the problem is to find the greatest product of 5 consecutive numbers in a 1000 digit number. So I'm trying to figure out how to use file io to read the numbers into a char array that I will later convert to integers. The read works except for the last third of the last line I get weird lines, a green lantern symbol, and a heart. ![alt text](https://imgur.com/QNgbH.png) ``` #include "stdafx.h" #include <iostream> #include <fstream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int maxNum = 1000; char buffer[maxNum]; char *bufferPointer = buffer; ifstream infile; infile.open("numberlist.txt"); if (!infile) { cerr << "Error: Open file failure" << endl; return -1; } infile.read(bufferPointer, streamsize(maxNum)); infile.close(); cout << buffer << endl; return 0; } ``` This is what the txt file contains: ``` 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450 ``` EDIT: Right after I posted this problem I just realized the problem might be the fact that read is reading the new lines and thus the array isn't big enough to hold it all.
Reading input from file prints strange symbols
CC BY-SA 3.0
null
2009-07-04T20:15:29.497
2015-01-22T17:56:59.387
2015-01-22T17:56:59.387
null
90,537
[ "c++", "file-io" ]
1,083,769
1
1,083,789
null
0
3,790
Can anyone list the requirements (i.e. any books, tutorials, libraries etc) to build an application in Java, which could communicate with my MySQL Database which is running on web. I am running an online webstore built in PHP and MySQL. I would like to build a Java Application through which I can (CRUD) Products, Categories, Orders etc. My Database is already built in MySQL and all the data is present in my online site. So I only need to work on a GUI App which can access my Store's data. Here is an example application built in Delphi which acts as a Front End (Store Manager) for oscommerce shopping cart. ![alt text](https://www.mariovaldez.net/software/oscpmwin/screenshots/200705/product_list_menu.png) What technologies do I need for creating Windows GUI in java and Database Application to communicate with my Online Store's Database. ? I have found some tutorials: [https://web.archive.org/web/20120126005135/http://www.netbeans.org/kb/docs/java/gui-db.html](https://web.archive.org/web/20120126005135/http://www.netbeans.org/kb/docs/java/gui-db.html) [https://web.archive.org/web/20101125223754/http://www.netbeans.org/kb/docs/java/gui-db-custom.html](https://web.archive.org/web/20101125223754/http://www.netbeans.org/kb/docs/java/gui-db-custom.html) [https://web.archive.org/web/20090228020221/http://www.netbeans.org/kb/articles/mysql-client.html](https://web.archive.org/web/20090228020221/http://www.netbeans.org/kb/articles/mysql-client.html) [https://web.archive.org/web/20110923093326/http://www.netbeans.org/kb/docs/java/gui-db.html](https://web.archive.org/web/20110923093326/http://www.netbeans.org/kb/docs/java/gui-db.html) Are the above tutorials enough? : 1). JDBC Practical Guide for Java Programmers 2). JDBC API Tutorial and Reference, 3rd Edition Would these be enough for a beginner?
What is required for building Java Windows Application to access Online MySQL Database
CC BY-SA 4.0
0
2009-07-05T09:51:46.927
2019-11-25T04:22:02.607
2019-11-25T04:22:02.607
1,033,581
103,132
[ "java", "mysql", "user-interface", "jdbc" ]
1,083,939
1
null
null
0
1,350
My idea is that a PNG overlaying some text, with transparency ranging from 0% to 100%, all colored in the same color as the CSS background, would fade out the text underlying it. Turns out the transparent PNG is visible also in the areas where it's supposed to be transparent. Also, the colors of the PNG and the CSS are not the same - even though I create them with the same hex-values. An image is included. I have tried creating the resource in Illustrator, Photoshop and Fireworks. I have tried removing the gamma-information (gAMA) with pngcrush, PNGSquash and ImageMagick. The problem is the same on Firefox as in Safari. If anyone knows how to solve this -- or if it's even possible -- I'd love to hear it! Thank you in advance. ![the gradient is visible even though transparent](https://files.getdropbox.com/u/12637/gradient_fail.png)
Aligning a transparent PNG over same-colored CSS background
CC BY-SA 2.5
0
2009-07-05T12:02:49.330
2009-07-05T15:59:46.677
2017-02-08T14:13:17.757
-1
9,872
[ "css", "png", "transparency", "colors" ]
1,084,873
1
1,084,968
null
16
12,565
I'm looking to write a Truth Table Generator as a personal project. There are several web-based online ones [here](http://www.brian-borowski.com/Software/Truth/) and [here](http://www-cs-students.stanford.edu/~silver/truth/). ![alt text](https://imgur.com/t1S9u.png) `(Example screenshot of an existing Truth Table Generator` I have the following questions: - - - Can anyone provide me with tips concerning the parsing of these arbitrary expressions and eventually evaluating the parsed expression?
How can I build a Truth Table Generator?
CC BY-SA 2.5
0
2009-07-05T21:40:44.167
2015-04-25T14:43:23.430
2009-07-06T06:44:10.487
47,738
64,878
[ "c#", "parsing", "boolean-logic", "parser-generator", "truthtable" ]
1,089,688
1
1,095,731
null
1
1,392
I have a `ListView` that I am populating with items from an `ObservableCollection`. All was working well until I decided to add a second list view to filter some of the items. What I have setup right now is that the main listview has `ItemGroup` objects as the rendered items, with the item being shown being the first in the item group. Envision a hashtable with buckets and the item being rendered on the list is the item in the group that is the most current. I have a button that, when clicked, will show another listview with all of the items from that "bucket". However, all I am getting in the new listview is blank entries for the items. I am seeing their item styled background, but the celltemplate appears to be empty. My only guess is that there is a reference issue because some of the items are already in another `ItemSource`. I have attached a screenshot: ![issue](https://i.stack.imgur.com/tRU5y.png) Here is my `DataTemplate`: ``` <DataTemplate x:Key="ResultListGroupViewCellTemplate"> <!--<DockPanel>--> <Grid Width="Auto" Margin="0,5,5,5" ShowGridLines="False"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> </Grid.RowDefinitions> <StackPanel Grid.Column="0"> <Image Margin="2" Source="{Binding Path=StrengthImage}" Height="20" Width="20" HorizontalAlignment="Left" /> <TextBlock Text="{Binding Path=AddedDate}" Margin="0,3,0,0" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" FontFamily="Tahoma" FontSize="10" FontStyle="Italic" HorizontalAlignment="Left" /> </StackPanel> </Grid> <!--</DockPanel>--> </DataTemplate> ``` Here is how I setup the databinding (MatchApiObject's are the objects used for binding in the above `DataTemplate`): ``` groupViewCollection = new ObservableCollection<MatchApiObject>(m.GroupList.OrderBy(mi => mi.AddedDate)); groupViewListView.DataContext = groupViewCollection; ``` And the groupViewListView itself: ``` <ListView Name="groupViewListView" Foreground="#FF333333" ItemContainerStyle="{StaticResource ListViewMatchItemStyleNotSelected}" SelectionMode="Single" ItemsSource="{Binding}" BorderThickness="0" SelectionChanged="contactsList_SelectionChanged" AlternationCount="2" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > <ListView.View> <GridView x:Name="groupViewListViewGridView" AllowsColumnReorder="False"> <GridView.ColumnHeaderContainerStyle> <Style TargetType="GridViewColumnHeader"> <Setter Property="Visibility" Value="Collapsed" /> </Style> </GridView.ColumnHeaderContainerStyle> <GridViewColumn CellTemplate="{StaticResource StrengthValMatchColumnCellTemplate}" Width="0" Header="Strength" /> <GridViewColumn CellTemplate="{StaticResource DateMatchColumnCellTemplate}" Width="0" Header="Date" /> <!--<GridViewColumn CellTemplateSelector="{StaticResource myMatchListItemTemplateSelector}" Width="Auto" Header="Result" />--> <GridViewColumn CellTemplate="{StaticResource ResultListGroupViewCellTemplate}" Width="Auto" Header="Result" /> </GridView> </ListView.View> </ListView> ``` EDIT: When I debug, the listview has the proper items in the binding (for example, CurrentItem shows the proper object that should be used for binding), but for some reason they aren't showing up.
WPF ListView not rendering templates
CC BY-SA 3.0
0
2009-07-06T23:38:13.310
2015-06-20T02:39:34.373
2015-06-20T02:39:34.373
1,159,643
32,140
[ "c#", "wpf", "listview", "datatemplate" ]
1,089,719
1
null
null
3
11,490
I'm trying to create a curve that passes through three given points in Java (I'm drawing the curves through a class that extends JPanel). How can I make it? ![enter image description here](https://i.stack.imgur.com/loG65.png)
How to draw a curve that passes through three points?
CC BY-SA 3.0
null
2009-07-06T23:47:36.910
2013-11-11T11:14:06.590
2013-03-04T21:44:11.690
1,730,272
null
[ "java", "java-2d" ]
1,090,690
1
1,092,937
null
1
2,147
I'm implementing some boundary based clustering on the server end of markers to display on my google maps. What I'm doing is that I have a function that is called everytime the map is moves or panned or zoomed which takes the bound of the map and makes an ajax call which in turn the server side script runs a simple sql query to retrieve the markers and clusters them. SO far teh clustering part is working nicely however sometimes the getBounds doesn't seem to be sending the correct boundaries I feel. Like I may pan a map a bit on the side and regions which used to have markers now all of a sudden don't have markers and the map is blank. I checked the sql query and from the query itself it shows an outrageously different bounds than what would be expected. Take a look at the regions below: ![Orginal WitH Markers](https://i.stack.imgur.com/qq6jM.jpg) ![No markers](https://i.stack.imgur.com/q1Myc.jpg) The first one shows all the markers. The one following however has just moved a bit to the top and left but half the region is the same as in the previous picture however there are no markers at all. I have isolated the issue to be with the getBounds function of the maps. This is my javascript code which gets the bounds and makes the call: ``` var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); var data = {ne:northEast.toUrlValue(), sw:southWest.toUrlValue(), zoom:map.getZoom()}; //something getting messed up in the code above this point $.ajax({ type: "POST", url: 'maps/get-markers', data: {object:$.toJSON(data)}, dataType: 'json', success: function(response) { //code to add markers } }); ``` On my server side code this is the php used to get the items based upon the coordinates: ``` $data = Zend_Json::decode(stripslashes($this->_request->getParam('object'))); //retrieve the variables from the GET vars list($nelat, $nelng) = explode(',', $data['ne']); list($swlat, $swlng) = explode(',',$data['sw']); //clean the data $nelng = (float)$nelng; $swlng = (float)$swlng; $nelat = (float)$nelat; $swlat = (float)$swlat; $ubound = $swlng > $nelng ? $swlng : $nelng; $lbound = $swlng > $nelng ? $nelng : $swlng; $sql = 'SELECT `a`.* FROM `locations` AS `a` WHERE (a.`longitude` > $lbound) AND (a.`longitude` < $ubound) AND'; $ubound = $swlat > $nelat ? $swlat : $nelat; $lbound = $swlat > $nelat ? $nelat : $swlat; $sql .= ' (a.`latitude` >= $lbound) AND (a.`latitude` <= $ubound)'; ``` I'm suspecting its the getbounds function in the javascript but need to fix it asap. Any ideas please :(
Google Maps - Panning and Zooming into areas - markers not appearing when I zoom in or pan
CC BY-SA 4.0
null
2009-07-07T06:32:05.387
2019-03-27T09:01:40.230
2019-03-27T09:01:40.230
4,751,173
89,752
[ "php", "javascript", "google-maps", "coordinates" ]
1,092,684
1
1,100,679
null
4
360
An object is positioned at and wants to move to . I want to calculate a movement vector there that doesn't move within the of the to-be-avoided points in . So if the move vector (B-A) normalized and multiplied with the objects speed would bring it within D of any point in C the vector is rotated so that it doesn't. This is in two dimensions. Also, if this operation has a name, please make a comment or edit this question yourself as I had no idea of what to call it. Also, my first instinct was to divide the active area into nodes and run a A* but I want to try the mathematical approach on this one, a few experiments with flocking gives me the impression that it can be done. (from comments): This image is very close to the solution I want: ![Path](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Motion_planning_configuration_space_curved_valid_path.svg/180px-Motion_planning_configuration_space_curved_valid_path.svg.png) Assuming we start at the point to the left, we start turning right towards the goal (the other point), we detect a wall on the right so we stop turning and move forward. The wall is gone so we are allowed to start turning towards the goal again, and so on. I know this may cause the object to not get there at all, but I want to define a , not necessarily a , if you know what I mean. : Translating the active area into a set of nodes might prove inefficient. A* and other heuristic graph traversal algorithms are great for low dimensional problems. But the area I want to move across is infinite in size and only has a handful of obstacles scattered across it. The nodes themselves, or rather the potential positions, are infinitely small. This could of course be optimized with a quad tree of some sort but I have a feeling simple movement vectors that are in some way rotated and interpolated can solve this as well.
Motion planning without a graph across an infinite plane
CC BY-SA 2.5
null
2009-07-07T14:31:18.690
2009-07-08T21:38:23.083
2017-02-08T14:13:19.580
-1
56,763
[ "algorithm", "language-agnostic", "math", "2d", "motion-planning" ]
1,093,328
1
1,099,251
null
1
5,136
I want to align a Custom Button Field (the Star on the Screenshot) to the center in a Horizontal Manager ![alt text](https://files.getdropbox.com/u/357576/saves/bb_screen_01.jpg) Definition of the HFM ``` final HorizontalFieldManager _navigation = new HorizontalFieldManager(HorizontalFieldManager.NO_VERTICAL_SCROLL | HorizontalFieldManager.FIELD_VCENTER | Field.USE_ALL_WIDTH) { protected void paint(Graphics graphics) { graphics.setGlobalAlpha(100); int[] xInds = new int[]{0, getExtent().width, getExtent().width, 0}; int[] yInds = new int[]{0, 0, getExtent().height, getExtent().height}; final int[] cols = new int[]{Color.WHITE, Color.WHITE, color_computacenter_light_blue, color_computacenter_light_blue}; graphics.drawShadedFilledPath(xInds, yInds, null, cols, null); super.paint(graphics); } protected void sublayout(int maxWidth, int maxHeight) { super.sublayout(maxWidth, maxHeight); setExtent(maxWidth, navigation_vertical_manager_height); } }; ``` Custom Field (partial) ``` public class NavigationButton extends Field { private String label; Bitmap img; int horizontalPadding = 4; int verticalPadding = 10; static int height; static int weight; ToolTip _tooltip; public NavigationButton(String name, Bitmap img) { label = name; this.img = img; this.height = img.getHeight() + 4; this.weight = img.getWidth() + 2; } public NavigationButton(String name, Bitmap img, long style) { super(style); label = name; this.img = img; this.height = img.getHeight() + 4; this.weight = img.getWidth() + 2; } protected void layout(int maxWidth, int maxHeight) { setExtent(maxWidth, maxHeight); // setExtent(Math.min(weight, maxWidth), Math.min(height, maxHeight)); } protected void paint(Graphics graphics) { // Draw background graphics.setGlobalAlpha(255); if(isFocus()) { graphics.setColor(0x005AA1); graphics.drawRoundRect(0 ,0 , weight + 1, height + 1, 2, 2); } if (img != null) { graphics.drawBitmap(0, 0 , img.getWidth(), img.getHeight(), img, 0, 0); } } ``` [...] Any Ideas, what I'm doing wrong?! Thanks!
Blackberry - Field - Horizontal alignment
CC BY-SA 2.5
null
2009-07-07T16:19:31.167
2011-12-04T16:50:37.237
2017-02-08T14:13:19.917
-1
107,004
[ "java", "blackberry", "user-interface" ]
1,095,073
1
1,182,982
null
0
551
After countless tries I got my animation animating right (Why oh why is the layer's coordinate system Y flipped from the view's coordinate system, I will never guess) but it seems that it degrades the image quality for some reason: ![](https://imgur.com/PZOR0.png) (green circled are examples of the original good quality images, the red circled is to emphasize the difference. [original image.](https://imgur.com/PZOR0.png)). Close up: ![alt text](https://imgur.com/kq5L6.png) (The lower images are as supposed to be, except the left one. The rest are pixelated.) The code I'm using (approximately, you can see the exact one in the image.): ``` CGImageRef *ir = [UIImage imageNamed:@"something"].CGImage; CALayer *cl = [CALayer layer]; cl.contents = ir; CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; anim.duration = 5; anim.autoreverses = NO; anim.removedOnCompletion = NO; anim.fromValue = **something** anim.toValue = **anotherthing** [cl addAnimation:anim forKey: @"fallDown"]; ``` My questions: 1. Why is there such a difference between the images? How do I fix it? 2. How is my code? I just can't find enough examples / explanations about the animation types and all stuff you can do with it (for example all of the animatable properties). And I am learning the SDK by myself (I have iPhone in Action but it's quite basic) and there is no one I know to review my code :)
Image getting pixelated when used as part of an animation in iPhone animation
CC BY-SA 2.5
null
2009-07-07T21:49:31.623
2009-08-16T14:00:07.727
2009-07-07T21:56:37.787
23,942
23,942
[ "objective-c", "iphone", "core-animation", "core-graphics" ]
1,095,980
1
1,096,008
null
16
6,076
I can't seem to find any help on this but under the Net tab in Firebug, one of my sites is showing red highlighted items. Unfortunately the site is protected right now so I can't post the link. ![Firebug](https://imgur.com/hueWT.gif) Can anyone explain what this means?
What does RED text mean in the Firebug net tab?
CC BY-SA 3.0
0
2009-07-08T03:17:45.987
2012-01-19T15:04:32.443
2012-01-19T15:04:32.443
110,204
null
[ "firebug" ]
1,096,526
1
1,096,537
null
1
514
We are giving a demo in a couple days and I have to go in and mock-up a lot of our views. This includes making a lot of fake data, etc. I figured I would drop in a loop and an extension method that returns random numbers so I don't have to make up this hard-coded data myself. Here is my view code: ``` <% for(int i = 1; i < 7; i++) { %> <tr> <td class="auditsTableAgencyElement">Agency <%=i %></td> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 30) %></td> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 100) %>%</td> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 20) %></td> <% foreach (var record in Model.Categories) { %> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 30) %></td> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 100) %>%</td> <td class="auditsTableResults"><%= Html.GetRandomNumber(0, 20) %></td> <% } %> </tr> <% } %> ``` Here is what my view looks like after doing this: ![alt text](https://imgur.com/UzUvv.png) Same numbers down the line. Are my requests for random numbers getting cached and returned to me? If so, how do I turn off this functionality for this method only? ``` public static string GetRandomNumber(this HtmlHelper html, int low, int high) { Random myRand = new Random(); return myRand.Next(low, high).ToString(); } ```
Why is my random number html extension method returning the same values?
CC BY-SA 3.0
null
2009-07-08T07:06:22.240
2011-08-28T17:12:04.497
2011-08-28T17:12:04.497
64,878
64,878
[ "asp.net-mvc" ]
1,097,006
1
1,097,122
null
120
216,014
I have a page with a row of about 10 `img`s. For readability of the HTML, I want to put a linebreak in between each `img` tag, but doing so renders whitespace between the images, which I do not want. Is there anything I can do other than break in the middle of the tags rather than between them? Edit: Here is a screenshot of what I have so far. I would like the book spine images to display in random combinations, using PHP. This is why I need separate `img` tags. ![Screenshot](https://i.stack.imgur.com/V50kO.jpg)
Removing whitespace between HTML elements when using line breaks
CC BY-SA 3.0
0
2009-07-08T09:13:06.900
2020-03-09T09:16:59.897
2014-09-27T06:04:57.780
1,402,846
49,376
[ "html", "css", "image" ]
1,097,923
1
null
null
3
1,449
I have a Java web application running in JBOSS with Tomcat with two web applications (contexts) running on it. A button press on one of the applications opens runs a javascript command to open a new window with a page from the other. The problem I seem to be having is that this raises a security alert in IE. with the following message: ![alt text](https://i.stack.imgur.com/IoSVn.jpg) I can't really ask my customer to add an exception to "http://" what are the likely causes for it not picking up the site? The browser is correctly pointed at the full url for the page (Ie www.something.net:8080/blah/somepage.jsp) the browser is IE7 with enhanced security running on windows 2003.
Issue with IE security on page opened from javascript
CC BY-SA 3.0
null
2009-07-08T13:01:10.660
2015-06-20T02:01:02.723
2015-06-20T02:01:02.723
1,159,643
20,400
[ "java", "javascript", "security", "internet-explorer" ]
1,098,350
1
1,106,586
null
0
533
When I try to generate a CRUD test for a new project I am getting a PHP Warning and a Fatal Error. The errors relate to files that it cannot find, however, I have checked and the files are definitely there. The error text is 'require_once(lib/model/map/QuestionMapBuilder.php): failed to open stream: No such file or directory in c:\webroot\askeet\lib\model\om\BaseQuestionPeer.php on line 547' What details of my project should I check? ![alt text](https://imgur.com/rfKN8.jpg)
Error with propel-generate-crud in Symfony 1.0
CC BY-SA 2.5
null
2009-07-08T14:12:06.233
2009-07-09T21:34:46.710
2009-07-09T15:15:40.437
42,106
42,106
[ "php", "command-line", "symfony1", "crud" ]
1,099,787
1
1,109,261
null
337
347,160
Having trouble with what I thought was a relatively simple jQuery plugin... The plugin should fetch data from a php script via ajax to add options to a `<select>`. The ajax request is pretty generic: ``` $.ajax({ url: o.url, type: 'post', contentType: "application/x-www-form-urlencoded", data: '{"method":"getStates", "program":"EXPLORE"}', success: function (data, status) { console.log("Success!!"); console.log(data); console.log(status); }, error: function (xhr, desc, err) { console.log(xhr); console.log("Desc: " + desc + "\nErr:" + err); } }); ``` This seems to work fine in Safari. In Firefox 3.5, the `REQUEST_TYPE` on the server is always 'OPTIONS', and the $_POST data does not appear. Apache logs the request as type 'OPTIONS': ``` ::1 - - [08/Jul/2009:11:43:27 -0500] "OPTIONS sitecodes.php HTTP/1.1" 200 46 ``` Why would this ajax call work in Safari, but not Firefox, and how do I fix it for Firefox? Here is a picture of the Firebug output: ![](https://i.stack.imgur.com/Tid8P.jpg)
jQuery $.ajax(), $.post sending "OPTIONS" as REQUEST_METHOD in Firefox
CC BY-SA 3.0
0
2009-07-08T18:26:00.663
2017-03-30T14:07:42.107
2013-01-22T15:00:28.333
1,249,581
135,121
[ "ajax", "firefox", "jquery-plugins", "jquery" ]
1,101,986
1
1,102,009
null
0
281
I'm generating an image out of text using php. My code works perfectly on my localhost and the text is generated fine. However on my online host it doesn't generate the whole text just bits and pieces of it. Like if I were to pass the text 'This is some text' to it - it would generate just maybe an S or t. The code is fine as it works perfectly on my localhost but doesn't run on the online host. It cant be that gd isnt on the host else it would not even generate part of the image. WHats going on here :( --- This is the GD CONfig on teh server - I don't think there is anything wrong with it ``` gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled ``` I'm just turning email addresses and fone numbers into one image. Heres an image of what the text should look like: ![localhost image](https://i.stack.imgur.com/JA8BJ.jpg) But this is what its rendering on the online: ![online image mess](https://i.stack.imgur.com/5U5th.jpg) --- I just found out something weird. If I try to create an image out of the text 'P P' it should create the following image which it does on my localhost. ![what I want](https://i.stack.imgur.com/mJ2I6.jpg) But on the online server its creating the image as so - the space is humongous and distorted. Could this be a hint as to why is it not rendering the text as it should. ![bad pic](https://i.stack.imgur.com/Ueut6.jpg) Please guys I need help here urgently :(.
Generating Image from text in php - not generating on my online host?
CC BY-SA 4.0
null
2009-07-09T05:34:41.943
2019-03-27T21:37:26.770
2019-03-27T21:37:26.770
4,751,173
89,752
[ "php", "image-processing" ]
1,102,716
1
1,102,780
null
35
4,569
Very occasionally, despite all testing efforts, I get hit with a bug report from a customer that I simply can't reproduce in the office. !["Works on my machine" syndrome]](https://i.stack.imgur.com/kaxff.png) [Apologies to Jeff](http://www.codinghorror.com/blog/archives/000818.html) I have a few "tools" that I can use to try and locate and fix these, but it always feels a bit like I'm knife-and-forking it:- - - - - - - Are there set procedures, or other techniques than anyone uses to resolve problems like this?
"Works on my machine" - How to fix non-reproducible bugs?
CC BY-SA 3.0
0
2009-07-09T09:11:07.800
2013-07-29T06:28:19.430
2013-07-29T06:28:19.430
1,488,917
1,737
[ "debugging", "testing" ]
1,104,016
1
1,104,832
null
2
2,047
There seems to be a fault with my access to directories on Team Foundation Server. See the image below. I'm the only one with this problem. All of the other clients can connect to the server fine, so it must be my local copy of Team Foundation Server thats gone haywire. Any ideas? ![enter image description here](https://i.stack.imgur.com/v5JEG.png)
Team Foundation Server (TFS) - can't browse folders properly using Visual Studio
CC BY-SA 3.0
null
2009-07-09T13:49:48.310
2016-10-30T08:25:20.623
2016-02-18T15:31:14.467
781,754
107,409
[ "tfs" ]
1,104,289
1
1,104,331
null
0
1,202
I got an app running on my SQL Server that is starting to slow down on a specific task. I ran SQL Profiler and noticed that the following query is taking an enormous (1-2 minutes) amount of time. Is there anything I can tune/change in the database? The PC10000 table in the statement below has approx. 119000 records. I also have the execution plan attached. ``` SELECT TOP 25 zProjectID, zTaskID, zTransactionNumber, zTransactionDate, zUserID, zCostCategoryDDL, zCostCategoryString, zSubCostCategory, zSubCostCategoryString, zDepartmentID, zJournalEntry, zPostingDate, zSalesPostingDate, zPeriodNumber, zTransactionDescription, zBillingDescriptionLine1, zBillingDescriptionLine2, zBillingDescriptionLine3, zBillingDescriptionLine4, zSalesAccountIndex, zSalesAccountString, zDistDocumentTypeDDL, zDistDocumentNumber, zDistSequenceNumber, zSalesDocumentTypeDDL, zSalesDocumentNumber, zSalesLineNumber, zDistHistoryYear, zSeriesDDL, zSourceDoc, zWebSource, zOrigDocumentNumber, zOrigDocumentDate, zOrigID, zOrigName, zExpenseStatusDDL, zApprovalUserIDCost, zAccountIndex, zAccountNumberString, zBillingStatusDDL, zApprovalUserIDBilling, zBillingWorkQty, zBillingWorkAmt, zQty, zQtyBilled, zUnitCost, zUnitPrice, zRevenueAmt, zOriginatingRevenueAmt, zCostAmtEntered, zCostAmt, zOriginatingCostAmt, zPayGroupID, zPayrollStatusDDL, zTotalTimeStatusDDL, zEmployeeID, zHoursEntered, zHoursPaid, zPayRecord, zItemID, zItemDescription, zUofM, zItemQty, zBurdenStatusDDL, zUserDefinedDate, zUserDefinedDate2, zUserDefinedString, zUserDefinedString2, zUserDefinedCurrency, zUserDefinedCurrency2, zNoteIndex, zImportType, DEX_ROW_ID FROM DBServer.dbo.pc10000 WHERE (zDistDocumentNumber in (select cast(JRNENTRY as varchar(20)) from DBServer..GL10001 where BACHNUMB = 'PMCHK00004283') or zSalesDocumentNumber in (select cast(JRNENTRY as varchar(20)) from DBServer..GL10001 where BACHNUMB = 'PMCHK00004283')) ORDER BY zProjectID ASC ,zTaskID ASC ,zTransactionNumber ASC ``` ![alt text](https://zq36tw.blu.livefilestore.com/y1p_FyzWCxkcIRFsKttE3LmJhBfCbtWhgzKKOUEv0lXa-37Pw097oJOl5GbMcKd197n9WL_EoG9MgxDGGchqkthnHZ05FDqxF-8/Execution%20Plan.png)
Tune Slow SQL Query
CC BY-SA 2.5
0
2009-07-09T14:36:35.180
2009-07-09T15:06:41.873
2017-02-08T14:13:22.623
-1
18,991
[ "sql-server", "sql-server-2000" ]
1,104,285
1
1,104,594
null
10
14,292
I have a number of relatively simple (auto-generated) graphs in graphviz dot format. These show the path through a state machine, but dot has a slightly confusing habit of deciding that two nodes must be on the same rank when I would like the graph to be in state order. I've tried a lot of settings (including the `:n` and `:s` and the `weight` listed below), but I cannot persuade dot to place the Third State the Fourth State. I have this problem with a lot of graphs: there seems to be something internal to dot that decides that it would be better if two nodes were on the same rank and there's nothing that can be done to override it. I've even had code that specifies that one node should be a `rank=sink`, but dot has decided to put another node below it anyway. Is there any way to suggest to dot that it's more important that the nodes are in order than any other constraint? The code that was used to generate the graph looks like this: ``` digraph { ERROR [label="Error"]; FirstSTATE [label="Initial State" URL="\ref FirstSTATE"]; FirstSTATE -> SecondSTATE; SecondSTATE [label="Second State" URL="\ref SecondSTATE"]; SecondSTATE -> ThirdSTATE; ThirdSTATE [label="Third State" URL="\ref ThirdSTATE"]; FourthSTATE [label="Fouth State?" shape="diamond"]; ThirdSTATE:s -> FourthSTATE:n [weight=50]; FourthSTATE -> FifthSTATE [label="Yes" ]; FourthSTATE -> ThirdSTATE [label="No"]; FifthSTATE [label="Fifth State" URL="\ref FifthSTATE"]; SixthSTATE [label="Sixth State?" shape="diamond"]; SixthSTATE -> ERROR [label="Yes" ]; SixthSTATE -> SeventhSTATE [label="No"]; FifthSTATE -> SixthSTATE; SeventhSTATE [label="Seventh State" URL="\ref SeventhSTATE"]; SeventhSTATE -> EighthSTATE; EighthSTATE [label="Eighth State" URL="\ref EighthSTATE"]; NinthSTATE [label="Ninth State?" shape="diamond"]; NinthSTATE -> TenthSTATE [label="Yes" ]; NinthSTATE -> EighthSTATE [label="No"]; EighthSTATE -> NinthSTATE; TenthSTATE [label="Tenth State" URL="\ref TenthSTATE"]; EleventhSTATE [label="Eleventh State?" shape="diamond"]; EleventhSTATE -> ERROR [label="Yes" ]; EleventhSTATE -> TwelfthSTATE [label="No" ]; TenthSTATE -> EleventhSTATE; TwelfthSTATE [label="Twelfth State" URL="\ref TwelfthSTATE"]; } ``` The graph currently looks like this: ![Dot Graph](https://i.stack.imgur.com/YfbIC.png)
How do you force rank on a node in dot?
CC BY-SA 3.0
0
2009-07-09T14:36:00.547
2021-11-04T16:42:07.503
2016-02-09T01:21:31.683
62,163
72,791
[ "graph", "graphviz", "dot", "state-machine", "graph-layout" ]
1,105,625
1
1,149,288
null
4
3,321
In company that I work for, I was given the opportunity to write an application, which would replace the old Excel workbook, which is used to plan the production queue. Because VBA was simple and Excel was easy to use, for few years this workbook was used by several people to plan/add changes/notes about current production status. Whole workbook has few feature's (additional information about products are stored in different sheets, etc), but is lacking many more. I sketched how it looks like (I recreated it from memory, simplified the layout, so it can be readable): ![workbook](https://imgur.com/eEnRX.jpg) This is only a sketch, but the original one is as ugly, impractical and limited as this one. I was hoping to create simple forms based application, which could be used by at least a few people simultaneously (each one having his own copy, though all copies would use single MS Access database for storing information). What do I need to know about if I plan to accomplish this? What are the guidelines for creating multiuser applications? I would also want to know if is there any way to recreate a similar layout using one of free/included .NET controls? Labels and alike are not the problem, but people need to move those colorful bars easily as well as add new ones in as easy as possible. I know that canvas-like controls exist in other languages and I was thinking about using one here. Is this a good choice or is there another, better one?
Visual C++ application as a frontend to MS Access database - multiuser data access and canvas-like GUI questions
CC BY-SA 2.5
null
2009-07-09T18:13:39.487
2009-07-19T05:21:10.380
2009-07-13T14:48:55.120
5,640
126,781
[ ".net", "database", "forms", "visual-c++", "canvas" ]
1,106,694
1
null
null
0
730
I was wondering if it's possible to reuse objects in web references in an ASP.NET Server control? (basically keeping the same web reference name) I have a few web services (.asmx) that I want to group with the same web reference name, however when I consume them using the same name they append a 1 at the end and with all object names. Right Click - Add Web Reference Enter URL of asmx Type "MyServices" in for Web Reference Name Repeat, Add Web Reference Type "MyServices" in for Web Reference Name And it adds it as "MyServices1" rather than grouping and reusing the same objects. This only appears to do this on ASP.NET Server Controls - any other project that I have ever created, standard c# console application, asp.net web application all group the objects and web reference names together. Am I missing a patch, upgrade, or is this just not possible with a Server Control? Just for a little background, I'm creating a control that I can drop into projects based on a single dll. I'm able to group the services in a test project if it's a web application, however they do not group in the Server Control project. Any help would be greatly appreciated! Thanks! Jamey An example is located here: ![http://imgur.com/6tqvQ.jpg](https://i.stack.imgur.com/lcjn3.jpg)
ASP.NET Server Control - Reuse Type/Objects in Web References
CC BY-SA 3.0
null
2009-07-09T22:08:58.667
2011-12-04T08:16:30.180
2011-12-04T08:16:30.180
84,042
null
[ "visual-studio-2008", "custom-server-controls" ]
1,106,741
1
1,113,597
null
12
11,844
I am having trouble displaying a raw YUV file that it is in NV12 format. I can display a selected frame, however, it is still mainly in black and white with certain shades of pink and green. Here is how my output looks like ![alt text](https://i.stack.imgur.com/cU579.png) Anyways, here is how my program works. (This is done in cocoa/objective-c, but I need your expert advice on program algorithm, not on syntax.) Prior to program execution, the YUV file is stored in a binary file named "test.yuv". The file is in NV12 format, meaning the Y plan is stored first, then the UV plan is interlaced. My file extraction has no problem because I did a lot testings on it. During initiation, I create a lookup table that will convert binary/8 bites/a byte/chars into respected Y, U, V float values For the Y plane this is my code ``` -(void)createLookupTableY //creates a lookup table for converting a single byte into a float between 0 and 1 { NSLog(@"YUVFrame: createLookupTableY"); lookupTableY = new float [256]; for (int i = 0; i < 256; i++) { lookupTableY[i] = (float) i /255; //NSLog(@"lookupTableY[%d]: %f",i,lookupTableY[i]);//prints out the value of each float } } ``` The U Plane lookup table ``` -(void)createLookupTableU //creates a lookup table for converting a single byte into a float between 0 and 1 { NSLog(@"YUVFrame: createLookupTableU"); lookupTableU = new float [256]; for (int i = 0; i < 256; i++) { lookupTableU[i] = -0.436 + (float) i / 255* (0.436*2); NSLog(@"lookupTableU[%d]: %f",i,lookupTableU[i]);//prints out the value of each float } } ``` And the V look-up table ``` -(void)createLookupTableV //creates a lookup table for converting a single byte into a float between 0 and 1 { NSLog(@"YUVFrame: createLookupTableV"); lookupTableV = new float [256]; for (int i = 0; i < 256; i++) { lookupTableV[i] = -0.615 + (float) i /255 * (0.615*2); NSLog(@"lookupTableV[%d]: %f",i,lookupTableV[i]);//prints out the value of each float } } ``` after this point, I extract the Y & UV plan and store them into two buffers, yBuffer & uvBuffer at this point, I attempt to convert the YUV data and stored it into a RGB buffer array called "frameImage" ``` -(void)sortAndConvert//sort the extracted frame data into an array of float { NSLog(@"YUVFrame: sortAndConvert"); int frameImageCounter = 0; int pixelCounter = 0; for (int y = 0; y < YUV_HEIGHT; y++)//traverse through the frame's height { for ( int x = 0; x < YUV_WIDTH; x++)//traverse through the frame's width { float Y = lookupTableY [yBuffer [y*YUV_WIDTH + x] ]; float U = lookupTableU [uvBuffer [ ((y / 2) * (YUV_WIDTH / 2) + (x/2)) * 2 ] ]; float V = lookupTableV [uvBuffer [ ((y / 2) * (YUV_WIDTH / 2) + (x/2)) * 2 + 1] ]; float RFormula = Y + 1.13983f * V; float GFormula = Y - 0.39465f * U - 0.58060f * V; float BFormula = Y + 2.03211f * U; frameImage [frameImageCounter++] = [self clampValue:RFormula]; frameImage [frameImageCounter++] = [self clampValue:GFormula]; frameImage [frameImageCounter++] = [self clampValue:BFormula]; } } } ``` then I tried to draw the Image in OpenGL ``` -(void)drawFrame:(int )x { GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, YUV_WIDTH, YUV_HEIGHT, 0, GL_RGB, GL_FLOAT, frameImage); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glRotatef( 180.0f, 1.0f, 0.0f, 0.0f ); glBegin( GL_QUADS ); glTexCoord2d(0.0,0.0); glVertex2d(-1.0,-1.0); glTexCoord2d(1.0,0.0); glVertex2d(+1.0,-1.0); glTexCoord2d(1.0,1.0); glVertex2d(+1.0,+1.0); glTexCoord2d(0.0,1.0); glVertex2d(-1.0,+1.0); glEnd(); glFlush(); } ``` so basically this my program in a nut shell. essentially i read the binary YUV files, stores all the data in a char array buffer. i then translate these values into their respected YUV float values. This is where I think the error might be: in the Y lookup table I standardize the Y plane to [0,1], in the U plane I standardized the values between [-0.435,0.436], and in the V plane I standardized it bewteen [-0.615,0.615]. I did this because those are the YUV value ranges according to wikipedia. And the YUV to RGB formula is the same formula from Wikipedia. I have also tried various other formulas, and this is the only formula that gives the rough outlook of the frame. Anyone might venture to guess to why my program is not correctly displaying the YUV frame data. I think it is something to do with my standardization technique, but it seems alright to me. > A note to everyone who is reading this. For the longest time, my frame was not displaying properly because I was not able to extract the frame data correctly.When I first started to program, I was under the impression that in a clip of say 30 frames, all 30 Y planar datas are first written in the data file, followed then by UV plane datas.What I found out through trial and error was that for a YUV data file, specifically NV12, the data file is stored in the following fashionY(1) UV(1) Y(2) UV(2) ... ... @nschmidt I changed my code to what you suggested ``` float U = lookupTableU [uvBuffer [ (y * (YUV_WIDTH / 4) + (x/4)) * 2 ] ] float V = lookupTableU [uvBuffer [ (y * (YUV_WIDTH / 4) + (x/4)) * 2 + 1] ] ``` and this is the result that i get ![alt text](https://i.stack.imgur.com/WAKR0.png) here is the print line from the console. i am print out the values for Y, U, V and RGB value that are being translated and stored on in the frameImage array YUV:[0.658824,-0.022227,-0.045824] RGBFinal:[0.606593,0.694201,0.613655] YUV:[0.643137,-0.022227,-0.045824] RGBFinal:[0.590906,0.678514,0.597969] YUV:[0.607843,-0.022227,-0.045824] RGBFinal:[0.555612,0.643220,0.562675] YUV:[0.592157,-0.022227,-0.045824] RGBFinal:[0.539926,0.627534,0.546988] YUV:[0.643137,0.025647,0.151941] RGBFinal:[0.816324,0.544799,0.695255] YUV:[0.662745,0.025647,0.151941] RGBFinal:[0.835932,0.564406,0.714863] YUV:[0.690196,0.025647,0.151941] RGBFinal:[0.863383,0.591857,0.742314] The problem was finally solved thanks to the recommendation from [nschmidt](https://stackoverflow.com/users/13677/nschmidt) . It turns out that my YUV file was actually in YUV 4:1:1 format. I was originally told that it was in YUV NV12 format. Anyways, I would like to share my results with you. Here is output ![alt text](https://i.stack.imgur.com/k4A3c.png) and my code for decode is as follows ``` float Y = (float) yBuffer [y*YUV_WIDTH + x] ; float U = (float) uvBuffer [ ((y / 2) * (YUV_WIDTH / 2) + (x/2)) ] ; float V = (float) uvBuffer [ ((y / 2) * (YUV_WIDTH / 2) + (x/2)) + UOffset] ; float RFormula = (1.164*(Y-16) + (1.596* (V - 128) )); float GFormula = ((1.164 * (Y - 16)) - (0.813 * ((V) - 128)) - (0.391 * ((U) - 128))); float BFormula = ((1.164 * (Y - 16)) + (2.018 * ((U) - 128))); frameImage [frameImageCounter] = (unsigned char)( (int)[self clampValue:RFormula]); frameImageCounter ++; frameImage [frameImageCounter] = (unsigned char)((int)[self clampValue:GFormula]); frameImageCounter++; frameImage [frameImageCounter] = (unsigned char)((int) [self clampValue:BFormula]); frameImageCounter++; GLuint texture; glGenTextures(1, &texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, YUV_WIDTH, YUV_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, frameImage); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE_SGIS); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE_SGIS); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); glRotatef( 180.0f, 1.0f, 0.0f, 0.0f ); glBegin( GL_QUADS ); glTexCoord2d(0.0,0.0); glVertex2d(-1.0,-1.0); glTexCoord2d(1.0,0.0); glVertex2d(+1.0,-1.0); glTexCoord2d(1.0,1.0); glVertex2d(+1.0,+1.0); glTexCoord2d(0.0,1.0); glVertex2d(-1.0,+1.0); glEnd(); NSLog(@"YUVFrameView: drawRect complete"); glFlush(); ``` essentially, I used NSData for the raw file extraction. stored in a char array buffer. For YUV to RGB conversion, I used the above formula, afterwards, I clamped the values to [0:255]. then I used a 2DTexture in OpenGL for display. So if you are converting YUV to RGB in the future, use the formula from above. If are using the YUV to RGB conversion formula from the earlier post, then you need to display the texture in GL_Float from the values for RGB are clamped between [0:1]
Display YUV in OpenGL
CC BY-SA 4.0
0
2009-07-09T22:20:12.560
2020-07-11T10:21:43.393
2020-07-11T10:21:43.393
507,043
125,450
[ "objective-c", "opengl", "rgb", "yuv" ]