Questions Tagged with #Inner classes

In object-oriented programming (OOP), an inner class or nested class is a class declared entirely within the body of another class or interface. However in Java, an inner class is a non-static nested class.

Java - No enclosing instance of type Foo is accessible

I have the following code: class Hello { class Thing { public int size; Thing() { size = 0; } } public static void main(String[] args) { Thin..

Why Would I Ever Need to Use C# Nested Classes

I'm trying to understand about nested classes in C#. I understand that a nested class is a class that is defined within another class, what I don't get is why I would ever need to do this...

Java inner class and static nested class

What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?..

Difference between final and effectively final

I'm playing with lambdas in Java 8 and I came across warning local variables referenced from a lambda expression must be final or effectively final. I know that when I use variables inside anonymous c..

Nested classes' scope?

I'm trying to understand scope in nested classes in Python. Here is my example code: class OuterClass: outer_var = 1 class InnerClass: inner_var = outer_var The creation of class do..

Getting hold of the outer class object from the inner class object

I have the following code. I want to get hold of the outer class object using which I created the inner class object inner. How can I do it? public class OuterClass { public class InnerClass { ..

Can we create an instance of an interface in Java?

Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: interface Test { public void wish(); } class Main..

Why would one use nested classes in C++?

Can someone please point me towards some nice resources for understanding and using nested classes? I have some material like Programming Principles and things like this IBM Knowledge Center - Nested ..

Nested or Inner Class in PHP

I'm building a User Class for my new website, however this time I was thinking to build it little bit differently... C++, Java and even Ruby (and probably other programming languages) are allowing th..

Is not an enclosing class Java

I'm trying to make a Tetris game and I'm getting the compiler error Shape is not an enclosing class when I try to create an object public class Test { public static void main(String[] args..

Java: Static vs inner class

What is the difference between static and non-static nested class?..

Can inner classes access private variables?

class Outer { class Inner { public: Inner() {} void func() ; }; private: static const char* const MYCONST; int var; }; void Outer::Inner::func() { var = 1; }..

PHP check file extension

I have an upload script that I need to check the file extension, then run separate functions based on that file extension. Does anybody know what code I should use? if (FILE EXTENSION == ???) { FUNC..

An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON SQL Server

I'm trying to do this query INSERT INTO dbo.tbl_A_archive SELECT * FROM SERVER0031.DB.dbo.tbl_A but even after I ran set identity_insert dbo.tbl_A_archive on I am getting this error message..

SELECT only rows that contain only alphanumeric characters in MySQL

I'm trying to select all rows that contain only alphanumeric characters in MySQL using: SELECT * FROM table WHERE column REGEXP '[A-Za-z0-9]'; However, it's returning all rows, regardless of the fa..

Checkout multiple git repos into same Jenkins workspace

Using Jenkins 1.501 and Jenkins Git plugin 1.1.26 I have 3 different git repos each with multiple projects. Now I need to checkout all projects from the 3 git repos into the same workspace on a Jenk..

How to delete row in gridview using rowdeleting event?

This is my .cs code : protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Gridview1.DeleteRow(e.RowIndex); Gridview1.DataBind(); } and this is markup, <asp:gridvi..

Import a module from a relative path

How do I import a Python module given its relative path? For example, if dirFoo contains Foo.py and dirBar, and dirBar contains Bar.py, how do I import Bar.py into Foo.py? Here's a visual representa..

[Ljava.lang.Object; cannot be cast to

I want to get value from the database, in my case I use List to get the value from the database but I got this error Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cann..

SQLite select where empty?

In SQLite, how can I select records where some_column is empty? Empty counts as both NULL and ""...

Trim to remove white space

jQuery trim not working. I wrote the following command to remove white space. Whats wrong in it? var str = $('input').val(); str = jquery.trim(str); console.log(str); Fiddle example...

Onclick event to remove default value in a text input field

I have an input field: <input name="Name" value="Enter Your Name"> How would I get it to remove the pre-defined text (Enter Your Name) when the user clicks the box. As far as I am aware Java..

Parsing JSON from XmlHttpRequest.responseJSON

I'm trying to parse a bit.ly JSON response in javascript. I get the JSON via XmlHttpRequest. var req = new XMLHttpRequest; req.overrideMimeType("application/json"); req.open('GET', BITLY_CREATE_..

round() for float in C++

I need a simple floating point rounding function, thus: double round(double); round(0.1) = 0 round(-0.1) = 0 round(-0.9) = -1 I can find ceil() and floor() in the math.h - but not round(). Is it..

Bootstrap 3 Glyphicons are not working

I downloaded bootstrap 3.0 and can't get the glyphicons to work. I get some kind of "E003" error. Any ideas why this is happening? I tried both locally and online and I still get the same problem...

Showing an image from an array of images - Javascript

I have a large image which is shown on my homepage, and when the user clicks the "next_img" button the large image on the homepage should change to the next image in the array. However, the next arr..

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

How do I remove the first characters of a specific column in a table?

In SQL, how can I remove the first 4 characters of values of a specific column in a table? Column name is Student Code and an example value is ABCD123Stu1231. I want to remove first 4 chars from my t..

wget/curl large file from google drive

I'm trying to download a file from google drive in a script, and I'm having a little trouble doing so. The files I'm trying to download are here. I've looked online extensively and I finally managed ..

Get bytes from std::string in C++

I'm working in a C++ unmanaged project. I need to know how can I take a string like this "some data to encrypt" and get a byte[] array which I'm gonna use as the source for Encrypt. In C# I do fo..

JSON find in JavaScript

Is there a better way other than looping to find data in JSON? It's for edit and delete. for(var k in objJsonResp) { if (objJsonResp[k].txtId == id) { if (action == 'delete') { objJsonRes..

passing object by reference in C++

The usual way to pass a variable by reference in C++(also C) is as follows: void _someFunction(dataType *name){ // dataType e.g int,char,float etc. /**** definition */ } int main(){ dataType v; ..

window.location.href and window.open () methods in JavaScript

What is the difference between window.location.href and window.open () methods in JavaScript?..

What does "#pragma comment" mean?

What does #pragma comment mean in the following? #pragma comment(lib, "kernel32") #pragma comment(lib, "user32") ..

msvcr110.dll is missing from computer error while installing PHP

I am trying to install PHP(5.5). I extracted the zip file in C:\php folder. And I also set the 'Path' system variable to C:\php. But when I open command prompt and type php I get error saying: The..

Index was out of range. Must be non-negative and less than the size of the collection parameter name:index

I'm trying to add data as one by one row to a datagridview here is my code and it says: "Index was out of range. Must be non-negative and less than the size of the collection parameter name:inde..

Git removing upstream from local repository

I am working with a ruby on rails application and I am trying to sync a fork. It is worth mentioning that I am also on a Mac. I committed the following action: $ git remote -v to get a view of my l..

get data from mysql database to use in javascript

I have a javascript that dynamically builds an html page. In the html page there are textarea boxes for the user to type information in. The information already exists in a database. I would like t..

groovy: safely find a key in a map and return its value

I want to find a specific key in a given map. If the key is found, I then want to get the value of that key from the map. This is what I managed so far: def mymap = [name:"Gromit", likes:"cheese", i..

Capturing console output from a .NET application (C#)

How do I invoke a console application from my .NET application and capture all the output generated in the console? (Remember, I don't want to save the information first in a file and then relist as..

Pretty Printing JSON with React

I'm using ReactJS and part of my app requires pretty printed JSON. I get some JSON like: { "foo": 1, "bar": 2 }, and if I run that through JSON.stringify(obj, null, 4) in the browser console, it pr..

Using sendmail from bash script for multiple recipients

I'm running a bash script in cron to send mail to multiple recipients when a certain condition is met. I've coded the variables like this: subject="Subject" from="[email protected]" recipients="user1..

Updating state on props change in React Form

I am having trouble with a React form and managing the state properly. I have a time input field in a form (in a modal). The initial value is set as a state variable in getInitialState, and is passed ..

Javascript code for showing yesterday's date and todays date

How to show yesterday's date in my textbox the yesterday's date and at the same time, the today's date in ? I have this home.php where I show the date yesterday(user cannot modify this-readonly) and..

C++ Compare char array with string

I'm trying to compare a character array against a string like so: const char *var1 = " "; var1 = getenv("myEnvVar"); if(var1 == "dev") { // do stuff } This if statement never validates as true...

Let JSON object accept bytes or let urlopen output strings

With Python 3 I am requesting a json document from a URL. response = urllib.request.urlopen(request) The response object is a file-like object with read and readline methods. Normally a JSON object..

How to exclude *AutoConfiguration classes in Spring Boot JUnit tests?

I tried: @RunWith(SpringJUnit4ClassRunner.class) @EnableAutoConfiguration(exclude=CrshAutoConfiguration.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration public..

Change string color with NSAttributedString?

I have a slider for a survey that display the following strings based on the value of the slider: "Very Bad, Bad, Okay, Good, Very Good". Here is the code for the slider: - (IBAction) sliderValueC..


Angular.js directive dynamic templateURL

I have a custom tag in a routeProvider template that that calls for a directive template. The version attribute will be populated by the scope which then calls for the right template. <hymn ver="b..

Find the maximum value in a list of tuples in Python

Possible Duplicate: Sorting or Finding Max Value by the second element in a nested list. Python I have a list with ~10^6 tuples in it like this: [(101, 153), (255, 827), (361, 961), ...] ..

No connection could be made because the target machine actively refused it (PHP / WAMP)

Note: I realise this could be seen as a duplicate but i have looked at the other responses and they didn't fix the problem for me. I have recently installed Zend Studio and Zend Server with the mys..

How to add 'libs' folder in Android Studio?

I need help in creating the 'libs' folder in Android Studio for my project (It is not auto-generated in my project). When I want to create a folder, it gives me lots of options, like AIDL, Assets, JN..

Why do people say that Ruby is slow?

I like Ruby on Rails and I use it for all my web development projects. A few years ago there was a lot of talk about Rails being a memory hog and about how it didn't scale very well but these suggest..

In Postgresql, force unique on combination of two columns

I would like to set up a table in PostgreSQL such that two columns together must be unique. There can be multiple values of either value, so long as there are not two that share both. For instance: ..

Typescript: React event types

What is the correct type for React events. Initially I just used any for the sake of simplicity. Now, I am trying to clean things up and avoid use of any completely. So in a simple form like this: e..

How do I find an element that contains specific text in Selenium WebDriver (Python)?

I'm trying to test a complicated JavaScript interface with Selenium (using the Python interface, and across multiple browsers). I have a number of buttons of the form: <div>My Button</div>..

Postgresql - unable to drop database because of some auto connections to DB

Whenever I try to drop database I get: ERROR: database "pilot" is being accessed by other users DETAIL: There is 1 other session using the database. When I use: SELECT pg_terminate_backend(pg_st..

Error fetching http headers in SoapClient

I'm trying to invoke a WS over https on a remote host:remote port and I get: Error fetching http headers using the PHP5 SoapClient; I can get the list of functions by doing $client->__getFunc..

How to connect to LocalDB in Visual Studio Server Explorer?

I can't believe I couldn't find a working solution to this after an hour of searching. I'm following this article on Entity Framework 6.0 which gives a simple walk-through on Code First. I created the..

Your project path contains non-ASCII characters android studio

I was installing android studio, but I have this problem when the program is starting: Error:(1, 0) Your project path contains non-ASCII characters. This will most likely cause the build to fail..

Maven Java EE Configuration Marker with Java Server Faces 1.2

I'm having a weird configuration problem with Maven in Eclipse. Although I can build the project and deploy it to tomcat without any errors, The Marker tab keeps showing the following message: [-] Ma..

AttributeError: 'numpy.ndarray' object has no attribute 'append'

I am trying to run the code presented on the second page: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-..

How to send JSON instead of a query string with $.ajax?

Can someone explain in an easy way how to make jQuery send actual JSON instead of a query string? $.ajax({ url : url, dataType : 'json', // I was pretty sure this would do the trick ..

Where do I put image files, css, js, etc. in Codeigniter?

Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I have to specify the path i..

Sql Server : How to use an aggregate function like MAX in a WHERE clause

I want get the maximum value for this record. Please help me: SELECT rest.field1 FROM mastertable AS m INNER JOIN ( SELECT t1.field1 field1, t2.field2 FR..

Return from lambda forEach() in java

I am trying to change some for-each loops to lambda forEach()-methods to discover the possibilities of lambda expressions. The following seems to be possible: ArrayList<Player> playersOfTeam = ..

PHP Notice: Undefined offset: 1 with array when reading data

I am getting this PHP error: PHP Notice: Undefined offset: 1 Here is the PHP code that throws it: $file_handle = fopen($path."/Summary/data.txt","r"); //open text file $data = array(); // create ..

How to loop through key/value object in Javascript?

var user = {}; now I want to create a setUsers() method that takes a key/value pair object and initializes the user variable. setUsers = function(data) { // loop and init user } where..

launch sms application with an intent

I have a question about an intent... I try to launch the sms app... Intent intent = new Intent(Intent.ACTION_MAIN); intent.setType("vnd.android-dir/mms-sms"); int flags = Intent.FLAG_ACTIVITY_NEW_TAS..

python encoding utf-8

I am doing some scripts in python. I create a string that I save in a file. This string got lot of data, coming from the arborescence and filenames of a directory. According to convmv, all my arboresc..

How do I enable Java in Microsoft Edge web browser?

My corporate web application is using Java applet to access users file system. There is no way for us to replace it with anything else for now. How do I enable Java in Microsoft Edge?..

Select mysql query between date?

How to select data from mysql table past date to current date? For example, Select data from 1 january 2009 until current date ?? My column "datetime" is in datetime date type. Please help, thanks E..

How to parse XML to R data frame

I tried to parse XML to R data frame, this link helped me a lot: how to create an R data frame from a xml file But still I was not able to figure out my problem: Here is my code: data <- xmlPar..

Array vs ArrayList in performance

Which one is better in performance between Array of type Object and ArrayList of type Object? Assume we have a Array of Animal objects : Animal animal[] and a arraylist : ArrayList list<Animal&g..

How to filter a RecyclerView with a SearchView

I am trying to implement the SearchView from the support library. I want the user to be to use the SearchView to filter a List of movies in a RecyclerView. I have followed a few tutorials so far and ..

Calculating Covariance with Python and Numpy

I am trying to figure out how to calculate covariance with the Python Numpy function cov. When I pass it two one-dimentional arrays, I get back a 2x2 matrix of results. I don't know what to do with ..

Spring Boot - Cannot determine embedded database driver class for database type NONE

This is the error that is thrown when trying to run my web app: [INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.b..

Restoring Nuget References?

I have solution & project in Visual Studio 2012. The project has a file packages.config in the root of the project. For the purposes of this question, lets assume I accidentally removed these l..

json_encode(): Invalid UTF-8 sequence in argument

I'm calling json_encode() on data that comes from a MySQL database with utf8_general_ci collation. The problem is that some rows have weird data which I can't clean. For example symbol ?, so once it r..

Replacing &nbsp; from javascript dom text node

I am processing xhtml using javascript. I am getting the text content for a div node by concatenating the nodeValue of all child nodes where nodeType == Node.TEXT_NODE. The resulting string sometimes..

Convert integer to string Jinja

I have an integer {% set curYear = 2013 %} In {% if %} statement I have to compare it with some string. I can't set curYear to string at the beginning because I have to decrement it in loop. How c..

Illegal character in path at index 16

I am getting the following error in RAD: java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base...... Could you please let me know what is ..

How to get build time stamp from Jenkins build variables?

How can I get build time stamp of the latest build from Jenkins? I want to insert this value in the Email subject in post build actions...

What is the mouse down selector in CSS?

I have noticed that buttons and other elements have a default styling and behave in 3 steps: normal view, hover/focus view and mousedown/click view, in CSS I can change the styling of normal view and ..

What is the facade design pattern?

Is facade a class which contains a lot of other classes? What makes it a design pattern? To me, it is like a normal class. Can you explain to me this Facade pattern?..

How to check for an empty struct?

I define a struct ... type Session struct { playerId string beehive string timestamp time.Time } Sometimes I assign an empty session to it (because nil is not possible) session = Sessi..

sklearn plot confusion matrix with labels

I want to plot a confusion matrix to visualize the classifer's performance, but it shows only the numbers of the labels, not the labels themselves: from sklearn.metrics import confusion_matrix import..

Is there a rule-of-thumb for how to divide a dataset into training and validation sets?

Is there a rule-of-thumb for how to best divide data into training and validation sets? Is an even 50/50 split advisable? Or are there clear advantages of having more training data relative to validat..

Check if the number is integer

I was surprised to learn that R doesn't come with a handy function to check if the number is integer. is.integer(66) # FALSE The help files warns: is.integer(x) does not test if x contains in..

How do I ignore files in a directory in Git?

What is the proper syntax for the .gitignore file to ignore files in a directory? Would it be config/databases.yml cache/* log/* data/sql/* lib/filter/base/* lib/form/base/* lib/model/map/* lib/mode..

Check if string is in a pandas dataframe

I would like to see if a particular string exists in a particular column within my dataframe. I'm getting the error ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool()..

Import Package Error - Cannot Convert between Unicode and Non Unicode String Data Type

I have made a dtsx package on my computer using SQL Server 2008. It imports data from a semicolon delimited csv file into a table where all of the field types are NVARCHAR MAX. It works on my comput..

How to create a database from shell command?

I'm looking for something like createdb in PostgreSQL or any other solution that would allow me to create database with a help of a shell command. Any hints?..

Convert serial.read() into a useable string using Arduino?

I'm using two Arduinos to sent plain text strings to each other using newsoftserial and an RF transceiver. Each string is perhaps 20-30 characters in length. How do I convert Serial.read() into a str..

How do I set the default locale in the JVM?

I want to set the default Locale for my JVM to fr_CA. What are the possible options to do this? I know of only one option Locale.setDefault()..

Import CSV file with mixed data types

I'm working with MATLAB for few days and I'm having difficulties to import a CSV-file to a matrix. My problem is that my CSV-file contains almost only Strings and some integer values, so that csvread..

How to resolve 'unrecognized selector sent to instance'?

In the AppDelegate, I'm alloc'ing an instance defined in a static library. This instance has an NSString property set a "copy". When I access the string property on this instance, the app crashes wi..

How to clear memory to prevent "out of memory error" in excel vba?

I am running VBA code on a large spreadsheet. How do I clear the memory between procedures/calls to prevent an "out of memory" issue occurring? Thanks..

Maven: Failed to retrieve plugin descriptor error

I configured Maven 3.0.3 and tried to download a sample project using archetypes with this command: mvn archetype:generate -DarchetypeGroupId=org.graniteds.archetypes -Darche..

Remove row lines in twitter bootstrap

I'm using twitter bootstrap for some web app I'm forced to do (I'm not a web developer) and I can't find a way to disable the row lines for tables. As you can see from the Bootstrap documentation, th..

How do I assert my exception message with JUnit Test annotation?

I have written a few JUnit tests with @Test annotation. If my test method throws a checked exception and if I want to assert the message along with the exception, is there a way to do so with JUnit @T..

How to play video with AVPlayerViewController (AVKit) in Swift

How do you play a video with AV Kit Player View Controller in Swift? override func viewDidLoad() { super.viewDidLoad() let videoURLWithPath = "http://****/5.m3u8" let videoURL..

Flash CS4 refuses to let go

I have a Flash project, and it has many source files. I have a fairly heavily-used class, call it Jenine. I recently (and, perhaps, callously) relocated Jenine from one namespace to another. I thought..

Difference between Groovy Binary and Source release?

i have been seeing the words binary and source release in many websites download sections. What do they actually mean? For example, I have seen this in Groovy download page. My question is how ..

String Array object in Java

I am trying to print the first element on the two arrays in my Athlete class, country and name. I also need to create a object that simulates three dive attemps an athlete had (that is initially set t..

Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile

I have been trying to build a code using maven. But I am stuck with an error. The code is available on this github repo. google-play-crawler My system configurations as shown by maven is followning: ..

How to determine if .NET Core is installed

I know that for older versions of .NET, you can determine if a given version is installed by following https://support.microsoft.com/en-us/kb/318785 Is there an official method of determining if..

Objective-C implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' warning

I'm working through some exercises and have got a warning that states: Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'int' #import <Foundation/Foundation..

Select multiple value in DropDownList using ASP.NET and C#

Select multiple value in DropDownList using ASP.NET and C#. I tried it to select single value from drop down but unable to find multiple selection...

Update index after sorting data-frame

Take the following data-frame: x = np.tile(np.arange(3),3) y = np.repeat(np.arange(3),3) df = pd.DataFrame({"x": x, "y": y}) x y 0 0 0 1 1 0 2 2 0 3 0 1 4 1 1 5 2 1 6 0 2 7 1 2 ..

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

"An access token is required to request this resource" while accessing an album / photo with Facebook php sdk

I am using the php sdk to access a user's albums and photos in a website. I am able to login and also able to retrieve all the info about the albums and photos. However, I am not able to display thes..

bypass invalid SSL certificate in .net core

I am working on a project that needs to connect to an https site. Every time I connect, my code throws exception because the certificate of that site comes from untrusted site. Is there a way to bypa..

How to use execvp()

The user will read a line and i will retain the first word as a command for execvp. Lets say he will type "cat file.txt" ... command will be cat . But i am not sure how to use this execvp(), i read ..

SVN remains in conflict?

How do I get this directory out of conflict? I don't care if it's resolved using "theirs" or "mine" or whatever... PS C:\Users\Mark\Desktop\myproject> svn ci -m "gr" svn: Commit failed (details f..

Ruby Hash to array of values

I have this: hash = { "a"=>["a", "b", "c"], "b"=>["b", "c"] } and I want to get to this: [["a","b","c"],["b","c"]] This seems like it should work but it doesn't: hash.each{|key,value| val..

Passing Arrays to Function in C++

#include <iostream> using namespace std; void printarray (int arg[], int length) { for (int n = 0; n < length; n++) { cout << arg[n] << " "; cout << "\n..

How do I make a WinForms app go Full Screen

I have a WinForms app that I am trying to make full screen (somewhat like what VS does in full screen mode). Currently I am setting FormBorderStyle to None and WindowState to Maximized which gives me..

How to change the font on the TextView?

How to change the font in a TextView, as default it's shown up as Arial? How to change it to Helvetica?..

How do you change the server header returned by nginx?

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?..

Selenium WebDriver How to Resolve Stale Element Reference Exception?

I have the following code in a Selenium 2 Web Driver test which works when I am debugging but most of the time fails when I run it in the build. I know it must be something to do with the way the page..

How do I get hour and minutes from NSDate?

In my application I need to get the hour and minute separately: NSString *currentHour=[string1 substringWithRange: NSMakeRange(0,2)]; int currentHourInNumber=[currentHour intValue]; Conside..

What are rvalues, lvalues, xvalues, glvalues, and prvalues?

In C++03, an expression is either an rvalue or an lvalue. In C++11, an expression can be an: rvalue lvalue xvalue glvalue prvalue Two categories have become five categories. What are these..

C# Java HashMap equivalent

Coming from a Java world into a C# one is there a HashMap equivalent? If not what would you recommend?..

How to return a table from a Stored Procedure?

It is very simple question. I am trying to return a table from a stored procedure, like select * from emp where id=@id I want to return this query result as a table. I have to do this through a st..

How to save a dictionary to a file?

I have problem with changing a dict value and saving the dict to a text file (the format must be same), I only want to change the member_phone field. My text file is the following format: memberID:m..

Eclipse: Java was started but returned error code=13

I just updated Java to 1.8 u25, and now I get this message every time I try to open Eclipse I have no clue what I'm doing wrong, when it comes to Eclipse. I have re-downloaded it number of times bu..

Can we define min-margin and max-margin, max-padding and min-padding in css?

Can we define min-margin and max-margin, max-padding and min-padding in CSS ?..

Converting JSON String to Dictionary Not List

I am trying to pass in a JSON file and convert the data into a dictionary. So far, this is what I have done: import json json1_file = open('json1') json1_str = json1_file.read() json1_data = json.lo..

IntelliJ does not show 'Class' when we right click and select 'New'

We're creating a new project in IntelliJ and must have something wrong because when we right click on a directory, select New and then get the context menu, Java based options are not shown. Currently..

What is the size of a boolean variable in Java?

Can any one tell the bit size of boolean in Java?..

Why should we typedef a struct so often in C?

I have seen many programs consisting of structures like the one below typedef struct { int i; char k; } elem; elem user; Why is it needed so often? Any specific reason or applicable area?..

Python: most idiomatic way to convert None to empty string?

What is the most idiomatic way to do the following? def xstr(s): if s is None: return '' else: return s s = xstr(a) + xstr(b) update: I'm incorporating Tryptich's suggestio..

How to query GROUP BY Month in a Year

I am using Oracle SQL Developer. I essentially have a table of pictures that holds the columns: [DATE_CREATED(date), NUM_of_PICTURES(int)] and if I do a select *, I would get an output similar to: ..

Can't get Python to import from a different folder

I can't seem to get Python to import a module in a subfolder. I get the error when I try to create an instance of the class from the imported module, but the import itself succeeds. Here is my directo..

Check if AJAX response data is empty/blank/null/undefined/0

What I have: I have jQuery AJAX function that returns HTML after querying a database. Depending on the result of the query, the function will either return HTML code or nothing (i.e. blank) as desire..

GetElementByID - Multiple IDs

doStuff(document.getElementById("myCircle1" "myCircle2" "myCircle3" "myCircle4")); This doesn't work, so do I need a comma or semi-colon to make this work?..

Spark RDD to DataFrame python

I am trying to convert the Spark RDD to a DataFrame. I have seen the documentation and example where the scheme is passed to sqlContext.CreateDataFrame(rdd,schema) function. But I have 38 columns o..

Removing NA observations with dplyr::filter()

My data looks like this: library(tidyverse) df <- tribble( ~a, ~b, ~c, 1, 2, 3, 1, NA, 3, NA, 2, 3 ) I can remove all NA observations with drop_na(): df %>% drop_na() Or..

How to Set Focus on JTextField?

I make my game run without mouse so using pointer is not a choice. High Score menu will show when player lose. this is my code highScore=new MyTextField("Your Name"); highScore.addKeyListene..

How to check if a column exists in Pandas

Is there a way to check if a column exists in a Pandas DataFrame? Suppose that I have the following DataFrame: >>> import pandas as pd >>> from random import randint >>> d..

How to decorate a class?

In Python 2.5, is there a way to create a decorator that decorates a class? Specifically, I want to use a decorator to add a member to a class and change the constructor to take a value for that memb..

What's the u prefix in a Python string?

Like in: u'Hello' My guess is that it indicates "Unicode", is it correct? If so, since when is it available?..

How to use a SQL SELECT statement with Access VBA

I have a combobox whose value I want to use with a SQL WHERE clause. How do you run a SELECT statement inside VBA based on the combobox value?..

PHP foreach loop key value

I am running this DB call to get me multi-dimensional array I am trying to get the keys of each but when I try it comes up blank or as array. $root_array = array(); $sites = $this->sites($membe..

horizontal line and right way to code it in html, css

I need to draw a horizontal line after some block, and I have three ways to do it: 1) Define a class h_line and add css features to it, like #css .hline { width:100%; height:1px; background: #fff } ..

Use tnsnames.ora in Oracle SQL Developer

I am evaluating Oracle SQL Developer. My tnsnames.ora is populated, and a tnsping to a connection defined in tnsnames.ora works fine. Still, SQL Developer does not display any connections. Oracle SQ..

grabbing first row in a mysql query only

if i had a query such as select * from tbl_foo where name = 'sarmen' and this table has multiple instances of name = sarmen how can i virtually assign row numbers to each row without having to crea..

Oracle's default date format is YYYY-MM-DD, WHY?

Oracle's default date format is YYYY-MM-DD. Which means if I do: select some_date from some_table ...I lose the time portion of my date. Yes, I know you can "fix" this with: alter session set ..

Difference between @Before, @BeforeClass, @BeforeEach and @BeforeAll

What is the main difference between @Before and @BeforeClass and in JUnit 5 @BeforeEach and @BeforeAll @After and @AfterClass According to the JUnit Api @Before is used in the following case: ..

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

I am following the tutorials at docs.mongodb.org, 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..

Auto-click button element on page load using jQuery

If I wanted to auto-click a button element on page load, how would I go about this using jQuery? The button html is <button class="md-trigger" id="modal" data-modal="modal"></button> A..

How to restore a SQL Server 2012 database to SQL Server 2008 R2?

I am trying to restore the backup taken from a SQL Server 2012 to SQL Server 2008 R2, and it giving an error Specified cast is not valid. (SqlManagerUI) If you have any solution to this please ..

Div Background Image Z-Index Issue

I am trying to get the background image of my content to appear behind the header and footer. Currently, the top of the content's background is sticking out onto the header, and you can see that the b..

Python - A keyboard command to stop infinite loop?

Possible Duplicate: Why can't I handle a KeyboardInterrupt in python? I was playing around with some Python code and created an infinite loop: y = 0 x = -4 itersLeft = x while(itersLe..

How do I verify/check/test/validate my SSH passphrase?

I think I forgot the passphrase for my SSH key, but I have a hunch what it might be. How do I check if I'm right?..

HTML - how to make an entire DIV a hyperlink?

How do I make an entire DIV a clickable hyperlink. Meaning, I essentially want to do: <div class="myclass" href="example.com"> <div>...</div> <table><tr>..</t..

How are echo and print different in PHP?

Possible Duplicate: Reference: Comparing PHP's print and echo Is there any major and fundamental difference between these two functions in PHP?..

How to take input in an array + PYTHON?

I am new to Python and want to read keyboard input into an array. The python doc does not describe arrays well. Also I think I have some hiccups with the for loop in Python. I am giving the C code sn..

#1062 - Duplicate entry for key 'PRIMARY'

So my MySQL database is behaving a little bit wierd. This is my table: Name shares id price indvprc cat 2 4 81 0 goog 4 4 20 20 fb 4 9 20 20 I'm getting th..

How to add parameters into a WebRequest?

I need to call a method from a webservice, so I've written this code: private string urlPath = "http://xxx.xxx.xxx/manager/"; string request = urlPath + "index.php/org/get_org_form"; WebRequest we..

VB.NET - If string contains "value1" or "value2"

I'm wondering how I can check if a string contains either "value1" or "value2"? I tried this: If strMyString.Contains("Something") Then End if This works, but this doesn't: If strMyString.Contain..

require is not defined? Node.js

Just started working with Node.js. In my app/js file, I am doing something like this: app.js var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {..

Checking on a thread / remove from list

I have a thread which extends Thread. The code looks a little like this; class MyThread(Thread): def run(self): # Do stuff my_threads = [] while has_jobs() and len(my_threads) < 5: ..

GET and POST methods with the same Action name in the same Controller

Why is this incorrect? { public class HomeController : Controller { [HttpGet] public ActionResult Index() { Some Code--Some Code---Some Code r..

Convert utf8-characters to iso-88591 and back in PHP

Some of my script are using different encoding, and when I try to combine them, this has becom an issue. But I can't change the encoding they use, instead I want to change the encodig of the result f..

Good Linux (Ubuntu) SVN client

Subversion has a superb client on Windows (Tortoise, of course). Everything I've tried on Linux just - well - sucks in comparison......

How to allow <input type="file"> to accept only image files?

I need to upload only image file through <input type="file"> tag. Right now, it accepts all file types. But, I want to restrict it to only specific image file extensions which include .jpg, .g..

Convert named list to vector with values only

I have a list of named values: myList <- list('A' = 1, 'B' = 2, 'C' = 3) I want a vector with the value 1:3 I can't figure out how to extract the values without defining a function. Is there a sim..

How do I replace text inside a div element?

I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. <div id="panel"> <div id="field_name">T..

How to open google chrome from terminal?

I'm trying to create an alias that opens google chrome to localhost. Port 80 in this case. I'd also really like to be able to be in any git directory and have it open that specific project in the br..

Select parent element of known element in Selenium

I have a certain element that I can select with Selenium 1. Unfortunately I need to click the parent element to get the desired behaviour. The element I can easily locate has attribute unselectable, ..

restart mysql server on windows 7

How do I restart MySQL on Windows 7? I'm using HeidiSql as a front end and there's no option in there. The only other things I have is the MySQL 5.5 command line client...

Configure Flask dev server to be visible across the network

I'm not sure if this is Flask specific, but when I run an app in dev mode (http://localhost:5000), I cannot access it from other machines on the network (with http://[dev-host-ip]:5000). With Rails in..

SameSite warning Chrome 77

Since the last update, I'm having an error with cookies, related with SameSite attribute. The cookies are from third party developers (Fontawesome, jQuery, Google Analytics, Google reCaptcha, Google ..

VBA - Range.Row.Count

I have written a simple code to illustrate my predicament. Sub test() Dim sh As Worksheet Set sh = ThisWorkbook.Sheets("Sheet1") Dim k As Long k = sh.Range("A1", sh.Range("A1").End..

window.open(url, '_blank'); not working on iMac/Safari

I've build a web page that let's you select a page name from a drop down list and then transfers the browser to that page. The code that does the transfer is if (url){ window.open(url, '_blank')..

How to restart VScode after editing extension's config?

VScode notifies you when you open a config of an extension: remember to Restart VScode But it says nothing about how. They use capital letter for restart word, so normally it should mean somet..

How to input automatically when running a shell over SSH?

In my shell script I am running a command which is asking me for input. How can I give the command the input it needs automatically? For example: $cat test.sh ssh-copy-id [email protected] When run..

How do I get the browser scroll position in jQuery?

I have a web document with scroll. I want to get the value, in pixels, of the current scroll position. When I run the below function it returns the value zero. How can I do this? <script type="..

What is an .axd file?

What kind of purpose do .axd files serve? I know that it is used in the ASP.Net AJAX Toolkit and its controls. I'd like to know more about it. I tried Googling for it, but could not find getting ba..

Redirect after Login on WordPress

I'm creating a customized WordPress theme based on an existing site. I want to use an alternate dashboard which I have created. How can I have the user directed to 'news.php' after login instead of ..

Load HTML File Contents to Div [without the use of iframes]

I'm quite sure this a common question, but I'm pretty new to JS and am having some trouble with this. I would like to load x.html into a div with id "y" without using iframes. I've tried a few things..

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do: 1) I have ASP...

What is the `zero` value for time.Time in Go?

In an error condition, I tried to return nil, which throws the error: cannot use nil as type time.Time in return argument What is the zero value for time.Time?..

How to do "If Clicked Else .."

I am trying to use jQuery to do something like if(jQuery('#id').click) { //do-some-stuff } else { //run function2 } But I'm unsure how to do this using jQuery ? Any help would be greatly ap..

How can I run an external command asynchronously from Python?

I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do...

Immutable array in Java

Is there an immutable alternative to the primitive arrays in Java? Making a primitive array final doesn't actually prevent one from doing something like final int[] array = new int[] {0, 1, 2, 3}; ar..

How to pass arguments and redirect stdin from a file to program run in gdb?

I usually run a program as : ./a.out arg1 arg2 <file I would like to debug it using gdb. I am aware of the set args functionality, but that only works from the gdb prompt...

Spring Boot and multiple external configuration files

I have multiple property files that I want to load from classpath. There is one default set under /src/main/resources which is part of myapp.jar. My springcontext expects files to be on the classpath...

What is the difference between partitioning and bucketing a table in Hive ?

I know both is performed on a column in the table but how is each operation different...

How to change Vagrant 'default' machine name?

Where does the name 'default' come from when launching a vagrant box? $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... Is there a way to set this?..

How to clear Tkinter Canvas?

When I draw a shape using: canvas.create_rectangle(10, 10, 50, 50, color="green") Does Tkinter keep track of the fact that it was created? In a simple game I'm making, my code has one Frame creat..

Can't import javax.servlet.annotation.WebServlet

I have started to write app that can run on Google App Engine. But when I wanted to use my code from Netbeans to Eclipse I had an errors on: import javax.servlet.annotation.WebServlet; and @WebServle..

What exactly does big ? notation represent?

I'm really confused about the differences between big O, big Omega, and big Theta notation. I understand that big O is the upper bound and big Omega is the lower bound, but what exactly does big ? (..

HTML5 video - show/hide controls programmatically

I am looking for a way to show or hide HTML5 video controls at will via javascript. The controls are currently only visible when the video starts to play Is there a way to do this with the native vid..

Enumerations on PHP

I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion..

How to Set Variables in a Laravel Blade Template

I'm reading the Laravel Blade documentation and I can't figure out how to assign variables inside a template for use later. I can't do {{ $old_section = "whatever" }} because that will echo "whatever"..

How to use NSJSONSerialization

I have a JSON string (from PHP's json_encode() that looks like this: [{"id": "1", "name":"Aaa"}, {"id": "2", "name":"Bbb"}] I want to parse this into some sort of data structure for my iPhone app. ..

How to download excel (.xls) file from API in postman?

I am having an API endpoint and Authorization token for that API. The said API is for .xls report download, how can I view the downloaded .xls file using (if possible) Postman? If it is not possible..

Javascript: Setting location.href versus location

When would you set location to a URL string versus setting location.href? location = "http://www.stackoverflow.com"; vs location.href = "http://www.stackoverflow.com"; Mozilla Developer Network ..

Error:Execution failed for task ':app:processDebugResources'. > java.io.IOException: Could not delete folder "" in android studio

I am trying to develop a Android application using Android Studio, so I created an Android app and I want to publish it. Whenever I click on “build project“ to obtain the apk file, I get this erro..

The input is not a valid Base-64 string as it contains a non-base 64 character

I have a REST service that reads a file and sends it to another console application after converting it to Byte array and then to Base64 string. This part works, but when the same stream is received a..

Test if a vector contains a given element

How to check if a vector contains a given value?..

Loading custom configuration files

I know I can open config files that are related to an assembly with the static ConfigurationManager.OpenExe(exePath) method but I just want to open a config that is not related to an assembly. Just a ..

What does the "__block" keyword mean?

What exactly does the __block keyword in Objective-C mean? I know it allows you to modify variables within blocks, but I'd like to know... What exactly does it tell the compiler? Does it do anythin..

stopPropagation vs. stopImmediatePropagation

What's the difference between event.stopPropagation() and event.stopImmediatePropagation()?..

Twitter Bootstrap and ASP.NET GridView

I am having aproblem using Twitter Bootstrap from my ASP.NET application. When I use the table table-striped css class to my asp:GridView control, it treats the Header of the table as a Row. My GridV..

Set scroll position

I'm trying to set the scroll position on a page so the scroller is scrolled all the way to the top. I think I need something like this but it's not working: (function () { alert('hello'); document...

How can I count text lines inside an DOM element? Can I?

I'm wondering if there's a way to count lines inside a div for example. Say we have a div like so: <div id="content">hello how are you?</div> Depending on many factors, the div can have..

How to select Multiple images from UIImagePickerController

In my application, I have to select more images ie; up to 3 images from library or capture of images...