Questions Tagged with #Git remote

git-remote is a command used to manage the set of tracked remote repositories.

Git push error: "origin does not appear to be a git repository"

I am following the instructions given here to create a Git repository. All went well until the last line: $ git push -u origin master fatal: 'origin' does not appear to be a git repository ..

Git - What is the difference between push.default "matching" and "simple"

I have been using git for a while now, but I have never had to set up a new remote repo myself and I have been curious on doing so. I have been reading tutorials and I am confused on how to get "git p..

Find out which remote branch a local branch is tracking

See also: How can I see which Git branches are tracking which remote / upstream branch? How can I find out which remote branch a local branch is tracking? Do I need to parse git config outp..

Git branching: master vs. origin/master vs. remotes/origin/master

I think I'm on the right track to understand the basic concepts of git. I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local reposito..

How to change the URI (URL) for a remote Git repository?

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and successfully tested cloning it from here. I would like to know if I can change the URI of "or..

Remote origin already exists on 'git push' to a new repository

I have my project on GitHub at some location, [email protected]:myname/oldrep.git. Now I want to push all my code to a new repository at some other location, [email protected]:newname/newrep.git. I used t..

Why does Git tell me "No such remote 'origin'" when I try to push to origin?

I am very new to Git; I only recently created a GitHub account. I've just tried to push my very first repository (a sample project), but I'm getting the following error: No such remote 'origin' I ..

How can I determine the URL that a local Git repository was originally cloned from?

I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitHub, and I neglected to note which one I took originally. How can I determine which of those for..

Changing the Git remote 'push to' default

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

How to update a git clone --mirror?

I have created a git repository to mirror a live site (which is a non-bare git repository): git clone --mirror ssh://[email protected]/path/to/repo Now, to keep this mirror clone updated with all ch..

How to pull remote branch from somebody else's repo

I've got a project hosted on GitHub which somebody has forked. On their fork, they've created a new branch "foo" and made some changes. How do I pull their "foo" into a new branch also named "foo" in..

fatal: does not appear to be a git repository

Why am I getting this error when my git repository url is correct? jitendra@JITENDRA-PC /c/mySite (master) $ git push beanstalk master fatal: '[email protected]/gittest.git' does not appear ..

How do I push a new local branch to a remote Git repository and track it too?

I want to be able to do the following: Create a local branch based on some other (remote or local) branch (via git branch or git checkout -b) Push the local branch to the remote repository (publish)..

git remote prune – didn't show as many pruned branches as I expected

From the man page: Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally..

How to add a local repo and treat it as a remote repo

I'm trying to make a local repo act as a remote with the name bak for another local repo on my PC, using the following: git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak which..

How can I find the location of origin/master in git, and how do I change it?

I'm a Git newbie. I recently moved a Rails project from Subversion to Git. I followed the tutorial here: http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-..

Change a Git remote HEAD to point to something besides master

How do I set a Git remote's HEAD reference to point to something besides "master"? My project has a policy not to use a "master" branch (all branches are to have meaningful names). Furthermore, the c..

How to connect to a remote Git repository?

I am working with a team and we want to use Git (Not with GitHub, we have a private remote machine). We were using SVN until now. We have a remote machine that works like an SVN repository. Now, we wa..

error: src refspec master does not match any

I have tried to follow the solutions suggested in this post but it didnt work and I am still getting: src refspec master does not match any. Here is what I did: Followed this solution // adding th..

How do I delete a Git branch locally and remotely?

I want to delete a branch both locally and remotely. Failed Attempts to Delete a Remote Branch $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d o..

What does '--set-upstream' do?

What does git --set-upstream do? I tried to understand it by reading the git manual, but I didn't quite get it. ..

Git: How to remove remote origin from Git repo

I just did git init to initialize my folder as git repo and then added a remote repository using git remote add origin url. Now I want to remove this git remote add origin and add a new repository git..

Uninstall Django completely

I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed. To rem..

Standard Android Button with a different color

I'd like to change the color of a standard Android button slightly in order to better match a client's branding. The best way I've found to do this so far is to change the Button's drawable to the dr..

How to select a schema in postgres when using psql?

I have a postgres database with multiple schemas. When I connect to the database from a shell with psql and I run \dt it uses the default connection schema which is public. Is there a flag I can speci..

JQuery get data from JSON array

This is part of the JSON i get from foursquare. JSON tips: { count: 2, groups: [ { type: "others", name: "Tips from others", count: 2, items: [ {..

django - get() returned more than one topic

When I tried to relate an attribute with another one which has an M to M relation I received this error: get() returned more than one topic -- it returned 2! Can you guys tell me what that means..

How to repeat last command in python interpreter shell?

How do I repeat the last command? The usual keys: Up, Ctrl+Up, Alt-p don't work. They produce nonsensical characters. (ve)[kakarukeys@localhost ve]$ python Python 2.6.6 (r266:84292, Nov 15 2010, 21:4..

Copy all values from fields in one class to another through reflection

I have a class which is basically a copy of another class. public class A { int a; String b; } public class CopyA { int a; String b; } What I am doing is putting values from class A into C..

PowerShell script to return members of multiple security groups

I need to return all members of multiple security groups using PowerShell. Handily, all of the groups start with the same letters. I can return a list of all the relevant security groups using the fo..

Setting the selected value on a Django forms.ChoiceField

Here is the field declaration in a form: max_number = forms.ChoiceField(widget = forms.Select(), choices = ([('1','1'), ('2','2'),('3','3'), ]), initial='3', required = True,) I would like to..

How do check if a parameter is empty or null in Sql Server stored procedure in IF statement?

I read this: How do I check if a Sql server string is null or empty but it not helped me in this situation. The piece of code from my stored procedure: IF (@item1 IS NOT NULL) OR (LEN(@item1) > 0..

How to send HTML-formatted email?

I could be able to let the web application sends automatic emails using Windows Task Scheduler. Now I want to send HTML-Formatted email using the following method that I wrote for sending emails. My ..

Is it possible to sort a ES6 map object?

Is it possible to sort the entries of a es6 map object? var map = new Map(); map.set('2-1', foo); map.set('0-1', bar); results in: map.entries = { 0: {"2-1", foo }, 1: {"0-1", bar } } Is..

How to get cookie expiration date / creation date from javascript?

Is it possible to retrieve the creation or expiration date of an existing cookie from javascript? If so how?..

Easiest way to copy a single file from host to Vagrant guest?

I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest. I don't want to do so via traditional provisioners (Puppet / Chef) because this is often a..

Gradients on UIView and UILabels On iPhone

Possible Duplicate: Manually drawing a gradient in iPhone apps? My application needs to display text in either a UIView or UILabel but the back ground must be a gradient as opposed to a tru..

Why is an OPTIONS request sent and can I disable it?

I am building a web API. I found whenever I use Chrome to POST, GET to my API, there is always an OPTIONS request sent before the real request, which is quite annoying. Currently I get the server to i..

Can you set a border opacity in CSS?

Is there a straight forward CSS way to make the border of an element semi-transparent with something like this? border-opacity: 0.7; If not, does anyone have an idea how I could do so without using..

How to find third or n?? maximum salary from salary table?

How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way?..

How to pass an array into a function, and return the results with an array

So I'm trying to learn how to pass arrays through a function, so that I can get around PHP's inability to return multiple values. Haven't been able to get anything to work so far, but here is my best ..

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25

I am getting issue while sending email. javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;..

ERROR Error: No value accessor for form control with unspecified name attribute on switch

Here is my component in Angular 4: @Component( { selector: 'input-extra-field', template: ` <div class="form-group" [formGroup]="formGroup" > <switch [att..

Broadcast Receiver within a Service

I am trying to start up a BroadcastReceiver within a Service. What I am trying to do is have a background running service going that collects incoming text messages, and logs incoming phone calls. I f..

Git push error pre-receive hook declined

I have run gitlabhq rails server on virtual machine, following 1-6 steps from this tutorial https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md and starts rails server exec..

IPython/Jupyter Problems saving notebook as PDF

So, i've been trying to save a jupyter notebook as PDF but i just can't figure out how to do this. The first thing i try is from the file menu just download as PDF, but doing that results in: nbconve..

Messages Using Command prompt in Windows 7

How to send message over network using command prompt in windows 7 ? ..

How to convert Nonetype to int or string?

I've got an Nonetype value x, it's generally a number, but could be None. I want to divide it by a number, but Python raises: TypeError: int() argument must be a string or a number, not 'NoneType' ..

How to sleep the thread in node.js without affecting other threads?

As per Understanding the node.js event loop, node.js supports a single thread model. That means if I make multiple requests to a node.js server, it won't spawn a new thread for each request but will e..

Run jar file with command line arguments

How can I run a jar file in command prompt and pass arguments to it. ie: "test.jar -get" would be entered in command prompt/terminal..

Can the "IN" operator use LIKE-wildcards (%) in Oracle?

I have searched this question, and found an answer in MySQL but this is one of those incidents where the statement fails to cross over into Oracle. Can I use wildcards in "IN" MySQL stateme..

How to get row count in an Excel file using POI library?

Guys I'm currently using the POI 3.9 library to work with excel files. I know of the getLastRowNum() function, which returns a number of rows in an Excel file. The only problem is getLastRowNum() ret..

How get total sum from input box values using Javascript?

I am not perfect in Javascript.. I want to show total sum of values entered in qty input boxes in next input box named total without refreshing page. Can anyone will help me to figure it out..? Here ..

Convert a video to MP4 (H.264/AAC) with ffmpeg

If I don't make a mistake, Safari currently need MP4 (H.264/AAC) video encoded for the HTML5 <video> element. So I tried to convert a video to this format with ffmpeg. However when I enter the ..

Is it possible to send a variable number of arguments to a JavaScript function?

Is it possible to send a variable number of arguments to a JavaScript function, from an array? var arr = ['a','b','c'] var func = function() { // debug alert(arguments.length); // ..

Sample database for exercise

I would like to play with a larger database to test my knowledge on SQL. Is there a huge .sql out there that I can use to play with SQL queries?..

Insert the same fixed value into multiple rows

I've got a table with a column, lets call it table_column that is currently null for all rows of the table. I'd like to insert the value "test" into that column for all rows. Can someone give me the..

How to increase heap size for jBoss server

I have an upload files scenario in my project. When I'm trying to upload the large files it's giving me an OutOfMemory error. That error is related to Java heap size. How can you increase the heap ..

Test if a string contains a word in PHP?

In SQL we have NOT LIKE %string% I need to do this in PHP. if ($string NOT LIKE %word%) { do something } I think that can be done with strpos() But can’t figure out how… I need exactly that ..

Check if all checkboxes are selected

How do I check if all checkboxes with class="abc" are selected? I need to check it every time one of them is checked or unchecked. Do I do it on click or change?..

Regex empty string or email

I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or email only? I want to hav..

How do I convert an existing callback API to promises?

I want to work with promises but I have a callback API in a format like: 1. DOM load or other one time event: window.onload; // set to callback ... window.onload = function() { }; 2. Plain callba..

Changing the interval of SetInterval while it's running

I have written a javascript function that uses setInterval to manipulate a string every tenth of a second for a certain number of iterations. function timer() { var section = document.getElementB..

SQL, How to convert VARCHAR to bigint?

I have a field that is VARCHAR(6) I am trying to insert it into another table of type bigint it is giving me an error (Error Converting from data type varchar to bigint here is what i am doing CON..

How to access array elements in a Django template?

I am getting an array arr passed to my Django template. I want to access individual elements of the array in the array (e.g. arr[0], arr[1]) etc. instead of looping through the whole array. Is there ..

a tag as a submit button?

Hi I am trying to get "a" tag as a submit button. I found a code somewhere in the web. But it didn't work. <a href="#" onclick="this.form.submit()">Submit</a> Is there any code for to ..

Floating point exception( core dump

Program: So I made a program that take two numbers, N and L. N is the size of a 2D array and L is a number from 3 - 16. The program builds the array and starts at the center and works its way out in a..

How to increase an array's length

I have a quick question. I have an integer array in java that needs its length to vary throughout the class. Specifically, I need it to increase by one in certain situations. I tried it like this. ..

BAT file: Open new cmd window and execute a command in there

I'm trying to open a new command window in a BAT file: start %windir%\system32\cmd.exe After it opens, I'd like to execute a BAT command in the new window: echo "test in new window" How can I do..

Send email using the GMail SMTP server from a PHP page

I am trying to send an email via GMail's SMTP server from a PHP page, but I get this error: authentication failure [SMTP: SMTP server does no support authentication (code: 250, response: mx.google..

Parameterize an SQL IN clause

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? SELECT * FROM Tags WHERE Name IN ('ruby','rails','scruffy','rubyonrails') ORDER BY Count DES..

Short form for Java if statement

I know there is a way for writing a Java if statement in short form. if (city.getName() != null) { name = city.getName(); } else { name="N/A"; } Does anyone know how to write the short form..

What port is a given program using?

I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on m..

How can I create a self-signed cert for localhost?

I've gone through the steps detailed in How do you use https / SSL on localhost? but this sets up a self-signed cert for my machine name, and when browsing it via https://localhost I receive the IE wa..

Git: How to squash all commits on branch

I make new branch from master with: git checkout -b testbranch I make 20 commits into it. Now I want to squash those 20 commits. I do that with: git rebase -i HEAD~20 What about if I don't kno..

What is the difference between aggregation, composition and dependency?

What is the difference between aggregation, composition and dependency?..

Best way to remove the last character from a string built with stringbuilder

I have the following data.AppendFormat("{0},",dataToAppend); The problem with this is that I am using it in a loop and there will be a trialling comma. What is the best way to remove the trailing ..

How to AUTO_INCREMENT in db2?

I thought this would be simple, but I can't seem to use AUTO_INCREMENT in my db2 database. I did some searching and people seem to be using "Generated by Default", but this doesn't work for me. I..

Angular2: Cannot read property 'name' of undefined

I am beginning to learn Angular2. I've been following the Heroes Tutorial provided at angular.io. All was working fine until, being annoyed by the clutter of HTML using the template, I used template ..

wampserver doesn't go green - stays orange

I am trying to install wampserver on a win7-32bit. The installation goes smoothly but the icon doesn't turn green. It stays orange saying "Server online". I've trying different solutions nothing worke..

How to make primary key as autoincrement for Room Persistence lib

I am creating an Entity (Room Persistence Library) class Food, where I want to make foodId as autoincrement. @Entity class Food(var foodName: String, var foodDesc: String, var protein: Double, var car..

SQLite - UPSERT *not* INSERT or REPLACE

http://en.wikipedia.org/wiki/Upsert Insert Update stored proc on SQL Server Is there some clever way to do this in SQLite that I have not thought of? Basically I want to update three out of four co..

How to serve up images in Angular2?

I am trying to put the relative path to one of my images in my assets folder in an image src tag in my Angular2 app. I set a variable in my component to 'fullImagePath' and used that in my template. I..

Where is the Query Analyzer in SQL Server Management Studio 2008 R2?

I have some SQL thats getting run and it is taking to long to return the results / parse / display, etc. in a asp.net c# application. I have SQL Server Management Studio 2008 R2 installed to connect ..

simulate background-size:cover on <video> or <img>

How can I simulate the functionality of background-size:cover on an html element like <video> or <img>? I'd like it to work like background-size: cover; background-position: center cente..

How can I verify if one list is a subset of another?

I need to verify if a list is a subset of another - a boolean return is all I seek. Is testing equality on the smaller list after an intersection the fastest way to do this? Performance is of utmost..

Getting java.net.SocketTimeoutException: Connection timed out in android

I'm relatively new to android development. I'm developing an android application where I'm sending requests to the web server and parsing JSON objects. Frequently I'm getting java.net.SocketTimeoutExc..

How to name Dockerfiles

I'm unsure of how to name Dockerfiles. Many on GitHub use Dockerfile without a file extension. Do I give them a name and extension; if so what? Or do I just call them Dockerfile?..

Bash mkdir and subfolders

Why I can't do something like this? mkdir folder/subfolder/ in order to achive this I have to do: mkdir folder cd folder mkdir subfolder Is there a better way to do it?..

Ruby 2.0.0p0 IRB warning: "DL is deprecated, please use Fiddle"

I just uninstalled my older versions of Ruby, removed all of my gems (including Rails), and installed Ruby 2.0. In other words, a totally clean re-install. Upon starting IRB, I received this message: ..

Waiting till the async task finish its work

I'm very new to programming and I have some doubts. I have a AsyncTask which is I call as RunInBackGround. and I start this process like: new RunInBackGround().execute(); But I wish to wait unt..

Find index of last occurrence of a sub-string using T-SQL

Is there a straightforward way of finding the index of the last occurrence of a string using SQL? I am using SQL Server 2000 right now. I basically need the functionality that the .NET System.String..

ORA-01652: unable to extend temp segment by 128 in tablespace SYSTEM: How to extend?

I have a large Oracle table, which contains 542512 rows. It has three columns and when I try to create an index for it with the following command: CREATE INDEX FTS_INDEX ON FILTERED_TEKLI_IIS_TABLO..

concatenate variables

I need to do a .bat for DOS that do the following: set ROOT = c:\programas\ set SRC_ROOT = (I want to put the ROOT Here)System\Source so after defining ROOT I want to have SRC_ROOT = c:\programas\S..

TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3

I've very recently migrated to Py 3.5. This code was working properly in Python 2.7: with open(fname, 'rb') as f: lines = [x.strip() for x in f.readlines()] for line in lines: tmp = line.str..

How to erase the file contents of text file in Python?

I have text file which I want to erase in Python. How do I do that?..

Single quotes vs. double quotes in C or C++

When should I use single quotes and double quotes in C or C++ programming?..

Git and nasty "error: cannot lock existing info/refs fatal"

After cloning from remote git repository (at bettercodes) I made some changes, commited and tried to push: git push origin master Errors with: error: cannot lock existing info/refs fatal: g..

Garbage collector in Android

I have seen many Android answers that suggest calling the garbage collector in some situations. Is it a good practice to request the garbage collector in Android before doing a memory-hungry operatio..

Split string to equal length substrings in Java

How to split the string "Thequickbrownfoxjumps" to substrings of equal size in Java. Eg. "Thequickbrownfoxjumps" of 4 equal size should give the output. ["Theq","uick","brow","nfox","jump","s"] Sim..

How to efficiently use try...catch blocks in PHP

I have been using try..catch blocks in my PHP code, but I'm not sure if I've been using them correctly. For example, some of my code looks like: try { $tableAresults = $dbHandler->doSometh..

Creating new table with SELECT INTO in SQL

Possible Duplicate: SELECT INTO using Oracle I have came across SQL SELECT INTO statement for creating new table and also dumping old table records into new table in single SQL statement as..

How can I remove space (margin) above HTML header?

I am creating a website. I have written the HTML part and now I am writing the stylesheet. But there is always some space above my header. How can I remove it? My HTML and CSS code is given below. ..

WPF Datagrid Get Selected Cell Value

I want to get value for selected cell in datagrid , please anyone tell how to do this. i used SelectedCell changed event , how can i do that? dataGrid1.CurrentCell ..

SELECT CONVERT(VARCHAR(10), GETDATE(), 110) what is the meaning of 110 here?

When we convert or cast date in sql, see below sql code SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY] it works fine, I just want to know the meaning of 110 in above code. what it doe..

How to force a SQL Server 2008 database to go Offline

How do I force my Database to go Offline, without regard to what or who is already using it? I tried: ALTER DATABASE database-name SET OFFLINE; But it's still hanging after 7 min. I want this bec..

How to strip comma in Python string

How can I strip the comma from a Python string such as Foo, bar? I tried 'Foo, bar'.strip(','), but it didn't work...

Android ListView Text Color

I am trying to set the ListView textColor to black, since I am using a white background. Here is my MailActivity public class MailActivity extends ListActivity { String[] listItems = { "Compose..

jQuery validate Uncaught TypeError: Cannot read property 'nodeName' of null

I have the following code: $(document).ready ( function () { $.validator.addMethod( "lessThan", function (value, element, param) { // bind to the b..

Getting the location from an IP address

I want to retrieve information like the city, state, and country of a visitor from their IP address, so that I can customize my web page according to their location. Is there a good and reliable way t..

Why is Ant giving me a Unsupported major.minor version error

I'm running this target in Ant. <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${b..

Show Current Location and Nearby Places and Route between two places using Google Maps API in Android

I need to develop an application using Google Maps in Android to locate my current location and need to find nearest location. (For example: Nearby police station from my current location.) It shoul..

Plot size and resolution with R markdown, knitr, pandoc, beamer

Doesn't fit on the slide by default, doesn't even print by any other means. Here's the .Rmd: Edit: it seems you have to use plot() in every chunk. Second plot now prints. # Plot should show at high..

How to call execl() in C with the proper arguments?

i have vlc (program to reproduce videos) if i type in a shell: /home/vlc "/home/my movies/the movie i want to see.mkv" it opens up an reproduces the movie. however, when I run the following program..

Apk location in New Android Studio

I started using new Android Studio and cant find the APK of the application in IDE,where it actually locates?..

Is it necessary to assign a string to a variable before comparing it to another?

I want to compare the value of an NSString to the string "Wrong". Here is my code: NSString *wrongTxt = [[NSString alloc] initWithFormat:@"Wrong"]; if( [statusString isEqualToString:wrongTxt] ){ ..

What is the difference between substr and substring?

What is the difference between alert("abc".substr(0,2)); and alert("abc".substring(0,2)); They both seem to output “ab”...

How to open a Bootstrap modal window using jQuery?

I'm using Twitter Bootstrap modal window functionality. When someone clicks submit on my form, I want to show the modal window upon clicking the "submit button" in the form. <form id="myform" clas..

Get file size, image width and height before upload

How can I get the file size, image height and width before upload to my website, with jQuery or JavaScript?..

Java8: HashMap<X, Y> to HashMap<X, Z> using Stream / Map-Reduce / Collector

I know how to "transform" a simple Java List from Y -> Z, i.e.: List<String> x; List<Integer> y = x.stream() .map(s -> Integer.parseInt(s)) .collect(Collectors.toList()..

Can an abstract class have a constructor?

Can an abstract class have a constructor? If so, how can it be used and for what purposes?..

Updating an object with setState in React

Is it at all possible to update object's properties with setState? Something like: this.state = { jasper: { name: 'jasper', age: 28 }, } I have tried: this.setState({jasper.name: 'someOtherNa..

Django: TemplateSyntaxError: Could not parse the remainder

I am getting this issue when I type localhost:8000/admin/. `TemplateSyntaxError: Could not parse the remainder: ':password_change' from 'admin:password_change'. The syntax of 'url' changed in Djan..

Is there a way to crack the password on an Excel VBA Project?

I've been asked to update some Excel 2003 macros, but the VBA projects are password protected, and it seems there's a lack of documentation... no-one knows the passwords. Is there a way of removing o..

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

IndentationError: unindent does not match any outer indentation level

When I compile the Python code below, I get IndentationError: unindent does not match any outer indentation level import sys def Factorial(n): # Return factorial result = 1 for i in ..

String "true" and "false" to boolean

I have a Rails application and I'm using jQuery to query my search view in the background. There are fields q (search term), start_date, end_date and internal. The internal field is a checkbox and I'm..

How to configure welcome file list in web.xml

I have this in my web.xml document. I am trying to have a welcome list so I dont need to type the path for the home page anymore. But everytime a clicked the application in my tomcat page it displays ..

How can I clear the SQL Server query cache?

I've got a simple query running against SQL Server 2005 SELECT * FROM Table WHERE Col = 'someval' The first time I execute the query can take > 15 secs. Subsequent executes are back in < 1 ..

How to identify whether a grammar is LL(1), LR(0) or SLR(1)?

How do you identify whether a grammar is LL(1), LR(0), or SLR(1)? Can anyone please explain it using this example, or any other example? X ? Yz | a Y ? bZ | e Z ? e ..

Programmatically get own phone number in iOS

Is there any way to get own phone number by standard APIs from iPhone SDK?..

java.io.IOException: Invalid Keystore format

Does anyone know how to solve this? I tried many things, but none of them worked. And when I click more details I get this: at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) atsun.sec..

How can I override inline styles with external CSS?

I have markup that uses inline styles, but I don't have access to change this markup. How do I override inline styles in a document using only CSS? I don't want to use jQuery or JavaScript. HTML: &l..

cd into directory without having permission

When cding into one of my directories called openfire the following error is returned: bash: cd: openfire: Permission denied Is there any way around this?..

Explicitly select items from a list or tuple

I have the following Python list (can also be a tuple): myList = ['foo', 'bar', 'baz', 'quux'] I can say >>> myList[0:3] ['foo', 'bar', 'baz'] >>> myList[::2] ['foo', 'baz'] >..

How do I make the text box bigger in HTML/CSS?

I am not sure where you edit the code for my question so I put both (sorry if that confuses anyone) In the top right hand corner there are two text boxes, but I'm not sure how to make them bigger in ..

Achieving white opacity effect in html/css

is there a way to achieve this effect in a cross-browser compatible way without having to prepare separated images? Basically the frame on which text lays has a white overlay of 50% opacity.. I would..

sort dict by value python

Assume that I have a dict. data = {1:'b', 2:'a'} And I want to sort data by 'b' and 'a' so I get the result 'a','b' How do I do that? Any ideas?..

Tool to monitor HTTP, TCP, etc. Web Service traffic

What's the best tool that you use to monitor Web Service, SOAP, WCF, etc. traffic that's coming and going on the wire? I have seen some tools that made with Java but they seem to be a little crappy. W..

textarea's rows, and cols attribute in CSS

I'd like to set the textarea's rows and cols attributes via CSS. How would I do this in CSS?..

Create normal zip file programmatically

I have seen many tutorials on how to compress a single file in c#. But I need to be able to create a normal *.zip file out of more than just one file. Is there anything in .NET that can do this? What ..

Get the first element of an array

I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get the first element of this array. Expected result: string apple One requirement: it cannot be don..

How to make a new List in Java

We create a Set as: Set myset = new HashSet() How do we create a List in Java?..

How to process images of a video, frame by frame, in video streaming using OpenCV and Python

I am a beginner in OpenCV. I want to do some image processing on the frames of a video which is being uploaded to my server. I just want to read the available frames and write them in a directory. The..

How to drop a database with Mongoose?

I'm preparing a database creation script in Node.js and Mongoose. How can I check if the database already exists, and if so, drop (delete) it using Mongoose? I could not find a way to drop it with Mo..

react button onClick redirect page

I am working on web application using React and bootstrap. When it comes to applying button onClick, it takes me hard time to let my page being redirect to another. if after a href , I cannot go the..

Doctrine query builder using inner join with conditions

I'd like to construct the following SQL using Doctrine's query builder: select c.* from customer c join phone p on p.customer_id = c.id and p.phone = :phone where c.username = :username First I tri..

How do I get the opposite (negation) of a Boolean in Python?

For the following sample: def fuctionName(int, bool): if int in range(...): if bool == True: return False else: return True Is there any way to skip the ..

Error with multiple definitions of function

I am trying to relearn C++ after taking an intro course a few years ago and I’m having some basic problems. My current problem occurs when trying to use a friend function. Here is my code in 2 files..

Is there any sed like utility for cmd.exe?

I want to programmatically edit file content using windows command line (cmd.exe). In *nix there is sed for this tasks. Is there any useful native equivalent in windows?..

Bootstrap change div order with pull-right, pull-left on 3 columns

I’ve been working on this the whole day but don’t come up with a solution. I have 3 columns in one row in a container. 1: right content – pull-right 2: navigation – pull-left 3: main conten..

Oracle - how to remove white spaces?

I am running this statement: select trim(a),trim(b) from table x; Even though I used the trim() statement, my output looks like this: A B..

operator << must take exactly one argument

a.h #include "logic.h" ... class A { friend ostream& operator<<(ostream&, A&); ... }; logic.cpp #include "a.h" ... ostream& logic::operator<<(ostream& os, A& a..

parse html string with jquery

I have an HTML string from a Ajax loaded source. I would like to get some attributes from an object (image) in this string, before I put the HTML into the document. I've got something like: $.ajax(..

Android ADB stop application command like "force-stop" for non rooted device

I'm trying to stop application on Android 2.3.7 device. But in this version of Android I can't use "force-stop" command. Do you know any other ways to close application on non rooted device?..

Most Pythonic way to provide global configuration variables in config.py?

In my endless quest in over-complicating simple stuff, I am researching the most 'Pythonic' way to provide global configuration variables inside the typical 'config.py' found in Python egg packages. ..

Converting rows into columns and columns into rows using R

I have a dataframe with unique row names and unique column names. I want to convert the rows into columns and column into rows. For example, this code: starting_df <- data.frame(row.names= c(LETT..

Placeholder Mixin SCSS/CSS

I'm trying to create a mixin for placeholders in sass. This is the mixin I've created. @mixin placeholder ($css) { ::-webkit-input-placeholder {$css} :-moz-placeholder {$css} ::-moz..

how to loop through each row of dataFrame in pyspark

E.g sqlContext = SQLContext(sc) sample=sqlContext.sql("select Name ,age ,city from user") sample.show() The above statement print entire table on terminal but i want to access each row in that tab..

Why is 22 the default port number for SFTP?

Why is 22 the default port number for SFTP? Is there any specific reason for this?..

Rename a file in C#

How do I rename a file using C#?..

How to sum up elements of a C++ vector?

What are the good ways of finding the sum of all the elements in a std::vector? Suppose I have a vector std::vector<int> vector with a few elements in it. Now I want to find the sum of all the ..

Catching errors in Angular HttpClient

I have a data service that looks like this: @Injectable() export class DataService { baseUrl = 'http://localhost' constructor( private httpClient: HttpClient) { } get(url,..

MISCONF Redis is configured to save RDB snapshots

During writes to Redis ( SET foo bar ) I am getting the following error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify..

What's the purpose of git-mv?

From what I understand, Git doesn't really need to track file rename/move/copy operations, so what's the real purpose of git mv? The man page isn't specially descriptive... Is it obsolete? Is it an in..

How to use MapView in android using google map V2?

I want to show a map in on of my activity. In google map V1 we use - <com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="match_parent" androi..

Showing line numbers in IPython/Jupyter Notebooks

Error reports from most language kernels running in IPython/Jupyter Notebooks indicate the line on which the error occurred; but (at least by default) no line numbers are indicated in Notebooks. Is i..

Cmake doesn't find Boost

I'm trying to configure a project using CMake, but it fails to find Boost libraries even though they are in the specified folder. I have specified Boost_INCLUDE_DIR, Boost_LIBRARYDIR and BOOST_ROOT , ..

How to add a ListView to a Column in Flutter?

I'm trying to construct a simple login page for my Flutter app. I've successfully built the TextFields and log in/Sign in buttons. I want to add a horizontal ListView. When I run the code my elemen..

Converting NumPy array into Python List structure?

How do I convert a NumPy array to a Python List (for example [[1,2,3],[4,5,6]] ), and do it reasonably fast?..

How to make phpstorm display line numbers by default?

How to make phpstorm display line numbers by default? Couldn't find that option. It's kind of annoying to turn them on manually for each page...

Getting the name / key of a JToken with JSON.net

I have some JSON that looks like this [ { "MobileSiteContent": { "Culture": "en_au", "Key": [ "NameOfKey1" ] } }, { "PageContent": { "Culture": "en_a..

Convert .cer certificate to .jks

I need to convert a .cer file to a .jks file. I saw a few questions about it, but haven't seen a solution to what I need. I don't need it in order to add it to my local certificates, but as a file to..

PHPExcel set border and format for all sheets in spreadsheet

I'm currently trying to set all borders for my spreadsheet, also formatting such as autosize. My code below is working, for sheet 1. All other sheets inside the spreadsheet are completely untouched. ..

Efficient method to generate UUID String in JAVA (UUID.randomUUID().toString() without the dashes)

I would like an efficient utility to generate unique sequences of bytes. UUID is a good candidate but UUID.randomUUID().toString() generates stuff like 44e128a5-ac7a-4c9a-be4c-224b6bf81b20 which is go..

Popup window in PHP?

here's a quick question: How do you make a window pop up for your error handling in php? Is javascript the only way to do this or is there a way to do this in PHP? i have a PHP-file, and one of the ..

Force encode from US-ASCII to UTF-8 (iconv)

I'm trying to transcode a bunch of files from US-ASCII to UTF-8. For that, I'm using iconv: iconv -f US-ASCII -t UTF-8 file.php > file-utf8.php My original files are US-ASCII encoded, which mak..

How to implement class constructor in Visual Basic?

I just would like to know how to implement class constructor in this language...

How to select distinct query using symfony2 doctrine query builder?

I have this symfony code where it retrieves all the categories related to a blog section on my project: $category = $catrep->createQueryBuilder('cc') ->Where('cc.contenttype = :type') -..

How to detect running app using ADB command

I have one Android Device running Jelly Bean OS. Is there any way to detect the process is running or not using ADB command if i know the package name?..

How can I create a dropdown menu from a List in Tkinter?

I am creating a GUI that builds information about a person. I want the user to select their birth month using a drop down bar, with the months configured earlier as a list format. from tkinter impor..

Angular js init ng-model from default values

Say you have a form that has values loaded from database. How do you initialize ng-model? Example: <input name="card[description]" ng-model="card.description" value="Visa-4242"> In my contr..

How to get subarray from array?

I have var ar = [1, 2, 3, 4, 5] and want some function getSubarray(array, fromIndex, toIndex), that result of call getSubarray(ar, 1, 3) is new array [2, 3, 4]...

Accessing a matrix element in the "Mat" object (not the CvMat object) in OpenCV C++

How to access elements by row, col in OpenCV 2.0's new "Mat" class? The documentation is linked below, but I have not been able to make any sense of it. http://opencv.willowgarage.com/documentation/c..

Mvn install or Mvn package

I am new to Maven, I have a Java based web project with maven configured in my MyEclipse. Now if I modified any java files then do I need to do Run as -> Mvn install or Mvn package?..

How can I find out which PHP script a process is running in Linux?

Running Linux, Apache, PHP 5.3 with FastCGI Handler. Is it possible to find out the script that is being executed for a linux process? I've been searching on google and haven't been able to find anyt..

How do I find ' % ' with the LIKE operator in SQL Server?

I have a column name Address which consists of some address which has '%' in between as: Address -------------------- Aman Ja%lan% Stree% Ro%ad etc., etc. How I can write the LIKE operator to find..

How to drop a unique constraint from table column?

I have a table 'users' with 'login' column defined as: [login] VARCHAR(50) UNIQUE NOT NULL Now I want to remove this unique constraint/index using SQL script. I found its name UQ_users_7D78A4E7 in ..

Rendering raw html with reactjs

So is this the only way to render raw html with reactjs? // http://facebook.github.io/react/docs/tutorial.html // tutorial7.js var converter = new Showdown.converter(); var Comment = React.createClas..

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'

I want to begin writing queries in MySQL. show grants shows: +--------------------------------------+ | Grants for @localhost | +--------------------------------------+ | GRANT USAGE ..

Is there a simple way to remove unused dependencies from a maven pom.xml?

I have a large Maven project with many modules and many pom.xml files. The project has changed and I suspect the pom's contain some unnecessary dependencies. Is there is a command which removes any un..

Make new column in Panda dataframe by adding values from other columns

I have a dataframe with values like A B 1 4 2 6 3 9 I need to add a new column by adding values from column A and B, like A B C 1 4 5 2 6 8 3 9 12 I believe this can be done using lambda functi..

AJAX Mailchimp signup form integration

Is there any way to integrate mailchimp simple (one email input) with AJAX, so there is no page refresh and no redirection to default mailchimp page. This solution doesn't work jQuery Ajax POST not w..

How to access a value defined in the application.properties file in Spring Boot

I want to access values provided in application.properties, e.g.: logging.level.org.springframework.web: DEBUG logging.level.org.hibernate: ERROR logging.file=${HOME}/application.log userBucket.path..

Git: Find the most recent common ancestor of two branches

How to find the most recent common ancestor of two Git branches?..

What is the use of BindingResult interface in spring MVC?

Is BindingResult useful to bind just exceptions with view, or something else? what is the exact use of BindingResult? Or is it useful in binding model attribute with view...

Eclipse comment/uncomment shortcut?

I thought this would be easy to achieve, but so far I haven't found solutions for comment/uncomment shortcut on both Java class editor and jsf faceted webapp XHTML file editor : to quickly comment/u..

Git - How to close commit editor?

I'm new to git and learning from a PDF. I just executed a command $ git commit and it opens a new editor. But I'm trying to close that new commit editor. How to do this? I'm using git on windows...

Provide schema while reading csv file as a dataframe

I am trying to read a csv file into a dataframe. I know what the schema of my dataframe should be since I know my csv file. Also I am using spark csv package to read the file. I trying to specify the ..

Run exe file with parameters in a batch file

Please have a look at my batch file. echo off start "c:\program files\php\php.exe D:\mydocs\mp\index.php param1 param2" but it isn't working. Any ideas how do I get it working?..

ASP.NET Background image

I am using VS2005 C#. I have a .aspx login page and I would like to implement a background image to it. Below is my current page screenshot: Below is my background code: <div align="center..

Uninstall Eclipse under OSX?

I'm running Eclipse SDK 3.4.0 on Mac OS X 10.5.6. Every time I try to install something new through "software updates", the message "The software items you selected may not be valid with your current..

How to know whether refresh button or browser back button is clicked in Firefox

How to know in Firefox whether refresh button is clicked or browser back button is clicked... for both events onbeforeunload() method is a callback. For IE I am handling like this: function Callback..

What is CDATA in HTML?

What is the use of CDATA inside JavaScript tags and HTML? <script type="text/javascript"> // <![CDATA[ // ]]> </script> ..

Escape double quotes for JSON in Python

How can I replace double quotes with a backslash and double quotes in Python? >>> s = 'my string with "double quotes" blablabla' >>> s.replace('"', '\\"') 'my string with \\"doubl..

Is there a "do ... while" loop in Ruby?

I'm using this code to let the user enter in names while the program stores them in an array until they enter an empty string (they must press enter after each name): people = [] info = 'a' # must fi..

Wrapping a react-router Link in an html button

Using suggested method: This is the result: A link in the button, Code in between comment lines I was wondering if there is a way to wrap a Link element from 'react-router' in an HTML button tag usin..

How to prevent Browser cache for php site

I have a php site running in cloud server.When ever i add new files css, js or images the browser is loading the same old js, css and image files stored in cache. My site has a doctype and meta tag a..

How to return a value from try, catch, and finally?

So when I do a code of blocks inside a try{}, and I try to return a value, it tells me no return values import org.w3c.dom.ranges.RangeException; public class Pg257E5 { public static void ma..

What happened to Lodash _.pluck?

I once used Lodash _.pluck...I loved pluck... Realizing Lodash no longer supports pluck (as of Lodash 4.x), I'm struggling to remember what to use instead... I went to the docs, hit cmd-f, typed 'pl..

How to read a file and write into a text file?

I want to open mis file, copy all the data and write into a text file. My mis file. File name – 1.mis M3;3395;44;0;1;;20090404;094144;8193;3;0;;;; M3;3397;155;0;2;;20090404;105941;8193;3;0;;;; M3..

Regex for allowing alphanumeric,-,_ and space

I am searching for a regular expression for allowing alphanumeric characters, -, _ or spaces in JavaScript/jQuery. I tried Googling but wasn't able to find that. Can anyone help me out with this? Th..

jQuery issue - #<an Object> has no method

I've tried a veriety of jQuery plugins recently and I keep getting this error … (source: shaunbellis.co.uk) … regardless of what plugin I try to use. I've checked the links to the JS files w..

Regex Until But Not Including

For regex what is the syntax for search until but not including? Kinda like: Haystack: The quick red fox jumped over the lazy brown dog Expression: .*?quick -> and then everything until it hits t..

Escaping special characters in Java Regular Expressions

Is there any method in Java or any open source library for escaping (not quoting) a special character (meta-character), in order to use it as a regular expression? This would be very handy in dynamic..

ActiveRecord find and only return selected columns

edit 2 If you stumble across this, check both answers as I'd now use pluck for this I have a fairly large custom dataset that I'd like to return to be echoe'd out as json. One part is: l=Location.fin..

Most Useful Attributes

I know that attributes are extremely useful. There are some predefined ones such as [Browsable(false)] which allows you to hide properties in the properties tab. Here is a good question explaining att..

How do you create different variable names while in a loop?

For example purposes... for x in range(0,9): string'x' = "Hello" So I end up with string1, string2, string3... all equaling "Hello"..

C++ alignment when printing cout <<

Is there a way to align text when printing using std::cout? I'm using tabs, but when the words are too big they won't be aligned anymore. Sales Report for September 15, 2010 Artist Title Price G..

jquery draggable: how to limit the draggable area?

I have a draggable object (div), and some droppable ones (table TD's). I want the user to drag my draggable object to one of those droppable TD's. I enable draggable and droppable this way: $(".drag..

unsigned int vs. size_t

I notice that modern C and C++ code seems to use size_t instead of int/unsigned int pretty much everywhere - from parameters for C string functions to the STL. I am curious as to the reason for this ..

How to add native library to "java.library.path" with Eclipse launch (instead of overriding it)

I got a native library that needs to be added to java.library.path. With JVM argument -Djava.library.path=path... I can set the path as I want. My problem is that my other library (pentaho reporting)..