Samual Sam has Published 2310 Articles

std::vector::resize() vs. std::vector::reserve() in C++

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

3K+ Views

Vectors have the ability to resize itself automatically like dynamic arrays when an element is inserted or deleted, the container handle their storage automatically.The main difference between vector resize() and vector reserve() is that resize() is used to change the size of vector where reserve() doesn’t. reserve() is only used ... Read More

Fetch the value in a Java Pair Class Tuple

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

485 Views

Use the getValueX() method to fetch the value from Pair Tuple class in Java at a particular index. For example, getValue0().Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to ... Read More

How to use multiple resource bundle in same JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

352 Views

The tag is used to load a resource bundle and stores it in the named scoped variable or the bundle configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultbasenameBase name of the resource bundle family to expose as a scoped or a configuration variableYesNonevarName of the variable to store ... Read More

Adding Navigation Bar programmatically iOS using Swift

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

3K+ Views

To add navigation bar programmatically we’ll go through a series of steps that are mentioned below. We’ll be doing this in ViewWillLayoutSubviews method of our viewController.Getting the width of the current View.let width = self.view.frame.widthCreating a navigation bar with the width of our current view and height of 44 px ... Read More

Drop a MySQL Table after x hours?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

145 Views

You need to create event to drop table after x hours. The syntax is as follows −CREATE EVENT yourEventName ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL x HOUR DO DROP TABLE IF EXISTS yourTableName;Let us first create a table −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY ... Read More

ftp_chmod() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

138 Views

The ftp_chmod() function set permissions on a remote file via FTP.Syntaxftp_chmod(con, mode, my_file);Parameterscon − The FTP connectionmode − The new permissions.It consists of four numbers −The first number is always zeroThe second number specifies permissions for the OWNERThe third number specifies permissions for the OWNER's USER GROUPThe fourth number specifies ... Read More

Get Sub Map from TreeMap in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

243 Views

To get Sub Map in Java, use the submap() method. It returns the elements in a range from the Map.First, create a TreeMap and add elements −TreeMap m = new TreeMap(); m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); m.put(5, "Java"); m.put(6, "AngularJS"); m.put(7, "ExpressJS");Now, get the Sub Map between ... Read More

ftp_connect() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

448 Views

The ftp_connect() function opens an FTB connection.Syntaxftp_connect(host, port, timeout);Parametershost − The FTP server to connect toport − The port of the FTP server. The default is 21. The host can be a domain or IP address.timeout − The timeout for network operationReturnThe ftp_connect() function returns an FTP stream on success ... Read More

Change a file attribute to read only in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

849 Views

A file attribute can be changed to read-only by using the method java.io.File.setReadOnly(). This method requires no parameters and it returns true if the file is set to read-only and false otherwise. The method java.io.File.canWrite() is used to check whether the file can be written to in Java and if ... Read More

ftp_exec() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

235 Views

The ftp_exec() function is used to execute a command on the FTP server.Syntaxftp_exec(con, command)Parameterscon − The FTP connectioncommand − The command to execute.ReturnThe ftp_exec() function returns TRUE if the command was executed successfully, else FALSE.ExampleThe following is an example that executes a command on the FTP server −Read More

Advertisements