Search Results

Search found 636 results on 26 pages for 'retry'.

Page 8/26 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Encrypt images before uploading to Dropbox [migrated]

    - by Cherry
    I want to encrypt a file first before the file will be uploaded to the dropbox. So i have implement the encryption inside the uploading of the codes. However, there is an error after i integrate the codes together. Where did my mistake go wrong? Error at putFileOverwriteRequest and it says The method putFileOverwriteRequest(String, InputStream, long, ProgressListener) in the type DropboxAPI is not applicable for the arguments (String, FileOutputStream, long, new ProgressListener(){}) Another problem is that this FileOutputStream fis = new FileOutputStream(new File("dont know what to put in this field")); i do not know where to put the file so that after i read the file, it will call the path and then upload to the Dropbox. Anyone is kind to help me in this? As time is running out for me and i still cant solve the problem. Thank you in advance. The full code is as below. public class UploadPicture extends AsyncTask<Void, Long, Boolean> { private DropboxAPI<?> mApi; private String mPath; private File mFile; private long mFileLen; private UploadRequest mRequest; private Context mContext; private final ProgressDialog mDialog; private String mErrorMsg; public UploadPicture(Context context, DropboxAPI<?> api, String dropboxPath, File file) { // We set the context this way so we don't accidentally leak activities mContext = context.getApplicationContext(); mFileLen = file.length(); mApi = api; mPath = dropboxPath; mFile = file; mDialog = new ProgressDialog(context); mDialog.setMax(100); mDialog.setMessage("Uploading " + file.getName()); mDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mDialog.setProgress(0); mDialog.setButton("Cancel", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { // This will cancel the putFile operation mRequest.abort(); } }); mDialog.show(); } @Override protected Boolean doInBackground(Void... params) { try { KeyGenerator keygen = KeyGenerator.getInstance("DES"); SecretKey key = keygen.generateKey(); //generate key //encrypt file here first byte[] plainData; byte[] encryptedData; Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key); //File f = new File(mFile); //read file FileInputStream in = new FileInputStream(mFile); //obtains input bytes from a file plainData = new byte[(int)mFile.length()]; in.read(plainData); //Read bytes of data into an array of bytes encryptedData = cipher.doFinal(plainData); //encrypt data FileOutputStream fis = new FileOutputStream(new File("dont know what to put in this field")); //upload to a path first then call the path so that it can be uploaded up to the dropbox //save encrypted file to dropbox // By creating a request, we get a handle to the putFile operation, // so we can cancel it later if we want to //FileInputStream fis = new FileInputStream(mFile); String path = mPath + mFile.getName(); mRequest = mApi.putFileOverwriteRequest(path, fis, mFile.length(), new ProgressListener() { @Override public long progressInterval() { // Update the progress bar every half-second or so return 500; } @Override public void onProgress(long bytes, long total) { publishProgress(bytes); } }); if (mRequest != null) { mRequest.upload(); return true; } } catch (DropboxUnlinkedException e) { // This session wasn't authenticated properly or user unlinked mErrorMsg = "This app wasn't authenticated properly."; } catch (DropboxFileSizeException e) { // File size too big to upload via the API mErrorMsg = "This file is too big to upload"; } catch (DropboxPartialFileException e) { // We canceled the operation mErrorMsg = "Upload canceled"; } catch (DropboxServerException e) { // Server-side exception. These are examples of what could happen, // but we don't do anything special with them here. if (e.error == DropboxServerException._401_UNAUTHORIZED) { // Unauthorized, so we should unlink them. You may want to // automatically log the user out in this case. } else if (e.error == DropboxServerException._403_FORBIDDEN) { // Not allowed to access this } else if (e.error == DropboxServerException._404_NOT_FOUND) { // path not found (or if it was the thumbnail, can't be // thumbnailed) } else if (e.error == DropboxServerException._507_INSUFFICIENT_STORAGE) { // user is over quota } else { // Something else } // This gets the Dropbox error, translated into the user's language mErrorMsg = e.body.userError; if (mErrorMsg == null) { mErrorMsg = e.body.error; } } catch (DropboxIOException e) { // Happens all the time, probably want to retry automatically. mErrorMsg = "Network error. Try again."; } catch (DropboxParseException e) { // Probably due to Dropbox server restarting, should retry mErrorMsg = "Dropbox error. Try again."; } catch (DropboxException e) { // Unknown error mErrorMsg = "Unknown error. Try again."; } catch (FileNotFoundException e) { } return false; } @Override protected void onProgressUpdate(Long... progress) { int percent = (int)(100.0*(double)progress[0]/mFileLen + 0.5); mDialog.setProgress(percent); } @Override protected void onPostExecute(Boolean result) { mDialog.dismiss(); if (result) { showToast("Image successfully uploaded"); } else { showToast(mErrorMsg); } } private void showToast(String msg) { Toast error = Toast.makeText(mContext, msg, Toast.LENGTH_LONG); error.show(); } }

    Read the article

  • Booting but not rebooting from external USB hard drive, what could be the problem?

    - by user8276
    I have a Dell Inspiron 6400 laptop with a dead internal hard drive controller. It boots perfectly from CD or USB. I therefore removed the internal hard drive and installed Ubuntu 10.10 Maverick onto an external USB hard drive. It boots and runs perfectly when doing a "cold start" of the PC. However, when I choose restart/reboot in the Ubuntu menu (e.g. after an update), I get this error message from the BIOS: "No bootable devices, strike f1 to retry boot, f2 for setup utility, press f5 to run onboard diagnostics". I can make the system boot again by pressing f2 or f5 and exiting the utility without having done anything. Or, I can simply power off the system and do a new "cold start". Does anyone know the likely reason for this problem and how to fix it. It is not a big issue but an annoyance that I would like to fix if possible.

    Read the article

  • Ubuntu 10.10 booting but not rebooting from external USB hard drive, what could be the problem?

    - by user8276
    I have a Dell Inspiron 6400 laptop with a dead internal hard drive controller. It boots perfectly from CD or USB. I therefore removed the internal hard drive and installed Ubuntu 10.10 Maverick onto an external USB hard drive. It boots and runs perfectly when doing a "cold start" of the PC. However, when I choose restart/reboot in the Ubuntu menu (e.g. after an update), I get this error message from the BIOS: "No bootable devices, strike f1 to retry boot, f2 for setup utility, press f5 to run onboard diagnostics". I can make the system boot again by pressing f2 or f5 and exiting the utility without having done anything. Or, I can simply power off the system and do a new "cold start". Does anyone know the likely reason for this problem and how to fix it. It is not a big issue but an annoyance that I would like to fix if possible.

    Read the article

  • How do I restore GRUB 2?

    - by uahug
    I upgraded my laptop with an SSD, moving my old HDD to where the DVD-drive was, so that I could have speed and storage. Now, I have reinstalled Ubuntu on the SSD, deleting all the partitions on the old HDD to make space for a data partition. But now the laptop doesn't even get to GRUB 2 if the HDD is plugged in! If I take it out, everything works, but as soon as I plug it in and retry to boot, I won't find GRUB. At first, I thought it was because of the boot order, but the order was OK: first the notebook hard drive (SSD) and then the CD/DVD drive (which in reality is the HDD). How can I fix it? Doing a simple grub-install /dev/sda doesn't work.. The SSD is sda, and the HDD is sdb.

    Read the article

  • How to Automatically run two commands after login?

    - by Covi
    I have these two commands that I need to manually run every time after login: autossh -M 2000 -N -f -q -D 127.0.0.1:7070 [email protected] and sudo mkdir /media/C sudo mount /dev/sda2 /media/C I'd like to make them automatically run every time I boot and login to my computer. I'm currently using 10.04LTS. BTW, I only vaguely know what init.d or runlevel mean. But I still prefer to know a command-line based way to achieve this, not a fancy GUI way. Also, the autossh will only succeed after Ubuntu automatically detect and connect to my network, so should we let it retry infinitely until successfully executed? Thank you!

    Read the article

  • All traffic is passed through OpenVPN although not requested

    - by BFH
    I have a bash script on a Ubuntu box which searches for the fastest openvpn server, connects, and binds one program to the tun0 interface. Unfortunately, all traffic is being passed through the VPN. Does anybody know what's going on? The relevant line follows: openvpn --daemon --config $cfile --auth-user-pass ipvanish.pass --status openvpn-status.log There don't seem to be any entries in iptables when I enter sudo iptables --list. The config files look like this: client dev tun proto tcp remote nyc-a04.ipvanish.com 443 resolv-retry infinite nobind persist-key persist-tun persist-remote-ip ca ca.ipvanish.com.crt tls-remote nyc-a04.ipvanish.com auth-user-pass comp-lzo verb 3 auth SHA256 cipher AES-256-CBC keysize 256 tls-cipher DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA

    Read the article

  • Websockets VS SSE

    - by user3385828
    Sorry for asking this here, I bet it has been asked plenty of times before but this time it's something specific which I haven't understood anywhere else: Suppose I have a service which requires to seek the database for different data once and in a while. For this I have 2 or 3 SSE, each one with a different retry basetime (20000 miliseconds, 1000 miliseconds...). What I'd like to know is if websockets can handle different "data type" accordingly to the request, for example, could I create one websocket to handle a notification system, a chat system, a group system instead of separated SSEs and treat data differently with javascript? And if so, would it be of higher interest (performance) than actually performing different queries to the server through different SSEs?

    Read the article

  • Ubuntu Server 12.04, Wifi problems

    - by brievolz84
    When I installed Ubuntu Server 12.04, I selected the ethernet adapter because I will use that most often; however, I would like to use wifi sometimes as well. This is how far I've gotten with this problem. lspci 02:00.0 Network Controller: Intel Corporation PRO/Wireless 5100 AGN [Shiloh] Network Connection iwconfig wlan0 IEEE a/b/g/n BSSID=off/any Mode=Managed Access Point=Not-Associated TX-Power=off Retry Long Limit:7 RTS thr:off Fragment thr:off Power Management:off I tried to do iwconfig wlan0 up but that doesn't work either. The error message said something along the lines of rfkill but I'm not connected to the Internet to download that particular program. Any help here would be great

    Read the article

  • error in installing informatica.

    - by raskart
    "The installer cannot ping the domain.Verify that Informatica Services is running on the domain host and select Retry. STDOUT: [1212] Command [ping] failed with error [[2121] Node [raskart] Domain [Doraskart] Host:Port [Doraskart:6001] has failed to ping back.]. exitcode -1 " This error occured when i tried to install informatica in my system. i checked informatica services and it was running and i have killed it and again started it but still then i have the problem. Please help me in this regard.Thanks in advance.

    Read the article

  • Amazon Web Services : Fault tolerant solution

    - by Algorist
    Hi, I am using Boto library to write scripts for automating our jobs on AWS. My script actually starts a hadoop cluster using cloudera scripts and then does some customization. I am having a problem with retries. Seems like very command in my script fails once couple of days. I started adding retry to all the commands, but then the code is very clumsy and difficult to maintain. what do people do in general. Thank you Bala

    Read the article

  • SFTP file transfer

    - by muthu
    hi iam totaly new to this area i have a requiremnet in transfering file to a SFTP site during which i need a proper LOG file and i also want to retry the transfer on any transaction error occurs or the network error and i also wan to log the errors. i also gone throug sftp and curl in which iam unable to satisfy the requirements. Thanks, Muthu

    Read the article

  • Handling connection errors in a MDB

    - by Rafa de Castro
    Is it possible to manage connection timeouts or errors in a MessageDrivenBean? You can make the factory to retry connecting a certain number of times but... is it possible to make some actions each time that a reconnection retrial is neccesary? Is it possible to register an ExceptionListener into the MessageDrivenBean's connection somehow? Thanks a lot.

    Read the article

  • ConfigurationErrorsException when running multiple instances due to file locking

    - by dr. evil
    I'm using My.Settings in my VB.NET application and when we run multiple instances rarely it's giving a ConfigurationErrorsException because the settings file locked by another instance. Is there anyway to fix this? This is happening during the OnShutdown process, also I'm not quite sure how can I catch that exception and handle it. Only thing I can think of is disabling onshutdown save and manually save it during the shutdown with extra retry + locking + exception handling.

    Read the article

  • I am getting the erorr when I try to debug.

    - by Michael
    I am receiving the error noted below. I have built/rebuilt the files sevaral time. I have alson renamed the file the file in the *.exe The NetworkAssociation.exe file is in the debug folder. Any help would be wonderful Visual Studio cannot start debugging because the debub target 'c:\NetworkAssociation\NetworkAssociation\Bin\Debug\NetworkAssociation.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location.

    Read the article

  • wxWidgets exception handling

    - by Alex Farber
    When unhandled exception is handled in wxWidgets application in Windows, program shows Abort-Retry-Ignore message produced by Widgets exception handler. I want to get normal unhandled exception behavior: program should terminate with standard Windows unhandled exception dialog. Can I prevent Widgets to catch unhahnled exceptions?

    Read the article

  • android: handover sms to default application

    - by harisali
    HI Plz guide, In android how can i pass my string (less then 160 char) to default builtin sms applicaion or queue, who must do rest of process. I meant, from my activity i want to call buitin sms application, & pass my sms string to that , then builtin application will be responsible to rest of activity like sms sent retry, ???

    Read the article

  • download file exception handling

    - by klaus-vlad
    Hi, In my application I download several critical files from a server, and I want to write some code that handles the case where the a file download didn't complete for a reason or other ,to retry downloading it at next startup. The function that downloads a file at a time however throws only MalformedURLException and IOException , but if these exceptions are thrown that means that the download didn't even begin. How should I arrange things so I can treat the case where a download failed , even if it began ? download(String file) throws MalformedURLException ,IOException { }

    Read the article

  • How to cleanup old Failed Builds in TeamCity?

    - by dr. evil
    We do have hundreds of failed builds in TeamCity (number is especially high because of old retry on fail settings) and now it's a pain to browse history. I want to clean up only old failed builds, is there anyway to do that in TeamCity? Normal clean-up policy only allows X days before the last successful build sort of clean ups.

    Read the article

  • Committed JDO writes do not apply on local GAE HRD, or possibly reused transaction

    - by eeeeaaii
    I'm using JDO 2.3 on app engine. I was using the Master/Slave datastore for local testing and recently switched over to using the HRD datastore for local testing, and parts of my app are breaking (which is to be expected). One part of the app that's breaking is where it sends a lot of writes quickly - that is because of the 1-second limit thing, it's failing with a concurrent modification exception. Okay, so that's also to be expected, so I have the browser retry the writes again later when they fail (maybe not the best hack but I'm just trying to get it working quickly). But a weird thing is happening. Some of the writes which should be succeeding (the ones that DON'T get the concurrent modification exception) are also failing, even though the commit phase completes and the request returns my success code. I can see from the log that the retried requests are working okay, but these other requests that seem to have committed on the first try are, I guess, never "applied." But from what I read about the Apply phase, writing again to that same entity should force the apply... but it doesn't. Code follows. Some things to note: I am attempting to use automatic JDO caching. So this is where JDO uses memcache under the covers. This doesn't actually work unless you wrap everything in a transaction. all the requests are doing is reading a string out of an entity, modifying part of the string, and saving that string back to the entity. If these requests weren't in transactions, you'd of course have the "dirty read" problem. But with transactions, isolation is supposed to be at the level of "serializable" so I don't see what's happening here. the entity being modified is a root entity (not in a group) I have cross-group transactions enabled Another weird thing is happening. If the concurrent modification thing happens, and I subsequently edit more than 5 more entities (this is the max for cross-group transactions), then nothing happens right away, but when I stop and restart the server I get "IllegalArgumentException: operating on too many entity groups in a single transaction". Could it be possible that the PMF is returning the same PersistenceManager every time, or the PM is reusing the same transaction every time? I don't see how I could possibly get the above error otherwise. The code inside the transaction just edits one root entity. I can't think of any other way that GAE would give me the "too many entity groups" error. The relevant code (this is a simplified version) PersistenceManager pm = PMF.getManager(); Transaction tx = pm.currentTransaction(); String responsetext = ""; try { tx.begin(); // I have extra calls to "makePersistent" because I found that relying // on pm.close didn't always write the objects to cache, maybe that // was only a DataNucleus 1.x issue though Key userkey = obtainUserKeyFromCookie(); User u = pm.getObjectById(User.class, userkey); pm.makePersistent(u); // to make sure it gets cached for next time Key mapkey = obtainMapKeyFromQueryString(); // this is NOT a java.util.Map, just FYI Map currentmap = pm.getObjectById(Map.class, mapkey); Text mapData = currentmap.getMapData(); // mapData is JSON stored in the entity Text newMapData = parseModifyAndReturn(mapData); // transform the map currentmap.setMapData(newMapData); // mutate the Map object pm.makePersistent(currentmap); // make sure to persist so there is a cache hit tx.commit(); responsetext = "OK"; } catch (JDOCanRetryException jdoe) { // log jdoe responsetext = "RETRY"; } catch (Exception e) { // log e responsetext = "ERROR"; } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } resp.getWriter().println(responsetext); EDIT: so I have verified that it fails after exactly 5 transactions. Here's what I do: I create a Foo (root entity), do a bunch of concurrent operations on that Foo, and some fail and get retried, and some commit but don't apply (as described above). Then, I start creating more Foos, and do a few operations on those new Foos. If I only create four Foos, stopping and restarting app engine does NOT give me the IllegalArgumentException. However if I create five Foos (which is the limit for cross-group transactions), then when I stop and restart app engine, I do get the exception. So it seems that somehow these new Foos I am creating are counting toward the limit of 5 max entities per transaction, even though they are supposed to be handled by separate transactions. It's as if a transaction is still open and is being reused by the servlet when it handles the new requests for the 2nd through 5th Foos. EDIT2: it looks like the IllegalArgument thing is independent of the other bug. In other words, it always happens when I create five Foos, even if I don't get the concurrent modification exception. I don't know if it's a symptom of the same problem or if it's unrelated. EDIT3: I found out what was causing the (unrelated) IllegalArgumentException, it was a dumb mistake on my part. But the other issue is still happening. EDIT4: added pseudocode for the datastore access EDIT5: I am pretty sure I know why this is happening, but I will still award the bounty to anyone who can confirm it. Basically, I think the problem is that transactions are not really implemented in the local version of the datastore. References: https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/gVMS1dFSpcU https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/deGasFdIO-M https://groups.google.com/forum/?hl=en&fromgroups=#!msg/google-appengine-java/4YuNb6TVD6I/gSttMmHYwo0J Because transactions are not implemented, rollback is essentially a no-op. Therefore, I get a dirty read when two transactions try to modify the record at the same time. In other words, A reads the data and B reads the data at the same time. A attempts to modify the data, and B attempts to modify a different part of the data. A writes to the datastore, then B writes, obliterating A's changes. Then B is "rolled back" by app engine, but since rollbacks are a no-op when running on the local datastore, B's changes stay, and A's do not. Meanwhile, since B is the thread that threw the exception, the client retries B, but does not retry A (since A was supposedly the transaction that succeeded).

    Read the article

  • Amazon Product Advertising API: XXX is not a valid value for BrowseNodeId

    - by Chris
    Hello, I am using the Amazon product Advertising API to fetch the product categories. For US categories it is working. But using browse nodes from different sites I get the following error: "569604 is not a valid value for BrowseNodeId. Please change this value and retry your request." I got the browse-nodes from the following site: http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?BrowseNodeIDs.html Where is the problem? Thanks for your help!

    Read the article

  • Do USB interrupt transfers guarantee order?

    - by ulidtko
    I've found in the fairly awesome book titled "USB in a NutShell" that interrupt transfers provide reliable delivery (via error detection and automatic retry). But I wonder, does that guarantee that transfers will not be swapped in order someday? As far as the bus is serial, my guess is that yes, reordering should never occur. But I'm not really much into this, so having doubts. Could somebody clarify?

    Read the article

  • Unexpected error when attempting to delete a facebook story

    - by blueberryfields
    I'm attempting to delete a facebook story/action, like so: curl -F 'access_token=[valid_token]' -X DELETE https://graph.facebook.com/[action_id] Facebook is responding with an internal server error, like so: {"error": {"message":"An unexpected error has occurred. Please retry your request later.", "type":"OAuthException","code":2}} Is this an error caused by my actions, or something on Facebook's end? Additional info When I run curl -X GET https://graph.facebook.com/[action_id]?access_token=[valid_token] the result is "false"

    Read the article

  • C# A simple Hangman game

    - by Radostin Angelov
    I'm trying to create a simple Hangman game and i have gotten so far, to make it read all words from a text file, but I don't know how to make the code work for every single word. I have another project, working with 3/4 words but with repeating nested if statements. I want to make it as shorter as possible. This is the code i have so far : using System; using System.Linq; class Program { static void Main() { string[] words = System.IO.File.ReadAllLines(@"C:\Users\ADMIN\Desktop\Letters\Letters.txt"); int LengthOfArray = words.Length; Random rnd = new Random(); int random = rnd.Next(1, 3); char[] letters = words[random].ToCharArray(); bool WordIsHidden = true; char hiddenChar = '_'; char GuessedLetter = hiddenChar; var retry = true; while (retry = true) { Console.WriteLine(letters); letters = GuessedLetter.ToString().ToCharArray(); for (int i = 1; i <= LengthOfArray; i++) { Console.Write("{0} ", GuessedLetter); } Console.WriteLine("Enter a letter!"); char letter = char.Parse(Console.ReadLine()); if (words[random].Contains<char>(letter)) { WordIsHidden = false; GuessedLetter = letter; Console.Write(letters); } else { if (WordIsHidden == true) { Console.Write("You guessed wrong!"); } } } } } Also I'm trying to make the game show each letter, the user has guessed on it's corresponding position, but now the letter is one line higher than the rest of the word and it's not in it's right position. Edited: Here is the result : cat ___Enter a letter! a __ aaaEnter a letter! t aa tttEnter a letter! IF anyone have a clue for where does this come from and how can I fix it, any help will be greatly appreciated.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >