Search Results

Search found 1555 results on 63 pages for 'scott'.

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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • How do I open a web browser from a .NET Program? Process.Start() isn't working?

    - by Scott Whitlock
    I have a URL and I want to launch it in the default browser. I've tried two methods: Process.Start("http://stackoverflow.com"); ... and the one detailed in this other question using ShellExecute. In both cases I get the error: Windows cannot find 'http://stackoverflow.com'. Make sure you typed the name correctly, and then try again. It shouldn't be trying to open it as a file though... from what I understand, it should recognize it as a URL and open it in the default browser. What am I missing? By the way: OS = Vista, and .NET = 3.5 EDIT: According to this MS KB article, since Process.Start sets the UseShellExecute by default, it should launch the default browser.

    Read the article

  • Trying to compile a linux-based app on Mac OS X

    - by Scott
    I'm just trying to compile the linux-based FCEUX (NES emulator) on my mac, OS X 10.5 Leopard. I got all the dependencies (SDL, GTK+ 2) going and everything but of all things this is now my problem: Undefined symbols: "_compress", referenced from: SaveSnapshot() in video.o "_gzclose", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o "_crc32", referenced from: CalcCRC32(unsigned int, unsigned char*, unsigned int)in crc32.o _unzReadCurrentFile in unzip.o _unzReadCurrentFile in unzip.o "_uncompress", referenced from: NetplayUpdate(unsigned char*)in netplay.o FCEUSS_LoadFP(EMUFILE*, ENUM_SSLOADPARAMS) in state.o "_compress2", referenced from: FCEUNET_SendFile(unsigned char, char*)in netplay.o FCEUSS_SaveMS(EMUFILE*, int) in state.o "_inflateEnd", referenced from: _unzCloseCurrentFile in unzip.o "_inflate", referenced from: _unzReadCurrentFile in unzip.o "inflateInit2", referenced from: _unzOpenCurrentFile in unzip.o "_gzgetc", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o "_gzopen", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o "_gzread", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o "_gzseek", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const*)in file.o ld: symbol(s) not found collect2: ld returned 1 exit status scons: ** [src/fceux] Error 1 scons: building terminated because of errors. Those are zlib functions. It seems like it is loading the zlib.h ok, but the symbols aren't being linked in? Just to make sure I downloaded the latest zlib and did a make install, no help. I have no clue what's going on here, it seems like it should be pretty basic, that library is nothing special. Help would be appreciated. Thanks.

    Read the article

  • How do I bind a Listview SelectedItem to a Textbox using the TwoWay mode?

    - by Nick U
    I am very new to WPF and testing some things that I would like to include in an application that I will be working on. I have a 2 row ListView (bound to a textbox) with the names Scott Guthrie and Jon Skeet in it. I am trying to select "Scott Guthrie" in the ListView and have it populate the TextBox. I want to be able to edit the text and tab off and have the ListView updated. Edit:I removed the code since that really didn't add anything to the question.

    Read the article

  • Recognize Dates In A String

    - by Tim Scott
    I want a class something like this: public interface IDateRecognizer { DateTime[] Recognize(string s); } The dates might exist anywhere in the string and might be any format. For now, I could limit to U.S. culture formats. The dates would not be delimited in any way. They might have arbitrary amounts of whitespace between parts of the date. The ideas I have are: ANTLR Regex Hand rolled I have never used ANTLR, so I would be learning from scratch. I wonder if there are libraries or code samples out there that do something similar that could jump start me. Is ANTLR too heavy for such a narrow use? I have used Regex a lot before, but I hate it for all the reasons that most people hate it. I could certainly hand roll it but I'd rather not re-solve a solved problem. Suggestions? UPDATE: Here is an example. Given this input: This is a date 11/3/63. Here is another one: November 03, 1963; and another one Nov 03, 63 and some more (11/03/1963). The dates could be in any U.S. format. They might have dashes like 11-2-1963 or weird extra whitespace inside like this: Nov   3,   1963, and even maybe the comma is missing like [Nov 3 63] but that's an edge case. The output should be an array of seven DateTimes. Each date would be the same: 11/03/1963 00:00:00.

    Read the article

  • Forcing a checkbox bound to a DataSource to update when it has not been viewed yet.

    - by Scott Chamberlain
    Here is a test framework to show what I am doing: create a new project add a tabbed control on tab 1 put a button on tab 2 put a check box paste this code for its code (use default names for controls) public partial class Form1 : Form { private List<bool> boolList = new List<bool>(); BindingSource bs = new BindingSource(); public Form1() { InitializeComponent(); boolList.Add(false); bs.DataSource = boolList; checkBox1.DataBindings.Add("Checked", bs, ""); this.button1.Click += new System.EventHandler(this.button1_Click); this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); } bool updating = false; private void button1_Click(object sender, EventArgs e) { updating = true; boolList[0] = true; bs.ResetBindings(false); Application.DoEvents(); updating = false; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (!updating) MessageBox.Show("CheckChanged fired outside of updating"); } } The issue is if you run the program and look at tab 2 then press the button on tab 1 the program works as expected, however if you press the button on tab 1 then look at tab 2 the event for the checkbox will not fire untill you look at tab 2. The reason for this is the controll on tab 2 is not in the "created" state, so its binding to change the checkbox from unchecked to checked does not happen until after the control has been "Created". checkbox1.CreateControl() does not do anything because according to MSDN CreateControl does not create a control handle if the control's Visible property is false. You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children. I tried getting the value of Handle(there is no public CreateHandle() for CheckBox) but still the same result. Any suggestions other than have the program quickly flash all of my tabs that have data-bound check boxes when it first loads? EDIT-- per Jaxidian's suggestion I created a new class public class newcheckbox : CheckBox { public new void CreateHandle() { base.CreateHandle(); } } I call CreateHandle() right after updating = true same results as before.

    Read the article

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