Questions Tagged with #Fasta

FASTA is a software package for sequence alignment of proteins and nucleic acids. FASTA is also the name of the file format used by these programs to represent sequences of peptides or nucleotides. The format is a de facto standard in bioinformatics.

Shell script not running, command not found

I am very, very new to UNIX programming (running on MacOSX Mountain Lion via Terminal). I've been learning the basics from a bioinformatics and molecular methods course (we've had two classes) where w..

Getting Python error "from: can't read /var/mail/Bio"

I am running a (bio)python script which results in the following error: from: can't read /var/mail/Bio seeing as my script doesn't have anything to with mail, I don't understand why my script is lo..

Changing file extension in Python

Suppose from index.py with CGI, I have post file foo.fasta to display file. I want to change foo.fasta's file extension to be foo.aln in display file. How can I do it?..

How to check if a string is a valid JSON string in JavaScript without using Try/Catch

Something like: var jsonString = '{ "Id": 1, "Name": "Coke" }'; //should be true IsJsonString(jsonString); //should be false IsJsonString("foo"); IsJsonString("<div>foo</div>") The so..

How do you add swap to an EC2 instance?

I'm currently running an ec2 micro instance and i've been finding that the instance occasionally runs out of memory. Other than using a larger instance size, what else can be done?..

Rollback to an old Git commit in a public repo

How can I go about rolling back to a specific commit in git? The best answer someone could give me was to use git revert X times until I reach the desired commit. So let's say I want to revert bac..

How to create a new img tag with JQuery, with the src and id from a JavaScript object?

I understand JQuery in the basic sense but am definitely new to it, and suspect this is very easy. I've got my image src and id in a JSON response (converted to an object), and therefore the correct ..

Is not an enclosing class Java

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

ValueError: shape mismatch: objects cannot be broadcast to a single shape

I am using the SciPy's pearsonr(x,y) method and I cannot figure out why the following error is happening: ValueError: shape mismatch: objects cannot be broadcast to a single shape It computes th..

keytool error Keystore was tampered with, or password was incorrect

I am getting following error while generating certificates on my local machine. C:\Users\abc>keytool -genkey -alias tomcat -keyalg RSA Enter keystore password: keytool error: java.io.IOException: ..

jQuery append() vs appendChild()

Here's some sample code: function addTextNode(){ var newtext = document.createTextNode(" Some text added dynamically. "); var para = document.getElementById("p1"); para.appendChild(newtex..

Python: How to check if keys exists and retrieve value from Dictionary in descending priority

I have a dictionary and I would like to get some values from it based on some keys. For example, I have a dictionary for users with their first name, last name, username, address, age and so on. Let's..

Why is 2 * (i * i) faster than 2 * i * i in Java?

The following Java program takes on average between 0.50 secs and 0.55 secs to run: public static void main(String[] args) { long startTime = System.nanoTime(); int n = 0; for (int i = 0;..

How to set the DefaultRoute to another Route in React Router

I have the following: <Route name="app" path="/" handler={App}> <Route name="dashboards" path="dashboards" handler={Dashboard}> <Route name="exploreDashboard" path="explore..

How to use radio on change event?

I have two radio button on change event i want change button How it is possible? My Code <input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot <input type="..

How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote branch? ..

How to read request body in an asp.net core webapi controller?

I'm trying to read the request body in the OnActionExecuting method, but I always get null for the body. var request = context.HttpContext.Request; var stream = new StreamReader(request.Body); var bod..

Get latitude and longitude automatically using php, API

In one of my php applications I have to find out the latitude and longitude of the place from address. I tried this code: $json = file_get_contents("http://maps.google.com/maps/api/geocode/json?ad..

Why is visible="false" not working for a plain html table?

The visible property of html table does not work. Why do they have that property if its defective? I had to use style="visibility:hidden" in order to hide a table. Please explain why. I am very cu..

How to use delimiter for csv in python

I'm having trouble with figuring out how to use the delimiter for csv.writer in Python. I have a csv file in which the strings separated by commas are in single cell and I need to have each word in ea..

Why does a base64 encoded string have an = sign at the end

I know what base64 encoding is and how to calculate base64 encoding in C#, however I have seen several times that when I convert a string into base64, there is an = at the end. A few questions came u..

A completely free agile software process tool

I know slightly close questions have been asked before but this question is a bit different. We are a start-up company with a very limited budget and we are looking for a completely free Agile softwa..

What order are the Junit @Before/@After called?

I have an Integration Test Suite. I have a IntegrationTestBase class for all my tests to extend. This base class has a @Before (public void setUp()) and @After (public void tearDown()) method to estab..

Creating a "logical exclusive or" operator in Java

Observations: Java has a logical AND operator. Java has a logical OR operator. Java has a logical NOT operator. Problem: Java has no logical XOR operator, according to sun. I would like to define..

c# replace \" characters

I am sent an XML string that I'm trying to parse via an XmlReader and I'm trying to strip out the \" characters. I've tried .Replace(@"\", "") .Replace("\\''", "''") .Replace("\\''", "\"") plus s..

How to determine the installed webpack version

Especially during the transition from webpack v1 to v2, it would be important to programmatically determine what webpack version is installed, but I cannot seem to find the appropriate API...

Create Pandas DataFrame from a string

In order to test some functionality I would like to create a DataFrame from a string. Let's say my test data looks like: TESTDATA="""col1;col2;col3 1;4.4;99 2;4.5;200 3;4.7;65 4;3.2;140 """ What is..

Overriding interface property type defined in Typescript d.ts file

Is there a way to change the type of interface property defined in a *.d.ts in typescript? for example: An interface in x.d.ts is defined as interface A { property: number; } I want to change ..

How to change icon on Google map marker

I want to use my customize icon on Google map, and added icon url on the code. But it's still not reflecting on the map. Can anyone suggest, what i am missing here. Why icon is not changing, after add..

How to use "Share image using" sharing Intent to share images in android?

I have image galley app in that app I placed all the images into the drawable-hdpi folder. and i called images in my activity like this : private Integer[] imageIDs = { R.drawable.wall1, R.dra..

Textarea that can do syntax highlighting on the fly?

I am storing a number of HTML blocks inside a CMS for reasons of easier maintenance. They are represented by <textarea>s. Does anybody know a JavaScript Widget of some sort that can do syntax h..

if A vs if A is not None:

Can I use: if A: instead of if A is not None: The latter seems so verbose. Is there a difference?..

Are there any Java method ordering conventions?

I've got a large-ish class (40 or so methods) that is part of a package I will be submitting as course-work. Currently, the methods are pretty jumbled up in terms of utility public/private etc. and I ..

git visual diff between branches

This answer is great for seeing a visual diff between two files that are checked into git: How do I view 'git diff' output with a visual diff program? However, I'd like to see a visual diff ..

I lose my data when the container exits

Despite Docker's Interactive tutorial and faq I lose my data when the container exits. I have installed Docker as described here: http://docs.docker.io/en/latest/installation/ubuntulinux without any ..

java how to use classes in other package?

can I import,use class from other package? In Eclipse I made 2 packages one is main other is second main -main (class) second -second (class) and I wanted the main function of main class to call..

HTTP POST using JSON in Java

I would like to make a simple HTTP POST using JSON in Java. Let's say the URL is www.site.com and it takes in the value {"name":"myname","age":"20"} labeled as 'details' for example. How would I g..

Practical uses of git reset --soft?

I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me. I understand I can use the soft..

How to check if a variable is an integer or a string?

I have an application that has a couple of commands. When you type a certain command, you have to type in additional info about something/someone. Now that info has to be strictly an integer or a stri..

The permissions granted to user ' are insufficient for performing this operation. (rsAccessDenied)"}

I created a report model using SSRS (2005) and published to the local server. But when I tried to run the report for the model I published using report builder I get the following error. Report e..

How to perform a mysqldump without a password prompt?

I would like to know the command to perform a mysqldump of a database without the prompt for the password. REASON: I would like to run a cron job, which takes a mysqldump of the database once everyda..

Close virtual keyboard on button press

I have an Activity with an EditText, a button and a ListView. The purpose is to type a search screen in the EditText, press the button and have the search results populate this list. This is all wor..

Trying to get PyCharm to work, keep getting "No Python interpreter selected"

I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but th..

Why am I getting error for apple-touch-icon-precomposed.png

I have created a new rails3 project but I am seeing following logs many times in my server logs. Why I am getting these request and how can I avoid these? Started GET "/apple-touch-icon-precompose..

tsconfig.json: Build:No inputs were found in config file

I have an ASP.NET core project and I'm getting this error when I try to build it: error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specif..

Forking vs. Branching in GitHub

I'd like to know more about the advantages and disadvantages of forking a github project vs. creating a branch of a github project. Forking makes my version of the project more isolated from the orig..

Are the decimal places in a CSS width respected?

Something I've been wondering for a while whilst doing CSS design. Are decimal places in CSS widths respected? Or are they rounded? .percentage { width: 49.5%; } or .pixel { width: 122.5px; }..

Import text file as single character string

How do you import a plain text file as single character string in R? I think that this will probably have a very simple answer but when I tried this today I found that I couldn't find a function to do..

Powershell send-mailmessage - email to multiple recipients

I have this powershell script to sending emails with attachments, but when I add multiple recipients, only the first one gets the message. I've read the documentation and still can't figure it out. Th..

PHP calculate age

I'm looking for a way to calculate the age of a person, given their DOB in the format dd/mm/yyyy. I was using the following function which worked fine for several months until some kind of glitch ca..

How to read a large file line by line?

I want to read a file line by line, but without completely loading it in memory. My file is too large to open in memory, and if try to do so I always get out of memory errors. The file size is 1 GB...

span with onclick event inside a tag

Sample code <a href="page" style="text-decoration:none;display:block;"> <span onclick="hide()">Hide me</span> </a> Since the a tag is over the span is not possible to cl..

How to Split Image Into Multiple Pieces in Python

I'm trying to split a photo into multiple pieces using PIL. def crop(Path,input,height,width,i,k,x,y,page): im = Image.open(input) imgwidth = im.size[0] imgheight = im.size[1] for i i..

Kill a postgresql session/connection

How can I kill all my postgresql connections? I'm trying a rake db:drop but I get: ERROR: database "database_name" is being accessed by other users DETAIL: There are 1 other session(s) using the d..

Can a class member function template be virtual?

I have heard that C++ class member function templates can't be virtual. Is this true? If they can be virtual, what is an example of a scenario in which one would use such a function?..

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

Converting ISO 8601-compliant String to java.util.Date

I am trying to convert an ISO 8601 formatted String to a java.util.Date. I found the pattern yyyy-MM-dd'T'HH:mm:ssZ to be ISO8601-compliant if used with a Locale (compare sample). However, using th..

Sending JSON object to Web API

I am trying to figure out how I can send some information from a form to a Web API action. This is the jQuery/AJAX I'm trying to use: var source = { 'ID': 0, 'ProductID': $('#ID').v..

Python Unicode Encode Error

I'm reading and parsing an Amazon XML file and while the XML file shows a ' , when I try to print it I get the following error: 'ascii' codec can't encode character u'\u2019' in position 16: ordinal ..

How to loop through an array of objects in swift

I'm trying to access the url of an object stored in an array, but I'm getting errors no matters what methods I'm using. let userPhotos = currentUser?.photos for var i = 0; i < userPhotos!.cou..

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102

I am receiving the error of SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102 in comments.php below: <?php /** * Class to handle ar..

install / uninstall APKs programmatically (PackageManager vs Intents)

My application installs other applications, and it needs to keep track of what applications it has installed. Of course, this could be achieved by simply keeping a list of installed applications. But ..

Sqlite primary key on multiple columns

What is the syntax for specifying a primary key on more than 1 column in SQLITE ? ..

Understanding the Linux oom-killer's logs

My app was killed by the oom-killer. It is Ubuntu 11.10 running on a live USB with no swap and the PC has 1 Gig of RAM. The only app running (other than all the built in Ubuntu stuff) is my program ..

Import cycle not allowed

I have a problem with import cycle not allowed It appears, when I am trying to test my controller. As output I've got can't load package: import cycle not allowed package project/controllers/a..

Convert string to datetime in vb.net

I have a datetime that looks like this: 201210120956 ccyyMMDDhhmm When I try this: Dim convertedDate As Date = Date.Parse(DateString) Return convertedDate I get back this: #10/12/2012# I'm lo..

SQL Server 2008 - Help writing simple INSERT Trigger

This is with Microsoft SQL Server 2008. I've got 2 tables, Employee and EmployeeResult and I'm trying to write a simple INSERT trigger on EmployeeResult that does this - each time an INSERT is done i..

Reverse a comparator in Java 8

I have an ArrayList and want sort it in descending order. I use for it java.util.stream.Stream.sorted(Comparator) method. Here is a description according Java API: Returns a stream consisting of t..

How to make git mark a deleted and a new file as a file move?

I've moved a file manually and then I've modified it. According to Git, it is a new file and a removed file. Is there any way to force Git into treating it as a file move?..

CSS performance relative to translateZ(0)

A number of blogs have expressed the performance gain in 'tricking' the GPU to think that an element is 3D by using transform: translateZ(0) to speed up animations and transitions. I was wondering if ..

How to convert a string to utf-8 in Python

I have a browser which sends utf-8 characters to my Python server, but when I retrieve it from the query string, the encoding that Python returns is ASCII. How can I convert the plain string to utf-8?..

How to get `DOM Element` in Angular 2?

I have a component that has a <p> element. It's (click) event will change it into a <textarea>. So, the user can edit the data. My question is: How can I make the focus on the textarea? H..

TypeError: Cannot read property 'then' of undefined

loginService.islogged() Above function return a string like "failed". However, when I try to run then function on it, it will return error of TypeError: Cannot read property 'then' of undefined ..

'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository

I am not able to clone or push to a git repository at Bitbucket in Eclipse: It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error ke..

how to get the current working directory's absolute path from irb

I'm running Ruby on Windows though I don't know if that should make a difference. All I want to do is get the current working directory's absolute path. Is this possible from irb? Apparently from a..

Why shouldn't I use PyPy over CPython if PyPy is 6.3 times faster?

I've been hearing a lot about the PyPy project. They claim it is 6.3 times faster than the CPython interpreter on their site. Whenever we talk about dynamic languages like Python, speed is one of the..

jQuery duplicate DIV into another DIV

Need some jquery help copying a DIV into another DIV and hoping that this is possible. I have the following HTML: <div class="container"> <div class="button"></div> </div&g..

How to load all modules in a folder?

Could someone provide me with a good way of importing a whole directory of modules? I have a structure like this: /Foo bar.py spam.py eggs.py I tried just converting it to a package by ..

Convert JSONArray to String Array

I want to ask a question about converting a jsonArray to a StringArray on Android. Here is my code to get jsonArray from server. try { DefaultHttpClient defaultClient = new DefaultHttpClient(); ..

How can get the text of a div tag using only javascript (no jQuery)

I tried this but showing "undefined". function test() { var t = document.getElementById('superman').value; alert(t); } Is there any way to get the value using simple Javascript no jQuery Please!..

Why does find -exec mv {} ./target/ + not work?

I want to know exactly what {} \; and {} \+ and | xargs ... do. Please clarify these with explanations. Below 3 commands run and output same result but the first command takes a little time and the f..

List append() in for loop

In Python, trying to do the most basic append function to a list with a loop: Not sure what i am missing here: a=[] for i in range(5): a=a.append(i) a returns: 'NoneType' object has no attr..

Get top first record from duplicate records having no unique identity

I need to fetch top first row out of each duplicate set of records from table given below. I need to use this query in view please no temp table as I have already done it by adding identity column a..

jquery fill dropdown with json data

I have the following jQuery code. I am able to get the following data from server [{"value":"1","label":"xyz"}, {"value":"2","label":"abc"}]. How do I iterate over this and fill a select box with id=c..

Merge two json/javascript arrays in to one array

I have two json arrays like var json1 = [{id:1, name: 'xxx' ...}] var json2 = [{id:2, name: 'xyz' ...}] I want them merge in to single arrays var finalObj = [{id:1, name: 'xxx' ...},{id:2, name: '..

How to write a JSON file in C#?

I need to write the following data into a text file using JSON format in C#. The brackets are important for it to be valid JSON format. [ { "Id": 1, "SSN": 123, "Message": "whatever" ..

"OverflowError: Python int too large to convert to C long" on windows but not mac

I am running the exact same code on both windows and mac, with python 3.5 64 bit. On windows, it looks like this: >>> import numpy as np >>> preds = np.zeros((1, 3), dtype=int) &g..

How to detect shake event with android?

How can I detect a shake event with android? How can I detect the shake direction? I want to change the image in an imageview when shaking occurs...

How to handle a lost KeyStore password in Android?

I have forgotten my Keystore password and I don't really know what to do anymore (I can't or won't give any excuses for it). I want to update my app because I just fixed a bug but it's not possible an..

How to change text and background color?

I want every character to be a different color. for example, cout << "Hello world" << endl; H would be red e would be blue l would be orange and so on. I know this can be done, I ju..

Get current URL with jQuery?

I am using jQuery. How do I get the path of the current URL and assign it to a variable? Example URL: http://localhost/menuname.de?foo=bar&amp;number=0 ..

Doctrine - How to print out the real sql, not just the prepared statement?

We're using Doctrine, a PHP ORM. I am creating a query like this: $q = Doctrine_Query::create()->select('id')->from('MyTable'); and then in the function I'm adding in various where clauses an..

Twitter Bootstrap date picker

How can I use the Twitter Bootstrap date picker? I used the code below but its not working. <html> <head> <title>DatePicker Demo</title> <script src="js/jquery-..

Convert JSON to Map

What is the best way to convert a JSON code as this: { "data" : { "field1" : "value1", "field2" : "value2" } } in a Java Map in which one the keys are (field1, field..

How to obtain values of request variables using Python and Flask

I'm wondering how to go about obtaining the value of a POST/GET request variable using Python with Flask. With Ruby, I'd do something like this: variable_name = params["FormFieldValue"] How would ..

Batch - Echo or Variable Not Working

I have this little batch script: SET @var = "GREG" ECHO %@var% PAUSE When I run it, it prints: H:\Dynamics>SET @var = "GREG" H:\Dynamics>ECHO ECHO is on. H:\Dynamics>PAUSE Press any key..

Changing CSS Values with Javascript

It's easy to set inline CSS values with javascript. If I want to change the width and I have html like this: <div style="width: 10px"></div> All I need to do is: document.getElementByI..

How to send and retrieve parameters using $state.go toParams and $stateParams?

I am using AngularJS v1.2.0-rc.2 with ui-router v0.2.0. I want to pass the referrer state to another state so I use the toParams of $state.go like so: $state.go('toState', {referer: $state.current.na..

Setting transparent images background in IrfanView

I have some PNG images which consist of a black shape and a transparent background. Unfortunately, IrfanView shows transparent background as black color, so I see just black on black. I've found in Ir..

How to change current working directory using a batch file

I need some help in writing a batch file. I have a path stored in a variable root as follows: set root=D:\Work\Root Then I am changing my working directory to this root as follows: cd %root% Whe..

SOAP PHP fault parsing WSDL: failed to load external entity?

I'm trying to run a web service using PHP & SOAP, but all I'm getting so far is this: (SoapFault)[2] message which states: 'SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/MyReg..

Why is reading lines from stdin much slower in C++ than Python?

I wanted to compare reading lines of string input from stdin using Python and C++ and was shocked to see my C++ code run an order of magnitude slower than the equivalent Python code. Since my C++ is r..

How to add anything in <head> through jquery/javascript?

I'm working with a CMS, which prevents editing HTML source for <head> element. For example I want to add the following above the <title> tag: <meta http-equiv="X-UA-Compatible" conten..

Passing arguments forward to another javascript function

I've tried the following with no success: function a(args){ b(arguments); } function b(args){ // arguments are lost? } a(1,2,3); In function a, I can use the arguments keyword to access a..

How can I dynamically switch web service addresses in .NET without a recompile?

I have code that references a web service, and I'd like the address of that web service to be dynamic (read from a database, config file, etc.) so that it is easily changed. One major use of this wil..

How do I calculate square root in Python?

Why does Python give the "wrong" answer? x = 16 sqrt = x**(.5) #returns 4 sqrt = x**(1/2) #returns 1 Yes, I know import math and use sqrt. But I'm looking for an answer to the above...

How to select an option from drop down using Selenium WebDriver C#?

I was trying for my web test selecting an option. An example can be found here: http://www.tizag.com/phpT/examples/formex.php Everything works great except the selecting an option part. How to select..

Simulate a click on 'a' element using javascript/jquery

I am trying to simulate a click on on an element. HTML for the same is as follows <a id="gift-close" href="javascript:void(0)" class="cart-mask-close p-abs" onclick="_gaq.push(['_trackEvent','vouc..

Adding a legend to PyPlot in Matplotlib in the simplest manner possible

TL;DR -> How can one create a legend for a line graph in Matplotlib's PyPlot without creating any extra variables? Please consider the graphing script below: if __name__ == '__main__': PyPlo..

How to stop mongo DB in one command

I need to be able to start/stop MongoDB on the cli. It is quite simple to start: ./mongod But to stop mongo DB, I need to run open mongo shell first and then type two commands: $ ./mongo use admin ..

Storing image in database directly or as base64 data?

The common method to store images in a database is to convert the image to base64 data before storing the data. This process will increase the size by 33%. Alternatively it is possible to directly sto..

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

Object not found! The requested URL was not found on this server. localhost

I have a typical set up A,M,P and i am just doing some testing on my localhost server for setting up a webpage. I'm a bit new to php and dynamic sites so I'm muddling my way though. So I am at an impa..

Counting unique values in a column in pandas dataframe like in Qlik?

If I have a table like this: df = pd.DataFrame({ 'hID': [101, 102, 103, 101, 102, 104, 105, 101], 'dID': [10, 11, 12, 10, 11, 10, 12, 10], 'uID': ['James', 'Henry', 'Abe'..

Reflection generic get field value

I am trying to receive field value via reflection. The problem is I don't know the fields type and have to decide it while getting the value. This code results with this exception: Can not set java...

How to add a default "Select" option to this ASP.NET DropDownList control?

I am a new ASP.NET developer and I am trying to learn Linq-To-Entities. I am trying to bind a DropDownList with the Linq statement for retrieving the list of status in the Status Entity. Everything is..

Change the color of a bullet in a html list?

All I want is to be able to change the color of a bullet in a list to a light gray. It defaults to black, and I can't figure out how to change it. I know I could just use an image; I'd rather not do ..

Foreach loop, determine which is the last iteration of the loop

I have a foreach loop and need to execute some logic when the last item is chosen from the List, e.g.: foreach (Item result in Model.Results) { //if current result is the last item in Model.R..

How to install an APK file on an Android phone?

I have a simple "Hello Android" application on my computer (Eclipse environment), and I have built an APK file. How do I transfer the APK file to my Android phone for testing? My phone is Ideos runni..

Rollback a Git merge

develop branch --> dashboard (working branch) I use git merge --no-ff develop to merge any upstream changes into dashboard git log: commit 88113a64a21bf8a51409ee2a1321442fd08db705 Merge: 981bc2..

How is VIP swapping + CNAMEs better than IP swapping + A records?

I'm in the middle of updating my DNS setup to use all CNAMEs instead of A records, because I need support for VIP swaps between Staging and Production. I can't use A records for this because that put..

Get current batchfile directory

Firstly, I saw this topic but I couldn't understand that. Question : There is a batch file in D:\path\to\file.bat with following content : echo %cd% pause Output is : C:\ It must be D:\path\to..

insert data into database with codeigniter

Trying to insert a row into my database with CodeIgniter. My database table is Customer_Orders and the fields are CustomerName and OrderLines. The variables are being submitted correctly. My Control..

Mysql select distinct

I am trying to select of the duplicate rows in mysql table it's working fine for me but the problem is that it is not letting me select all the fields in that query , just letting me select the field ..

Decoding UTF-8 strings in Python

I'm writing a web crawler in python, and it involves taking headlines from websites. One of the headlines should've read : And the Hip's coming, too But instead it said: And the Hip’s coming,..

Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function

I'm trying to send a call using Ajax but in Chrome it is rising error but in Firefox there is no error. But still it can't calling the method. I tried to record my call in Firebug but there is no call..

Bootstrap modal link

How can I make button become a link only and have a popup in bootstrap 3? code <a href="" data-toggle="modal" data-target=".bannerformmodal">Load me</a> <div class="modal fade banne..

How to detect the OS from a Bash script?

I would like to keep my .bashrc and .bash_login files in version control so that I can use them between all the computers I use. The problem is I have some OS specific aliases so I was looking for a w..

Converting Python dict to kwargs?

I want to build a query for sunburnt(solr interface) using class inheritance and therefore adding key - value pairs together. The sunburnt interface takes keyword arguments. How can I transform a dict..

Android check permission for LocationManager

I'm trying to get the GPS coordinates to display when I click a button in my activity layout. The following is the method that gets called when I click the button: public void getLocation(View view) ..

jQuery check if an input is type checkbox?

I'd like to find out if an input is a checkbox or not, and the following doesn't work: $("#myinput").attr('checked') === undefined Thank you once again!..

How do I check if an object has a key in JavaScript?

Which is the right thing to do? if (myObj['key'] == undefined) or if (myObj['key'] == null) or if (myObj['key']) ..

Extract substring from a string

what is the best way to extract a substring from a string in android?..

What values for checked and selected are false?

I think according to W3 spec, you're supposed to do <input type="checkbox" checked="checked" /> And selected="selected" But, most browsers will accept it you just write "CHECKED" and don'..

Set background image on grid in WPF using C#

I have a problem: I want to set the image of my grid through code behind. Can anybody tell me how to do this?..

Refused to apply inline style because it violates the following Content Security Policy directive

So, in about 1 hour my extensions failed hard. I was doing my extension and it was doing what I pretended. I made some changes, and as I didnt liked I deleted them, and now my extension is throwing e..

Python IndentationError: unexpected indent

Here is my code ... I am getting indentation error but i don't know why it occurs. -> # loop while d <= end_date: # print d.strftime("%Y%m%d") fecha = d.strftime("%Y%m%d") # set url ..

Write to rails console

When I want to try or debug smthing I run rails console and do some stuff there. I can print some text or variables from code by raising exception with raise "blablabla". Question: How I can just writ..

GoTo Next Iteration in For Loop in java

Is there a token in java that skips the rest of the for loop? Something like VB's Continue in java...

Async/Await Class Constructor

At the moment, I'm attempting to use async/await within a class constructor function. This is so that I can get a custom e-mail tag for an Electron project I'm working on. customElements.define('e-m..

jQuery class within class selector

<div class="outer"> <div class="inner"></div> </div> how do I find the inner div here? $container.find('.outer .inner') is just going to look for a div with class="out..

How do I create a Linked List Data Structure in Java?

What's the best way to make a linked list in Java?..

Find unique lines

How can I find the unique lines and remove all duplicates from a file? My input file is 1 1 2 3 5 5 7 7 I would like the result to be: 2 3 sort file | uniq will not do the job. Will show all va..

Querying DynamoDB by date

I'm coming from a relational database background and trying to work with amazon's DynamoDB I have a table with a hash key "DataID" and a range "CreatedAt" and a bunch of items in it. I'm trying to g..

Git: Recover deleted (remote) branch

I need to recover two Git branches that I somehow deleted during a push. These two branches were created on a different system and then pushed to my "shared" (github) repository. On my system, I (ap..

Best way to replace multiple characters in a string?

I need to replace some characters as follows: & ? \&, # ? \#, ... I coded as follows, but I guess there should be some better way. Any hints? strs = strs.replace('&', '\&') strs = st..

Set HTML dropdown selected option using JSTL

In the same context i have another query <select multiple="multiple" name="prodSKUs"> <c:forEach items="${productSubCategoryList}" var="productSubCategoryList"> <..

jQuery get the name of a select option

I have a dropdown list with several option, each option has a name attribute. When I select an option, a different list of checkboxes needs to appear - when another options is selected, that checkbox ..

How can I remove the string "\n" from within a Ruby string?

I have this string: "some text\nandsomemore" I need to remove the "\n" from it. I've tried "some text\nandsomemore".gsub('\n','') but it doesn't work. How do I do it? Thanks for reading...

Check if selected dropdown value is empty using jQuery

Here is the dropdown in question: <select name="data" class="autotime" id="EventStartTimeMin"> <option value=""></option> <option value="00">00</option> <..

Pass entire form as data in jQuery Ajax function

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

Android WebView Cookie Problem

I have a server that sends my android app a session cookie to be used for authenticated communication. I am trying to load a WebView with a URL pointing to that same server and I'm trying to pass i..

Display image as grayscale using matplotlib

I'm trying to display a grayscale image using matplotlib.pyplot.imshow(). My problem is that the grayscale image is displayed as a colormap. I need the grayscale because I want to draw on top of the..

How is using "<%=request.getContextPath()%>" better than "../"

I have worked on number of J2EE projects where the view layer is JSP. In most projects, I have seen that we reference external resources i.e. images, javascript, jsp's, css etc. using the contextPath ..

Using margin / padding to space <span> from the rest of the <p>

Ive got a block of text, and i want to write the authors name and date bellow it in small italics, so i put it in a <span> block and styled it, but i want to space the name out a little bit so i..

Why is quicksort better than mergesort?

I was asked this question during an interview. They're both O(nlogn) and yet most people use Quicksort instead of Mergesort. Why is that?..

How to create multidimensional array

Can anyone give me a sample/example of JavaScript with a multidimensional array of inputs? Hope you could help because I'm still new to the JavaScript. Like when you input 2 rows and 2 columns the ou..

Convert JavaScript string in dot notation into an object reference

Given a JS object var obj = { a: { b: '1', c: '2' } } and a string "a.b" how can I convert the string to dot notation so I can go var val = obj.a.b If the string was just 'a', I could use obj..

Cannot install packages using node package manager in Ubuntu

NodeJS interpreter name(node) on Ubuntu has been renamed to nodejs because of a name conflict with another package. Here's what the readme. Debian says: The upstream name for the Node.js interpret..

sscanf in Python

I'm looking for an equivalent to sscanf() in Python. I want to parse /proc/net/* files, in C I could do something like this: int matches = sscanf( buffer, "%*d: %64[0-9A-Fa-f]:%X %64[..

HTTP Status 405 - Request method 'POST' not supported (Spring MVC)

Im getting this error: HTTP Status 405 - Request method 'POST' not supported What I am trying to do is make a form with a drop down box that get populated based on the other value selected in anothe..

Escape invalid XML characters in C#

I have a string that contains invalid XML characters. How can I escape (or remove) invalid XML characters before I parse the string?..

TypeError: 'type' object is not subscriptable when indexing in to a dictionary

I have multiple files that I need to load so I'm using a dict to shorten things. When I run I get a TypeError: 'type' object is not subscriptable Error. How can I get this to work? m1 = pygame.i..

socket.emit() vs. socket.send()

What's the difference between these two? I noticed that if I changed from socket.emit to socket.send in a working program, the server failed to receive the message, although I don't understand why. ..

How do I get my solution in Visual Studio back online in TFS?

I had my solution in Visual Studio 2012 (which is under TFS source control) open and the TFS server (2010) was down. When I then made a change to one of the files and attempted to save it I got a prom..

JQuery Validate input file type

I have a form that can have 0-hundreds of <input type="file"> elements. I have named them sequentially depending on how many are dynamically added to the page. For example: <input type="fi..

jQuery - find child with a specific class

I am trying to write code to search all children for a div that has a specific class. The DIV does not have an ID. Here is the HTML I will be using. <div class="outerBUBGDiv"> <div class="..

How to create a fix size list in python?

In C++, I can create a array like... int* a = new int[10]; in python,I just know that I can declare a list,than append some items,or like.. l = [1,2,3,4] l = range(10) Can I initialize a list by..

How to save a Python interactive session?

I find myself frequently using Python's interpreter to work with databases, files, etc -- basically a lot of manual formatting of semi-structured data. I don't properly save and clean up the useful b..

Restful API service

I'm looking to make a service which I can use to make calls to a web-based REST API. Basically I want to start a service on app init then I want to be able to ask that service to request a url and re..

Multiprocessing vs Threading Python

I am trying to understand the advantages of multiprocessing over threading. I know that multiprocessing gets around the Global Interpreter Lock, but what other advantages are there, and can threading ..

Reference list item by index within Django template?

This may be simple, but I looked around and couldn't find an answer. What's the best way to reference a single item in a list from a Django template? In other words how do I do the equivalent of {{ ..

Mobile Safari: Javascript focus() method on inputfield only works with click?

I have a simple input field like this. <div class="search"> <input type="text" value="y u no work"/> </div>? And I'm trying to focus() it inside a function. So inside of a rand..

How to cast or convert an unsigned int to int in C?

My apologies if the question seems weird. I'm debugging my code and this seems to be the problem, but I'm not sure. Thanks!..

Change Name of Import in Java, or import two classes with the same name

In Python you can do a: from a import b as c How would you do this in Java, as I have two imports that are clashing...

in linux terminal, how do I show the folder's last modification date, taking its content into consideration?

So here's the deal. Let's say I have a directory named "web", so $ ls -la drwx------ 4 rimmer rimmer 4096 2010-11-18 06:02 web BUT inside this directory, web/php/ $ ls -la -rw-r--r-- 1 rimmer r..

How can I select from list of values in Oracle

I am referring to this stackoverflow answer: How can I select from list of values in SQL Server How could something similar be done in Oracle? I've seen the other answers on this page that use UNION a..

How to disable Google asking permission to regularly check installed apps on my phone?

I'm developing an Android app, which I therefore endlessly build and install on my test device. Since a couple days I get with every build/install a question asking Google may regularly check ins..

Differences between Microsoft .NET 4.0 full Framework and Client Profile

The Microsoft .NET Framework 4.0 full installer (32- and 64-bit) is 48.1 MB and the Client Profile installer is 41.0 MB. The extracted installation files are 237 MB and 194 MB resp..

how to get value of selected item in autocomplete

i have here a code from http://jqueryui.com/autocomplete/ it works really good but i cant find a way to get the value of selected item in the text view i tried something like this but its not working ..

"React.Children.only expected to receive a single React element child" error when putting <Image> and <TouchableHighlight> in a <View>

I have the following render method in my React Native code: render() { const {height, width} = Dimensions.get('window'); return ( <View style={styles.container}> <Image..

Convert varchar into datetime in SQL Server

How do I convert a string of format mmddyyyy into datetime in SQL Server 2008? My target column is in DateTime I have tried with Convert and most of the Date style values however I get an error mess..

How can I specify system properties in Tomcat configuration on startup?

I understand that I can specify system properties to Tomcat by passing arguments with the -D parameter, for example "-Dmy.prop=value". I am wondering if there is a cleaner way of doing this by specif..

How to scale a UIImageView proportionally?

I have a UIImageView and the objective is to scale it down proportionally by giving it either a height or width. UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL U..

Passing an integer by reference in Python

How can I pass an integer by reference in Python? I want to modify the value of a variable that I am passing to the function. I have read that everything in Python is pass by value, but there has to ..

How to find the path of Flutter SDK

How to configure Flutter SDK? How to locate the Flutter SDK? I don't know the location of the SDK file. ..

Angular bootstrap datepicker date format does not format ng-model value

I am using bootstrap date-picker in my angular application. However when I select a date from that date-picker underlying ng-model that I have bind gets updated I want that ng-model in one date format..

How to use ArrayList's get() method

I'm new to java (& to OOP too) and I'm trying to understand about the class ArrayList but I don't understand how to use the get(). I tried searching in net, but couldn't find anything helpful...

Getting value of select (dropdown) before change

The thing I want to achieve is whenever the <select> dropdown is changed I want the value of the dropdown before change. I am using 1.3.2 version of jQuery and using on change event but the valu..

Converting byte array to String (Java)

I'm writing a web application in Google app Engine. It allows people to basically edit html code that gets stored as an .html file in the blobstore. I'm using fetchData to return a byte[] of all the ..

Need to ZIP an entire directory using Node.js

I need to zip an entire directory using Node.js. I'm currently using node-zip and each time the process runs it generates an invalid ZIP file (as you can see from this Github issue). Is there another..

What is the reason for the error message "System cannot find the path specified"?

I have folder run in folder system32. When I run cmd from within Total Commander opening a command prompt window with C:\Users\admin as current directory and want to go into that folder, the following..

What is the difference between H.264 video and MPEG-4 video?

Are these both the same? Is H.264 codec of MPEG-4? What if I need to convert flv to high definition H.264 video format? I want make online tv streaming and want to use PHP or Python...

How do I connect to a MySQL Database in Python?

How do I connect to a MySQL database using a python program?..

Populating a razor dropdownlist from a List<object> in MVC

I have a model: public class DbUserRole { public int UserRoleId { get; set; } public string UserRole { get; set; } } public class DbUserRoles { public List<DbU..

How to backup Sql Database Programmatically in C#

I want to write a code to backup my Sql Server 2008 Database using C# in .Net 4 FrameWork. Can anyone help in this...

How to position a div scrollbar on the left hand side?

Is it possible to specify a position (left or right hand side) for the placement of a vertical scrollbar on a div? For example look at this page which explains how to use the overflow attribute. Is ..

How to simulate a mouse click using JavaScript?

I know about the document.form.button.click() method. However, I'd like to know how to simulate the onclick event. I found this code somewhere here on Stack Overflow, but I don't know how to use..

Can you delete multiple branches in one command with Git?

I'd like to clean up my local repository, which has a ton of old branches: for example 3.2, 3.2.1, 3.2.2, etc. I was hoping for a sneaky way to remove a lot of them at once. Since they mostly follow ..

Permission is only granted to system app

I have a System app that uses system permissions and I have those permissions listed in the manifest. Eclipse gives the following error when I try to make a build(command line build works): Permis..

How do AX, AH, AL map onto EAX?

My understanding of x86 registers say that each register can be accessed by the entire 32 bit code and it is broken into multiple accessible registers. In this example EAX being a 32 bit register, if..

How can I pass some data from one controller to another peer controller

I have the following two peer controllers. There's no parent to these: <div data-ng-controller="Controller1"> </div> <div data-ng-controller="Controller2"> The value of xxx is:..

Find and replace string values in list

I got this list: words = ['how', 'much', 'is[br]', 'the', 'fish[br]', 'no', 'really'] What I would like is to replace [br] with some fantastic value similar to &lt;br /&gt; and thus getting..