Questions Tagged with #Libumem

Libumem is a library used to detect memory management bugs in applications, based on the Slab allocator concept.

How to access a dictionary element in a Django template?

I would like to print out the number of votes that each choice got. I have this code in a template: {% for choice in choices %} {{choice.choice}} - {{votes[]}} <br /> {% endfor %}..

IBOutlet and IBAction

What is the purpose of using IBOutlets and IBActions in Xcode and Interface Builder? Does it make any difference if I don't use IBOutlets and IBActions? Swift: @IBOutlet weak var textField: UITex..

Log4net rolling daily filename with date in the file name

I would like to have files named for example: How is this possible with log4net?..

Location of the mongodb database on mac

I am kind of new to mac as well as mongodb. I have a weird doubt, accessing the database created using mongodb on mac? I know, in windows there is a folder called c:\data\db, where my database files..

How to make layout with View fill the remaining space?

I'm designing my application UI. I need a layout looks like this: (< and > are Buttons). The problem is, I don't know how to make sure the TextView will fill the remaining space, with two button..

Identifying Exception Type in a handler Catch Block

I have created custom exception class public class Web2PDFException : Exception { public Web2PDFException(string message, Exception innerException) : base(message, innerException) { ... }..

Bringing a subview to be in front of all other views

I am working on integrating an ad provider into my app currently. I wish to place a fading message in front of the ad when the ad displays but have been completely unsuccessful. I made a function whi..

Console app arguments, how arguments are passed to Main method

This would be question from c# beginner. When I create console application I get Main method with parameter args as array string. I do not understand how this method is called by system and how args ..

How do you initialise a dynamic array in C++?

How do I achieve the dynamic equivalent of this static array initialisation: char c[2] = {}; // Sets all members to '\0'; In other words, create a dynamic array with all values initialised to the ..

Sorting HTML table with JavaScript

I'm after a table sorting solution (in JavaScript) but I can't seem to find a suitable one yet. I just need it to sort each column alphabetically. It doesn't need to ignore any code or any numbers or ..

How to query between two dates using Laravel and Eloquent?

I'm trying to create a report page that shows reports from a specific date to a specific date. Here's my current code: $now = date('Y-m-d'); $reservations = Reservation::where('reservation_from', $no..

Default visibility for C# classes and members (fields, methods, etc.)?

I'm trying to find a reference for the default visibility of various aspects of C#. Class types, fields, methods, enums, etc. Can someone provide a list of these along with their default visibility (..

ant build.xml file doesn't exist

After the installation of my ant in my windows 7 . In cmd i typed ant -v it's given the ant version but it says the following also. Buildfile: build.xml does not exist! Build failed What's the pro..

Making sure at least one checkbox is checked

I have a form with multiple checkboxes and I want to use JavaScript to make sure at least one is checked. This is what I have right now but no matter what is chosen an alert pops up. JS (wrong) ..

text-align:center won't work with form <label> tag (?)

I was going through a site I have just completed, and fixing up some accessibility issues. I had a form: <input type="hidden" name="redirect" value="thank-you.php" /> <p>Enter your Email..

Assigning the output of a command to a variable

I am new with unix and I am writing a shell script. When I run this line on the command prompt, it prints the total count of the number of processes which matches: ps -ef | awk '/siebsvc –s siebs..

Can regular JavaScript be mixed with jQuery?

For example, can I take this script (from mozilla tutorial): <html> <head> <script type="application/javascript"> function draw() { var canvas = document.getElementById..

Android Studio emulator does not come with Play Store for API 23

I selected this emulator from the newest version of Android Studio AVD. I have selected the latest version of android API 23. Because it says "with Google APIs", I thought that it would actually in..

Copying a HashMap in Java

I am trying to keep a temporary container of a class that contains member : HashMap<Integer,myObject> myobjectHashMap A class called myobjectsList Then I do myobjectsListA = new myobjectsList()..

Java regex email

First of all, I know that using regex for email is not recommended but I gotta test this out. I have this regex: \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b In Java, I did this: Pattern p = Pattern..

HTML meta tag for content language

What is the difference between the following two HTML meta tags, for specifying spanish web page content: <meta name="language" content="Spanish"> and <meta http-equiv="content-language" ..

git: undo all working dir changes including new files

How to delete all changes from working directory including new untracked files. I know that git checkout -f does that, but it doesn't delete new untracked files created since last commit. Does anybod..

Use superscripts in R axis labels

Using base graphics in R, how can I add superscripts to axis labels, as one might want to when plotting latitude and longitude axes on a map. Consider this example: plot(-100:-50, 50:100, type="n", ..

What are callee and caller saved registers?

I'm having some trouble understanding the difference between caller and callee saved registers and when to use what. I am using the MSP430 : procedure: mov.w #0,R7 mov.w #0,R6 add.w R6,R7 inc.w..

Why does my Eclipse keep not responding?

I'm using Eclipse, and at random times, it will just freeze up and stop responding. Does this happen to anyone else? It usually happens when I click on a line of code, whether it be Java or XML. Any i..

Reverse HashMap keys and values in Java

It's a simple question, I have a simple HashMap of which i want to reverse the keys and values. HashMap<Character, String> myHashMap = new HashMap<Character, String>(); myHashMap.put('a',..

How To have Dynamic SQL in MySQL Stored Procedure

How do you build and use dynamic sql in a MySQL stored procedure?..

Browser Caching of CSS files

Quick question regarding CSS and the browser. I tried searching SO and found some similar posts, but nothing definitive. I use one or two CSS files in my web projects. These are referenced in the HEA..

Detect if device is iOS

I'm wondering if it's possible to detect whether a browser is running on iOS, similar to how you can feature detect with Modernizr (although this is obviously device detection rather than feature dete..

Console logging for react?

I'm super new to React and I'm trying to get it set up for Meteor and piecing stuff together from other sources too. One of these other sources set up console logging for the app, but I'm going the ES..

Php multiple delimiters in explode

I have a problem, I have a string array, and I want to explode in different delimiter. For Example $example = 'Appel @ Ratte'; $example2 = 'apple vs ratte' and I need an array which is explode in @..

How to obtain image size using standard Python class (without using external library)?

I am using Python 2.5. And using the standard classes from Python, I want to determine the image size of a file. I've heard PIL (Python Image Library), but it requires installation to work. How migh..

Save file/open file dialog box, using Swing & Netbeans GUI editor

I am a beginner to Java. I am making a simple text editor in netbeans 7(.3) IDE, using its GUI editor. The main problem I face in it is that I can't make it to save/open the file. I have created the "..

Map a network drive to be used by a service

Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service's session when the service is started? Logging in as..

Adding a column to an existing table in a Rails migration

I have a Users model which needs an :email column (I forgot to add that column during the initial scaffold). I opened the migration file and added t.string :email, did rake db:migrate, and got a No..

Convert a string to a double - is this possible?

Just wondering in php, if it was possible to convert a string to a double. I am using a financial web service which provides a price as a string. I really need to process this as a double and was wond..

how can I display tooltip or item information on mouse over?

I am displaying 5 userImage on one screen.I want to display userID and email on mouseover on those userImage.I used alt property of image control but that not working in mozila,chrome and some versio..

Counting Line Numbers in Eclipse

I have a Java project in Eclipse with ~10 packages and ~10 class files per package. Is there a way to determine total lines of code for the whole project from within Eclipse? I am familiar with othe..

regex.test V.S. string.match to know if a string matches a regular expression

Many times I'm using the string match function to know if a string matches a regular expression. if(str.match(/{regex}/)) Is there any difference between this: if (/{regex}/.test(str)) They se..

How to Ping External IP from Java Android

I am developing a Ping application for Android 2.2. I try my code and it works, but only in local IPs, that's my problem I want to do ping to external servers too. Here is my code: private OnClic..

Storing Form Data as a Session Variable

So I was wondering if it would be possible to store data coming in from a form as a session variable. Heres what I have so far, but I don't know what to put for the Form Action. Thanks for looking!..

Show git diff on file in staging area

Is there a way I can see the changes that were made to a file after I have done git add file? That is, when I do: git add file git diff file no diff is shown. I guess there's a way to see the dif..

Install Android App Bundle on device

I built my project using the new Android App Bundle format. With APK files, I can download the APK to my device, open it, and immediately install the app. I downloaded my app as a bundle (.aab format)..

How do I use Node.js Crypto to create a HMAC-SHA1 hash?

I want to create a hash of I love cupcakes (signed with the key abcdeg) How can I create that hash, using Node.js Crypto?..

Jasmine.js comparing arrays

Is there a way in jasmine.js to check if two arrays are equal, for example: arr = [1, 2, 3] expect(arr).toBe([1, 2, 3]) expect(arr).toEqual([1, 2, 3]) Neither seems to work...

Remove specific characters from a string in Javascript

I am creating a form to lookup the details of a support request in our call logging system. Call references are assigned a number like F0123456 which is what the user would enter, but the record in th..

A simple jQuery form validation script

I made a simple validation form using jQuery. It's working alright. The thing is I'm not satisfied with my code. Is there another way around to write my code with the same output result? $(document)...

Django auto_now and auto_now_add

For Django 1.1. I have this in my class User(models.Model): created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) When updating a row ..

Change image onmouseover

What's the correct way to change an image on mouseover and back on mouseout (with/without jQuery)? <a href="#" id="name"> <img title="Hello" src="/ico/view.png" onmouseover="$(this).attr..

How can jQuery deferred be used?

jQuery 1.5 brings the new Deferred object and the attached methods .when, .Deferred and ._Deferred. For those who haven't used .Deferred before, I've annotated the source for it. What are the possib..

Excel VBA: AutoFill Multiple Cells with Formulas

I have big amount of data that I collected from different files. In this main workbook, I have different types of formulas for every cells. In range A to F is where the data from other files are colle..

Python - Using regex to find multiple matches and print them out

I need to find content of forms from HTML source file, I did some searching and found very good method to do that, but the problem is that it prints out only first found, how can I loop through it and..

xcode library not found

I'm getting the following error: ld: library not found for -lGoogleAnalytics clang: error: linker command failed with exit code 1 (use -v to see invokation) I've spent some time googling but c..

Inserting the iframe into react component

I have a small problem. After requesting a data from a service I got an iframe code in response. <iframe src="" width="540" height="450"></iframe> I ..

IndexError: too many indices for array

I know there is a ton of these threads but all of them are for very simple cases like 3x3 matrices and things of that sort and the solutions do not even begin to apply to my situation. So I'm trying ..

Converting a char to uppercase

String lower = Name.toLowerCase(); int a = Name.indexOf(" ",0); String first = lower.substring(0, a); String last = lower.substring(a+1); char f = first.charAt(0); char l = last.charAt(0); System.out...

Invoking a PHP script from a MySQL trigger

Is there any way how to invoke a PHP page / function when a record is inserted to a MySQL database table? We don't have control over the record insertion procedure. Is there a trigger mechanism which ..

AngularJS - difference between pristine/dirty and touched/untouched

AngularJS Developer Guide - Forms tell there are many styles and directives regarding forms and fields. For each one, a CSS class: ng-valid ng-invalid ng-pristine ng-dirty ng-touched ng-untouched W..

Conversion of System.Array to List

Last night I had dream that the following was impossible. But in the same dream, someone from SO told me otherwise. Hence I would like to know if it it possible to convert System.Array to List Array..

How do I print bold text in Python?

How do I print bold text in Python? For example: print "hello" What should I do so that the text “hello” is displayed in bold?..

Linux command to print directory structure in the form of a tree

Is there any linux command that I can call from a Bash script that will print the directory structure in the form of a tree, e.g., folder1 a.txt b.txt folder2 folder3 ..

How to check is Apache2 is stopped in Ubuntu?

I want to make sure apache2 service is stopped. 1. I need to verify if apache2 is installed or not. when I type: sudo /etc/init.d/apache2 stop I got: sudo: /etc/init.d/apache2: command not fou..

APR based Apache Tomcat Native library was not found on the java.library.path?

When trying to run my app with eclipse/linux on tomcat I got the following info message: INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments w..


I was trying to change my default/main/startup (whatever you call it) activity by editing the androidmanifest.xml file. All i did was change the android:name property. however, this completely broke t..

Difference between hamiltonian path and euler path

Can some one tell me the difference between hamiltonian path and euler path. They seem similar!..

UITableViewCell, show delete button on swipe

How do I get the delete button to show when swiping on a UITableViewCell? The event is never raised and the delete button never appears...

How can I delete derived data in Xcode 8?

The projects page seems to be disappeared from Xcode 8. I used this page for deleting the derived data. Any idea how can I delete derived data from within Xcode 8?..

Oracle SQL - REGEXP_LIKE contains characters other than a-z or A-Z

I would like to create a query where I select all records which contain characters that are not a-z or A-Z so something like this SELECT * FROM mytable WHERE REGEXP_LIKE(column_1, '![A-Z] [a-z]')..

Adding a user on .htpasswd

I am using .htpasswd to password protect certain directory on my server. However, I noticed that everytime I do this sudo htpasswd -c /etc/apache2/.htpasswd newuser my current contents of .htpasswd wi..

What are the rules for JavaScript's automatic semicolon insertion (ASI)?

Well, first I should probably ask if this is browser dependent. I've read that if an invalid token is found, but the section of code is valid until that invalid token, a semicolon is inserted before ..

Create a List of primitive int?

Is there a way to create a list of primitive int or any primitives in java like following? List<int> myList = new ArrayList<int>(); It seems I can do List myList = new ArrayList(); an..

How to set a binding in Code?

I have the need to set a binding in code. I can't seem to get it right tho. This is what i have tried: XAML: <TextBox Name="txtText"></TextBox> Code behind: Binding myBinding = new ..

Stop a youtube video with jquery?

I have a jquery slider that I have built, basically just three pannels that slide by applying negative left CSS values. Works great, but I have a youtube video in one slide that wont stop when I slide..

Git: How to update/checkout a single file from remote origin master?

The scenario: I make some changes in a single file locally and run git add, git commit and git push The file is pushed to the remote origin master repository I have another local repository that is ..

__init__() got an unexpected keyword argument 'user'

i am using Django to create a user and an object when the user is created. But there is an error __init__() got an unexpected keyword argument 'user' when calling the register() function in

How to store custom objects in NSUserDefaults

Alright, so I've been doing some poking around, and I realize my problem, but I don't know how to fix it. I have made a custom class to hold some data. I make objects for this class, and I need to t..

Where is svn.exe in my machine?

I have Tortoise svn installed on my desktop. I want to perform some tasks using commandline svn.exe? But I am not able to find svn.exe on my machine. Do we have to install something else to get the s..

PHP code to remove everything but numbers

I'm trying to remove everything from a string but just numbers (0-9). I thought this would work.. echo preg_replace("[^0-9]","",'604-619-5135'); But it echos "604-619-5135". What am I missing??? ..

Observable Finally on Subscribe

According to this artcle, onComplete and onError function of the subscribe are mutually exclusive. Meaning either onError or onComplete events will fire up in my subscribe. I have a logic block whi..

Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail

What would be a good way to attempt to load the hosted jQuery at Google (or other Google hosted libs), but load my copy of jQuery if the Google attempt fails? I'm not saying Google is flaky. There ar..

Unable to install Android Studio in Ubuntu

I'm using Ubuntu Gnome 14.04, and I have Java 8 installed (both the JDK and the JRE). When I was installing Android Studio everything worked, but a message appeared saying: Unable to run mksdcard..

How to install JSTL? The absolute uri: cannot be resolved

I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception: org.apache.jasper.JasperException: The absolute uri:

Initialize array of strings

What is the right way to initialize char** ? I get coverity error - Uninitialized pointer read (UNINIT) when trying: char **values = NULL; or char **values = { NULL }; ..

SQL Update Multiple Fields FROM via a SELECT Statement

This works, but i would like to remove the redundancy. Is there a way to merge the update with a single select statement so i don't have to use vars? DECLARE @OrgAddress1 varchar, ..

Tomcat 8 is not able to handle get request with '|' in query parameters?

I am using Tomcat 8. In one case I need to handle external request coming from external source where the request has a parameters where it is separated by |. Request is looks like this: http://local..

Calculate business days

I need a method for adding "business days" in PHP. For example, Friday 12/5 + 3 business days = Wednesday 12/10. At a minimum I need the code to understand weekends, but ideally it should account for..

Line break (like <br>) using only css

Is it possible in pure css, that is without adding additional html tags, to make a line break like <br>? I want the line break after the <h4> element, but not before: HTML <li> T..

Javascript: Load an Image from url and display

I want to preface this with the fact that I am very very new to JavaScript. I appreciate your patience with me. I'm trying to create a script that allows a user to input a name into a text-area, pres..

Class constants in python

In python, I want a class to have some "constants" (practically, variables) which will be common in all subclasses. Is there a way to do it with friendly syntax? Right now I use: class Anima..

mongodb service is not starting up

I've installed the mongodb 2.0.3, using the mongodb-10gen debian package. Everything went well, except the service which is installed by default is not starting up when computer starts. The mongod is ..

How to find a Java Memory Leak

How do you find a memory leak in Java (using, for example, JHat)? I have tried to load the heap dump up in JHat to take a basic look. However, I do not understand how I am supposed to be able to find ..

How can I change eclipse's Internal Browser from IE to Firefox on Windows XP?

How can I change eclipse's Internal Browser from IE to Firefox on Windows XP? To be more specific I need to change the Internal Browser instead of adding the External Browser through Preferences -> G..

How to get image width and height in OpenCV?

I want to get image width and height, how can I do that in OpenCV? For example: Mat src = imread("path_to_image"); cout << src.width; Is that right?..

What is so bad about singletons?

The singleton pattern is a fully paid up member of the GoF's patterns book, but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for factory cl..

How to make sql-mode="NO_ENGINE_SUBSTITUTION" permanent in MySQL my.cnf

UPDATE FIXED 1/18/15 After we recently updated to MySQL 5.6.27 (from the Ubuntu repo), this option now works. So this appears to have been a problem with the previous version of MySQL. ORIGINAL QUES..

Redirecting 404 error with .htaccess via 301 for SEO etc

I couldn't find a straight answer to my question and need to know it from the real experts. I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search e..

How to set delay in vbscript

How to set delay in vbscript? WScript.Sleep(100) does not work on Windows XP, Vista...

What is the purpose of the : (colon) GNU Bash builtin?

What is the purpose of a command that does nothing, being little more than a comment leader, but is actually a shell builtin in and of itself? It's slower than inserting a comment into your scripts b..

HTTP Status 500 - Servlet.init() for servlet Dispatcher threw exception

When I'm trying to run this simple html form: <html> <head> <title>Enter a new Page</title> </head> <body> <div id="..

How do I extract data from JSON with PHP?

This is intended to be a general reference question and answer covering many of the never-ending "How do I access data in my JSON?" questions. It is here to handle the broad basics of decoding JSON..

Get the new record primary key ID from MySQL insert query?

Let's say I am doing a MySQL INSERT into one of my tables and the table has the column item_id which is set to autoincrement and primary key. How do I get the query to output the value of the newly ge..

How to convert image into byte array and byte array to base64 String in android?

Can someone tell me the code to convert image into byte array and that byte array into base64 string. i write the below code not getting proper result . String filepath = "/sdcard/Image/ic_launcher..

How to paste the selected range (passed as rng) to the end of the worksheet?

The code below is trying to paste the selected range (passed as rng) to the end of the worksheet. It works if there are two rows already present (A1, A2). Sub copyRow(rng As Range, ws As Worksheet) ..

Converting Columns into rows with their respective data in sql server

I have a scenario where I need to convert columns of table to rows eg - table - stocks: ScripName ScripCode Price ----------------------------------------- 20 MICRONS 533022 ..

How would one write object-oriented code in C?

What are some ways to write object-oriented code in C? Especially with regard to polymorphism. See also this Stack Overflow question Object-orientation in C...

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer. but my android studio version is 3.2.1 and there is no new update from Google..

MySQL: Can't create/write to file '/tmp/#sql_3c6_0.MYI' (Errcode: 2) - What does it even mean?

For some reason my production DB decided to spew out this message. All application calls fail to the DB with the error: PreparedStatementCallback; SQL [ /*long sql statement here*/ ]; Can't create/w..

Could not load file or assembly version

I have installed MS SQL Server 2008 R2 and when I try to update model from database under EDMX file I am facing that error. Could not load file or assembly ..

Programmatically change input type of the EditText from PASSWORD to NORMAL & vice versa

In my application, I have an EditText whose default input type is set to android:inputType="textPassword" by default. It has a CheckBox to its right, which is when checked, changes the input..

Sending email from Azure

Hope someone can help. I want to send email from my Azure account. My domain name is configured to work with Azure. I could not find easily on the web how to send an email from an Azure account. The..

Java: get all variable names in a class

I have a class and I want to find all of its public fields (not methods). How can I do this? Thanks!..

delete a column with awk or sed

I have a file with three columns. I would like to delete the 3rd column(in-place editing). How can I do this with awk or sed? 123 abc 22.3 453 abg 56.7 1236 hjg 2.3 Desired output 123 abc..

How do I sort an observable collection?

I have a following class : [DataContract] public class Pair<TKey, TValue> : INotifyPropertyChanged, IDisposable { public Pair(TKey key, TValue value) { Key = key; Value ..

Securely storing passwords for use in python script

Possible Duplicate: I need to securely store a username and password in Python, what are my options? I am looking for a way to securely store passwords which I intend to use in some Python ..

How to decompile to java files intellij idea

IDEA has a great built-in feature - decompiler. It works great.I can copy source code, but I cannot find option to extract all decompiled java classes to java files. This project has a lot of java cla..

How to convert Blob to File in JavaScript

I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that. I had the dataURL of the image that I converted to blob using the following code: dataUR..

How to enable mod_rewrite for Apache 2.2

I've got fresh install of Apache 2.2 on my Vista machine, everything works fine, except mod rewrite. I've uncommented LoadModule rewrite_module modules/mod_rewrite.s but none of my rewrite rules ..

Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JDBC_DBO]]

I get this Tomcat Error: Sep 09, 2012 4:16:54 PM org.apache.catalina.core.AprLifecycleListener init Information: The APR based Apache Tomcat Native library which allows optimal performance in product..

What does "publicPath" in Webpack do?

Webpack docs state that output.publicPath is: The output.path from the view of the JavaScript. Could you please elaborate on what this actually means? I use output.path and output.filename to s..

Alternative for PHP_excel

Is there any alternative for PHP_excel which can "Export to XLSX/XLS" file in a customized format? This is a General Reference question for the php tag ..

How to test if JSON object is empty in Java

The JSON object I'm receiving looks like this: [{"foo1":"bar1", "foo2":"bar2", "problemkey": "problemvalue"}] What I'm trying to test for is the existence of problemvalue. If problemvalue returns a..

Setup a Git server with msysgit on Windows

My friends and I are trying to setup Git for Windows using the tutorial Git Server: Gitosis and Cygwin on Windows, but we just keep running into problems. What would a "Setup Git Server" guide for W..

React-Router External link

Since I'm using react-router to handle my routes in a react app, I'm curious if there is a way to redirect to an external resource. Say someone hits: I would like it to r..

Select option padding not working in chrome

Select option padding not working in chrome <style> select option { padding:5px 0px; } </style> <select> <option>1</option> <option>2</option> <option..

How to create a temporary table in SSIS control flow task and then use it in data flow task?

I have a control flow where I create a temp database and table in a with a T-SQL Command. When I add a dataflow I would like to query the table but I can't because the table doesn't exist to grab info..

Operator overloading on class templates

I'm having some problems defining some operator overloads for template classes. Let's take this hypothetical class for example. template <class T> class MyClass { // ... }; operator+= // ..

Chrome refuses to execute an AJAX script due to wrong MIME type

I'm trying to access a script as JSON via AJAX, which works fine on Safari and other browsers but unfortunately will not execute in Chrome. It's coming with the following error: Refused to execute..

How to use addTarget method in swift 3

here is my button object let loginRegisterButton:UIButton = { let button = UIButton(type: .system) button.backgroundColor = UIColor(r: 50 , g: 80, b: 130) button.setTitle("Register",..

How should I log while using multiprocessing in Python?

Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 multiprocessing module. Because it uses multiprocessing, there is module-level multiprocessing-awar..

NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle

In my AppDelegate there is a problem I do not understand. RootViewController initially called ViewController and I changed it name. The application is formed by many ViewController then I have introdu..

What's the syntax to import a class in a default package in Java?

Is it possible to import a class in Java which is in the default package? If so, what is the syntax? For example, if you have package; public class SomeClass { // ... in one file, yo..

Is there a Subversion command to reset the working copy?

Is there a single Subversion command that would “reset” a working copy exactly to the state that’s stored in the repository? Something like git reset --hard or (ha, hard Git reset does not remov..

Could not find folder 'tools' inside SDK

I am starting Android Development using Eclipse. I have downloaded all the required software but I am having the same problem as discussed here. Now I do not find the solution of the problem on that d..

How can I align text in columns using Console.WriteLine?

I have a sort of column display, but the end two column's seem to not be aligning correctly. This is the code I have at the moment: Console.WriteLine("Customer name " + "sales " ..

Most Pythonic way to provide global configuration variables in

In my endless quest in over-complicating simple stuff, I am researching the most 'Pythonic' way to provide global configuration variables inside the typical '' found in Python egg packages. ..

Initializing a struct to 0

If I have a struct like this: typedef struct { unsigned char c1; unsigned char c2; } myStruct; What would be the easiest way to initialize this struct to 0? Would the following suffice? my..

How can I dynamically add a directive in AngularJS?

I have a very boiled down version of what I am doing that gets the problem across. I have a simple directive. Whenever you click an element, it adds another one. However, it needs to be compiled firs..

How to preserve aspect ratio when scaling image using one (CSS) dimension in IE6?

Here's the problem. I have an image: <img alt="alttext" src="filename.jpg"/> Note no height or width specified. On certain pages I want to only show a thumbnail. I can't alter the html, so I..

What is the difference between hg forget and hg remove?

I want mercurial to remove several files from the current state of the repository. However, I want the files to exist in prior history. How do forget and remove differ, and can they do what I want?..

How to identify and switch to the frame in selenium webdriver when frame does not have id

Can anyone tell me how I can identify and switch to the iframe which has only a title? <iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px;..

The APR based Apache Tomcat Native library was not found on the java.library.path

I'm newly at server development and have been started from easy tutorial by Lars Vogel. Servlet and JSP development with Eclipse WTP . Step by step accord this tutorial: installed Eclipse Java E..

Sublime Text 2: How to delete blank/empty lines

Let's say I had a text file with the following nine lines: foo bar baz qux quux How can I use Sublime Text 2 to remove all four of the blank/empty lines, leaving only five lines?..

How do I specify row heights in CSS Grid layout?

I have a CSS Grid Layout in which I want to make some (middle 3) rows stretch to their maximum size. I'm probably looking for a property similar to what flex-grow: 1 does with Flexbox but I can't seem..

Missing XML comment for publicly visible type or member

I am getting this warning: "Missing XML comment for publicly visible type or member". How to solve this?..

Mockito verify order / sequence of method calls

Is there a way to verify if a methodOne is called before methodTwo in Mockito? public class ServiceClassA { public void methodOne(){} } public class ServiceClassB { public void methodTwo(){..

Simple (I think) Horizontal Line in WPF?

Creating a relatively simple data entry form, and just want to separate certain sections with a horizontal line (not unlike an HR tag in HTML) that stretches the full length of the form. I have tried..

CSS strikethrough different color from text?

The HTML elements del, strike, or s may all be used for a text strike-through effect. Examples: <del>del</del> del <strike>strike</strike> and <s>strike</s..

Formatting doubles for output in C#

Running a quick experiment related to Is double Multiplication Broken in .NET? and reading a couple of articles on C# string formatting, I thought that this: { double i = 10 * 0.69; Console.W..

openCV program compile error " cannot open shared object file: No such file or directory" in ubuntu 12.04

I compiled and installed openCV 2.4.2 in ubuntu 12.04. Under /usr/local/include I can see the directories /usr/local/opencv and /usr/local/opencv2. Here is the code I wrote: #include <cv.h> #i..

Formatting NSDate into particular styles for both year, month, day, and hour, minute, seconds

I basically need to get current date and time separately, formatted as: 2009-04-26 11:06:54 The code below, from another question on the same topic, generates now: |2009-06-01 23:18:23 +..

Upload Progress Bar in PHP

Does anyone know how to get a progress bar for an upload in php? I am trying writing code for a photo album uploader. I would like a progress bar to display while the photos are uploading. I am fair..

Using jQuery UI sortable with HTML tables

I want to output some data from the database in a HTML table, and I want the user to be able to reorder table rows. To achieve this, I used jQuery UI sortable, thus: <script> $(function() {..

How to center an iframe horizontally?

Consider the following example: (live demo) HTML: <div>div</div> <iframe></iframe> CSS: div, iframe { width: 100px; height: 50px; margin: 0 auto; backgroun..

VNC viewer with multiple monitors

I am running a VNC server on Linux and a TightVNC viewer (ver.1.3.10 from 2/10/2009) on Windows with 2 monitors attached to it. I would like to have a full-screen session on both monitors at the same ..

Is there a way to continue broken scp (secure copy) command process in Linux?

I am copying 7.5 GB file to a remote server using scp command. At some point in time file transfer breaks and I have to start all over again. Is the temporary amount of file being transferred complet..

How to display an unordered list in two columns?

With the following HTML, what is the easiest method to display the list as two columns? <ul> <li>A</li> <li>B</li> <li>C</li> <li>D</..

Refresh (reload) a page once using jQuery?

I'm wondering how to refresh/reload a page (or even specific div) once(!) using jQuery? Ideally in a way right after the DOM structure is available (cf. onload event) and not negatively affecting ba..

How can I find the maximum value and its index in array in MATLAB?

Suppose I have an array, a = [2 5 4 7]. What is the function returning the maximum value and its index? For example, in my case that function should return 7 as the maximum value and 4 as the index...

Change tab bar tint color on iOS 7

Is there a way to change the tint of a tab bar on iOS 7 from the default white with blue icons to another color tint with different color buttons?..

Unable to start Service Intent

I have a service class. I have exported this class to jar and I have embed the jar in my client app. When needed, I call the service class. When I try to do this, I get the following error: Unable t..

sudo echo "something" >> /etc/privilegedFile doesn't work

This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux. There are a lot of times when I just want to append something to /etc/hosts or a similar file b..

How to 'grep' a continuous stream?

Is that possible to use grep on a continuous stream? What I mean is sort of a tail -f <file> command, but with grep on the output in order to keep only the lines that interest me. I've tried t..

API pagination best practices

I'd love some some help handling a strange edge case with a paginated API I'm building. Like many APIs, this one paginates large results. If you query /foos, you'll get 100 results (i.e. foo #1-100),..

How to Return partial view of another controller by controller?

I have an XXX.cshtml file in a Views\ABC folder. Its controller is ABC I also have an action method in my DEF controller that return a Partialview("XXX" , xyzmodel) I get a "view not found" error. ..

"ImportError: No module named" when trying to run Python script

I'm trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named ..., however, if I launch ipython and import the same module in the same way thro..

Convert file: Uri to File in Android

What's the easiest way to convert from a file: to a File in Android? Tried the following but it doesn't work: final File file = new File(Environment.getExternalStorageDirectory(), "..

Is there a MessageBox equivalent in WPF?

Is there a standard message box in WPF, like WinForms' System.Windows.Forms.MessageBox.Show(), or should I use the WinForms message box?..

How to create a JavaScript callback for knowing when an image is loaded?

I want to know when an image has finished loading. Is there a way to do it with a callback? If not, is there a way to do it at all?..

HTTP 404 when accessing .svc file in IIS

I recently created a WCF service that works fine when tested from Visual Studio 2008. but when I deploy the project to IIS and I try to access the .svc file from IIS, I get this error : "Server Error..

Convert decimal to hexadecimal in UNIX shell script

In a UNIX shell script, what can I use to convert decimal numbers into hexadecimal? I thought od would do the trick, but it's not realizing I'm feeding it ASCII representations of numbers. printf? ..

Invalid argument supplied for foreach()

It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data. $values = get_values(); foreach ($values as $value){ ... } When you..

Plotting with C#

C# seems to show some promise for scientific computing, but I found very little about one plotting 2D graphs, which is very important both for science student and scientists. Is there a reliable, fre..

Creating a DateTime in a specific Time Zone in c#

I'm trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected. In the test I need to be able to create DateTime o..

jQuery text() and newlines

I want to be able to say $(someElem).text('this\n has\n newlines); and it renders with newlines in the browser. The only workaround I have found is to set the css property 'white-space' to 'pre' o..

What is the use of the JavaScript 'bind' method?

What is the use of bind() in JavaScript?..

Calling C++ class methods via a function pointer

How do I obtain a function pointer for a class member function, and later call that member function with a specific object? I’d like to write: class Dog : Animal { Dog (); void bark (); } ..

Where is the IIS Express configuration / metabase file found?

Where can the IIS Express configuration / metabase file be found?..

How to connect a Windows Mobile PDA to Windows 10

Does anyone know how I can get a Windows Mobile 6.5 PDA to connect up to a Windows 10 PC? Before upgrading the PC from Window 8.1 I was able to use Windows Mobile Device Center to link up to the PDA ..

Event when window.location.href changes

I'm writing a Greasemonkey script for a site which at some point modifies location.href. How can I get an event (via window.addEventListener or something similar) when window.location.href changes on..

How do I call a specific Java method on a click/submit event of a specific button in JSP?

My Java file is: public class MyClass { public void method1() { // some code } public void method2() { //some code } public void method3() { //some ..

Insert php variable in a href

I am planning to insert a PHP variable which holds the directory path for a file stored on my Windows machine. How can I include this variable in the a href tag inside my php script such that when the..

Capitalize the first letter of string in AngularJs

I want capitalize first character of string in angularjs As i used {{ uppercase_expression | uppercase}} it convert whole string to upper case...

Best way to represent a fraction in Java?

I'm trying to work with fractions in Java. I want to implement arithmetic functions. For this, I will first require a way to normalize the functions. I know I can't add 1/6 and 1/2 until I have a ..

Mipmaps vs. drawable folders

I'm working with Android Studio 1.1 Preview 1. I noticed that when I create a new project I'm getting the following hierarchy: Mipmap folders for different DPIs, no more different DPIs drawable fol..

How to center absolute div horizontally using CSS?

I've a div and want it to be centered horizontally - although I'm giving it margin:0 auto; it's not centered... .container { position: absolute; top: 15px; z-index: 2; width:40%; ..

Ternary operators in JavaScript without an "else"

I've always had to put null in the else conditions that don't have anything. Is there a way around it? For example, condition ? x = true : null; Basically, is there a way to do the following? conditi..

Can two Java methods have same name with different return types?

Can two Java methods have the same name with different return type? The return type of the methods are different and they are declared with the same method's name. Is that allowed?..

Explanation of "ClassCastException" in Java

I read some articles written on "ClassCastException", but I couldn't get a good idea on that. Is there a good article or what would be a brief explanation?..

remove item from array using its name / value

I have the following array var countries = {}; countries.results = [ {id:'AF',name:'Afghanistan'}, {id:'AL',name:'Albania'}, {id:'DZ',name:'Algeria'} ]; How can I remove an item fro..

Print the address or pointer for value in C

I want to do something that seems fairly simple. I get results but the problem is, I have no way to know if the results are correct. I'm working in C and I have two pointers; I want to print the cont..

How to set the component size with GridLayout? Is there a better way?

I am working on a larger GUI with Java and I am becoming angry on Layout Managers. I have a "Settings-Panel" with a variable number of JComponents in it (Labels, Buttons, JSpinners, JSliders,...). I ..

Checking letter case (Upper/Lower) within a string in Java

The problem that I am having is that I can't get my Password Verification Program to check a string to ensure that, 1 of the characters is in upper case and one is in lower case, it will check the who..

Loop code for each file in a directory

I have a directory of pictures that I want to loop through and do some file calculations on. It might just be lack of sleep, but how would I use PHP to look in a given directory, and loop through each..

$(document).ready(function(){ Uncaught ReferenceError: $ is not defined

Hi I am having a "Uncaught ReferenceError: $ is not defined" while using bellow codes I am currently getting the following error in my log. I have been looking at the samples in the framework and I j..

How do I parse JSON with Objective-C?

I am new to iPhone. Can anyone tell me the steps to follow to parse this data and get the activity details, first name, and last name? { "#error": false, "#data": { "": { ..

HttpServletRequest to complete URL

I have an HttpServletRequest object. How do I get the complete and exact URL that caused this call to arrive at my servlet? Or at least as accurately as possible, as there are perhaps things that ca..

bash: mkvirtualenv: command not found

After following the instructions on Doug Hellman's virtualenvwrapper post, I still could not fire up a test environment. [mpenning@tsunami ~]$ mkvirtualenv test -bash: mkvirtualenv: command not found..

What is the best way to detect a mobile device?

Is there a way to detect whether or not a user is using a mobile device in jQuery? Something similar to the CSS @media attribute? I would like to run a different script if the browser is on a handheld..

Get HTML code using JavaScript with a URL

I am trying to get the source code of HTML by using an XMLHttpRequest with a URL. How can I do that? I am new to programming and I am not too sure how can I do it without jQuery...

AVD Manager - Cannot Create Android Virtual Device

I just installed the Android Eclipse Plugin and the Android SDK from Google yesterday. I open the AVD Manager window by going to Window -> Android Virtual Device Manager. I then click "New" and am ..