Search Results

Search found 1970 results on 79 pages for 'james morris'.

Page 8/79 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Error checking overkill?

    - by James
    What error checking do you do? What error checking is actually necessary? Do we really need to check if a file has saved successfully? Shouldn't it always work if it's tested and works ok from day one? I find myself error checking for every little thing, and most of the time if feels overkill. Things like checking to see if a file has been written to a file system successfully, checking to see if a database statement failed.......shouldn't these be things that either work or don't? How much error checking do you do? Are there elements of error checking that you leave out because you trust that it'll just work? I'm sure I remember reading somewhere something along the lines of "don't test for things that'll never really happen".....can't remember the source though. So should everything that could possibly fail be checked for failure? Or should we just trust those simpler operations? For example, if we can open a file, should we check to see if reading each line failed or not? Perhaps it depends on the context within the application or the application itself. It'd be interesting to hear what others do. Thanks, James.

    Read the article

  • Saving/Associating slider values with a pop-up menu

    - by James
    Hi, Following on from a question I posted yesterday about GUIs, I have another problem I've been working with. This question related to calculating the bending moment on a beam under different loading conditions. On the GUI I have developed so far, I have a number of sliders (which now work properly) and a pop-up menu which defines the load case. I would like to be able to select the load case from the pop-up menu and position the loads as appropriate, in order to define each load case in turn. The output that I need is an array defining the load case number (the rows) and a number of loading parameters (the itensity and position of the loads, which are controlled by the sliders). The problem I am having is that I can produce this array (of the size I need) and define the loading for one load case (by selecting the pop-up menu) using the sliders, but when I change the popup menu again, the array only keeps the loading for the load case selected by the pop-up menu. Can anyone suggest an approach I can take with (specifically to store the variables from each load case) or an example that illustrates a similar solution to the problem? The probem may be a bit vague, so please let me know if anything needs clearing up. Many Thanks, James

    Read the article

  • maven dependencies and jetty - avoiding deploy

    - by James Cooper
    Hi, I have a project with 3 artifacts: common - entities, business logic. no UI code webapp-a - a public web app webapp-b - an admin web app webapp-a and webapp-b depend on common. common is configured to deploy to a local maven repo. so far so good. I have IntelliJ configured so that each artifact is a separate module. Module dependencies are configured properly. I can add a new method to a class in common and immediately use that method in a class in a webapp. However, when I run mvn jetty:run it uses the currently deployed common snapshot in my repository. It does not use my local classes. If I add a method to a class in common, it compiles fine, but blows up at runtime. So is it possible to either: a) Convince jetty:run to use my local common build output or b) Deploy my common output to my local ~/.m2/repo while I'm testing locally before I want to commit/deploy or c) some other solution? thank you! -- James

    Read the article

  • Fast block placement algorithm, advice needed?

    - by James Morris
    I need to emulate the window placement strategy of the Fluxbox window manager. As a rough guide, visualize randomly sized windows filling up the screen one at a time, where the rough size of each results in an average of 80 windows on screen without any window overlapping another. It is important to note that windows will close and the space that closed windows previously occupied becomes available once more for the placement of new windows. The window placement strategy has three binary options: Windows build horizontal rows or vertical columns (potentially) Windows are placed from left to right or right to left Windows are placed from top to bottom or bottom to top Why is the algorithm a problem? It needs to operate to the deadlines of a real time thread in an audio application. At this moment I am only concerned with getting a fast algorithm, don't concern yourself over the implications of real time threads and all the hurdles in programming that that brings. So far I have two choices which I have built loose prototypes for: 1) A port of the Fluxbox placement algorithm into my code. The problem with this is, the client (my program) gets kicked out of the audio server (JACK) when I try placing the worst case scenario of 256 blocks using the algorithm. This algorithm performs over 14000 full (linear) scans of the list of blocks already placed when placing the 256th window. 2) My alternative approach. Only partially implemented, this approach uses a data structure for each area of rectangular free unused space (the list of windows can be entirely separate, and is not required for testing of this algorithm). The data structure acts as a node in a doubly linked list (with sorted insertion), as well as containing the coordinates of the top-left corner, and the width and height. Furthermore, each block data structure also contains four links which connect to each immediately adjacent (touching) block on each of the four sides. IMPORTANT RULE: Each block may only touch with one block per side. The problem with this approach is, it's very complex. I have implemented the straightforward cases where 1) space is removed from one corner of a block, 2) splitting neighbouring blocks so that the IMPORTANT RULE is adhered to. The less straightforward case, where the space to be removed can only be found within a column or row of boxes, is only partially implemented - if one of the blocks to be removed is an exact fit for width (ie column) or height (ie row) then problems occur. And don't even mention the fact this only checks columns one box wide, and rows one box tall. I've implemented this algorithm in C - the language I am using for this project (I've not used C++ for a few years and am uncomfortable using it after having focused all my attention to C development, it's a hobby). The implementation is 700+ lines of code (including plenty of blank lines, brace lines, comments etc). The implementation only works for the horizontal-rows + left-right + top-bottom placement strategy. So I've either got to add some way of making this +700 lines of code work for the other 7 placement strategy options, or I'm going to have to duplicate those +700 lines of code for the other seven options. Neither of these is attractive, the first, because the existing code is complex enough, the second, because of bloat. The algorithm is not even at a stage where I can use it in the real time worst case scenario, because of missing functionality, so I still don't know if it actually performs better or worse than the first approach. What else is there? I've skimmed over and discounted: Bin Packing algorithms: their emphasis on optimal fit does not match the requirements of this algorithm. Recursive Bisection Placement algorithms: sounds promising, but these are for circuit design. Their emphasis is optimal wire length. Both of these, especially the latter, all elements to be placed/packs are known before the algorithm begins. I need an algorithm which works accumulatively with what it is given to do when it is told to do it. What are your thoughts on this? How would you approach it? What other algorithms should I look at? Or even what concepts should I research seeing as I've not studied computer science/software engineering? Please ask questions in comments if further information is needed. [edit] If it makes any difference, the units for the coordinates will not be pixels. The units are unimportant, but the grid where windows/blocks/whatever can be placed will be 127 x 127 units.

    Read the article

  • How to stop scrolling in a virtual (LVS_OWNERDATA) listview in LVS_REPORT mode when using changing t

    - by David L Morris
    Win32 Virtual listviews (LVS_REPORT view) created with the LVS_OWNERDATA style are supposed not to scroll when LVSICF_NOSCROLL is used in the LVM_SETITEMCOUNT message or ListView_SetItemCountEx macro, according the MSDN documentation. However, this doesn't seem work, and the list-view scrolls regardless of the use of LVSICF_NOSCROLL. In these sorts of cases, 99% of the time it is something I have done incorrectly or overlooked. But, I've now run out of options. Have I missed something?

    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

  • Calling end invoke on an asynchronous call when an exception has fired in WCF.

    - by james.ingham
    Hey, I currently have an asynchronous call with a callback, which fires this method on completion: private void TestConnectionToServerCallback(IAsyncResult iar) { bool result; try { result = testConnectionDelegate.EndInvoke(iar); Console.WriteLine("Connection made!"); } catch (EndpointNotFoundException e) { Console.WriteLine("Server Timeout. Are you connected?"); result = false; } ... } With the EndpointNotFoundException firing when the server is down or no connection can be made. My question is this, if I want to recall the testConnectionDelegate with some kind of re-try button, must I first call testConnectionDelegate.EndInvoke where the exception is caught? When I do call end invoke in the catch, I get another exception on result = testConnectionDelegate.EndInvoke(iar); whenever I call this method for the second time. This is "CommunicationObjectFaultedException". I'm assuming this is because I didn't end it properly, which is what I think I have to do. Any help would be appreciated. Thanks - James

    Read the article

  • Including variables inside curly braces in a Zend config ini file on Linux

    - by Dave Morris
    I am trying to include a variable in a .ini file setting by surrounding it with curly braces, and Zend is complaining that it cannot parse it properly on Linux. It works properly on Windows, though: welcome_message = Welcome, {0}. This is the error that is being thrown on Linux: : Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /var/www/html/portal/application/configs/language/messages.ini on line 10 ' in /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php:181 Stack trace: 0 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(201): Zend_Config_Ini-&gt;_parseIniFile('/var/www/html/p...') 1 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(125): Zend_Config_Ini-&gt;_loadIniFile('/var/www/html/p...') 2 /var/www/html/portal/library/Ingrain/Language/Base.php(49): Zend_Config_Ini-&gt;__construct('/var/www/html/p...', NULL) 3 /var/www/html/portal/library/Ingrain/Language/Base.php(23): Ingrain_Language_Base-&gt;setConfig('messages.ini', NULL, NULL) 4 /var/www/html/portal/library/Ingrain/Language/Messages.php(7): Ingrain_Language_Base-&gt;__construct('messages.ini', NULL, NULL, NULL) 5 /var/www/html/portal/library/Ingrain/Helper/Language.php(38): Ingrain_Language_Messages-&gt;__construct() 6 /usr/local/zend/share/ZendFramework/library/Zend/Contr in We are able to get the error to go away on Linux if we surround the braces with quotes, but that seems like a strange solution: welcome_message = Welcome, "{"0"}". Is there a better way to solve this issue for all platforms? Thanks for your help, Dave

    Read the article

  • asyncsocket Write Issue

    - by James
    I am attempting to use asyncsocket to communicate GPS data from a server app on my iPhone to a client app on my macbook. The two devices connect without any problems, and when the first data is sent from the iPhone to the laptop in asyncsocket's didConnectToHost method, the data is sent without hiccup. When I subsequently try to write additional data to the laptop from the locationManager method, however, no data is written. Here is the code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { lat = [NSNumber numberWithFloat:newLocation.coordinate.latitude]; [lat retain]; NSLog(@"lat: %1.0f", [lat floatValue]); NSString *msg = [NSString stringWithFormat:@"%1.0f", [lat floatValue]]; NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding]; [listenSocket writeData:msgData withTimeout:-1 tag:0]; } listensocket is my instance of ASyncSocket. I know that no data is being sent because after the initial successful transfer, the didWriteDataWithTag method is not called. Can anyone explain this? Thanks! James

    Read the article

  • Does C# have an equivalent to Scala's structural typing?

    - by Tom Morris
    In Scala, I can define structural types as follows: type Pressable { def press(): Unit } This means that I can define a function or method which takes as an argument something that is Pressable, like this: def foo(i: Pressable) { // etc. The object which I pass to this function must have defined for it a method called press() that matches the type signature defined in the type - takes no arguments, returns Unit (Scala's version of void). I can even use the structural type inline: def foo(i: { def press(): Unit }) { // etc. It basically allows the programmer to have all the benefits of duck typing while still having the benefit of compile-time type checking. Does C# have something similar? I've Googled but can't find anything, but I'm not familiar with C# in any depth. If there aren't, are there any plans to add this?

    Read the article

  • Why is my multithreaded Java program not maxing out all my cores on my machine?

    - by James B
    Hi, I have a program that starts up and creates an in-memory data model and then creates a (command-line-specified) number of threads to run several string checking algorithms against an input set and that data model. The work is divided amongst the threads along the input set of strings, and then each thread iterates the same in-memory data model instance (which is never updated again, so there are no synchronization issues). I'm running this on a Windows 2003 64-bit server with 2 quadcore processors, and from looking at Windows task Manager they aren't being maxed-out, (nor are they looking like they are being particularly taxed) when I run with 10 threads. Is this normal behaviour? It appears that 7 threads all complete a similar amount of work in a similar amount of time, so would you recommend running with 7 threads instead? Should I run it with more threads?...Although I assume this could be detrimental as the JVM will do more context switching between the threads. Alternatively, should I run it with fewer threads? Alternatively, what would be the best tool I could use to measure this?...Would a profiling tool help me out here - indeed, is one of the several profilers better at detecting bottlenecks (assuming I have one here) than the rest? Note, the server is also running SQL Server 2005 (this may or may not be relevant), but nothing much is happening on that database when I am running my program. Note also, the threads are only doing string matching, they aren't doing any I/O or database work or anything else they may need to wait on. Thanks in advance, -James

    Read the article

  • PHP APC DLL Built with VC8

    - by Dave Morris
    I am looking for a copy php_apc.dll that was built with VC8. I found one built with VC9, but my PHP distro I got with the ZendServer CE says it needs to be built with VC8. Any help would be greatly appreciated. Thanks, Dave

    Read the article

  • Javascript/PHP and timezones

    - by James
    Hi, I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here: http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/ So this gives me the offset along with the DST indicator. Now, I want to use these in my PHP scripts in order to ouput the local date/time for the user....but what's best for this? I figure I have 2 options: a) Pick a random timezone which has the same offset and DST setting from the output of timezone_abbreviations_list(). Then call date_timezone_set() with this in order to apply the correct treatment to the time. b) Continue treating the date as UTC but just do some timestamp addition to add the appropriate number of hours on. My feeling is that option B is the best way. The reason for this is that with A, I could be using a timezone which although correct in terms of offset/dst, may have some obscur rules in place behind the scene that could give surprising results (I don't know of any but nonetheless I don't think I can rule it out). I'd then re-check the timezone using Javascript at the start of each session in order to capture when either the user's timezone changes (very unlikely) or they pass in to the DST period. Sorry for the brain dump - I'm really just after some sort of reassurance that the approaches above are valid. Thanks, James.

    Read the article

  • Disable chaching in JPA (eclipselink)

    - by James
    Hi, I want to use JPA (eclipselink) to get data from my database. The database is changed by a number of other sources and I therefore want to go back to the database for every find I execute. I have read a number of posts on disabling the cache but this does not seem to be working. Any ideas? I am trying to execute the following code: EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("default"); EntityManager em = entityManagerFactory.createEntityManager(); MyLocation one = em.createNamedQuery("MyLocation.findMyLoc").getResultList().get(0); MyLocation two = em.createNamedQuery("MyLocation.findMyLoc").getResultList().get(0); System.out.println(one==two); one==two is true while I want it to be false. I have tried adding each/all the following to my persistence.xml <property name="eclipselink.cache.shared.default" value="false"/> <property name="eclipselink.cache.size.default" value="0"/> <property name="eclipselink.cache.type.default" value="None"/> I have also tried adding the @Cache annotation to the Entity itself: @Cache( type=CacheType.NONE, // Cache nothing expiry=0, alwaysRefresh=true ) Am I misunderstanding something? Thank you, James

    Read the article

  • Data Mappers, Models and Images

    - by James
    Hi, I've seen and read plenty of blog posts and forum topics talking about and giving examples of Data Mapper / Model implementations in PHP, but I've not seen any that also deal with saving files/images. I'm currently working on a Zend Framework based project and I'm doing some image manipulation in the model (which is being passed a file path), and then I'm leaving it to the mapper to save that file to the appropriate location - is this common practise? But then, how do you deal with creating say 3 different size images from the one passed in? At the moment I have a "setImage($path_to_tmp_name)" which checks the image type, resizes and then saves back to the original filename. A call to "getImagePath()" then returns the current file path which the data mapper can use and then change with a call to "setImagePath($path)" once it's saved it to the appropriate location, say "/content/my_images". Does this sound practical to you? Also, how would you deal with getting the URL to that image? Do you see that as being something that the model should be providing? It seems to me like that model should worry about where the images are being stored or ultimately how they're accessed through a browser and so I'm inclined to put that in the ini file and just pass the URL prefix to the view through the controller. Does that sound reasonable? I'm using GD for image manipulation - not that that's of any relevance. UPDATE: I've been wondering if the image resizing should be done in the model at all. The model could require that it's provided a "main" image and a "thumb" image, both of certain dimensions. I've thought about creating a "getImageSpecs()" function in the model that would return something that defines the required sizes, then a separate image manipulation class could carry out the resizing and (perhaps in the controller?) and just pass the final paths in to the model using something like "setImagePaths($images)". Any thoughts much appreciated :) James.

    Read the article

  • JSON Serialization of a Django inherited model

    - by Simon Morris
    Hello, I have the following Django models class ConfigurationItem(models.Model): path = models.CharField('Path', max_length=1024) name = models.CharField('Name', max_length=1024, blank=True) description = models.CharField('Description', max_length=1024, blank=True) active = models.BooleanField('Active', default=True) is_leaf = models.BooleanField('Is a Leaf item', default=True) class Location(ConfigurationItem): address = models.CharField(max_length=1024, blank=True) phoneNumber = models.CharField(max_length=255, blank=True) url = models.URLField(blank=True) read_acl = models.ManyToManyField(Group, default=None) write_acl = models.ManyToManyField(Group, default=None) alert_group= models.EmailField(blank=True) The full model file is here if it helps. You can see that Company is a child class of ConfigurationItem. I'm trying to use JSON serialization using either the django.core.serializers.serializer or the WadofStuff serializer. Both serializers give me the same problem... >>> from cmdb.models import * >>> from django.core import serializers >>> serializers.serialize('json', [ ConfigurationItem.objects.get(id=7)]) '[{"pk": 7, "model": "cmdb.configurationitem", "fields": {"is_leaf": true, "extension_attribute_10": "", "name": "", "date_modified": "2010-05-19 14:42:53", "extension_attribute_11": false, "extension_attribute_5": "", "extension_attribute_2": "", "extension_attribute_3": "", "extension_attribute_1": "", "extension_attribute_6": "", "extension_attribute_7": "", "extension_attribute_4": "", "date_created": "2010-05-19 14:42:53", "active": true, "path": "/Locations/London", "extension_attribute_8": "", "extension_attribute_9": "", "description": ""}}]' >>> serializers.serialize('json', [ Location.objects.get(id=7)]) '[{"pk": 7, "model": "cmdb.location", "fields": {"write_acl": [], "url": "", "phoneNumber": "", "address": "", "read_acl": [], "alert_group": ""}}]' >>> The problem is that serializing the Company model only gives me the fields directly associated with that model, not the fields from it's parent object. Is there a way of altering this behaviour or should I be looking at building a dictionary of objects and using simplejson to format the output? Thanks in advance ~sm

    Read the article

  • Why does output of fltk-config truncate arguments to gcc?

    - by James Morris
    I'm trying to build an application I've downloaded which uses the SCONS "make replacement" and the Fast Light Tool Kit Gui. The SConstruct code to detect the presence of fltk is: guienv = Environment(CPPFLAGS = '') guiconf = Configure(guienv) if not guiconf.CheckLibWithHeader('lo', 'lo/lo.h','c'): print 'Did not find liblo for OSC, exiting!' Exit(1) if not guiconf.CheckLibWithHeader('fltk', 'FL/Fl.H','c++'): print 'Did not find FLTK for the gui, exiting!' Exit(1) Unfortunately, on my (Gentoo Linux) system, and many others (Linux distributions) this can be quite troublesome if the package manager allows the simultaneous install of FLTK-1 and FLTK-2. I have attempted to modify the SConstruct file to use fltk-config --cflags and fltk-config --ldflags (or fltk-config --libs might be better than ldflags) by adding them like so: guienv.Append(CPPPATH = os.popen('fltk-config --cflags').read()) guienv.Append(LIBPATH = os.popen('fltk-config --ldflags').read()) But this causes the test for liblo to fail! Looking in config.log shows how it failed: scons: Configure: Checking for C library lo... gcc -o .sconf_temp/conftest_4.o -c "-I/usr/include/fltk-1.1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT" gcc: no input files scons: Configure: no How should this really be done? And to complete my answer, how do I remove the quotes from the result of os.popen( 'command').read()? EDIT The real question here is why does appending the output of fltk-config cause gcc to not receive the filename argument it is supposed to compile?

    Read the article

  • Unpacking Argument Lists and Instantiating WTForms objects from web.py

    - by Morris Cornell-Morgan
    After a bit of searching, I've found that it's possible to instantiate a WTForms object in web.py using the following code: form = my_form(**web.input()) web.input() returns a "dictionary-like" web.storage object, but without the double asterisks WTForms will raise an exception: TypeError: formdata should be a multidict-type wrapper that supports the 'getlist' method From the Python documentation I understand that the two asterisks are used to unpack a dictionary of named arguments. That said, I'm still a bit confused about exactly what is going on. What makes the web.storage object returned by web.input() "dictionary-like" enough that it can be unpacked by ** but not "dictionary-like" enough that it can be passed as-is to the WTForms constructor? I know that this is an extremely basic question, but any advice to help a novice programmer would be greatly appreciated!

    Read the article

  • Templates, and C++ operator for logic: B contained by set A

    - by James Morris
    In C++, I'm looking to implement an operator for selecting items in a list (of type B) based upon B being contained entirely within A. In the book "the logical design of digital computers" by Montgomery Phister jr (published 1958), p54, it says: F11 = A + ~B has two interesting and useful associations, neither of them having much to do with computer design. The first is the logical notation of implication... The second is notation of inclusion... This may be expressed by a familiar looking relation, B < A; or by the statement "B is included in A"; or by the boolean equation F11= A + ~B = 1. My initial implementation was in C. Callbacks were given to the list to use for such operations. An example being a list of ints, and a struct containting two ints, min and max, for selection purposes. There, selection would be based upon B = A-min && B <= A-max. Using C++ and templates, how would you approach this after having implemented a generic list in C using void pointers and callbacks? Is using < as an over-ridden operator for such purposes... <ugh> evil? </ugh> (or by using a class B for the selection criteria, implementing the comparison by overloading ?)

    Read the article

  • php custom forum error

    - by phillip morris
    i have a form, and i want to have it be limited at 10 characters minimum. that is no problem, but what i want to do is echo the error at the top of the page, which is being included, so i cant just do: echo '<div class="error">Error</div>'; i want to have a designated div that is empty (will be on the included header page), but when there is an error it gets filled with the error text to output. anyone know how to do this not using sessions or cookies?

    Read the article

  • How to allow users to define financial formulas in a C# app

    - by Peter Morris
    I need to allow my users to be able to define formulas which will calculate values based on data. For example //Example 1 return GetMonetaryAmountFromDatabase("Amount due") * 1.2; //Example 2 return GetMonetaryAmountFromDatabase("Amount due") * GetFactorFromDatabase("Discount"); I will need to allow / * + - operations, also to assign local variables and execute IF statements, like so var amountDue = GetMonetaryAmountFromDatabase("Amount due"); if (amountDue > 100000) return amountDue * 0.75; if (amountDue > 50000) return amountDue * 0.9; return amountDue; The scenario is complicated because I have the following structure.. Customer (a few hundred) Configuration (about 10 per customer) Item (about 10,000 per customer configuration) So I will perform a 3 level loop. At each "Configuration" level I will start a DB transaction and compile the forumlas, each "Item" will use the same transaction + compiled formulas (there are about 20 formulas per configuration, each item will use all of them). This further complicates things because I can't just use the compiler services as it would result in continued memory usage growth. I can't use a new AppDomain per each "Configuration" loop level because some of the references I need to pass cannot be marshalled. Any suggestions?

    Read the article

  • GCC, functions, and pointer arguments, warning behaviour

    - by James Morris
    I've recently updated to a testing distribution, which is now using GCC 4.4.3. Now I've set everything up, I've returned to coding and have built my project and I get one of these horrible messages: *** glibc detected *** ./boxyseq: free(): invalid pointer: 0x0000000001d873e8 *** I absolutely know what is wrong here, but was rather confused as to when I saw my C code where I call a function which frees a dynamically allocated data structure - I had passed it an incompatible pointer type - a pointer to a completely different data structure. warning: passing argument 1 of 'data_A_free' from incompatible pointer type note: expected 'struct data_A *' but argument is of type 'struct data_B *' I'm confused because I'm sure this would have been an error before and compilation would never have completed. Is this not just going to make life more difficult for C programmers? Can I change it back to an error without making a whole bunch of other warnings errors too? Or am I loosing the plot and it's always been a warning?

    Read the article

  • jquery load links not clickable

    - by john morris
    ok i am loading a separate page with links in it, into a page named index.php. it loads fine, but when i click one of the links inside the loaded content, nothing happens. they dont act as links. but if i do a alert('hi'); after the load('page.html'); then it will work. any ideas on getting this to work without alerting something after it loads? oh also i cant use a callback, unless there is a way to update the get variable because the page loading, has a $_GET variable, and the links inside the loaded page are supposed to update the $_GET variable. anyways is there a way to make the links clickable after loading the page?

    Read the article

  • Stopping and Play button for Audio (Android)

    - by James Rattray
    I have this problem, I have some audio I wish to play... And I have two buttons for it, 'Play' and 'Stop'... Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code: final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth); And then the two public onclicks: (For playing...) button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click button.setText("Playing!"); try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mp.start(); // } }); And for stopping the track... final Button button2 = (Button) findViewById(R.id.cancel); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mp.stop(); mp.reset(); } }); Can anyone see the problem with this? If so could you please fix it... (For suggest) Thanks alot... James

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >