Search Results

Search found 2446 results on 98 pages for 'darren green'.

Page 33/98 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Passing in defaults within window.onload?

    - by Matrym
    I now understand that the following code will not work because I'm assigning window.onload to the result of the function, not the function itself. But if I remove the parens, I suspect that I have to explicitly call a separate function to process the config before the onload. So, where I now have: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <script type="text/javascript" src="lb-core.js"></script> <script type="application/javascript"> var lbp = { defaults: { color: "blue" }, init: function(config) { if(config) { for(prop in config){ setBgcolor.defaults[prop] = config[prop]; } } var bod = document.body; bod.style.backgroundColor = setBgcolor.defaults.color; } } var config = { color: "green" } window.onload = lbp.init(config); </script> </HEAD> <body> <div id="container">test</div> </body> </HTML> I imagine I would have to change it to: var lbp = { defaults: { color: "blue" }, configs: function(config){ for(prop in config){ setBgcolor.defaults[prop] = config[prop]; } }, init: function() { var bod = document.body; bod.style.backgroundColor = setBgcolor.defaults.color; } } var config = { color: "green" } lbp.configs(config); window.onload = lbp.init; Then, for people to use this script and pass in a configuration, they would need to call both of those bottom lines separately (configs and init). Is there a better way of doing this? Note: If your answer is to bundle a function of window.onload, please also confirm that it is not hazardous to assign window.onload within scripts. It's my understanding that another script coming after my own could, in fact, overwrite what I'd assigned to onload.

    Read the article

  • Complex regex question, data may or may not be in brackets

    - by martinpetts
    I need to extract data from a source that presents it in one of two ways. The data could be formatted like this: Francis (Lab) 18,077 (60.05%); Waller (LD) 4,140 (13.75%); Evans (PC) 3,545 (11.78%); Rees-Mogg (C) 3,064 (10.18%); Wright (Veritas) 768 (2.55%); La Vey (Green) 510 (1.69%) Or like this: Lab 8,994 (33.00%); C 7,924 (29.07%); LD 5,197 (19.07%); PC 3,818 (14.01%); Others 517 (1.90%); Green 512 (1.88%); UKIP 296 (1.09%) The data I need to extract is the percentage and the party (these are election results), which is either in brackets (first example) or is the only non-numeric text. So far I have this: preg_match('/(.*)\(([^)]*)%\)/', $value, $match); Which is giving me the following matches (for first example): Array ( [0] => Francis (Lab) 18,077 (60.05%) [1] => Francis (Lab) 18,077 [2] => 60.05 ) So I have the percentage, but I also need the party label, which may or may not be in brackets and may or may not be the only text. Can anyone help?

    Read the article

  • How does one convert 16-bit RGB565 to 24-bit RGB888?

    - by jleedev
    I’ve got my hands on a 16-bit rgb565 image (specifically, an Android framebuffer dump), and I would like to convert it to 24-bit rgb888 for viewing on a normal monitor. The question is, how does one convert a 5- or 6-bit channel to 8 bits? The obvious answer is to shift it. I started out by writing this: uint16_t buf; while (read(0, &buf, sizeof buf)) { unsigned char red = (buf & 0xf800) >> 11; unsigned char green = (buf & 0x07c0) >> 5; unsigned char blue = buf & 0x003f; putchar(red << 3); putchar(green << 2); putchar(blue << 3); } However, this doesn’t have one property I would like, which is for 0xffff to map to 0xffffff, instead of 0xf8fcf8. I need to expand the value in some way, but I’m not sure how that should work. The Android SDK comes with a tool called ddms (Dalvik Debug Monitor) that takes screen captures. As far as I can tell from reading the code, it implements the same logic; yet its screenshots are coming out different, and white is mapping to white. Here’s the raw framebuffer, the smart conversion by ddms, and the dumb conversion by the above algorithm. (By the way, this conversion is implemented in ffmpeg, but it’s just performing the dumb conversion listed above, leaving the LSBs at all zero.) I guess I have two questions: What’s the most sensible way to convert rgb565 to rgb888? How is DDMS converting its screenshots?

    Read the article

  • Alternating table row colors in freemarker

    - by itsadok
    What's a good, simple way to have alternate row coloring with freemarker? Is this really the best way? <#assign row=0> <#list items as item> <#if (row % 2) == 0> <#assign bgcolor="green"> <#else> <#assign bgcolor="red"> </#if> <tr style='background-color: ${bgcolor}'><td>${item}</td></tr> <#assign row = row + 1> </#list> I tried doing this: <#assign row=0> <#list items as item> <tr style='background-color: ${(row % 2) == 0 ? "green" : "blue"}'><td>${item}</td></tr> <#assign row = row + 1> </#list> But apparently you can't user the ternary operator in there. Note: I guess I should have mentioned it earlier, but I can't use css classes or javascript, since this HTML is going into an email message.

    Read the article

  • Possible to create an implicit cast for an anonymous type to a dictionary?

    - by Ralph
    I wrote a method like this: using AttrDict = System.Collections.Generic.Dictionary<string, object>; using IAttrDict = System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object>>; static string HtmlTag(string tagName, string content = null, IAttrDict attrs = null) { var sb = new StringBuilder("<"); sb.Append(tagName); if(attrs != null) foreach (var attr in attrs) sb.AppendFormat(" {0}=\"{1}\"", attr.Key, attr.Value.ToString().EscapeQuotes()); if (content != null) sb.AppendFormat(">{0}</{1}>", content, tagName); else sb.Append(" />"); return sb.ToString(); } Which you can call like HtmlTag("div", "hello world", new AttrDict{{"class","green"}}); Not too bad. But what if I wanted to allow users to pass an anonymous type in place of the dict? Like HtmlTag("div", "hello world", new {@class="green"}); Even better! I could write the overload easily, but the problem is I'm going to have about 50 functions like this, I don't want to overload each one of them. I was hoping I could just write an implicit cast to do the work for me... public class AttrDict : Dictionary<string, object> { public static implicit operator AttrDict(object obj) { // conversion from anonymous type to AttrDict here } } But C# simply won't allow it: user-defined conversions to or from a base class are not allowed So what can I do?

    Read the article

  • Is CSS Inheritance in Internet Explorer 8 still buggy?

    - by rrrr
    I have a situation that I am looking at where certain CSS properties will not be inherited. This revolves around tables and IE8. Using the sample HTML below I cannot get the text within the table to inherit the green colour. This works in Firefox and Chrome, but not IE8 and from reading up this seems to have always been a problem in IE but was meant to be working in version 8 from what I read. I have tried to specify the inherit value everywhere possible, but to no avail so the question is whether the CSS inheritance support in IE8 is buggy, or am I missing something? I don't want answer changing inline CSS to be classes and I certainly dont wan't any comments on tables as this all stems from building and designing HTML emails where inline CSS and tables are essential. <html> <head></head> <body> <table style="color: green;"> <tr> <td> <span>Span</span> <p>Paragraph</p> <div>Div</div> <table style="color:inherit;"> <tr> <td>Table</td> </tr> </table> </td> </tr> </table> </body> </html>

    Read the article

  • RegistryKey ValueCount/SubKeyCount wrong

    - by Mark J Miller
    I am trying to query the following registry key values: HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SharedMemoryOn HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\ProtocolOrder But depending on which machine I'm running the program the query returns null. When I debug on my local machine and I inspect the value for ValueCount for: HKLM\SOFTWARE\Microsoft\MSSQLServer\Client HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib The count is 0 and OpenSubKey returns null. I am a domain admin, in the local administrators group and have added the following to my app.manifest: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> Any idea why? private static void ValidateSqlClientSettings() { Console.WriteLine("\r\n/////////////// LOCAL SQL CLIENT PROTOCOLS ////////////////"); RegistryKey keyHKLM = Registry.LocalMachine; ///TODO: nullreferenceexception - connect to remote machine and find out why RegistryKey sqlClientKey = keyHKLM.OpenSubKey(@"SOFTWARE\Microsoft\MSSQLServer\Client"); if (sqlClientKey == null) { WriteLine2Console(@"WARNING: unable to read registry key '{0}\SOFTWARE\Microsoft\MSSQLServer\Client'", ConsoleColor.Yellow); } var cliKeyNames = from k in sqlClientKey.GetSubKeyNames() where k == "SuperSocketNetLib" select k; ///TODO: find out why these values are always missing (even if I can see them in regedit) Console.Write("Shared Memory Disabled (cliconfg): "); if (Convert.ToBoolean(sqlClientKey.GetValue("SharedMemoryOn"))) WriteLine2Console("FAILED", ConsoleColor.Red); else if(sqlClientKey.GetValue("SharedMemoryOn") == null) WriteLine2Console(String.Format("WARNING - unable to read '{0}\\SharedMemoryOn'", sqlClientKey.Name), ConsoleColor.Yellow); else WriteLine2Console("PASS", ConsoleColor.Green); Console.Write("Client Protocol Order (cliconfg - tcp first): "); foreach (string cliKey in cliKeyNames) { RegistryKey subKey = sqlClientKey.OpenSubKey(cliKey); object order = subKey.GetValue("ProtocolOrder"); if (order != null && order.ToString().StartsWith("tcp") == false) { WriteLine2Console("FAILED", ConsoleColor.Red); } else if (order == null) { WriteLine2Console(String.Format("WARNING - unable to read '{0}\\ProtocolOrder'", subKey.Name), ConsoleColor.Yellow); } else { WriteLine2Console("PASS", ConsoleColor.Green); } subKey.Close(); } sqlClientKey.Close(); keyHKLM.Close(); }

    Read the article

  • TeamCity and pending Git merge branch commit keeps build with failed tests

    - by Vladimir
    We use TeamCity for continuous integration and Git for source control. Generally it works pretty well - convenient, modern and good us quick feedback when tests fails. There is a strange behavior related to Git merge specifics. Here are steps of the case: First developer pulls from master repo. Second developer pulls from master repo. First developer makes commit A locally. Second developer makes commit B locally; Second developer pushes commit B. First developer want to push commit A but unable because he have to pull commit B first. First developer pull's from remote reposity. First developer pushes commit A and generated merge branch commit. The history of commits in master repo is following: B second developer A first developer merge branch first developer. Now let's assume that Second Developer fixed some failing tests in his commit B. What TeamCity will do is following: Commit B arrives - TeamCity makes build #1 with all tests passed Commit A arrives - TeamCity makes build #2 (without commit B) test bar becomes Red! TeamCity thought that Pending "Merge Branch" commit doesn't contain any changes (any new files) - but it actually does contain the merge of commit B, so the TeamCity don't want to make new build here and make tests green. Here are two problems: 1. In our case we have failed tests returning back in second commit (commit A) 2. TeamCity don't want to make a new build and make tests back green. Does anybody know how to fix both of this problems. I consider some reasonable general approach.

    Read the article

  • Adding S3 metadata using jets3t

    - by billintx
    I'm just starting to use the jets3t API for S3, using version 0.7.2 I can't seem to save metadata with the S3Objects I'm creating. What am I doing wrong? The object is successfully saved when I putObject, but I don't see the metadata after I get the object. S3Service s3Service = new RestS3Service(awsCredentials); S3Bucket bucket = s3Service.getBucket(BUCKET_NAME); String key = "/1783c05a/p1"; String data = "This is test data at key " + key; S3Object object = new S3Object(key,data); object.addMetadata("color", "green"); for (Iterator iterator = object.getMetadataMap().keySet() .iterator(); iterator.hasNext();) { String type = (String) iterator.next(); System.out.println(type + "==" + object.getMetadataMap().get(type)); } s3Service.putObject(bucket, object); S3Object retreivedObject = s3Service.getObject(bucket, key); for (Iterator iterator = object.getMetadataMap().keySet() .iterator(); iterator.hasNext();) { String type = (String) iterator.next(); System.out.println(type + "==" + object.getMetadataMap().get(type)); } Here's the output before putObject Content-Length==37 color==green Content-MD5==AOdkk23V6k+rLEV03171UA== Content-Type==text/plain; charset=utf-8 md5-hash==00e764936dd5ea4fab2c4574df5ef550 Here's the output after putObject/getObject Content-Length==37 ETag=="00e764936dd5ea4fab2c4574df5ef550" request-id==9ED1633672C0BAE9 Date==Wed Mar 24 09:51:44 CDT 2010 Content-MD5==AOdkk23V6k+rLEV03171UA== Content-Type==text/plain; charset=utf-8

    Read the article

  • Latex renewcommand not working properly

    - by Nazgulled
    Why is this not working: \documentclass[a4paper,10pt]{article} \usepackage{a4wide} \usepackage[T1]{fontenc} \usepackage[portuguese]{babel} \usepackage[latin1]{inputenc} \usepackage{indentfirst} \usepackage{listings} \usepackage{fancyhdr} \usepackage{url} \usepackage[compat2,a4paper,left=25mm,right=25mm,bottom=15mm,top=20mm]{geometry} \usepackage{color} \usepackage[colorlinks]{hyperref} \usepackage[pdftex]{graphicx} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} \pagestyle{fancy} \fancyhead[L]{\small Laboratórios de Informática III} \fancyhead[R]{\small Projecto 1 (Linguagem \textsf{C})} \lstset{ basicstyle=\ttfamily\footnotesize, showstringspaces=false, frame=single, tabsize=4, breaklines=true, } \definecolor{Section1}{rgb}{0.09,0.21,0.36} \definecolor{Section2}{rgb}{0.21,0.37,0.56} \definecolor{Section3}{rgb}{0.30,0.50,0.74} \hypersetup{ bookmarks=false, linkcolor=red, urlcolor=cyan, } \renewcommand{\section}[1]{\texorpdfstring{\color{green}#1}{#1}} \parskip=6pt \begin{document} \begin{titlepage} \begin{center} \includegraphics[width=5cm]{./logo.jpg}\\[1cm] \textsc{\LARGE Universidade do Minho}\\[1cm] \textsc{\large Licenciatura em Engenharia Informática\\Laboratórios de Informática III}\\[1.5cm] \rule{\linewidth}{0.5mm}\\[0.4cm] \huge{\textbf{\textsc{Relatório do Projecto 1 (Linguagem C)}}} \rule{\linewidth}{0.5mm} \vfill \begin{tabular}{c c} \includegraphics[width=3.5cm]{./nuno.jpg} & \includegraphics[width=3.5cm]{./ricardo.jpg} \\ \textsc{\large{Nuno Mendes (51161)}} & \textsc{\large{Ricardo Amaral (48404)}} \\ \end{tabular} \vfill \large{\today} \end{center} \end{titlepage} \tableofcontents \newpage \section{Introdução} Lorem ipsum... \newpage \appendix \section{\color{Section1}Diagrama das Estruturas de Dados} \begin{center} \includegraphics[width=16cm]{./Diagrama.pdf} \end{center} \end{document} ! LaTeX Error: Something's wrong--perhaps a missing \item. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.2 ...rline {1}\color {green}Teste}{3}{section.1} How can I make it work properly?

    Read the article

  • Custom UIButton for Iphone.

    - by Amal
    I have an view in my App which has a number of buttons based on the number of items returned by the server. So if the server returns say 10 items, there should be 10 buttons and clicking on each button should call a different person. For the above purpose I created a custom button class deriving from UIButton. @implementation HopitalButton @synthesize index; @synthesize button_type; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { UIImage* img = [UIImage imageNamed:@"dr_btn.png"]; [img stretchableImageWithLeftCapWidth:10 topCapHeight:10]; [self setBackgroundImage:img forState:UIControlStateNormal]; [self setTitleColor:[UIColor colorWithRed:0.698 green:0.118 blue:0.376 alpha:1] forState:UIControlStateNormal] ; [self setFont:[UIFont fontWithName:@"Helvetica Bold" size:13]]; self.titleLabel.textColor = [UIColor colorWithRed:178 green:48 blue:95 alpha:1]; self.adjustsImageWhenHighlighted = YES; } return self; } - (void)dealloc { [super dealloc]; } @end Now the problem with the above code is that it does not create buttons that look similar to the buttons created by default in Interface builder. The borders are missing. And I create buttons of the above type by the following code: HopitalButton* hb = [[HopitalButton alloc] init]; hb.button_type = @"call"; hb.frame = CGRectMake(50, 50 + i * 67, 220, 40); [self.scroll_view addSubview:hb]; [hb setTitle:[[[self.office_full_list objectAtIndex:i] objectForKey:@"Staff" ]objectForKey:@"FullName"] forState:UIControlStateNormal]; hb.index = [NSNumber numberWithInt:[self.button_items count]]; [self.button_items insertObject:hb atIndex:[self.button_items count]]; [hb addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; I am not finding a way to set the button type for this custom button. Is there a way i can do it ? Or is there a better way to design the code.

    Read the article

  • How can I generate HTML tables in Perl?

    - by anon
    I need to create a 2 tables in HTML format. Each has 5 rows: 1st Table 1st row has FRUITS in it, occupying all columns 2nd row has January(month), occupying all columns 3rd row has names of some 6 fruits (apple, orange, grapes,...)These names do not change. so this row has 6 columns 4th row has rates for each fruit ( 10,20,30..) so this has 6 columns. 5th row has corresponding message for each fruit showing as Available or not. 2nd Table If it is available the background color for the cell should be green and if not RED. 1st row has VEGETABLES in it, occupying all columns 2nd row has February(month), occupying all columns 3rd row has names of some 6 vegetables (tomato, potato..)These names do not change. so this row has 6 columns 4th row has rates for each vegetable ( 10,20,30..) so this has 6 columns. 5th row has corresponding message for each vegetable showing as Available or not.If it is available the background color for the cell should be green and if not RED. All this data is read from a file having a particular format, it is <name of fruit/vegetable price <available or not The names of fruits and vegetable do not change , it will be same for both the tables. However, it might be possible that data for a particular fruit/vegetable is not present. if it is not present the the column for that should show N/A with white background. I cannot use MIME:Lite for this. Need to use print <<ENDHTML;

    Read the article

  • echo is not working in my php-gdlibrary page

    - by tismon varghese
    Hi, i am trying to create an ellipse using php gd library; also i want to display something under the ellipse. but the usual echo will not work with this. somebody please help me to find the reason and suggest a solution. this is my php code header('Content-type: image/png'); $handle = imagecreate(100, 100); $background = imagecolorallocate($handle, 255, 255, 255); $red = imagecolorallocate($handle, 255, 0, 0); $green = imagecolorallocate($handle, 0, 255, 0); $blue = imagecolorallocate($handle, 0, 0, 255); for ($i = 60; $i > 50; $i--) { imagefilledarc($handle, 50, $i, 100, 50, 0, 90, $darkred, IMG_ARC_PIE); imagefilledarc($handle, 50, $i, 100, 50, 90, 360 , $darkblue, IMG_ARC_PIE); } imagefilledarc($handle, 50, 50, 100, 50, 0, 90, $red, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, 90, 225 , $blue, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, 225, 360 , $green, IMG_ARC_PIE); imagepng($handle); thanks in advance tismon

    Read the article

  • Comparing UIColors or CGColor or CGColorSpace

    - by wiznaibus
    I'm having an issue comparing UIColors. I have an image, which I have successfully extracted the color on the image at which the user clicked. Now I want to compare that color with other colors, but I'm getting some strange results. Here's what I've tried: CGColorRef pixelColor = [[buttonImage colorAtPixel:point] CGColor]; UIColor* color = [UIColor colorWithCGColor:pixelColor]; UIColor* aqua = [UIColor colorWithRed:0.521569 green:0.768627 blue:0.254902 alpha:1]; if (CGColorEqualToColor(color.CGColor, aqua.CGColor)) { DLog(@"Apparently, it works"); } DLog(@"%@", color.CGColor); DLog(@"%@", aqua.CGColor); Output: 2011-05-21 19:48:27.144 Coffee[66860:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d1eb80> [<CGColorSpace 0x4d1a070> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 ) 2011-05-21 19:48:27.145 Coffee[66860:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d1f750> [<CGColorSpace 0x4d1a070> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 ) It looks like the CGColor addresses are different, but the CGColorSpaces are the same, but I can't figure out how to compare the CGColorSpaces I've also tried this: CGColorRef pixelColor = [[buttonImage colorAtPixel:point] CGColor]; UIColor* color = [UIColor colorWithCGColor:pixelColor]; UIColor* aqua = [UIColor colorWithRed:0.521569 green:0.768627 blue:0.254902 alpha:1]; if ([color isEqual:aqua]) { DLog(@"Apparently, it works"); } DLog(@"%@", color.CGColor); DLog(@"%@", aqua.CGColor); The same silliness occurs. 2011-05-21 20:02:49.277 Coffee[67013:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d3b810> [<CGColorSpace 0x5912010> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 ) 2011-05-21 20:02:49.278 Coffee[67013:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d3ba20> [<CGColorSpace 0x5912010> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 )`

    Read the article

  • how to rotate the Circle in DrawRect?

    - by senthilmuthu
    HI, i want to draw a circle in DrawRect through context like pie chart(took from tutorial) thorugh UITouch? i have given the code as follows,how can i rotate ? any help please? define PI 3.14159265358979323846 define snapshot_start 360 define snapshot_finish 360 static inline float radians(double degrees) { return degrees * PI / 180; } - (void)drawRect:(CGRect)rect { // Drawing code CGRect parentViewBounds = self.bounds; CGFloat x = CGRectGetWidth(parentViewBounds)/2; CGFloat y = CGRectGetHeight(parentViewBounds)*0.55; // Get the graphics context and clear it CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextClearRect(ctx, rect); // define stroke color CGContextSetRGBStrokeColor(ctx, 1, 1, 1, 1.0); // define line width CGContextSetLineWidth(ctx, 4.0); // need some values to draw pie charts double snapshotCapacity =20; double rawCapacity = 100; double systemCapacity = 1; int offset = 5; double pie1_start = 315.0; double pie1_finish = snapshotCapacity *360.0/rawCapacity; double system_finish = systemCapacity*360.0/rawCapacity; CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor greenColor] CGColor])); CGContextMoveToPoint(ctx, x+2*offset, y); CGContextAddArc(ctx, x+2*offset, y, 100, radians(snapshot_start), radians(snapshot_start+snapshot_finish), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); // system capacity CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor colorWithRed:15 green:165/255 blue:0 alpha:1 ] CGColor])); CGContextMoveToPoint(ctx, x+offset,y); CGContextAddArc(ctx, x+offset, y, 100, radians(snapshot_start+snapshot_finish+offset), radians(snapshot_start+snapshot_finish+system_finish), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); /* data capacity */ CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor colorWithRed:99/255 green:184/255 blue:255/255 alpha:1 ] CGColor])); CGContextMoveToPoint(ctx, x, y); CGContextAddArc(ctx, x, y, 100, radians(snapshot_start+snapshot_finish+system_finish+offset), radians(snapshot_start), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); }

    Read the article

  • How to mix HTML in Perl

    - by anon
    Hi, I need to create a 2 tables in html format. each has 5 rows. 1st Table *) 1st row has FRUITS in it, occupying all columns *) 2nd row has January(month), occupying all columns *) 3rd row has names of some 6 fruits (apple, orange, grapes,...)These names do not change. so this row has 6 columns *) 4th row has rates for each fruit ( 10,20,30..) so this has 6 columns. *) 5th row has corresponding message for each fruit showing as Available or not. 2nd table If it is available the background color for the cell should be green and if not RED. *) 1st row has VEGETABLES in it, occupying all columns *) 2nd row has February(month), occupying all columns *) 3rd row has names of some 6 vegetables (tomato, potato..)These names do not change. so this row has 6 columns *) 4th row has rates for each vegetable ( 10,20,30..) so this has 6 columns. *) 5th row has corresponding message for each vegetable showing as Available or not.If it is available the background color for the cell should be green and if not RED. All this data is read from a file having a particular format, it is price The names of fruits and vegetable do not change , it will be same for both the tables. However, it might be possible that data for a particular fruit/vegetable is not present. if it is not present the the column for that should show N/A with white background. I cannot use MIME:Lite for this. Need to use print <

    Read the article

  • How do I make the left and right gutters different colors with 960.gs?

    - by Andrew Arrow
    How do I make the left and right gutters different colors with 960.gs? When I try something simple like: <div style="background-color: green"> <div class="container_16"> <div class="grid_16"> test </div> </div> </div> <div style="background-color: cyan"> <div class="container_16"> <div class="grid_16"> test </div> </div> </div> The green and cyan colors are ignored. Seems like the "grid_16" class removes the color for some reason? My goal is being able to have different sections of the page in different colors all the way across the page, even past 960 pixels. So if someone makes their browser 1200px the left and right sides have the right color and the rest of the grid system is all contained within the 960 pixels in the middle. I could add a background color to 'body' to do this for just 1 color, but I want multiple colors in the page. Like different colored horizontal stripes. Thanks.

    Read the article

  • How to get the "real" colors when exporting a GDI drawing to bmp

    - by Rodrigo
    Hi guys I'm developing a ASP.Net web handler that returns images making a in-memory System.Windows.Forms.Control and then exports the rendered control as a bitmap compressed to PNG, using the method DrawToBitmap(). The classes are fully working by now, except for a problem with the color assignment. By example, this is a Gauge generated by the web handler. The colors assigned to the inner parts of the gauge are red (#FF0000), yellow (#FFFF00) and green (#00FF00) but I only get a dully version of each color (#CB100F for red, #CCB70D for yellow and #04D50D for green). The background is a bmp file containing the color gradient. The color loss happens whether the background is a gradient as the sample, a black canvas, a white canvas, a transparent canvas, even when there is not a background set. With black background With transparent background With a white background Without a background set With pixel format in Format32bppArgb I've tried multiple bitmap color deeps, output formats, compression level, etc. but none of them seems to work. Any ideas? This is a excerpt of the source code: Bitmap bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); Image bgimage = (Image) HttpContext.GetGlobalResourceObject("GraphicResources", "GaugeBackgroundImage"); Canvas control_canvas = new Canvas(); .... //the routine that makes the gauge .... control_canvas.DrawToBitmap(bmp, new Rectangle(0, 0, w, h));

    Read the article

  • Graph-structured databases and Php

    - by stagas
    I want to use a graph database using php. Can you point out some resources on where to get started? Is there any example code / tutorial out there? Or are there any other methods of storing data that relate to each other in totally random/abstract situations? - Very abstract example of the relations needed: John relates to Mary, both relate to School, John is Tall, Mary is Short, John has Blue Eyes, Mary has Green Eyes, query I want is which people are related to 'Short people that have Green Eyes and go to School' - answer John - Another example: TrackA -> ArtistA -> ArtistB -> AlbumA -----> [ label ] -> AlbumB -----> [ A ] -> TrackA:Remix -> Genre:House -> [ Album ] -----> [ label ] TrackB -> [ C ] [ B ] Example queries: Which Genre is TrackB closer to? answer: House - because it's related to Album C, which is related to TrackA and is related to Genre:House Get all Genre:House related albums of Label A : result: AlbumA, AlbumB - because they both have TrackA which is related to Genre:House - It is possible in MySQL but it would require a fixed set of attributes/columns for each item and a complex non-flexible query, instead I need every attribute to be an item by itself and instead of 'belonging' to something, to be 'related' to something.

    Read the article

  • ContentControl + RenderTargetBitmap + empty image

    - by Kellls
    Im trying to create some chart images without ever displaying those charts on the screen. I'v been at this for quite a while and tried a lot of different things but nothing seems to work. The code works perfectly if I display the chart in a window first, but if I don't display it in a window, the bitmap is just white with a black border (no idea why). I have tried adding the chart to a border before rendering and giving the border a green borderBrush. In the bitmap, I see the green borderBrush then the black border and white background but no chart. I don't know where the black border is coming from as the chart is not contained in a black border. I have tried adding the chart to a window without calling window.Show() and again just the black boarder and white background. However if I call window.Show() the bitmap contains the chart. I have tried using a drawingVisual as explained here, same result. Here is the code (not including adding the element to a border or window): private static BitmapSource CreateElementScreenshot(FrameworkElement element, int dpi) { if (!element.IsMeasureValid) { Size size = new Size(element.Width, element.Height); element.Measure(size); element.Arrange(new Rect(size)); } element.UpdateLayout(); var scale = dpi/96.0; var renderTargetBitmap = new RenderTargetBitmap ( (int)(scale * element.RenderSize.Width),(int)(scale * element.RenderSize.Height),dpi,dpi,PixelFormats.Default ); // this is waiting for dispatcher to perform measure, arrange and render passes element.Dispatcher.Invoke(((Action)(() => renderTargetBitmap.Render(element))), DispatcherPriority.Render); return renderTargetBitmap; } Note: The chart is a ContentControl. Is there anyway I can get the chart to render without displaying it in a window first?

    Read the article

  • How can Safari be prevented from scrolling an overflow:hidden iframe?

    - by Alexander Ljungberg
    With Safari you can disable most iframe scrolling by setting style="overflow: hidden;" on the iframe. However, if you click in the iframe and move the mouse the content scrolls anyhow. Example: <html> <body> <iframe style="width: 100%; height:100px; overflow: hidden;" scrolling="no" src="scrollcontent.html"> </iframe> </body> </html> scrollcontent.html: <html scroll="no" style="overflow:hidden;"> <body scroll="no" style="overflow:hidden;"> <div style="background-color: green; height:100px;">A</div> <div style="background-color: red; height:100px;">B</div> </body> </html> In this example, the iframe should only show a green area and it should be impossible to reveal the red area. This is mostly true: there is no scrollbar, the mouse wheel doesn't do anything and neither do the arrow keys. However click and drag still scrolls the view. This is particularly noticeable when selecting text. Does anyone know any trick to stop Safari from doing this?

    Read the article

  • Windows Form color changing

    - by Sef
    Hello, So i am attempting to make a MasterMind program as sort of exercise. Field of 40 picture boxes (line of 4, 10 rows) 6 buttons (red, green, orange, yellow, blue, purple) When i press one of these buttons (lets assume the red one) then a picture box turns red. My question is how do i iterate trough all these picture boxes? I can get it to work but only if i write : And this is offcourse no way to write this, would take me countless of lines that contain basicly the same. private void picRood_Click(object sender, EventArgs e) { UpdateDisplay(); pb1.BackColor = System.Drawing.Color.Red; } Press the red button - first picture box turns red Press the blue button - second picture box turns blue Press the orange button - third picture box turns orange And so on... Ive had a previous similar program that simulates a traffic light, there i could assign a value to each color (red 0, orange 1, green 2). Is something similar needed or how exactly do i adress all those picture boxes and make them correspond to the proper button. Best Regards.

    Read the article

  • WPF Style: how to change GradientStop Color in Trigger

    - by Nike
    I have a Button Style: <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Path x:Name="path1" ... Data="...some data..."> <Path.Fill> <LinearGradientBrush EndPoint="0.5,-0.3" StartPoint="0.5,0.8"> <GradientStop x:Name="gs1" Color="Green" Offset="0.44"/> <GradientStop Color="Black" Offset="0.727"/> </LinearGradientBrush> </Path.Fill> </Path> <ContentPresenter ...properties... /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="???" Property="Color" Value="Green"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> I want to change the Color of GradientStop with x:Name="gs1" when mouse is over button, so I use Trigger IsMouseOver. How can i get an access to Color Property in Trigger? I tried TargetName="path1.gs1" but it doesn't work. Any idea?

    Read the article

  • Practices for keeping JavaScript and CSS in sync?

    - by Rene Saarsoo
    I'm working on a large JavaScript-heavy app. Several pieces of JavaScript have some related CSS rules. Our current practice is for each JavaScript file to have an optional related CSS file, like so: MyComponent.js // Adds CSS class "my-comp" to div MyComponent.css // Defines .my-comp { color: green } This way I know that all CSS related to MyComponent.js will be in MyComponent.css. But the thing is, I all too often have very little CSS in those files. And all too often I feel that it's too much effort to create a whole file to just contain few lines of CSS - it would be easier to just hardcode the styles inside JavaScript. But this would be the path to the dark side... Lately I've been thinking of embedding the CSS directly inside JavaScript - so it could still be extracted in the build process and merged into one large CSS file. This way I wouldn't have to create a new file for every little CSS-piece. Additionally when I move/rename/delete the JavaScript file I don't have to additionally move/rename/delete the CSS file. But how to embed CSS inside JavaScript? In most other languages I would just use string, but JavaScript has some issues with multiline strings. The following looks IMHO quite ugly: Page.addCSS("\ .my-comp > p {\ font-weight: bold;\ color: green;\ }\ "); What other practices have you for keeping your JavaScript and CSS in sync?

    Read the article

  • How to sort objects in a many-to-many relationship in ruby on rails?

    - by Kenji Kina
    I've been trying to deal with this problem for a couple of hours now and haven't been able to come up with a clean solution. It seems I'm not too good with rails... Anyway, I have the following: In code: class Article < ActiveRecord::Base has_many :line_aspects, :dependent => :destroy has_many :aspects, :through => :line_aspects #plus a name field end class LineAspect < ActiveRecord::Base belongs_to :article belongs_to :aspect end class Aspect < ActiveRecord::Base belongs_to :data_type has_many :line_aspects has_many :articles, :through => :line_aspects end Now, what I would like to do, is to sort these in two steps. First list of Articles by their Articles.name, and then inside sort them by Aspect.name (note, not the middleman). For instance, alphabetically (sorry if the notation is not correct): [{ article => 'Apple', line_aspects => [ {:value => 'red'}, #corresponding to the Attribute with :name => 'color' {:value => 'small'} #corresponding to the Attribute with :name => 'shape' ] },{ article => 'Watermelon', line_aspects => [ {:value => 'green'}, #corresponding to the Attribute with :name => 'color' {:value => 'big'} #corresponding to the Attribute with :name => 'shape' ] }] Again, note that these are ordered by the aspect name (color before shape) instead of the specific values of each line (red before green). (NOTE: My intention is to displaye these in a table in the view) I have not found a good way to do this in rails yet (without resorting to N queries). Can anyone tell me a good way to do it?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >