Search Results

Search found 2828 results on 114 pages for 'blue rose'.

Page 38/114 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • PHP Function needed for GENERIC sorting of a recordset array

    - by donbriggs
    Somebody must have come up with a solution for this by now. I wrote a PHP class to display a recordset as an HTML table/datagrid, and I wish to expand it so that we can sort the datagrid by whichever column the user selects. In the below example data, we may need to sort the recordset array by Name, Shirt, Assign, or Age fields. I will take care of the display part, I just need help with sorting the data array. As usual, I query a database to get a result, iterate throught he result, and put the records into an assciateiave array. So, we end up with an array of arrays. (See below.) I need to be able to sort by any column in the dataset. However, I will not know the column names at design time, nor will I know if the colums will be string or numeric values. I have seen a ton of solutions to this, but I have not seen a GOOD and GENERIC solution Can somebody please suggest a way that I can sort the recordset array that is GENERIC, and will work on any recordset? Again, I will not know the fields names or datatypes at design time. The array presented below is ONLY an example. Array ( [0] = Array ( [name] = Kirk [shrit] = Gold [assign] = Bridge ) [1] => Array ( [name] => Spock [shrit] => Blue [assign] => Bridge ) [2] => Array ( [name] => Uhura [shrit] => Red [assign] => Bridge ) [3] => Array ( [name] => Scotty [shrit] => Red [assign] => Engineering ) [4] => Array ( [name] => McCoy [shrit] => Blue [assign] => Sick Bay ) )

    Read the article

  • Problem in setting backgound color to my TreeCellRenderer

    - by Sunil Kumar Sahoo
    Hi I have cretaed my own renderer. I want the back ground should be blue. I have set background color as blue also. But I donot know what is tha problem that the background color of my renderer always seems to be white. I have post the code. please help where I am wrong so that the background color becomes white. class CheckTreeCellRenderer extends JPanel implements TreeCellRenderer { private CheckTreeSelectionModel selectionModel; private MyRenderer delegate; private TristateCheckBox checkBox = new TristateCheckBox("", null, true); public static final State NOT_SELECTED = new State(); public static final State SELECTED = new State(); public static final State DONT_CARE = new State(); public CheckTreeCellRenderer(MyRenderer delegate, CheckTreeSelectionModel selectionModel) { this.delegate = delegate; this.selectionModel = selectionModel; setLayout(new BorderLayout()); setOpaque(true); setBackground(new Color(207, 219, 234)); checkBox.setState(Boolean.TRUE); checkBox.setOpaque(true); checkBox.setBackground(new Color(207, 219, 234)); } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component renderer = delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); TreePath path = tree.getPathForRow(row); if (path != null) { if (selectionModel.isPathSelected(path, true)) { checkBox.setState(Boolean.TRUE); } else { checkBox.setState(selectionModel.isPartiallySelected(path) ? null : Boolean.FALSE); } } renderer.setBackground(new Color(207, 219, 234)); tree.setOpaque(true); tree.setBackground(new Color(207, 219, 234)); this.setOpaque(true); this.setBackground(new Color(207, 219, 234)); add(checkBox, BorderLayout.WEST); add(renderer, BorderLayout.CENTER); return this; } }

    Read the article

  • NSTableView selection & highlights

    - by Christian
    I have a NSTableView as a very central part of my Application and want it to integrate more with the rest of it. It has only one column (it's a list) and I draw all Cells (normal NSTextFieldCells) myself. The first problem is the highlighting. I draw the highlight myself and want to get rid of the blue background. I now fill the whole cell with the original background color to hide the blue background, but this looks bad when dragging the cell around. I tried overriding highlight:withFrame:inView: and highlightColorWithFrame:inView: of NSCell but nothing happened. How can I disable automatic highlighting? I also want all rows/cells to be deselected when I click somewhere outside my NSTableView. Since the background / highlight of the selected cell turns gray there must be an event for this, but I can't find it. I let my cells expand on a double click and may need to undo this. So getting rid of the gray highlight is not enough. EDIT: I add a subview to the NSTableView when a cell gets double clicked and then resignFirstResponder of the NSTableView gets called. I tried this: - (BOOL)resignFirstResponder { if (![[self subviews] containsObject:[[self window] firstResponder]]) { [self deselectAll:self]; ... } return YES; } Besides that it's not working I would need to implement this method for all objects in the view hierarchy. Is there an other solution to find out when the first responder leaves a certain view hierarchy?

    Read the article

  • Attributes in XML subtree that belong to the parent

    - by Bart van Heukelom
    Say I have this XML <doc:document> <objects> <circle radius="10" doc:colour="red" /> <circle radius="20" doc:colour="blue" /> </objects> </doc:document> And this is how it is parsed (pseudo code): // class DocumentParser public Document parse(Element edoc) { doc = new Document(); doc.objects = ObjectsParser.parse(edoc.getChild("objects")); for ( ...?... ) { doc.objectColours.put(object, colour); } return doc; } ObjectsParser is responsible for parsing the objects bit, but is not and should not be aware of the existence of documents. However, in Document colours are associated with objects by use of a Map. What kind of pattern would you recommend to give the colour settings back to DocumentParser.parse from ObjectsParser.parse so it can associate it with the objects they belong to in a map? The alternative would be something like this: <doc:document> <objects> <circle id="1938" radius="10" /> <circle id="6398" radius="20" /> </objects> <doc:objectViewSettings> <doc:objectViewSetting object="1938" colour="red" /> <doc:objectViewSetting object="6398" colour="blue" /> </doc:objectViewSettings> </doc:document> Ugly!

    Read the article

  • Why aren't these Canvases rendering?

    - by bpapa
    I'm creating a web app that allows users to enter a number of colors, by specifying RGB values. Upon submission, the user will see a canvas with a solid rectangle drawn in the color chosen. On this page, I have 7 canvases. The first one draws just fine, but none of the rest show up. The browser is Safari. Here's the relevant code: First, the script element in the header, which defines the function I use to draw to the canvas. <script language="JavaScript" TYPE="text/javascript"><!-- function drawCanvas(canvasId, red, green, blue) { var theCanvas = document.getElementById("canvas" + canvasId); var context = theCanvas.getContext("2d"); context.clearRect(0,0,100,100); context.setFillColor(red,green,blue,1.0); context.fillRect(0,0,100,100); } // --> </script> Next, the HTML source, where I have my canvas tags and some embedded Javascript to call my drawCanvas function <canvas id="canvas0" width="100" height="100"> </canvas> <script language="JavaScript" TYPE="text/javascript"><!-- drawCanvas(0,250,0,0); // --> </script> . . //more source . <canvas id="canvas1" width="100" height="100"> </canvas> <script language="JavaScript" TYPE="text/javascript"><!-- drawCanvas(1,4,250,6); // --> </script> Also provided is a screenshot. As you can see, the "red" canvas comes up just fine, but the second one, which should be green, doesn't show up at all. Any ideas?

    Read the article

  • How can i iterate through QListWidget items and work with each item?

    - by Hossein
    In CSharp its as simple as writting : listBox1.Items.Add("Hello"); listBox1.Items.Add("There"); foreach (string item in listBox1.Items ) { MessageBox.Show(item.ToString()); } and i can easily add different objects to a list box and then retrieve them using foreach. I tried the same approach in Qt 4.8.2 but it seems they are different.though they look very similar at first.I found that Qt supports foreach so i went on and tried something like : foreach(QListWidgetItem& item,ui->listWidget->items()) { item.setTextColor(QColor::blue()); } which failed clearly.It says the items() needs a parameter which confuses me.I am trying to iterate through the ListBox itself, so what does this mean? I tried passing the ListBox object as the parameter itself this again failed too: foreach(QListWidgetItem& item,ui->listWidget->items(ui->listWidget)) { item.setTextColor(QColor::blue()); } So here are my questions: How can I iterate through a QListWidget items in Qt? Can i store objects as items in QListWidgets like C#? How can i convert an object in QListWidgets to string(C#s ToString counter part in Qt) ? (suppose i want to use a QMessagBox instead of that setTextColor and want to print out all string items in the QlistWidget.)

    Read the article

  • rotating a circle in UIView?

    - 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

  • Suggestions for a django db structure

    - by rh0dium
    Hi Say I have the unknown number of questions. For example: Is the sky blue [y/n] What date were your born on [date] What is pi [3.14] What is a large integ [100] Now each of these questions poses a different but very type specific answer (boolean, date, float, int). Natively django can happily deal with these in a model. class SkyModel(models.Model): question = models.CharField("Is the sky blue") answer = models.BooleanField(default=False) class BirthModel(models.Model): question = models.CharField("What date were your born on") answer = models.DateTimeField(default=today) class PiModel(models.Model) question = models.CharField("What is pi") answer = models.FloatField() But this has the obvious problem in that each question has a specific model - so if we need to add a question later I have to change the database. Yuck. So now I want to get fancy - How do a set up a model where by the answer type conversion happens automagically? ANSWER_TYPES = ( ('boolean', 'boolean'), ('date', 'date'), ('float', 'float'), ('int', 'int'), ('char', 'char'), ) class Questions(models.model): question = models.CharField(() answer = models.CharField() answer_type = models.CharField(choices = ANSWER_TYPES) default = models.CharField() So in theory this would do the following: When I build up my views I look at the type of answer and ensure that I only put in that value. But when I want to pull that answer back out it will return the data in the format specified by the answer_type. Example 3.14 comes back out as a float not as a str. How can I perform this sort of automagic transformation? Or can someone suggest a better way to do this? Thanks much!!

    Read the article

  • setting write permissions on theme subdirectory?

    - by Scott B
    I've a theme which supports multiple templates, each with a header background image whose color can be set by the site owner via a colorpicker widget in my theme's options panel. This has the effect of opening the background image, recoloring it and resaving it back to the server. I've had zero issues with this routine until recently when a customer installed the theme on a web host whose default read/write permissions are apparently much more restrictive than the norm. In this case, the user was unable to alter the colors of the template images because of the permissions settings. I'm looking for a bit of understanding on what the permissions would need to be (assuming I purposefully set them via script) to allow the logged in wordpress user to write to files under my theme's styles directory. The code I'm using to write to the image file is below... $img = imagecreatefromgif("../wp-content/themes/mytheme/styles/".get_option('my_theme')."/image.gif"); $color = imagecolorallocate($img, $info["red"], $info["green"], $info["blue"]); imagecolorset($img, 0, $info["red"], $info["green"], $info["blue"]); imagegif($img, $path);

    Read the article

  • Using std::ifstream to load in an array of struct data type into a std::vector

    - by Sent1nel
    I am working on a bitmap loader in C++ and when moving from the C style array to the std::vector I have run into an usual problem of which Google does not seem to have the answer. 8 Bit and 4 bit, bitmaps contain a colour palette. The colour palette has blue, green, red and reserved components each 1 byte in size. // Colour palette struct BGRQuad { UInt8 blue; UInt8 green; UInt8 red; UInt8 reserved; }; The problem I am having is when I create a vector of the BGRQuad structure I can no longer use the ifstream read function to load data from the file directly into the BGRQuad vector. // This code throws an assert failure! std::vecotr quads; if (coloursUsed) // colour table available { // read in the colours quads.reserve(coloursUsed); inFile.read( reinterpret_cast(&quads[0]), coloursUsed * sizeof(BGRQuad) ); } Does anyone know how to read directly into the vector without having to create a C array and copy data into the BGRQuad vector?

    Read the article

  • How to sum up a fetched result's number property based on the object's category?

    - by mr_kurrupt
    I have a NSFetchRequest that is returning all my saved objects (call them Items) and storing them in an NSMutableArray. Each of these Items have a category, an amount, and some other properties. My goal is to check the category of each Item and store the sum of the amounts for objects of the same category. So if I had these Items: Red; 10.00 Blue; 20.00 Green; 5.00 Red; 5.00 Green; 15.00 then I would have an array or other type of container than has: Red; 15.00 Blue; 20.00 Green; 20.00 What would be the best way to organize the data in such a manner? I was going to create a object class (call it Totals) that just has the category and amount. As I traverse through the fetch results in a for-loop, add Items with the same category in a Totals object an store them in a NSMutableArray. The problem I ran into with that is that I'm not sure how to check if an array contains a Totals object with a specific property. Specifically, a category that already exists. So if 'Red' exists, add the amount to it, otherwise create a new Totals object with category 'Red' and a the first Item's amount. Thanks.

    Read the article

  • how to display two li in time intervel using jquery

    - by abc
    <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script> <style type="text/css"> body { color:green; } </style> <script type="text/javascript"> $(document).ready(function() { setInterval(findYellow,1000); function findYellow() { $("ul").each(function() { var $this = $(this); if($this.css("color") != "green") { $this.css("color", "green"); $this.text("abcd blue"); } else { $this.css("color", "blue"); $this.text("abcd green"); } }); } }); </script> </head> <body> <ul>This is a sample set <li>1</li> <li>3</li> <li>5</li> <li>7</li> <li>9</li> </ul> </body> </html>

    Read the article

  • I have a fucntion that create histogram of each Bitmap. How can i create another 3 histograms for R.G.B of each Bitmap?

    - by Daniel Lip
    This is the histogram function im using today and if im not worng it's creating an histogram by Gray color. What i want is another fucntion that will return me 3 histograms of each Bitmap: The first histogram will be of the Red color of the bitmap the second for the Green color and the last one for the Blue color. public static long[] GetHistogram(Bitmap b) { long[] myHistogram = new long[256]; BitmapData bmData = null; try { //Lock it fixed with 32bpp bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); int scanline = bmData.Stride; System.IntPtr Scan0 = bmData.Scan0; unsafe { byte* p = (byte*)(void*)Scan0; int nWidth = b.Width; int nHeight = b.Height; for (int y = 0; y < nHeight; y++) { for (int x = 0; x < nWidth; x++) { long Temp = 0; Temp += p[0]; // p[0] - blue, p[1] - green , p[2]-red Temp += p[1]; Temp += p[2]; Temp = (int)Temp / 3; myHistogram[Temp]++; //we do not need to use any offset, we always can increment by pixelsize when //locking in 32bppArgb - mode p += 4; } } } b.UnlockBits(bmData); } catch { try { b.UnlockBits(bmData); } catch { } } return myHistogram; } How may i do it ?

    Read the article

  • Array, change color, as3

    - by pixelGreaser
    Hi Thanks for the help Yesterday, but I have on more question. How can I change color of text on certain words? My animation plays the text animation of THIS SALE IS RED HOT!!! I want RED HOT it to be red. It seems the array can be indexed in such a way to switch the color from Blue to Red. MY BANNER ADD var myArray:Array = ["THIS","SALE","IS","RED HOT!!!",]; var tm:Timer = new Timer(500); tm.addEventListener(TimerEvent.TIMER, countdown); function countdown(event:TimerEvent) { tx.text = myArray[(tm.currentCount-1)%myArray.length]; } tm.start(); tx.textColor = 0x0000FF; Cont...PSEUDO CODE //var myArray:Array = ["This","Sale","is","RED HOT!!!",]; var spliceRedhot = myArray.splice(-1); //trace(myArray[2]); trace(spliceRedhot); function mySplice(e:Event):void{ if (spliceRedhot = 4){ //Make RED HOT!!! red tx.textColor = 0xFF0000; } else{ //Text is Blue again tx.textColor = 0x0000FF; } }

    Read the article

  • Create Clone Without Effecting Results of Original Object

    - by user1655096
    I have a function that when selecting an option, returns results. I want to be able to clone that function and have the ability to return another set of results, without adding the new results to the original object. // shows / hides results based on selection $(".categories-select").live("change" ,function(){ if($(this).val() == 'red'){ $('.red').removeClass('hide'); // toggles red results, sub menus $(this).parent('.controls').find('.sub').removeClass('hide'); } if($(this).val() == 'blue'){ $('.blue').removeClass('hide'); $(this).parent('.controls').find('.sub').addClass('hide'); } if($(this).val() == 'purple'){ $('.purple').removeClass('hide'); $(this).parent('.controls').find('.sub').addClass('hide'); } if($(this).val() == 'orange'){ $('.orange').removeClass('hide'); $(this).parent('.controls').find('.sub').addClass('hide'); } }); // Duplicates category select menu $(".add-color").find(function(){ $(".color-category").clone().removeClass('color-category').appendTo("#we-want-to").find('.sub,').addClass('hide') ; }); $(".add-color-alternate").click(function(){ $(".color-category-alternate").clone().removeClass('color-category-alternate').appendTo("#we-want-to").find('.sub, .results-table').addClass('hide'); });

    Read the article

  • Why the compiler is not compiling a line in C++ Builder?

    - by MLB
    Hi boys: I was programming an application in C++ Builder 6, and I had encountered this rare problem: void RotateDice() { Graphics::TBitmap *MYbitmap = new Graphics::TBitmap(); Randomize(); int rn = random(6) + 1; switch (rn) { case 1: { //... break; } //... Some cases... } ShowDice(); //it's a function to show the dice delete MYbitmap; //the compiler don't get it!!!! } In the line "ShowDice()", the compiler jumps to the final of the RotateDice() method, it doesn't "see" the line "delete MYbitmap". When I compile the program, every compiled line shows a little blue point in its left side, but that line don't show the blue point... it's like the compiler don't "see" the line of code. What's happening with that???? Note: Some days ago, I was writing a program in Delphi and I was advice of that problematic issue. Some like that happened to me in Delphi 7... So, waht the problem with that? I am so sorry about my English. I am from Cuba.

    Read the article

  • Adding a ActionPerformed Array to a String Array

    - by user267490
    Hey, Before you guys ask, yes I've searched online for the answer, but everything I found just leaves a lil confuse and nothing is recent so asking in those forums won't really help. My problems is this: I have an array that holds my name for a menu. String[] fontColor = new String[] {"Red", "Blue", "Green"}; for (int i = 0; i < fontColors.length; i++) { JMenuItem fontC = new JMenuItem(fontColors[i]); fontC.addActionListener(new fontColorAction()); changeFontColor.add(fontC); } Then I have an array that holds my color change in a class called fontColorAction in that class I have another array that does the same thing as my string array except all thats in the statement is textarea.setForeground(colorArr[i]); that will set the setForeground() in order, but now how do I successfully attact the action listner in my class to my menuItems? my class looks like this private class fontColorAction implements ActionListener { Color[] colorArr - new Color[] {"Color.RED","Color.BLUE","Color.GREEN"}; public void actionPerformed(ActionEvent e){ for(i = 0; i < collorArr.length; i++){ textarea.setForeground(colorArr[i]); } } }

    Read the article

  • Handling multiple media queries in Sass with Twitter Bootstrap

    - by Keith
    I have a Sass mixin for my media queries based on Twitter Bootstrap's responsive media queries: @mixin respond-to($media) { @if $media == handhelds { /* Landscape phones and down */ @media (max-width: 480px) { @content; } } @else if $media == small { /* Landscape phone to portrait tablet */ @media (max-width: 767px) {@content; } } @else if $media == medium { /* Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { @content; } } @else if $media == large { /* Large desktop */ @media (min-width: 1200px) { @content; } } @else { @media only screen and (max-width: #{$media}px) { @content; } } } And I call them throughout my SCSS file like so: .link { color:blue; @include respond-to(medium) { color: red; } } However, sometimes I want to style multiple queries with the same styles. Right now I'm doing them like this: .link { color:blue; /* this is fine for handheld and small sizes*/ /*now I want to change the styles that are cascading to medium and large*/ @include respond-to(medium) { color: red; } @include respond-to(large) { color: red; } } but I'm repeating code so I'm wondering if there is a more concise way to write it so I can target multiple queries. Something like this so I don't need to repeat my code (I know this doesn't work): @include respond-to(medium, large) { color: red; } Any suggestions on the best way to handle this?

    Read the article

  • (Android) Why won't invalidate() update my buttons immediately?

    - by frustrated user
    I have read several forums and examples on using invalidate() in order to update views immediately but I still do not understand why what I am doing will not work. The code below uses image buttons defined by "red", "blue", "green", and "yellow". I set a 1 second delay between each time I try and change a button's appearance. Please someone tell me what i'm doing wrong. private void showPattern() { if (correct == true) { for (int k = 0; k < temp_basket.length; k++) { if (temp_basket[k] == 0) { red.setPressed(true); red.invalidate(); final Handler handler = new Handler(); Timer t = new Timer(); t.schedule(new TimerTask() { public void run() { handler.post(new Runnable() { public void run() { red.setPressed(false); red.invalidate(); } }); } }, 1000); There are 3 more or these blocks after this one that are blue, green, and yellow.

    Read the article

  • Java for loop with multiple incrementers

    - by user2517280
    Im writing a program which combines the RGB pixel values for 3 images, e.g. red pixel of image 1, green pixel of image 2 and blue pixel of image 3 and I want to then create a final image of it. Im using the code below, but this seems to be incrementing x2 and x3 whilst x1 is the same, i.e. not giving the right pixel value for same co-ordinate for each image. for (int x = 0; x < image.getWidth(); x++) { for (int x2 = 0; x2 < image2.getWidth(); x2++) { for (int x3 = 0; x3 < image3.getWidth(); x3++) { for (int y = 0; y < image.getHeight(); y++) { for (int y2 = 0; y2 < image2.getHeight(); y2++) { for (int y3 = 0; y3 < image3.getHeight(); y3++) { So I was wondering if anyone can tell me how to iterate through each of the 3 images on the same co-ordinate, so for example read 1, 1 of each image and record the red, green and blue value accordingly. Apologies if it doesnt make complete sense, its a bit hard to explain. I can iterate the values for one image fine but when I add in another, things start to go a bit wrong as obviously its quite a bit more complicated! I was thinking it might be easier to create an array and replace the according values in that just not sure how to do that effectively either. Thanks

    Read the article

  • Polling a web URL until event

    - by Jaxo
    I'm really sorry about the crappy title - if anybody has a better way of wording it, please edit it! I basically need to have a C# application run a function if the output of a URL is a certain value. For example, if the website says blue the background colour will be blue, red to make it red, etc. The problem is I don't want to spam my webserver with checks. The 4 bytes it downloads each time is negligible, but if I were to deploy this type of system on multiple computers, it would get slower and slower and the bandwidth would add up quickly. So my question is: How can my desktop application run a piece of code only when a web URL has a different output without checking each time? I can't use sockets, and any sort of LAN protocol won't end up working. My reasoning behind this potentially nefarious code is to be able to mute computers by updating a file on the website (as you may have seen in my previous question today, sorry!). I'd like it to be rather quick, and not have the refresh time minutes apart, a few seconds at the most would be ideal. How can I accomplish this? The website's code is easy, but getting the C# application to check when it changes is the part I'm stuck on. Nothing shows up on the website other than the command. Thanks!

    Read the article

  • using same ids for many tags?

    - by gaurav rathor
    here is the example code that i was testing and i got confused that every one says that we can use or we should use only one time per id but i have testes using using it multiple times but its giving me the correct output. so what should i do. it is kinda working same like class for me in this example code: <html> <head> <style> #exampleID1 { background-color: blue; } #exampleID2 { text-transform: uppercase; } </style> </head> <body> <p id="exampleID1">This paragraph has an ID name of "exampleID1" and has a blue CSS defined background.</p> <p id="exampleID2">This paragraph has an ID name of "exampleID2" and has had its text transformed to uppercase letters.</p> <address id="exampleID1"> Written by W3Schools.com<br /> <a href="mailto:[email protected]">Email us</a><br /> Address: Box 564, Disneyland<br /> Phone: +12 34 56 78 </address> <blockquote id="exampleID1"> Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation. </blockquote> </body> </html> please see the above code and answer me that why we should not use id selector two times in a page while its working fine.

    Read the article

  • JavaScript: supposed to execute functions sequentially, not actually doing so?

    - by AP257
    I'm seeing a lot of answers on StackOverflow that say that JavaScript executes code sequentially, but I can actually see my own JavaScript not doing so. From the following code: function centre_map(lat, lng, zoom_level) { alert('centre_map'); map = new GMap2(document.getElementById('map_canvas')); var latlng = new GLatLng(lat, lng); map.setCenter(latlng, zoom_level); } function add_markers_within_bounds() { alert('add_markers_within_bounds'); // add numerous BLUE markers within map bounds using MarkerClusterer } function add_marker(lat, lng, place_name, grid, county) { alert('add_marker'); // add one ordinary RED Google Maps marker } centre_map('{{lat}}', '{{lng}}', 12); add_markers_within_bounds('{{grid}}', '{{place_name}}'); add_marker('{{lat}}', '{{lng}}', '{{place_name}}', '{{grid}}', '{{county}}'); I get the following sequence of events: 'centre_map' alert 'add_markers_within_bounds' alert 'add_marker' alert individual RED marker appears on map (i.e. add_marker renders) multiple BLUE markers appear on map (i.e. add_markers_within_bounds renders) Why doesn't add_markers_within_bounds complete before add_marker gets under way: and how can I make it do so? I know that one way might be to call add_marker from within add_markers_within_bounds, but for various reasons I'd rather keep it as a separate function.

    Read the article

  • Usability for notification messages, colors

    - by metrobalderas
    In each app I develop, I like to add three types of messages: Green/blue for success messages Yellow for warnings Red for errors And perhaps, a neutral one for information, which is gray or blue if the success one is green. The success one is used for when an item is created or updated, the yellow one is when there's something wrong, but not we-are-going-to-die wrong and the red one is when something is blocked or we are going to die. However, there's one thing I can't figure out, when I delete an object, what kind of notification should I use? I think the success one is not because it is not expected, altough the deletion was successful, the user tends not to read the message, just to see the color. The red one might be, but it can be misunderstood (I tried to delete it but there was an error), the warning and the information one might be good choices, but I'm not really sure. Also, when you ask for confirmation about deleting something, the 'cancel' button should be green or red? I'm just curious how you guys handle this. Thanks.

    Read the article

  • Using Color.rgb() doesnt work for full 0...255 range

    - by superflyninja
    I'm writing an android game using opengl. I'm using: colour = Color.rgb(theR,theG,theB); (all ints) to store the color of a rectangle. Then I parse out the RGB to render the rectangle: colorR = Color.red(color); colorG = Color.green(color); colorB = Color.blue(color); For example for color 53,130,255 this should result in a blue but on my app it results in a white. If i use 1,1,1 i get white. If i use 0,0,0 i get black. If i use 0,1,0 I get green etc. So it looks like any value over one is treated as 1 and so i am not getting the full 0...255 range. I tried using Color.argb and color = Color.parseColor(theColor) where the Color is a string. I'm using this in an opengles app. I have a class to display a rectangle of color. This definitely works fine as the correct size rectangle is rendered, just not a color using values above 1. I also use textures and everything displays fine. any ideas? thanks a million

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >