Search Results

Search found 505 results on 21 pages for 'minus'.

Page 15/21 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How to append a row to a TableViewSection in Titanium?

    - by Mike Trpcic
    I'm developing an iPhone application in Titanium, and need to append a row to a particular TableViewSection. I can't do this on page load, as it's done dynamically by the user throughout the lifecycle of the application. The documentation says that the TableViewSection has an add method which takes two arguments, but I can't make it work. Here's my existing code: for(var i = 0; i <= product_count; i++){ productsTableViewSection.add( Ti.UI.createTableViewRow({ title:'Testing...' }) ); } That is just passing one argument in, and that causes Titanium to die with an uncaught exception: 2010-04-26 16:57:18.056 MyApplication[72765:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 2. The number of rows contained in an existing section after the update (2) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted).' 2010-04-26 16:57:18.056 MyApplication[72765:207] Stack: ( The exception looks like it did add the row, but it's not allowed to for some reason. Since the documentation says that TableViewSection takes in "view" and "row", I tried the following: for(var i = 0; i <= product_count; i++){ productsTableViewSection.add( Ti.UI.createView({}), Ti.UI.createTableViewRow({ title:'Testing...' }) ); } The above code doesn't throw the exception, but it gives a [WARN]: [WARN] Invalid type passed to function. expected: TiUIViewProxy, was: TiUITableViewRowProxy in -[TiUITableViewSectionProxy add:] (TiUITableViewSectionProxy.m:62) TableViewSections don't seem to support any methods like appendRow, or insertRow, so I don't know where else to go with this. I've looked through the KitchenSink app, but there are no examples that I could find of adding a row to a TableViewSection. Any help is appreciated.

    Read the article

  • NullPointerException in NetBeans 6.5 IDE itself

    - by titaniumdecoy
    When I use NetBeans for almost any task (in particular, attempting to open a project), a red minus sign in the bottom right corner of the IDE starts blinking and I get the following NullPointerException error when I click it. Unfortunately I cannot reinstall NetBeans since I am using a shared computer lab account. java.lang.NullPointerException at org.openide.util.Exceptions.attachMessage(Unknown Source) at org.netbeans.modules.project.ant.Util$ErrHandler.annotate(Unknown Source) at org.netbeans.modules.project.ant.Util$ErrHandler.fatalError(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:925) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283) at org.openide.xml.XMLUtil.parse(Unknown Source) at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProjectXml(Unknown Source) at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProject(Unknown Source) at org.netbeans.api.project.ProjectManager.createProject(Unknown Source) at org.netbeans.api.project.ProjectManager.access$300(Unknown Source) at org.netbeans.api.project.ProjectManager$2.run(Unknown Source) at org.netbeans.api.project.ProjectManager$2.run(Unknown Source) at org.openide.util.Mutex.readAccess(Unknown Source) at org.netbeans.api.project.ProjectManager.findProject(Unknown Source) at org.netbeans.modules.project.ui.OpenProjectList.fileToProject(Unknown Source) at org.netbeans.modules.project.ui.ProjectChooserAccessory$ProjectFileView.run(Unknown Source) at org.openide.util.RequestProcessor$Task.run(Unknown Source) [catch] at org.openide.util.RequestProcessor$Processor.run(Unknown Source) I have recently had problems with going over my disk space quota on this computer lab account. I cleaned up my files and I now have about 10MB free. I'm not sure whether or not this is related to the problem with NetBeans.

    Read the article

  • parse content away from structure in a binary file

    - by Jeff Godfrey
    Using C#, I need to read a packed binary file created using FORTRAN. The file is stored in an "Unformatted Sequential" format as described here (about half-way down the page in the "Unformatted Sequential Files" section): http://www.tacc.utexas.edu/services/userguides/intel8/fc/f_ug1/pggfmsp.htm As you can see from the URL, the file is organized into "chunks" of 130 bytes or less and includes 2 length bytes (inserted by the FORTRAN compiler) surrounding each chunk. So, I need to find an efficient way to parse the actual file payload away from the compiler-inserted formatting. Once I've extracted the actual payload from the file, I'll then need to parse it up into its varying data types. That'll be the next exercise. My first thoughts are to slurp up the entire file into a byte array using File.ReadAllBytes. Then, just iterate through the bytes, skipping the formatting and transferring the actual data to a second byte array. In the end, that second byte array should contain the actual file contents minus all the formatting, which I'd then need to go back through to get what I need. As I'm fairly new to C#, I thought there might be a better, more accepted way of tackling this. Also, in case it's helpful, these files could be fairly large (say 30MB), though most will be much smaller...

    Read the article

  • Fetching Core Data for Tableview on iPhone - Tutorial leaves me with crashes when adding items to a

    - by Gordon Fontenot
    Been following the Core Data tutorial on Apple's developer site, and all is good until I have to add something to the fetched store. I am getting this error after a successful build and load when I try to add a new item to the list: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted). Due to the fact that the fetch goes through fine, and that if I replace the fetching with eventList = [[NSMutableArray alloc] init] it works as expected (without persistance, of course), I am led to believe that the problem comes from not creating the Mutable Array correctly. Here's the problematic part of the code: NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:managedObjectContext]; [request setEntity:entity]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"creationDate" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [request setSortDescriptors:sortDescriptors]; [sortDescriptors release]; [sortDescriptor release]; NSError *error; NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; if (mutableFetchResults = nil) { //Handle the error } [self setEventList:mutableFetchResults]; [mutableFetchResults release]; [request release]; I have tried switching the NSArrays in the second chunk out with NSMutableArrays, but I still get the same error. For reference, the section of code that is throwing the error when I try adding an entry is here: [eventList insertObject:event atIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES]; it errors out at the insertRowsAtIndexPaths call. Thanks in advance for any help

    Read the article

  • Microsoft Training in .NET

    - by JD
    Hey guys, A quick question about training. My company are offering to put me through a 5 day course in .NET programming with C#, on the proviso that I work for them for a minimum 12 month period immediately after the training has been completed. IF I don't work for them for 12months I will be expected to pay them back teh cost of the training, minus the amount of months which I have stayed at the company (e.g. stay 6 months and only pay back half). The course will be $3,300 AUD - and will have no qualifications. I have been programming in C# for about 6 months, and in PHP for about 10 years - so I am getting the hang of .NET slowly but surely. Is it worth doing this? Or would I be best advised to learn from reading the MS books from Amazon for $40 and then sitting the 2 exams to get MS certified off my own back? The company are not willing to pay for my certification as well as 'they are not training me to get certified' and hence more employable... Thoughts? How do other companies deal with training? And stop people from taking off after becoming certified?

    Read the article

  • Calculate differences between rows while grouping with SQL

    - by Guido
    I have a postgresql table containing movements of different items (models) between warehouses. For example, the following record means that 5 units of model 1 have been sent form warehouse 1 to 2: source target model units ------ ------ ----- ----- 1 2 1 5 I am trying to build a SQL query to obtain the difference between units sent and received, grouped by models. Again with an example: source target model units ------ ------ ----- ----- 1 2 1 5 -- 5 sent from 1 to 2 1 2 2 1 2 1 1 2 -- 2 sent from 2 to 1 2 1 1 1 -- 1 more sent from 2 to 1 The result should be: source target model diff ------ ------ ----- ---- 1 2 1 2 -- 5 sent minus 3 received 1 2 2 1 I wonder if this is possible with a single SQL query. Here is the table creation script and some data, just in case anyone wants to try it: CREATE TEMP TABLE movements ( source INTEGER, target INTEGER, model INTEGER, units INTEGER ); insert into movements values (1,2,1,5); insert into movements values (1,2,2,1); insert into movements values (2,1,1,2); insert into movements values (2,1,1,1);

    Read the article

  • An Ideal Keyboard Layout for Programming

    - by Jon Purdy
    I often hear complaints that programming languages that make heavy use of symbols for brevity, most notably C and C++ (I'm not going to touch APL), are difficult to type because they require frequent use of the shift key. A year or two ago, I got tired of it myself, downloaded Microsoft's Keyboard Layout Creator, made a few changes to my layout, and have not once looked back. The speed difference is astounding; with these few simple changes I am able to type C++ code around 30% faster, depending of course on how hairy it is; best of all, my typing speed in ordinary running text is not compromised. My questions are these: what alternate keyboard layouts have existed for programming, which have gained popularity, are any of them still in modern use, do you personally use any altered layout, and how can my layout be further optimised? I made the following changes to a standard QWERTY layout. (I don't use Dvorak, but there is a programmer Dvorak layout worth mentioning.) Swap numbers with symbols in the top row, because long or repeated literal numbers are typically replaced with named constants; Swap backquote with tilde, because backquotes are rare in many languages but destructors are common in C++; Swap minus with underscore, because underscores are common in identifiers; Swap curly braces with square brackets, because blocks are more common than subscripts; and Swap double quote with single quote, because strings are more common than character literals. I suspect this last is probably going to be the most controversial, as it interferes the most with running text by requiring use of shift to type common contractions. This layout has significantly increased my typing speed in C++, C, Java, and Perl, and somewhat increased it in LISP and Python.

    Read the article

  • How to know why an animation stutters?

    - by Patrick Klug
    I have a few fairly simple animations (moving text around, moving ellipses etc.) and running in full screen (1920x1080 minus the task bar) the WPF Performance Suite reports a good framerate around 50 FPS throughout the animation. Dirty Rect Addition is somewhere around 300 rect/s, the SW frames are between 0 and 4 and the HW frames are between 3 and 5. Video memory usage is around 80 MB. Problem is that the animations stutters every other half second. My machine is a new Dell laptop XPS 15 with the GeForce GT 435 with 2GB memory. - The drivers are up to date. (The same behavior occurs on my netbook (in full screen) as well so I don't think it is hardware related.) If I make the window smaller the stutter goes away. The stutter occurs with the simplest of animations - even with just a couple of elements but adding more elements certainly makes it more noticeable. How can I find out what causes this stutter? When I think of it, I have not actually seen any WPF animations which run smoothly in full screen. Is this even possible?

    Read the article

  • Facebook: Social Widgets versus Share

    - by just_wes
    Hello all, I am interested in people's thoughts on Facebook's new social widgets thing. Most notably the new "Like" button. The concept I am struggling with is the difference between "Like" and "Share". I have an existing Connect application. This application has its own fan page on Facebook. People can become "Fans" of the page and register to receive email updates and the like. The application is currently programmed to update its own fan page any time content is added to the site. Enter Social Widgets and "Like". People who visit our site can currently "share" our content on Facebook. With "Share" they can post a full item to their wall with a comment or send the content item as a message to another Facebook user. "Like" seems to do the same thing minus the message part. However "Like" automatically subscribes people to the fan page. My question is simply, should I add "Like" to my existing Connect site? Is "Like" different than what I already have? Are Social Widgets the future of Connect? Thanks!

    Read the article

  • Django: Applying Calculations To A Query Set

    - by TheLizardKing
    I have a QuerySet that I wish to pass to a generic view for pagination: links = Link.objects.annotate(votes=Count('vote')).order_by('-created')[:300] This is my "hot" page which lists my 300 latest submissions (10 pages of 30 links each). I want to now sort this QuerySet by an algorithm that HackerNews uses: (p - 1) / (t + 2)^1.5 p = votes minus submitter's initial vote t = age of submission in hours Now because applying this algorithm over the entire database would be pretty costly I am content with just the last 300 submissions. My site is unlikely to be the next digg/reddit so while scalability is a plus it is required. My question is now how do I iterate over my QuerySet and sort it by the above algorithm? For more information, here are my applicable models: class Link(models.Model): category = models.ForeignKey(Category, blank=False, default=1) user = models.ForeignKey(User) created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) url = models.URLField(max_length=1024, unique=True, verify_exists=True) name = models.CharField(max_length=512) def __unicode__(self): return u'%s (%s)' % (self.name, self.url) class Vote(models.Model): link = models.ForeignKey(Link) user = models.ForeignKey(User) created = models.DateTimeField(auto_now_add=True) def __unicode__(self): return u'%s vote for %s' % (self.user, self.link) Notes: I don't have "downvotes" so just the presence of a Vote row is an indicator of a vote or a particular link by a particular user.

    Read the article

  • Macro and array crossing

    - by Thomas
    I am having a problem with a lisp macro. I would like to create a macro which generate a switch case according to an array. Here is the code to generate the switch-case: (defun split-elem(val) `(,(car val) ',(cdr val))) (defmacro generate-switch-case (var opts) `(case ,var ,(mapcar #'split-elem opts))) I can use it with a code like this: (generate-switch-case onevar ((a . A) (b . B))) But when I try to do something like this: (defparameter *operators* '((+ . OPERATOR-PLUS) (- . OPERATOR-MINUS) (/ . OPERATOR-DIVIDE) (= . OPERATOR-EQUAL) (* . OPERATOR-MULT))) (defmacro tokenize (data ops) (let ((sym (string->list data))) (mapcan (lambda (x) (generate-switch-case x ops)) sym))) (tokenize data *operators*) I got this error: *** - MAPCAR: A proper list must not end with OPS. But I don't understand why. When I print the type of ops I get SYMBOL I was expecting CONS, is it related? Also, for my function tokenize how many times the lambda is evaluated (or the macro expanded)?

    Read the article

  • Would making plain int 64-bit break a lot of reasonable code?

    - by R..
    Until recently, I'd considered the decision by most systems implementors/vendors to keep plain int 32-bit even on 64-bit machines a sort of expedient wart. With modern C99 fixed-size types (int32_t and uint32_t, etc.) the need for there to be a standard integer type of each size 8, 16, 32, and 64 mostly disappears, and it seems like int could just as well be made 64-bit. However, the biggest real consequence of the size of plain int in C comes from the fact that C essentially does not have arithmetic on smaller-than-int types. In particular, if int is larger than 32-bit, the result of any arithmetic on uint32_t values has type signed int, which is rather unsettling. Is this a good reason to keep int permanently fixed at 32-bit on real-world implementations? I'm leaning towards saying yes. It seems to me like there could be a huge class of uses of uint32_t which break when int is larger than 32 bits. Even applying the unary minus or bitwise complement operator becomes dangerous unless you cast back to uint32_t. Of course the same issues apply to uint16_t and uint8_t on current implementations, but everyone seems to be aware of and used to treating them as "smaller-than-int" types.

    Read the article

  • Five unique, random numbers from a subset

    - by tau
    I know similar questions come up a lot and there's probably no definitive answer, but I want to generate five unique random numbers from a subset of numbers that is potentially infinite (maybe 0-20, or 0-1,000,000). The only catch is that I don't want to have to run while loops or fill an array. My current method is to simply generate five random numbers from a subset minus the last five numbers. If any of the numbers match each other, then they go to their respective place at the end of the subset. So if the fourth number matches any other number, it will bet set to the 4th from the last number. Does anyone have a method that is "random enough" and doesn't involve costly loops or arrays? Please keep in mind this a curiosity, not some mission-critical problem. I would appreciate it if everyone didn't post "why are you having this problem?" answers. I am just looking for ideas. Thanks a lot!

    Read the article

  • HTML, CSS: overbar matching square root symbol

    - by Pindatjuh
    Is there a way in HTML and/or CSS to do the following, but then correctly: √¯¯¯¯¯¯φ·(2π−γ) Such that there is an overbar above the expression, which neatly aligns with the &radic;? I know there is the Unicode &macr;, that looks like the overbar I need (as used in the above example, though as you can see – it doesn't align well with the root symbol). The solution I'm looking for works at least for one standard font, on most sizes, and all modern browsers. I can't use images; I'd like to have a pure HTML4/CSS way, without client scripting. Here is my current code, thank you Matthew Jones (+1) for the text-decoration: overline! Still some problems <div style="font-family: Georgia; font-size: 200%"> <span style="vertical-align: -15%;">&radic;</span><span style="text-decoration: overline;">&nbsp;x&nbsp;+&nbsp;1&nbsp;</span> </div> The line doesn't match the &radic; because I lowered it with 15% baseline height. (Because the default placement is not nice) The line thickness doesn't match the thickness of the &radic;. Thanks!

    Read the article

  • jQuery Ajax call for buttons on a list

    - by lloydphillips
    I have a list of data that i have in a view from an asp.net mvc application. It's a list of stock and I have two images (a plus and a minus) on the end of each row which will allow me to increase or decrease stock quantity. It works fine at present with a call to the mvc action but since the list is long I want to use jQuery and AJAX to have the call go without a refresh. I want to do this with unobtrusive javascript so don't want onclick handlers on my images. Since I'm just starting out with jQuery I have no idea how I can iterate all the images and add the function. Here are the images with the form tags as they stand: <td> <% using (Html.BeginForm("Increase", "Stock", new { Id = item.StockId })) {%> <input type="image" src="/Content/Images/bullet_add.png" style="margin-left:20px;" /> <% } %> </td> <td><% using (Html.BeginForm("Decrease", "Stock", new { Id = item.StockId })) {%> <input type="image" src="/Content/Images/bullet_delete.png" style="margin-left:10px;" /><% } %> </td> Can anyone help me out a little? Many thanks. Lloyd

    Read the article

  • Practical non-image based CAPTCHA approaches?

    - by Jeff Atwood
    It looks like we'll be adding CAPTCHA support to Stack Overflow. This is necessary to prevent bots, spammers, and other malicious scripted activity. We only want human beings to post or edit things here! We'll be using a JavaScript (jQuery) CAPTCHA as a first line of defense: http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs The advantage of this approach is that, for most people, the CAPTCHA won't ever be visible! However, for people with JavaScript disabled, we still need a fallback and this is where it gets tricky. I have written a traditional CAPTCHA control for ASP.NET which we can re-use. However, I'd prefer to go with something textual to avoid the overhead of creating all these images on the server with each request. I've seen things like.. ASCII text captcha: \/\/(_)\/\/ math puzzles: what is 7 minus 3 times 2? trivia questions: what tastes better, a toad or a popsicle? Maybe I'm just tilting at windmills here, but I'd like to have a less resource intensive, non-image based <noscript> compatible CAPTCHA if possible. Ideas?

    Read the article

  • System Error when running PyQt4's loadUi()

    - by user633804
    Hello, I'm pretty new to Qt, Python and their combinations. I'm currently writing a QGIS plugin in python (I used QtCreator 2.1 (Qt Designer 4.7) to generate a .ui-file and am now trying to use it for a Quantum GIS plugin that's written in Python 2.5 (and running in the Quantum GIS Python 2.5 console)). I am running into trouble when loading the ui-file dynamically when the program runs the loadUi() function. What throws me off is that the error occurs outside my script. Does that mean, I'm passing something wrong into it? Where does the error come in? Any hints on what could be wrong? code_dir = os.path.dirname(os.path.abspath(__file__)) self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self) This is the Error Code I am getting (minus the first paragraph): File "C:/Dokumente und Einstellungen/name.name/.qgis/python/plugins\myfile\myfile_gui.py", line 42, in __ init __ self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic__init__.py", line 112, in loadUi return DynamicUILoader().loadUi(uifile, baseinstance) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\Loader\loader.py", line 21, in loadUi return self.parse(filename) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in parse actor(elem) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 616, in createUserInterface self.traverseWidgetTree(elem) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 594, in traverseWidgetTree handler(self, child) File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 233, in createWidget topwidget.setCentralWidget(widget) SystemError: error return without exception set

    Read the article

  • Serving static media in django application

    - by Ed
    I notice that when I reference my java scripts and static image files from my templates, they show up in development, but not from the production server. From development, I access them as such: <img src="/my_proj/media/css/images/collapsed.png" /> but from production, I have to remove the project directory: <img src="/media/css/images/collapsed.png" /> I'm assuming I'm doing something wrong with regard to serving static media. I'm caught between a number of seemingly different options for serving static media in Django. On one hand, it's been recommended that I use django-staticfiles to serve media. On the other I see reference to STATIC_ROOT and STATIC_URL in the documentation (with caveats about use in production). I have small .png files of "plus" and "minus" symbols for use in some of my jQuery scripts. In addition, the scripts themselves need to be referenced. 1) Am I correctly categorizing scripts and site images as static media? 2) What is the best method to access this media (from production)?

    Read the article

  • PHP, MySQL: Security concern; Page loads in a weird way

    - by Devner
    Hi all, I am testing the security of my website. I am using the following URL to load a PHP page in my website, on localhost: http://localhost/domain/user/index.php/apple.php When I do this, the page is not loading normally; Instead the images, icons used in the page simply vanish/disappear from the page. Only text appears. And also on any link I click on this page, it brings me to this same page again without navigating to the required page. So if I have hyperlinks to other pages, such as "SEARCH", which points to search.php, instead of navigating to the search.php page, it refreshes the index.php page and just appends the page name of the destination page to the end of the URL. For example, say I used the link above. It then loads the index.php page minus the images at it's will. When I click on the "Search" link to navigate to the search page, I see the following in the URL: http://localhost/domain/user/index.php/search.php I have a redirection configured to a 404 error page in my .htaccess file, but the page does not redirect to the 404 error page. Notice the search.php towards the end of the URL above. Any other link that I click, reloads the index.php page and just appends the destination page name to the end of the URL like I have shown above. I was expecting to see a 404 Error but that does not happen. The URL should not even be able to load the page because I do NOT have a "index.php" folder in my website. What can I do to solve this? All help is appreciated. Thank you.

    Read the article

  • How do I do a count on that meet a specific condition, dependent on several has_many relationships i

    - by Angela
    I have a Model Campaign. A Campaign has many Events. Each Event has an attribute :days. A Campaign also has_many Contacts. Each Contact as a :date_entered attribute. The from_today(contact,event) method returns a number, which is the number of days from the contact's :date_entered till today minus the event's :days. In other words, a positive number shows the number of days from today till the :days of the event is elapsed. If it is negative, if means that the number of days that has elapsed since the :date_entered is greater than the :days attribute of an event. In other words, the event is overdue. What I would like to be able to do is do campaign.overdue and this would result in a total number of contacts that have an overdue event. It shouldn't count multiple events for a single contact, just one contact. How do I do that? It seems like I would need to cycle through all the events for every contact and keep a counter but I'm assuming that there is a better way.

    Read the article

  • Error : Number of Rows In Section in UITableView in iPhone SDK

    - by Meghan
    I am getting this error while I am trying to load the data into my table view. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (73) must be equal to the number of rows contained in that section before the update (71), plus or minus the number of rows inserted or deleted from that section (3 inserted, 0 deleted). What could be wrong? Thanks EDIT : I am initializing the array on ViewWillAppear and adding new objects to the same array on Tableview's didSelectRowAtIndexPath method Here is the code On viewWillAppear : cellTextArray = [[NSMutableArray alloc] init]; [cellTextArray addObjectsFromArray:newPosts]; Here is the code which modifies the array on didSelectRowAtIndexPath : [cellTextArray addObjectsFromArray:newPosts]; NSMutableArray *insertIndexPaths = [NSMutableArray array]; for (NSUInteger item = count; item < count + newCount; item++) { [insertIndexPaths addObject:[NSIndexPath indexPathForRow:item inSection:0]]; } [self.table beginUpdates]; [self.table insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade]; [self.table endUpdates]; [self.table scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:YES]; NSIndexPath *selected = [self.table indexPathForSelectedRow]; if (selected) { [self.table deselectRowAtIndexPath:selected animated:YES]; } Here newPosts is an array which has the values that are added to cellTextArray on didSelectRowAtIndexPath method and viewWillAppear method.

    Read the article

  • Update on: How to model random non-overlapping spheres of non-uniform size in a cube using Matlab?

    - by user3838079
    I am trying to use MATLAB for generating random locations for non-uniform size spheres (non-overlapping) in a cube. The for loop in the code below never seems to end. I don't know what am missing in the code. I have ran the code for no. of spheres (n) = 10; dims = [ 10 10 10 ] function [ c r ] = randomSphere( dims ) % creating one sphere at random inside [0..dims(1)]x[0..dims(2)]x... % radius and center coordinates are sampled from a uniform distribution % over the relevant domain. % output: c - center of sphere (vector cx, cy,... ) % r - radius of sphere (scalar) r = rand(1); % you might want to scale this w.r.t dims or other consideration c = r + rand( size(dims) )./( dims - 2*r ); % make sure sphere does not exceed boundaries function ovlp = nonOverlapping( centers, rads ) % check if several spheres with centers and rads overlap or not ovlp = false; if numel( rads ) == 1 return; % nothing to check for a single sphere end dst = sqrt( sum( bsxfun( @minus, permute( centers, [1 3 2] ),... permute( centers, [3 1 2] ) ).^2, 3) ); ovlp = dst >= bsxfun( @plus, rads, rads.' ); %' all distances must be smaller than r1+r2 ovlp = any( ovlp(:) ); % all must not overlap function [centers rads] = sampleSpheres( dims, n ) % dims is assumed to be a row vector of size 1-by-ndim % preallocate ndim = numel(dims); centers = zeros( n, ndim ); rads = zeros( n, 1 ); ii = 1; while ii <= n [centers(ii,:), rads(ii) ] = randomSphere( dims ); if nonOverlapping( centers(1:ii,:), rads(1:ii) ) ii = ii + 1; % accept and move on end end

    Read the article

  • Entity Framework Decorator Pattern

    - by Anthony Compton
    In my line of business we have Products. These products can be modified by a user by adding Modifications to them. Modifications can do things such as alter the price and alter properties of the Product. This, to me, seems to fit the Decorator pattern perfectly. Now, envision a database in which Products exist in one table and Modifications exist in another table and the database is hooked up to my app through the Entity Framework. How would I go about getting the Product objects and the Modification objects to implement the same interface so that I could use them interchangeably? For instance, the kind of things I would like to be able to do: Given a Modification object, call .GetNumThings(), which would then return the number of things in the original object, plus or minus the number of things added by the modification. This question may be stemming from a pretty serious lack of exposure to the nitty-gritty of EF (all of my experience so far has been pretty straight-forward LOB Silverlight apps), and if that's the case, please feel free to tell me to RTFM. Thanks in advance!

    Read the article

  • Best way to update/insert into a table based on a remote table.

    - by martilyo
    I have two very large enterprise tables in an Oracle 10g database. One table keeps the historical information of the other table. The problem is, I'm getting to the point where the records are just too many that my insert update is taking too long and my session is getting killed by the governor. Here's a pseudocode of my update process: sqlsel := 'SELECT col1, col2, col3, sysdate FROM table2@remote_location dpi WHERE (col1, col2, col3) IN ( SELECT col1, col2, col3 FROM table2@remote_location MINUS SELECT DISTINCT col1, col2, col3 FROM table1 mpc WHERE facility = '''||load_facility||''' )'; EXECUTE IMMEDIATE sqlsel BULK COLLECT INTO table1; I've tried the MERGE statement: MERGE INTO table1 t1 USING ( SELECT col1, col2, col3 FROM table2@remote_location ) t2 ON ( t1.col1 = t2.col1 AND t1.col2 = t2.col2 AND t1.col3 = t2.col3 ) WHEN NOT MATCHED THEN INSERT (t1.col1, t1.col2, t1.col3, t1.update_dttm ) VALUES (t2.col1, t2.col2, t2.col3, sysdate ) But there seems to be a confirmed bug on versions prior to Oracle 10.2.0.4 on the merge statement when doing a merge using a remote database. The chance of getting an enterprise upgrade is slim so is there a way to further optimize my first query or write it in another way to have it run best performance wise? Thanks.

    Read the article

  • Is there a set based solution for this problem?

    - by NYSystemsAnalyst
    We have a table set up as follows: |ID|EmployeeID|Date |Category |Hours| |1 |1 |1/1/2010 |Vacation Earned|2.0 | |2 |2 |2/12/2010|Vacation Earned|3.0 | |3 |1 |2/4/2010 |Vacation Used |1.0 | |4 |2 |5/18/2010|Vacation Earned|2.0 | |5 |2 |7/23/2010|Vacation Used |4.0 | The business rules are: Vacation balance is calculated by vacation earned minus vacation used. Vacation used is always applied against the oldest vacation earned amount first. We need to return the rows for Vacation Earned that have not been offset by vacation used. If vacation used has only offset part of a vacation earned record, we need to return that record showing the difference. For example, using the above table, the result set would look like: |ID|EmployeeID|Date |Category |Hours| |1 |1 |1/1/2010 |Vacation Earned|1.0 | |4 |2 |5/18/2010|Vacation Earned|1.0 | Note that record 2 was eliminated because it was completely offset by used time, but records 1 and 4 were only partially used, so they were calculated and returned as such. The only way we have thought of to do this is to get all of the vacation earned records in a temporary table. Then, get the total vacation used and loop through the temporary table, deleting the oldest record and subtracting that value from the total vacation used until the total vacation used is zero. We could clean it up for when the remaining vacation used is only part of the oldest vacation earned record. This would leave us with just the outstanding vacation earned records. This works, but it is very inefficient and performs poorly. Also, the performance will just degrade over time as more and more records are added. Are there any suggestions for a better solution, preferable set based? If not, we'll just have to go with this.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21  | Next Page >