Questions Tagged with #Ejb

Enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of enterprise applications. The EJB specification is one of several [Java] APIs in the [Java EE] specification.

Should I use @EJB or @Inject

I have found this question: What is the difference between @Inject and @EJB but I did not get any wiser. I have not done Java EE before nor do I have experience with dependency injection so I do not u..

Cannot instantiate the type List<Product>

I have the following code: List<Product> product = new List<Product>(); The error: Cannot instantiate the type List<Product> Product is an Entity in my EJB project. Why I'm get..

Maximum size for a SQL Server Query? IN clause? Is there a Better Approach

Possible Duplicate: T-SQL WHERE col IN (…) What is the maximum size for a SQL Server query? (# of characters) Max size for an IN clause? I think I saw something about Oracle having a ..

How to pass multiple values through command argument in

I have ImageButton with CommandArgument attribute which is having multiple Eval value. When I click one of them I want to pass values to ImageButton2_Click event but it does not work because Command a..

How to clear the text of all textBoxes in the form?

private void CleanForm() { foreach (var c in this.Controls) { if (c is TextBox) { ((TextBox)c).Text = String.Empty; } } } This method above doesn't wo..

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 2: ordinal not in range(128)

I am attempting to work with a very large dataset that has some non-standard characters in it. I need to use unicode, as per the job specs, but I am baffled. (And quite possibly doing it all wrong.) ..

How to find which git branch I am on when my disk is mounted on other server

Our git repo is on a Linux server; I can be on the master branch or create a new branch that I can go inside and use. Our git repo disk is mounted on AIX box to build (I can see git directory in the ..

Copy multiple files in Python

How to copy all the files present in one directory to another directory using Python. I have the source path and the destination path as string...

taking input of a string word by word

I just started learning C++. I was just playing around with it and came across a problem which involved taking input of a string word by word, each word separated by a whitespace. What I mean is, supp..

YouTube iframe embed - full screen

I have a form that is iframed into a web page. Upon completion of the form, a YouTube video is displayed from using iframe embed. When I enter full screen mode of the YouTube video, nothing really ha..

JavaScript null check

I've come across the following code: function test(data) { if (data != null && data !== undefined) { // some code here } } I'm somewhat new to JavaScript, but, from other qu..

Maximum request length exceeded.

I am getting the error Maximum request length exceeded when I am trying to upload a video in my site. How do I fix this?..

PHP CSV string to array

I'm trying to parse a CSV string to an array in PHP. The CSV string has the following attributes: Delimiter: , Enclosure: " New line: \r\n Example content: "12345","Computers","Acer","4","Varta","..

WebView and HTML5 <video>

I'm piecing together a cheapo app that amongst other things "frames" some of our websites... Pretty simple with the WebViewClient. until I hit the video. The video is done as HTML5 elements, and th..

how to display a div triggered by onclick event

I have have two divs. I want to display a div( which has other divs inside it ) when the onclick event is triggered. Any help or suggestion would be appreciated. ..

How to get the path of running java program

Is there a way to get the path of main class of the running java program. structure is D:/ |---Project |------bin |------src I want to get the path as D:\Project\bin\. I tried Syste..

SSIS how to set connection string dynamically from a config file

I am using SQL Server Integration Services (SSIS) in SQL Server Business Intelligent Development Studio. I need to do a task that is as follows. I have to read from a source database and put it into..

My httpd.conf is empty

I recently installed apache2 on ubuntu but I have a problem, my httpd.conf is empty. Can someone give me a clean copy of httpd.conf for apache2 on ubuntu? Thanks! Edit: I saw your answers but on wamp..

When is a CDATA section necessary within a script tag?

Are CDATA tags ever necessary in script tags and if so when? In other words, when and where is this: <script type="text/javascript"> //<![CDATA[ ...code... //]]> </script> prefer..

What is the difference between Task.Run() and Task.Factory.StartNew()

I have Method : private static void Method() { Console.WriteLine("Method() started"); for (var i = 0; i < 20; i++) { Console.WriteLine("Method() Counter = " + i); Thr..

How to vertically center an image inside of a div element in HTML using CSS?

I have a markup like this: <div> <img /> </div> The div is higher than img: div { height: 100px; } img { height: dynamic-value-smaller-than-100px; } I need the image to ..

Custom HTTP headers : naming conventions

Several of our users have asked us to include data relative to their account in the HTTP headers of requests we send them, or even responses they get from our API. What is the general convention to ad..

Volatile Vs Atomic

I read somewhere below line. Java volatile keyword doesn't means atomic, its common misconception that after declaring volatile, ++ operation will be atomic, to make the operation atomic you s..

CSS3 animate border color

I want to animate borders of an element using CSS3, whether it's in hover state or normal state. Can someone provide me a code snippet for this or can guide? I can do this using jQuery but looking fo..

How to reset db in Django? I get a command 'reset' not found error

Following this Django by Example tutotrial here: The tutorial says: "This changes our table layout and we’ll have to ask Django to reset and recreate t..

How to export a Hive table into a CSV file?

I used this Hive query to export a table into a CSV file. INSERT OVERWRITE DIRECTORY '/user/data/output/test' select column1, column2 from table1; The file generated '000000_0' does not have comma ..

Convert np.array of type float64 to type uint8 scaling values

I have a particular np.array data which represents a particular grayscale image. I need to use SimpleBlobDetector() that unfortunately only accepts 8bit images, so I need to convert this image, obviou..

Spring data jpa- No bean named 'entityManagerFactory' is defined; Injection of autowired dependencies failed

I'm developing application using spring data jpa,hibernate,mysql,tomcat7,maven and it's create error.I'm trying to figure it out but i failed. error are Cannot resolve reference to bean 'entityMan..

Vbscript list all PDF files in folder and subfolders

Well here is my code but I just can not filter the listing using the objFile.Extension i am sure it is some thing silly Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\de..

How to get the current TimeStamp?

I'm trying to get the current time as TimeStamp without success. I have this code: QDateTime setTime = QDateTime::fromString (QString("1970-07-18T14:15:09"), Qt::ISODate); QDateTime current = QDateT..

Inner join with count() on three tables

Simple and fast question, i have those tables: //table people | pe_id | pe_name | | 1 | Foo | | 2 | Bar | //orders table | ord_id | pe_id | ord_title | | 1 | 1 | First order | | 2 ..

What does ECU units, CPU core and memory mean when I launch a instance

When I launch an instance on EC2, it gives me option for t1.micro, m1.small, m1.large etc. There is a comparision chart of vCPU, ECU, CPU cores, Memory, Instance store. Is this memory RAM of a system ..

How do I convert an array object to a string in PowerShell?

How can I convert an array object to string? I tried: $a = "This", "Is", "a", "cat" [system.String]::Join(" ", $a) with no luck. What are different possibilities in PowerShell?..

Regex Match all characters between two strings

Example: "This is just\na simple sentence". I want to match every character between "This is" and "sentence". Line breaks should be ignored. I can't figure out the correct syntax...

How can I print using JQuery

I have nested which images generate dynamically ...this is the html code problem is if i click the print button the corresponding image need to be printed. <div id="outputTemp" style..

ASP.NET MVC: No parameterless constructor defined for this object

Server Error in '/' Application. -------------------------------------------------------------------------------- No parameterless constructor defined for this object. Description: An unhandled exce..

run main class of Maven project

I've created a simple console Java application that is built with Maven. Is there a way that the main class (which doesn't require any arguments) can be run from the command-line using a maven command..

How to use ConfigurationManager

I want to use App.config for storing some setting. I tried to use the next code for getting a parameter from a config file. private string GetSettingValue(string paramName) { return String.Format(..

Stop a youtube video with jquery?

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

Change header background color of modal of twitter bootstrap

I am trying to change the background color of modal header of twitter bootstrap using following css code. .modal-header { padding:9px 15px; border-bottom:1px solid #eee; background-c..

Regular expression to match non-ASCII characters?

What is the easiest way to match non-ASCII characters in a regex? I would like to match all words individually in an input string, but the language may not be English, so I will need to match things l..

Angular EXCEPTION: No provider for Http

I am getting the EXCEPTION: No provider for Http! in my Angular app. What am I doing wrong? import {Http, Headers} from 'angular2/http'; import {Injectable} from 'angular2/core' @Component({ se..

Copying Code from Inspect Element in Google Chrome

I'm currently developing a website in HTML and I want to copy some of the code from other websites. However when I go into the inspect element feature and try to copy just part of the code it ends up ..

How to auto adjust the <div> height according to content in it?

I have a <div> which needs to be auto adjusted according to the content in it. How can I do this? Right now my content is coming out of the <div> The class I have used for the div is as..

HTML IF Statement

I just wanna know how to do an if-statement in simple HTML. Like the [if IE6] thingy I'd like to do something like this [IF 5>6] How's the syntax? I can't seem to find anything but [If!IE6] and..

Matlab: Running an m-file from command-line

Suppose that; I have an m-file at location: C:\M1\M2\M3\mfile.m And exe file of the matlab is at this location: C:\E1\E2\E3\matlab.exe I want to run this m-file with Matlab, from command-line, for ..

How to get the parents of a Python class?

How can I get the parent class(es) of a Python class? ..

Align <div> elements side by side

I know this is a rather simple question, but I can't figure it out for the life of me. I have two links which I've applied a background image to. Here's what it currently looks like (apologies for ..

How to stop a goroutine

I have a goroutine that calls a method, and passes returned value on a channel: ch := make(chan int, 100) go func(){ for { ch <- do_stuff() } }() How do I stop such a goroutine?..

XML string to XML document

I have a whole XML document in a String which i need to convert to a XML document and parse tags in the document..

What process is listening on a certain port on Solaris?

So I log into a Solaris box, try to start Apache, and find that there is already a process listening on port 80, and it's not Apache. Our boxes don't have lsof installed, so I can't query with that. I..

Show popup after page load

I created a jQuery popup by following an online tutorial. I want to show this popup after page load/after page load it appears + how to code it as like it appears after 5 second of page load. Due to m..

Media query to detect if device is touchscreen

What is the safest way, using media queries, to make something happen when not on a touchscreen device? If there is no way, do you suggest using a JavaScript solution such as !window.Touch or Moderniz..

XMLHttpRequest blocked by CORS Policy

I add an API with following script in let's say <script src=""></script> <div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&..

How to set the first option on a select box using jQuery?

I have two HTML select boxes. I need to reset one select box when I make a selection in another. <select id="name" > <option value="">select all</option> <option value="1..

How do we control web page caching, across all browsers?

Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner. For security reasons we do not want certain pages in our application to be cached, ever, ..

What is logits, softmax and softmax_cross_entropy_with_logits?

I was going through the tensorflow API docs here. In the tensorflow documentation, they used a keyword called logits. What is it? In a lot of methods in the API docs it is written like tf.nn.softmax(..

Vim 80 column layout concerns

The way I do 80-column indication in Vim seems incorrect:set columns=80. At times I also set textwidth, but I want to be able to see and anticipate line overflow with the set columns alternative. Th..

Difference between npx and npm?

I have just started learning React, and Facebook helps in simplifying the initial setup by providing the following ready-made project. If I have to install the skeleton project I have to type npx c..

Powershell Error "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function..."

I just typed the follow to try and get my SharePoint site: $spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp" It gave me the following error The term 'Get-SPWeb' is not recognized a..

Maven error :Perhaps you are running on a JRE rather than a JDK?

I've never worked with Maven before and I am following the instructions here. When I run the command mvn integration-test -Pamp-to-war It initially downloaded a whole bunch of dependencies, and in ..

Polling the keyboard (detect a keypress) in python

How can I poll the keyboard from a console python app? Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.)..

Can HTML checkboxes be set to readonly?

I thought they could be, but as I'm not putting my money where my mouth was (so to speak) setting the readonly attribute doesn't actually seem to do anything. I'd rather not use Disabled, since I wan..

Difference between Eclipse Europa, Helios, Galileo

What is the difference between versions of Eclipse (Europa, Helios, Galileo)? Which is the best for desktop application?..

How to set Java environment path in Ubuntu

I just installed JDK in Ubuntu with sudo apt-get install openjdk-6-jdk command, after the installation where's the Java bin directory located? And how can I set the environment path for that directory..

Android. Fragment getActivity() sometimes returns null

In developer console error reports sometimes I see reports with NPE issue. I do not understand what is wrong with my code. On emulator and my device application works good without forcecloses, howeve..

Postgres: How to convert a json string to text?

Json value may consist of a string value. eg.: postgres=# SELECT to_json('Some "text"'::TEXT); to_json ----------------- "Some \"text\"" How can I extract that string as a postgres text value..

How to use OR condition in a JavaScript IF statement?

I understand that in JavaScript you can write: if (A && B) { do something } But how do I implement an OR such as: if (A OR B) { do something } ..

For loop in Oracle SQL

I am new to Oracle and I am unaware about using for loop in Oracle SQL (not PL/SQL). I had a requirement to increase the number by +1 in the query and execute the statements; is it possible to use a ..

How to display and hide a div with CSS?

In my script there are three divs. I want to display div with class="ab" when I hover on first line and display div with class="abc", when hover on second line. Otherwise I want to display div with cl..

Should try...catch go inside or outside a loop?

I have a loop that looks something like this: for (int i = 0; i < max; i++) { String myString = ...; float myNum = Float.parseFloat(myString); myFloats[i] = myNum; } This is the main..

jQueryUI modal dialog does not show close button (x)

I'm using a jQuery modal dialog in my ASP .NET MVC 3 application. It works fine except for that there is no close button showing in the top right corner. How can I add this? $("#dialog-modal").dialo..

how to get program files x86 env variable?

I would like to know how I can display the location of Program Files (x86) in command prompt. I'm using Windows 7 64bit. I've tried: echo %programfiles(x86)% and echo %programfiles%, both of which..

IBOutlet and IBAction

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

Parser Error when deploy ASP.NET application

I've finished simple web application project, compiled it, and try to test on local IIS. I've create virtual directory, map it with physical directory, then put all necessary files there, incl..

How can I declare a two dimensional string array?

string[][] Tablero = new string[3][3]; I need to have a 3x3 array arrangement to save information to. How do I declare this in C#?..

Getting 400 bad request error in Jquery Ajax POST

I am trying to send an Ajax POST request using Jquery but I am having 400 bad request error. Here is my code: $.ajax({ type: 'POST', url: "http://localhost:8080/project/server/rest/subjects", ..

How to get the employees with their managers

This is what I want the output to look like: Employee Emp# Manager Mgr# BLAKE 7698 KING 7839 CLARK 7782 KING 7839 JONES 7566 KING 7839 MARTIN 7654 BLAKE 7698 A..

React hooks useState Array

I tried looking for resetting useState array values in here but could not find any references to array values. Trying to change the drop down value from initial state to allowedState values. I am usi..

Alternative to mysql_real_escape_string without connecting to DB

I'd like to have a function behaving as mysql_real_escape_string without connecting to database as at times I need to do dry testing without DB connection. mysql_escape_string is deprecated and theref..

Assign width to half available screen width declaratively

Is it possible to assign a widget width to half the available screen width, and do it using declarative xml?..

Move view with keyboard using Swift

I have an app that has a text field on the lower half of the view. This means that when I go to type in the text field the keyboard covers the textfield. How would I go about moving the view upwards ..

Bootstrap Dropdown with Hover

OK, so what I need is fairly straightforward. I have set up a navbar with some dropdown menus in it (using class="dropdown-toggle" data-toggle="dropdown"), and it works fine. The thing is it works "..

anaconda - graphviz - can't import after installation

Just installed a package through anaconda (conda install graphviz), but ipython wouldn't find it. I can see a graphviz folder in C:\Users\username\Anaconda\pkgs But there's nothing in: C:\Users\user..

Making Maven run all tests, even when some fail

I have a project with several modules. When all tests pass, Maven test runs them all. When tests fail in the first module, maven will not continue to the next project. I have testFailureIgnore set to..


Using the command: CREATE TABLE IF NOT EXISTS `test`.`t1` ( `col` VARCHAR(16) NOT NULL ) ENGINE=MEMORY; Running this twice in the MySQL Query Browser results in: Table 't1' already exists E..

Logical operators ("and", "or") in DOS batch

How would you implement logical operators in DOS Batch files?..

regular expression for finding 'href' value of a <a> link

I need a regex pattern for finding web page links in HTML. I first use @"(<a.*?>.*?</a>)" to extract links (<a>), but I can't fetch href from that. My strings are: <a href="ww..

MD5 is 128 bits but why is it 32 characters?

I read some docs about md5, it said that its 128 bits, but why is it 32 characters? I can't compute the characters. 1 byte is 8 bits if 1 character is 1 byte then 128 bits is 128/8 = 16 bytes right?..

Catch paste input

I'm looking for a way to sanitize input that I paste into the browser, is this possible to do with jQuery? I've managed to come up with this so far: $(this).live(pasteEventName, function(e) { // th..

How to read integer values from text file

Possible Duplicate: Java: Reading integers from a file into an array I want to read integer values from a text file say contactids.txt. in the file i have values like 12345 3456778 2342342..

Sass - Converting Hex to RGBa for background opacity

I have the following Sass mixin, which is a half complete modification of an RGBa example: @mixin background-opacity($color, $opacity: .3) { background: rgb(200, 54, 54); /* The Fallback */ b..

Is having an 'OR' in an INNER JOIN condition a bad idea?

In trying to improve the speed of an immensely slow query (several minutes on two tables with only ~50,000 rows each, on SQL Server 2008 if it matters), I narrowed down the problem to an OR in my inne..

mysqli::mysqli(): (HY000/2002): Can't connect to local MySQL server through socket 'MySQL' (2)

I get this error when I try to connect to the mysql database using php mysqli class. Using following code: $db = new MySQLi("localhost","kamil","*****"); if (mysqli_connect_errno()) { echo "An er..

Half circle with CSS (border, outline only)

I'm trying to create a circle with CSS, which looks exactly like on the following picture: ...with only one div: <div class="myCircle"></div> and by using only CSS definitions. No SV..

How to read line by line or a whole text file at once?

I'm in a tutorial which introduces files (how to read and write from\to file) First of all, this is not a homework, this is just general help I'm seeking. I know how to read one word at a time, but ..

struct in class

I have struct in class and not know how to call variables from struct, please help ;) #include <iostream> using namespace std; class E { public: struct X { int v; }; }; ..

C++: variable 'std::ifstream ifs' has initializer but incomplete type

Sorry if this is pretty noobish, but I'm pretty new to C++. I'm trying to open a file and read it using ifstream: vector<string> load_f(string file) { vector<string> text; ifstream i..

Connection refused on docker container

I'm new to Docker and trying to make a demo Rails app. I made a dockerfile that looks like this: FROM ruby:2.2 MAINTAINER [email protected] # Install apt based dependencies required to run Rails a..

Why do we use Base64?

Wikipedia says Base64 encoding schemes are commonly used when there is a need to encode binary data that needs be stored and transferred over media that are designed to deal with textual data. Thi..

How to set value to variable using 'execute' in t-sql?

DECLARE @dbName nvarchar(128) = 'myDb' DECLARE @siteId int exec ('SELECT TOP 1 @siteId = Id FROM ' + @dbName + '..myTbl') select @siteId When I run the script above I get the following error Msg..

Why do you need ./ (dot-slash) before executable or script name to run it in bash?

When running scripts in bash, I have to write ./ in the beginning: $ ./ syncdb If I don't, I get an error message: $ syncdb -bash: command not found What is the rea..

Looping over elements in jQuery

I want to loop over the elements of an HTML form, and store the values of the <input> fields in an object. The following code doesn't work, though: function config() { $("#frmMain").childre..

Integrating MySQL with Python in Windows

I am finding it difficult to use MySQL with Python in my windows system. I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) sou..

jquery background-color change on focus and blur

I have the following problem: I have a form with three text input fields, and I want to change the background-color when one of the fields has focus, and get it set back when it loses focus. I have co..

Can I access constants in from templates in Django?

I have some stuff in that I'd like to be able to access from a template, but I can't figure out how to do it. I already tried {{CONSTANT_NAME}} but that doesn't seem to work. Is this po..

Drop all data in a pandas dataframe

I would like to drop all data in a pandas dataframe, but am getting TypeError: drop() takes at least 2 arguments (3 given). I essentially want a blank dataframe with just my columns headers. import p..

XOR operation with two strings in java

How to do bitwise XOR operation to two strings in java...

org.hibernate.QueryException: could not resolve property: filename

I am using Hibernate Criteria to get values from column filename in my table contaque_recording_log. But when I'm getting the result, it throws an exception org.hibernate.QueryException: could no..

Where can I get Google developer key

I am working on Google API like chat, contacts and so on... I am stuck on developer_key as mentioned in gdata doc. You can get this at 'developer_key' => '' ..

Bitbucket fails to authenticate on git pull

I use BitBucket and had to change my password because it was compromised. git pull remote: Invalid username or password. If you log in via a third party service you must ensure you have an accou..

How to pass payload via JSON file for curl?

I can successfully create a place via curl executing the following command: $ curl -vX POST https://server/api/v1/places.json -d " auth_token=B8dsbz4HExMskqUa6Qhn& \ place[name]=Fuelstation C..

How to have a a razor action link open in a new tab?

I trying to get my link to open in a new tab (it must be in razor format): <a href="@Url.Action("RunReport", "Performance", new { reportView = Model.ReportView.ToString() }, new { target = "_b..

How do I combine two lists into a dictionary in Python?

I have two lists of the same length: [1,2,3,4] and [a,b,c,d] I want to create a dictionary where I have {1:a, 2:b, 3:c, 4:d} What's the best way to do this?..

How do you find the sum of all the numbers in an array in Java?

I'm having a problem finding the sum of all of the integers in an array in Java. I cannot find any useful method in the Math class for this...

How to connect Bitbucket to Jenkins properly

Since about 1 week now, Bitbucket doesn't (?) send a request to my Jenkins server. I've set it all up like this: Endpoint http://username:apitoken@jenkinshost/ username = username in Jenkins apito..

Difference between add(), replace(), and addToBackStack()

What is the main difference between calling these methods: fragmentTransaction.addToBackStack(name); fragmentTransaction.replace(containerViewId, fragment, tag); fragmentTransaction.add(containerView..

How to get the first five character of a String

I have read this question to get first char of the string. Is there a way to get the first n number of characters from a string in C#?..

SVN checkout the contents of a folder, not the folder itself

I'm fairly new to linux and svn. I'm trying to checkout the trunk folder of a project into my public_html directory using this command (while in public_html): svn checkout file:///home/landonwinters/..

Using PowerShell to write a file in UTF-8 without the BOM

Out-File seems to force the BOM when using UTF-8: $MyFile = Get-Content $MyPath $MyFile | Out-File -Encoding "UTF8" $MyPath How can I write a file in UTF-8 with no BOM using PowerShell?..

Python string to unicode

Possible Duplicate: How do I treat an ASCII string as unicode and unescape the escaped characters in it in python? How do convert unicode escape sequences to unicode characters in a python stri..

no module named zlib

First, please bear with me. I have hard time telling others my problem and this is a long thread... I am using pythonbrew to run multiple versions of python in Ubuntu 10.10. For installing pythonbre..

Merge development branch with master

I have two branches namely master and development in a GitHub Repository. I am doing all my development in development branch as shown. git branch development git add * git commit -m "My initial com..

Override and reset CSS style: auto or none don't work

I would like to override following CSS styling defined for all tables: table { font-size: 12px; width: 100%; min-width: 400px; display:inline-table; } I have..

Check if a String contains a special character

How do you check if a String contains a special character like: [,],{,},{,),*,|,:,>, ..

Add a tooltip to a div

I have a div tag like this: <div> <label>Name</label> <input type="text"/> </div> How can I displaying a tooltip on :hover of the div, preferably with a fade in/ou..

Send Outlook Email Via Python?

I am using Outlook 2003. What is the best way to send email (through Outlook 2003) using Python?..

Remove Duplicate objects from JSON Array

I have an array that looks like this: var standardsList = [ {"Grade": "Math K", "Domain": "Counting & Cardinality"}, {"Grade": "Math K", "Domain": "Counting & Cardinality"}, {"Gra..

How do I convert from a string to an integer in Visual Basic?

How do I convert from a string to an integer? Here's what I tried: Price = CInt(Int(txtPrice.Text)) I took out the Int and I still got an exception...

SQL Developer is returning only the date, not the time. How do I fix this?

Here's what SQL Develoepr is giving me, both in the results window and when I export: CREATION_TIME ------------------- 27-SEP-12 27-SEP-12 27-SEP-12 Here's what another piece of software r..

Using FolderBrowserDialog in WPF application

I have a WPF application that I need to have users access directories in. I have searched to the end of the world on how to integrate windows forms into WPF and have found all kinds of information on..

Back to previous page with header( "Location: " ); in PHP

The title of this question kind of explains my question. How do I redirect the PHP page visitor back to their previous page with the header( "Location: URL of previous page" );..

Bootstrap 3 modal vertical position center

This is a two part question: How can you position the modal vertically in the center when you don't know the exact height of the modal? Is it possible to have the modal centered and have overflow:au..

Remove an item from a dictionary when its key is unknown

What is the best way to remove an item from a dictionary by value, i.e. when the item's key is unknown? Here's a simple approach: for key, item in some_dict.items(): if item is item_to_remove: ..

Github permission denied: ssh add agent has no identities

This is my first time accessing GitHub and I'm not experienced using a console. I am on a MacBook using Bash. When I try to access GitHub, I get this: git clone [email protected]:dhulihan/league-of-lege..

"Failed to install the following Android SDK packages as some licences have not been accepted" error

I am getting this error in jitpack, I've tried everything on the internet. Below is my error Failed to install the following Android SDK packages as some licences have not been accepted. platfo..

What is VanillaJS?

I have one simple question, that got stuck in my mind for a few days: What is VanillaJS? Some people refer to it as a framework, you can download a library from the official pages. But when I check s..

JavaScript Infinitely Looping slideshow with delays?

How do I make an infinite loop in JavaScript? I'm trying to make a slideshow, which I have working, but I can't get it to loop. I can't even get it to loop twice. The code I'm using right now is w..

Stripping everything but alphanumeric chars from a string in Python

What is the best way to strip all non alphanumeric characters from a string, using Python? The solutions presented in the PHP variant of this question will probably work with some minor adjustments, ..

Correct redirect URI for Google API and OAuth 2.0

I am making an application with the Google Maps API. I want to be able to have one person on a computer, watch what another person has edited to a map. I am thinking of passing information of the map ..

Change keystore password from no password to a non blank password

I have a jks keystore with no password. When I run the command keytool -list -keystore mykeystore.jks And it prompts me for the keystore password, I simply hit 'enter'. Please note that the keyst..

Update R using RStudio

How can I update R via RStudio?..

Add leading zeroes to number in Java?

Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something..

PHP: How to generate a random, unique, alphanumeric string for use in a secret link?

How would it be possible to generate a random, unique string using numbers and letters for use in a verify link? Like when you create an account on a website, and it sends you an email with a link, an..

How to use a dot "." to access members of dictionary?

How do I make Python dictionary members accessible via a dot "."? For example, instead of writing mydict['val'], I'd like to write mydict.val. Also I'd like to access nested dicts this way. For exam..

Benefits of using the conditional ?: (ternary) operator

What are the benefits and drawbacks of the ?: operator as opposed to the standard if-else statement. The obvious ones being: Conditional ?: Operator Shorter and more concise when dealing with direc..

Setting the default active profile in Spring-boot

I want my default active profile to be production if is not set. I tried the following in my but it did't work: spring.profiles.default=production S..

git: Your branch is ahead by X commits

How does this actually come about? I am working in one repo by myself at the moment, so this is my workflow: Change files Commit Repeat 1-2 until satisfied Push to master Then when I do a git sta..

An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

When I execute my code below, this error message occurs: "An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Additional inform..

How do I display a decimal value to 2 decimal places?

When displaying the value of a decimal currently with .ToString(), it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 decima..

error C2220: warning treated as error - no 'object' file generated

I have below class class Cdata12Mnt { public: char IOBname[ID1_IOB_PIOTSUP-ID1_IOB_TOP][BOADNAM_MAX + 4]; char ExIOBname[ID1_MAX_INF-ID1_EXIOB_U1TOP][BOADNAM_MAX + 4]; char cflpath[256]; ..

How to Batch Rename Files in a macOS Terminal?

I have a folder with a series of files named: prefix_1234_567.png prefix_abcd_efg.png I'd like to batch remove one underscore and the middle content so the output would be: prefix_567.png prefix_e..

How to install SignTool.exe for Windows 10

How to install SignTool.exe in Visual Studio 2015 for Windown 10? I tried to build my project but the program threw an error : Error An error occurred while signing: SignTool.exe not found. ..

How can I disable a button on a jQuery UI dialog?

How do I go about disabling a button on the jQuery UI dialog. I can't seem to find this in any of the documentation in the link above. I have 2 buttons on the modal confirmation ("Confirm" and "Cance..

Easiest way to detect Internet connection on iOS?

I know this question will appear to be a dupe of many others, however, I don't feel the simple case is well explained here. Coming from an Android and BlackBerry background, making requests through HT..

How to check if a specific key is present in a hash or not?

I want to check whether the "user" key is present or not in the session hash. How can I do this? Note that I don't want to check whether the key's value is nil or not. I just want to check whether th..

Callback functions in Java

Is there a way to pass a call back function in a Java method? The behavior I'm trying to mimic is a .Net Delegate being passed to a function. I've seen people suggesting creating a separate object b..

How to run Unix shell script from Java code?

It is quite simple to run a Unix command from Java. Runtime.getRuntime().exec(myCommand); But is it possible to run a Unix shell script from Java code? If yes, would it be a good practice to run a..

How does "FOR" work in cmd batch file?

I've been programming in dozens of languages for 20 years but I could never understand how "FOR" work in windows cmd shell batch file, no matter how hard I tried. I read

How to print register values in GDB?

How do I print the value of %eax and %ebp? (gdb) p $eax $1 = void ..

Read/Parse text file line by line in VBA

I'm trying to parse a text document using VBA and return the path given in the text file. For example, the text file would look like: *Blah blah instructions *Blah blah instructions on line 2 G:\\Fo..

Installing RubyGems in Windows

I'm new to ruby. I tried to install Ruby Gems on my PC by following the steps given in the site I downloaded the package from the mentioned site, changed the direct..

How do I extract data from JSON with PHP?

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

What is meant by the term "hook" in programming?

I recently heard the term "hook" while talking to some people about a program I was writing. I'm unsure exactly what this term implies although I inferred from the conversation that a hook is a type ..

Parcelable encountered IOException writing serializable object getactivity()

so I am getting this in logcat: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.resources.student_list.Student) I know this means that my stud..

Looping through all the properties of object php

How can I loop through all the properties of object?. Right now I have to write a new code line to print each property of object echo $obj->name; echo $obj->age; Can I loop through all the pr..

What are alternatives to document.write?

In tutorials I've learnt to use document.write. Now I understand that by many this is frowned upon. I've tried print(), but then it literally sends it to the printer. So what are alternatives I shoul..

How Do I Insert a Byte[] Into an SQL Server VARBINARY Column

I have a byte array highlighted below, how do I insert it into a SQL Server database Varbinary column? byte[] arraytoinsert = new byte[10]{0,1,2,3,4,5,6,7,8,9}; string sql = string.format (..

How do I clear all variables in the middle of a Python script?

I am looking for something similar to 'clear' in Matlab: A command/function which removes all variables from the workspace, releasing them from system memory. Is there such a thing in Python? EDIT: I..

Making WPF applications look Metro-styled, even in Windows 7? (Window Chrome / Theming / Theme)

I like the window chrome on the new Office Suite and Visual Studio: I'm still developing applications for Windows 7 of course, but I'm wondering if there's a quick and easy way (read: WPF style or ..

label or @html.Label MVC 4

Newbie to MVC 4 and trying to make sense of Razor. If I wanted to just display some text in my .cshtml page, can I use <label class="LabelCSSTop">Introduction</label> or shoul..

Storing and retrieving datatable from session

How to store a datatable in session and to retrieve the values from the session in

Get ASCII value at input word

I have a character: char ch='A' Give me method which converts char to ASCII or way which returns a ASCII NUMBER. Output : 65..

How are zlib, gzip and zip related? What do they have in common and how are they different?

The compression algorithm used in zlib is essentially the same as that in gzip and zip. What are gzip and zip? How are they different and how are they same?..

What's the bad magic number error?

What's the "Bad magic number" ImportError in python, and how do I fix it? The only thing I can find online suggests this is caused by compiling a .py -> .pyc file and then trying to use it with the w..

How do I "Add Existing Item" an entire directory structure in Visual Studio?

I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure. I want to add them in that format to a different directory in an..

html5 localStorage error with Safari: "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota."

My webapp have javascript errors in ios safari private browsing: JavaScript:error undefined QUOTA_EXCEEDED_ERR:DOM Exception 22:An attempt was made to add something to storage... my co..

C++ program converts fahrenheit to celsius

Can someone help me understand why this gives an output of 0? #include <iostream> using namespace std; int main() { ..

What certificates are trusted in truststore?

I do not know very well keystore / truststore lingo but as far as I'm concerned, a truststore keeps the certificates trusted by a peer server. I can view the content of a keystore using keytool -lis..

Case-insensitive string comparison in C++

What is the best way of doing case-insensitive string comparison in C++ without transforming a string to all uppercase or all lowercase? Please indicate whether the methods are Unicode-friendly and h..

How to determine a user's IP address in node

How can I determine the IP address of a given request from within a controller? For example (in express):'/get/ip/address', function (req, res) { // need access to IP address here }) ..

SQL: Return "true" if list of records exists?

An alternative title might be: Check for existence of multiple rows? Using a combination of SQL and C# I want a method to return true if all products in a list exist in a table. If it can be done al..

Make div 100% Width of Browser Window

I'm trying to make one of my containers 100% of the width of the screen. Here is my SASS body, html { width: 100%; height: 100%; padding: 0; margin: 0; } #neo_wrapper { width..

Disable scrolling when touch moving certain element

I have a page with a section to sketch a drawing in. But the touchmove events, at least the vertical ones, are also scrolling the page (which degrades the sketching experience) when using it on a mob..

Html encode in PHP

What is the easiest way to Html encode in PHP?..

Changing datagridview cell color dynamically

I have a dataGridView object that is populated with data. I want to click a button and have it change the color of the background of the cell. This is what I currently have foreach(DataGridViewRow ro..

How to get response as String using retrofit without using GSON or any other library in android

I am trying to get response from the following Api : But I don't know how to get response as String so that I can use the String to parse and get the JSONObject..

git pull remote branch cannot find remote ref

I'm not sure why this doesn't work. When I do git branch -a, this is what I see: I'm trying to pull from the DownloadManager on the online GitHub repository. I have tried git pull, but then it ..

How to revert a merge commit that's already pushed to remote branch?

git revert <commit_hash> alone won't work. -m must be specified, and I'm pretty confused about it. Anyone experienced this before?..

Install opencv for Python 3.3

Is OpenCV still not available for Python 3.3 and do I really have to downgrade to Python 2.7 to use it? I didn't find much about it on the internet, only some posts from 2012 that OpenCV wasn't yet po..

Swing/Java: How to use the getText and setText string properly

I'm trying to make input nameField appear in a Label called label1 after a Button called button1 is clicked. Right now it says: 'txt' and I understand why. But I don't know how I can use the string! C..

How to set the text color of TextView in code?

In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000". But how do I change it by coding? I tried something like: holder.text.setTextColor(R.color.Red); Where..

Get Selected Item Using Checkbox in Listview

I am creating an Android application where I have a ListView that displays all of the applications that were installed in my mobile phone. My ListView is customized, it is contains a Icon, TextView a..

Lombok annotations do not compile under Intellij idea

I've installed the plugin for intellij idea(lombok-plugin-0.8.6-13). Added lombok.jar into classpath I can find getters and setters in the window of structure. And Intellij shows no error. Setting - ..

Test only if variable is not null in if statement

I have the following method where I want to test the event.status property only if status has been passed in: def findEvent(String desc, String status = null, Collection events) { return eve..

A project with an Output Type of Class Library cannot be started directly

Please can someone could explain why I get this error and what to do to fix it (or what I'm doing wrong!). The steps I have taken are Download Source code from

Reading CSV file and storing values into an array

I am trying to read a *.csv-file. The *.csv-file consist of two columns separated by semicolon (";"). I am able to read the *.csv-file using StreamReader and able to separate each line by using the..

How do I improve ASP.NET MVC application performance?

How do you improve your ASP.NET MVC application performance?..

Commands out of sync; you can't run this command now

I am trying to execute my PHP code, which calls two MySQL queries via mysqli, and get the error "Commands out of sync; you can't run this command now". Here is the code I am using <?php $con = my..

How can I run code on a background thread on Android?

I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible? I have tried calling the Thread class in my Activity but my Activity rema..

MongoDB: How to find out if an array field contains an element?

I have two collections. The first collection contains students: { "_id" : ObjectId("51780f796ec4051a536015cf"), "name" : "John" } { "_id" : ObjectId("51780f796ec4051a536015d0"), "name" : "Sam" } { "..

How to disable phone number linking in Mobile Safari?

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is turning that into a phone numb..