Search Results

Search found 4467 results on 179 pages for 'red rover'.

Page 53/179 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Is there a more efficient way to run enum values through a switch-case statement in C# than this?

    - by C Patton
    I was wondering if there was a more efficient (efficient as in simpler/cleaner code) way of making a case statement like the one below... I have a dictionary. Its key type is an Enum and its value type is a bool. If the boolean is true, I want to change the color of a label on a form. The variable names were changed for the example. Dictionary<String, CustomType> testDict = new Dictionary<String, CustomType>(); //populate testDict here... Dictionary<MyEnum, bool> enumInfo = testDict[someString].GetEnumInfo(); //GetEnumInfo is a function that iterates through a Dictionary<String, CustomType> //and returns a Dictionary<MyEnum, bool> foreach (KeyValuePair<MyEnum, bool> kvp in enumInfo) { switch (kvp.Key) { case MyEnum.Enum1: if (someDictionary[kvp.Key] == true) { Label1.ForeColor = Color.LimeGreen; } else { Label1.ForeColor = Color.Red; } break; case MyEnum.Enum2: if (someDictionary[kvp.Key] == true) { Label2.ForeColor = Color.LimeGreen; } else { Label2.ForeColor = Color.Red; } break; } } So far, MyEnum has 8 different values.. which means I have 8 different case statements.. I know there must be an easier way to do this, I just can't conceptualize it in my head. If anyone could help, I'd greatly appreciate it. I love C# and I learn new things every day.. I absorb it like a sponge :) -CP

    Read the article

  • How to make a WPF ComboBox editable with custom values

    - by Liam
    I would like to have a combobox that allows selection from a list of values and also allow a custom value from the typed in text. For display reasons the items are a complex type (lets say the combobox item template displays a patch of color and a flag indicating if it is a custom color). public class ColorLevel { public decimal Intensity { get; set; } public bool IsCustom { get; set; } public Color BaseColor { get; set; } public override ToString() { return string.Format("{0}", Intensity*100); } } Example items var items = new [] { new ColorLevel { Intensity = 0.9m, IsCustom = false, BaseColor = Color.Red }, new ColorLevel { Intensity = 0.7m, IsCustom = false, BaseColor = Color.Red } } XAML <ComboBox SelectedItem="{Binding Path=SelectedColorLevel}" IsEditable="true" IsTextSearchEnabled="true"> </ComboBox> So the above markup works when an item is selected from the item list. And as you type with the text search the matching items are selected. If the typed text doesn't match an item then the SelectedColorLevel is set to null. The question is at what point (and how) is it best to create a new custom item that can be set to the SelectedColorLevel when the typed text doesn't match an item. For example I would want to assign a new item to the selected value such as new ColorLevel { Intensity = decimal.Parse(textvalue), IsCustom = true } or using an appropriate converter and databinding to the Text property.

    Read the article

  • Combining aggregate functions in an (ANSI) SQL statement

    - by morpheous
    I have aggregate functions foo(), foobar(), fredstats(), barneystats() I want to create a domain specific query language (DSQL) above my DB, to facilitate using using a domain language to query the DB. The 'language' comprises of boolean expressions (or more specifically SQL like criteria) which I then 'translate' back into pure (ANSI) SQL and send to the underlying Db. The following lines are examples of what the language statements will look like, and hopefully, it will help further clarify the concept: **Example 1** DQL statement: foobar('yellow') between 1 and 3 and fredstats('weight') > 42 Translation: fetch all rows in an underlying table where computed values for aggregate function foobar() is between 1 and 3 AND computed value for AGG FUNC fredstats() is greater than 42 **Example 2** DQL statement: fredstats('weight') < barneystats('weight') AND foo('fighter') in (9,10,11) AND foobar('green') <> 42 Translation: Fetch all rows where the specified criteria matches **Example 3** DQL statement: foobar('green') / foobar('red') <> 42 Translation: Fetch all rows where the specified criteria matches **Example 4** DQL statement: foobar('green') - foobar('red') >= 42 Translation: Fetch all rows where the specified criteria matches Given the following information: The table upon which the queries above are being executed is called 'tbl' table 'tbl' has the following structure (id int, name varchar(32), weight float) The result set returns only the tbl.id, tbl.name and the names of the aggregate functions as columns in the result set - so for example the foobar() AGG FUNC column will be called foobar in the result set. So for example, the first DQL query will return a result set with the following columns: id, name, foobar, fredstats Given the above, my questions then are: What would be the underlying SQL required for Example1 ? What would be the underlying SQL required for Example3 ? Given an algebraic equation comprising of AGGREGATE functions, Is there a way of generalizing the algorithm needed to generate the required ANSI SQL statement(s)? I am using PostgreSQL as the db, but I would prefer to use ANSI SQL wherever possible.

    Read the article

  • Eclipse and JavaFX? is it just me?

    - by jeff porter
    I'm looking at learning JavaFX. I've tried setting Eclipse to develop a small app and I've downloaded the Eclipse plugin. Eclipse JavaFX plugin BUT... it just seems, well, flakey. So I have 3 questions... 1: Is there a better plugin? 2: Or is there some great set of tutorials out there that I'm missing? 3: finally, is it meant to be easy to call Java code from FX? I'm stuggling, it there a good example somewhere? On questions 1 & 2, Eclipse underlines code in red that just shouln't be. For example.. see this image... Why does it underline bit of imports in red? I know this is little of an open ended question. So I guess my main question is this... Is my experiance of JavaFX and Eclipse the best I can hope for? Or am I missing something ? (and I'm not looking for a Yes/No response) :-) Just looking for a discussion on how best to learn/develop JavaFx.

    Read the article

  • AdvancedDataGrid dynamic text Value Coloring - ItemRenderer problem

    - by sri
    In my AdvancedDataGrid, I am adding dynamic values to cells by dragging a cell value to other cells. While copying, I am setting the value to listData and setting the Red color to the value in ItemRenderer. Everything is working fine, but when I scroll down/up, the values remains in the cells where thay are supposed to be(as I am setting to listData) but the coloring behaves wierd(as I am trying to set the color in ItemRenderer). I don't want to store the color of the value, but I should be able to see the dynamically created values in Red color. Is there a way, I can do this? Do I need to set the color to actual dataprovider object and then check in ItemRenderer? Can anyone help me with this? public class CustomItemRenderer extends AdvancedDataGridItemRenderer { private var _isDynamicValue:Boolean; .... .... //_isDynamicValue is set to true if the value is dynamic if(_isDynamicValue && listData.label) { setStyle("color", 0xFF0000); setStyle("fontWeight", "bold"); } else { setStyle("color", 0x000000); }

    Read the article

  • Listen to double click not click

    - by Mohsen
    I'm just wondering why click event happening when I dbclick an element? I have this code:(JSBIN) HTML <p id="hello">Hello World</p> JavaScript document.getElementById('hello').addEventListener('click', function(e){ e.preventDefault(); this.style.background = 'red'; }, false); document.getElementById('hello').addEventListener('dbclick', function(){ this.style.background = 'yellow'; }, false); It should do different things for click and double click, but it seems when you double click on the p it catch click event in advance and ignore double click. I tried preventDefault the click event too. How can I listen to just dbclick? UPDATE I had a typo in my code. dbclick is wrong. It's dblclick. Anyway the problem still exist. When user double clicks the click event happens. This is updated code that prove it:(JSBin) document.getElementById('hello').addEventListener('click', function(e){ e.preventDefault(); this.style.background = 'red'; this.innerText = "Hello World clicked"; }, false); document.getElementById('hello').addEventListener('dblclick', function(){ this.style.background = 'green'; }, false);

    Read the article

  • Chrome is leaking memory, when jQuery is used on events?

    - by user269386
    Hi, I'm experiencing an increase of memory usage, when I use the jQuery-eventhandling in Chrome. I've tested it with IE and FF as well, but there I couldn't see a suspicious rise of memory-usage, compared to Chrome. I'm using Chrome version 4.0.223.16 (unfortunately I'm forced to use this version, here) Simple example here. Just scroll with the mousewheel in the red box and open the Chrome-taskmanager and you will see an increase of memory which won't be released anymore: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript" src="js/libs/jquery-1.4.2.min.js"></script> <script type="text/javascript"> jQuery(function () { jQuery("#div1").bind("mousewheel", function (event) { event.preventDefault(); }); }); </script> </head> <body> <div id="div1" style="width: 100px; height: 100px; background-color: red;"></div> </body> </html> Does anyone have experienced the same problem (or is it maybe solvend with a different version of chrome)? And does anyone have a fix for it? thanks

    Read the article

  • Understanding Symbols In Ruby

    - by Kezzer
    Despite reading this article, I'm still confused as to the representation of the data in memory when it comes to using symbols. If a symbol, two of them contained in different objects, exist in the same memory location, then how is it that they contain different values? I'd have expected the same memory location to contain the same value. As a quote from the link: Unlike strings, symbols of the same name are initialized and exist in memory only once during a session of ruby I just don't understand how it manages to differentiate the values contained in the same memory location. EDIT So let's consider the example: patient1 = { :ruby => "red" } patient2 = { :ruby => "programming" } patient1.each_key {|key| puts key.object_id.to_s} 3918094 patient2.each_key {|key| puts key.object_id.to_s} 3918094 patient1 and patient2 are both hashes, that's fine. :ruby however is a symbol. If we were to output the following: patient1.each_key {|key| puts key.to_s} Then what will be output? "red", or "programming"? FURTHER EDIT I'm still really quite confused. I'm thinking a symbol is a pointer to a value. Let's forget hashes for a second. The questions I have are; can you assign a value to a symbol? Is a symbol just a pointer to a variable with a value in it? If symbols are global, does that mean a symbol always points to one thing?

    Read the article

  • PHP 5.2 Function needed for GENERIC sorting FOLLOWUP

    - by donbriggs
    OK, you guys gave me a great solution for sorting a recordset array last Friday. (http://stackoverflow.com/questions/2884325/php-5-2-function-needed-for-generic-sorting-of-a-recordset-array) But now when I implement it, I end up with an extra element in the recordset array. I won't wast space reposting the same info, as the link is above. But the bottom line is that when I sort an array of 5 records, the resulting array has 6 records. The last element in the array is not a record array, but rather just a element containing an integer value of 1. I presume that it is somehow getting the output value of the "strnatcasecmp" function, but I have no idea how it is happening. Here is the function that you fine folks provided last week: function getSortCommand($field, $sortfunc) { return create_function('$var1, $var2', 'return '.$sortfunc.'($var1["'.$field.'"], $var2["' .$field .'"]);'); } And here is the line I am calling to sort the array: $trek[] = usort($trek, getSortCommand('name', 'strnatcasecmp')); This produces the following output, with an extra element tacked on to the end. Array ( [0] = Array ( [name] = Kirk [shirt] = Gold [assign] = Bridge ) [1] => Array ( [name] => McCoy [shirt] => Blue [assign] => Sick Bay ) [2] => Array ( [name] => Scotty [shirt] => Red [assign] => Engineering ) [3] => Array ( [name] => Spock [shirt] => Blue [assign] => Bridge ) [4] => Array ( [name] => Uhura [shirt] => Red [assign] => Bridge ) [5] => 1 )

    Read the article

  • Generated HTML word document not displaying image correctly

    - by spiderdijon
    I'm trying to add an image to a generated html word document that is embedded in a classic ASP page. The code looks something like this: <% Response.ContentType = "application/msword" %> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word"> ... <v:shape id="_x0000_s1030" type="#_x0000_t75" style='position:absolute; left:0;text-align:left;margin-left:0;margin-top:17.95pt;width:7in;height:116.85pt; z-index:2;mso-position-horizontal:center;mso-position-horizontal-relative:page; mso-position-vertical-relative:page'> <v:imagedata src="http://xxx/image001.gif" o:title="image001"/> <w:wrap anchorx="page" anchory="page"/> <w:anchorlock/> </v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;position: absolute;z-index:0;left:0px;margin-left:0px;margin-top:24px;width:672px; height:156px'><img width=672 height=156 src="http://xxx/image001.gif" v:shapes="_x0000_s1030"></span><![endif]> The image URL is correct and can be viewed through a browser, however when the word document opens, the image has a red x, with the error message: The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may be corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again. If i copy the html code and try to open the word document on my local machine, it displays the image correctly. It just doesn't work when retrieving the document from the server. This happens for any images I try to add. Is there another way to add images to html-generated word documents that can be output from an asp page? Thanks.

    Read the article

  • First test of a Windows Phone application

    - by Maurizio Reginelli
    I downloaded the Microsoft Visual Studio 2010 Express for Windows Phone and I wrote a simple application to make a first test of the emulator. In this application I have only a button with the property Content binded to a string called ButtonText and with the property Background binded to a SolidColorBrush named FillColor. I handled the Click event with this code: void MyButton_Click(object sender, RoutedEventArgs e) { if (toggle == true) { ButtonText = "Blue"; FillColor = new SolidColorBrush(Colors.Blue); } else { ButtonText = "Red"; FillColor = new SolidColorBrush(Colors.Red); } toggle = !toggle; } Unfortunately this doesn't work. While the Content of the Button changes each time the button is pressed, I cannot say the same for the Background which remains at the same color. Could you tell me what is wrong? Thank you. I also post the XAML: <Grid x:Name="ContentGrid" Grid.Row="1"> <Button Name="MyButton" Width="300" Height="300" Content="{Binding Path=ButtonText}" Background="{Binding Path=FillColor}" /> </Grid>

    Read the article

  • How to effectively color pixels in a BufferedImage?

    - by Ed Taylor
    I'm using the following pice of code to iterate over all pixels in an image and draw a red 1x1 square over the pixels that are within a certain RGB-tolerance. I guess there is a more efficient way to do this? Any ideas appreciated. (bi is a BufferedImage and g2 is a Graphics2D with its color set to Color.RED). Color targetColor = new Color(selectedRGB); for (int x = 0; x < bi.getWidth(); x++) { for (int y = 0; y < bi.getHeight(); y++) { Color pixelColor = new Color(bi.getRGB(x, y)); if (withinTolerance(pixelColor, targetColor)) { g2.drawRect(x, y, 1, 1); } } } private boolean withinTolerance(Color pixelColor, Color targetColor) { int pixelRed = pixelColor.getRed(); int pixelGreen = pixelColor.getGreen(); int pixelBlue = pixelColor.getBlue(); int targetRed = targetColor.getRed(); int targetGreen = targetColor.getGreen(); int targetBlue = targetColor.getBlue(); return (((pixelRed >= targetRed - tolRed) && (pixelRed <= targetRed + tolRed)) && ((pixelGreen >= targetGreen - tolGreen) && (pixelGreen <= targetGreen + tolGreen)) && ((pixelBlue >= targetBlue - tolBlue) && (pixelBlue <= targetBlue + tolBlue))); }

    Read the article

  • Swapping content in a seperate div on hover

    - by Fuego DeBassi
    I feel like this should work: $(".module .one").hover(function() { $("#viewport #one").addClass('red'); }); Basically I am hiding all the .children of "#viewport on load, then when a seperate element is hovered, in this case .module .one I want to change something on the corresponding viewport ID #viewport #one. Basic idea is a variable content window, where when a thumbnail or whatever I put in the modules swaps the content shown in the viewport. Something I am doing wrong? Here is my full code: <script type="text/javascript"> $(document).ready(function() { $(".module .caption").hide(); $("#viewport").children().hide(); $(".module").hover(function() { $(this).find(".caption").slideDown().end().siblings('.module').addClass('under'); },function() { $(this).find(".caption").slideUp().end().siblings('.module').removeClass('under'); }); $(".module .one").hover(function() { $("#viewport #one").addClass('red'); }); }); </script> The bigger hover function in the middle is for some fancy rollover effects that the modules will perform themselves, but for these purposes I just want to figure out why I can't add a Class to a separate element when another is hovered. Would love some help/advice!

    Read the article

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

    - by Anonymous the Great
    When you type something like "red:Hi:" it will type "Hi" in red. The following script does not work and I do not know why, (The one who made the sorting PHP function is Graphain, thanks again!) <?php function getit($raw) { # If the value was posted $raw = isset($raw) ? $raw : ""; # Split it based on ':' $parsed = explode(':', $raw); $colorClass = ""; $text = ""; if (count($parsed) >= 2) { $colorClass = $parsed[0]; $text = $parsed[1]; $text = "~~~" . $text . "~~~" . $colorClass; return $text; } } ?> <script type="text/javascript"> function postit() { var preview = document.getElementById("preview").value; var submit = document.getElementById("post").value; var text = <?php getit(submit); ?> var t = text[0]; preview = t; } </script> <textarea id="preview" cols=70 rows=5 readonly>Preview box</textarea> <p> <textarea id="post" cols=70 rows=5/>Submit box</textarea> <p> <input type="button" onclick="postit();" value="Submit"/>

    Read the article

  • [PERL Tk] printing Line number in Text widget

    - by ungalnanban
    I use the following code for printing the line number in Text widget. my $c=0; my $r=0; $txt = $mw-Text( -background ='white', -width=>400, -height=>300, -selectbackground => 'skyblue', -insertwidth => 5, -borderwidth =>3, -highlightcolor => 'blue', ### after visit -highlightbackground => 'red' , ### default before visit -xscrollcommand => sub { print"CHAT NO :",$c++; }, # Determines the callback used when the Text widget is scrolled horizontally. -yscrollcommand = sub { print"LINR NO:",$r++; }, # Determines the callback used when the Text widget is scrolled vertically. -padx = 5, -pady = 5, )- pack (); the above code is printing the line number and character no is ok. but I used in Scrolled widget that output is not printing. what is the problem in the following code how can I solve this? $txt = $mw-Scrolled('Text', -scrollbars = 'se', -background ='white', -width=>400, -height=>300, -insertwidth => 5, -borderwidth =>3, -highlightcolor => 'blue', ### after visit -highlightbackground => 'red' , ### default before visit -padx => 5, -pady => 5, -xscrollcommand => sub { print"CHAT NO :",$c++; }, # Determines the callback used when the Text widget is scrolled horizontally. -yscrollcommand => sub { print"LINR NO :",$r++; }, # Determines the callback used when the Text widget is scrolled vertically. )->pack();

    Read the article

  • JavaFX 2.0 - How to change legend color of a LineChart dynamically?

    - by marie
    I am trying to style my JavaFX linechart but I have some trouble with the legend. I know how to change the legend color of a line chart in the css file: .default-color0.chart-series-line { -fx-stroke: #FF0000, white; } .default-color1.chart-series-line { -fx-stroke: #00FF00, white; } .default-color2.chart-series-line { -fx-stroke: #0000FF, white; } .default-color0.chart-line-symbol { -fx-background-color: #FF0000, white; } .default-color1.chart-line-symbol { -fx-background-color: #00FF00, white; } .default-color2.chart-line-symbol { -fx-background-color: #0000FF, white; } But this is not enough for my purposes. I have three or more colored toggle buttons and a series of data for every button. The data should be displayed in the same color the button has after I have selected the button. This should be possible with a multiselection of the buttons, so that more than one series of data can be displayed simultaneously. For the chart lines I have managed it by changing the style after I clicked the button: .. dataList.add(series); .. series.getNode().setStyle("-fx-stroke: rgba(" + rgba + ")"); If I deselect the button I remove the data from the list. dataList.remove(series); That is working fine for the strokes, but how can I do the same for the legend? You can see an example below. First I clicked the red button, thus the stroke and the legend is red (default-color0). After that I clicked the blue button. Here you can see the problem. The stroke is blue but the legend is green, because default color1 is used and I do not know how to change the legend color.

    Read the article

  • How Can I ReWrite flat link to a dynamic link and preserve the Query string?

    - by jeremysawesome
    Hello All, I am wanting to rewrite a url like: http://my.project/mydomain.com/ANY_NUMBER_OF_CATEGORIES/designer/4/designer-name/page.html to this: http://my.projects/mydomain.com/ANY_NUMBER_OF_CATEGORIES/page.html?designer=4 I would like to use mod-rewrite to accomplish this. Things to note: Any number of categories can be between 'mydomain.com/' and '/designer'. For instance the url could be http://my.project/mydomain.com/designer/4/designer-name/page.html or it could be http://my.project/mydomain.com/tops/shirts/small/designer/4/designer-name/page.html A query string may be provided in the original url that needs to be preserved in the rewritten url. For example url provided could be: http://my.project/mydomain.com/designer/4/designer-name/page.html?color=red&type=shirt Given the url above the resulting url would need to be: http://my.projects/mydomain.com/page.html?designer=4&color=red&type=shirt The order of the query string does not matter. The 'designer=4' part could come before or after the rest of the query string. I'm new to .htaccess and re-writes so any examples and or explanations would be greatly appreciated. Thank you very much.

    Read the article

  • Color picker does not give gradient appearance

    - by ykaratoprak
    i added below codes. But it generates to me 16 color. but i need 16 color between "red" and "khaki". i don't need gradient flow. My colors look like gradient flow. My colors must not closer to each other. Because i will use this codes return values in chart columns. they are too near each other. static class Program { [STAThread] static void Main() { Form form = new Form(); Color start = Color.Red, end = Color.Khaki; for (int i = 0; i < 16; i++) { int r = Interpolate(start.R, end.R, 15, i), g = Interpolate(start.G, end.G, 15, i), b = Interpolate(start.B, end.B, 15, i); Button button = new Button(); button.Dock = DockStyle.Top; button.BackColor = Color.FromArgb(r, g, b); form.Controls.Add(button); button.BringToFront(); } Application.Run(form); } static int Interpolate(int start, int end, int steps, int count) { float s = start, e = end, final = s + (((e - s) / steps) * count); return (int)final; } }

    Read the article

  • C# string syntax error

    - by Mesa
    I'm reading in data from a file and trying to write only the word immediately before 'back' in red text. For some reason it is displaying the word and then the word again backwords. Please help. Thank you. private void Form1_Load(object sender, EventArgs e) { Regex r = new Regex(" "); StreamReader sr = new StreamReader("KeyLogger.txt"); string[] tokens = r.Split(sr.ReadToEnd()); int index = 0; for(int i = 0; i <= tokens.Length; i++) { if (tokens[i].Equals("back")) { //richTextBox1.Text+="TRUE"; richTextBox1.SelectionColor = Color.Red; string myText; if (tokens[i - 1].Equals("back")) myText = ""; else myText = tokens[i - 1]; richTextBox1.SelectedText = myText; richTextBox1.Text += myText; } else { //richTextBox1.Text += "NOOOO"; } //index++; //richTextBox1.Text += index; } }

    Read the article

  • Fullcalendar doesn't render color when using eventRender

    - by jaffa
    When I set-up fullCalendar and set eventRender function callback, I want to set the color of the event depending if LeadId is null or not. But this doesn't seem to work even though the documentation says so: http://arshaw.com/fullcalendar/docs/event_data/Event_Object/#color-options Is there any way to set the event color to change based on the data? calendar = $('#dayview').fullCalendar({ .... timeFormat: 'HH:mm', columnFormat: { agendaDay: 'dddd dd/MM/yyyy' }, eventClick: function (calEvent, jsEvent, view) { var leadUrl = "/Leads/" + calEvent.LeadId; window.location = leadUrl; }, eventRender: function (event, element) { if (event.LeadId != null) { event.eventColor = "#B22222"; event.eventBackColor = "#B22222"; } }, UPDATE: This is really strange. The event has all my properties returned for the event off the server. element is just the DOM element for the event. When I drag/move the event to somewhere else in the calendar, the event turns red, and if I inspect the event object it now has color set to Red. So the question is why isn't it applying on the 1st render, but on subsequent renders (i.e. after move) the colour gets applied?

    Read the article

  • Fill parent container

    - by manix
    After several hours of design battle I come to you for a hand. I am building a website for a night club as you can see. I can't get stretch the centered area (bordered by yellow color) to the bottom of the page where the footer start (the footer is the green top-bordered div). This happends because the content is not enought to fill the rest of heigh. This is my css html, body{ height: 100%; margin: 0 auto; } #container{ height: auto !important; height: 100%; margin: 0 auto -50px; /* as #footer height */ min-height: 100%; text-align: center; border: 5px solid blue; } #centered-container{ width: 950px; margin: 0 auto; text-align: left; border: 5px solid yellow; } #body-container{ border: 5px solid red; } #footer, .footer{ height: 50px; } #footer{ text-align: center; border-top: 5px solid green; } And this is my html markup <body> <div id="container"> <!-- BLUE BORDER --> <div id="centered-container"> <!-- YELLOW BORDER --> <div id="body-container"> <!-- RED BORDER --> </div> </div> <div class="footer"></div> <!-- GREEN BORDER --> </div> <div id="footer"></div> </body> Expected behaviour: Additional facts - The colored borders is just for debugging porpuses

    Read the article

  • How to get pixel information inside a fragment shader?

    - by user697111
    In my fragment shader I can load a texture, then do this: uniform sampler2D tex; void main(void) { vec4 color = texture2D(tex, gl_TexCoord[0].st); gl_FragColor = color; } That sets the current pixel to color value of texture. I can modify these, etc and it works well. But a few questions. How do I tell "which" pixel I am? For example, say I want to set pixel 100,100 (x,y) to red. Everything else to black. How do I do a : "if currentSelf.Position() == (100,100); then color=red; else color=black?" ? I know how to set colors, but how do I get "my" location? Secondly, how do I get values from a neighbor pixel? I tried this: vec4 nextColor = texture2D(tex, gl_TexCoord[1].st); But not clear what it is returning? if I'm pixel 100,100; how do I get the values from 101,100 or 100,101?

    Read the article

  • The mathematics of Schellings segregation model

    - by Bruce
    For those who don't know the model. You can read this pdf. I want to find what is the probability that 2 nodes are each others neighbors when the algorithm converges (i.e. when all nodes are happy). Here's the model in a gist. You have a grid (say 10x10). You have nodes of two kind (red and green) 45 each. So we have 10 empty spaces. We randomly place the nodes on the grid. Now we scan through this grid (Exact order does not matter according to Schelling). Each node wants a specific percentage of people of same kind in its Moore neighborhood (say b = 50% for each red and green). We calculate the happiness of each node (a = Number of neighbors of same kind/Number of neighbors of different kind). If a node is unhappy (a < b) it moves to an empty cell where it knows it will be happy. This movement can change the dynamics of old as well as new neighborhood. Algorithm converges when all nodes are happy. PS - I am looking for links for any mathematical analysis of the Schelling's model.

    Read the article

  • (PHP) Converting an array of arrays from one format into another

    - by Richard Carter
    Hi, I currently have an array, created from a database, an example of which looks like the following: Array( [0] => Array ( objectid => 2, name => title, value => apple ), [1] => Array ( objectid => 2, name => colour, value => red ), [2] => Array ( objectid => 3, name => title, value => pear ), [3] => Array ( objectid => 3, name => colour, value => green ) ) What I would like to do is group all the items in the array by their objectid, and convert the 'name' values into keys and 'value' values into values of an associative array....like below: Array ( [0] => Array ( objectid => 2, title => apple, colour => red ), [1] => Array ( objectid => 3, title => pear, colour => green ) ) I've tried a few things but haven't really got anywhere.. Any ideas? Thanks in advance

    Read the article

  • 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

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >