Daily Archives

Articles indexed Thursday June 10 2010

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

  • Doubts About Core Data NSManagedObject Deep Copy

    - by Jigzat
    Hello everyone, I have a situation where I must copy one NSManagedObject from the main context into an editing context. It sounds unnecessary to most people as I have seen in similar situations described in Stackoverflow but I looks like I need it. In my app there are many views in a tab bar and every view handles different information that is related to the other views. I think I need multiple MOCs since the user may jump from tab to tab and leave unsaved changes in some tab but maybe it saves data in some other tab/view so if that happens the changes in the rest of the views are saved without user consent and in the worst case scenario makes the app crash. For adding new information I got away by using an adding MOC and then merging changes in both MOCs but for editing is not that easy. I saw a similar situation here in Stackoverflow but the app crashes since my data model doesn't seem to use NSMutableSet for the relationships (I don't think I have a many-to-many relationship, just one-to-many) I think it can be modified so I can retrieve the relationships as if they were attributes for (NSString *attr in relationships) { [cloned setValue:[source valueForKey:attr] forKey:attr]; } but I don't know how to merge the changes of the cloned and original objects. I think I could just delete the object from the main context, then merge both contexts and save changes in the main context but I don't know if is the right way to do it. I'm also concerned about database integrity since I'm not sure that the inverse relationships will keep the same reference to the cloned object as if it were the original one. Can some one please enlighten me about this?

    Read the article

  • Weird Rails URL issue when rendering a new action

    - by Tony
    I am rendering a new action but somehow getting the "index" URL. To be more specific, my create action looks like this: class ListingsController < ApplicationController def create @listing = Listing.new(params[:listing]) @listing.user = @current_user if @listing.save redirect_to @listing else flash[:error] = "There were errors" render :action => "new" end end end When there are errors, I get the "new" action but my URL is the index URL - http://domain.com/listings Anyone know why this would happen? My routes file is fairly standard: map.connect 'listings/send_message', :controller => 'listings', :action => 'send_message' map.resources :listings map.root :controller => "listings" map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format'

    Read the article

  • Dye Sub printer with specific prints remaining - can I command-line query this?

    - by Jason N
    Hey, I've got a Sony Dye-Sub printer that holds ink/paper sets - i.e. a very certain amount of ink and paper for ~200 prints. This information is available to me from within Control Panel Printers Preferences Printer Device Information (i.e. current 189 remaining prints). Any way I can perhaps get this information from the command line? I'd like to write a little program to tell me when the number of prints gets low (i.e. < 20), rather than suffer the annoying Windows "run out of paper" popup. I've found the Windows VBScript print utilities, but can't seem to find the request I need for this. Any suggestions? Jason

    Read the article

  • MySQL Grant Problem

    - by Joel Dare
    Why might the following grant statement fail to work? grant all on kylie.* to 'kylie'@'localhost' identified by 'foo'; Here's the complete output. $ mysql -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 63 Server version: 5.1.37 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases like 'kylie%'; +-------------------+ | Database (kylie%) | +-------------------+ | kylie | +-------------------+ 1 row in set (0.00 sec) mysql> grant all on kylie.* to 'kylie'@'localhost' identified by 'foo'; Query OK, 0 rows affected (0.02 sec) mysql> exit Bye $ mysql -u kylie ERROR 1045 (28000): Access denied for user 'kylie'@'localhost' (using password: YES) It seems that these grant options get me every time. I think I have them memorized and the docs seem to check out too, but they often fail to work. What am I missing?

    Read the article

  • Vector iterators in for loops, return statements, warning, c++

    - by Crystal
    Had 3 questions regarding a hw assignment for C++. The goal was to create a simple palindrome method. Here is my template for that: #ifndef PALINDROME_H #define PALINDROME_H #include <vector> #include <iostream> #include <cmath> template <class T> static bool palindrome(const std::vector<T> &input) { std::vector<T>::const_iterator it = input.begin(); std::vector<T>::const_reverse_iterator rit = input.rbegin(); for (int i = 0; i < input.size()/2; i++, it++, rit++) { if (!(*it == *rit)) { return false; } } return true; } template <class T> static void showVector(const std::vector<T> &input) { for (std::vector<T>::const_iterator it = input.begin(); it != input.end(); it++) { std::cout << *it << " "; } } #endif Regarding the above code, can you have more than one iterator declared in the first part of the for loop? I tried defining both the "it" and "rit" in the palindrome() method, and I kept on getting an error about needing a "," before rit. But when I cut and paste outside the for loop, no errors from the compiler. (I'm using VS 2008). Second question, I pretty much just brain farted on this one. But is the way I have my return statements in the palindrome() method ok? In my head, I think it works like, once the *it and *rit do not equal each other, then the function returns false, and the method exits at this point. Otherwise if it goes all the way through the for loop, then it returns true at the end. I totally brain farted on how return statements work in if blocks and I tried looking up a good example in my book and I couldn't find one. Finally, I get this warnings: \palindrome.h(14) : warning C4018: '<' : signed/unsigned mismatch Now is that because I run my for loop until (i < input.size()/2) and the compiler is telling me that input can be negative? Thanks!

    Read the article

  • WCF REST with jQuery AJAX - removing/working around same origin policy

    - by csauve
    So I'm trying to create a C# WCF REST service that is called by jQuery. I've discovered that jQuery requires that AJAX calls are made under the same origin policy. I have a few questions for how I might proceed. I am already aware of; 1. The hacky solution of JSONP with a server callback 2. The way too much server overhead of having a cross-domain proxy. 3. Using Flash in the browser to make the call and setting up crossdomain.xml at my WCF server root. I'd rather not use these because; 1. I don't want to use JSON, or at least I don't want to be restricted to using it 2. I would like to separate the server that serves static pages from the one that serves application state. 3. Flash in this day in age is out of the question. What I'm thinking: is there anything like Flash's crossdomain.xml file that works for jQuery? Is this "same-origin" policy a part of jQuery or is it a restriction in specific browsers? If it's just a part of jQuery, maybe I'll try digging in the code to work around it.

    Read the article

  • file_field is not sticky in my Rails form

    - by Tony
    I have a pretty standard Rails form: <div> <h1>Create a New Listing</h1> <%- form_for @listing, :html => {:multipart => true} do |f| -%> <div><%= f.label :title, "Title:"%> <%= f.text_field :title %></div> <div> <%= f.label :image, "Image:" %> <%= f.file_field :image </div> <div> <%= f.label :sound, "Sound Clip:"%> <%= f.file_field :sound %><br /> </div> <div class="submit"><%= f.submit 'Post Listing' %></div> <%- end -%> </div> When a user chooses a file, but the form fails for validation purposes, he must always re-select the file. It is not sticky. Any suggestion on how to fix this? Thanks!

    Read the article

  • google maps api : internal server error when inserting a feature

    - by user142764
    Hi, I try to insert features on a custom google map : i use the sample code from the doc but i get a ServiceException (Internal server error) when i call the service's insert method. Here is what i do : I create a map and get the resulting MapEntry object : myMapEntry = (MapEntry) service.insert(mapUrl, myEntry); This works fine : i can see the map i created in "my maps" on google. I use the feed url from the map to insert a feature : final URL featureEditUrl = myMapEntry.getFeatureFeedUrl(); I create a kml string using the sample from the doc : String kmlStr = "< Placemark xmlns=\"http://www.opengis.net/kml/2.2\">" + "<name>Aunt Joanas Ice Cream Shop</name>" + "<Point>" + "<coordinates>-87.74613826475604,41.90504663195118,0</ coordinates>" + "</Point></Placemark>"; And when i call the insert method i get an internal server error. I must be doing something wrong but i cant see what, can anybody help ? Here is the complete code i use : public void doCreateFeaturesFormap(MapEntry myMap) throws ServiceException, IOException { final URL featureEditUrl = myMap.getFeatureFeedUrl(); FeatureEntry featureEntry = new FeatureEntry(); try { String kmlStr = "<Placemark xmlns=\"http://www.opengis.net/kml/ 2.2\">" + "<name>Aunt Joanas Ice Cream Shop</name>" + "<Point>" + "<coordinates>-87.74613826475604,41.90504663195118,0</ coordinates>" + "</Point></Placemark>"; XmlBlob kml = new XmlBlob(); kml.setFullText(kmlStr); featureEntry.setKml(kml); featureEntry.setTitle(new PlainTextConstruct("Feature Title")); } catch (NullPointerException e) { System.out.println("Error: " + e.getClass().getName()); } FeatureEntry myFeature = (FeatureEntry) service.insert( featureEditUrl, featureEntry); } Thanks in advance, Vincent.

    Read the article

  • Ruby Challenge - efficiently change the last character of every word in a sentence to a capital

    - by emson
    Hi All I recently was challenged to write some Ruby code to change the last character of every word in a sentence into a capital. Such that the string: "script to convert the last letter of every word to a capital" becomes "scripT tO converT thE lasT letteR oF everY worD tO A capitaL" This was my optimal solution however I'm sure you wizards have much better solutions and I would be really interested to hear them. "script to convert the last letter of every word to a capital".split.map{|w|w<<w.slice!(-1).chr.upcase}.join' ' For those interested as to what is going on here is an explanation. split will split the sentence up into an array, the default delimiter is a space and with Ruby you don't need to use brackets here. map the array from split is passed to map which opens a block and process each word (w) in the array. the block slice!(s) off the last character of the word and converts it to a chr (a character not ASCII code) and then capitalises upcase it. This character is now appended << to the word which is missing the sliced last letter. Finally the array of words is now join together with a ' ' to reform the sentence. Enjoy

    Read the article

  • need help about add navigationItem

    - by RAGOpoR
    according to my picture the upper picture is an original create automatically when navigation controller is push if i try to create like this one it will appear like bottom picture. how can i programmatic to create Back Button like upper picture? here is my code to create Done button self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(backtohome)];

    Read the article

  • yes another question about Interfaces?

    - by sam
    Hi Guys, I started commercial programming lately, I am used to functions, then now I always questions about interfaces.. Do you provide me with some links and book names, that can explain deeply why using interfaces? is interfaces required for small projects?? I am using C#. thanks

    Read the article

  • What are major differences between C# and Java?

    - by enba
    I just want to clarify one thing. This is not a question on which one is better, that part I leave to someone else to discuss. I don't care about it. I've been asked this question on my job interview and I thought it might be useful to learn a bit more. These are the ones I could come up with: Java is "platform independent". Well nowadays you could say there is the Mono project so C# could be considered too but I believe it is a bit exaggerating. Why? Well, when a new release of Java is done it is simultaneously available on all platforms it supports, on the other hand how many features of C# 3.0 are still missing in the Mono implementation? Or is it really CLR vs. JRE that we should compare here? Java doesn't support events and delegates. As far as I know. In Java all methods are virtual Development tools: I believe there isn't such a tool yet as Visual Studio. Especially if you've worked with team editions you'll know what I mean. Please add others you think are relevant. Update: Just popped up my mind, Java doesn't have something like custom attributes on classes, methods etc. Or does it?

    Read the article

  • Using Mercurial (hg), how to push just one file or one directory out?

    - by Jian Lin
    Using Mercurial, we can commit one file by using hg commit file.rb or 1 folder hg commit foldername But how can we push just 1 file or 1 folder out? The whole project can be pushed using hg push ssh://[email protected]//project/code/preliminary but there seems to be no way to push out just 1 file or 1 folder? I tried the following and they don't work: hg push ssh://[email protected]//project/code/preliminary app/views/index.html.erb or hg push ssh://[email protected]//project/code/preliminary/app/views/index.html.erb

    Read the article

  • ASP.NET Login Page Redirection Problem

    - by Daniel
    Hello everyone! I'm building a silverlight application hosted on ASP.NET Web App. / IIS7 / SSL-enabled website. For security, I put my silverlight page inside a Members folder in the ASP.NET Web Application, and restricted access from anonymous users.(see web.config below) when users try to access pages under Members folder, they get redirected to https://www.ssldemo.com/authenticationtest/login.aspx. (see web.config below) (I've mapped www.ssldemo.com to 127.0.0.1). for security, I'm switching to HTTPS in login.aspx, and back to HTTP after validation. below is the code for login.aspx.cs. protected void Page_Load(object sender, EventArgs e) { LoginControl.LoggedIn += new EventHandler(LoginControl_LoggedIn); } void LoginControl_LoggedIn(object sender, EventArgs e) { //for going to ReturnURL & switching back to HTTP string serverName = HttpUtility.UrlEncode(Request.ServerVariables["SERVER_NAME"]); string returnURL = Request["ReturnURL"]; Response.Redirect(ResolveClientUrl("http://" + serverName + returnURL)); } The problem is, when I deploy another application to http://www.ssldemo.com/authenticationtest/members/AnotherApplication/ and open http://www.ssldemo.com/authenticationtest/members/AnotherApplication/default.aspx, Users get redirected to https://www.ssldemo.com/authenticationtest/login.aspx?ReturnUrl=%2fauthenticationtest%2fmembers%2fanotherapplication%2fdefault.aspx. but even when I enter the correct credentials at login page, I get redirected to the same login page again, not to the ReturnUrl. when I looked into fiddler, it said '302 object moved to here.' Thank you for reading! Any input will be much appreciated. <configuration> <connectionStrings> <add name="CompanyDatabase" connectionString="Data Source=192.168.0.2;Initial Catalog=SomeTable;User ID=Username;Password=P@ssword" /> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Forms"> <forms slidingExpiration="true" timeout="15" loginUrl="https://www.ssldemo.com/authenticationtest/login.aspx" defaultUrl="~/Members/Default.aspx" > </forms> </authentication> <!--Custom Membership Provider--> <membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <clear /> <add name="MyMembershipProvider" type="AuthenticationTest.Web.MyMembershipProvider" connectionStringName="CompanyDatabase" applicationName="AuthenticationTest.Web"/> </providers> </membership> </system.web> <!--securing folders--> <location path="Members"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> </configuration>

    Read the article

  • Flash Player Critical Fix on Deck

    With Microsoft and Google already having already released fixes for critical security bugs this week, Adobe is getting ready to join the party as it readies an important patch for its Adobe Flash Player software.

    Read the article

  • CD/DVD WRITER I/O ERROR !!!

    - by bobby
    http://www.mediafire.com/imageview.php?quickkey=jqzdbd5n0nl i am getting the above error wen i am trying to burn a cd/dvd on my dvd writer. im am getting dis error for evry cd/dvd..!! i hv included a screenshot.above. i dnt knw whether it a problem wit my dvd writer...!! im unable to write any dvds/cds im using imgburn burning software.

    Read the article

  • slideshow for images, prev, next buttons

    - by ramyauk
    Hi, I developed an application for my Image gallery.now, i need to make a slideshow for those images with Previous & Next buttons to switch between images. Do anyOne of you tried to develop with such functionality. Can any one of you provide me sample XCode project for my requirement?I would like to test it using iPhone-simulator. Any kind of help would be greatly appreciated. Thank You, Ramya.

    Read the article

  • Adding a validator to the gridview textbox, created in edit-mode of a bound field

    - by user181218
    Hi,take a look at this sample code: (question bellow) <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" onrowupdated="GridView1_RowUpdated" DataKeyNames="Product_Id"> <Columns> <asp:ImageField DataImageUrlField="Image_Name" HeaderText="Image_Name" ReadOnly="True" > <ItemStyle Width="50px" Height="50px" Wrap="true"/> </asp:ImageField> <asp:BoundField DataField="Product_Id" HeaderText="Product_Id" InsertVisible="False" ReadOnly="True" SortExpression="Product_Id"> </asp:BoundField> <asp:BoundField DataField="Product_Name" HeaderText="Product_Name" SortExpression="Product_Name" /> <asp:BoundField DataField="Category_Name" HeaderText="Category_Name" SortExpression="Category_Name" ReadOnly="true" /> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /> <asp:BoundField DataField="Size" HeaderText="Size" SortExpression="Size" /> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" /> <asp:CommandField ShowEditButton="True" /> <asp:CommandField ShowDeleteButton="True" /> </Columns> </asp:GridView> Assume I initialize an SqlDataSource, add a parameter and so on. The thing is, that when a user clicks edit we get a textbox to edit the colnumn value. I want to validate the data enter by the user before the update is performed and the new data is propagated back to the server.How? 10x a lot!

    Read the article

  • Is there any equivalent of XAMPP for Pylons?

    - by Skilldrick
    I'd like to get started with Pylons, to be used on a Windows machine as a local web server. Is there any equivalent of e.g. XAMPP for Pylons that would set up everything with one installer? Edit: I've just discovered the Pylons web server. Could I use this to serve pages to computers on a LAN?

    Read the article

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