I'm using visual studios and programming in C#. Is it possible to move a PictureBox, using the picturebox.left function, and not have it always redraw my picture box but instead just change the position?  Thank you.
I need to knock out a quick animation in C#/Windows Forms for a Halloween display.  Just some 2D shapes moving about on a solid background.  Since this is just a quick one-off project I really don't want to install and learn an entire new set of tools for this.  (DirectX dev kits, Silverlight, Flash, etc..)  I also have to install this on multiple computers so anything beyond the basic .Net framework (2.0) would be a pain in the arse.  For tools I've got VS2k8, 25 years of development experience, a wheelbarrow, holocaust cloak, and about 2 days to knock this out.  I haven't done animation since using assembler on my Atari 130XE (hooray for page flipping and player/missile graphics!)  Advice?  Here's some of the things I'd like to know:   I can draw on any empty widget (like a panel) by fiddling with it's OnPaint handler, right?  That's how I'd draw a custom widget.  Is there a better technique than this? Is there a page-flipping technique for this kind of thing in Windows Forms?  I'm not looking for a high frame rate, just as little flicker/drawing as necessary.   Thanks.  Post Mortem Edit ... "a couple of coding days later"  Well, the project is done.  The links below came in handy although a couple of them were 404.  (I wish SO would allow more than one reply to be marked "correct").  The biggest problem I had to overcome was flickering, and a persistent bug when I tried to draw on the form directly.   Using the OnPaint event for the Form: bad idea.  I never got that to work; lots of mysterious errors (stack overflows, or ArgumentNullExceptions).  I wound up using a panel sized to fill the form and that worked fine. Using the OnPaint method is slow anyway.  Somewhere online I read that building the PaintEventArgs was slow, and they weren't kidding.  Lots of flickering went away when I abandoned this.  Skip the OnPaint/Invalidate() and just paint it yourself.  Setting all of the "double buffering" options on the form still left some flicker that had to be fixed.  (And I found conflicting docs that said "set them on the control" and "set them on the form".  Well controls don't have a .SetStyle() method.)  I haven't tested without them, so they might be doing something (this is the form):      this.SetStyle(ControlStyles.UserPaint, true);     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);     this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);    So the workhorse of the code wound up looking like (pf is the panel control):      void PaintPlayField()     {         Bitmap bufl = new Bitmap(pf.Width, pf.Height);         using (Graphics g = Graphics.FromImage(bufl))         {             g.FillRectangle(Brushes.Black, new Rectangle(0, 0, pf.Width, pf.Height));             DrawItems(g);             DrawMoreItems(g);             pf.CreateGraphics().DrawImageUnscaled(bufl, 0, 0);         }     }   And I just called PaintPlayField from the inside of my Timer loop.  No flicker at all.
Can a sql server table have two identity columns? I need to have one column as the primary key and another to auto increment an order number field. Is this possible?  EDIT: I think I'll just use a composite number as the order number. Thanks anyways. Changing my iTunes account details CSS Display an Image Resized and Cropped I want to show an image from an URL with a certain width and height even if it has a different size ratio.  So I want to resize (maintaining the ratio) and then cut the image to the size I want.  I can resize with html img property and I can cut with background-image.  How can I do both?  Example:  This image:     Has the size 800x600 pixels and I want to show like an image of 200x100 pixels   With img I can resize the image 200x150px:  &lt;img      style="width: 200px; height: 150px;"      src="http://i.stack.imgur.com/wPh0S.jpg"&gt;    That gives me this:    &lt;img style="width: 200px; height: 150px;" src="https://i.stack.imgur.com/wPh0S.jpg"&gt;       And with background-image I can cut the image 200x100 pixels.  &lt;div      style="background-image:            url('https://i.stack.imgur.com/wPh0S.jpg');      width:200px;      height:100px;      background-position:center;"&gt;&amp;nbsp;&lt;/div&gt;    Gives me:        &lt;div style="background-image:url('https://i.stack.imgur.com/wPh0S.jpg'); width:200px; height:100px; background-position:center;"&gt;&amp;nbsp;&lt;/div&gt;      How can I do both?  Resize the image and then cut it the size I want? Wildcard certificates with short hostnames? I'm trying to generate a certificate with the following subjectAltName:  hostname *.hostname hostname.mydomain.local *.hostname.mydomain.local   I generate the CSR via OpenSSL and then get the certificate from Microsoft Active Directory Certificate Services. Certificate works OK for the following alternative names:  hostname hostname.mydomain.local *.hostname.mydomain.local   But, *.hostname just doesn't work. Testing with Curl, I get the following output:  % curl https://m.example/ curl: (51) SSL: certificate subject name '*.example' does not match target host name 'm.example'   If, on the other hand, I add 'm.example' as a subjectAltName, then it works. So, wildcard with shortened hostname just refuses to work. C++ cast syntax styles Solutions of $x^2 \equiv 1 \pmod N$ which vectors are perpendicular to each other?  $\vec a = (1, -2, 3)$, $\vec b = (5, 4, 1)$, $\vec c = (1, 0, -5)$  Do i just take the dot product of 2 of them. If the dot product they are at $90^\circ$? But how do i know if there perpendicular? What is the difference between OpenOffice and the newly created LibreOffice? What is the difference between OpenOffice and LibreOffice? I understand that LibreOffice is another fork that is going to be developed. I have used OpenOffice since v1 and am wondering if there is a definite advantage to uninstalling and trying LibreOffice. How do I undo 'git add' before commit? I mistakenly added files to Git using the command:  git add myfile.txt   I have not yet run git commit. Is there a way to undo this, so these files won't be included in the commit? I recently upgraded from QGIS 3.2 to 3.4 using the standalone installer (Windows 64 bit), and uninstalling 3.2 beforehand.  When I open 3.4 it goes the background behind all my other open programs and clicking its icon on the taskbar does nothing, nor does Alt-Tab.  To use QGIS I have to minimize all my other open programs.    Is this a Windows issue, a QGIS issue, or something else entirely? Do we know why there is a speed limit in our universe? This question is about why we have a universal speed limit (the speed of light in vacuum). Is there a more fundamental law that tells us why this is? I'm not asking why the speed limit is equal to $c$ and not something else, but why there is a limit at all. EDIT: Answers like &quot;if it was not..&quot; and answers explaining the consequences of having or not having a speed limit are not--in my opinion-- giving an answer to whether there is a more fundamental way to derive it from a law to explain this limit. How do I install the Cinnamon Desktop? I have read that there is a new Gnome-2 like interface called Cinnamon produced by the Linux Mint developers.  Is this available for Ubuntu users - and if so how do I install it? iPhone: Detecting user inactivity/idle time since last screen touch Number of $n^2\times n^2$ permutation matrices with a 1 in each $n\times n$ subgrid I found the following question in a paper I was trying to solve:  The following figure shows a $3^2 \times 3^2$ grid divided into $3^2$ subgrids of size $3 \times 3$. This grid has $81$ cells, $9$ in each subgrid.    Now consider an $n^2 \times n^2$ grid divided into $n^2$ subgrids of size $n \times n$. Find the number of ways in which you can select $n^2$ cells from this grid such that there is exactly one cell coming from each subgrid, one from each row and one from each column.  My try:  Since we have $n^2$ rows, $n^2$ columns and $n^2$ subgrids in total, we have to choose one and only one cell from each of them. Let's choose them one at a time. We can choose the first cell in $n^4$ many ways. Then, we'll have to avoid that subgrid, that column and that row that we've chosen the first one from when choosing the second cell. So, we have $n^4-n^2-2n(n-1)$ choices. We can continue this to get the total number of possible ways. But, I think there's a hole. Say, we've chosen the first cell from the subgrid of the up-left corner and the second from the subgrid just right to it so that it doesn't violate any rules. Then, when finding the number of ways we can choose the third cell, we would have substracted some of the cells twice. I think you get it. Please, if anyone can help me solving this problem, it'd be greatly appreciated. I am not talking about miracles, religious revelation, or artistic expression, but something more mundane. There is a lot of "empirical" evidence that the Riemann hypothesis is true, the scare quotes indicate that the source of the evidence is "mathematical intuition". In psychology there are mental states that no one sees, touches, hears, smells or tastes, qualia with their perceptual fullness that can not be conceptualized or directly communicated, and abilities/skills "know how" with the same problem. In linguistics Kripke's theory of reference relies on "modal intuitions" to decide the truth of counterfactuals. But an empirical counterfactual is an oxymoron, especially when it is embedded into an entire "possible world".  Freudian psychoanalysis and Husserlian phenomenology are attempts to deal with some of them systematically, but they are traditionally confined to the fringe of science at best. The mainstream approach is empirical second hand, but behaviorism in psychology and linguistics, and nominalism in mathematics, were not very productive.   According to the naturalized epistemology there is no a priori "first philosophy" of science, methodology is subject to the "tribunal of experience" and revision, just as the science itself. Should it apply to non-empirical experience? Sense empiricism has served science well for centuries, and was fully embraced by Quine.  takes him to task for it:     "Cognitive science is an empirical science working to unearth the mechanisms through which natural language constitutes itself. That account has had to recognize the indispensability of mental states, of beliefs, if it is ever to become adequate to the problem... There is still too much "first philosophy" in Quine. We must rescue naturalized epistemology from its own founder".    Note the use of "empirical" together with "mental states".  Questions: Does naturalized epistemology dictate that natural science should relax sense empiricism, and approach non-empirical phenomena partly first hand? If so, how can the scientific method be adapted to introspective/intuitive phenomena that are not readily reproducible, manipulable, measurable, and/or publicly accessible? What would play the selective role of empirical testing? Can there be non-empirical (more likely, not entirely empirical) natural science? How to get string with pattern from std::regex in VC++ 2010 Why comment reply auto-completion feature (@) sometimes doesn't work? Can a random forest be used for feature selection in multiple linear regression? Since RF can handle non-linearity but can't provide coefficients, would it be wise to use random forest to gather the most important features and then plug those features into a multiple linear regression model in order to obtain their coefficients? Recently I have installed an older version of Ubuntu on my old machine. Whenever I try to install any software, I get an error saying it couldn't be found:  $ sudo apt-get install vlc Reading package lists... Done                Building dependency tree        Reading state information... Done     E: Couldn't find package vlc How to obtain the sum of the following series? $\sum_{n=1}^\infty{\frac{n^2}{2^n}}$