Search Results

Search found 2046 results on 82 pages for 'sam dark'.

Page 36/82 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Is it possible to have a Ocaml function that accepts only integer lists?

    - by Sam
    I'm writing a recursive function in Ocaml that's supposed to count the number of items in an integer list (Yes I know there's a List.length function but I'm trying to do it myself). However the Ocaml compiler/interpreter forces me to use alpha list all the time. So is it wrong to say that, when a function accepts a list as a parameter, the type of that list must always be alpha? Thanks EDIT: the reason why it's inconvenient for me to use alpha lists is because i can't compare the head of the alpha list with an integer value due to type-matching complaints

    Read the article

  • Accessing a dictionary value by custom object value in Python?

    - by Sam
    So I have a square that's made up of a series of points. At every point there is a corresponding value. What I want to do is build a dictionary like this: class Point: def __init__(self, x, y): self._x = x self._y = y square = {} for x in range(0, 5): for y in range(0, 5): point = Point(x,y) square[point] = None However, if I later create a new point object and try to access the value of the dictionary with the key of that point it doesn't work.. square[Point(2,2)] Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> square[Point(2,2)] KeyError: <__main__.Point instance at 0x02E6C378> I'm guessing that this is because python doesn't consider two objects with the same properties to be the same object? Is there any way around this? Thanks

    Read the article

  • ASP.NET MVC: How to display strongly typed view model, containing list of items, which also contain

    - by Sam Delaney
    Hi, I'm building an app using ASP.NET MVC which I want to use a strongly type view model, which contains a List called items which contains an id int and itemName string. The view model also conatins a List called people, and the Person class contains a List. The way I want to display the information is as a table, with each row having a column of Person name, then n number of columns which contain checkboxes, one for each of the List, and checked based on whether the Person's List (called items) contains the id of the Item. I have the display working fine, but I'm struggling to understand how to name the items so that the posted method can read the data. This is what I have in the BeginForm: <table cellpadding="20"> <thead> <th>Person name</th> <!-- for each of the items, create a column with the item name --> <% foreach( var i in Model.items ) { %> <th><%= Html.Encode(i.itemName) %></th> <% } %> </thead> <% foreach( var p in Model.people ) { %> <tr> <td><%= Html.Encode(p.name) %></td> <!-- for each item, create a column with a checkbox --> <% foreach( var i in Model.items ) { %> <td> <% if( p.items.Contains(i.id) ) { %> <!-- vm is the name of the view model passed to the view --> <%= Html.CheckBox( "vm.people[" + p.id + "].items[" + i.id + "]", true ) %> <% } else { %> <%= Html.CheckBox( "vm.people[" + p.id + "].items[" + i.id + "]", false ) %> <% } %> </td> <% } %> </tr> <% } %> </table> And this code displays the information perfectly. When I click submit, however, I get an Object Reference Not Set.. error message. Can anyone help with this please?

    Read the article

  • Installing Python in Windows XP

    - by Sam
    My work PC has restrictions that stop me from adding programs to the start menu so when I try to install Python using the Python 2.6.5 Windows installer it can't complete as it tries to add a shortcut to my start menu. Is there a way around this? I.e another way of installing without the need for a shortcut? Edit: I'll also need to install NumPy which I can't do on the Portable version of Python.

    Read the article

  • Best design for generating code from an AST?

    - by Sam Washburn
    I'm working on a pretty complex DSL that I want to compile down into a few high level languages. The whole process has been a learning experience. The compiler is written in java. I was wondering if anyone knew a best practice for the design of the code generator portion. I currently have everything parsed into an abstract syntax tree. I was thinking of using a template system, but I haven't researched that direction too far yet as I would like to hear some wisdom first from stack overflow. Thanks!

    Read the article

  • Unsuccessful error detection of improperly declared method in GCC 4.2 compiler

    - by sam
    I am using C++ compiler GCC 4.2 in XCode 3.2.2. I have noted that the compiler will successfully compile a method foo even though there are no ellipses. The header and method are properly declared as foo(), but when I do a find and replace either by file or by program-wide it will miss approximately 2-3% of the changes [foo to foo(). This would not be critical if the compiler did not give an erroneous successful build. I have not found that this to occur with: foo(any parameter). Does anyone have any solution? Thank you.

    Read the article

  • Difference between SQL 2005 and SQL 2008 for inserting multiple rows with XML

    - by Sam Dahan
    I am using the following SQL code for inserting multiple rows of data in a table. The data is passed to the stored procedure using an XML variable : INSERT INTO MyTable SELECT SampleTime = T.Item.value('SampleTime[1]', 'datetime'), Volume1 = T.Item.value('Volume1[1]', 'float'), Volume2 = T.Item.value('Volume2[1]', 'float') FROM @xml.nodes('//Root/MyRecord') T(item) I have a whole bunch of unit tests to verify that I am inserting the right information, the right number of records, etc.. when I call the stored procedure. All fine and dandy - that is, until we began to monkey around with the compatibility level of the database. The code above worked beautifully as long as we kept the compatibility level of the DB at 90 (SQL 2005). When we set the compatibility level at 100 (SQL 2008), the unit tests failed, because the stored procedure using the code above times out. The unit tests are dropping the database, re-creating it from scripts, and running the tests on the brand new DB, so it's not - I think - a question of the 'old compatibility level' sticking around. Using the SQL Management studio, I made up a quick test SQL script. Using the same XML chunk, I alter the DB compat level , truncate the table, then use the code above to insert 650 rows. When the level is 90 (SQL 2005), it runs in milliseconds. When the level is 100 (SQL 2008) it sometimes takes over a minute, sometimes runs in milliseconds. I'd appreciate any insight anyone might have into that. EDIT The script takes over a minute to run with my actual data, which has more rows than I show here, is a real table, and has an index. With the following example code, the difference goes between milliseconds and around 5 seconds. --use [master] --ALTER DATABASE MyDB SET compatibility_level =100 use [MyDB] declare @xml xml set @xml = '<?xml version="1.0"?> <Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Record> <SampleTime>2009-01-24T00:00:00</SampleTime> <Volume1>0</Volume1> <Volume2>0</Volume2> </Record> ..... 653 records, sample time spaced out 4 hours ........ </Root>' DECLARE @myTable TABLE( ID int IDENTITY(1,1) NOT NULL, [SampleTime] [datetime] NOT NULL, [Volume1] [float] NULL, [Volume2] [float] NULL) INSERT INTO @myTable select T.Item.value('SampleTime[1]', 'datetime') as SampleTime, Volume1 = T.Item.value('Volume1[1]', 'float'), Volume2 = T.Item.value('Volume2[1]', 'float') FROM @xml.nodes('//Root/Record') T(item) I uncomment the 2 lines at the top, select them and run just that (the ALTER DATABASE statement), then comment the 2 lines, deselect any text and run the whole thing. When I change from 90 to 100, it runs all the time in 5 seconds (I change the level once, but I run the series several times to see if I have consistent results). When I change from 100 to 90, it runs in milliseconds all the time. Just so you can play with it too. I am using SQL Server 2008 R2 standard edition.

    Read the article

  • Visual Studio error on valid SQL

    - by Sam
    I'm getting an annoying error in visual studio for SQL that executes fine. SELECT InvoiceLines.LineID, InvoiceLines.InvoiceID, InvoiceLines.Text, InvoiceLines.Rate, InvoiceLines.Count, InvoiceLines.Rate * InvoiceLines.Count AS LineTotal, ((InvoiceLines.Rate * InvoiceLines.Count) * (1 + Invoices.VatRate / 100)) * (1 - CAST(Invoices.Discount AS money) * InvoiceLines.ApplyDiscount / 100) AS LineTotalIncVat, InvoiceLines.ApplyDiscount FROM InvoiceLines LEFT JOIN Invoices ON Invoices.InvoiceID = InvoiceLines.InvoiceID What LineTotalIncVat is trying to do is compute the total for the invoice item while adding the vat and subtracting the discount, and yes, probably better to do this in code (would if I could) The error visual studio gives is: There was an error parsing the query [token line number =1, token line offset =14, token in error = InvoiceLines] Even though it will validate and execute without a problem in the query builder...

    Read the article

  • How do you get Eclipse/Mylyn to fill out your commit messages for you?

    - by Sam Hasler
    I've setup the following: Installed Mylyn in Eclipse Installed the Bugzilla connector Installed Subversive SVN Integration for the Mylyn Project I've gone to Windows - Preferences - Tasks - Team and clicked Change Set Management and left it with the default Commit Comment Template: ${task.status} - ${connector.task.prefix} ${task.key}: ${task.description} ${task.url} However, if I activate a bugzilla bug in the Task List, and then edit a file, when I commit the changes the commit message isn't filled in. Also, in the Synchronisation perspective there isn't a change set for the task I'm working on. I've tried following the instructions on the Eclipse wiki's Mylyn FAQ for Why does task change set not appear when I modify files? but the bullet point: * Verify that the configured Synchronize View is configured for change sets. points to a section that is no longer in the document. I have a Show Change Sets button, but clicking it only shows me incoming change sets, there aren't any outgoing change sets. What am I missing?

    Read the article

  • Windows Service WebBrowser DocumentCompleted Bug

    - by Sam Youtsey
    I've been building a Windows Service to create a WebBrowser object to navigate, login, and download a site's HTML. However, I recently discovered this bug which prevents the DocumentCompleted event from firing if the WebBrowser is not visible: http://support.microsoft.com/kb/259935 I've got to assume this is because the Windows Service doesn't allow for a GUI and therefore this bug is tripped. What is the best workaround for this? Thanks for your help.

    Read the article

  • Truncating long strings with CSS: feasible yet?

    - by Sam Stokes
    Is there any good way of truncating text with plain HTML and CSS, so that dynamic content can fit in a fixed-width-and-height layout? I've been truncating server-side by logical width (i.e. a blindly-guessed number of characters), but since a 'w' is wider than an 'i' this tends to be suboptimal, and also requires me to re-guess (and keep tweaking) the number of characters for every fixed width. Ideally the truncation would happen in the browser, which knows the physical width of the rendered text. I've found that IE has a text-overflow: ellipsis property that does exactly what I want, but I need this to be cross-browser. This property seems to be (somewhat?) standard but isn't supported by Firefox. I've found various workarounds based on overflow: hidden, but they either don't display an ellipsis (I want the user to know the content was truncated), or display it all the time (even if the content wasn't truncated). Does anyone have a good way of fitting dynamic text in a fixed layout, or is server-side truncation by logical width as good as I'm going to get for now?

    Read the article

  • Webwork actions, the lifecycle of variables declared in the action class.

    - by Sam
    Hi all, I'm using the webwork framework (JIRA plugin development) and was wondering about the lifecycle of the variables in the action class. I have a few private variables in the action class that are set when during the doDefault() method. These are used in the input view to set up jqGrid columns and then when the user has entered some data they click submit which puts the grid data into a hidden input. The next thing that happens is the doValidation() method is called before the doExecute(), which displays the input view if there are any errors. The problem is that the variables set up in the doDefault() method are now null. Can anyone explain to me how the lifecycle of variables works in the webwork actions? Cheers

    Read the article

  • asp.net ajax toolkit combobox doesn't work in hidden div

    - by sam
    I have a combobox inside a hidden div which I use css display = none to make it invisible, but when I make the div visible by setting display = block, the combobox just show the input and its button and ul list all have css as display = 'none', visibility ='hidden'. I can tell it is done by combobox inbuild javascript because I tried to use javascript to set the css manually with no luck. It is a bug of combobox. Urgent help needed. I spent a week to solve this, and our team put a lot trust on the toolkit. Please help me on this, all javascript gurus, thanks. Below is the code to reproduce the bug. When you run it, you can't see the dropdown: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <div id="d" style="display:none"> <asp:ComboBox ID="ComboBox1" runat="server"> <asp:ListItem>a</asp:ListItem> <asp:ListItem>d</asp:ListItem> <asp:ListItem>f</asp:ListItem> </asp:ComboBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> <div ID="Button1" runat="server" onclick="show();">click me</div> <script type="text/javascript"> function show() { var d = $get('d'); d.style.display = 'block'; } </script>

    Read the article

  • I am trying to have a wall follow robot but there are errors on the names not being declared in my s

    - by Sam
    #include <iostream> #include <libplayerc++/playerc++.h> using namespace std; int main(int argc, char *argv[]) { using namespace PlayerCc; PlayerClient robot("localhost"); BumperProxy bp(&robot,0); Position2dProxy pp(&robot,0); pp.SetMotorEnable(true); for(;;) double turnrate, speed; double error; bool wall; motor_a_speed(0); motor_c_speed(0); while(1) { front_bumper = SENSOR_2; left_bumper = SENSOR_3; if (front_bumper > 2) { if (left_bumper < 3) { motor_a_speed(5); motor_c_speed(drive_speed); motor_a_dir(fwd); motor_c_dir(fwd); } else { motor_a_speed(drive_speed); motor_c_speed(5); motor_a_dir(rev); motor_c_dir(rev); } } else { motor_a_speed(drive_speed); motor_c_speed(drive_speed); motor_a_dir(brake); motor_c_dir(brake); mrest(100); cputs("bump"); motor_a_dir(fwd); motor_c_dir(rev); msleep(450); cputs("right"); motor_a_speed(10); motor_a_dir(fwd); motor_c_dir(fwd); mrest(1300); } pp.SetSpeed(speed, turnrate); } }

    Read the article

  • TFS Folders - Getting them to work like Subversion "Trunk/Tags/Branches"

    - by Sam Schutte
    I recently started using Team Foundation Server, and am having some trouble getting it to work the way I want it to. I've used Subversion for a couple years now, and love the way it works. I always set up three folders under each project, Trunk, Tags, and Branches. When I'm working on a project, all my code lives under a folder called "C:\dev\projectname". This "projectname" folder can be made to point to either trunk, or any of the branches or tags using Subversion (with the switch command). Now that I'm using TFS (my client's system), I'd like things to work the same way. I created a "Trunk" folder with my project in it, and mapped "Project/Trunk/Website" to "c:\dev\Website". Now, I want to make a release under the "tags" folder (located in "Project/Tags/Version 1.0/Website", and TFS is giving me the following error when I execute the branch command: "No appropriate mapping exists for $Project/tags/Version 1.0/Website" From what I can find on the internet, TFS expects you to have a mapping to your hard drive at the root of the project (the "Project" folder in my case), and then have all the source code that lives in trunk, tags and branches all pulled down to your hard drive. This sucks because it requires way too much stuff on your hard drive, and even worse, when you are working in a solution in Visual Studio, you won't be able to pull down "Version 2.0" and have all your project references to other projects work, because they'll all be pointing to "trunk" folders under the main folder, not just the main folder itself. What I want to do is have the root "Project/Website" folder on my hard drive, and be able to have it point to (mapped to) either tags, branches, or trunk, depending on what i'm doing, without having to screw around with fixing Visual Studio project references. Ideas?

    Read the article

  • Splitting a string in ASP Classic

    - by Sam
    So here's my string: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam elit lacus, dignissim quis laoreet non, cursus id eros. Etiam lacinia tortor vel purus eleifend accumsan. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque bibendum vestibulum nisl vitae volutpat. I need to split it every 100 characters (full words only) until all the characters are used up. So we'd end up with: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam elit lacus, dignissim quis laoreet non, and cursus id eros. Etiam lacinia tortor vel purus eleifend accumsan. Pellentesque habitant morbi tristique and senectus et netus et malesuada fames ac turpis egestas. Quisque bibendum vestibulum nisl vitae volutpat. Any ideas on the best way to do that?

    Read the article

  • Day dreaming about automatic RGB color function in PHP

    - by Sam
    Hello fellow earthlings. A quesion about RGB color and its usefulness in a simple tiny php code: Imagine I have variable $colorA containning a valid six char color. say B1B100, a greenish natural color. Now If I would like to make a new color from that, which is, say, ten steps lighter thatn that original color, roughly. $colorA = B1B100 // original color php code with little color engine lightening stuff up goes here $colorB = ?????? // original color lightened up Is there a php ready function that KNOWS rgb colors something like php function RGB ( input color, what to do, output color) Where what to do could be +/- 255 values of brightness etc etc. Is something like this already possible or am I day dreaming? rgb($colorA, +10, $colorB) If this does not exist, what would be the shortest code for doing this? Link suffices. Suggestions and ideas are answers to me. Thanks.

    Read the article

  • modify this code .. please help me?

    - by Sam
    i wana modify this code from static choices to dynamic this for 3 choices var PollhttpObject=null; function DoVote() {if(document.getElementById('PollRadio1').checke d)DoVote_Submit(1);else if(document.getElementById('PollRadio2').checked)DoVote_Submit(2);else if(document.getElementById('PollRadio3').checked)DoVote_Submit(3);else alert('?????: ?????? ?????? ??? ?????????? ??????? ?? ????? ??? ?? ???????');return false;} function DisbalePoll(TheCase) {document.getElementById('VoteBttn').onclick=function(){alert('!?????? ??? ?? ??????? ??????');} document.getElementById('PollRadio1').disabled='true';document.getElementById('PollRadio2').disabled='true';document.getElementById('PollRadio3').disabled='true';if(TheCase=='EXPIRED') {document.getElementById('VoteBttn').src='images/design/VoteBttn_OFF.jpg';document.getElementById('ResultBttn').src='images/design/ResultsBttn_OFF.jpg';document.getElementById('VoteBttn').onclick='';document.getElementById('ResultBttn').onclick='';document.getElementById('ResultBttn').style.cursor='';document.getElementById('VoteBttn').style.cursor='';}} function DoVote_Submit(VoteID) {if(VoteID!=0)DisbalePoll();try{PollhttpObject=getHTTPObject();if(PollhttpObject!=null) {PollhttpObject.onreadystatechange=PollOutput;PollhttpObject.open("GET","Ajax.aspx?ACTION=POLL&VOTEID="+ VoteID+"&RND="+ Math.floor(Math.random()*10001),true);PollhttpObject.send(null);}} catch(e){} return false;} function PollOutput(){if(PollhttpObject.readyState==4) {var SearchResult=PollhttpObject.responseText;document.getElementById('PollProgress').style.display='none';document.getElementById('PollFormDiv').style.display='block';if(SearchResult.length=2&&SearchResult.substr(0,2)=='OK') {var ReturnedValue=SearchResult.split("#");document.getElementById('PollBar1').style.width=0+'px';document.getElementById('PollBar2').style.width=0+'px';document.getElementById('PollBar3').style.width=0+'px';document.getElementById('PollRate1').innerHTML="0 (0%)";document.getElementById('PollRate2').innerHTML="0 (0%)";document.getElementById('PollRate3').innerHTML="0 (0%)";window.setTimeout('DrawPollBars(0, '+ ReturnedValue[1]+', 0, '+ ReturnedValue[2]+', 0, '+ ReturnedValue[3]+')',150);} else if(SearchResult.length=2&&SearchResult.substr(0,2)=='NO') {alert("?????: ??? ??? ???????? ?????");}} else {document.getElementById('PollProgress').style.display='block';document.getElementById('PollFormDiv').style.display='none';}} function DrawPollBars(Bar1Var,Bar1Width,Bar2Var,Bar2Width,Bar3Var,Bar3Width) {var TotalVotes=parseInt(Bar1Width)+parseInt(Bar2Width)+parseInt(Bar3Width);var IncVal=parseFloat(TotalVotes/10);var NewBar1Width=0;var NewBar2Width=0;var NewBar3Width=0;var Bar1NextVar;var Bar2NextVar;var Bar3NextVar;if(parseInt(parseInt(Bar1Var)*200/TotalVotes)0)NewBar1Width=parseInt(Bar1Var)*200/TotalVotes;else if(Bar1Var0)NewBar1Width=1;else NewBar1Width=0;if(parseInt(parseInt(Bar2Var)*200/TotalVotes)0)NewBar2Width=parseInt(Bar2Var)*200/TotalVotes;else if(Bar2Var0)NewBar2Width=1;else NewBar2Width=0;if(parseInt(parseInt(Bar3Var)*200/TotalVotes)0)NewBar3Width=parseInt(Bar3Var)*200/TotalVotes;else if(Bar3Var0)NewBar3Width=1;else NewBar3Width=0;document.getElementById('PollBar1').style.width=NewBar1Width+'px';document.getElementById('PollBar2').style.width=NewBar2Width+'px';document.getElementById('PollBar3').style.width=NewBar3Width+'px';document.getElementById('PollRate1').innerHTML=parseFloat(Bar1Var).toFixed(0)+" ("+ parseFloat(parseFloat(Bar1Var)/TotalVotes*100).toFixed(1)+"%)";document.getElementById('PollRate2').innerHTML=parseFloat(Bar2Var).toFixed(0)+" ("+ parseFloat(parseFloat(Bar2Var)/TotalVotes*100).toFixed(1)+"%)";document.getElementById('PollRate3').innerHTML=parseFloat(Bar3Var).toFixed(0)+" ("+ parseFloat(parseFloat(Bar3Var)/TotalVotes*100).toFixed(1)+"%)";if(Bar1Var!=Bar1Width||Bar2Var!=Bar2Width||Bar3Var!=Bar3Width) {if(parseFloat(Bar1Var)+IncVal<=parseInt(Bar1Width))Bar1NextVar=parseFloat(Bar1Var)+IncVal;else Bar1NextVar=Bar1Width;if(parseFloat(Bar2Var)+IncVal<=parseInt(Bar2Width))Bar2NextVar=parseFloat(Bar2Var)+IncVal;else Bar2NextVar=Bar2Width;if(parseFloat(Bar3Var)+IncVal<=parseInt(Bar3Width))Bar3NextVar=parseFloat(Bar3Var)+IncVal;else Bar3NextVar=Bar3Width;window.setTimeout('DrawPollBars('+ Bar1NextVar+', '+ Bar1Width+', '+ Bar2NextVar+', '+ Bar2Width+', '+ Bar3NextVar+', '+ Bar3Width+')',80); }}

    Read the article

  • netbeans custom jax-ws stubs..

    - by Sam
    Hi, I am using netbeans 6.9. I have made a JAX-WS service that returns a complex type, I have also made a JAX-WS client to consume it. The JAX-WS system automaticly creates a class for the client, inferred from the WSDl spec. I want to make my own class for this using JAXB annotations, so that I can add some extra functions to it. How do I go about replacing the autogenerated file with my own one? Could I also use the same class in the service to control how it is transmitted? Thanks!

    Read the article

  • No IntelliSense for c++/cli in visual studio 2010?

    - by Sam
    I just moved from Visual Studio 2008 to 2010, and noticed one major flaw: When I try to use AutoComplete in a C++ Source file for managed c++, a small note in the footer appers: intellisense for c++/cli not available Uh, has IntelliSense for c++/cli been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful...

    Read the article

  • jquery datepicker format problem

    - by Sam Vloeberghs
    Hi I'm having a problem trying to format the output on the jQuery UI datepicker. I want the dateformat to be the 'ISO 8601' format, like explained here: http://jqueryui.com/demos/datepicker/#date-formats This is what my code looks like: $.datepicker.setDefaults($.datepicker.regional['nl']); $('.datepicker').datepicker('option', {dateFormat: 'yy-mm-dd' }); Can someone help and advice plz? Thx in advance! I really trust this community for providing a quick and great answer! :)

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >