This article demonstrates how to connect to MySQL using JDBC.
How to connect Java to MySQL using JDBC
This post shows how to connect Java to MySQL using JDBC. Therefore, nothing fancy here. Just JDBC basics. MySQL JDBC Requirements We used the following items for this post. Although we can use newer versions, the Java JDBC codes pretty
How to get HttpServletRequest Object in JSF
So you’re using JSF and Spring. You thought your application is modern but then you hit a showstopper bug from either library that you could not retrieve the request parameters. Time to use some old-school Servlet/JSP API. This article demonstrates how to retrieve HttpServletRequest object in JSF.
How to List a Specific number of Random Rows in MySQL
Let’s say you have a list of 10 items you want to display but these items are randomly chosen items. In MySQL, you use the rand() function in the ORDER BY clause. This article demonstrates how to list a specific number of random rows my MySQL.
How to use phpfastcache to Cache Data to Files
Background [wp_ad_camp_5] Most of the PHP Frameworks I worked on or experimented with have their own ways of caching things to reduce calls to other systems (e.g., RDBMS) or interfaces to plug in third-party caching libraries. But what if you
How to fix “Warning: Invalid argument supplied for foreach()” in PHP
When we are working with loops, we sometimes need to check first if the variables are iterable. Otherwise, we get the warning message “Warning: Invalid argument supplier for foreach()” in PHP. We get this warning when we use variables are
How to update User Country and Language in SAP NetWeaver Portal
We can create SAP NetWeaver Portal users from various sources. One is through LDAP. Unfortunately, the details from LDAP are never comprehensive. Next, is through user inputs. Users register and provide details like country and language. This post shows how
How to Trace Program Flow using Log4j2
Do you not hate it to log method with “entry” and “exit” texts? Should you use “start” or “entry”? This article demonstrates how to use Log4j2 API to perform flow tracing without the need to provide texts.
How to Zip a file or the contents of a Directory in PHP
Background This article demonstrates how to archive the contents of a directory in PHP using ZipArchive class. [wp_ad_camp_1] Software Requirements Windows 7 Professional SP1 PHP 5.5.9 / Zend Engine v2.5.0 NetBeans IDE 8.0.1 Zip a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* * Copyright 2014 www.turreta.com. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Description of ZipArchiveSample * * @author www.turreta.com */ $zip1 = new ZipArchive(); $zip1->open("zip_add_single_file.zip", ZipArchive::CREATE); $zip1->addFile('zipme.txt', 'zipme.txt'); $zip1->close(); |
Zip a Directory
How to create MD5 checksum for Jar Files using Apache Ant
Background This article demonstrates how to create an MD5 checksums for jar files using Ant. This is useful to verify if correct jar files have been used to deploy in some environment by other team, e.g., SQA. [wp_ad_camp_1] Software Environment