Search Results

Search found 5192 results on 208 pages for 'random forests'.

Page 121/208 | < Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >

  • How do I force ode45 to take steps of exactly 0.01 on the T axis?

    - by Gravitas
    I'm using Matlab to solve a differential equation. I want to force ode45 to take constant steps, so it always increments 0.01 on the T axis while solving the equation. How do I do this? ode45 is consistently taking optimized, random steps, and I can't seem to work out how to make it take consistent, small steps of 0.01. Here is the code: options= odeset('Reltol',0.001,'Stats','on'); %figure(1); %clf; init=[xo yo zo]'; tspan=[to tf]; %tspan = t0:0.01:tf; [T,Y]=ode45(name,tspan,init,options);

    Read the article

  • Object Oriented Design Questions

    - by Robert
    Hello there. I am going to develop a Tic-Tac-Toe game using Java(or maybe other OO Languages).Now I have a picture in my mind about the general design. Interface: Player ,then I will be able to implement a couple of Player classes,based on how I want the opponent to be,for example,random player,intelligent player. Classes: Board class,with a two-dimensional array of integers,0 indicates open,1 indicates me,-1 indicates opponent.The evaluation function will be in here as well,to return the next best move based on the current board arrangement and whose turn it is. Refree class,which will create instance of the Board and two player instances,then get the game begin. This is a rough idea of my OO design,could anybody give me any critiques please,I find this is really beneficial,thank you very much.

    Read the article

  • Memcached broken pipe in rails

    - by abronte
    I seem to run into some random broken pipe errors if I try to access memcached a specific way. When I try to access memcached via Rails.cache, the first one or two reads/writes will result in a "MemCacheError (Broken pipe): Broken pipe" and return nil. But if I access memcached through a new object (ActiveSupport::Cache::MemCacheStore.new) I don't get the broken pipe error at all. I've tried upgrading to memcached 1.4.4 (was previously using 1.2.2) and I still got the error. I'm using rails 2.3.5. I would prefer to access memcached through Rails.cache because I takes namespaces into account. Any ideas?

    Read the article

  • Why the following Java code has different outputs each time?

    - by Maxood
    I don't know about threads in Java. I like to know what is happening in this code because each time it runs, it produces a different output: public class TwoThreadsDemo{ public static void main(String[] args) { new SimpleThread("Java Programmer").start(); new SimpleThread("Java Programmer").start(); } } class SimpleThread extends Thread{ public SimpleThread(String str) { super(str); } public void run() { for (int i=0;i<10;i++) { System.out.println(i + " " + getName()); try { sleep((long)(Math.random()*1000)); } catch(InterruptedException e) { } } System.out.println("Done!" + getName()); } }

    Read the article

  • Check ReturnUrl is valid before redirecting

    - by Josh
    I'm using ASP.NET Membership and Form Authentication and before redirecting to the returnURL I wanted to validate it. For those unfamiliar with the workflow, basically if you request a page that requires that you are authenticated, you are redirected to a login page. In the URL string you'll see a parameter called returnURL, e.g. http://example.com/login.aspx?ReturnUrl=%2fprotected%2fdefault.aspx Whether you use this in a redirect such as Response.Redirect(returnURL) or indirectly through the FormsAuthentication.RedirectFromLoginPage method, it passes without validating returnURL. FormsAuthentication.RedirectFromLoginPage does have a security check that it is isn't leaving the domain, but that still doesn't stop someone from putting enough random characters to cause an error. I tried using System.IO.File.Exists(Server.MapPath(returnURL)) but given enough illegal characters it cause Server.MapPath to error. Note: URLEncoding doesn't work because we are not cleaning a parameter, but the primary URL. Any other suggestions for validating or cleaning the returnURL value?

    Read the article

  • Why is WPFToolkit DataGrid so slow when binding?

    - by Schneider
    I have a very simple test application where I have two objects, each with a small collection of items. when I select an object I display its collection in a WPFToolkit DataGrid. The problem is there is a noticeable delay, such that if you press up/down keys to toggle selection between objects you can see it can't keep up. Why is the performance so bad? <Window x:Class="SlowGridBinding.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" Title="MainWindow" Height="350" Width="525"> <StackPanel> <ListBox ItemsSource="{Binding Shops}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True"/> <Controls:DataGrid ItemsSource="{Binding Shops/Vegetables}" AutoGenerateColumns="True"/> </StackPanel> The DataContext is populated with some test classes filled with 50 items of random test data.

    Read the article

  • the best method for google indexing text content in images?

    - by dnuske
    Hi everybody, I have a webpage where I put 1 image once in a while, this is just like xkcd.com I would like to know how to let google know the text in my images. My approach is to put the text in alt html attribute, like this: <img src="http://myapokalips.com/public/cartoons/021_Robot_Tattoo.png" alt="RETARD - aw, that's a sick tattoo! - yea, bro, it means 'strength'" /> is that right? or should I put the text in some random metatag? thank you in advance.

    Read the article

  • AttributeError while adding colorbar in matplotlib

    - by bgbg
    The following code fails to run on Python 2.5.4: from matplotlib import pylab as pl import numpy as np data = np.random.rand(6,6) fig = pl.figure(1) fig.clf() ax = fig.add_subplot(1,1,1) ax.imshow(data, interpolation='nearest', vmin=0.5, vmax=0.99) pl.colorbar() pl.show() The error message is C:\temp>python z.py Traceback (most recent call last): File "z.py", line 10, in <module> pl.colorbar() File "C:\Python25\lib\site-packages\matplotlib\pyplot.py", line 1369, in colorbar ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw) File "C:\Python25\lib\site-packages\matplotlib\figure.py", line 1046, in colorbar cb = cbar.Colorbar(cax, mappable, **kw) File "C:\Python25\lib\site-packages\matplotlib\colorbar.py", line 622, in __init__ mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax AttributeError: 'NoneType' object has no attribute 'autoscale_None' How can I add colorbar to this code? Following is the interpreter information: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>

    Read the article

  • Codeigniter and Paypal: How it works

    - by Abs
    Hello all, Two random question as I try to integerate Paypal IPN into my Codeigniter based web app. 1) Are these two lines the same? $data['pp_info'] = $this->input->post(); $data['pp_info'] = $_POST; 2) A user agrees to pay a monthly recurring fee to use your service using paypal - first payment you are aware they have paid as you get data returned from paypal. But how do you keep track if users has paid for the following months? How do you know the user has not cancelled from their paypal account? Thanks all for any help

    Read the article

  • Iphone SDK, arc4random CGPointmake?

    - by Harry
    I have tried using integers to store the number like so: playPin = 35 + arc4random() % 118; playY = -50 - arc4random() %100; if (CGRectIntersectsRect(pin.frame, refreshpin.frame)){ pin.center = CGPointMake(playPin, playY); pinend.center = CGPointMake(pin.center.x, pin.center.y+58); } Then using them, when needed, but... its random the first time, then it just keeps repeating itself. then i tried this: if (CGRectIntersectsRect(pin.frame, refreshpin.frame)){ pin.center = CGPointMake(35 + arc4random() % 118, -50 - arc4random() %100); pinend.center = CGPointMake(pin.center.x, pin.center.y+58); } And this also doesn't work, you cant even see the items i want to display! Any ideas? Thanks. Harry.

    Read the article

  • Rails migration to add boolean column to Postgres on Heroku

    - by pmc255
    I'm trying to execute a simple Rails migration to add a boolean column to an existing table. Here's the add_column call: add_column :users, :soliciting, :boolean, :null => false, :default => false However, after the migration runs (successfully, with no errors), I don't see the new column. If I go into the console and list the columns on the User table, for example, with this command: >> User.columns.each { |c| puts "#{c.name} : #{c.type}" } All the other columns show up, but not the one I just added with the migration. What's even more strange is that looking up a random user object yields the Postgres version of booleans (Ruby strings) >> User.find(1).soliciting => "t" However, the existing boolean columns all show up with standard Ruby boolean values of true and false. What's going on here? Is the migration actually complete? Why doesn't the column show up, yet is accessible in the model objects?

    Read the article

  • async handler deleted by the wrong thread in django

    - by user3480706
    I'm run this algorithm in my django application.when i run several time from my GUI django local server will stopped and i got this error Exception RuntimeError: RuntimeError('main thread is not in main loop',) in ignored Tcl_AsyncDelete: async handler deleted by the wrong thread Aborted (core dumped) code print "Learning the sin function" network =MLP.MLP(2,10,1) samples = np.zeros(2000, dtype=[('x', float, 1), ('y', float, 1)]) samples['x'] = np.linspace(-5,5,2000) samples['y'] = np.sin(samples['x']) #samples['y'] = np.linspace(-4,4,2500) for i in range(100000): n = np.random.randint(samples.size) network.propagate_forward(samples['x'][n]) network.propagate_backward(samples['y'][n]) plt.figure(figsize=(10,5)) # Draw real function x = samples['x'] y = samples['y'] #x=np.linspace(-6.0,7.0,50) plt.plot(x,y,color='b',lw=1) samples1 = np.zeros(2000, dtype=[('x1', float, 1), ('y1', float, 1)]) samples1['x1'] = np.linspace(-4,4,2000) samples1['y1'] = np.sin(samples1['x1']) # Draw network approximated function for i in range(samples1.size): samples1['y1'][i] = network.propagate_forward(samples1['x1'][i]) plt.plot(samples1['x1'],samples1['y1'],color='r',lw=3) plt.axis([-2,2,-2,2]) plt.show() plt.close() return HttpResponseRedirect('/charts/charts') how can i fix this error ?need a quick help

    Read the article

  • List of dict in Python

    - by plalex
    Hi everybody, I've got a list of dict in Python: dico_cfg = {'name': entry_name, 'ip': entry_ip, 'vendor': combo_vendor, 'stream': combo_stream} self.list_cfg.append(dico_cfg) I append to my list a lot of dict in the same way. Now I would like to delete one dict and only one dict in this list? What is the best way to proceed? I've try with the index of the list, but when I remove a dict from the list, the index is modify, so after some random remove my index doesn't correspond anymore to the dict I want to remove in my list. I hope that is clear. Maybe I can add an "id" row in my dict, so I can ask to remove more preciously the dict I want. I'll ask to remove the dict where id is equal to the id's dict I want to remove. How can I do that? I hope I'm enough clear. Sorry but I'm a newbie in Python.

    Read the article

  • Pseudorandom crashes in Flash Debugger - My bad, or Abode's?

    - by rinogo
    I'm working on a large-size dual AS3/Flex project (some parts are pure AS3, other parts are Flex), and I'm experiencing a lot of Flash Debugger crashes. These crashes aren't completely random - it seems like I can get them to occur with greater consistency when I perform certain actions in my app. However, at the same time, they aren't consistently repeatable - sometimes a set of actions causes my app to crash, and other times, the same steps execute fine without a crash. I have two questions (carefully worded to remove my personal bias :) ) Are these crashes due to my coding practices, or Adobe's Flash Debugger? When I deploy my app on a web site and access it via Flash Player, should I expect the same crashes to occur, or is Flash Player considerably more resilient than Flash Debugger? Thanks so much, all! :) -Rich

    Read the article

  • C# timer won't tick

    - by Andrej
    hi, i have a strange problem... I've been going out of my mind for the past couple of hours... the timer i put in my winform code (from the toolbar) won't tick... I have timers on a couple of forms in my program, they all work fine... I try to do exactly the same it this it won't tick... I select it, drag it on to a form, enable it, set interval and handle the tick event... and nothing happens... i even tried putting random code like messagebox.show in the tick event just to see if anything happens, and nothing!!! as I said, a have a couple of more timer in my program (on other forms, not in the one i'm trying to put this timer) and they all work fine... any suggestions? thanks in advance!

    Read the article

  • backslashbox is too wide

    - by Tim
    Hi I feel the first column in my longtable is too wide. Please see the figure below My code is: \begin{center} \begin{longtable}{|c|c|c|c|c|c|} \caption{Error rates for SVM and 100 random counts. \label{tab:svmcount100errortable}}\\ \hline \backslashbox{Concepts}{Train sizes} & 10 & 100 & 1000 & 10000 & 100000\\ \hline 1 & 0.49 (0.00) & 0.49 (0.00) & 0.47 (0.00) & 0.43 (0.00) & 0.33 (0.00)\\ \hline \end{longtable} \end{center} I wonder if there is some way to reduce the width of the first column? Thanks and regards!

    Read the article

  • fire and forget compared to http request

    - by cometta
    Hi, i looking for opinion from you all. I have a web application that need to records data into another web application database. I not prefer to use http request GET on 2nd application because of latency issue. I looking for fast way to save records on 2nd application quickly, i came across the idea of "fire and forget" , will JMX suit for this scenario? from my understanding jmx will gurantee message delivery. Let say i need to call at least 1000 random requests per seconds to 2nd application should i use jmx? http request? or xmpp instead?

    Read the article

  • How can I tell if a user came to a page via a Google Adwords PPC campaign?

    - by Mike Crittenden
    I have a form with a hidden "Came from Adwords" field that will be marked true (via javascript) if the user came from a PPC campaign and will stay false if not. That way, when the user submits the form, we will have each submission stored with info about whether that submission came from adwords or not, all without the user knowing. How can I fetch this info? I know that Google sets a cookie called Conversion whenever you click a PPC link to a page, but the cookie's content is just random alphanumeric characters. Is there something in the Analytics/Adwords API that will let me test for this? Do I have to resort to adding ?ref=adwords or something onto the PPC URLs so that I can test that way?

    Read the article

  • odd problem with jni interacting with dll's - not sure why a change to gc ergonomics fixes it

    - by jim hale
    We were having a problem with our Tomcat jvm blowing up and giving us an hs_* dump at random times but always in the same spot, that wasn't very informative other than saying we had an EXCEPTION_ACCESS_VIOLATION Commenting out various parts of the java that called particular jni functions just made it blow consistently in another spot. By changing our jvm options from: set PAF_OPTS=-Xms1024m -Xmx32000m -server -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+DisableExplicitGC -XX:+UseCompressedOops -Djava.library.path="%CATALINA_HOME%"\jni -Dcom.sun.management.jmxremote TO set PAF_OPTS=-Xms1024m -Xmx32000m -server -XX:+DisableExplicitGC -XX:+UseCompressedOops -Djava.library.path="%CATALINA_HOME%"\jni -Dcom.sun.management.jmxremote The problem went away. The solution does not give me a warm and fuzzy however and am wondering anyone might understand what's going on under the covers here. Environment: jdk1.6, 64 bit OS and Java, Tomcat, Windows

    Read the article

  • OpenGL es 2.0 Read depth buffer

    - by Brian
    Hi! As far as i know, we can't read the Z(depth) value in OpenGL ES 2.0. So I am wondering how we can get the 3D world coordinates from a point on the 2D screen? Actually I have some random thoughts might work. Since we can read the RGBA value by using glReadPixels, how about we duplicate the depth buffer and store it in a color buffer(say ColorforDepth). Of course there need to be some nice convention so that we don't lose any information of the depth buffer. And then when we need a point's world coordinates , we attach this ColorforDepth color buffer to the framebuffer and then render it. So when we use glReadPixels to read the depth information at this frame. However, this will lead to 1 frame flash since the colorbuffer is a weird buffer translated from the depth buffer. I am still wondering if there is some standard way to get the depth in OpenGL es 2.0? Thx in advance!:)

    Read the article

  • Mysql PHP generated table: doesn't work with Tablesorter

    - by echedey lorenzo
    Hi, I found this great Tablesorter plugin for jQuery but I can't make it work with my PHP generated table. Here's the code: <script type="text/javascript"> function table() { $("#container").load("table.php?randval="+Math.random()); } $(document).ready(function() { table(); $("table").tablesorter(); }); </script> Where #container is the div where the table will be and table is the name of the table. I get the table loaded but sorting function is not working. It works if I put the table directly in html in the page.. but I don't see the point in having a static table for sorting. Any help would be very appreciated.

    Read the article

  • How to dispose NHibernate ISession in an ASP.NET MVC App

    - by Joe Young
    I have NHibernate hooked up in my asp.net mvc app. Everything works fine, if I DON'T dispose the ISession. I have read however that you should dispose, but when I do, I get random "Session is closed" exceptions. I am injecting the ISession into my other objects with Windsor. Here is my current NHModule: public class NHibernateHttpModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += context_BeginRequest; context.EndRequest += context_EndRequest; } static void context_EndRequest(object sender, EventArgs e) { CurrentSessionContext.Unbind(MvcApplication.SessionFactory); } static void context_BeginRequest(object sender, EventArgs e) { CurrentSessionContext.Bind(MvcApplication.SessionFactory.OpenSession()); } public void Dispose() { // do nothing } } Registering the ISession: container .Register(Component.For<ISession>() .UsingFactoryMethod(() => MvcApplication.SessionFactory.GetCurrentSession()).LifeStyle.Transient); The error happens when I tack the Dispose on the unbind in the module. Since I keep getting the session is closed error I assume this is not the correct way to do this, so what is the correct way? Thanks, Joe

    Read the article

  • Oracle SELECT TOP 10 records

    - by ArneRie
    Hi, i have an big problem with an SQL Statement in Oracle. I want to select The TOP 10 Records ordered by STORAGE_DB wich arent in a list from an other select statement. This one works fine for all records: SELECT DISTINCT APP_ID, NAME, STORAGE_GB, HISTORY_CREATED, TO_CHAR(HISTORY_DATE, 'DD.MM.YYYY') AS HISTORY_DATE FROM HISTORY WHERE STORAGE_GB IS NOT NULL AND APP_ID NOT IN (SELECT APP_ID FROM HISTORY WHERE TO_CHAR(HISTORY_DATE, 'DD.MM.YYYY') = '06.02.2009') But when i am adding AND ROWNUM <= 10 ORDER BY STORAGE_GB DESC im getting some kind of "random" Records. I think because the limit takes in place before the order. Does someone has an good solution? The other problem: This query is realy slow (10k+ records)

    Read the article

  • Combinatorics, probability, dice

    - by TarGz
    A friend of mine asked: if I have two dice and I throw both of them, what is the most frequent sum (of the two dice' numbers)? I wrote a small script: from random import randrange d = dict((i, 0) for i in range(2, 13)) for i in xrange(100000): d[randrange(1, 7) + randrange(1, 7)] += 1 print d Which prints: 2: 2770, 3: 5547, 4: 8379, 5: 10972, 6: 13911, 7: 16610, 8: 14010, 9: 11138, 10: 8372, 11: 5545, 12: 2746 The question I have, why is 11 more frequent than 12? In both cases there is only one way (or two, if you count reverse too) how to get such sum (5 + 6, 6 + 6), so I expected the same probability..?

    Read the article

  • How can I prevent Telerik RadChart from generating an onerror attribute?

    - by Sean McMillan
    We're using the Telerik Rad Controls for ASP.Net Ajax on an ASP.Net MVC project. The RadChart generates the following HTML: <img onerror="if(confirm('Error loading RadChart image.\nYou may also wish to check the ASP.NET Trace for further details.\nDisplay stack trace?'))window.location.href=this.src;" src="ChartImage.axd?UseSession=true&amp;ChartID=e25ad666-e05b-4a92-ac0c-4f2c729b9382_chart_ctl00$MainContent$AverageCTMChart&amp;imageFormat=Png&amp;random=0.501658702968461" usemap="#imctl00_MainContent_AverageCTMChart" style="border-width: 0px;" alt=""> I'd like to remove the onerror attribute; I don't really want the customers being offered the option to see a stack trace if something goes wrong. I can't see any way to control the markup that this control generates. Google searches provide no help. Has anyone dealt with this before? How do I remove the onerror attribute?

    Read the article

< Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >