Search Results

Search found 942 results on 38 pages for 'yellow'.

Page 3/38 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Duplicating an array of strings.

    - by Jon
    arr = ["red","green","yellow"] arr2 = arr.clone arr2[0].replace("blue") puts arr.inspect puts arr2.inspect produces: ["blue", "green", "yellow"] ["blue", "green", "yellow"] Is there anyway to do a deep copy of an array of strings, other than using Marshal as i understand that is a hack. I could do: arr2 = [] arr.each do |e| arr2 << e.clone end but it doesn't seem very elegant, or efficient. Thanks

    Read the article

  • Creating nested arrays on the fly

    - by adardesign
    I am trying to do is to loop this HTML and get a nested array of this HTML values that i want to grab. It might look complex at first but is a simple question... This script is just part of a Object containing methods. html <div class="configureData"> <div title="Large"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Medium"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Small"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> </div> javascript // this is part of a script..... parseData:function(dH){ dH.find(".configureData div").each(function(indA, eleA){ colorNSize.tempSizeArray[indA] = [eleA.title,[],[],[],[]] $(eleZ).find("a").each(function(indB, eleB){ colorNSize.tempSizeArray[indA][indB+1] = eleC.title }) }) }, I expect the end array should look like this. [ ["large", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ], ["Medium", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ] ] // and so on....

    Read the article

  • Can Drupal terms in different Taxonomies be synonymous?

    - by DKinzer
    Let's say Taxonomy_A is associated to Node_Type_A Taxonomy_B is associated to Node_Type_B. AND Both Taxonomy_A and Taxonomy_B have a term called 'yellow'. Is it possible to make terms 'yellow' synonymous, so that if I'm looking at a list of 'yellow' stuff, I'm seeing content of both types (Node_Type_A, and Node_Type_B)?

    Read the article

  • Change css property in chain - JavaScript

    - by SilverDeveloper
    I'm using MooTools 1.4.5 and I want to change cursor before calling function that takes some time and after finished same function set cursor to default. I was not successful. After that I made simple example to change background color via plain JavaScript (no jQuery or MooTools plugin) and again I was not successful. Here is my code. <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> <script type="text/javascript"> <!-- document.body.style.background = 'red'; setTimeout(function () { }, 1250); document.body.style.background = 'yellow'; //--> </script> </html> First at all I set background color to red, and after delay to yellow. I assumed that the background color will bi set to red and after delay to yellow. It doesn't work. When page is loaded background color is yellow (last line). If I insert alert function in a middle of lines where sets background color everything works fine (background color is red, click to message box, background color is yellow). Why it works so? Only last changing style is affected. I need something like that to change pointer before calling function that takes 10 seconds and setting cursor to default value after function is done.

    Read the article

  • I'm looking for a blend mode that gives 'realistic' paint colors. (Subtractive)

    - by almosnow
    I've been looking for a blend mode to (well ...) blend two RGB pixels in order to build colors in the samw way that a painter builds them (i.e: subtractive). Here are quick examples of the type of results that I'm expecting: CYAN + MAGENTA = BLUE CYAN + YELLOW = GREEN MAGENTA + YELLOW = RED RED + YELLOW = ORANGE RED + BLUE = PURPLE YELLOW + BLUE = GREEN I'm looking for a formula, like: dest_red = first_red + second_red; dest_green = first_green + second_green; dest_blue = first_blue + second_blue; I've tried with the commonly used 'multiply' formula but it doesn't work; I've tried with custom made formulas but I'm still not able to 'crack' how it should work. And I know already a lot of color theory so please refrain from answers like: Check this link: http://the_difference_betweeen_additive_and_subtractive_lightning.html

    Read the article

  • Printer image correction

    - by Matthew Shinal
    Here is my problem: my printer and scanner (HP psc2410xi) prints darker than the photos taken and teh scanner has a background fuzz. I want to create and install files to have the printer lighten the photos it prints (yellow becomes dark yellow, etc) and delete the "fuzz" from the scanner image (you can see it on a blank scan and yes I did clean the scanner). I'm thinking there is a way to take a printed image, scan that in, and subtract the two images from each other to get the correction factor.

    Read the article

  • Photoshop changes colors when moved to a different monitor

    - by Jason
    This Yahoo! answers question pretty much sums up my predicament. Unfortunately I haven't really found an actual answer. Here's a screen shot of what happens when I place Photoshop between my monitors. Imagine that the left side of my laptop is the right square and the yellow is the right side of my monitor. When I move the program to one side fully or the other, it takes on the corresponding color. Obviously the color on the right is correct and Photoshop is changing the color of the image when it moves to my external monitor. Also notice how none of the tools or anything are different colors, just the actual image itself. How do I fix this? EDIT You may also notice that the color palette in the left corner is showing that yellow tinge. I didn't actually pick that yellow color, it's supposed to be showing the grey on the left that I used to fill in the square.

    Read the article

  • Backbone.js Model change events in nested collections not firing as expected

    - by Pallavi Kaushik
    I'm trying to use backbone.js in my first "real" application and I need some help debugging why certain model change events are not firing as I would expect. I have a web service at /employees/{username}/tasks which returns a JSON array of task objects, with each task object nesting a JSON array of subtask objects. For example, [{ "id":45002, "name":"Open Dining Room", "subtasks":[ {"id":1,"status":"YELLOW","name":"Clean all tables"}, {"id":2,"status":"RED","name":"Clean main floor"}, {"id":3,"status":"RED","name":"Stock condiments"}, {"id":4,"status":"YELLOW","name":"Check / replenish trays"} ] },{ "id":47003, "name":"Open Registers", "subtasks":[ {"id":1,"status":"YELLOW","name":"Turn on all terminals"}, {"id":2,"status":"YELLOW","name":"Balance out cash trays"}, {"id":3,"status":"YELLOW","name":"Check in promo codes"}, {"id":4,"status":"YELLOW","name":"Check register promo placards"} ] }] Another web service allows me to change the status of a specific subtask in a specific task, and looks like this: /tasks/45002/subtasks/1/status/red [aside - I intend to change this to a HTTP Post-based service, but the current implementation is easier for debugging] I have the following classes in my JS app: Subtask Model and Subtask Collection var Subtask = Backbone.Model.extend({}); var SubtaskCollection = Backbone.Collection.extend({ model: Subtask }); Task Model with a nested instance of a Subtask Collection var Task = Backbone.Model.extend({ initialize: function() { // each Task has a reference to a collection of Subtasks this.subtasks = new SubtaskCollection(this.get("subtasks")); // status of each Task is based on the status of its Subtasks this.update_status(); }, ... }); var TaskCollection = Backbone.Collection.extend({ model: Task }); Task View to renders the item and listen for change events to the model var TaskView = Backbone.View.extend({ tagName: "li", template: $("#TaskTemplate").template(), initialize: function() { _.bindAll(this, "on_change", "render"); this.model.bind("change", this.on_change); }, ... on_change: function(e) { alert("task model changed!"); } }); When the app launches, I instantiate a TaskCollection (using the data from the first web service listed above), bind a listener for change events to the TaskCollection, and set up a recurring setTimeout to fetch() the TaskCollection instance. ... TASKS = new TaskCollection(); TASKS.url = ".../employees/" + username + "/tasks" TASKS.fetch({ success: function() { APP.renderViews(); } }); TASKS.bind("change", function() { alert("collection changed!"); APP.renderViews(); }); // Poll every 5 seconds to keep the models up-to-date. setInterval(function() { TASKS.fetch(); }, 5000); ... Everything renders as expected the first time. But at this point, I would expect either (or both) a Collection change event or a Model change event to get fired if I change a subtask's status using my second web service, but this does not happen. Funnily, I did get change events to fire if I added one additional level of nesting, with the web service returning a single object that has the Tasks Collection embedded, for example: "employee":"pkaushik", "tasks":[{"id":45002,"subtasks":[{"id":1..... But this seems klugey... and I'm afraid I haven't architected my app right. I'll include more code if it helps, but this question is already rather verbose. Thoughts?

    Read the article

  • How to display same type of data from XML using XSLT

    - by MKS
    Hi Guys, I am using XSLT and XML. I have got below XML. <documentCountryInformation> <countryCode>US</countryCode> <countryName>United States</countryName> <sufficientDocumentation>Conditional</sufficientDocumentation> <sectionInformation> <sectionName>Health</sectionName> <documentParagraph paragraphId="23628"> <paragraphType>Requirement</paragraphType> <paragraphText> <p> Vaccination for <strong>yellow fever</strong> Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days. </p> </paragraphText> </documentParagraph> </sectionInformation> </documentCountryInformation> <documentCountryInformation> <countryCode>IN</countryCode> <countryName>India</countryName> <sufficientDocumentation>Conditional</sufficientDocumentation> <sectionInformation> <sectionName>Health</sectionName> <documentParagraph paragraphId="23648"> <paragraphType>Requirement</paragraphType> <paragraphText> <p> Vaccination for <strong>Dengue fever</strong> Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days. </p> </paragraphText> </documentParagraph> </sectionInformation> </documentCountryInformation> Above is the part of full xml and you can see there are two records of same type, now I have got the <countryName> in parameters of XSLT in above example my countryName parameter will contain this type of data "United States,India", Now I want to split the parameter data and further it will check the XML having same country name and display the data according, I mean there will be loop on country name and below is desired HTML. <div class="resultsContainer" id="divTransit"> <h3>Transit - United States (US)</h3> <p> Vaccination for <strong>yellow fever</strong> Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 6 days. </p> <h3>Transit - India (IN)</h3> <p> Vaccination for <strong>Dengue fever</strong> Persons without valid yellow fever certification, if required, are subject to quarantine for a period up to 3 days. </p> </div>

    Read the article

  • XNA C# How to draw fonts in different color

    - by XNA newbie
    I'm doing a simple chat system with XNA C#. It is a chatbox that contains 5 lines of chat typed by the users. Something like a MMORPG chatting system. [User1name] says: Hi [User2name] says: Hello [User1name] says: What are you doing? [User2name] says: I'm fine [System] The time is now 1:03AM. When the user pressed 'ENTER', the text he entered will be added inside an ArrayList chatList.Add(s); For displaying the text he entered, I used for (int i = 0; i < chatList.Count(); i++) { spriteBatch.DrawString(font, chatList[i], new Vector2(40, arr1[i]), Color.Yellow); } *arr1[i] contains 5 y-axis points to print my 5 line of chats in the chatbox Question1: What if I have another type of message which will be added into ChatList (something like a system message). I need the System Message to be printed out in red color. And if the user keeps on chatting, the chat box will be updated according: (MAX 5 LINES) The newest chat will be shown below, and the oldest one will be deleted if they reached the max 5 lines. [User2name] says: Hello [User1name] says: What are you doing? [User2name] says: I'm fine [System] The time is now 1:03AM. [User1name] says: Ok, great to hear that! I'm having trouble to print each line color according to their msg type. For normal msg, it should be yellow. For system msg, it should be red. Question2: And for the next problem, I need the chat texts to be white color, while the names of the user is yellow (like warcraft3 chat system). How do I do that? I have a hard time thinking of a solution for these to work. Advise needed.

    Read the article

  • WPF Toolkit DataGridCell Style DataTrigger

    - by KrisTrip
    I am trying to change the color of a cell to Yellow if the value has been updated in the DataGrid. My XAML: <toolkit:DataGrid x:Name="TheGrid" ItemsSource="{Binding}" IsReadOnly="False" CanUserAddRows="False" CanUserResizeRows="False" AutoGenerateColumns="False" CanUserSortColumns="False" SelectionUnit="CellOrRowHeader" EnableColumnVirtualization="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <toolkit:DataGrid.CellStyle> <Style TargetType="{x:Type toolkit:DataGridCell}"> <Style.Triggers> <DataTrigger Binding="{Binding IsDirty}" Value="True"> <Setter Property="Background" Value="Yellow"/> </DataTrigger> </Style.Triggers> </Style> </toolkit:DataGrid.CellStyle> </toolkit:DataGrid> The grid is bound to a List of arrays (displaying a table of values kind of like excel would). Each value in the array is a custom object that contains an IsDirty dependency property. The IsDirty property gets set when the value is changed. When i run this: change a value in column 1 = whole row goes yellow change a value in any other column = nothing happens I want only the changed cell to go yellow no matter what column its in. Do you see anything wrong with my XAML?

    Read the article

  • How to convert CMYK to RGB programmatically in indesign.

    - by BBDeveloper
    Hi, I have a CMYK colorspace in indesign, i want to convert that as RGB color space, I got some codes, but I am getting incorrect data. Some of the codes which I tried are given below double cyan = 35.0; double magenta = 29.0; double yellow = 0.0; double black = 16.0; cyan = Math.min(255, cyan + black); //black is from K magenta = Math.min(255, magenta + black); yellow = Math.min(255, yellow + black); l_res[0] = 255 - cyan; l_res[1] = 255 - magenta; l_res[2] = 255 - yellow; @Override public float[] toRGB(float[] p_colorvalue) { float[] l_res = {0,0,0}; if (p_colorvalue.length >= 4) { float l_black = (float)1.0 - p_colorvalue[3]; l_res[0] = l_black * ((float)1.0 - p_colorvalue[0]); l_res[1] = l_black * ((float)1.0 - p_colorvalue[1]); l_res[2] = l_black * ((float)1.0 - p_colorvalue[2]); } return (l_res); } The values are C=35, M = 29, Y = 0, K = 16 in CMYK color space and the correct RGB values are R = 142, G = 148, B = 186. In adobe indesign, using swatches we can change the mode to CMYK or to RGB. But I want to do that programmatically, Can I get any algorithm to convert CMYK to RGB which will give the correct RGB values. And one more question, if the alpha value for RGB is 1 then what will be the alpha value for CMYK? Can anyone help me to solve these issues... Thanks in advance.

    Read the article

  • Background problem on UITableView

    - by f0rz
    Hi ! I have come to a problem, wich I have no idea how to solve. Can anyone think outside the box and point me to right directions? I would be very thankfull ! The problem. I have a UITableView containing a first row wich is always the same (a empty row with repeating background) Next rows are bounch of dynamic data rows. I have set the yellow background on my UITableView in IBuilder, My cells (except first row) have white background with code: UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ]; backgroundView.backgroundColor = [UIColor colorWithRed: 0.96078431372549 green: 0.96078431372549 blue: 0.96078431372549 alpha: 1.0]; cell.backgroundView = backgroundView; for ( UIView* view in cell.contentView.subviews ) { view.backgroundColor = [ UIColor clearColor ]; } The example yellow background, I only want to be showed at the top. As u see img example below. The thing is I dont want to have yellow background under the last datarow, I want to contain same white color I have on the cells. This should be white as the cells. Not yellow. Thank u for your time. Regards

    Read the article

  • Why this class assignment is not working in IE

    - by user550750
    I've wrote this peice of code, this works fine in FF and Chrome but not in IE. Why is it? <html> <header> <style type="text/css"> .red{ color: red; } .green{ color: green; } .yellow{ color: yellow; } </style> </header> <body> <div id="mydiv" style="height: 50px">Some contents</div> <div> <input type="radio" value="1" name="change" onclick="onClick(this)">Red</input> <input type="radio" value="2" name="change" onclick="onClick(this)">Green</input> <input type="radio" value="3" name="change" onclick="onClick(this)">Yellow</input> </div> <script type="text/javascript"> function onClick(el){ var className = ""; if(el.value == 1){ className = "red"; }else if(el.value == 2){ className = "green"; }else if(el.value == 3){ className = "yellow"; } document.getElementById("mydiv").setAttribute("class", className); } </script> </body> </html>

    Read the article

  • CSS - How to create a table cell with a two-colour background?

    - by Chris
    Hi, I'm trying to create an HTML table cell with a two-tone background; so I have normal text on a background which is yellow on the left, and green on the right. The closest I've got so far is as follows. The background is correctly half-and-half, but the content text is displaced below it. <html> <head> <style type='text/css'> td.green { background-color: green; padding: 0px; margin: 0px; height:100%; text-align:center } div.yellow { position:relative; width: 50%; height: 100%; background-color:yellow } </style> </head> <body style="width: 100%"> <table style="width: 25%"> <tr style="padding: 0px; margin: 0px"> <td class="green"> <div class="yellow"></div> <div class="content">Hello</div> </td> </tr> </table> </body> </html> How can I fix this up?

    Read the article

  • Bouncing off a circular Boundary with multiple balls?

    - by Anarkie
    I am making a game like this : Yellow Smiley has to escape from red smileys, when yellow smiley hits the boundary game is over, when red smileys hit the boundary they should bounce back with the same angle they came, like shown below: Every 10 seconds a new red smiley comes in the big circle, when red smiley hits yellow, game is over, speed and starting angle of red smileys should be random. I control the yellow smiley with arrow keys. The biggest problem I have reflecting the red smileys from the boundary with the angle they came. I don't know how I can give a starting angle to a red smiley and bouncing it with the angle it came. I would be glad for any tips! My js source code : var canvas = document.getElementById("mycanvas"); var ctx = canvas.getContext("2d"); // Object containing some global Smiley properties. var SmileyApp = { radius: 15, xspeed: 0, yspeed: 0, xpos:200, // x-position of smiley ypos: 200 // y-position of smiley }; var SmileyRed = { radius: 15, xspeed: 0, yspeed: 0, xpos:350, // x-position of smiley ypos: 65 // y-position of smiley }; var SmileyReds = new Array(); for (var i=0; i<5; i++){ SmileyReds[i] = { radius: 15, xspeed: 0, yspeed: 0, xpos:350, // x-position of smiley ypos: 67 // y-position of smiley }; SmileyReds[i].xspeed = Math.floor((Math.random()*50)+1); SmileyReds[i].yspeed = Math.floor((Math.random()*50)+1); } function drawBigCircle() { var centerX = canvas.width / 2; var centerY = canvas.height / 2; var radiusBig = 300; ctx.beginPath(); ctx.arc(centerX, centerY, radiusBig, 0, 2 * Math.PI, false); // context.fillStyle = 'green'; // context.fill(); ctx.lineWidth = 5; // context.strokeStyle = '#003300'; // green ctx.stroke(); } function lineDistance( positionx, positiony ) { var xs = 0; var ys = 0; xs = positionx - 350; xs = xs * xs; ys = positiony - 350; ys = ys * ys; return Math.sqrt( xs + ys ); } function drawSmiley(x,y,r) { // outer border ctx.lineWidth = 3; ctx.beginPath(); ctx.arc(x,y,r, 0, 2*Math.PI); //red ctx.fillStyle="rgba(255,0,0, 0.5)"; ctx.fillStyle="rgba(255,255,0, 0.5)"; ctx.fill(); ctx.stroke(); // mouth ctx.beginPath(); ctx.moveTo(x+0.7*r, y); ctx.arc(x,y,0.7*r, 0, Math.PI, false); // eyes var reye = r/10; var f = 0.4; ctx.moveTo(x+f*r, y-f*r); ctx.arc(x+f*r-reye, y-f*r, reye, 0, 2*Math.PI); ctx.moveTo(x-f*r, y-f*r); ctx.arc(x-f*r+reye, y-f*r, reye, -Math.PI, Math.PI); // nose ctx.moveTo(x,y); ctx.lineTo(x, y-r/2); ctx.lineWidth = 1; ctx.stroke(); } function drawSmileyRed(x,y,r) { // outer border ctx.lineWidth = 3; ctx.beginPath(); ctx.arc(x,y,r, 0, 2*Math.PI); //red ctx.fillStyle="rgba(255,0,0, 0.5)"; //yellow ctx.fillStyle="rgba(255,255,0, 0.5)"; ctx.fill(); ctx.stroke(); // mouth ctx.beginPath(); ctx.moveTo(x+0.4*r, y+10); ctx.arc(x,y+10,0.4*r, 0, Math.PI, true); // eyes var reye = r/10; var f = 0.4; ctx.moveTo(x+f*r, y-f*r); ctx.arc(x+f*r-reye, y-f*r, reye, 0, 2*Math.PI); ctx.moveTo(x-f*r, y-f*r); ctx.arc(x-f*r+reye, y-f*r, reye, -Math.PI, Math.PI); // nose ctx.moveTo(x,y); ctx.lineTo(x, y-r/2); ctx.lineWidth = 1; ctx.stroke(); } // --- Animation of smiley moving with constant speed and bounce back at edges of canvas --- var tprev = 0; // this is used to calculate the time step between two successive calls of run function run(t) { requestAnimationFrame(run); if (t === undefined) { t=0; } var h = t - tprev; // time step tprev = t; SmileyApp.xpos += SmileyApp.xspeed * h/1000; // update position according to constant speed SmileyApp.ypos += SmileyApp.yspeed * h/1000; // update position according to constant speed for (var i=0; i<SmileyReds.length; i++){ SmileyReds[i].xpos += SmileyReds[i].xspeed * h/1000; // update position according to constant speed SmileyReds[i].ypos += SmileyReds[i].yspeed * h/1000; // update position according to constant speed } // change speed direction if smiley hits canvas edges if (lineDistance(SmileyApp.xpos, SmileyApp.ypos) + SmileyApp.radius > 300) { alert("Game Over"); } // redraw smiley at new position ctx.clearRect(0,0,canvas.height, canvas.width); drawBigCircle(); drawSmiley(SmileyApp.xpos, SmileyApp.ypos, SmileyApp.radius); for (var i=0; i<SmileyReds.length; i++){ drawSmileyRed(SmileyReds[i].xpos, SmileyReds[i].ypos, SmileyReds[i].radius); } } // uncomment these two lines to get every going // SmileyApp.speed = 100; run(); // --- Control smiley motion with left/right arrow keys function arrowkeyCB(event) { event.preventDefault(); if (event.keyCode === 37) { // left arrow SmileyApp.xspeed = -100; SmileyApp.yspeed = 0; } else if (event.keyCode === 39) { // right arrow SmileyApp.xspeed = 100; SmileyApp.yspeed = 0; } else if (event.keyCode === 38) { // up arrow SmileyApp.yspeed = -100; SmileyApp.xspeed = 0; } else if (event.keyCode === 40) { // right arrow SmileyApp.yspeed = 100; SmileyApp.xspeed = 0; } } document.addEventListener('keydown', arrowkeyCB, true); JSFiddle : http://jsfiddle.net/gj4Q7/

    Read the article

  • good way of changing all pixels of one particular color to another particular color in a jpeg/png?

    - by gojira666
    I have an image which looks like this: http://img21.imageshack.us/i/64054053.jpg/ However the yellow line needs to be red and the cyan line needs to be green. I have MS Paint and IrfanView. How can I change the colors of the yellow and cyan line without individually selecting all pixels manually? I.e. what is a good way of changing all pixels of one color to another color?

    Read the article

  • Can the users can apply Windows update without local administrator rights?

    - by AAA-Super
    My users are running on windows XP 32bit. normally WSUS automatically download and notify them to select which update want to install in the past they were in local administrator rights,now I reduce them to user rights so now they can't see the yellow notification said updated are available. Is there a way to give users permission to see the yellow notification and they can select updates by hand without local admin rights or power users? Any advice would be appreciated Thanks

    Read the article

  • Sort each standalone line alphabetically

    - by Daniel
    I want to sort some items in alphabetic order, but in a very specifc way. I have, for example, the following list, each item separated by comma: monkeys, dogs, cats pineapple, banana, orange yellow, red, blue, green silver, gold, platinum delphi, java, c++, visual basic I want to sort each line alphabetically, WITHOUT changing line order. My desired result would be: cats, dogs, monkeys banana, orange, pineapple blue, green, red, yellow gold, platinum, silver c++, delphi, java, visual basic My target list has got 3000+ lines, so it should be an automated process. Thanks!

    Read the article

  • How can I better collaborate the colors between my iMac and Macbook Air?

    - by kylehotchkiss
    I just got a Macbook Air and the differences in color between it and my 2009 iMac are driving me crazy. I know there were certain iMac models from that period with yellow tinting issues, but I did the gray bar tests and that doesn't appear to be the issue. (No hardware issue suspected) However, my iMacs tones are more yellow prone than the macbook and I was wondering how to collaborate these two devices better for design work.

    Read the article

  • how to clear stack after stack overflow signal occur

    - by user353573
    In pthread, After reaching yellow zone in stack, signal handler stop the recursive function by making it return however, we can only continue to use extra area in yellow zone, how to clear the rubbish before the yellow zone in the thread stack ? (Copied from "answers"): #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <setjmp.h> #include <sys/mman.h> #include <unistd.h> #include <assert.h> #include <sys/resource.h> #define ALT_STACK_SIZE (64*1024) #define YELLOW_ZONE_PAGES (1) typedef struct { size_t stack_size; char* stack_pointer; char* red_zone_boundary; char* yellow_zone_boundary; sigjmp_buf return_point; size_t red_zone_size; } ThreadInfo; static pthread_key_t thread_info_key; static struct sigaction newAct, oldAct; bool gofromyellow = false; int call_times = 0; static void main_routine(){ // make it overflow if(gofromyellow == true) { printf("return from yellow zone, called %d times\n", call_times); return; } else { call_times = call_times + 1; main_routine(); gofromyellow = true; } } // red zone management static void stackoverflow_routine(){ fprintf(stderr, "stack overflow error.\n"); fflush(stderr); } // yellow zone management static void yellow_zone_hook(){ fprintf(stderr, "exceed yellow zone.\n"); fflush(stderr); } static int get_stack_info(void** stackaddr, size_t* stacksize){ int ret = -1; pthread_attr_t attr; pthread_attr_init(&attr); if(pthread_getattr_np(pthread_self(), &attr) == 0){ ret = pthread_attr_getstack(&attr, stackaddr, stacksize); } pthread_attr_destroy(&attr); return ret; } static int is_in_stack(const ThreadInfo* tinfo, char* pointer){ return (tinfo->stack_pointer <= pointer) && (pointer < tinfo->stack_pointer + tinfo->stack_size); } static int is_in_red_zone(const ThreadInfo* tinfo, char* pointer){ if(tinfo->red_zone_boundary){ return (tinfo->stack_pointer <= pointer) && (pointer < tinfo->red_zone_boundary); } } static int is_in_yellow_zone(const ThreadInfo* tinfo, char* pointer){ if(tinfo->yellow_zone_boundary){ return (tinfo->red_zone_boundary <= pointer) && (pointer < tinfo->yellow_zone_boundary); } } static void set_yellow_zone(ThreadInfo* tinfo){ int pagesize = sysconf(_SC_PAGE_SIZE); assert(pagesize > 0); tinfo->yellow_zone_boundary = tinfo->red_zone_boundary + pagesize * YELLOW_ZONE_PAGES; mprotect(tinfo->red_zone_boundary, pagesize * YELLOW_ZONE_PAGES, PROT_NONE); } static void reset_yellow_zone(ThreadInfo* tinfo){ size_t pagesize = tinfo->yellow_zone_boundary - tinfo->red_zone_boundary; if(mmap(tinfo->red_zone_boundary, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0) == 0){ perror("mmap failed"), exit(1); } mprotect(tinfo->red_zone_boundary, pagesize, PROT_READ | PROT_WRITE); tinfo->yellow_zone_boundary = 0; } static void signal_handler(int sig, siginfo_t* sig_info, void* sig_data){ if(sig == SIGSEGV){ ThreadInfo* tinfo = (ThreadInfo*) pthread_getspecific(thread_info_key); char* fault_address = (char*) sig_info->si_addr; if(is_in_stack(tinfo, fault_address)){ if(is_in_red_zone(tinfo, fault_address)){ siglongjmp(tinfo->return_point, 1); }else if(is_in_yellow_zone(tinfo, fault_address)){ reset_yellow_zone(tinfo); yellow_zone_hook(); gofromyellow = true; return; } else { //inside stack not related overflow SEGV happen } } } } static void register_application_info(){ pthread_key_create(&thread_info_key, NULL); sigemptyset(&newAct.sa_mask); sigaddset(&newAct.sa_mask, SIGSEGV); newAct.sa_sigaction = signal_handler; newAct.sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK; sigaction(SIGSEGV, &newAct, &oldAct); } static void register_thread_info(ThreadInfo* tinfo){ stack_t ss; pthread_setspecific(thread_info_key, tinfo); get_stack_info((void**)&tinfo->stack_pointer, &tinfo->stack_size); printf("stack size %d mb\n", tinfo->stack_size/1024/1024 ); tinfo->red_zone_boundary = tinfo->stack_pointer + tinfo->red_zone_size; set_yellow_zone(tinfo); ss.ss_sp = (char*)malloc(ALT_STACK_SIZE); ss.ss_size = ALT_STACK_SIZE; ss.ss_flags = 0; sigaltstack(&ss, NULL); } static void* thread_routine(void* p){ ThreadInfo* tinfo = (ThreadInfo*)p; register_thread_info(tinfo); if(sigsetjmp(tinfo->return_point, 1) == 0){ main_routine(); } else { stackoverflow_routine(); } free(tinfo); printf("after tinfo, end thread\n"); return 0; } int main(int argc, char** argv){ register_application_info(); if( argc == 2 ){ int stacksize = atoi(argv[1]); pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 1024 * 1024 * stacksize); { pthread_t pid0; ThreadInfo* tinfo = (ThreadInfo*)calloc(1, sizeof(ThreadInfo)); pthread_attr_getguardsize(&attr, &tinfo->red_zone_size); pthread_create(&pid0, &attr, thread_routine, tinfo); pthread_join(pid0, NULL); } } else { printf("Usage: %s stacksize(mb)\n", argv[0]); } return 0; } C language in linux, ubuntu

    Read the article

  • How to mix colors "naturally" with C#?

    - by crono
    I have to mix some colors in a natural way. This means blue + yellow = green blue + red = purple and so on. I got the colors as RGB-Values. When I try to mix them I got the right "RGB"-results like green + red = yellow yellow + blue = white but not the right "natural-wet-paint"-results. Any good idea how to mix RGB in a natural way? It would be great if someone knew a solution within the Microsoft.Xna.Framework.Graphics namespace but a generic solution would also help :)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >