Tumgik
#temp.txt
spamtonromantic · 1 year
Text
do mew think if i publically cry fur my boyfriend glitchll wake back up
1 note · View note
okuman64 · 1 year
Text
terapad用grepちょっと改良
terapad用grepちょっと改良しました。 何をかというとgrepしたものから、そのテキストに飛びやすくするために、頭にfile://を付け足しました。 echo offSET MOJI=SET FILEP=SET /P MOJI=”文字列を入力して下さい…”SET /P FILEP=”ファイルパスを入力して下さい…” echo ———-%date% %time% 検索文字列=”%MOJI%” ファイルパス=”%FILEP%*” >> find.txt FINDSTR /S /N /C:”%MOJI%” “%FILEP%*” > temp.txt for /f %%a in (temp.txt) do (echo file://%%a >> find.txt) find.txt exit
View On WordPress
0 notes
justmystic · 2 years
Text
Git annex commands
Tumblr media
#Git annex commands software#
Git commit –m “Message to go with the commit here” git commit will create a snapshot of the changes and save it to the git directory.For example, the basic Git following command will index the temp.txt file: git add is used to add files to the staging area.Git clone Conversely, run the following basic command to copy a local repository: If the repository lies on a remote server, use: git clone is used to copy a repository.Alternatively, you can create a repository within a new directory by specifying the project name:.The following Git command will create a repository in the current directory: git init will create a new local GIT repository.Here are some basic GIT commands you need to know:
#Git annex commands software#
The software may have a steep learning curve, but there are lots of GIT tutorials ready to help you. After you commit your changes, the snapshot of the changes will be saved into the git directory.Įveryone can use GIT as it is available for Linux, Windows, Mac, and Solaris. Then, the changes are staged (indexed) in the staging area. The working directory is where you add, delete, and edit the files. Companies and programmers usually use GIT to collaborate on developing software and applications.Ī GIT project consists of three major sections: the working directory, the staging area, and the git directory. GIT is the most widely used open-source VCS (version control system) that allows you to track changes made to files. Let’s get started! Understanding the GIT Workflow Read on to discover our handy cheat sheet that you can use for daily reference. Need to learn some basic GIT commands? You’ve come to the right place.
Tumblr media
1 note · View note
birbvin · 3 years
Text
THE ONE THING THAT WILBUR AND QUACKITY AGREE ON IS THAT TOMMY ISNT ALLOWED IN THE STRIP CLUB, ABSOLUTELY INCREDIBLE
5K notes · View notes
Photo
Tumblr media Tumblr media
mine technologically 
1 note · View note
techandguru-blog · 5 years
Link
Did you ever forget to bring what your girlfriend asked you to take from the market? What is your reaction? Oh no honey, I was supposed to do this and that but forget and feel sorry about that. Similarly, while writing programs, programmers sometimes forget to handle scenarios which hamper the program execution. Such problems in programming languages are often called Exceptions. Java Exceptions are the way to identify such problems and Exception handling is the same as managing your girlfriend so that execution goes on smoothly.
Java provides rich implementation to handle java exceptions. Exceptions are event occurred during compiling or execution of a program which hamper the normal execution of the program. If exceptions are not handled properly, they can abort the program execution. An exception can happen because of numerous reasons e.g. file is not found, invalid data encountered, divide by zero condition, network connection lost in the middle of operations, etc.
So, cause of exception can arise from user input, programmer mistake or resource on the system, etc. Based on the various scenario, exceptions can be divided into below categories as follows
CHECKED JAVA EXCEPTIONS
A checked exception is thrown by the compiler at compile time so these are also called compile-time exceptions. These can not be ignored and must be handled by the programmer. e.g. If you try to read a non-existing file, then compiler throws FileNotFoundException at compile time.
import java.io.FileReader; import java.io.File; public class CompileTimeExceptionExample { public static void main(String args[]) { File file = new File("C://myfile.txt"); FileReader fr = new FileReader(file); } }
If you try to compile the above program using the command
“javac CompileTimeExceptionExample.java”, it will throw FileNotFoundException which will read like below
CompileTimeExceptionExample.java:6: error: unreported exception FileNotFoundException; must be caught or declared to be thrown FileReader fr = new FileReader(file); ^ 1 error
Note: read(), close(), write() etc operations thrown IOException so compiler notifies to handle IOException along with FileNotFoundException.
UNCHECKED JAVA EXCEPTIONS
These exceptions occur at runtime and are a result of improper use of operation and APIs. These are also called runtime exception. Runtime exceptions are ignored at compile time. e.g exception is thrown when divide by zero is attempted.
Also, you have n elements in an array and tries to access (n+1)th element and ArrayIndexOutOfBoundException is thrown.
ERRORS IN JAVA
These are beyond the control of the programmer and a programmer can hardly do anything with them. Errors are very severe and result in program abort.
Now we are familiar with what are exceptions and how many times of are they. Let’s look into the Exceptions hierarchy.
All exception classes are a subclass of java.lang.Exception class. Exception class is driven from Throwable class. Error class is also a subclass of Throwable. Error is a severe condition in program execution which can not be handled by code. Errors are thrown by JVM like OutOfMemoryException.
Java Exception Classes
Tumblr media
Java Exception Classes
Exceptions can be divide mainly in two main categories namely Runtime exception and IO exceptions (compile-time exceptions).
Below table lists the methods exposed by Exception class
Method Description public String getMessage() Returns a detailed message about the exception that has occurred. This message is initialized in the Throwable constructor. public Throwable getCause() Returns the cause of the exception as represented by a Throwable object. public String toString() Returns the name of the class concatenated with the result of getMessage(). public void printStackTrace() Prints the result of toString() along with the stack trace to System.err, the error output stream. public StackTraceElement [] getStackTrace() Returns an array containing each element on the stack trace. The element at index 0 represents the top of the call stack, and the last element in the array represents the method at the bottom of the call stack. public Throwable fillInStackTrace() Fills the stack trace of this Throwable object with the current stack trace, adding to any previous information in the stack trace.
HANDLING EXCEPTION IN JAVA
Exceptions can be handled by using “try{}catch(){}” block. The code snippet likely to produce Exception is put inside try block and is called protected code. And if anything unexpected happens and catch block and handles it according to exception defined in the definition of catch block.
Syntax of using try-catch block is below:
try { // Protected code..likely to produc exceptions } catch (ExceptionName e1) { // ExceptionName represents exception type handled in catch block. // Catch block }
If an exception occurs in the protected code, then control is passed to the catch block with an exception object.
A single try-catch block and handle multiple exceptions in the catch block. One can specify actions for each type of exception which are likely to occur in the protected code placed inside the try block. Syntax of handling the multiple exceptions in the catch block is shown below:
try { // Protected code likely to encounter exception } catch (ExceptionType1 e1) { // Catch block } catch (ExceptionType2 e2) { // Catch block } catch (ExceptionType3 e3) { // Catch block }
A single try block can have any number of catch blocks to handle exceptions. The type of the exception thrown in the try block is matched against the exception handled in catch block from TOP to BOTTOM and if anywhere down the ladder, the exception thrown and exception handled by catch block are matched then control is passed to matching catch block and is handled by that catch block.
If no catch block handles the exception thrown then the exception is thrown to the last method in the execution stack and current method execution stops here.
Since Java 7, single catch block and handle multiple exceptions. This approach simplifies the code. e.g.
catch (IOException|FileNotFoundException ex) { logger.log(ex); throw ex; }
Throws and Throw usages in Java
If the method in execution does not handle the checked exception then it must declare exceptions it is going to throw using “throws” keywords. "Throws" is appended at the end of the method signature and specify the Exceptions it can throw using comma like below
import java.io.*; public class ThrowsExample { public void methodName(double amount) throws Exception1,Exception2 { // Method implementation throw new Exception1(); ….. throw new Exception2(); } // Remainder of class definition }
throws is used to postpone the handling of exception and throw is used to raise the exception explicitly.
Finally{} block: finally block is placed after either try or catch depending on whether the catch is used or not. It also occurs after catch if catch block is used otherwise put after try block. “finally” block always executes irrespective of any exception is thrown in try block or not. This block is normally used to do cleanup and resource release kind of activities.
Syntax of finally block
try { // Protected code } catch (ExceptionType1 e1) { // Catch block } catch (ExceptionType2 e2) { // Catch block } catch (ExceptionType3 e3) { // Catch block }finally { // The finally block always executes. }
Popular use of finally block is found in closing sessions/connection after doing DB operations. It is where your program normally release the resources if it has to.
KEY POINTS TO BE NOTED HERE
- try block has to have at least one out of catch block and finally block.
- no code can appear between try-catch and finally block
- catch or finally can not appear without try block
- finally block is not a compulsion to have
try-with-resource:
Since Java 7, try-with-resources is supported. What it means is it automatically releases the resources used inside try block. Generally, we have to close the connection, streams created in try block using finally block. To avoid such explicit code management, Java 7 provides try with resources wherein it automatically releases the resources as the control moves out of try block. Let’s look at an example:
import java.io.FileReader; import java.io.IOException; public class TryWithResourceExample { public static void main(String args[]) { try(FileReader fr = new FileReader("E://temp.txt")) { char [] a = new char[50]; fr.read(a); // reads the content to the array a for(char c : a) System.out.print(c); // prints the characters one by one } catch (IOException e) { e.printStackTrace(); } } }
try-with-resource is also referred to as automatic resource management. To use automatic resource management, you just need to declare the resource inside parentheses with a try statement like in the above program.
KEY POINTS TO USE try-with-resource MECHANISM:
- To use a class with try-with-resource, the class must implement AutoCloseable interface. Close() method is implicitly called after try-catch
- multiple class can be used with try to automatically manage them
- All instances of the class declared with try are instantiated before try block and are final by default.
USER DEFINED JAVA EXCEPTIONS:
User can create own exception by extending Throwable class in java. To create a self-defined Exception class, one should following key points listed below:
- All exceptions must be a child of Throwable
- to write check exception, one must extend the Exception class.
- To create a Runtime exception class, one must implement the RuntimeException class.
Syntax to define Exception class
class MyException extends Exception { }
Basis the origin of exception, Exceptions in java can be divided into two categories like
JVM Exceptions: these are thrown by JVM. e.g. NullPointerException, ArrayIndexOutOfBoundException, ClassCastException
Programmatic Exception: thrown by a programmer like IllegalArgumentException, IllegalStateException etc
So key take away from the post:
- Error are not something programmer can handle through code but however writing code efficiently can reduce the chances of their occurrences.
- checked exceptions are caught by the compiler at compile time and include IOExceptions/ FileNotFoundExceptions etc
- unchecked exceptions occur at runtime and are something programmers can manage using try-catch block
- finally block always execute regardless of what happened in the try block.
That's it, folks!!
Related items: Java Interview Questions and Java Basics
0 notes
xokes · 6 years
Text
Finding Zero byte Files in a folder
A user was reporting problems with corrupted files. They ended up being zero bytes in size. Not sure why that happened, but my boss asked me to find any zero byte files edited in the last thirty days
Enter PowerShell, with a simple one-liner
Get-ChildItem -Path "FOLDER GOES HERE" -Recurse | ` Where {$_.Length -eq 0 -And $_.LastWriteTime -gt (Get-Date).AddDays(-30)} | ` Select-Object FullName, LastWriteTime | Out-File "C:\Temp.txt"
And that is it. Quick and simple, dumps the list of files out to a file
0 notes
codezclub · 7 years
Text
Write a C++ Program to Decrypt Files using File Handling
Write a C++ Program to Decrypt Files using File Handling
  #include #include #include #include using namespace std; int main() { char ch, choice, fname[20]; fstream fps, fpt; cout<>fname; fps.open(fname); if(!fps) { cout<<"Error in opening source file..!!"; cout<<"\nPress any key to exit..."; exit(7); } fpt.open("temp.txt"); if(!fpt) { cout<<"Error in opening temp.txt file..!!"; fps.close();…
View On WordPress
0 notes
birbvin · 3 years
Text
god i know that we're always joking about how phil and kristin are proof that love is real but like,,, the fact that phil really saw all of our 'mumza as the goddess of death' headcanons and decided "yknow what? yeah. my wife IS a goddess, shes BEAUTIFUL and POWERFUL and can make forests appear out of nowhere sometimes and this is all canon now so everyone can see how AMAZING my wife is!!!!" i just, god, love really is real, im just-
Tumblr media
5K notes · View notes
codezclub · 7 years
Text
Write a C++ Program to Encrypt Files using File Handling
Write a C++ Program to Encrypt Files using File Handling
  #include #include #include #include using namespace std; int main() { char fname[20], ch, choice; fstream fps, fpt; cout<>fname; fps.open(fname); if(!fps) { cout<<"Error in opening file..!!"; cout<<"\nPress any key to exit..."; exit(1); } fpt.open("temp.txt"); if(!fpt) { cout<<"Error in creating temp.txt file..!!"; fps.close(); cout<>ch;…
View On WordPress
0 notes