Id
int64
1.68k
75.6M
PostTypeId
int64
1
2
AcceptedAnswerId
int64
1.7k
75.6M
ParentId
int64
1.68k
75.6M
Score
int64
-60
3.16k
ViewCount
int64
8
2.68M
Body
stringlengths
1
41.1k
Title
stringlengths
14
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
1
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
1
21.3M
Tags
list
6,303,590
1
6,303,630
null
0
501
This is the data I read from database into a datatable. ![enter image description here](https://i.stack.imgur.com/d3Qji.png) the datatable called table is now reshaped. For every same/distinct UnitType + UnitZoom + MemberZoom I create a new Unit and read the MemberId`s into the MemberListId - this should happen in the Order given by the number of the MemberOrder. Sample data: Unit1: A B C --> P1,P2 Unit2: 1 2 3 --> P9,P12,P4 Unit3: H23 B10 T15 -->X4,T5,Z3,Y1 My code for now that does not proper sort: ``` var groupedCollection = table.AsEnumerable() .GroupBy(row => new { UType = row.Field<string>("UnitType"), UZoom = row.Field<string>("UnitZoom"), MZoom = row.Field<string>("MemberZoom"), MOrder = row.Field<int>("MemberOrder"), // I DO NOT WANT the MemberOrder to be in the Group Key, but later on I use this Property to order by it... }); var unitCollection = groupedCollection .Select(g => new Unit { UnitType = g.Key.UType, UnitZoom = g.Key.UZoom, MemberZoom = g.Key.MZoom, MemberIdList = g.Select(r => r.Field<string>("MemberId")).OrderBy(b => g.Key.MOrder).ToList(), }); List<Unit> units = unitCollection.ToList(); ```
Order grouped data with LINQ
CC BY-SA 3.0
null
2011-06-10T08:00:49.937
2011-06-10T08:10:47.980
2011-06-10T08:02:52.553
98,713
252,289
[ "c#", "linq", "group-by", "extension-methods" ]
6,303,846
1
null
null
0
937
In a Gtk application, I have that line height: ![GtkTreeView narrow](https://i.stack.imgur.com/imJvi.jpg) and I want this line height: ![GtkTreeView wide](https://i.stack.imgur.com/nhQwP.jpg) Note that this is the same font size. Is it possible to achieve this line height / padding using gtkrc? How? Any hint will be appreciated. fbmd
How do I change the line height of a GtkTreeView using gtkrc?
CC BY-SA 3.0
null
2011-06-10T08:30:03.550
2011-06-10T16:43:17.387
2011-06-10T08:37:54.797
1,132,250
1,132,250
[ "gtk" ]
6,304,675
1
6,307,005
null
0
2,460
My project needs a library which is able to read large amount of data from 2D data Matrix .Now I am using Zxing which is decoding only 2D data Matrix with less amount of data and not able to read large amount of data in 2D Data Matrix.But its working fine with QR codes with any amount of data this is my 2D data Matrix data Any other library is available for 2D data matrix scanning I have downloaded libdmtx library but I don't know how can i use it with my project because it is a C file? Please give me solutions for this Thanks in Advance this is my 2D data Matrix data ![enter image description here](https://i.stack.imgur.com/g1PC3.png) zxing 1.7 Not Working with these above code I need other libraries to decode 2D data matrix of above type I found libmtx library for 2D data matrix decoding But how can i integrate libmtx with xcode?
Zxing Not decoding the 2D Data Matrix code having large amount of Data
CC BY-SA 3.0
null
2011-06-10T09:48:11.690
2014-07-06T12:20:25.617
2012-06-06T06:38:18.303
739,363
739,363
[ "iphone", "objective-c", "xcode", "image-processing", "zxing" ]
6,304,729
1
null
null
4
7,428
I have not seen this before usually a map either loads or it doesnt because of some error. I am getting the map to load without errors but it is blank: ![enter image description here](https://i.stack.imgur.com/objRU.jpg) ``` <script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false&#038;ver=3.0'></script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng(43.9869349, -102.24306); var myOptions = { zoom: 6, center: latlng, mapTypeId: google.maps.MapTypeId.TERRAIN }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } </script> <div id="map_canvas" style="width:100%; height:300px"></div> ``` Anyone else seen this or know what might be the culprit? The map itself is sitting in a div that I am show/hide with jQuery. Could that be the conflict? ## ANSWER This was just a stupid conflict with the parent div where I had img {display:none} defined. Oops. .thanks everyone for trying to help.
Why is my google map blank?
CC BY-SA 3.0
null
2011-06-10T09:53:11.730
2018-02-26T10:15:44.443
2011-06-11T08:45:02.317
82,330
82,330
[ "javascript", "google-maps-api-3", "maps" ]
6,304,898
1
6,304,946
null
1
4,730
I'm trying to build a category/subcategory class with php & MySQL. I am stuck with the following problem: I want to make a selection of all categories in an ordered way like it's showed in the picture below. The table structure I've made is: ![enter image description here](https://i.stack.imgur.com/XbjHG.png) Can I build an SELECT * statement which will select these categories in that order?
unlimited categories/subcategories with MYSQL
CC BY-SA 3.0
null
2011-06-10T10:08:22.230
2016-03-21T06:36:58.500
2011-06-10T11:30:40.573
650,492
726,162
[ "php", "mysql", "categories" ]
6,304,896
1
6,305,249
null
4
7,885
I am using Delphi 2009. I want to view the contents of a file (in hexadecimal) inside a memo. I'm using this code : ``` var Buffer:String; begin Buffer := ''; AssignFile(sF,Source); //Assign file Reset(sF); repeat Readln(sF,Buffer); //Load every line to a string. TempChar:=StrToHex(Buffer); //Convert to Hex using the function ... until EOF(sF); end; function StrToHex(AStr: string): string; var I ,Len: Integer; s: chr (0)..255; //s:byte; //s: char; begin len:=length(AStr); Result:=''; for i:=1 to len do begin s:=AStr[i]; //The problem is here. Ord(s) is giving false values (251 instead of 255) //And in general the output differs from a professional hex editor. Result:=Result +' '+IntToHex(Ord(s),2)+'('+IntToStr(Ord(s))+')'; end; Delete(Result,1,1); end; ``` When I declare variable "" as (i know that char goes up to 255) I get results hex values up to 65535! When i declare variable "" as or , it outputs different hex values, comparing to any Hexadecimal Editor! Why is that? How can I see the correct values? Check images for the differences. : Professional Hex Editor. ![Professional Hex Editor](https://i.stack.imgur.com/8lFW1.png) : Function output to Memo. ![Marked value should be 255 (box character)](https://i.stack.imgur.com/F2Kie.png) Thank you.
Hex view of a file
CC BY-SA 3.0
0
2011-06-10T10:08:17.160
2011-06-10T16:22:50.710
2011-06-10T10:57:43.133
null
266,068
[ "delphi", "delphi-2009", "hex" ]
6,305,016
1
6,305,682
null
0
450
I need to get performance counters from the network card. To make things easy, the user selects the needed adapter by typing an index number in a console application. ![Console application](https://i.stack.imgur.com/AsFGn.png) This is the code that gets the user input and creates performance counter instance ``` var connectionNames = NetworkCardLocator.GetConnectedCardNames().ToArray(); log.Debug("Please select one of the available connections"); log.Debug("--"); for (int i = 0; i < connectionNames.Count(); i++) { log.Debug(i + ". " + connectionNames[i]); } log.Debug("--"); var key = Console.ReadLine(); int idx = 0; Int32.TryParse(key, out idx); string connectionName = connectionNames[idx]; var networkBytesSent = new PerformanceCounter("Network Interface", "Bytes Sent/sec", connectionName); var networkBytesReceived = new PerformanceCounter("Network Interface", "Bytes Received/sec", connectionName); var networkBytesTotal = new PerformanceCounter("Network Interface", "Bytes Total/sec", connectionName); ``` This is how I select available adapters ``` internal static IEnumerable<string> GetConnectedCardNames() { string query = String.Format(@"SELECT * FROM Win32_NetworkAdapter"); var searcher = new ManagementObjectSearcher { Query = new ObjectQuery(query) }; try { log.Debug("Trying to select network adapters"); var adapterObjects = searcher.Get(); var names = (from ManagementObject o in adapterObjects select o["Name"]) .Cast<string>(); return names; } catch (Exception ex) { log.Debug("Failed to get needed names, see Exception log for details"); log.Fatal(ex); throw; } } ``` Given I have selected the needed adapter, the code works on my machine (Win 2008 R2 Ent x64). It doesn't work on some of the VMs I use for testing (Win 2008 R1 DC x86). Any selection there gives me an exception (still works on my PC and VM Win 2008 R1 Std x86) ``` foreach (PerformanceCounter counter in counters) { float rawValue = counter.NextValue(); //thrown here ... } 2011-06-10 11:08:20,505 [10] DEBUG TH.Exceptions Instance 'WAN Miniport (PPTP)' does not exist in the specified Category. System.InvalidOperationException: Instance 'WAN Miniport (PPTP)' does not exist in the specified Category. at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName) at System.Diagnostics.PerformanceCounter.NextSample() at System.Diagnostics.PerformanceCounter.NextValue() at TH.PerformanceMonitor.API.Internal.PerformanceLogService.DoPerformanceLogging(IEnumerable`1 counters, Int32 interval, TimeSpan duration) in C:\Projects\...\PerformanceLogService.cs:line 122 at TH.PerformanceMonitor.API.PerformanceManager.DoPerformanceLogging() in C:\Projects\...\PerformanceManager.cs:line 294 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() ``` What might be the problem, or how can I trace the reasons?
Cannot attach to a network adapter on one VM, same code works on another VM
CC BY-SA 3.0
null
2011-06-10T10:20:55.723
2013-12-15T20:55:39.110
2013-12-15T20:55:39.110
1,043,380
706,456
[ "c#", "networking", "wmi", "virtual-machine", "performancecounter" ]
6,305,077
1
6,306,562
null
9
9,191
Is it possible to have a tree structure with check boxes in JQuery MObile. I did not find any thing in demos. I wanted something similar this image: Is there any alternative way we can achieve this?![enter image description here](https://i.stack.imgur.com/n2nl6.png)
Tree structure with Check boxes in JQuery Mobile
CC BY-SA 3.0
0
2011-06-10T10:26:25.160
2012-04-25T09:49:48.950
null
null
189,006
[ "treeview", "jquery-mobile" ]
6,305,127
1
6,305,224
null
1
722
So I thought that an enum would help me with States. Basically, I have a little Sidebar app which has 3 states: Minimized - Where you can see a small and colored rectangular Panel indicating the app is open on the desktop. Preview - Which indicated the app is open, and you can see the logo. Normal - where the whole sidebar can be seen. Now, I have setup an enum like this: ``` public enum CurrentState { Minimized = 0, Preview, Normal }; ``` And I am trying to check the CurrentState and switch to another like this when the user clicks the always-visible panel: ``` // If Min=Set(Preview). If Preview=Set(Normal). If Normal=Set(Min). if (State.HasFlag(CurrentState.Minimized)) { State = CurrentState.Preview; this.Location = new Point( Screen.PrimaryScreen.WorkingArea.Right - _minimize.Size.Width - _logo.Size.Width, this.Location.Y ); } else if (State.HasFlag(CurrentState.Preview)) { State = CurrentState.Normal; this.Location = new Point( Screen.PrimaryScreen.WorkingArea.Right - this.Size.Width, this.Location.Y ); } else { State = CurrentState.Minimized; this.Location = new Point( Screen.PrimaryScreen.WorkingArea.Right - _minimize.Size.Width, this.Location.Y ); } ``` And when the application loads, I set the initial value to: CurrentState.Minimized;, like this: ``` CurrentState State = CurrentState.Preview; ``` So, this is the behavior: If form is Minimized, Move it a bit so it is in Preview mode. If it is in Preview, move it a bit so it is in Normal mode. If it is in Normal mode, set it to Minimized again. But, upon clicking the always-visible panel the first time, it works as expected. It sets it to Preview mode and moved the form a bit. , that's as far as it goes. Once it's in Preview mode, it does not go to Normal mode upon clicking the Panel a second time, which means that it's currently impossible to get it to normal view. Am I doing something wrong here? Although this may be uncommon, it is logical, and I can't figure out where something is going wrong. Here's a little visual to help better clarify what I mean: ![enter image description here](https://i.stack.imgur.com/SZzfi.png)
Switching State (C#/Windows Forms)
CC BY-SA 3.0
null
2011-06-10T10:31:45.433
2011-06-10T10:59:04.103
null
null
789,564
[ "c#", ".net", "winforms", "enums" ]
6,305,273
1
6,330,343
null
1
1,315
I'm using SQL Server 2005. I have a series of product and pricing tables from which I draw a view that provides several line items for each product, depending on whether the item's markup is set at item level, category level, or department level. So an example of the output for a single item would be: ![Output for an example item of ID 2739](https://i.stack.imgur.com/58FLx.jpg) What I'd like some help with - if it's at all possible - is grouping the output or performing some additional query on it so that the three line items in my result are combined into a single line item, with all the possible markup levels on one line. I've been unable to think of a way to do this without requiring additional expensive server-side processing to create a temp table and apply some logic to it to combine the 3 lines into 1. The real issue is time, since iterating through a product database of over 30000 items and performing per-line steps on the whole thing strikes me as an extremely cumbersome way to do this. If anyone might be able to help me out on this, I'd really appreciate it.
Is there a way to group multiple line items from a result in SQL Server 2005 into a single line item?
CC BY-SA 3.0
null
2011-06-10T10:47:58.683
2011-06-13T12:42:07.717
2011-06-10T11:43:59.560
13,302
123,729
[ "sql-server", "sql-server-2005", "grouping" ]
6,305,382
1
6,305,526
null
1
6,249
I'm drawing a curve from point A to point B. I know coordinates of points. How can I draw this curve. I have used example from Raphael site [http://raphaeljs.com/curver.html](http://raphaeljs.com/curver.html), but I didn't understand how I should insert my own values to that function. ![enter image description here](https://i.stack.imgur.com/fTW6I.png)
Drawing a curve using Raphael JavaScript library?
CC BY-SA 3.0
null
2011-06-10T10:57:49.347
2011-06-10T12:12:07.777
null
null
159,793
[ "javascript", "raphael" ]
6,305,395
1
6,308,217
null
4
3,047
I'm running a simple load test with apache benchmark: ``` ab -n 1 http://localhost/mysite/index/index/ ``` In my httpd.conf: ``` #mod_deflate enabled LoadModule deflate_module modules/mod_deflate.so #mod_deflate disabled #LoadModule deflate_module modules/mod_deflate.so ``` ![enter image description here](https://i.stack.imgur.com/E1R2V.jpg) - It looks like server without mod_deflate is performing better than with mod_deflate enabled (see "time taken for tests","Requests per seconds" and "time per requests").- Plus I dont understand why total transferred is bigger with deflate enabled Please explain me thanks Luca
Apache benchmark load-test: mod_deflate enabled vs disabled
CC BY-SA 3.0
0
2011-06-10T10:58:56.607
2011-06-10T15:03:33.833
null
null
505,762
[ "apache", "benchmarking", "mod-deflate" ]
6,305,432
1
6,305,469
null
1
1,736
I'm using an image of a dart board in this example as it's a good example for what I am trying to achieve. Is there any way in Java that part of an image can be highlighted? I achieved the below by using the `Magic Wand` in Paint.NET and added an outline to the selected part. The 'problem' here is if I wanted to highlight every part of this dart board individually, I'm going to end up with a lot of pictures. Is there some clever library out there that can do this programmatically so I have literally just the one image and can somehow point to some coordinates, it imitates the "magic wand" effect and adds an outline of my choice? Without highlight: ![Without highlight](https://i.stack.imgur.com/OdTyF.png) With highlight: ![With highlight](https://i.stack.imgur.com/OI4wR.png) Thanks, Ricky : Answer taken for simplicity. Thanks.
Java - Highlight parts of an image
CC BY-SA 3.0
null
2011-06-10T11:02:23.190
2011-06-10T11:21:04.353
2011-06-10T11:21:04.353
539,861
539,861
[ "java", "image-manipulation" ]
6,305,736
1
null
null
3
480
I'm using gnuplot to profile my cuda program. I found especially the width plot feature helpful. It seems however that computeprof offers no way to export or customize the plots generated. Fortunately all the data is stored in csv format so I thought I could do it just myself using gnuplot or something similar. So now to my question: I couldn't find an example to pro create a plot of time blocks can you create such a plot using gnuplot and if so how? ![Example of a width plot](https://i.stack.imgur.com/L7Qub.png)
Width plot with gnuplot
CC BY-SA 3.0
null
2011-06-10T11:30:51.533
2011-06-10T12:18:42.147
null
null
44,232
[ "profiling", "cuda", "gnuplot" ]
6,305,601
1
null
null
0
2,716
I am having problem in managing UITableView. I 'm posting a screenshot here to briefly explain the problem. Image 1 shows the default View when First Time view Appears. When I tap on yellow button(Yellow Button is in a custom table section header view) I open an UIAlertView with table in it like shown in the image 2![image 2](https://i.stack.imgur.com/d1V6A.png). Then selecting any option I insert a custom cell with a button,textfield and another button. I have a mutable Array for each section so when I select an option I add that string into the corresponding section array and reloadtable.See image 3![image 3](https://i.stack.imgur.com/HUtjz.png). Now when I enter values in UITextfields the values replaced by another cells. See the two images below for understanding the problem. image 4![image 4](https://i.stack.imgur.com/yAl31.png). Also when I delete a cell and insert a new the textfield is preloaded with previous value. ![Image 1](https://i.stack.imgur.com/7m7MH.png) And here is the .m file implementation code for analyze the problem ``` #import "contactsViewController.h" #import "textFieldCell.h" #import "SBTableAlert.h" #import "PhoneFieldCell.h" #import "DHValidation.h" #define kTextFieldTag 222 #define kTitleButtonTag 111 #define MAX_LENGTH 20 #define charecterLimit 13 #define PHONE_NUMBER @"0123456789+-" @implementation contactsViewController @synthesize currentTextField; @synthesize choiceList; @synthesize labelHeaders; @synthesize selectedIndexPath; @synthesize aTable; @synthesize customText; @synthesize currentSelectionType; @synthesize phoneList; @synthesize emailList; @synthesize otherDetailsList; // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; //Prepare array's for display in table header and in custom alert option table [self prepareDataForTable]; [self initializeProperties]; //Set selected index to -1 by default selectedIndex = -1; } //prepare array's for table - (void) prepareDataForTable { NSArray *temp = [[NSArray alloc] initWithObjects:@"work",@"home",@"mobile",@"custom",nil]; self.choiceList = temp; [temp release]; NSArray *temp1 = [[NSArray alloc] initWithObjects:@"First Name",@"Last Name",nil]; self.labelHeaders = temp1; [temp1 release]; } - (void) initializeProperties { //Initialize Mutable array's NSMutableArray *temp = [[NSMutableArray alloc] initWithCapacity:0]; self.phoneList = temp; [temp release]; NSMutableArray *temp1 = [[NSMutableArray alloc] initWithCapacity:0]; self.emailList = temp1; [temp1 release]; NSMutableArray *temp2 = [[NSMutableArray alloc] initWithCapacity:0]; self.otherDetailsList = temp2; [temp2 release]; } #pragma mark - - (IBAction) btnCancelTapped:(id) sender { [self dismissModalViewControllerAnimated:YES]; } - (IBAction) btnDoneTapped:(id) sender { [self.currentTextField resignFirstResponder]; //TODO: Fetch all the data from all the cells and notify the delegate. NSMutableDictionary *allSectionsData = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease]; NSMutableDictionary *section1Dictionary = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease]; NSMutableDictionary *phoneSectionDictionary = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease]; NSMutableDictionary *emailSectionDictionary = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease]; NSMutableDictionary *otherSectionDictionary = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease]; //For Section 0 for (unsigned rowIndex = 0; rowIndex < 2; rowIndex++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0]; UITableViewCell *cell = nil; cell = (textFieldCell*)[aTable cellForRowAtIndexPath:indexPath]; UITextField *txtf = (UITextField *)[cell viewWithTag:kTextFieldTag]; //TextField validation DHValidation *validation = [[DHValidation alloc] init]; NSString *str = [txtf.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; NSString *alertMessage = nil; BOOL isvalid = NO; if(![validation validateNotEmpty:str]) alertMessage = @"NameField should not be Empty"; else isvalid = TRUE; if(!isvalid){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:alertMessage delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; return ; } [validation release]; NSString *type = nil; NSString *value = nil; if(rowIndex == 0) type = @"First Name"; else if(rowIndex == 1){ type = @"Last Name"; } value = txtf.text; if(!value){ //Do not insert that value in the dictinary value = @""; }else { NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:type,@"type",value,@"value",nil]; [section1Dictionary setObject:dictionary forKey:[NSNumber numberWithInt:rowIndex]]; } } if([section1Dictionary count] > 0) { [allSectionsData setObject:section1Dictionary forKey:@"PersonalDetailsSection"]; } //For Section 1 for (unsigned rowIndex = 0; rowIndex < [phoneList count]; rowIndex++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:1]; UITableViewCell *cell = nil; cell = (PhoneFieldCell*)[aTable cellForRowAtIndexPath:indexPath]; UITextField *txtf = (UITextField *)[cell viewWithTag:kTextFieldTag]; UIButton *btnTitle = (UIButton*)[cell viewWithTag:kTitleButtonTag]; NSString *type = nil; NSString *value = nil; type = [btnTitle currentTitle]; value = [txtf text]; if(!value || [[value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@""] ){ //Do not insert that value in the dictinary continue; }else { NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:type,@"type",value,@"value",nil]; [phoneSectionDictionary setObject:dictionary forKey:[NSNumber numberWithInt:rowIndex]]; //[phoneSectionDictionary setObject:value forKey:type]; } } if([phoneSectionDictionary count] > 0) { [allSectionsData setObject:phoneSectionDictionary forKey:@"PhoneSection"]; } //For Section 2 for (unsigned rowIndex = 0; rowIndex < [emailList count]; rowIndex++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:2]; UITableViewCell *cell = nil; cell = (PhoneFieldCell*)[aTable cellForRowAtIndexPath:indexPath]; UITextField *txtf = (UITextField *)[cell viewWithTag:kTextFieldTag]; UIButton *btnTitle = (UIButton*)[cell viewWithTag:kTitleButtonTag]; NSString *type = nil; NSString *value = nil; type = [btnTitle currentTitle]; value = [txtf text]; if(!value || [[value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@""] ){ //Do not insert that value in the dictinary continue; }else { NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:type,@"type",value,@"value",nil]; [emailSectionDictionary setObject:dictionary forKey:[NSNumber numberWithInt:rowIndex]]; } } if([emailSectionDictionary count] > 0) { [allSectionsData setObject:emailSectionDictionary forKey:@"EmailSection"]; } //for Section 3 for (unsigned rowIndex = 0; rowIndex < [phoneList count]; rowIndex++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:3]; UITableViewCell *cell = nil; cell = (PhoneFieldCell*)[aTable cellForRowAtIndexPath:indexPath]; UITextField *txtf = (UITextField *)[cell viewWithTag:kTextFieldTag]; UIButton *btnTitle = (UIButton*)[cell viewWithTag:kTitleButtonTag]; NSString *type = nil; NSString *value = nil; type = [btnTitle currentTitle]; value = [txtf text]; if(!value || [[value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@""] ){ //Do not insert that value in the dictinary continue; }else { NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:type,@"type",value,@"value",nil]; [otherSectionDictionary setObject:dictionary forKey:[NSNumber numberWithInt:rowIndex]]; //[phoneSectionDictionary setObject:value forKey:type]; } } if([otherSectionDictionary count] > 0) { [allSectionsData setObject:otherSectionDictionary forKey:@"OtherSection"]; } } #pragma mark - #pragma mark UITableView Data Source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 4; } // Returns the number of rows in a given section. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSInteger count = 0; switch (section) { case 0: count = 2; break; case 1://Phone count = [phoneList count]; break; case 2://Email count = [emailList count]; break; case 3://Other count = [otherDetailsList count]; break; default: count = 0; break; } return count; } // Returns the cell for a given indexPath. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"textFieldCustomCell"; static NSString *PhoneFieldCustomCellIdentifier = @"PhoneFieldCustomCell"; static NSString *EmailFieldCustomCellIdentifier = @"EmailFieldCustomCell"; static NSString *OtherDetailsCustomCellIdentifier = @"OtherDetailsCustomCell"; UITableViewCell *cell = nil; switch (indexPath.section) { case 0:{ cell = (textFieldCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"textFieldCell" owner:self options:nil]; for (id currentObject in topLevelObjects){ if ([currentObject isKindOfClass:[textFieldCell class]]){ cell = (textFieldCell *) currentObject; break; } } } } break; case 1:{ cell = (PhoneFieldCell *)[tableView dequeueReusableCellWithIdentifier:PhoneFieldCustomCellIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"PhoneFieldCell" owner:self options:nil]; for (id currentObject in topLevelObjects){ if ([currentObject isKindOfClass:[PhoneFieldCell class]]){ cell = (PhoneFieldCell *) currentObject; ((PhoneFieldCell *)cell).enterText.delegate = self; ((PhoneFieldCell *)cell).enterText.text = nil; break; } } } } break; case 2:{ cell = (EmailFieldCell *)[tableView dequeueReusableCellWithIdentifier:EmailFieldCustomCellIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"EmailFieldCell" owner:self options:nil]; for (id currentObject in topLevelObjects){ if ([currentObject isKindOfClass:[EmailFieldCell class]]){ cell = (EmailFieldCell *) currentObject; ((EmailFieldCell *)cell).enterText.delegate = self; ((EmailFieldCell *)cell).enterText.text = nil; break; } } } } break; case 3:{ cell = (OtherDetailsCell *)[tableView dequeueReusableCellWithIdentifier:OtherDetailsCustomCellIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"OtherDetailsCell" owner:self options:nil]; for (id currentObject in topLevelObjects){ if ([currentObject isKindOfClass:[OtherDetailsCell class]]){ cell = (OtherDetailsCell *) currentObject; ((OtherDetailsCell *)cell).enterText.delegate = self; ((OtherDetailsCell *)cell).enterText.text = nil; break; } } } } break; default: break; } //Setup cell data switch (indexPath.section) { case 0:{ ((textFieldCell*)cell).aTextField.delegate = self; if(indexPath.row == 0){ ((textFieldCell*)cell).aTextField.placeholder = @"Enter First Name"; } if(indexPath.row == 1){ ((textFieldCell*)cell).aTextField.placeholder = @"Enter Last Name"; } ((textFieldCell*)cell).aLabel.text = [self.labelHeaders objectAtIndex:indexPath.row]; } break; case 1:{ NSString *str = [phoneList objectAtIndex:indexPath.row]; [((PhoneFieldCell *)cell).changeBtn setTitle:str forState:UIControlStateNormal]; [((PhoneFieldCell *)cell).changeBtn addTarget:self action:@selector(changeButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; ((PhoneFieldCell *)cell).btnDeleteCell.tag = indexPath.row; [((PhoneFieldCell *)cell).btnDeleteCell addTarget:self action:@selector(deleteButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; } break; case 2:{ NSString *str = [emailList objectAtIndex:indexPath.row]; [((EmailFieldCell *)cell).changeBtn setTitle:str forState:UIControlStateNormal]; [((EmailFieldCell *)cell).changeBtn addTarget:self action:@selector(changeButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; ((EmailFieldCell *)cell).btnDeleteCell.tag = indexPath.row; [((EmailFieldCell *)cell).btnDeleteCell addTarget:self action:@selector(deleteButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; } break; case 3:{ NSString *str = [otherDetailsList objectAtIndex:indexPath.row]; [((OtherDetailsCell *)cell).changeBtn setTitle:str forState:UIControlStateNormal]; [((OtherDetailsCell *)cell).changeBtn addTarget:self action:@selector(changeButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; ((OtherDetailsCell *)cell).btnDeleteCell.tag = indexPath.row; [((OtherDetailsCell *)cell).btnDeleteCell addTarget:self action:@selector(deleteButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; } break; default: break; } return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 30; } - (UIView*) tableView: (UITableView*) tableView viewForHeaderInSection: (NSInteger) section { if (section == 0) { return nil; } return [self headerViewForSection:section]; } // Handle row selection - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ } - (UIView*) headerViewForSection:(NSInteger)section { CGRect lblTitleFrame = CGRectMake(15, 0, 200, 20); CGRect btnFrame = CGRectMake(280.0, 0.0, 30.0, 30.0); CGRect headerViewFrame = CGRectMake(0,0, 40, 30); NSString *lblTitleText = nil; switch (section) { case 1://phone lblTitleText = @"Phone"; break; case 2://email lblTitleText = @"Email"; break; case 3://other details lblTitleText = @"Other"; break; default: break; } //Create a header view with a label and a button UIView *headerView = [[[UIView alloc] initWithFrame:headerViewFrame] autorelease]; UILabel *titleForTable = [[UILabel alloc]initWithFrame:lblTitleFrame]; titleForTable.text = lblTitleText; titleForTable.backgroundColor = [UIColor clearColor]; titleForTable.textColor = [UIColor whiteColor]; titleForTable.shadowColor = [UIColor whiteColor]; [headerView addSubview:titleForTable]; [titleForTable release]; UIButton *phoneButton = [[UIButton alloc] initWithFrame:btnFrame]; phoneButton.alpha = 0.7; phoneButton.tag = section; [phoneButton setImage:[UIImage imageNamed:@"Yellow.png"] forState: UIControlStateNormal]; [phoneButton addTarget: self action: @selector(headerTapped:) forControlEvents: UIControlEventTouchUpInside]; [headerView addSubview: phoneButton]; [phoneButton release]; return headerView; } #pragma mark - #pragma mark UITextField Delegate - (void)textFieldDidBeginEditing:(UITextField *)textField { self.currentTextField = textField; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } //textfield charecters range - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if (textField.text.length >= MAX_LENGTH && range.length == 0){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You reached maximum limit - 20" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; return NO; // return NO to not change text } else { return YES; } } #pragma mark - - (void)deleteButtonTapped:(id)sender{ if([self.currentTextField isFirstResponder]) { [self.currentTextField resignFirstResponder]; } NSLog(@"Button Pressed"); UIButton *btnDelete = (UIButton*)sender; id cell = [[btnDelete superview] superview]; if([cell isKindOfClass:[PhoneFieldCell class]]) { cell = (PhoneFieldCell*)cell; } if([cell isKindOfClass:[EmailFieldCell class]]) { cell = (EmailFieldCell*)cell; } if([cell isKindOfClass:[OtherDetailsCell class]]) { cell = (OtherDetailsCell*)cell; } NSIndexPath *indexPath = [aTable indexPathForCell:cell]; NSLog(@"Section is %d and row is %d",indexPath.section,indexPath.row); switch (indexPath.section) { case 1: [self.phoneList removeObjectAtIndex:[btnDelete tag]]; [aTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; break; case 2: [self.emailList removeObjectAtIndex:[btnDelete tag]]; [aTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; break; case 3: [self.otherDetailsList removeObjectAtIndex:[btnDelete tag]]; [aTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; break; default: break; } [aTable reloadData]; } - (void)changeButtonTapped:(id)sender{ if([self.currentTextField isFirstResponder]) { [self.currentTextField resignFirstResponder]; } UIButton *btnDelete = (UIButton*)sender; id cell = (PhoneFieldCell*)[[btnDelete superview] superview]; if([cell isKindOfClass:[PhoneFieldCell class]]) { cell = (PhoneFieldCell*)cell; } if([cell isKindOfClass:[EmailFieldCell class]]) { cell = (EmailFieldCell*)cell; } if([cell isKindOfClass:[OtherDetailsCell class]]) { cell = (OtherDetailsCell*)cell; } self.selectedIndexPath = [aTable indexPathForCell:cell]; shouldModify = YES; NSLog(@"Section is %d and row is %d",self.selectedIndexPath.section,self.selectedIndexPath.row); SBTableAlert *alert = nil; alert = [[[SBTableAlert alloc] initWithTitle:@"Options" cancelButtonTitle:@"Cancel" messageFormat:@"Select your option!"] autorelease]; [alert setType:SBTableAlertTypeSingleSelect]; [alert.view addButtonWithTitle:@"OK"]; [alert setDelegate:self]; [alert setDataSource:self]; [alert show]; } - (void)headerTapped:(id)sender { if([self.currentTextField isFirstResponder]) { [self.currentTextField resignFirstResponder]; } UIButton *tappedButton = (UIButton*)sender; //set current selection according to section switch ([tappedButton tag]) { case 1://Phone self.currentSelectionType = SELECTIONTYPE_PHONE; break; case 2://Email self.currentSelectionType = SELECTIONTYPE_EMAIL; break; case 3://Other details self.currentSelectionType = SELECTIONTYPE_OTHER; break; default: break; } SBTableAlert *alert; alert = [[[SBTableAlert alloc] initWithTitle:@"Options" cancelButtonTitle:@"Cancel" messageFormat:@"Select your option!"] autorelease]; [alert setType:SBTableAlertTypeSingleSelect]; [alert.view addButtonWithTitle:@"OK"]; [alert setDelegate:self]; [alert setDataSource:self]; [alert show]; } #pragma mark - SBTableAlertDataSource - (UITableViewCell *)tableAlert:(SBTableAlert *)tableAlert cellForRow:(NSInteger)row { UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil] autorelease]; [cell.textLabel setText:[self.choiceList objectAtIndex:row]]; if(row == selectedIndex) cell.accessoryType = UITableViewCellAccessoryCheckmark; else { cell.accessoryType == UITableViewCellAccessoryNone; } return cell; } - (NSInteger)numberOfRowsInTableAlert:(SBTableAlert *)tableAlert { if (tableAlert.type == SBTableAlertTypeSingleSelect) return [self.choiceList count]; else return 4; } #pragma mark - SBTableAlertDelegate - (void)tableAlert:(SBTableAlert *)tableAlert didSelectRow:(NSInteger)row { if (tableAlert.type == SBTableAlertTypeMultipleSelct) { UITableViewCell *cell = [tableAlert.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]]; if (cell.accessoryType == UITableViewCellAccessoryNone) [cell setAccessoryType:UITableViewCellAccessoryCheckmark]; else [cell setAccessoryType:UITableViewCellAccessoryNone]; [tableAlert.tableView deselectRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0] animated:YES]; } else if (tableAlert.type == SBTableAlertTypeSingleSelect) { selectedIndex = row; [tableAlert.tableView reloadData]; [tableAlert.tableView deselectRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0] animated:YES]; } } - (void)tableAlert:(SBTableAlert *)tableAlert didDismissWithButtonIndex:(NSInteger)buttonIndex { if(buttonIndex == 1){ if(selectedIndex == -1){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Select at least one choice" message:nil delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; } else if(cellSelected == FALSE){ if(selectedIndex == 3){ UIAlertView *customAlert = [[UIAlertView alloc] initWithTitle:@"Enter Custom Message" message:@"\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil]; customAlert.tag = 99; CGAffineTransform myTransForm = CGAffineTransformMakeTranslation(0,0); UITextField *temp = [[UITextField alloc] initWithFrame:CGRectMake(15, 50, 255, 30)]; self.customText = temp; [temp release]; self.customText.backgroundColor = [UIColor whiteColor]; self.customText.placeholder = @"Enter Custom Text"; self.customText.clearButtonMode = UITextFieldViewModeWhileEditing; self.customText.layer.cornerRadius = 5; [customAlert addSubview:self.customText]; [customAlert setTransform:myTransForm]; [customAlert show]; [customAlert release]; }else { UITableViewCell *cell = [tableAlert.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:selectedIndex inSection:0]]; NSString *val = cell.textLabel.text; if(!shouldModify) { switch (self.currentSelectionType) { case SELECTIONTYPE_PHONE: [phoneList addObject:val]; break; case SELECTIONTYPE_EMAIL: [emailList addObject:val]; break; case SELECTIONTYPE_OTHER: [otherDetailsList addObject:val]; break; default: break; } } else { switch (self.selectedIndexPath.section) { case 1: [phoneList replaceObjectAtIndex:self.selectedIndexPath.row withObject:val]; break; case 2: [emailList replaceObjectAtIndex:self.selectedIndexPath.row withObject:val]; break; case 3: [otherDetailsList replaceObjectAtIndex:self.selectedIndexPath.row withObject:val]; break; default: break; } shouldModify = NO; } } } if(self.currentSelectionType != SELECTIONTYPE_UNKNOWN || self.selectedIndexPath.section > 0) [aTable reloadData]; selectedIndex = -1; [tableAlert release]; } } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if(alertView.tag == 99 && buttonIndex == 1){ NSString *val = [self.customText text]; if(!val || [[val stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@""]){ //show error alert here and return from here UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please fill a value for custom text" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [errorAlert show]; [errorAlert release]; return; } switch (self.currentSelectionType) { case SELECTIONTYPE_PHONE: [phoneList addObject:val]; [aTable reloadData]; break; case SELECTIONTYPE_EMAIL: [emailList addObject:val]; [aTable reloadData]; break; case SELECTIONTYPE_OTHER: [otherDetailsList addObject:val]; [aTable reloadData]; break; default: break; } } } #pragma mark - /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { self.currentTextField = nil; self.choiceList = nil; self.labelHeaders = nil; self.selectedIndexPath = nil; self.aTable = nil; self.customText = nil; self.phoneList = nil; self.emailList = nil; self.otherDetailsList = nil; self.customText = nil; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [phoneList release]; [emailList release]; [otherDetailsList release]; [customText release]; [customText release]; [aTable release]; [selectedIndexPath release]; [choiceList release]; [labelHeaders release]; [currentTextField release]; [super dealloc]; } @end ```
How to manage UITableView + Dynamic Custom Cell(UIBUtton + UITextField + UIBUtton) Insertion?
CC BY-SA 3.0
null
2011-06-10T11:19:37.773
2011-08-02T15:09:01.773
2011-06-10T11:43:45.230
83,905
83,905
[ "ios4", "uitableview", "uitextfield", "custom-cell" ]
6,305,877
1
6,306,067
null
2
697
I have a layout in which I want two ToggleButton widgets centered horizontally; not right next to each other, but as if each was centered in their own half of the view. ![So, I'm wanting them to look like this.](https://i.stack.imgur.com/xiJSq.png) ![But instead I get this.](https://i.stack.imgur.com/6WCmh.png) Here is the code for my layout: ``` `<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/pics" android:layout_weight="2" android:layout_height="fill_parent" android:layout_width="fill_parent" android:padding="8dp" android:layout_alignParentTop="true" > <ImageView android:id="@+id/prefix" android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="wrap_content" android:padding="4dp"/> <ImageView android:id="@+id/suffix" android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="wrap_content" android:padding="4dp" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" orientation="horizontal" > <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content" orientation="horizontal" > <ToggleButton android:id="@+id/lockPrefix" android:textOn="Locked" android:textOff="Unlocked" android:checked="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" /> </LinearLayout> <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content" orientation="horizontal" > <ToggleButton android:id="@+id/lockSuffix" android:textOn="Locked" android:textOff="Unlocked" android:checked="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" /> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/toolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_below="@id/pics" android:padding="8dp" > <Button android:id="@+id/mixButton" style="@style/DefaultButton" android:layout_height="wrap_content" android:layout_width="90dp" android:text="@string/main_mixButton" android:onClick="mixButtonClick" /> <Button android:id="@+id/exitButton" style="@style/DefaultButton" android:layout_height="wrap_content" android:layout_width="90dp" android:text="@string/main_exitButton" android:onClick="exitButtonClick" /> </LinearLayout> </LinearLayout>` ``` (EDIT: make XML readable)
Having trouble centering two form widgets horizontally
CC BY-SA 3.0
null
2011-06-10T11:42:41.033
2011-06-10T12:07:18.003
2011-06-10T11:57:34.583
491,682
202,870
[ "android", "android-layout" ]
6,306,018
1
6,341,152
null
4
1,577
I try to upload an update for my app. However I always get this error message: ![enter image description here](https://i.stack.imgur.com/Tr4hC.png) I use xcode 4.2 and the iOS 5.0 SDK. I read that question [Xcode iOS organizer submit to app store yields "The archive is invalid" error](https://stackoverflow.com/questions/5483728/xcode-ios-organizer-submit-to-app-store-yields-the-archive-is-invalid-error) but nothing helped. I tried following - - - I keep getting this error message. Any ideas?
"The archive is invalid" during archive validation in xcode
CC BY-SA 3.0
0
2011-06-10T11:55:54.473
2011-06-14T08:48:33.053
2017-05-23T12:01:09.963
-1
401,025
[ "iphone", "xcode", "organizer", "xcode4.2", "ios5" ]
6,306,410
1
null
null
2
2,426
Here is the fragmentation status on indexed tables: ![enter image description here](https://i.stack.imgur.com/bQie7.jpg) And here is my `PageDefinition` table: ![enter image description here](https://i.stack.imgur.com/oOg8x.png) Any suggestion what possible changes I can made in this to low down the fragmentation. I am doing this first time so solution with reason will be very helpful.also please let me know if I need to add some more detail here. Thanx
Fixing Index Fragmentation in SQL Server
CC BY-SA 3.0
null
2011-06-10T12:34:06.343
2011-06-10T16:24:25.557
2011-06-10T13:02:55.170
13,302
479,291
[ "sql-server-2005", "sql-server-2008" ]
6,306,415
1
6,306,641
null
0
1,887
I have an auto generated DropDownList from Entity Framework in a strongly typed view: ``` <div class="editor-field"> @Html.DropDownList("User_FK", String.Empty) @Html.ValidationMessageFor(model => model.User_FK) </div> ``` ![Auto Generated drop down list](https://i.stack.imgur.com/7eGLm.jpg) Here is the action code: ``` public ActionResult Create() { ViewBag.SystemMaster_FK = new SelectList(db.SystemMasters, "System_PK", "Name"); ViewBag.User_FK = new SelectList(db.Users, "User_PK", "NetworkLogin"); return View(); } ``` I need this list to display the names of people loaded from Active Directory. How do I customize the select list options seperately?
MVC3 Customizing DropdownList items in strongly typed view
CC BY-SA 3.0
null
2011-06-10T12:34:29.877
2012-10-14T12:30:10.233
2011-06-10T14:00:21.723
178,931
178,931
[ "entity-framework", "asp.net-mvc-3" ]
6,306,807
1
null
null
3
16,344
I need help on how to filter data in a database. I want a filter like in the excel spreadsheet. For example, I have this sample code on how to get data from [w3school](http://www.w3schools.com/php/php_mysql_select.asp) on how to select data from database. Here is my sample code: ``` <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("TableTest", $con); $result = mysql_query("SELECT * FROM Colors "); echo "<table border='1'> <tr> <th>Colors</th> <th>Type</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['colors'] . "</td>"; echo "<td>" . $row['type'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> ``` ![enter image description here](https://i.stack.imgur.com/OnNr3.png) I also found this [sample](http://www.w3schools.com/php/php_ajax_database.asp) too in w3school, but I dont want to filter the database with a drop down. I'd like to make it like an excel filter. When I select the column 'Colors' to filter on 'Red', it will display only the color red. So i was wondering if anyone could help me on how to start. Thanks all
PHP - Filtering data in table
CC BY-SA 3.0
null
2011-06-10T13:09:51.300
2021-04-27T07:20:52.000
2017-03-07T15:15:08.390
7,325,614
147,685
[ "php", "mysql", "html" ]
6,306,814
1
6,320,164
null
1
428
I nearly successfully migrated my vim settings form Linux (ubuntu) on Mac. What I liked was the latex-suite for vim with the forward (press the compiling buttons and the generated dvi file will jumo straightly to this position) and inverse search (press CTR and the left mouse button in the dvi file and it will jump right to the place in the code of the tex file where you pressed). Under Linux it is working but not under MacVim. Here is a picture of the error message: ![enter image description here](https://i.stack.imgur.com/anEHI.png) Here are my .vimrc settings for the latex suite: ``` " LateX SUITE HACKS " ================= " inverse | forward search (http://forum.ubuntuusers.de/topic/vim-vim-latexsuite-vim-gtk) " her are the forward search :let g:Tex_ViewRule_dvi = 'xdvi -editor "vim --servername xdvi --remote +\%l \%f" $* &' :let g:Tex_ViewRuleComplete_dvi = 'xdvi -editor "vim --servername xdiv --remote +\%l \%f" $* &' " settings for determining tex filetype :let g:tex_flavor = "latex" map ,lj :execute '!cd ' . expand(Tex_GetMainFileName(':p:h')) . ' && xdvi -editor "vim --servername 'v:servername' --remote-wait +\%l \%f" -sourceposition ' . line(".") . substitute(expand('%:p'),expand(Tex_GetMainFileName(':p:h')).'\/','','') . " " . expand(Tex_GetMainFileName(':p:r')) . ".dvi &" <CR><CR> " default output of compiling (pressing ,lj) is dvi :let g:Tex_DefaultTargetFormat="dvi" ``` I got these settings from [http://vim.wikia.com/wiki/Vim_can_interact_with_xdvi](http://vim.wikia.com/wiki/Vim_can_interact_with_xdvi) I'm starting vim with an alias like: ``` alias vi='/Applications/MacVim.app/Contents/MacOS/Vim -g' alias vim='/Applications/MacVim.app/Contents/MacOS/Vim -g' ``` It must have something to do with the xserver or maybe some wrong argument passing in the settings mentioned above. Hope someone can help me. Matthias
Enable inversearch for dvi documents in macvim
CC BY-SA 3.0
null
2011-06-10T13:10:46.517
2011-06-12T04:37:45.243
null
null
317,487
[ "vim", "vi", "macvim", "latex-suite" ]
6,306,856
1
6,306,892
null
1
849
I have a select box in which it is very important that the background for each option has a specific color. The problem is that the select box is clicked, the selected option appears blue (same as the selected text color). I've tried using a lot of selectors (:active, :focus, ::selection, [selected]) and I cannot find the way to change this behaviour. Any idea? I guess this can be done with js, but there must be a CSS selector that works, right? ![see what i mean?](https://i.stack.imgur.com/KbMiU.gif)
Problem styling Option[selected] in a select field
CC BY-SA 3.0
null
2011-06-10T13:14:15.987
2011-06-10T13:39:15.003
null
null
345,157
[ "css", "css-selectors" ]
6,306,877
1
null
null
0
4,749
i am creating admin panel of my project and getting some sort of problem, i just wanna make edit button as you can see click able, when when i click on the down besides chechboxes should appear and when again i click over edit button they should hide. i tried myself by many ways but all gone wrong. please help me to solve this issue. ![enter image description here](https://i.stack.imgur.com/fjeaD.jpg) ``` <tr> <td class="fl underline" style="margin-bottom:15px;" colspan="3">User Profile<span style="float:right;font-size:12px;margin-top:3px;word-spacing:6px;"><span id="edit_profile">Edit</span> | <span id="del_profile">Delete</span></span></td> </tr> ``` ``` <td class="hl">Complete Name</td> <td class="hr"><input class="edit_completeName" type="checkbox" value="" style="display:none;"> <?php echo $row['first_name']." ".$row['last_name']; ?></td> </tr> <tr> <td class="hl">Address</td> <td class="hr"><input class="edit_streetAddr" type="checkbox" value="" style="display:none;"> <?php echo $row['street_address']; ?></td> </tr> <tr> <td class="hl">&nbsp;</td> <td class="hr"><input class="edit_city" type="checkbox" value="" style="display:none;"> <?php echo $row['city']; ?></td> </tr> ```
how to make text clickable without <a> and show/hide checkboxes
CC BY-SA 3.0
null
2011-06-10T13:16:51.417
2011-06-10T13:35:23.483
2011-06-10T13:35:23.483
698,668
698,668
[ "jquery", "html" ]
6,306,975
1
6,307,283
null
0
4,681
I'm making an app where i want to automatically make an calculation. the numbers are , number is a . when i fill in the numbers , i want it to and show a result in the . in this example 1+2=3 i made an xml example: ![enter image description here](https://i.stack.imgur.com/aKTB3.png)
Automatic calculation
CC BY-SA 3.0
0
2011-06-10T13:25:30.383
2011-06-13T06:16:48.423
2020-06-20T09:12:55.060
-1
752,358
[ "android" ]
6,307,263
1
null
null
8
24,810
using Hough Transform, how can I detect and get coordinates of (x0,y0) and "a" and "b" of an ellipse in 2D space? This is ellipse01.bmp: ![ellipse image](https://i.stack.imgur.com/lpAMs.png) ``` I = imread('ellipse01.bmp'); [m n] = size(I); c=0; for i=1:m for j=1:n if I(i,j)==1 c=c+1; p(c,1)=i; p(c,2)=j; end end end Edges=transpose(p); Size_Ellipse = size(Edges); B = 1:ceil(Size_Ellipse(1)/2); Acc = zeros(length(B),1); a1=0;a2=0;b1=0;b2=0; Ellipse_Minor=[];Ellipse_Major=[];Ellipse_X0 = [];Ellipse_Y0 = []; Global_Threshold = ceil(Size_Ellipse(2)/6);%Used for Major Axis Comparison Local_Threshold = ceil(Size_Ellipse(1)/25);%Used for Minor Axis Comparison [Y,X]=find(Edges); Limit=numel(Y); Thresh = 150; Para=[]; for Count_01 =1:(Limit-1) for Count_02 =(Count_01+1):Limit if ((Count_02>Limit) || (Count_01>Limit)) continue end a1=Y(Count_01);b1=X(Count_01); a2=Y(Count_02);b2=X(Count_02); Dist_01 = (sqrt((a1-a2)^2+(b1-b2)^2)); if (Dist_01 >Global_Threshold) Center_X0 = (b1+b2)/2;Center_Y0 = (a1+a2)/2; Major = Dist_01/2.0;Alpha = atan((a2-a1)/(b2-b1)); if(Alpha == 0) for Count_03 = 1:Limit if( (Count_03 ~= Count_01) || (Count_03 ~= Count_02)) a3=Y(Count_03);b3=X(Count_03); Dist_02 = (sqrt((a3 - Center_Y0)^2+(b3 - Center_X0)^2)); if(Dist_02 > Local_Threshold) Cos_Tau = ((Major)^2 + (Dist_02)^2 - (a3-a2)^2 - (b3-b2)^2)/(2*Major*Dist_02); Sin_Tau = 1 - (Cos_Tau)^2; Minor_Temp = ((Major*Dist_02*Sin_Tau)^2)/(Major^2 - ((Dist_02*Cos_Tau)^2)); if((Minor_Temp>1) && (Minor_Temp<B(end))) Acc(round(Minor_Temp)) = Acc(round(Minor_Temp))+1; end end end end end Minor = find(Acc == max(Acc(:))); if(Acc(Minor)>Thresh) Ellipse_Minor(end+1)=Minor(1);Ellipse_Major(end+1)=Major; Ellipse_X0(end+1) = Center_X0;Ellipse_Y0(end+1) = Center_Y0; for Count = 1:numel(X) Para_X = ((X(Count)-Ellipse_X0(end))^2)/(Ellipse_Major(end)^2); Para_Y = ((Y(Count)-Ellipse_Y0(end))^2)/(Ellipse_Minor(end)^2); if (((Para_X + Para_Y)>=-2)&&((Para_X + Para_Y)<=2)) Edges(X(Count),Y(Count))=0; end end end Acc = zeros(size(Acc)); end end end ```
Ellipse Detection using Hough Transform
CC BY-SA 3.0
0
2011-06-10T13:49:39.050
2016-01-28T15:20:34.480
2011-12-02T05:04:28.327
125,507
787,978
[ "algorithm", "matlab", "hough-transform" ]
6,307,516
1
6,307,896
null
1
2,012
I am taking photo using , , and display it in . Its work properly. But, After display image in UIImage. I am detecting faces using OpenCV from that displayed image. It detect, but it returns the rotated image. I am not use any code for rotate the image. Its automatically rotate the image. I want to stop rotating. Here is my code. ``` + (UIImage *) opencvFaceDetect:(UIImage *)originalImage { cvSetErrMode(CV_ErrModeParent); IplImage *image = [self CreateIplImageFromUIImage:originalImage]; // Scaling down IplImage *small_image = cvCreateImage(cvSize(image->width/2,image->height/2), IPL_DEPTH_8U, 3); cvPyrDown(image, small_image, CV_GAUSSIAN_5x5); int scale = 2; // Load XML NSString *path = [[NSBundle mainBundle] pathForResource:@"haarcascade_frontalface_default" ofType:@"xml"]; CvHaarClassifierCascade* cascade = (CvHaarClassifierCascade*)cvLoad([path cStringUsingEncoding:NSASCIIStringEncoding], NULL, NULL, NULL); CvMemStorage* storage = cvCreateMemStorage(0); // Detect faces and draw rectangle on them CvSeq* faces = cvHaarDetectObjects(small_image, cascade, storage, 1.2f, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20, 20), cvSize(100, 100)); cvReleaseImage(&small_image); NSLog(@"found %d faces in image", faces->total); // Create canvas to show the results CGImageRef imageRef = originalImage.CGImage; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef contextRef = CGBitmapContextCreate(NULL, originalImage.size.width, originalImage.size.height, 8, originalImage.size.width * 4, colorSpace, kCGImageAlphaPremultipliedLast|kCGBitmapByteOrderDefault); CGContextDrawImage(contextRef, CGRectMake(0, 45, originalImage.size.width, originalImage.size.height), imageRef); CGContextSetLineWidth(contextRef, 4); CGContextSetRGBStrokeColor(contextRef, 0.0, 0.0, 1.0, 0.5); // Draw results on the iamge for(int i = 0; i < faces->total; i++) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // Calc the rect of faces CvRect cvrect = *(CvRect*)cvGetSeqElem(faces, i); CGRect face_rect = CGContextConvertRectToDeviceSpace(contextRef, CGRectMake(cvrect.x * scale, cvrect.y * scale, cvrect.width * scale, cvrect.height * scale)); CGContextStrokeRect(contextRef, face_rect); [pool release]; } UIImage *returnImage = [UIImage imageWithCGImage:CGBitmapContextCreateImage(contextRef)]; CGContextRelease(contextRef); CGColorSpaceRelease(colorSpace); cvReleaseMemStorage(&storage); cvReleaseHaarClassifierCascade(&cascade); return returnImage; } ``` Here is the Screen shots 1) Image for before calling face detection method ![Image before face detection method called](https://i.stack.imgur.com/thQjW.png) 2) Image for after calling face detection method ![Image after face detection method called](https://i.stack.imgur.com/ApAiY.png)
Why rotate Image in OpenCV without rotation code?
CC BY-SA 3.0
null
2011-06-10T14:08:47.893
2011-06-10T14:54:38.467
2011-06-10T14:54:38.467
223,633
223,633
[ "iphone", "opencv", "avcapturesession", "avcapturedevice", "avcapture" ]
6,307,709
1
6,307,759
null
0
632
i am using tomcat 7.0.11 which also support servlet 3.0 but `req.getServletContext().getEffectiveMajorVersion()` // 2 `req.getServletContext().getEffectiveMinorVersion()` // 5 gives me this output. how would i achive servlet 3.0? it show as tomcat support javaServer page 2.2. and also how would i get JAvaServer Page version?![enter image description here](https://i.stack.imgur.com/HPjkn.png)
servlet version getServletContext().getEffectiveMajorVersion() given me 2.5 while i am using 3
CC BY-SA 3.0
0
2011-06-10T14:23:50.317
2011-06-10T15:13:43.823
2011-06-10T15:13:43.823
410,439
410,439
[ "java", "servlets" ]
6,307,798
1
6,307,931
null
2
1,107
Coming from Subversion I have used the "Mark For Comparison" and "Compare URLs" feature in TortoiseSVN. This gave me the ability to compare the development branch with the last release version to get a list of files that changed. We use this list of files for final code review, documentation of the next version, etc. As you can see it is possible to get a list of files and also be able to click each file to see a visual diff of the changes. ![Screenshot of comparing revisions with Subversion](https://i.stack.imgur.com/OGvIC.png) Is it possible to do something similar with Mercurial? The best I have found thus far is this command, however the list of files is far less useful than what I was able to get with Subversion. `hg status --change {revisionnumber}`
Comparing revisions in Mercurial
CC BY-SA 3.0
0
2011-06-10T14:31:10.970
2011-06-10T14:40:57.913
null
null
742,527
[ "mercurial" ]
6,307,805
1
6,308,891
null
1
1,008
i have a view, then in the view i have a scrollview and then in the scrollview i have a bunch of different objects. These objects aren't bigger than the scrollview's size, so i put a textView with a lot of text in the scrollview to see if it works but it is not scrolling. I deactivated the textview's scroll function. Does the scrollview knows the size of my textview? The textview's text is being set programmatically. Here's my view hierarchy: ![enter image description here](https://i.stack.imgur.com/2WTBH.png) Thanks in advance.
scrollview and textview problem with scrolling iphone
CC BY-SA 3.0
null
2011-06-10T14:31:47.580
2011-06-10T15:59:04.780
null
null
526,924
[ "iphone", "objective-c", "cocoa-touch", "interface-builder" ]
6,307,944
1
null
null
9
4,135
Not sure how even that could be possible, but I have got this error message: ![System.Web.Mvc Version=3.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35" is incompatible with .NET Framework 4 In order to add it you should to change the project's target to a compatible framework first](https://i.stack.imgur.com/GocTE.png) That happened after I've: 1. installed .NET 4 and Visual Studio 2010 Professional 2. installed VS 2010 SP1 package using WPI + NuGet + some groovy funky library packages 3. installed ASP.NET MVC 3 (includes April 2011 Tools Update) package using WPI 4. created a new empty MVC 3 C# Web Application with Razor support 5. failed to build it because got this error: Warning 3 The primary reference "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". 6. checked if the project targets .NET 4. It does 7. removed the reference to System.Web.Mvc and tried to add it again (version 3.0) and got the aforementioned error message (screenshot above) 8. tried out re-installing some components, performed some of the previous steps in random order, spilled some virgin chicken's blood over my computer and restarted Windows again and again, all that to no avail. I bet the solution is banal, but it must be that its Friday afternoon. By the way, I have also VS 2008, MVC 1, MVC 2, all .NET framework versions installed and functional. --- In fact, I have exactly the same problem with projects targeting .NET 4. --- I feel that this is somehow related - I do really miss in the folder `C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0` (though is present) I reinstalled .NET 4 framework but that didn't fix the problem.
MVC 3 "is incompatible with .NET Framework 4"
CC BY-SA 3.0
0
2011-06-10T14:42:20.263
2012-06-19T17:55:10.117
2011-06-13T09:37:56.877
574,995
574,995
[ ".net", "visual-studio-2010", "asp.net-mvc-3" ]
6,307,972
1
6,308,482
null
1
369
This is a screenshot from Opera using FireFly. It clearly illustrates the padding (5px) and margin (0px) of the textbox. However, to the right of the textbox is an unidentified black space of approximately 10px that isn't HTML whitespace, `td` padding, textbox margin or anything else I can think of. The spacing also exists in FireFox and IE 9. (Please ignore the fact that the below button has the same indent - in its case I've added padding-right to the `td` as a hack to even it out) ![Opera](https://i76.photobucket.com/albums/j37/dahwan/Screenshots%20for%20illustrative%20purposes/Untitled.png) Any ideas?
Where is this rogue white-space coming from?
CC BY-SA 3.0
null
2011-06-10T14:44:14.007
2011-06-10T15:23:23.567
2017-02-08T14:32:26.847
-1
388,916
[ "css", "opera", "padding", "margins" ]
6,308,079
1
6,308,676
null
0
3,726
I'm having a problem getting the BlendState on the graphics device to work properly and display the alpha blending correctly. ![Render Output](https://i.stack.imgur.com/sN5Jz.png) In some cases you can see the leaves through other leaves, in other cases you cannot. And the trunk is also always obscured. I've tried so many different combinations of setting up the BlendState. At the moment it looks like this: ``` GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; //GraphicsDevice.BlendState = BlendState.AlphaBlend; GraphicsDevice.BlendState = new BlendState() { AlphaBlendFunction = BlendFunction.Add, AlphaDestinationBlend = Blend.InverseSourceAlpha, AlphaSourceBlend = Blend.One, BlendFactor = new Color(1.0F, 1.0F, 1.0F, 1.0F), ColorBlendFunction = BlendFunction.Add, ColorDestinationBlend = Blend.InverseSourceAlpha, ColorSourceBlend = Blend.One, ColorWriteChannels = ColorWriteChannels.All, ColorWriteChannels1 = ColorWriteChannels.All, ColorWriteChannels2 = ColorWriteChannels.All, ColorWriteChannels3 = ColorWriteChannels.All, MultiSampleMask = -1 }; ``` The shader code are as follows: float alpha = 1.0F; if (HasAlphaTexture) alpha = tex2D(AlphaSampler, IN.UV).xyz; //... //determine color values etc.. ///... return float4(result.xyz,alpha); The maps I'm using for this looks like the following: ![Opacity Map](https://i.stack.imgur.com/XklVa.png) ![Diffuse/Color Map](https://i.stack.imgur.com/sGMSs.png)
Device AlphaBlend state in XNA 4.0
CC BY-SA 3.0
null
2011-06-10T14:52:38.997
2011-06-10T15:41:17.550
null
null
767,302
[ "xna", "alphablending" ]
6,308,295
1
null
null
2
848
In a datagrid where one column is editable and the other columns are read only. The non editable column is bound to a nullable decimal field in a collection and is initially NULL, so no value is present in the column. When trying to click this cell to get the datagrid into edit mode, the click target is very small and hard to click. How can you set the click target size for such a cell? ![I would like the clickable area to be the entire cell, highlighted as shown](https://i.stack.imgur.com/K2YYl.png)
How can you set the clickable area of a WPF datagrid cell?
CC BY-SA 3.0
null
2011-06-10T15:09:25.980
2014-06-20T05:38:05.590
2011-06-12T11:48:59.407
224
224
[ "wpf", "wpfdatagrid" ]
6,308,335
1
6,314,289
null
5
431
Is it possible to adjust the size/font of the TogglerBar, so that they are all equally large in case of different name size. The example below is the solution proposed by Belisarius for : ["Can TogglerBar be used as multiple CheckBox in Mathematica ?"](https://stackoverflow.com/questions/6299215/can-togglerbar-be-used-as-multiple-checkbox-in-mathematica) I would like each Button to be equally sized. ``` Manipulate[Graphics[ { {White, Circle[{5, 5}, r]},(*For Mma 7 compatibility*) If[MemberQ[whatToDisplay, "I am a Circle"], {Red, Circle[{5, 5}, r]}], If[MemberQ[whatToDisplay, "and I am a very nice Square"], {Blue, Rectangle[{5, 5}, {r, r}]}], If[MemberQ[whatToDisplay, "Other"], {Black, Line[Tuples[{3, 4}, 2]]}] }, PlotRange -> {{0, 20}, {0, 10}} ], {{r, 1, Style["Radius", Black, Bold, 12]}, 1, 5, 1, ControlType -> Slider, ControlPlacement -> Top}, Control@{{whatToDisplay, True, Style["What", Black, Bold, 12]}, {"I am a Circle", "and I am a very nice Square", "Other"}, ControlType -> TogglerBar, Appearance -> "Horizontal", ControlPlacement -> Top}] ``` ![enter image description here](https://i.stack.imgur.com/Nm6cb.png) : It is trully ugly in the code (if we can still call that a code) but looks good on display. ![enter image description here](https://i.stack.imgur.com/vwbTR.png) ![enter image description here](https://i.stack.imgur.com/Hz0Xa.png)
Adjust TogglerBar button size in Mathematica
CC BY-SA 3.0
null
2011-06-10T15:12:11.903
2015-08-06T11:13:25.160
2017-05-23T12:29:51.823
-1
769,551
[ "wolfram-mathematica", "togglebutton" ]
6,308,423
1
11,045,735
null
0
270
## Bah! I have recently installed the MiniProfiler from [http://code.google.com/p/mvc-mini-profiler/](http://code.google.com/p/mvc-mini-profiler/) attempting to find all the slow calls on my site. (There are quite a few. But I've fixed a lot of it as a result of the profiler) There were two common calls that I noticed were being reported by the profiler to take over a second to return in some cases. This didn't make any sense. The profiler showed the call (in mvc itself) to take around 2-4ms but the overall call took over 1 second. I spent quite a bit of time trying to narrow down the problem. I noticed that the subsequent ajax calls are always instant but those were on delayed loads and the initial call times seemed to always grow from the initial page load so I decided to check in firebug and IE's firebug equivalent and the reported times are the same. I decided then to delay the calls made by the page by about 10ms using a `setTimeout()`. Suddenly the calls are exactly what they should be in terms of how long they take to complete. (Note the actual calls are instant but the reported times aren't) I can not figure out why this is happening. I've tried to reproduce it using a new project and attempting to duplicate the behavior but alas, all is well in the new project. My initial thoughts were that the initial ajax calls were using the same connection due to the keep alive header, however, all the responses returned with "Closed" on the keep alive so I'm not sure that is the case. ## Here are the results from the different services ### Mini Profiler ![Mini profiler results](https://i.stack.imgur.com/imERZ.png) ### Firebug ![firebug results](https://i.stack.imgur.com/SC2e0.png) ### IE's firebug ![ie results](https://i.stack.imgur.com/tTDii.png) ## Javascript Helper function ``` <script type='text/javascript'> function LoadJson(url, callback, error) { $.ajax({ url: url, type: "POST", dataType: "json", success: function (ret) { callback(ret); }, error: function (ret) { //alert(url); } }); } </script> ``` ## Actual call ``` $(function () { LoadJson('/ajax/activeform', function (ret) { //Do something }); ); ``` Any help in understanding this would be appreciated. Thanks :)
Response times for ajax httprequests are based on time from the initial call
CC BY-SA 3.0
0
2011-06-10T15:19:12.817
2012-06-15T06:36:51.190
2011-06-10T16:04:23.140
365,526
365,526
[ "asp.net-mvc-3", "profiling", "profiler" ]
6,308,753
1
6,887,092
null
1
383
Take a look at [http://www.cssstickyfooter.com/](http://www.cssstickyfooter.com/) and resize your browser window to < 600px. Notice how the header and footer elements fall short as the content overflows beyond their width. Is there any way to prevent this from happening so that when the page scrolls horizontally, the header and footer don't fall short? ![](https://i.stack.imgur.com/eyZni.png)
Horizontal Overflow Issue with CSS Sticky Footer
CC BY-SA 3.0
0
2011-06-10T15:41:55.110
2011-07-31T02:04:08.547
2011-06-10T16:29:48.340
405,015
128,991
[ "css", "sticky-footer" ]
6,308,770
1
26,510,901
null
3
1,388
My layout is a fluid (98% of page width) containing box. I have multiple rows that take up 100% of the width of this container and have fixed height. I need 3 divs (green, red, blue) in each row — but the red div is hidden until toggled on, at which point it slides out. Currently, when the red div slides out, depending on the amount of “Main Text” in the blue div, the blue div will wrap under the row. ## My goal ![my goal](https://i.stack.imgur.com/wUtzs.png) ## Attempt 1 ``` $('#a').click(function() { $('#tC').animate({width: 'toggle'}); }); ``` ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!DOCTYPE html> <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <meta charset=utf-8 /> <title>JS Bin</title> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <style> article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; } #container { min-width: 900px; width: 98%; margin: 0 2%; float: left; border: 1px solid #000; height: 145px; overflow: hidden;} #a, #b, #tC { padding: 20px; font-size: 30px; height: 145px } #a { background: #0C0; width: 100px; float: left; } #tC { background: #C00; width: 400px; float: left; margin-right: 20px; } #b { background: #00C; height: 145px; float: left; position: relative } #bottom { position: absolute; bottom: 44px; font-size: 13px } </style> </head> <body> <div id="container"> <div id="a"><a id="click" href="#">A</a></div> <div id="tC">TC</div> <div id="b"> <div id="title">BBBB BBBB BBBBB BBBBB BBBBBBBBBBB BBBBBBBBBB BBBBBBBBBBBBBB</div> <div id="bottom">words at the bottom of blue div!</div> </div> </div> </body> </html> ``` Click the A to toggle the red div — this may not work on lower resolutions. [Demo on JS Bin](http://jsbin.com/usake4/3). ## Attempt 2 ``` $('#a').click(function() { $('#tC').animate({width: 'toggle'}); }); ``` ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!DOCTYPE html> <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <meta charset=utf-8 /> <title>JS Bin</title> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <style> article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; } #container { min-width: 900px; width: 98%; margin: 0 2%; float: left; border: 1px solid #000; height: 145px; overflow: hidden;} #a, #b, #tC { padding: 20px; font-size: 30px; height: 145px } #a { background: #0C0; width: 100px; float: left; } #tC { background: #C00; width: 400px; float: left; margin-right: 20px; } #b { background: #00C; height: 145px; float: left; position: relative } #bottom { position: absolute; bottom: 44px; font-size: 13px } </style> </head> <body> <div id="container"> <div id="a"><a id="click" href="#">A</a></div> <div id="tC">TC</div> <div id="b"> <div id="title">BBBB BBBB BBBBB BBBBB </div> <div id="bottom">words at the bottom of blue div!</div> </div> </div> </body> </html> ``` Click the A to toggle the red div. [Demo on JS Bin](http://jsbin.com/usake4/4). ## Problems The Main Text in the blue div is not wrapping. Instead of the text wrapping and the blue div always “filling in” the row, the blue div itself gets wrapped. The “bottom text” in the blue div should stick to the bottom, whether the Main Text is a single line or two lines.
Can I prevent a floating div from wrapping when it's resized?
CC BY-SA 3.0
null
2011-06-10T15:43:18.580
2014-10-22T16:53:32.687
2014-10-22T15:11:30.617
209,139
545,447
[ "jquery", "html", "css", "jquery-ui" ]
6,308,932
1
null
null
1
3,342
Sorry for my English) My class extends `TabActivity`. How remove divider, which place after `TabWidget`? or how setup color for it? ![enter image description here](https://i.stack.imgur.com/KAmSR.jpg) Thanks!!
Android TabWidget remove line at the bottom
CC BY-SA 3.0
0
2011-06-10T15:55:25.980
2013-02-28T10:39:33.530
2011-06-20T07:56:12.407
593,709
764,815
[ "android", "tabwidget", "divider" ]
6,308,976
1
null
null
2
3,441
How do you change tab orders on the form when it is too complex like having splitters and again another splitter inside the first one and panels and activex controls and user controls and even some panels behind other panels to show/hide them based on the selection of a radio button,... I am attaching the picture also, for me it is even hard to visually find the control and select it especially when it is a panel under other panels... so I took the route of overriding the and manually handling tabbing and works great. but I cannot imagine there is no way to handle this with IDE... maybe easier to change the resx files? any thoughts? ![enter image description here](https://i.stack.imgur.com/38WeF.png)
changing the tab order
CC BY-SA 3.0
0
2011-06-10T15:58:52.900
2011-06-10T16:02:24.300
null
null
320,724
[ "c#", "winforms" ]
6,308,969
1
6,310,006
null
2
12,564
I am trying to integrate PrimeFaces 3.0 into my JSF 2.0 project. I've created some example code to try and get a PrimeFaces `<p:dataTable>` with a delete button/link in a column for each row. I want the delete action to trigger an Ajax refresh of the table (my current code triggers a render of the enclosing form using @form). `<f:ajax>``<f:ajax>``<p:dataTable>` If I implement this purely using core JSF elements (`<h:dataTable>`, `<h:commandButton>`, etc.) everything works as expected. Pardon the ugly output, but I'm not going to waste time on CSS styling for my example code. ![Ugly but properly functioning core JSF implementation](https://i.stack.imgur.com/PyjzR.jpg) Here is the code for the core JSF implementation page: ``` <h:form id="dataTableForm"> <f:ajax listener="#{dataTableTestBean.processAjaxBehavior}" event="action" render="@form :messages :ajaxRenderTargetsInTemplate"> <h:panelGroup id="dataTablePanelGroup"> <h:commandLink id="commandLinkAddRow" value="Add Sample Row" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <h:commandButton id="commandButtonAddRow" value="Add Sample Row" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <sandbox:dataTableCC id="dataTableCC" valueList="#{dataTableTestBean.dataTableList}" /> </h:panelGroup> </f:ajax> <h:panelGroup rendered="#{empty dataTableTestBean.dataTableList}"> <h3>No Records To Display</h3> </h:panelGroup> <h:commandButton id="commandButtonBackToStartPage" value="#{bundle.backToStartPage}" action="start" immediate="true" /> </h:form> ``` Here is the code for the core JSF implementation CC: ``` <composite:implementation> <h:dataTable id="theDataTable" rendered="#{not empty cc.attrs.valueList}" value="#{cc.attrs.valueList}" var="row" emptyMessage="#{bundle.dataTableEmptyMessage}"> <f:facet name="header">#{bundle.dataTableHeader}</f:facet> <h:column id="columnDeleteButton"> <h:commandLink id="commandLinkDelete" value="Delete" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </h:column> <h:column> <h:commandButton alt="#{bundle.delete}" image="#{resource['images/onebit_33_24x24.gif']}" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </h:column> <h:column sortBy="#{row.name}"> <f:facet name="header"> #{bundle.columnHeaderName} </f:facet> <h:outputText value="#{row.name}" /> </h:column> <h:column sortBy="#{row.rank}"> <f:facet name="header"> #{bundle.columnHeaderRank} </f:facet> <h:outputText value="#{row.rank}" /> <f:facet name="footer"> #{bundle.columnFooterRank} </f:facet> </h:column> <h:column sortBy="#{row.serialNumber}"> <f:facet name="header"> #{bundle.columnHeaderSerialNumber} </f:facet> <h:outputText value="#{row.serialNumber}" /> <f:facet name="footer"> #{bundle.columnFooterSerialNumber} </f:facet> </h:column> <f:facet name="footer">#{bundle.dataTableFooter}</f:facet> </h:dataTable> </composite:implementation> ``` The core JSF implementation will nicely fire the Ajax events and do the Partial Page Rendering, part of which is the render of an `<h:messages>` that confirms the event was processed successfully. When I replace the `<h:dataTable>` with a `<p:dataTable>`, no problem. However, if I replace the `<h:commandButton>` and `<h:commandLink>` with `<p:commandButton>` and `<p:commandLink>`, the Ajax events are not making it to the `<f:ajax>` Ajax Group element. The record delete and insert operations do actually happen on the server, but the page is never refreshed. I will appear to the user that nothing happened. If you click the browser Refresh button, you will see that the operation did indeed happen. If you click the core JSF command button or command link, everything works. The PrimesFaces table renders and even the PrimeFaces "growl" popups are displayed as expected. Here is a screenshot of the PrimeFaces implementation that has the problem. Again, pardon the ugliness of the buttons and links. ![PrimeFaces implementation that has Ajax event problems](https://i.stack.imgur.com/uapY7.jpg) First, the page: ``` <p:growl id="growl" showSummary="false" showDetail="true" /> <h:form id="dataTableForm" styleClass="ui-widget"> <f:ajax listener="#{dataTableTestBean.processAjaxBehavior}" event="action" render="@form :growl :ajaxRenderTargetsInTemplate"> <h:panelGroup id="dataTablePanelGroup"> <p:commandLink id="pfCommandLinkAddRow" value="Add Sample Row (pf)" ajax="true" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <p:commandButton id="pfCommandButtonAddRow" value="Add Sample Row (pf)" ajax="true" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <h:commandLink id="hCommandLinkAddRow" value="Add Sample Row (h)" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <h:commandButton id="hCommandButtonAddRow" value="Add Sample Row (h)" actionListener="#{dataTableTestBean.handleAddDataTableRow}" /> <sandbox:primeFacesDataTableCC id="dataTableCC" valueList="#{dataTableTestBean.dataTableList}" /> </h:panelGroup> </f:ajax> <h:panelGroup rendered="#{empty dataTableTestBean.dataTableList}"> <h3>No Records To Display</h3> </h:panelGroup> <h:commandButton id="commandButtonBackToStartPage" value="#{bundle.backToStartPage}" action="start" immediate="true" /> </h:form> ``` and the CC: ``` <composite:implementation> <p:dataTable id="theDataTable" rendered="#{not empty cc.attrs.valueList}" value="#{cc.attrs.valueList}" var="row" emptyMessage="#{bundle.dataTableEmptyMessage}"> <f:facet name="header">#{bundle.dataTableHeader}</f:facet> <p:column id="columnpclDelete"> <p:commandLink id="pclDelete" value="Delete (pf)" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </p:column> <p:column id="columnpcbDeleteIconOnly"> <p:commandButton id="pcbDeleteIconOnly" ajax="true" global="true" alt="#{bundle.delete}" image="ui-icon ui-icon-trash" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </p:column> <p:column id="columnhclDelete"> <h:commandLink id="hclDelete" value="Delete (h)" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </p:column> <p:column id="columnhcbDeleteWithImage"> <h:commandButton id="hcbDeleteWithImage" alt="#{bundle.delete}" image="#{resource['images/onebit_33_24x24.gif']}" action="#{dataTableTestBean.actionDeleteDataTableRow(row)}" /> </p:column> <p:column id="columnName" sortBy="#{row.name}"> <f:facet name="header"> #{bundle.columnHeaderName} </f:facet> <h:outputText value="#{row.name}" /> </p:column> <p:column id="columnRank" sortBy="#{row.rank}"> <f:facet name="header"> #{bundle.columnHeaderRank} </f:facet> <h:outputText value="#{row.rank}" /> <f:facet name="footer"> #{bundle.columnFooterRank} </f:facet> </p:column> <p:column id="serialNumber" sortBy="#{row.serialNumber}"> <f:facet name="header"> #{bundle.columnHeaderSerialNumber} </f:facet> <h:outputText value="#{row.serialNumber}" /> <f:facet name="footer"> #{bundle.columnFooterSerialNumber} </f:facet> </p:column> <f:facet name="footer">#{bundle.dataTableFooter}</f:facet> </p:dataTable> </composite:implementation> ```
PrimeFaces 3.0 - f:ajax Ajax Group not receiving events from p:commandButton or p:commandLink
CC BY-SA 3.0
null
2011-06-10T15:58:01.830
2011-06-10T17:30:50.590
2011-06-10T16:04:36.853
346,112
346,112
[ "java", "ajax", "jsf-2", "facelets", "primefaces" ]
6,309,237
1
6,309,485
null
6
7,595
this is a follow-up post of [Using pHash from .NET](https://stackoverflow.com/questions/6254447/using-phash-from-net) How would you declare following C++ declaration in .NET? ``` int ph_dct_imagehash(const char* file,ulong64 &hash); ``` So far i have ``` [DllImport(@"pHash.dll")] public static extern int ph_dct_imagehash(string file, ref ulong hash); ``` But I am now getting following error for ``` ulong hash1 = 0, hash2 = 0; string firstImage = @"C:\Users\dance2die\Pictures\2011-01-23\177.JPG"; string secondImage = @"C:\Users\dance2die\Pictures\2011-01-23\176.JPG"; ph_dct_imagehash(firstImage, ref hash1); ph_dct_imagehash(secondImage, ref hash2); ``` ![enter image description here](https://i.stack.imgur.com/p7SWo.png) It basically says that my declartion of ph_dtc_imagehash is wrong.
How would you declare DLL import signature?
CC BY-SA 3.0
0
2011-06-10T16:20:05.400
2011-06-10T16:39:33.870
2017-05-23T12:16:51.877
-1
4,035
[ "c#", ".net", "c++", "dllimport" ]
6,309,340
1
6,310,236
null
3
11,096
With command line, I use `/r:` to add reference with VS2010 as follows. ``` csc Program.cs /r:System.ComponentModel.Composition.dll /r:SharedLibrary.dll ``` How can I add reference in VS2010 IDE? I tried to right click on the Solution Explorer, then clicked "Add Reference ...", but I can't find the `System.ComponentModel.Composition`. ![enter image description here](https://i.stack.imgur.com/4v4Sy.jpg)
How to add System.ComponentModel.Composition.dll in VS2010 IDE?
CC BY-SA 3.0
null
2011-06-10T16:27:54.257
2011-06-10T17:52:31.627
null
null
260,127
[ "visual-studio", "visual-studio-2010", "mef" ]
6,309,346
1
null
null
1
110
If I use an `NSTask` object which is launched, is it possible to get the process invoked by the task? For example, Terminal does this to show it in the title bar: ![Terminal screenshot](https://i.stack.imgur.com/5rr6S.png) How can I get the process invoked by the `NSTask`'s process?
How can one get the subprocesses of an NSTask's process?
CC BY-SA 3.0
null
2011-06-10T16:28:32.500
2011-06-10T16:48:11.313
null
null
null
[ "objective-c", "c", "cocoa", "process", "nstask" ]
6,309,345
1
6,312,931
null
0
2,168
I have a basic M:N setup with three tables: candidate, position, and candidate_position. Here's a screenshot of the ERD from MySQL Workbench ![http://dl.dropbox.com/u/180411/stackoverflow/erd.png](https://i.stack.imgur.com/L3LuZ.png) Now, moving on from that let's talk about forms. In the default world of symfony generator, you'd have a separate CRUD interface for all three of these tables. However, I don't want to have a CRUD interface for `candidate_position`. What I want, is for the create and edit actions of the Candidate interface to contain a multi-choice field (select list, checkbox array, whatever) that would create the CandidatePosition records as part of the Candidate actions. On to the code ``` --- detect_relations: true options: type: InnoDB candidate: columns: id: type: integer(4) primary: true unsigned: true notnull: true autoincrement: true first_name: type: string(45) notnull: true last_name: type: string(45) notnull: true created_at: type: integer(4) unsigned: true relations: Positions: class: Position refClass: CandidatePosition local: candidate_id foreign: position_id position: columns: id: type: integer(4) primary: true unsigned: true notnull: true autoincrement: true name: type: string(45) relations: Candidates: class: Candidate refClass: CandidatePosition local: position_id foreign: candidate_id candidatePosition: tableName: candidate_position columns: candidate_id: type: integer(4) primary: true unsigned: true notnull: true position_id: type: integer(4) primary: true unsigned: true notnull: true indexes: fk_candidate_position_candidate1: fields: [candidate_id] fk_candidate_position_position1: fields: [position_id] ``` ``` generator: class: sfDoctrineGenerator param: model_class: Candidate theme: admin non_verbose_templates: true with_show: false singular: ~ plural: ~ route_prefix: candidate with_doctrine_route: true actions_base_class: sfActions config: actions: ~ fields: first_name: { label: First Name } last_name: { label: Last Name } created_at: { label: Created On } candidate_positions: {label: Positions} list: sort: [last_name, asc] filter: ~ form: display: "User": [first_name, last_name] "Applying For": [candidate_positions] fields : hide: [created_at] edit: ~ new: ~ ``` ``` class candidateForm extends BasecandidateForm { public function configure() { unset( $this['created_at'] ); $this->widgetSchema['candidate_positions'] = new sfWidgetFormDoctrineChoice( array( 'multiple' => true, 'model' => 'Position', 'renderer_class' => 'sfWidgetFormSelectCheckbox' ) ); $this->validatorSchema['candidate_positions'] = new sfValidatorDoctrineChoice( array( 'multiple' => true, 'model' => 'Position', 'min' => 1 ) ); } } ``` This all works, except when it comes to actually saving the data. This is the point where I get stuck. I clearly need to do to create/edit/delete the CandidatePosition records, but I'm not sure where to start working. In `candidateActions`? Override `Basecandidate::save()`? Let me know if there's any other data you might need to see. - -
Symfony Generator Forms, Doctrine, and M:N Relationships
CC BY-SA 3.0
null
2011-06-10T16:28:32.343
2011-06-13T16:24:53.453
null
null
8,815
[ "php", "symfony1", "doctrine", "symfony-1.4", "symfony-forms" ]
6,309,465
1
6,309,513
null
4
6,279
i tried to use media queries in my sites. it works well in firefox and safari, but not for IE. does anyone know to make the media queries work well in IE(internet explorer 7 and 8). here is the code : ![enter image description here](https://i.stack.imgur.com/AN0Sx.png)
media queries internet explorer
CC BY-SA 3.0
null
2011-06-10T16:37:55.720
2013-08-30T19:45:54.703
null
null
716,542
[ "html", "css", "internet-explorer", "media-queries" ]
6,309,492
1
6,309,624
null
0
2,728
My company doc pages need to be laid out as specified in [this image](https://i.stack.imgur.com/YkaSv.png): ![](https://i.stack.imgur.com/YkaSv.png) The iframes are handled by the doc team software, MadCap Flare. The problem we're having is that we'd like the breadcrumbs and topic heading/logo to be fixed elements at the top of the page and have the topic content be scrollable, without disappearing under the fixed elements at the top. We'd also like for the topic content scrollbar to be the web browser scrollbar, and not an overflow scroller. Additionally, because we have fixed elements at the top, we need to avoid content disappearing under the fixed element such as when the page loads or a link is clicked to an anchor somewhere on the page (anchors load at the top of the page and not the top of the content table cell). The built content looks like this: ``` <body> <table class="superheader"> <tr class="topRow"> <td class="headingBreadcrumbs"> <div class="breadcrumbs">breadcrumb trail</div> <h1>topic heading</h1> </td> <td class="headingLogo"> <img src="logo.png"> </td> </tr> <tr class="contentRow"> <td class="content" colspan="2">topic content - full of tables, divs, paragraphs, lists, etc...</td> </tr> </table> </body> ``` I'm not married to the inner table. I'll welcome a different solution so long as: - - -
Scrollable table content when top row has fixed position
CC BY-SA 3.0
null
2011-06-10T16:39:54.290
2017-11-05T11:08:00.347
2017-11-05T11:08:00.347
4,370,109
773,720
[ "html", "css", "scroll", "html-table", "css-position" ]
6,309,790
1
null
null
1
1,526
I've long been trying to make an image viewer, but really I do not what does not work. Here's a picture like you should get! ![enter image description here](https://i.stack.imgur.com/pfwSr.png) This is UIScrollView. The UIImage add to UIScrollView. When user scroll - image must download to UIImageView. I think we need download image in a separate thread. For this I am using - NSOperationqueue and NSInvocationOperation. In delegate: ``` - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. MyThumbnailsBook * myThumbnailsBook = [[MyThumbnailsBook alloc] initWithFrame:CGRectMake(0, 20, 768, 1004)]; [myThumbnailsBook createThumbnails]; [myThumbnailsBook setContentSize:CGSizeMake(768, 1004 * 10)]; [myThumbnailsBook setBackgroundColor:[UIColor blackColor]]; [self.window addSubview:myThumbnailsBook]; [self.window makeKeyAndVisible]; return YES; } ``` ``` #define COUNT 100 #import "MyThumbnailsBook.h" #import "MyImageDownload.h" @implementation MyThumbnailsBook #pragma mark - #pragma mark Initialization & Create Thumbnails - (id)initWithFrame:(CGRect)frame{ if((self = [super initWithFrame:frame])){ self.delegate = self; } return self; } - (void)createThumbnails{ float point_x = 20; float point_y = 20; for(NSInteger i = 0; i < COUNT; i++){ if(i%3==0 && i != 0){ point_x = 20; point_y += 220; } // Create new image view. NSURL * url = [[NSURL alloc] initWithString:@"http://storage.casinotv.com/videos/SOYCL/pages/P68.jpg"]; MyImageDownload * imageDownload = [[MyImageDownload alloc] initWithImageURL:url]; [imageDownload setFrame:CGRectMake(point_x, point_y, 200, 200)]; [self addSubview:imageDownload]; [imageDownload release]; [url release]; point_x += 220; } } #pragma mark - #pragma mark Scroll View Protocol - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ // If scroll view no decelerating. if(!decelerate){ [self asyncImageDownload]; } } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ [self asyncImageDownload]; } #pragma mark - #pragma mark Download Image // If scroll stopped - download image to thumbnails. - (void)asyncImageDownload{ } @end ``` In class inherit UIScrollView MyImageDownload.m ``` #import "MyImageDownload.h" @implementation MyImageDownload // This is init method. When class init - we add new operation for download image. - (id)initWithImageURL:(NSURL*)url{ if((self == [super init])){ [self setBackgroundColor:[UIColor yellowColor]]; NSArray * params = [NSArray arrayWithObjects:url, nil]; queue = [[NSOperationQueue alloc] init]; [queue setMaxConcurrentOperationCount:1]; NSInvocationOperation* operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(asyncDownload:) object:params]; [queue addOperation:operation]; [params release]; } return self; } // Download image to data and after to self (UIImageView). - (void)asyncDownload:(NSArray *)params{ NSData * data = [NSData dataWithContentsOfURL:[params objectAtIndex:0]]; // Get image data with url. if(data) [self setImage:[UIImage imageWithData:data]]; [data release]; } @end ``` In this example, the images are not loaded and I do not understand why? I have always used these classes in which the images were loaded from the internet, but I also had problems with memory and I do not know too how to solve it. For example, when to scroll images I get exception - and after app crash. And I have no idea what to do. I understand what you need as a separate download of images over time and to remove non visible objects but I have found I need the algorithm. For example - when i go to scrollDidScroll method i get all object when i not see them and remove image: ``` NSArray *views = [self subviews]; for (UIImageView *v in views) { if(v.frame.origin.y >= self.contentOffset.y && v.frame.origin.y <= self.contentOffset.y + self.frame.size.height){ // If image of imageview is equal nil - call new operation if(v.image == nil){ [self requestImageForIndexPath:[NSNumber numberWithInt:v.tag]]; } else { v.image = nil; } } } ``` - I was confused and ask for help in resolving this issue. TNX all!
Photo Viewer iPad & iPhone
CC BY-SA 3.0
null
2011-06-10T17:09:53.610
2011-06-10T17:16:37.990
null
null
587,415
[ "ios", "uiscrollview", "nsoperationqueue", "photoviewer" ]
6,309,871
1
8,080,016
null
1
755
I have a small project I am working on HTML5 canvas and I wanted to get some ideas how to accomplish it. I have built an outline of a tree using all the canvas line functions. lineTo, bezierCurveTo, quadracticCurve, etc. I have attached a picture of the outline. Now, what I would like to do is have some code that fills a percent of this outline. Kind of like a progress bar starting from the bottom. Does anyone have ideas on how to accomplish this? Thanks ![enter image description here](https://i.stack.imgur.com/IPRFD.png)
Custom shape and fill in HTML5 canvas
CC BY-SA 3.0
0
2011-06-10T17:17:54.857
2011-11-10T13:12:11.413
null
null
524,604
[ "html" ]
6,309,946
1
6,311,585
null
9
2,965
My question deals with this UI sample. ![enter image description here](https://i.stack.imgur.com/dH8bx.png) Having trouble with approach to managing the "selected" state of various UI view components. For example, I have menus above from which the user makes various selections. These selections should cause updates in the menus themselves (HL selected items) and also cause updates in the results, which would be based on the selections made. Also, the menus have different kinds of rules. For example, you can only have one "list" selected at a time, but you can have multiple "tags" selected. One approach that I was thinking about was to create a Backbone model that holds the state of the UI "selection". For example, I could have a model SearchCriteria that holds this information. Then, when a user makes choices in the UI, I could update this model. I could have the various view components listen for changes in this model (as well as changes in the primary data models.) Then, the views would update their visual state by updating which items are shown as selected. One item I am struggling with in this approach is who should be responsible for updating the selected state of an item. For example, on the list of tags, I might have the following pieces defined... - - - - Should I... - - - Sorry for so many questions. I am just having a hard time moving to this model of development.
Backbone.js Approach to Managing UI State / Handling Selections in UI
CC BY-SA 3.0
0
2011-06-10T17:24:32.557
2012-03-22T12:10:48.977
null
null
161,349
[ "backbone.js" ]
6,310,296
1
6,310,947
null
0
1,580
I am using `jqGrid` with a horizontal scrollbar, but when I use the horizontal scrollbar the column header does not move together with the columns. Once I stop scrolling the grid comes back to normal. See the attached picture: ![enter image description here](https://i.stack.imgur.com/GC5OG.png) This is happening in FF (4.0.1) but not in IE8. Here are the grid options I use: ``` width:'800', shrinkToFit:false, height: 500, pager: '#pagerDiv', gridview: true, rowNum: 50, rowTotal: 500, sortorder: 'desc', cellEdit: true, cellsubmit: 'remote', cellurl: 'MyURL', beforeSaveCell: function (rowid, cellname, value, iRow, iCol) { return parse(value); }, viewrecords: true, loadComplete: loadCompleteHandler, ignoreCase: true .... jQuery(function(){ jQuery("#listTable").jqGrid('filterToolbar',{ stringResult: true, searchOnEnter: false }); }); ``` I have `jqGrid` version 3.8.2, `jQuery` 1.4.4 (full). Is there any way to fix this?
jqGrid column header display slows down when scrolling horizontally
CC BY-SA 3.0
null
2011-06-10T17:58:20.190
2011-06-10T19:04:07.820
null
null
384,598
[ "javascript", "jquery", "jquery-ui", "jqgrid" ]
6,310,308
1
6,310,326
null
1
1,824
I'm having a problem in IE9: . So even if i have the last radio input pressed, if i click anywhere within the wrapper, the radio will go back to the first one. As soon as i hover my mouse off the wrapper div the light blue color on the first radio input changes back to gray as it should be. ![enter image description here](https://i.stack.imgur.com/wq6Xb.png) My page works as expected in FF, Chrome and IE-Compatability mode. I tried creating a simple page with inputs and can't recreate the problem as it's happening in my large web page. Any input into what can be causing this and/or how to stop it would be greatly appreciated. ``` <div id="wrapper"> ... <div id="region_sel_type"> <input type="radio" id="optLine" name="radio_region_sel_type" value="Line" /><label id="lblForOptLine" for="optLine" title="Line" unselectable="on"></label> <input type="radio" id="optPoint" name="radio_region_sel_type" value="Point" /><label id="lblForOptPoint" for="optPoint" title="Point" unselectable="on"></label> <input type="radio" id="optPolygon" name="radio_region_sel_type" value="Polygon" /><label id="lblForOptPolygon" for="optPolygon" title="Polygon" unselectable="on"></label> <input type="radio" id="optList" name="radio_region_sel_type" value="List" /><label id="lblForOptList" for="optList" title="Input Coordinates" unselectable="on"></label> <input type="radio" id="optUploadKML" name="radio_region_sel_type" value="KML" /><label id="lblOptUploadKML" for="optUploadKML" title="Upload KML" unselectable="on"></label> <input type="radio" id="optOpen" name="radio_region_sel_type" value="Open" /><label id="lblForOptOptn" for="optOpen" title="Open Saved ROI" unselectable="on"></label> </div> ... </div> ``` Somewhere inside the 'wrapper' div i had a self-closing label IE9 did not support (even though they should) ``` <label id='x'/> ```
input radio button hover issues in IE 9
CC BY-SA 3.0
0
2011-06-10T17:59:35.160
2011-06-10T19:19:43.767
2011-06-10T19:07:48.280
442,580
442,580
[ "javascript", "html", "css" ]
6,310,488
1
6,310,529
null
1
84
I have a layout that should be fairly straightforward, but for some unknown reason there is just this magical space appearing from ...... nothing. There is no element for it. I can't explain it. I have a picture, and a jsFiddle that reproduces the problem. This happens across all browsers. [http://jsfiddle.net/ciel/qSQ7b/](http://jsfiddle.net/ciel/qSQ7b/) ![Picture](https://i.stack.imgur.com/BdCig.jpg)
Peculiar Non-Existing Element Space in HTML
CC BY-SA 3.0
null
2011-06-10T18:19:04.147
2011-06-10T18:33:53.453
null
null
84,685
[ "html", "css" ]
6,310,631
1
6,315,768
null
0
123
Is there anyway to make EF navigational properties unidirectional? In the example below, I would like to remove "Customers" property from the "Orders" table. Driver behind this is the "circular reference" error I am receiving with Telerik Grid (which tries to serialize my object for Ajax Binding). ![example](https://i.stack.imgur.com/3Gtw6.png)
Unidirectional Navigation Properties
CC BY-SA 3.0
null
2011-06-10T18:35:32.290
2011-06-11T11:59:34.267
null
null
16,522
[ "visual-studio-2010", "entity-framework", "entity-framework-4" ]
6,311,062
1
6,311,385
null
0
1,692
I posted recently regarding onbeforeunload implementation. Its working now but that only solved half of the problem. My application has lot of tabs and I want to throw this same confirmation to user if he clicks on a new tab without saving changes. all the tabs are div elements. How do you implement something of this sort? Sample tab structure is attached, where every tab loads a new page.![enter image description here](https://i.stack.imgur.com/3ooQj.png)
How to implement onbeforeunload behavior for a div?
CC BY-SA 3.0
null
2011-06-10T19:16:18.147
2011-06-10T20:03:58.693
2011-06-10T20:03:58.693
157,882
449,035
[ "javascript" ]
6,311,125
1
6,311,253
null
6
233
I'm trying to create a very simple grammar to learn to use ANTLR but I get the following message: This is my grammar attempt: ``` grammar Robot; file : command+; command : ( delay|type|move|click|rclick) ; delay : 'wait' number ';'; type : 'type' id ';'; move : 'move' number ',' number ';'; click : 'click' ; rclick : 'rlick' ; id : ('a'..'z'|'A'..'Z')+ ; number : ('0'..'9')+ ; WS : (' ' | '\t' | '\r' | '\n' ) { skip();} ; ``` I'm using ANTLRWorks plugin for IDEA: ![This is what it looks like](https://i.stack.imgur.com/psQeU.png)
The following alternatives can never be reached: 2
CC BY-SA 3.0
null
2011-06-10T19:22:04.503
2011-06-10T19:49:57.057
2011-06-10T19:26:32.180
87,197
20,654
[ "java", "antlr", "grammar", "antlrworks" ]
6,311,296
1
6,311,917
null
3
2,041
I am seriously considering doing a Optical Character Recognition program. I am well versed with Java and would love to know about libraries available out there. Basically, I want to convert something like the following to text. I will need to give manual interruption to specify a pattern. For example, I would need to ask user to mark f in this text, so that I know where f occurs. ![enter image description here](https://i.stack.imgur.com/mQKZM.png) I am a newbie to this entirely, so I dont mind learning from scratch as well. Need guidance.
Where do I start for Text Pattern Recognition - Java Based
CC BY-SA 3.0
null
2011-06-10T19:40:46.750
2011-06-10T22:46:58.423
null
null
1,977,903
[ "java", "pattern-matching", "ocr" ]
6,311,382
1
6,312,399
null
0
408
I had accidentally synthesized parentViewController Edit/ This was working, and now it isn't, I don't think that I have done anything in code that would affect this behavior. Here is what I am doing: I have a view and associated view controller, called `NewAssetViewController`. NewAssetViewController's view has a mixture of `UITextField`s `and UITextView`s:![enter image description here](https://i.stack.imgur.com/pZIPk.png) when I click on the `UITextView` I receive the delegate method `textViewShouldBeginEditing:` in this method I present my customController view called `MultiPicker`: ``` [self presentModalViewController:multiPicker animated:YES]; ``` if the user selects a button on this interface it either cancels, or returns selecting a value, I will only use the cancel case because it behaves the same way, and doesn't have any extra code. multipicker's cancel method: ``` -(IBAction)cancel:(id)sender { //close returning nothing... [delegate multiPickerDidCancel:self]; } ``` which calls `NewAssetController`'s `multiPickerDidCancel:` method: ``` -(void)multiPickerDidCancel:(MultiPicker *)aMultiPicker { [self dismissModalViewControllerAnimated:YES]; [aMultiPicker reset]; } ``` at this point now it freezes, doesn't crash, if I pause the debugger, this is what the trace looks like: ![enter image description here](https://i.stack.imgur.com/pEQXg.png) with the frame above representing some assembly: ``` 0x00ec121e <+0317> mov %eax,%edi 0x00ec1220 <+0319> jmp 0xec11bb <-[UIViewController dismissModalViewControllerWithTransition:]+218> 0x00ec1222 <+0321> mov 0x4e446b(%ebx),%eax 0x00ec1228 <+0327> mov %eax,0x4(%esp) 0x00ec122c <+0331> mov %edi,(%esp) 0x00ec122f <+0334> call 0x128e98a <dyld_stub_objc_msgSend> 0x00ec1234 <+0339> mov %eax,-0x1c(%ebp) 0x00ec1237 <+0342> mov 0x4e1bcb(%ebx),%edx 0x00ec123d <+0348> mov %edx,0x4(%esp) 0x00ec1241 <+0352> mov %esi,(%esp) 0x00ec1244 <+0355> call 0x128e98a <dyld_stub_objc_msgSend> 0x00ec1249 <+0360> cmpl $0x3,-0x20(%ebp) 0x00ec124d <+0364> jne 0xec1277 <-[UIViewController dismissModalViewControllerWithTransition:]+406> 0x00ec124f <+0366> mov 0x4e295f(%ebx),%eax 0x00ec1255 <+0372> mov %eax,0x4(%esp) 0x00ec1259 <+0376> mov %edi,(%esp) ```
dismissModalViewControllerAnimated: freezes app, not a crash
CC BY-SA 3.0
null
2011-06-10T19:49:28.810
2011-06-10T21:46:01.607
2011-06-10T21:45:25.023
593,382
593,382
[ "iphone", "debugging", "ios4", "uikit", "modalviewcontroller" ]
6,311,413
1
8,124,491
null
12
15,895
I am using virtual machine VirtualBox ![enter image description here](https://i.stack.imgur.com/VWNci.jpg) Now, I need to limit bandwith. I have 2 Virtual Machines running. One is just for fun. One is for important database access. I need to tell the "fun machine" to just use bandwith on network with less priority if the "database machine" is not using maximum of the bandwith. I read [this](http://forums.virtualbox.org/viewtopic.php?f=1&t=40680) But I am working on Windows. Would be great if you have any suggestions.
Virtual Box limit Bandwith on network
CC BY-SA 3.0
0
2011-06-10T19:53:17.550
2013-08-29T17:12:11.593
null
null
375,368
[ "networking", "configuration", "virtual-machine", "virtualbox", "lan" ]
6,311,432
1
6,311,879
null
1
1,158
i need to draw something like the image below using WPF... i need this in xaml code and in c# in code behind. ![image example](https://i.stack.imgur.com/92cNI.png) Thanks for any help.
Draw using WPF with c#
CC BY-SA 3.0
0
2011-06-10T19:55:09.737
2016-03-21T13:28:47.307
2011-06-10T20:09:16.523
624,630
624,630
[ "c#", "wpf", "drawing" ]
6,311,460
1
6,311,484
null
1
16,691
I am trying to write a function in Matlab that takes an RGB image of class unit8 and double and converts it to a YCBCR image. The transformation formula is below. ![The transformation between YCbCr and RGB](https://i.stack.imgur.com/u35da.png) I would be really thankful for any help of any kind.
rgb to ycbcr conversion in matlab
CC BY-SA 3.0
0
2011-06-10T19:57:16.643
2014-06-02T17:10:49.463
null
null
712,796
[ "matlab", "image-processing", "image-conversion" ]
6,311,851
1
6,312,415
null
2
169
Someone sent me a database (via means of an `.mdf` and `.ldf` file) which I attached on a server (with no errors, warnings, etc) and though I don't have proof (since I don't have access to the server the DB came from), it appears the primary key (identity) values are different from what they were originally. Also, they appear to be "reset" - all primary key values are starting at 1, whereas based on foreign key references it is clear that is incorrect (for example, a table with only 1 row has a primary key value of 1, but a table that references it references a value of 7). Though I don't really care, I am curious as to why this is happening (if there is an explanation)? What I really need is to figure out if there is a way to attach the database and retain the proper values? As far as I can tell, the foreign key references are set up properly. Here are some screenshots: ![foreign key relationship](https://i.stack.imgur.com/ZTzb2.png) ![foreign key relationship columns](https://i.stack.imgur.com/aFAwK.png) ![WTF!?](https://i.stack.imgur.com/h5USe.png)
Why are "identity" column values incorrect when I attach a database?
CC BY-SA 3.0
null
2011-06-10T20:43:02.227
2011-06-10T21:48:23.380
2011-06-10T21:43:23.087
199,797
199,797
[ "sql", "sql-server-2008" ]
6,311,862
1
6,408,019
null
3
1,802
I want to know, how can I erase a custom rect (with, for example, an `UIView` in `IB` or something else) of an `UIImageView` in order to display an other `UIImageView` positioned underneath. ![enter image description here](https://i.stack.imgur.com/NmBNw.jpg) I didn't manage to do it using some response in the forum...
Erase a rect of an UIImageView
CC BY-SA 3.0
0
2011-06-10T20:44:16.797
2011-06-20T09:46:30.507
2011-06-20T09:46:30.507
656,600
553,488
[ "iphone", "objective-c", "ios", "ipad", "uiimageview" ]
6,311,920
1
6,333,968
null
1
431
So I made an application that creates a graphical timeline from a csv file. I have that part finished now I just need help getting the image "pretty". When capturing the image the border from the JFrame is captured too! ![enter image description here](https://i.stack.imgur.com/IsXcZ.jpg)
How do I get rid of the border made by capturing a jframe image to file?
CC BY-SA 3.0
null
2011-06-10T20:49:32.967
2011-11-02T17:20:52.600
2011-11-02T17:20:52.600
496,830
783,280
[ "java", "image", "swing", "jframe", "awtrobot" ]
6,311,930
1
6,311,978
null
1
36,771
I'm creating an HTML file containing a table with alternating row colors. One of the columns in this table is a set of cells containing sub-tables. My problem is that I can't get the sub-tables to have the same background color as the row in which they're a member. I've tried having a CSS class with ``` background-color: transparent; ``` but that doesn't seem to change anything at all. It might be easier to understand the problem with a visual. I fuzzed-out the text and circled the sub-tables to highlight them. Basically, I need those white areas within the rows with a gray background to also have gray backgrounds (for their entire table) so you can't really tell it's a separate table. ![enter image description here](https://i.stack.imgur.com/EzMiF.png) Also, this has to work in IE. I know, I know, but...that's how it is. Thanks!
How to give a nested HTML table cell a transparent background?
CC BY-SA 3.0
null
2011-06-10T20:50:27.663
2016-04-24T03:46:24.790
2016-04-24T03:46:24.790
4,233,593
397,985
[ "html", "css", "internet-explorer", "transparent", "html-table" ]
6,311,964
1
6,312,735
null
2
620
I am using a `BufferedImage` in java after capturing the image out of a JFrame. Here's the thing it has to keep the same image size. Here's the code I'm using to capture the image. ``` private void grabScreenShot() throws Exception { BufferedImage image = (BufferedImage)createImage(getSize().width, getSize().height); paint(image.getGraphics()); try{ //ImageIO.write(image, "jpg", new File(TimeTable.path+"\\TimeLine.jpg")); ImageIO.write(image, "jpg", new File("C:\\Users\\"+TimeTable.user+"\\AppData\\TimeLineMacroProgram\\TimeLine.jpg")); //ImageIO.write(image, "jpg", new File("C:\\ProgramData\\TimeLineMacroProgram\\TimeLine.jpg")); System.out.println("Image was created"); } catch (IOException e){ System.out.println("Had trouble writing the image."); throw e; } } ``` And here's the image it creates ![enter image description here](https://i.stack.imgur.com/wi2JZ.jpg)
How can I get a less pixelated screenshot in java?
CC BY-SA 3.0
null
2011-06-10T20:53:29.203
2011-06-10T22:36:32.307
2011-06-10T21:00:44.227
446,591
783,280
[ "java", "image", "jframe" ]
6,312,067
1
12,387,340
null
89
115,704
Consider a `div` with the `border-radius`, `border`, and `background-color` CSS attributes applied: ``` <div style="background-color:#EEEEEE; border-radius:10px; border: 1px black solid;"> Blah </div> ``` ![enter image description here](https://i.stack.imgur.com/Dx5Bu.png) Now consider a similar layout but with the `background-color` specified in an inner-div: ``` <div style="border-radius:10px; border: 1px black solid;"> <div style="background-color:#EEEEEE;"> Blah </div> </div> ``` ![enter image description here](https://i.stack.imgur.com/GohhL.png) I'm dismayed by the fact that the `background-color` of the `<div>` is obscuring the border of the `<div>`. This is a simplified sample of the problem. In reality, I'm using a `<table>` as the inner element with alternating row colors. And I'm using a `<div>` as the outer element since `border-radius` does not seem to work on the `<table>` element. [Here's a jsfiddle](http://jsfiddle.net/jpNy7/9/) of a sample of this problem. Does anyone have a suggestion for a solution?
border-radius + background-color == cropped border
CC BY-SA 3.0
0
2011-06-10T21:05:33.777
2016-09-27T22:34:46.960
2015-11-03T02:46:55.573
189,950
189,950
[ "html", "border", "background-color", "css" ]
6,312,288
1
null
null
0
731
I'm using an AdvancedDataGrid in ActionScript 3/Flex 4. The grid has 5 columns: Caller Intent, Labels, Strategy, Confirmation Mode, and Confirmation Promptlet. All columns are editable except for Labels. However, if you change the Confirmation Mode value to NEVER, the next column Confirmation Promptlet becomes uneditable and is set with the value 'n/a' (this is the desired functionality). ![Screen in question](https://i.stack.imgur.com/sWD87.jpg) Unfortunately, the image is not clear. In the second row, I changed the Confirmation Mode value to NEVER. This is what happens when I start tabbing out of the Confirmation Mode cell: 1st Tab: Confirmation Promptlet populated with 'n/a'. I don't see anything in focus. 2nd Tab: The 5th tab from the left in the view stack (dark grey) is in focus. 3rd Tab: I don't see anything in focus. 4th Tab: The button with the green '+' (top left) is in focus. 5th Tab: The grid itself is in focus. 6th Tab: Finally I get to the Caller Intent cell of the next row (when this image was captured) I tried setting tabEnabled="false" and tabFocusEnabled="false" for the button. I set only tabFocusEnabled="false" for the AdvancedDataGrid. But then the Tab focus starts moving to the components in the upper right panel and lower right panel. I need to accomplish 2 things: 1. Have tabbing be contained in the grid, in the upper right panel, and in the lower right panel. Meaning tabbing should not cross from one area to another. 2. Have an uneditable field not mess up the normal tabbing behaviour.
How to make a grid cell uneditable without messing up tabbing
CC BY-SA 3.0
null
2011-06-10T21:33:49.543
2014-06-27T19:33:26.500
2014-06-27T19:33:26.500
2,246,344
680,975
[ "actionscript-3", "flex4", "advanceddatagrid", "tabbing" ]
6,312,373
1
6,313,375
null
3
2,526
What am I doing wrong ? I just downloaded the latest Rx sdk, installed. Using vs 2010, .net 4 have all latest sp/updates etc. Downloaded/installed linqpad, Added reference to the reactive dll as shown in the attached screenshot. Added the one line as shown in the linqpad demo but get an error when I run. Please advise. Right click on image and view image for clear view. thanks ![enter image description here](https://i.stack.imgur.com/kHTwr.gif)
linqpad error using Rx Reactive extensions in c#
CC BY-SA 3.0
0
2011-06-10T21:43:13.477
2012-01-12T23:34:49.320
null
null
666,490
[ "c#", "linq", "system.reactive", "linqpad" ]
6,312,422
1
null
null
0
2,822
I am throwing an exception in a Silverlight enabled service and catching it in my silverlight client. I have done everything as per the manual, but still getting what I think is unexpected behavior. Code from Client ``` try { client.ThrowFaultExceptionCompleted += (s, args) => { DoCallback(args); }; client.ThrowFaultExceptionAsync(new ThrowFaultExceptionRequest()); } catch (FaultException<MyFaultException> myFex) { } catch (FaultException fex) { } ``` Here is the code from the service My Custom Fault Exception class ``` [DataContract] public class MyFaultException { private string _reason; private string _myExceptionStackTrace; [DataMember] public string Reason { get { return _reason; } set { _reason = value; } } [DataMember] public string MyExceptionStackTrace { get { return _myExceptionStackTrace; } set { _myExceptionStackTrace = value; } } } ``` The bit of service side code that throws the fault exception. For testing purposes I am calling this method from the client. ``` [OperationContract] [FaultContract(typeof(MyFaultException))] public void ThrowFaultException() { MyFaultException mfex = new MyFaultException(); mfex.Reason = "No Reason!"; mfex.MyExceptionStackTrace = "Long stack trace here"; System.ServiceModel.Web.WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; //throw new FaultException<MyFaultException>(mfex ,new FaultReason(new FaultReasonText("My Fault Reason Text here!")), new FaultCode("my fault code here")); throw new FaultException<MyFaultException>(mfex); } ``` no matter if I throw the FaultException with a single param or those three params in the commented line I get an error in my Reference.cs file in the silverlight proxy class like the one below ![error message in reference.cs](https://i.stack.imgur.com/fQnjP.jpg) and it doesnt ever go to either of the catch blocks.. Is this normal behavior? I have to now catch the error in the callback method DoCallback(args) and in that method check for (args.Error == null). Why doesnt the catch block get hit? Thanks for your time...
throwing Fault Exceptions in WCF service and handling in Silverlight
CC BY-SA 3.0
null
2011-06-10T21:49:09.433
2012-10-15T09:22:46.140
null
null
20,358
[ "silverlight", "wcf", "exception" ]
6,313,006
1
6,313,215
null
2
98
![enter image description here](https://i.stack.imgur.com/QqjUB.gif) Can anyone explain the weird presentation behavior in the UI screenshot above? As you can see, there's an undesirable separation between the insurance type and the top of the row. When looking at the code via Firebug, there's a clear break in the code. You can view this oddity in the code screenshot below. ![enter image description here](https://i.stack.imgur.com/pg6qI.gif) The div.insurance-type parent container has no CSS styles. In other words, the vertical-align property, the margin-top property, the padding-top property, and the float property are set to default values and don't inherit a value that might cause this presentation. The children divs have this style: ``` div#worklist table tr td.col-InsuranceType div.insurance-type div { display: block; margin-bottom: 2px; margin-left: 25px; } ``` The span.insurance-company has this style: ``` div#worklist table tr td.col-InsuranceType div.insurance-type span.insurance-company { font-weight: bold; } ``` The components of this web app are: - - - - - This issue occurs in FF4, IE8 and IE7. Please let me know if you know the root cause of this unexplainable presentation behavior. Thanks.
Unexplainable UI Presentation Problem
CC BY-SA 3.0
null
2011-06-10T23:26:58.793
2011-06-11T00:18:02.943
2011-06-10T23:52:07.853
127,907
127,907
[ "html", "css", "asp.net-mvc", "user-interface", "firebug" ]
6,313,629
1
null
null
4
3,539
After sending an e-mail using PHPMailer to my Gmail account, after clicking 'show details,' to the right of 'mailed-by,' it says 'yourhostingaccount.com.' Here is a picture: ![](https://i.stack.imgur.com/X5J0T.png) I've read you may change it using the fifth parameter of PHP mail(), although I'm not using that. Is there a way to change this using PHPMailer? Thanks!
PHPMailer: Set mailed-by Message Header
CC BY-SA 3.0
0
2011-06-11T02:07:00.170
2012-09-18T10:12:09.753
2011-06-11T02:20:07.120
667,456
667,456
[ "php", "phpmailer", "email-headers" ]
6,314,005
1
null
null
0
565
I'm searching a javascript that can resize images similar to script thats available as a plugin in vBulletin CMS: ![enter image description here](https://i.stack.imgur.com/C8InZ.png) I want the script to be used in blogger blog so that all images i upload into a post are resized to a smaller res and on clicking the image should be displayed in original dimensions Something of the sort `getelementbyID("img")`. are there any script providing this feature? Pls help me out Thanks in advance.
Image resize script
CC BY-SA 3.0
null
2011-06-11T04:12:24.873
2011-06-11T04:35:02.730
2011-06-11T04:30:37.797
139,010
793,665
[ "javascript", "image-manipulation" ]
6,314,353
1
6,314,431
null
-2
170
I really could use some help in the right direction with this. Thanks! ![enter image description here](https://i.stack.imgur.com/UQMaa.png)
What would be the math associated for creating lines like in this image?
CC BY-SA 3.0
null
2011-06-11T05:49:41.063
2015-06-11T07:34:03.687
2015-06-11T07:34:03.687
1,079,354
403,887
[ "javascript", "generative-art" ]
6,314,700
1
6,314,862
null
0
1,340
I have a tableview with a segmentedControl in the header, i want the segment control to change the data depending on which segment is clicked, in this case Upcoming/Weekly. Both data sources come from an XML file on my server, which is the part im having trouble with, as im still new to using NSXMLParser ive messed around with some code, but to no avail. I know that my segmentAction is being picked up because ive used logs to do so. attached is code and an image of my table, cheers :) ![enter image description here](https://i.stack.imgur.com/1m2jv.png) ``` #import <UIKit/UIKit.h> @class XMLAppDelegate, BookDetailViewController; @interface RootViewController : UITableViewController <UITableViewDelegate> { XMLAppDelegate *appDelegate; BookDetailViewController *bdvController; UITableViewCell *eventUpCVCell; UILabel *month; UILabel *title; UILabel *date; UISegmentedControl *segmentedControl; } @property (nonatomic, retain) IBOutlet UITableViewCell *eventUpCVCell; @property (nonatomic, retain) IBOutlet UISegmentedControl *segmentedControl; @property (nonatomic, retain) IBOutlet UILabel *month; @property (nonatomic, retain) IBOutlet UILabel *title; @property (nonatomic, retain) IBOutlet UILabel *date; @end ``` ``` #import "RootViewController.h" #import "XMLAppDelegate.h" #import "Book.h" #import "BookDetailViewController.h" #define kLabel1Tag 1 #define kLabel2Tag 2 #define kLabel3Tag 3 @implementation RootViewController @synthesize eventUpCVCell, segmentedControl; @synthesize month, title, date; -(void)viewDidLoad { appDelegate = (XMLAppDelegate *)[[UIApplication sharedApplication] delegate]; self.title = @"Upcoming Events"; [super viewDidLoad]; NSURL *urlUpcoming = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsUpcoming.xml"]; NSURL *urlWeekly = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsWeekly.xml"]; } -(IBAction)segmentedAction:(id)sender { XMLAppDelegate *mainDelegate = (XMLAppDelegate *)[[UIApplication sharedApplication] delegate]; segmentedControl = (UISegmentedControl *)sender; if (segmentedControl.selectedSegmentIndex == 0) { mainDelegate.url = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsUpcoming.xml"]; [self.tableView reloadData]; } else if (segmentedControl.selectedSegmentIndex == 1) { NSLog(@"Hello 2"); mainDelegate.url = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsWeekly.xml"]; [self.tableView reloadData]; } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 66; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [appDelegate.eventDataUp count]; } etc etc... ``` ``` #import <UIKit/UIKit.h> @interface XMLAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UINavigationController *navigationController; NSString *url; NSMutableArray *eventDataUp; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @property (nonatomic, retain) NSString *url; @property (nonatomic, retain) NSMutableArray *eventDataUp; @end ``` ``` #import "XMLAppDelegate.h" #import "RootViewController.h" #import "XMLParser.h" @implementation XMLAppDelegate @synthesize window; @synthesize navigationController, eventDataUp; @synthesize url; - (void)applicationDidFinishLaunching:(UIApplication *)application { //RootViewController *rvController = [[RootViewController alloc] init]; NSURL *urlUpcoming = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsUpcoming.xml"]; // NSURL *urlWeekly = [[NSURL alloc] initWithString:@"http://www.randomosity.com.au/EventsWeekly.xml"]; NSURL *url = urlUpcoming; NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; //Initialize the delegate. XMLParser *parser = [[XMLParser alloc] initXMLParser]; //Set delegate [xmlParser setDelegate:parser]; //Start parsing the XML file. BOOL success = [xmlParser parse]; if(success) NSLog(@"No Errors"); else NSLog(@"Error Error Error!!!"); // Configure and show the window [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } - (void)applicationWillTerminate:(UIApplication *)application { // Save data if appropriate } - (void)dealloc { [eventDataUp release]; [navigationController release]; [window release]; [super dealloc]; } @end ``` ``` #import <UIKit/UIKit.h> @class XMLAppDelegate, Book; @interface XMLParser : NSObject { NSMutableString *currentElementValue; XMLAppDelegate *appDelegate; Book *eventUp; } - (XMLParser *) initXMLParser; @end // // XMLParser.m // XML // // Created by iPhone SDK Articles on 11/23/08. // Copyright 2008 www.iPhoneSDKArticles.com. // #import "XMLParser.h" #import "XMLAppDelegate.h" #import "Book.h" @implementation XMLParser - (XMLParser *) initXMLParser { [super init]; appDelegate = (XMLAppDelegate *)[[UIApplication sharedApplication] delegate]; return self; } - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { if([elementName isEqualToString:@"EventsUpcoming"]) { //Initialize the array. appDelegate.eventDataUp = [[NSMutableArray alloc] init]; } else if([elementName isEqualToString:@"Event"]) { //Initialize the book. eventUp = [[Book alloc] init]; //Extract the attribute here. eventUp.eventUpID = [[attributeDict objectForKey:@"id"] integerValue]; NSLog(@"Reading id value :%i", eventUp.eventUpID); } NSLog(@"Processing Element: %@", elementName); } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if(!currentElementValue) currentElementValue = [[NSMutableString alloc] initWithString:string]; else [currentElementValue appendString:string]; NSLog(@"Processing Value: %@", currentElementValue); } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if([elementName isEqualToString:@"EventsUpcoming"]) return; //There is nothing to do if we encounter the Books element here. //If we encounter the Book element howevere, we want to add the book object to the array // and release the object. if([elementName isEqualToString:@"Event"]) { [appDelegate.eventDataUp addObject:eventUp]; [eventUp release]; eventUp = nil; } else [eventUp setValue:currentElementValue forKey:elementName]; [currentElementValue release]; currentElementValue = nil; } - (void) dealloc { [eventUp release]; [currentElementValue release]; [super dealloc]; } @end ```
SegmentedControl to change TableView data
CC BY-SA 3.0
0
2011-06-11T07:26:11.753
2011-06-11T08:55:38.940
2011-06-11T07:43:39.820
596,821
596,821
[ "iphone", "cocoa-touch", "uitableview", "nsxmlparser", "uisegmentedcontrol" ]
6,314,888
1
6,315,028
null
1
4,122
In my project, I want to give a report. For that i create a report with dataset. name, course, year, semester all the textbox datas are passing from form. (I am using parameters to passing the data). but the table datas are taken from dataset. In that dataset have all the student data. But i want display one particular student data. For that i want to filer the data at run time in rdlc report. How can i filter the data?. ![](https://i.stack.imgur.com/mpeQy.png) ![](https://i.stack.imgur.com/2Ykkd.png) In that admin_no column is there. I planed to filter the data with the help of admin_no. ![](https://i.stack.imgur.com/nrsG3.png) Thanks in advance!.
How to Filter a rdlc report data?
CC BY-SA 3.0
null
2011-06-11T08:14:10.770
2011-06-11T08:52:17.927
null
null
776,226
[ "c#", "winforms" ]
6,314,993
1
6,315,029
null
4
4,875
I have a comment something like what I have mocked up below. `.avatar` & `.actions` have a static width. `.comment` does not. How should I structure my HTML & CSS so that `.text` will take up all of the available space as `.comment` changes it's width? ![enter image description here](https://i.stack.imgur.com/NbXmc.png)
Div Fill Parent Container
CC BY-SA 3.0
0
2011-06-11T08:42:48.637
2014-06-12T23:38:46.600
null
null
435,471
[ "html", "css" ]
6,315,100
1
6,315,110
null
0
263
I tried one simple application in android... to store the database but while add am getting error like below ![enter image description here](https://i.stack.imgur.com/9iufJ.jpg) `06-11 14:27:32.157: ERROR/Database(523): Failure 1 (near "FROM": syntax error) on 0x2685c0 when preparing 'CREATE VIEW ViewTasks AS SELECT TaskTable.TaskID AS _id, TaskTable.TaskName, TaskTable.StartDate, TaskTable.EndDate, TaskTable.Desi, FROM TaskTable'.` ``` public class DatabaseActivity extends SQLiteOpenHelper{ /*public DatabaseActivity(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); // TODO Auto-generated constructor stub }*/ static final String dbName="TaskDB"; static final String taskTable="TaskTable"; static final String colID="TaskID"; static final String colTask="TaskName"; static final String colStartDate="StartDate"; static final String colEndDate="EndDate"; static final String viewTasks="ViewTasks"; static final String colDesi="Desi"; public DatabaseActivity(Context context) { super(context, dbName, null,66); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("CREATE TABLE "+taskTable+" ("+colID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+ colTask+" TEXT, "+colStartDate+" TEXT, "+colEndDate+" TEXT, "+colDesi+" TEXT)"); db.execSQL("CREATE VIEW "+viewTasks+ " AS SELECT "+taskTable+"."+colID+" AS _id,"+ " "+taskTable+"."+colTask+","+ " "+taskTable+"."+colStartDate+","+ " "+taskTable+"."+colEndDate+","+ " "+taskTable+"."+colDesi+","+ " FROM "+taskTable+"" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS "+taskTable); db.execSQL("DROP TRIGGER IF EXISTS dept_id_trigger"); db.execSQL("DROP TRIGGER IF EXISTS dept_id_trigger22"); //db.execSQL("DROP TRIGGER IF EXISTS fk_empdept_deptid"); db.execSQL("DROP VIEW IF EXISTS "+viewTasks); onCreate(db); } void AddTask(Task tsk) { SQLiteDatabase db= this.getWritableDatabase(); ContentValues cv=new ContentValues(); cv.put(colTask, tsk.getTask()); cv.put(colStartDate, tsk.getStartDate()); cv.put(colEndDate, tsk.getEndDate()); cv.put(colDesi, tsk.getDesi()); //cv.put(colDept,2); //////////////////consider here ezhil // db.insert(taskTable, colTask, cv); db.close(); } Cursor getAllTasks() { SQLiteDatabase db=this.getWritableDatabase(); //Cursor cur= db.rawQuery("Select "+colID+" as _id , "+colName+", "+colDesi+", "+colStartDate+", "+colEndDate+" from "+TaskTable, new String [] {}); Cursor cur= db.rawQuery("SELECT * FROM "+viewTasks,null); return cur; } public Cursor getTskByDept(String Tsk) { SQLiteDatabase db=this.getReadableDatabase(); String [] columns=new String[]{"_id",colTask,colDesi,colStartDate,colEndDate}; Cursor c=db.query(viewTasks, columns, null, new String[]{Tsk}, null, null, null); return c; } public int UpdateTsk(Task tsk) { SQLiteDatabase db=this.getWritableDatabase(); ContentValues cv=new ContentValues(); cv.put(colTask, tsk.getTask()); cv.put(colDesi, tsk.getDesi()); cv.put(colStartDate, tsk.getStartDate()); cv.put(colEndDate, tsk.getEndDate()); return db.update(taskTable, cv, colID+"=?", new String []{String.valueOf(tsk.getID())}); } public void DeleteTsk(Task tsk) { SQLiteDatabase db=this.getWritableDatabase(); db.delete(taskTable,colID+"=?", new String [] {String.valueOf(tsk.getID())}); db.close(); } } ``` Any one can help to me fri thank you
error in the database - android
CC BY-SA 3.0
null
2011-06-11T09:14:27.083
2011-06-11T09:19:06.900
null
null
565,106
[ "android", "database" ]
6,315,373
1
6,321,025
null
2
4,089
i have problem with my map. Map was working correctly about 5 months ago. Now when I load map with my coords, map is loading, but when i start browsing map, zooming etc. i'm getting white screen like there's no connection with map.. i need to load map again, but again this same problem happens. About 5 months ago i was using this script and everything was working fine.. browsing, zooming, change map type, everything without any problems. I've created html code according to google website and put it in new resource file: ``` <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <title>Google Maps JavaScript API v3 Example: Map Simple</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function load(latitude,longitude,zoomik) { var myLatlng = new google.maps.LatLng(latitude,longitude); var myOptions = { zoom: zoomik, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, title:"Here!"}); } </script> </head> <body onload="load()"> <div id="map_canvas"></div> </body> </html> ``` Code for my button is: ``` private void TestButton_Click(object sender, EventArgs e) { webBrowser1.Document.InvokeScript("load", new object[] { -34.397, 150.644, 8 }); } ``` Screens: Map loaded correctly: ![enter image description here](https://i.stack.imgur.com/l1Ub5.jpg) After use of pan tool or zoom tool: - blank white screen. ![enter image description here](https://i.stack.imgur.com/dTnWJ.jpg) I'm using Visual C# Express and WebBrowser control from winforms. HTML code is working correctly in Firefox (using Aptana Studio) (zoom and pan working ok) What more this code from google api example is also not working correctly: ``` <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <title>Google Maps JavaScript API v3 Example: Map Simple</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 8, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } </script> </head> <body onload="initialize()"> <div id="map_canvas"></div> </body> </html> ```
GoogleMaps Api and C#
CC BY-SA 3.0
null
2011-06-11T10:30:26.750
2012-08-05T17:55:17.087
2011-06-11T13:51:16.167
684,570
684,570
[ "c#", "winforms", "google-maps-api-3", "webbrowser-control" ]
6,315,486
1
6,324,308
null
1
9,660
I have 2 or 3 hough lines drawn on the edges of the road these lines intersect at the horizon point where the road and the sky meet. I want to find and plot this point. How can i achieve this using hough lines? An idea rings in my mind of voting map how can i create voting map ? This is my code. Assume hough lines from the edges of the road, intersect and make a triangle with the road area inside. here is my output image ![enter image description here](https://i.stack.imgur.com/HQtm4.jpg) ``` I = imread('1.jpg'); J = imfilter(I, fspecial('gaussian', [17 17], 5), 'symmetric'); se3 = strel('disk', 4); %J = imdilate(J, se); J = rgb2gray(J); BW = edge(J, 'sobel'); BW = imdilate(BW, se3); [H T R] = hough(BW); P = houghpeaks(H, 4); lines = houghlines(J, T, R,P); Q = figure(5); imshow(I) hold on; xy1 = [lines(3).point1; lines(3).point2]; line1 = plot(xy1(:,1),xy1(:,2),'LineWidth',6,'Color','blue'); xy2 = [lines(4).point1; lines(4).point2]; line2 = plot(xy2(:,1),xy2(:,2),'LineWidth',6,'Color','blue'); xy3 = [lines(2).point1; lines(2).point2]; line3 = plot(xy3(:,1),xy3(:,2),'LineWidth',6,'Color','blue'); ```
How to find intersection point between lines matlab
CC BY-SA 3.0
null
2011-06-11T10:57:09.413
2017-03-07T15:06:02.317
2011-06-12T05:55:02.260
null
785,034
[ "image", "matlab", "lines" ]
6,315,617
1
6,316,535
null
3
1,485
I'm using SVN within Eclipse. Whenever I change a file I commit the changes. It works for everything except for three certain folders (which contain certain files) I cannot commit. When trying to commit them I receive the following error message: ![enter image description here](https://i.stack.imgur.com/uVcIy.jpg) `workspace\yp\src\yp\forum\locale\cs` is one of the three uncommitable folders. The folder definitely doesn't exist on the server yet, but I get the above error each time I'm trying to upload it. How do I solve the problem? I've deleted the `.svn` folders from the problematic directories. I still get the same error when trying to commit and the problematic directories have no `.svn` folders. I'm still trying to fix the problem. Now I get another error message when trying to commit: ![enter image description here](https://i.stack.imgur.com/O0Xq4.jpg) Now I've tried to do `Team --> Cleanup` and got that error message: ![enter image description here](https://i.stack.imgur.com/wThJN.jpg)
SVN in Eclipse: Cannot commit certain folders
CC BY-SA 3.0
0
2011-06-11T11:29:06.807
2011-06-11T14:44:21.263
2011-06-11T13:14:38.670
110,028
110,028
[ "eclipse", "svn" ]
6,315,753
1
6,316,044
null
3
3,744
I want to create this infographic( Teaser ;) ) on [http://www.bcndevcon.org](http://www.bcndevcon.org) website The problem: If I use I won't be able to display any information on iOS devices BUT i will be able to perform animations if I want to feed in in realtime. If I use I won't be able to display it on any IE, and animations will be slow... Finally I'm not really sure is a great solution so... Any suggestion!? ![enter image description here](https://i.stack.imgur.com/jPjAe.png)
Infographic and charts on a Website
CC BY-SA 3.0
0
2011-06-11T11:56:28.483
2012-05-02T16:46:01.477
2011-06-11T12:48:47.660
210,631
210,631
[ "jquery", "flash", "html", "svg" ]
6,315,788
1
null
null
2
3,122
Ok guys, this is driving me nuts. I got the following (odata) entity which represents a page structure in which every page can have any children and any parents. (basically a graph in which all nodes could be connected). In the database it's represented by a many-to-many relationship with two tables `Page <-> PagePage <-> Page`. ![Page Entity](https://i.stack.imgur.com/ZSetm.png) The problem is, I'm just not able to insert a new entity including a relation. The last thing I tried was: ``` Page page = new Page() { Id = Guid.NewGuid(), Title = "New Page", Created = DateTime.Now, LastChanged = DateTime.Now, IsRedirected = false, Position = 0, Html = "Add your HTML here.", Parent = { parent } }; this.Context.AddToPages(page); this.Context.AddLink(parent, "Children", page); parent.Children.Add(page); this.Context.SaveChanges(); ``` I can't think of anything else to try. Has anyone cracked this one? : Here's a picture from the database diagram: ![db diagram](https://i.stack.imgur.com/68TWk.png) : Exception Details: ``` System.Data.Services.Client.DataServiceRequestException was unhandled Message=An error occurred while processing this request. Source=System.Data.Services.Client StackTrace: at System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse() at System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest() at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) at System.Data.Services.Client.DataServiceContext.SaveChanges() at PortfolioManagementConsole.Models.PageViewModel.SaveChanges(Object parameter) in C:\Users\Daniel\documents\visual studio 2010\Projects\PortfolioManagementService\PortfolioManagementConsole\Models\PageViewModel.cs:line 59 at PortfolioManagementConsole.Common.RelayCommand.Execute(Object parameter) in C:\Users\Daniel\documents\visual studio 2010\Projects\PortfolioManagementService\PortfolioManagementConsole\Common\RelayCommand.cs:line 52 at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at Telerik.Windows.Controls.RadButton.OnClick() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Buttons\RadButton.cs:line 348 at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at PortfolioManagementConsole.App.Main() in C:\Users\Daniel\documents\visual studio 2010\Projects\PortfolioManagementService\PortfolioManagementConsole\obj\x86\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Data.Services.Client.DataServiceClientException Message=<?xml version="1.0" encoding="utf-8" standalone="yes"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code></code> <message xml:lang="de-CH">An error occurred while processing this request.</message> </error> Source=System.Data.Services.Client StatusCode=500 StackTrace: at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d__1e.MoveNext() InnerException: ```
OData and inserting (AddLink) many-to-many relationships
CC BY-SA 3.0
0
2011-06-11T12:03:04.203
2011-11-13T18:01:56.483
2011-06-11T12:41:10.410
251,861
251,861
[ "wpf", "odata", "wcf-data-services" ]
6,315,883
1
6,316,239
null
1
1,609
I'm currently writing a pure GWT (2.3) application and I require the use of a dialog box. I followed the examples in the documentation and they work as they should. My requirement is to display a dialog displaying some text in a scrollable text area with a close button (for now). The problem is that the right side of my dialog panel is being clipped off (please correct me if my terminology is incorrect here). Rather than explain it more, I will include some sample code and the resultant dialog box. ``` // This next block just builds debug text to display StringBuilder sb = new StringBuilder(); for (int i = 0 ; i < 100; i++) { sb.append(((i+1) < 10) ? " " : "").append(i+1).append(" : "); for (int j = 0; j < 8; j++) { sb.append("1234567890"); } sb.append("\n"); } final DialogBox dialogBox = new DialogBox(); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.setText("My broken dialog box"); VerticalPanel contentPanel = new VerticalPanel(); contentPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); contentPanel.setSpacing(4); TextArea ta = new TextArea(); ta.setCharacterWidth(90); ta.setVisibleLines(40); ta.setReadOnly(true); ta.setText(sb.toString()); contentPanel.add(ta); Button closeButton = new Button("Close Button"); closeButton.addClickHandler(new ClickHandler() {public void onClick(ClickEvent event) {dialogBox.hide();}}); contentPanel.add(closeButton); dialogBox.setWidget(contentPanel); dialogBox.show(); ``` ![Dialog box with right side clipped off (for some reason)](https://i.stack.imgur.com/MUkrA.png) Maybe I'm doing something fundamentally wrong in my layout code? Any help much appreciated. Chris
Why is my (pure) GWT dialog box not clipping correctly?
CC BY-SA 3.0
null
2011-06-11T12:19:36.643
2011-06-11T13:42:16.313
null
null
286,881
[ "java", "gwt" ]
6,315,899
1
6,316,497
null
7
636
I'm trying to access information within a `Graph` object in Mathematica 8. For some reason, the `Part` command does not seem to work. `myGraph` is the object I want to gain access to. The first line below displays myGraph. The others serve to inspect it. ``` myGraph myGraph // FullForm myGraph // InputForm myGraph // OutputForm myGraph[[1]] myGraph[[2]] ``` ![myGraph](https://i.stack.imgur.com/8AeTk.png) Why doesn't `myGraph[[1]]` return `List[1,3,4,2,5]` ? [I checked to level 2 just in case `Graph` were wrapped by some invisible wrapper. `Level[myGraph,1]`, simply returns `{}`. And `FullForm[myGraph][[1]]` returns a picture of the graph itself. I must be overlooking something obvious. --- Here's the code I used to produce the graph. Most of it is irrelevant to the issue at hand. But at least you'll be working with the same code I am using. ``` ClearAll[edges, compatibleQ, adjacentCourses, g]; edges[w_, b_] := Most /@ Accumulate /@ Flatten[Permutations[#] & /@ IntegerPartitions[w, All, b], 1] compatibleQ[j_, k_, edg_] := If[Intersection[edg[[j]], edg[[k]]] == {}, {j, k}, False] adjacentCourses[edg_] := Module[{len = Length[edg]}, Cases[Flatten[Table[compatibleQ[j, k, edg], {j, len}, {k, j, len}], 1], {v_, w_} :> v \[UndirectedEdge] w]] myGraph = Graph[adjacentCourses[edges[9, {2, 3}]], VertexLabels -> "Name", ImagePadding -> 10] ```
How can I programmatically access information about a 'Graph` object in Mathematica 8?
CC BY-SA 3.0
null
2011-06-11T12:22:59.233
2011-06-12T05:58:20.727
2011-06-12T05:56:28.170
638,130
638,130
[ "wolfram-mathematica", "mathematica-8" ]
6,316,225
1
6,467,548
null
6
3,858
I'm using this code snippet to encrypt/decrypt data in my app's database: [http://www.androidsnippets.com/encryptdecrypt-strings](http://www.androidsnippets.com/encryptdecrypt-strings) It appears that the javax.crypto.KeyGenerator.generateKey() operation works differently in Android 2.3.3 OS than in other (previous?) versions. Naturally, this presents a major problem for my users when they upgrade their device from 2.2 to 2.3.3 and the app starts throwing errors decrypting the database. Is this a known issue? Am I using the crypto library incorrectly? Anyone have any suggestions on how to address this so that data encrypted in 2.2 is able to be decrypted in 2.3.3? I built a test app that feeds values through the encrypt function. When I run it on a 2.2 AVD, I get one result. When I run it on a 2.3.3 AVD, I get a different result. ``` import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class main extends Activity { TextView tvOutput; static String out; String TEST_STRING = "abcdefghijklmnopqrstuvwxyz"; String PASSKEY = "ThePasswordIsPassord"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tvOutput = (TextView) findViewById(R.id.tvOutput); } @Override public void onResume() { super.onResume(); out = ""; runTest(); tvOutput.setText(out); } private void runTest() { out = "Test string: " + TEST_STRING + "\n"; out += "Passkey: " + PASSKEY + "\n"; try { out += "Encrypted: " + encrypt(PASSKEY, TEST_STRING) + "\n"; } catch (Exception e) { out += "Error: " + e.getMessage() + "\n"; e.printStackTrace(); } } public static String encrypt(String seed, String cleartext) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = encrypt(rawKey, cleartext.getBytes()); return toHex(result) + "\n" + "Raw Key: " + String.valueOf(rawKey) + "\n"; } private static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(seed); kgen.init(128, sr); // 192 and 256 bits may not be available SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); return raw; } private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(clear); return encrypted; } public static String toHex(String txt) { return toHex(txt.getBytes()); } public static String fromHex(String hex) { return new String(toByte(hex)); } public static byte[] toByte(String hexString) { int len = hexString.length() / 2; byte[] result = new byte[len]; for (int i = 0; i < len; i++) result[i] = Integer.valueOf(hexString.substring(2 * i, 2 * i + 2), 16).byteValue(); return result; } public static String toHex(byte[] buf) { if (buf == null) return ""; StringBuffer result = new StringBuffer(2 * buf.length); for (int i = 0; i < buf.length; i++) { appendHex(result, buf[i]); } return result.toString(); } private final static String HEX = "0123456789ABCDEF"; private static void appendHex(StringBuffer sb, byte b) { sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f)); } } ``` My main.xml layout looks like this: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/tvOutput" /> </LinearLayout> ``` I can't post links or images since I'm a new users, but you can decipher the URLs for the following two images if you want to see the results: What I get from 2.2: ![wct.vg/wt/droid/2.2.png](https://i.stack.imgur.com/kh8Qy.png) ..and from 2.3.3: ![wct.vg/wt/droid/2.3.3.png](https://i.stack.imgur.com/usfNv.png)
javax.crypto working differently in different versions of Android OS?
CC BY-SA 3.0
0
2011-06-11T13:38:58.133
2011-07-17T17:52:17.783
2011-06-24T07:32:11.930
26,796
442,481
[ "java", "android", "encryption", "javax.crypto" ]
6,316,391
1
6,316,458
null
0
1,062
I am doing this design. Users can speak one or more languages (limit five). first language is the native and the others are in order of fluency. ``` user 1 speak 3 languages user_id|first language|secondlanguage|thirdlanguage|fourthlanguage| fifthlanguage 1 english (1) franch(2) portuguese (3) null null ``` ![enter image description here](https://i.stack.imgur.com/gZrGc.png) What do you think about this scheme? Sounds a bit strange or it is the correct way to do that?
Many to many - junction table
CC BY-SA 3.0
null
2011-06-11T14:16:37.810
2017-07-03T20:48:11.007
2017-07-03T20:48:11.007
4,370,109
564,979
[ "database", "database-design", "many-to-many" ]
6,316,476
1
6,381,813
null
2
954
I have written this trivial action method associated to a textfield. Every time I enter text into a textfield a search in a PDF is performed and `PDFView` automatically scroll to selection: ``` - (IBAction) search:(id)id { NSString *query = [self.searchView stringValue]; // get from textfield selection = [document findString: query fromSelection:NULL withOptions:NSCaseInsensitiveSearch]; if (selection != nil) { [self.pdfView setCurrentSelection:selection]; [self.pdfView scrollSelectionToVisible:self.searchView]; } } ``` Problem is that after 3 or 4 searches I get `EXC_BAD_ACCESS` on row (i). If I debug I see that query contains an `NSCFString` and not an `NSString`. I think it is a memory management problem..but where? ![enter image description here](https://i.stack.imgur.com/s5Bws.png) I replicated the same issue inside a trivial testcase: ``` @interface PDFRef_protoTests : SenTestCase { @private PDFDocument *document; } ........ - (void)setUp { [super setUp]; document = [[PDFDocument alloc] initWithURL: @"a local url ..."]; } - (void)test_exc_bad_access_in_pdfdocument { for (int i =0 ;i<100; i++) { NSString *temp; if (i % 2 == 0) temp = @"home"; else if (i % 3 ==0) temp = @"cocoa"; else temp=@"apple"; PDFSelection *selection = [document findString: temp fromSelection:nil withOptions:NSCaseInsensitiveSearch]; NSLog(@"Find=%@, iteration=%d", selection, i); } } ``` : 1) It seems that it happens also if I use asynchronous search (method beginFindString: withOptions) every time I perform second search. 2) I found a similar problem to mine in MacRuby Issue Tracking: [http://www.macruby.org/trac/ticket/1029](http://www.macruby.org/trac/ticket/1029) 3) It seems that if I disable temporarily garbage collection it works but memory goes up. I wrote something like: ``` [[NSGarbageCollector defaultCollector] disable]; [[NSGarbageCollector defaultCollector] enable]; ``` surrounding search code Very weird thing is that sometimes all works. Than I clean and Rebuild and problem arises again. From a certain point of view is is not 100% reproducible. I suspect a bug in PDFKit or some compiler setting I have to do Dears it seems very crazy. I'd concentrate on testcase which is very trivial and which replicates easily the problem. What's wrong with it? This testcase works only if I disable (by code or by project setting) GC Boys it seems a bug but I downloaded an example called PDFLinker from Apple website ([http://developer.apple.com/library/mac/#samplecode/PDFKitLinker2/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003594](http://developer.apple.com/library/mac/#samplecode/PDFKitLinker2/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003594)). This example implements a PDFViewer. Code of my app and this example are quite similars. For the same search action on same PDF, my memory rises at 300/400 MB while PDFLinker rises at 190MB. Clearly there is something wrong in my code. But I am comparing it bit by bit and I don't think I am inserting memory leaks (and Instrument doesn't give me any evidence). Maybe is there some project-wide setting ? Changing from 64 bit to 32 bit memory consumption lowered. Surely there is a problem with 64bit and PDFKit. BTW still EXC_BAD_ACCESS on second search Crucial point is that PDFKit with Garbage collection is bugged. If I disable GC all works correctly. I had another issue that had complicated my analysis: I disabled GC on Project Setting but GC remained enabled on Target Settings. So Apple's example PDFLinked2 worked while mine not.
Weird EXC_BAD_ACCESS in a trivial PDFKit program
CC BY-SA 3.0
0
2011-06-11T14:32:54.603
2011-06-18T15:01:36.200
2011-06-18T15:01:36.200
1,182,738
1,182,738
[ "objective-c", "cocoa", "macruby", "pdfkit" ]
6,316,540
1
25,781,167
null
215
190,516
I'm designing my application UI. I need a layout looks like this: ![Example of desired layout](https://i.stack.imgur.com/t5Ulu.png) (< and > are Buttons). The problem is, I don't know how to make sure the TextView will fill the remaining space, with two buttons have fixed size. If I use fill_parent for Text View, the second button (>) can't be shown. How can I craft a layout that looks like the image?
How to make layout with View fill the remaining space?
CC BY-SA 3.0
0
2011-06-11T14:45:56.430
2021-10-22T05:30:34.423
2015-12-30T00:00:40.937
3,063,884
653,457
[ "android", "layout", "android-layout" ]
6,316,697
1
6,960,525
null
12
6,195
While trying to optimize a code, I'm a bit puzzled by differences in profiles produced by `kcachegrdind` and `gprof`. Specifically, if I use gprof (compiling with the `-pg` switch, etc), I have this: ``` Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 89.62 3.71 3.71 204626 0.02 0.02 objR<true>::R_impl(std::vector<coords_t, std::allocator<coords_t> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&) const 5.56 3.94 0.23 18018180 0.00 0.00 W2(coords_t const&, coords_t const&) 3.87 4.10 0.16 200202 0.00 0.00 build_matrix(std::vector<coords_t, std::allocator<coords_t> > const&) 0.24 4.11 0.01 400406 0.00 0.00 std::vector<double, std::allocator<double> >::vector(std::vector<double, std::allocator<double> > const&) 0.24 4.12 0.01 100000 0.00 0.00 Wrat(std::vector<coords_t, std::allocator<coords_t> > const&, std::vector<coords_t, std::allocator<coords_t> > const&) 0.24 4.13 0.01 9 1.11 1.11 std::vector<short, std::allocator<short> >* std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<std::vector<short, std::alloca ``` Which seems to suggest that I need not bother looking anywhere but `::R_impl(...)` At the same time, if I compile without the `-pg` switch and run `valgrind --tool=callgrind ./a.out` instead, I have something rather different: here's a screenshot of the `kcachegrind` output ![enter image description here](https://i.stack.imgur.com/1rLQd.png) If I interpret this correctly, it seems to suggest that `::R_impl(...)` only takes about 50% of time, while the other half is spent in linear algebra (`Wrat(...)`, `eigenvalues` and the underlying lapack calls ) which was way down below in the `gprof` profile. I understand that `gprof` and `cachegrind` use different techniques, and I'd not bother if their results were somewhat different. But here, it looks very different, and I'm at loss as to how to interpret those. Any ideas or suggestions?
gprof vs cachegrind profiles
CC BY-SA 3.0
0
2011-06-11T15:17:57.033
2011-08-05T17:51:16.637
null
null
143,765
[ "c++", "optimization", "profiling", "valgrind", "gprof" ]
6,316,778
1
6,316,802
null
2
7,425
I am looking for advice or examples of how to create a timetable widget as shown in the image below; ![Timetable design](https://i.stack.imgur.com/Ml4KR.gif) I need the user to be able to the rectangles to or them up and down each column of the timetable. It's quite simple when you look at it but I imagine the JavaScript involved is quite tricky and I just don't know where to start. I'm thinking of using a table and overlaying div's but that's about as far as I've got.
jQuery Timetable Widget required
CC BY-SA 3.0
0
2011-06-11T15:32:10.763
2011-06-11T15:36:41.080
null
null
263,534
[ "javascript", "jquery", "jquery-ui", "dom", "jquery-plugins" ]
6,316,833
1
6,317,742
null
0
1,117
I want to know how to read the traffic information from google map as here in the following image. Google only displays the traffic layer by red, green, and yellow lines. But how can an application identify the color and find out how much traffic there is between source and destination. ![enter image description here](https://i.stack.imgur.com/PrVm9.png) Visually users can see with their eyes and identify the colors but what about the application?
Identify Google traffic data inside application
CC BY-SA 3.0
null
2011-06-11T15:41:07.003
2016-03-06T01:25:43.697
2011-06-12T16:32:09.540
436,641
405,383
[ "google-maps", "google-maps-api-3" ]
6,316,923
1
6,318,132
null
9
7,833
This question is very similar to that posed [here](https://stackoverflow.com/questions/3273880/perlin-noise-detail-level-how-to-zoom-in-on-a-landscape). My problem is that I have a map, something like this: [](https://i.stack.imgur.com/9ACDe.jpg) This map is made using 2D Perlin noise, and then running through the created heightmap assigning types and color values to each element in the terrain based on the height or the slope of the corresponding element, so pretty standard. The map array is two dimensional and the exact dimensions of the screen size (pixel-per-pixel), so at 1200 by 800 generation takes about 2 seconds on my rig. Now zooming in on the highlighted rectangle: ![http://i.stack.imgur.com/hrZnM.png](https://i.stack.imgur.com/T0o4T.png) Obviously with increased size comes lost detail. And herein lies the problem. I want to create additional detail on the fly, and then write it to disk as the player moves around (the player would simply be a dot restricted to movement along the grid). I see two approaches for doing this, and the first one that came to mind I quickly implemented: ![http://i.stack.imgur.com/bbLia.png](https://i.stack.imgur.com/Kg2Bg.png) This is a zoomed-in view of a new biased local terrain created from a sampled element of the old terrain, which is highlighted by the yellow grid space (to the left of center) in the previous image. However this system would require a great deal of modification, as, for example, if you move one unit left and up of the yellow grid space, onto the beach tile, the terrain changes completely: ![http://i.stack.imgur.com/6shKz.png](https://i.stack.imgur.com/VupAz.png) So for that to work properly you'd need to do an excessive amount of, I guess the word would be interpolation, to create a smooth transition as the player moved the 40 or so grid-spaces in the local world required to reach the next tile over in the over world. That seems complicated and very inelegant. The second approach would be to break up the grid of the original map into smaller bits, maybe dividing each square by 4? I haven't implemented this and I'm not sure how I would in a way that would actually increase detail, but I think that would probably end up being the best solution. Any ideas on how I could approach this? Keep in mind it has to be local and on-the-fly. Just increasing the resolution of the map is something I want to avoid at all costs.
On-the-fly Terrain Generation Based on An Existing Terrain
CC BY-SA 3.0
0
2011-06-11T15:53:14.583
2016-04-03T14:14:15.297
2017-05-23T12:16:59.013
-1
794,067
[ "landscape", "fractals", "terrain", "procedural", "perlin-noise" ]
6,316,929
1
null
null
4
692
After realizing why Eclipse did not want to open XMl files in its Layout designer, I hope we'll be able to solve this issue here. Anyway, after I create the project in InteliJ IDEA, exports it in Eclipse format, opens it in Eclipse, I realize that Eclipse Layout Designer does not recognize such XML file and the Layout Designer cannot load its content into right pane of the designer. This is how the Designer looks like after I try to load InteliJ-created XML file. ![](https://i.stack.imgur.com/SLtZS.png) Indeed, I can load Android layout elements after setting Designer to correct Android OS version (dropdown list, elements appear in left pane of the designer), but the very content of the XML file gets never loaded in the right pane of the Designer. After examining the STRUCTURE of a project created in Eclipse and a project created in IntelliJ, I realized that Eclipse DOES NOT generate Java files in /gen directory nor it imports correct Android library once I import IntelliJ-created project. Look at the image. ![](https://i.stack.imgur.com/24khV.png) The upper project is created in Eclipse and it has both Android R files and Android library imported. The project below is created in IntelliJ, exported to Eclipse format and then imported into Eclipse workspace. It does not have either Android R files or Android library imported. Another problem is that I cannot force rebuild the Intellij-created project or even clean it in Eclipse because it isn't in the list of projects. Like Eclipse does not see it as an Android project at all. The final issue is: when I manually set Android OS version in Layout Designer, then try to grab&drop Android element into the right pane of the Designer, I get the message (error) "Missing project resources". Look at the image. ![](https://i.stack.imgur.com/vyhMg.png) Please help!
Eclipse Layout Designer cannot open IntelliJ-created XML file
CC BY-SA 3.0
0
2011-06-11T15:54:59.077
2017-01-20T10:33:01.183
2017-01-20T10:33:01.183
2,417,043
437,039
[ "android", "eclipse", "android-layout", "intellij-idea", "android-xml" ]
6,316,963
1
6,319,013
null
2
408
I am trying to write a strategy game using XNA 4.0, with a dynamically generating map, and it's really difficult to create all the ground textures, having to distort them individually in photoshop. So what I want to do is create a flat image, and then apply the distortion programatically to simulate perspective, by moving the corners of the image. Here is an example done in photoshop: ![Image Distortion](https://i.stack.imgur.com/7lcPq.jpg) How can I do that in XNA?
How can I create a corner pin effect in XNA 4.0?
CC BY-SA 3.0
null
2011-06-11T16:02:34.147
2011-06-11T22:55:59.847
2011-06-11T17:24:51.357
563,379
794,075
[ "xna", "2d", "perspective", "distortion" ]
6,316,960
1
6,316,994
null
2
349
I'm completely new to Linux and have been trying to get my (Windows built) Java Swing projects to work correctly on XUbuntu on a separate machine from executable jar files I built. I've reduced the problem to a minimum amount of code ``` import java.awt.Dimension; import javax.swing.*; public class JFrameTest extends JFrame { public JFrameTest(String title) { super(title); JLabel lab = new JLabel("Label"); this.getContentPane().add(lab); this.setMinimumSize(new Dimension(200, 200)); this.pack(); this.setVisible(true); } public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } JFrameTest frame = new JFrameTest("Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } ``` On Windows I see: ![Windows o/p](https://i.stack.imgur.com/5UvRE.jpg) In Xubuntu I just see a grey box and the label, not the Title or close icons etc. I also have to kill (-9) the jvm after I've ctrl zedded from the command line. I launched it with java -jar filename.jar My Linux machine is running Xubuntu 11. I've installed the sun Java 6_24 JRE. I Googled for this and found something similar relating to Compziz(?) but this was allegedly fixed a while back. I'm a bit stuck now. I have got one Swing app that works OK in that it responds to buttons OK but still doesn't show the Title etc. Any help would be much appreciated.
Java, Swing and Xubuntu, JFrames not correct
CC BY-SA 3.0
null
2011-06-11T16:02:20.443
2011-06-11T16:17:52.780
null
null
440,010
[ "java", "swing", "ubuntu" ]
6,317,033
1
6,317,078
null
29
35,409
I want to minimize a C# WinForms app to system tray. I've tried this: [Having the application minimize to the system tray when button is clicked?](https://stackoverflow.com/questions/1297028/having-the-application-minimize-to-the-system-tray-when-button-is-clicked). The first time I minimize it, it's nowhere to be found on the screen - taskbar/above taskbar/tray. If i hit alt tab, I can see my app there; if I alt tab into it and minimize it again, it shows up above the taskbar: ![minimize](https://i.imgur.com/eOd7B.png) What am I doing wrong?
How do I minimize a WinForms application to the notification area?
CC BY-SA 3.0
0
2011-06-11T16:13:52.850
2017-01-23T18:18:06.323
2017-05-23T12:10:18.820
-1
688,843
[ "c#", ".net", "windows", "winforms", "notifyicon" ]
6,317,099
1
6,559,433
null
1
1,775
I have a simple requirement: The number of columns of my `<tr:table/>` is dynamic. I will have a list of objects, `someBean.features` which will determine how many columns are rendered. The following diagram should clarify my requirement. ![Table with dynamic columns](https://i.stack.imgur.com/K0Vd3.png) In the code that I was given, there was usage of the JSTL `<c:forEach/>` tag which obviously created problems when used in a JSF environment. They had done something like this: ``` <tr:table value="#{someBean.values}"> <tr:column headerText="Name"> <tr:outputText value="#{someBean.name}"/> </tr:column> <c:forEach var="col" items="#{someBean.features}"> <tr:column headerText="Column-#{col.id}"> <tr:outputText value="#{col.name}"/> </tr:column> </c:forEach> </tr:table> ``` But when I profiled the above code, the method `someBean.getValues` which is the input to the `<tr:table/>` tag above was getting called several thousands of times rather than about 20. This - as I figured out - was due to the fact that `<c:forEach/>` tag is a compile time tag where as `<tr:*/>` are render time tags. So, here's what I intend to do (replace `<c:forEach/>` with `<tr:iterator/>`: ``` <tr:table value="#{someBean.values}"> <tr:column headerText="Name"> <tr:outputText value="#{someBean.name}"/> </tr:column> <tr:iterator var="col" value="#{someBean.features}"> <tr:column headerText="Column-#{col.id}"> <tr:outputText value="#{col.name}"/> </tr:column> </tr:iterator> </tr:table> ``` But, for some reason, the `<tr:iterator/>` doesn't seem to like being placed inside a `<tr:table/>` and it never gets executed. Any solution, tips, guidelines will be greatly appreciated. Oh and we're using JSF 1.1 with a MyFaces Trinidad 1.0.13 implementation. Thanks.
Apache MyFaces Trinidad: Dynamic <tr:column/> tags inside a <tr:table/>
CC BY-SA 3.0
0
2011-06-11T16:26:54.583
2011-07-02T20:27:39.310
null
null
343,955
[ "java", "jsf", "myfaces", "trinidad" ]
6,317,173
1
6,317,208
null
3
692
Consider : ``` Tuples[Range[1, 3], 2] ``` ![enter image description here](https://i.stack.imgur.com/sZC3O.png) I would like to drop some of the sublist based on the following list : sublistToTemove = {1,2,3,6,8} Desired Output : {2, 1}, {2, 2}, {3, 1} Corresponding to the 4th, 5th and 7th elements of list. I have tried Drop, Case, Select without success, must be missing something.
Drop nested Lists in Mathematica
CC BY-SA 3.0
null
2011-06-11T16:40:46.247
2014-03-31T19:01:29.183
2014-03-31T19:01:29.183
881,229
769,551
[ "wolfram-mathematica" ]
6,317,253
1
6,317,280
null
2
655
Given that `g` is a graphics object with primitives such as `Line`s and `Polygon`s, how do you remove some of them? To add more primitives to an existing graphics object we can use `Show`, for instance: `Show[g, g2]` where `g2` is another graphics object with other primitives. But how do you remove unwanted primitive objects? Take a look at the following ``` ListPlot3D[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}, {1, 1, 0}}, Mesh -> {1, 1}] ``` ![Output](https://i.stack.imgur.com/cvIUH.png) Now, for the input form: ``` InputForm[ ListPlot3D[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}, {1, 1, 0}}, Mesh -> {1, 1}] ] ``` ![Output](https://i.stack.imgur.com/uPhZ8.png) To create a wire frame from this object all we have to do is remove the polygons. As an extra we can also remove the vertex normals since they don't contribute to the wireframe. Notice that to make a wireframe we can simply set `PlotStyle -> None` as an option in `ListPlot3D`. This gets rid of the `Polygon`s but doesn't remove the `VertexNormals`. To clarify the question. Given that ``` g = ListPlot3D[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}, {1, 1, 0}}, Mesh -> {1, 1}] ``` How do you remove some of the of the graphics primitives from `g` and how do you remove some of the options, i.e. `VertexNormals`? Note: option `VertexNormals` is an option of `GraphicsComplex`. If this is not possible then maybe the next question would be, how do you obtain the data used to generate `g` to generate a new graphics object with some of the data obtained from `g`.
Mathematica: Removing graphics primitives
CC BY-SA 3.0
null
2011-06-11T16:55:37.620
2011-06-13T08:42:51.040
null
null
788,553
[ "wolfram-mathematica" ]
6,317,380
1
null
null
3
102
Say I have this HTML: ``` <div> <p>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.</p> </div> ``` I want to determine what line in the client's browser the phrase `sed do eiusmod tempor` is on and from there determine where that line starts and ends. Is there any way to do this with javascript. What I am trying to do with that line then is to put a border along the bottom and the sides (so a border on each side of that text that is parallel to the sides of the area that that `<div>` is located in.). I know if there is a solution it won't be easy, but I am willing even if it is relatively difficult. Also, I am using jQuery if it has a method to do this. Also, if there is a way with CSS I would be even happier. Here is approximately talking about, the highlighted part is the text I am looking for and the red line is supposed to represent what has a border set on it. ![enter image description here](https://i.stack.imgur.com/0Kvaz.png)
Is there any way to determine, with Javascript, or CSS which words are on what line in the client's browser?
CC BY-SA 3.0
null
2011-06-11T17:18:59.803
2011-06-11T18:46:29.333
2011-06-11T17:33:55.910
407,756
407,756
[ "javascript", "jquery", "html", "css", "line" ]