In C++, integer values can be represented in different formats, including decimal, binary, and hexadecimal. Hexadecimal is a base-16 numbering system that uses 16 digits, from 0 to 9 and from A to F. In this post, we will explore how to input and output hexadecimal integers using iostream in C++. Outputting Hexadecimal Integers To
Read more
Author: Eric Ma
Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.Micosoft招聘部分算法题
Posted onMicosoft招聘部分算法题 1.链表和数组的区别在哪里? 2.编写实现链表排序的一种算法。说明为什么你会选择用这样的方法? 3.编写实现数组排序的一种算法。说明为什么你会选择用这样的方法? 4.请编写能直接实现strstr()函数功能的代码。 5.编写反转字符串的程序,要求优化速度、优化空间。 6.在链表里如何发现循环链接? 7.给出洗牌的一个算法,并将洗好的牌存储在一个整形数组里。 8.写一个函数,检查字符是否是整数,如果是,返回其整数值。(或者:怎样只用4行代码编写出一个从字符串到长整形的函数?) 9.给出一个函数来输出一个字符串的所有排列。 10.请编写实现malloc()内存分配函数功能一样的代码。 11.给出一个函数来复制两个字符串A和B。字符串A的后几个字节和字符串B的前几个字节重叠。 12.怎样编写一个程序,把一个有序整数数组放到二叉树中? 13.怎样从顶部开始逐层打印二叉树结点数据?请编程。 14.怎样把一个链表掉个顺序(也就是反序,注意链表的边界条件并考虑空链表)? 来源:·日月光华 bbs.fudan.edu.cn
How to Connect to MySQL in JSP
Posted onWe use tomcat as the container used for instructions in the post. 1) Download the driver mysql-connector-java-*.*.*-bin.jar and put it into WEB-INF/lib/, and remember to restart tomcat. 2) The example code as follows. String driverName=”com.mysql.jdbc.Driver”; String userName=”username”; String userPasswd=”password”; String dbName=”dbname”; String tableName=”tablename”; String url=”jdbc:mysql://localhost/”+dbName+”?user=”+userName+”&password=”+userPasswd; Class.forName(“com.mysql.jdbc.Driver”).newInstance(); Connection conn=DriverManager.getConnection(url); Statement statement = conn.createStatement(); String sql=”SELECT *
Read more
Java Calling Native Functions in .DLL on Windows
Posted onHow to call a function in .dll from Java on Windows is introduced in this post with an example. Platforms used: OS: Microsoft Windows XP [5.1.2600] C to .dll compiler: MS Visual Studio 2008 JDK: java -version java version “1.6.0_05” Java(TM) SE Runtime Environment (build 1.6.0_05-b13) Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
Read more
Controlling Display of WordPress Widget with PHP Code
Posted onI am always wondering how to display different Widgets in WordPress depending on the page/post/category etc. I ever tried some plugins that is for specific purpose. However, they are not flexible enough for all my needs. For example, I want a widget that contains AdSense ad not display on certain posts that I selected and
Read more
CloudFlare with DreamHost
Posted onCloudFlare is a very nice service that provides CDN / optimizer / security protection and more. Good news is that DreamHost turns to be a partner with CloudFlare. The free account on CloudFlare is enough for sites such as Fclose.com. I enabled CloudFlare yesterday and it works smoothly and boosts the site’s performance. Overall, I
Read more
How to Disable WordPress Visual Editor
Posted onThe visual editor provides a visual editor to write and format posts. However, it tries to format the HTML tags written in the HTML editor when turning to the visual editor, and may delete some HTML tags and screw up HTML tags. Even when we set the editor to HTML editor, WordPress may automatically turn
Read more
HTML Document Character Set and Encoding
Posted onHTML authors need to look up HTML character encodings frequently as some characters can not (or hard to) be typed out directly from the keyboard. If you would like not do the math and search, you may find the HTML symbols you want to use and its HTML code in Reference: Special HTML Characters. Calculating
Read more
BBCode Support in WordPress
Posted onBBCode is another markup language to format posts widely by forums, which is easier and clearer than HTML. WordPress provides a visual editor and some easy-to-use tools, but no built-in BBCode support. Let’s see how to add BBCode support in WordPress. We can add BBCode support to WordPress with the BBCode plugin by bOingball that
Read more
Web2 Icons: Icons of Social Networking in iPhone Style
Posted onWhen I tried to find a group of icons for my site, I got to the Web 2 Icons and decided to use it. Web2 icons is a set of icons of social networking in iPhone style. I used the RSS feed, twitter and facebook icons. But it has more icons in the package. It
Read more
An Online JPG to EPS Converter
Posted onConverting the JPG images to EPS is frequently need especially when write documents in LaTeX. I introduced how to Convert JPG Images to EPS on Linux. However, not everyone have a Linux box available at any time. We set up an Online JPG to EPS Converter to help people convert JPG to EPS. Convert JPG
Read more
A Free Personal WordPress Blog Solution
Posted onIf you want to have a wordpress blog for FREE co.cc + x10hosting is the best choice. I will introduce both in this post. I will briefly introduce how to set up a wordpress blog like my blog. The overall that I paid for this blog is only $0.89. I can say that it is
Read more
Google PageRank Update 2011
Posted onUpdate 3: Fclose.com sees minor PageRank updates on November 8, 2011. For example, some tooles and some posts get PageRank of 3 from 0. Update: Confirmed that Google updates the PageRank in toolbar on November 8 2011. Update 2: Google updates the PageRank in toolbar on August 05 2011. Update 1: Google updates the PageRank
Read more
Speeding Up the Site With Apache GZIP Compression
Posted onWe can speed up the site with compression while save bandwidth at the same time. As most of the modern browsers support gzip encoding, we can set it up to let the users enjoy faster speed. The Apache mod_deflate is easy to set up and standard. It compress the content on the fly. We can
Read more
Changing the Font Size of WordPress’s Visual Editor
Posted onThe font size of WordPress’s visual editor is too small for me on my screen display. The default font size is 13px which is hard for my eye on my screen. There are two ways to change the default font size in the visual editor. One is changing WordPress’s css file for the editor while
Read more
RGBlite WordPress Theme
Posted onAbout RGBlite Theme RGBlite Theme is a simple and light-weight theme for WordPress. RGBlite Theme provides a green-red-blue mixed style, bright view and fast rendering experience to the users. RGBlite Theme passes W3C XHTML 1.0 and W3C CSS level 3 validation. This theme works well on WordPress 2.9.x and WordPress 3.0. RGBlite theme is among
Read more
How to Redirect WordPress Feed to Feedburner Using .htaccess
Posted on.htaccess is a powerful tool. Let’s look at how to using .htaccess to redirect WordPress feeds to feedburner. Let’s use my blog as the example. The WordPress’s feed url of my blog is https://www.systutorials.com/feed/. Now I want to redirect it to feedburner with url http://feeds.feedburner.com/systutorials . The idea is quite straightforward: For every request to
Read more
Speeding Up the Site by Using PHP GZIP Compression
Posted onCompression is a simple way to speed up the site. PHP’s gzip compression is excellent. And using it is very convenient: Simply put these codes before any HTML content at the beginning of the PHP script: <?php if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip’)) ob_start(“ob_gzhandler”); else ob_start(); ?> In WordPress, the suitable position for these codes is the beginning
Read more
How to Read File into String in PHP
Posted onRead content of a file to string (in this example, we echo it): // Get text from file function get_text($text_filename) { if ($text_filename != “”) { $text = “”; $text_file = fopen($text_filename, “r”); while (!feof($text_file)) { $text = $text . fgets($text_file, 4096); } fclose($text_file); if ( $text != “” ) { echo $text; } }
Read more
Get the Number of All Posts in WordPress
Posted onUse the wp_count_posts() function to get the posts count. The code: <?php $count_posts = wp_count_posts(); $count_pages = wp_count_posts(‘page’); echo “<li><a href=” . get_option(‘home’) . “>”; echo $count_posts->publish . ” Posts, ” . $count_pages->publish . ” Pages”; echo “</a></li>” ?>