Search Results

Search found 1489 results on 60 pages for 'peter illes'.

Page 30/60 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Trouble using eval() with cython

    - by Peter Stewart
    I was trying to speed up some code, and then I tried compiling a class and a function using cython and WOW! I havn't measured it yet but it looks at least 10x faster. I first looked at cython just two days ago, I'm very impressed! However, I can't get eval() to work. def thefirst(int a): d = eval('1+2+a') return d I compile this to module1.pyd file and call it with the python file: from module1 import thefirst x = thefirst(2) print x This returns: NameError: name 'a' is not defined. All help is appreciated.

    Read the article

  • Alternative of JPA

    - by Peter
    I want to use JPA for my persistence layer of my Java Desktop Application but I have the similar problem as describe at http://stackoverflow.com/questions/2562746/jpa-entity-design-problem/2563009#2563009 I didn't find a solution to the above kind of problem that's why I want to go with any other alternative of JPA. It would be better if I get the solution of the above problem.

    Read the article

  • How to implement an offline reader writer lock

    - by Peter Morris
    Some context for the question All objects in this question are persistent. All requests will be from a Silverlight client talking to an app server via a binary protocol (Hessian) and not WCF. Each user will have a session key (not an ASP.NET session) which will be a string, integer, or GUID (undecided so far). Some objects might take a long time to edit (30 or more minutes) so we have decided to use pessimistic offline locking. Pessimistic because having to reconcile conflicts would be far too annoying for users, offline because the client is not permanently connected to the server. Rather than storing session/object locking information in the object itself I have decided that any aggregate root that may have its instances locked should implement an interface ILockable public interface ILockable { Guid LockID { get; } } This LockID will be the identity of a "Lock" object which holds the information of which session is locking it. Now, if this were simple pessimistic locking I'd be able to achieve this very simply (using an incrementing version number on Lock to identify update conflicts), but what I actually need is ReaderWriter pessimistic offline locking. The reason is that some parts of the application will perform actions that read these complex structures. These include things like Reading a single structure to clone it. Reading multiple structures in order to create a binary file to "publish" the data to an external source. Read locks will be held for a very short period of time, typically less than a second, although in some circumstances they could be held for about 5 seconds at a guess. Write locks will mostly be held for a long time as they are mostly held by humans. There is a high probability of two users trying to edit the same aggregate at the same time, and a high probability of many users needing to temporarily read-lock at the same time too. I'm looking for suggestions as to how I might implement this. One additional point to make is that if I want to place a write lock and there are some read locks, I would like to "queue" the write lock so that no new read locks are placed. If the read locks are removed withing X seconds then the write lock is obtained, if not then the write lock backs off; no new read-locks would be placed while a write lock is queued. So far I have this idea The Lock object will have a version number (int) so I can detect multi-update conflicts, reload, try again. It will have a string[] for read locks A string to hold the session ID that has a write lock A string to hold the queued write lock Possibly a recursion counter to allow the same session to lock multiple times (for both read and write locks), but not sure about this yet. Rules: Can't place a read lock if there is a write lock or queued write lock. Can't place a write lock if there is a write lock or queued write lock. If there are no locks at all then a write lock may be placed. If there are read locks then a write lock will be queued instead of a full write lock placed. (If after X time the read locks are not gone the lock backs off, otherwise it is upgraded). Can't queue a write lock for a session that has a read lock. Can anyone see any problems? Suggest alternatives? Anything? I'd appreciate feedback before deciding on what approach to take.

    Read the article

  • In what areas might the use of F# be more appropriate than C#?

    - by Peter McGrattan
    Over the last few years F# has evolved into one of Microsoft's fully supported languages employing many ideas incubated in OCaml, ML and Haskell. Over the last several years C# has extended it's general purpose features by introducing more and more functional language features: LINQ (list comprehension), Lamdas, Closures, Anonymous Delegates and more... Given C#'s adoption of these functional features and F#'s taxonomy as an impure functional language (it allows YOU to access framework libraries or change shared state when a function is called if you want to) there is a strong similarity between the two languages although each has it's own polar opposite primary emphasis. I'm interested in any successful models employing these two languages in your production polyglot programs and also the areas within production software (web apps, client apps, server apps) you have written in F# in the past year or so that you would previously have written in C#. EDIT: Edited based on feedback from close votes with the intent of reducing perceived ambiguity.

    Read the article

  • Enabling Hibernate second-level cache with JPA on JBoss 4.2

    - by Peter Hilton
    What are the steps required to enable Hibernate's second-level cache, when using the Java Persistence API (annotated entities)? How do I check that it's working? I'm using JBoss 4.2.2.GA. From the Hibernate documentation, it seems that I need to enable the cache and specify a cache provider in persistence.xml, like: <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> What else is required? Do I need to add @Cache annotations to my JPA entities? How can I tell if the cache is working? I have tried accessing cache statistics after running a Query, but Statistics.getSecondLevelCacheStatistics returns null, perhaps because I don't know what 'region' name to use.

    Read the article

  • mod_rewrite apache

    - by Peter
    is there any way to hide redirected url, here is what I think: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*)$ http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force So the long redirected url http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI} to something shorter like /mintedomain.com/track/ It is possible? Adrian edit: Andrew: This is a stats software Mint (haveamint.com) with File Download tracker plugin. The File Download tracker works in this way: in .htaccess every file (zip, rar, txt,...) is redirected to the tracker.php file (because the stats): http://mydomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI} So the redirected url look like this for a zip file: http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://mydomain/downloads/apple.zip This redirected URL is very long and ugly. The best for me would be to redirect this redirected URL to something shorter URL: example: http://mydomain.com/track/downloads/apple.zip.. So the http://mydomain.com/track would be the http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php

    Read the article

  • Change NSNumber value by allocating new NSNumber?

    - by Peter Hajas
    I understand that NSNumber is immutable, but I still have the need to change it in my app. I use it because it's an object, and therefore usable with @property (if I could, I would use float or CGFloat in a heartbeat, but sadly, I can't). Is there any way to just overwrite the old NSNumber instance? I'm trying this: NSNumber *zero = [[NSNumber alloc] initWithFloat:0.0]; myNSNumber = zero but this doesn't change the value. This is a simplified version of my code, as I'm changing the root view controller's parameter (I know, not MVC-friendly). Still, the changing of the value should be the same assignment, right? Should I release myNSNumber first? What should I set the @property at for myNSNumber? Thanks!

    Read the article

  • Emacs key binding in Eclipse IDE

    - by Peter Delaney
    Hello; I am an Emacs lover probably because I love the key binding and I am able to do things very quickly. I also use Eclipse IDE for my Java/Android/Python/ development because it is free, most of my peers use it, and it works. I find myself switching between emacs and Eclipse and the workflow just isn't great. What I would like to do is setup the key bindings in Eclipse so that they are like Emacs. Can someone suggest the best Eclipse plugin I could use for this. Or can anyone talk about how they've used Eclipse to be more Emacs like. Thanks in advance

    Read the article

  • With sqlalchemy how to dynamically bind to database engine on a per-request basis

    - by Peter Hansen
    I have a Pylons-based web application which connects via Sqlalchemy (v0.5) to a Postgres database. For security, rather than follow the typical pattern of simple web apps (as seen in just about all tutorials), I'm not using a generic Postgres user (e.g. "webapp") but am requiring that users enter their own Postgres userid and password, and am using that to establish the connection. That means we get the full benefit of Postgres security. Complicating things still further, there are two separate databases to connect to. Although they're currently in the same Postgres cluster, they need to be able to move to separate hosts at a later date. We're using sqlalchemy's declarative package, though I can't see that this has any bearing on the matter. Most examples of sqlalchemy show trivial approaches such as setting up the Metadata once, at application startup, with a generic database userid and password, which is used through the web application. This is usually done with Metadata.bind = create_engine(), sometimes even at module-level in the database model files. My question is, how can we defer establishing the connections until the user has logged in, and then (of course) re-use those connections, or re-establish them using the same credentials, for each subsequent request. We have this working -- we think -- but I'm not only not certain of the safety of it, I also think it looks incredibly heavy-weight for the situation. Inside the __call__ method of the BaseController we retrieve the userid and password from the web session, call sqlalchemy create_engine() once for each database, then call a routine which calls Session.bind_mapper() repeatedly, once for each table that may be referenced on each of those connections, even though any given request usually references only one or two tables. It looks something like this: # in lib/base.py on the BaseController class def __call__(self, environ, start_response): # note: web session contains {'username': XXX, 'password': YYY} url1 = 'postgres://%(username)s:%(password)s@server1/finance' % session url2 = 'postgres://%(username)s:%(password)s@server2/staff' % session finance = create_engine(url1) staff = create_engine(url2) db_configure(staff, finance) # see below ... etc # in another file Session = scoped_session(sessionmaker()) def db_configure(staff, finance): s = Session() from db.finance import Employee, Customer, Invoice for c in [ Employee, Customer, Invoice, ]: s.bind_mapper(c, finance) from db.staff import Project, Hour for c in [ Project, Hour, ]: s.bind_mapper(c, staff) s.close() # prevents leaking connections between sessions? So the create_engine() calls occur on every request... I can see that being needed, and the Connection Pool probably caches them and does things sensibly. But calling Session.bind_mapper() once for each table, on every request? Seems like there has to be a better way. Obviously, since a desire for strong security underlies all this, we don't want any chance that a connection established for a high-security user will inadvertently be used in a later request by a low-security user.

    Read the article

  • Watin from TeamCity not running as a Windows Service

    - by peter.swallow
    I'm trying to run Watin from within a TeamCity build, using nUnit. All tests run fine locally. I know you cannot run the full Watin tests (i.e. POST) from TeamCity if it is running as a Windows Service. You must start the build agent from a .bat file. But, I don't want to have to login to the server for it to start. I've tried getting a Scheduled Task (in Windows Server 2008) to fire the agent.bat file on StartUp (not Login), but with no luck. Has anyone else got Watin/TeamCity running from a Scheduled Task? Thanks, Pete

    Read the article

  • number of args for stored procedure PLS00306

    - by Peter Kaleta
    Hi I have problem with calling for my procedure.Oracle scrams pls00306 Error: Wrong number of types of arguments in call to procedure. With my type declaration procedure has exact the same declaration like in header below. If I run it as separate prcedure it works , when i work in ODCI interface for exensible index creation , it throws pls 00306. MEMBER PROCEDURE FILL_TREE_LVL(target_column VARCHAR2, cur_lvl NUMBER, max_lvl NUMBER, parent_rect NUMBER,start_x NUMBER, start_y NUMBER,end_x NUMBER, end_y NUMBER) IS stmt VARCHAR2(2000); rect_id NUMBER; diff_x NUMBER; diff_y NUMBER; new_start_x NUMBER; new_end_x NUMBER; i NUMBER; j NUMBER; BEGIN {...} END FILL_TREE_LVL; STATIC FUNCTION ODCIINDEXCREATE (ia SYS.ODCIINDEXINFO, parms VARCHAR2, env SYS.ODCIEnv) RETURN NUMBER IS stmt VARCHAR2(2000); stmt2 VARCHAR2(2000); min_x NUMBER; max_x NUMBER; min_y NUMBER; max_y NUMBER; lvl NUMBER; rect_id NUMBER; pt_tab VARCHAR2(50); rect_tab VARCHAR2(50); cnum NUMBER; TYPE point_rect is RECORD( point_id NUMBER, rect_id NUMBER ); TYPE point_rect_tab IS TABLE OF point_rect; pr_table point_rect_tab; BEGIN {...} FILL_TREE_LVL('any string',0,lvl,min_x,min_y,max_x, max_y); {...} END;

    Read the article

  • Eclipse + Android + JUnit test references android.os class = NoClassDefFoundError WTF

    - by Peter Pascale
    I have a custom timer that extends android.os.CountDownTimer. I have a test in the test project (standard Android/Eclipse project config) that tests the custom Timer. When I try to run this test, I get a java.lang.NoClassDefFoundError: android/os/CountDownTimer at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:698) You get the idea. Can I not run code that references android code code in junit test?

    Read the article

  • .NET load assembly error metabase config

    - by peter
    Hi, Yesterday I found out that the mailroot directory had moved to a different location on the C drive. I don't know how this happened as no configs were changed, using IIS7 with IIS6 SMTP service on Windows 2008 R2 web edition. I wanted to restore it to the default c:\inetpub\mailroot location. So I opened system32/inetsrv/MetaBase.xml, and in the node was the problem, BadMailDirectory, DropDirectory etc were all pointing to the wrong location... I changed them back to the default c:\inetpub\mailroot. Later I discovered an ASP.NET application was throwing this error: An error occurred in the Microsoft .NET Framework while trying to load assembly id 1. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileNotFoundException: Could not load file or assembly 'microsoft.sqlserver.types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. I figured it had to do with my changes to the mailroot locations, so I gave ASP.NET access to the mailroot directory and it was working.... My question is, how is this possible? Why does APS.NET require access to the mailroot directory to load assemblies? Thanks

    Read the article

  • Using Include() with inherited entities problem

    - by Peter Stegnar
    In EF eager loading related entities is easy. But I'm having difficulties including inherited entities when loading data using table-per-type model. This is my model: Entities: ArticleBase (base article entity) ArticleSpecial (inherited from ArticleBase) UserBase (base user entity) UserSpecial (inherited from UserBase) Image Relations are as shown on the image (omitting many columns): In reality my users are always of type UserSpecial, since UserBase is used in another application, thus we can share credentials. That's the only reason I have two separate tables. UserBase table can't be changed in any way shape or form, because the other app would break. Question How am I suppose to load ArticleSpecial with both CreatedBy and EditedBy set, so that both are of type UserSpecial (that defines Image relation)? I've tried (unsuccessfully though) these options: 1. Using lambda expressions: context.ArticleBases .OfType<ArticleSpecial>() .Include("UserCreated.Image") .Include("UserEdited.Image"); In this case the problem is that both CreatedBy and EditedBy are related to UserBase, that doesn't define Image navigation. So I should somehow cast these two to UserSpecial type like: context.ArticleBases .OfType<ArticleSpecial>() .Include("UserCreated<UserSpecial>.Image") .Include("UserEdited<UserSpecial>.Image"); But of course using generics in Include("UserCreated<UserSpecial>.Image") don't work. 2. I have tried using LINQ query var results = from articleSpecial in ctx.ArticleBase.OfType<ArticleSpecial>() join created in ctx.UserBase.OfType<UserSpecial>().Include("Image") on articleSpecial.UserCreated.Id equals created.Id join edited in ctx.UserBase.OfType<UserSpecial>().Include("Image") on articleSpecial.UserEdited.Id equals edited.Id select articleSpecial; In this case I'm only getting ArticleSpecial object instances without related properties being set. I know I should select those somehow, but I don't know how? Select part in my LINQ could be changed to something like select new { articleSpecial, articleSpecial.UserCreated, articleSpecial.UserEdited }; but images are still not loaded into my context. My joins in this case are barely used to filter out articleSpecial results, but they don't load entities into context (I suppose). Can anybody provide any help regarding this problem? I think it's not so uncommon.

    Read the article

  • How do I corrupt a SQL CE Database?

    - by Peter Tate
    I want to be able to check for a corrupted database at startup, and then repair it programmatically. I can do that easily enough. My problem is that I want to test that things work the way I expect. Does anyone know of a way to purposefully corrupt a database so I can test my code?

    Read the article

  • Force maximum width and height for PHPThumb images

    - by Peter
    PHPThumb provides two great variables setting the output maximum width and height BUT "This is always overridden by ?w=_ GETstring parameter" $PHPTHUMB_CONFIG['output_maxwidth'] = 720; $PHPTHUMB_CONFIG['output_maxheight'] = 720; You can also set defaults, and for landscape/portrait: $PHPTHUMB_DEFAULTS['w'] = 720; $PHPTHUMB_DEFAULTS['h'] = 720; $PHPTHUMB_DEFAULTS['hp'] = 720; $PHPTHUMB_DEFAULTS['wl'] = 720; You can set the getsringoverride to enforce the default width/height but then you can't have width/height smaller than the default. $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = false; There doesn't seem to be a way to allow the get paramaters to be used but if entering a value higher than the output_maxwidth/height it outputs that size, not the maximum. How can the output be explicitly restricted to a maximum size, hence protecting the source images?

    Read the article

  • NSSet to NSData, then back out again, for GameKit?

    - by Peter Hajas
    Hi guys, I'm trying to do some image edit syncing between two of the same app running on different iPhones. I would like to send an NSSet * from one device to another (which I imagine involves encapsulating in NSData) then decrypting this back to an NSSet, then using it in a touchesMoved type of function. Is this feasible, or should I work on syncing the UIImages instead? I worry that UIImage syncing would have too much latency for realtime interaction. Thanks for your help!

    Read the article

  • What Implementation of Forth to use for Learning Forth

    - by Peter Kofler
    I want to start learning Forth (like in this related article). I see that there are many implementations. I would like to use a ANS 1994 compatible version (if reasonable, but sticking to the standard might be good) small and compact implementation, I don't want a full OS. Windows easy to use, I am new to Forth ;-) Can anybody recommend any particular implementation?

    Read the article

  • Career Day in kindergarten: how to demonstrate programming in 20 minutes?

    - by Péter Török
    I was invited to the kindergarten group of my elder daughter to talk, and aswer the kids' questions, about my profession. There are 26 kids of age 4-6 in the group (plus 3 teachers who are fairly scared of anything related to programming and IT themselves, but bold enough to learn new tricks). I would have about 20-30 minutes, without projector or anything. (They have an old computer though, which by its look may be a 486, and I am not even sure if it's functioning.) My research turned up excellent earlier threads, with lots of good tips: How would you explain your job to a 5-year old? Career Day: how do I make “computer programmer” sound cool to 8 year olds? What things can I teach a group of children about programming in one day? My situation is different from each of the above though. So any advice on how to teach the kids (and their teachers) in a fun way about programming is appreciated.

    Read the article

  • Algorithm to fill slots

    - by Peter Lang
    I am searching for an algorithm to fill several slots, which are already filled to some level. The current levels and the available quantity to fill are known Resulting levels should be as equal as possible, but existing level cannot be reduced Slots are filled from left to right, so left slots get higher level if equal level is impossible       The image above shows six examples, each column represents a slot. The grey area is already filled, the blue are is the expected position of the new elements. I could iterate through my slots and increase the quantity on the lowest slot by 1 until the available quantity is consumed, but I wonder about how to actually calculate the new filling levels. I am going to implement this with SQL/PL/SQL, other code is just as welcome though :)

    Read the article

  • How to efficiently track my geolocation during traveling using iPhone

    - by Peter Kruithof
    I'm going to travel through Thailand and I want to keep track of my location to geotag photos afterwards taken with a digital camera (iPhone's camera is not good enough). There are two things that are important here: I don't want to update manually I want the battery to last as long as possible, since the times I will be able to charge will be scarce I've thought about creating a web page that periodically sends my geolocation to a script that stores it in a database, but I don't know if GPS data is available in Mobile Safari. Second, I want the data I send to be as small as possible, and the frequency this is done s few as possible, because of the pricing of mobile data usage abroad. Any suggestions what would be a good solution here?

    Read the article

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