text:
namespace rocksdb {

// An interface for converting a slice to a readable string
class SliceFormatter {
 public:
  virtual ~SliceFormatter() {}
  virtual std::string Format(const Slice& s) const = 0;
};

// Options for customizing ldb tool (beyond the DB Options)
struct LDBOptions {
  // Create LDBOptions with default values for all fields
  LDBOptions();

  // Key formatter that converts a slice to a readable string.
  // Default: Slice::ToString()
  std::shared_ptr<SliceFormatter> key_formatter;

  std::string print_help_header = "ldb - RocksDB Tool";
};

class LDBTool {
 public:
  void Run(
      int argc, char** argv, Options db_options = Options(),
      const LDBOptions& ldb_options = LDBOptions(),
      const std::vector<ColumnFamilyDescriptor>* column_families = nullptr);
};

}  // namespace rocksdb

#endif  // ROCKSDB_LITE


text:
Q: PHP to display string 0 I need help with this code all i need is to display a string "0" to the empty hit data so what i have in mind is day 1 has 3 hits and day 2 has 0 hits, i really have no idea how to display the 0 please help me. thank you
days || Hits
 1 - | | |- 3
 2 - | | |-
 3 - | | |-
 4 - | | |-
 5 - | | |- 5

here's the code:
$year = date("Y");
$month = $_POST['selected_date'];
if(!isset($month) or $_POST['selected_date'] == 0)
{
  $month = date("n");
}
 $num = cal_days_in_month(CAL_GREGORIAN, $month, $year);

    for($i = 1; $i <= $num; $i++)
    {
     echo "<p >$i - ";

     $query = mysql_query("SELECT DATE_FORMAT(`LookbookLogDate`, '%m') as 'month', DATE_FORMAT(`LookbookLogDate`, '%d') as 'day',
COUNT(`LookbookLogID`) as 'total'
FROM LookbookLog
where Lookbook_LookbookID = $LookbookID and LookbookLogDate like '%2013-03%'
GROUP BY DATE_FORMAT(`LookbookLogDate`, '%m'), DATE_FORMAT(`LookbookLogDate`, '%d')");
        while($row = mysql_fetch_array($query))
        {
               $day = $row['day'];

           $total = $row['total'];

             if($day == $i) echo $total."</p>";
        }

    }

A: I would get the zero from the database, since there is a universal SQL function which achieves a good solution:
SELECT
DATE_FORMAT(`LookbookLogDate`, '%m') as 'month',
DATE_FORMAT(`LookbookLogDate`, '%d') as 'day',
COALESCE(COUNT(`LookbookLogID`),0) as 'total'
FROM LookbookLog
{snip}

This means if there's no value in the results for COUNT() it will select 0 instead. Then your echo statements will proceed to work fine without checking especially for the NULL case in your application.

A: Try using the empty() function, the empty() function considers many things as a true value, for a list of these values have a look here http://php.net/manual/en/function.empty.php
$total = (empty($row['total'])?0:$row['total']);

Update:
You should only need to do the below to get the results you are looking for.
$total = ($row['total']?$row['total']:0);

A: if you do echo 0 it will display 0 on the screen, however if you do echo false it will not display it. Now the problem that you have is not with displaying 0 but its in what value $total holds. If your query returns empty set then your $row['total'] is either false or null and therefore echo false or echo null will not display anything.
check to make sure your query returns something and that $total holds the desired value using var_dump to see the type of it.
You would need something like
   $total = ! empty($row['total']) ? $row['total'] : 0;

A: Edit: Why not just make the field an int and set the default value to 0 ?
You don't show any code of how you build your table, but you would do:
$total = ((!$row['total'] ? 0 : $row['total']);

This code basically says "if $row['total'] is blank, make it zero. Otherwise, make the $total equal to whatever was returned.

A: Your problem is that COUNT(...) returns NULL instead of 0 if there are no results, which presumably PHP treats as an empty string when you output it. You can fix that by either adding an COALESCE expression to your SQL (in my opinion, this is the better solution):
SELECT ... COALESCE(COUNT(`LookbookLogID`), 0) ...

Or check it in PHP:
echo $row['total'] ? $row['total'] : 0;

Or the multi-line version:
if($row['total'])
    echo $row['total'];
else
    echo 0;

Note that you don't need to do any comparisons or call empty(), because PHP's type casting treats null, empty string and 0 as false.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Abstract Algebra, group Can someone please help me with this question.
Prove that the set of permutations of a set S is a closed under the operation of composition.
I know that for something to be closed that means two elements in the set under some operation will stay in the set.

A: A permutation of a set $X$ is a bijection $f:X\rightarrow X$. Therefore, any composition of permutations must stay in $X$.

A: Although this problem is very simple, the key is to use the fact that the composition of bijections is also a bijection.
A permutation of $S$ is a bijection from $S$ to $S$.
Let $a$, $b$ be permutations of $S$.
Since the composition of two bijections is also a bijection, $ab$ is a bijection from $S$ to $S$.
Hence $ab$ is also a permutation of $S$, and the set of permutations of $S$ is closed.

A: A permutation of a set $X$ is nothing mire than a bijective function $f:X \to X$. If $g,h:X \to X)$ are permutations (hence elements of $\mathbb{S}$) then $g \circ h: X \to X$ and $h \circ g: X \to X$ are both bijective function. Therefore $g \circ h, h \circ g \in \mathbb{S}$ and hence $\mathbb{S}$ is closed under the composition of functions.


In this article Scott examines the concept of URL rewriting in ASP.NET using code samples.
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications. This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have the option to structure the URLs of your application however you want.
Very useful article. I liked it. Thanks a lot.
I know it is an issue which lot of people are facing but how can i make url rewriting work with ajax..
I have even used Context.Items.Add which will fix my url for the entire post-response cycle.
hi please any example available for url rewriting then put here with code.
Hi in this website download link is not working so please check this.
Very good your article!!! Fantastic!
Hi, You said the first approach could work in a shared hosting environment. however, we always have to configure the IIS server when deployment. Or there is another option?? I have this problem now, and I have asked my hosting to allow me that.