Questions Tagged with #Intentional programming

Python "TypeError: unhashable type: 'slice'" for encoding categorical data

I am getting TypeError: unhashable type: 'slice' when executing the below code for encoding categorical data in Python. Can anyone please help? # Importing the libraries import numpy as np imp..

If statement within Where clause

I am working with a query which contains "IF" statements within a "WHERE" clause. But PL\SQL Developer is giving some errors while executing it. Can anyone please help me with the correct query? Here .. function

I was trying to find some more information on the following jQuery function: It is described to test the number of active connections to a server and will evaluate true when the numbe..

Why has it failed to load main-class manifest attribute from a JAR file?

I have created a JAR file in this way jar cf jar-file input-files. Now, I'm trying to run it. Running it does not work (jre command is not found): jre -cp app.jar MainClass This does not work eithe..

How to Get JSON Array Within JSON Object?

This is my JSON: { "data": [ { "id": 1, "Name": "Choc Cake", "Image": "1.jpg", "Category": "Meal", "Method": "", "..

CodeIgniter query: How to move a column value to another column in the same row and save the current time in the original column?

In my db table, I have two datetime columns: Last and Current. These column allow me to keep track of when someone last used a valid login to the service I am building up. Using CodeIgniter's active ..

Create a symbolic link of directory in Ubuntu

Below is my code for creating a symlink of a directory: sudo ln -s /usr/local/nginx/conf/ /etc/nginx I already created the directory /etc/nginx. I just want the contents of the source directory (/..

Xcode 7 error: "Missing iOS Distribution signing identity for ..."

I tried to upload my App to iTunes Connect resp. AppStore and got the following error: Failed to locate or generate matching signing assets Xcode attempted to locate or generate matching sign..

Why Local Users and Groups is missing in Computer Management on Windows 10 Home?

I'm using Windows 10 Home. While troubleshooting some issue with WinRM, I figured out "Local Users and Groups" item is missing in my System Tools. Computer Management >> System Tools >> "Local Users..

How do I keep track of pip-installed packages in an Anaconda (Conda) environment?

I've installed and have been using the Anaconda Python distribution, and I have started using the Anaconda (Conda) environment. I can use the standard conda install... command to put packages from the..

Unknown SSL protocol error in connection

I want to push my commits to a Bitbucket repository but this error occurred: Fatal: unable to access 'https://[email protected]/myUsername/myRepository.git/': Unknown SSL protocol error in con..

Why is the GETDATE() an invalid identifier

Why is the GETDATE() an invalid identifier says Oracle Sql Developer tool when I debug this code: CREATE OR REPLACE TRIGGER SPName AFTER UPDATE ON TableName FOR EACH ROW BEGIN UPDATE TableName S..

Numeric for loop in Django templates

How do I write a numeric for loop in a Django template? I mean something like for i = 1 to n ..

change the date format in laravel view page

I want to change the date format which is fetched from database. now I got 2016-10-01{{$user->from_date}} .I want to change the format 'd-m-y' in laravel 5.3 {{ $user->from_date->format('d/..

SQL left join vs multiple tables on FROM line?

Most SQL dialects accept both the following queries: SELECT, FROM a, b WHERE a.x = b.x SELECT, FROM a LEFT JOIN b ON a.x = b.x Now obviously when you need an outer join, th..

How to enable production mode?

I was reading related questions and I found this one, but my question is how can I switch from development to production mode. There are some differences between the modes which are pointed out here. ..

increase font size of hyperlink text html

I am working on web application where I have taken href. But the default font of it is too small when comparing to the page. So I want to increase the size of the font. My output page look like below..

invalid use of non-static member function

I have something like this: class Bar { public: pair<string,string> one; std::vector<string> cars; Bar(string one, string two, string car); }; ..

Separating class code into a header and cpp file

I am confused on how to separate implementation and declarations code of a simple class into a new header and cpp file. For example, how would I separate the code for the following class? class A2DD ..

How to correctly use Html.ActionLink with ASP.NET MVC 4 Areas

I recently discovered Areas in ASP.NET MVC 4, which I have successfully implemented, but I'm running into troubles with the @Html.ActionLink helper in my Razor views. The URL this helper generates alw..

AttributeError: 'module' object has no attribute

I have two python modules: import b def hello(): print "hello" print "" print hello() print b.hi() import a def hi(): print "hi" When I run, I get: AttributeError: 'm..

Jdbctemplate query for string: EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0

I am using Jdbctemplate to retrieve a single String value from the db. Here is my method. public String test() { String cert=null; String sql = "select ID_NMB_SRZ from codb_owner..

Why is Android Studio reporting "URI is not registered"?

So I've given Android Studio a try, because I really like Resharper and noticed that the IDE had some of their functionality built into it. Having now created a default new project, I added a new layo..

Why does CSS not support negative padding?

I have seen this many a times that the prospect of a negative padding might help the development of CSS of certain page elements become better and easier. Yet, there is no provision for a negative pad..

Fastest way to write huge data in text file Java

I have to write huge data in text[csv] file. I used BufferedWriter to write the data and it took around 40 secs to write 174 mb of data. Is this the fastest speed java can offer? bufferedWriter = new..

Post order traversal of binary tree without recursion

What is the algorithm for doing a post order traversal of a binary tree WITHOUT using recursion?..

pip install - locale.Error: unsupported locale setting

Full stacktrace: ? ~ pip install virtualenv Traceback (most recent call last): File "/usr/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/lib/python3.4/site-packages/pip/_..

What is "Linting"?

PHPLint, JSLint, and I recently came across "you can lint your JS code on the fly" while reading something about some IDE. So, what is "linting"?..

Show SOME invisible/whitespace characters in Eclipse

A long while back I transitioned to doing all my web application development in Eclipse from BBEdit. But I miss one little feature from BBEdit. I used to be able to show invisible characters like tabs..

How do I read the contents of a Node.js stream into a string variable?

I'm hacking on a Node program that uses smtp-protocol to capture SMTP emails and act on the mail data. The library provides the mail data as a stream, and I don't know how to get that into a string. ..

Pass a JavaScript function as parameter

How do I pass a function as a parameter without the function executing in the "parent" function or using eval()? (Since I've read that it's insecure.) I have this: addContact(entityId, refreshContac..

SQL Server: Is it possible to insert into two tables at the same time?

My database contains three tables called Object_Table, Data_Table and Link_Table. The link table just contains two columns, the identity of an object record and an identity of a data record. I want t..

"Missing return statement" within if / for / while

I have a question regarding return statements used within if() while() or for() statements. As you can see in the following method, it is expecting that I return a String value. The problem is that if..

How to add a Try/Catch to SQL Stored Procedure


Drawing a line/path on Google Maps

I've been busy for a long time finding out how to draw a line between two (GPS) points on the map in HelloMapView but with no luck. Could anyone please tell me how to do so. Suppose I use the HelloM..

Javascript/jQuery: Set Values (Selection) in a multiple Select

I have a multiple select: <select name='strings' id="strings" multiple style="width:100px;"> <option value="Test">Test</option> <option value="Prof">Prof</option>..

Get the Selected value from the Drop down box in PHP

I am populating a Drop Down Box using the following code. <select id="select_catalog"> <?php $array_all_catalogs = $db->get_all_catalogs(); foreach($array_all_catalogs as $array_catalog)..

How to convert a string of numbers to an array of numbers?

I have below string - var a = "1,2,3,4"; when I do - var b = a.split(','); I get b as ["1", "2", "3", "4"] can I do something to get b as [1, 2, 3, 4] ?..

How to remove all non-alpha numeric characters from a string in MySQL?

I'm working on a routine that compares strings, but for better efficiency I need to remove all characters that are not letters or numbers. I'm using multiple REPLACE functions now, but maybe there is..

ASP.NET document.getElementById('<%=Control.ClientID%>'); returns null

I'm trying to retrieve a server control in JavaScript. For testing purposes I am calling the JavaScript function from the page load event. protected void Page_Load(object sender, EventArgs e){ Cl..

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project...

How can I read inputs as numbers?

Why are x and y strings instead of ints in the below code? (Note: in Python 2.x use raw_input(). In Python 3.x use input(). raw_input() was renamed to input() in Python 3.x) play = True while play:..

Cannot make a static reference to the non-static method

Building a multi-language application in Java. Getting an error when inserting String value from R.string resource XML file: public static final String TTT = (String) getText(R.string.TTT); This i..

Javascript pass values using POST

I have a javascript function that uses to call another page and returning the result. Here is the section of my code: var windowFeatures = "status=0, toolbar=0, location=0, menubar=0, di..

How to make type="number" to positive numbers only

currently I have the following code <input type="number" /> it comes out to something like this The little selector things on the right allow the number to go into negative. How do I preve..

JavaScript global event mechanism

I would like to catch every undefined function error thrown. Is there a global error handling facility in JavaScript? The use case is catching function calls from flash that are not defined...

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.. /storage/emulated/0/New file.txt: open failed: EACCES (Permission denied)

I've been trying to encrypt files and write those files back on to the same place. But I got the error message saying " /storage/emulated/0/New file.txt: open failed: EAC..

What are ODEX files in Android?

After some android apps installed, I found that it will change to odex file (not apk) in smartphone. How does it happens? Who can teach me, I am very interested about it...

ImportError: No module named dateutil.parser

I am receiving the following error when importing pandas in a Python program monas-mbp:book mona$ sudo pip install python-dateutil Requirement already satisfied (use --upgrade to upgrade): python-dat..

JavaScript, get date of the next day

I have the following script which returns the next day: function today(i) { var today = new Date(); var dd = today.getDate()+1; var mm = today.getMonth()+1; var yy..

UITextView that expands to text using auto layout

I have a view that is laid out completely using auto layout programmatically. I have a UITextView in the middle of the view with items above and below it. Everything works fine, but I want to be able ..

Difference between sh and bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know what's the difference between them. What's main difference between bash and sh? What do we need..

Unable to copy a file from obj\Debug to bin\Debug

I have a project in C# and I get this error every time I try to compile the project: (Unable to copy file "obj\Debug\Project1.exe" to "bin\Debug\Project1.exe". The process cannot access the file '..

Create zip file and ignore directory structure

I need to create a zip file using this command: zip /dir/to/file/newZip /data/to/zip/data.txt This works, but the created zip file creates a directory structure mimicking the directory to the raw f..

How can I access getSupportFragmentManager() in a fragment?

I have a FragmentActivity and I want to use a map fragment within it. I'm having a problem getting the support fragment manager to access it. if (googleMap == null) { googleMap = ((Supp..

Concatenate columns in Apache Spark DataFrame

How do we concatenate two columns in an Apache Spark DataFrame? Is there any function in Spark SQL which we can use?..

jQuery call function after load

Need to call a filter function on some options based on a radio selected (Link here), How can I call this after the page is loaded? the radio is set from a DB call and I would like to filter the optio..

Line continue character in C#

We have a unit test with variable that contains a very long string. Question is how to write this in code, without having problems with line breaks or that the code is difficult to read. In VB there..

Dealing with nginx 400 "The plain HTTP request was sent to HTTPS port" error

I'm running a Sinatra app behind passenger/nginx. I'm trying to get it to respond to both http and https calls. The problem is, when both are defined in the server block https calls are responded to n..

Laravel where on relationship object

I'm developing a web API with Laravel 5.0 but I'm not sure about a specific query I'm trying to build. My classes are as follows: class Event extends Model { protected $table = 'events'; pu..

How to go to each directory and execute a command?

How do I write a bash script that goes through each directory inside a parent_directory and executes a command in each directory. The directory structure is as follows: parent_directory (name could b..

The transaction manager has disabled its support for remote/network transactions

I'm using SQL Server and ASP.NET. I have the following function: Using js = daoFactory.CreateJoinScope() Using tran = New Transactions.TransactionScope() '... tran.Complete() ..

Python 3: ImportError "No Module named Setuptools"

I'm having troubles with installing packages in Python 3. I have always installed packages with install. But now, when I try to install the ansicolors package I get: importerror "No Modu..

Virtual network interface in Mac OS X

I know that you can make a virtual network interface in Windows (see here), and in Linux it is also pretty easy with ip-aliases, but does something similar exist for Mac OS X? I've been looking for lo..

Changing navigation title programmatically

I have a navigation bar with a title. When I double click the text to rename it, it actually says it's a navigation item, so it might be that. I'm trying to change the text using code, like: declare..

How to convert a String to a Date using SimpleDateFormat?

I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat("mm/DD/yyyy"); System.out.println((Date)formatter1.parse("08/16/2011")); When I run this, I get this as the output..

Update Row if it Exists Else Insert Logic with Entity Framework

Does anyone have suggestions on the most efficient way to implement "update row if it exists else insert" logic using Entity Framework?..

Cursor adapter and sqlite example

Hello I am looking for sample code in which cursor adapter is used with sqlite?..

What is the difference between properties and attributes in HTML?

After the changes made in jQuery 1.6.1, I have been trying to define the difference between properties and attributes in HTML. Looking at the list on the jQuery 1.6.1 release notes (near the bottom),..

PHP check if url parameter exists

I have a URL which i pass parameters into example/success.php?id=link1 I use php to grab it $slide = ($_GET["id"]); then an if statement to display content based on parameter <?php if($s..

C++, How to determine if a Windows Process is running?

This is concerning Windows XP processes. I have a process running, let's call it Process1. Process1 creates a new process, Process2, and saves its id. Now, at some point Process1 wants Process2 to d..

How can you print a variable name in python?

Say I have a variable named choice it is equal to 2. How would I access the name of the variable? Something equivalent to In [53]: namestr(choice) Out[53]: 'choice' for use in making a dictionary. ..

SELECT INTO a table variable in T-SQL

Got a complex SELECT query, from which I would like to insert all rows into a table variable, but T-SQL doesn't allow it. Along the same lines, you cannot use a table variable with SELECT INTO or ..

How to fix corrupt HDFS FIles

How does someone fix a HDFS that's corrupt? I looked on the Apache/Hadoop website and it said its fsck command, which doesn't fix it. Hopefully someone who has run into this problem before can tell m..

How do I initialise all entries of a matrix with a specific value?

In Haskell, if I wanted to get a 10 element list which only contained the number 5, I could do something like this: take 10 $ repeat 5 Output: [5,5,5,5,5,5,5,5,5,5] Is there anything like this i..

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

I have a situation very much like the one at ImportError: DLL load failed: %1 is not a valid Win32 application, but the answer there isn't working for me. My Python code says: import cv2 But that ..

Delete all local git branches

I follow a development process where I create a new local branch for every new feature or story card. When finished I merge the branch into master and then push. What tends to happen over time due t..

How do I avoid the specification of the username and password at every git push?

I git push my work to a remote Git repository. Every push will prompt me to input username and password. I would like to avoid it for every push, but how to configure to avoid it?..

Freely convert between List<T> and IEnumerable<T>

How can I convert a List<MyObject> to an IEnumerable<MyObject> and then back again? I want to do this in order to run a series of LINQ statements on the List, e. g. Sort()..

Getting Error - ORA-01858: a non-numeric character was found where a numeric was expected

I am getting the error in the below sql: ORA-01858: a non-numeric character was found where a numeric was expected SELECT c.contract_num, CASE WHEN ( MAX (TO_CHAR (TO_D..

How can I do time/hours arithmetic in Google Spreadsheet?

How do I do time/hour arithmetic in a Google spreadsheet? I have a value that is time (e.g., 36:00:00) and I want to divide it by another time (e.g., 3:00:00) and get 12. If I divide just one by the..

Convert AM/PM time to 24 hours format?

I need to convert 12 hours format time (am/pm) to 24 hours format time, e.g. 01:00 PM to 13:00 using C#. How can I convert it?..

How to explain callbacks in plain english? How are they different from calling one function from another function?

How to explain callbacks in plain English? How are they different from calling one function from another function taking some context from the calling function? How can their power be explained to a n..

Subtracting Dates in Oracle - Number or Interval Datatype?

I have a question about some of the internal workings for the Oracle DATE and INTERVAL datatypes. According to the Oracle 11.2 SQL Reference, when you subtract 2 DATE datatypes, the result will be a N..

What is unit testing and how do you do it?

Exact duplicate of many posts: What is unit testing? What Makes a Good Unit Test? New to Unit Testing Unit Testing - definitions Learning Unit Testing How to properly mock and unit test Unit Te..

How to get the location of the DLL currently executing?

I have a config file that I need to load as part of the execution of a dll I am writing. The problem I am having is that the place I put the dll and config file is not the "current location" when the..

How do I tell Gradle to use specific JDK version?

I can't figure out to get this working. Scenario: I have an application built with gradle The application uses JavaFX What I want Use a variable (defined per developer machine) which points to ..

How to Convert unsigned char* to std::string in C++?

I have unsigned char*, want to convert it to std::string. Can you please tell me the safest way to do this?..

Convert pandas.Series from dtype object to float, and errors to nans

Consider the following situation: In [2]: a = pd.Series([1,2,3,4,'.']) In [3]: a Out[3]: 0 1 1 2 2 3 3 4 4 . dtype: object In [8]: a.astype('float64', raise_on_error = False) Out[8]..

strange error in my Animation Drawable

A strange error when trying to start Activity. i think the error in my Animation Drawable LogCat: 12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main 12-31 06:37:45.138: E/Andr..

How do I query between two dates using MySQL?

The following query: SELECT * FROM `objects` WHERE (date_field BETWEEN '2010-09-29 10:15:55' AND '2010-01-30 14:15:55') returns nothing. I should have more than enough data to for the query to wo..

Repeat a task with a time delay?

I have a variable in my code say it is "status". I want to display some text in the application depending on this variable value. This has to be done with a specific time delay. It's like, Check ..

Visual Studio SignTool.exe Not Found

I have completed an application I have made in Visual Studio 14.0, but when I tried to publish the program, I get an error as Visual Studio cannot find 'SignTool.exe'. I have searched my Hard drive a..

How to prevent page from reloading after form submit - JQuery

I am working on a website for my app development class and I have the weirdest issue. I am using a bit of JQuery to send form data to a php page called 'process.php, and then upload it to my DB. The..

PHP/regex: How to get the string value of HTML tag?

I need help on regex or preg_match because I am not that experienced yet with regards to those so here is my problem. I need to get the value "get me" but I think my function has an error. The number..

How to input matrix (2D list) in Python?

I tried to create this code to input an m by n matrix. I intended to input [[1,2,3],[4,5,6]] but the code yields [[4,5,6],[4,5,6]. Same things happen when I input other m by n matrix, the code yields ..

How to output an Excel *.xls file from classic ASP

I have a number of generated html tables that I need to output as an Excel file. The site is codded in classic ASP. Is this possible? Could it be done by somehow using the Open Office libraries? ED..

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 convert list to string

How can I convert a list to a string using Python?..

Update Query with INNER JOIN between tables in 2 different databases on 1 server

Need some SQL syntax help :-) Both databases are on the same server db1 = DHE db2 = DHE_Import UPDATE DHE.dbo.tblAccounts INNER JOIN DHE_Import.dbo.tblSalesRepsAccountsLink ON DHE.dbo.tblAcco..

Make just one slide different size in Powerpoint

Making a powerpoint that's supposed to show a before and after of a website. Since it's currently a long website I'd rather make a single long slide to put it on (20" instead of 7.5"). But all the o..

Outlets cannot be connected to repeating content iOS

I have just created an app and have started hooking up @IBOutlet's to the storyboard. I am connecting some of them to labels in a UITableViewCell Prototype Cell with a Basic Style. When I connect it t..

How to pass multiple parameters in json format to a web service using jquery?

I'm trying to execute a webservice using jquery. When I pass only one input parameter it works fine: $.ajax({ type: "POST", url: url, data: "{'Id1':'2'}", contentType..

How do I check whether a file exists without exceptions?

How do I check if a file exists or not, without using the try statement?..

Showing Difference between two datetime values in hours

I am retrieving two date time values from the database. Once the value is retrieved, I need the difference between the two values. For that, I create a timespan variable to store the difference of the..

Font Awesome icon inside text input element

I am trying to insert a user icon inside username input field. I've tried one of the solution from the similar question knowing that background-image property won't work since Font Awesome is a fon..

jQuery Set Select Index

I have an select box: <select id="selectBox"> <option value="0">Number 0</option> <option value="1">Number 1</option> <option value="2">Number 2</opt..

How to edit the size of the submit button on a form?

Hi I don't want an image for my submit button so I have gone with the default submit button but I want to edit its width and height. How do I do that? <input type="submit" id="search" value="Searc..

How to open a web page automatically in full screen mode

How do I open a web page automatically in full screen mode? I am looking for a solution to open an web page automatically in full screen mode, without expecting user to users press F11 or any other b..

Migrating from VMWARE to VirtualBox

I'm trying to migrate an existing VM from VMWARE to VirtualBox. I've made a copy of the Virtual Machine folder for the VM (so I can experiment and not destroy the original) and have successfully creat..

Opening a SQL Server .bak file (Not restoring!)

I have been reading a LOT of google posts and StackOverflow questions about how to restore a database in SQL Server from a .bak file. But none of them states how to just READ the tables in the databa..

How to make a ssh connection with python?

Can anyone recommend something for making a ssh connection in python? I need it to be compatible with any OS. I've already tried pyssh only to get an error with SIGCHLD, which I've read is because W..

How do I select an element with its name attribute in jQuery?

How to get an element with its name attribute with jQuery? Is there anything (like # for id and . for class) for name in jQuery?..

Why is enum class preferred over plain enum?

I heard a few people recommending to use enum classes in C++ because of their type safety. But what does that really mean?..

How do I declare an array of undefined or no initial size?

I know it could be done using malloc, but I do not know how to use it yet. For example, I wanted the user to input several numbers using an infinite loop with a sentinel to put a stop into it (i.e. -1..

Difference between SelectedItem, SelectedValue and SelectedValuePath

What is the difference betweeen the following: SelectedItem SelectedValue SelectedValuePath All these dependency properties are defined in Selector class. I often confuse SelectedItem with Selecte..

Rounding integer division (instead of truncating)

I was curious to know how I can round a number to the nearest whole number. For instance, if I had: int a = 59 / 4; which would be 14.75 if calculated in floating point; how can I store the result ..

Read url to string in few lines of java code

I'm trying to find Java's equivalent to Groovy's: String content = "".toURL().getText(); I want to read content from a URL into string. I don't want to pollute my code with bu..

How to set -source 1.7 in Android Studio and Gradle

I'm getting following error when trying to compile my project in Android Studio: Gradle: error: diamond operator is not supported in -source 1.6 I have 1.7 set as target in all project preferences ..

what is difference between success and .done() method of $.ajax

Can anyone help me? I am not able to understand the difference between success and .done() of $.ajax. If possible please give examples...

Printing all global variables/local variables?

How can I print all global variables/local variables? Is that possible in gdb?..

JQuery - Get select value

I'm trying to get the selected value from a drop down list via jQuery. I have a bit of javascript that validates a form when I click SEND, to make sure there are no blanks, code is as follows: functi..

String parsing in Java with delimiter tab "\t" using split

I'm processing a string which is tab delimited. I'm accomplishing this using the split function, and it works in most situations. The problem occurs when a field is missing, so instead of getting nul..

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 can I parse a local JSON file from assets folder into a ListView?

I'm currently developing a physics app that is supposed to show a list of formulas and even solve some of them (the only problem is the ListView) This is my main layout <LinearLayout xmlns:an..

Gson: Directly convert String to JsonObject (no POJO)

Can't seem to figure this out. I'm attempting JSON tree manipulation in GSON, but I have a case where I do not know or have a POJO to convert a string into, prior to converting to JsonObject. Is there..

How to return multiple rows from the stored procedure? (Oracle PL/SQL)

I want to create a stored procedure with one argument which will return different sets of records depending on the argument. What is the way to do this? Can I call it from plain SQL?..

How can I create keystore from an existing certificate (abc.crt) and abc.key files?

I am trying to import a certificate and a key file into the keystore but I'm unable to do that. How can I create a keystore by importing both an existing certificate (abc.crt) and abc.key files?..

Uncaught ReferenceError: <function> is not defined at HTMLButtonElement.onclick

I have created my problem on JSFiddle at The code is as follows HTML CODE <div class="loading">Loading&#8230;</div> <button type="submit" onCli..

Node.js project naming conventions for files & folders

What are the naming conventions for files and folders in a large Node.js project? Should I capitalize, camelCase, or under-score? Ie. is this considered valid? project-name app controll..

jQuery callback on image load (even when the image is cached)

I want to do: $("img").bind('load', function() { // do stuff }); But the load event doesn't fire when the image is loaded from cache. The jQuery docs suggest a plugin to fix this, but it doesn't ..

No matching bean of type ... found for dependency

after some days of trying and waitin' for answers on the springsource forums I'll try it here. Running my application results in these exception: org.springframework.beans.factory.NoSuchBeanDefinitio..

How do I import modules or install extensions in PostgreSQL 9.1+?

Firstly, if you're not using 9.1+, please refer to this question. How do I install an extension to PostgreSQL 9.1?..

Bash script prints "Command Not Found" on empty lines

Every time I run a script using bash from the command line in Debian, I get Command Not found and then the result of the script. The script works but there is always a Command Not Found..

How do I change the title of the "back" button on a Navigation Bar

Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the te..

UIAlertView first deprecated IOS 9

I have tried several ways to use UIAlertController,instead of UIAlertView. I tried several ways but I cannot make the alert action work. Here is my code that works fine in IOS 8 and IOS 9 but is showi..

Remote Linux server to remote linux server dir copy. How?

What is the best way to copy a directory (with sub-dirs and files) from one remote Linux server to another remote Linux server? I have connected to both using SSH client (like Putty). I have root acce..

Importing project into Netbeans

My client just sent me the base project for development purposes. I think he just zipped the project folder and sent to me. Now when I go to NetBeans, "New project with existing sources": First I see..

Check whether an array is empty

I have the following code <?php $error = array(); $error['something'] = false; $error['somethingelse'] = false; if (!empty($error)) { echo 'Error'; } else { echo 'No errors'; } ?> ..

Go back button in a page

Possible Duplicate: Go Back to Previous Page get back to previous page How to get the previous page in javascript coding. Go to the previous page when click that back button...

Does a favicon have to be 32x32 or 16x16?

I'd like to use a single image as both a regular favicon and iPhone/iPad friendly favicon. Is this possible? Would an iPad-friendly 72x72 PNG scale if linked to as a regular browser favicon? Or do I..

How to read numbers separated by space using scanf

I want to read numbers(integer type) separated by spaces using scanf() function. I have read the following: C, reading multiple numbers from single input line (scanf?) how to read scanf with spaces ..

Can't install nuget package because of "Failed to initialize the PowerShell host"

All of a sudden, I am getting this error when upgrading Nuget packages. None of the fixes that I have come across work. I am using Visual Studio 2013. 'Newtonsoft.Json 6.0.3' already installed. ..

Python copy files to a new directory and rename if file name already exists

I've already read this thread but when I implement it into my code it only works for a few iterations. I'm using python to iterate through a directory (lets call it move directory) to copy mainly pd..

"Please try running this command again as Root/Administrator" error when trying to install LESS

I'm trying to install LESS on my machine and have installed node already. However, when I enter "node install -g less" I get the following error and am not sure what to do? FPaulMAC:bin paul$ npm ins..

WPF Databinding: How do I access the "parent" data context?

I have a list (see below) contained in a window. The window's DataContext has two properties, Items and AllowItemCommand. How do I get the binding for the Hyperlink's Command property needs to resolv..

Entity Framework - Generating Classes

I have an existing database. I was hoping there was a way to generate class files from this database. However, I seem to see a lot of generating the database from the class files. Is there a way to g..

How to correctly save instance state of Fragments in back stack?

I have found many instances of a similar question on SO but no answer unfortunately meets my requirements. I have different layouts for portrait and landscape and I am using back stack, which both pr..

How can I use a batch file to write to a text file?

I need to make a script that can write one line of text to a text file in the same directory as the batch file...

How to reload or re-render the entire page using AngularJS

After rendering the entire page based on several user contexts and having made several $http requests, I want the user to be able to switch contexts and re-render everything again (resending all $http..

Plain Old CLR Object vs Data Transfer Object

POCO = Plain Old CLR (or better: Class) Object DTO = Data Transfer Object In this post there is a difference, but frankly most of the blogs I read describe POCO in the way DTO is defined: DTOs are s..

Unable to open project... cannot be opened because the project file cannot be parsed

I have been working for a while to create an iPhone app. Today when my battery was low, I was working and constantly saving my source files then the power went out... Now when I plugged my computer b..

How to Display blob (.pdf) in an AngularJS app

I have been trying to display pdf file which I am getting as a blob from a $ response. The pdf must be displayed within the app using <embed src> for example. I came across a couple of..

how to get file path from sd card in android

hi all i have mp3 files in sd card. how to get file path of mp3 song from sd card. please assist me...

How to get the top position of an element?

Is it possible to get the top position of an element using javascript/jquery ? The element is a table, if that matters...

How to Display Selected Item in Bootstrap Button Dropdown Title

I am using the bootstrap Dropdown component in my application like this: <div class="btn-group"> <button class="btn">Please Select From List</button> <button class="btn d..

Image resizing in React Native

I am trying to resize an image (smaller to fit screen) in my react native app but am unable to do it as it is too big. Here is the code: 'use strict'; var React = require('react-native'); var { S..

C#: List All Classes in Assembly

I'd like to output (programmatically - C#) a list of all classes in my assembly. Any hints or sample code how to do this? Reflection?..

how does Request.QueryString work?

I have a code example like this : location.href = location.href + "/Edit?pID=" + hTable.getObj().ID; ; //aspx parID = Request.QueryString["pID"]; //c# it works, my question is - how ? what i..

The thread has exited with code 0 (0x0) with no unhandled exception

While debugging my C# application I have noticed a large amount occurrences of the following sentence: The thread -- has exited with code 0 (0x0). The application continues to work and no except..

mysql count group by having

I have this table: Movies (ID, Genre) A movie can have multiple genres, so an ID is not specific to a genre, it is a many to many relationship. I want a query to find the total number of movies whi..

Use of ~ (tilde) in R programming Language

I saw in a tutorial about regression modeling the following command: myFormula <- Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width What exactly does this command do, and what is t..

How to send FormData objects with Ajax-requests in jQuery?

The XMLHttpRequest Level 2 standard (still a working draft) defines the FormData interface. This interface enables appending File objects to XHR-requests (Ajax-requests). Btw, this is a new feature -..

Android Studio doesn't see device

The AVD Manager in Android Studio doesn't show my device but adb devices does show it. Am I missing something obvious here?..

Using reCAPTCHA on localhost

I'm developing a website using PHP and I want to make a human verification in one of the sessions. For the development, I'm initially running the system locally and when it is ready, I'm gonna make pu..

TSQL - Cast string to integer or return default value

Is there a way in T-SQL to cast an nvarchar to int and return a default value or NULL if the conversion fails?..

How to write some data to excel file(.xlsx)

This is what i am trying to do. 1.Create excel file(.xlsx) c://test/files/work1_4.13.14.xlsx with name + value(date) example: work1_4.13.14.xlsx 2.Set headers to the file example: [Name] [Age] [Ci..

Recyclerview inside ScrollView not scrolling smoothly

For my app I am using a RecyclerView inside a ScrollView where the RecyclerView has a height based on its content using this library. Scrolling is working but it's not working smoothly when I scroll o..

How to make a Qt Widget grow with the window size?

I want to have a small QFormLayout that grows to fill its parent widget. I created a new .ui file using the QWidget template in Qt Designer. I put a QFormLayout inside that 'window', then put some co..

How to write console output to a txt file

I have tried to write the console output to a txt file using this code suggestion ( however I was not successful. What's wrong? try { //create a ..

CSS Transition doesn't work with top, bottom, left, right

I have an element with style position: relative; transition: all 2s ease 0s; Then I want to change its position smoothly after clicking on it, but when I add the style change the transition doesn't t..

Submit HTML form on self page

I want an HTML form to submit to itself. How do I use the action attribute? <form action=""> <form action="#"> <form action="some/address"> <form> Which was is preferable?..

Using Razor within JavaScript

Is it possible or is there a workaround to use Razor syntax within JavaScript that is in a view (cshtml)? I am trying to add markers to a Google map... For example, I tried this, but I'm getting a to..

Can I create a One-Time-Use Function in a Script or Stored Procedure?

In SQL Server 2005, is there a concept of a one-time-use, or local function declared inside of a SQL script or Stored Procedure? I'd like to abstract away some complexity in a script I'm writing, but ..

Parsing JSON in Java without knowing JSON format

I am trying to parse JSON strings in Java and find the key-value pairs so that I can determine the approximate structure of the JSON object since object structure of JSON string is unknown. For examp..

Get element inside element by class and ID - JavaScript

Alright, I've dabbled in JavaScript before, but the most useful thing I've written is a CSS style-switcher. So I'm somewhat new to this. Let's say I have HTML code like this: <div id="foo"..

How to restart kubernetes nodes?

The status of nodes is reported as unknown "conditions": [ { "type": "Ready", "status": "Unknown", "lastHeartbeatTime": "2015-11-12T06:03:19Z", ..

glm rotate usage in Opengl

I am rendering a cone, and I would like to rotate it, 90 degrees anti-clockwise, so that the pointy end faces west! I am using OpenGL 3+. Here is my code in my Cone.cpp so far: //PROJECTION glm:..

How to remove all numbers from string?

I'd like to remove all numbers from a string [0-9]. I wrote this code that is working: $words = preg_replace('/0/', '', $words ); // remove numbers $words = preg_replace('/1/', '', $words ); // remov..

How to delete a row from GridView?

I am using GridView control in 2005 c# using . How can I delete a particular row from GridView. I have written the following code. But it's not working... DataRow dr = dtPrf_Mstr.NewRow(); ..

Get domain name

My computer is in a Domain (Active Directory) and I need to get the domain name dynamically. I found the following code on the internet: SelectQuery query = new SelectQuery("Win32_ComputerSystem"); u..

How to check ASP.NET Version loaded on a system?

How can I check the version of ASP.NET that is installed on my system?..

Add CSS box shadow around the whole DIV

Is it possible to have the shadow surround the entire DIV? -moz-box-shadow: 3px 3px 3px #ccc; -webkit-box-shadow: 3px 3px 3px #ccc; box-shadow: 3px 3px 3px #ccc; I know the order of attributes goes..

Laravel Eloquent ORM Transactions

The Eloquent ORM is quite nice, though I'm wondering if there is an easy way to setup MySQL transactions using innoDB in the same fashion as PDO, or if I would have to extend the ORM to make this poss..

How to download a branch with git?

I have a project hosted on GitHub. I created a branch on one computer, then pushed my changes to GitHub with: git push origin branch-name Now I am on a different computer, and I want to download t..

How to have Android Service communicate with Activity

I'm writing my first Android application and trying to get my head around communication between services and activities. I have a Service that will run in the background and do some gps and time based..

Multiple Errors Installing Visual Studio 2015 Community Edition

When installing Visual Studio 2015 Community Edition on Windows 10, using the web installer, everything runs fine, however, the following packages fail to install: Team Explorer for Visual Studio 20..

PHP: How can I determine if a variable has a value that is between two distinct constant values?

How can I determine using PHP code that, for example, I have a variable that has a value between 1 and 10, or between 20 and 40? ..

Is it possible to open developer tools console in Chrome on Android phone?

An AngularJS application works fine on desktop, but is not rendering properly on mobile (actual code is showing). This is on an Android phone. I would like to see what errors are showing in the conso..

Fancybox doesn't work with jQuery v1.9.0 [ f.browser is undefined / Cannot read property 'msie' ]

Fancybox breaks with the new jQuery v1.9.0. It affects both, Fancybox v1.3.4 and below - and - v2.1.3 and below. The errors shown are : v1.3.4 : Timestamp: 15/01/2013 10:03:28 AM Error: TypeError:..

javascript /jQuery - For Loop

I have a query ajax response which I then use to set the array variables. Is there anyway to use a 'For Loop' to change to #name so that I don't have to write out a line of code to set each array elem..

How to use the curl command in PowerShell?

Am using the curl command in PowerShell to post the comment in bit-bucket pull request page through a Jenkins job. I used the below PowerShell command to execute the curl command, but am getting the e..

Extract a substring using PowerShell

How can I extract a substring using PowerShell? I have this string ... "-----start-------Hello World------end-------" I have to extract ... Hello World What is the best way to do that?..

Java SimpleDateFormat for time zone with a colon separator?

I have a date in the following format: 2010-03-01T00:00:00-08:00 I have thrown the following SimpleDateFormats at it to parse it: private static final SimpleDateFormat[] FORMATS = { new Simp..

Correct way to push into state array

I seem to be having issues pushing data into a state array. I am trying to achieve it this way: this.setState({ myArray: this.state.myArray.push('new value') }) But I believe this is incorrect way ..

Good Patterns For VBA Error Handling

What are some good patterns for error handling in VBA? In particular, what should I do in this situation: ... some code ... ... some code where an error might occur ... ... some code ... ... some ot..

C# : Converting Base Class to Child Class

I have a class, NetworkClient as a base class : using System.IO; using System.Net.Sockets; using System.Threading.Tasks; namespace Network { using System; using System.Collections.Generic; using Sys..

Changing the Git remote 'push to' default

I want to change the Git default remote branch destination so I could just git push Instead of: git push upstream Currently this is set to the origin remote and I want to set it to a different r..

Pass entire form as data in jQuery Ajax function

I have a jQuery ajax function and would like to submit an entire form as post data. We are constantly updating the form so it becomes tedious to constantly update the form inputs that should be sent i..