Search Results

Search found 47805 results on 1913 pages for 'return address'.

Page 110/1913 | < Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >

  • Haskell Add Function Return to List Until Certain Length

    - by kienjakenobi
    I want to write a function which takes a list and constructs a subset of that list of a certain length based on the output of a function. If I were simply interested in the first 50 elements of the sorted list xs, then I would use fst (splitAt 50 (sort xs)). However, the problem is that elements in my list rely on other elements in the same list. If I choose element p, then I MUST also choose elements q and r, even if they are not in the first 50 elements of my list. I am using a function finderFunc which takes an element a from the list xs and returns a list with the element a and all of its required elements. finderFunc works fine. Now, the challenge is to write a function which builds a list whose total length is 50 based on multiple outputs of finderFunc. Here is my attempt at this: finish :: [a] -> [a] -> [a] --This is the base case, which adds nothing to the final list finish [] fs = [] --The function is recursive, so the fs variable is necessary so that finish -- can forward the incomplete list to itself. finish ps fs -- If the final list fs is too small, add elements to it | length fs < 50 && length (fs ++ newrs) <= 50 = fs ++ finish newps newrs -- If the length is met, then add nothing to the list and quit | length fs >= 50 = finish [] fs -- These guard statements are currently lacking, not the main problem | otherwise = finish [] fs where --Sort the candidate list sortedps = sort ps --(finderFunc a) returns a list of type [a] containing a and all the -- elements which are required to go with it. This is the interesting -- bit. rs is also a subset of the candidate list ps. rs = finderFunc (head sortedps) --Remove those elements which are already in the final list, because -- there can be overlap newrs = filter (`notElem` fs) rs --Remove the elements we will add to the list from the new list -- of candidates newps = filter (`notElem` rs) ps I realize that the above if statements will, in some cases, not give me a list of exactly 50 elements. This is not the main problem, right now. The problem is that my function finish does not work at all as I would expect it to. Not only does it produce duplicate elements in the output list, but it sometimes goes far above the total number of elements I want to have in the list. The way this is written, I usually call it with an empty list, such as: finish xs [], so that the list it builds on starts as an empty list.

    Read the article

  • mongodb insert and return id with REST API

    - by abhi
    New to Mongodb,trying to get _id after mongodb insert without a round trip. $.ajax( { url: "https://api.mongolab.com/api/1/databases/xxx/collections/xx?apiKey=xxx", data: JSON.stringify( [ { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} ] ), type: "POST", contentType: "application/json" } ); Thanks edit: Solved buy removing square bracers JSON.stringify( { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} )

    Read the article

  • Contacts activity doesn't return data

    - by Mike
    In my app I simply open the list of activities and when a contact is clicked I attempt to retrieve the name of the contact selected and put it into a string. The app crashes in the onActivityResult() function. I do have the READ_CONTACTS permission set. /** * Opens the contacts activity */ public void openContacts() { Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); } @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); switch (reqCode) { case (PICK_CONTACT) : if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); //NullPointerException thrown here, line 102 if (c.moveToFirst()) { String name = c.getString(c.getColumnIndexOrThrow(People.NAME)); FRIEND_NAME = name; showConfirmDialog(name); } } break; } } The following logcat error logs are returned: Any help is appreciated. Thanks

    Read the article

  • How to present a plot and then return to cmd prompt

    - by ldigas
    I have a data file, and a gnu file, in which my plotting commands are. How can I produce a plot in gnuplot, in a way that I call gnuplot giving it a name of the gnu file ... it gives me the window with a plot ... and after I close it, it returns me not to gnuplot command prompt, but to cmd (windows cmd.exe) command prompt ?

    Read the article

  • Does "Return value optimization" cause undefined behavior?

    - by 6pack kid
    Reading this Wikipedia article pointed by one of the repliers to the following question: http://stackoverflow.com/questions/2323225/c-copy-constructor-temporaries-and-copy-semantics I came across this line Depending on the compiler, and the compiler's settings, the resulting program may display any of the following outputs: Doesn't this qualify for undefined behavior? I know the article says Depending on the compiler and settings but I just want to clear this.

    Read the article

  • Context.Items.Add on an XML return type?

    - by Scott Schluer
    So I have the following code contained within an HttpModule in an application I've been asked to support: app.Context.Response.ContentType = "text/xml"; app.Context.Items.Add("IpixRoomId", ipixRoomId); app.Context.Items.Add("IpixId", ipixId); app.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache); app.Context.RewritePath(rewriteUrl, true); What's the purpose of adding data to Context.Items when the content type is XML? EDIT: For clarification, I'm calling up this URL: http://website.com/virtualtour/1971/6284/panorama2flash.swf I assume the SWF file (I know very little about Flash) makes another call to http://website.com/virtualtour/config.xml. The code I pasted above only executes on calls to config.xml. So since it's only the SWF file and config.xml being requested from the server, I'm a little confused. Can the .SWF file have access to HttpContext.Current.Items? Other than the HttpModule, there is no .NET involved in the code, it's a straight request to the SWF file which triggers a call to config.xml but it seems that those Context.Items contain the data needed to make the SWF file display the right virtual tour. I'm just missing where that link happens. It can't happen in the XML, so maybe in Flash?

    Read the article

  • NSRunningApplication, return list of recent used applications?

    - by Martijn
    i'm trying to get a list of the most recent used applications. NSWorkspace returns me a list of active applications and i can sort them on a few options using NSRunningApplication. see list below: launchDate finishedLaunching processIdentifier i dont want the lauch date but the recent 'active' date (like the way cmd-tab sorts). Does anyone knows the solution for this?

    Read the article

  • C# regularly return values from a different thread

    - by sdds
    Hello, I'm very new to multithreading and lack experience. I need to compute some data in a different thread so the UI doesn't hang up, and then send the data as it is processed to a table on the main form. So, basically, the user can work with the data that is already computed, while other data is still being processed. What is the best way to achieve this? I would also be very grateful for any examples. Thanks in advance.

    Read the article

  • Setting up App Engine to receive email addresses with ids in the address

    - by Mark M
    I am writing an App Engine app that is supposed to receive emails in this form: [email protected] (someID is an alphanumeric ID that I generate). I have this in my web.xml thinking it would catch emails that start with 'addcontact.': <servlet> <servlet-name>addNewContactServlet</servlet-name> <servlet-class>com.mycompany.server.AddNewContactServlet</servlet- class> </servlet> <servlet-mapping> <servlet-name>addNewContactServlet</servlet-name> <url-pattern>/_ah/mail/addcontact.*</url-pattern> </servlet-mapping> However, both on my dev machine and on google's servers email is not received. On the dev machine I get this message (I get a similar error in the deployed log) Message send failure HTTP ERROR 404 Problem accessing /_ah/mail/ [email protected]. Reason: NOT_FOUND I can receive email at fully specified addresses or when I use /_ah/mail/* The google documentation made me believe it was possible to include partial email addresses in web.xml. Am I not using the wildcard correctly? Does the period have something to do with it? Can this be done somehow?

    Read the article

  • A file's web address is different from the local file structure

    - by allanb
    I'm not sure how best to describe this (as you can clearly tell from the title) so I'll give you an example: I have a multisite Drupal installation. Each of the sites' sitemap.xml files are located on the server at /sites/example.com/files though with a browser (and to search engines) it is accessible at example.com/sitemap.xml I was wondering how this was achieved? Is this called Virtual Directory? Thank you

    Read the article

  • MySQL: Return grouped fields where the group is not empty, effeciently

    - by Ryan Badour
    In one statement I'm trying to group rows of one table by joining to another table. I want to only get grouped rows where their grouped result is not empty. Ex. Items and Categories SELECT Category.id FROM Item, Category WHERE Category.id = Item.categoryId GROUP BY Category.id HAVING COUNT(Item.id) > 0 The above query gives me the results that I want but this is slow, since it has to count all the rows grouped by Category.id. What's a more effecient way? I was trying to do a Group By LIMIT to only retrieve one row per group. But my attempts failed horribly. Any idea how I can do this? Thanks

    Read the article

  • Unexpected crash while using looking phone numbers in iPhone address book

    - by FX
    I have a rather unexpected result with the following code: ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); NSLog (@"npeople = %d = %d", nPeople, CFArrayGetCount(people)); for (CFIndex i = 0; i < nPeople; i++) { ABRecordRef record = CFArrayGetValueAtIndex(people,i); ABMultiValueRef numbers = ABRecordCopyValue(record, kABPersonPhoneProperty); CFIndex count = ABMultiValueGetCount(numbers); NSLog (@"%d %d", i, count); } I never reach the second NSLog, it crashes on the call to ABMultiValueGetCount with: : * -[NSCFString count]: unrecognized selector sent to instance 0x383e72f4 : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '** -[NSCFString count]: unrecognized selector sent to instance 0x383e72f4' In short, it's behaving as if my "numbers" variable was an NSString. While I wrote the code above myself, the same can be found in many examples on the web. Does someone here spot anything wrong with it? Oh, and also: it only crashes in Release mode (in debug mode, all is fine).

    Read the article

  • Linking to a Large address aware DLL.

    - by Canopus
    Suppose I have a DLL which is built with LARGEADDRESSAWARE linker flag set. Now I have an application dynamically linking to this DLL. Does this make my application LARGEADDRESSAWARE? If not then, does it make sense to have this flag set for any DLL?

    Read the article

  • PHP delete script, return to 'viewsubjects.php?classroom_id=NO VALUE'

    - by Derek
    Hi, As the title states... I am deleting a 'subject' from a 'classroom' I view classrooms, then can click on a classroom to view the subject for that classroom. So the link where I am viewing subjects looks like: viewsubjects.php?classroom=23 When the user selects the delete button (in a row) to remove a subject from a class, I simply want the user to be redirected back to the list of subjects for the classroom (exactly where they were before!!) So I though this is simply a case of calling up the classroom ID within my delete script. Here is what I have: EDIT: corrected spelling mistake in code (this was not the problem) $subject_id = $_GET['subject_id']; $classroom_id = $_GET['classroom_id']; $sql = "DELETE FROM subjects WHERE subject_id=".$subject_id; $result = mysql_query($sql, $connection) or die("MySQL Error: ".mysql_error()); header("Location: viewsubjects.php?classroom_id=".$classroom_id); exit(); The subject is being removed from the DB, but when I am redirected back the URI is displaying with an empty classroom ID like: viewsubjects.php?classroom_id= Is there a way to carry the classroom ID through successfully through the delete script so it can be displayed after, allowing the user to be redirected back to the page? Thanks for any help!

    Read the article

  • Redirecting to wrong relative address

    - by jay
    Hi All: I have an issue with not getting the correct relative url. Right now, say my home page is at (please ignore quotation) "http://www.foo.com/user/home" I have links on the homepage that should go to "http://www.foo.com/user/home/page1" but right now I'm getting "http://www.foo.com/page1" Everything worked locally, can this be fixed with modifying .htaccess and how? Thank you.

    Read the article

  • Return current web path in PHP

    - by BenTheDesigner
    Hi All Currently developing a PHP framework and have ran into my first problem. I need to be able to drop the framework into any folder on a server, no matter how many folders deep, and need to find that directory to use as a base URL. For example, it currently works if I put the framework in the root of the server (http://cms.dev/), but if I were to put it in http://cms.dev/folder/ it does not work. Please advise, any comments welcome. BenTheDesigner

    Read the article

  • Linq Return node level of hierarchical xml

    - by Ryan
    In a treeview you can retrieve the level of an item. I am trying to accomplish the same thing with the given input being an object. The XML data I will use for this example would be something like the following <?xml version="1.0" encoding="utf-8" ?> <Testing> <Numbers> <Number val="1"> <Number val="1.1"> <Number val="1.1.1"> <Number val="1.1.2" /> <Number val="1.1.3" /> <Number val="1.1.4" /> </Number> </Number> <Number val="1.2" /> <Number val="1.3" /> <Number val="1.4" /> </Number> <Number val="2" /> <Number val="3" /> <Number val="4" /> </Numbers> <Numbers> <Number val="5" /> <Number val="6" /> <Number val="7" /> <Number val="8" /> </Numbers> </Testing> This one is kicking my butt!

    Read the article

  • Query to return substring from string in SQL Server

    - by Jowie
    I have a user defined function called Sync_CheckData under Scalar-valued functions in Microsoft SQL Server. What it actually does is to check the quantity of issued product and balance quantity are the same. If something is wrong, returns an ErrorStr nvarchar(255). Output Example: Balance Stock Error for Product ID : 4 From the above string, I want to get 4 so that later on I can SELECT the rows which is giving errors by using WHERE clause (WHERE Product_ID = 4). Which SQL function can I use to get the substring?

    Read the article

< Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >