Daily Archives

Articles indexed Monday March 14 2011

Page 3/12 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Ubuntu Froze Keyboard and mouse (laptop)

    - by fernando
    something similar to what happened to me was this post Updates kill Keyboard and mouse. unfortunately I'm stuck there. I also read on a couple other threads that I should go and use recovery mode, but when i select the option from GRUB it stops at a certain point, the screen that will allow me to fix packages won't appear. i decided to diagnose the computer, and test the RAM; so far everything seems to be going well. but this whole thing happened when I was doing an update around 230mb's... i still havent found a solution to the frozen Keyboard and mouse (trackpad). but if all else fails can i just reinstall Ubuntu? would that fix the issue? what else can I try? btw, I'm not not great with coding, so if there is anything that I need to type and put correct syntax or anything please guide me through it. I've had Ubuntu literally for 1 day, and this happens. any suggestions would be appreciated.

    Read the article

  • How to install an application manually into Natty's Application list

    - by Valorin
    I am trying to install ZendStudio 8 (Eclipse based) on 11.04 and am kinda stuck at the part were I can get it into the Applications list. ZendStudio prior to version 8 came with a magic .bin which installed it all no problems, but now it simply comes as a folder all set up to be run as-is. I have copied this folder to /opt/ZendStudio, and I can launch the program using /opt/ZendStudio/ZendStudio but in the Unity Launcher it shows up with a grey box and a big Question Mark as it's icon. However, I'd like it to be show up in the Applications list so I can search for it and load it like a normal application. I also want to Pin it to the launcher so it stays there the whole time, and I tried this with running it directly but it didn't work and it didn't load up the application icon. Any ideas how I can finish the install so it is in my menus etc?

    Read the article

  • Installed Ruby 1.9.2 but new gems won't create scripts into /usr/bin

    - by karatedog
    I had previously ruby 1.8 on my Ubuntu 10.10, which I removed through Synaptics. Then I have installed ruby 1.9.1 also via Synaptics (which is then saying that itself is version 1.9.2). Then I installed ruby-debug19 and rspec gems with sudo gem install ruby-debug19 rspec However I can't start rdebug or rspec, but I can invoke the debugger from inside my ruby script, so the debugger is working. I inspected the starting scipts rdebug and rspec and then I realized that they are still old scripts back from ruby1.8 time. In other worlds, the current 1.9 install of these gems haven't created the starting scripts anywhere. What is the easiest solution for a lazy soul like me? It looks like removing-reinstalling ruby 1.9.2 won't help, and installing these gems over and over againg won't create the starting scripts.

    Read the article

  • How can I prevent [flush-8:16] and [jbd2/sdb2-8] from causing GUI unresponsiveness?

    - by ændrük
    Approximately twice a week, the entire graphical interface will lock up for about 10-20 seconds without warning while I am doing simple tasks such as browsing the web or writing a paper. When this happens, GUI elements do not respond to mouse or keyboard input, and the System Monitor applet displays 100% IOWait processor usage. Today, I finally happened to have GNOME Terminal already open when the problem started. Despite other applications such as Google Chrome, Firefox, GNOME Do, and GNOME Panel being unresponsive, the terminal was usable. I ran iotop and observed that commands named [flush-8:16] and [jbd2/sdb2-8] were alternately using 99.99% IO. What are these, and how can I prevent them from causing GUI unresponsiveness? Details $ mount | grep ^/dev /dev/sda1 on / type ext4 (rw,noatime,discard,errors=remount-ro,commit=0) /dev/sdb2 on /home type ext4 (rw,commit=0) /dev/sda is an OCZ-VERTEX2 and /dev/sdb is a WD10EARS. Here is dumpe2fs /dev/sdb2, if it's relevant.

    Read the article

  • How to disable the alt-hotkey behavior on gnome terminal?

    - by farleyknight
    This is not just gnome terminal, but pretty much all gnome windows: When you hold the "alt" key, you can press the first letter of one of the menu items. This will let you scroll that menu without clicking on it directly. This is okay on any other window, like say Firefox, but on gnome terminal, it steals the keys I use for emacs!! There is very little chance of me learning a new set key combinations if I can avoid. If I can't isolate this just to gnome terminal, I'm fine with that.

    Read the article

  • GPU On-the-fly encoding of video through Logitech HD Webcam C510

    - by Ashfame
    Originally asked here but I edited that to move this question as a different one on suggestion by a fellow member. I read that I should have a Core2Duo 2.2Ghz for 720p but I have a 2.0Ghz one, would it be possible for me to first record it and then encode it after recording if my processor really start giving issue when doing on-the-fly encoding? I also have a ATI HD 4850 512MB card, if it can help in encoding on-the-fly or is there a chance that my graphics card alone can handle it and those specs were just for a system without a graphics card? I believe so. Also, I got no worries in dealing with console, if I have to do some of the things above in terminal. Other possible significant details: I have a dual screen setup 29" (1360X768) & 22" (1680X1050) which might be using some good power from GPU and I have 2GB DDR2 800Mhz RAM.

    Read the article

  • How is Logitech C510 HD Webcam

    - by Ashfame
    I am going to buy Logitech C510 HD webcam and I just checked on other questions here on AskUbuntu that it works out of the box with cheese. Jorge's response also confirm this and I feel confident buying it now. My question is can it be limited in any functionality that I would like to do with it? I would like it to be used with everything - Skype, Gtalk video chat, Facebook, Youtube etc. Also this may sound lame but I need to know whether I could record or do a video call in lesser resolution video (its a 720p one)? Edit: Ported part of this question to another question to make it more specific.

    Read the article

  • Google doesn't index a subdomain. What can be the problem and what can be done?

    - by fudge
    Hi! I have a domain, let's call it example.com, which has a subdomain, games.example.com. I maintain a games forum using phpbbseo which is located at games.example.com/forum. The problem is that the forum is not being crawled. I used Google's webmaster tools and tested that the page is seen by google. P.S. There is a link from games.example.com to games.example.com/forum. What can I do? How can I make google crawl my forum?

    Read the article

  • Compared to Firefox 4 and Google Chrome 10, what can't IE9 do?

    - by ClosureCowboy
    If a website works in Firefox 4 and in Google Chrome 10, what could potentially cause that website not to work (broken layout or broken JavaScript) in IE9? What limitations and differences does IE9 have, aside from vendor-specific stylesheet rules? Yes, that is a painfully vague question — that's because I am not asking this question from the perspective of someone with a specific problem! I'm asking this question from the perspective of someone with a working website who does not have access to IE9.

    Read the article

  • Points on lines where the two lines are the closest together

    - by James Bedford
    Hey guys, I'm trying to find the points on two lines where the two lines are the closest. I've implemented the following method (Points and Vectors are as you'd expect, and a Line consists of a Point on the line and a non-normalized direction Vector from that point): void CDClosestPointsOnTwoLines(Line line1, Line line2, Point* closestPoints) { closestPoints[0] = line1.pointOnLine; closestPoints[1] = line2.pointOnLine; Vector d1 = line1.direction; Vector d2 = line2.direction; float a = d1.dot(d1); float b = d1.dot(d2); float e = d2.dot(d2); float d = a*e - b*b; if (d != 0) // If the two lines are not parallel. { Vector r = Vector(line1.pointOnLine) - Vector(line2.pointOnLine); float c = d1.dot(r); float f = d2.dot(r); float s = (b*f - c*e) / d; float t = (a*f - b*c) / d; closestPoints[0] = line1.positionOnLine(s); closestPoints[1] = line2.positionOnLine(t); } else { printf("Lines were parallel.\n"); } } I'm using OpenGL to draw three lines that move around the world, the third of which should be the line that most closely connects the other two lines, the two end points of which are calculated using this function. The problem is that the first point of closestPoints after this function is called will lie on line1, but the second point won't lie on line2, let alone at the closest point on line2! I've checked over the function many times but I can't see where the mistake in my implementation is. I've checked my dot product function, scalar multiplication, subtraction, positionOnLine() etc. etc. So my assumption is that the problem is within this method implementation. If it helps to find the answer, this is function supposed to be an implementation of section 5.1.8 from 'Real-Time Collision Detection' by Christer Ericson. Many thanks for any help!

    Read the article

  • Level editor event system, how to translate event to game action

    - by Martino Wullems
    Hello, I've been busy trying to create a level editor for a tile based game i'm working on. It's all going pretty fine, the only thing i'm having trouble with is creating a simple event system. Let's say the player steps on a particulair tile that had the action "teleport" assigned to it in the editor. The teleport string is saved in the tile object as a variable. When creating the tilegrid an actionmanager class scans the action variable and assigns actions to the variable. public static class ActionManager { public static function ParseTileAction(tile:Tile) { switch(tile.action) { case "TELEPORT": //assign action here break; } } } Now this is an collision event, so I guess I should also provide an object to colide with the tile. But what if it would have to count for collision with all objects in the world? Also, checking for collisions in the actionmanager class doesn't seem very efficient. Am I even on the right track here? I'm new to game design so I could be completly off track. Any tips on how handeling and creating events using an editor is usually done would be great. The main problem i'm having is the Thanks in advance.

    Read the article

  • PHP, how can I produce a string, a unique list of values up to three items, for use after IN in a query?

    - by Jules
    I need to produce a string for use in an query e.g. SELECT whatever from Keywords.word IN (here); At the moment I have string which could be $search = "one word or four"; or $search = "one"; or $search = "one one"; I need to validate this into some acceptable for my query. I want a unique list of words, separated with a comma up to a maximum of three. This is what I have so far. $array = explode(" ",$search); $unique = array_unique ($array); I'm sure there must be a quicker way than evaluating each of the items for blank and selecting the first three.

    Read the article

  • EF4 CTP5 Conflicting changes detected. This may happen when trying to insert multiple entities with the same key.

    - by user658332
    hi, I am new to EF4 CTP5. I am just hanging at one problem.. I am using CodeFirst without Database, so when i execute application, it generated DB for me. here is my scenario, i have following Class structure... public class KVCalculationWish { public KVCalculationWish() { } public int KVCalculationWishId { get; set; } public string KVCalculationWishName { get; set; } public int KVSingleOfferId { get; set; } public virtual KVSingleOffer SingleOffer { get; set; } public int KVCalculationsForPersonId { get; set; } public virtual KVCalculationsForPerson CaculationsForPerson { get; set; } } public class KVSingleOffer { public KVSingleOffer() { } public int KVSingleOfferId { get; set; } public string KVSingleOfferName { get; set; } public KVCalculationWish CalculationWish { get; set; } } public class KVCalculationsForPerson { public KVCalculationsForPerson() { } public int KVCalculationsForPersonId { get; set; } public string KVCalculationsForPersonName { get; set; } public KVCalculationWish CalculationWish { get; set; } } public class EntiyRelation : DbContext { public EntiyRelation() { } public DbSet<KVCalculationWish> CalculationWish { get; set; } public DbSet<KVSingleOffer> SingleOffer { get; set; } public DbSet<KVCalculationsForPerson> CalculationsForPerson { get; set; } protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<KVCalculationWish>().HasOptional(m => m.SingleOffer).WithRequired(p => p.CalculationWish); modelBuilder.Entity<KVCalculationWish>().HasOptional(m => m.CaculationsForPerson).WithRequired(p => p.CalculationWish); } } i want to use KVCalcuationWish object in KVCalcuationsForPerson and KVSingleOffer class. So when i am creating object of KVCalcuationForPerson and KVSingleOffer class i initialize both object with New KVCalcuationWish object. like this KVCalculationsForPerson calcPerson = new KVCalculationsForPerson(); KVCalculationWish wish = new KVCalculationWish() { CaculationsForPerson = calcPerson }; calcPerson.KVCalculationsForPersonName = "Person Name"; calcPerson.CalculationWish = wish; KVSingleOffer singleOffer = new KVSingleOffer(); KVCalculationWish wish1 = new KVCalculationWish() { SingleOffer = singleOffer }; singleOffer.KVSingleOfferName = "Offer Name"; singleOffer.CalculationWish = wish1; but my problem is when i save this records using following code try { db.CalculationsForPerson.Add(calcPerson); db.SingleOffer.Add(singleOffer); db.SaveChanges(); } catch (Exception ex) { } i can save successfully in DB, but in Table KVCalcuationWish i am not able to get the ID of SingleOffer and CalcuationsForPerson class object. Following is the data of KVCalcuationWish table. KVCalcuationWishID KVCalcuationWishName KVSingleOfferID KVCalcuationsForPersonID 1 NULL 0 0 Following is the data of KVSingleOFfer Table KVSingleOfferID KVSingleOfferName 1 Offer Name Follwing is the data of KVCalcuationsForPerson Table KVSingleOfferID KVSingleOfferName 1 Person Name I want to have following possible output in KVCalcuationWish table. KVCalcuationWishID KVCalcuationWishName KVSingleOfferID KVCalcuationsForPersonID 1 NULL 1 NULL 2 NULL NULL 1 so what i want to achieve is ...... when i am save KVSingleOffer object i want separate record to be inserted and when i save KVCalcuationsForPerson object another separate record should be save to KVCalcuationwish table. Is that possible? Sorry for long description... but i really hang on this situation... Thanks & Regards, Joyous Suhas

    Read the article

  • JSF 2.1 Spring 3.0 Integration

    - by danny.lesnik
    I'm trying to make very simple Spring 3 + JSF2.1 integration according to examples I googled in the web. So here is my code: My HTML submitted to actionController.actionSubmitted() method: <h:form> <h:message for="textPanel" style="color:red;" /> <h:panelGrid columns="3" rows="5" id="textPanel"> //all my bean prperties mapped to HTML code. </h:panelGrid> <h:commandButton value="Submit" action="#{actionController.actionSubmitted}" /> </h:form> now the Action Controller itself: @ManagedBean(name="actionController") @SessionScoped public class ActionController implements Serializable{ @ManagedProperty(value="#{user}") User user; @ManagedProperty(value="#{mailService}") MailService mailService; public void setMailService(MailService mailService) { this.mailService = mailService; } public void setUser(User user) { this.user = user; } private static final long serialVersionUID = 1L; public ActionController() {} public String actionSubmitted(){ System.out.println(user.getEmail()); mailService.sendUserMail(user); return "success"; } } Now my bean Spring: public interface MailService { void sendUserMail(User user); } public class MailServiceImpl implements MailService{ @Override public void sendUserMail(User user) { System.out.println("Mail to "+user.getEmail()+" sent." ); } } This is my web.xml <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> <!-- Welcome page --> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <!-- JSF mapping --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> my applicationContext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="mailService" class="com.vanilla.jsf.services.MailServiceImpl"> </bean> </beans> my faces-config.xml is the following: <application> <el-resolver> org.springframework.web.jsf.el.SpringBeanFacesELResolver </el-resolver> <message-bundle> com.vanilla.jsf.validators.MyMessages </message-bundle> </application> <managed-bean> <managed-bean-name>actionController</managed-bean-name> <managed-bean-class>com.vanilla.jsf.controllers.ActionController</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>mailService</property-name> <value>#{mailService}</value> </managed-property> </managed-bean> <navigation-rule> <from-view-id>index.xhtml</from-view-id> <navigation-case> <from-action>#{actionController.actionSubmitted}</from-action> <from-outcome>success</from-outcome> <to-view-id>submitted.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> My Problem is that I'm getting NullPointerExeption because my mailService Spring bean is null. public String actionSubmitted(){ System.out.println(user.getEmail()); //mailService is null Getting NullPointerException mailService.sendUserMail(user); return "success"; }

    Read the article

  • How to handle the browsers who don't support HTML5/CSS3

    - by Sheikh Aman
    Hi, I have been looking into HTML5 and CSS3 and have been liking it quite a lot. Got around the modernizr API, but am stuck at one point, and that leads to further confusions: How will I write a code that caters to the situation of non-compatibility between browsers ? This leads to the following confusions: if I write the doctype as <!DOCTYPE HTML> and my page is accessed in IE6, then ho IE6 will handle the page? If I try to include <video> tag and the page is again accessed by IE6/IE7IE8 (which don't support this tag), Then how am I supposed to be rolling back to flash for them? Should I use some JS to show/hide the content appropriately? I would love to hear some thoughts of you guys. If needed, please mark this post as a community wiki. Thanks!

    Read the article

  • Restart logging to a new file (Python)

    - by compie
    I'm using the following code to initialize logging in my application. logger = logging.getLogger() logger.setLevel(logging.DEBUG) # log to a file directory = '/reserved/DYPE/logfiles' now = datetime.now().strftime("%Y%m%d_%H%M%S") filename = os.path.join(directory, 'dype_%s.log' % now) file_handler = logging.FileHandler(filename) file_handler.setLevel(logging.DEBUG) formatter = logging.Formatter("%(asctime)s %(filename)s, %(lineno)d, %(funcName)s: %(message)s") file_handler.setFormatter(formatter) logger.addHandler(file_handler) # log to the console console_handler = logging.StreamHandler() level = logging.INFO console_handler.setLevel(level) logger.addHandler(console_handler) logging.debug('logging initialized') How can I close the current logging file and restart logging to a new file? Note: I don't want to use RotatingFileHandler, because I want full control over all the filenames and the moment of rotation.

    Read the article

  • jsp update request happens to be invoked by a link

    - by Akshatha
    <tr class="bg-row1"> <td class="td-highlighted-2"> <div align="left"><a href="<%=contextPath%>/jsp/admin/UpdateProject.jsp"><%=searchList1.getProjid()%></a></div> </td> <td class="td-highlighted-2"> <div align="left"><%=searchList1.getProjname()%></div> </td> </tr> here jsp update request happens to be invoked by a link in updateproject.jsp how can i refer projid and projname value in a text box

    Read the article

  • how to assign the html value to the php variable without post or get method

    - by Meena
    hi , in my program i had a php value $test = 2 using this value i done some operation for example: in my page i had a 2 block A and B and one select box. If the test value is A it enable the div A, if the value is B it hide div A and also i am able to show and hide the div using the select box onchange event. please check my sample code given below $test = $_GET["id"]; <select name="hideme" id="hideme" onchange="enableme();"> <option value="A">Show</option> <option value="B">Hide</option> </select> if($test == 'A') { <div id="div1" name="div1"> xxxxxxxxxxxxx </div> } Js Function : function enableme() { if(document.getElementByID('hideme').value == "A") { document.getElementById.style.display ="block"; } else { document.getElementById.style.display ="none"; } } my issue is at fist time using the $test($_get) value it show the correct div but the on change event is not working because of , if condition. If i remove the if condition then it show div A even if the value of the $test is B. how could i handle both. Please Help me

    Read the article

  • Better performance to Query the DB or Cache small result sets?

    - by user169867
    Say I need to populate 4 or 5 dropdowns w/ items from a database. Each drop down will have < 15 items in it. These items almost never change. Now I could query the DB each time the page is accessed or I could grab the values from a custom class that would check to see if they already exist in ASP.Net's cache and only if they don't query the DB to update the cache. It's trivial for me to write but I'm unsure if the performace would be better or not. I think it would be (although not likely anything huge). What do you think?

    Read the article

  • What does this statement mean ? printf("[%.*s] ", (int) lengths[i],

    - by Vivek Goel
    I was reading this page http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html there is one line printf("[%.*s] ", (int) lengths[i], row[i] ? row[i] : "NULL"); from code MYSQL_ROW row; unsigned int num_fields; unsigned int i; num_fields = mysql_num_fields(result); while ((row = mysql_fetch_row(result))) { unsigned long *lengths; lengths = mysql_fetch_lengths(result); for(i = 0; i < num_fields; i++) { printf("[%.*s] ", (int) lengths[i], row[i] ? row[i] : "NULL"); } printf("\n"); } what does [%.*s] mean in that code ?

    Read the article

  • probelem with NSTimer

    - by zp26
    Hi I have a problem with a NSTimer I recived a "SIGABRT" error and "[NSCFTimer intValue]: unrecognized selector sent to instance " These is my code: -(void)detectionMove:(NSNumber*)arrayIndex{ static BOOL notFind = FALSE; static int countVariable = 0; static int countRilevamenti = 0; notFind = FALSE; for(int i = countVariable+1; i<[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]; i++){ if(!notFind){ if((actualAccelerometerX+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueX] && (actualAccelerometerX-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueX] && (actualAccelerometerY+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueY] && (actualAccelerometerY-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueY] && (actualAccelerometerZ+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueZ] && (actualAccelerometerZ-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueZ]) { countVariable = i; notFind = TRUE; countRilevamenti++; } } } if(!notFind) return; else if(countVariable+1 == [[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]){ if(countRilevamenti + tollerance >= [[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]) movementDetected = [arrayIndex intValue]; else NSLog(@"troppo veloce"); countVariable = 0; notFind = FALSE; countRilevamenti = 0; return; } [NSTimer scheduledTimerWithTimeInterval:timeToCatch target:self selector:@selector(detectionMove:) userInfo:(NSNumber*)arrayIndex repeats:NO]; }

    Read the article

  • table lock while creating table using select

    - by shal
    Using mysql version 5.0.18 I am creating a table TT, Client 1 set autocommit = false; start transaction Create table TT select * from PT; PT has tow columns pk bigint not null,name varchar(20) Client 2 set autocommit = false start transaction insert into PT values(123,'text'); While inserting a row in PT , it is waiting for the table Client 1 to commit. I am unable to insert the row. why? Is it possible to insert the row without waiting for Client 1 to commit.

    Read the article

  • How would I show an HTML page in Eclipse at Design Time?

    - by 1.21 gigawatts
    When I'm writing crappy code in eclipse and I'm looking at a website for help I am constantly flipping back and forth between the browser and eclipse. To help me write crappy code faster is there a way to have a View that has a web page in it? I need to be able to set the URL and if I'm navigating around the site have a button to have it return to the original URL. So a URL Address box and 1 favorite link. BTW I'm not a Eclipse plugin developer.

    Read the article

  • Need to reload current_cart to get the test passed

    - by leomayleomay
    I'm testing my online store app with RSpec, here's what I'm doing: # spec/controllers/line_items_controller_spec.rb require 'spec_helper' describe LineItemsController do describe "POST 'create'" do before do @current_cart = Factory(:cart) controller.stub!(:current_cart).and_return(@current_cart) end it 'should merge two same line_items into one' do @product = Factory(:product, :name => "Tee") post 'create', {:product_id => @product.id} post 'create', {:product_id => @product.id} assert LineItem.count.should == 1 assert LineItem.first.quantity.should == 2 end end end # app/controllers/line_items_controller.rb class LineItemsController < ApplicationController def create current_cart.line_items.each do |line_item| if line_item.product_id == params[:product_id] line_item.quantity += 1 if line_item.save render :text => "success" else render :text => "failed" end return end end @line_item = current_cart.line_items.new(:product_id => params[:product_id]) if @line_item.save render :text => "success" else render :text => "failed" end end end The problem right now is it never added up two line_items having the same product into one, because the second time I entered into the line_items_controller#create, the current_cart.line_items is [], I have run current_cart.reload to get the test passed, any idea what's going wrong?

    Read the article

  • NSData dataWithContentsOfURL

    - by ketan rajput
    I have this method for button click (download). The problem is that it is terminating due to an exception: [Session started at 2011-03-14 13:06:45 +0530.] 2011-03-14 13:06:45.710 XML[7079:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString isFileURL]: unrecognized selector sent to instance 0x62b8' -(IBAction) download { UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:@"http://ws.cdyne.com/WeatherWS/Images/thunderstorms.gif"]]; [image release]; } What is the problem?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >