Id
int64
1.68k
75.6M
PostTypeId
int64
1
2
AcceptedAnswerId
int64
1.7k
75.6M
ParentId
int64
1.68k
75.6M
Score
int64
-60
3.16k
ViewCount
int64
8
2.68M
Body
stringlengths
1
41.1k
Title
stringlengths
14
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
1
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
1
21.3M
Tags
list
5,760,859
1
5,762,482
null
2
519
I've been working on an image-emboss procedure with my class' special image ADT, but I can't seem to figure it out. I have included my recently edited code and the image procedures that I have been using for the problem. If you have a couple minutes to sit through the explanation, you might find this type of image editing interesting. ``` (define bound (lambda (n) (cond [(<= n 0) 0] [(>= n 255) 255] [else n]))) ``` Bound takes an integer and crops values outside the range 0 to 255, inclusive, to the endpoints. ``` (define boost (lambda (x) (bound (+ 127 x)))) ``` Boost takes an integer, adds 127 to it, and then bounds the result. The number 127 is the focus of boost because we will use boost to boost colors and 127 is half the range of a color component. ``` (define image-emboss (lambda (img) (define emboss (lambda (r c) (let ([a (image-ref img r (add1 c))] [b (image-ref img (add1 r) (add1 c))] [c (image-ref img (sub1r) (add1 c))] [d (image-ref img r (sub1 c))] [e (image-ref img (sub1 r) (sub1 c))] [f (image-ref img (add1 r) (sub1 c))]) (if (or (< r 0) (< c 0)) img (make-image r c (boost (- (+ a b c) d e f))))))) (emboss r c))) ``` "In an embossed image, the color of each pixel is computed from six of the pixels neighbors in the original image. Each color component of the embossed pixel is obtained by adding the corresponding components of the three pixels in the row directly above it and subtracting the components from the three pixels in the row directly below it, and then applying boost to the result." ![Image of pixels needed](https://i.stack.imgur.com/KDhkt.png) I've tried to create image-emboss: it takes an image and returns an embossed version of the image. Pixels along the perimeter are unchanged. This proc is supposed to use make-image and image-ref. Image-rows takes an image and returns the number of rows in the image. ``` (define image-rows (lambda (img) (cond [(image? img 1 1) (vector-length (img))] [else (error 'image-rows (format "~a is not an image" img))]))) ``` Image-cols takes an image and returns the number of columns in the image. ``` (define image-cols (lambda (img) (cond [(image? img 1 1) (if (zero? (vector-length (img))) 0 (vector-length (vector-ref (img) 0)))] [else (error 'image-cols (format "~a is not an image" img))]))) ``` Image-ref takes an image, row-index, and column-index, and returns the pixel. ``` (define image-ref (lambda (img r c) (if (not (image? img 0 0)) (error 'image-ref "first argument is not an image")) (if (and (integer? r) (<= 0 r (- (image-rows img) 1))) (if (and (integer? c) (<= 0 c (- (image-cols img) 1))) (vector-ref (vector-ref (img) r) c) (error 'image-ref (format "~a is an illegal index" c))) (error 'image-ref (format "~a is an illegal index" r))))) ``` Make-image takes rows, cols, and a procedure. ``` (define make-image (lambda (rows cols . args) (let ([gen-proc (cond [(null? args) (lambda (i j rows cols) black)] [(not (null? (cdr args))) (error 'make-image "too many arguments")] [(color? (car args)) (lambda (i j rows cols) (car args))] [(procedure? (car args)) (car args)] [else (error 'make-image (format "unknown fill: ~s" (car args)))])]) (let ([img (make-vector rows)]) (let loop ([i 0]) (when (< i rows) (vector-set! img i (let ([row (make-vector cols)]) (let loop ([j 0]) (when (< j cols) (vector-set! row j (gen-proc i j rows cols)) (loop (+ j 1)))) row)) (loop (+ i 1)))) (lambda () img))))) ``` The way I am testing this is by dloading an image and defining it in the repl, then drawing the image using a procedure created by my prof. Anyways. I think my code is close to being correct, but I am really not sure how to correct it. If anyone has a hint/ better explanation that will help me figure this out, I'd really appreciate it. Thanks
Embossing an Image
CC BY-SA 3.0
null
2011-04-22T23:05:11.840
2011-04-23T05:50:39.663
null
null
622,508
[ "image", "scheme", "iteration" ]
5,760,937
1
5,761,192
null
0
5,735
Just wondering if anyone can give me feedback on my class diagram. I want to make sure it's correct and also any changes that are needed to it. Thanks Image link: [http://i.stack.imgur.com/k4RA2.jpg](https://i.stack.imgur.com/k4RA2.jpg) ![enter image description here](https://i.stack.imgur.com/k4RA2.jpg)
Class Diagram Feedback
CC BY-SA 3.0
null
2011-04-22T23:18:57.430
2011-04-23T10:08:25.887
null
null
251,671
[ "uml", "class-diagram", "modeling" ]
5,760,977
1
5,790,039
null
1
2,287
I'm creating an HTML mail template for an app, and the template includes a 440px wide image. When i look at it on my iphone, it goes beyond the width of the screen. I've seen plenty of times when iOS Mail shrinks the size of the email to fit everything in (for instance, emails from Apple). Any ideas on what I might be doing wrong? The image CSS and it's container CSS is: ``` .photo { width: 400px; height: 460px; padding: 20px; background: #fff; -moz-box-shadow: 0 0 10px rgba(0, 0, 0, .5); -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); position: relative; overflow: hidden; } .photo img.main-photo { max-width: 400px; } .photo div.caption { width: 400px; position: absolute; bottom: 20px; font-family: 'Indie Flower'; height: 50px; font-size: 20px; } ``` and the actual HTML is ``` <div class="photo"> <img src="{{ photo.images.standard_resolution.url }}" class="main-photo" /> <div class="caption"> {{ photo.caption.text }} </div> </div> ``` Here is an example of how it looks. I dont want it to stretch beyond the screen ![enter image description here](https://i.stack.imgur.com/NGJ0r.png)
Image size reduction in iOS Mail
CC BY-SA 3.0
null
2011-04-22T23:24:48.930
2011-04-29T00:32:38.350
2011-04-23T00:51:30.817
636,064
636,064
[ "iphone", "html", "css", "ios", "html-email" ]
5,761,027
1
5,761,157
null
1
153
![enter image description here](https://i.stack.imgur.com/90XNn.png) This is what I want... But how can I build this using CSS and DIV's? I tried many tutorials, but it didn't came further than this: ``` body { font-family: Arial, Helvetica, sans-serif; font-size: 13px; background: #F0F0F0; } #wrapper { padding: 1px; margin: 0 auto; } #wrapper:after { content: "."; display: block; clear: both; height: 0; overflow: hidden; } #left { float: left; width: 200px; background: white; padding: 5px; } #content { margin-left: 215px; background: white; padding: 5px; padding-left: 10px; } ```
CSS: Table to div, somekind
CC BY-SA 3.0
null
2011-04-22T23:35:05.387
2018-02-17T16:26:49.237
2018-02-17T16:26:49.237
4,370,109
528,370
[ "html", "css", "css-tables" ]
5,761,036
1
5,761,143
null
1
838
I have a ListView, and I have added a header (with getListView().addHeaderView) that simply contains a TextEdit widget. ![enter image description here](https://i.stack.imgur.com/7JcVi.png) Then when I tap the TextEdit to start writting, the keyboard appears and it messes up the list! ![enter image description here](https://i.stack.imgur.com/LnJ8A.png) If I tap everywhere else to hide the keyboard, the list messes up again! I don't know why is this happening. I thought it was something related with the onConfigurationChanged method, but after implementing it (and adding the corresponding attribute in the manifest file) the problem persists. How could I fix it? Why is Android messing up my list? My list uses a custom adapter, this is the getView method: ``` @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v != null) { return v; } LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.list_row, null); ListTask list_item = items.get(position); if (list_item != null) { TextView item_name = (TextView) v.findViewById(R.id.item_name); item_name.setText(list_item.getTitle()); } return v; } ``` The problem is not the value of my items, but their order. They are displayed in a different order when the keyboard appears, but the values are correct. Ok, I have changed my getView method with rekaszeru's suggestion and now it works as expected. But now I'm facing another problem: Let's say the second textview is optional, and "Item 1" and "Item 3" have it, but "Item 2" does not, so it's initialized as a void String (length == 0). The first time the list is displayed, it shows "Item1" and "Item 3" with their second textview, and "Item 2" without it. That's correct. But when the keyboard appears, the "Item 2" takes the second textview of another item and displays it! This is the modified code I have right now: ``` @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater vi = (LayoutInflater) getContext(). getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.list_row, null); } ListTask list_item = items.get(position); TextView item_name = (TextView) convertView.findViewById(R.id.item_name); TextView item_optional_text = (TextView) convertView.findViewById(R.id.item_optional_text); item_name.setText(list_item.getTitle()); // if the item has defined the optional text, make some room and display it if (item_optional_text.isNotEmpty()) { LayoutParams layout_params = (LayoutParams) item_name.getLayoutParams(); layout_params.topMargin = 10; layout_params.height = -2; // -2: wrap_content item_name.setLayoutParams(layout_params); item_optional_text.setText(list_item.getOptionalText()); } return convertView; } ``` The isNotEmpty() does this in the Item class: ``` public boolean isNotEmpty() { return this.optional_text.length() > 0; } ``` Maybe it's too complex to understand in a written question. If so, I can make a short video showing the problem and my source code. Thanks in advance for your help guys.
ListView with a TextEdit header messes up
CC BY-SA 3.0
0
2011-04-22T23:38:07.660
2011-04-23T12:38:45.893
2011-04-23T12:38:45.893
267,705
267,705
[ "android" ]
5,761,078
1
5,761,092
null
3
1,189
Can anyone tell me which eclipse plugin this is? I've been searching all over the place but I can't find out what it's called. Thanks. ![Command Line Shell plugin](https://i.stack.imgur.com/ZIG6K.jpg)
eclipse Command Line Shell plugin
CC BY-SA 3.0
0
2011-04-22T23:45:36.797
2011-04-22T23:47:57.917
null
null
598,093
[ "eclipse", "command-line", "eclipse-plugin" ]
5,761,518
1
5,761,624
null
0
5,139
Hey fellas, while running through a debugger I am seeing the following appear the time it sets the variables (timestamp and checksum are set through this method one after the other, it works fine when no DataFeedManager exists, but upon returning to it again it crashes when it's time to set the checksum): ![debug screen shot](https://i.stack.imgur.com/GXUEu.png) Here is the function of interest: ``` //sets specified attribute to the passed in value while ensuring that only one instance of the DataFeedManager exists -(void)setItemInDFMWhilePreservingEntityUniquenessForItem:(attribute)attr withValue:(id)value { SJLog(@"CoreDataSingleton.m setItemInDFMWhilePreservingEntityUniquenessForItem"); NSError *error; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"DataFeedManager" inManagedObjectContext:[self managedObjectContext]]; [fetchRequest setEntity:entity]; NSUInteger numEntities = [[self managedObjectContext] countForFetchRequest:fetchRequest error:&error]; if (numEntities == NSNotFound) { // ERROR //... } else if (numEntities == 0) { DataFeedManager *dfm = (DataFeedManager *)[NSEntityDescription insertNewObjectForEntityForName:@"DataFeedManager" inManagedObjectContext:[self managedObjectContext]]; if (attr == checksumAttr) { //BLOCK OF INTEREST NSString *tempVal = [[NSString alloc] initWithString:value]; [dfm setLastUpdateCheckSum:[NSString stringWithString:tempVal]]; } else if (attr == timeStampAttr) { [dfm setTimeStamp:value]; } } else { // more than zero entities if (numEntities == 1) { NSArray *fetchedObjects = [[self managedObjectContext] executeFetchRequest:fetchRequest error:&error]; if (attr == checksumAttr) { //BLOCK OF INTEREST NSString *tempVal = [[NSString alloc] initWithString:value]; [[fetchedObjects objectAtIndex:0] setLastUpdateCheckSum:[NSString stringWithString:tempVal]]; //crashes at this line, after successfully going through the previous BLOCK OF INTEREST area } else if (attr == timeStampAttr) { [[fetchedObjects objectAtIndex:0] setTimeStamp:value]; } } else { // ERROR: more than one entity //... } } // else more than zero entities [fetchRequest release]; }//setItemInDFMWhilePreservingEntityUniquenessForItem:withValue: ``` I have marked the areas of interest with `//BLOCK OF INTEREST` comments and have indicated upon which line the crash occurs (scroll right to see it!). Here is a readout of error from the console: ``` 2011-04-22 17:18:10.924 Parking[26783:207] CoreDataSingleton.m setItemInDFMWhilePreservingEntityUniquenessForItem 2011-04-22 17:18:10.924 Parking[26783:207] -[__NSCFDictionary length]: unrecognized selector sent to instance 0xac34850 2011-04-22 17:18:10.970 Parking[26783:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary length]: unrecognized selector sent to instance 0xac34850' *** Call stack at first throw: ( 0 CoreFoundation 0x011a0be9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x012f55c2 objc_exception_throw + 47 2 CoreFoundation 0x011a26fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x01112366 ___forwarding___ + 966 4 CoreFoundation 0x01111f22 _CF_forwarding_prep_0 + 50 5 Foundation 0x00c4d1e1 -[NSPlaceholderString initWithString:] + 162 6 Foundation 0x00c562c2 +[NSString stringWithString:] + 72 7 Parking 0x0000e4d4 -[CoreDataSingleton setItemInDFMWhilePreservingEntityUniquenessForItem:withValue:] + 774 8 Parking 0x00008bb4 -[DataUpdater allDataRetrievedWithSuccess:withError:] + 225 9 Parking 0x0000952e -[DataUpdater dataDownloadCompleted:forFunc:withData:withError:] + 769 10 Parking 0x00010bb5 -[DataRetriever finish] + 432 11 Parking 0x00010e75 -[DataRetriever connectionDidFinishLoading:] + 36 12 Foundation 0x00c61172 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108 13 Foundation 0x00c610cb _NSURLConnectionDidFinishLoading + 133 14 CFNetwork 0x0348e606 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220 15 CFNetwork 0x03559821 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293 16 CFNetwork 0x03559b0f _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1043 17 CFNetwork 0x03484e3c _ZN19URLConnectionClient13processEventsEv + 100 18 CFNetwork 0x03484cb7 _ZN17MultiplexerSource7performEv + 251 19 CoreFoundation 0x0118201f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 20 CoreFoundation 0x010e019d __CFRunLoopDoSources0 + 333 21 CoreFoundation 0x010df786 __CFRunLoopRun + 470 22 CoreFoundation 0x010df240 CFRunLoopRunSpecific + 208 23 CoreFoundation 0x010df161 CFRunLoopRunInMode + 97 24 GraphicsServices 0x01414268 GSEventRunModal + 217 25 GraphicsServices 0x0141432d GSEventRun + 115 26 UIKit 0x0004e42e UIApplicationMain + 1160 27 Parking 0x00002698 main + 102 28 Parking 0x00002629 start + 53 ) terminate called after throwing an instance of 'NSException' ``` I believe it has something to do with copying the string adequately (can't set a string I don't own to the store). I have tried placing `[value copy]` as well as `&value`(saw this sort of thing work for someone else, so I thought I would give it a shot) to no avail. Shouldn't my current method adequately take ownership of the string? I still can't figure out what I am doing wrong. Any help appreciated. Thanks!
Variable is Not A CFString Error
CC BY-SA 3.0
null
2011-04-23T01:30:14.227
2011-04-23T01:58:30.617
null
null
347,339
[ "objective-c", "cocoa-touch", "ios4", "core-data", "memory-management" ]
5,761,773
1
null
null
0
395
I've made a few custom controls to use in my projects, but i can't figure out how to set custom icons or descriptions like the pre-made visual studio controls have when you hover over them in the toolbox. ![http://i.stack.imgur.com/fB7DN.png](https://i.stack.imgur.com/AgXdW.png) So far i've tried using this: ``` /// <summary> /// Description of my Control /// </summary> ``` And adding this attribute to my control class: ``` [System.ComponentModel.Description("Description of my Control")] ``` But i just cant figure it out, does anyone know? Thanks.
Set Designer ToolBox proterties for custom controls
CC BY-SA 3.0
null
2011-04-23T02:34:14.390
2014-11-03T16:27:27.317
2011-11-27T03:07:02.073
234,976
721,356
[ "c#", "icons", "controls", "designer" ]
5,761,853
1
5,761,967
null
0
624
OK so my brain is just probably not working tonight. What I'm trying to accomplish is a two column layout where one column scrolls and the other is fixed. The fixed column has a large background image in it that I would like to be able to scale to the size of the screen. Additionally the left (fixed) column's width would have to scale to accommodate the background image. The best way to really explain this is with a picture: ![Layout](https://i.stack.imgur.com/lvvrv.png) The highlighted area with the arrow in it will scroll and the other column with the picture and twitter status in it would remain fixed. My problem does not come into play with the fixed CSS positioning. My issue is with scaling my columns based on screen size so that the picture always remains in the proportion it's shown here both in it's own dimensions and those of the other column. That's what I'm stuck on. Any ideas? I really appreciate the help.
Advanced CSS Layout | Fixed Column w/ Very Large Picture
CC BY-SA 3.0
null
2011-04-23T02:56:31.637
2011-04-23T11:02:08.063
null
null
483,418
[ "css", "scroll", "positioning", "image-scaling", "css-position" ]
5,761,928
1
null
null
1
1,214
i am using pydev to develop a google app engine application. i followed the steps mentioned [here](https://stackoverflow.com/questions/455552/break-on-exception-in-pydev) to configure pydev debugger to break on unhandled exception. i could get it to work on a sample pydev project, but when i try the same steps in my pydev gae project, it doesn't work and gives following error: > pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower) pydev debugger: starting ... Traceback (most recent call last): File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 3858, in _HandleRequest self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 3792, in _Dispatch base_env_dict=env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 580, in Dispatch base_env_dict=base_env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2918, in Dispatch self._module_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2822, in ExecuteCGI reset_modules = exec_script(handler_path, cgi_path, hook) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2702, in ExecuteOrImportScript exec module_code in script_module. File "C:\Users\siddjain\workspace\rfad\src\main.py", line 1, in import pydevd ImportError: No module named pydevd my debug configuration for gae project is like this: ![enter image description here](https://i.stack.imgur.com/jmt5v.jpg) the sample pydev project where it works is like this and am following same pattern in my gae project: ``` import pydevd def f(x,y): z = y/x; return z; def main(): pydevd.set_pm_excepthook() print f(0,0) if __name__ == '__main__': main() ``` the run config for test project is like this: ![enter image description here](https://i.stack.imgur.com/xtN1y.jpg) the pydevd.py module is under C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc. Although this path is not included in the pythonpath for test project, the breaking works in test. i also tried including this path in pythonpath of gae project to see if that fixes my problem, but it didn't
breaking on unhandled exceptions in pydev/gae
CC BY-SA 3.0
null
2011-04-23T03:19:40.020
2011-04-23T16:16:50.603
2017-05-23T11:55:50.580
-1
147,530
[ "pydev" ]
5,761,950
1
5,762,036
null
1
1,521
Hi I downloaded some PEAR files and they're in the bin folder of my MAMP directory. Inside the bin folder, they're in a bunch of subfolders (php 5.3/lib/php/pear etc) as you can see below However, the files that are requiring PEAR are in htdocs, so they're not connecting at all. As I'm a newbie I'm cautious about taking all of those files from the php folder in bin and moving them into htdocs, yet it would also be a complicated file path to include them in every file from htdocs. Has anyone used Pear. Is it supposed to be set up like this? ![bin and htdocs in MAMP folder](https://i.stack.imgur.com/FEdiC.png) ![inside bin](https://i.stack.imgur.com/bve8Z.png) UPDATE -screenshot of Pear folder, and also screenshot of terminal pointing out suggested locations for pear ![Pear](https://i.stack.imgur.com/O8l0h.png) ![terminal asking me where to put pear](https://i.stack.imgur.com/VwdU4.png) ``` # Setting PATH for MacPython 2.6 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}" export PATH # Setting PATH for MacPython 2.5 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" export PATH #I HAVE ADDED THE PATH HERE export PATH=$PATH:/usr/local/mysql/bin:/Users/michaelmitchell/pear/bin/ # Setting PATH for Python 3.2 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}" export PATH File Name to Write: .bash_profile (HIT ENTER) ^G Get Help ^T To Files M-M Mac Format M-P Prepend ^C Cancel M-D DOS Format M-A Append M-B Backup File ```
php MAMP path problem
CC BY-SA 3.0
null
2011-04-23T03:27:53.367
2013-08-05T19:41:48.823
2011-04-23T08:42:55.800
486,094
577,455
[ "php", "pear", "mamp" ]
5,762,135
1
5,763,627
null
4
5,529
I have a Reason object: ``` public class Reason { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual Company Company {get;set;} } ``` I am using entity framework 4 and Company is navigation property to Company. I also use webservices in order to return data to the client. I have web method that returns Reasons: ``` [WebMethod] public Reason[] GetCallReasons() { IReasonRepository rep = ObjectFactory.GetInstance<IReasonRepository>(); return rep.GetReasonsList().ToArray(); } ``` Because of the ef4 I get the following exception for executing the web method: ``` A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Reason_24A0E4BBE02EE6BC2CF30BB56CFCB670C7D9D96D03D40AF4D174B89C9D3C5537' ``` The problem accurs because ef4 adds property that can't be serialized: ![Image of the watch panel on rep.GetReasonsList().ToArray()](https://i.stack.imgur.com/lZhur.png) In order to solve this and eliminate the error, I can disable the navigation property by not making it virtual or by remove the navigation property. But I neet it and want to use the lazy loading feature. I also can write spesific serializer for Reason but I have many many classes the I used in my web-services and write a serializer for all of them is a lot of work. How can I solve this exception?..
ef4 cause Circular reference in web service
CC BY-SA 3.0
0
2011-04-23T04:18:00.803
2011-10-13T19:52:21.910
2011-04-23T10:17:54.070
413,501
289,246
[ "c#", ".net", "web-services", "entity-framework", "serialization" ]
5,762,176
1
5,762,214
null
-1
168
I dont know why i am getting the following exception how can I cast into grouping Row ? What does grouping row means ![enter image description here](https://i.stack.imgur.com/ynn9k.png)
Casting into grouping row
CC BY-SA 3.0
0
2011-04-23T04:29:20.823
2011-04-23T04:39:30.877
null
null
389,288
[ "c#", ".net", "linq", "ado.net" ]
5,762,271
1
null
null
0
926
I have a ListAdapter that contains a bunch of images that are being downloaded from the internet. When I scroll up and down there seems to be a performance hit and things get jerky. How can I resolve this? ``` @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.message_row, null); } STMessage aMessage = messages.get(position); if (aMessage != null) { TextView usernameTextView = (TextView) v.findViewById(R.id.usernameTextView); TextView bodyTextView = (TextView) v.findViewById(R.id.bodyTextView); TextView dateTextView = (TextView) v.findViewById(R.id.dateTextView); ImageView avatarImageView = (ImageView)v.findViewById(R.id.avatarImageView); if (usernameTextView != null) { usernameTextView.setText(Html.fromHtml(aMessage.getUser_login())); } if (bodyTextView != null) { bodyTextView.setText(aMessage.getBody()); //linkify urls Linkify.addLinks(bodyTextView, Linkify.WEB_URLS); //linkify symbols Pattern symbolMatcher = Pattern.compile("/(?:^|\\s|[\\.(\\+\\-\\,])(?:\\$?)\\$((?:[0-9]+(?=[a-z])|(?![0-9\\.\\:\\_\\-]))(?:[a-z0-9]|[\\_\\.\\-\\:](?![\\.\\_\\.\\-\\:]))*[a-z0-9]+)/i"); String symbolURL = "content://com.stocktwits.activity/symbol/"; Linkify.addLinks(bodyTextView, symbolMatcher, symbolURL); } if (dateTextView != null) { dateTextView.setText(aMessage.getUpdated_at()); } if (avatarImageView != null) { imageDownloader.download(aMessage.getAvatar_url(), avatarImageView); } } return v; } ```
How can I download images from the network in a ListView without lag?
CC BY-SA 3.0
null
2011-04-23T04:55:27.157
2011-04-23T23:11:41.690
null
null
19,875
[ "java", "android", "imageview", "android-arrayadapter", "listadapter" ]
5,762,306
1
null
null
12
2,884
I'm working on the details of a symbols pop up button, similar to what Xcode 3 at the top of its editor window. My controller object is the delegate of the `NSMenu` that is shown when the `NSPopUpButton` is shown. I implement the two methods `numberOfItemsInMenu:` and `menu:updateItem:atIndex:shouldCancel:` to populate the menu right before it's about to be displayed. However, the title and image of the selected `NSMenuItem` have to change each time the user changes the selection in the editor `NSTextView`, or makes changes to the text; just as is the case with Xcode. The problem I'm having is when the user goes to click on the `NSPopUpButton` to display the `NSMenu`, the selected `NSMenuItem` and the item that should be selected do not match up, since the menu doesn't have the proper number of items yet. I'm wondering if there is a way to control which `NSMenuItem` is initially highlighted and tracked when the user clicks to open the menu. As it stands, the first item it always highlighted and tracked or, if the user had previously selected a item, that item is highlighted and tracked. I tried explaining as best I could, but here is a image illustrating my problem: ![http://imgur.com/izGvh](https://i.stack.imgur.com/CFEL2.png) I want the highlighted item to be the same as the selected item when the user opens the menu. Any ideas?
Is there a way to control the NSMenuItem item that is initially highlighted when opening a menu?
CC BY-SA 3.0
null
2011-04-23T05:04:00.707
2016-03-28T18:02:37.133
2011-12-04T01:08:39.657
84,042
296,961
[ "objective-c", "cocoa", "nsmenu" ]
5,762,417
1
null
null
14
1,330
From what I understand about A* heuristics and how the Bresenham algorithm works, this may not be be possible since only the current state and goal state are passed to the heuristic function. But maybe someone has a clever solution to this problem. I am using A* to plan a path on a grid, and I would like a heuristic that would cause the best path to follow a Bresenham's line when there are free spaces between the current state and the goal or the next turn around an obstacle. Here are some images to illustrate the problem. If movements in the world acted like a checkers on a grid, this would be perfectly fine, but I'm eventually going to convert the A* path to motions on a continuously plane, so this does work very well. ![The shortest path from red to green using the Manhattan distance heuristic](https://i.stack.imgur.com/m8ySD.png) Better, but still not perfect. Notice the straight line at the end. The diagonal could have just as easily remained a diagonal, which is what I want. ![The shortest path from red to green using the Euclidian distance heuristic](https://i.stack.imgur.com/6CGsI.png) Bresenham lines are draw to the next turn or goal. ![The best path I actually want, which uses Bresenham lines to get to the goal](https://i.stack.imgur.com/t43z2.png) I found a good resource here, [http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html](http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html) that touches on what I am looking for, but only seems to work for drawing Bresenham lines from the start to the goal. What I want are Bresenham lines being draw to the next turn around an obstacle too. Any ideas for a good approach to this problem?
A* heuristic to create Bresenham lines
CC BY-SA 3.0
0
2011-04-23T05:34:51.153
2011-04-25T20:10:13.070
null
null
402,893
[ "algorithm", "grid", "line", "a-star", "bresenham" ]
5,762,534
1
6,986,851
null
4
1,065
I'm looking for a scala trait that I can mix in to a `scala.swing.Component` that will allow that component to be positioned and resized using mouse input. Ideally it would add little boxes as "handles" to indicate to the user that the component can be resized: ![enter image description here](https://i.stack.imgur.com/MRuSK.png) I feel like this is a fairly common task, and there should be some traits out there that support it.
scala swing: draggable / resizable component trait
CC BY-SA 3.0
0
2011-04-23T06:04:56.960
2021-02-19T15:42:02.873
null
null
244,526
[ "swing", "scala", "drag-and-drop", "resize", "position" ]
5,762,913
1
5,775,633
null
5
313
![enter image description here](https://i.stack.imgur.com/x0lOc.gif) The image above shows a Nested model tree approach. i am searching for a query that will only display level number 1 with nodes FRUIT and MEAT when FRUIT or MEAT are called I I have formulate a combination of children and sibilings I think to pull of Beef when Red is called as below. ``` INSERT $sqlinsert = "INSERT INTO categories (categories_id, parent_id,name, parent) VALUES('','','$name', '$parent')"; $enterquery = mysql_query($sqlinsert) or die(mysql_error()); $customer_id = mysql_insert_id(); ``` I am looking to insert parent_id throug relating a new filled called parent that will be related to the existing field called "name" and then if parent field = to existing name field then take category_id from that name field and put it as the parent_id of the new INSERTED name. for instance a user insert name "blue" and parent "food" then the name blue will take the categories id of food, and place it as the parent_id of blue...
Looking for a query to display nodes in the same level only
CC BY-SA 3.0
null
2011-04-23T07:29:53.150
2011-04-28T18:40:28.940
2011-04-28T18:40:28.940
666,159
666,159
[ "sql" ]
5,763,079
1
5,784,987
null
1
4,815
I am trying to debug a Windows Azure WebRole which is an MVC3 project, but I want it to launch in any browser of my choice. The Windows Azure is set as the Startup Project and launches the MVC3 project WebRole. I am using Visual Studio Web Developer Express 2010. I have previously stabbed in the dark by setting the following properties as in the image below but to no avail: ![ProjectPropertyPages_WebTab](https://i.stack.imgur.com/7qig9.png) I then decided to set the project to not independently launch a page as above. Is there a way to setup a default browser with the above scenario without changing my Windows default browser?
Default Browser- Visual Web Developer Express 2010
CC BY-SA 3.0
null
2011-04-23T08:07:23.747
2012-06-25T13:16:24.423
null
null
435,873
[ "visual-studio-2010", "asp.net-mvc-3", "azure", "visual-web-developer" ]
5,763,121
1
5,763,167
null
1
1,831
I will show you the exact code and output of the code... This is my linq .dbml file ![enter image description here](https://i.stack.imgur.com/2nCWT.png) This i the combobox cbx_contact code : ``` <ComboBox Height="22.669" Margin="107.769,43.75,424.266,0" Name="cbx_contact" VerticalAlignment="Top" IsTabStop="True" SelectedValuePath="ContactID" IsSynchronizedWithCurrentItem="True" IsEditable="True" IsTextSearchEnabled="True"> <ComboBox.ItemTemplate> <DataTemplate> <Grid> <TextBlock Text="{Binding Path=ContactName}"/> </Grid> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> ``` This is the .cs file : ``` public Contacts() { InitializeComponent(); DataClasses1DataContext db = new DataClasses1DataContext(); cbx_contact.ItemsSource = db.Contacts; cbx_contact.SelectedIndex = 0; } ``` This is the output view of the combobox : ![enter image description here](https://i.stack.imgur.com/rAdJ8.png) ![enter image description here](https://i.stack.imgur.com/RNzK8.png) Here in the drop down list of combobox i get all the values but when i select any value the text does not change it gives Contact_Manager.Contact.... I dont know what i am missing here... I have binded combobox like this before also it was working at that time but here it is creating probs... thanks in advance for the help...
WPF combobox binding not working.. It is not showing the exact value
CC BY-SA 3.0
null
2011-04-23T08:18:20.057
2011-04-23T08:29:46.150
null
null
406,427
[ "c#", "wpf", "linq", "combobox", "binding" ]
5,763,258
1
5,763,392
null
13
13,202
I want to add a clear button to the search textbox in my application. Is there a ready Ajax extender or a JQuery functionality to implement that? ![enter image description here](https://i.stack.imgur.com/SUeIT.png) Thanks in advance.
Is there something ready for a Clear button on search textbox?
CC BY-SA 3.0
0
2011-04-23T08:51:22.620
2016-08-05T10:34:37.220
2020-06-20T09:12:55.060
-1
322,355
[ "jquery", "html" ]
5,763,444
1
5,766,510
null
2
9,669
I have two array 451x1 , I want to fit a line to a part of my data, for x=3.8 –4.1 , and I want to evaluate interception of fitted line with line y=0, Do you have any idea? (In matlab ) ![enter image description here](https://i.stack.imgur.com/6Fkao.png) [data](http://dl.dropbox.com/u/21031944/book1.xls)
Fit a line to a part of a plot
CC BY-SA 3.0
null
2011-04-23T09:34:55.203
2011-04-23T19:51:23.163
null
null
601,908
[ "matlab" ]
5,763,430
1
5,764,046
null
0
1,923
This is my design ``` <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Font-Names="Arial" Font-Size="11pt" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowCommand="GridView1_RowCommand"> <Columns> <asp:TemplateField> <HeaderTemplate> <asp:CheckBox ID="CheckAll" onclick="return check_uncheck (this );" runat="server" /> </HeaderTemplate> <ItemTemplate> <asp:Label ID="ID" Visible="false" Text='<%# DataBinder.Eval (Container.DataItem, "Id") %>' runat="server" /> <asp:CheckBox ID="deleteRec" onclick="return check_uncheck (this );" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Id" SortExpression="Id"> <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Id") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="FileName" SortExpression="FileName"> <EditItemTemplate> <asp:Label ID="LblFileName" runat="server" Text='<%# Eval("FileName") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="LblFileName1" runat="server" Text='<%# Bind("FileName") %>'></asp:Label> <asp:ImageButton ID="img" runat="Server" CommandName="Image" ImageUrl="~/Images/pen.png" /> </ItemTemplate> </asp:TemplateField> </Columns> <AlternatingRowStyle BackColor="White" /> <RowStyle BackColor="#F7F7DE" /> <FooterStyle BackColor="#CCCC99" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /> </asp:GridView> <asp:Panel ID="pnlAddEdit" runat="server" CssClass="modalPopup" Style="display: none" Width="1000px"> <asp:Label Font-Bold="true" ID="Label4" runat="server" Text="File Data"></asp:Label> <br /> <table align="center" width="1000px"> <tr> <td> <asp:Label ID="Label1" runat="server" Text="RecordTypeCode"></asp:Label> </td> <td> <asp:Label ID="lblRec" runat="server" Text="Content"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="lblFileHeader" runat="server" Text="FileHeader"></asp:Label> </td> <td> <asp:Label ID="txtCustomerID" Width="500px" MaxLength="5" runat="server"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="lblBatchHeader" runat="server" Text="BatchHeader"></asp:Label> </td> <td> <asp:Label ID="txtBatch" runat="server"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label2" runat="server" Text="EntryDetail"></asp:Label> </td> <td> <asp:Label ID="txtEntry" runat="server"></asp:Label> </td> </tr> <tr> <td> <asp:Button ID="btnSave" runat="server" Text="Save" /> </td> <td> <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="return Hidepopup()" /> </td> </tr> </table> </asp:Panel> <asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton> <cc1:ModalPopupExtender ID="popup" runat="server" DropShadow="false" PopupControlID="pnlAddEdit" TargetControlID="lnkFake" BackgroundCssClass="modalBackground"> </cc1:ModalPopupExtender> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="GridView1" /> <asp:AsyncPostBackTrigger ControlID="btnSave" /> </Triggers> </asp:UpdatePanel> ``` I have taken some text boxes inside a panel when a pop-up opens but instead of that i need a gridview to be there as i have to display the content of a large file This is my data ``` 101 111100022 5104885671104200936A094101CapitalOne MudiamInc 5220MudiamInc A510488567CCDITServices000000110422 1111100020000001 622968765348545646565 00004000001007 rajeshk 1111100020000001 62297877654775676546546 00002888891007 rajeshk 1111100020000002 82200000020194754188000000000000000000688889A510488567 111100020000001 5220MudiamInc A510488567CCDITServices000000110422 1111100020000002 62212345678034354465677 00000864451005 swethau 1111100020000003 62212345678087664534543 00000559841011 swathiK 1111100020000004 62212345678097867546435 00000579351012 lavanyaK 1111100020000005 6221234567806754654435435 00000846761013 AnithaN 1111100020000006 82200000040049382712000000000000000000285040A510488567 111100020000002 9000002000001000000060244136900000000000000000071739300 ``` This i have to show sequentially in an order as ``` RecordTyecode Content FileHeader Starting line to be here BatchHeader Line that come's with 5(First come line) EntryDetail Number of 6 line has to be added on by one BatchControl line that starts with 8 has to be here ``` Again if i have line starts with `5` after `8` that has to be appended like above sequence Can any give me an idea to add this dynamically a little tricky to understand ask if any information required This was done in `winforms` exact i need in web too ![enter image description here](https://i.stack.imgur.com/e1pKs.png)
How can i have a gridview or details view in a popup
CC BY-SA 3.0
null
2011-04-23T09:32:00.087
2012-07-16T06:01:00.100
null
null
388,388
[ "c#", "asp.net", "gridview" ]
5,763,575
1
5,763,722
null
0
103
I have the following dataset, I want to select distinct rows. since the data is flat. I dont how can i do that with linq ? ![Following is the sample of the data](https://i.stack.imgur.com/TLr9b.jpg) Following is the code snippet who I am meeting my requirement, How can i optimize it ? ``` VendorInvoiceStagingTable = new Program().ReadExcelFile(@"C:\Users\huzaifa.gain\Desktop\Vendor invoice import - sample data set.xlsx", "Sheet2"); var InvoiceHeadercollection = VendorInvoiceStagingTable.AsEnumerable().Select(t=>t.Field<string>(VendInvoice.Number)).Distinct(); VendorInvoiceTable = new Program().CreateHeader(); foreach (var InvoiceHeader in InvoiceHeadercollection) { IEnumerable<DataRow> query = from vendInv in VendorInvoiceStagingTable.AsEnumerable() where vendInv.Field<string>(VendInvoice.Number) == InvoiceHeader select vendInv; Object[] obj = new Object[10]; var item = query.First(); for (int idx = 0; idx < 10; idx++) { obj[idx] = item[idx]; } VendorInvoiceTable.Rows.Add(obj); } ```
Optimizing algo for getting distinct values
CC BY-SA 3.0
null
2011-04-23T10:06:57.047
2011-04-23T12:24:26.993
2011-04-23T11:02:53.820
389,288
389,288
[ "c#", ".net", "linq", "linq-to-sql" ]
5,763,700
1
null
null
0
504
How to remove black shade in the Drawable image in Android?![enter image description here](https://i.stack.imgur.com/v8o3T.png) ``` Drawable d = new BitmapDrawable(bitmap);mapController.animateTo(geoPoint); mapOverlay = new MapOverlay(d); listOfOverlays = mapView.getOverlays(); // listOfOverlays.clear(); listOfOverlays.add(mapOverlay); overlayitem = new OverlayItem(geoPoint, "", ""); mapOverlay.addOverlay(overlayitem); listOfOverlays.add(mapOverlay); mapView.invalidate(); ```
How to remove black shade in the Drawable image in Android?
CC BY-SA 3.0
null
2011-04-23T10:36:49.357
2011-04-23T11:59:43.103
2011-04-23T11:59:43.103
227,466
536,091
[ "android" ]
5,763,986
1
5,764,148
null
29
72,253
I'm generating an UIWebView into my viewDidLoad method, with a tiny size (let's say something like 50x70). And then I put it into a super UIView. I'd like to make its content fit the webView frame. To do this, I wrote : ``` oneView = [[UIWebView alloc] initWithFrame:CGRectMake(x, y, W, H)]; oneView.backgroundColor = [UIColor whiteColor]; oneView.autoresizingMask = UIViewAutoresizingFlexibleWidth; oneView.scalesPageToFit = YES; oneView.autoresizesSubviews = YES; [self.view addSubview:oneView]; [oneView loadRequest:/*some request*/]; ``` But doing this, the web page is not resized to the frame of the UIWebView. It seems to be scaled to something else, smaller than the superview's frame, and wider than the webview's one. ![enter image description here](https://i.stack.imgur.com/YcIXU.png) If I set the webview frame size to the whole superview's size, it's ok. How may I force the web content (real www content) to fit the frame of the "reduced" UIWebView ?
iPhone - Auto resizing UIWebView content do not fit the frame
CC BY-SA 3.0
0
2011-04-23T11:43:30.930
2021-08-12T16:54:04.920
2016-06-15T07:05:57.583
1,371,853
499,417
[ "ios", "iphone", "uiwebview", "frame", "autoresize" ]
5,764,114
1
5,764,179
null
0
1,309
I dont know how to get rid of this error ? Error 1 Using the generic type 'System.Collections.Generic.IEnumerable' requires 1 type arguments C:\Users\huzaifa.gain\documents\visual studio 2010\Projects\VendInvoiceImport\VendInvoiceImport\Program.cs 34 24 VendInvoiceImport ``` private static IEnumerable<string , string > DistinctInvoiceNumber(DataTable VendorInvoiceStagingTable) { var InvoiceLinecollection = VendorInvoiceStagingTable.AsEnumerable().Select(t => new { number = t.Field<string>(VendInvoice.Number),LineNumber = t.Field<string>(VendInvoice.LineNumber)}).Distinct(); return InvoiceLinecollection; } ``` ![enter image description here](https://i.stack.imgur.com/zaoQS.png)
IEnumerable <T> with anonymous methods
CC BY-SA 3.0
null
2011-04-23T12:17:43.940
2011-04-23T12:40:55.413
2011-04-23T12:26:48.727
680,275
389,288
[ "c#", ".net", "linq" ]
5,764,151
1
5,764,223
null
1
600
i am trying to make an application which would show which color my mouse is pointing to, i dont mean in my own application but anywhere in windows on any screen, kind of like a tag beside my mouse pointer which shows the exact color. ![example](https://i.stack.imgur.com/FbEHd.jpg) I am a Java developer but i dont think this could be done in java i am thinking maybe i need some sort of script but i have no idea any help would be really appriciated
Mouse shows color
CC BY-SA 3.0
0
2011-04-23T12:26:54.657
2011-04-23T13:11:28.460
2011-04-23T12:36:13.977
520,989
520,989
[ "java", "windows", "scripting", "mouseover", "windows-scripting" ]
5,764,263
1
5,764,372
null
1
537
I think this is a very basic question, but I am struggling with this one. I have a screenshot (an UIImage) which I put into an UIView (called screenShotView in my sample below). I want to get rid of this screenShotView by gradually revealing what is behind this screenShotView. Right now my screenShotView SQUEEZES to the left, but I would like its FRAME to become less and less until the screenShotView is no longer seen (without Squeezing). This is my code. If I did the same transformation with an UITextView (instead of an UIImage) it would work exactly how I would like it to behave (without transformation). Perhaps I don't get the concept of framing UIImages? ``` [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:10]; [screenShotView setFrame:CGRectMake(0, 0, 0, 480)]; [UIView commitAnimations]; ``` --- And this is how it looks like in the middle of the animation: ![enter image description here](https://i.stack.imgur.com/vUXun.png) And this is how I would like it to look like in the middle of the animation: ![enter image description here](https://i.stack.imgur.com/oZuH1.png) --- This is the code updated to Codo's suggestions (see below), with the result that I have no animation anymore. The blue screen simply pops up once the button is pressed. I guess that I am doing something wrong with adding the subviews -- the problem appears to be that no subviews are added and can therefore not disappear: ``` -(IBAction)showNextText { screenShotView = [[UIImageView alloc] initWithImage:[self screenshot]]; [screenShotView setFrame:CGRectMake(0, 0, 320, 480)]; [screenShotScrollView setFrame:CGRectMake(0, 0, 320, 480)]; [self.view addSubview:screenShotScrollView]; [screenShotScrollView addSubview:screenShotView]; screenShotScrollView.scrollEnabled = NO; [self setUpNextText]; [self removeOldText]; } -(void)setUpNextText { NSString* secondText = @"This is the second text shown if the user clicks next."; textView.text = secondText; textView.textColor = [UIColor redColor]; textView.backgroundColor = [UIColor blueColor]; } -(IBAction)removeOldText{ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:5]; [screenShotScrollView setFrame:CGRectMake(0,0,320,480)]; [UIView commitAnimations]; } ```
How to decrease the width of a frame of an UIImage gradually without distorting it?
CC BY-SA 3.0
null
2011-04-23T12:54:12.923
2011-04-23T19:19:54.500
2011-04-23T13:42:43.947
648,371
648,371
[ "iphone", "objective-c", "cocoa-touch", "uiimage" ]
5,764,322
1
5,764,497
null
1
501
I'm working on a calendar/planner application and I need some advice. I'm working on the following part of my application: ![days of the month](https://i.stack.imgur.com/8Jv3u.png) It shows the days of the month from 1 till the end of the month, 28/29, 30 or 31. I achieved this.. ([here](http://www.obscura-design.be/planner)) but my code is extremely ugly and I'm sure there must be another way to do this. I'm working in CodeIgniter. My controller contains the following function to populate the list with the days of the month: ``` public function init_days() { // post values? in case of previous/next months (ajax) if($this->input->post('post_month') && $this->input->post('post_year')) { $month = $this->input->post('post_month'); $year = $this->input->post('post_year'); $data = $this->planner_model->calendar_data($month, $year); } else { $data = $this->planner_model->calendar_data(); } // init empty calendar $data['calendar'] = ''; // easy var names $current_month = $data['current_month']; $current_year = $data['current_year']; // echo list into $data['calendar'] for($i = 1; $i <= $data['days_in_month']; $i++) { if($current_month == date('n') && $current_year == date('Y')) { if($i < $data['current_day_of_month']) { $data['calendar'] .= "<li class='prev_month' value='$i'>$i</li>"; } if($i == $data['current_day_of_month']) { $data['calendar'] .= "<li class='today' value='$i'>$i</li>"; } if($i > $data['current_day_of_month']) { $data['calendar'] .= "<li class='next_month' value='$i'>$i</li>"; } } if( ($current_month > date('n') && $current_year == date('Y')) || ($current_year > date('Y')) ) { $data['calendar'] .= "<li class='next_month' value='$i'>$i</li>"; } if( ($current_month < date('n') && $current_year == date('Y')) || ($current_year < date('Y')) ) { $data['calendar'] .= "<li class='prev_month' value='$i'>$i</li>"; } } $data['month_name'] = ucfirst($this->get_month_name($current_month)); header('Content-type: application/json'); echo json_encode($data); } ``` My model returns the $data array that gets called by the controller (in the else clause, first part): ``` public function calendar_data($month = '', $year = '') { if( ! empty($month) && ! empty($year)) { $data['current_year'] = $year; $data['current_month'] = $month; $data['current_day_of_month'] = date('j'); $data['current_day_of_week'] = date('w'); $data['days_in_month'] = cal_days_in_month(CAL_GREGORIAN, $month, $year); } else { $data['current_year'] = date('Y'); $data['current_month'] = date('n'); $data['current_day_of_month'] = date('j'); $data['current_day_of_week'] = date('w'); $data['days_in_month'] = cal_days_in_month(CAL_GREGORIAN, $data['current_month'], $data['current_year']); } return $data; } ``` I then output this in my view with an AJAX call on $(document).ready. `$("#day_list").html(data['calendar']).fadeIn();` I'm not happy with the code. It's a mess, and I'm fairly sure I'm breaking MVC here; aren't I? Could someone perhaps give some advice or insights on how to do this in a 'better' way? Thanks a lot. The full source is [here](https://github.com/cabaret/Studieplanner) in case anyone would be kind enough to look through it and tell me if there's other stuff I'm doing wrong.
Calendar application - outputting days of the month
CC BY-SA 3.0
null
2011-04-23T13:04:58.197
2013-08-22T19:16:45.923
2013-08-22T19:16:45.923
287,583
613,721
[ "php", "model-view-controller", "codeigniter", "date", "calendar" ]
5,764,431
1
5,800,208
null
6
4,589
This is what the generated graph looks currently: ![](https://i.stack.imgur.com/nWZt6.png) And here is the code for this: ``` digraph { rankdir=TB; subgraph cluster01 { label="1.fázis" aSTART; node [shape = doublecircle]; a001; node [shape = ellipse]; aSTART -> a0 [ penwidth = 3 label = "0" ]; a0 -> a00 [ penwidth = 3 label = "0" ]; a00 -> a001 [ penwidth = 3 label = "1" ]; a0 -> aSTART [ label = "1" ]; a00 -> a00 [ label = "0" ]; a001 -> a0 [ label = "0"]; a001 -> aSTART [ label = "1"]; aSTART -> aSTART [ label = "1"]; } subgraph cluster02 { label="2.fázis" bSTART; b1; b11; node [shape = doublecircle]; b111; node [shape = ellipse]; bSTART -> b1 [ penwidth = 3 label = "1" ]; b1 -> b11 [ penwidth = 3 label = "1" ]; b11 -> b111 [ penwidth = 3 label = "1" ]; b1 -> bSTART [ label = "0" ]; b11 -> bSTART [ label = "0" ]; b111 -> bSTART [ label = "0"]; bSTART -> bSTART [ label = "0"]; b111 -> b111 [label = "1"]; } subgraph cluster03 { label="3.fázis"; cSTART; c0; c1; c01; c10; node [shape = doublecircle]; c010; c100; node [shape = ellipse]; cSTART -> c0 [ penwidth = 3 label = "0" ]; c0 -> c01 [ label = "1" ]; c01 -> c010 [ penwidth = 3 label = "0" ]; cSTART -> c1 [ label = "1" ]; c1 -> c10 [ penwidth = 3 label = "0" ]; c10 -> c100 [ label = "0" ]; c0 -> c1 [ penwidth = 3 label = "1" ]; c01 -> c1 [ label = "1" ]; c1 -> c1 [label = "1"]; c10 -> c01 [ penwidth = 3 label = "1"]; c010 -> c100 [penwidth = 3 label = "0"]; c010 -> c01 [label = "1"]; c100 -> c01 [label = "1"]; c100 -> c0 [label = "0"]; } a001 -> b1 [color = "red" style = "dashed"]; b111 -> c1 [color = "red" style = "dashed"]; } ``` If I remove the 2 red lines, then it lines up the way I want it to: ![](https://i.stack.imgur.com/7eePE.png) How could I make it line up like this and have the two red lines at the same time?
How can I get dot to draw connected subgraphs side by side?
CC BY-SA 3.0
0
2011-04-23T13:30:12.153
2015-03-27T09:36:44.050
2013-09-30T18:13:08.443
15,416
55,267
[ "graphviz", "dot", "directed-graph", "subgraph" ]
5,764,786
1
null
null
1
1,522
Sorry if it is wrong section to post this. I want use JW player as an audio player. So I want to take it out the area above control bar which display thumbnails because I only want control bar to display. If that's only one song, i can just change the height of the JW player but now what I want is with playlist. So If i change the height of the JW player, the bottom playlist is screwed up. I attached the image to make it clear. ![enter image description here](https://i.stack.imgur.com/GHfym.jpg) Playlist Become like this when I change the height of the JW player ![enter image description here](https://i.stack.imgur.com/n32EA.png)
JW Player How to take out the screen area above the control bar?
CC BY-SA 3.0
null
2011-04-23T14:35:33.553
2012-08-19T07:21:09.203
2011-04-23T15:07:20.863
139,010
329,453
[ "javascript", "flash", "jwplayer" ]
5,765,130
1
5,765,169
null
2
321
Here is my html: ``` <div class="pagination">Page <a href="page.php?submit=1&amp;page=2">&#171;</a> <a href="page.php?submit=1&amp;page=1">1</a> <a href="page.php?submit=1&amp;page=2">2</a> <strong>3</strong> <a href="page.php?submit=1&amp;page=4">4</a> ... <a href="page.php?submit=1&amp;page=104">104</a> <a href="page.php?submit=1&amp;page=4">&#187;</a> </div> ``` My css: ``` div.pagination { width: 90%; margin: 15px auto; float:right; text-align: right; } div.pagination a { border: 1px solid #0667B9; background-color:#B4D6F2; padding: 3px 6px; color:#0667B9; margin: 1px; } div.pagination strong { border: 1px solid #0667B9; background-color:#FFFFFF; padding: 3px 6px; color:#0667B9; margin: 1px; } div.pagination a:hover { border: 1px solid #0667B9; background-color:#0667B9; padding: 3px 6px; color:#B4D6F2; margin: 1px; } ``` And what I am getting in result: ![Unwanted Css overlapping](https://i.stack.imgur.com/wrAmB.jpg) The problem you see, things are getting overlapped, what I would like to avoid. Thanks in advance for any help. Cheers.
css unwanted overlapping
CC BY-SA 3.0
null
2011-04-23T15:39:49.593
2012-12-07T07:26:01.533
2012-12-07T07:26:01.533
1,845,869
613,018
[ "css" ]
5,765,255
1
5,765,312
null
0
9,897
I am creating a Class Diagram for a simple booking system for the theater. I would like to know if the diagram makes any sense and if anything needs to be changed (arrow directions) in order for it to be correct? Thanks. ![enter image description here](https://i.stack.imgur.com/zWiGW.jpg) Image URL: [http://i.stack.imgur.com/zWiGW.jpg](https://i.stack.imgur.com/zWiGW.jpg)
Feedback on UML Class Diagram
CC BY-SA 3.0
null
2011-04-23T15:59:12.430
2011-04-24T18:37:41.957
2011-04-23T18:11:46.237
251,671
251,671
[ "uml", "class-diagram", "modeling" ]
5,765,491
1
5,765,816
null
12
7,936
I am looking to plot something like the whispering gallery modes -- a 2D cylindrically symmetric plot in polar coordinates. Something like this: ![whispering gallery modes](https://i.stack.imgur.com/kgztc.png) I found the following code snippet in Trott's symbolics guidebook. Tried running it on a very small data set; it ate 4 GB of memory and hosed my kernel: ``` (* add points to get smooth curves *) addPoints[lp_][points_, \[Delta]\[CurlyEpsilon]_] := Module[{n, l}, Join @@ (Function[pair, If[(* additional points needed? *) (l = Sqrt[#. #]&[Subtract @@ pair]) < \[Delta]\[CurlyEpsilon], pair, n = Floor[l/\[Delta]\[CurlyEpsilon]] + 1; Table[# + i/n (#2 - #1), {i, 0, n - 1}]& @@ pair]] /@ Partition[If[lp === Polygon, Append[#, First[#]], #]&[points], 2, 1])] (* Make the plot circular *) With[{\[Delta]\[CurlyEpsilon] = 0.1, R = 10}, Show[{gr /. (lp : (Polygon | Line))[l_] :> lp[{#2 Cos[#1], #2 Sin[#1]} & @@@(* add points *) addPoints[lp][l, \[Delta]\[CurlyEpsilon]]], Graphics[{Thickness[0.01], GrayLevel[0], Circle[{0, 0}, R]}]}, DisplayFunction -> $DisplayFunction, Frame -> False]] ``` Here, `gr` is a rectangular 2D ListContourPlot, generated using something like this (for example): ``` data = With[{eth = 2, er = 2, wc = 1, m = 4}, Table[Re[ BesselJ[(Sqrt[eth] m)/Sqrt[er], Sqrt[eth] r wc] Exp[ I m phi]], {r, 0, 10, .2}, {phi, 0, 2 Pi, 0.1}]]; gr = ListContourPlot[data, Contours -> 50, ContourLines -> False, DataRange -> {{0, 2 Pi}, {0, 10}}, DisplayFunction -> Identity, ContourStyle -> {Thickness[0.002]}, PlotRange -> All, ColorFunctionScaling -> False] ``` Is there a straightforward way to do cylindrical plots like this?.. I find it hard to believe that I would have to turn to Matlab for my curvilinear coordinate needs :)
Is it possible to create polar CountourPlot/ListCountourPlot/DensityPlot in Mathematica?
CC BY-SA 3.0
0
2011-04-23T16:40:35.627
2011-10-07T19:43:52.053
2011-04-25T02:34:18.760
133,234
133,234
[ "wolfram-mathematica" ]
5,765,552
1
null
null
2
1,175
This is similar to the "answered" question [JQuery AJAX request behaving synchronous for unknown reason](https://stackoverflow.com/questions/5383247/jquery-ajax-request-behaving-synchronous-for-unknown-reason) I believe that the actual issue with parallel execution observed by MGM has been overlooked and actually there is a problem with $.get/$.ajax executed in parallel. Look at the snippet below: ``` $(function() { $(".dd").each(function() { var obj = $(this); $.get("test.txt", function(data) { obj.html(data); }); }); }); ``` It loads a file (asynchronously I would expect) and displays it (synchronously of course). However, the code executes differently during the first page load and on page refresh. I am monitoring the requests to the server using firebug Net panel in Firefox 4.0 on Windows. On the first page load (or when refreshed using Ctrl-F5) I can see on the Net panel that multiple requests to the "test.txt" start at the same time and the Net acivity mostly overlapps. This part works as expected. The result may be processed in the browser one by one, but the requests to the server are performed in parallel. ![image:initial load](https://i.stack.imgur.com/64JbO.gif) It is completly different story when user presses F5 to refresh the page. Suddenly parallelism is gone. And same web page loads "test.txt" one by one. ![image: Subsequent refresh](https://i.stack.imgur.com/feYnO.gif) It becomes even more clear if I replace data display (obj.html(data);) with a simple alert: alert(data); On initial page load I get multiple alert messages on the screen at the same time. Subsequent refreshes (F5) clearly demonstrate that while one alert message is on screen no other downloads are performed (I can remove the file to see next "$.get" to fail). So in fact the $.get does not perform async. calls to the server. Any ideas on why this happening? P.S. Sorry system does not allow me to post images use provided URL to see the screenshots.
JQuery AJAX request behaving synchronous
CC BY-SA 3.0
null
2011-04-23T16:50:38.153
2011-04-24T01:40:11.320
2017-05-23T10:30:21.980
-1
719,170
[ "jquery", "ajax", "asynchronous" ]
5,765,572
1
5,952,372
null
2
1,601
I am trying to build a really simple `NSTextField` with Interface Builder (XCode 4), but the rendering is really weird with default values: ![Current rendering](https://i.stack.imgur.com/mRAbp.png) The only setting I changed is the border style: ![enter image description here](https://i.stack.imgur.com/lrHIO.png) How to display a neat Text Field “squared but with rounded corners”, like in Safari: ![Safari Text Field](https://i.stack.imgur.com/X9iQy.png) < Interface Builder bug, fixed. Should I design my own, image-based component? Thank you!
Text Field rendering
CC BY-SA 3.0
0
2011-04-23T16:54:01.060
2011-05-10T15:17:43.203
2011-05-05T21:04:12.703
292,500
292,500
[ "cocoa", "xcode", "macos", "interface-builder", "xcode4" ]
5,765,898
1
5,766,039
null
1
40
![enter image description here](https://i.stack.imgur.com/x0lOc.gif) how can I relate Fruit and Meat when Fruit or Meat are call and display both of them? I have use a couple of calculations in between their nodes numbers 2,11,12,17 ran out of calculus. can you think of a equation to solve this problem?
how can I relate two nodes in different rows in a nested model tree?
CC BY-SA 3.0
0
2011-04-23T17:58:43.237
2011-04-23T18:23:20.993
null
null
666,159
[ "sql" ]
5,766,298
1
5,766,354
null
0
602
I'm trying to code the appearance of an UILabel, but I can't get another font applied. The funny (or rather annoying) thing is that if I add a second UILabel, the font WILL BE APPLIED for the second label, BUT NOT the first. I'm slightly going crazy on this... especially the font size won't change if I try to. My code (found in my ViewDidLoad): ``` NSString* dateWeekDay = @"MON"; CGRect dateWeekDayFrame = CGRectMake(183, 12, 34, 21); viewNoteDateWeekDay = [[UILabel alloc] initWithFrame:dateWeekDayFrame]; viewNoteDateWeekDay.text = dateWeekDay; viewNoteDateWeekDay.textColor = [UIColor blackColor]; viewNoteTitle.font = [UIFont fontWithName:@"Helvetica Neue" size:70.0f]; // I know this size is crazy, but it's just to show that it has no effect whatsoever... viewNoteDateWeekDay.transform = CGAffineTransformMakeRotation( ( -90 * M_PI ) / 180 ); viewNoteDateWeekDay.backgroundColor = [UIColor clearColor]; NSString* dateDay = @"01"; CGRect dateDayFrame = CGRectMake(209, 3, 47, 50); viewNoteDateDay = [[UILabel alloc] initWithFrame:dateDayFrame]; viewNoteDateDay.text = dateDay; viewNoteDateDay.textColor = [UIColor blackColor]; viewNoteDateDay.font = [UIFont fontWithName:@"Helvetica Neue" size:33.0f]; viewNoteDateDay.backgroundColor = [UIColor clearColor]; NSString* dateMonth = @"SEPTEMBER"; CGRect dateMonthFrame = CGRectMake(249, 6, 93, 31); viewNoteDateMonth = [[UILabel alloc] initWithFrame:dateMonthFrame]; viewNoteDateMonth.text = dateMonth; viewNoteDateMonth.textColor = [UIColor blackColor]; viewNoteDateMonth.font = [UIFont fontWithName:@"Helvetica Neue" size:12.0f]; viewNoteDateMonth.backgroundColor = [UIColor clearColor]; ``` ![enter image description here](https://i.stack.imgur.com/qk8iQ.png)
cocoa-touch: Why is font not applied?
CC BY-SA 3.0
null
2011-04-23T19:09:20.220
2011-04-23T19:21:02.290
2011-04-23T19:15:41.760
648,371
648,371
[ "iphone", "objective-c", "cocoa-touch", "uifont" ]
5,766,434
1
5,767,674
null
3
286
Consider this HTML: ``` <!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> div { position: relative; width: 200px; height: 200px; background: #ff0; } span { position: absolute; width: 200px; height: 200px; background: #f00; top: 100px; left: 100px; } </style> </head> <body> <div><span></span></div> </body> </html> ``` Output: ![](https://i.imgur.com/WL6L5.png) Now let's add some jQuery code that sets the opacity of the containing div to any level: ``` $('div').css({ opacity: '1' }); ``` The output is now this: ![](https://i.imgur.com/NNr07.png) How can I avoid this? [Here's a test page](http://files.mattalexander.me/ie7.html). EDIT: It happens in IE6 as well.
When I use jQuery to set an element's opacity in IE6 or IE7, it seems to aquire "overflow: hidden". Why?
CC BY-SA 3.0
null
2011-04-23T19:37:37.210
2014-01-14T17:34:31.793
2014-01-14T17:34:31.793
881,229
334,966
[ "jquery", "css", "cross-browser", "internet-explorer-7", "opacity" ]
5,766,626
1
5,766,649
null
3
2,513
I hope I'm not repeating - it doesn't seem like there are any questions that have the same specifications as mine. I'm looking for a way to "crop" a div with jQuery. The div is going to start with a width of zero, and then get animated to its full length. The tricky part is I want any text that overflows on the side to be hidden, rather than just pushed down to fill the space. It doesn't seem like the regular "overflow: hidden" will work because I could have many lines of text, and I want each line to be "cropped", so the characters for the individual line are hidden instead of being bumped down to the next line. !["cropped div"](https://i.stack.imgur.com/Fpba7.jpg) I hope this is clear. Any suggestions?
jQuery "crop" div
CC BY-SA 3.0
null
2011-04-23T20:10:12.060
2011-04-23T20:30:16.717
null
null
552,532
[ "javascript", "jquery", "css" ]
5,766,644
1
5,766,937
null
3
3,841
I downloaded the iPad programming example from [pragprog](http://pragprog.com/titles/sfipad/ipad-programming) site. When I tried to compile Bezier1 example, I got `'syntehsized property 'window'...` error. Why this error? How to solve this issue? ![enter image description here](https://i.stack.imgur.com/YhAH7.png) ## ADDED ``` @interface BezierAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; BezierViewController *viewController; } ``` was missing.
ipad build error - synthesized property must either be named the same
CC BY-SA 3.0
null
2011-04-23T20:14:06.183
2011-04-23T21:29:04.017
2011-04-23T21:29:04.017
260,127
260,127
[ "xcode", "ipad" ]
5,766,691
1
5,767,098
null
3
2,071
For a class project I'm working on "Pissed Off Pigs" (I think you get the idea, the pigs get revenge, don't worry, I'm not going to release it!) and I want to create circles with a fill from a bitmap (circles because the collision math is easier). Here is how they look now. ![How my Pigs look now](https://i.stack.imgur.com/D3Tz1.png) Of course, the white is the problem. Below is my "pigs" class. Any ideas? I've tried gif's, pngs, 8-bit pngs, etc and it seems to make no difference. The image itself is 20px square and the radius of the circle is 10px (so a 20px diameter). Here is the image I'm using: ![My Pig Image](https://i.stack.imgur.com/FFA5E.gif) And I know I should probably load the image outside the class and just pass the BitmapData when I make a new pig so I don't have to load the image every time I create a new pig but for now it works! (Sorta). Is the matrix translate the problem? Oh, and I have checked bmpImage.transparent and it returns true (even when I don't specify true in the constructor). ` package { import flash.display.; import flash.events.; import flash.display.BitmapDataChannel; ``` public class pig extends Sprite { public var radius:uint; public var velocity:Vec2; public var tt:Sprite; public var pigLoader:Loader; public var bmpImage:BitmapData; public var framesAlive:uint; public function pig(xx:uint, yy:uint, radius:uint, vx:Number, vy:Number, sprite:String){ this.x = xx; this.y = yy; this.radius = radius; this.velocity = new Vec2(vx, vy); pigLoader = new Loader(); pigLoader.load(new URLRequest(sprite)); pigLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, picLoaded); } private function picLoaded(event:Event):void { bmpImage = new BitmapData(pigLoader.width, pigLoader.height, true); bmpImage.draw(pigLoader); tt = new Sprite(); var matrix:Matrix; matrix = new Matrix(); matrix.translate( -10, -10); tt.graphics.beginBitmapFill(bmpImage, matrix, false, false); tt.graphics.drawCircle(0, 0, this.radius) tt.graphics.endFill(); this.addChild(tt); } } ``` } `
How to get transparency to work on a bitmap in Actionscript
CC BY-SA 3.0
null
2011-04-23T20:21:12.907
2011-04-24T02:53:35.693
2011-04-24T02:53:35.693
336,929
4,835
[ "flash", "actionscript-3", "bitmap", "transparency", "bitmapdata" ]
5,766,907
1
5,767,425
null
2
2,372
I have this ListView: ![enter image description here](https://i.stack.imgur.com/sjSwK.png) I'm using a custom adapter. As you see, each row is made of a checkbox, a big TextView, and a little TextView. All items have defined the little TextView, even the "Item 2" but it's a void string. The problem comes when I tap the EditText placed in the header of the list: ![enter image description here](https://i.stack.imgur.com/py7v4.png) The keyboard appears, and the rows are recycled, so the getView method of my adapter is called. In that method I have an if clause where I check if the length of the "optional" text (the little TextView) is greater than 0. In that case I make some room (the space that you can see in the screenshot) and I display it. The problem is that "Item 2" has the "optional" text initialized but it's void (0-sized). I don't understand why the if clause is executed. But more strangely... the else is also executed! In the else I just show a void string in the little TextView. Why is this happening? The app is really simple. This is my getView method: ``` @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.list_row, null); } ListItem list_item = items.get(position); TextView item_title = (TextView) convertView.findViewById(R.id.item_title); TextView item_optional = (TextView) convertView.findViewById(R.id.item_optional); item_title.setText(list_item.getTitle()); // If the task has an optional text, make some room and display it if (list_item.hasOptional()) { // This portion of code will be executed when you tap the EditText and the keyboard appears, putting the item up in the row LayoutParams layout_params = (LayoutParams) item_title.getLayoutParams(); layout_params.topMargin = 10; layout_params.height = -2; // -2: wrap_content item_title.setLayoutParams(layout_params); item_optional.setText(list_item.getOptional()); item_optional.setVisibility(0); } else { // This portion of code will ALSO be executed when you tap the EditText... why? this should not happen! item_optional.setText(""); } return convertView; } ``` The source code can be seen [here](https://gist.github.com/fc545489701344b84006) (github).
ListView and rows recycling problem
CC BY-SA 3.0
null
2011-04-23T20:59:35.093
2011-04-23T22:35:52.053
null
null
267,705
[ "android" ]
5,767,089
1
5,767,135
null
0
38
I have an html table that is displaying customer orders. One of these columns is a sub total which needs to add all rows for sub total in the order details table for that specific order. Is there a way to do this within my anonymous type? Here's some images of what I'm talking about: ![enter image description here](https://i.stack.imgur.com/wNKsZ.png) ![enter image description here](https://i.stack.imgur.com/XyAOC.png) And the code i'm using minus the total amount addition: ``` var q = db.Orders.Where(x => x.siteUserID == 41) .OrderByDescending(x => x.orderID) .Select(x => new { dateCreated = x.dateCreated, orderID = x.orderID, count = x.OrderDetails.Count() }); ``` Currently I've created a class with identical properties of my LINQ query, and am adding the results to a `List` and within the list calling a function that adds up the sub total. If it could be done within my original query it would be much cleaner.
Help with adding in LINQ to SQL query
CC BY-SA 3.0
null
2011-04-23T21:33:55.440
2011-04-23T21:43:30.583
null
null
445,303
[ "linq-to-sql" ]
5,767,642
1
5,774,762
null
3
3,352
I understand from reading [Arik Poznanski's blog](http://blogs.microsoft.co.il/blogs/arik/archive/2009/09/03/windows-ribbon-for-winforms-part-1-introduction.aspx) that the [Windows Ribbon UI Framework](http://msdn.microsoft.com/en-us/library/dd316910%28VS.85%29.aspx) is a COM object in Windows 7, and the [WindowsRibbon wrapper](http://windowsribbon.codeplex.com) is just a .NET veneer around that, to allow the Ribbon UI to be used in Windows Forms applications. I've been successful in implementing a Hello World Windows Form app that employs this wrapper: ![Windows Ribbon HEllo World](https://i.stack.imgur.com/hDNw7.png) It is running on my development machine, which is Windows7. --- Questions: - Will this "hello, world" application run on Vista? XP? Do I need to download something onto those machines in order to make that happen? - Is there a way to specify the Windows Ribbon UI components as a pre-requisite, in an MSI installer? Thanks --- Browsing around I found [the documentation for UIRibbon.dll](http://msdn.microsoft.com/en-us/library/dd742706%28v=vs.85%29.aspx), which is the DLL on Windows7 that delivers the Ribbon UI. It lists these as minimum supported clients: > Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista how would I check for that in an MSI ?
Can I use the Windows Ribbon UI on Windows XP? how?
CC BY-SA 3.0
null
2011-04-23T23:26:36.770
2011-06-18T01:12:17.230
2011-04-23T23:45:26.627
48,082
48,082
[ "windows-7", "windows-installer", "ribbon", "windows-ribbon-framework" ]
5,767,913
1
5,767,921
null
2
540
What is the proper way of aligning Label and button? Bottom to bottom? ![enter image description here](https://i.stack.imgur.com/2aJIa.jpg) --- Text Bottom to text bottom? ![enter image description here](https://i.stack.imgur.com/HN4A8.jpg) The same question goes for TexBoxes and Buttons, TexBoxes and Labels.
Proper way of aligning labes and buttons and TexBoxes
CC BY-SA 3.0
null
2011-04-24T00:43:08.797
2011-04-24T01:50:45.543
2011-04-24T01:50:45.543
86,860
465,408
[ "c#", ".net", "winforms", "layout", "alignment" ]
5,767,959
1
5,767,970
null
0
371
I have a simple Rectangle struct with x, y, width, and height, which I thought would be easy to work with vectors but it turned out to be pretty messy. This is what I have in main: ``` vector<CvRect> v; v.push_back(cvRect(50,0,50, 50)); v.push_back(cvRect(150, 0, 50,50)); v.push_back(cvRect(100, 0, 50,50)); sort(v.begin(), v.end(), rectangleCmpByPosition); ``` I have this declared in my header ``` static int rectangleCmpByPosition(const CvRect &a, const CvRect &b); ``` with this as definition: ``` static int rectangleCmpByPosition(const CvRect& a, const CvRect &b){ if (a.y != b.y){ return a.y - b.y; }else{ return a.x - b.x; } } ``` And visual studio throws this error message at me![enter image description here](https://i.stack.imgur.com/1OYbH.png). I spent the whole afternoon googling to see what I did wrong but I can't find the cause. Please help.
Sorting a vector of struct causes Visual Studio to throw a popup with "Debug Assertion Failed"
CC BY-SA 3.0
null
2011-04-24T00:54:02.090
2011-04-24T00:56:02.783
null
null
10,088
[ "c++", "sorting", "stl", "opencv" ]
5,768,030
1
5,768,762
null
1
1,490
I have a development server and a production server. All developers push updates to the development server and the development server pushes updates to the production server. Is there a Post-Receive hook for doing this? Assume that the development server and production server names are `dev1` and `prod1`. If possible, is there a post-receive hook that checks for the tag `stable` before pushing to prod1? Edit: ![Workflow example](https://i.stack.imgur.com/9vh6M.png)
Git Post-Receive Hook for Pushing from One Server to Another
CC BY-SA 3.0
null
2011-04-24T01:15:25.737
2011-04-24T05:08:11.893
2011-04-24T01:20:50.280
259,311
259,311
[ "git", "workflow" ]
5,768,107
1
5,768,192
null
16
3,441
A would like to plot geom_tile() without displaying the surrounding grey frame. Example: ``` library(ggplot2) p <- ggplot(melt(volcano), aes(x = X1, y = X2, z = value,fill = value)) + geom_tile() print(p) ``` Produces the figure below, which would look better had not the theme background framed the heatmap proper. I imaging the padding is the same 4% as in base graphics. It's good to have it most of the time, but not always. I assume the same solution to this problem could be applied to other geoms as well. ![heatmap](https://i.stack.imgur.com/0V7L4.png)
Losing the grey margin padding in a ggplot
CC BY-SA 3.0
0
2011-04-24T01:40:32.650
2011-04-25T02:00:51.423
2011-04-25T02:00:51.423
143,813
143,813
[ "r", "graphics", "ggplot2" ]
5,768,129
1
5,769,395
null
9
16,423
I want to compare values in two columns in Excel as depicted in the image below :- ![enter image description here](https://i.stack.imgur.com/IRLSh.png) Using the formula, I want to put the values in the "Values of A which don't exist in B" and "Values of B which don't exist in A". Any help is appreciated. I have shared the same excel sheet [here](http://www.filedropper.com/comparevalues).
Comparing two columns in Excel with exclusion
CC BY-SA 3.0
0
2011-04-24T01:47:33.760
2011-04-25T06:09:22.543
2011-04-25T05:07:36.947
13,295
255,562
[ "excel", "excel-2007", "worksheet-function" ]
5,768,138
1
6,165,475
null
87
27,169
I have a C# console app in Visual Studio 2010 that I can run just fine. When I attempt to run the process in debug mode, I am presented with the following error: ![clr.dll version doesn't match mscordacwks.dll](https://i.stack.imgur.com/9F2FJ.png) I have tried searching for any information, but I haven't been able to find anything. Can anyone provide clues as to why I can't run this with the debugger? EDIT: I should clarify that I have been able to successfully debug a console app previously, this is a new situation.
The version of clr.dll does not match the one mscordacwks.dll was built for
CC BY-SA 3.0
0
2011-04-24T01:49:58.410
2018-05-11T14:57:37.527
2011-04-24T01:56:18.690
181,481
181,481
[ "visual-studio" ]
5,768,366
1
5,770,195
null
0
1,810
I have a simple database with two tables: `Photo` and `Tag`. There is a one-to-many (a photo can have many tags) relationship between the two tables. Here is a diagram: ![Tables](https://i.stack.imgur.com/thItq.jpg) Now I have made a `Photo` class and set it up for LINQ-to-SQL using attributes. The code for that class is below: ``` [Table] public class Photo { [Column(IsDbGenerated = true, IsPrimaryKey = true, CanBeNull = false)] public int ID { get; set; } [Column(CanBeNull = false)] public string Filename { get; set; } [Column(CanBeNull = false)] public string Description { get; set; } [Column(CanBeNull = false)] public DateTime DateTaken { get; set; } public List<string> Tags { get; set; } public override string ToString() { string result = String.Format("File: {0}, Desc: {1}, Date: {2}, Tags: ", Filename, Description, DateTaken); if (Tags != null) foreach (string tag in Tags) result += tag + ", "; return result; } } ``` You will notice that currently I do not have any attributes for the `Tags` list. I would like to be able to setup the attributes (associations) for the `Tags` list so that it would be populated with `Name` field of the `Tag` table for all entries in the `Tag` table of a particular `PhotoID`. It would be preferable if I could do this directly (i.e. without having to setup a `Tag` class mimicking/relating to the `Tag` table). Since I'm only interested in one field (the Name in the Tag table) rather than many fields, I would think there is a way to do this. Is this possible, and if so how would I further decorate the class with attributes and what would be the syntax for a simiple Select query using LINQ-to-SQL? If it helps, here is the code I am using to simply add a new photo and then grab all of the photos out of the database (obviously the tag information is not pulled out as the code stands now). ``` DataContext context = new DataContext(connectionString); // add new photo Photo newPhoto = new Photo { Filename = "MyImage1.jpg", Description = "Me", DateTaken = DateTime.Now }; context.GetTable<Photo>().InsertOnSubmit(newPhoto); context.SubmitChanges(); // print out all photos var photoQuery = from m in context.GetTable<Photo>() select m; foreach (Photo myPhoto in photoQuery) textBox1.Text += Environment.NewLine + myPhoto.ToString(); ```
LINQ to SQL: How to setup associations between two tables to populate a list of strings
CC BY-SA 3.0
null
2011-04-24T02:54:14.193
2011-04-24T11:15:18.063
null
null
716,285
[ "c#", "linq", "linq-to-sql", "associations" ]
5,768,395
1
null
null
1
271
I have a floating div tag to the left and then another div tag that auto margins to the right. If I take out the contents of the right div the left div tag "overlaps" everything below it. How could I go by fixing this so it doesn't overlap?! I'll include a picture to show you how it overlaps. ![overlapping problem](https://i.stack.imgur.com/VRI8M.png)
Is there a way to make a floating div tag take on the actual height it has from content
CC BY-SA 3.0
null
2011-04-24T03:05:00.410
2012-06-06T13:35:33.457
2012-06-06T13:35:33.457
44,390
613,932
[ "css", "html", "css-float", "overlap" ]
5,768,373
1
5,770,196
null
1
6,538
Hooray for pictures! Here's what it looks like when assigning the picture to the background, and when not. ![enter image description here](https://i.stack.imgur.com/HfgqO.png) ![enter image description here](https://i.stack.imgur.com/gChQ9.png) I'd very much like for it to not stretch out the top `TableView` if the image is larger than the table. I've included an empty "view" to give a little bit of extra space for the table's background already as well, as you can see in the XML to follow. Tried to mess around with ScaleType, but that was a wash. How can I get the BG to stretch to fit the layout? I'm trying to handle the "user xxx has a smaller screen than WVGA" gracefully. I lack grace, apparently. ``` <TableLayout android:id="@+id/widget29" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:scaleType="fitXY" android:background="@drawable/minetownx480" > <View android:id="@+id/blankSpace" android:layout_width="fill_parent" android:layout_height="60dip" /> <TableRow android:id="@+id/widget40" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal"> <TextView android:id="@+id/moneyText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Money: $$$$$$$$$" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/savingsText" android:gravity="right" android:text="Savings: $$$$$$$" android:layout_weight="3" android:textSize="12sp"/> </TableRow> <TableRow android:id="@+id/widget41" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal"> <TextView android:id="@+id/wagonText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Wagon Space: XXX/XXX" /> <TextView android:id="@+id/loanText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Loans: $$$$$$$$" android:gravity="right" android:layout_weight="3" android:textSize="12sp"/> </TableRow> <TableRow android:id="@+id/widget42" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" > <TextView android:id="@+id/daysText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Days Left: XX/XX" /> <TextView android:id="@+id/armedText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Unarmed!" android:gravity="right" android:layout_weight="3" /> </TableRow> </TableLayout> ``` The tablelayout is the first element of the root linearLayout, if that matters at all. Edit: Alternatively, if you know how I could measure the tableLayout's X and Y space before assigning the image, I could scale it programmatically before assigning it.... Either solution would be good if anyone knows!
Android - Make a background image not stretch it's assigned view out
CC BY-SA 3.0
null
2011-04-24T02:57:53.690
2011-04-24T11:15:50.407
2011-04-24T03:30:32.270
705,175
705,175
[ "android", "background", "tablelayout", "stretch" ]
5,768,714
1
5,771,130
null
4
7,068
![enter image description here](https://i.stack.imgur.com/GkUgZ.png)Hello all, I am working on a program which determines the average colony size of yeast from a photograph, and it is working fine with the .bmp images I tested it on. The program uses pygame, and might use PIL later. However, the camera/software combo we use in my lab will only save 16-bit grayscale tiff's, and pygame does not seem to be able to recognize 16-bit tiff's, only 8-bit. I have been reading up for the last few hours on easy ways around this, but even the Python Imaging Library does not seem to be able to work with 16-bit .tiff's, I've tried and I get "IOError: cannot identify image file". ``` import Image img = Image.open("01 WT mm.tif") ``` My ultimate goal is to have this program be user-friendly and easy to install, so I'm trying to avoid adding additional modules or requiring people to install ImageMagick or something. Does anyone know a simple workaround to this problem using freeware or pure python? I don't know too much about images: bit-depth manipulation is out of my scope. But I am fairly sure that I don't need all 16 bits, and that probably only around 8 actually have real data anyway. In fact, I once used ImageMagick to try to convert them, and this resulted in an all-white image: I've since read that I should use the command "-auto-levels" because the data does not actually encompass the 16-bit range. I greatly appreciate your help, and apologize for my lack of knowledge. P.S.: Does anyone have any tips on how to make my Python program easy for non-programmers to install? Is there a way, for example, to somehow bundle it with Python and pygame so it's only one install? Can this be done for both Windows and Mac? Thank you. EDIT: I tried to open it in GIMP, and got 3 errors: 1) Incorrect count for field "DateTime" (27, expecting 20); tag trimmed 2) Sorry, can not handle images with 12-bit samples 3) Unsupported layout, no RGBA loader What does this mean and how do I fit it?
Python: Manipulating a 16-bit .tiff image in PIL &/or pygame: convert to 8-bit somehow?
CC BY-SA 3.0
0
2011-04-24T04:52:42.697
2011-04-26T18:41:58.540
2011-04-26T18:41:58.540
556,651
556,651
[ "python", "python-imaging-library", "tiff", "pygame", "16-bit" ]
5,768,739
1
null
null
16
47,748
Here's a [screenshot](http://www.laranevans.com/BadScrollbar.png) of the problem. ![enter image description here](https://i.stack.imgur.com/Itqzr.png) Basically, when the scrollbar shows up for the y-axis, the width of the container doesn't expand. Instead it just creates a scrollbar for the x-axis. How can I get the container to expand without creating the x-axis scrollbar?
CSS: Scrollbar for y-axis causes scrollbar for x-axis
CC BY-SA 3.0
0
2011-04-24T05:01:27.530
2023-01-28T00:49:40.403
2011-04-24T08:29:19.670
325,418
1,174,250
[ "css" ]
5,768,904
1
5,771,209
null
4
2,635
I'm working on a social web-site project and I need to list "First, Second and Third Degree Contacts" of my contacts. I'm using SQL Server AND C# Assume a `contact` table like this: ![enter image description here](https://i.stack.imgur.com/8AQsX.png) For first degree contact: - `gulsah``burak,sennur` Query I use to select this: ``` SELECT contact_2 FROM Contacts_Table WHERE contact_1 like 'gulsah' ``` For second degree contact: If `gulsah` is me again then my second degree contacts are: `mali` What makes it difficult is to select contacts of my contacts who are not my first degree contact. I can select mutual contacts but I guess it is not the right approach. For example, to select mutual contacts of me (`gulsah`) and `burak`: ``` SELECT contact_1 FROM (SELECT * FROM Contact_Test WHERE contact_2 like 'burak') a INNER JOIN (SELECT contact_1 FROM Contact_Test WHERE (contact_2 = 'gulsah')) b ON a.contact_1 = b.contact_1 ``` This query works but as I said, it's not the right approach for this job. For third degree contact: If `gulsah` is me again then my third degree contacts are_ `mehmet,ahmet` I need to select contacts of my contacts' contacts who are not my first and second degree contact :) [Here is a post from Linkedin which explains contact level.](http://www.linkedin.com/answers/administration/customer-service/ADM_CSV/581967-23863639) Thanks for responses.
SQL Server: how to select First, Second and Third degree contacts
CC BY-SA 3.0
0
2011-04-24T05:51:42.560
2011-04-25T20:54:54.843
2011-04-24T13:48:43.700
41,071
235,555
[ "sql", "sql-server-2008", "contacts", "contact-list" ]
5,768,998
1
5,769,230
null
270
392,593
How to flip any background image using CSS? Is it possible? currenty I'm using this arrow image in a `background-image` of `li` in css ![enter image description here](https://i.stack.imgur.com/ah0iN.png) On :`visited` I need to flip this arrow horizontally. I can do this to make another image of arrow I'm just curious to know is it possible to flip the image in CSS for `:visited`
How to flip background image using CSS?
CC BY-SA 3.0
0
2011-04-24T06:13:22.943
2019-01-19T19:12:12.463
2011-04-24T06:33:00.907
84,201
84,201
[ "css", "mobile-webkit" ]
5,769,000
1
6,032,738
null
4
17,206
I remember successfully doing this countless times before with a bit of trial and error, but after a new reinstall of Snow Leopard, I would like to just ask the Stackoverflow community this for once and for all... I installed Netbeans 7 (for C++). For some reason, I didn't see any way to install Python plugins here, so I installed Netbeans 6.5. It automatically detects Python 2.5 on the system, but darnit I want Python 3, which it cannot automatically detect. So now I go to Tools > Python Platforms, click on New, and which file do I select in the new window? EDIT: I found this when looking in `usr/bin/`.![enter image description here](https://i.stack.imgur.com/sBCIl.png) EDIT: For my own future reference, in Eclipse at least, `/Library/Frameworks/Python.framework/Versions/3.2/Resources/Python.app/Contents/MacOS/Python` I found the alias in `.../3.2/bin/python3.2`
Setting up Python in Netbeans
CC BY-SA 3.0
0
2011-04-24T06:13:58.183
2015-12-04T07:03:58.517
2011-05-28T19:46:59.677
257,583
257,583
[ "python", "netbeans", "python-3.x" ]
5,769,080
1
null
null
0
68
The server's publishing options in Netbeans that like in Eclipse ? Just like the feature in eclipse. ![Server's publishing options in Eclipse](https://i.stack.imgur.com/Iz9wN.png)
The server's publishing options in netbeans that like in eclipse?
CC BY-SA 3.0
null
2011-04-24T06:34:10.337
2011-04-24T06:39:48.240
null
null
292,084
[ "eclipse", "netbeans" ]
5,769,184
1
5,769,224
null
2
7,337
On a `UITableViewCell` with `UITableViewCellStyleSubtitle` styling, I'm setting the `imageView.image`, `textLabel.text`, and `detailTextLabel.text`. There's white padding all around the cell. How do I get rid of the padding so all my images touch each other like the Youtube app below? ![](https://i.stack.imgur.com/jkkSe.png)
Remove padding on UITableViewCell
CC BY-SA 3.0
0
2011-04-24T07:03:06.333
2017-08-23T12:42:29.177
2011-04-24T07:11:17.263
115,730
459,987
[ "iphone", "objective-c", "cocoa-touch" ]
5,769,275
1
5,769,481
null
2
611
While coding with UITableView, I encounter this bug that I couldn't understand. I got 3 rows for my table and setting 50px for each row, except the 2nd row that I set it 500px which fill the whole screen. Problem comes when I scroll down to bottom, my bottom role is repeating first row appearance.This is my custom code: ``` - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return 3; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"TestTable"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; if (indexPath.section ==0 && indexPath.row==0) { cell.contentView.backgroundColor = [UIColor redColor]; } if (indexPath.section ==0 && indexPath.row==1) { cell.contentView.backgroundColor = [UIColor blueColor]; } if (indexPath.section ==0 && indexPath.row==2) { cell.contentView.backgroundColor = [UIColor greenColor]; } } // Configure the cell... return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row==1) { return 400; } return 50; } ``` According to the code, first row is red color, second role is red and third one is blue. But my last row is red color (repeating the first row). If I set my 2nd row to shorter than the screen, e.g. 100px, third row loading fine. Original Display ![enter image description here](https://i.stack.imgur.com/ahLKc.png) After Scroll Down ![enter image description here](https://i.stack.imgur.com/d46rx.png) Appreciate for all kind of advice, as I am running out of ideas how is this happening. Thanks
UITable load first UITableViewCell for my last row of UITableViewCell
CC BY-SA 3.0
null
2011-04-24T07:27:57.567
2011-04-24T08:19:06.490
2011-04-24T07:31:00.190
635,608
572,438
[ "iphone", "objective-c" ]
5,769,640
1
null
null
1
767
![enter image description here](https://i.stack.imgur.com/PPi4C.jpg) I want to post message to selected user`s wall but like to customize picture and title(name)? is there any solution? below may be garbage... ``` $access_token_url = "http://graph.facebook.com/oauth/access_token"; $parameters ="type=client_cred&client_id=CCCCCCC&client_secret=AA"; $access_token = file_get_contents($access_token_url . "?" . $parameters); $user_facebookUID = "AAAAAAAAAA"; $data = array(); $data["access_token"] = $access_token; $data["message"] = "aadfadfsdf"; $facebook->api("/$user_facebookUID/feed/" , "post", $param); ``` then message was posted to the users wall as an application. but that users picture and user`s name was displayed. but I like to customize user picture to other and change user`s name to another title. how can it possible? isthere any other way to solve this not as application or application
users wall post as application
CC BY-SA 3.0
0
2011-04-24T09:01:36.330
2011-04-24T20:20:08.073
2011-04-24T09:42:17.777
21,234
153,506
[ "php", "facebook" ]
5,769,766
1
null
null
3
8,089
I am trying to use one blinking image in QGraphicsPixmapItem. The image has shown without the animation effect. The below is the original image, the following is the QGraphicsScene which uses this image in QGraphicsPixmapItem. Can anybody say how to achieve this?. ![enter image description here](https://i.stack.imgur.com/mCmpe.gif) ![enter image description here](https://i.stack.imgur.com/z3Yu2.jpg)
Qt - How to show gif(animated) image in QGraphicsPixmapItem
CC BY-SA 3.0
0
2011-04-24T09:36:15.063
2014-01-13T04:18:08.513
null
null
344,822
[ "c++", "qt", "plugins", "animation", "gif" ]
5,769,868
1
5,769,905
null
2
229
How do I show this in iPad application. ![enter image description here](https://i.stack.imgur.com/vyzkh.jpg) It looks like some kind of modal popup. What is it called and how do I integrate it in my iPad app?
How to display this in iPad App?
CC BY-SA 3.0
null
2011-04-24T09:56:46.110
2011-04-24T10:03:21.087
null
null
480,346
[ "iphone", "objective-c", "cocoa-touch", "ipad", "ios4" ]
5,770,061
1
5,770,083
null
0
85
I am helping a friend with his C# homework, but is being a long time since i don't do nothing in .NET Could you please me give me a hand to solve some difficulties i have with visual studio 2008? How can i make a primary key of a table be auto incremented automatically? Where is that option? i don't see it in my interface anywhere. ![enter image description here](https://i.stack.imgur.com/gXGWw.png) How can i create a relationship between 2 tables? I think i am doing it correctly, but i don't see any sign that i did things right: This is how i start creating the relationship: ![enter image description here](https://i.stack.imgur.com/BvM9J.png) Then i configure the relationship with the wizard: ![enter image description here](https://i.stack.imgur.com/a3MsV.png) But at the end i don't see any icon or symbol that indicates me that this is a relationship: ![enter image description here](https://i.stack.imgur.com/XtA4a.png) I want to start adding data in the database directly in the easiest and fastest way(Executing an Insert query). Could you give me a little tip on how to do that?(I don't want other approaches such as dataset...)
Visual studio 2008. I cant remember hot to do the things
CC BY-SA 3.0
null
2011-04-24T10:36:37.443
2011-04-24T10:48:05.610
null
null
614,141
[ "c#", "visual-studio", "visual-studio-2008", "ado.net" ]
5,770,082
1
5,770,095
null
17
20,538
Can I use some sort of line break in the alt text for an image while still adhering to the XHTML 1.0 Strict standard? Something like this... ``` <img src="foo.jpg" alt="Line 1\nLine 2" /> ``` I'm asking because I want to post the following screenshot on my site, but I want to include the text-only version in the alt text for SEO reasons and for the visually impaired. ![http://i.stack.imgur.com/563df.png](https://i.stack.imgur.com/ulYiw.png) I prefer the screenshot over the plain text version because it looks more visually appealing.
Newline in alt text
CC BY-SA 3.0
0
2011-04-24T10:41:16.530
2021-07-31T05:08:03.597
null
null
217,649
[ "html", "xhtml" ]
5,770,211
1
5,828,273
null
0
1,577
Hey guys, I am storing a time stamp in my iPhone app via Core Data, I have had success doing it in the past storing a double value as an INT 64 type in Core Data. However, I just recently had to change it to an NSNumber instance instead of a primitive double type and ever since I have not been able to get Core Data to store and retrieve the same numeric value (the following are attempts with different numeric attribute types within Core Data): ![enter image description here](https://i.stack.imgur.com/RNAYb.png) ![enter image description here](https://i.stack.imgur.com/ASMkq.png) ![enter image description here](https://i.stack.imgur.com/i4Gyh.png) The code that generates this console output is the following: ``` NSLog(@"VALUE BEING STORED: %@",[NSNumber numberWithDouble:tmeStmp]); [[CoreDataSingleton sharedManager] setItemInDFMWhilePreservingEntityUniquenessForItem:timeStampAttr withValue:[NSNumber numberWithDouble:tmeStmp]]; [[CoreDataSingleton sharedManager] saveStore]; NSLog(@"VALUE RETRIEVED FROM STORE: %@",[[CoreDataSingleton sharedManager] getTimeStamp]); ``` Relevant parts of `setItemInDFMWhilePreservingEntityUniquenessForItem:withValue:`: ``` -(void)setItemInDFMWhilePreservingEntityUniquenessForItem:(attribute)attr withValue:(id)value { //... } else if (attr == timeStampAttr) { [dfm setTimeStamp:value]; } //... } else if (attr == timeStampAttr) { [[fetchedObjects objectAtIndex:0] setTimeStamp:value]; } //... } ``` Relevant parts of `getTimeStamp`: ``` -(NSNumber *)getTimeStamp { //... NSNumber *returnable = [[[NSNumber alloc] initWithDouble:(NSInteger)[[fetchedObjects objectAtIndex:0] valueForKey:@"timeStamp"]] autorelease]; return returnable; } ``` I am thinking that I am most likely not converting between numeric types adequately, but I have fudged around with the code for hours with no luck. Any idea where I am going wrong? Thanks!
Difficulty Storing Timestamp in Store Using Core Data and Retrieving Consistent Values
CC BY-SA 3.0
null
2011-04-24T11:19:49.617
2011-04-29T05:33:00.717
null
null
347,339
[ "objective-c", "cocoa-touch", "ios4", "core-data", "nsnumber" ]
5,770,595
1
5,770,723
null
0
148
So I have a simple SQL script which creates a database schema of a simple library online catalog: ``` DROP TABLE book_copies; / DROP TABLE books_authors_xref; / DROP TABLE authors; / DROP TABLE books; / CREATE TABLE books ( isbn VARCHAR2(13) NOT NULL PRIMARY KEY, title VARCHAR2(200), summary VARCHAR2(2000), date_published DATE, page_count NUMBER ); / CREATE TABLE authors ( name VARCHAR2(200) NOT NULL PRIMARY KEY ); / CREATE TABLE books_authors_xref ( author_name VARCHAR2(200), book_isbn VARCHAR2(13), CONSTRAINT pk_books_authors_xref PRIMARY KEY (author_name, book_isbn), CONSTRAINT fk_books_authors_xref1 FOREIGN KEY (author_name) REFERENCES authors (name), CONSTRAINT fk_books_authors_xref2 FOREIGN KEY (book_isbn) REFERENCES books (isbn) ); / CREATE TABLE book_copies ( barcode_id VARCHAR2(100) NOT NULL PRIMARY KEY, book_isbn VARCHAR2(13), CONSTRAINT fk_book_copies FOREIGN KEY (book_isbn) REFERENCES books (isbn) ); / ``` Whenever I run it through SQL*Plus, I get many errors during its execution even though it looks like all SQL orders execute properly. This is the output I get: ![enter image description here](https://i.stack.imgur.com/9CPeT.png) What does that mean? Am I doing something wrong?
Errors in my schema creation script
CC BY-SA 3.0
null
2011-04-24T12:57:12.273
2011-04-24T13:22:36.023
null
null
95,944
[ "sql", "oracle", "plsql", "sqlplus" ]
5,770,771
1
5,872,460
null
6
6,772
I am struck with a problem. I want to convert the CMAttitude information of an iPhone to Altitude (0 to 90deg) and Azimuth (0 to 360 deg). I have googled around and hit some threads which discuss about it, but none of threads turn out with a positive answer and most of the articles discussing Quaternion and Euler angles are too much mathematics to stuff into my brain! Is there some open source material which does this task easy? Or someone has written code to perform this conversion? Edit: First off, sorry for being so abstract! Azimuth is the direction on the surface of the earth towards which the device is pointing. Like North = 0 deg, North East = 45deg, East = 90 deg, South = 180 deg and so on. Ranges between 0 deg to 360 deg: ![enter image description here](https://i.stack.imgur.com/8aT4d.png) Altitude is the angle made from the plane of the earth to an object in the sky: ![enter image description here](https://i.stack.imgur.com/FuAR7.gif) Thanks, Raj
Compute Altitude and Azimuth from CMAttitude using either Roll, pitch and Yaw or Quaternion or Rotation Matrix
CC BY-SA 3.0
0
2011-04-24T13:31:39.813
2011-05-03T16:13:11.017
2011-04-28T05:31:12.440
260,665
260,665
[ "iphone", "cocoa-touch", "quaternions", "euler-angles", "rotational-matrices" ]
5,770,818
1
6,563,768
null
12
9,357
I need to know how to align an image in Matlab for further work. for example I have the next license plate image and I want to recognize all the digits. ![enter image description here](https://i.stack.imgur.com/CJHaA.png) my program works for straight images so, I need to align the image and then preform the optical recognition system. The method should be as much as universal that fits for all kinds of plates and in all kinds of angles. I tried to do this with Hough Transform but I didn't Succeed. anybody can help me do to this? any help will be greatly appreciated.
How to align image - Matlab
CC BY-SA 3.0
0
2011-04-24T13:39:34.593
2015-08-17T10:15:45.790
2015-08-17T10:15:45.790
556,011
556,011
[ "matlab", "image-processing", "computer-vision", "alignment" ]
5,771,136
1
5,771,213
null
0
562
Hey I have time column and datatype date.. default value is getdate() but this return format like 2011-04-24 but I want like 24.04.2011 How can I convert that format? what is the value format? ![enter image description here](https://i.stack.imgur.com/IcffJ.jpg)
Sql server getdate() convert problem
CC BY-SA 3.0
null
2011-04-24T14:41:19.923
2011-04-24T15:01:26.600
2011-04-24T15:01:26.600
127,480
701,855
[ "sql-server" ]
5,771,217
1
5,772,757
null
6
1,195
While looking at the [belisarius](https://stackoverflow.com/users/353410/belisarius)'s question about [generation of non-singular integer matrices with uniform distribution of its elements](https://stackoverflow.com/questions/5131987/generating-random-non-singular-integer-matrices), I was studying a paper by Dana Randal, "[Efficient generation of random non-singular matrices](http://www.eecs.berkeley.edu/Pubs/TechRpts/1991/CSD-91-658.pdf)". The algorithm proposed is recursive, and involves generating a matrix of lower dimension and assigning it to a given minor. I used combinations of `Insert` and `Transpose` to do it, but there are must be more efficient ways of doing it. How would you do it? The following is the code: ``` Clear[Gen]; Gen[p_, 1] := {{{1}}, RandomInteger[{1, p - 1}, {1, 1}]}; Gen[p_, n_] := Module[{v, r, aa, tt, afr, am, tm}, While[True, v = RandomInteger[{0, p - 1}, n]; r = LengthWhile[v, # == 0 &] + 1; If[r <= n, Break[]] ]; afr = UnitVector[n, r]; {am, tm} = Gen[p, n - 1]; {Insert[ Transpose[ Insert[Transpose[am], RandomInteger[{0, p - 1}, n - 1], r]], afr, 1], Insert[ Transpose[Insert[Transpose[tm], ConstantArray[0, n - 1], r]], v, r]} ] NonSingularRandomMatrix[p_?PrimeQ, n_] := Mod[Dot @@ Gen[p, n], p] ``` It does generate a non-singular matrix, and has uniform distribution of matrix elements, but requires p to be prime: ![histogram of matrix element (2, 3)](https://i.stack.imgur.com/HB7XC.png) The code is also not every efficient, which is, I suspect due to my inefficient matrix constructors: ``` In[10]:= Timing[NonSingularRandomMatrix[101, 300];] Out[10]= {0.421, Null} ``` --- So let me condense my question. The minor matrix of a given matrix `m` can be computed as follows: ``` MinorMatrix[m_?MatrixQ, {i_, j_}] := Drop[Transpose[Drop[Transpose[m], {j}]], {i}] ``` It is the original matrix with `i`-th row and `j`-th column deleted. I now need to create a matrix of size `n` by `n` that will have the given minor matrix `mm` at position `{i,j}`. What I used in the algorithm was: ``` ExpandMinor[minmat_, {i_, j_}, v1_, v2_] /; {Length[v1] - 1, Length[v2]} == Dimensions[minmat] := Insert[Transpose[Insert[Transpose[minmat], v2, j]], v1, i] ``` Example: ``` In[31]:= ExpandMinor[ IdentityMatrix[4], {2, 3}, {1, 2, 3, 4, 5}, {2, 3, 4, 4}] Out[31]= {{1, 0, 2, 0, 0}, {1, 2, 3, 4, 5}, {0, 1, 3, 0, 0}, {0, 0, 4, 1, 0}, {0, 0, 4, 0, 1}} ``` I am hoping this can be done more efficiently, which is what I am soliciting in the question. --- Per blisarius's suggestion I looked into implementing `ExpandMinor` via `ArrayFlatten`. ``` Clear[ExpandMinorAlt]; ExpandMinorAlt[m_, {i_ /; i > 1, j_}, v1_, v2_] /; {Length[v1] - 1, Length[v2]} == Dimensions[m] := ArrayFlatten[{ {Part[m, ;; i - 1, ;; j - 1], Transpose@{v2[[;; i - 1]]}, Part[m, ;; i - 1, j ;;]}, {{v1[[;; j - 1]]}, {{v1[[j]]}}, {v1[[j + 1 ;;]]}}, {Part[m, i ;;, ;; j - 1], Transpose@{v2[[i ;;]]}, Part[m, i ;;, j ;;]} }] ExpandMinorAlt[m_, {1, j_}, v1_, v2_] /; {Length[v1] - 1, Length[v2]} == Dimensions[m] := ArrayFlatten[{ {{v1[[;; j - 1]]}, {{v1[[j]]}}, {v1[[j + 1 ;;]]}}, {Part[m, All, ;; j - 1], Transpose@{v2}, Part[m, All, j ;;]} }] In[192]:= dim = 5; mm = RandomInteger[{-5, 5}, {dim, dim}]; v1 = RandomInteger[{-5, 5}, dim + 1]; v2 = RandomInteger[{-5, 5}, dim]; In[196]:= Table[ExpandMinor[mm, {i, j}, v1, v2] == ExpandMinorAlt[mm, {i, j}, v1, v2], {i, dim}, {j, dim}] // Flatten // DeleteDuplicates Out[196]= {True} ```
How to efficiently set matrix's minor in Mathematica?
CC BY-SA 3.0
0
2011-04-24T14:55:02.607
2011-05-01T19:13:38.087
2017-05-23T11:55:50.580
-1
594,376
[ "wolfram-mathematica" ]
5,771,321
1
5,780,863
null
0
4,330
I have two Combo-Boxes like this ![enter image description here](https://i.stack.imgur.com/FP5sl.png) I need to create an auto-fill feature for the 1st Combo-Box. It should list the EmployeeID if Search-By Field is specified as Employee-Number. Similarly it should list Employee First Name along with Last Name if the Search-By Field is Employee-Name. How can I do this? I have no clue, I am doing this for the first time. I am using SQLite, Visual Studio 2010. ``` Dim mySelectQuery As String = "SELECT " & Search & " FROM EmployeeTable WHERE Status LIKE '" & Status & "'" Dim myConnString As String = "Data Source=" & Application.StartupPath & "\Database\SimpleDB.db3" Dim sqConnection As New SQLiteConnection(myConnString) Dim sqCommand As New SQLiteCommand(mySelectQuery, sqConnection) sqConnection.Open() Try ' Always call Read before accessing data. Dim sqReader As SQLiteDataReader = sqCommand.ExecuteReader() Dim j As Integer = sqReader.FieldCount While sqReader.Read() '''''''''''''''''''''''Here, Don't know how to list the items from the query reult into the combo-box End While 'Close Reader after use sqReader.Close() Catch ex As Exception 'Show Message on Error MsgBox(ex.ToString) Finally 'At Last Close the Connection sqConnection.Close() End Try ```
How to create a ComboBox autofill using SQLite Data Reader
CC BY-SA 3.0
0
2011-04-24T15:11:33.403
2011-04-25T18:34:27.193
2011-04-25T17:05:47.907
722,000
722,000
[ "vb.net", "sqlite" ]
5,771,389
1
6,501,202
null
2
1,357
Hey, I have a Gallery in a ScrollView, the problem is that when in Landscape, the images are not scaled to fill the screen, Here is a screenshot: ![picture](https://i.stack.imgur.com/YbTjF.png) (ignore the toast) As you can see the image in the middle is the one that is currently selected, but you can see that in the left/right sides of the screen parts of the next/previous images are also displayed.. how can I make the image in the middle get scaled to the whole screen? ImageAdapter class: ``` public class ImageAdapter extends BaseAdapter { int mGalleryItemBackground; int counter =0 ; private Context mContext; public String[] mImageIds; public ImageAdapter(Context c) { mContext = c; TypedArray a = c.obtainStyledAttributes(R.styleable.Gallery1); mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0); a.recycle(); } public void insert(String string) { mImageIds[counter]=string; counter++; } public int getCount() { return mImageIds.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(mContext); i.setImageBitmap(BitmapFactory.decodeFile(mImageIds[position])); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setBackgroundResource(mGalleryItemBackground); return i; } } ``` xml: ``` </Gallery> <ScrollView android:id="@+id/QuranGalleryScrollView" android:layout_height="fill_parent" android:layout_width="fill_parent"> <Gallery android:id="@+id/GalleryLandscape" android:layout_width="fill_parent" android:layout_height="fill_parent"> </Gallery> ``` Thanks. Edit1: ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/relative"> <Gallery android:id="@+id/Gallery" android:layout_width="fill_parent" android:layout_height="fill_parent"> </Gallery> <ScrollView android:id="@+id/QuranGalleryScrollView" android:layout_height="fill_parent" android:layout_width="fill_parent"> <Gallery android:id="@+id/GalleryLandscape" android:layout_width="fill_parent" android:layout_height="fill_parent"> </Gallery> </ScrollView> <....other relative views here....> </RelativeLayout> ``` {I'm also using other Relative views so they get displayed above the gallery, though this is at the top of xml..
Images in the Gallery not stretching/scaling to the whole screen in Landscape
CC BY-SA 3.0
0
2011-04-24T15:22:51.693
2011-06-28T03:21:22.303
2011-04-24T17:41:48.747
668,082
668,082
[ "android" ]
5,771,573
1
5,771,611
null
28
88,632
It is really annoying that when I run a select command in SQL*Plus such as: ``` SELECT * FROM books; ``` The output is really badly formatted and unreadable (row cells are not in a row but separated by line breaks etc): ![enter image description here](https://i.stack.imgur.com/kH1KZ.png) How can I configure it to show SELECT results in a nicer way? EDIT: This is my login.sql file contents: ``` SET ECHO OFF SET SERVEROUTPUT ON SIZE 1000000 SET PAGESIZE 999 SET LINESIZE 132 ``` EDIT2: Affer increasing the LINESIZE: ``` SET LINESIZE 32000 ``` It now looks like this: ![enter image description here](https://i.stack.imgur.com/a6SZA.png)
Ugly formatting in SQL*Plus
CC BY-SA 3.0
0
2011-04-24T15:58:16.553
2021-03-23T11:35:03.707
2011-04-24T16:11:39.230
95,944
95,944
[ "sql", "oracle", "plsql", "oracle10g", "sqlplus" ]
5,771,653
1
5,771,889
null
0
9,196
I want to create a table row, which on the left are 3 images, and on the right a textview. Something You can usually see in a game (on the right the level number, and on the left the number of lives left.) I have tried this layout, but one of the images isnt aligns to the right: (The table layout is nested within linear layout) ``` <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="100dp" android:shrinkColumns="0" android:stretchColumns="1"> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/wa1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:paddingRight="5px" android:paddingTop="6px" android:src="@drawable/v"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/v" android:paddingTop="6px" android:layout_gravity="left" android:id="@+id/wa2" android:paddingRight="5px"> </ImageView> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/v" android:paddingTop="6px" android:layout_gravity="left" android:id="@+id/wa3" android:paddingRight="5px"> </ImageView> <TextView android:id="@+id/question_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:textColor="#000000" android:textSize="26px" android:paddingLeft="125px" android:paddingRight="15px" /> </TableRow> ``` this is the relevant part of the result: ![enter image description here](https://i.stack.imgur.com/5Cl60.jpg) 10X alot :)
Android - align images in table Layout
CC BY-SA 3.0
null
2011-04-24T16:12:50.163
2011-04-24T16:55:35.667
null
null
500,105
[ "android", "tablelayout" ]
5,771,688
1
5,774,185
null
2
1,192
I have this Ir image that has captured the veins under the skin. I want to process this image so as to retain just the veins as black colour and get everything else as white. Then I want to generate the coordinate pixels as these black pixels which will be the veins. This is what I have done till now : ``` a=imread('11.jpg'); figure(1),imshow(a); title('original image'); cform = makecform('srgb2lab'); for ii = 1:3 a(:,:,ii) = medfilt2(a(:,:,ii),[5 5]); end lab = applycform(a,cform); figure(2),imshow(lab); title('ímage in color space after filtering'); b=lab(:,:,1); c=im2bw(b,0.2); figure(3),imshow(c); title('b&white boundry of fist'); neg=1-c; figure(4),imshow(neg); color=a; r=color(:,:,1); r(~c)= 0; g = color(:,:,2); g(~c)= 0; b = color(:,:,3); b(~c)= 0; % Concatenate in the "3rd dimension" to re-constitute an RGB image. color = cat(3,r,g,b); figure(5), imshow(color); title('reconstructed fist with black bg'); gray=rgb2gray(color); figure(6); imshow(gray); title('grayscale of fist'); i1=imresize(gray,[256 256],'bilinear'); figure(7); imshow(i1); title('Resized Image of grayscale'); figure(8),imhist(i1); title('histogram of resized grayscale'); i2=histeq(i1,256); figure(9),imshow(i2); title('histogram equalisatio'); figure(10),imhist(i2); title('équalised histogram'); e=medfilt2(i2,[5 5]); figure(7),imshow(e); f=medfilt2(e,[5 5]); figure(8),imshow(f); g=medfilt2(f,[5 5]); figure(9),imshow(g); s=g; figure(10),imshow(s); l=imresize(s,[200 200]); figure(11); imshow(l); [h,u]=size(l); smth=double(l); wl=1.5; we=3; wt=15; eline=smth;; [grady,gradx]=gradient(smth); eedge=-1*sqrt((gradx.*gradx+grady.*grady)); figure(12); imshow(uint8(-eedge)); m1=[-1 1]; m2=[-1;1]; m3=[1 -2 1]; m4=[1;-2;1]; m5=[1 -1;-1 1]; cx=conv2(smth,m1,'same'); cy=conv2(smth,m2,'same'); cxx=conv2(smth,m3,'same'); cyy=conv2(smth,m4,'same'); cxy=conv2(smth,m5,'same'); for i=1:h for j=1:u eterm(i,j)=(cyy(i,j)*cx(i,j)*cx(i,j)-2*cxy(i,j)*cx(i,j)*cy(i,j)+cxx(i,j)*cy(i,j)*cy(i,j))/((1+cx(i,j)*cx(i,j)+cy(i,j)*cy(i,j))^1.5); end end figure(13); imshow(uint8(-eterm)); eext=(wl*eline+we*eedge+wt*eterm); figure(14); imshow(uint8(eext)); eext=(wl*eline+we*eedge); figure(15); imshow(uint8(eext)); whos eext; ``` and this is the image: ![enter image description here](https://i.stack.imgur.com/UtcwZ.jpg) So how do I proceed after this so that I retain the veins as black and eveything else as white? ![after median filtering](https://i.stack.imgur.com/wcua7.jpg) So this is the image after median filtering, as you can see the veins are quite dark. So how do I proceed from here so that the veins are retained as black and everything else as white?
How do I proceed to retain just the veins as black using MATLAB?
CC BY-SA 3.0
null
2011-04-24T16:18:22.757
2013-02-01T11:43:50.153
2013-02-01T11:43:50.153
1,826,081
720,746
[ "matlab", "image-processing", "image-segmentation", "threshold" ]
5,771,754
1
5,771,773
null
0
135
I try to retrieve somethingclass2 class retrieving in an iframe tag with jQuery: ![enter image description here](https://i.stack.imgur.com/i0Cql.png) this code does not work for me: ``` $("document").ready(function () { console.log($('iframe html body .somethingclass1 .somethingclass2')); }); ``` thanks
How to retrieve specefic div class in iframe tag?
CC BY-SA 3.0
null
2011-04-24T16:30:29.087
2017-08-17T02:06:17.983
2017-08-17T02:06:17.983
6,144
689,820
[ "jquery" ]
5,771,908
1
5,772,205
null
6
3,886
I am trying to compute a polygon that surrounds a line connecting multiple points (e.g. a GPX track). The image below shows an example with the track as red line and the desired polygon in blue. ![Example of a track (red line) and a rough estimated polygon surrounding the track](https://i.stack.imgur.com/4M11j.png) As simplification the red points are denoted by x and y - not by latitude/longitude. How do I compute such an environment (light blue polygon) if I only have the list of the three points specifying the path? Partial solutions (e.g. for only two points) or hints about mathematical libraries (in Java) that provide algorithms for such a computation would also bring me one step forward. Further assumptions: - Using the approach as presented by Rogach and xan I ran into some problems if the angle between the lines is smaller than 90 degree or larger than 270 degree: ![Example demonstrating the problem with the selected approach](https://i.stack.imgur.com/BEOiG.png) As you can see the polygon gets intersects itself which leads to a serious problem. From my point of view using an `java.awt.geom.Area` is the better approach: For each line connecting two points of the track I compute a surrounding polygon. Afterwards I add (area union) the computed polygon to an Area which does all the necessary computation for me. As the Area strictly uses the "or" algorithm on adding new polygons I do not have to care about "self intersections" of the polygon as presented in the update above. ![](https://i.stack.imgur.com/vtVXN.png) ``` Area area = new Area(); for (int i = 1; i < points.size(); i++) { Point2D point1 = points.get(i - 1); Point2D point2 = points.get(i); Line2D.Double ln = new Line2D.Double(point1.getX(), point1.getY(), point2.getX(), point2.getY()); double indent = 15.0; // distance from central line double length = ln.getP1().distance(ln.getP2()); double dx_li = (ln.getX2() - ln.getX1()) / length * indent; double dy_li = (ln.getY2() - ln.getY1()) / length * indent; // moved p1 point double p1X = ln.getX1() - dx_li; double p1Y = ln.getY1() - dy_li; // line moved to the left double lX1 = ln.getX1() - dy_li; double lY1 = ln.getY1() + dx_li; double lX2 = ln.getX2() - dy_li; double lY2 = ln.getY2() + dx_li; // moved p2 point double p2X = ln.getX2() + dx_li; double p2Y = ln.getY2() + dy_li; // line moved to the right double rX1_ = ln.getX1() + dy_li; double rY1 = ln.getY1() - dx_li; double rX2 = ln.getX2() + dy_li; double rY2 = ln.getY2() - dx_li; Path2D p = new Path2D.Double(); p.moveTo(lX1, lY1); p.lineTo(lX2, lY2); p.lineTo(p2X, p2Y); p.lineTo(rX2, rY2); p.lineTo(rX1_, rY1); p.lineTo(p1X, p1Y); p.lineTo(lX1, lY1); area.add(new Area(p)); } ```
Computing a polygon that surrounds a multi-point line
CC BY-SA 3.0
0
2011-04-24T17:00:17.527
2011-04-27T11:25:25.850
2011-04-25T15:06:40.477
150,978
150,978
[ "java", "math", "polygon" ]
5,772,082
1
5,772,170
null
1
113
``` "SELECT parent.name FROM categories AS node, categories AS parent WHERE node.left_node BETWEEN parent.left_node AND parent.right_node AND node.name = '{$node_name}' ORDER BY parent.right_node AND node.left_node" ``` The query above will display all the parent to the root of the node called. I only want to get the next parent, not all the way to the root, but only node above. for instance in the graphic below ![http://img97.imageshack.us/img97/7139/fruittree.gif](https://i.stack.imgur.com/Pe9xw.gif) If I call RED the statement will pull Fruit and Food, but instead I would like to structure the query to only pull the very next node to RED only which is "Fruit", don't need root node "Food".
Structuring a SQL statement to display by depth
CC BY-SA 3.0
null
2011-04-24T17:30:04.980
2013-01-16T06:10:30.487
2013-01-16T06:10:30.487
394,322
666,159
[ "sql" ]
5,772,590
1
5,772,676
null
2
777
I have a small gray-scale image with a number on it. In order to try my OCR method on it I have to convert it into binary. If I use cvThreshold with 127 as threshold the image looks all screwed up because of the gradient around the skeletons of the number. I tried but could not find any image sharpening functions to use before applying the threshold. Does anyone have pointers please? ![original gray scale image](https://i.stack.imgur.com/PBUJk.png) becomes ![enter image description here](https://i.stack.imgur.com/ptWCU.png) which is crude. EDIT: by binary, I mean binary image, where a pixel in the image is either 0 (black) or 255 (white). EDIT2: Oh, looking at the revision log made me giggle.
How to convert a gray image of a letter to binary without losing the main contour?
CC BY-SA 3.0
null
2011-04-24T19:05:50.337
2011-04-24T23:10:11.087
2011-04-24T23:10:11.087
176,769
10,088
[ "c", "image-processing", "opencv" ]
5,772,876
1
null
null
1
1,381
This is probably a very easy problem to solve but i have not succeeded. I have copied the file "questions_famquiz_easy_110326.txt" to the resources folder and now want to access (read) it and NSLog it to see that i am able to read it. The code below is from one of the tests i have done based on examples that i have found on the web. I am trying to access a txt-file in the Resources folder and fail to do so. I have searched for a solution, tested a lot, but not succeeded. I am testing with the following code: ``` NSLog(@"\n \n >>>>>>viewDidLoad<<<<<<<<<"); NSError *error; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *filePath = [docsDirectory stringByAppendingPathComponent:@"questions_famquiz_easy_110326.txt"]; if(![fileManager fileExistsAtPath:filePath]) { NSData *data = [NSData dataWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/questions_famquiz_easy_110326.txt"]]; [data writeToFile:filePath atomically:YES]; } NSString *myString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error]; NSLog(@"myString: %@", myString); NSLog(@"\n \n>>>>>>DONE WITH viewDidLoad<<<<<<<<<"); exit(0); //====EXIT JUST FOR THE TEST====<<< ``` The above code is located in the first viewController that is started. The output i get is: ``` >>>>>>viewDidLoad<<<<<<<<< 2011-04-24 21:53:47.825 FamQuiz_R0_1[542:307] myString: (null) 2011-04-24 21:53:51.044 FamQuiz_R0_1[542:307] >>>>>>DONE WITH viewDidLoad<<<<<<<<< ``` Could someone nice help me to solve this? update: Here is the filePath: ``` 2011-04-24 22:38:08.562 FamQuiz_R0_1[637:307] filePath: /var/mobile/Applications/7F5FDB03-0D22-46BC-91BC-4D268EB4BBEB/FamQuiz_R0_1.app/questions_famquiz_easy_110326.txt ``` Here is where i have placed the file: ![enter image description here](https://i.stack.imgur.com/RpYpj.png) ``` NSString *myString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error]; ``` When i used the above it did not work, when i used the below it worked and printed out the text. ``` NSString *myString = [[NSString alloc] initWithContentsOfFile:filePath]; ```
Objective-C / Can't access (read) file in "Resources" folder
CC BY-SA 3.0
0
2011-04-24T19:56:00.163
2011-04-25T17:41:20.197
2011-04-25T09:20:32.270
418,332
418,332
[ "objective-c", "ios4", "file-manager" ]
5,773,032
1
5,775,030
null
36
13,469
I have developed a photo sharing community site using CodeIgniter 1.7. Photos that are uploaded by members are automatically resized in a number of formats, for which I use the CodeIgniter Image Manipulation class. This class is built into the framework and basically a wrapper around multiple image manipulation libraries, such as GD, GD2, ImageMagick, and NETPBM. On my host, I can only make use of GD2, so that's where this question will be about. On to my problem. Here is an example of a resized photo on my site. Note that the original was very large, over 3000px wide: [http://www.jungledragon.com/image/195/female_impala_close-up.html](http://www.jungledragon.com/image/195/female_impala_close-up.html) Now, look at that same image, also resized, just a bit larger at Flickr: [http://www.flickr.com/photos/fledder/3763538865/in/set-72157621744113979](http://www.flickr.com/photos/fledder/3763538865/in/set-72157621744113979) See the dramatic difference? I'm trying to bridge that huge gap. The first thing I did was to apply a sharpen filter to the images. You can see the result here: ![enter image description here](https://i.stack.imgur.com/FHEPy.png) Although still not perfect, it at least approaches the sharpness level of the Flickr image. The remaining problem is that the colors are washed away, as if their saturation is decreased. This happens before the sharpening filter already, so it must be in GD2. This issue is vitally important to me, but I don't know where to look. I've found some .NET threads talking about chroma sub sampling but I don't know what to do with that information in my setup. I'm looking for any solution that works within the constraints of my setup. Hereby the original file, exactly as I uploaded it both to my site and Flickr: [http://www.jungledragon.com/img/DSC07275.jpg](http://www.jungledragon.com/img/DSC07275.jpg) : I'm shocked. In a good way. It took me a lot of pain to install ImageMagick but after switching to it (which was a matter of setting 'imagemagick' as the library to use at the Code Igniter image manipulation class, the result of the test image is as follow: ![enter image description here](https://i.stack.imgur.com/oUEY5.jpg) ImageMagick's resizing is doing it exactly as intended. The colors are preserved, and the sharpness is there. Yes, I disabled my custom sharpening routine since it is no longer needed due to ImageMagick. On top of that, the process is a lot faster and less memory hungry too. And here comes another great part: I cannot explain it, but I did absolutely nothing to tell ImageMagick to use a specific color profile, which was suggested by user @Alix. In my testing so far it looks like the color information is respected with or without an embedded profile. The output simply is a smaller version of the input. Is ImageMagick really that smart or am I dreaming?
How to stop GD2 from washing away the colors upon resizing images?
CC BY-SA 3.0
0
2011-04-24T20:25:33.740
2017-08-11T15:16:10.987
2020-06-20T09:12:55.060
-1
80,969
[ "php", "codeigniter", "image-resizing", "gd2" ]
5,773,031
1
5,773,471
null
0
770
Note: I apologize if this program is painful to look at. this is my first program using derived classes. I plan on submitting it to code review after I get it to do what I want so I can recieve tips on how it could have been designed better. Feel free to provide those tips here but my main intention for this post is to get it to work correctly. This program processes withdrawals and deposits for bank accounts and then applies an interest rate. For some reason it seems like the value of checkingBalance gets stuck and does not update to a new value throughout the rest of the loop when processing the accounts of class type "checkingAccount". It is odd because the same loop is used to process the other derived class "savingsAccount" and it works fine and one of accounts of type "checkingAccount" even seems to have been processed correctly so I am completely bamboozled as to what is going on. If anyone could lend a hand and help me resolve this issue it would be greatly appreciated. Please do not hesitate to ask me to specify anything, I will respond asap. ![enter image description here](https://i.stack.imgur.com/n5V1D.png) ![enter image description here](https://i.stack.imgur.com/HGxe8.png) ``` //This loop is exited early: for (int j = 0; j < transactionNum; j++) { inFile >> transactionTypeTemp >> amountTemp; inFile.get(discard); ba.applyTransaction(accountType, transactionTypeTemp, amountTemp, j); } //when something in here occurs? // c = j from loop double checkingAccount:: applyTransaction(char transactionTypeTemp, int amountTemp, int c, double checkingBalance) { if (transactionTypeTemp == 'D') { checkingBalance = checkingBalance + amountTemp; } else if (transactionTypeTemp == 'W') { if (checkingBalance < amountTemp) { cout << "error: transaction number " << c + 1 << " never occured due to insufficent funds." << endl; } else { checkingBalance = checkingBalance - amountTemp; if(checkingBalance < minimumBalance) //if last transaction brought the balance below minimum balance { checkingBalance = (checkingBalance - serviceCharge); //apply service charge } } } return checkingBalance; } ``` ``` //header file #include <iostream> #include <fstream> using namespace std; class bankAccount { public: bankAccount(); void setAccountInfo(int accountNumTemp, double balanceTemp); void prePrint(char accountType); void applyTransaction(char accountType, char transactionTypeTemp, int amountTemp, int j); void applyInterest(char accountType); void postPrint(); private: int accountNumber; double balance; }; class checkingAccount: public bankAccount { public: void prePrint(int accountNumber, char accountType, double checkingBalance); checkingAccount(); double applyTransaction(char transactionTypeTemp, int amountTemp, int c, double checkingBalance); double applyInterest(double checkingBalance); private: float interestRate; int minimumBalance; float serviceCharge; }; class savingsAccount: public bankAccount { public: void prePrint(int savingsAccountNumber, char accountType, double savingsBalance); savingsAccount(); double applyTransaction(char transactionTypeTemp, int amountTemp, int c, double savingsBalance); double applyInterest(double checkingBalance); private: float interestRate; }; //class implementation .cpp file bankAccount:: bankAccount() { accountNumber = 0; balance = 0; } void bankAccount:: setAccountInfo(int accountNumTemp, double balanceTemp) { accountNumber = accountNumTemp; balance = balanceTemp; } void bankAccount:: prePrint(char accountType) { if(accountType == 'C') { int checkingAccountNumber = accountNumber; double checkingBalance = balance; checkingAccount ca; ca.prePrint(checkingAccountNumber, accountType, checkingBalance); } else if (accountType == 'S') { int savingsAccountNumber = accountNumber; double savingsBalance = balance; savingsAccount sa; sa.prePrint(savingsAccountNumber, accountType, savingsBalance); } } void bankAccount:: applyTransaction(char accountType, char transactionTypeTemp, int amountTemp, int j) { int c; c = j; double checkingBalance, savingsBalance; checkingAccount ca; savingsAccount sa; if (accountType == 'C') { checkingBalance = balance; balance = ca.applyTransaction(transactionTypeTemp, amountTemp, c, checkingBalance); } else if (accountType == 'S') { savingsBalance = balance; balance = sa.applyTransaction(transactionTypeTemp, amountTemp, c, savingsBalance); } } void bankAccount:: applyInterest(char accountType) { double checkingBalance, savingsBalance; checkingAccount ca; savingsAccount sa; if (accountType == 'C') { checkingBalance = balance; balance = ca.applyInterest(checkingBalance); } else if (accountType == 'S') { savingsBalance = balance; balance = sa.applyInterest(savingsBalance); } } void bankAccount:: postPrint() { cout << "Balance after processing: " << balance << endl; } checkingAccount:: checkingAccount() { interestRate = .02; minimumBalance = 500; serviceCharge = 20; } void checkingAccount:: prePrint(int checkingAccountNumber, char accountType, double checkingBalance) { cout << "Account Number:" << checkingAccountNumber << " account type:" << accountType << " Starting Balance:" << checkingBalance << endl; } double checkingAccount:: applyTransaction(char transactionTypeTemp, int amountTemp, int c, double checkingBalance) { if (transactionTypeTemp == 'D') { checkingBalance = checkingBalance + amountTemp; } else if (transactionTypeTemp == 'W') { if (checkingBalance < amountTemp) { cout << "error: transaction number " << c + 1 << " never occured due to insufficent funds." << endl; } else { checkingBalance = checkingBalance - amountTemp; if(checkingBalance < minimumBalance) //if last transaction brought the balance below minimum balance { checkingBalance = (checkingBalance - serviceCharge); //apply service charge } } } return checkingBalance; } double checkingAccount:: applyInterest(double checkingBalance) { checkingBalance = (checkingBalance + (checkingBalance * interestRate)); return checkingBalance; } savingsAccount:: savingsAccount() { interestRate = .04; } void savingsAccount:: prePrint(int savingsAccountNumber, char accountType, double savingsBalance) { cout << "Account Number:" << savingsAccountNumber << " account type:" << accountType << " Starting Balance:" << savingsBalance << endl; } double savingsAccount:: applyTransaction(char transactionTypeTemp, int amountTemp, int c, double savingsBalance) { if (transactionTypeTemp == 'D') { savingsBalance = savingsBalance + amountTemp; } else if (transactionTypeTemp == 'W') { if (savingsBalance < amountTemp) { cout << "error: transaction number" << c + 1 << " never occured due to insufficent funds." << endl; } else { savingsBalance = savingsBalance - amountTemp; //apply transaction } } return savingsBalance; } double savingsAccount:: applyInterest(double savingsBalance) { savingsBalance = (savingsBalance + (savingsBalance * interestRate)); return savingsBalance; } //main .cpp file int main() { ifstream inFile; int numberOfAccounts, accountNumTemp, transactionNum, amountTemp; double balanceTemp; char discard, accountType, transactionTypeTemp; bankAccount ba; cout << "Processing account data..." << endl; inFile.open("Bank.txt"); if (!inFile) { for (int a = 0; a < 20; a++) cout << endl; cout << "Cannot open the input file." << endl; return 1; } inFile >> numberOfAccounts; inFile.get(discard); for (int i = 0; i < numberOfAccounts; i++) { inFile >> accountNumTemp >> accountType >> balanceTemp >> transactionNum; inFile.get(discard); ba.setAccountInfo(accountNumTemp, balanceTemp); ba.prePrint(accountType); for (int j = 0; j < transactionNum; j++) { inFile >> transactionTypeTemp >> amountTemp; inFile.get(discard); ba.applyTransaction(accountType, transactionTypeTemp, amountTemp, j); } ba.applyInterest(accountType); ba.postPrint(); } inFile.close(); return 0; } ``` Here is the input in copy-and-pastable form so that others don't have to type it in: ``` 6 35231 C 500 3 W 250 W 200 W 100 46728 S 2700 2 D 250 W 100 87324 C 500 3 D 300 W 100 W 150 79873 S 800 0 89932 C 3000 2 W 1000 W 1500 98322 C 750 6 D 50 W 75 W 100 W 25 W 30 W 75 ```
Erronous output from program using derived classes. Not for the light of heart
CC BY-SA 3.0
0
2011-04-24T20:25:29.517
2011-04-24T23:08:59.143
2011-04-24T23:08:59.143
85,371
538,293
[ "c++" ]
5,773,539
1
null
null
0
871
Hi Im trying to delete an item from the listbox which the user selects here you can find my code and a screenshot tnx. Code: ``` public void deleteEvent(ListBox list_event) { int i = list_event.SelectedIndex; ds.Tables["tblEvents"].Rows[i].Delete(); da.Update(ds.Tables["tblEvents"]); } ``` Im getting Object reference not set to an instance of an object Exception. ScreenShot: ![enter image description here](https://i.stack.imgur.com/1cRTj.jpg)
Deleting An item from a List Box from a Database
CC BY-SA 3.0
null
2011-04-24T22:04:25.697
2011-04-24T22:52:40.520
2011-04-24T22:17:59.520
273,200
723,001
[ "c#" ]
5,774,073
1
5,774,103
null
8
1,294
Is it possible to create graphics of spherical co-ordinate system like this in mathematica or should I use photoshop? I'm asking because I want a high resolution graphic, but lot of the files on internet are grainy when zoomed. Here is the image: ![enter image description here](https://i.stack.imgur.com/1GM0z.gif)
Spherical co-ordinate graphics in Mathematica
CC BY-SA 3.0
0
2011-04-25T00:05:57.053
2011-04-26T14:41:17.540
2011-04-25T00:07:19.367
618,728
723,055
[ "wolfram-mathematica" ]
5,774,111
1
null
null
0
106
I have a list component filled with text of varying length. I currently have this ![](https://i.stack.imgur.com/vvKBa.jpg) But I'm trying to get this ![](https://i.stack.imgur.com/ZevG1.jpg) And is it possible to manually wrap the row height depending on the size of the text inside the row? Thanks!
Align list items left on a row with huge height
CC BY-SA 3.0
null
2011-04-25T00:17:04.507
2011-04-25T05:59:50.067
2011-04-25T05:56:26.230
271,725
159,856
[ "flash", "actionscript-3", "actionscript" ]
5,774,108
1
null
null
2
839
# What I plan on doing: I want to develop the [English accent](http://en.wikipedia.org/wiki/English_accent) (without professional training). # Set of axioms behind my reasoning with executive summary: Following is knowingly over simplified, sorry for that. I tried to keep question short. ## Part 1 : Understanding how learning works. At the moment I assume, that [Broca's area](http://en.wikipedia.org/wiki/Broca%27s_area) and [Wernicke's area](http://en.wikipedia.org/wiki/Wernicke%27s_area) must be aware of the language, and muscle memory with existing phonetic alphabet will build the speech. Accents are just formed naturally over time by phonetic alphabet assimilation. ![areas](https://i.stack.imgur.com/jJZfJ.png) Using Google I found, that [speech shadowing](http://en.wikipedia.org/wiki/Speech_shadowing), can potentially be used for phonetic symbol assimilation. Muscle memory on the other hand can be trained by repetitive action. And this is most effective, if person is of 23-24 years of age and has lots of uninterpretable time on his/her hand as losing focus can dramatically decrease effective learning curve gradient. This kind of [procedural memory](http://en.wikipedia.org/wiki/Procedural_memories) can be probably optimized to flushed in [memory with designed sleep pattern](http://en.wikipedia.org/wiki/Sleep_and_learning). ## Part 2 : Designing behavioral pattern - - - ## Part 3 : Finding a fluent speaker whom accent I want to sound like. Youtube is a powerful free resource. Sample audio, that I tough about picking : [Someone Like You - Adele (Cover)](http://www.youtube.com/p/57025F8AB5E8E795?hl=en_US&fs=1) in HD. It does not bother me, that it is high pitched female voice. ## Part 4 : Distinguishing target accent phonemes and phones. It is not a trivial task - identifying and judging whether spoken phone is correct. And how correctly tangible text is spoken by human. It seems so complex in fact, that I wont bother automating it and just use [IPA](http://en.wikipedia.org/wiki/IPA) as baseline. Here is the first psalm with word stress in american IPA of the sample audio above : ![IPA](https://i.stack.imgur.com/yg7IU.png) No copyright infringement intended. And image is created with [upodn](http://upodn.com/phon.asp) (alternative: [photransedit](http://www.photransedit.com/Online/Text2Phonetics.aspx)). ## Part 5 : Training muscle memory to produce target accent. Although it is fun to just try to mimic and archive synchronization, then i would prefer building a tool, that extracts words as audio files. So I can use winamp or ipod to loop and shuffle the words I want. I imagine, that I can use MS Expression Encoder for this. # Question If given an audio file (ex. in wav format, size < 32mb) and it's text equivalent (finite nr of words, ex. 2000), then how to split it into multiple files, that each contains 1 word. Word can contain some excess whitespace, and boundary checks can be user approved. If it is not accurate, then what is the best way, to get good estimation for word boundaries. Main intention is to reduce work, that I would be doing, if this would be done manually.
Audio mining for words boundaries
CC BY-SA 3.0
null
2011-04-25T00:16:39.323
2013-02-24T11:59:02.800
2020-06-20T09:12:55.060
-1
97,754
[ "c#", "algorithm", "word-boundaries" ]
5,774,152
1
5,774,264
null
10
1,975
I'm working on a site where users can describe a physical object using (amongst many other things) any color in the rgb 0-255 range. We offer some simplified palettes for easy clicking but a full color wheel is a requirement. Behind the scenes, one of the processes compares two user descriptions of the object and scores them for similarity. What I'm trying to do is get a score for how similar the 2 colors are . Basically, the algorithm needs to determine if a 2 humans picking 2 different colors could be describing the same object. Thus Light Red->Red should be 100%, Most of the shades of grey will be 100% to each other, etc but red-> green is definitely not a match. To get a decent look at how the algorithms were working, I plotted grayscale and 3 intensities of each hue against every other color in the set and indicated no match (0%) with black, visually identical (100%) with white and grayscale to indicate the intermediate values. My first (very simplistic approach) was to simply treat the RGB values as co-ordinates in the colour cube and work out the distance (magnitude of the vector) between them. This threw out a number of problems with regards to Black->50% Grey being a larger distance than (say) Black->50% Blue. having run hundreds of comparisons and asked for feedback, this doesn't seem to match human perception (shown below) ![Method 1](https://i.stack.imgur.com/T1VG8.png) Method 2 converted the RGB values into [HSV](http://en.wikipedia.org/wiki/HSL_and_HSV). I then generated a score based 80% on hue with the other 20% on Sat/Lum. This seems to be the best method so far but still throws some odd matches ![Method 2](https://i.stack.imgur.com/LGdnM.png) Method 3 was an attempt at a hybrid - HSL Values were calculated but the final score was based upon the distance between the 2 colors in the HSL color cylinder space (as in 3D polar co-ordinates). ![Method 3](https://i.stack.imgur.com/ecH60.png) I feel like I must be re-inventing the wheel - surely this has been done before? I can't find any decent examples on Google and as you can see my approach leaves something to be desired. So, my question is: Is there a standard way to do this? If so, how? If not, can anyone suggest a way to improve my approach? I can provide code snippets if required but be warned it's currently messy as hell due to 3 days of tweaking. Using the suggestions provided below, I've implemented a `Delta E 2000` comparer. I've had to tweak the weighting values to be quite large - I'm not looking for colors which are imperceptibly different but which are not hugely different. In case anyone's interested, the resulting plot is below... ![DeltaE2000](https://i.stack.imgur.com/Xz7sn.png)
Calculate how humans perceive similarity between different colours
CC BY-SA 3.0
0
2011-04-25T00:28:41.873
2015-04-12T01:40:15.050
2015-04-12T01:40:15.050
156,755
156,755
[ "algorithm", ".net-4.0", "colors", "comparison" ]
5,774,201
1
null
null
0
299
A legacy website that I am working on has a popup box that uses an iFrame and has nested tables. Within the cells of this table there is simple text and the last row of the table has two input boxes; one left aligned and one right aligned. On screen resolution higher than 1024 X 768 everything is displayed within the borders of the box. The problem lies when I have resolution of 1024 X 768 or lower the text expands wider then the box and therefore horizontal scroll bars are turned on. I like to modify the inline css styling that so prominent in this design so the text and buttons render the same in any resolution and no scroll bars are turned on. The only thing I can see is that table width is set to 100%. Any help will be a life saver. Thanks Please find screenshots attached: ![Greater than 1024](https://i.stack.imgur.com/uy7Y0.png) ![1024 x 768](https://i.stack.imgur.com/t7ATY.png) Here is the markup for the tables ``` <div align="center" style="padding: 8px 10px 4px;"> <table cellspacing="0" cellpadding="0" align="center" width="600px"> <tbody><tr> <td align="center" valign="top"> <div class="container"> <TABLE cellSpacing="5" cellPadding="5" width="100%" class="gradientHeader"> <tr> <th width="100%"> xxxxxx </th> </tr> <tr> <td width="100%"> some text </td> </tr> <tr> <td width="100%" style="PADDING-LEFT: 10px"> <table width="100%"> <tr> <td width="100%"> <FIELDSET style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;padding:0;"> <asp:RadioButtonList id="rbl" runat="server" /> </FIELDSET> </td> </tr> <tr> <td align="left"> <AN IMAGE BUTTON> </td> <td align="right"> <AN IMAGE BUTTON> </td> </tr> </table> </td> </tr> <tr> <td> <input type="hidden" name="hidProductId" id="hidProductId"> </td> </tr> </table> </div> </td></tr></tbody></table> ```
Text and buttons outgrow popup box size
CC BY-SA 3.0
null
2011-04-25T00:38:00.137
2011-04-25T09:09:11.813
2011-04-25T08:56:00.043
112,651
112,651
[ "html", "css" ]
5,774,280
1
null
null
4
554
I'm implementing a fairly standard `UIView` animation, using `UIViewAnimationTransitionCurlUp`. The basic idea is that I have a folder on the screen covered with a stack of pages, and as I change from page to page I use the curl up animation. Each page is a subview that takes up about 70% of the screen so that the clipboard is still visible in the background. This animation all works fine, that problem is that even though each "page" (which is a separate `UIViewController` & `UIView`) has a transparent background, the page background becomes visible during the page curl. It's only slightly visible, like a black background with an alpha of 0.1. But it ruins the effect. Any ideas? This is for a private application that will not be distributed on the app store, so private APIs are ok. ![enter image description here](https://i.stack.imgur.com/W5aJa.jpg)
UIViewAnimationTransitionCurlUp with transparent background
CC BY-SA 3.0
0
2011-04-25T00:51:30.737
2013-06-17T22:04:15.513
2013-05-22T05:33:45.503
981,914
334,982
[ "iphone", "objective-c", "core-animation", "uiviewanimation" ]
5,774,314
1
5,778,519
null
3
1,369
I'm creating a page with [jQuery Mobile](http://jquerymobile.com) and I have the following HTML: ``` <div data-role="page" id="page1"> <div data-role="header"> <h1>Page 1</h1> </div> <div data-role="content"> <p>You need to select a page:</p> <ol data-role="listview"> <li><a href="#page2">Item 1</a></li> <li><a href="#page2">Item 2</a></li> </ol> </div> </div> <div data-role="page" id="page2"> <div data-role="header"> <h1>Page 2</h1> </div> </div> ``` It behaves as expected, except that on Chrome 10.0.648.205, I see the following: ![enter image description here](https://i.stack.imgur.com/qBQUG.png) Notice that the `<p>` is obscured by the list. Why is the list overlapping the text? you can play with the code here: [http://jsfiddle.net/r2whr/](http://jsfiddle.net/r2whr/)
Why is this listview positioned above the previous <p>?
CC BY-SA 3.0
0
2011-04-25T00:58:55.357
2011-07-08T13:48:51.430
null
null
193,619
[ "jquery", "jquery-mobile", "overlap" ]
5,774,442
1
5,774,456
null
27
10,990
I have a button with a default command and a context menu for other available commands: ``` <Button Content="Do this" Height="23" Width="75" Command="local:MyCommands.ThisCommand"> <Button.ContextMenu> <ContextMenu> <MenuItem Header="Do this" Command="local:MyCommands.ThisCommand" /> <MenuItem Header="Do that" Command="local:MyCommands.ThatCommand" /> </ContextMenu> </Button.ContextMenu> </Button> ``` By default, the context menu appears starting at the hot spot of the cursor: ![](https://i.stack.imgur.com/1AYow.png) However, I'd like it to appear at a fixed relative position, beneath the button (fake, edited screenshot): ![](https://i.stack.imgur.com/AM6c4.png) Setting the context menu's `Placement`, `PlacementRectangle` and `PlacementTarget` properties doesn't seem to do anything; the context menu insists on hanging off the cursor wherever I right-click my button. Worse, focusing the button and hitting the [menu key](http://en.wikipedia.org/wiki/Menu_key) causes the context menu to sit in front of the button, blocking it completely. So, how exactly do I specify that the context menu should appear beneath the button?
How can I tell a ContextMenu to place itself relatively to its control and not the cursor?
CC BY-SA 3.0
0
2011-04-25T01:30:46.687
2012-10-22T06:38:09.140
2012-10-22T06:38:09.140
106,224
106,224
[ ".net", "wpf", "xaml", "contextmenu" ]
5,774,480
1
5,774,523
null
2
863
I designed a pretty cool looking form layout but have no clue how to make the radios on it work! Below is a mockup of the the form: ![Sample of Form](https://i.stack.imgur.com/uJyX5.png) I've already created the CSS for the text inputs (and will attach it below for anyone else looking for something similar). What I now need to figure out is the "What service are you looking for?" section. I've written the CSS for the blue box but I now need to figure out how to turn "Consulting, Web Development, and Graphic Design" into radio selects where the one with the check mark next to it is the selected radio box. Way over my head. I'm still trying to figure it out and will post back here if I do; just looking for some input on how you'd write those radios. Current code for text inputs: ``` input[type=text] { width: 365px; height: 54px; margin: 0 0 12px 0; padding: 0 0 0 25px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; background: #a2bdd8; background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #76899d), color-stop(0.075, #a2bdd8)); color: #fff; font-size: 30px; border: none; } *:focus { outline: none; } ``` Current code for background to "What service are you looking for?": ``` #options { width: 270px; height: 120px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; background: #a2bdd8; } ```
CSS Challenge: Custom Radio Selects
CC BY-SA 3.0
null
2011-04-25T01:40:32.173
2011-04-25T02:51:04.950
null
null
483,418
[ "css", "forms", "layout", "radio-button" ]
5,774,535
1
5,774,635
null
0
859
![enter image description here](https://i.stack.imgur.com/28DBp.jpg) I need to make the ListBox expand to fit the width it has available. Here's the XAML: ``` <ListBox Grid.Row="2" Height="400" ItemsSource="{StaticResource Notes}" VerticalAlignment="Top"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical" Height="90" Margin="5"> <TextBlock Text="{Binding Title}" FontSize="30" /> <TextBlock Text="{Binding Text}" FontSize="15" /> <Rectangle Fill="#1192D4" Height="2" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> ```
How can I make a ListBox expand to fit the entire available width?
CC BY-SA 3.0
null
2011-04-25T01:55:23.300
2011-04-25T02:15:30.080
2011-04-25T01:58:05.973
314,166
699,978
[ "silverlight", "xaml", "windows-phone-7" ]
5,774,621
1
5,776,116
null
23
7,039
I'm trying to run a Ruby on Rails app on a Dreamhost shared server. All is well so far except one weird bug I have not been able to unravel. Sometimes when I visit the web app, I get presented with a Phusion Passenger error saying, > You have already activated rack 1.2.1, but your Gemfile requires rack 1.2.2. Consider using bundle exec. When I just refresh the page it seems to work, though - no more Phusion Passenger error message. Following other stack overflow threads and a similar [Dreamhost wiki](http://wiki.dreamhost.com/Ruby_on_Rails#Rails_2.3.5_-_Rack_1.0_already_activated_.28fix.29), I added the following to the top of the `config/environment.rb` file: ``` if ENV['RAILS_ENV'] == 'production' # don't bother on dev ENV['GEM_PATH'] = '/home/myusername/.gems' + ':/usr/lib/ruby/gems/1.8' end ``` ![enter image description here](https://i.stack.imgur.com/jOBcU.png)
Phusion Passenger Error: You have activated rack 1.2.1, but your Gemfile requires rack 1.2.2
CC BY-SA 3.0
0
2011-04-25T02:11:54.870
2022-10-12T16:52:39.967
2011-09-08T18:31:59.457
627,264
627,264
[ "ruby-on-rails", "ruby", "rubygems", "passenger", "dreamhost" ]
5,774,734
1
null
null
0
471
I am trying to add a whole package to my svn ignore list. I thought that putting `*ploo.syntax.analysis*` as pattern would be a match, but it seems as it isn't. I've also tried without success: - - - Adding `*` or `analysis` or `*analysis*` will work, though (but that is not exactly what I intend to) What am I doing wrong? ![enter image description here](https://i.stack.imgur.com/Up76H.png)
Problem with Eclipse svn:ignore
CC BY-SA 3.0
null
2011-04-25T02:44:41.527
2011-04-25T09:44:56.963
null
null
130,758
[ "eclipse", "svn", "version-control" ]
5,774,877
1
7,958,783
null
4
4,879
I have just moved to xcode4 and boy am i confused! :) For one, in the screenshot, you could see the localizable strings, a couple of the file names changed to "null", i am wondering why and if it would effect the final product? And also, i could'nt figure out for the life of me, how do i add another localization. Previously in xcode3.x i had to right click on "Localizable Strings" and add a language, where do i do it now? ![enter image description here](https://i.stack.imgur.com/mypYs.jpg) Update: I have found where to add locations, but again, previously i was able to type a language the way i wanted, for instance, i want to add spanish, i could do that by just adding a language with name spanish, but now i am forced to choose from a predefined list of languages. And also, the ((null)) bugs me
XCode 4, Adding localization
CC BY-SA 3.0
0
2011-04-25T03:25:16.677
2011-10-31T19:38:27.110
2011-04-25T03:30:38.567
164,601
164,601
[ "cocoa", "xcode4" ]