Search Results

Search found 4489 results on 180 pages for 'black cobra'.

Page 58/180 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Invert the 1bbp color under a rectangle.

    - by Scott Chamberlain
    I am working with GDI+, the image I am working with is a 1bbp image. What i would like to do is draw a rectangle on the image and everything under that rectangle will be inverted (white pixels will become black and black pixels become white). All of the sample code I have seen is for 8 bit RGB color scale images, and I don't think the techniques they use will work for me. Here is the code I have so far. This is the parent control, one of the Epl2.IDrawableCommand's will be the command that does the inverting. protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Label != null) { using (Bitmap drawnLabel = new Bitmap((int)((float)Label.LabelHeight * _ImageScaleFactor), (int)((float)Label.LableLength *(int) _ImageScaleFactor), System.Drawing.Imaging.PixelFormat.Format1bppIndexed)) { using (Graphics drawBuffer = Graphics.FromImage(drawnLabel)) { drawBuffer.ScaleTransform(_ImageScaleFactor, _ImageScaleFactor); foreach (Epl2.IDrawableCommand cmd in Label.Collection) { cmd.Paint(drawBuffer); } drawBuffer.ResetTransform(); } drawnLabel.RotateFlip(Rotation); pbLabelDrawArea.Size = drawnLabel.Size; using (Graphics drawArea = pbLabelDrawArea.CreateGraphics()) { drawArea.Clear(Color.White); drawArea.DrawImage(drawnLabel, new Point(0, 0)); } } } } What should I put in the Paint(Graphic g) for this command?

    Read the article

  • Update successful notice with pure css and a close button

    - by Crays
    Hi guys, i've seen websites that allow you to say update your profile and when the stuff is done, they'll stay in the same page or redirect you to another and with a fancy notice that says "Update successful. click here to close" with a lowered opacity black background and a box in the middle with the text within. I've got most of the stuff, the lowred opacity black background, the middle box with the text and even the click here to close function. But how i did the "Click here to close" function is by using a link. Let's say after updating the profile, my script redirect me to index.php?update=successful then i use $update = $_GET['update']; if ($update == "successful") { echo '<div id="BlackScreen"><p id="MiddleBox">You\'ve successfully update your status!<br><span class="close"><a class="menu" href="index.php">Click to close. </a></span></div></div>'; } so that the lowered opacity background div will be gone, but is there another way to do this? Any tips please?

    Read the article

  • Synth LaF JLabel DISABLED color

    - by mmoris
    Hi all, Using the Synth LaF, I am unable to set a JLabel's FOREGROUND color for the DISABLED state. has anybody succeeded in doing this? Here is my label's style definition in my LaF.xml file. <style id="whiteLabelStyle"> <opaque value="false"/> <font name="Bitstream Vera Sans" size="16" /> <state> <color type="FOREGROUND" value="WHITE"/> </state> <state value="DISABLED"> <color type="FOREGROUND" value="BLACK"/> </state> </style> <bind style="whiteLabelStyle" type="name" key="WhiteOrbitLabel"/> Please not that all the other styles defined in my LaF.xml file are rendered properly in my application including my label's WHITE normal state color (it just never goes to black when I do lbl.setEnabled(false) Also, going through the Synth code, I have found the following comment in SynthStyle.getColor if ((context.getComponentState() & SynthConstants.DISABLED) != 0) { //This component is disabled, so return the disabled color. //In some cases this means ignoring the color specified by the //developer on the component. In other cases it means using a //specified disabledTextColor, such as on JTextComponents. //For example, JLabel doesn't specify a disabled color that the //developer can set, yet it should have a disabled color to the //text when the label is disabled. This code allows for that. if (c instanceof JTextComponent) { JTextComponent txt = (JTextComponent)c; Color disabledColor = txt.getDisabledTextColor(); if (disabledColor == null || disabledColor instanceof UIResource) { return getColorForState(context, type); } } else if (c instanceof JLabel && (type == ColorType.FOREGROUND || type == ColorType.TEXT_FOREGROUND)){ return getColorForState(context, type); } But I could not figure out how to set a disabled color for a JLabel Thanks for your help!

    Read the article

  • Set a color as transparent in palette-based image

    - by NeDark
    Hello there! I want to convert a alpha transparent png image to palette based png image. In GD I can do it easy: // We have already the image loaded in $source_img $w=200; $h=200; // We supose that img dimensions are 200x200 $img = imagecreatetruecolor($w, $h); // New black image list($r, $g, $b) = array(200, 200, 200); // Some color that doesn't appear in image to avoid conflict $color = imagecolorallocate($img, $r, $g, $b); imagefill($img, 0, 0, $color); // Fill the black image with the chosen color. imagecolortransparent($img, $color); // Set the chosen color as transparent $res = imagecopyresampled($img, $source_img, 0, 0, 0, 0, $w, $h, $w, $h); But in Imagick I don't know how set a color as transparent (imagecolortransparent() in GD). I have spent hours searching on the internet, but the help in the php site isn't very comphrensive and there are many undocumented functions. Thanks.

    Read the article

  • Canvas Check before submission

    - by smokinguns
    I have a page where a user can draw on the canvas and save the image to a file on the server. The canvas has a default black background. Is there a way to check if the user has drawn anything on the canvas before submitting the data URL representation of the image of a canvas with the toDataURL() function? So if the user doesn't draw anything on the canvas(it will be a blank canvas with a black background), the image wont be created on the server. Should I loop through each and every pixel of the canvas to determine this? Here is what I'm doing currently: var currentPixels = context.getImageData(0, 0, 600, 400); for (var y = 0; y < currentPixels.height; y += 1) { for (var x = 0; x < currentPixels.width; x += 1) { for (var c = 0; c < 3; c += 1) { var i = (y*currentPixels.width + x)*4 + c; if(currentPixels.data[i]!=0) break; } } }

    Read the article

  • Truncating a string while storing it in an array in c

    - by Nick
    I am trying to create an array of 20 character strings with a maximum of 17 characters that are obtained from a file named "words.dat". After that the program should truncate the string only showing the first 17 characters and completely ignore the rest of that string. However My question is: I am not quite sure how to accomplish this, can anyone give me some insight on how to accomplish this task? Here is my current code as is: #include <stdio.h> #include <stdlib.h> #define WORDS 20 #define LENGTH 18 char function1(char[WORDS][LENGTH]); int main( void ) { char word_array [WORDS] [LENGTH]; function1(word_array); return ( 0 ) ; } char function1(char word_array[WORDS][LENGTH]) { FILE *wordsfile = fopen("words.dat", "r"); int i = 0; if (wordsfile == NULL) printf("\nwords.dat was not properly opened.\n"); else { for (i = 0; i < WORDS; i++) { fscanf(wordsfile, "%17s", word_array[i]); printf ("%s \n", word_array[i]); } fclose(wordsfile); } return (word_array[WORDS][LENGTH]); } words.dat file: Ninja DragonsFury failninja dragonsrage leagueoflegendssurfgthyjnu white black red green yellow green leagueoflegendssughjkuj dragonsfury Sword sodas tiger snakes Swords Snakes sage Sample output: blahblah@fang:~>a.out Ninja DragonsFury failninja dragonsrage leagueoflegendssu rfgthyjnu white black red green yellow green leagueoflegendssu ghjkuj dragonsfury Sword sodas tiger snakes Swords blahblah@fang:~> What will be accomplished afterwards with this program is: After function1 works properly I will then create a second function name "function2" that will look throughout the array for matching pairs of words that match "EXACTLY" including case . After I will create a third function that displays the 20 character strings from the words.dat file that I previously created and the matching words.

    Read the article

  • Fitting Text into an Image

    - by Abs
    Hello all, I have a function which takes in a font (ttf or otf file) and generates an image of text in different fonts. The problem I have is trying to work out how I can make the text fit in the image regardless of the font-size, type of font, and amount of text. I have tried to make the image rectangle variable so that it contains the text of different fonts without cutting a bit of the text since the image is not long or wide enough. Here is the function that I currently have, I have tried using the number of characters to determine the width of the image, but in some cases for some fonts and sizes, it still gets cut off. function generate_image($save_path, $text, $font_path){ $length = strlen($text) * 15; // Create the image $im = imagecreatetruecolor($length, 40); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $length, 40, $white); $font = $font_path; imagettftext($im, 30, 0, 0, 25, $black, $font, $text); if(imagepng($im, $save_path)){ $status = true; }else{ $status = false; } imagedestroy($im); return $status; } Thank you all for any help

    Read the article

  • View results of affine transform

    - by stckjp
    I am trying to find out the reason why when I apply affine transformations on an image in OpenCV, the result of it is not visible in the preview window, but the entire window is black.How can I find workaround for this problem so that I can always view my transformed image (the result of the affine transform) in the window no matter the applied transformation? Update: I think that this happens because all the transformations are calculated with respect to the origin of the coordinate system (top left corner of the image). While for rotation I can specify the center of the rotation, and I am able to view the result, when I perform scaling I am not able to control where the transformed image goes. Is it possible to somehow move the coordinate system to make the image fit in the window? Update2: I have an image which contains only ROI at some position in it (the rest of the image is black), and I need to apply a set of affine transforms on it. To make things simpler and to see the effect of each individual transform, I applied each transform one by one. What I noticed is that, whenever I move (translate) the image such that the center of the ROI is in the center of the coordinate system (top left corner of the view window), all the affine transforms perform correctly without moving. However, by translating the center of ROI at the center of the coordinate system, the upper and the left part of the ROI remain cut out of the current view window. If I move ROI's central point to another point in the view window (for example the window center), an affine transform of type: A=[a 0 0; 0 b 0] (A is 2x3 matrix, parameter of the warpAffine function) moves the image (ROI), outside of the view window (which doesn't happen if the ROI's center is in the top-left corner). How can I modify the affine transform so the image doesn't move out of its place (behaves the same way as when the ROI center is in the center of the coordinate system)?

    Read the article

  • How to make Chrome obey this rule?

    - by George Edison
    Here is the code: <table style='margin-left: auto; margin-right: auto; text-align: right;'> <tr> <td style='vertical-align: top;'>Title:</td> <td style='width: 400px;'><input type='text' style='border: 1px solid black; width: 100%;' /> </tr> <tr> <td style='vertical-align: top;'>Content:</td> <td><textarea style='border: 1px solid black; width: 100%;' rows='7'></textarea></td> </tr> </table> Here is what it looks like in Opera and FireFox (in Linux): But then in Chrome (also in Linux): As you can see, the first text box is not the right width :( How can I fix this?

    Read the article

  • php, image dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • Image generated with PHP dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • How to handle window closed in the middle of a long running operation gracefully?

    - by Marek
    We have the following method called directly from the UI thread: void DoLengthyProcessing() { DoStuff(); var items = DoMoreStuff(); //do even more stuff - 200 lines of code trimmed this.someControl.PrepareForBigThing(); //someControl is a big user control //additional 100 lines of code that access this.someControl this.someControl.Finish(items); } Many of the called methods call Application.DoEvents() (and they do so many times) (do not ask me why, this is black magic written by black magic programmers and it can not be changed because everyone is scared what the impact would be) and there is also an operation running on a background thread involved in the processing. As a result, the window is not fully nonresponsive and can be closed manually during the processing. The Dispose method of the form "releases" the someControl variable by setting it to null. As a result, in case the user closes the window during the lengthy process, a null reference exception is thrown. How to handle this gracefully without just catching and logging the exception caused by disposal? Assigning the someControl instance to a temporary variable in the beginning of the method - but the control contains many subcontrols with similar disposal scheme - sets them to null and this causes null reference exceptions in other place put if (this.IsDisposed) return; calls before every access of the someControl variable. - making the already nasty long method even longer and unreadable. in Closing event, just indicate that we should close and only hide the window. Dispose it at the end of the lengthy operation. This is not very viable because there are many other methods involved (think 20K LOC for a single control) that would need to handle this mechanism as well. How to most effectively handle window disposal (by user action) in the middle of this kind of processing?

    Read the article

  • Margically appearing margin in footer. Could use some fresh eye's on this.

    - by Banderdash
    Hi chaps! Got a nearly finished coded comp here: http://clients.pixelbleed.net/biodesign/ I realize it's not completely valid, what with my nesting of li's and ul's within A tags. Unfortunately that's the way it has to be. My issue is with the very bottom of the footer. It has a space showing the body's background color beneath it. Tried a number of things and this space after the black link bar on the very bottom is a resistant little bugger. Ideally the black box on the bottom should rest against the very base of the view-port, at least when the content is sufficiently long--which it is in this case. If someone would like to take a quick peak at my source and give me some ideas I'd be very grateful. The CSS can be found here: http://clients.pixelbleed.net/biodesign/css/core.css And, yes, I've tried removing the height:100%. Makes no difference it seems. I do believe the issue to be with the footer, as when I remove these Div's the content rests as it should. Just don't see anything in my CSS to cause the margin/spacing issue though. Thanks so much.

    Read the article

  • In SVG is there a way to grab a shape anywhere when it has fill = "none"

    - by Shaunwithanau
    I have a series of shapes that I want the user to be able click anywhere on the shape to pick up as part of a drag and drop feature. All of these shapes are bounded by a rectangle. For example: <g id="shape1" fill="none" stroke="black"> <rect x="0" y="0" width="100" height="100"/> <circle cx="50" cy="50" r="50"/> </g> <g id="shape2" fill="none" stroke="black"> <rect x="0" y="0" width="100" height="100"/> <line x1="0" y1="0" x2="50" y2="100"/> <line x1="100" y1="0" x2="50" y2="100"/> </g> I already have all of the drag and drop parts working, the problem is all of these shapes have to have fill="none" so you can see anything that may be underneath of them. This means that even though they are bounded by the rectangle, at the moment users have to physically click on one of the lines in order to pick it up instead of being able to click anywhere on the shape like I want. My original idea was to use fill="white" and then set opacity="0" or some really low value but this applies to the stroke as well so this didn't work out. Any ideas on how I can get this working?

    Read the article

  • JSF myfaces dataTable , how to avoid NBSP; tags in the TDs

    - by Peter
    Hi, I have style applied to the TD elements of the dataTable of my myfaces application. td.financialReportTd { font-family: Arial; font-size: 12px; line-height: 12px; color:black; background-color: white; padding-right: 5px; text-align: right; border:0px black solid; height: 30px; padding-top:4px; padding-left:4px; vertical-align: top; direction: rtl; } Output: <td class="financialReportTd"> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;MY TEXT </td> No matter what I try, those NBSP tags fill up the TD and position of the text changes to the worse. I tried style text-align:right; (I need RTL text), I tried direction: rtl; Nothing helps. How can I align my text to the very right of the TD and avoid those space tags?

    Read the article

  • HTML5 Video Element on iPad doesn't fire onclick?

    - by bhups
    I am using the video element in my HTML as following:<div id="container" style="background:black; overflow:hidden;width:320px;height:240px" <video style="background:black;display:block" id="vdo" height="240px" width="320px" src="http://mydomain/vid.mp4"</video</div And in javascript I am doing this:var video=document.getElementById('vdo'); var container=document.getElementById('container'); video.addEventListener('click', function(e) { e.preventDefault(); console.log("clicked"); }, false); container.addEventListener('click', function(e) { e.preventDefault(); console.log("clicked"); }, false); On desktop safari/chrome everything is working fine. I can see two "clicked" in the console. But on ipad there is nothing. First I tried with iOS versin 3.2, then I updated it to the latest one 4.2.1 without any success.I found a similar question HTML5 Video Element on iPad doesn't fire onclick or touchstart events? where it suggests not to use controls in video tag and I am not using it.

    Read the article

  • Nested functions not allowed in drawrect problem

    - by Martin
    I have a custom view onto which I draw some graphics from the drawrect function, which works fine. However I like to draw based on the contens of an array I pass on the the view just before I do a setNeedsDisplay. In the drawRect function I try to access the array but then I get a nested functions error which I do not understand. Here's my code: // // MyView.h // window // #import <UIKit/UIKit.h> @interface MyView : UIView { NSArray * nary; } @property (nonatomic, copy) NSArray *nary; @end // // MyView.m // window // #import "MyView.h" @implementation MyView @synthesize nary; CGContextRef c; CGFloat black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { c = UIGraphicsGetCurrentContext(); CGContextSetStrokeColor(c, black); NSLog(@"mview"); NSArray *ns = [nary objectAtIndex:0]; } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • Problem with derived ControlTemplates in WPF

    - by Frank Fella
    The following xaml code works: <Window x:Class="DerivedTemplateBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DerivedTemplateBug" Title="Window1" Height="300" Width="300"> <Button> <Button.Template> <ControlTemplate> <Border BorderBrush="Black" BorderThickness="2"> <TextBlock>Testing!</TextBlock> </Border> </ControlTemplate> </Button.Template> </Button> </Window> Now, if you define the following data template: using System.Windows.Controls; namespace DerivedTemplateBug { public class DerivedTemplate : ControlTemplate { } } And then swap the ControlTemplate for the derived class: <Window x:Class="DerivedTemplateBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DerivedTemplateBug" Title="Window1" Height="300" Width="300"> <Button> <Button.Template> <local:DerivedTemplate> <Border BorderBrush="Black" BorderThickness="2"> <TextBlock>Testing!</TextBlock> </Border> </local:DerivedTemplate> </Button.Template> </Button> </Window> You get the following error: Invalid ContentPropertyAttribute on type 'DerivedTemplateBug.DerivedTemplate', property 'Content' not found. Can anyone tell me why this is the case?

    Read the article

  • A rectangle drawn with DrawingContext.DrawRectangle blocks mouse

    - by dharmatech
    The WPF program below puts up a window which looks like this: Mouse-movement outside the black square causes the window title to be updated with the mouse's position. The updating stops when the mouse enters the square. I'd like for MouseMove to continue to trigger even when the mouse is over the square. Is there a way to do this? using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Wpf_Particle_Demo { class DrawingVisualElement : FrameworkElement { public DrawingVisual visual; public DrawingVisualElement() { visual = new DrawingVisual(); } protected override int VisualChildrenCount { get { return 1; } } protected override Visual GetVisualChild(int index) { return visual; } } public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var canvas = new Canvas(); Content = canvas; var element = new DrawingVisualElement(); canvas.Children.Add(element); CompositionTarget.Rendering += (s, e) => { using (var dc = element.visual.RenderOpen()) dc.DrawRectangle(Brushes.Black, null, new Rect(0, 0, 50, 50)); }; MouseMove += (s, e) => Title = e.GetPosition(canvas).ToString(); } } }

    Read the article

  • UIWebView autosize issue only on iOS 4.3

    - by troop231
    I am trying to figure out how to fix this bug that only occurs on iOS 4.3. When the application launches, it displays a PDF that is scaled to fit in the UIWebView. It behaves perfectly until you pinch to zoom on the document, and then rotate it, leaving behind a black area. If you don't pinch to zoom, it doesn't leave the black area. I don't understand why this is a iOS 4.3 only issue. Screenshot of the issue: I've been trying to solve this problem awhile now, and would greatly appreciate your help. Thank you. Screenshots of the .xib settings: The code I'm using is: .h: #import <UIKit/UIKit.h> @interface ViewController : UIViewController { UIWebView *webView; } @property (nonatomic) IBOutlet UIWebView *webView; @end .m: #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize webView; - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { return YES; } else { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } } - (void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]; NSURL *url = [NSURL fileURLWithPath:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end

    Read the article

  • Connect 4 C# (How to draw the grid)

    - by Matt Wilde
    I've worked out most of the code and have several game classes. The one bit I'm stuck on at the moment, it how to draw the actual Connect 4 grid. Can anyone tell me what's wrong with this for loop? I get no errors but the grid doesn't appear. I'm using C#. private void Drawgrid() { Brush b = Brushes.Black; Pen p = Pens.Black; for (int xCoor = XStart, col = 0; xCoor < XStart + ColMax * DiscSpace; xCoor += DiscSpace, col++) // x coordinate beginning; while the x coordinate is smaller than the max column size, times it by // the space between each disc and then add the x coord to the disc space in order to create a new circle. for (int yCoor = YStart, row = RowMax - 1; yCoor < YStart + RowMax * DiscScale; yCoor += DiscScale, row--) { switch (Grid.State[row, col]) { case GameGrid.Gridvalues.Red: b = Brushes.Red; break; case GameGrid.Gridvalues.Yellow: b = Brushes.Yellow; break; case GameGrid.Gridvalues.None: b = Brushes.Aqua; break; } MainDisplay.DrawEllipse(p, xCoor, yCoor, 50, 50); MainDisplay.FillEllipse(b, xCoor, yCoor, 50, 50); } Invalidate(); } Thanks.

    Read the article

  • Choropleth mapping issue in R

    - by chasec
    I am trying to follow the tutorial described here: http://www.thisisthegreenroom.com/2009/choropleths-in-r/ The below code executes, but it is either not matching my dataset with the maps_counties data properly, or it isn't plotting it in the order I would expect. For example, the resulting areas for the greater NYC area show no density while random counties in PA show the highest density. The general format of my data table is: county state count fairfield connecticut 17 hartford connecticut 6 litchfield connecticut 3 new haven connecticut 12 ... ... westchester new york 70 yates new york 1 luzerne pennsylvania 1 Note this data is in order by state and then county and includes data for CT, NJ, NY, & PA. First, I read in my data set: library(maps) library(RColorBrewer) d <- read.table("gissum.txt", sep="\t", header=TRUE) #Concatenate state and county info to match maps library d$stcon <- paste(d$state, d$county, sep=",") #Color bins colors = brewer.pal(5, "PuBu") d$colorBuckets <- as.factor(as.numeric(cut(d$count,c(0,10,20,30,40,50,300)))) Here is my matching mapnames <- map("county",plot=FALSE)[4]$names colorsmatched <- d$colorBuckets [na.omit(match(mapnames ,d$stcon))] Plotting: map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = colors[d$colorBuckets[na.omit(match(mapnames ,d$stcon))]] ,fill = TRUE ,resolution = 0 ,lty = 0 ,lwd= 0.5 ) map("state" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE ,lty=1 ,lwd=2 ) map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE , lty=1 , lwd=.5 ) title(main="Respondent Home ZIP Codes by County") I am sure I am missing something basic re: the order in which the maps function plots items - but I can't seem to figure it out. Thanks for the help. Please let me know if you need any more information.

    Read the article

  • ListSelector applies to the entire list

    - by jax
    I have a simple list with a listselector like so. <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/round" android:listSelector="#99000000" android:clickable="true" android:cacheColorHint="#00000000" android:background="#00000000"> </ListView> As you can see android:listSelector="#99000000" but the "black alpha" color is applied to the entire list, not the selected item. So this is what I have now but the entire list still turns black ::listview_background.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:drawable="@drawable/list_normal" /> <item android:state_pressed="true" android:drawable="@drawable/list_pressed" /> <item android:state_focused="true" android:drawable="@drawable/list_active" /> </selector> ::colors.xml <resources> <drawable name="list_normal">#96FFFFFF</drawable> <drawable name="list_active">#66000000</drawable> <drawable name="list_pressed">#CA000000</drawable> </resources> ::the xml tag in my list android:listSelector="@drawable/listview_background"

    Read the article

  • php | Multidimensional array sorting

    - by user889349
    I have an array and need to be sorted (based on id): Array ( [0] => Array ( [qty] => 1 [id] => 3 [name] => Name1 [sku] => Model 1 [options] => [price] => 100.00 ) [1] => Array ( [qty] => 2 [id] => 1 [name] => Name2 [sku] => Model 1 [options] => Color: <em>Black (+10$)</em>. Memory: <em>32GB (+99$)</em>. [price] => 209.00 ) ) Is it possible to sort my array to get output (id based)? Array ( [0] => Array ( [qty] => 2 [id] => 1 [name] => Name2 [sku] => Model 1 [options] => Color: <em>Black (+10$)</em>. Memory: <em>32GB (+99$)</em>. [price] => 209.00 ) [1] => Array ( [qty] => 1 [id] => 3 [name] => Name1 [sku] => Model 1 [options] => [price] => 100.00 ) ) Thanks!

    Read the article

  • Is there a way to capture a bitmap from a WPF window using native C++?

    - by Mike Caron
    Imagine a document window in a MDI application which contains a child WPF window, say a sidebar for example. How can one get a bitmap containing both the WPF pixels AND the GDI (non-wpf) pixels? I've discovered that when making my thumbnail preview for the Win7 taskbar app icon hover, I get black in the parts of the preview where the WPF pixels should be. My current method simply grabs a bitmap capture of the document window. Then I get a DC for the preview, make a memory DC from it and select my bitmap into it. Then I do some size adjustments and bitblt the memory dc to the real dc. I'm guessing that the BitBlt operation doesn't take into account the fact that the WPF pixels are hardware accelerated and therefore need to be grabbed from the graphics hardware. All the stuff in GDI is managed just fine, though and when there's no WPF child windows, the preview image looks fine. I'm wondering if it's at all possible to grab a bitmap of the WPF window from native C++. Then I can blt that onto the black area of the previous preview.

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >