Search Results

Search found 737 results on 30 pages for 'anthony shorten'.

Page 19/30 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Where can I find a library that parses source code and is able to extract the scope of where your cursor is currently in the code?

    - by Anthony
    In SublimeText(2), when you press [ctrl + shift + p] (mac osx) you are shown a scope of where your caret/cursor is in the source code at the given moment e.g.: entity.name.tag.inline.any.html meta.tag.inline.any.html text.html.basic I am curious about what library or script is used to parse the document/file and create that scope string. A sidenote: Typing view.syntax_name(view.sel()[0].b) into Sublime's console will output the scope as well.

    Read the article

  • PHP sql with foreach loop variable problem

    - by anthony
    This is really getting frustrating. I have a text file that I'm reading for a list of part numbers that goes into an array. I'm using the following foreach function to search a database for matching numbers. $file = file('parts_array.txt'); foreach ($file as $newPart) { $sql = "SELECT products_sku FROM products WHERE products_sku='" . $newPart . "'"; $rs = mysql_query($sql); $num_rows = mysql_num_rows($rs); echo $num_rows; echo "<br />"; } The problem is I'm getting 0 rows returned from mysql_num_rows. I can type the sql statement without the variable and it works perfectly. I can even echo out the sql statement from this script, copy and paste the statement from the browser and it works. But, for some reason I'm not getting any records when I'm using the variable. I've used variables in sql statements tons of times, but this really has me stumped.

    Read the article

  • Convert wide to long format in R

    - by Anthony
    My data has a long format similar to the one below: ID Language MotherTongue SpokenatHome HomeLang 1 English English English 1 French French 1 Polish Polish 2 Lebanese Lebanese Lebanese Labanese 2 Arabic Arabbic Here is the output I am looking for: ID Language1 Language2 Language 3 MotherTongue1 MotherTongue2 SpokenatHome1 HomeLan 1 English French Polish English Polish French English 2 Lebanese Arabic Labanese Arabic I'm using using the melt and dcast functions of the reshape2 package, but it does not work. Does anyone know how to do this? Thanks. df<-df[,c("OEN", "Langugae","MotherTongue", "SpokenatHome", "MainHomeLanguage")] dfl <- melt(df, id.vars=c("OEN", "Langugae"), measure.vars=c("MotherTongue", "SpokenatHome", "MainHomeLanguage"), variable.name="Language") dfw <- dcast(dfl, OEN ~ Langugae , value.var="value" )

    Read the article

  • Initializing static pointer in templated class.

    - by Anthony
    This is difficult for me to formulate in a Google query (at least one that gives me what I'm looking for) so I've had some trouble finding an answer. I'm sure I'm not the first to ask though. Consider a class like so: template < class T > class MyClass { private: static T staticObject; static T * staticPointerObject; }; ... template < class T > T MyClass<T>::staticObject; // <-- works ... template < class T > T * MyClass<T>::staticPointerObject = NULL; // <-- cannot find symbol staticPointerObject. I am having trouble figuring out why I cannot successfully create that pointer object. Edit: The above code is all specified in the header, and the issue I mentioned is an error in the link step, so it is not finding the specific symbol.

    Read the article

  • Image input onclick event being fired when enter button Pressed

    - by Anthony
    I have a strange problem where an onclick event on an input image is being fired when i hit enter in input text box <form id="MyForm" action="/someaction"> <input type="image" src="someimage.jpg" onclick="doStuff();$('#MyForm').submit();" /> <input type="text" name="textInput"/> </form> When the cursor is in the text box and i hit enter, rather than the form being submitted it calls the onclick event on the image input. Any ideas whats going on ?

    Read the article

  • Python: When passing variables between methods, is it necessary to assign it a new name?

    - by Anthony
    I'm thinking that the answer is probably 'no' if the program is small and there are a lot of methods, but what about in a larger program? If I am going to be using one variable in multiple methods throughout the program, is it smarter to: Come up with a different phrasing for each method (to eliminate naming conflicts). Use the same name for each method (to eliminate confusion) Just use a global variable (to eliminate both) This is more of a stylistic question than anything else. What naming convention do YOU use when passing variables?

    Read the article

  • Help with Magento and related products

    - by Anthony
    I have a customer product page that literally lives beside the catalog/product/view.phtml page. It's basically identical to that page with a few small exceptions. It's basically a 'product of the day' type page so I can't combine it with the regular product page since I have to fetch the data from the DB and perform a load to get the product information $_product = Mage::getModel('catalog/product')->load($row['productid']); To make a long story short, everything works (including all children html blocks) with the singular exception of the related products. After the load I save the product into the registry with Mage::register('product', $_product); and then attempt to load the related products with: echo $this->getLayout()->createBlock('catalog/product_view')->setTemplate('catalog/product/list/related.phtml')->toHtml();` All of which give back the error: Fatal error: Call to a member function getSize() on a non-object in catalog/product/list/related.phtml on line 29`, and line 29 is <?php if($this->getItems()->getSize()): ?>`. Any help getting the relateds to load would be appreicated.

    Read the article

  • Replacing symbol from object file at compile time. For example swapping out main

    - by Anthony Sottile
    Here's the use case: I have a .cpp file which has functions implemented in it. For sake of example say it has the following: [main.cpp] #include <iostream> int foo(int); int foo(int a) { return a * a; } int main() { for (int i = 0; i < 5; i += 1) { std::cout << foo(i) << std::endl; } return 0; } I want to perform some amount of automated testing on the function foo in this file but would need to replace out the main() function to do my testing. Preferably I'd like to have a separate file like this that I could link in over top of that one: [mymain.cpp] #include <iostream> #include <cassert> extern int foo(int); int main() { assert(foo(1) == 1); assert(foo(2) == 4); assert(foo(0) == 0); assert(foo(-2) == 4); return 0; } I'd like (if at all possible) to avoid changing the original .cpp file in order to do this -- though this would be my approach if this is not possible: do a replace for "(\s)main\s*\(" == "\1__oldmain\(" compile as usual. The environment I am targeting is a linux environment with g++.

    Read the article

  • Disabling browser print options (headers, footers, margins) from page?

    - by Anthony
    I have seen this question asked in a couple of different ways on SO and several other websites, but most of them are either too specific or out-of-date. I'm hoping someone can provide a definitive answer here without pandering to speculation. Is there a way, either with CSS or javascript, to change the default printer settings when someone prints within their browser? And of course by "prints from their browser" I mean some form of HTML, not PDF or some other plug-in reliant mime-type. Please note: If some browsers offer this and others don't (or if you only know how to do it for some browsers) I welcome browser-specific solutions. Similarly, if you know of a mainstream browser that has specific restrictions against EVER doing this, that is also helpful, but some fairly up-to-date documentation would be appreciated. (simply saying "that goes against XYZ's security policy" isn't very convincing when XYZ has made significant changes in said policy in the last three years). Finally, when I say "change default print settings" I don't mean forever, just for my page, and I am referring specifically to print margins, headers, and footers. I am very aware that CSS offers the option of changing the page orientation as well as the page margins. One of the many struggles is with Firefox. If I set the page margins to 1 inch, it ADDS this to the half inch it already puts into place. I very much want to reduce the usage of PDFs on my client's site, but the infringement on presentation (as well as the lack of reliability) are their main concern.

    Read the article

  • Entity Framework Decorator Pattern

    - by Anthony Compton
    In my line of business we have Products. These products can be modified by a user by adding Modifications to them. Modifications can do things such as alter the price and alter properties of the Product. This, to me, seems to fit the Decorator pattern perfectly. Now, envision a database in which Products exist in one table and Modifications exist in another table and the database is hooked up to my app through the Entity Framework. How would I go about getting the Product objects and the Modification objects to implement the same interface so that I could use them interchangeably? For instance, the kind of things I would like to be able to do: Given a Modification object, call .GetNumThings(), which would then return the number of things in the original object, plus or minus the number of things added by the modification. This question may be stemming from a pretty serious lack of exposure to the nitty-gritty of EF (all of my experience so far has been pretty straight-forward LOB Silverlight apps), and if that's the case, please feel free to tell me to RTFM. Thanks in advance!

    Read the article

  • Custom Drupal Module not creating any tables

    - by Anthony
    Anything specific I need in the module file? Install File function module_install() { //lets create the school database $create_table_sql = "CREATE TABLE IF NOT EXISTS `table1` ( id int(11) NOT NULL, principal_name varchar(300) NOT NULL, school_name varchar(300) NOT NULL, address1 varchar(300) NOT NULL, address2 varchar(300) NOT NULL, city varchar(300) NOT NULL, computer_serial_no varchar(300) NOT NULL, state varchar(200) NOT NULL, uid int(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1"; db_query($create_table_sql); //lets create the student database $create_table_sql = "CREATE TABLE IF NOT EXISTS table2 ( id int(11) NOT NULL, principal_name varchar(300) NOT NULL, school_name varchar(300) NOT NULL, address1 varchar(300) NOT NULL, address2 varchar(300) NOT NULL, city varchar(300) NOT NULL, computer_serial_no varchar(300) NOT NULL, state varchar(200) NOT NULL, uid int(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1"; db_query($create_table_sql); } /** * _UNINSTALL hook * * This function is run to uninstall the module. * */ function module_uninstall() { // Delete the DB db_query("drop table table1"); db_query("drop table table2"); } Info File Just in Case ; $Id$ name = My Module description = This module deals with blah blah package = Somepackage core = 6.x version = "6.x-1.0" core = "6.x"

    Read the article

  • iOS: how to understand the role of rootviewcontroller and its relationship with other objects

    - by Anthony Kong
    I have created a UISplitViewController based iOS app in XCode 3.2.5 Below is a screen shot of Interface builder showing the rootviewcontroller and how it is linked to other objects. Being a beginner myself, I do not understand: 1) What is the role of the rootviewcontroller? Searched the documentation but what I found did not answer this question. 2) I thought a IBOutlet should only link to one corresponding object. Why in this case the rootviewcontroller is linked to two?

    Read the article

  • Thread-safe use of a singleton's members

    - by Anthony Mastrean
    I have a C# singleton class that multiple classes use. Is access through Instance to the Toggle() method thread-safe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it? public class MyClass { private static readonly MyClass instance = new MyClass(); public static MyClass Instance { get { return instance; } } private int value = 0; public int Toggle() { if(value == 0) { value = 1; } else if(value == 1) { value = 0; } return value; } }

    Read the article

  • rake db:migrate fails when trying to do inserts

    - by anthony
    I'm trying to get a database populate so I can begin working on a project. THis project is already built and I'm being brought in to helpwith front-end work. Problem is I can't get rake db:migrate to do any inserts. Every time I run rake db:migrate I get this: ... == 20081220084043 CreateTimeDimension: migrating ============================== -- create_table(:time_dimension) - 0.0870s INSERT time_dimension(time_key, year, month, day, day_of_week, weekend, quarter) VALUES(20080101, 2008, 1, 1, 'Tuesday', false, 1) rake aborted! Could not load driver (uninitialized constant Mysql::Driver) ... I'm building on a MBP with Snow Leopard. I've installed XCode from the disk that comes with the mac. I've updated ruby, installed rails and all the needed gems. I have the 64 bit version of MySQL installed. I've tried the 32 bit version of MySQL and I've even tried installing from macports (via http://www.robbyonrails.com/articles/2010/02/08/installing-ruby-on-rails-passenger-postgresql-mysql-oh-my-zsh-on-snow-leopard-fourth-edition) The mysql gemis installed using: sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/path/to/mysql/bin/mysql_config the migrate creates the tables just fine but it dies every. single. time. it trys an insert. Any help would be great

    Read the article

  • overflow auto not working in IE

    - by Anthony Russo
    First off I have read a couple of q and a's on here about this issue but none of them seem to help. I have a couple other pages on the website that have no problems with resizing to height using overflow auto. The thing I have noticed is the pages work fine with one div. The page that is not working has two or more div and also I have tried it with a container but I still get the vertical and horizontal scroll bars. <div class="content"> <div class="container"> <div class="a"> <div class="left">List Items</div> <div class="right">List Items</div> </div> <div class="b"> This div is a FORM. </div> </div> </div> I could be making a simple error to you guys but I am new so bare with me!

    Read the article

  • Why can't I create an abstract constructor on an abstract C# class?

    - by Anthony D
    I am creating an abstract class. I want each of my derived classes to be forced to implement a specific signature of constructor. As such, I did what I would have done has I wanted to force them to implement a method, I made an abstract one. public abstract class A { abstract A(int a, int b); } However I get a message saying the abstract modifier is invalid on this item. My goal was to force some code like this. public class B : A { public B(int a, int b) : base(a, b) { //Some other awesome code. } } This is all C# .NET code. Can anyone help me out? Update 1 I wanted to add some things. What I ended up with was this. private A() { } protected A(int a, int b) { //Code } That does what some folks are saying, default is private, and the class needs to implement a constructor. However that doesn't FORCE a constructor with the signature A(int a, int b). public abstract class A { protected abstract A(int a, int b) { } } Update 2 I should be clear, to work around this I made my default constructor private, and my other constructor protected. I am not really looking for a way to make my code work. I took care of that. I am looking to understand why C# does not let you do this.

    Read the article

  • Limiting the size of a python dictionary

    - by anthony
    I'd like to work with a dict in python, but limit the number of key/value pairs to X. In other words, if the dict is currently storing X key/value pairs and I perform an insertion, I would like one of the existing pairs to be dropped. It would be nice if it was the least recently inserted/accesses key but that's not completely necessary. If this exists in the standard library please save me some time and point it out!

    Read the article

  • How do you submit a rails 3 form without refreshing the page?

    - by Anthony H
    I've seen this done using ajax & php, but not rails 3. I've tried using: <%= form_for(:technician, :url => {:controller => 'pos', :action => 'create_ticket'}, :remote => true) do |f| %> but the page still refreshes each time. I'm building a point of sale program, so I don't want the page to refresh. How do I send the form data to the controller to process and store in the database without refreshing?

    Read the article

  • What is the '@(' doing in this Perl code?

    - by Anthony Veckey
    In this code snippet: use strict; use warnings; use Data::Dumper; my $r = [qw(testing this thing)]; print Dumper($r); foreach my $row (@({$r}) { print "$row\n"; $row .= 'mod'; } print Dumper($r); print Dumper(@({$r}); I figured out that the '(' after the '@' in the foreach is causing this not to loop correctly. I have no idea why this code even works as there is no ending parenthesis. What is this doing? It looks to be creating a new variable on the fly, but shouldn't 'use strict' have fired or something? Please help explain what that '@(' is doing and why it still runs without an ending parenthesis.

    Read the article

  • Reading binary file with Octave

    - by Anthony Blake
    I'm trying to a binary file consisting of floats with Octave (on OS X), but I'm getting the following error: octave-3.2.3:2> load Input.dat R -binary error: load: failed to read matrix from file `Input.dat' The file was written like so: std::ofstream fout("Input.dat", std::ios::trunc | std::ios::binary); fout.write(reinterpret_cast<char*>(Buf), N*sizeof(double)); fout.close(); Any idea what could be going wrong here?

    Read the article

  • Submit form if ajax validator returns true using jquery

    - by Anthony
    I am not sure where I'm going wrong. The idea is that before the form is submitted, one of the input fields is sent to a server-side validator via ajax. If the response is 1, the input is valid and the form should be submitted. If the response is 0, the form should not be submitted. The issue is that I can't figure out how to set a variable within the ajax request function that will prevent the form from being submitted. This is what I have: $("#form").submit(function() { var valid= false; var input = $("#input").val(); $.ajax({ type: "POST", url: "validator.php", data: "input=" + input, success: function(msg){ valid = (msg == 1) ? true : false; if(!valid) { $("#valid_input").html("Please enter valid info"); } else { $("#valid_input").html(""); } } }); return valid; });

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >