Daily Archives

Articles indexed Saturday April 17 2010

Page 16/81 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • How to fix this python program?

    - by Phenom
    import math def p(n): return 393000*((288200/393000)^n * math.exp(-(288200/393000)))/math.factorial(n) print p(3) When I run it, I get the following error message: Traceback (most recent call last): File "poisson.py", line 6, in <module> print p(3) File "poisson.py", line 4, in p return 393000*((288200/393000)^n * math.exp(-(288200/393000)))/math.factoria l(n) TypeError: unsupported operand type(s) for ^: 'int' and 'float'

    Read the article

  • Setting the AccountController in ASP.NET MVC 1.0 Template Not to Connect to SQL Server Express

    - by Maxim Z.
    I'm writing a website in ASP.NET MVC, using the ASP.NET MVC 1.0 template that was added to VS2008 for me by the ASP.NET MVC installer. The template automatically adds an AccountController, but its account methods tie into a SQL Server Express entity. I don't have Express installed here. How can I reconfigure it to use my SQL Server 2008 database and to store user info in some columns in a User table I've already created?

    Read the article

  • Why in the hell is this happening?

    - by user202411
    I just can't understand why is my database (mysql) behaving like this! My console shows that the record is created properly (please, notice the "remote_id" value): Tweet Create (0.3ms) INSERT INTO `tweets` (`remote_id`, `text`, `user_id`, `twitter_account_id`) VALUES (12325438258, 'jamaica', 1, 1) But when I check the record, it shows that the remote_id is 2147483647 intead of the provided value (12325438258 in the example above)... This table has many entries, but this field is always written with 2147483647... It was supposed to fill this space with an unique id (which I guarantee you is being generated properly).

    Read the article

  • Need help with shell script

    - by via-point
    I am a total newbie to Shell Scripting so please bear with me. I need to create a shell script called script1 that will calculate and then display letter grade of ABC2345. Read in the following grades from keyboard: Assignments 40% Test1 15% Test2 15% Final exam 30% Calculate and display the number grade using the weight of each factor above Convert the number grade to letter grade using the table below: Number Grade Letter Grade 90 - 100 A+ 85 - 89 A 80 - 84 77 - 79 B+ 73 - 76 B 70 - 72 B- 67 - 69 C+ 63 - 66 C 60 - 62 C- 57 - 59 D+ 53 - 56 D 50 - 52 D- 0 - 49 F Any help would be appreciated :) Thank you!

    Read the article

  • How to Create a Temporary Function in Emacs Lisp

    - by Cristian
    I'm making some tedious calls to a bunch of functions, but the parameters will be determined at runtime. I wrote a simple function to keep my code DRY but giving it a name is unnecessary. I don't use this function anywhere else. I'm trying to do it the way I would in Scheme, but I get a void-function error: (let ((do-work (lambda (x y z) (do-x x) (do-y y) ;; etc ))) (cond (test-1 (do-work 'a 'b 'c)) (test-2 (do-work 'i 'j 'k)))) I could stick it all into an apply (e.g., (apply (lambda ...) (cond ...))) but that isn't very readable. Is there a better way?

    Read the article

  • Java - Reg. Ex. File Question

    - by aloh
    I'm grabbing lines from a text file and sifting line by line using regular expressions. I'm trying to search for blank lines, meaning nothing or just whitespace. However, what exactly is empty space? I know that whitespace is \s but what is a line that is nothing at all? null (\0)? newline (\n)? I tried the test harness in the Java tutorial to try and test to see what an empty space is but no luck so far.

    Read the article

  • C++ catch constructor exception

    - by aaa
    hi. I do not seem to understand how to catch constructor exception. Here is relevant code: struct Thread { rysq::cuda::Fock fock_; template<class iterator> Thread(const rysq::cuda::Centers &centers, const iterator (&blocks)[4]) : fock_() { if (!fock_) throw; } }; Thread *ct; try { ct = new Thread(centers_, blocks); } catch(...) { return false; } // catch never happens, So catch statement do not execute and I get unhandled exception. What did I do wrong? this is straight C++ using g++.

    Read the article

  • Code Own Socket Server or Use Red5/ElectroServer on Amazon EC2?

    - by Travis
    I've been thinking for a long time about working on a multiplayer game in Flash. I need updates frequently enough that ajax requests won't work so I need to use a socket server. The system will eventually have enough objects/players that I would consider it an MMO. I would like to set up a scalable system on Amazon's EC2. (Which probably effects my choice of server) This architecture would hopefully allow the game to grow without many changes over time. (Using a domain decomposition technique or something similar) Heres my internal debate: Should I a. Code my own socket server in C++ or Java? b. Use the free and open source Red5 socket server for Flash? or c. Pay the licensing fees and go for Electroserver? I consider myself a decent developer, but am at an impasse as to what road to go down. I'm not sure if I, could develop/would need, the features of one of the prepackaged socket servers. I'm also not sure if the prepackaged servers would work well in an Amazon EC2 environment and take full advantage of its features. Any help or guidance would be greatly appreciated.

    Read the article

  • Ideal way to deliver large data over Web Services

    - by zengr
    We are trying to design 6 web services, which will serve another client component. The client component requires data from the web service we are implementing. Now, the problem is, there is not 1 WS we are implementing, there is one WS which the client component hits, this initiates a series (5 more) of WSs which gather data from their respective data stores and finally provide the data back to the original WS, which then delivers the data back to the client component. So, if the requested data becomes huge, then, this will be a serious problem for our internal communication channel. So, what do you guys suggest? What can be done to avoid overloading of the communication channel between the internal WS and at the same time, also delivering the data to the client component.

    Read the article

  • Slider with default functionality

    - by Geetha
    Hi All, I am trying to create a slider like this example. but the control is not getting displayed. pls anyone help me. http://devsandbox.nfshost.com/js/jquery-ui/development-bundle/demos/slider/constraints.html Geetha.

    Read the article

  • Mysql - Grouping the result based on a mathematical operation and SUM() function

    - by SpikETidE
    Hi all... I'm having the following two tables... Table : room_type type_id type_name no_of_rooms max_guests rate 1 Type 1 15 2 1254 2 Type 2 10 1 3025 Table : reservation reservation_id start_date end_date room_type booked_rooms 1 2010-04-12 2010-04-15 1 8 2 2010-04-12 2010-04-15 1 2 Now... I have this query SELECT type_id, type_name FROM room_type WHERE id NOT IN (SELECT room_type FROM reservation WHERE start_date >= '$start_date' AND end_date <= '$end_date') What the query does is it selects the rooms that are not booked between the start date and end date. Also, as you can see from the reservation table, we also have 'number of rooms booked between the two dates' factor also... I need to add this 'no.of booked rooms between the two dates' factor also in to the query... The query should return the type of rooms for which at least one room is free between the two dates. I worked out the logic but just can't represent it as a query....! How will you do this...? Thanks for your suggestions..!

    Read the article

  • How do I add fade in effect when I click expand on this script?

    - by kohei
    Hi, I found this content expand/collapse jQuery plugin. I want to add fade-in effect to this plugin when I click on the EXPAND button. How do I do this? $(document).ready(function () { var maxlines = 15; var lineheight = 15; // line height in 'px' var maxheight = (maxlines * lineheight); var allowedExtraLines = 3; var showText = "EXPAND"; var hideText = "CLOSE"; $('.ranking').each(function () { var text = $(this); if (text.height() > maxheight + allowedExtraLines * lineheight) { text.css({ 'overflow': 'hidden', 'line-height': lineheight + 'px', 'height': maxheight + 'px' }); var link = $('<a href="#">' + showText + '</a>'); link.click(function (event) { event.preventDefault(); if (text.css('height') == 'auto') { $(this).html(showText); text.css('height', maxheight + 'px'); } else { //$(this).remove(); $(this).html(hideText); text.css('height', 'auto'); } }); var linkDiv = $('<div></div>'); linkDiv.append(link); $(this).after(linkDiv); } }); });

    Read the article

  • Keeping messages in queue in case of receiver crash

    - by John Doe
    Hi, We've a Spring JMS message listener container for receiving messages asynchronously. Using DefaultMessageListenerContainer and in sessionTransacted mode. I understand being in sessionTransacted mode means in case of an exception the message will be put back into the queue. But how can I make sure the message won't be deleted from the queue even if the receiver (which is picked the message) crashes or just the machine running it looses power? At first I thought CLIENT_ACKNOWLEDGE acknowledge mode should save me, but apparently it's not the case, Spring calls .acknowledge() no matter what. So here's my question, how can I guarantee the delivery? Using a custom MessageListenerContainer? Using a transaction manager?

    Read the article

  • Methods of cooling with no more room in case?

    - by Wesley
    Hi all, I've got an HP DC7100 and an HP m8530f. The DC7100 is a small form factor desktop while the m8530f has a mATX board with lots of extra features like front I/O and HP Personal Media Drive bay. Both of these have very little space (especially the DC7100) and don't have any other places to mount fans. What other possible ways of cooling are there, if there isn't much space left inside the case? Thanks in advance.

    Read the article

  • Ideal way/architecture to deliver large data over Web Services

    - by zengr
    We are trying to design 6 web services, which will serve another client component. The client component requires data from the web service we are implementing. Now, the problem is, there is not 1 WS we are implementing, there is one WS which the client component hits, this initiates a series (5 more) of WSs which gather data from their respective data stores and finally provide the data back to the original WS, which then delivers the data back to the client component. So, if the requested data becomes huge, then, this will be a serious problem for our internal communication channel. So, what do you guys suggest? What can be done to avoid overloading of the communication channel between the internal WS and at the same time, also delivering the data to the client component.

    Read the article

  • .NET 4 RTM MetadataType attribute ignored when using Validator

    - by bart
    I am using VS 2010 RTM and trying to perform some basic validation on a simple type using MetadataTypeAttribute. When I put the validation attribute on the main class, everything works. However, when I put it on the metadata class, it seems to be ignored. I must be missing something trivial, but I've been stuck on this for a while now. I had a look at the Enterprise Library validation block as a workaround, but it doesn't support validation of single properties out of the box. Any ideas? class Program { static void Main(string[] args) { Stuff t = new Stuff(); try { Validator.ValidateProperty(t.X, new ValidationContext(t, null, null) { MemberName = "X" }); Console.WriteLine("Failed!"); } catch (ValidationException) { Console.WriteLine("Succeeded!"); } } } [MetadataType(typeof(StuffMetadata))] public class Stuff { //[Required] //works here public string X { get; set; } } public class StuffMetadata { [Required] //no effect here public string X { get; set; } }

    Read the article

  • ListBox and Listview problem

    - by Anu
    Hi, I have listbox in my applcation and corresponding coding.. XAML: <DataTemplate x:Key="menuItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Menu}" /> </WrapPanel> </DataTemplate> <ListBox x:Name="menubox" ItemsSource="{Binding}" ItemTemplate="{StaticResource menuItemTemplate}" Margin="0,5,0,0"> .CS : public void Add(string[] menu) { ItemList items = ItemList.Load(menu); DataContext = items; } It works fine.Later i add Listview for another purpose and i coded like the same way of listbox XAML: <DataTemplate x:Key="ListItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Title}" /> </WrapPanel> </DataTemplate> <ListView ItemsSource="{Binding}" ItemTemplate="{StaticResource ListItemTemplate}" Name="listView1" /> .cs coding: public void SetTree(string Title,int BoxNo ) { TreeList items1 = TreeList.Load(Title,BoxNo); DataContext = items1; } After adding Listview,what happended this ListView show data,but Listbox didnot show anything.When i click the listbox it perfectly executing the clicking event of listbox.Only problem it doesnot display the text.What can i do for that. Here i added corresponding list class pls see tht. namespace Tabcontrol { public class TreeList : Collection<TreeItems> { public int size; public TreeList() { size = 0; } public int Count { get { return size; } } public static TreeList Load(string pmenu,int Box) { TreeList result = new TreeList(); TreeItems item = TreeItems.Load(pmenu,Box); result.Add(item); return result; } } } The ItemList class also the same thing, only variable names are getting differred.

    Read the article

  • alternative to rescue in ruby ?

    - by wefwgeweg
    it seems like i have begin rescue end statements everywhere in my code. this doesn't seem like the correct thing to do. i am learning process, can anyone suggest how can i catch any exceptions without having to place everything inside begin,rescue, end. anyway to just tell ruby to shut up and just keep going even if exception is raised ?

    Read the article

  • Why would ASP.NET MVC use session state?

    - by ray247
    Recommended by the ASP.NET team to use cache instead of session, we stopped using session from working with the WebForm model the last few years. So we normally have the session turned off in the web.config <sessionState mode="Off" /> But, now when I'm testing out a ASP.NET MVC application with this setting it throw an error in class SessionStateTempDataProvider inside the mvc framework, it asked me to turn on session state, I did and it worked. Looking at the source it uses session Dictionary<string, object> tempDataDictionary = httpContext.Session[TempDataSessionStateKey] as Dictionary<string, object>; // line 20 in SessionStateTempDataProvider.cs So, why would they use session here? What am I missing? Thanks, Ray. ======================================================== Edit Sorry didn't mean for this post to debate on session vs. cache, but rather in the context of the ASP.NET MVC, I was just wondering why session is used here. In this Scott Watermasysk blog post he mentioned on turning off session too as a good practice, so I'm just wondering do I have to turn it on to use MVC from here on?

    Read the article

  • Debugging 500 Internal Server Error on PHP running on IIS7 cluster

    - by Matthijs P
    Recently my ISP switched our website to an IIS7.0 high availibility cluster. The website is running on PHP5.2.1 and I can only upload files (so no registry tweaks). I had tested the website before and everything seemed to be working, but now the checkout page fails with: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. As error messages go, this isn't very informative. I've tried: ini_set('display_errors', 1); ini_set('error_log', $file_php_can_write_to ); but both don't seem to do anything. Anyone know how to get better debugging output?

    Read the article

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