Margin on child element moves parent element

Margin on child element moves parent element

I have a div (parent) that contains another div (child). Parent is the first element in body with no particular CSS style. When I set.child{ margin-top: 10px;}The end result is that top of my child is still aligned with parent. Instead o

How do I check if an object has a property in JavaScript?

How do I check if an object has a property in JavaScript?

How do I check if an object has a property in JavaScript?Consider:x = {'key': 1};if ( x.hasOwnProperty('key') ) { //Do this}Is that the best way to do it? 1:I'm really confused by the answers that have been given - most of them are ju

Python dictionary, how to keep keys/values in same order as declared?

Python dictionary, how to keep keys/values in same order as declared?

I have a dictionary that I declared in a particular order and want to keep it in that order all the time. The keys/values can't really be kept in order based on their value, I just want it in the order that I declared it.So if I have the di

Aren't promises just callbacks?

Aren't promises just callbacks?

I've been developing JavaScript for a few years and I don't understand the fuss about promises at all.It seems like all I do is change:api(function(result){ api2(function(result2){ api3(function(result3){ // do work

Why is the gets function so dangerous that it should not be used?

Why is the gets function so dangerous that it should not be used?

When I try to compile C code that uses the gets() function with GCC,I get thiswarning: (.text+0x34): warning: the `gets' function is dangerous and should not be used.I remember this has something to do with stack protection and security,

Can PHP PDO Statements accept the table or column name as parameter?

Can PHP PDO Statements accept the table or column name as parameter?

Why can't I pass the table name to a prepared PDO statement?$stmt = $dbh->prepare('SELECT * FROM :table WHERE 1');if ($stmt->execute(array(':table' => 'users'))) { var_dump($stmt->fetchAll());}Is there another safe way to insert a table

Prototypical inheritance - writing up [duplicate]

Prototypical inheritance - writing up [duplicate]

This question already has an answer here: Javascript object members that are prototyped as arrays become shared by all class instances 3 answers So I h

from sys import argv - what is the function of “script”

from sys import argv - what is the function of “script”

I am reading "Learn Python the Hard Way" and was confused by the "script" part of the second line.from sys import argvscript, filename = argvFrom what I understand, the second line says: script and filename comprise argv.I tried running my

How to convert int* to int

How to convert int* to int

Given a pointer to int, how can I obtain the actual int?I don't know if this is possible or not, but can someone please advise me? 1:Use the * on pointers to get the variable pointed (dereferencing).int val = 42;int* pVal = &val;int k =

Which file is Perl's diamond operator (null file handle) currently reading from?

Which file is Perl's diamond operator (null file handle) currently reading from?

I'm using Perl's diamond operator to read from files specified on the command line.I'd like to be able to report messages like "Trouble on line $. of file $FILENAME", but how can I tell which file is currently used by the diamond? 1:Se

BinaryWrite exception “OutputStream is not available when a custom TextWriter is used” in MVC 2 ASP.

BinaryWrite exception “OutputStream is not available when a custom TextWriter is used” in MVC 2 ASP.

I have a view rendering a stream using the response BinaryWrite method. This all worked fine under ASP.NET 4 using the Beta 2 but throws this exception in the RC release: "HttpException" , "OutputStream is not available when a custom Tex

Can I avoid running junit tests twice in eclipse when using a TestSuite?

Can I avoid running junit tests twice in eclipse when using a TestSuite?

I need to do some per-suite initialisation (starting a web-server). It is working fine except that when I run all tests in my project in eclipse my tests run twice. My test suite looks a bit like this:@RunWith(Suite.class)@Suite.SuiteClasse

Keep x number of files and delete all others - Powershell

Keep x number of files and delete all others - Powershell

I am trying to write a script that will look through a set of folders and keep only the last 10 files. The files in each folder could be created daily, weekly or monthly. I need the script to keep the 10 most recent copies regardless of the

How to make Xcode automatically conform to a protocol

How to make Xcode automatically conform to a protocol

When I use a prototype table view, I always have to conform to the protocol TableViewDataSource. I always forget what methods I need to implement, so I have to look at the source of the protocol every time. This is really time consuming.I t

Unable to post message to http://www.youtube.com. Recipient has origin https://www.youtube.com

Unable to post message to http://www.youtube.com. Recipient has origin https://www.youtube.com

My app at http://beta.billboard.fm is producing errors in my normal browsing session after playing a single song.If i reload the page in incognito, the app works fully. I only recently starting experiencing these issues. I have completed cl

attach() inside function

attach() inside function

I'd like to give a params argument to a function and then attach it so that I can use a instead of params$a everytime I refer to the list element a.run.simulationIs there a problem with this? If I have defined a global variable named c and

Three curly brackets together in php source code

Three curly brackets together in php source code

I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]).They are often using three curly brackets together as given below (The following code snippet extracted form ext/ctype/ctype.c.)/* {{{ proto bool ctype_digit(

SQL Return only duplicate rows

SQL Return only duplicate rows

I have a query that returns the following rows:StateId, OrderId, OrderTime, PermitIdI need to return only the rows that are exact duplicates all across the board so each record must be exctly the same as the other record for it to be a dupl

Spaces cause split in path with PowerShell

Spaces cause split in path with PowerShell

I'm having an issue with powershell when invoking an exe at a path containing spaces.PS C:\Windows Services> invoke-expression "C:\Windows Services\MyService.exe"The term 'C:\Windows' is not recognized as the name of a cmdlet, function, scr

What does “a” stand for in font: 0/0 a;

What does “a” stand for in font: 0/0 a;

I was referring a video tutorial where the designer used font: 0/0 a; for image replacement, so I get that 0 is the font-size, another 0 is the line-height but designer skips the a part just by saying that's an hack.So what does that a exac

How to see which files have not been saved in Android Studio?

How to see which files have not been saved in Android Studio?

Coming from Eclipse I now use Android Studio for development. In Eclipse it was always clear which files were not saved, but in Android studio I see no distinction between the open files that have been saved, and the ones that haven't. Plus

Cannot convert '0000-00-00 00:00:00' to TIMESTAMP

Cannot convert '0000-00-00 00:00:00' to TIMESTAMP

the field definition /** Date. */ @Column(columnDefinition = "datetime") private Date date;setterpublic void setDate(final Date date) { DateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { this.date = dfmt.parse

How to open SBT Tool Window in Intellij?

How to open SBT Tool Window in Intellij?

This question may sound silly for you, but I have been searching the Internet for a while and couldn't find the answer. How can I open SBT Tool Window in Intellij (scala and SBT plugins obviously installed)? 1:In Menu: View -> Tool Windo

reinterpret_cast cast cost

reinterpret_cast cast cost

My understanding is that C++ reinterpret_cast and C pointer cast is a justa compile-time functionality and that it has no performance cost at all.Is this true? 1:It's a good assumption to start with. However, the optimizer may be restric

Executing a certain action for all elements in an Enumerable

Executing a certain action for all elements in an Enumerable

I have an Enumerable and am looking for a method that allows me to execute an action for each element, kind of like Select but then for side-effects. Something like:string[] Names = ...;Names.each(s => Console.Writeline(s));or Names.each(s