Questions Tagged with #Proxies

php & mysql query not echoing in html with tags?

<?php require 'db.php'; ?> <?php if (isset($_POST['search'])) { $limit = $_POST['limit']; $country = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $data = mysqli_query..

docker: Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable. IN DOCKER , MAC

I am having this issue in my Mac system 10.11.6 system3:postgres saurabh-gupta2$ docker build -t postgres . Sending build context to Docker daemon 38.91kB Step 1/51 : FROM registry.access.redhat.com..

Docker "ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"

I have a directory apkmirror-scraper-compose with the following structure: . +-- docker-compose.yml +-- privoxy ¦   +-- config ¦   +-- Dockerfile +-- scraper ¦   +-- Dockerfile ¦   +-- ne..

Why am I getting a "401 Unauthorized" error in Maven?

Why am I getting a "401 Unauthorized" error in Maven? Here's the error I'm getting when calling mvn deploy (full logs at the bottom): [INFO] BUILD FAILURE [ERROR] Failed to execute goal org.apache.m..

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved

I got the following error message when I tried to create a Maven project in eclipse. Many have posted about proxies in settings.xml file and also flush the .m2 folder forcing it to download a new one...

Entity framework self referencing loop detected

I have a strange error. I'm experimenting with a .NET 4.5 Web API, Entity Framework and MS SQL Server. I've already created the database and set up the correct primary and foreign keys and relationshi..

WCF error - There was no endpoint listening at

I am developing a WCF service, running IIS6 on Window server 2003. I have built a test client to talk to the WCF service and I am getting the error below. I have been looking at this error for days an..

Create a Maven project in Eclipse complains "Could not resolve archetype"

I am totally a newbie with Maven. I want to create a Maven project with Eclipse Juno EE with archetype "webapp". I installed "Maven Integration for Eclipse WTP (incubation)" and I also have installed ..

The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)

I trying to consume a WCF web service using stand alone application. I am able to view this service using Internet Explorer also able to view in Visual studio service references. This is the error I..

Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2)

I have created a new maven project in SpringSource Tool Suite. I am getting this error in my new maven project. Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from ..

Automapper missing type map configuration or unsupported mapping - Error

Entity Model public partial class Categoies { public Categoies() { this.Posts = new HashSet<Posts>(); } public int Id { get; set; } public string Name { get; set; } ..

Python Requests requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol

I'm on Ubuntu 12.10 with OpenSSL 1.0.1c, python 2.7.3, Requests 1.0.3 and 1.0.4 (tried both), and when attempting to connect to the website in the url variable with the following code. def SendInitia..

Non-static method requires a target

I have a controller action that works fine on Firefox both locally and in production, and IE locally, but not IE in production. Here is my controller action: public ActionResult MNPurchase() { C..

How to remove MySQL completely with config and library files?

So far I've tried the following commands: sudo apt-get remove mysql-server mysql-client mysql-common sudo apt-get purge mysql-server mysql-client mysql-common sudo apt-get autoremove But whenever I..

Express.js: how to get remote client address

I don't completely understand how I should get a remote user IP address. Let's say I have a simple request route such as: app.get(/, function (req, res){ var forwardedIpsStr = req.header('x-forwa..

How to send data in request body with a GET when using jQuery $.ajax()

The service API I am consuming has a given GET method that requires the data be sent in the body of the request. The data required in the body is a list of id's separated by hypen and could potenti..

htaccess "order" Deny, Allow, Deny

I would like to allow only one country access, but exclude proxies within this country. This is what I have (shortened version for convenience) <Limit GET POST> order deny,allow deny from all ..

How to use pip on windows behind an authenticating proxy

My computer is running windows behind a proxy on a windows server (using active directory), and I can't figure out how to get through it with pip (in python3). I have tried using --proxy, but it stil..

Proxies with Python 'Requests' module

Just a short, simple one about the excellent Requests module for Python. I can't seem to find in the documentation what the variable 'proxies' should contain. When I send it a dict with a standard "I..

Maven plugin not using Eclipse's proxy settings

I am using springsource tool suite 2.7.2, based on Eclipse 3.7. The Maven plugin comes now out of the box with Eclipse which is great, and this problem occurred even with previous version of Eclipse. ..

inject bean reference into a Quartz job in Spring?

I managed to configure and schedule a Quartz job using JobStoreTX persistent store in Spring. I do not use Spring's Quartz jobs, because I need to schedule them dynamically, at run time, and all exam..

How to preserve request url with nginx proxy_pass

I was trying to use Thin app server and had one issue. When nginx proxies the request to Thin (or Unicorn) using proxy_pass http://my_app_upstream; the application receives the modified URL sent by n..

Strange Jackson exception being thrown when serializing Hibernate object

Jackson is throwing a weird exception that I don't know how to fix. I'm using Spring, Hibernate and Jackson. I have already considered that lazy-loading is causing the problem, but I have taken measu..

Why am I getting "(304) Not Modified" error on some links when using HttpWebRequest?

Any ideas why on some links that I try to access using HttpWebRequest I am getting "The remote server returned an error: (304) Not Modified." in the code? The code I'm using is from Jeff's post here ..

How to convert a Hibernate proxy to a real entity object

During a Hibernate Session, I am loading some objects and some of them are loaded as proxies due to lazy loading. It's all OK and I don't want to turn lazy loading off. But later I need to send some ..

What is the most accurate way to retrieve a user's correct IP address in PHP?

I know there are a plethora of $_SERVER variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to most accurately retrieve a user's real IP add..

Eclipse 3.5 Unable to install plugins

I really don't know what's going on with Eclipse 3.5 (3.5.0 or 3.5.1, same issues), but it's been now 2 days that I'm struggling with Eclipse to find a way to make the plugins installation work via th..

Proxy with urllib2

I open urls with: site = urllib2.urlopen('http://google.com') And what I want to do is connect the same way with a proxy I got somewhere telling me: site = urllib2.urlopen('http://google.com', prox..

Spring - @Transactional - What happens in background?

I want to know what actually happens when you annotate a method with @Transactional? Of course, I know that Spring will wrap that method in a Transaction. But, I have the following doubts: I heard ..

How do I solve this error, "error while trying to deserialize parameter"

I have a web service that is working fine in one environment but not in another. The web service gets document meta data from SharePoint, it running on a server where I cant debug but with logging I ..

Interface naming in Java

Most OO languages prefix their interface names with a capital I, why does Java not do this? What was the rationale for not following this convention? To demonstrate what I mean, if I wanted to have ..

How to make sure you don't get WCF Faulted state exception?

I am getting this exception: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. The WCF service us..

HTTP 1.0 vs 1.1

Could somebody give me a brief overview of the differences between HTTP 1.0 and HTTP 1.1? I've spent some time with both of the RFCs, but haven't been able to pull out a lot of difference between the..

Linux command (like cat) to read a specified quantity of characters

Is there a command like cat in linux which can return a specified quantity of characters from a file? e.g., I have a text file like: Hello world this is the second line this is the third line And ..

How do I check (at runtime) if one class is a subclass of another?

Let's say that I have a class Suit and four subclasses of suit: Heart, Spade, Diamond, Club. class Suit: ... class Heart(Suit): ... class Spade(Suit): ... class Diamond(Suit): ... class C..

Error in spring application context schema

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

Using true and false in C

As far as I can see there are 3 ways to use booleans in c with the bool type, from then using true and false defining using preprocessor #define FALSE 0 ... #define TRUE !(FALSE) Just to use consta..

Can I set max_retries for requests.request?

The Python requests module is simple and elegant but one thing bugs me. It is possible to get a requests.exception.ConnectionError with a message like: Max retries exceeded with url: ... This impli..

How to get the values of a ConfigurationSection of type NameValueSectionHandler

I'm working with C#, Framework 3.5 (VS 2008). I'm using the ConfigurationManager to load a config (not the default app.config file) into a Configuration object. Using the Configuration class, I was ..

HTML5 <video> element on Android

According to: http://developer.android.com/sdk/android-2.0-highlights.html Android 2.0 should support the HTML5 video element. I haven't been able to get this to work using a Motorola Droid, and hav..

JQuery Bootstrap Multiselect plugin - Set a value as selected in the multiselect dropdown

I am having a multiselect dropdown using the Boostrap Multiselect plugin (http://davidstutz.de/bootstrap-multiselect/) as below <select id="data" name="data" class="data" multiple="multiple"> ..

Deleting objects from an ArrayList in Java

I need to delete some objects from an ArrayList if they meet a condition and I'm wondering which way could be more efficient. Here's the situation: I have a class that contains an ArrayList containin..

In SQL Server, what does "SET ANSI_NULLS ON" mean?

The definition says: When SET ANSI_NULLS is ON, a SELECT statement that uses WHERE column_name = NULL returns zero rows even if there are null values in column_name. A SELECT statement that uses W..

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

Why is textarea filled with mysterious white spaces?

I have a simple text area in a form like this: <textarea style="width:350px; height:80px;" cols="42" rows="5" name="sitelink"> <?php if($siteLink_val) echo $siteLink_val; ?> </tex..

How to convert BigInteger to String in java

I converted a String to BigInteger as follows: Scanner sc=new Scanner(System.in); System.out.println("enter the message"); String msg=sc.next(); byte[] bytemsg=msg.getBytes(); BigInteger m=new BigInt..

how do you filter pandas dataframes by multiple columns

To filter a dataframe (df) by a single column, if we consider data with male and females we might: males = df[df[Gender]=='Male'] Question 1 - But what if the data spanned multiple years and i want..

How to make image hover in css?

I want to change the image from normal to brighter when it's on hover, My code: <div class="nkhome"> <a href="Home.html"><img src="Images/btnhome.png" /></a> &..

Determine a string's encoding in C#

Is there any way to determine a string's encoding in C#? Say, I have a filename string, but I don't know if it is encoded in Unicode UTF-16 or the system-default encoding, how do I find out?..

How to insert data using wpdb

I have wriiten as following $name="Kumkum"; $email="[email protected]"; $phone="3456734567"; $country="India"; $course="Database"; $message="hello i want to read db"; $now = new DateTime(); $datesent..

How to concatenate a std::string and an int?

I thought this would be really simple but it's presenting some difficulties. If I have std::string name = "John"; int age = 21; How do I combine them to get a single string "John21"?..

ORA-01843 not a valid month- Comparing Dates

I have a problem when try to select data from a table filtering by date. For example: SELECT * FROM MYTABLE WHERE MYTABLE.DATEIN = '23/04/49'; The Oracle Error is: Informe de error: Error SQ..

Add Variables to Tuple

I am learning Python and creating a database connection. While trying to add to the DB, I am thinking of creating tuples out of information and then add them to the DB. What I am Doing: I am taking ..

Warning: push.default is unset; its implicit value is changing in Git 2.0

I've been using Git for a while now and have recently downloaded an update only to find this warning message come up when I try to push. warning: push.default is unset; its implicit value is changing..

How to delete the top 1000 rows from a table using Sql Server 2008?

I have a table in SQL Server. I would like to delete the top 1000 rows from it. However, I tried this, but I instead of just deleting the top 1000 rows it deleted all the rows in the table. Here is..

Find the number of columns in a table

It is possible to find the number of rows in a table: select count(*) from tablename Is it possible to find the number of columns in a table?..

Subtract days, months, years from a date in JavaScript

Does anybody know of a simple way of taking a date (e.g. Today) and going back X days, X months and X years? I have tried that: var date = new Date(); $("#searchDateFrom").val((date.getMonth() -1 ) ..

git push rejected: error: failed to push some refs

I know people have asked similar questions, but I believe the causes of their problems to be different. I did a hard reset because I had messed up my code pretty bad git reset --hard 41651df8fc9 ..

Amazon S3 boto - how to create a folder?

How can I create a folder under a bucket using boto library for Amazon s3? I followed the manual, and created the keys with permission, metadata etc, but no where in the boto's documentation it des..

'cl' is not recognized as an internal or external command,

I am trying to compile a hello world program in Qt Using Qt Creator. I am getting 'cl' is not recognized as an internal or external command. I am using Windows 7 and Both Vs 2008 and 2010 installed ..

How to check if a file exists in the Documents directory in Swift?

How to check if a file exists in the Documents directory in Swift? I am using [ .writeFilePath ] method to save an image into the Documents directory and I want to load it every time the app is launc..

SQL Server Installation - What is the Installation Media Folder?

I am installing SQL Server 2008. I have installed .NET framework 3.5. Then I got folder SQL Server 2008 and performed following steps- I clicked configuration Tools. Then I clicked SQL Server Inst..

How do you migrate an IIS 7 site to another server?

I'm wondering what is the best practice for moving a website to another server (along with all settings, etc.) Manually recreate the site on the new server (not maintainable for obvious reasons) Cop..

How to add a ScrollBar to a Stackpanel

In my WPF application, I have a Stackpanel containing several controls inside them. How can I add a Scrollbar to this stackpanel...

What's the difference between @Component, @Repository & @Service annotations in Spring?

Can @Component, @Repository and @Service annotations be used interchangeably in Spring or do they provide any particular functionality besides acting as a notation device? In other words, if I have a..

Use StringFormat to add a string to a WPF XAML binding

I have a WPF 4 application that contains a TextBlock which has a one-way binding to an integer value (in this case, a temperature in degrees Celsius). The XAML looks like this: <TextBlock x:Name=..

How to fix missing dependency warning when using useEffect React Hook?

With React 16.8.6 (it was good on previous version 16.8.3), I get this error when I attempt to prevent an infinite loop on a fetch request ./src/components/BusinessesList.js Line 51: React Hook useEf..

How to format current time using a yyyyMMddHHmmss format?

I'm trying to format the current time using this format yyyyMMddHHmmss. t := time.Now() fmt.Println(t.Format("yyyyMMddHHmmss")) That is outputting: yyyyMMddHHmmss Any suggestions?..

How to set a DateTime variable in SQL Server 2008?

SQL Server 2008 is not doing what I expected with DateTime. It doesn't let me set DateTime variables, no matter what date format I use. When I execute: DECLARE @Test AS DATETIME SET @Test = 2011-02-..

Extract first item of each sublist

I am wondering what is the best way to extract the first item of each sublist in a list of lists and append it to a new list. So if I have: lst = [[a,b,c], [1,2,3], [x,y,z]] and I want to pull out ..

Checking if a folder exists (and creating folders) in Qt, C++

In Qt, how do I check if a given folder exists in the current directory? If it doesn't exist, how do I then create an empty folder?..

add Shadow on UIView using swift 3

prior swift 3 i was adding shadow in my UIView like this : //toolbar is an UIToolbar (UIView) toolbar.layer.masksToBounds = false toolbar.layer.shadowOffset = CGSize(width: -1, height: 1) toolbar.lay..

Is it not possible to stringify an Error using JSON.stringify?

Reproducing the problem I'm running into an issue when trying to pass error messages around using web sockets. I can replicate the issue I am facing using JSON.stringify to cater to a wider audience:..

How to invoke bash, run commands inside the new shell, and then give control back to user?

This must either be really simple or really complex, but I couldn't find anything about it... I am trying to open a new bash instance, then run a few commands inside it, and give the control back to t..

How can I get a Bootstrap column to span multiple rows?

I'm trying to figure out how to do the following grid with Bootstrap. I'm not sure how I'd create the box (number 1) that spans two rows. The boxes are generated programmatically in the order they a..

How can I clear console

As in the title. How can I clear console in C++?..

Difference between nVidia Quadro and Geforce cards?

I'm not a 3D or HPC guy, but I've been tasked with doing some research into those fields for a possible HPC application. Reading benchmarks, comparisons and specs between nVidia Quadro and Geforce car..

How to identify numpy types in python?

How can one reliably determine if an object has a numpy type? I realize that this question goes against the philosophy of duck typing, but idea is to make sure a function (which uses scipy and numpy)..

How to make a copy of an object in C#

Let's say that I have a class: class obj { int a; int b; } and then I have this code: obj myobj = new obj(){ a=1, b=2} obj myobj2 = myobj; Now the above code makes a reference to the first o..

How to display a "busy" indicator with jQuery?

How do I display a spinning "busy" indicator at a specific point in a web page? I want to start/stop the indicator when an Ajax request commences/completes. Is it really just a matter of showing/hid..

GitHub - failed to connect to github 443 windows/ Failed to connect to gitHub - No Error

Q - I installed git to get the latest version of Angular. When I tried to run git clone https://github.com/angular/angular-phonecat.git I got failed to connect to github 443 error I even tried g..

Apache: "AuthType not set!" 500 Error

It's been a while since I used the Apache httpd web server. I'm firing up a local server for a project and when I try to request localhost/index.html, I get a 500 error and I see this in the error lo..

How to expand/collapse a diff sections in Vimdiff?

I've started using vimdiff today, and wanted to do some of the things that I've taken for granted on Windows based diff editors (like expand/collapse a diff section, have full file expansion/only diff..

What exactly is an instance in Java?

What is the difference between an object, instance, and reference? They say that they have to create an instance to their application? What does that mean?..

How can I render HTML from another file in a React component?

Is it possible to render HTML from another file in a React component? I have tried the following, but it does not work: var React = require('react'); /* Template html */ var template = require('./t..

SQL SELECT everything after a certain character

I need to extract everything after the last '=' (http://www.domain.com?query=blablabla - > blablabla) but this query returns the entire strings. Where did I go wrong in here: SELECT RIGHT(supplier_re..

How to concatenate two layers in keras?

I have an example of a neural network with two layers. The first layer takes two arguments and has one output. The second should take one argument as result of the first layer and one additional argum..

How can I set a dynamic model name in AngularJS?

I want to populate a form with some dynamic questions (fiddle here): <div ng-app ng-controller="QuestionController"> <ul ng-repeat="question in Questions"> <li> ..

Breaking out of nested loops

Is there an easier way to break out of nested loops than throwing an exception? (In Perl, you can give labels to each loop and at least continue an outer loop.) for x in range(10): for y in ran..

How to format a QString?

I'd like to format a string for Qt label, I'm programming in C++ on Qt. In ObjC I would write something like: NSString *format=[NSString stringWithFormat: ... ]; How to do something like that in ..

Removing element from array in component state

I am trying to find the best way to remove an element from an array in the state of a component. Since I should not modify the this.state variable directly, is there a better way (more concise) to re..

Making custom right-click context menus for my web-app

I've a few websites like google-docs and map-quest that have custom drop down menus when you right-click. Somehow they override the browser's behavior of drop-down menu, and I'm now sure exactly how t..

How to send an object from one Android Activity to another using Intents?

How can I pass an object of a custom type from one Activity to another using the putExtra() method of the class Intent? ..

Default passwords of Oracle 11g?

I installed Oracle 11g. I didn't change the passwords for SYSTEM and SYS. However now I find that the default passwords do not work. Please help...

How can I easily view the contents of a datatable or dataview in the immediate window

Sometimes I will be at a breakpoint in my code and I want to view the contents of a DataTable variable (or a DataTable in a DataSet). The quick watch doesn't give you a very clear view of the contents..

What does the "no version information available" error from linux dynamic linker mean?

In our product we ship some linux binaries that dynamically link to system libraries like "libpam". On some customer systems we get the following error on stderr when the program runs: ./authpam: /l..

How to pause for specific amount of time? (Excel/VBA)

I have an Excel worksheet that has the following macro. I'd like to loop it every second but danged if I can find the function to do that. Isn't it possible? Sub Macro1() ' ' Macro1 Macro ' Do ..

PHP Fatal error: Cannot access empty property

I'm new to php and I have executed below code. <?php class my_class{ var $my_value = array(); function my_class ($value){ $this->my_value[] = $value; } function set_va..

How to add action listener that listens to multiple buttons

I'm trying to figure out what i am doing wrong with action listeners. I'm following multiple tutorials and yet netbeans and eclipse are giving me errors when im trying to use an action listener. Bel..

How to download a file from my server using SSH (using PuTTY on Windows)

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server. (Note I am already SSH'd into my server before typing this command. I've watched tutoria..

How do you resize a form to fit its content automatically?

I am trying to implement the following behaviour: On a form there is a tabcontrol. On that tabcontrol there is a treeview. To prevent scrollbars appearing, I would like the form to change its size ac..

How to make UIButton's text alignment center? Using IB

I can't set the title of UIButton using IB as center. My title is multi line.It is giving like this one But I want like this one I have given space in this but I don't want to do that. As it is no..

Git On Custom SSH Port

My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is the while I know I can give the port number when create a remote config,..

How to make a <div> appear in front of regular text/tables

I have been trying to make a DIV box appear in front of the text/tables that I have on a webpage. The DIV is made visible via a button press; but when visible it automatically moves the text/table do..

Explaining Apache ZooKeeper

I am trying to understand ZooKeeper, how it works and what it does. Is there any application which is comparable to ZooKeeper? If you know, then how would you describe ZooKeeper to a layman? I have..

When do you use varargs in Java?

I'm afraid of varargs. I don't know what to use them for. Plus, it feels dangerous to let people pass as many arguments as they want. What's an example of a context that would be a good place to u..

ASP.NET MVC Ajax Error handling

How do I handle exceptions thrown in a controller when jquery ajax calls an action? For example, I would like a global javascript code that gets executed on any kind of server exception during an aja..

Date Comparison using Java

I have two dates: toDate (user input in MM/dd/yyyy format) currentDate (obtained by new Date()) I need to compare the currentDate with toDate. I have to display a report only when the toDate is e..

JQuery - $ is not defined

I have a simple jquery click event <script type="text/javascript"> $(function() { $('#post').click(function() { alert("test"); }); }); &l..

Resizing a button

I have a "button" that I wish to use all throughout my site, but depending on where in the site the button is, I want it to display at different sizes. In my HTML I have tried (but its not working):..

JQuery, Spring MVC @RequestBody and JSON - making it work together

I would like to have a bidirectional JSON to Java serialization I'm using successfully the Java to JSON to JQuery path... (@ResponseBody) e.g. @RequestMapping(value={"/fooBar/{id}"}, method=Request..

Swift - How to detect orientation changes

I want to add two images to single image view (i.e for landscape one image and for portrait another image)but i don't know how to detect orientation changes using swift languages. I tried this answer..

creating custom tableview cells in swift

I have a custom cell class with a couple of IBOutlets. I have added the class to the storyboard. I have connected all my outlets. my cellForRowAtIndexPath function looks like this: override func tabl..

how to get selected row value in the KendoUI

I have a kendoUI grid. @(Html.Kendo().Grid<EntityVM>() .Name("EntitesGrid") .HtmlAttributes(new { style = "height:750px;width..

The container 'Maven Dependencies' references non existing library - STS

I'm using win8 previously I had been running Eclipse Juno on my pc but from now on I wanted to start using STS, I am getting the below error as soon as I create a new project. I deleted my .m2 folder ..

How does one reorder columns in a data frame?

How would one change this input (with the sequence: time, in, out, files): Time In Out Files 1 2 3 4 2 3 4 5 To this output (with the sequence: time, out, in, files)? ..

String.equals() with multiple conditions (and one action on result)

Is it possible to do something like this in Java for Android (this is a pseudo code) IF (some_string.equals("john" OR "mary" OR "peter" OR "etc."){ THEN do something } ? At the moment this is d..

How to delete all files older than 3 days when "Argument list too long"?

I've got a log file directory that has 82000 files and directories in it (about half and half). I need to delete all the file and directories which are older than 3 days. In a directory that has 370..

Reading my own Jar's Manifest

I need to read the Manifest file, which delivered my class, but when I use: getClass().getClassLoader().getResources(...) I get the MANIFEST from the first .jar loaded into the Java Runtime. My app..

Getting the first character of a string with $str[0]

I want to get the first letter of a string and I've noticed that $str[0] works great. I am just not sure whether this is 'good practice', as that notation is generally used with arrays. This feature d..

How to print the values of slices

I want to see the values which are in the slice. How can I print them? projects []Project ..

Android selector & text color

I want a simple TextView to behave the way simple_list_item_1 in a ListView does. Here's the XML: <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wr..

Pass a password to ssh in pure bash

I want to pass a password to ssh using a bash script (Yes, I know that there are ssh keys that I could use, but this is not what I intend). I found some solutions that were using expect but since it ..

How to index an element of a list object in R

I'm doing the following in order to import some txt tables and keep them as list: # set working directory - the folder where all selection tables are stored hypo_selections<-list.files() # change ..

Auto-Submit Form using JavaScript

<form name="myForm" id="myForm" action="test.php" method="POST"> <p> <input name="test" value="test" /> </p> <p> <input type="submit" name="submit" value="..

html div onclick event

I have one html div on my jsp page, on that i have put one anchor tag, please find code below for that, <div class="expandable-panel-heading"> <h2> <a id="ancherComplaint..

The term 'ng' is not recognized as the name of a cmdlet

Today, while working through some basic AngularJS Intro, I ran into a problem. I opened PowerShell to get going on the project. NPM worked. I was able to install the Angular using: npm install -g ..

How do I get the backtrace for all the threads in GDB?

Is there an equivalent command in GDB to that of WinDbg's "!process 0 7"? I want to extract all the threads in a dump file along with their backtraces in GDB. "info threads" doesn't output the stack ..

phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin

I have installed MySQL server enterprise 5.1 on my local machine and now I want to install phpMyAdmin, but it does not work. I have unrared phpMyAdmin to my server root directory and browsed to "loca..

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

How to get past the login page with Wget?

I am trying to use Wget to download a page, but I cannot get past the login screen. How do I send the username/password using post data on the login page and then download the actual page as an authe..

IndexError: too many indices for array

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

Javascript ES6/ES5 find in array and change

I have an array of objects. I want to find by some field, and then to change it: var item = {...} var items = [{id:2}, {id:2}, {id:2}]; var foundItem = items.find(x => x.id == item.id); foundItem..

How can I write data attributes using Angular?

When I try to use a data attribute in my template, like this: <ol class="viewer-nav"> <li *ngFor="#section of sections" data-value="{{ section.value }}"> ..

How to checkout a specific Subversion revision from the command line?

I want to checkout a specific revision of a folder in Subversion using the command line. I don't see an option for specifying the revision number in TortoiseProc.exe, TortoiseProc.exe /command:check..

SQLite: How do I save the result of a query as a CSV file?

I'm new to SQLite. Is there a way I can export the results of a query into a CSV file?..

Vertical (rotated) text in HTML table

Is there a (portable) way to rotate text in a HTML table cell by 90°? (I have a table with many columns and much text for the headings, so I'd like to write it vertically to save space.)..

Failed to run sdkmanager --list with Java 9

I downloaded and installed: JDK (jdk-9.0.1_osx-x64_bin.dmg) from Oracle here Android SDK (sdk-tools-darwin-3859397.zip) from Google here. After configuring the PATH variable, I tried running sdkma..

Hibernate show real SQL

if I set <property name="show_sql">true</property> in my hibernate.cfg.xml configuration file in the console I can see the SQL. But it's not real SQL... Can I see the SQL code that wil..

How to trim a string to N chars in Javascript?

How can I, using Javascript, make a function that will trim string passed as argument, to a specified length, also passed as argument. For example: var string = "this is a string"; var length = 6; va..

Why is Dictionary preferred over Hashtable in C#?

In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that?..

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 to delete a specific line in a file?

Let's say I have a text file full of nicknames. How can I delete a specific nickname from this file, using Python?..

How to create a date object from string in javascript

Having this string 30/11/2011. I want to convert it to date object. Do I need to use : Date d = new Date(2011,11,30); /* months 1..12? */ or Date d = new Date(2011,10,30); /* months 0..11..

Representing null in JSON

What is the preferred method for returning null values in JSON? Is there a different preference for primitives? For example, if my object on the server has an Integer called "myCount" with n..

After installing SQL Server 2014 Express can't find local db

I have downloaded and installed SQL Server 2014 Express (from this site: http://www.microsoft.com/en-us/server-cloud/products/sql-server-editions/sql-server-express.aspx#Installation_Options). The pr..

How can I set the value of a DropDownList using jQuery?

As the question says, how do I set the value of a DropDownList control using jQuery?..

Generate random string/characters in JavaScript

I want a 5 character string composed of characters picked randomly from the set [a-zA-Z0-9]. What's the best way to do this with JavaScript?..

python global name 'self' is not defined

Just started learning python and I am sure its a stupid question but I am trying something like this: def setavalue(self): self.myname = "harry" def printaname(): print "Name..

uppercase first character in a variable with bash

I want to uppercase just the first character in my string with bash. foo="bar"; //uppercase first character echo $foo; should print "Bar";..

WARNING: Can't verify CSRF token authenticity rails

I am sending data from view to controller with AJAXand I got this error: WARNING: Can't verify CSRF token authenticity I think I have to send this token with data. Does anyone know how can I do..

Git status shows files as changed even though contents are the same

I received a git checkout from someone else and am trying to commit the unstaged changes to the local repository. However, a lot (if not every) file appears as modified even though the contents are ex..

Angular 2 Routing run in new tab

I am working with a asp.net core application with angular2 and my routing is working fine. <a target="target" routerLink="/page1" routerLinkActive="active">Associates</a> <a routerLin..

How to call a mysql stored procedure, with arguments, from command line?

How can I call a stored procedure from command line? I have a procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `insertEvent`(IN `dateTimeIN` DATETIME) NO SQL BEGIN SET @eventIDOut = NU..

Installing MySQL in Docker fails with error message "Can't connect to local MySQL server through socket"

I'm trying to install mysql inside a docker container,Tried various images from github, it seems they all manage to successfully install the mysql but when I try to run the mysql it gives an error: ..

How can I make a HTML a href hyperlink open a new window?

This is my code: <a href="http://www.google.com" onClick="window.location.href='http://www.yahoo.com';return false;" target="_blank">test</a> When you click it, it takes you to Yahoo bu..

Error in Python script "Expected 2D array, got 1D array instead:"?

I'm following this tutorial to make this ML prediction: import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use("ggplot") from sklearn import svm x = [1, 5, 1.5, 8..

How to add to an NSDictionary

I was using a NSMutableArray and realized that using a dictionary is a lot simpler for what I am trying to achieve. I want to save a key as a NSString and a value as an int in the dictionary. How is ..

How do you detect the clearing of a "search" HTML5 input?

In HTML5, the search input type appears with a little X on the right that will clear the textbox (at least in Chrome, maybe others). Is there a way to detect when this X is clicked in Javascript or jQ..

$(document).ready shorthand

Is the following shorthand for $(document).ready? (function($){ //some code })(jQuery); I see this pattern used a lot, but I'm unable to find any reference to it. If it is shorthand for $(documen..

AngularJS: How to make angular load script inside ng-include?

Hey I am building a web page with angular. The problem is that there are somethings already build without angular and I have to include them as well The problem is this. I have something like this i..

Image comparison - fast algorithm

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

Determine number of pages in a PDF file

I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from an URL. Does anyone have any idea on how this c..

Appending a line break to an output file in a shell script

I have a shell script that I am executing in Cygwin (maybe this is the problem). For this bit of code, I simply want to write the first line, and append a line break: echo "`date` User `whoami` start..

Scanner only reads first word instead of line

In my current program one method asks the user to enter the description of a product as a String input. However, when I later attempt to print out this information, only the first word of the String s..

How can I view the source code for a function?

I want to look at the source code for a function to see how it works. I know I can print a function by typing its name at the prompt: > t function (x) UseMethod("t") <bytecode: 0x2332948> &..

Check if item is in an array / list

If I've got an array of strings, can I check to see if a string is in the array without doing a for loop? Specifically, I'm looking for a way to do it within an if statement, so something like this: ..

Classpath including JAR within a JAR

Is it possible to specify a Java classpath that includes a JAR file contained within another JAR file?..

Solution to "subquery returns more than 1 row" error

I have one query that returns multiple rows, and another query in which I want to set criteria to be either one of values from those multiple rows , so basicly I want the subquery to look something li..

How to set fake GPS location on IOS real device

Currently I have to test app and set the different fake GPS locations on real IOS 7 devices. On Android I use 'My Fake Location'. Unfortunately, I didn't find the same app for IOS 7. Any ideas to sol..

Split string with PowerShell and do something with each token

I want to split each line of a pipe on spaces, and then print each token on its own line. I realise that I can get this result using: (cat someFileInsteadOfAPipe).split(" ") But I want more flexib..

What is the difference between 0.0.0.0, 127.0.0.1 and localhost?

I am using Jekyll and Vagrant on my mac. I found that Jekyll server will bind to 0.0.0.0:4000 instead of 127.0.0.1:4000. Also gem server will bind to this address by default. I can still visit it via ..

How to overwrite the previous print to stdout in python?

If I had the following code: for x in range(10): print x I would get the output of 1 2 etc.. What I would like to do is instead of printing a newline, I want to replace the previous value a..

How to auto adjust the div size for all mobile / tablet display formats?

I have designed a page where four div tags are there in the page. If I test the page in mobile phone (5 inch) it fits the page perfectly, If I test the same page in tablet the page fits with in 30% of..

Warp \ bend effect on a UIView?

I'm trying to get a similar effect to the one described in the pictures. The white area on the left isn't on the original photo, it pushes the pixels away. I've tried using Core Image (which offered a..

Connect to network drive with user name and password

How do I supply credential so that I can connect to a network drive in .NET? I’m trying to retrieve files from a network drive and need to supply user credentials to access the drive...

How can you make a custom keyboard in Android?

I want to make a custom keyboard. I don't know how to do it using XML and Java. The following picture is a model of the keyboard I want to make. It only needs numbers. ..

Debugging doesn't start

When I hit F5 (debugging mode) nothing happens. Building works correctly, exe file I can launch properly, but can't start debug. Why?..

not None test in Python

Out of these not None tests. if val != None: if not (val is None): if val is not None: Which one is preferable, and why?..

Get child node index

In straight up javascript (i.e., no extensions such as jQuery, etc.), is there a way to determine a child node's index inside of its parent node without iterating over and comparing all children nodes..

Parameter binding on left joins with array in Laravel Query Builder

I trying to do a left join with where IN clause search. But I couldn't able to bind the array to the query. $query = DB::table('offers'); $query->select('id', 'business_id', 'address_id',..

Stick button to right side of div

http://jsfiddle.net/kn5sH/ What do I need to add in order to stick the button to the right side of the div on the same line as the header? HTML: <div> <h1> Ok </h1> <bu..

Golang append an item to a slice

Why does the slice a remain the same? Does append() generate a new slice? package main import ( "fmt" ) var a = make([]int, 7, 8) func Test(slice []int) { slice = append(slice, 100) fm..

Simplest Way to Test ODBC on WIndows

With unixODBC you can use a simple command line utility called "isql" to test your connection and permissions of some queries. Without having to write extra code or install libs or bloated programs, i..

Make a negative number positive

I have a Java method in which I'm summing a set of numbers. However, I want any negatives numbers to be treated as positives. So (1)+(2)+(1)+(-1) should equal 5. I'm sure there is very easy way of d..

How to extract a substring using regex

I have a string that has two single quotes in it, the ' character. In between the single quotes is the data I want. How can I write a regex to extract "the data i want" from the following text? myda..

Is it possible to return empty in react render function?

I have a notification component, and I have a timeout setting for it. After timeout I call this.setState({isTimeout:true}). What I want to do is if already timeout, I want just render nothing: render(..

android - save image into gallery

i have an app with a gallery of images and i want that the user can save it into his own gallery. I've created an option menu with a single voice "save" to allow that but the problem is...how can i sa..

PHP function ssh2_connect is not working

Following is my script: <?php $connection = ssh2_connect('XX.XX.XX.XX', 22); ssh2_auth_password($connection, 'root', '******'); $stream = ssh2_exec($connection, 'useradd -d /ho..

print spaces with String.format()

how I can rewrite this: for (int i = 0; i < numberOfSpaces; i++) { System.out.print(" "); } using String.format()? PS I'm pretty sure that this is possible but the javadoc is a bit confusi..

Linq on DataTable: select specific column into datatable, not whole table

I'm running a LINQ query on a datatable in c#. I want to select specific columns rather than the whole row and enter the result into a datatable. How can i do that?? My Code: public DataTable getCo..

How do the major C# DI/IoC frameworks compare?

At the risk of stepping into holy war territory, What are the strengths and weaknesses of these popular DI/IoC frameworks, and could one easily be considered the best? ..: Ninject Unity Castle.Wind..

Slide a layout up from bottom of screen

I have a layout hidden from the view. On a button click I want it to slide up from the bottom pushing the entire screen contents upwards, very similar to how whatsapp shows emoticons panel in chat scr..

How do I compile and run a program in Java on my Mac?

How do I compile and run a program in Java on my mac? I'm new. Also I downloaded a program that was suggested to me on here called text wrangler if that has any bearing on the situation. ..

Why is setState in reactjs Async instead of Sync?

I have just found that in react this.setState() function in any component is asynchronous or is called after the completion of the function that it was called in. Now I searched and found this blog (..

Changing default encoding of Python?

I have many "can't encode" and "can't decode" problems with Python when I run my applications from the console. But in the Eclipse PyDev IDE, the default character encoding is set to UTF-8, and I'm fi..

'Linker command failed with exit code 1' when using Google Analytics via CocoaPods

I'm trying to add Google Analytics to an iOS app written in Swift. I've followed the guide that adds the frameworks via CocoaPods and added a bridging header but I'm still getting: Linker command fai..

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

What's the difference between window.location= and window.location.replace()?

Is there a difference between these two lines? var url = "http://www.google.com/"; window.location = url; window.location.replace(url); ..

Calculate percentage saved between two numbers?

I have two numbers, the first, is the original price, the second, is the discounted price. I need to work out what percentage a user saves if they purchase at the second price. example 25, 10 = 60%..

In Gradle, is there a better way to get Environment Variables?

In several Tasks, I reference jars in my home folder. Is there a better way to get Environment Variables than ENV = System.getenv() HOME = ENV['HOME'] task copyToServer(dependsOn: 'jar', type: Copy..

How can I get the values of data attributes in JavaScript code?

I have next html: <span data-typeId="123" data-type="topic" data-points="-1" data-important="true" id="the-span"></span> Is it possi..

WCF Error - Could not find default endpoint element that references contract 'UserService.UserService'

Any ideas how to fix this? UserService.UserServiceClient userServiceClient = new UserServiceClient(); userServiceClient.GetUsersCompleted += new EventHandler<GetUsersCompletedEventArgs..

Terminal Commands: For loop with echo

I've never used commands in terminal like this before but I know its possible. How would I for instance write: for (int i = 0; i <=1000; i++) { echo "http://example.com/%i.jpg",i } ..

How to change the CHARACTER SET (and COLLATION) throughout a database?

Our previous programmer set the wrong collation in a table (Mysql). He set it up with Latin collation, when it should be UTF8, and now I have issues. Every record with Chinese and Japan character turn..

Pandas aggregate count distinct

Let's say I have a log of user activity and I want to generate a report of total duration and the number of unique users per day. import numpy as np import pandas as pd df = pd.DataFrame({'date': ['2..

Alternative to a goto statement in Java

What is an alternative function for the goto keyword in Java? Since Java does not have a goto...

Testing whether a value is odd or even

I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return i..

pip install failing with: OSError: [Errno 13] Permission denied on directory

pip install -r requirements.txt fails with the exception below OSError: [Errno 13] Permission denied: '/usr/local/lib/.... What's wrong and how do I fix this? (I am trying to setup Django) Installing..

How can I specify the schema to run an sql file against in the Postgresql command line

I run scripts against my database like this... psql -d myDataBase -a -f myInsertFile.sql The only problem is I want to be able to specify in this command what schema to run the script against. I c..

Get href attribute on jQuery

I have some table rows <tr class="b_row"> <td> <div class="cpt"> <h2> <a href="/ref/ref/1.html">example</a> <..

How to use Apple's new San Francisco font on a webpage

I'd like to use the new San Francisco font on a site. I've tried: font: 'San Francisco', Helvetica, Arial, san-serif; to no avail. I have tried the answers to this question, but @font-face is not t..

How to create an array containing 1...N

I'm looking for any alternatives to the below for creating a JavaScript array containing 1 through to N where N is only known at runtime. var foo = []; for (var i = 1; i <= N; i++) { foo.push(i..

IF...THEN...ELSE using XML

I have a program that uses XML formatted rules to create executable code for run-time. I have to define some actions and logical constructs using my own dialect. I have OR, AND, and NOT constructs and..

How to create file object from URL object (image)

I need to create a File object from URL object My requirement is I need to create a file object of a web image (say googles logo) URL url = new URL("http://google.com/pathtoaimage.jpg"); File f = c..

PostgreSQL column 'foo' does not exist

I have a table that has 20 integer columns and 1 text column named 'foo' If I run query: SELECT * from table_name where foo is NULL I get error: ERROR: column "foo" does not exist I have check..

Checking if my Windows application is running

How do I check if my C# Windows application is running ? I know that I can check the process name but the name can be changed if the exe changes. Is there any way to have a hash key or something to..

How can I find which tables reference a given table in Oracle SQL Developer?

In Oracle SQL Developer, if I'm viewing the information on a table, I can view the constraints, which let me see the foreign keys (and thus which tables are referenced by this table), and I can view t..

How to refresh app upon shaking the device?

I need to add a shake feature that will refresh my Android application. All I find of documentation involves implementing the SensorListener, but Eclipse tells me it's deprecated and suggest SensorEv..

Warn user before leaving web page with unsaved changes

I have some pages with forms in my application. How can I secure the form in such a way that if someone navigates away or closes the browser tab, they should be prompted to to confirm they really wa..

How do I force a DIV block to extend to the bottom of a page even if it has no content?

In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so..

XSL xsl:template match="/"

I am just learning XML and how to use XSL files. In an XSL file I found the following term: xsl:template match="/" What does this stand for? And what could I use instead of the /? Could I write tab..

Checking if a website is up via Python

By using python, how can I check if a website is up? From what I read, I need to check the "HTTP HEAD" and see status code "200 OK", but how to do so ? Cheers Related How do you s..

Angular 4 img src is not found

I'm having a problem with sourcing an image with angular 4. It keeps telling me that the image is not found. Folder structure: app_folder/ app_component/ - my_componenet - image_folder/ - ..

Best practice multi language website

I've been struggling with this question for quite some months now, but I haven't been in a situation that I needed to explore all possible options before. Right now, I feel like it's time to get to kn..

get and set in TypeScript

I'm trying to create get and set method for a property: private _name: string; Name() { get: { return this._name; } set: { this._name = ???; } } What's the ..

How to determine CPU and memory consumption from inside a process?

I once had the task of determining the following performance parameters from inside a running application: Total virtual memory available Virtual memory currently used Virtual memory currently used ..

When should I use git pull --rebase?

I know of some people who use git pull --rebase by default and others who insist never to use it. I believe I understand the difference between merging and rebasing, but I'm trying to put this in the..

How to manually include external aar package using new Gradle Android Build System

I've been experimenting with the new android build system and I've run into a small issue. I've compiled my own aar package of ActionBarSherlock which I've called 'actionbarsherlock.aar'. What I'm t..

Foreign key referring to primary keys across multiple tables?

I have to two tables namely employees_ce and employees_sn under the database employees. They both have their respective unique primary key columns. I have another table called deductions, whose fo..

How do I format date value as yyyy-mm-dd using SSIS expression builder?

hi I have taking flatfile source name dynamically I.e. filename like "source 2011-08-11" I'm creating expression builder for taking most recent file as per filename. I did like Created one variable wh..

How to convert a file into a dictionary?

I have a file comprising two columns, i.e., 1 a 2 b 3 c I wish to read this file to a dictionary such that column 1 is the key and column 2 is the value, i.e., d = {1:'a', 2:'b', 3:'c'} The f..

How to center the text in a JLabel?

despite many tries I can't get the result that I would like to see - text centered within the JLabel and the JLabel somewhat centered in the BorderLayout. I said "somewhat" because there should be als..