Search Results

Search found 3492 results on 140 pages for 'chris cochran'.

Page 99/140 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • Why isn't LISP more widely used?

    - by Chris
    I've heard a lot of people espouse the capabilities of LISP and its omnipotent macros. If LISP is such a great language, why isn't it being adopted more? What problems is LISP facing that is holding it back from (re)emerging as popular language? Is it something about LISP itself ("those brackets!" isn't the answer, is it?!), or its competitors (e.g. the dominance of Java, .NET)?

    Read the article

  • Selecting a div with same ID as the rel attribute of clicked link

    - by Chris
    Hi there, This is a two-part question. I'm using jQuery for a project and wanting to click a link and toggle the class name "highlight" to that link and also to the div with the same id as the rel attribute of the link. I then want to be able to link to the next div without the classname of "highlight". Here's the HTML for it: <ul> <li><a href="#" rel="panel1">Item 1</a></li> <li><a href="#" rel="panel2">Item 2</a></li> <li><a href="#" rel="panel3">Item 3</a></li> </ul> <a href="">go to next div without class of highlight</a> <div id="panel1">some text</div> <div id="panel2">some text</div> <div id="panel3">some text</div> Can anyone help with jQuery side of things? Many thanks in advance!

    Read the article

  • Limit of 88 bytes on response.write?

    - by Chris
    I am trying to serve a csv file from a wcf service, as a string response. It looks like this: HttpContext.Current.Response.AddHeader("Content-disposition", "attachment; filename=ImportErrors.csv"); HttpContext.Current.Response.ContentType = "text/csv"; HttpContext.Current.Response.Write(myCsvContent); The response StatusCode is set to (int)HttpStatusCode.OK (200) It works, but I am only getting 88 bytes of my csv and the rest is cut off (not shown). Any suggestions on where to look? I don't see any custom entries in my web.config that are setting a limit.

    Read the article

  • create a dict of lists from a string

    - by Chris Card
    I want to convert a string such as 'a=b,a=c,a=d,b=e' into a dict of lists {'a': ['b', 'c', 'd'], 'b': ['e']} in Python 2.6. My current solution is this: def merge(d1, d2): for k, v in d2.items(): if k in d1: if type(d1[k]) != type(list()): d1[k] = list(d1[k]) d1[k].append(v) else: d1[k] = list(v) return d1 record = 'a=b,a=c,a=d,b=e' print reduce(merge, map(dict,[[x.split('=')] for x in record.split(',')])) which I'm sure is unnecessarily complicated. Any better solutions?

    Read the article

  • How do I display a field's hidden characters in the result of a query in Oracle?

    - by Chris Williams
    I have two rows that have a varchar column that are different according to a Java .equals(). I can't easily change or debug the Java code that's running against this particular database but I do have access to do queries directly against the database using SQLDeveloper. The fields look the same to me (they are street addresses with two lines separated by some new line or carriage feed/new line combo). Is there a way to see all of the hidden characters as the result of a query?I'd like to avoid having to use the ascii() function with substr() on each of the rows to figure out which hidden character is different. I'd also accept some query that shows me which character is the first difference between the two fields.

    Read the article

  • Overloading '-' for array subtraction

    - by Chris Wilson
    I am attempting to subtract two int arrays, stored as class members, using an overloaded - operator, but I'm getting some peculiar output when I run tests. The overload definition is Number& Number :: operator-(const Number& NumberObject) { for (int count = 0; count < NumberSize; count ++) { Value[count] -= NumberObject.Value[count]; } return *this; } Whenever I run tests on this, NumberObject.Value[count] always seems to be returning a zero value. Can anyone see where I'm going wrong with this? The line in main() where this subtraction is being carried out is cout << "The difference is: " << ArrayOfNumbers[0] - ArrayOfNumbers[1] << endl; ArrayOfNumbers contains two Number objects. The class declaration is #include <iostream> using namespace std; class Number { private: int Value[50]; int NumberSize; public: Number(); // Default constructor Number(const Number&); // Copy constructor Number(int, int); // Non-default constructor void SetMemberValues(int, int); // Manually set member values int GetNumberSize() const; // Return NumberSize member int GetValue() const; // Return Value[] member Number& operator-=(const Number&); }; inline Number operator-(Number Lhs, const Number& Rhs); ostream& operator<<(ostream&, const Number&); The full class definition is as follows: #include <iostream> #include "../headers/number.h" using namespace std; // Default constructor Number :: Number() {} // Copy constructor Number :: Number(const Number& NumberObject) { int Temp[NumberSize]; NumberSize = NumberObject.GetNumberSize(); for (int count = 0; count < NumberObject.GetNumberSize(); count ++) { Temp[count] = Value[count] - NumberObject.GetValue(); } } // Manually set member values void Number :: SetMemberValues(int NewNumberValue, int NewNumberSize) { NumberSize = NewNumberSize; for (int count = NewNumberSize - 1; count >= 0; count --) { Value[count] = NewNumberValue % 10; NewNumberValue = NewNumberValue / 10; } } // Non-default constructor Number :: Number(int NumberValue, int NewNumberSize) { NumberSize = NewNumberSize; for (int count = NewNumberSize - 1; count >= 0; count --) { Value[count] = NumberValue % 10; NumberValue = NumberValue / 10; } } // Return the NumberSize member int Number :: GetNumberSize() const { return NumberSize; } // Return the Value[] member int Number :: GetValue() const { int ResultSoFar; for (int count2 = 0; count2 < NumberSize; count2 ++) { ResultSoFar = ResultSoFar * 10 + Value[count2]; } return ResultSoFar; } Number& operator-=(const Number& Rhs) { for (int count = 0; count < NumberSize; count ++) { Value[count] -= Rhs.Value[count]; } return *this; } inline Number operator-(Number Lhs, const Number& Rhs) { Lhs -= Rhs; return Lhs; } // Overloaded output operator ostream& operator<<(ostream& OutputStream, const Number& NumberObject) { OutputStream << NumberObject.GetValue(); return OutputStream; }

    Read the article

  • jquery split() and indexOf results in "Object doesn't support this property or method"

    - by chris
    I have the following code: var selected = $('#hiddenField').val().split(","); ... if (selected.indexOf(id) > 0) { ... set value ... } I'm dynamically creating a CheckBoxList, and trying to remember the state of the checkboxes by putting the selected IDs into the hidden field. I get an error stating that "Object doesn't support this property or method". My assumption is that selected is an array, which should support indexOf. Is that incorrect?

    Read the article

  • Anyone using SharpKeeper in production?

    - by Chris Eldredge
    SharpKeeper is a port of ZooKeeper to .NET. The port was done by Eric Hauser as seen on his blog. The code is only available on GitHub here as far as I can tell. My question is does it work? Is anyone using SharkKeeper in production or is it just a toy at this point?

    Read the article

  • Datetime NOW PHP mysql (+ PDO variant)

    - by Chris
    Thanks for looking. All helpful answers/comments are up voted. In php, you can use NOW() like this: mysql_query("INSERT INTO tablename (id, value, time_created) VALUES ('{$id}', '{$value}', NOW())"); How can I do the same thing in PDO. When I bind like this, I get an error: $stmt->bindParam(':time_added', NOW(), PDO::PARAM_STR); Is it the PDO:PARAM_STR?

    Read the article

  • Parsing an Open XML doc via styled blocks

    - by Chris B. Behrens
    I'm working with docx docs, and I need to parse a document into sections on the basis of headings styled with the "heading 1" style. So if I had a doc like this (markup is pseudocode): <doc> <title style>Doc Title</title style> <heading1>First Section</heading1> ... <heading2>Second Section</heading2> ... <heading3>Third Section</heading3> ... </doc> I'd want to break this into a doc with four sections, the first being the content that precedes the first section. I figure that this is probably pretty simple once you're familiar with Open XML, but I am not. TIA.

    Read the article

  • Validate HAML from ActiveRecord: scope/controller/helpers for link_to etc?

    - by Chris Boyle
    I like HAML. So much, in fact, that in my first Rails app, which is the usual blog/CMS thing, I want to render the body of my Page model using HAML. So here is app/views/pages/_body.html.haml: .entry-content= Haml::Engine.new(body, :format => :html5).render ...and it works (yay, recursion). What I'd like to do is validate the HAML in the body when creating or updating a Page. I can almost do that, but I'm stuck on the scope argument to render. I have this in app/models/page.rb: validates_each :body do |record, attr, value| begin Haml::Engine.new(value, :format => :html5).render(record) rescue Exception => e record.errors.add attr, "line #{(e.respond_to? :line) && e.line || 'unknown'}: #{e.message}" end end You can see I'm passing record, which is a Page, but even that doesn't have a controller, and in particular doesn't have any helpers like link_to, so as soon as a Page uses any of that it's going to fail to validate even when it would actually render just fine. So I guess I need a controller as scope for this, but accessing that from here in the model (where the validator is) is a big MVC no-no, and as such I don't think Rails gives me a way to do it. (I mean, I suppose I could stash a controller in some singleton somewhere or something, but... excuse me while I throw up.) What's the least ugly way to properly validate HAML in an ActiveRecord validator?

    Read the article

  • SL3 Grid RowDefinition Height Problem

    - by Chris
    I have a parent grid that contains multiple row definitions, all of which have their height set to 'auto'. Within the parent grid are individual grids - each individual grid contains a custom content control. When the custom content control loads, the height may increase. What I am noticing is that when the height does increase, the content overlaps with the content in other rows. I have specified the horizontal and vertical alignments - am I missing something? Here is an example: <Grid x:Name="LayoutRoot"> <Grid x:Name="ParentGrid>"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Grid Grid.Row="0"> <CustomContentControl/> </Grid> <Grid Grid.Row="1"> <CustomContentControl/> </Grid> <Grid Grid.Row="2"> <CustomContentControl/> </Grid> </Grid> </Grid>

    Read the article

  • How can I execute an ANTLR parser action for each item in a rule that can match more than one item?

    - by Chris Farmer
    I am trying to write an ANTLR parser rule that matches a list of things, and I want to write a parser action that can deal with each item in the list independently. Some example input for these rules is: $(A1 A2 A3) I'd like this to result in an evaluator that contains a list of three MyIdentEvaluator objects -- one for each of A1, A2, and A3. Here's a snippet of my grammar: my_list returns [IEvaluator e] : { $e = new MyListEvaluator(); } '$' LPAREN op=my_ident+ { /* want to do something here for each 'my_ident'. */ /* the following seems to see only the 'A3' my_ident */ $e.Add($op.e); } RPAREN ; my_ident returns [IEvaluator e] : IDENT { $e = new MyIdentEvaluator($IDENT.text); } ; I think my_ident is defined correctly, because I can see the three MyIdentEvaluators getting created as expected for my input string, but only the last my_ident ever gets added to the list (A3 in my example input). How can I best treat each of these elements independently, either through a grammar change or a parser action change? It also occurred to me that my vocabulary for these concepts is not what it should be, so if it looks like I'm misusing a term, I probably am. EDIT in response to Wayne's comment: I tried to use op+=my_ident+. In that case, the $op in my action becomes an IList (in C#) that contains Antlr.Runtime.Tree.CommonTree instances. It does give me one entry per matched token in $op, so I see my three matches, but I don't have the MyIdentEvaluator instances that I really want. I was hoping I could then find a rule attribute in the ANTLR docs that might help with this, but nothing seemed to help me get rid of this IList. Result... Based on chollida's answer, I ended up with this which works well: my_list returns [IEvaluator e] : { $e = new MyListEvaluator(); } '$' LPAREN (op=my_ident { $e.Add($op.e); } )+ RPAREN ; The Add method gets called for each match of my_ident.

    Read the article

  • Overloading stream insertion without violating information hiding?

    - by Chris
    I'm using yaml-cpp for a project. I want to overload the << and >> operators for some classes, but I'm having an issue grappling with how to "properly" do this. Take the Note class, for example. It's fairly boring: class Note { public: // constructors Note( void ); ~Note( void ); // public accessor methods void number( const unsigned long& number ) { _number = number; } unsigned long number( void ) const { return _number; } void author( const unsigned long& author ) { _author = author; } unsigned long author( void ) const { return _author; } void subject( const std::string& subject ) { _subject = subject; } std::string subject( void ) const { return _subject; } void body( const std::string& body ) { _body = body; } std::string body( void ) const { return _body; } private: unsigned long _number; unsigned long _author; std::string _subject; std::string _body; }; The << operator is easy sauce. In the .h: YAML::Emitter& operator << ( YAML::Emitter& out, const Note& v ); And in the .cpp: YAML::Emitter& operator << ( YAML::Emitter& out, const Note& v ) { out << v.number() << v.author() << v.subject() << v.body(); return out; } No sweat. Then I go to declare the >> operator. In the .h: void operator >> ( const YAML::Node& node, Note& note ); But in the .cpp I get: void operator >> ( const YAML::Node& node, Note& note ) { node[0] >> ? node[1] >> ? node[2] >> ? node[3] >> ? return; } If I write things like node[0] >> v._number; then I would need to change the CV-qualifier to make all of the Note fields public (which defeats everything I was taught (by professors, books, and experience))) about data hiding. I feel like doing node[0] >> temp0; v.number( temp0 ); all over the place is not only tedious, error-prone, and ugly, but rather wasteful (what with the extra copies). Then I got wise: I attempted to move these two operators into the Note class itself, and declare them as friends, but the compiler (GCC 4.4) didn't like that: src/note.h:44: error: ‘YAML::Emitter& Note::operator<<(YAML::Emitter&, const Note&)’ must take exactly one argument src/note.h:45: error: ‘void Note::operator(const YAML::Node&, Note&)’ must take exactly one argument Question: How do I "properly" overload the >> operator for a class Without violating the information hiding principle? Without excessive copying?

    Read the article

  • "Mail merge"-like functionality in Dreamweaver, or in any other web editing tool?

    - by Chris Farmer
    I have inherited several related, low-traffic web sites to manage and edit. These sites are implemented with static html, and they've accrued lots of stray tags and other cruft. I want to try to clean these up and migrate them to some common page template framework to simplify design and data changes and improve overall consistency. The pages will change on the timescale of weeks, and since the current web hosting plan does not support any dynamic server technologies, I was hoping to just use Dreamweaver or some other tool to merge my content data with some templating structure. I'd like to do content updates every several days and then run the content back through my templates, resulting in new static html that I can upload to the host. Do any tools support this kind of poor-man's data-driven web application? Are there better ways to approach this problem, aside from moving to a new hosting plan and using ASP.NET or PHP?

    Read the article

  • DDD: Enum like entities

    - by Chris
    Hi all, I have the following DB model: **Person table** ID | Name | StateId ------------------------------ 1 Joe 1 2 Peter 1 3 John 2 **State table** ID | Desc ------------------------------ 1 Working 2 Vacation and domain model would be (simplified): public class Person { public int Id { get; } public string Name { get; set; } public State State { get; set; } } public class State { private int id; public string Name { get; set; } } The state might be used in the domain logic e.g.: if(person.State == State.Working) // some logic So from my understanding, the State acts like a value object which is used for domain logic checks. But it also needs to be present in the DB model to represent a clean ERM. So state might be extended to: public class State { private int id; public string Name { get; set; } public static State New {get {return new State([hardCodedIdHere?], [hardCodeNameHere?]);}} } But using this approach the name of the state would be hardcoded into the domain. Do you know what I mean? Is there a standard approach for such a thing? From my point of view what I am trying to do is using an object (which is persisted from the ERM design perspective) as a sort of value object within my domain. What do you think? Question update: Probably my question wasn't clear enough. What I need to know is, how I would use an entity (like the State example) that is stored in a database within my domain logic. To avoid things like: if(person.State.Id == State.Working.Id) // some logic or if(person.State.Id == WORKING_ID) // some logic

    Read the article

  • Is "for(;;)" faster than "while (TRUE)"? If not, why do people use it?

    - by Chris Cooper
    for (;;) { //Something to be done repeatedly } I have seen this sort of thing used a lot, but I think it is rather strange... Wouldn't it be much clearer to say while (TRUE), or something along those lines? I'm guessing that (as is the reason for many-a-programmer to resort to cryptic code) this is a tiny margin faster? Why, and is it REALLY worth it? If so, why not just define it this way: #DEFINE while(TRUE) for(;;)

    Read the article

  • Javascript src starts with //?

    - by Chris
    I'm starting to see more and more script references show up like so: <script type="text/javascript" src="//somedomain.com/somescript.js"></script> Note the lack of http: at the beginning of the src attribute. It seems to work fine and avoids the messy requirement of detecting http vs https, but I've never actually seen this uri format referenced anywhere. Where did it come from? Is this behavior documented anywhere? Is it guaranteed to work in any browser?

    Read the article

  • ScaleTransform transforms non-linearly

    - by Chris
    I am using scale transform to allow a user to resize a control. What happens though is that when you start to move the mouse the control jumps to a new size, and then scales oddly. The further you move your mouse from the starting location the larger the increase in size becomes. I expect its the way I calculate the scale to be applied. Here is the code: private void ResizeGrip_MouseDown(object sender, MouseButtonEventArgs e) { ResizeHandle.CaptureMouse(); //Get the initial coordinate cursor location on the window initBtmX = e.GetPosition(this).X; bottomResize = true; } private void ResizeGrip_MouseUp(object sender, MouseButtonEventArgs e) { bottomResize = false; ResizeHandle.ReleaseMouseCapture(); } private void ResizeGrip_MouseMove(object sender, MouseEventArgs e) { if( bottomResize == true) { //Get the new Y coordinate cursor location double newBtmX = e.GetPosition(this).X; //Get the smallest change between the initial and new cursor location double diffX = initBtmX - newBtmX; // Let our rectangle capture the mouse ResizeHandle.CaptureMouse(); double newWidth = e.GetPosition(this).X - diffX; double scaler = newWidth / ResizeContainer.ActualWidth; Console.WriteLine("newWidth: {0}, scalar: {1}", newWidth, scaler); if (scaler < 0.75 || scaler > 3) return; ScaleTransform scale = new ScaleTransform(scaler, scaler); ResizeContainer.LayoutTransform = scale; } }

    Read the article

  • Determining CPU usage in WinCE

    - by Chris
    I want to be able to get the current % CPU usage in a C++ program running under Wince. I found this link that states where the source code is but I cannot find it in my platform builder installation - I expect this is because it isn't the Windows Automotive platform. Does anyone know where I can find this source code or (even better) know how I can get this information directly? i.e. what DLL / function calls to make etc.

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >