Thinkphp random problems such as selling 10 News, 10 News are sorted: 1, 2, 3, 4, 5, 5, 5, 6, 6, 7;
When the same order number is encountered, it is displayed randomly. That is, the same order number is randomly displayed.
I don't know how to write this thing. can I implement it?
Reply to discussion (solution)
$ Arr = array (Array ('id' => 1, 'name' => 'AAA', 'uid' => 1 ),Array ('id' => 2, 'name' => 'BBB ', 'uid' => 2 ),Array ('id' => 3, 'name' =
generated. When a large number of pointing operations are performed, a large number of objects are created, which leads to performance problems.
To solve this problem, jkd provides a variable supporting class StringBuffer for the string class. As StringBuffer is variable, splicing only changes the internal data structure without creating new objects. Therefore, the performance is greatly improved.
How can I implement a class definition that contains the string type?
String is a reference type,
regular expression bash itself does not support regular expression, but only supports wildcards *? Regular Expressions can be executed through some commands, such as grep, vi, sed, awk, such as introduction 03 in Linux shell BASICS (II. interaction with shell scripts # cd/tmp/ddd/# ls ...... # Rm-rf * # vi #! /Bin/bashecho $1 \ $1 echo $2 \ $2 echo $3 \ $3 echo $ #\\ \# echo $? \ $ \? Echo $ \ $ wq # chmod a + x a #./a $1 $2 $30 $ # (How many parameters are input) 0 $? 3061 $ #./a aaa
code is executed, JVM first goes to the string pool to check whether there are "AAA" objects. If so, no new objects will be created, directly return the reference of an existing object. If it does not exist, create the object first, add it to the string pool, and then return its reference.
Java code
String str1 = "AAA ";
String str2 = "AAA ";
Only one object is created. The above explanation makes it clearer. When the second line of code is executed, the AAA String object already exists in
Instance scenario. For string: "AAAA AAA BBBB bbb bbb CCCCCCCC".1. Separate as "AAAA AAA". "BBBB BBB BBB". "CCCCCCCC"2. Separate as "AAAA", "AAA". "BBBB", "BBB". "BBB", "CCCCCCCC"Implementation code:void Main () {var str = "AAAA A
the string pool.When this line of code is executed, the JVM looks in the string pool to see if an object with the value "AAA" already exists, and if it does, no longer creates a new object, returns a reference to the existing object directly, and if it does not, it is created first, then added to the string pool, and its reference is returned.Java code
String str1="AAA";
String str2="AAA";
Only 1 objects are created. The above explanation is even clearer, when executing the se
equals are finished, say again the construction of the stringThere are two types of strings that we use most oftenString a1= "BBB";String A2=new string ("CCC");There are two different ways ofThe first way, through the above figure, we also see, BBB this data is stored in the constant pool, the exact word is to use string a1= "BBB" in such a way to produce a stri
This article focuses on English, the main market is the United States, the main job is foreign trade e-commerce, record a little experience I encountered.
1. BBB accept
Logo:, there is another
The full name of BBB is Better Business Bureau. It is a very authoritative certification organization. Generally, as long as an enterprise has this logo, it can hardly worry, because it has to have some strength
How does php compare whether two arrays are equal to two arrays? $ aarray (aaa, bbb, ddd, aaa); $ barray (aaa, ddd, aaa, bbb ); to determine whether the two arrays are equal, the premise is that they cannot be sorted using built-in functions such as sort. If you must use a built-in function, which sort function is the fastest? If you are interested, you can see the following question in the example: how to
following is the sorting code for testing. Here, the sorting is based on the attr2 and attr3 attributes of embedded object B of object.
from operator import itemgetter, attrgettera1 = A(B('u1', 'AAA', 100))a2 = A(B('u2', 'BBB', 100))a3 = A(B('u3', 'BBB', 10))aaa = (a1, a2, a3,)print sorted(aaa, key=attrgetter('b.attr2', 'b.attr3'))print sorted(aaa, key=attrgetter('b.attr2', 'b.attr3'), reverse=True)
Run th
Middle BracketBrackets are divided into single brackets [], and double brackets [[]], and brackets are commonly used in expression judgments, and parentheses can also be used in expressions, as mentioned later.Single brackets []a=5b=3[$A-eq $B] determine if A is equal to b[${a}-eq ${b}] ["${a}"-eq "${b}" function as abovea=abc[$A = = "abc"] or write [${a} = = "abc"] or write ["${a}" = = "abc"] [$A \> "ABC"][-D./aaa.sh-a-E./bbb] Tests whether the aaa.s
Python1, suppose aaa=[1,1,1,3,5,2,6,1,7,3,45], how do you use Python to filter out the numbers repeated in the list?>>>list (Set (AAA))2, briefly describe the difference between list and tripeList is dynamic, set up can be deleted elements, and tripe is static, can not delete elements, and tripe will automatically go heavy.3. Briefly describe the difference between search () and match ()4, how to generate a random number?>>>import Random>>>random.random ()"comment" This will generate a floating-
character *? Regular expressions can be executed with some commands, such as the introduction of Grep,vi,sed,awk in Linux shell (ii) 03. Interaction with Shell scripts #cd/tmp/ddd/#ls ... #rm-rf * #vi a#!/bin/ Bashecho $ \$1echo $ \$2echo $ \$3echo $# \$\ #echo $? \$\?echo $$ \$\ $wq #chmod a+x a#./a$1$2$30 $# (input number of parameters) 0 $?3061 $$#./a aaa bbb cccaaa $1bbb $2CCC $34 $ #0 $?3064 $$ #vi b#!/b In/bashecho Stop $ $2ing ... #./b httpd s
HTML Table Code General people will write, nothing but the use of th, TR, TD, the Novice webmaster network to say the table code upgrade, table code across rows across columns, a row of multiple columns or a column of the use of multiple rows:Cross-row, row-by-column, or one-column-by-row code that is used primarily for multiple rows is and is used across multiple colspan rowspan columns when used colspan across multiple rows rowspan . For example, a row across 2 columns, you can write colspan="
to Print_r and var_dump, but rarely used.Var_dump:This function displays information about the structure of one or more expressions, including the type and value of the expression. The array recursively expands the value and displays its structure by indenting it.The difference between Var_dump and Print_r:Var_dump returns the type and value of an expression and print_r only returns results, which is easier to read than debugging code using Var_dump.
Print_r (), Var_export (), Var_dump () The d
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.