Search Results

Search found 3440 results on 138 pages for 'returning'.

Page 90/138 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • PHP CURL works fine from localhost not from server

    - by Joby Joseph
    I have 2 servers, srv1 and srv2. All client sites are stored in srv2 and all authentication details are stored in srv1. Each time a client site is loaded, the site in srv2 sends a curl request to srv1 to validate. I am always getting bool(false) when I print the curl response using var_dump. But if I am requesting for validation from my local wamp installation(localhost) it is perfectly returning the response. According to my understanding srv2 is blocking srv1 ip or something like that. Any help or suggestions will be greatly appreciated. The solution is really urgent as all my clients are stuck with invalid authorization message. Edit: Now when i tested curl in srv2 is working fine i think. Because I am able to fetch other websites without any trouble. But I am not able to fetch data from srv1. I can view a page from srv1 through browser url but not through curl.

    Read the article

  • I just can't figure out strcat.

    - by Anonymous
    I know I shouldn't be using that function, and I don't care. Last time I checked the spec for strcat, it said something along the lines of updating the first value as well as returning the same. Now, this is a really stupid question, and I want you to explain it like you're talking to a really stupid person. Why won't this work? char* foo="foo"; printf(strcat(foo,"bar")); EDIT: I don't know the difference between char[] and char*. How would I allocate a string of 255 characters? EDIT 2: OK, OK, so char[number] allocates a string of that many bytes? Makes sense. Thanks.

    Read the article

  • iPhone SDK SDL_openAudio with Multitasking Support

    - by brokedid
    Hello, I'm playing audio from a Online Live RTPS Stream with ffmpeg(because Apple doesn't support rtsp live streaming). Now I would play my Stream in the background. I started a thread in the background and registered the music for Background support. When the Application is entering in Background the NSThread is paused, and then Resuming after returning from background. If I start playing a Music (MP3-Stream) in the Application which use official Apple Frameworks then when the App is entering Background both Streams are played. What can I do to fix this?

    Read the article

  • struts annotation issue

    - by Gourav
    My issue is that i have an annotation in Struts2 action class like private String[] origfilenofrom; @FieldExpressionValidator(fieldName="origfilenofrom",key="",message="File Length should be 12 for old file format and 15 for new file format",expression="checkorigFileFormat(origfilenofrom)") now my mehtod is public boolean checkorigFileFormat(String[] files ) { for(int counter=0;counter<files.length;counter++) { int n=files[counter].length(); if(!(n==12 || n==15)) { return false; } } return true; } So for any string in that string [], which is returning false the value is bei false. No matter 3 strings in that string [] are true if one is false then the annotaion message is displayed for all. I want the message not to display where the string is true. Help please

    Read the article

  • WP: redirect users to a certain category using cookies

    - by kass
    Basically like cragslist. once you select city on craigslist, nexttime when you go to the site, it redirects you to the city you selected. What I want to achieve: When a person comes to the site and selects a particular category, the next time they come to the site (returning user) - the page will open up on that category section. I would think this would be fairly easy to do via setting a cookie when the visitor clicks on the category link (or when the category page loads). When they return the following time, the cookie is read and then the page redirects accordingly. Unfortunately my knowledge of PHP and cookies is limited, (hence my search for answers) so I need to ask if anyone can help me out! Anyone have any ideas? Thanks!

    Read the article

  • receive a responseText in ajax but without div tag

    - by kawtousse
    Hi everyone I want to know if there is any other way whithout using a div tag to receive response html when sending parameter whith ajax. I'am asking because when iam building the select in other servlet and returning the result to jsp it receive the responsehtml in a div tag when we use the famous: x = xhr.responseText; document.getElementById('param').innerHTML = x; with param is the id of div tag. Note: this works fine when populating ddl but its constraint are multiple for my case. Thinks.

    Read the article

  • MySQL - Conflicting WHERE and GROUP BY Statements

    - by TaylorPLM
    I have a query returning the counts of some data, but I do NOT want data that has a null value in it... As an example, the code rolls stats from a clicking system into a table. SELECT sh.dropid, ... FROM subscriberhistory sh INNER JOIN subscriberhistory sh2 on sh.subid = sh2.subid WHERE sh.dropid IS NOT NULL AND sh.dropid != "" ... GROUP BY sh.dropid An example of the record set returned would look like this... 400 2 3 4 5 6 401 2 3 6 5 4 NULL 2 3 4 5 1 There are some other where clauses, and a few more selects (as I said, using the count aggregate) that are also within the query. There is also an order by statement. Again, the goal is to keep the NULL data out of the preceding record set. Could someone explain to me why this behavior is occurring and what to do to solve it.

    Read the article

  • Assign grid.arrange to object

    - by Tyler Rinker
    I want to arrange plots with grid.arrange to make more complex coplots and then use grid.arrange to combine these complex coplots. I am using the following solution (http://stackoverflow.com/a/13295880/1000343) in this task to arrange mutliple plots and ensure they have equal widths. Here is a demo of the code: library(ggplot2); library(gridExtra) gA <- ggplotGrob(A) gB <- ggplotGrob(B) maxWidth = grid::unit.pmax(gA$widths[2:5], gB$widths[2:5]) gA$widths[2:5] <- as.list(maxWidth) gB$widths[2:5] <- as.list(maxWidth) x <- grid.arrange(gA, gB, ncol=1) y <- grid.arrange(gA, gB, ncol=1) grid.arrange(x, y, ncol=2) To be clear in my case x and y are slightly different plots with different values. I know grid.arrange isn't returning the plot as other grid based functions.

    Read the article

  • SQL SELECT INSERTed data from Table

    - by Noam Smadja
    its in ASP Classic. MS-Access DB. i do: INSERT INTO Orders (userId) VALUES (123)" what i want to retrieve is orderNumber from that row. its an auto-increment number. so i did: SELECT orderNumber FROM Orders WHERE userId=123 but since it is on the same page, the SELECT returns: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. i've seen somewhere RETURNING orderNumber as variable but it was for oracle and i dont know how to implement it into my asp :( set addOrder = Server.CreateObject("ADODB.Command") addOrder.ActiveConnection = MM_KerenDB_STRING addOrder.CommandText = "INSERT INTO Orders (userId) VALUES ("&userId&")" addOrder.CommandType = 1 addOrder.CommandTimeout = 0 addOrder.Prepared = true addOrder.Execute() Dim getOrderNumber Set getOrderNumber = Server.CreateObject("ADODB.Recordset") getOrderNumber.ActiveConnection = MM_KerenDB_STRING getOrderNumber.Source = "SELECT orderNumber FROM Orders WHERE userId=" & userId getOrderNumber.CursorType = 0 getOrderNumber.CursorLocation = 2 getOrderNumber.LockType = 1 getOrderNumber.Open() session("orderNumber") = getOrderNumber.Fields.Item("orderNumber").value

    Read the article

  • NSArray : release its objects, but keep a pointer to it.

    - by Leo
    Hello, I declare an NSArray in my code then building the array from another array. I process my NSArray and when I'm finished, I would like to release the objects, but I'm reusing this pointer to NSAarray again later to do the same process (creating the array from another array, process then releasing).. So I need to keep the pointer. What should I do ? Here is roughly what I want to do, the buildArray is creating and returning an autoreleased NSArray : NSArray *myArray; for (int i = 0, i < 10, i++){ [myArray arrayWithArray:[self buildArray]]; // Here I process myArray [myArray = nil] // is my guess } I need to keep a pointer to my NSArray, in order to reuse later in the loop, but what is happening to the objects created with [self buildArray]? What is the best to do in order not to keep unused object and arrays ? Or maybe the best solution is simply to removeAllObject of the array..? Thank you!

    Read the article

  • MySQL - Counting rows in preparation for greatest-n-per-group not working?

    - by John M
    Referring to SO and other sites have given me examples of how to use MySQL to create a 'greatest-n-per-group' query. My variant on this would be to have a query that returns the first 3 rows of each category. As the basis for this I need to sort my data into a usable sequence and that is where my problems start. Running just the sequence query with row numbering shows that changes in category are mostly ignored. I should have 35 categories returning rows but only 5 do so. My query: set @c:=0; set @a:=0; SELECT IF(@c = tdg, @a:=@a+1, @a:=1) AS rownum, (@c:=tdg) , julian_day, sequence, complete, year, tdg FROM tsd WHERE complete = 0 order by tdg, year, julian_day, sequence Do I have a syntax mistake with this query?

    Read the article

  • Django: how to pass form variable to simple tag in template

    - by Remigijus
    Hello. I am trying to do some custom things in Django comments form. I have simple tag named "get_flatpage_by_id" that returns flatpage model data as array. This is working I expected: {% get_flatpage_by_id 14 as page %} It's returning flatpage that ID is 14. But this is not working, if I try to pass {{ form.object_pk.data }} (that returns 14). This is how it should look like: {% get_flatpage_by_id form.object_pk.data as page %} Simple tag receives value "form.object_pk.data" (string), not 14. I don't know how to tell Django that "form.object_pk.data" is variable, not a string!

    Read the article

  • SQL Server concurrency and generated sequence

    - by Goyuix
    I need a sequence of numbers for an application, and I am hoping to leverage the abilities of SQL Server to do it. I have created the following table and procedure (in SQL Server 2005): CREATE TABLE sequences ( seq_name varchar(50) NOT NULL, seq_value int NOT NULL ) CREATE PROCEDURE nextval @seq_name varchar(50) AS BEGIN DECLARE @seq_value INT SET @seq_value = -1 UPDATE sequences SET @seq_value = seq_value = seq_value + 1 WHERE seq_name = @seq_name RETURN @seq_value END I am a little concerned that without locking the table/row another request could happen concurrently and end up returning the same number to another thread or client. This would be very bad obviously. Is this design safe in this regard? Is there something I can add that would add the necessary locking to make it safe? Note: I am aware of IDENTITY inserts in SQL Server - and that is not what I am looking for this in particular case. Specifically, I don't want to be inserting/deleting rows. This is basically to have a central table that manages the sequential number generator for a bunch of sequences.

    Read the article

  • Handling file upload in a non-blocking manner

    - by Kaliyug Antagonist
    The background thread is here Just to make objective clear - the user will upload a large file and must be redirected immediately to another page for proceeding different operations. But the file being large, will take time to be read from the controller's InputStream. So I unwillingly decided to fork a new Thread to handle this I/O. The code is as follows : The controller servlet /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("In Controller.doPost(...)"); TempModel tempModel = new TempModel(); tempModel.uploadSegYFile(request, response); System.out.println("Forwarding to Accepted.jsp"); /*try { Thread.sleep(1000 * 60); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ request.getRequestDispatcher("/jsp/Accepted.jsp").forward(request, response); } The model class package com.model; import java.io.IOException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.utils.ProcessUtils; public class TempModel { public void uploadSegYFile(HttpServletRequest request, HttpServletResponse response) { // TODO Auto-generated method stub System.out.println("In TempModel.uploadSegYFile(...)"); /* * Trigger the upload/processing code in a thread, return immediately * and notify when the thread completes */ try { FileUploaderRunnable fileUploadRunnable = new FileUploaderRunnable( request.getInputStream()); /* * Future<FileUploaderRunnable> future = ProcessUtils.submitTask( * fileUploadRunnable, fileUploadRunnable); * * FileUploaderRunnable processed = future.get(); * * System.out.println("Is file uploaded : " + * processed.isFileUploaded()); */ Thread uploadThread = new Thread(fileUploadRunnable); uploadThread.start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } /* * catch (InterruptedException e) { // TODO Auto-generated catch block * e.printStackTrace(); } catch (ExecutionException e) { // TODO * Auto-generated catch block e.printStackTrace(); } */ System.out.println("Returning from TempModel.uploadSegYFile(...)"); } } The Runnable package com.model; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; public class FileUploaderRunnable implements Runnable { private boolean isFileUploaded = false; private InputStream inputStream = null; public FileUploaderRunnable(InputStream inputStream) { // TODO Auto-generated constructor stub this.inputStream = inputStream; } public void run() { // TODO Auto-generated method stub /* Read from InputStream. If success, set isFileUploaded = true */ System.out.println("Starting upload in a thread"); File outputFile = new File("D:/06c01_output.seg");/* * This will be changed * later */ FileOutputStream fos; ReadableByteChannel readable = Channels.newChannel(inputStream); ByteBuffer buffer = ByteBuffer.allocate(1000000); try { fos = new FileOutputStream(outputFile); while (readable.read(buffer) != -1) { fos.write(buffer.array()); buffer.clear(); } fos.flush(); fos.close(); readable.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("File upload thread completed"); } public boolean isFileUploaded() { return isFileUploaded; } } My queries/doubts : Spawning threads manually from the Servlet makes sense to me logically but scares me coding wise - the container isn't aware of these threads after all(I think so!) The current code is giving an Exception which is quite obvious - the stream is inaccessible as the doPost(...) method returns before the run() method completes : In Controller.doPost(...) In TempModel.uploadSegYFile(...) Returning from TempModel.uploadSegYFile(...) Forwarding to Accepted.jsp Starting upload in a thread Exception in thread "Thread-4" java.lang.NullPointerException at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:512) at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:497) at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:559) at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:324) at org.apache.coyote.Request.doRead(Request.java:422) at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:287) at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:407) at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:310) at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:202) at java.nio.channels.Channels$ReadableByteChannelImpl.read(Unknown Source) at com.model.FileUploaderRunnable.run(FileUploaderRunnable.java:39) at java.lang.Thread.run(Unknown Source) Keeping in mind the point 1., does the use of Executor framework help me in anyway ? package com.utils; import java.util.concurrent.Future; import java.util.concurrent.ScheduledThreadPoolExecutor; public final class ProcessUtils { /* Ensure that no more than 2 uploads,processing req. are allowed */ private static final ScheduledThreadPoolExecutor threadPoolExec = new ScheduledThreadPoolExecutor( 2); public static <T> Future<T> submitTask(Runnable task, T result) { return threadPoolExec.submit(task, result); } } So how should I ensure that the user doesn't block and the stream remains accessible so that the (uploaded)file can be read from it?

    Read the article

  • Efficient retrieval of lists over WebServices

    - by Chris
    I have a WCF WebService that uses LINQ and EF to connect to an SQL database. I have an ASP.NET MVC front end that collects its data from the webservice. It currently has functions such as List<Customer> GetCustomers(); As the number of customers increases massively the amount of data being passed increases also reducing efficiency. What is the best way to "page data" across WebServices etc. My current idea is to implement a crude paging system such as List<Customer> GetCustomers(int start, int length); This, however, means I would have to replicate such code for all functions returning List types. It is unfortunate that I cannot use LINQ as it would be much nicer. Does anyone have any advice or ideas of patterns to implement that would be "as nice as possible" Thanks

    Read the article

  • AS3 Passing data between objects/classes

    - by 1337holiday
    So i a building a categorized menu of different foods. I have a class for "categories" (buttons) which essentially will return a string "salads", "drinks", etc. I now have another class "menuItems" for items within categories and this handles sizes such as "small", "med", "large", etc. My problem now is that when i return "salads", i want to invoke an array which contains all the elements of salads, send it to menuItems which will populate the menu. So far i have both the category objects and the menu object setup. I just cant seem to be able to send the data that the category object is returning and pass it to the menu object. Both of which are added to the stage as shown below: If there was a way that i could say add all these classes to one class so that they can talk to each other that would be great but i dont know how to do this. Been stuck for hours, please any help is greatly appreciated.

    Read the article

  • if else-if making code look ugly any cleaner solution?

    - by Vishal
    I have around 20 functions (is_func1, is_fucn2, is_func3...) returning boolean I assume there is only one function which returns true and I want that! I am doing: if is_func1(param1, param2): # I pass 1 to following abc(1) # I pass 1 some_list.append(1) elif is_func2(param1, param2): # I pass 2 to following abc(2) # I pass 1 some_list.append(2) ... . . elif is_func20(param1, param2): ... Please note: param1 and param2 are different for each, abc and some_list take parameters depending on the function. The code looks big and there is repetition in calling abc and some_list, I can pull this login in a function! but is there any other cleaner solution? I can think of putting functions in a data structure and loop to call them.

    Read the article

  • Own params to PeriodicTask run() method in Celery

    - by Alex Isayko
    Hello to all! I am writing a small Django application and I should be able to create for each model object its periodical task which will be executed with a certain interval. I'm use for this a Celery application, but i can't understand one thing: class ProcessQueryTask(PeriodicTask): run_every = timedelta(minutes=1) def run(self, query_task_pk, **kwargs): logging.info('Process celery task for QueryTask %d' % query_task_pk) task = QueryTask.objects.get(pk=query_task_pk) task.exec_task() return True Then i'm do following: >>> from tasks.tasks import ProcessQueryTask >>> result1 = ProcessQueryTask.delay(query_task_pk=1) >>> result2 = ProcessQueryTask.delay(query_task_pk=2) First call is success, but other periodical calls returning the error - TypeError: run() takes exactly 2 non-keyword arguments (1 given) in celeryd server. So, can i pass own params to PeriodicTask run() ? Thanks!

    Read the article

  • Return value in Visual Studio's Autos window

    - by Dave
    When I used to develop in C++, I remember that Visual Studio had an entry in its Autos window whenever returning from a function call. This entry would tell me what value was returned from that function. One might argue that if a function returns a value, then you should set a variable to that value, i.e. int i = GetRandomInt(); But as a contrived example, suppose I wanted to do this: CycleTushKicker( GetRandomInt()); Instead of stepping into CycleTushKicker to figure out how many lickings my kid gets, I'd just like to know the value as soon as I exit GetRandomInt. Is there a way to get this when using C#?

    Read the article

  • jquery for loop on click image swap

    - by user2939914
    I've created a for loop of images. I would like each image to swap with another image on click individually. Here's the jQuery I've written so far: for ( var i = 1; i < 50; i++) { $('article').append('<div class="ps-block" id="' + i + '"><img src="img/bw/' + i + 'bw.png"></div>'); } $('img').click(function() { var imgid = $(this).attr('id'); $(this).attr("src", "img/color/" + imgid + ".png"); }); I also attempted to use this code inside the for loop after the append, but i ends up returning 50 every time you click since the loop has already ran: $('img[src="img/bw/' + i + 'bw.png"]').click(function() { $(this).attr("src", "img/color/" + this.id + ".png"); }); Thanks!

    Read the article

  • JSF-JSP cancel button returns a number format exception

    - by Barca
    I have a cancel button on a JSF-JSP page. It is handled by a method on the corresponding java class: public String cancel_action() { return "CANCEL"; This is configured in faces-config.xml as following: <navigation-rule> <from-view-id>/page2.jsp</from-view-id> <navigation-case> <from-outcome>CANCEL</from-outcome> <to-view-id>/page1.jsp</to-view-id> </navigation-case> </navigation-rule> Not sure why it is returning a number format exception. Any help will be highly appreciated.

    Read the article

  • variable $base_path is not working

    - by Nidhi Prasad
    I am trying to get the value of base_path variable in PHP (on lamp server) . I have kept the code insider beta_test directory inside www directly. i.e, base path function should return " /beta_test/ " . But it is returning just single slash ( "/" ) . The code that I tried is <script type="text/javascript" src="<?php print base_path(); ?>sites/all/themes/people10/slider/call.js"></script> Expected output is <script type="text/javascript" src="/beta_test/sites/all/themes/people10/slider/call.js"></script> But its giving <script type="text/javascript" src="/sites/all/themes/people10/slider/call.js"></script> I am using php version 5.3.3.Can anyone please help me in getting this issue solved? I am newbie to php and drupal .

    Read the article

  • Run C# code after running all javascript codes

    - by Devi
    I am having a form in which a button is there on click of that button i am calling a javascript function in which i am displaying like 3.. 2.. 1 kind of effect then i am returning true. But after showing 3 only return true is getting executed and the form is getting submitted. How to stop form submitting before running the script. Edit: function jsFun() { timerCount(3); //Calling the Timer Function. } var t; function timerCount(cDown) { if (cDown == 0) { clearTimeout(t); return true; } $('#<%= mainContainer.ClientID %>').html(cDown); cDown = cDown - 1; t = setTimeout('timerCount(' + cDown + ')', 1000); } <asp:Button ID="btnStarts" runat="server" Text="Start" OnClientClick="return jsFun();" OnClick="btn_click" />

    Read the article

  • emacs debugger: how can I step-out, step-over ?

    - by Cheeso
    I don't know why I'm having so much trouble groking the documentation for the elisp debugger. I see it has a commands to "step-into" (d). But for the life of me, I cannot see a step-out or step-over. Can anyone help? If I have this in the Backtrace buffer: Debugger entered--returning value: 5047 line-beginning-position() * c-parse-state() * byte-code("...") * c-guess-basic-syntax() c-show-syntactic-information(nil) call-interactively(c-show-syntactic-information) ...where do I put the cursor, and what key do I type, to step out of the parse-state() fn ? by that I mean, run until that fn returns, and then stop in the debugger again.

    Read the article

  • Most efficient method of generating PNG as HTTP response

    - by awj
    I've built an ASP.NET page whose output stream is a dynamically-generated PNG image containing only text on a transparent background. The text is based upon database IDs contained in the querystring. There will be a limited number of variations. Which one of the following would be the most efficient means of returning the image to the client? Store each variation upon the first generation, and thenceforth retrieve this from the drive. Simply generate the image each time. Cache the output response based upon the querystring.

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >