Search Results

Search found 4441 results on 178 pages for 'red'.

Page 18/178 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • How to compare a memory bits in C++?

    - by Trunet
    Hi, I need help with a memory bit comparison function. I bought a LED Matrix here with 4 x HT1632C chips and I'm using it on my arduino mega2560. There're no code available for this chipset(it's not the same as HT1632) and I'm writing on my own. I have a plot function that get x,y coordinates and a color and that pixel turn on. Only this is working perfectly. But I need more performance on my display so I tried to make a shadowRam variable that is a "copy" of my device memory. Before I plot anything on display it checks on shadowRam to see if it's really necessary to change that pixel. When I enabled this(getShadowRam) on plot function my display has some, just SOME(like 3 or 4 on entire display) ghost pixels(pixels that is not supposed to be turned on). If I just comment the prev_color if's on my plot function it works perfectly. Also, I'm cleaning my shadowRam array setting all matrix to zero. variables: #define BLACK 0 #define GREEN 1 #define RED 2 #define ORANGE 3 #define CHIP_MAX 8 byte shadowRam[63][CHIP_MAX-1] = {0}; getShadowRam function: byte HT1632C::getShadowRam(byte x, byte y) { byte addr, bitval, nChip; if (x>=32) { nChip = 3 + x/16 + (y>7?2:0); } else { nChip = 1 + x/16 + (y>7?2:0); } bitval = 8>>(y&3); x = x % 16; y = y % 8; addr = (x<<1) + (y>>2); if ((shadowRam[addr][nChip-1] & bitval) && (shadowRam[addr+32][nChip-1] & bitval)) { return ORANGE; } else if (shadowRam[addr][nChip-1] & bitval) { return GREEN; } else if (shadowRam[addr+32][nChip-1] & bitval) { return RED; } else { return BLACK; } } plot function: void HT1632C::plot (int x, int y, int color) { if (x<0 || x>X_MAX || y<0 || y>Y_MAX) return; if (color != BLACK && color != GREEN && color != RED && color != ORANGE) return; char addr, bitval; byte nChip; byte prev_color = HT1632C::getShadowRam(x,y); bitval = 8>>(y&3); if (x>=32) { nChip = 3 + x/16 + (y>7?2:0); } else { nChip = 1 + x/16 + (y>7?2:0); } x = x % 16; y = y % 8; addr = (x<<1) + (y>>2); switch(color) { case BLACK: if (prev_color != BLACK) { // compare with memory to only set if pixel is other color // clear the bit in both planes; shadowRam[addr][nChip-1] &= ~bitval; HT1632C::sendData(nChip, addr, shadowRam[addr][nChip-1]); shadowRam[addr+32][nChip-1] &= ~bitval; HT1632C::sendData(nChip, addr+32, shadowRam[addr+32][nChip-1]); } break; case GREEN: if (prev_color != GREEN) { // compare with memory to only set if pixel is other color // set the bit in the green plane and clear the bit in the red plane; shadowRam[addr][nChip-1] |= bitval; HT1632C::sendData(nChip, addr, shadowRam[addr][nChip-1]); shadowRam[addr+32][nChip-1] &= ~bitval; HT1632C::sendData(nChip, addr+32, shadowRam[addr+32][nChip-1]); } break; case RED: if (prev_color != RED) { // compare with memory to only set if pixel is other color // clear the bit in green plane and set the bit in the red plane; shadowRam[addr][nChip-1] &= ~bitval; HT1632C::sendData(nChip, addr, shadowRam[addr][nChip-1]); shadowRam[addr+32][nChip-1] |= bitval; HT1632C::sendData(nChip, addr+32, shadowRam[addr+32][nChip-1]); } break; case ORANGE: if (prev_color != ORANGE) { // compare with memory to only set if pixel is other color // set the bit in both the green and red planes; shadowRam[addr][nChip-1] |= bitval; HT1632C::sendData(nChip, addr, shadowRam[addr][nChip-1]); shadowRam[addr+32][nChip-1] |= bitval; HT1632C::sendData(nChip, addr+32, shadowRam[addr+32][nChip-1]); } break; } } If helps: The datasheet of board I'm using. On page 7 has the memory mapping I'm using. Also, I have a video of display working.

    Read the article

  • Select column value that matches a combination of other columns values on the same table

    - by Ala
    I have a table called Ads and another Table called AdDetails to store the details of each Ad in a Property / Value style, Here is a simplified example with dummy code: [AdDetailID], [AdID], [PropertyName], [PropertyValue] 2 28 Color Red 3 28 Speed 100 4 27 Color Red 5 28 Fuel Petrol 6 27 Speed 70 How to select Ads that matches many combinations of PropertyName and PropertyValue, for example : where PropertyName='Color' and PropertyValue='Red' And where PropertyName='Speed' and CAST(PropertyValue AS INT) > 60

    Read the article

  • How to make an Inputfield change its design when active?

    - by Opoe
    Hi all, Let's say my background color is red. I want the input textfield to appear red, but when you click inside the input field to type it becomes a regulad textfield. And ofcourse when you are not active in the input field it should be back to its original state (red). Its actually something you see quite often. I thought of using toggleclass? My input fields are all appended with jQuery Thanks in advance

    Read the article

  • jquery element filter by css

    - by salmane
    I would like to select every div that has a red background color for example. is this possible in jquery? <div style="background-color:red"></div> <div style="background-color:white"></div> <div style="background-color:red"></div> <div style="background-color:yellow"></div> thank you

    Read the article

  • MySQL: Count occurrences of known (or enumerated) distinct values

    - by Eilidh
    After looking at how to count the occurrences of distinct values in a field, I am wondering how to count the occurrences of each distinct value if the distinct values are known (or enumerated). For example, if I have a simple table - TrafficLight Colour ------------ ------ 1 Red 2 Amber 3 Red 4 Red 5 Green 6 Green where one column (in this case Colour) has known (or enumerated) distinct values, how could I return the count for each colour as a separate value, rather than as an array, as in the linked example. To return an array with a count of each colour (using the same method as in the linked example), the query would be something like SELECT Colour COUNT(*) AS ColourCount FROM TrafficLights GROUP BY Colour, and return an array - Colour ColourCount ------ ----------- Red 3 Amber 1 Green 2 What I would like to do is to return the count for each Colour AS a separate total (e.g. RedCount). How can I do this?

    Read the article

  • Detecting Markers Using OpenCV

    - by Hamza Yerlikaya
    I am trying to detect various objects containing colored markers, so a red blue green marker identifies object A, and a red blue red marker identifies object B. My problem is I can't use template matching cause objects can be rotated, currently I am thinking about check for each color then find the object by checking the distance between colors but it seems inefficient, so my question is there a better way to do this?

    Read the article

  • Confirm box always displays first (javascript, jQuery, .Net)

    - by Jan-Frederik Carl
    Hello, I have a jQuery-Script to accomplish the following tasks: if a gridview in my form contains a row with a certain id, it has to be marked red. a confirm dialogue has to pop up to ask the user if he wants to do this or that. I built this code: if (response == "EntryInList") { $('#entryListContainer div table tbody tr').each(function() { if ($(this).attr('id') == 'entry_' + $('#<%= txtProductNumber.ClientID %>').val()) { $(this).css("color", "red"); } } ); if (!confirm("Entry already exists. Really overwrite?")) { jQuery('#<%= txtProductNumber.ClientID %>').val(''); jQuery('#<%= txtCount.ClientID %>').val(''); jQuery('#<%= txtProductNumber.ClientID %>').focus(); return false; } } As a result, the confirm box pops up first, without the row being turned red. Only after using the box, it becomes red. How would I get the row to be turned red at once? Another of my problems is that the confirm box denies my page to be scrolled down. But I would like to do this if the gridview is longer than the entire page.

    Read the article

  • MySQL: Get unique values across multiple columns in alphabetical order

    - by RuCh
    Hey everyone, If my table looks like this: id | colA | colB | colC =========================== 1 | red | blue | yellow 2 | orange | red | red 3 | orange | blue | cyan What SELECT query do I run such that the results returned are: blue, cyan, orange, red, yellow Basically, I want to extract a collective list of distinct values across multiple columns and return them in alphabetical order. I am not concerned with performance optimization, because the results are being parsed to an XML file that will serve as a cache (database is hardly updated). So even a dirty solution would be fine. Thanks for any help!

    Read the article

  • How to color HTML elements based on parsing a user command string

    - by Anonymous the Great
    I'm working on a little parsing thing to color objects. For an example, you could type red:Hi!: and "Hi!" would be red. This is my not working code: <script type="text/javascript"> function post() { var preview = document.getElementById("preview"); var submit = document.getElementById("post"); var text = submit.value; <?php str_replace("red:*:",'<i class="red">*</i>',text); ?> preview.value = text; } </script>

    Read the article

  • Convert this VB code to C#?

    - by Róisín Kerr Lautman
    I was wondering if anyone would be able to help me convert the below code to c#? From what I have read it seems to be similar however I am not sure if my 'case' statements are still able to be used? Public Class Form1 Dim dteStart As Date Dim dteFinish As Date Dim span As TimeSpan Public Sub KeyDown(ByVal Sender As System.Object, ByVal e As _ System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown Select Case e.KeyCode Case Keys.Q Label1.BackColor = Color.Green dteStart = Now() Case Keys.W Label2.BackColor = Color.Green Case Keys.E Label3.BackColor = Color.Green Case Keys.R Label4.BackColor = Color.Green dteFinish = Now() span = dteFinish.Subtract(dteStart) Label5.Text = span.ToString End Select End Sub Public Sub KeyUp(ByVal Sender As System.Object, ByVal e As _ System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp Select Case e.KeyCode Case Keys.Q Label1.BackColor = Color.Red Case Keys.W Label2.BackColor = Color.Red Case Keys.E Label3.BackColor = Color.Red Case Keys.R Label4.BackColor = Color.Red End Select End Sub End Class

    Read the article

  • Clean way to assign value unless empty

    - by atmorell
    Hello, I often need to assign a variable, if the source value is set. So far I have done it like this: filters[:red] = params[:search][:red] unless params[:search][:red].nil? This works but looks a bit clumsy. There must be a more DRY way of getting this result. Any suggestions? Best regards. Asbjørn Morell.

    Read the article

  • Questions on using enums as parameters and if/else conditions

    - by dotnetdev
    Hi, Is it possible to do the following with an enum in C#?: Pass in to a method a selected value of the enum (eg if an enum has members such as Red, Green, Orange, I can pass in Colors.Red). In the method body of the above method which accepts an enum, I can say if (Enum == Colors.Red). What would be the syntax for this? I've always seemed to have stalled on this.

    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

  • All possible combinations for two column data

    - by Alec Dobbie
    I have a two column view Product Id Tag ---------------------- 1 Leather 1 Watch 2 Red 2 Necklace 2 Pearl I'm trying to get all possible combinations of tags for a product as such: 1 Leather 1 Leather,Watch 2 Pearl 2 Pearl,Necklace 2 Pearl Necklace,Red 2 Necklace 2 Necklace, Red 2 Red I've found and stolen some SQL that give me the complete list for all but not the small versions, its below. Any ideas, it's started to make my head hurt. A virtual pint for the best answer. SELECT ProductId, (SELECT CAST(Tag + ', ' AS VARCHAR(MAX)) FROM ProductByTagView WHERE Product.ProductId = ProductByTagView.ProductId order by tag FOR XML PATH ('')) AS Tags FROM Product

    Read the article

  • Conditional formatting in Access

    - by every_answer_gets_a_point
    I have a datasheet that looks like this: ID name_ 1 2 3 4 1 name1 x 0 0 0 2 name2 0 x 0 0 3 name3 0 0 x 0 4 name4 0 0 0 x I have rectangles on a report that correspond to this datasheet. When the report opens, I need the rectangles to be colored red according to the data. For example, in the name1 row where there is an x in the 1 column, I need the specific rectangle corresponding to this (name1, 1) to be colored red. Here is the result that I need: x x x x (where x is a rectangle that is red) Perhaps the best place to place this code would be in ON LOAD event of the report, but i am not sure exactly. Can you please suggest to me some code that would turn the specified rectangles red according to the data?

    Read the article

  • "Parsing" I think is the word.

    - by Anonymous the Great
    I'm working on a little parsing thing to color objects. For an example, you could type red:Hi!: and "Hi!" would be red. This is my not working code: <script type="text/javascript"> function post() { var preview = document.getElementById("preview"); var submit = document.getElementById("post"); var text = submit.value; <?php str_replace("red:*:",'<i class="red">*</i>',text); ?> preview.value = text; } </script>

    Read the article

  • Table cells with space between them

    - by Naor
    I want to make the foollowing but with CSS classes - as simple as can be: <table cellspacing="0" cellpadding="0"> <tr> <td style="color:red;text-decoration:underline;padding-right:50px;>cell1</td> <td style="color:red;text-decoration:underline;>cell2</td> </tr> <tr> <td style="color:red;text-decoration:underline;padding-right:50px;>cell3</td> <td style="color:red;text-decoration:underline;>cell4</td> </tr> </table> What is the best way to do it?

    Read the article

  • jquery .show("slide") options (WITH PICS!!)

    - by Micky Fokken
    Here's my code. It slides in from the left. <script> $('#goalHS').click(function() { $('div[id^="div-detailed-goal"]').show("slide"); }); $("#redline").click(function() { $('div[id^="div-detailed-goal"]').fadeOut("slow"); }); </script> Instead of fading in from the left, I want a red line to be drawn and then have the DIV slide in from the top. How can I get it to do the following? Horizontal red line grows out from center. --- Red line finishes growing: Content slides in from underneath red line. COntent does NOT show above red line: c. content, content, content d. content, content, content Content finishes sliding in. Awesomeness ensues! a. content, content, content b. content, content, content c. content, content, content d. content, content, content I've tried 4 different ways, and I've tried using other js plugin libraries, but I'm not quite that advanced to figure it out.

    Read the article

  • interesting vba/access question: color rectangles according to data

    - by every_answer_gets_a_point
    i have a datasheet that looks like this: ID name_ 1 2 3 4 1 name1 x 0 0 0 2 name2 0 x 0 0 3 name3 0 0 x 0 4 name4 0 0 0 x i have rectangles on a report that correspond to this datasheet. when the report opens, i need the rectangles to be colored RED according to the data. for example where name1 and there is an x in the 1 column, i need the specific rectangle corresponding to this (name1, 1) to be colored red. here is the result that i will need: x x x x (where x is a rectangle that is RED) perhaps the best place to place this code would be in ON LOAD event of the report, but i am not sure exactly. can you please suggest to me some code that would turn the specified rectangles RED according to the data?

    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

  • trying to put an mysql result into a string

    - by user1583432
    I'm trying to put an mysql query result into an string I tried to find an answer but all the similar posts were getting subquery answers which is not what I'm trying to do. for example Fruits_tbl ID Fruit Color Number __________________________________ 2 Apple Red 5 $sql = "select Fruits,Color,Number from Fruits_tbl where ID = 2"; $result = $pdo->query($sql); $row = $result->fetch(); print_r($row); This will give me something like Array([0]="Apple", [1]="Red", [2]="5", [Fruit]="Apple", [Color]="Red", [Number]="5") implode will give me 2 of each I want just need a string = "Apple, Red, 5" what I currently have is $string = $row[Fruit].", ".$row[Color].", ".$row['Number'] As you can see that's rather tedious. Is there something like implode but only return the index array or something?

    Read the article

  • How to add multiple link styles on the same page?

    - by Darren Baker
    I have two hyperlinks on a page. I'm happy with the css on 'link1' (white text / red rollover) however I want to have a different styling for 'link2'. I've created a seperate css for this section and have managed to colour it green but I can't get rid of the red rollover effect? Does anyone know how to override the red rollover effect just on 'link2'? http://www.signport.co.uk/test/testsize3.html Thanks!

    Read the article

  • Can I lock rows in a cursor if the cursor only returns a single count(*) row?

    - by RenderIn
    I would like to restrict users from inserting more than 3 records with color = 'Red' in my FOO table. My intentions are to A) retrieve the current count so that I can determine whether another record is allowed and B) prevent any other processes from inserting any Red records while this one is in process, hence the for update of. I'd like to do something like: cursor cur_cnt is select count(*) cnt from foo where foo.color = 'Red' for update of foo.id; Will this satisfy both my requirements or will it not lock only the rows in the count(*) who had foo.color = 'Red'?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >