Tumgik
techtechinfo · 7 months
Text
How to upload Images from rest API in Spring boot
Tumblr media
Hello Everyone, If you want to upload the image from the rest api in the sprint boot application then first we have to setup the spring boot application first install the postman for the testing of the api. Below are the steps to upload the document Get the original file name from the multipart file  String originalFilename = multipartFile.getOriginalFilename();Java Create a FileOutputSteam object to get the original file name FileOutputStream fos = new FileOutputStream(originalFilename)Java Now write the file with the same name from the mutipartFile file fos.write(multipartFile.getBytes());Java After creating the new file we can delete this file also originalFilename.delete();   These are the important steps to upload an image through Spring boot rest API Now let's implement the above code in a rest API “api/uploadDoc” Create a rest Controller with the name CommonController.java
Tumblr media
upload imge in spring boot rest api Now test the upload doc API from the postman,
Tumblr media
test upload doc api in Postman To delete the uploaded file in Spring boot First, we have to create a file object with the same file name and file path. Then you can delete the image from the uploaded path. File file = new File(originalFilename); file.delete();Java You can copy the content of the testController given below. @Slf4j @RestController @RequestMapping("api/v1") public class TectController { @PostMapping(path = "uploadDoc") public String uploadImageToS3(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest header) throws IOException { try { String originalFilename = multipartFile.getOriginalFilename(); File file = new File(originalFilename); try (FileOutputStream fos = new FileOutputStream(originalFilename)) { fos.write(multipartFile.getBytes()); } catch (IOException e) { throw new IOException("Failed to convert multipart file to file", e); } file.delete(); return "File uploaded successfully"; } catch (Exception e) { // TODO: handle exception log.error("Error :: {}", e.getLocalizedMessage()); return "Something went wrong"; } } }Java Read the full article
0 notes
techtechinfo · 2 years
Text
Visual Studio Code keyboard shortcuts for windows
Tumblr media
General Ctrl+Shift+P, F1 Show Command Palette Ctrl+P Quick Open, Go to File… Ctrl+Shift+N New window/instance Ctrl+Shift+W Close window/instance Ctrl+, User Settings Ctrl+K Ctrl+S Keyboard Shortcuts Basic editing Ctrl+X Cut line (empty selection) Ctrl+C Copy line (empty selection) Alt+ ↑ / ↓ Move line up/down Shift+Alt + ↓ / ↑ Copy line up/down Ctrl+Shift+K Delete line Ctrl+Enter Insert line below Ctrl+Shift+Enter Insert line above Ctrl+Shift+ Jump to matching bracket Ctrl+] / Unfold (uncollapse) region Ctrl+K Ctrl+ Unfold (uncollapse) all subregions Ctrl+K Ctrl+0 Fold (collapse) all regions Ctrl+K Ctrl+J Unfold (uncollapse) all regions Ctrl+K Ctrl+C Add line comment Ctrl+K Ctrl+U Remove line comment Ctrl+/ Toggle line comment Shift+Alt+A Toggle block comment Alt+Z Toggle word wrap Navigation Ctrl+T Show all Symbols Ctrl+G Go to Line... Ctrl+P Go to File... Ctrl+Shift+O Go to Symbol... Ctrl+Shift+M Show Problems panel F8 Go to next error or warning Shift+F8 Go to previous error or warning Ctrl+Shift+Tab Navigate editor group history Alt+ ← / → Go back / forward Ctrl+M Toggle Tab moves focus Search and replace Ctrl+F Find Ctrl+H Replace F3 / Shift+F3 Find next/previous Alt+Enter Select all occurences of Find match Ctrl+D Add selection to next Find match Ctrl+K Ctrl+D Move last selection to next Find match Alt+C / R / W Toggle case-sensitive / regex / whole word Multi-cursor and selection Alt+Click Insert cursor Ctrl+Alt+ ↑ / ↓ Insert cursor above / below Ctrl+U Undo last cursor operation Shift+Alt+I Insert cursor at end of each line selected Ctrl+L Select current line Ctrl+Shift+L Select all occurrences of current selection Ctrl+F2 Select all occurrences of current word Shift+Alt+→ Expand selection Shift+Alt+← Shrink selection Shift+Alt + (drag mouse) Column (box) selection Ctrl+Shift+Alt + (arrow key) Column (box) selection Ctrl+Shift+Alt +PgUp/PgDn Column (box) selection page up/down Rich languages editing Ctrl+Space, Ctrl+I Trigger suggestion Ctrl+Shift+Space Trigger parameter hints Shift+Alt+F Format document Ctrl+K Ctrl+F Format selection F12 Go to Definition Alt+F12 Peek Definition Ctrl+K F12 Open Definition to the side Ctrl+. Quick Fix Shift+F12 Show References F2 Rename Symbol Ctrl+K Ctrl+X Trim trailing whitespace Ctrl+K M Change file language Editor management Ctrl+F4, Ctrl+W Close editor Ctrl+K F Close folder Ctrl+ Split editor Ctrl+ 1 / 2 / 3 Focus into 1 st, 2nd or 3rd editor group Ctrl+K Ctrl+ ←/→ Focus into previous/next editor group Ctrl+Shift+PgUp / PgDn Move editor left/right Ctrl+K ← / → Move active editor group File management Ctrl+N New File Ctrl+O Open File... Ctrl+S Save Ctrl+Shift+S Save As... Ctrl+K S Save All Ctrl+F4 Close Ctrl+K Ctrl+W Close All Ctrl+Shift+T Reopen closed editor Ctrl+K Enter Keep preview mode editor open Ctrl+Tab Open next Ctrl+Shift+Tab Open previous Ctrl+K P Copy path of active file Ctrl+K R Reveal active file in Explorer Ctrl+K O Show active file in new window/instance Display F11 Toggle full screen Shift+Alt+0 Toggle editor layout (horizontal/vertical) Ctrl+ = / - Zoom in/out Ctrl+B Toggle Sidebar visibility Ctrl+Shift+E Show Explorer / Toggle focus Ctrl+Shift+F Show Search Ctrl+Shift+G Show Source Control Ctrl+Shift+D Show Debug Ctrl+Shift+X Show Extensions Ctrl+Shift+H Replace in files Ctrl+Shift+J Toggle Search details Ctrl+Shift+U Show Output panel Ctrl+Shift+V Open Markdown preview Ctrl+K V Open Markdown preview to the side Ctrl+K Z Zen Mode (Esc Esc to exit) Debug F9 Toggle breakpoint F5 Start/Continue Shift+F5 Stop F11 / Shift+F11 Step into/out F10 Step over Ctrl+K Ctrl+I Show hover Integrated terminal Ctrl+` Show integrated terminal Ctrl+Shift+` Create new terminal Ctrl+C Copy selection Ctrl+V Paste into active terminal Ctrl+↑ / ↓ Scroll up/down Shift+PgUp / PgDn Scroll page up/down Ctrl+Home / End Scroll to top/bottom Read the full article
0 notes
techtechinfo · 2 years
Text
How to use Socket for realtime chat application in Node Js
Tumblr media
What is node js?
Node js is not a language. It is an environment that is open source, cross-platform, and  back-end JavaScript runtime environment that runs on the V8 javascript Engine Developed by Google chrome.  What node js can do? Node.js can create, open, read, write, delete, and close files on the server Node.js can add, modify, and delete data in your database Node.js can generate the dynamic page content Node.js can collect form data
What is WebSocket or socket.io?
the socket is a bidirectional connection between the client and server. It is a continuous connection between the server and client until any of the ones have not terminated the connection. It uses the full-duplex protocol. When we can use a web socket? Real-time web application:  in real time chat application we need to show the live data on the website or application without loading the page from the client end. Gaming application: In a Gaming application, you can see that data is continuously received by the server, and without refreshing the UI Chat application: for real-time chat applications between one-to-one users or one-to-many users    How to install web socket in node js application. Step 1: you should have installed the node js on your computer and created a base project of node js  Step 2: run the command in the terminal npm i socket.io step 3: after creating the HTTP server listen to line past the below code in your app.js your group joining request is created and a message emit request is created. httpServer.listen(3001); const io = require('socket.io')(httpServer, { allowEIO3: true,     cors: {          origin: true,          credentials: true      }, }); io.on("connection", async (socket) => { var MyRoomId = "myroomid"          socket.on("joinGroup", async (data) => {                                     await socket.join(MyRoomId);                     console.log(“user successfully connected with room”);         });   socket.on("sendMessage", async (data) => {                   await io.in(MyRoomId).emit("sendMessage_response",  {                    "error": "false",                      "message": "Message Received successfully",                     "chat": data.message                 });              return;         }); }); Now let's understand the code line by line. Const io holds the reference of socket connection. Which created the socket connection later. io.on("connection", async (socket)  After creating the connection we have created an API by which the user will join the group. and Both the users can broadcast their messages from both ends.  socket.on("joinGroup", async (data) After joining the request we need to create another request that will send the message to the group  socket.on("sendMessage", async (data) Now we need to emit the user message in the group so other users can easily read the message that is emitted by other users in the group.  await io.in(MyRoomId).emit("sendMessage_response",  {                    "error": "false",                      "message": "Message Received successfully",                     "chat": data.message                 }); Here we have emitted the JSON in myRoomid  And the listener of the message is the sendMessage_response listener. 
Tumblr media
How to run socket on postman Read the full article
0 notes
techtechinfo · 2 years
Text
How to install JDK (java development kit) in windows 
Tumblr media
JDK (Java Development kit) is the tool that needs to run the java application on your computer. It is the collection of tools that create the environment to run the java application for example JVM (Java virtual machine) and JRE (Java Runtime Environment). JVM and JRE are part of JDK, to install the JVM and JRE we can only install the JDK in our machine.  JDK version History Version Release date End of Free Public Updates Extended Support Until JDK Beta 1995 ? ? JDK 1.0 January 1996 ? ? JDK 1.1 February 1997 ? ? J2SE 1.2 December 1998 ? ? J2SE 1.3 May 2000 ? ? J2SE 1.4 February 2002 October 2008 February 2013 J2SE 5.0 September 2004 November 2009 April 2015 Java SE 6 December 2006 April 2013 December 2018 December 2026 for Azul Java SE 7 July 2011 July 2019 July 2022 Java SE 8 (LTS) March 2014 March 2022 for Oracle (commercial) December 2030 for Oracle (non-commercial) December 2030 for Azul May 2026 for IBM Semeru At least May 2026 for Eclipse Adoptium At least May 2026 for Amazon Corretto December 2030 Java SE 9 September 2017 March 2018 for OpenJDK N/A Java SE 10 March 2018 September 2018 for OpenJDK N/A Java SE 11 (LTS) September 2018 September 2026 for Azul October 2024 for IBM Semeru At least October 2024 for Eclipse Adoptium At least September 2027 for Amazon Corretto At least October 2024 for Microsoft September 2026 September 2026 for Azul Java SE 12 March 2019 September 2019 for OpenJDK N/A Java SE 13 September 2019 March 2020 for OpenJDK N/A Java SE 14 March 2020 September 2020 for OpenJDK N/A Java SE 15 September 2020 March 2021 for OpenJDK March 2023 for Azul N/A Java SE 16 March 2021 September 2021 for OpenJDK N/A Java SE 17 (LTS) September 2021 September 2029 for Azul At least September 2027 for Microsoft At least TBA for Eclipse Adoptium September 2029 or later September 2029 for Azul Java SE 18 March 2022 September 2022 for OpenJDK N/A Java SE 19 September 2022 March 2023 for OpenJDK N/A Java SE 20 March 2023 September 2023 for OpenJDK N/A Java SE 21 (LTS) September 2023 September 2028 September 2031   Download JDK for Windows (latest version) https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.exe
Tumblr media
Step 1 Execute the jdk-17_windowss-x64_bin.exe file by double click on the file Then give the admin permission if required. Step 2
Tumblr media
Click on next 
Tumblr media
Set the installation folder where you want to install the java in your computer. If you don’t know more about it leave it as default and click next.
Tumblr media
Jdk installation complete here Step 3 Now test JAV is install in the pc or not  Run the following command in the command prompt  Java –version If the given command returns the version of java that means your java has been installed globally. Else you can try after restarting your pc. In some case, pc need restart process after software installations
Tumblr media
Read the full article
0 notes
techtechinfo · 2 years
Text
How to search a value from a 2-dimensional array in PHP
Tumblr media
The array is a collection of similar types of data. Here you will learn how to search a value from a single dimensional array as well as a 2-dimensional array. We will use the array_search function for this task. Search for single Dimensional array:-  $a=array("a"=>"red","b"=>"green","c"=>"blue"); echo array_search("red",$a); Search for 2-Dimensional array:-  $a = array(        array(        'id' => 5698,        'first_name' => 'Peter',        'last_name' => 'Griffin',        ),        array(        'id' => 4767,        'first_name' => 'Ben',        'last_name' => 'Smith',        ),        array(        'id' => 3809,        'first_name' => 'Joe',        'last_name' => 'Doe',        )     ); print_r($a); //search first name of the user "Ben" $firstnameArray = array_column($a,"first_name"); $value = array_search("Ben",$firstnameArray); print_r($a); die; result:
Tumblr media
In the above code first, we have created a new array by the array_column function for a column. Here we have selected the first_name value to create a 1-dimensional array. Ex:  Array (     => Peter     => Ben     => Joe ) As we can see in the above array is single-dimensional so now we can add the array search function on this array that will return the index of value from the array  $value = array_search("Ben",$firstnameArray); Here array_search function will return  “1”.  As the index of “Ben” is 1 in the array. Now get the complete object from the parent array of the given index. $result = $a; Final result:-  Array (      => 4767      => Ben     => Smith )   Read the full article
0 notes
techtechinfo · 2 years
Text
How to read the text from Docx in php
Tumblr media
  Here you will learn about how to read the docx content in php. This library will return the text of the docx so that you can apply different operations on the given text. Here are the steps to convert docx to the text   Requirements   * php installation * Apache * vsCode * Download library (https://github.com/jpwright/debcite/blob/master/class.pdf2text.php)  # Step1: Download the Doc2Txt.php and past this in the root folder # Step2: create an index.php file in the same folder and paste the below code in the file   Read the full article
0 notes
techtechinfo · 2 years
Text
TikTok & WeChat banned by US Government
Tumblr media
TikTok & WeChat are banned by US government from today onwards as US Government said that these companies could provide User’s Data/Information to China but Both companies (TikTok & WeChat) has denied for the same. Trump Government says on Friday that WeChat will be surely banned from 20th of Sep but US users may continue use TikTok till 12th of Nov after that it will be fully banned.
Indian Government also banned all Chinese social Apps
Recently Indian government also has banned all Chinese social Apps included most popular apps like (TikTok , WeChat & most popular PubG game) due to same data security concern. As Indian government also share the same concern related to user information & Data security. Now the time to boycott Chinese apps & Products as china has given so many things to world like Corona virus, Data hacking, pushing world to 3 world war.
China did not use American Apps
As you Know China is a world most population natation, and you will be surprise that in Chian they didn’t use Google, Facebook, YouTube, WhatsApp and other important platforms. And china is using American companies’ platform (Play store & App Store) to reach out the world. This is best action by Trump Government and slowly other countries will also understand the Moto of China.
What is in the order?
"At the president's direction, we have taken significant action to combat China's malicious collection of American citizens' personal data," said by Wilbur Ross in his statement from Department of Commerce Secretary The Order says that from Sunday WeChat will be banned completed but TikTok uses will still able to use it. But they will not be able to receive any updates for that and from 12th of Nov it will completely closed same as WeChat. Read the full article
0 notes
techtechinfo · 2 years
Text
How to read the text from Pdf in php
Tumblr media
Here you will learn about how to read the pdf in php. These libraries return the text of the pdf so that you can apply different operations on the given text. In this tutorial, we will give you two options or a library to convert the pdf to text.
Requirements
* PHP installation * Apache * vsCode * Download any of the one library (https://github.com/jpwright/debcite/blob/master/class.pdf2text.php)   Or   (https://github.com/christian-vigh-phpclasses/PdfToText) # Step1: create a file with the name class.pdf2text.php and paste the code given below /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA This code is an improved version of what can be found at: http://www.webcheatsheet.com/php/reading_clean_text_from_pdf.php AUTHOR: - Webcheatsheet.com (Original code) - Joeri Stegeman (joeri210 yahoo com) (Class conversion and fixes/adjustments) DESCRIPTION: This is a class to convert PDF files into ASCII text or so called PDF text extraction. It will ignore anything that is not addressed as text within the PDF and any layout. Currently supported filters are: ASCIIHexDecode, ASCII85Decode, FlateDecode PURPOSE(S): Most likely for people that want their PDF to be searchable. SYNTAX: include('class.pdf2text.php'); $a = new PDF2Text(); $a->setFilename('test.pdf'); $a->decodePDF(); echo $a->output(); ALTERNATIVES: Other excellent options to search within a PDF: - Apache PDFbox (http://pdfbox.apache.org/). An open source Java solution - pdflib TET (http://www.pdflib.com/products/tet/) - Online converter: http://snowtide.com/PDFTextStream */ class PDF2Text {     // Some settings     var $multibyte = 2; // Use setUnicode(TRUE|FALSE)     var $convertquotes = ENT_QUOTES; // ENT_COMPAT (double-quotes), ENT_QUOTES (Both), ENT_NOQUOTES (None)     // Variables     var $filename = '';     var $decodedtext = '';     function setFilename($filename) {         // Reset         $this->decodedtext = '';         $this->filename = $filename;     }     function output($echo = false) {         if($echo) echo $this->decodedtext;         else return $this->decodedtext;     }     function setUnicode($input) {         // 4 for unicode. But 2 should work in most cases just fine         if($input == true) $this->multibyte = 4;         else $this->multibyte = 2;     }     function decodePDF() {         // Read the data from pdf file         $infile = @file_get_contents($this->filename, FILE_BINARY);         if (empty($infile))             return "";         // Get all text data.         $transformations = array();         $texts = array();         // Get the list of all objects.         preg_match_all("#obj(.*)endobj#ismU", $infile, $objects);         $objects = @$objects;         // Select objects with streams.         for ($i = 0; $i             $currentObject = $objects;             // Check if an object includes data stream.             if (preg_match("#stream(.*)endstream#ismU", $currentObject, $stream)) {                 $stream = ltrim($stream);                 // Check object parameters and look for text data.                 $options = $this->getObjectOptions($currentObject);                 if (!(empty($options) && empty($options) && empty($options)))                     continue;                 // Hack, length doesnt always seem to be correct                 unset($options);                 // So, we have text data. Decode it.                 $data = $this->getDecodedStream($stream, $options);                 if (strlen($data)) {                     if (preg_match_all("#BT(.*)ET#ismU", $data, $textContainers)) {                         $textContainers = @$textContainers;                         $this->getDirtyTexts($texts, $textContainers);                     } else                         $this->getCharTransformations($transformations, $data);                 }             }         }         // Analyze text blocks taking into account character transformations and return results.         $this->decodedtext = $this->getTextUsingTransformations($texts, $transformations);     }     function decodeAsciiHex($input) {         $output = "";         $isOdd = true;         $isComment = false;         for($i = 0, $codeHigh = -1; $i '; $i++) {             $c = $input;             if($isComment) {                 if ($c == 'r' || $c == 'n')                     $isComment = false;                 continue;             }             switch($c) {                 case '�': case 't': case 'r': case 'f': case 'n': case ' ': break;                 case '%':                     $isComment = true;                 break;                 default:                     $code = hexdec($c);                     if($code === 0 && $c != '0')                         return "";                     if($isOdd)                         $codeHigh = $code;                     else                         $output .= chr($codeHigh * 16 + $code);                     $isOdd = !$isOdd;                 break;             }         }         if($input != '>')             return "";         if($isOdd)             $output .= chr($codeHigh * 16);         return $output;     }     function decodeAscii85($input) {         $output = "";         $isComment = false;         $ords = array();         for($i = 0, $state = 0; $i             $c = $input;             if($isComment) {                 if ($c == 'r' || $c == 'n')                     $isComment = false;                 continue;             }             if ($c == '�' || $c == 't' || $c == 'r' || $c == 'f' || $c == 'n' || $c == ' ')                 continue;             if ($c == '%') {                 $isComment = true;                 continue;             }             if ($c == 'z' && $state === 0) {                 $output .= str_repeat(chr(0), 4);                 continue;             }             if ($c 'u')                 return "";             $code = ord($input) & 0xff;             $ords = $code - ord('!');             if ($state == 5) {                 $state = 0;                 for ($sum = 0, $j = 0; $j                     $sum = $sum * 85 + $ords;                 for ($j = 3; $j >= 0; $j--)                     $output .= chr($sum >> ($j * 8));             }         }         if ($state === 1)             return "";         elseif ($state > 1) {             for ($i = 0, $sum = 0; $i                 $sum += ($ords + ($i == $state - 1)) * pow(85, 4 - $i);             for ($i = 0; $i                 $ouput .= chr($sum >> ((3 - $i) * 8));         }         return $output;     }     function decodeFlate($input) {         return gzuncompress($input);     }     function getObjectOptions($object) {         $options = array();         if (preg_match("##ismU", $object, $options)) {             $options = explode("/", $options);             @array_shift($options);             $o = array();             for ($j = 0; $j                 $options = preg_replace("#s+#", " ", trim($options));                 if (strpos($options, " ") !== false) {                     $parts = explode(" ", $options);                     $o] = $parts;                 } else                     $o] = true;             }             $options = $o;             unset($o);         }         return $options;     }     function getDecodedStream($stream, $options) {         $data = "";         if (empty($options))             $data = $stream;         else {             $length = !empty($options) ? $options : strlen($stream);             $_stream = substr($stream, 0, $length);             foreach ($options as $key => $value) {                 if ($key == "ASCIIHexDecode")                     $_stream = $this->decodeAsciiHex($_stream);                 if ($key == "ASCII85Decode")                     $_stream = $this->decodeAscii85($_stream);                 if ($key == "FlateDecode")                     $_stream = $this->decodeFlate($_stream);                 if ($key == "Crypt") { // TO DO                 }             }             $data = $_stream;         }         return $data;     }     function getDirtyTexts(&$texts, $textContainers) {         for ($j = 0; $j             if (preg_match_all("#s*TJ#ismU", $textContainers, $parts))                 $texts = array_merge($texts, @$parts);             elseif(preg_match_all("#Ts*((.*))s*Tj#ismU", $textContainers, $parts))                 $texts = array_merge($texts, @$parts);             elseif(preg_match_all("#Ts*()s*Tj#ismU", $textContainers, $parts))                 $texts = array_merge($texts, @$parts);         }     }     function getCharTransformations(&$transformations, $stream) {         preg_match_all("#(+)s+beginbfchar(.*)endbfchar#ismU", $stream, $chars, PREG_SET_ORDER);         preg_match_all("#(+)s+beginbfrange(.*)endbfrange#ismU", $stream, $ranges, PREG_SET_ORDER);         for ($j = 0; $j             $count = $chars;             $current = explode("n", trim($chars));             for ($k = 0; $k                 if (preg_match("#s+#is", trim($current), $map))                     $transformations, 4, "0")] = $map;             }         }         for ($j = 0; $j             $count = $ranges;             $current = explode("n", trim($ranges));             for ($k = 0; $k                 if (preg_match("#s+s+#is", trim($current), $map)) {                     $from = hexdec($map);                     $to = hexdec($map);                     $_from = hexdec($map);                     for ($m = $from, $n = 0; $m multibyte); // 2 or 4 (UTF8 or ISO)                         for ($k = 0; $k                             $chex = str_pad($hexs, 4, "0"); // Add tailing zero                             if (isset($transformations))                                 $chex = $transformations;                             $document .= html_entity_decode("".$chex.";");                         }                         $isHex = false;                     break;                     case "(":                         $plain = "";                         $isPlain = true;                     break;                     case ")":                         $document .= $plain;                         $isPlain = false;                     break;                     case "":                         $c2 = $texts;                         if (in_array($c2, array("", "(", ")"))) $plain .= $c2;                         elseif ($c2 == "n") $plain .= 'n';                         elseif ($c2 == "r") $plain .= 'r';                         elseif ($c2 == "t") $plain .= 't';                         elseif ($c2 == "b") $plain .= 'b';                         elseif ($c2 == "f") $plain .= 'f';                         elseif ($c2 >= '0' && $c2 convertquotes);                         }                         $j++;                     break;                     default:                         if ($isHex)                             $hex .= $c;                         if ($isPlain)                             $plain .= $c;                     break;                 }             }             $document .= "n";         }         return $document;     } } ?> # Step2: create an index.php file in the same folder and paste the below code in the file include('class.pdf2text.php'); $a = new PDF2Text(); $a->setFilename('test.pdf'); $a->decodePDF(); $data = $a->output(); echo $data; echo "Hello"; # Step3: Put a pdf file in the same folder and change the file in the index.php file
Tumblr media
# Step4: Now hit the index file on the browser you will get the pdf
Tumblr media
Github link to download this project:- https://github.com/DeepakSharma78400/read-text-from-pdf.git Read the full article
0 notes
techtechinfo · 3 years
Text
How to integrate the Stripe Payment gateway in restful API using PHP
Tumblr media
Introduction of Stripe If you want to start your online business to sell some products and services. It Quite easy and straightforward to start. There are too many available in the market that can ease your work. The biggest problem for most startups is how to accept the payment for the end-user who is purchasing the product. We have lots of already built-in software in the market that can do this work for you with a secure socket. Installation  First, install the stripe library in your project using composer. If you have not installed the composer in your system then click here to learn how to install the composer in your system. composer require stripe/stripe-php OR  Add the below line in composer.json "stripe/stripe-php": "^7.60", Now run the below command composer install Account setup on stripe Create an account on stripe.com using the email id. There you will see two different environment modes first for the test env and second for the live environment. copy your private key from the test env and put it safely. Note: Change this key from the live when you will go to the production  setup stripe account Code Integration Paste your API key in the below code to connect stripe with your account. $STRIPE_API_KEY = “replace this text with your  private key”;  StripeStripe::setApiKey($STRIPE_API_KEY); Creating tokens for payment using stripe Token API.  $tokenData = StripeToken::create(,             ]); Creating Read the full article
0 notes
techtechinfo · 3 years
Text
How to optimize the php two-dimensional search 
Tumblr media
For search, the object or a row from a two-dimensional array most people use the for and foreach loop that consumes too much time to search if the record is large. It increases the iteration of a loop. That can consume too much memory and also raised the performance issue for the software if that code is accessible by multiple users through direct access or by API.  $users = ,,, ]; Now in the above array we want the user name for the user which have the user id 3 Worst approach foreach($users as $row) {     if($row==3){         $userName = $row;     } } OR for($i = 0;$i     if($users==3){         $userName = $users;     } } Best approach $key = array_search(3, array_column($users, 'user_id')); $userName = $users; In this approach we are using the two array function first array_column and second array_search. Array_column made an one dimensional array with that particular key. e.g user_id Below given array will be return from the array column function. $users ==>1,     =>2,     =>3,     =>4 ]; Now array_search function will return you the key where value 3 is exist. $key = array_search('3',$users); Let suppose it return you the 2 because value 3 exist on the key 2. $value = $users; Then you can easily access that value from the array  Read the full article
0 notes
techtechinfo · 3 years
Text
How to setup git in windows
Tumblr media
Introduction Git is widely use by the developer for working on a single project by multiple users from multiple devices. Uses can share their code and get another developer code by the git without sharing the files and folder.  Install git for windows Step 1: download git from here  and install it on your PC Step2: click on next to all default setting and it will install finally in c drive by default Set up an account on github.com  Step 1: login and signup on the github.com Step 2: Create a repository for your project  Step 3: Create a branch for your self and one more for another developer who will also work on the same project Step 4: to give the repository access to another developer you can invite him for the same repository. Setup get repository on your local machine step 1: open command prompt  Step 2: switch to the folder where you want to store the repository  Step 3: copy the repository URL from the GitHub Step4: now write the command in the command prompt with your repository URL git clone --single-branch --branch branch1 https://github.com/DeepakSharma78400/testing_repo.git Step5: Open the folder in your favorite code editor here I will use VS Code. If the terminal asked for the user name and password to take cole then run the below commands in CMD git config --global user.email [email protected] git config --global user.password ●●●●●●●●●●● Step6: create a new file and some line in the file and save Step7: Read the full article
0 notes
techtechinfo · 3 years
Text
Instagram, Facebook, Whatsapp, messenger Down Today
Tumblr media
Today all the big social media platforms owned by facebook are facing some issues. The issue from the backend server side. Unable to load the data on the platform.  Instagram is  the leading social platform on the internet. This is used for story and photo share purposes. Currently total 30028 issue reports are submitted on the downdecetor for instagram. That is very tought change for facebook and it reputation.  List of top 6 Platform Down Today Platform Date Reports count Instagram 19 Mar 2021 11:41 PM 30028 Messenger 19 Mar 2021 11:41 PM 157 Whatsapp 19 Mar 2021 11:41 PM 34127 Facebook 19 Mar 2021 11:41 PM 1697 Airtel 19 Mar 2021 11:41 PM 637 Jio 19 Mar 2021 11:41 PM 594   Read the full article
0 notes
techtechinfo · 3 years
Text
Operators in c language
Tumblr media
An Operator is the predefined symbols in c language. Which tells the compiler to perform the mathematical or logical operations.  Types of operators in c language Arithmetic Operator Assignment Operator Relational Operator Logical Operator Increment & Decrement Operator Bitwise Operator Ternary Operator Type Cast Operator sizeof Operator C shorthand   Arithmetic Operators:-  Arithmetic Operators are used for Arithmetic Operations for example add, multiply. 1 + Add 2 - Subtract 3 * Multiply 4 / Divide 5 % Modulus   Example: #include int main(){ int num1,num2; Int add,sub,mul,div,mod; printf(“nEnter First Number :”); scanf(“%d”,&num1); printf(“nEnter second Number :”); scanf(“%d”,&num2); add = num1 + num2; printf(“sum of entered no’s are %d”,add); sub = num1 - num2; printf(“subtraction of entered no’s are %d”,sub); mul = num1 * num2; printf(“Multiplications of entered no’s are %d”,mul); div = num1 / num2; printf(“Divisions of entered no’s are %d”,div); mod = num1 % num2; printf(“Modulas of entered no’s are %d”,mod); } Assignment Operator:- This Operator is used to assign the value to a variable. this is a binary operator that operates on two operands or variables. 1 = Assignment Operator   Example: #include int Read the full article
0 notes
techtechinfo · 3 years
Text
US President Donald Trump banned 60 Chinese tech companies in his last week of presidency
Tumblr media
The Trump administration puts  the Semiconductor Manufacturing international corp (SMIC) and Drone drone maker DJI; and dozens of other Chinese companies and universities on an export blacklist List of Chinese companies add to export blacklist AGCU Scientech; Beijing Institute of Technology; Beijing University of Posts and Telecommunications (BUPT); China Communications Construction Company Ltd.; Read the full article
0 notes
techtechinfo · 3 years
Text
Youtube and Google Down today
Tumblr media
Today youtube and other products of Google like google sheets, Gmail, Google Docs, and more are down today. youtube has announced that they know the issue. and the team is working to fix this bug.   Google is the world's largest search engine. The firm also offers the Gmail e-mail service, the video hosting platform Youtube, Google maps, Google Talk and the Google+ social network. Google develops the Chrome browser and the Android software for smart phones including the Google Play store for mobile apps, as well as the Adwords and Adsense advertising platforms. Google Document Down   Google Sheets Down   Gmail Down   Google Account Down Read the full article
0 notes
techtechinfo · 3 years
Text
Keywords and Datatypes in C language
Tumblr media
What is a keyword? Keywords are the reserved word’s in a programming language. These are predefined in a programming language and has different mean for the compiler. These keywords can’t be used as a user-defined program identifier. List of keyword defined in the c language   auto double int struct break else long switch case enum register typedef char extern return union continue for signed void do if static while default goto sizeof volatile const float short unsigned Example : #include       int main() { int a; double x;   return 0; } What is Data Type? Data types are used to define the variable and function in a program to store the value of different sizes or types. The data type is useful to save memory space. We have different datatype to store the different sizes of data.  List of dataTypes with respect to their sizes   Type Size (bytes) Format Specifier int at least 2, usually 4 %d, %i char 1 %c float 4 %f double 8 %lf short int 2 usually %hd unsigned int at least 2, usually 4 %u long int at least 4, usually 8 %ld, %li long long int at least 8 %lld, %lli unsigned long int at least 4 %lu unsigned long long int at least 8 %llu signed char 1 %c unsigned char 1 %c long do00 Comments in moderationuble at least 10, usually 12 or 16 %Lf Example: #include       int main() {   int a;   printf("size of int= %d bytesn", sizeof(a));   return 0; } Read the full article
0 notes
techtechinfo · 3 years
Text
Variables in c language
Tumblr media
The variable in c language is the name of the store location. These locations are used to store the data. And we can change the data at that location multiple times. Different type of variable take different memory size in storage according to their data type i.e int contains 2 bytes. The variable in the C programming language is also called a container to store the data. Different type of data types contain the different size of memory in storage The variable in c is also called the building block of c programming. Which is called an Identifier. A Variable is the actual location of memory where the data is stored  Type of Variables Local Variables Global Variables Local Variables These variables having the local scope of access. Local variables are accessible only from the inside of the function or block in which it is declared. It has higher priority than Global variables Global Variables Global variables are variables that have global scope Scope of Global variables is throughout the program The global variable can’t be accessible inside the function if you declared a local variable with a name inside the function because the global variable has a higher priority. Variable name Rules in C programming language A variable can’t alphabets(a-z,A-Z), digits(0-9), and underscore(_). A variable name can’t start with a digit  The variable name can be started from the alphabet and underscore. Read the full article
0 notes