Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 117/191 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • Sending XML to Servlet from Action Script

    - by John Doe
    I am only getting empty arrays on output. Anyone know what Exactly I'm doing wrong? package myDungeonAccessor; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class myDungeonAccessorServlet extends HttpServlet { private myDungeonAccessor dataAccessor; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here out.println("<html>"); out.println("<head>"); out.println("<title>Servlet myDungeonAccessorServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet myDungeonAccessorServlet at " + request.getContextPath () + "</h1>"); out.println("</body>"); out.println("</html>"); */ } finally { out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); // PrintWriter out = response.getWriter(); System.out.println("yo mom"); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //System.out.println("heppo"); //dataAccessor = new myDungeonAccessor(); System.out.println("Hello"); try { System.out.println("HEADERS: " + request.getHeaderNames()); ObjectInputStream in = new ObjectInputStream(request.getInputStream()); ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); } catch(Exception e) { e.printStackTrace(); } System.out.println("WAZZUP"); byte [] buffer = new byte[4096]; //in.read(buffer); System.out.println("TEST!"); String s = new String(buffer); System.out.println("Update S:" + s); } /** * Returns a short description of the servlet. * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; } }

    Read the article

  • android internal phone storage

    - by John
    how can you retrieve yours phone internal storage from an app? I found memoryinfo, but it seems that returns information on how much memory your currently running tasks. I am trying to get my app to retrieve how much internal phone storage is available.

    Read the article

  • Controlling the print options of a pdf

    - by John Nolan
    I am producing a number of PDFs using either SSRS or using an HTML to PDF component. What I want to do for each document is to set the first page to print to tray 1 and subsequent pages. Is there anyway to do this? System.Drawing.Printing and System.Printing seem like good candidates but they don't seem to be useful for PDFs (i may be wrong). The Adobe sdk doesn't at first glance seem to have that level of granularity either.

    Read the article

  • How do I set streetView in my mapview

    - by John
    I an working on an android project whereby i need to set my map to zoom in and show a more detailed view of my map, like the streets of where i want my coordinates to triangulate. The problem is in Mapview class, setStreetView is deprecated, wat is the alternative? This is how setStreetView looks when i use it. package com.HelloMapView; import java.util.List; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.OverlayItem; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.widget.LinearLayout; public class HelloMapView extends MapActivity { MapView mapview; LinearLayout linearlayout; List<Overlay> mapOverlay; Drawable drawable; HelloItemizedOverlay itemizedOverlay; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mapview=(MapView)findViewById(R.id.mapview); mapview.setBuiltInZoomControls(true); mapview.setStreetView(true); mapOverlay=mapview.getOverlays(); drawable=this.getResources().getDrawable(R.drawable.androidmarker); itemizedOverlay=new HelloItemizedOverlay(drawable); GeoPoint geoPoint=new GeoPoint(19240000,-99120000); OverlayItem overlayitem=new OverlayItem(geoPoint,"",""); itemizedOverlay.addoverlay(overlayitem); mapOverlay.add(itemizedOverlay); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } this does not work it only shows square boxes with no map at all

    Read the article

  • Where is mpx386.6 and start.c in Minix 3.2?

    - by John Bowlinger
    I'm trying to follow along in Operating Systems and Implementation 3rd edition and I'm now at the part in the book where Tanenbaum is discussing bootup and kernel process switching. He keeps referring to these 2 files (mpx386.s, start.c) that are supposedly in a directory called kernel, but I can't seem to find them. In the root directory, when I go to boot/minix/3.2.0/kernel, kernel just seems to be a binary file that is illegible in terminal. There also seems to be a bunch of mod01-mod12 gz binary files as well in the 3.2.0 directory. Am I in the wrong directory, or is there something I need to install and do to read kernel? I would like to follow along with the book to what's on my screen, instead of constantly flipping back and forth. I realize alot of files are completely different from this book published in 2006 and I accept that, but this seems to be a critical juncture of the book and the operating system as a whole. If it's any consolation, I'm running the OS in Virtualbox on a 64-bit Macbook.

    Read the article

  • Good book for learning Bash shell?

    - by John Isaacks
    I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book?

    Read the article

  • Jquery disable link for 5 seconds

    - by John
    I have this code: $('#page-refresh').click( function() { $.ajax({ url: "/page1.php", cache: false, dataType: "html", success: function(data) { $('#pagelist').html(data); } }); return false; }); In this code is it possible that on the ajax success function it disables the #page-refresh click for 5 seconds then re-enable it? Basically if a person clicks the button and this action happens I dont want them to click and run this action again for another 5 seconds. I looked at delay() to unbind the click for this then bind it again but once it unbinded it never allowed me to click the button anymore.

    Read the article

  • Servlet response wrapper has encoding problem

    - by John O
    A servlet response wrapper is being used in a Servlet Filter. The idea is that the response is manipulated, with a 'nonce' value being injected into forms, as part of defence against CSRF attacks. The web app is using UTF-8 everywhere. When the Servlet Filter is absent, no problems. When the filter is added, encoding issues occur. (It seems as if the response is reverting to 8859-1.) The guts of the code : final class CsrfResponseWrapper extends AbstractResponseWrapper { ... byte[] modifyResponse(byte[] aInputResponse){ ... String originalInput = new String(aInputResponse, encoding); String modifiedResult = addHiddenParamToPostedForms(originalInput); result = modifiedResult.getBytes(encoding); ... } ... } As I understand it, the transition between byte-land and String-land should specify an encoding. That is done here, as you can see, in two places. The value of the 'encoding' variable is 'UTF-8'; the alteration of the String itself is standard string manipulation (with a regex), and never specifies an encoding (addHiddenParamToPostedForms). Where am I in error about the encoding? EDIT: Here is the base class (sorry it's rather long): package hirondelle.web4j.security; import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintWriter; /** Abstract Base Class for altering response content. (May be useful in future contexts as well. For now, keep package-private.) */ abstract class AbstractResponseWrapper extends HttpServletResponseWrapper { AbstractResponseWrapper(ServletResponse aServletResponse) throws IOException { super((HttpServletResponse)aServletResponse); fOutputStream = new ModifiedOutputStream(aServletResponse.getOutputStream()); fWriter = new PrintWriter(fOutputStream); } /** Return the modified response. */ abstract byte[] modifyResponse(byte[] aInputResponse); /** Standard servlet method. */ public final ServletOutputStream getOutputStream() { //fLogger.fine("Modified Response : Getting output stream."); if ( fWriterReturned ) { throw new IllegalStateException(); } fOutputStreamReturned = true; return fOutputStream; } /** Standard servlet method. */ public final PrintWriter getWriter() { //fLogger.fine("Modified Response : Getting writer."); if ( fOutputStreamReturned ) { throw new IllegalStateException(); } fWriterReturned = true; return fWriter; } // PRIVATE /* Well-behaved servlets return either an OutputStream or a PrintWriter, but not both. */ private PrintWriter fWriter; private ModifiedOutputStream fOutputStream; /* These items are used to implement conformance to the javadoc for ServletResponse, regarding exceptions being thrown. */ private boolean fWriterReturned; private boolean fOutputStreamReturned; /** Modified low level output stream. */ private class ModifiedOutputStream extends ServletOutputStream { public ModifiedOutputStream(ServletOutputStream aOutputStream) { fServletOutputStream = aOutputStream; fBuffer = new ByteArrayOutputStream(); } /** Must be implemented to make this class concrete. */ public void write(int aByte) { fBuffer.write(aByte); } public void close() throws IOException { if ( !fIsClosed ){ processStream(); fServletOutputStream.close(); fIsClosed = true; } } public void flush() throws IOException { if ( fBuffer.size() != 0 ){ if ( !fIsClosed ) { processStream(); fBuffer = new ByteArrayOutputStream(); } } } /** Perform the core processing, by calling the abstract method. */ public void processStream() throws IOException { fServletOutputStream.write(modifyResponse(fBuffer.toByteArray())); fServletOutputStream.flush(); } // PRIVATE // private ServletOutputStream fServletOutputStream; private ByteArrayOutputStream fBuffer; /** Tracks if this stream has been closed. */ private boolean fIsClosed = false; } }

    Read the article

  • Replace method doesn't work properly

    - by John Smith
    Hello I have a string and when i try to use replace method in for loop it doesn't work String phrase="hello friend"; String[] wordds=phrase.split(" "); String newPhrase="sup friendhello weirdo"; for (int g=0;g<2;g++) { finalPhrase+=newPhrase.replace(wordds[g],"");} } System.out.println(finalPhrase) It prints out "sup hello weirdo" and i expect it to print "sup weirdo". What am i doing wrong?

    Read the article

  • UIAlertView Will not show

    - by John
    I have a program that is requesting a JSON string. I have created a class that contains the connect method below. When the root view is coming up, it does a request to this class and method to load up some data for the root view. When I test the error code (by changing the URL host to 127.0.0.1), I expect the Alert to show. Behavior is that the root view just goes black, and the app aborts with no alert. No errors in debug mode on the console, either. Any thoughts as to this behavior? I've been looking around for hints to this for hours to no avail. Thanks in advance for your help. Note: the conditional for (error) is called, as well as the UIAlertView code. - (NSString *)connect:(NSString *)urlString { NSString *jsonString; UIApplication *app = [UIApplication sharedApplication]; app.networkActivityIndicatorVisible = YES; NSError *error = nil; NSURLResponse *response = nil; NSURL *url = [[NSURL alloc] initWithString:urlString]; NSURLRequest *req = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10]; NSData *_response = [NSURLConnection sendSynchronousRequest: req returningResponse: &response error: &error]; if (error) { /* inform the user that the connection failed */ //AlertWithMessage(@"Connection Failed!", message); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oopsie!" message:@"Unable to connect! Try later, thanks." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; } else { jsonString = [[[NSString alloc] initWithData:_response encoding:NSUTF8StringEncoding] autorelease]; } app.networkActivityIndicatorVisible = NO; [url release]; return jsonString; }

    Read the article

  • Just when I thought my site was working right, it screws up in IE7

    - by John
    I thought I'd done quite well, my site passed XHTML1.0 strict validation and worked flawlessly in IE6 as well as looking fine in IE8 & Chrome. I glibly thought that it it worked in IE6 & 8, IE7 was bound to be OK. But on checking I see one of my has a scrollbar in IE7, the seems about 200% as wide as it should be... the content is fine but you can scroll the whole . 2 separate pages have this issue, a 3rd does not, even though all pages use the same layout template - the main difference on the 2 that break is a floated div. Are there known issues specifically in this area with IE7? Or do I have to embarrass myself by posting a link to the site?

    Read the article

  • Battery drains even with app off screen, could it be Location Services doing it?

    - by John Jorsett
    I run my app, which uses GPS and Bluetooth, then hit the back button so it goes off screen. I verified via LogCat that the app's onDestroy was called. OnDestroy removes the location listeners and shuts down my app's Bluetooth service. I look at the phone 8 hours later and half the battery charge has been consumed, and my app was responsible according the phone's Battery Use screen. If I use the phone's Settings menu to Force Stop the app, this doesn't occur. So my question is: do I need to do something more than remove the listeners to stop Location Services from consuming power? That's the only thing I can think of that would be draining the battery to that degree when the app is supposedly dormant. Here's my onStart() where I turn on the location-related stuff and Bluetooth: @Override public void onStart() { super.onStart(); if(D_GEN) Log.d(TAG, "MainActivity onStart, adding location listeners"); // If BT is not on, request that it be enabled. // setupBluetooth() will then be called during onActivityResult if (!mBluetoothAdapter.isEnabled()) { Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableIntent, REQUEST_ENABLE_BT); // Otherwise, setup the Bluetooth session } else { if (mBluetoothService == null) setupBluetooth(); } // Define listeners that respond to location updates mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_UPDATE_INTERVAL, 0, this); mLocationManager.addGpsStatusListener(this); mLocationManager.addNmeaListener(this); } And here's my onDestroy() where I remove them: public void onDestroy() { super.onDestroy(); if(D_GEN) Log.d(TAG, "MainActivity onDestroy, removing update listeners"); // Remove the location updates if(mLocationManager != null) { mLocationManager.removeUpdates(this); mLocationManager.removeGpsStatusListener(this); mLocationManager.removeNmeaListener(this); } if(D_GEN) Log.d(TAG, "MainActivity onDestroy, finished removing update listeners"); if(D_GEN) Log.d(TAG, "MainActivity onDestroy, stopping Bluetooth"); stopBluetooth(); if(D_GEN) Log.d(TAG, "MainActivity onDestroy finished"); }

    Read the article

  • MySQL: count enumerated values?

    - by John Isaacks
    If my table looks like this: daily_individual_tracking', 'CREATE TABLE `daily_individual_tracking` ( `daily_individual_tracking_id` int(10) unsigned NOT NULL auto_increment, `daily_individual_tracking_date` date NOT NULL default ''0000-00-00'', `sales` enum(''no'',''yes'') NOT NULL COMMENT ''no'', `repairs` enum(''no'',''yes'') NOT NULL COMMENT ''no'', `shipping` enum(''no'',''yes'') NOT NULL COMMENT ''no'', PRIMARY KEY (`daily_individual_tracking_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 basically the fields can be either yes or no. How can I count how many yes's their are for each column over a date range? Thanks!!

    Read the article

  • C++ - Access array (in main) from methods outside main

    - by John Smith
    I have an array in my main class that holds objects that I need to print out for a menu listing. The array is declared and initialized in main. I need to, however, access the same array in a sub-menu function. If I copy the code (for loop that prints out the values) to the sub-menu, nothing is printed (presumably because it can't access the original array and has made a new, blank one). Is there any way (without making the array a global variable) that I can access the array in this sub-menu? Both the main and the sub-menu function are in the same file and the sub-menu is called from main. Maybe to put it more simply, can I use scope resolution to bring me up one 'level' in scope?

    Read the article

  • Is is possible to do an end-run around generics covariance in C# < 4 in this hypothetical situation?

    - by John Feminella
    Suppose I have a small inheritance hierarchy of Animals: public interface IAnimal { string Speak(); } public class Animal : IAnimal { public Animal() {} public string Speak() { return "[Animal] Growl!"; } } public class Ape : IAnimal { public string Speak() { return "[Ape] Rawrrrrrrr!"; } } public class Bat : IAnimal { public string Speak() { return "[Bat] Screeeeeee!"; } } Next, here's an interface offering a way to turn strings into IAnimals. public interface ITransmogrifier<T> where T : IAnimal { T Transmogrify(string s); } And finally, here's one strategy for doing that: public class Transmogrifier<T> : ITransmogrifier<T> where T : IAnimal, new() { public T Transmogrify(string s) { T t = default(T); if (typeof(T).Name == s) t = new T(); return t; } } Now, the question. Is it possible to replace the sections marked [1], [2], and [3] such that this program will compile and run correctly? If you can't do it without touching parts other than [1], [2], and [3], can you still get an IAnimal out of each instance of a Transmogrifier in a collection containing arbitrary implementations of an IAnimal? Can you even form such a collection to begin with? static void Main(string[] args) { var t = new Transmogrifier<Ape>(); Ape a = t.Transmogrify("Ape"); Console.WriteLine(a.Speak()); // Works! // But can we make an arbitrary collection of such animals? var list = new List<Transmogrifier< [1] >>() { // [2] }; // And how about we call Transmogrify() on each one? foreach (/* [3] */ transmogrifier in list) { IAnimal ia = transmogrifier.Transmogrify("Bat"); } } }

    Read the article

  • How can I use the compile time constant __LINE__ in a string?

    - by John
    I can use __LINE__ as a method parameter just fine, but I would like an easy way to use it in a function that uses strings. For instance say I have this: 11 string myTest() 12 { 13 if(!testCondition) 14 return logError("testcondition failed"); 15 } And I want the result of the function to be: "myTest line 14: testcondition failed" How can I write logError? Does it have to be some monstrosity of a macro?

    Read the article

  • Changing A Different Class Display on Hover with Jquery

    - by John K
    Ok, here's what I'm trying to do. I have a DIV box with a child element set with DISPLAY: NONE;. I'm trying to use Jquery so that when the mouse enters the parent DIV box, the child element is made visible, and then hides when the mouse leaves the parent DV. There will be multiple divs on the page with these classes. For some reason it's not working. Any ideas? Here's my code: HTML: <div class="parent"> <span class="handle" style="display: none;">My Handle</span> <p>Child Text</p> </div> Javascript: $(document).ready(function () { $('.parent').mouseenter(function(){ $(this).next('.handle').show(); }); $('.parent').mouseleave(function(){ $(this).next('.handle').hide(); }); })

    Read the article

  • Best way to simulate a domain?

    - by John Isaacks
    I am going to build a website on a test server that will behave differently depending on which domain is used to access it (The real website will have multiple domains pointing to it). But how will I be able to simulate the different domains on the test server?

    Read the article

  • T4 trouble compiling transformation

    - by John Leidegren
    I can't figure this one out. Why doesn't T4 locate the IEnumerable type? I'm using Visual Studio 2010. And I just hope someone knows why? <#@ template debug="true" hostspecific="false" language="C#" #> <#@ assembly name="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #> <#@ import namespace="System" #> <#@ import namespace="System.Data" #> <#@ import namespace="System.Data.SqlClient" #> <#@ output extension=".cs" #> public static class Tables { <# var q = @" SELECT tbl.name 'table', col.name 'column' FROM sys.tables tbl INNER JOIN sys.columns col ON col.object_id = tbl.object_id "; // var source = Execute(q); #> } <#+ static IEnumerable Execute(string cmdText) { using (var conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=t4build;Integrated Security=True;")) { conn.Open(); var cmd = new SqlCommand(cmdText, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { } } } } #> Error 2 Compiling transformation: The type or namespace name 'IEnumerable' could not be found (are you missing a using directive or an assembly reference?) c:\Projects\T4BuildApp\T4BuildApp\TextTemplate1.tt 26 9

    Read the article

  • Tool to generated rotated versions of an image

    - by John
    In sprite-based systems, it's common to fake rotation of a sprite by having many different images, each showing it rotated an extra few degrees. Is there any free tool which will take a single image, and output a single image containing several rotations? It should also ideally let us control how many images are in each row. e.g if I have a 32x32 sprite and I want it rotated at 10 degree intervals, the tool might generate a 320x32 file or a 160x64 file

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >