Search Results

Search found 4656 results on 187 pages for 'sleepy john'.

Page 113/187 | < Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >

  • How to understand existing projects

    - by John
    Hi. I am a trainee developer and have been writing .NET applications for about a year now. Most of the work I have done has involved building new applications (mainly web apps) from scratch and I have been given more or less full control over the software design. This has been a great experience however, as a trainee developer my confidence about whether the approaches I have taken are the best is minimal. Ideally I would love to collaborate with more experienced developers (I find this the best was I learn) however in the company I work for developers tend to work in isolation (a great shame for me). Recently I decided that a good way to learn more about how experienced developers approach their design might be to explore some open source projects. I found myself a little overwhelmed by the projects I looked at. With my level of experience it was hard to understand the body of code I faced. My question is slight fuzzy one. How do developers approach the task of understanding a new medium to large scale project. I found myself pouring over lots of code and struggling to see the wood for the trees. At any one time I felt that I could understand a small portion of the system but not see how its all fits together. Do others get this same feeling? If so what approaches do you take to understanding the project? Do you have any other advice about how to learn design best practices? Any advice will be very much appreciated. Thank you.

    Read the article

  • PHP / Windows - Opendir() fails opening subdirectories within symbolic linked directories

    - by John Himmelman
    Does anyone know a solution to this problem? I'm unable to open a subdirectory within a symboliclink'd directory. I've confirmed that the paths are correct (even copy & pasted the path into explorer, which parsed it fine). This is a strange, annoying, bug :|. Example: C:\folder\symbolic_link\dir1\dir2 - opening dir2 fails. C:\folder\symbolic_link\dir1 - works C:\folder\real_directory\dir1\dir2 - works C:\folder\real_directory\dir1 - works

    Read the article

  • When to delete newly deprecated code?

    - by John
    I spent a month writing an elaborate payment system that handles both credit card payments and electronic fund transfers. My work was used on production server for about a month. I was told recently by the client that he no longer wants to use the electronic fund transfer feature. Because the way I had to interface and communicate with the credit card gateway is drastically different from the electronic fund transfer api (eg. the cc company gives transaction responses immediately after an http request, while the eft company gives transaction responses 5 business days after an http request), I spent a lot of time writing my own API to abstract common function calls like function payment(amount, pay_method,pay_freq) function updateRecurringSchedule(user_id,new_schedule) etc.. Now that the client wants to abandon the EFT feature, all my work for this abstracted payments API is obsolete. I'm deliberating over whether I should scrap my work. Here's my pro vs. con for scrapping it now: PRO 1: Eliminate code bloat PRO 2: New developers do not need to learn MY API. They only need to read the CC company's API PRO 3: Because the EFT company did not handle recurring payment schedules, refunds, and validation, I wrote my own application to do it. Although the CC company's API permitted this functionality, I opted to use mine instead so that I could streamline my code. now that EFT is out of the picture, I can delete all this confusing code and just rely on the CC company's sytsem to manage recurring billing, payment schedules, refunds, validations etc... CON 1: Although I can just delete the EFT code, it still takes time to remove the entire framework consolidates different payment systems. CON 2: with regards to PRO 3, it takes time to build functionality that integrates the payment system more closely with the CC company. CON 3: I feel insecure deleting all this work. I don't think I'll ever use it again. But, for some inexplicable reason, I just don't feel comfortable deleting this work "right now". So my question is, should I delete one month's worth recent development? If yes, should I do it immediately or wait X amount of time before doing so?

    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

  • Picking apples off a tree

    - by John Retallack
    I have the following problem: I am given a tree with N apples, for each apple I am given it's weight and height. I can pick apples up to a given height H, each time I pick an apple the height of every apple is increased with U. I have to find out the maximum weight of apples I can pick. 1 = N = 100000 0 < {H, U, apples' weight and height, maximum weight} < 231 Example: N=4 H=100 U=10 height weight 82 30 91 10 93 5 94 15 The answer is 45: first pick the apple with the weight of 15 then the one with the weight of 30. Could someone help me approach this problem?

    Read the article

  • c++ global operator not playing well with template class

    - by John
    ok, i found some similar posts on stackoverflow, but I couldn't find any that pertained to my exact situation and I was confused with some of the answers given. Ok, so here is my problem: I have a template matrix class as follows: template <typename T, size_t ROWS, size_t COLS> class Matrix { public: template<typename, size_t, size_t> friend class Matrix; Matrix( T init = T() ) : _matrix(ROWS, vector<T>(COLS, init)) { /*for( int i = 0; i < ROWS; i++ ) { _matrix[i] = new vector<T>( COLS, init ); }*/ } Matrix<T, ROWS, COLS> & operator+=( const T & value ) { for( vector<T>::size_type i = 0; i < this->_matrix.size(); i++ ) { for( vector<T>::size_type j = 0; j < this->_matrix[i].size(); j++ ) { this->_matrix[i][j] += value; } } return *this; } private: vector< vector<T> > _matrix; }; and I have the following global function template: template<typename T, size_t ROWS, size_t COLS> Matrix<T, ROWS, COLS> operator+( const Matrix<T, ROWS, COLS> & lhs, const Matrix<T, ROWS, COLS> & rhs ) { Matrix<T, ROWS, COLS> returnValue = lhs; return returnValue += lhs; } To me, this seems to be right. However, when I try to compile the code, I get the following error (thrown from the operator+ function): binary '+=' : no operator found which takes a right-hand operand of type 'const matrix::Matrix<T,ROWS,COLS>' (or there is no acceptable conversion) I can't figure out what to make of this. Any help if greatly appreciated!

    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

  • What is Restful Routing?

    - by John Baker
    I have been searching pretty hard for info out on the net to explain exactly what Restful routing is but I haven't had any success. There are a lot of resources but not a who lot make sense to me. I'm familiar with Ruby On Rails's routing system and well as how Code Igniter and PhpCake route things but is there more to it than having a centralized location where you give out routes based on a directory structure? Like this: controller/action/id/ Admin/editUser/22 I'd appreciate any help with this, it's had me baffled for months. I just thought of putting it on SO. Thanks

    Read the article

  • How to convert Xml files to Text Files

    - by John
    Hi all, I have around 8000 xml files that needs to be converted into text files. The text file must contain title, description and keywords of the xml file without the tags and removing other elements and attributes as well. In other words, i need to create 8000 text files containing the title,description and keywords of the xml file. I need codings for this to be done systematically. Any help would be greatly appreciated. Thanks in advance.

    Read the article

  • Can I have a CASE statement within a WHILE loop?

    - by John
    This is what I'm doing: while (@counter < 3 and @newBalance >0) begin CASE when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee) when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee) END @counter = @counter +1 end I get this error: Incorrect syntax near the keyword 'CASE'. No idea why. Please help!

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • How to add value to second column using wxListCtrl in wxWidgets (C++ code)??

    - by azm882
    I've following code: int column_width = 100; long indx1 = alist-InsertColumn(0, L"User Name", wxLIST_FORMAT_LEFT, column_width); long indx2 = alist-InsertColumn(1, L"User Id", wxLIST_FORMAT_LEFT, column_width); long itemIndex1 = alist-InsertItem(indx1, L"John Smith", -1); alist-SetItem(indx1, 1, L"jsmith"); I expect to see two columns with User Name and User Id as heading with "My Name" and "My Id" as values on the first row. Instead I only see "John Smith" under column User Name but nothing under User ID column. Here is a link to the snapshot showing the result: http://drop.io/agtyt6s Thanks!

    Read the article

  • Advantage to parsing Excel Spreadsheet data vs. CSV?

    - by john
    I have tabulated data in an Excel spreadsheet (file size will likely never be larger than 1 mb). I want to use PHP to parse the data and insert in to a MySQL database. Is there any advantage to keeping the file as an .xls/.xlsx and parsing it using a PHP Excel Parsing Library? If so, what are some good libraries to use? Obviuously, I can save the .xls/.xlsx as a CSV and handle the file that way. Thanks!

    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

  • 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

  • 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

< Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >