Relative imports in Python 3

Relative imports in Python 3

I want to import a function from another file in the same directory.Sometimes it works for me with from .mymodule import myfunction but sometimes I get a:SystemError: Parent module '' not loaded, cannot perform relative importSometimes it w

What is DOM Event delegation?

What is DOM Event delegation?

Can anyone please explain event delegation in JavaScript and how is it useful? 1:DOM event delegation is a mechanism of responding to ui-events via a single common parent rather than each child, through the magic of event "bubbling" (aka

Encrypt and decrypt a string in C#?

Encrypt and decrypt a string in C#?

How can I encrypt and decrypt a string in C#? 1:EDIT 2013-Oct: Although I've edited this answer over time to address shortcomings, please see jbtule's answer for a more robust, informed solution.https://stackoverflow.com/a/10366194/18847

Can multiple directives for one element share an isolated scope?

Can multiple directives for one element share an isolated scope?

Two directives on the same element can not both have isolated scope, but can they both use the same scope isolated from their parent? And can they both use properties bound to the isolated scope?For example, if I have two directives on an

Eclipse/javac disagree on compiling signature with default method collision; who is right?

Eclipse/javac disagree on compiling signature with default method collision; who is right?

Here's a simple class that demonstrates the issue:package com.mimvista.debug;public class DefaultCollisionTest { public static interface Interface1 { public String getName(); } public static interface Interface2 { pub

Why Object#hashCode() returns int instead of long

Why Object#hashCode() returns int instead of long

why not:public native long hashCode();instead of: public native int hashCode();for higher chance of achieving unique hash codes? 1:Because the maximum length of an array is Integer.MAX_VALUE. Since the prime use of hashCode() is to deter

Does an empty array in .NET use any space?

Does an empty array in .NET use any space?

I have some code where I'm returning an array of objects.Here's a simplified example:string[] GetTheStuff() { List s = null; if( somePredicate() ) { s = new List(); // imagine we load some data or something } return (s ==

Why is “ss” equal to the German sharp-s character 'ß'?

Why is “ss” equal to the German sharp-s character 'ß'?

Coming from this question I'm wondering why ä and ae are different(which makes sense) but ß and ss are treated as equal. I haven't found an answer on SO even if this question seems to be related and even mentions "that ß will compare equal

Drag and drop images in gridview in android

Drag and drop images in gridview in android

I'am developing a sample android application to learn about drag & drop in android. On start of the app, i'am displaying few images on a grid view. Now i need to drag one image at a time over to the place of another. After dropping an imag

php/Ajax - Best practice for pre-loading images

php/Ajax - Best practice for pre-loading images

I have put together a script which is very much like the flickr photostream feature. Two thumbnails next to each other, and when you click the next or prev links the next (or previous) two images slide in. Cool!Currently when the page loads

How to download, zip and save multiple files with Javascript and get progress?

How to download, zip and save multiple files with Javascript and get progress?

I'm creating a Chrome extension that needs to download multiple files (images and/or videos) from a website. These files may have a huge size, so I want to show the download progress to the user. After some research I found that currently a

How do I fade in /out a rectangle or text?

How do I fade in /out a rectangle or text?

I want to achieve the effect of fade in / fade out the rect or text. I call CGContextFillRect or CGContextShowText in my UIVIew's drawRect: method. I wonder if there is a way to achieve the animation without using UIView' support(i.e. [UIVi

How to find a pixel-positon of a cursor in UITextView?

How to find a pixel-positon of a cursor in UITextView?

I'm developing a simple writing app for iPad.I'm trying to compute the pixel-position of the cursor in UITextView. I spend a few weeks to design this, but I still couldn't figure out to do it.In stackoverflow, Tony wrote one good algorithm

SQLite Number of Transactions Limit?

SQLite Number of Transactions Limit?

I'm trying to insert a large amount of records (in the millions) into an SQLite database. The data is read in from a file stream (C++). If I begin a single transaction, perform all of the inserts and then commit the transaction, I only get

error in visual studio, Access to the path is denied

error in visual studio, Access to the path is denied

I've been having this problem for a while now. I created a brand new winforms c# application in Visual Studio. I can usually launch it in debug mode once without a problem. However, if I close it and launch it again I get an error "Unable t

Performance overhead of using attributes in .NET

Performance overhead of using attributes in .NET

1.. Is there any performance overhead caused by the usage of attributes? Think for a class like: public class MyClass { int Count {get;set;} }where it has 10 attibutes (attributes being classes, where the attribute classes th

Should lookup values be modeled as aggregate roots?

Should lookup values be modeled as aggregate roots?

As part of my domain model, lets say I have a WorkItem object. The WorkItem object has several relationships to lookup values such as:WorkItemType:UserStoryBugEnhancementPriority:HighMediumLowAnd there could possibly be more, such as Statu

Accesing contents of res/raw programatically (Android)

Accesing contents of res/raw programatically (Android)

I'm working on an app for Android with a few other people, and the primary content is specified by our designers as text files in a certain file format, which we then parse, process, and serve in the app. We're currently storing them in re

Unit testing concurrent software - what do you do?

Unit testing concurrent software - what do you do?

As software gets more and more concurrent, how do you handle testing the core behaviour of the type with your unit tests (not the parallel behaviour, just the core behaviour)?In the good old days, you had a type, you called it, and you chec

How can you show the debugger console in “xcode 6”

How can you show the debugger console in “xcode 6”

In Xcode 5 you could show the bottom view and show the debugger console. But in xcode 6 I'm getting no data when running on the simulator. What gives? 1:Go to XCode -> Preferences -> Behaviors -> Select “Starts” in Running -> Select “Sho

Unit test case generator [closed]

Unit test case generator [closed]

Has anybody tried any Unit Test generators for .Net?I assume although it won't be any substitute for any good unit test written by a person who has written the functionality, but I think it will take away some of work and be a starting poin

Git push takes forever

Git push takes forever

When I am trying to push to my remote git repository, but it is taking forever and nothing happens. I waited for so long, but push is never getting finished. My OS is Ubuntu 12.10. Thank you. 1:Try using the --verbose option to see what

Need a tutorial for using GHC to parse and typecheck Haskell

Need a tutorial for using GHC to parse and typecheck Haskell

I'm working on a project for analyzing Haskell code. I decided to use GHC to parse the source and infer types rather than write my own code to do that. Right now, I'm slogging through the Haddock docs, but it's slow going. Does anyone kn

How to keep 2 objects in view at all time by scaling the field of view? (or z&y axis)

How to keep 2 objects in view at all time by scaling the field of view? (or z&y axis)

I'm making a little arcade shooter for 2 players, and need to have the screen focused on 2 players, I got the camera moving in the center of the players in the X axis, but it I think it would be cool when the 2 players get closer together t

Bootstrap 3 responsive desktop and mobile layout

Bootstrap 3 responsive desktop and mobile layout

Using bootstrap 3 to design my responsive website, I'm having trouble getting the layout to work below a desktop width resolution of 1366px v 786px. When the layout is decreased down to 1024px, it is considered the mobile breakpoint.How can