I'm looking through Google Polymer's source code and I found this:
/**
* IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee):
*
* iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't
* guarantee that the animation will start _exactly_ after that value. S...
I am getting started with web development, and been trying some HTML & CSS, and I want recommendations on my code from experts here. I want to know what standard naming conventions you use for class names, how do you layout your pages, do you use tables or divs? I have written the following code ...
Background
I'm using Lua with luaglut to do some OpenGL stuff. The luaglut API is almost identical to the gl/glut C APIs. Sometimes, gl functions want a pointer to some data, for example:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, oh_crap_a_pointer)...
@rolfl I'm not sure how to solve the "0-day streak" problem, do you have any clue what is causing that? If have a feeling it is in my IF/ELSE statement but can't really pinpoint it. Would it be best to just add a zero-check in a where clause at the end?
I have a dining menu app that scrapes the data from a website and redisplays it in a mobile format, displayed below.
If the user swipes left and right, the app will show the previous/next meal (ex. if current meal is lunch, swiping left will show dinner)
I'm trying to come up with a more eff...
@Hosch250 I've never seen a debug mode in SQL, because usually, either a query executes, or it doesn't. There's no compiling. So normally, you get either a syntax error (good) or borked data (really bad)
I have written two classes, one to represent the tree and a Util class to get the deepest node from the tree. Can you please review the code?
Below is the class for Tree:
package org.vik.ds.tree;
public class BinaryTree<E>{
private E data;
private BinaryTree<E> leftNode;
private BinaryTree<E>...
Meme: JDQ
Originator: rolfl
Cultural Height: The 2nd Monitor
Background: JavaDeveloper is the user who has posted the most questions on Code Review. A JDQ is of course, a JavaDeveloper Question. JavaDeveloper is the first one, and currently the only one, who have received the newly invented So...
Here's a little script that enters text into a document when activated.
tell application "TextEdit"
activate
end tell
delay 0.2
tell application "System Events"
keystroke "Hello World!"
keystroke return
end tell
I stuck the delay in there because otherwise the first few keystrokes tend t...
Hello and welcome Abby and all to Code Review. Just as a head's up to all, these comments will be regularly monitored, and purged. Have (courteous) fun. — rolfl ♦Dec 17 at 22:10
Despite being on permanent patrol for all other things Apple here on Code Review, and contrary to popular belief, AppleScript is outside my realm of expertise. With that said though, I believe this is our first AppleScript question? And I'm left wondering why we don't have an AppleScript FizzBuzz. Look out CodeReview... — nhgrif43 secs ago
I still don't actually know what AppleScript is. One day (after seeing this post), I read about it a little. I had assumed that it was something in the Terminal, but I think it's actually not?
I'm concerned that the SQL query is not safe, among other things.
Well, you're right to be concerned. I don't know much about PHP (basically nothing), so I'll let someone who does know about PHP comment about that half of your code.
But from the Swift end, we're passing the password as pla...
This question, by the way, needs some attention from some PHP reviewers. For sure.
For the sake of full disclosure, this was written with bananas, not apples. The doctor may not be kept away.
activate application "TextEdit"
tell application "System Events"
repeat until first window of application "TextEdit" exists
tell application "TextEdit" to make new document a...
For the sake of full disclosure, this was written with bananas, not apples. The doctor may not be kept away.
With AppleScript highlighting:
For Copy&Pasting:
activate application "TextEdit"
tell application "System Events"
repeat until first window of application "TextEdit" exists
...
Since this problem involves small numbers (particularly with a small loop count of 100), it's possible to ease the modulo operation setup by simply working with 16-bit and 8-bit registers:
[AX] (16-bit register)
---------------------- = [AH] (remainder)
[other 8-bit register]
My main concern i...
@Hosch250 You would have to try really hard to find a language where FizzBuzz has not been made here... hell, we even have a brainfuck and lolcode version...
I run a coding dojo at work. For one session I'm to showing that you can use a kata to get into a new language.
I'm using the FizzBuzz Kata to to show F# (and JavaScript) because it is short. The problem is I am very new to F# and find myself devolving to objects instead of being functional.
...
I don't know how programmers who work on Office and Windows and other huge projects test their code - I compile my project every few hours when adding feature and every few minutes when debugging.
Do they just have millions of console applications open?
On a different note, I have a bunch of XAML/C# pages in my WPF app.
Like this:
<Grid Background="Transparent">
<ScrollViewer Style="{StaticResource DataPage}">
<StackPanel>
<TextBlock>
The Undo menu for working with inked items, pictures, and files only has two options - undo and redo:<LineBreak/>
</TextBlock>
<Viewbox MaxHeight="270">
<Image Source="../../WindowsPictures/Menus/UndoDraw.png" />
</Viewbox>
</StackPanel>
</ScrollViewer>
</Grid>
Then, I display these pages in a frame.
I have many, many pages now, and I'm wondering if this is a good way to do this.
<UserControl>
<TextBlock>
The Undo menu for working with inked items, pictures, and files only has two options - undo and redo:<LineBreak/>
</TextBlock>
<Viewbox MaxHeight="270">
<Image Source="../../WindowsPictures/Menus/UndoDraw.png" />
</Viewbox>
</UserControl>
@Mat'sMug Here is interesting syntax for Postgres doing the same damn thing I did earlier... looks completely different... sql-standard
CREATE OR REPLACE FUNCTION getAllFoo() RETURNS SETOF foo AS
$BODY$
DECLARE
r foo%rowtype;
BEGIN
FOR r IN SELECT * FROM foo
WHERE fooid > 0
LOOP
-- can do some processing here
RETURN NEXT r; -- return current row of SELECT
END LOOP;
RETURN;
END
$BODY$
LANGUAGE 'plpgsql' ;
Make a user control and look into dependency properties - so you can customize it everywhere it's used. Like you would have one to set the MaxHeight for example
And another to set the textblock contents
Other than that.. depends what you're trying to do
@Phrancis I find that CREATE OR REPLACE FUNCTION a bit dangerous. Is it the default? I tend to script CREATE so I can't run it accidentally and mess up the existing one
@Mat'sMug CREATE OR REPLACE is mostly something you do before the DB is live, I feel. I would be more comfortable raising an error if an object of the same name already existed, in production
I am trying to create something that is very reusable here so that I can use it in other sites for other pages etc.
This code is for a simple photo gallery,
I took the code from How to Create Simple Image Gallery using repeater control & Jquery in ASP.NET but I changed it a bit, I would like...
I am trying to create something that is very reusable here so that I can use it in other sites for other pages etc.
This code is for a simple photo gallery,
I took the code from How to Create Simple Image Gallery using repeater control & Jquery in ASP.NET but I changed it a bit, I would like...
This question is from Cracking the Coding Interview and in this question they have asked to solve without using temporary buffer.
I have used Iterator interface. Can I use it or need to re-implement it?
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import...
I have a javascript array:
var data = [{abc: "vf",def: [{ a:"1", b:"3"},{a:"2",b:"4"}]}];
I want it to convert to:
[{"abc":"vf","a":"2","b":"4"},{"abc":"vf","a":"2","b":"4"}]
I have written the javascript code for it:
Javascript:
var push_apply = Function.apply.bind([].push);
var slic...
I just finished Project Euler #9 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it.
A Pythagorean triplet is a set of three natural numbers, a < b < c,
for which,
a^2 + b^2 = c^2 For example, 3^2 + 4^2...
Let's say that I want to query some API which will respond with array of random numbers:
[4, ..., 17, ..., 25]
To keep things simple enough, let's say that array has always 10 elements. For every element in that array, I need to emit via socket to all clients just ONE number every M seconds...
It appears that many review requests are for toy or homework examples (e.g. FizzBuzz).
Is this observation correct or am I mistaken?
If observed correctly, I have the following questions:
Is it good that many questions are toy examples? and/or would having more real world problems be better?
W...
I am just beginning to learn C++. I have experience with other languages, mainly C# and Java, so pointers are repetitively new to me.
Below I have implemented a function which checks if the given string (cstring?) is a palindrome. Is there a better or more efficient way to do this?
Basically I ...
@rolfl A friend of mine told me that he received upvoting/downvoting powers while he still had 1 reputation. iirc that should only happen at 15 rep, right? Or is it some kind of christmas action ^^
using System.Collections.Generic;
using System.IO;
using System.Net;
namespace Graphs
{
class Program
{
static void Main(string[] args)
{
IGraph g =
UndirectedGraph.FromStream(
new WebClient().OpenRead("http://algs4.cs.princ...
This question is a follow-up question of this one.
I've learnt a bit more python since then. I recently came back to making battleships again, and I think I did better.
These are the changes I've made:
1. Completely rewritten.
2. Multiple battleships.
3. Removed difficulty settings (as the wa...
I am setting a value to input box and trigger to hear the change. further i would like to hear the input change always. for that i made this function.
any expert can please verify the way i did is correct? or is it further tune-able?
here is my code :
var page = function () {
return {
...
I just started to learn angularjs. I created a simple site using ASP.NET MVC as a backend.
I created 1 main view and 4 partial views for the CRUD operations with a Company Entity.
In the main page I have this element: <div ng-view></div> I load here the required partial view.
I created 2 angul...
> Notice: Undefined variable: cart in /var/www/vhosts/ergonomique.nl/httpdocs/payment/msp.return.php on line 60 Fatal error: Call to a member function get_order() on a non-object in /var/www/vhosts/ergonomique.nl/httpdocs/payment/msp.return.php on line 60
I have emigrated to Canada myself, and helped others through the process. I have come to realize that managing to follow the process right, and fill in the forms adequately, and get things from a-to-b on schedule, are a sort of 'entry requirement', 'filter', and 'aptitude test'.
Maybe you only get the degree if you are smart enough to survive the site?
The code below implements an intrusive lock-free queue that supports multiple concurrent producers and consumers.
Some features:
Producers and consumers work on separate ends of the queue most of the time.
The fast path for producers and consumers has 4 atomic ops.
Version numbers are used to ...
I made a piece of software that basically adds the functionality of a compose key to Windows, after switching from one keyboard layout to another (for programming reasons), and being unable to find a piece of proper software that did what I wanted.
This was my first venture into making applicati...
(A quick note on terminology: I use 'generalized functor' to refer to a functor that can be initialized from any callable entity, similar to the definition from Alexandrescu's Modern C++ Design. I use 'generic functor' to refer to functors in the general C++ sense, meaning anything which implemen...
I made a piece of software that basically adds the functionality of a compose key to Windows, after switching from one keyboard layout to another (for programming reasons), and being unable to find a piece of proper software that did what I wanted.
This was my first venture into making applicati...
@Hosch250 The easiest way would be to find obsolete/not constructive/offensive comments. You could also look for non-answers and older off-topic posts.
I've been playing around with Jekyll and CoffeeScript the last few days and made a Periodic Table to learn those 2.
Now, to create the Periodic Table, I take an array of lis as input which then replaces itself with a table using a custom format like so:
periodicTable = [
[1, "s:16", 2],
...