Search Results

Search found 3747 results on 150 pages for '500'.

Page 40/150 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Remove padding in wxPython's wxWizard

    - by mridang
    Hi Guys, I'm using wxPython to create a wizard using the wxWizard control. I'm trying to a draw a colored rectangle but when I run the app, there seems to be a about a 10px padding on each side of the rectangle. This goes for all other controls too. I have to offset them a bit so that they appear exactly where I want them to. Is there any way I could remove this padding? Here's the source of my base Wizard page. class SimplePage(wx.wizard.PyWizardPage): """ Simple wizard page with unlimited rows of text. """ def __init__(self, parent, title): wx.wizard.PyWizardPage.__init__(self, parent) self.next = self.prev = None #self.sizer = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, -1, title) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) #self.sizer.AddWindow(title, 0, wx.ALIGN_LEFT|wx.ALL, padding) #self.sizer.AddWindow(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, padding) # self.SetSizer(self.sizer) self.Bind(wx.EVT_PAINT, self.OnPaint) def OnPaint(self, evt): """set up the device context (DC) for painting""" self.dc = wx.PaintDC(self) self.dc.BeginDrawing() self.dc.SetPen(wx.Pen("grey",style=wx.TRANSPARENT)) self.dc.SetBrush(wx.Brush("grey", wx.SOLID)) # set x, y, w, h for rectangle self.dc.DrawRectangle(0,0,500, 500) self.dc.EndDrawing() del self.dc def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev def Activated(self, evt): """ Executed when page is being activated. """ return def Blocked(self, evt): """ Executed when page is about to be switched. Switching can be blocked by returning True. """ return False def Cancel(self, evt): """ Executed when wizard is about to be canceled. Canceling can be blocked by returning False. """ return True Thanks guys.

    Read the article

  • Temporary storage for keeping data between program iterations?

    - by mr.b
    I am working on an application that works like this: It fetches data from many sources, resulting in pool of about 500,000-1,500,000 records (depends on time/day) Data is parsed Part of data is processed in a way to compare it to pre-existing data (read from database), calculations are made, and stored in database. Resulting dataset that has to be stored in database is, however, much smaller in size (compared to original data set), and ranges from 5,000-50,000 records. This process almost always updates existing data, perhaps adds few more records. Then, data from step 2 should be kept somehow, somewhere, so that next time data is fetched, there is a data set which can be used to perform calculations, without touching pre-existing data in database. I should point out that this data can be lost, it's not irreplaceable (key information can be read from database if needed), but it would speed up the process next time. Application components can (and will be) run off different computers (in the same network), so storage has to be reachable from multiple hosts. I have considered using memcached, but I'm not quite sure should I do so, because one record is usually no smaller than 200 bytes, and if I have 1,500,000 records, I guess that it would amount to over 300 MB of memcached cache... But that doesn't seem scalable to me - what if data was 5x that amount? If it were to consume 1-2 GB of cache only to keep data in between iterations (which could easily happen)? So, the question is: which temporary storage mechanism would be most suitable for this kind of processing? I haven't considered using mysql temporary tables, as I'm not sure if they can persist between sessions, and be used by other hosts in network... Any other suggestion? Something I should consider?

    Read the article

  • php when to use get method?

    - by user329394
    how all, when is the right time to use $_GET['data']? i want to pass value of userid from page A to page B by using popup javascript. $qry="SELECT * FROM dbase WHERE id='".$id."'"; $sql=mysql_query($qry); $rs=mysql_fetch_array($sql); <script language="JavaScript"> function myPopup() { window.open( "<?=$CFG->wwwroot.'/ptk/main.php?task=ptk_checkapp&id='.$rs['userid'];?>" ,"myWindow", "status = 1, height = 500, width = 500, scrollbars=yes,toolbar=no,directories=no,location=no,menubar=no, resizable='yes';" ) } </script> calling by hyperlink: <a href="#" onclick="myPopup()"> <?=ucwords(strtolower($rs->nama));?> </a> It seems that , the $rs['user'] dont hold any value on it. can tell me what problem or may be solution? thank you very much.

    Read the article

  • problem with fork()

    - by john
    I'm writing a shell which forks, with the parent reading the input and the child process parsing and executing it with execvp. pseudocode of main method: do{ pid = fork(); print pid; if (p<0) { error; exit; } if (p>0) { wait for child to finish; read input; } else { call function to parse input; exit; } }while condition return; what happens is that i never seem to enter the child process (pid printed is always positive, i never enter the else). however, if i don't call the parse function and just have else exit, i do correctly enter parent and child alternatingly. full code: int main(int argc, char *argv[]){ char input[500]; pid_t p; int firstrun = 1; do{ p = fork(); printf("PID: %d", p); if (p < 0) {printf("Error forking"); exit(-1);} if (p > 0){ wait(NULL); firstrun = 0; printf("\n> "); bzero(input, 500); fflush(stdout); read(0, input, 499); input[strlen(input)-1] = '\0'; } else exit(0); else { if (parse(input) != 0 && firstrun != 1) { printf("Error parsing"); exit(-1); } exit(0); } }while(strcmp(input, "exit") != 0); return 0; }

    Read the article

  • jQuery UI Rang Slider show divs based on selected range

    - by andi_sf
    I have set up a range slider that should show/hide divs based on their range values - meaning if the range of the one specifies in the div falls into the selected range in the slider it should show - the others hide. Somehow it does not work correctly - if anybody could help that would be greatly appreciated. My code so far: $("#slider").slider({ range: true, min: 150, max: 280, step: 5, values: [150, 280], slide: function(event, ui) { $("#amount").val('Min. Value' + ui.values[0] + ' - Max. Value' + ui.values[1]); }, change: function(event, ui) { $('#col-2 div').each(function(){ var valueS = parseInt($(this).attr("class")); var valueX = parseInt($(this).attr("title")); if (valueS < ui.values[0] && valueX <= ui.values[1] || valueS ui.values[0] && valueX = ui.values[1] ) { $(this).stop().animate({opacity: 0.25}, 500) } else { $(this).stop().animate({opacity: 1.0}, 500) $("#amount").val('Min. Value' + ui.values[0] + ' - Max. Value' + ui.values[1]); } }); } }); $("#amount").val('Min. Value' + $("#slider").slider("values", 0) + ' - Max. Value' + $("#slider").slider("values", 1)); }); I have also posted a sample at: http://www.webdesigneroakland.com/slider/444range_slider.html

    Read the article

  • Why does adding Crossover to my Genetic Algorithm give me worse results?

    - by MahlerFive
    I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the Ordered Crossover and the PMX Crossover methods, and both suffer from bad results. Here are the other parameters I'm using: Mutation: Single Swap Mutation or Inverted Subsequence Mutation (as described by Tiendil here) with mutation rates tested between 1% and 25%. Selection: Roulette Wheel Selection Fitness function: 1 / distance of tour Population size: Tested 100, 200, 500, I also run the GA 5 times so that I have a variety of starting populations. Stop Condition: 2500 generations With the same dataset of 26 points, I usually get results of about 500-600 distance using purely mutation with high mutation rates. When adding crossover my results are usually in the 800 distance range. The other confusing thing is that I have also implemented a very simple Hill-Climbing algorithm to solve the problem and when I run that 1000 times (faster than running the GA 5 times) I get results around 410-450 distance, and I would expect to get better results using a GA. Any ideas as to why my GA performing worse when I add crossover? And why is it performing much worse than a simple Hill-Climb algorithm which should get stuck on local maxima as it has no way of exploring once it finds a local max?

    Read the article

  • Indexing community images for google image search

    - by Vittorio Vittori
    Hi, I'm trying to understand how can I do to let my site be reachable from google image search spiders. I like how last.fm solution, and I thought to use a technique like his staff do to let google find artists images on their pages. When I'm looking for an artist and I search it on google image search, as often as not I find an image from last.fm artists page, I make an example: If I search the band Pure Reason Revolution It brings me here, the artist's image page http://www.last.fm/music/Pure+Reason+Revolution/+images/4284073 Now if I take a look to the image file, i can see it's named: http://userserve-ak.last.fm/serve/500/4284073/Pure+Reason+Revolution+4.jpg so if I try to undertand how the service works I can try to say: http://userserve-ak.last.fm/serve/ the server who serve the images 500/ the selected size for the image 4284073/ the image id for database Pure+Reason+Revolution+4.jpg the image name I thought it's difficult to think the real filename for the image is Pure+Reason+Revolution+4.jpg for image overwrite problems when an user upload it, in fact if I digit: http://userserve-ak.last.fm/serve/500/4284073.jpg I probably find the real image location and filename With this tecnique the image is highly reachable from search engines and easily archived. My question is, does exist some guide or tutorial to approach on this kind of tecniques, or something similar?

    Read the article

  • flood fill algorithm

    - by user335593
    i want to implement the flood fill algorthm...so that when i get the x and y co-od of a point...it should start flooding from that point and fill till it finds a boundary but it is not filling the entire region...say a pentagon this is the code i am using void setpixel(struct fill fillcolor,int x,int y) { glColor3f(fillcolor.r,fillcolor.g,fillcolor.b); glBegin(GL_POINTS); glVertex2i(x,y); glEnd(); glFlush(); } struct fill getpixcol(int x,int y) { struct fill gotpixel; glReadPixels(x,y,1,1,GL_RGB,GL_UNSIGNED_BYTE,pick_col); gotpixel.r =(float) pick_col[0]/255.0; gotpixel.g =(float) pick_col[1]/255.0; gotpixel.b =(float) pick_col[2]/255.0; return(gotpixel); } void floodFill(int x, int y,struct fill fillcolor,struct fill boundarycolor) { struct fill tmp; // if ((x < 0) || (x >= 500)) return; // if ((y < 0) || (y >= 500)) return; tmp=getpixcol(x,y); while (tmp.r!=boundarycolor.r && tmp.g!=boundarycolor.g && tmp.b!=boundarycolor.b) { setpixel(fillcolor,x,y); setpixel(fillcolor,x+1,y); setpixel(fillcolor,x,y+1); setpixel(fillcolor,x,y-1); setpixel(fillcolor,x-1,y); floodFill(x-1,y+1,fillcolor,boundarycolor); floodFill(x-1,y,fillcolor,boundarycolor); floodFill(x-1,y-1,fillcolor,boundarycolor); floodFill(x,y+1,fillcolor,boundarycolor); floodFill(x,y-1,fillcolor,boundarycolor); floodFill(x+1,y+1,fillcolor,boundarycolor); floodFill(x+1,y,fillcolor,boundarycolor); floodFill(x+1,y-1,fillcolor,boundarycolor); } }

    Read the article

  • How to get IQueryable<> from stored procedure (entity framework)

    - by mmcteam
    I want to get IQueryable<> result when executing stored procedure. Here is peace of code that works fine: IQueryable<SomeEntitiy> someEntities; var globbalyFilteredSomeEntities = from se in m_Entities.SomeEntitiy where se.GlobalFilter == 1234 select se; I can use this to apply global filter, and later use result in such way result = globbalyFilteredSomeEntities .OrderByDescending(se => se.CreationDate) .Skip(500) .Take(10); What I want to do - use some stored procedures in global filter. I tried: Add stored procedure to m_Entities, but it returns IEnumerable<> and executes sp immediately: var globbalyFilteredSomeEntities = from se in m_Entities.SomeEntitiyStoredProcedure(1234); Materialize query using EFExtensions library, but it is IEnumerable<>. If I use AsQueryable() and OrderBy(), Skip(), Take() and after that ToList() to execute that query - I get exception that DataReader is open and I need to close it first(can't paste error - it is in russian). var globbalyFilteredSomeEntities = m_Entities.CreateStoreCommand("exec SomeEntitiyStoredProcedure(1234)") .Materialize<SomeEntitiy>(); //.AsQueryable() //.OrderByDescending(se => se.CreationDate) //.Skip(500) //.Take(10) //.ToList(); Also just skipping .AsQueryable() is not helpful - same exception.

    Read the article

  • JQuery Progress Bar Inline Text

    - by Craig
    Hello, I am trying to use the basic progress bar however I am unable to figure out the css/command to actually put some text inside the bar. I am using this progress bar: http://docs.jquery.com/UI/Progressbar however I am open to other ones if they are just as simple to implement. I want it to display in the left corner some static information and then a percentage of complete somewhere in the right section. All css I attempted to do just made the information display below or to the side of. As well I am unsure how to actually have this CSS change based on a JQuery method (new to JQuery). below is my actual JQuery. Don't try to understand the url value just assume it returns 0-100. <script type="text/javascript"> var url = "%%$protocol_url%%/bin/task_status?id=%%$tid%%&cmd=percent_done"; $(function() { var progress = 0; //alert("some value" + value, value); $("#progressbar").progressbar({ progress: 0 }); setTimeout(updateProgress, 500); }); function updateProgress() { var progress; $.get(url, function(data) { // data contains whatever that page returns if (data < 100) { $("#progressbar") .progressbar("option", "value", data); setTimeout(updateProgress, 500); } else { $("#progressbar") .progressbar("option", "value", 100); } }); } Thanks

    Read the article

  • Cairo / GTK example code crashes when window is too big or maximized

    - by user1890673
    I have copied and compiled the source code available in the section titled "Full Source". http://cairographics.org/threaded_animation_with_cairo/ I adapted this code to a project that I'm working on only to find that the app would crash when I made the window too big. Going back to the original example code, it too crashes when the window is too big ( 1000x1000 or so). I narrowed down in the example that this line appears to be responsible: pixmap = gdk_pixmap_new(window-window,500,500,-1); Where pixmap is of type GdkPixmap*. Resizing the window overwrites pixmap with a new pixmap that is the size of the window. I am doing this in Eclipse Juno in Windows Vista, 32-bit. My compiler is MinGW version 0.5-beta-20120426-1. My GTK+ version is 2.24.10 and apparently Cairo is 1.10.2 I added all of the includes and libraries for GTK and also added compiler switch -mms-bitfields. Is there a limit to the size of a pixmap or something? I'm just starting with GTK with examples so I'm not sure where to go if this example doesn't work.

    Read the article

  • Prepare community images for google image search indexing

    - by Vittorio Vittori
    Hi, I'm trying to understand how can I do to let my site be reachable from google image search spiders. I like how last.fm solution, and I thought to use a technique like his staff do to let google find artists images on their pages. When I'm looking for an artist and I search it on google image search, as often as not I find an image from last.fm artists page, I make an example: If I search the band Pure Reason Revolution It brings me here, the artist's image page http://www.last.fm/music/Pure+Reason+Revolution/+images/4284073 Now if I take a look to the image file, i can see it's named: http://userserve-ak.last.fm/serve/500/4284073/Pure+Reason+Revolution+4.jpg so if I try to undertand how the service works I can try to say: http://userserve-ak.last.fm/serve/ the server who serve the images 500/ the selected size for the image 4284073/ the image id for database Pure+Reason+Revolution+4.jpg the image name I thought it's difficult to think the real filename for the image is Pure+Reason+Revolution+4.jpg for image overwrite problems when an user upload it, in fact if I digit: http://userserve-ak.last.fm/serve/500/4284073.jpg I probably find the real image location and filename With this tecnique the image is highly reachable from search engines and easily archived. My question is, does exist some guide or tutorial to approach on this kind of tecniques, or something similar?

    Read the article

  • Counting problem C#

    - by MadBoy
    Hello, I've a bit of a problem. I'm adding numbers to ArrayList like 156, 340 (when it is TransferIn or Buy) etc and then i remove them doing it like 156, 340 (when it's TransferOut, Sell). Following solution works for that without a problem. The problem I have is that for some old data employees were entering sum's like 1500 instead of 500+400+100+500. How would I change it so that when there's Sell/TransferOut and there's no match inside ArrayList it should try to add multiple items from that ArrayList and find elements that combine into aggregate. ArrayList alNew = new ArrayList(); ArrayList alNewPoIle = new ArrayList(); ArrayList alNewCo = new ArrayList(); string tempAkcjeCzynnosc = (string) alInstrumentCzynnoscBezNumerow[i]; string tempAkcjeInId = (string) alInstrumentNazwaBezNumerow[i]; decimal varAkcjeCena = (decimal) alInstrumentCenaBezNumerow[i]; decimal varAkcjeIlosc = (decimal) alInstrumentIloscBezNumerow[i]; int index; switch (tempAkcjeCzynnosc) { case "Sell": case "TransferOut": index = alNew.IndexOf(varAkcjeIlosc); if (index != -1) { alNew.RemoveAt(index); alNewPoIle.RemoveAt(index); alNewCo.RemoveAt(index); } else { // Number without match encountred } break; case "Buy": case "TransferIn": alNew.Add(varAkcjeIlosc); alNewPoIle.Add(varAkcjeCena); alNewCo.Add(tempAkcjeInId); break; } }

    Read the article

  • Prepare your site images for google image search indexing

    - by Vittorio Vittori
    Hi, I'm trying to understand how can I do to let my site be reachable from google image search spiders. I like how last.fm solution, and I thought to use a technique like his staff do to let google find artists images on their pages. When I'm looking for an artist and I search it on google image search, as often as not I find an image from last.fm artists page, I make an example: If I search the band Pure Reason Revolution It brings me here, the artist's image page http://www.last.fm/music/Pure+Reason+Revolution/+images/4284073 Now if I take a look to the image file, i can see it's named: http://userserve-ak.last.fm/serve/500/4284073/Pure+Reason+Revolution+4.jpg so if I try to undertand how the service works I can try to say: http://userserve-ak.last.fm/serve/ the server who serve the images 500/ the selected size for the image 4284073/ the image id for database Pure+Reason+Revolution+4.jpg the image name I thought it's difficult to think the real filename for the image is Pure+Reason+Revolution+4.jpg for image overwrite problems when an user upload it, in fact if I digit: http://userserve-ak.last.fm/serve/500/4284073.jpg I probably find the real image location and filename With this tecnique the image is highly reachable from search engines and easily archived. My question is, does exist some guide or tutorial to approach on this kind of tecniques, or something similar?

    Read the article

  • Java Stopping JApplet Components from Resizing based on Applet Size

    - by Doug
    Creating a JApplet I have 2 Text Fields, a button and a Text Area. private JPanel addressEntryPanel = new JPanel(new GridLayout(1,3)); private JPanel outputPanel = new JPanel(new GridLayout(1,1)); private JTextField serverTf = new JTextField(""); private JTextField pageTf = new JTextField(""); private JTextArea outputTa = new JTextArea(); private JButton connectBt = new JButton("Connect"); private JScrollPane outputSp = new JScrollPane(outputTa); public void init() { setSize(500,500); setLayout(new GridLayout(3,1)); add(addressEntryPanel); addressEntryPanel.add(serverTf); addressEntryPanel.add(pageTf); addressEntryPanel.add(connectBt); addressEntryPanel.setPreferredSize(new Dimension(50,50)); addressEntryPanel.setMaximumSize(addressEntryPanel.getPreferredSize()); addressEntryPanel.setMinimumSize(addressEntryPanel.getPreferredSize()); add(outputPanel); outputPanel.add(outputSp); outputTa.setLineWrap(true); connectBt.addActionListener(this); The problem is when debugging and putting it in a page the components / panels resize depending on the applet size. I don't want this. I want the textfields to be a certain size, and the text area to be a certain size. I've put stuff in there to set the size of them but they aren't working. How do I go about actually setting a strict size for either the components or the JPanel.

    Read the article

  • Getting Depth Value on Kinect SDK 1.6

    - by AlexanderPD
    this is my first try on Kinect and Kinect SDK so I'm having a lot of "newbie issues" :) my goal is to point my mouse on the Kinect standard video output and get the depth value. I already have both normal video and depth video outputs by using the 2 "Color Basic-WPF" and "Depth Basic-WPF" samples, and handling mouse events or position is not a problem. In fact i already did all and i already got a depth value, but this value is always HIGHLY imprecise. It jumps from 500 to 4000 by just moving to the next pixel in a plane surface. So.. I'm pretty sure I'm reading the depth value in the wrong way. This is how i read it: short debugValue = depthPixels[x*y].Depth; debug.Text = "X = "+x+", Y = "+y+", value = "+debugValue.ToString(); i know it's pretty out of context, this little piece of code is inside the same SensorDepthFrameReady function in "Depth Basic-WPF"! "x" and "y" are the mouse coordinates and depthPixels is DepthImagePixel[] type, a temporary array filled with the "depthFrame.CopyDepthImagePixelDataTo(this.depthPixels);" instruction. Depth frame is filled here: DepthImageFrame depthFrame = e.OpenDepthImageFrame() the "e" comes from here: private void SensorDepthFrameReady(object sender, DepthImageFrameReadyEventArgs e) and this last one is called here: this.sensor.DepthFrameReady += this.SensorDepthFrameReady; how i must handle that depth value i get? I know the value must be between 800 and 4000 but i get values between about 500 and about 8000. i already google a lot (here on SO too) and i still can't understand if the depth value is 11 or 13 bit. The sdk examples uses shrink this value to 8 bit and this is making even more confusion in my head :(

    Read the article

  • JQuery fadeIn fadeOut loop issue

    - by Tarun
    I am trying to create a jQuery fadeIn fadeout effect for my page content using the code below. $(document).ready(function (){ $("#main").click(function(){ $("#content").fadeOut(800, function(){ $("#content").load("main.html", function(){ $("#content").fadeIn(800); }); }); }); $("#gallery").click(function(){ $("#content").fadeOut(800, function(){ $("#content").load("gallery.html", function(){ $("#content").fadeIn(800); }); }); }); }); So whenever a user clicks on either the main link or gallery link, the old content fades out and new content fades in. The problem I am facing is that for every link I have to repeat the same code again and again. So I tried to use a loop to simplify this but it doesn't work. Here is my code: var p = ["#main","#gallery", "#contact"]; var q = ["main.html", "gallery.html", "contact.html"]; for (i=0;i<=(p.length-1);i++){ $(p[i]).click(function(){ $("#content").fadeOut(500, function(){ $("#content").load(q[i], function(){ $("#content").fadeIn(500); }); }); }); } It works fine when I write repeat the scripts for each link but it doesn't work when I combine them in a loop. I only get the FadeOut effect and nothing happens after that. This might be a very simple issue or may be something deep into jQuery. Any hint or help is greatly appreciated. TK

    Read the article

  • Controller changes format on variables when publishing

    - by Christoffer
    I am a newbie to ROR but catching on quickly. I have been working on this problem for a couple of hours now and it seems like a bug. I does not make any sense. I have a database with the following migration: class CreateWebsites < ActiveRecord::Migration def self.up create_table :websites do |t| t.string :name t.integer :estimated_value t.string :webhost t.string :purpose t.string :description t.string :tagline t.string :url t.integer :adsense t.integer :tradedoubler t.integer :affiliator t.integer :adsense_cpm t.boolean :released t.string :empire_type t.string :oldid t.string :old_outlink_policy t.string :old_inlink_policy t.string :old_priority t.string :old_profitability t.integer :priority_id t.integer :project_id t.integer :outlink_policy_id t.integer :inlink_policy_id t.timestamps end end def self.down drop_table :websites end end I have verified that what is created in the database also is integers, strings etc according to this migration. I have not touched the controller after generating it through scaffold, i.e. it is the standard controller with show, index etc. Now. When I enter data into the database, either through the web form, in rails console or directly in the database - such as www.domain.com for url or 500 for adsense - it will be created in the db without problem. However, when it is being published on the website the variables go completely nuts. Adsense (integer) turns into date, url (string) turns into a float, and so on. This only happens to a few of the variables. This will also create a problem with "argument out of range" since I input 500 and Rails will try to output it as date = crash and "argument out of range". So, how do I fix/trouble shoot this? Why do the formats change? Could it be because of the respond_to in the controller? Cheers, Christoffer

    Read the article

  • Pulling a value from one jQuery function into another

    - by Travis
    I'm trying to take the hex value chosen from a jQuery colorpicker plugin, and store it as a cookie using the jQuery cookie plugin. I just don't know the appropriate way to tie the two together (new to js and jQuery). Here's my colorpicker function: $('#colorSelector').ColorPicker({ color: '#ffffff', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $('#colorSelector div, .preview-image, .cover ').css('backgroundColor', '#' + hex); $('body').css('backgroundColor', '#' + hex); $.cookie('bgColor', 'picker'); return false; } }); And here's my cookie function as is: var bgColor = $.cookie('bgColor'); if (bgColor == 'picker') { $('#colorSelector div, .preview-image, .cover ').css('backgroundColor', '#' + hex); }; I can set and store the cookie value as a standard css background-color, but can't figure out how to pull the "'backgroundColor', '#' + hex" value into the cookie function.

    Read the article

  • Google app engine: Poor Performance with JDO + Datastore

    - by Bosh
    I have a simple data model that includes USERS: store basic information (key, name, phone # etc) RELATIONS: describe, e.g. a friendship between two users (supplying a relationship_type + two user keys) I'm getting very poor performance, for instance, if I try to print the first names of all of a user's friends. Say the user has 500 friends: I can fetch the list of friend user_ids very easily in a single query. But then, to pull out first names, I have to do 500 back-and-forth trips to the Datastore, each of which seems to take on the order of 30 ms. If this were SQL, I'd just do a JOIN and get the answer out fast. I understand there are rudimentary facilities for performing joins across un-owned relations in a relaxed implementation of JDO (as described at http://gae-java-persistence.blogspot.com) but they sound experimental and non-standard (e.g. my code won't work in any other JDO implementation). Is this really my best bet? Otherwise, how do people extract satisfactory performance from JDO/Datastore in this kind of (very common) situation? -Bosh

    Read the article

  • how do I call a javacript function every 60 seconds?

    - by William
    So I'm trying to work on a Canvas demo, and I want this square to move from one side to the other, but I can't figure out how to call javascript in a way that repeats every 60 seconds. Here's what I got so far: <!DOCTYPE html> <html lang="en"> <head> <title>Canvas test</title> <meta charset="utf-8" /> <link href="/bms/style.css" rel="stylesheet" /> <style> body { text-align: center; background-color: #000000;} canvas{ background-color: #ffffff;} </style> <script type="text/javascript"> var x = 50; var y = 250; function update(){ draw(); x = x + 5; } function draw(){ var canvas = document.getElementById('screen1'); if (canvas.getContext){ var ctx = canvas.getContext('2d'); ctx.fillStyle = 'rgb(236,138,68)'; ctx.fillRect(x,y,24,24); } } </script> </head> <body onLoad="setTimeout(update(), 0);"> <canvas id="screen1" width="500" height="500"></canvas> </body> </html>

    Read the article

  • How do I bind arrays to columns in a WPF datagrid

    - by user1432917
    I have a Log object that contains a list of Curve objects. Each curve has a Name property and an array of doubles. I want the Name to be in the column header and the data below it. I have a user control with a datagid. Here is the XAML; <UserControl x:Class="WellLab.UI.LogViewer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="500"> <Grid> <StackPanel Height="Auto" HorizontalAlignment="Stretch" Margin="0" Name="stackPanel1" VerticalAlignment="Stretch" Width="Auto"> <ToolBarTray Height="26" Name="toolBarTray1" Width="Auto" /> <ScrollViewer Height="Auto" Name="scrollViewer1" Width="Auto" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" CanContentScroll="True" Background="#E6ABA4A4"> <DataGrid AutoGenerateColumns="True" Height="Auto" Name="logDataGrid" Width="Auto" ItemsSource="{Binding}" HorizontalAlignment="Left"> </DataGrid> </ScrollViewer> </StackPanel> </Grid> In the code behind I have figured out how to create columns and name them, but I have not figured out how to bind the data. public partial class LogViewer { public LogViewer(Log log) { InitializeComponent(); foreach (var curve in log.Curves) { var data = curve.GetData(); var col = new DataGridTextColumn { Header = curve.Name }; logDataGrid.Columns.Add(col); } } } I wont even show the code I tried to use to bind the array "data", since nothing even came close. I am sure I am missing something simple, but after hours of searching the web, I have to come begging for an answer.

    Read the article

  • cURL gets Internal Server Error when posting to aspx page

    - by Mihai
    I have a big problem. I have some applications made on an unix based system, and I use PHP with cURL to post an XML question to an IIS server with asp.net. Every time I ask the server something I get error: HTTP/1.1 500 Internal Server Error Date: Tue, 04 May 2010 07:36:08 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 3032 But if I ask same question on another server, almost identically to this one (BOTH configured by me) I get results like it should and the headers: HTTP/1.1 200 OK Date: Tue, 04 May 2010 07:39:37 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 9169 I tried everything, searched hundreds of forums, but i don't find anything. In IIS logs I only get: 2010-05-04 07:36:08 W3SVC1657587027 80.xx.xx.xx POST /XML_SERV/XmlAPI.aspx - 80 - 80.xx.xx.xx Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1 500 0 0 any ideas where to look what is going on? I forgot to mention! If I use an XML request software, and ask same question, it works.

    Read the article

  • forms problem in django 1.1

    - by alexarsh
    I have the following form: class ModuleItemForm2(forms.ModelForm): class Meta: model = Module_item fields = ('title', 'media', 'thumb', 'desc', 'default', 'player_option') The model is: class Module_item(models.Model): title = models.CharField(max_length=100) layout = models.CharField(max_length=5, choices=LAYOUTS_CHOICE) media = models.CharField(help_text='Media url', max_length=500, blank=True, null=True) conserv = models.ForeignKey(Conserv, help_text= 'Redirect to Conserv', blank=True, null=True) conserve_section = models.CharField(max_length=100, help_text= 'Section within the redirected Conserv', blank=True, null=True) parent = models.ForeignKey('self', help_text='Upper menu.', blank=True, null=True) module = models.ForeignKey(Module, blank=True, null=True) thumb = models.FileField(upload_to='sms/module_items/thumbs', blank=True, null=True) desc = models.CharField(max_length=500, blank=True, null=True) auto_play = models.IntegerField(help_text='Auto start play (miliseconds)', blank=True, null=True) order = models.IntegerField(help_text='Display order', blank=True, null=True) depth = models.IntegerField(help_text='The layout depth', blank=True, null=True) flow_replace = models.IntegerField(blank=True, null=True) default = models.IntegerField(help_text='The selected sub item (Note: Starting from 0)', blank=True, null=True) player_options = models.CharField(max_length=1000, null=True, blank=True) In my view I build form: module_item_form2 = ModuleItemForm2() print module_item_form2 And I get the following error on the print line: 'NoneType' object has no attribute 'label' It works fine with django 1.0.2. I see the error only in django 1.1. Do you have an idea what am I doing wrong? Regards, Arshavski Alexander.

    Read the article

  • Thread-safety of read-only memory access

    - by Edmund
    I've implemented the Barnes-Hut gravity algorithm in C as follows: Build a tree of clustered stars. For each star, traverse the tree and apply the gravitational forces from each applicable node. Update the star velocities and positions. Stage 2 is the most expensive stage, and so is implemented in parallel by dividing the set of stars. E.g. with 1000 stars and 2 threads, I have one thread processing the first 500 stars and the second thread processing the second 500. In practice this works: it speeds the computation by about 30% with two threads on a two-core machine, compared to the non-threaded version. Additionally, it yields the same numerical results as the original non-threaded version. My concern is that the two threads are accessing the same resource (namely, the tree) simultaneously. I have not added any synchronisation to the thread workers, so it's likely they will attempt to read from the same location at some point. Although access to the tree is strictly read-only I am not 100% sure it's safe. It has worked when I've tested it but I know this is no guarantee of correctness! Questions Do I need to make a private copy of the tree for each thread? Even if it is safe, are there performance problems of accessing the same memory from multiple threads?

    Read the article

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