Search Results

Search found 39 results on 2 pages for 'filenotfound'.

Page 1/2 | 1 2  | Next Page >

  • Android - Audio recorder FileNotFound

    - by david
    Hi, I'm trying to record audio this.recorder = new android.media.MediaRecorder(); this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC); this.recorder.setOutputFormat(android.media.MediaRecorder.OutputFormat.DEFAULT); this.recorder.setAudioEncoder(android.media.MediaRecorder.AudioEncoder.DEFAULT); this.recorder.setOutputFile("pruebaAudioRecorder.mp4"); this.recorder.prepare(); this.recorder.start(); but when i call prepare method throws the FileNotFound exception. Should I create the file before prepare method? something like new File(...) If so, which should be the file path? thx a lot.

    Read the article

  • FileNotFound exception when trying to write to a file

    - by Chris Knight
    OK, I'm feeling like this should be easy but am obviously missing something fundamental to file writing in Java. I have this: File someFile = new File("someDirA/someDirB/someDirC/filename.txt"); and I just want to write to the file. However, while someDirA exists, someDirB (and therefore someDirC and filename.txt) do not exist. Doing this: BufferedWriter writer = new BufferedWriter(new FileWriter(someFile)); throws a FileNotFoundException. Well, er, no kidding. I'm trying to create it after all. Do I need to break up the file path into components, create the directories and then create the file before instantiating the FileWriter object?

    Read the article

  • FileNotFound Exception when using TestDriven.NET and NUnit

    - by Quang Anh
    I'm Writing a simple pong game in C# and XNA 4.0 to learn unit testing. The tools used are TestDriven.NET and NUnit, all newest versions. The problem is, if I test the code with VS2010 internal debugger, everything runs fine, but when I use "Run Test(s)" from menu, the application chokes with error: Test 'WindowsGame1.Game1.TestGameMenu' failed: Microsoft.Xna.Framework.Content.ContentLoadException : Error loading "SpaceBackground". File not found. ----> System.IO.FileNotFoundException : Error loading "Content\SpaceBackground.xnb". File not found. (some more below...) So it stops when the first textre is going to be loaded. What's going on? If you want to check the code out, download it here http://www.mediafire.com/?qwnkmyqheum

    Read the article

  • FileNotFound exception

    - by Pratik
    I am trying to read a file in a servlet. I am using eclipse IDE. I get a FileNotFoundException if I provide relative file name. List<String> ls=new ArrayList<String>(); Scanner input = new Scanner(new File("Input.txt")); while(input.hasNextLine()) { ls.add(input.nextLine()); } The same code works if I put the absolute path like this: Scanner input = new Scanner(new File("F:/Spring and other stuff/AjaxDemo/src/com/pdd/ajax/Input.txt")); The Java file and text file are there in the same folder. Does it searches text file in some other folder ?

    Read the article

  • Java swing app can't find image

    - by KáGé
    Hello, I'm making a torpedo game for school in java with swing gui, please see the zipped source HERE. I use custom button icons and mouse cursors of images stored in the /bin/resource/graphics/default folder's subfolders, where the root folder is the program's root folder (it will be the root in the final .jar as well I suppose) which apart from "bin" contains a "main" folder with all the classes. The relative path of the resources is stored in MapStruct.java's shipPath and mapPath variables. Now Battlefield.java's PutPanel class finds them all right and sets up its buttons' icons fine, but every other class fail to get their icons, e.g. Table.java's setCursor, which should set the mouse cursor for all its elements for the selected ship's image or Field.java's this.button.setIcon(icon); in the constructor, which should set the icon for the buttons of the "water". I watched with debug what happens, and the images stay null after loading, though the paths seem to be correct. I've also tried to write a test file in the image folder but the method returns a filenotfound exception. I've tried to get the path of the class to see if it runs from the supposed place and it seems it does, so I really can't find the problem now. Could anyone please help me? Thank you.

    Read the article

  • Where exactly should i add crossdomain.xml file?

    - by SpikETidE
    Hi everyone... i am trying to create a internet radio.... I use icecast2 for streaming..... edcast plugin with winamp to send the music to icecast... and the xspf web music player (http://musicplayer.sourceforge.net/) to connect the user to the icecast server and play the music.... The setup works great and i can broadcast and receive on the local network i use to test the radio.. using xampp... Now the icecast broadcasts online from a windows server with the ip address say xx.xx.xxx.xxx The webpage in which the flash player is embedded is uploaded to www.xyz.com/images/radio This domain has the same ip address from where the icecast server runs. Now when i run the webpage to connect to the radio with the flash player, i get the error in firebug as "xx.xx.xxx.xxx:8000/crossdomain.xml 404 NOT FOUND" But i have created a crossdomain.xml file in the root of the xx.xx.xxx.xxx server... Still it doesn't recognize the file... Can anyone tell me where exactly i should create the file for my setting...??? Thanks a lot in advance.....

    Read the article

  • Is it possible to capture a "file not found" from another process and then return a file to that pro

    - by Neil N
    I have a legacy application that looks for files in a directory. It does not handle missing files very well. What I want to do is "capture" the file not found errors, and send another file back to the calling app instead. Similar to how you could handle a 404 error on a webserver and return something based on what the requested URL was, except on the local file system. Is this possible? And more preferably, is it possible in .Net?

    Read the article

  • Excel VBA File not Found

    - by Brett
    During development of some Excel vba code about every other iteration where I go in and add some code then save the file, the next time I open the thing (it is automatically set to run the code on open) I get a spurious "File not Found" error. To fix it I copy all the code- modules and classes plus the startup code, to a fresh blank excel file save it and it runs fine. This happens in both Excel 2003 and 2007. What is happening here?

    Read the article

  • Failed to create feature receiver object from assembly/FileNotFound...

    - by harshvardhan
    During solution deployments & Feature activation, I am facing an on/off issue where the system is unable to find & load the FeatureReceiver class. Mostly it is file not found exception (even though the assembly is there in the GAC). I checked over the net and this seems it a common issue with solutions (wsp) packaging DLL to be GACed. (But, no one has any clue or solution!) What is the recommendation and guideline to fix this issue? We are setting the flag to reset IIS in my solution definition - but that does not seem to help. The issue is more prevalent in multi-M farms. Thanks

    Read the article

  • Counting entries in a list of dictionaries: for loop vs. list comprehension with map(itemgetter)

    - by Dennis Williamson
    In a Python program I'm writing I've compared using a for loop and increment variables versus list comprehension with map(itemgetter) and len() when counting entries in dictionaries which are in a list. It takes the same time using a each method. Am I doing something wrong or is there a better approach? Here is a greatly simplified and shortened data structure: list = [ {'key1': True, 'dontcare': False, 'ignoreme': False, 'key2': True, 'filenotfound': 'biscuits and gravy'}, {'key1': False, 'dontcare': False, 'ignoreme': False, 'key2': True, 'filenotfound': 'peaches and cream'}, {'key1': True, 'dontcare': False, 'ignoreme': False, 'key2': False, 'filenotfound': 'Abbott and Costello'}, {'key1': False, 'dontcare': False, 'ignoreme': True, 'key2': False, 'filenotfound': 'over and under'}, {'key1': True, 'dontcare': True, 'ignoreme': False, 'key2': True, 'filenotfound': 'Scotch and... well... neat, thanks'} ] Here is the for loop version: #!/usr/bin/env python # Python 2.6 # count the entries where key1 is True # keep a separate count for the subset that also have key2 True key1 = key2 = 0 for dictionary in list: if dictionary["key1"]: key1 += 1 if dictionary["key2"]: key2 += 1 print "Counts: key1: " + str(key1) + ", subset key2: " + str(key2) Output for the data above: Counts: key1: 3, subset key2: 2 Here is the other, perhaps more Pythonic, version: #!/usr/bin/env python # Python 2.6 # count the entries where key1 is True # keep a separate count for the subset that also have key2 True from operator import itemgetter KEY1 = 0 KEY2 = 1 getentries = itemgetter("key1", "key2") entries = map(getentries, list) key1 = len([x for x in entries if x[KEY1]]) key2 = len([x for x in entries if x[KEY1] and x[KEY2]]) print "Counts: key1: " + str(key1) + ", subset key2: " + str(key2) Output for the data above (same as before): Counts: key1: 3, subset key2: 2 I'm a tiny bit surprised these take the same amount of time. I wonder if there's something faster. I'm sure I'm overlooking something simple. One alternative I've considered is loading the data into a database and doing SQL queries, but the data doesn't need to persist and I'd have to profile the overhead of the data transfer, etc., and a database may not always be available. I have no control over the original form of the data. The code above is not going for style points.

    Read the article

  • Exception Handling And Other Contentious Political Topics

    - by Justin Jones
    So about three years ago, around the time of my last blog post, I promised a friend I would write this post. Keeping promises is a good thing, and this is my first step towards easing back into regular blogging. I fully expect him to return from Pennsylvania to buy me a beer over this. However, it’s been an… ahem… eventful three years or so, and blogging, unfortunately, got pushed to the back burner on my priority list, along with a few other career minded activities. Now that the personal drama of the past three years is more or less resolved, it’s time to put a few things back on the front burner. What I consider to be proper exception handling practices is relatively well known these days. There are plenty of blog posts out there already on this topic which more or less echo my opinions on this topic. I’ll try to include a few links at the bottom of the post. Several years ago I had an argument with a co-worker who posited that exceptions should be caught at every level and logged. This might seem like sanity on the surface, but the resulting error log looked something like this: Error: System.SomeException Followed by small stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace. Error: System.SomeException Followed by slightly bigger stack trace.   These were all the same exception. The problem with this approach is that the error log, if you run any kind of analytics on in, becomes skewed depending on how far up the stack trace your exception was thrown. To mitigate this problem, we came up with the concept of the “PreLoggedException”. Basically, we would log the exception at the very top level and subsequently throw the exception back up the stack encapsulated in this pre-logged type, which our logging system knew to ignore. Now the error log looked like this: Error: System.SomeException Followed by small stack trace. Much cleaner, right? Well, there’s still a problem. When your exception happens in production and you go about trying to figure out what happened, you’ve lost more or less all context for where and how this exception was thrown, because all you really know is what method it was thrown in, but really nothing about who was calling the method or why. What gives you this clue is the entire stack trace, which we’re losing here. I believe that was further mitigated by having the logging system pull a system stack trace and add it to the log entry, but what you’re actually getting is the stack for how you got to the logging code. You’re still losing context about the actual error. Not to mention you’re executing a whole slew of catch blocks which are sloooooooowwwww……… In other words, we started with a bad idea and kept band-aiding it until it didn’t suck quite so bad. When I argued for not catching exceptions at every level but rather catching them following a certain set of rules, my co-worker warned me “do yourself a favor, never express that view in any future interviews.” I suppose this is my ultimate dismissal of that advice, but I’m not too worried. My approach for exception handling follows three basic rules: Only catch an exception if 1. You can do something about it. 2. You can add useful information to it. 3. You’re at an application boundary. Here’s what that means: 1. Only catch an exception if you can do something about it. We’ll start with a trivial example of a login system that uses a file. Please, never actually do this in production code, it’s just concocted example. So if our code goes to open a file and the file isn’t there, we get a FileNotFound exception. If the calling code doesn’t know what to do with this, it should bubble up. However, if we know how to create the file from scratch we can create the file and continue on our merry way. When you run into situations like this though, What should really run through your head is “How can I avoid handling an exception at all?” In this case, it’s a trivial matter to simply check for the existence of the file before trying to open it. If we detect that the file isn’t there, we can accomplish the same thing without having to handle in in a catch block. 2. Only catch an exception if you can do something about it. Continuing with the poorly thought out file based login system we contrived in part 1, if the code calls a Login(…) method and the FileNotFound exception is thrown higher up the stack, the code that calls Login must account for a FileNotFound exception. This is kind of counterintuitive because the calling code should not need to know the internals of the Login method, and the data file is an implementation detail. What makes more sense, assuming that we didn’t implement any of the good advice from step 1, is for Login to catch the FileNotFound exception and wrap it in a new exception. For argument’s sake we’ll say LoginSystemFailureException. (Sorry, couldn’t think of anything better at the moment.) This gives us two stack traces, preserving the original stack trace in the inner exception, and also is much more informative to the calling code. 3. Only catch an exception if you’re at an application boundary. At some point we have to catch all the exceptions, even the ones we don’t know what to do with. WinForms, ASP.Net, and most other UI technologies have some kind of built in mechanism for catching unhandled exceptions without fatally terminating the application. It’s still a good idea to somehow gracefully exit the application in this case if possible though, because you can no longer be sure what state your application is in, but nothing annoys a user more than an application just exploding. These unhandled exceptions need to be logged, and this is a good place to catch them. Ideally you never want this option to be exercised, but code as though it will be. When you log these exceptions, give them a “Fatal” status (e.g. Log4Net) and make sure these bugs get handled in your next release. That’s it in a nutshell. If you do it right each exception will only get logged once and with the largest stack trace possible which will make those 2am emergency severity 1 debugging sessions much shorter and less frustrating. Here’s a few people who also have interesting things to say on this topic:  http://blogs.msdn.com/b/ericlippert/archive/2008/09/10/vexing-exceptions.aspx http://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET I know there’s more but I can’t find them at the moment.

    Read the article

  • CustomErrors section does not handle 404 properly on production server

    - by Adrian Grigore
    Hi, I'd like my ASP.NET MVC application to redirect failed requests to matching action methods of a certain controller. This works fine on my development machine running Windows 7, but not on my production machine running Windows 2008 R2. I set up my web.config as follows: <customErrors mode="On" defaultRedirect="/Error/ServerError/500"> <error statusCode="403" redirect="/Error/AccessDenied" /> <error statusCode="404" redirect="/Error/FileNotFound" /> </customErrors> This customErrors section works fine on both of my machines (production and development) for 500 Internal Server errors. It also works fine for 404 errors on my development machine. However, it does not properly redirect 404 errors on the production machine. Instead of /Error/FileNotFound, I get the standard 404 page that comes with IIS 7. What could be the problem here?

    Read the article

  • ASP.NET: How can I properly redirect requests with 404 errors?

    - by Adrian Grigore
    Hi, I'd like my ASP.NET MVC application to redirect failed requests to matching action methods of a certain controller. This works fine on my development machine running Windows 7, but not on my production machine running Windows 2008 R2. I set up my web.config as follows: <customErrors mode="On" defaultRedirect="/Error/ServerError/500"> <error statusCode="403" redirect="/Error/AccessDenied" /> <error statusCode="404" redirect="/Error/FileNotFound" /> </customErrors> This customErrors section works fine on both of my machines (production and development) for 500 Internal Server errors. It also works fine for 404 errors on my development machine. However, it does not properly redirect 404 errors on the production machine. Instead of /Error/FileNotFound, I get the standard 404 page that comes with IIS 7. What could be the problem here?

    Read the article

  • Impersonation in ASP.NET MVC

    - by eibrahim
    I have an Action that needs to read a file from a secure location, so I have to use impersonation to read the file. This code WORKS: [AcceptVerbs(HttpVerbs.Get)] public ActionResult DirectDownload(Guid id) { if (Impersonator.ImpersonateValidUser()) { try { var path = "path to file"; if (!System.IO.File.Exists(path)) { return View("filenotfound"); } var bytes = System.IO.File.ReadAllBytes(path); return File(bytes, "application/octet-stream", "FileName"); } catch (Exception e) { Log.Exception(e); }finally { Impersonator.UndoImpersonation(); } } return View("filenotfound"); } The only problem with the above code is that I have to read the entire file into memory and I am going to be dealing with VERY large files, so this is not a good solution. But if I replace these 2 lines: var bytes = System.IO.File.ReadAllBytes(path); return File(bytes, "application/octet-stream", "FileName"); with this: return File(path, "application/octet-stream", "FileName"); It does NOT work and I get the error message: Access to the path 'c:\projects\uploads\1\aa2bcbe7-ea99-499d-add8-c1fdac561b0e\Untitled 2.csv' is denied. I guess using the File results with a path, tries to open the file at a later time in the request pipeline when I have already "undone" the impersonation. Remember, the impersonation code works because I can read the file in the bytes array. What I want to do though is stream the file to the client. Any idea how I can work around this? Thanks in advance.

    Read the article

  • how to pass the parameters to the urlconnection in java/android?

    - by androidbase
    hi all, i can establish a connection using HttpUrlConnection. my code below. client = new DefaultHttpClient(); URL action_url = new URL(actionUrl); conn = (HttpURLConnection) action_url.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestProperty("domain", "bschool.hbs.edu"); conn.setRequestProperty("userType", "2"); conn.setRequestProperty("referer", "http://www.alumni.hbs.edu/"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestMethod(HttpPost.METHOD_NAME); DataOutputStream ds = new DataOutputStream(conn.getOutputStream()); String content = "username=username1&password=password11"; Log.v(TAG, "content: " + content); ds.writeBytes(content); ds.flush(); ds.close(); InputStream in = conn.getInputStream();//**getting filenotfound exception here.** BufferedReader reader = new BufferedReader( new InputStreamReader(in)); StringBuilder str1 = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { str1.append(line); Log.v(TAG, "line:" + line); } in.close(); s = str1.toString(); getting filenotfound exception. dont know why? else give me some suggestion to pass username and passwrod parameter to the url by code..

    Read the article

  • How to see errors in an asp.net website?

    - by Jayam Ravi
    I just want to see error insteas of asp.net showing me default error Server Error in '/' Application. What should i change in web config? I used this, <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> Any suggestion i want to see errors in browser as i do live testing...

    Read the article

  • ASP.NET aspxerrorpath in URL

    - by theog
    I have a site where I use CustomErrors in the web.config to specify a custom error page, and that's working just fine. The custom 404 page is also specified in the IIS configuration (because if it's not, I don't get my custom 404 page). But I have some logic that kicks in if a user gets a 404 that looks at their requested URL and make a navigation suggestion, if appropriate. This logic relies on the aspxerrorpath value. On my development PC, the aspxerrorpath is correctly appended to the URL, like so: http://localhost:3092/FileNotFound.aspx?aspxerrorpath=/badpage.aspx, but on my test site, there's no aspxerrorpath appended to the URL, so all of my custom logic is bypassed and my suggestions don't work. I'm not sure if this is an IIS config issue or something else. The web server is Windows Server 2008 with IIS 7. Any thoughts? Many Thanks.

    Read the article

  • Applet tag error

    - by Yvan JANSSENS
    Hi, I'm getting a FileNotFound error when I try to include my applet. It tries to include a .class file, while I provide a .jar file. Here's the java console output: at java.lang.Thread.run(Thread.java:637) Caused by: java.io.FileNotFoundException: /Users/yvanjanssens/NetBeansProjects/yBlackJack/yBlackJackApplet.class (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) And here's my Applet code: <applet code="yBlackJackApplet" archive="yBlackJack.jar" width="100%" height="100%" > </applet> Thanks! Yvan

    Read the article

  • Map Reduce job on Amazon: argument for custom jar

    - by zero51
    Hi all, This is one of my first try with Map Reduce on AWS in its Management Console. Hi have uploaded on AWS S3 my runnable jar developed on Hadoop 0.18, and it works on my local machine. As described on documentation, I have passed the S3 paths for input and output as argument of the jar: all right, but the problem is the third argument that is another path (as string) to a file that I need to load while the job is in execution. That file resides on S3 bucket too, but it seems that my jar doesn't recognize the path and I got a FileNotFound Exception while it tries to load it. That is strange because this is a path exactly like the other two... Anyone have any idea? Thank you Luca

    Read the article

  • How to add folder to assembly search path at runtime in .NET?

    - by Valery Tydykov
    My DLLs are loaded by a third-party application, which we can not customize. My assemblies have to be located in their own folder. I can not put them into GAC (my application has a requirement to be deployed using XCOPY). When the root DLL tries to load resource or type from another DLL (in the same folder), the loading fails (FileNotFound). Is it possible to add the folder where my DLLs are located to the assembly search path programmatically (from the root DLL)? I am not allowed to change the configuration files of the application.

    Read the article

  • CustomError not working properly

    - by IrfanRaza
    Hello friends, I am using following setting for customError. < customErrors mode="On" defaultRedirect="GenericErrorPage.aspx" < error statusCode="403" redirect="NoAccess.aspx" / < error statusCode="404" redirect="FileNotFound.aspx" / < /customErrors I have a folder "Admin" having access to administrators role. When someone other than administrators tries to access the pages inside admin folder, it is redirected to login page. My expectation is to display "NoAccess.aspx". Whats wrong with this code? Or is there other meaning to statusCode=403. Could someone provide help on this. Thanks for sharing your valuable time.

    Read the article

  • complex thinking on simple java challenge, how can i fix it?

    - by Rachel
    Simple stuff but somehow not able to crack it, below piece of code is throwing unexpected token at try/catch and unhandled exception:java.io.FileNotFound String fileName = "C:\\GS.xlsx"; try{ CSVReader reader = new CSVReader(new FileReader(fileName)); }catch(Exception e){ } What is the possible issue in here, i know there is something really goofy that am doing in here... public class PositionParserGS { String fileName = "C:\\GS.xlsx"; try{ CSVReader reader = new CSVReader(new FileReader(fileName)); }catch(Exception e){ } } that's the complete code...

    Read the article

  • Storing data on SD Card in Android

    - by BBoom
    Using the guide at Android Developers (http://developer.android.com/guide/topics/data/data-storage.html) I've tried to store some data to the SD-Card. This is my code: // Path to write files to String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/"+ctxt.getString(R.string.package_name)+"/files/"; String fname = "mytest.txt"; // Current state of the external media String extState = Environment.getExternalStorageState(); // External media can be written onto if (extState.equals(Environment.MEDIA_MOUNTED)) { try { // Make sure the path exists boolean exists = (new File(path)).exists(); if (!exists){ new File(path).mkdirs(); } // Open output stream FileOutputStream fOut = new FileOutputStream(path + fname); fOut.write("Test".getBytes()); // Close output stream fOut.flush(); fOut.close(); } catch (IOException ioe) { ioe.printStackTrace(); } When I create the new FileOutputStream I get a FileNotFound exception. I have also noticed that "mkdirs()" does not seem to create the directory. Can anyone tell me what I'm doing wrong? I'm testing on an AVD with a 2GB sd card and "hw.sdCard: yes", the File Explorer of DDMS in Eclipse tells me that the only directory on the sdcard is "LOST.DIR".

    Read the article

1 2  | Next Page >