Search Results

Search found 11297 results on 452 pages for 'delete operator'.

Page 11/452 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Delete temp file during finally vs delete output file during catch

    - by Russell
    This is in Java 6. I've seen more than once that people create temp files, do something, then rename it to the output file. Everything is wrapped in a try-finally block, where the temp file is deleted in finally in case something goes wrong in between. try { //do something with tempFile //do something with tempFile //do something with tempFile tempFile.renameTo(outputFile); } finally { if (tempFile.exists()) tempFile.delete() } I was wondering what are the benefits of doing that instead of doing something to the output file directly and delete it in case of exceptions. try { //do something with outputFile //do something with outputFile //do something with outputFile } catch (Exception e) { if (outputFile.exists()) outputFile.delete(); } My guess is that deleting temp files in finally benefits me when the try block can throw many kinds of exceptions. Is my guess right? What else?

    Read the article

  • An operator == whose parameters are non-const references

    - by Eduardo León
    I this post, I've seen this: class MonitorObjectString: public MonitorObject { // some other declarations friend inline bool operator==(/*const*/ MonitorObjectString& lhs, /*const*/ MonitorObjectString& rhs) { return lhs.fVal==rhs.fVal; } } Before we can continue, THIS IS VERY IMPORTANT: I am not questioning anyone's ability to code. I am just wondering why someone would need non-const references in a comparison. The poster of that question did not write that code. This was just in case. This is important too: I added both /*const*/s and reformatted the code. Now, we get back to the topic: I can't think of a sane use of the equality operator that lets you modify its by-ref arguments. Do you?

    Read the article

  • Dynamic Operator Overloading on dict classes in Python

    - by Ishpeck
    I have a class that dynamically overloads basic arithmetic operators like so... import operator class IshyNum: def __init__(self, n): self.num=n self.buildArith() def arithmetic(self, other, o): return o(self.num, other) def buildArith(self): map(lambda o: setattr(self, "__%s__"%o,lambda f: self.arithmetic(f, getattr(operator, o))), ["add", "sub", "mul", "div"]) if __name__=="__main__": number=IshyNum(5) print number+5 print number/2 print number*3 print number-3 But if I change the class to inherit from the dictionary (class IshyNum(dict):) it doesn't work. I need to explicitly def __add__(self, other) or whatever in order for this to work. Why?

    Read the article

  • Java file delete on NFS drive

    - by RenegadeAndy
    Hey guys. I am trying to delete a file on a NFS drive. I have had other problems manipulating files on remote drives such as moving a file - however i got around it by not using the conventional method i.e renameFile but instead properly using input and output streams. However using the File.delete() returns false , and I have heard suggestions on using the apache commons io FileUtils class - however it just throws an IO exception. Does anybody have any suggestions on a way to delete a file on a network mounted drive using java? Thanks

    Read the article

  • Scala :: operator, how it works?

    - by Felix
    Hello Guys, in Scala, I can make a caseclass case class Foo(x:Int) and then put it in a list like so: List(Foo(42)) Now, nothing strange here. The following is strange to me. The operator :: is a function on a list, right? With any function with 1 argument in Scala, I can call it with infix notation. An example is 1 + 2 is a function (+) on the object Int. The class Foo I just defined does not have the :: operator, so how is the following possible: Foo(40) :: List(Foo(2)) ? In scala 2.8 rc1, I get the following output from the interactive prompt: scala> case class Foo(x:Int) defined class Foo scala> Foo(40) :: List(Foo(2)) res2: List[Foo] = List(Foo(40), Foo(2)) scala> I can go on and use it, but if someone can explain it I will be glad :)

    Read the article

  • Passing operator as a parameter

    - by nacho4d
    Hi, I want to have a function that evaluates 2 bool vars (like a truth table) for example: since T | F : T then myfunc('t', 'f', ||); /*defined as: bool myfunc(char lv, char rv, ????)*/ should return true; how can I pass the third parameter? (I know is possible to pass it as a char* but then I will have to have another table to compare operator string and then do the operation which is something I would like to avoid) Is it possible to pass an operator like ^(XOR) or ||(OR) or &&(AND), etc in a function/method? Thanks in advance

    Read the article

  • copy C'tor with operator= | C++

    - by user2266935
    I've got this code here: class DerivedClass : public BaseClass { SomeClass* a1; Someclass* a2; public: //constructors go here ~DerivedClass() { delete a1; delete a2;} // other functions go here .... }; My first question is as follows: Can I write an "operator=" to "DerivedClass" ? (if your answer is yes, could you show me how?) My second question is: If the answer to the above is yes, could you show me how to make an "copy c'tor" using the "operator=" that you wrote beforehand (if that is even possible)? Your help would be much appreciated !

    Read the article

  • template; operator (int)

    - by Oops
    Hi, regarding my Point struct already mentioned here: http://stackoverflow.com/questions/2794369/template-class-ctor-against-function-new-c-standard is there a chance to replace the function toint() with a cast-operator (int)? namespace point { template < unsigned int dims, typename T > struct Point { T X[ dims ]; //umm??? template < typename U > Point< dims, U > operator U() const { Point< dims, U > ret; std::copy( X, X + dims, ret.X ); return ret; } //umm??? Point< dims, int > operator int() const { Point<dims, int> ret; std::copy( X, X + dims, ret.X ); return ret; } //OK Point<dims, int> toint() { Point<dims, int> ret; std::copy( X, X + dims, ret.X ); return ret; } }; //struct Point template < typename T > Point< 2, T > Create( T X0, T X1 ) { Point< 2, T > ret; ret.X[ 0 ] = X0; ret.X[ 1 ] = X1; return ret; } }; //namespace point int main(void) { using namespace point; Point< 2, double > p2d = point::Create( 12.3, 34.5 ); Point< 2, int > p2i = (int)p2d; //äähhm??? std::cout << p2d.str() << std::endl; char c; std::cin >> c; return 0; } I think the problem is here that C++ cannot distinguish between different return types? many thanks in advance. regards Oops

    Read the article

  • Delete page permenetly

    - by alienavatar
    Hi I deleted sharepoint page which is based on page layout through browser by going siteactions--managing content and structure-- pages-- selected the page-- delete(by right clicking). But when I see in the content database still the page is there. Basically I want to delete the content type which I could nt delete as it is being used by a page. I am getting "Content type is in use" Is there one have solution for this. Please let me know. Thanks in advance.

    Read the article

  • delete row from mysql through generated table with records

    - by HennySmafter
    I am using 2 pages. On one page it generates a table with the records and a delete button. After pressing delete it goes to the second page which should delete the record. But it doesn't. Below is the code that I am using. PS: The code is adapted from a tutorial I found through Google a while ago. delete_overzicht.php <?php // Load Joomla! configuration file require_once('../../../configuration.php'); // Create a JConfig object $config = new JConfig(); // Get the required codes from the configuration file $server = $config->host; $username = $config->user; $password = $config->password; $database = $config->db; // Connect to db $con = mysqli_connect($server,$username,$password,$database); if (!$con){ die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,$database); // Get results $result = mysqli_query($con,"SELECT * FROM cypg8_overzicht"); echo "<table border='1' id='example' class='tablesorter'><thead><tr><th>Formulier Id</th><th>Domeinnaam</th><th>Bedrijfsnaam</th><th>Datum</th><th>Periode</th><th>Subtotaal</th><th>Dealernaam</th><th>Verwijderen</th></tr></thead><tbody>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['formuliernummer'] . "</td>"; echo "<td>" . $row['domeinnaam'] . "</td>"; echo "<td>" . $row['bedrijfsnaam'] . "</td>"; echo "<td>" . $row['datum'] . "</td>"; echo "<td>" . $row['periode'] . "</td>"; echo "<td> &euro; " . $row['subtotaal'] . "</td>"; echo "<td>" . $row['dealercontactpersoon'] . "</td>"; echo "<td><a href='delete.php?id=" . $row['id'] . "'>Verwijderen </a></td>"; echo "</tr>"; } echo "</tbody></table>"; mysqli_close($con); ?> delete.php <?php // Load Joomla! configuration file require_once('../../../configuration.php'); // Create a JConfig object $config = new JConfig(); // Get the required codes from the configuration file $server = $config->host; $username = $config->user; $password = $config->password; $database = $config->db; // Connect to db $con = mysqli_connect($server,$username,$password,$database); if (!$con){ die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,$database); // Check whether the value for id is transmitted if (isset($_GET['id'])) { // Put the value in a separate variable $id = $_GET['id']; // Query the database for the details of the chosen id $result = mysqli_query($con,"DELETE * FROM cypg8_overzicht WHERE id = $id"); } else { die("No valid id specified!"); } ?> Thanks to everyone who is willing to help!

    Read the article

  • How can i get my delete messages function just appear for the user's own messages left on their friends page?

    - by Hannah_B
    I had been working on this trying the delete message button to work on my own profile page of my site. When I delete a message left by a friend it not only deletes it from the screen but deletes it from the database. The messages in the database have 4 fields: message_id, from, to and message. Here is my profile view that shows how Im deleting messages from my friends: if(!empty($messages)){ foreach($messages as $message): $delete = $message['message_id']; //var_dump($message); ?> <li><?=$message['from']?> says...: "<?=$message['message']?>"(<?=anchor("home/deleteMsg/$delete", 'delete')?>)</li> //this is where the delete button appears beside messages left <?php endforeach?> <?php }else{ ?> <?php echo 'No messages left yet !!!'; }?> Here is my controller showing the deleteMsg function called: function deleteMsg($messageid) { $this->messages->deleteMsg($messageid); redirect('home'); } Here is the messages model showing the deleteMsg model itself: function deleteMsg($message_id) { $this->db->where(array('message_id' => $message_id)); $this->db->delete('messages'); } Here is my friendprofile view where I want to implement the delete message command just so the button appears for messages Ive left and I can delete them. The delete button will not appear beside other friends comments on this page: <li><?=$message['from']?> says...: "<?=$message['message']?>"</li> Now I've tried creating a new delete Message function to no success so far, am I better off doing this than calling the same function? As this didnt work either.

    Read the article

  • Permanently Delete MailMessage in Outlook with VBA?

    - by eidylon
    Hello all, I am looking for a way to permanently delete a MailMessage from Outlook 2000 with VBA code. I'd like to do this without having to do a second loop to empty the Deleted items. Essentially, I am looking for a code equivalent to the UI method of clicking a message and hitting SHIFT+DELETE. Is there such a thing? TIA!

    Read the article

  • null-coalescing operator or conditional operator

    - by rkrauter
    Which coding style do you prefer: object o = new object(); //string s1 = o ?? "Tom"; // Cannot implicitly convert type 'object' to 'string' CS0266 string s3 = Convert.ToString(o ?? "Tom"); string s2 = (o != null) ? o.ToString() : "Tom"; s2 or s3? Is it possible to make it shorter? s1 does not obviously work.

    Read the article

  • Android - read and delete new SMS of a specific sender only

    - by John
    I'm trying to write the next function: 1) Send SMS to a service number 2) Read the response SMS content (the service's auto sent-back message that tells me if I succeed/failed to turn on the service) 3) Delete the service's auto-sent SMS I know how to do the first step, and I should be able to do the second with both: getMessageBody () getOriginatingAddress () but: 1) how can I refer the last incoming message to use the above functions? 2) how can I delete that specific message? Thanks, John

    Read the article

  • Working with Reporting Services Filters – Part 2: The LIKE Operator

    - by smisner
    In the first post of this series, I introduced the use of filters within the report rather than in the query. I included a list of filter operators, and then focused on the use of the IN operator. As I mentioned in the previous post, the use of some of these operators is not obvious, so I'm going to spend some time explaining them as well as describing ways that you can use report filters in Reporting Services in this series of blog posts. Now let's look at the LIKE operator. If you write T-SQL queries, you've undoubtedly used the LIKE operator to produce a query using the % symbol as a wildcard for multiple characters like this: select * from DimProduct where EnglishProductName like '%Silver%' And you know that you can use the _ symbol as a wildcard for a single character like this: select * from DimProduct where EnglishProductName like '_L Mountain Frame - Black, 4_'   So when you encounter the LIKE operator in a Reporting Services filter, you probably expect it to work the same way. But it doesn't. You use the * symbol as a wildcard for multiple characters as shown here: Expression Data Type Operator Value [EnglishProductName] Text Like *Silver* Note that you don’t have to include quotes around the string that you use for comparison. Books Online has an example of using the % symbol as a wildcard for a single character, but I have not been able to successfully use this wildcard. If anyone has a working example, I’d love to see it!

    Read the article

  • C# On Quit WebPage Delete Files and Folders on Server with no user action

    - by user325558
    Hi, I have some problems to delete temporary folder and files on my server when users not finish some action in webpages and quit to other webpages. Initialy at Page Load folders are created to allow the user to load files.I have tried implementing destruction during Idisposable without success. Could someone point the best method to delete folders and files when user quit the page with no action or cancel button. Thanks.

    Read the article

  • delete all files and folders in multiple directory but leave the directoy

    - by NightsEVil
    well i like this nice of code right here it seems to work awsome but i cant seem to add any more directories to it DirectoryInfo dir = new DirectoryInfo(@"C:\temp"); foreach(FileInfo files in dir.GetFiles()) { files.Delete(); } foreach (DirectoryInfo dirs in dir.GetDirectories()) { dirs.Delete(true); } i would also like to add in special folders aswell like History and cookies and such how would i go about doing that (i would like to include atleast 4-5 different folders)

    Read the article

  • C# delete all files and folders in multiple directory but leave the directoy

    - by NightsEVil
    well i like this nice of code right here it seems to work awsome but i cant seem to add any more directories to it { DirectoryInfo dir = new DirectoryInfo(@"C:\temp"); foreach(FileInfo files in dir.GetFiles()) { files.Delete(); } foreach (DirectoryInfo dirs in dir.GetDirectories()) { dirs.Delete(true); } } i would also like to add in special folders aswell like History and cookies and such how would i go about doing that (i would like to include atleast 4-5 different folders)

    Read the article

  • override delete function in entity framework

    - by k0ni
    How can i make my own delete method to prevent that the data really gets deleted? i want to set a datetime field when it gets deleted insted of a normal delete. i read about overriding the submitchanges function, but i don't get it to work thanks

    Read the article

  • malloc and delete in C++, opinions

    - by Alexander
    In C++ using delete to free memory obtained with malloc() doesn't necessarily cause a program to blow up. Do you guys think a warning or perhaps even an assertion failure should be produced if delete is used to free memory obtained using malloc()?? Why do you think that Stroustrup did not had this feature on C++?

    Read the article

  • How to delete drupal's unused core modules correctly?

    - by vegatron
    Hi I want to delete the unused drupal modules like ( blog, Forum, taxonomy ...) but I'm worried if I delete the modules from the modules directory I might cause an error (now or in the future) . is it safe? and if I deleted the corresponding tables what will happen? the reason for this is because I want to deliver the site to my client, and teach him how to use the admin page, but I want to make as easy as possible for him..

    Read the article

  • How to delete images from memory in a browser

    - by trefeater
    Hi all. Is it possible to delete some images from the browser (firefox2) memory using javascript? By doing this, I want to save some precious browser memory and let my web app to work better. I guess that if possible, it will be something like this: delete (document.images[7]); document.images[7].src = null; document.images[7] = null; Thanks guys!

    Read the article

  • Delete table in all the rendering pages of a single page in Javascript

    - by Aruna
    HI , i am having a table like in many pages .. All these pages are rendered in a single page . when i apply the javascript to delete that using on load with the below var tbl = document.getElementById('toc'); if(tbl) tbl.parentNode.removeChild(tbl); Only one table is deleted and not the others i am trying to delete the tables in all the rendering pages using javascript.how to do this??

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >