I have set up a View to show a list of stories, and then set up an attachment to my View that puts the first 4 stories at the top of the View styled differently. I need those 4 to only show on the first page of items. Every other page will show the normal styling without the top 4. I have created a custom module using the following code. However, now every item is showing on one page. I have set number of items for the pager in the main view to 10 with an offset of 4, and in the attachment it is set to 4. Any suggestions?  &lt;?php /**  * Implements hook_views_pre_build().  */ function custom_stories_views_pre_build(&amp;$views) {   if($views-&gt;name == 'stories' &amp;&amp; $views-&gt;current_display == 'block_1') {     // if 'attachment_1' is not defined, we assume it is the first page.     if (empty($_GET['attachment_1'])) {       // The offset number y should be equal to the number of items on       // attachment. If we want to keep the total n items on list, the       // number of items on main display should be (n - y).       $item_num = $views-&gt;get_items_per_page() - $views-&gt;get_offset();       $views-&gt;set_items_per_page($item_num);     }     else {       // Remove attachment for other pages.       $views-&gt;is_attachment = TRUE;       // We don't need to handle the offset anymore.       $views-&gt;set_offset(0);     }   } }
I have a current view set up that displays a feed of stories and is sorted in descending order. I now need to have the first 4 stories display as a different style then the remaining ones. I have pagination set to 10. I only want the first 4 to show differently on page 1, and then the current style will show on the remaining pages. Is there a way to do this?
How can a complete web page be saved and viewed on an Android device? There are situations I require to save a "complete" web page for offline reading. I can easily do that on Windows by saving the web page, but not on Android.  I am using Chrome on Android and I don't see a "save" option. Instead, I see "Save link" which, I believe, saves "only" the "pure HTML" version of a site of which the link leads to.  I have tried this but, when I view it in the HTML Viewer a lot of necessary CSS formatting and all the images were lost, which made the information misleading and incomplete respectively. (PS I thought I downloaded the complete page and the fault was that of the HTML Viewer for not rendering every thing, but I was wrong, as the desktop Chrome also displayed the "only HTML" version when I transferred those pages to my laptop through Bluetooth).  So, my question is: How can I download "a complete" web page on my Android smart-phone. It's OK if I can't view it on my smart-phone, but every thing should be in place when I view it on my laptop after transferring it. It is also OK if it is saved as a PDF file.  (PS I'm asking this as I use internet very often in my smartphone because my laptop is not connected to the internet. Also I want to transfer it to my laptop because I don't want to view those "important" pages on a small screen, it's inconvenient). Should we sign-then-encrypt, or encrypt-then-sign? Best way to randomize an array with .NET There's vs There are Who owns R2-D2 & C-3PO in the Prequel trilogy? Is there any concrete evidence that Anakin officially owned R2-D2 or C-3PO?  I found this episode of Star Wars: Clone Wars that shows it, but it's fairly vague... Language hints for quoted code In  I tried to add  for syntax formatting to code blocks quoted from the question. However, it seems they won't be honoured if I write them as a comment in my own part of the post, and if I include the hint in the qutotation as well then I have some ugly empty space before the code block. There should be a way to write these things properly. Prove that simultaneously diagonalizable matrices commute Two $n\times n$ matrices $A, B$ are said to be simultaneously diagonalizable if there is a nonsingular matrix $S$ such that both $S^{-1}AS$ and $S^{-1}BS$ are diagonal matrices.      a) Show that simultaneously diagonalizable matrices commute: $AB = BA$.      b) Prove that the converse is valid, provided that one of the matrices has no multiple eigenvalues. Is every pair of commuting matrices simultaneously diagonalizable?   My attempt:  a) Let $M=S^{-1}AS$ and $P=S^{-1}BS$, then it follows that $A= S^{-1}MS$ and $B=S^{-1}PS$. Thus $AB =S^{-1}MSS^{-1}PS = S^{-1}MPS = S^{-1}PMS$ (is it wrong that I switched MP to PM?) $=S^{-1}PSS^{-1}MS=BA$.   b) How can I do this? How do you change the size of figures drawn with Matplotlib? Strange black shading. Cannot fully light mesh. (Cycles) Here is the viewport in material view.  The node setup is just a PNG texture into a diffuse shader.    And this is in rendered view.  I've tried using environmental lighting as well as a directional light, and while the lit parts become brighter/washed out, the darker parts stay dark.  Normals are correct and there is no z-fighting.  Ambient Occlusion is not enabled.  Changing to Flat shading makes it worse.    Update:  Any modifier that alters the mesh (bevel, subdivide, etc) make the problem go away instantly. Closed-loop function question How do I find the   How do I find the transfer function of Gd(s)?  I am able to find the transfer function of Gr(s) but I am not really sure about Gd(s)? and how do i determine which order is this closed system? How can Linux/Ubuntu be installed safely on ChromeBook? Is installing Ubuntu on my Chromebook potentially dangerous to anything on my Chromebook? I got it as a gift, so I don't want to destroy anything that is important on the laptop. Also, which is better for being able to safely install Ubuntu: ChrUbuntu or Crouton? I'm using the Samsung Chromebook 3 (as described by the quick-start manual). Does that make any other differences as well? Cardinality of quotient ring $\mathbb{Z_6}[X]/(2X+4)$ I would like to know if there are any other tenses or grammatical structures to use for speaking about the future apart from will (perfect tense included), going to, simple and continuous present.  I mean not the obvious ones. For example, simple present (I could never have imagined it could be used for the future).     My mom arrives tomorrow.   I go to the doctor at 4 o'clock this afternoon. Composition of two Riemann integrable functions Suppose $f,g$ are two Riemann  Integrable functions .Is it true that $f\circ g$ is also Riemann  Integrable?  Trying this for a long time but not getting the answer Difference between  and  in Java How can I apply an effect when a player left-clicks/right-clicks with an item in hand? Understanding minipages - aligning at top I would like to be able to align two minipage at the top, without worrying about what is in the minipage.  I am aware of the optional [t] parameter, but still have some confusion as to how this all works.  I tend to think of a minipage as a regular page in that whatever is placed on it starts at the top and fills the page going across and then down the page, but this does not appear to be the case.  In the MWE example below, I have color coded the sections for reference purposes.   The first case (black) works just as I would expect. The two minipages are aligned exactly as I want with the [t] specifier.  No question here.  The next case (red) only works if the inner minipage also has the [t] specifier. Why is that necessary?  I would have thought that any content would be placed at the top of this page, and since both the outer minipage had a [t] things should have aligned at the top. I would like to place a graphic in the second mini page, and still have the two aligned at the top.   The simple case (blue) of using \includegraphics directly does not result in the content being aligned at the top.  So, then I attempt to put this in a \parbox (green) and this too does not yield the desired results.  I also try to place the graphic inside an inner minipage (brown) and specify the [t] alignment, and even though this worked in the red section, it does not here.  The only difference between the red and brown being that the red section had text, whereas the brown section has a graphic.  I am aware of question regarding  which suggests to place \vspace{0pt} at the top of the minipage, and that does provide the desired alignment (cyan), but adds vertical space at the top.  So, my second question is why is the \vspace{0pt} necessary when a graphic is included, but not when it is text.  This appears to be a hack and wondering if there is a replacement for minipage that works better without having to worry about exactly what is in the minipage?  Also, why did wrapping the figure in a parbox (green) or another minipage (brown) not solve this problem?   Here is the MWE:  \documentclass{article} \usepackage[demo]{graphicx} \usepackage{lipsum} \usepackage{xcolor}  \begin{document} \section{This Works - Aligned at top as desired} \begin{minipage}[t]{0.6\linewidth}     \lipsum[1] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \lipsum[2] \end{minipage}  \color{red} \section{Why does inner mini page required the [t]?} \label{Minipage-in-minipage} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \begin{minipage}[t]{\linewidth}% Why is [t] required here         \lipsum[4]     \end{minipage} \end{minipage}  \color{blue} \section{Why are These not aligned at top?} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \includegraphics[width=\linewidth]{foo} \end{minipage}  \color{green} \section{Why are These not aligned at top?} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}} \end{minipage}  \newpage \color{brown} \section{Why does this not work with the [t] as it did in red section?} This worked fine in Section \ref{Minipage-in-minipage}  \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \begin{minipage}[t]{\linewidth}% Even with [t] here, this does not work         \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}}     \end{minipage} \end{minipage}   \color{cyan} \section{Adding a \textbackslash{}vspace\{0pt\} works} \begin{minipage}[t]{0.6\linewidth}     \vspace{0pt}% Hack!! But does do the job     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \vspace{0pt}% Hack!! But does do the job     \begin{minipage}[t]{\linewidth}% Why is [t] required here         \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}}     \end{minipage} \end{minipage} \end{document} Should I worry about an Amazon AWS doomsday scenario? What's the best way to take a segment out of a text file? Get steam to realize I have games already installed I uninstalled and re-installed steam. I didn't uninstall my games, and they still exist on my hard drive (I checked).  I have an SSD and a HDD, and to save space I install programs (including steam) to C:\Program Files (x86)\Steam drive (SSD) and games to D:\Games\SteamApps (HDD). How to I let steam know the programs are installed there?