Search Results

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

Page 94/1913 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • php most memory efficient way to return files

    - by bumperbox
    so i have a bunch of files, some can be up to 30-40mb and i want to use php to handle security of the files, so i can control who has access to them that means i have a script sort of like this rough example $has_permission = check_database_for_permission($user, filename); if ($has_permission) { header('Content-Type: image/jpeg'); readfile ($filename); exit; } else { // return 401 error } i would hate for every request to load the full file into memory, as it would soon chew up all the memory on my server with a few simultaneous requests so a couple of questions is readfile the most memory efficient way of doing this? is there some better method of achieving the same outcome, that i am overlooking? server: apache/php5 thanks

    Read the article

  • Return to the same view using ModelAndview in Spring MVC framework

    - by ria
    I have a page with a link. On clicking the link a page opens up in a separate window. This new page has a form. On submitting this form, some operation takes place at the server. The result of which needs to be redirected to the same page. However after the operation on using the following: return new ModelAndView("newUser"); //This view "newUser" actually maps to the popped up window. A similar new window again pops up and the message gets displayed on this new page. How to go about this?

    Read the article

  • Not all Code Paths return a Value Issue

    - by jorame
    I have this peace of code in a class(DataBase) and I'm getting "Not all Paths return a Value". Any help will be really appreciated. public static DataSet DELETE_PDT(String rowid) { SqlConnection con = new SqlConnection(); SqlCommand cmd = new SqlCommand("sp_DELETE_PDT", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rowid", SqlDbType.Int).Value = rowid; con.ConnectionString = ConfigurationManager.ConnectionStrings["WMS"].ConnectionString; try { con.Open(); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } catch (Exception ex) { throw new Exception("Error while deleting record. Please contact your System Administrator", ex); } }

    Read the article

  • Get a return value from a screen'd command

    - by AndyMac
    I'm running a process in a screen (on Ubuntu 13.10, if it matters). I can execute a command within that screen with: screen -p 0 -X eval 'stuff \"$command\"\015' I'm not 100% sure what this command is doing to begin with, though it's functioning correctly. The reason behind it is I'm running a Minecraft server (still) and this screens in to the correct screen, and throws the command on the running command line. So that's good, so far. But what I'd like is to be able to run this command with a return value. So for example, if I were to run a "list" command, it'd tell me how many people and who is online, but I need to capture that output and put it somewhere. Anyone know of a way to accomplish this? I can't tell the minecraft server command line to redirect the output somewhere else since it doesn't have direct command line access, so the only way I could do this would be to grab all output of the screen while I'm connected ... but I'm not sure if that's possible.

    Read the article

  • Old functions return 'undefined' error once I add a jquery reference

    - by Lapa
    Disregard this question: I've simply confused <script src="..."></script> tag and <script> [some functions] </scipt> tags. I have this function function OnLoad() { ShowHideConfirmAnswers(); return true; } triggered by onload event: <body onload=OnLoad()> It works fine until I add src="jquery-1.4.2.js" to the script element. From this moment I get "OnLoad is not defined" error, and the same happens to every other javascript function.

    Read the article

  • getElementById does return null

    - by pbcoder
    I have following function: $('canvas').createWindow('xyz', 500, 600); And js-code behind is: var $ = function(element) { if (this.constructor !== $) { return new $(element); } alert(element); var windowObj = document.getElementById(element); this.createWindow = function(src, width, height) { if(width != "" && height != "") { windowWidth = windowObj.style.width = width + 'px'; windowHeight = windowObj.style.height = height + 'px'; } }; }; But the problem is that JS says windowObj is null, alert(element) works fine! Thanks for your help!

    Read the article

  • Can a method return an NSRange?

    - by Dan Donaldson
    I have a method that returns an NSRange. When I call this method from outside the class I get a compile error. NSRange tmpRange; tmpRange = [phrase rangeInString:searchString forString:theLetter goingForward:YES]; return tmpRange.location == -1; in the .h file: #import <Foundation/Foundation.h> @interface Phrase : NSObject { } - (NSRange) rangeInString:(NSString *) tgt forString:(NSString *) find goingForward:(BOOL) fwd; @end This method is called within the Phrase object by other methods without problems. The compiler says 'incompatible types in assignment'. Can anyone explain this to me? I assume it has to do with returning an NSRange/struct type value generated outside the object, but I don't know why it works in one place and not the other.

    Read the article

  • only return random number when it is unique

    - by phil
    My brain is melting today and i cannot think how to do this simple bit of code. numberList is a string of numbers seperated by commas like '2, 34, 10' etc.. when i request a random number i need to check if the string has the number, if it does i want to keep requesting a random number until the random number is definitely not in the string. i cant think what kind of loop i would do to get this to work: Random r = new Random(); public int RandomPos(int max) { int i; do { i = r.Next(max) + 1; } while (!numberList.Contains(i.ToString())); return i; }

    Read the article

  • how to return value from groovy to java

    - by Sid
    Hi I am very new to groovy and having trouble with some parts. I have a jsp page tied to a servlet that runs groovy scripts. I am able to get to the groovy script from the servlet. But after the script runs how do I return the response from the groovy script back to the servlet to be displayed in the jsp page? My java servlet code is as follows: File file = new File("TestScript.groovy"); ClassLoader parent = getClass().getClassLoader(); GroovyClassLoader loader = new GroovyClassLoader(parent); Class groovyClass = loader.parseClass(file); Object[] args = {}; GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); groovyObject.invokeMethod("runTest", args);

    Read the article

  • pthread_exit return value

    - by Manty
    This is surprising for me. void * thread_func(void *arg) { pthread_exit(&ret); } int main(void) { pthread_t thr; int *exit_status; pthread_create(&thr, NULL, thread_func, NULL); sleep(2); pthread_join(thr, (void **)&exit_status); printf("value of exit status - %d\n", *exit_status); ret = 20; pthread_join(thr, (void **)&exit_status); printf("value of exit status - %d\n", *exit_status); return 0; } The output is value of exit status - 50 value of exit status - 20 I was expecting both the times the exit_status would be the actual exit value(50 in my case) of the thread. Instead it is just returning the value of the global variable which I used for pthread_exit. Is it not a bug?

    Read the article

  • MYSQL: COUNT with GROUP BY, LEFT JOIN and WHERE clause doesn't return zero values

    - by Paul Norman
    Hi guys, thanks in advance for any help on this topic! I'm sure this has a very simply answer, but I can't seem to find it (not sure what to search on!). A standard count / group by query may look like this: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` GROUP BY `t1`.`any_col` and this works as expected, returning 0 if no rows are found. So does: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 However: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 GROUP BY `t1`.`any_col` only works if there is at least one row in table_1 and fails miserably returning an empty result set if there are zero rows. I would really like this to return 0! Anyone enlighten me on this? Beer can be provided in exchange if you are in London ;-)

    Read the article

  • Return Empty String as NULL

    - by Daniel
    I have a listbox select and I want when the user selects null for the empty string it produces to pull the nulls from the SQL table. Here's what I have now. Blank strings return nothing because there are no empty fields in the table. SELECT * FROM dbo.Table WHERE ID = " & TextBox2.Text & " and And Field1 IN (" & Msg1 & ") How do I code that?

    Read the article

  • (Action<T>).Name does not return expected values

    - by Tomas Lycken
    I have the following method (used to generate friendly error messages in unit tests): protected string MethodName<TTestedType>(Action<TTestedType> call) { return string.Format("{0}.{1}", typeof(TTestedType).FullName, call.Method.Name); } But when I call it as follows, I don't get the expected results: var nm = MethodName<MyController>(ctrl => ctrl.Create()); After running this code, nm contains "<Create_CreateShowsView>b__8", and not (as expected) "Create". How should I change the code to obtain the expected result?

    Read the article

  • Why is the operation address incremented by two?

    - by Gavin Jones
    I am looking at a Javascript emulator of a NES to try and understand how it works. On this line: addr = this.load(opaddr+2); The opcode is incremented by two. However, the documentation (see appendix E) I'm reading says: Zero page addressing uses a single operand which serves as a pointer to an address in zero page ($0000-$00FF) where the data to be operated on can be found. By using zero page addressing, only one byte is needed for the operand, so the instruction is shorter and, therefore, faster to execute than with addressing modes which take two operands. An example of a zero page instruction is AND $12. So if the operand's argument is only one byte, shouldn't it appear directly after it, and be + 1 instead of + 2? Why +2? This is how I think it works, which may be incorrect. Suppose our memory looks like: ------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | <- index ------------------------- | a | b | c | d | e | f | <- memory ------------------------- ^ \ PC and our PC is 0, pointing to a. For this cycle, we say that the opcode: var pc= 0; //for example's sake var opcode= memory[pc]; //a So shouldn't the first operand be the next slot, i.e. b? var first_operand = memory[pc + 1]; //b

    Read the article

  • Function to get a string and return same after processing in C

    - by C0de_Hard
    I am working on a code which requires a function. This function gets a string as input and returns a string. What I have planned so far is to get a str[], remove all $'s and spaces, and store this in another string which is returned later: char *getstring(char str[]) { int i=0; char rtn[255]; while (i<strlen(str)) { if (str[i] != " " || str[i] != "$" ) rtn[i] = str[i]; else rtn[i] = ''; } return str; } I dont feel like this will work. Any ideas?? :-S

    Read the article

  • How to return result set based on other rows

    - by understack
    I've 2 tables - packages and items. Items table contains all items belonging to the packages along with location information. Like this: Packages table id, name, type(enum{general,special}) 1, name1, general 2, name2, special Items table id, package_id, location 1, 1, America 2, 1, Africa 3, 1, Europe 4, 2, Europe Question: I want to find all 'special' packages belonging to a location and if no special package is found then it should return 'general' packages belonging to same location. So, for 'Europe' : package 2 should be returned since it is special package (Though package 1 also belongs to Europe but not required since its a general package) for 'America' : package 1 should be returned since there are no special packages

    Read the article

  • why some mp3s on mime_content_type return application/octet-stream

    - by robertdd
    why on some mp3s file when i call mime_content_type($mp3_file_path) it's return application/octet-stream? i have this: if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $image = getimagesize($tempFile); $mp3_mimes = array('audio/mpeg', 'audio/x-mpeg', 'audio/mp3', 'audio/x-mp3', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg', 'audio/x-mpegaudio'); if (in_array(mime_content_type($tempFile), $mp3_mimes)) { echo json_encode("mp3"); } elseif ($image['mime']=='image/jpeg') { echo json_encode("jpg"); } else{ echo json_encode("error"); } }

    Read the article

  • Pass, edit and return variable in C

    - by Supertecnoboff
    I am new to C programming and recently I have been playing around with functions in C programming. But I have a simple problem: Basically I want to pass an integer to a function, have the function edit it and then pass back the integer to the main function. I am working on this but it isn't working..... Here is my code: int update_SEG_values(int DIGIT_1, int DIGIT_2) { // How many tens in the "TEMP_COUNT". DIGIT_2 = ((TEMP_COUNT) / 10); // How much is left for us to display. TEMP_COUNT = TEMP_COUNT - ((DIGIT_2) * 10); // How many ones. DIGIT_1 = ((TEMP_COUNT) / 1); return(DIGIT_1, DIGIT_2); } What am I doing wrong here?

    Read the article

  • Get all Methods with a given return type

    - by Aren B
    Is this code wrong? It's just not returning anything: public IEnumerable<string> GetMethodsOfReturnType(Type cls, Type ret) { var methods = cls.GetMethods(BindingFlags.NonPublic); var retMethods = methods.Where(m => m.ReturnType.IsSubclassOf(ret)) .Select(m => m.Name); return retMethods; } It's returning an empty enumerator. Note: I'm calling it on a ASP.NET MVC Controller looking for ActionResults GetMethodsOfReturnType(typeof(ProductsController), typeof(ActionResult));

    Read the article

  • Javascript: Inherit method from base class and return the subclass's private variable

    - by marisbest2
    I have the following BaseClass defined: function BaseClass (arg1,arg2,arg3) { //constructor code here then - var privateVar = 7500; this.getPrivateVar = function() { return privateVar; }; } I want to have the following subclass which allows changing privateVar like so: function SubClass (arg1,arg2,arg3,privateVar) { //constructor code here then - var privateVar = privateVar; } SubClass.prototype = new BaseClass(); Now I want SubClass to inherit the getPrivateVar method. However, when I try this, it always returns 7500 which is the value in the BaseClass and not the value of privateVar. In other words, is it possible to inherit a BaseClass's public methods but have any references in them refer to the SubClass's properties? And how would I do that?

    Read the article

  • Return Total Rows from a table.

    - by theband
    while($row=mysql_fetch_array($result)) { $output .= "<Reports>"; $output .= "<ProjectName>"; $output .= $row['ProjectName']; $output .= "</ProjectName>"; $output .= "<ProjectCount>"; $output .= $row=mysql_fetch_array($result) $output .= "</ProjectCount>"; $output .= "</Reports>"; } Can i return the number of rows in table like this, i am getting XML markup error.

    Read the article

  • Java application return codes

    - by doele
    I have a Java program that processes one file at a time. This Java program is called from a wrapper script which logs the return code from the Java program. There are 2 types of errors. Expected errors and unexpected errors. In both cases I just need to log them. My wrapper knows about 3 different states. 0-OK, 1-PROCESSING_FAILED, 2- ERROR. Is this a valid approach? Here is my approach: enum ReturnCodes {OK,PROCESSING_FAILED,ERROR}; public static void main(String[] args) { ... proc.processMyFile(); ... System.exit(ReturnCodes.OK.ordinal()); } catch (Throwable t) { ... System.exit(ReturnCodes.ERROR.ordinal()); } private void processMyFile() { try { ... }catch( ExpectedException e) { ... System.exit(ReturnCodes.PROCESSING_FAILED.ordinal()); } }

    Read the article

  • read after lseek always return 0

    - by Wins
    I'm having an issue reading byte in file after performing lseek long cur_position = lseek(fd, length * -1, SEEK_CUR ); // Rewind file reading by length bytes. printf("cur_position: %i\n", cur_position); int num_byte = read(fd, &byte, 1); printf("num_byte = %i\n", num_byte); With the initial variable length set to 34, the above code would produce cur_position 5 (so there are definitely at least 34 bytes after the lseek function returns), but the variable num_byte returned from function read always returns 0 even though there are still more bytes to read. Does anyone know the reason num_byte always return 0 or do I make mistake in the above code? Just for information, the above code was run on the following machine $ uname -srvpio Linux 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 GNU/Linux

    Read the article

  • JQuery mobile handling links (return false)

    - by shinax
    I'm planning on using JQM to make a simple mobile web app, and I'm having problems getting this simple functionality to work: when I click on some links (not all of them), I want to be able to first process some data, and then depending on that outcome, sometimes continue the link action (I like the whole transitions and ajax things), and sometimes don't. The important part is that I want to preserve the normal JQMobile transitions and stuff for the links, just sometimes prevent them (for example for validation and things like that). I've tried with: return false, preventDefault (and in combination with stopPropagation), and data-ajax="false", and none hav worked, they all redirect. Could somebody tell me the correct way to to this in JQMobile? Just in case it's important: I'm using anchor links, using this to test. Thank you in advance, Jennifer.

    Read the article

  • Connected host failed to respond (internal NAT address)

    - by MostRandom
    I'm writing my first C# web application that connects to an XML based service. It requires that I present a certificate and feed the XML stream. It seems to authenticate properly but then it gives the following error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.1.10.4:3128 The funny thing is that I'm not on a proxy or anything like that. I'm connecting directly to the internet. At one point I we did use a proxy that with internal NAT address. So my question is: Does Visual Studio have some sort of default proxy setting that I need to change? This IP is no longer used for anything, so I know that I don't need to use any proxy authentication code. using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Net; using System.Security.Cryptography.X509Certificates; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Uri requestURI = new Uri("*site omitted*"); //Create the Request Object HttpWebRequest pageRequest = (HttpWebRequest)WebRequest.Create(requestURI); //After installing the cert on the server export a client cert to the working directory as Deluxe.cer string certFile = "*certificate omitted*"; X509Certificate cert = X509Certificate.CreateFromCertFile(certFile); //Pull in your Data, if it is from an external xml as below or create an xml string with variables if a dynamic post is required. string xmlPath = "*XML omitted*"; System.Xml.XmlDocument passXML = new System.Xml.XmlDocument(); passXML.Load(xmlPath); //XML String with the data needed to pass string postData = passXML.OuterXml; //Set the Request Object parameters pageRequest.ContentType = "application/x-www-form-urlencoded"; pageRequest.Method = "POST"; pageRequest.AllowWriteStreamBuffering = false; pageRequest.AllowAutoRedirect = false; pageRequest.ClientCertificates.Add(cert); postData = "xml_data=" + Server.UrlEncode(postData); pageRequest.ContentLength = postData.Length; //Create the Post Stream Object System.IO.StreamWriter postStream = new System.IO.StreamWriter(pageRequest.GetRequestStream()); //Write the data to the post stream postStream.Write(postData); postStream.Flush(); postStream.Close(); //Set the Response Object HttpWebResponse postResponse = (HttpWebResponse)pageRequest.GetResponse();

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >