Questions Tagged with #Iphone sdk 4.0.1

Refers to the iPhone software development kit, version 4.0.1

How to Get Element By Class in JavaScript?

I want to replace the contents within a html element so I'm using the following function for that: function ReplaceContentInContainer(id,content) { var container = document.getElementById(id); ..

How to declare a variable in a template in Angular

I have the following template : <div> <span>{{aVariable}}</span> </div> and would like to end up with : <div "let a = aVariable"> <span>{{a}}</spa..

Copy Paste in Bash on Ubuntu on Windows

How to execute a copy paste operation from Windows 10 to the Bash on Ubuntu on Windows environment? I tried the following: ctrl + shift + v right click to paste Any suggestions?..

Scaling an image to fit on canvas

I have a form that allows a user to upload an image. Once the image is loaded, we perform some scaling on it in order to reduce its filesize before we pass it back to the server. To do this, we plac..

php mail setup in xampp

I'm learning PHP and have installed Xampp on my computer. But I have a problem with the setup as the email option doesn't seem to be working. After doing some reading I think it has something to d..

Is there any way to install Composer globally on Windows?

I've read the global installation documentation for Composer, but it's for *nix systems only: curl -s | php sudo mv composer.phar /usr/local/bin/composer I would..

removeEventListener on anonymous functions in JavaScript

I have an object that has methods in it. These methods are put into the object inside an anonymous function. It looks like this: var t = {}; window.document.addEventListener("keydown", function(e) { ..

Where is my m2 folder on Mac OS X Mavericks

I cant seem to find the local .m2 folder on Mac OS X mavericks. Ideally it should be at {user.home}/.m2 but I cant seem to find it. Should I create it?..

How to insert a character in a string at a certain position?

I'm getting in an int with a 6 digit value. I want to display it as a String with a decimal point (.) at 2 digits from the end of int. I wanted to use a float but was suggested to use String for a bet..

Add my custom http header to Spring RestTemplate request / extend RestTemplate

My current code: RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); Mall[] malls = restTemplate.getForObject(url, Mall..

How do you programmatically set an attribute?

Suppose I have a python object x and a string s, how do I set the attribute s on x? So: >>> x = SomeObject() >>> attr = 'myAttr' >>> # magic goes here >>> x.myAttr..

How do I include a Perl module that's in a different directory?

How do I include a Perl module that's in a different directory? It needs to be a relative path from the module that's including it. I've tried push ( @INC,"directory_path/more_path"); also push..

Installing Apple's Network Link Conditioner Tool

I have installed xcode 4.3.1 on my machine running Lion. I can't find the Network Link Conditioner tool anywhere. I have checked the utilities folder, also the xcode/contents/developer/* directorie..

Android SDK location should not contain whitespace, as this cause problems with NDK tools

Recently I have installed the last version of Android Studio (Android Studio 2.1), keeping the old 1.2 version previously installed. Now i have Android Studio 2.1 and Android Studio 1.2. In Android S..

Closing Excel Application using VBA

I have used the following without success. The active workbook closes, indeed, but the excel window remains open. Application.ActiveWindow.Close SaveChanges:=False ActiveWorkbook.Close SaveChanges:=F..

PHP string "contains"

What would be the most efficient way to check whether a string contains a "." or not? I know you can do this in many different ways like with regular expressions or loop through the string to see if ..

What does random.sample() method in python do?

I Googled it a lot but could not found it. I want to know the use of random.sample() method and what does it give? When should it be used and some example usage...

Graphical HTTP client for windows

I am looking for a Windows graphical utility for performing HTTP operations. For example, I want to be able to say things like: POST to With a POST body: "Data goes h..

How to create range in Swift?

In Objective-c we create range by using NSRange NSRange range; So how to create range in Swift?..

Syncing Android Studio project with Gradle files

I was working on a project, and then I got a prompt to update Android Studio. After I did that, I started getting this error when trying to run my app It says The project may need to be synced..

Creating Accordion Table with Bootstrap

I have a table that's populated from a database which has lots of columns (around 30). A solution someone thought of was to create an accordion out the table, where each row is clickable and will acco..

How to make Visual Studio copy a DLL file to the output directory?

I have a Visual Studio C++ project that relies on an external DLL file. How can I make Visual Studio copy this DLL file automatically into the output directory (debug/release) when I build the project..

Google Maps Api v3 - find nearest markers

When i click on map, which will be best way to find nearest marker or markers? is there some functions in api that will help me to do that? it's google map api v3...

Delete forked repo from GitHub

I'm starting with git and GitHub and there's a project I'm watching on GitHub. I unintentionally clicked to fork it. Now it appears as a new project to me. I have some doubts about it: I know if co..

How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

I need some guide lines on how to install a Date Picker Bootstrap 3 on a MVC 5 project using the Razor engine. I found this link here but couldn't make it work in VS2013. Copying from the example in..

How to check how many letters are in a string in java?

How do you check how many letters are in a Java string? How do you check what letter is in a certain position in the string (i.e, the second letter of the string)?..

MassAssignmentException in Laravel

I am a Laravel newbie. I want to seed my database. When I run the seed command I get an exception [Illuminate\Database\Eloquent\MassAssignmentException] username db:seed [--class[="..."]] [--d..

Accuracy Score ValueError: Can't Handle mix of binary and continuous target

I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric. This is ..

How to set JFrame to appear centered, regardless of monitor resolution?

While working with Java, I find it hard to position my main window in the center of the screen when I start the application. Is there any way I can do that? It doesn't have to be vertically centered,..

Socket.IO - how do I get a list of connected sockets/clients?

I'm trying to get a list of all the sockets/clients that are currently connected. io.sockets does not return an array, unfortunately. I know I could keep my own list using an array, but don't thin..

Javascript: best Singleton pattern

Possible Duplicate: Simplest/Cleanest way to implement singleton in JavaScript? I'm using this pattern for singletons, in the example the singleton is PlanetEarth: var NAMESPACE = function..

"for" vs "each" in Ruby

I just had a quick question regarding loops in Ruby. Is there a difference between these two ways of iterating through a collection? # way 1 @collection.each do |item| # do whatever end # way 2 fo..

How do I convert between big-endian and little-endian values in C++?

How do I convert between big-endian and little-endian values in C++? For clarity, I have to translate binary data (double-precision floating point values and 32-bit and 64-bit integers) from one CPU a..

How to find server name of SQL Server Management Studio

I installed Microsoft SQL Server 2008. When I start SQL Server Management Studio (SSMS), I get the Connect to Server login window with a blank textbox for Server name. I have tried a lot of names, bu..

Correct Way to Load Assembly, Find Class and Call Run() Method

Sample console program. class Program { static void Main(string[] args) { // ... code to build dll ... not written yet ... Assembly assembly = Assembly.LoadFile(@"C:\dyn.dll")..

How does the ARM architecture differ from x86?

Is the x86 Architecture specially designed to work with a keyboard while ARM expects to be mobile? What are the key differences between the two?..

How do I undo the most recent local commits in Git?

I accidentally committed the wrong files to Git, but didn't push the commit to the server yet. How can I undo those commits from the local repository?..

Uncaught ReferenceError: angular is not defined - AngularJS not working

I'm attempting to learn angular and I am struggling with a simple button click. I followed an example which has an identical code to the one below. The result I am looking for is for the button click..

Class 'DOMDocument' not found

I've found an error on a page in my Magento application; it always show this message error when I visit it: Fatal error: Class 'DOMDocument' not found in /home/.../lib/Zend/Feed/Abstract.php on li..

Remove white space below image

In Firefox only my video thumbnails are displaying mysterious 2-3 pixels of white space between the bottom of my image and its border (see below). I've tried everything I can think of in Firebug with..

Does the Java &= operator apply & or &&?

Assuming boolean a = false; I was wondering if doing: a &= b; is equivalent to a = a && b; //logical AND, a is false hence b is not evaluated. or on the other hand it means a = ..

What is a good pattern for using a Global Mutex in C#?

The Mutex class is very misunderstood, and Global mutexes even more so. What is good, safe pattern to use when creating Global mutexes? One that will work Regardless of the locale my machine is in..

How do I get started with Node.js

Are there any good resources to get started with Node.JS? Any good tutorials, blogs or books? Of course, I have visited its official website, but I didn't think the documentation t..

Export database schema into SQL file

Is it possible in MS SQL Server 2008 to export database structure into a T-SQL file? I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedu..

Query for array elements inside JSON type

I'm trying to test out the json type in PostgreSQL 9.3. I have a json column called data in a table called reports. The JSON looks something like this: { "objects": [ {"src":"foo.png"}, {"s..

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

I included these in the Build Path: all Spring libs Apache Tomcat 7.0 library The project still fails during startup: SEVERE: Error configuring application listener of class org.springframework.w..

Using cURL with a username and password?

I want to access a URL which requires a username/password. I'd like to try accessing it with curl. Right now I'm doing something like: curl I get an ..

Trying to get the average of a count resultset

I have the following SQL:(bitemp) SELECT COUNT (*) AS Count FROM Table T WHERE (T.Update_time = (SELECT MAX (B.Update_time ) FROM Table B WHERE (B.Id = T.Id))..

Returning a boolean value in a JavaScript function

I am doing a client side form validation to check if passwords match. But the validation function always returns undefined. function validatePassword(errorMessage) { var password = document.getEle..

include external .js file in node.js app

I have an app.js node application. As this file is starting to grow, I would like to move some part of the code in some other files that I would "require" or "include" in the app.js file. I'm trying ..

Is there any 'out-of-the-box' 2D/3D plotting library for C++?

I looked at the different options for plotting functions (or other types of graphs) in an interactive window. I mostly use wxWidgets but I'd be open to any other "interfaces". Looking at what is ava..

How to show x and y axes in a MATLAB graph?

I am drawing a graph using the plot() function, but by default it doesn't show the axes. How do we enable showing the axes at x=0 and y=0 on the graph? Actually my graph is something like: And I wa..

"Submit is not a function" error in JavaScript

Can anyone tell me what is going wrong with this code? I tried to submit a form with JavaScript, but an error ".submit is not a function" shown. See below for more details of the code: <form actio..

How to merge remote master to local branch

I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local ..

Return Max Value of range that is determined by an Index & Match lookup

I need a cell to display the max value of a range who's row is defined by an index and match formula. I know this will be an array function but I'm struggling to get the syntax right. Here is what my ..

How can I make visible an invisible control with jquery? (hide and show not work)

How can I change the visibility of a control with jQuery? I have a control that its visible property to false (not css). When I used show() function for it nothing happened, it seems that hide() and s..

How to set DialogFragment's width and height?

Let's say I specify the layout of my DialogFragment in an xml layout file named my_dialog_fragment.xml and I specify the layout_width and layout_height values of its root view to a fixed value (e.g. 1..

Create autoincrement key in Java DB using NetBeans IDE

I'm coming from MySQL world, please help. Is it possible to create autoincrement key from NetBeans IDE in JavaDB? Do you use some more advanced db clients, which? Thanks...

Best way to get all selected checkboxes VALUES in jQuery

I am looking to get all checkboxes' VALUE which have been selected through jQuery...

Angularjs - simple form submit

I am going through learning curve with AngularJs and I am finding that there are virtually no examples that serve real world use. I am trying to get a clear understanding of how to submit a form with..

Python: tf-idf-cosine: to find document similarity

I was following a tutorial which was available at Part 1 & Part 2. Unfortunately the author didn't have the time for the final section which involved using cosine similarity to actually find the d..

How do I set Tomcat Manager Application User Name and Password for NetBeans?

I'm trying to follow a tutorial to make an extremely basic Java web application in NetBeans. When I try to run it, a dialogue box appears title "Authentication Required". Inside the dialogue box the..

Compiler error: "initializer element is not a compile-time constant"

When compiling this code, I get the error "initializer element is not a compile-time constant". Can anyone explain why? #import "PreferencesController.h" @implementation PreferencesController - (id..

Add context path to Spring Boot application

I am trying to set a Spring Boot applications context root programmatically. The reason for the context root is we want the app to be accessed from localhost:port/{app_name} and have all the controlle..

How do you do a deep copy of an object in .NET?

I want a true deep copy. In Java, this was easy, but how do you do it in C#?..

Which concurrent Queue implementation should I use in Java?

From the JavaDocs: A ConcurrentLinkedQueue is an appropriate choice when many threads will share access to a common collection. This queue does not permit null elements. ArrayBlockingQueue is a clas..

Attribute 'nowrap' is considered outdated. A newer construct is recommended. What is it?

I'm getting an error when compiling this within an ASPX page using Visual Studio 2010: <td valign="top" nowrap width="237"> The error message is "Attribute 'nowrap' is considered out..

How to use "svn export" command to get a single file from the repository?

How can I use the svn export command to get a single file from the repository? I've tried this: svn export e:\repositories\process\test.txt c:\ But I get this error: svn: e:\repositories\proce..

Remove background drawable programmatically in Android

I want to remove the background drawable @drawable/bg programmatically. Is there a way to do that? Currently, I have the following XML in my layout: <?xml version="1.0" encoding="utf-8"?> <..

Using msbuild to execute a File System Publish Profile

I have a c# .Net 4.0 project created with VS2010 and now being accessed with VS2012. I'm trying to publish only the needed files from this website to a destination location (C:\builds\MyProject[Files..

How do I check out a remote Git branch?

Somebody pushed a branch called test with git push origin test to a shared repository. I can see the branch with git branch -r. Now I'm trying to check out the remote test branch. I've tried: git ..

Android Facebook 4.0 SDK How to get Email, Date of Birth and gender of User

I am using the following code. I want the user's Date Of Birth, Email and Gender. Please help. How to retrieve those data? This is my onViewCreated() inside the Fragment. @Override public void onVie..

Evenly distributing n points on a sphere

I need an algorithm that can give me positions around a sphere for N points (less than 20, probably) that vaguely spreads them out. There's no need for "perfection", but I just need it so none of them..

Data binding for TextBox

I have a basic property that stores an object of type Fruit: Fruit food; public Fruit Food { get {return;} set { value; this.RefreshDataBindings(); ..

'method' object is not subscriptable. Don't know what's wrong

I'm writing some code to create an unsorted list but whenever I try to insert a list using the insert method I get the 'method' object is not subscriptable error. Not sure how to fix it. Thanks. clas..

Image comparison - fast algorithm

I'm looking to create a base table of images and then compare any new images against that to determine if the new image is an exact (or close) duplicate of the base. For example: if you want to reduc..

mongod command not recognized when trying to connect to a mongodb server

I am following the tutorials at, I have completed the first tutorial which was to install mongodb on a windows machine. I am now at the second stage which is getting started with mong..

Add disabled attribute to input element using Javascript

I have an input box and I want it to be disabled and at the same time hide it to avoid problems when porting my form. So far I have the following code to hide my input: $(".shownextrow").click(funct..

How to run shell script on host from docker container?

How to control host from docker container? For example, how to execute copied to host bash script?..

Input and output numpy arrays to h5py

I have a Python code whose output is a sized matrix, whose entries are all of the type float. If I save it with the extension .dat the file size is of the order of 500 MB. I read that using h5py redu..

Declare variable in SQLite and use it

I want to declare a variable in SQLite and use it in insert operation. Like in MS SQL: declare @name as varchar(10) set name = 'name' select * from table where name = @name For example, I will nee..

Get/pick an image from Android's built-in Gallery app programmatically

I am trying to open an image / picture in the Gallery built-in app from inside my application. I have a URI of the picture (the picture is located on the SD card). Do you have any suggestions?..

Display PDF within web browser

How can I display a pdf within a web browser on an .html page?..

Example of SOAP request authenticated with WS-UsernameToken

I'm trying to authenticate a SOAP request using WS-UsernameToken spec, but the target device is always denying access. My non-working request looks like this. (The password I'm trying to hash is syste..

How can I submit a form using JavaScript?

I have a form with id theForm which has the following div with a submit button inside: <div id="placeOrder" style="text-align: right; width: 100%; background-color: white;"..

Passing Parameters JavaFX FXML

How can I pass parameters to a secondary window in javafx? Is there a way to communicate with the corresponding controller? For example: The user chooses a customer from a TableView and a new window ..

@RequestParam in Spring MVC handling optional parameters

Is it possible for a Spring controller to handle both kind of requests? 1) http://localhost:8080/submit/id/ID123432?logout=true 2) http://localhost:8080/submit/id/ID123432?name=sam&password=543..

cannot load such file -- bundler/setup (LoadError)

I'm setting Rails 4 application with Ruby 2.0, but I'm getting "Web application could not be started" and get this trace: cannot load such file -- bundler/setup (LoadError) /usr/local/lib/ruby/site..

How to deserialize xml to object

<StepList> <Step> <Name>Name1</Name> <Desc>Desc1</Desc> </Step> <Step> <Name>Name2</Name> <Desc>Desc2</Desc&g..

How can I extract a good quality JPEG image from a video file with ffmpeg?

Currently I am using this command to extract the images: ffmpeg -i input.mp4 output_%03d.jpeg But how can I improve the JPEG image quality?..

How to set bootstrap navbar active class with Angular JS?

If I have a navbar in bootstrap with the items Home | About | Contact How do I set the active class for each menu item when they are active? That is, how can I set class="active" when the angular r..

How do I use method overloading in Python?

I am trying to implement method overloading in Python: class A: def stackoverflow(self): print 'first method' def stackoverflow(self, i): print 'second method', i ob=A()..

How to get Toolbar from fragment?

I have ActionBarActivity with NavigationDrawer and use support_v7 Toolbar as ActionBar. In one of my fragments toolbar has custom view. In other fragments Toolbar should show title. How get Toolbar i..

Opencv - Grayscale mode Vs gray color conversion

I am working in opencv(2.4.11) python(2.7) and was playing around with gray images. I found an unusual behavior when loading image in gray scale mode and converting image from BGR to GRAY. Following i..

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..

Jquery Button Click Event via ajax

I was wondering if anyone can point me in the right direction. I have an button with a click event (that runs some server side code). What i'd like to do is call this event via ajax and jquer..

Redirect non-www to www in .htaccess

I have this in my .htaccess file: RewriteCond %{HTTP_HOST} ^$ RewriteRule (.*)$1 [R=301,L] but whenever I access a file on my root like

Node.js ES6 classes with require

So up until now, i have created classes and modules in node.js the following way: var fs = require('fs'); var animalModule = (function () { /** * Constructor initialize object * @c..

How do I delete everything below row X in VBA/Excel?

I have a long variable X that contains a number. Say it's 415. How do I delete everything on the worksheet from Row 415 and below? I want to ensure my spreadsheet is clean in Row 415 and anything e..

How to add form validation pattern in Angular 2?

I have a simple form that needs to validate if the beginning and the end of the input is not space. In HTML5, I will do this: <input type="text" pattern="^(?!\s|.*\s$).*$"> What is the right..

"UnboundLocalError: local variable referenced before assignment" after an if statement

I have also tried searching for the answer but I don't understand the answers to other people's similar problems... tfile= open("/home/path/to/file",'r') def temp_sky(lreq, breq): for line in t..

How to fix: /usr/lib/ version `GLIBCXX_3.4.15' not found

So I'm now desperate in finding a fix for this. I'm compiling a shared library .so in Ubuntu 32 bit (Have tried doing it under Debian and Ubuntu 64 bit, but none worked either) I keep getting: /usr/l..

could not access the package manager. is the system running while installing android application

While installing the android application in the emulator I am getting the following error. Please help me to resolve this error. Error message: emulator.exe -avd avd_name adb wait-for-device ..

Using reflection in Java to create a new instance with the reference variable type set to the new instance class name?

All the examples I look at for reflection show creating a new instance of an unknown implementation, and casting that implementation to it's interface. The issue with this is that now you can't call a..

How to insert a blob into a database using sql server management studio

How can I easily insert a blob into a varbinary(MAX) field? As an example: thing I want to insert is: c:\picture.png the table is mytable the column is mypictureblob the place is recid=1..

How to re-enable right click so that I can inspect HTML elements in Chrome?

I am looking at a web page which has overwritten the right-click button so to display its own popup HTML element. This prevents me from using Chrome Developer Tools to inspect elements. Does anybod..

How to upgrade OpenSSL in CentOS 6.5 / Linux / Unix from source?

How do I upgrade OpenSSL in CentOS 6.5? I have used these commands, but nothings happens: cd /usr/src wget tar -zxf openssl-1.0.1g.tar.gz cd o..

How can I create a dynamically sized array of structs?

I know how to create an array of structs but with a predefined size. However is there a way to create a dynamic array of structs such that the array could get bigger? For example: typedef struct..

Linux c++ error: undefined reference to 'dlopen'

I work in Linux with C++ (Eclipse), and want to use a library. Eclipse shows me an error: undefined reference to 'dlopen' Do you know a solution? Here is my code: #include <stdlib.h> #in..

Specifying number of decimal places in Python

When accepting user input with a decimal in Python I'm using: #will input meal subtotal def input_meal(): mealPrice = input('Enter the meal subtotal: $') mealPrice = float (mealPrice)..

View tabular file such as CSV from command line

Anyone know of a command-line CSV viewer for Linux/OS X? I'm thinking of something like less but that spaces out the columns in a more readable way. (I'd be fine with opening it with OpenOffice Calc..

How to select all textareas and textboxes using jQuery?

How can I select all textboxes and textareas, e.g: <input type='text' /> and <textarea></textarea> on a page and have the property style.width="90%"; applied to them?..

No appenders could be found for logger(log4j)?

I have put log4j to my buildpath, but I get the following message when I run my application: log4j:WARN No appenders could be found for logger (dao.hsqlmanager). log4j:WARN Please initialize the log4..

java.lang.RuntimeException: Uncompilable source code - what can cause this?

This error is just bizarre, my code compiles fine, I can see there are no problems with it, yet this error has just popped up. I have tried re-starting NetBeans and there is no additional exception in..

converting list to json format - quick and easy way

Let's say I have an object MyObject that looks like this: public class MyObject { int ObjectID {get;set;} string ObjectString {get;set;} } I have a list of MyObject and I'm looking to convert ..

Why can't a text column have a default value in MySQL?

If you try to create a TEXT column on a table, and give it a default value in MySQL, you get an error (on Windows at least). I cannot see any reason why a text column should not have a default value. ..

PHP fwrite new line

I'm trying to write username and password to a new line in a txt file. The output should be something like this in the txt file. I know this is not very secure but its just for learning purposes Sebas..

How to delete a workspace in Perforce (using p4v)?

I'm new to Perforce and have created a few workspaces as exercises for getting familiar with it. Now I would like to delete some of the workspaces. I just want to get rid of the workspaces so that the..

Accessing dictionary value by index in python

I would like to get the value by key index from a Python dictionary. Is there a way to get it something like this? dic = {} value_at_index = dic.ElementAt(index) where index is an integer..

C# get and set properties for a List Collection

How are properties for a Collection set? I've created a class with a Collection properties. I want to add to the List anytime I set a new value. Using _name.Add(value) within the set method doesn't w..

Refresh image with a new one at the same url

I am accessing a link on my site that will provide a new image each time it is accessed. The issue I am running into is that if I try to load the image in the background and then update the one on th..

What are the differences between using the terminal on a mac vs linux?

I've been using Ubuntu for the last four years. I have a basic knowledge of shell commands and I prefer working in a terminal rather than using a GUI. Recently I've started using a Mac. I've tried ..

How do I copy an object in Java?

Consider the code below: DummyBean dum = new DummyBean(); dum.setDummy("foo"); System.out.println(dum.getDummy()); // prints 'foo' DummyBean dumtwo = dum; System.out.println(dumtwo.getDummy()); // p..

Complex numbers usage in python

I'm a math newbie. Now I'm getting deeper into Python data types. I can't understand how to use a complex number. Please give me examples of usage of complex numbers in Python...

More elegant "ps aux | grep -v grep"

When I check list of processes and 'grep' out those that are interesting for me, the grep itself is also included in the results. For example, to list terminals: $ ps aux | grep terminal user 2064 ..

Ansible: how to get output to display

I have the following playbook, Playbook with output There are currently no errors and it runs fine. However, it does not display the output to the console. I have come across this with other playbook..

Singular matrix issue with Numpy

I am trying to multiply a vector(3 by 1) by its transpose(1 by 3). I get a (3 by 3) array but I cannot get its inverse. Any idea why? import numpy as np c=array([1, 8, 50]) np.transpose(c[np.newaxis..

moving changed files to another branch for check-in

This often happens to me: I write some code, go to check in my changes, and then realize I'm not in the proper branch to check in those changes. However I can't switch to another branch without my cha..

Set database timeout in Entity Framework

My command keeps timing out, so I need to change the default command timeout value. I've found myDb.Database.Connection.ConnectionTimeout, but it's readonly. How can I set the command timeout in Ent..

How to determine the last Row used in VBA including blank spaces in between

How can I determine the last row in an Excel sheet, including some blank lines in the middle? With this function: Function ultimaFilaBlanco(col As String) As Long Dim lastRow As Long..

Git: Could not resolve host error while cloning remote repository in git

What I did: I have created a remote repository on Github and I am trying to clone the remote repository on my local machine. While cloning I am providing the clone URL & target folder. But every ..

Removing duplicate objects with Underscore for Javascript

I have this kind of array: var foo = [ { "a" : "1" }, { "b" : "2" }, { "a" : "1" } ]; I'd like to filter it to have: var bar = [ { "a" : "1" }, { "b" : "2" }]; I tried using _.uniq, but I guess ..

Intellij reformat on file save

I remember seeing in either IntelliJ or Eclipse the setting to reformat (cleanup) files whenever they are saved. How do I find it (didn't find it in the settings)..

What is Persistence Context?

I am new to the Java world and JPA. I was studying JPA and came across many new terms like Entity, persistence. While reading, I could not understand the exact definition for Persistence Context. Can..

Error in spring application context schema

I have a maven-spring project in Eclipse and I have this annoying error message in one of my spring contexts: Referenced file contains errors (jar:file:/M2_HOME/repository/org/springframework/spri..

How to show data in a table by using psql command line interface?

Is there a way to show all the content inside a table by using psql command line interface? I can use \list to show all the databases, \d to show all the tables, but how can I show all the data in a ..

IF-THEN-ELSE statements in postgresql

I'm looking to write a postgresql query to do the following : if(field1 > 0, field2 / field1 , 0) I've tried this query, but it's not working if (field1 > 0) then return field2 / field1 as ..

Oracle (ORA-02270) : no matching unique or primary key for this column-list error


How do I limit the number of rows returned by an Oracle query after ordering?

Is there a way to make an Oracle query behave like it contains a MySQL limit clause? In MySQL, I can do this: select * from sometable order by name limit 20,10 to get the 21st to the 30th rows (skip..

Converting an integer to a hexadecimal string in Ruby

Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent? Something like the opposite of String#to_i: "0A".to_i(16) #=>10 Like perhaps: "0A".hex #=>10 I know ..

Opening a .ipynb.txt File

I have got downloaded a file that got downloaded in a format .pynb.txt extension. Can anyone help me to figure how to make it in a readable format? Attaching a screenshot of the file when i tried open..

Is it possible to use raw SQL within a Spring Repository

I need to use raw SQL within a Spring Data Repository, is this possible? Everything I see around @Query is always entity based...

Does Spring @Transactional attribute work on a private method?

If I have a @Transactional -annotation on a private method in a Spring bean, does the annotation have any effect? If the @Transactional annotation is on a public method, it works and open a transacti..

How to disable spring security for particular url

I am using stateless spring security,but in case of signup i want to disable spring security.I disabled using antMatchers("/api/v1/signup").permitAll(). but it is not working,i am getting error b..

how to fetch data from database in Hibernate

This is my class to fetch data from database package com.javatpoint.mypackage; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Tra..

how to activate a textbox if I select an other option in drop down box

suppose I've a 3 options in a drop down box say red , blue, others. If a user select option as an others then below a text box should be visible to wrtie his own favourite color. I can populat..

How can I loop over entries in JSON?

I want to loop over the content of a JSON file and print it to the console. I think I did mix up something with lists. This is what I tried to get all the team_name elements from urllib2 import url..

Embedding a media player in a website using HTML

What I want to do is to embed music files within a website (Have something a'la little mp3 player on the site). I want the audience to be able to play, stop etc the songs by using custom made controll..

Configure nginx with multiple locations with different root folders on subdomain

I'm looking to serve the root url of a subdomain and directory of a subdomain to two different folders on my server. Here is the simple set-up that I have and is not working... server { index in..

How to split a string by spaces in a Windows batch file?

Suppose I have a string "AAA BBB CCC DDD EEE FFF". How can I split the string and retrieve the nth substring, in a batch file? The equivalent in C# would be "AAA BBB CCC DDD EEE FFF".Split()[n] ..

how to calculate percentage in python

This is my program print" Welcome to NLC Boys Hr. Sec. School " a=input("\nEnter the Tamil marks :") b=input("\nEnter the English marks :") c=input("\nEnter the Maths marks :") d=input("\nEnter the S..

Android: How to open a specific folder via Intent and show its content in a file browser?

I thought this would be easy but as it turns out unfortunately it's not. What I have: I have a folder called "myFolder" on my external storage (not sd card because it's a Nexus 4, but that should no..

Javascript - How to detect if document has loaded (IE 7/Firefox 3)

I want to call a function after a document loads, but the document may or may not have finished loading yet. If it did load, then I can just call the function. If it did NOT load, then I can attach a..

Where to get "UTF-8" string literal in Java?

I'm trying to use a constant instead of a string literal in this piece of code: new InputStreamReader(new FileInputStream(file), "UTF-8") "UTF-8" appears in the code rather often, and would be much..

Excel: last character/string match in a string

Is there an efficient way to identify the last character/string match in a string using base functions? I.e. not the last character/string of the string, but the position of a character/string's ..

Highlight a word with jQuery

I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text: <p> Lorem ipsum dolor sit amet, consec..

Why does jQuery or a DOM method such as getElementById not find the element?

What are the possible reasons for document.getElementById, $("#id") or any other DOM method / jQuery selector not finding the elements? Example problems include: jQuery silently failing to bind an ..

tsql returning a table from a function or store procedure

This is more of a syntax question I'm trying to write a store procedure or function that I can embed into a query such as: select * from MyBigProcOrFunction I'm trying to define a tabular function ..

How to import module when module name has a '-' dash or hyphen in it?

I want to import This works: foobar = __import__("foo-bar") This does not: from "foo-bar" import * My question: Is there any way that I can use the above format i.e., from "foo-bar" ..

Best C# API to create PDF

Can you recomend any PDF API for C#. Free is the best, but I don't mind paying for it...

PDOException SQLSTATE[HY000] [2002] No such file or directory

I believe that I've successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as php artisan migrate or php artisan db:seed) I get an error m..

Test iOS app on device without apple developer program or jailbreak

How can I test an iOS application on my iPod Touch without registering for the Apple Developer Program or jailbreaking my iPod? Neither is a viable option at the moment. I'd like to test on the devi..

How to change node.js's console font color?

I had to change the console background color to white because of eye problems, but the font is gray colored and it makes the messages unreadable. How can I change it?..

How to express a NOT IN query with ActiveRecord/Rails?

I'm hoping there is a easy solution that doesn't involve find_by_sql, if not then I guess that will have to work. I found this article which references this: Topic.find(:all, :conditions => { :foru..

Sending an Intent to browser to open specific URL

I'm just wondering how to fire up an Intent to the phone's browser to open an specific URL and display it. Can someone please give me a hint?..

How to run a program automatically as admin on Windows 7 at startup?

I created my own parental control app to monitor my kids activity. The app's only GUI is a task bar icon. The program is installed as admin. I'd like this program to be started up automatically as adm..

better way to drop nan rows in pandas

On my own I found a way to drop nan rows from a pandas dataframe. Given a dataframe dat with column x which contains nan values,is there a more elegant way to do drop each row of dat which has a nan v..

Request string without GET arguments

Is there a simple way to get the requested file or directory without the GET arguments? For example, if the URL is I would like to return just htt..

Selecting the last value of a column

I have a spreadsheet with some values in column G. Some cells are empty in between, and I need to get the last value from that column into another cell. Something like: =LAST(G2:G9999) except that..

Cannot create a connection to data source Error (rsErrorOpeningConnection) in SSRS

I'm working on integrating a report into a browser, and I get this error: An error has occurred during report processing. (rsProcessingAborted) Cannot create a connection to data source 'dsFederatedS..

How to break out or exit a method in Java?

The keyword break in Java can be used for breaking out of a loop or switch statement. Is there anything which can be used to break from a method?..

Remove HTML tags from string including &nbsp in C#

How can I remove all the HTML tags including &nbsp using regex in C#. My string looks like "<div>hello</div><div><br></div><div><br></div><div..

Stuck while installing Visual Studio 2015 (Update for Microsoft Windows (KB2999226))

I am trying to install Visual Studio 2015 to my Windows 7. I seem to get stuck in this screen while installing it. It has been like 3 hours now and still stuck. Tried installing that update manually b..

How to check list A contains any value from list B?

List A: 1, 2, 3, 4 List B: 2, 5 How to check if list A contains any value from list B? e.g. something like A.contains(a=> =

Get current location of user in Android without using GPS or internet

Is it possible to get the current location of user without using GPS or the internet? I mean with the help of mobile network provider...

Removing spaces from a variable input using PowerShell 4.0

I've tried a few things already but they don't seem to work for some reason. Basically what I'm attempting to do is have a user input a value using the "Read-host" cmdlet, then strip it of any spac..

T-SQL get SELECTed value of stored procedure

In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 So, it's possible to get the value of a SELECT and stuff it in a va..

Algorithm to calculate the number of divisors of a given number

What would be the most optimal algorithm (performance-wise) to calculate the number of divisors of a given number? It'll be great if you could provide pseudocode or a link to some example. EDIT: All..

Check if one list contains element from the other

I have two lists with different objects in them. List<Object1> list1; List<Object2> list2; I want to check if element from list1 exists in list2, based on specific attribute (Object1 an..

np.mean() vs np.average() in Python NumPy?

I notice that In [30]: np.mean([1, 2, 3]) Out[30]: 2.0 In [31]: np.average([1, 2, 3]) Out[31]: 2.0 However, there should be some differences, since after all they are two different functions. Wh..

X close button only using css

How to make a cross (X) only in CSS3, to use as a close button? I've been searching for a long time, and cannot found how.... When I look at source code on a website using it, there's always something..

Converting of Uri to String

Is it possible to convert an Uri to String and vice versa? Because I want to get the the Uri converted into String to pass into another activity via intent.putextra() and if it's not possible can anyo..

Unused arguments in R

In R, is it possible to have a the software ignore the fact that there are unused arguments defined when a module is run? For example, I have a module multiply(a,b), which returns the product of a an..

Clear ComboBox selected text

I have a ComboBox control with the DropDownStyle properties set to DropDownList. Once there is an item selected, how can I clear the selection from the ComboBox without deleting any Items in it ? I'd..

Lodash .clone and .cloneDeep behaviors

I try to clone an array of objects with nested objects. Something like: var data = [ { id: 1, values: { a: 'a', b: 'b' } }, { id: 2, values: { c: 'c', d: 'd' } } ]; _.Clone With the _.clo..

Background color in input and text fields

I would like to change the color background in the text and input fields of a form, but when I do this it also affects the submit button! Could it be done in some other way that does not affect the bu..

Compute a confidence interval from sample data

I have sample data which I would like to compute a confidence interval for, assuming a normal distribution. I have found and installed the numpy and scipy packages and have gotten numpy to return a m..

Using Node.JS, how do I read a JSON file into (server) memory?

Background I am doing some experimentation with Node.js and would like to read a JSON object, either from a text file or a .js file (which is better??) into memory so that I can access that object qui..

FormData.append("key", "value") is not working

Can you tell me whats wrong with this: var formdata = new FormData(); formdata.append("key", "value"); console.log(formdata); My output looks like this, I cant find my "key" - "value" pair FormDat..

Copy entire contents of a directory to another using php

I tried to copy the entire contents of the directory to another location using copy ("old_location/*.*","new_location/"); but it says it cannot find stream, true *.* is not found. Any other way ..

What is the correct way to represent null XML elements?

I have seen null elements represented in several ways: The element is present with xsi:nil="true": <book> <title>Beowulf</title> <author xsi:nil="true"/> </boo..

How to run TypeScript files from command line?

I'm having a surprisingly hard time finding an answer to this. With plain Node.JS, you can run any js file with node path/to/file.js, with CoffeeScript it's coffee and ES6 has babel-node ..

How to find out what is locking my tables?

I have a SQL table that all of a sudden cannot return data unless I include with (nolock) on the end, which indicates some kind of lock left on my table. I've experimented a bit with sys.dm_tran_lo..

LINQ to Entities does not recognize the method

I'm getting the following error when trying to do a linq query: LINQ to Entities does not recognize the method 'Boolean IsCharityMatching(System.String, System.String)' method, and this method..

How to get the excel file name / path in VBA

Say, I'm writing a VBA inside my excel file sample.xls. Now I want to get the full path of sample.xls in my VBA. How do I do it?..

How to solve Object reference not set to an instance of an object.?

In my program.I set one protected list.And i add a value in list.But it shows Object reference not set to an instance of an object error protected List<string> list; protected void Page..

How to read AppSettings values from a .json file in ASP.NET Core

I have set up my AppSettings data in file appsettings/Config .json like this: { "AppSettings": { "token": "1234" } } I have searched online on how to read AppSettings values from .jso..

Confusing "duplicate identifier" Typescript error message

Why am I getting this and many more errors of this kind? I am adding a link to the repo as well as key code snippets below. I think I have a basic misunderstanding of how the dependency and "include" ..

Passing the argument to CMAKE via command prompt

I have a makefile for my project and also I am passing some argument and based on that argument i am seting some flag. I am able to do this . but now I want to do the same using cmake. I have created ..

How to redirect the output of an application in background to /dev/null

I would like to redirect the output generated from a background application in Linux to /dev/null. I am using kate text editor and it prints all the debug messages on the terminal which I would like ..