Daily Archives

Articles indexed Wednesday June 16 2010

Page 24/119 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Python __subclasses__() not listing subclasses

    - by Mridang Agarwalla
    I cant seem to list all derived classes using the __subclasses__() method. Here's my directory layout: import.py backends __init__.py --digger __init__.py base.py test.py --plugins plugina_plugin.py From import.py i'm calling test.py. test.py in turn iterates over all the files in the plugins directory and loads all of them. test.py looks like this: import os import sys import re sys.path.append(os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ ))))) sys.path.append(os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ ))), 'plugins')) from base import BasePlugin class TestImport: def __init__(self): print 'heeeeello' PLUGIN_DIRECTORY = os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ ))), 'plugins') for filename in os.listdir (PLUGIN_DIRECTORY): # Ignore subfolders if os.path.isdir (os.path.join(PLUGIN_DIRECTORY, filename)): continue else: if re.match(r".*?_plugin\.py$", filename): print ('Initialising plugin : ' + filename) __import__(re.sub(r".py", r"", filename)) print ('Plugin system initialized') print BasePlugin.__subclasses__() The problem us that the __subclasses__() method doesn't show any derived classes. All plugins in the plugins directory derive from a base class in the base.py file. base.py looks like this: class BasePlugin(object): """ Base """ def __init__(self): pass plugina_plugin.py looks like this: from base import BasePlugin class PluginA(BasePlugin): """ Plugin A """ def __init__(self): pass Could anyone help me out with this? Whatm am i doing wrong? I've racked my brains over this but I cant seem to figure it out Thanks.

    Read the article

  • How to get the last key pressed on Mac ?

    - by Dheeraj
    Hi All, I'm writing a plugin for an application. I cannot derive from NSApplication as it is a third party application. I can get the callback in my plugin when any key is pressed. But I will not know what key is pressed. So is there any call in Cocoa to find the last key pressed when I get the callback? I only have NSView object. Any ideas will help me a lot. Thanks, Dheeraj.

    Read the article

  • delphi app freezes whole win7 system

    - by avar
    Hello i have a simple program that sorts a text file according to length of words per line this program works without problems in my xp based old machine now i run this program on my new win7/intel core i5 machine, it freezes whole system and back normal after it finishes it's work. i'v invastigated the code and found the line causing the freeze it was this specific line... caption := IntToStr(i) + '..' + IntTostr(ii); i'v changed it to caption := IntTostr(ii); //slow rate change and there is no freeze and then i'v changed it to caption := IntTostr(i); //fast rate change and it freeze again my main complete procedure code is var tword : widestring; i,ii,li : integer; begin tntlistbox1.items.LoadFromFile('d:\new folder\ch.txt'); tntlistbox2.items.LoadFromFile('d:\new folder\uy.txt'); For ii := 15 Downto 1 Do //slow change Begin For I := 0 To TntListBox1.items.Count - 1 Do //very fast change Begin caption := IntToStr(i) + '..' + IntTostr(ii); //problemetic line tword := TntListBox1.items[i]; LI := Length(tword); If lI = ii Then Begin tntlistbox3.items.Add(Trim(tntlistbox1.Items[i])); tntlistbox4.items.Add(Trim(tntlistbox2.Items[i])); End; End; End; end; any idea why ? and how to fix it? i use delphi 2007/win32

    Read the article

  • Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more i

    - by pooyakhamooshi
    I have developed an application using Entity Framework, SQL Server 2000, VS 2008 and Enterprise Library. It works absolutely fine locally but when I deploy the project to our test environment, I am getting the following error: "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information." Stack trace: at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) at System.Reflection.Assembly.GetTypes() at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadTypesFromAssembly(LoadingContext context) at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.InternalLoadAssemblyFromCache(LoadingContext context) at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadAssemblyFromCache(Assembly assembly, Boolean loadReferencedAssemblies, Dictionary2 knownAssemblies, Dictionary2& typesInLoading, List`1& errors) at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies) at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyForType(Type type) at System.Data.Metadata.Edm.MetadataWorkspace.LoadAssemblyForType(Type type, Assembly callingAssembly) at System.Data.Objects.ObjectContext.CreateQueryT Entity Framework seems to have issue, any clue how to fix it?

    Read the article

  • Drawing in iPad

    - by Manjunath
    Hi all, I am trying to draw custom shapes in iPad application. I am using UIBezierPath for drawing which is available for 3.2 onwards. My question is whether it is good to use this class or should I go to the core graphics? Is there any difference between uibezierpath and core graphics drawing related to performance?

    Read the article

  • awk + sorting file according to values in the file and write two diffrent files

    - by yael
    hi I have in file file_test values of right eye and left eye How to separate the file_test to file1 and file2 by awk in order to write the equal values on file1 and different values on file2 as the following example down THX file_test: NAME: jim LAST NAME: bakker right eye: |5|< left eye VALUE: |5|< NAME: Jorg LAST NAME: mitchel right eye: |3|< left eye VALUE: |5|< NAME: jimmy LAST NAME: kartter right eye: |6|< left eye VALUE: |5|< NAME: david LAST NAME: kann right eye: |9|< left eye VALUE: |9|< file1: NAME: jim LAST NAME: bakker right eye: |5|< left eye VALUE: |5|< NAME: david LAST NAME: kann right eye: |9|< left eye VALUE: |9|< file2: NAME: Jorg LAST NAME: mitchel right eye: |3|< left eye VALUE: |5|< NAME: jimmy LAST NAME: kartter right eye: |6|< left eye VALUE: |5|<

    Read the article

  • Imagemagick Resizing in Paperclip

    - by jonathan.soeder
    So, I want to resize images to a FIXED width, but proportional height. I have been trying a wide range of operators: 380x242# 380x242 380!x242 380x242< none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image to 380 wide.

    Read the article

  • How to Trigger a Error from a VBA function

    - by nimo
    hi, I need to trigger(return) an error event from a VBA function, then the calling function of this function can trigger On Error Go to call. E.g function Test() On Error Go to myError: TestErr() Exit Function myerror: Test = "Error Triggered" End Function Function TestErr() ?? 'How to Trigger error here End Function Thank You

    Read the article

  • How to display records below form on submission in php without the use of database?

    - by OM The Eternity
    How to make the use of hidden variables as array for consecutive submission of data so that they can be used to display the records list. I have a form with 4 text fields and a file upload field.. as i submit he form it should get appended to the list which needs to be displayed below the form, such that these values are NOT stored in the DB.. So in this case how can i use the post array to collect the data and display in the list below?

    Read the article

  • Change ObjectChoiceField Color not working on Blackberry OS 5.0

    - by Ari R. Fikri
    I want to create a custom ObjectChoiceField, the expected behavior is if the data change then upon leavinge the focus the font color will change. I have succeded in BB OS upto 4.7 but when tested on simulator and on real device with BB OS 5.0 the color won't change. This is my class : public class MyObjectChoiceField extends ObjectChoiceField { int color; Object oldValue, newValue; boolean isChanged; public MyObjectChoiceField(){ super(); oldValue = new Object(); newValue = new Object(); } public MyObjectChoiceField(int color, String label, String[] choices, int intP, long styleP){ super(label, choices, intP, styleP); this.color = color; } public void onUnfocus(){ if (getSelectedIndex() != -1){ newValue = getChoice(getSelectedIndex()); if (oldValue != newValue){ isChanged = true; invalidate(); } } super.onUnfocus(); } public void onFocus(int directionInt){ if (getSelectedIndex() != -1) oldValue = getChoice(getSelectedIndex()); super.onFocus(directionInt); } public void paint(Graphics g){ if (isChanged){ g.setColor(this.color); } super.paint(g); } What should I do to make this also work on BB OS 5.0. FYI : The ObjectChoiceField in BB 5.0 is look like a button with a triangle point down in the right side, which is different with BB OS 4.7.

    Read the article

  • Is there a faster way to download a page from the net to a string?

    - by cphil5
    I have tried other methods to download info from a URL, but needed a faster one. I need to download and parse about 250 separate pages, and would like the app to not appear ridiculously slow. This is the code I am currently using to retrieve a single page, any insight would be great. try { URL myURL = new URL("http://www.google.com"); URLConnection ucon = myURL.openConnection(); InputStream inputStream = ucon.getInputStream(); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); ByteArrayBuffer byteArrayBuffer = new ByteArrayBuffer(50); int current = 0; while ((current = bufferedInputStream.read()) != -1) { byteArrayBuffer.append((byte) current); } tempString = new String(byteArrayBuffer.toByteArray()); } catch (Exception e) { Log.i("Error",e.toString()); }

    Read the article

  • Active Perl Installation on Windows operating system

    - by pavun_cool
    Hi all. I have installed the Active perl in my windows OS. I have followed below url procedure to install Active Perl Installation after done with that .. I have tried to run "perl -v " in command line . But it says me following error. The system cannot execute the specified prgoram Now What I need to do to solve this issues .. Any one help me out of this problem... Thanks ..

    Read the article

  • MIME "Content-Type" folding and parameter question regarding RFCs?

    - by BastiBense
    Hello, I'm trying to implement a basic MIME parser for the multipart/related in C++/Qt. So far I've been writing some basic parser code for headers, and I'm reading the RFCs to get an idea how to do everything as close to the specification as possible. Unfortunately there is a part in the RFC that confuses me a bit: From RFC882 Section 3.1.1: Each header field can be viewed as a single, logical line of ASCII characters, comprising a field-name and a field-body. For convenience, the field-body portion of this conceptual entity can be split into a multiple-line representation; this is called "folding". The general rule is that wherever there may be linear-white-space (NOT simply LWSP-chars), a CRLF immediately followed by AT LEAST one LWSP-char may instead be inserted. Thus, the single line Alright, so I simply parse a header field and if a CRLF follows with linear whitespace, I simply concat those in a useful manner to result in a single header line. Let's proceed... From RFC2045 Section 5.1: In the Augmented BNF notation of RFC 822, a Content-Type header field value is defined as follows: content := "Content-Type" ":" type "/" subtype *(";" parameter) ; Matching of media type and subtype ; is ALWAYS case-insensitive. [...] parameter := attribute "=" value attribute := token ; Matching of attributes ; is ALWAYS case-insensitive. value := token / quoted-string token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials> Okay. So it seems if you want to specify a Content-Type header with parameters, simple do it like this: Content-Type: multipart/related; foo=bar; something=else ... and a folded version of the same header would look like this: Content-Type: multipart/related; foo=bar; something=else Correct? Good. As I kept reading the RFCs, I came across the following in RFC2387 Section 5.1 (Examples): Content-Type: Multipart/Related; boundary=example-1 start="<[email protected]>"; type="Application/X-FixedRecord" start-info="-o ps" --example-1 Content-Type: Application/X-FixedRecord Content-ID: <[email protected]> [data] --example-1 Content-Type: Application/octet-stream Content-Description: The fixed length records Content-Transfer-Encoding: base64 Content-ID: <[email protected]> [data] --example-1-- Hmm, this is odd. Do you see the Content-Type header? It has a number of parameters, but not all have a ";" as parameter delimiter. Maybe I just didn't read the RFCs correctly, but if my parser works strictly like the specification defines, the type and start-info parameters would result in a single string or worse, a parser error. Guys, what's your thought on this? Just a typo in the RFCs? Or did I miss something? Thanks!

    Read the article

  • Android - Isn't Eclipse WYSIWYG?

    - by Dada
    Hi at all, i have downloaded Eclipse Galileo and install Android SDK for the first time. I have try to create an simple Userinterface, but i have see that i can't move the "object" directly from the stage. But i need to edit the Code or open the Property panel in order to change the position of an Element on the Stage. Isn't Eclipse WYSIWYG? D.

    Read the article

  • rewrite image URLs

    - by Don
    Hi, I'm writing a Maven plugin that merges CSS files together. So all the CSS files that match /foo/bar/*.css might get merged to /foo/merged.css. A concern is that in a file such as /foo/bar/baz.css there might be a property such as: background: url("images/pic.jpg") So when the file is merged into /foo/merged.css this will need to be changed to background: url("bar/images/pic.jpg") The recalculated URL obviously depends on 3 factors: original URL original CSS file location merged CSS file location Assuming that the original and merged CSS files are both on the same filesystem, is there a general formula (or Java library) that can be used to calculate the new url given these 3 inputs? Thanks, Don

    Read the article

  • How might one implement FileTimeToSystemTime?

    - by Billy ONeal
    Hello :) I'm writing a simple wrapper around the Win32 FILETIME structure. boost::datetime has most of what I want, except I need whatever date type I end up using to interpolate with Windows APIs without issues. To that end, I've decided to write my own things for doing this -- most of the operations aren't all that complicated. I'm implementing the TimeSpan - like type at this point, but I'm unsure how I'd implement FileTimeToSystemTime. I could just use the system's built-in FileTimeToSystemTime function, except FileTimeToSystemTime cannot handle negative dates -- I need to be able to represent something like "-12 seconds". How should something like this be implemented? Billy3

    Read the article

  • Building a QueryExpression where name field is either A or B

    - by Mike
    I'm trying to build a Dynamics CRM 4 query so that I can get calendar events that are named either "Event A" or "Event B". A QueryByAttribute doesn't seem to do the job as I cannot specify a condition where the field called "event_name" = "Event A" of "event_name" = "Event B". When using the QueryExpression, I've found the FilterExpression applies to the Referencing Entity. I don't know if the FilterExpression can be used on the Referenced Entity at all. The example below is something like what I want to achieve, though this would return an empty result set as it will go looking in the entity called "my_event_response" for a "name" attribute. It's starting to look like I will need to run several queries to get this but this is less efficient than if I can submit it all at once. ColumnSet columns = new ColumnSet(); columns.Attributes = new string[]{ "event_name", "eventid", "startdate", "city" }; ConditionExpression eventname1 = new ConditionExpression(); eventname1.AttributeName = "event_name"; eventname1.Operator = ConditionOperator.Equal; eventname1.Values = new string[] { "Event A" }; ConditionExpression eventname2 = new ConditionExpression(); eventname2.AttributeName = "event_name"; eventname2.Operator = ConditionOperator.Equal; eventname2.Values = new string[] { "Event B" }; FilterExpression filter = new FilterExpression(); filter.FilterOperator = LogicalOperator.Or; filter.Conditions = new ConditionExpression[] { eventname1, eventname2 }; LinkEntity link = new LinkEntity(); link.LinkCriteria = filter; link.LinkFromEntityName = "my_event"; link.LinkFromAttributeName = "eventid"; link.LinkToEntityName = "my_event_response"; link.LinkToAttributeName = "eventid"; QueryExpression query = new QueryExpression(); query.ColumnSet = columns; query.EntityName = EntityName.mbs_event.ToString(); query.LinkEntities = new LinkEntity[] { link }; RetrieveMultipleRequest request = new RetrieveMultipleRequest(); request.Query = query; return (RetrieveMultipleResponse)crmService.Execute(request); I'd appreciate some advice on how to get the data I need.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >