Search Results

Search found 1556 results on 63 pages for 'scott pendleton'.

Page 28/63 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Dynamically bind argument and default value to existing function in Javascript

    - by Scott
    Let's suppose you have some function someFunc() already defined in javascript, that may or may not have its own argument set defined. Is it possible to write another function to add a required argument and set that argument to a default for someFunc()? Something like: var someFunc = function(arg1, arg2 ...){ Do stuff...} var addRequired = function(argName, argValue, fn) { Add the required default arg to a function... } addRequired("x", 20, someFunc); Now someFunc would be defined roughly like so: someFunc = function(x, arg1, arg2...) { x = 20; Do stuff... } What I am really seeking is to not only bind a this value to a function (which I already know how to achieve), but also bind another object reference to that same function (the function not being known ahead of time, as a user will define it, but then the user's code has access to this second object reference for use in their own function). So in my simple example above, the "20" value will actually be an object reference. Thanks for any help you can offer.

    Read the article

  • WordPress Custom Theme Favicon in Dashboard Menu

    - by Scott B
    When you create a custom theme in WordPress, you can add a link to your theme options on the left menu in the WP dashboard. The default icon that's used next to your menu label is called generic.png and resides in the wp-admin/images directory. Anyone know how to tell WP to use my theme's custom favicon.png instead of the default?

    Read the article

  • AutoIt Array Error

    - by Scott
    Func archiveDir($dir) ; Get all the files under the current dir $allOfDir = _FileListToArray($dir) Local $countDirs = 0 Local $countFiles = 0 $imax = UBound($allOfDir) For $i = 0 to $imax - 1 If StringInStr(FileGetAttrib($allOfDir[$i]),"D") Then $countDirs = $countDirs + 1 Else $countFiles = $countFiles + 1 EndIf Next Local $allDirs[$countDirs] Local $allFiles[$countFiles] The error text is : "Array variable subscript badly formatted." and comes on this line: Local $allDirs[$countDirs] Any ideas?

    Read the article

  • Testing if URL and querystring is valid

    - by Scott
    What is the best way to test if a url & querystring is valid? For example, after a login redirect I want to make sure the target url is valid. If not, go to a default page. We seem to have a problem with the querystring, starting with "ReturnUrl=", being duplicated and that throws an exception. We'd rather have it go to a default page.

    Read the article

  • v8 is too slow for my purpose

    - by Scott
    I'm working on a music visualization plugin for libvisual. It's an AVS clone -- AVS being from Winamp. Right now I have a superscope plugin. This element has 4 scripts, and "point" is run at every pixel. You can imagine that it has to be rather fast. The original libvisual avs clone had a JIT compiler that was really fast, but it had some bugs and wasn't fully implemented, so I decided to try v8. Well, v8 is too slow running the compiled script at every pixel. Is there any other script engine that would be pretty fast for this purpose?

    Read the article

  • How to restrain one's self from the overwhelming urge to rewrite everything?

    - by Scott Saad
    Setup Have you ever had the experience of going into a piece of code to make a seemingly simple change and then realizing that you've just stepped into a wasteland that deserves some serious attention? This usually gets followed up with an official FREAK OUT moment, where the overwhelming feeling of rewriting everything in sight starts to creep up. It's important to note that this bad code does not necessarily come from others as it may indeed be something we've written or contributed to in the past. Problem It's obvious that there is some serious code rot, horrible architecture, etc. that needs to be dealt with. The real problem, as it relates to this question, is that it's not the right time to rewrite the code. There could be many reasons for this: Currently in the middle of a release cycle, therefore any changes should be minimal. It's 2:00 AM in the morning, and the brain is starting to shut down. It could have seemingly adverse affects on the schedule. The rabbit hole could go much deeper than our eyes are able to see at this time. etc... Question So how should we balance the duty of continuously improving the code, while also being a responsible developer? How do we refrain from contributing to the broken window theory, while also being aware of actions and the potential recklessness they may cause? Update Great answers! For the most part, there seems to be two schools of thought: Don't resist the urge as it's a good one to have. Don't give in to the temptation as it will burn you to the ground. It would be interesting to know if more people feel any balance exists.

    Read the article

  • PackageManager: Not granting permission

    - by scott
    Im trying to force my phone to go to sleep as soon as i turn my screen off, but whenever i install with adb, packagemanager informs me that it wont grant the permission i need, so my service throws an exception. I was able to install another app called power save mode toggle which has the same permission, and it seems to work, so i should be able to get this to work, right?

    Read the article

  • How do I apply a "template" or "skeleton" of code in C# here?

    - by Scott Stafford
    In my business layer, I need many, many methods that follow the pattern: public BusinessClass PropertyName { get { if (this.m_LocallyCachedValue == null) { if (this.Record == null) { this.m_LocallyCachedValue = new BusinessClass( this.Database, this.PropertyId); } else { this.m_LocallyCachedValue = new BusinessClass( this.Database, this.Record.ForeignKeyName); } } return this.m_LocallyCachedValue; } } I am still learning C#, and I'm trying to figure out the best way to write this pattern once and add methods to each business layer class that follow this pattern with the proper types and variable names substituted. BusinessClass is a typename that must be substituted, and PropertyName, PropertyId, ForeignKeyName, and m_LocallyCachedValue are all variables that should be substituted for. Are attributes usable here? Do I need reflection? How do I write the skeleton I provided in one place and then just write a line or two containing the substitution parameters and get the pattern to propagate itself? EDIT: Modified my misleading title -- I am hoping to find a solution that doesn't involve code generation or copy/paste techniques, and rather to be able to write the skeleton of the code once in a base class in some form and have it be "instantiated" into lots of subclasses as the accessor for various properties. EDIT: Here is my solution, as suggested but left unimplemented by the chosen answerer. // I'll write many of these... public BusinessClass PropertyName { get { return GetSingleRelation(ref this.m_LocallyCachedValue, this.PropertyId, "ForeignKeyName"); } } // That all call this. public TBusinessClass GetSingleRelation<TBusinessClass>( ref TBusinessClass cachedField, int fieldId, string contextFieldName) { if (cachedField == null) { if (this.Record == null) { ConstructorInfo ci = typeof(TBusinessClass).GetConstructor( new Type[] { this.Database.GetType(), typeof(int) }); cachedField = (TBusinessClass)ci.Invoke( new object[] { this.Database, fieldId }); } else { var obj = this.Record.GetType().GetProperty(objName).GetValue( this.Record, null); ConstructorInfo ci = typeof(TBusinessClass).GetConstructor( new Type[] { this.Database.GetType(), obj.GetType()}); cachedField = (TBusinessClass)ci.Invoke( new object[] { this.Database, obj }); } } return cachedField; }

    Read the article

  • Can an Aspect conditionally render parts of a JSP page ?

    - by Scott The Scot
    At present the jsp pages have normal authorize tags to conditionally render links and information etc. The website is on the intranet, and we're using Spring Security 2.0.4. Ive now got a business user who wants to allow all roles to access everything for the first few weeks, then gradually add the security back in as feedback is gathered from the business. Rather than go through every page, removing the authorize tags, only to have to put them back in, is is possible to configure these through an aspect, or is there any other way to externalize this into a config file ? I've found Spring's MethodSecurityInterceptor and the meta data tags, but these wouldn't give me the externalization. I've been on google for the last hour, and am now pretty sure this can't be done, but would love to find out I haven't been asking the right questions. Advice appreciated

    Read the article

  • Django ForeignKey created empty?

    - by Scott Willman
    This seems very basic and I must be missing something, but here goes anyways... With two models like so: class School(models.Model): name = models.CharField("Official School Name", max_length=128) address = models.TextField("Address of the School", max_length=256) mascot = models.CharField("Name of the School Mascot", max_length=128) class StudentProfile(models.Model): name = models.CharField(max_length=128) school = models.ForeignKey(School) If the student gets created before the school, how do I give 'school' a default empty value? Is it blank or null or what? Thanks!

    Read the article

  • Iterating Oracle collections of objects with out exploding them

    - by Scott Bailey
    I'm using Oracle object data types to represent a timespan or period. And I've got to do a bunch of operations that involve working with collections of periods. Iterating over collections in SQL is significantly faster than in PL/SQL. CREATE TYPE PERIOD AS OBJECT ( beginning DATE, ending DATE, ... some member functions...); CREATE TYPE PERIOD_TABLE AS TABLE OF PERIOD; -- sample usage SELECT <<period object>>.contains(period2) FROM TABLE(period_table1) t The problem is that the TABLE() function explodes the objects into scalar values, and I really need the objects instead. I could use the scalar values to recreate the objects but this would incur the overhead of re-instantiating the objects. And the period is designed to be subclassed so there would be additional difficulty trying to figure out what to initialize it as. Is there another way to do this that doesn't destroy my objects?

    Read the article

  • Can SVG render partially if gzipped and chunk-transferred?

    - by Scott Stafford
    Hi - I have some large, dynamically generated SVGs that are being served over a relatively slow internet connection. I'm trying to optimize them to be viewable as fast as possible. If I set the server to Content-Encoding: gzip and Transfer-Encoding: chunked, will any SVG viewers take advantage of that and render it partially, as it is transferred? If not, are there other ways to get it to render as-it-streams? I could break it up into several SVG pieces but that will be a lot of work, I was hoping for server settings... The most common users use IE7 with the Adobe SVG Viewer plugin. I doubt it matters but I'm serving with C#/ASP.NET and IIS6.

    Read the article

  • Wordpress auto excerpts from post content?

    - by Scott B
    I'm trying to create an auto generated post excerpt from the current page's post content using a function in my theme's header file. The post excerpt will be used as the page's meta description. Can someone give me an idea of how you might go about this once you've got the post content into a string variable? The somewhat tricky part is that, in order to predict a viable stopping point for the post excerpt, I'd like to specify that the cutoff point be the end of the first paragraph of text. And for that reason, it does not make sense to load the entire post content into the string I'm using. Can I grab the first paragraph without having to load the entire post content string? And I'm not certain how to test for that in php. Would regex be the only way?

    Read the article

  • How do I conditionally format a WPF TextBlock?

    - by Scott Ferguson
    I have a WPF TextBlock bound to a string. If that string is empty, I want the TextBlock to display a warning message in another colour. This is easy to do in code, I was wondering if there was a elegant WPF pure XAML solution for it? I have investigated Style Triggers, but the syntax doesn't come naturally to me. Thanks!

    Read the article

  • Does the chunk of the System.Collections.Concurrent.Partitioner need to be thread safe?

    - by Scott Chamberlain
    I am working with the Parallel libraries in .net 4 and I am creating a Partitioner and the example shown in the MSDN only has a chunk size of 1 (every time a new result is retrieved it hits the data source instead of the local cache. The version I am writing will pull 10000 SQL rows at a time then feed the rows from the cache until it is empty then pull another batch. Each partition in the Partitioner has its own chunk. I know every time I call to the IEnumerator in from the SQL data-source that needs to be thread safe but for use in a Parallel.ForEach do I need to make every call to the cache for the chunking thread safe?

    Read the article

  • How to Convert ILayer to IPolygon In ArcObjects

    - by Scott
    Having trouble converting an Ilayer to an IPolygon. I am developing a toolbar for ArcMap and I grab a layer via code from the side table of contents. The Layer is a Polygon, but the code won't convert it to a IPolygon. Can anyone help me out? This is the code I am using to try and convert it to a IPolygon... IPolygon poly = m_document.Maps.get_Item(0).get_Layer(0) as IPolygon; I can do this: ILayer layer = m_document.Maps.get_Item(0).get_Layer(0) as ILayer; And that works, just not converting it to a IPloygon..

    Read the article

  • Post/Redirect/Get Pattern and Sticky Forms

    - by Scott Christopherson
    I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this approach before and I'm trying to figure something out: Normally, I always just displayed the posted form again when there were validation errors and displayed POST values in the form (sticky form). However with the PRG pattern, the form is displayed after a redirect, so there aren't any POST values. So my question is, how can I implement the PRG pattern and still have sticky forms?

    Read the article

  • C program help......

    - by scott
    void main () { int c; signal (SIGINT, Handle); while (( c = getchar()) != '\n' ); return(); } void Handle(signum) { signal {SIGINT, Handle); printf ("beep \n"); } I thought it would print 'beep' until any key has been pressed but the method call is outside the loop? :S

    Read the article

  • Using arrays with other arrays in Python.

    - by Scott
    Trying to find an efficient way to extract all instances of items in an array out of another. For example array1 = ["abc", "def", "ghi", "jkl"] array2 = ["abc", "ghi", "456", "789"] Array 1 is an array of items that need to be extracted out of array 2. Thus, array 2 should be modified to ["456", "789"] I know how to do this, but no in an efficient manner.

    Read the article

  • Why is this exception thrown when trying to match this regex in Java?

    - by Scott Ferguson
    I'm trying to match a specific string out of a an HTML document and have this regex pattern to grab it: Pattern somePattern = Pattern.compile("var json = ({\"r\":\"^d1\".*});"); However when I try to hit that code at runtime, I get this error: FATAL EXCEPTION: Timer-0 java.util.regex.PatternSyntaxException: Syntax error U_REGEX_RULE_SYNTAX near index 13: var json = ({"r":"^d1".*}); ^ at com.ibm.icu4jni.regex.NativeRegEx.open(Native Method) at java.util.regex.Pattern.compileImpl(Pattern.java:383) at java.util.regex.Pattern.<init>(Pattern.java:341) at java.util.regex.Pattern.compile(Pattern.java:317) Can anybody tell me what I'm doing wrong?

    Read the article

  • LAMP stack on home computer as a public web server

    - by Scott
    So I'm using this website: http://www.howtoforge.com/ubuntu_debian_lamp_server to setup LAMP on my Ubuntu Virtual Machine. Here is my question though, This will enable me to program and test through localhost. How can I set this up so anyone on the web can access my .php pages from any Internet capable device, and they will still interact with my local database, etc?

    Read the article

  • Anyone using IronPython in a production application?

    - by Scott P
    I've been toying with the idea of adding IronPython for extending a scientific application I support. Is this a good or horrible idea? Are there any good examples of IronPython being used in a production application. I've seen Resolver, which is kind of cute. Are there any other apps out there? What I don't get is this. Is it any easier to use IronPython than to just use something like code DOM to create script like extensibility in your application? Anyone have some horror stories or tales of glorious success with IronPython / IronRuby?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >