Questions Tagged with #6510

6510 is a microprocessor designed by MOS Technology, Inc. It is a modified version of the 6502 microprocessor with 8-bit IO port addition. 6510 was made famous by being used on the Commodore 64.

Calculate logarithm in python

I am wondering why the result of log base 10 (1.5) in python = 0.405465108108 while the real answer = 0.176091259. This is the code that I wrote: import math print math.log(1.5) Can someone tell h..

How to send a POST request with BODY in swift

I'm trying to make a post request with a body in swift using Alamofire. my json body looks like : { "IdQuiz" : 102, "IdUser" : "iosclient", "User" : "iosclient", "List":[ { ..

How to make HTTP Post request with JSON body in Swift

I'm trying to make an HTTP post request with a JSON body : How to be able to add an NSdictionnary to the HTTP request body. Here is my code, it doesn't seem to work properly. var entry1 = Response(..

Give column name when read csv file pandas

This is the example of my dataset. >>> user1 = pd.read_csv('dataset/1.csv') >>> print(user1) 0 0.69464 3.1735 7.5048 0 0.030639 0.14982 3.48680 9.2755 1 0.06976..

Reading specific XML elements from XML file

I have the following XML file <lexicon> <word> <base>a</base> <category>determiner</category> <id>E0006419</id> </word> <word> <..

Time in milliseconds in C

Using the following code: #include<stdio.h> #include<time.h> int main() { clock_t start, stop; int i; start = clock(); for(i=0; i<2000;i++) { printf("%d", (..

How to "wait" a Thread in Android

private void startGameTimeElapseThread(){ new Thread(new Runnable() { Date d = new Date(); public void run() { while (gameOn){ Log.d(TAG,""+d.getTime()+..

Java integer to byte array

I got an integer: 1695609641 when I use method: String hex = Integer.toHexString(1695609641); system.out.println(hex); gives: 6510f329 but I want a byte array: byte[] bytearray = new byte[] ..

How do I use dataReceived event of the SerialPort Port Object in C#?

I am attempting to create a small application to collect data received from an external sensor attached to COM10. I have successfully created a small C# console object and application that opens the ..

What should main() return in C and C++?

What is the correct (most efficient) way to define the main() function in C and C++ — int main() or void main() — and why? And how about the arguments? If int main() then return 1 or return 0? Th..

ng-if, not equal to?

I have a simple ng-reapt that displays a list of values.. On some of the outputs, i have a couple of ng-if to show/hide DIVs. HTML: <div ng-repeat="details in myDataSet"> <p>{{ deta..

Openssl is not recognized as an internal or external command

I wish to generate an application signature for my app which will later be integrated with Facebook. In one of Facebook's tutorials, I found this command: keytool -exportcert -alias androiddebugkey -..

Oracle "ORA-01008: not all variables bound" Error w/ Parameters

This is the first time I've dealt with Oracle, and I'm having a hard time understanding why I'm receiving this error. I'm using Oracle's ODT.NET w/ C# with the following code in a query's where claus..

setHintTextColor() in EditText

I have View in which there are two text boxes, and the user can select text color from another view on the same screen (through dialog box). So when the user changes color via dialog box, I am changi..

ASP.Net MVC - Read File from HttpPostedFileBase without save

I am uploading the file by using file upload option. And i am directly send this file from View to Controller in POST method like, [HttpPost] public ActionResult Page2(FormCollection objColle..

No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes

Context: I'm trying to set up Google Analytics for my app. (having 4 custom buildTypes and more than a few productFlavors) It works fine when I select the Build Variant which has the applicationId s..

Check orientation on Android phone

How can I check if the Android phone is in Landscape or Portrait? ..

docker: "build" requires 1 argument. See 'docker build --help'

Trying to follow the instructions for building a docker image from the docker website. this is the error I get will following the instructions..

Call a VBA Function into a Sub Procedure

I know this is a simple question for someone out there, but I have never really used function module at all because I did not understand what they were. So I have a whole bunch of things I can use th..

Moment JS - check if a date is today or in the future

I am trying to use momentjs to check if a given date is today or in the future. This is what I have so far: <script type="text/javascript" src=""><..

Printing leading 0's in C

I'm trying to find a good way to print leading 0, such as 01001 for a ZIP Code. While the number would be stored as 1001, what is a good way to do it? I thought of using either case statements or if t..

Check if a string is null or empty in XSLT

How can I check if a value is null or empty with XSL? For example, if categoryName is empty? I'm using a when choosing construct. For example: <xsl:choose> <xsl:when test="categoryName..

How can I set my Cygwin PATH to find javac?

I have a Windows 7 system on which I have installed the latest Java compiler. I also have the latest Cygwin. I want to use the Java compiler from Cygwin's shell. I edited the PATH variable in Cygwin a..

Can I call methods in constructor in Java?

I have situation, where I want to read configuration file only one time, when class is instantiated. Suppose I have a method named readConfig(), that reads configuration and puts it into a Map object..

Add new attribute (element) to JSON object using JavaScript

How do I add new attribute (element) to JSON object using JavaScript?..

Set color of text in a Textbox/Label to Red and make it bold in C#

I want a text color to be red in color on certain condition. Here is how i want to get it done. string minusvalue = TextBox1.Text.ToString(); if (Convert.ToDouble(minusvalue) < 0) { // set colo..

How do I set the time zone of MySQL?

On one server, when I run: mysql> select now(); +---------------------+ | now() | +---------------------+ | 2009-05-30 16:54:29 | +---------------------+ 1 row in set (0.00 sec) On.. as modal popup?

I want open as modal popup. var features = 'resizable= yes; status= no; scroll= no; help= no; center= yes; width=460;height=140;menubar=no;directories=no;location=no;modal=yes'; wi..

How to set thymeleaf th:field value from other variable

I have a simple text input field where i have to set default value from one object and save its final value in other. The following code is not working. <div th:object="${form}"> <input ..

How to get the innerHTML of selectable jquery element?

I have a php generated list whose list items are selectable using jquery selectable widget. The list for all intents and purposes is: <ul id="#select-image"> <li class="ui-widget-content..

How to get post slug from post in WordPress?

I want to get "abc_15_11_02_3" from How can i do this?..

How do I get an animated gif to work in WPF?

What control type should I use - Image, MediaElement, etc.?..

Compare one String with multiple values in one expression

I have one String variable, str with possible values, val1, val2 and val3. I want to compare (with equal case) str to all of these values using an if statement, for example: if("val1".equalsIgnoreCa..

source of historical stock data

I'm trying to make a stock market simulator (perhaps eventually growing into a predicting AI), but I'm having trouble finding data to use. I'm looking for a (hopefully free) source of historical stock..

Bootstrap 3 collapse accordion: collapse all works but then cannot expand all while maintaining data-parent

I'm using Bootstrap 3 and trying to setup the following accordion/collapse structure: Onload: Each accordion panel in a group is fully collapsed and functions as documented/expected. Button click: E..

Check if cookies are enabled

I am working on a page that requires javascript and sessions. I already have code to warn the user if javascript is disabled. Now, I want to handle the case where cookies are disabled, as the session ..

Selenium WebDriver How to Resolve Stale Element Reference Exception?

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

How do I push amended commit to the remote Git repository?

When I've worked a bit with my source code, I did my usual thing commit and then I pushed to a remote repository. But then I noticed I forgot to organize my imports in the source code. So I do the ame..

Read lines from a text file but skip the first two lines

I've got this macro code in Microsoft Office Word 2003 which reads the lines of a text file. The lines each represent a string value that I need to use later in the code. However, the first two lines..

SQL Server Express 2008 Install Side-by-side w/ SQL 2005 Express Fails

When I try to install a new instance of SQL Server 2008 Express on a development machine with SQL 2005 Express already up and running, the install validation fails because the "SQL 2005 Express tools"..

how does multiplication differ for NumPy Matrix vs Array classes?

The numpy docs recommend using array instead of matrix for working with matrices. However, unlike octave (which I was using till recently), * doesn't perform matrix multiplication, you need to use the..

Opacity of div's background without affecting contained element in IE 8?

I want to set Opacity of div's background without affecting contained element in IE 8. have a any solution and don't answer to set 1 X 1 .png image and set opacity of that image because I am using dyn..

URL rewriting with PHP

I have a URL that looks like: How would I go about converting that URL to: picture.php/Some-text-goes-here/51 I think WordPress does the same. How do I go about making..

Formatting PowerShell Get-Date inside string

I can't get my head around how formatting a datetime variable inside a string works in PowerShell. $startTime = Get-Date Write-Host "The script was started $startTime" ...Do stuff... $endTime = Get..

Common xlabel/ylabel for matplotlib subplots

I have the following plot: fig,ax = plt.subplots(5,2,sharex=True,sharey=True,figsize=fig_size) and now I would like to give this plot common x-axis labels and y-axis labels. With "common", I mean t..

How do I get and set Environment variables in C#?

How can I get Environnment variables and if something is missing, set the value?..

Thread Safe C# Singleton Pattern

I have some questions regarding the the singleton pattern as documented here: The following code is an extract from the article: using System; ..

How to add font-awesome to Angular 2 + CLI project

I'm using Angular 2+ and Angular CLI. How do I add font-awesome to my project?..

How can I color a UIImage in Swift?

I have an image called arrowWhite. I want to colour this image to black. func attachDropDownArrow() -> NSMutableAttributedString { let image:UIImage = UIImage(named: "arrowWhite.png")! let..

Find files with size in Unix

I am looking for a Unix command to print the files with its size. I used this but it didn't work. find . -size +10000k -print. I want to print the size of the file along with the filename/directory..

Allow only numbers to be typed in a textbox

How to allow only numbers to be written in this textbox ? <input type="text" class="textfield" value="" id="extra7" name="extra7"> ..

how to do "press enter to exit" in batch

I am using rake to build my project and I have a build.bat file similar to this: @echo off cls rake When I double click on build.bat the dos window pops up and shows all the progress but closes its..

Issue with adding common code as git submodule: "already exists in the index"

I'm new to git and would appreciate help with adding submodules. I've received two projects sharing some common code. The shared code was just copied into the two projects. I created a separate git re..

How to fit a smooth curve to my data in R?

I'm trying to draw a smooth curve in R. I have the following simple toy data: > x [1] 1 2 3 4 5 6 7 8 9 10 > y [1] 2 4 6 8 7 12 14 16 18 20 Now when I plot it with a standard ..


I have been given a specification that requires the ISO 8601 date format, does any one know the conversion codes or a way of getting these 2 examples: ISO 8601 Extended Date 2000-01-14T13:42Z ISO 86..

Load a bitmap image into Windows Forms using open file dialog

I need to open the bitmap image in the window form using open file dialog (I will load it from drive). The image should fit in the picture box. Here is the code I tried: private void button1_Click(..

Eclipse Build Path Nesting Errors

I'm working on a simple JSP/Servlet/Tomcat webapp for my class. The professor asked us to use a folder structure that is slightly different than the default dynamic web project structure. Rather than ..

SFTP in Python? (platform independent)

I'm working on a simple tool that transfers files to a hard-coded location with the password also hard-coded. I'm a python novice, but thanks to ftplib, it was easy: import ftplib info= ('someuser'..

Java - ignore exception and continue

For my Java application, I am creating an instance of a user information object and populating it with a service that I don't control the source for. The code looks like this: // username given as ..

Where does error CS0433 "Type 'X' already exists in both A.dll and B.dll " come from?

When I run a webapp from Visual Studio 2008 SP1 using the internal web server (not IIS) I receive the above mentioned error. The full error (source file Default.aspx.cs): Compiler Error Message: ..

Get list from pandas dataframe column or row?

I have a dataframe df imported from an Excel document like this: cluster load_date budget actual fixed_price A 1/1/2014 1000 4000 Y A 2/1/2014 12000 10000 Y A 3/1/2014 360..

How to obtain the total numbers of rows from a CSV file in Python?

I'm using python (Django Framework) to read a CSV file. I pull just 2 lines out of this CSV as you can see. What I have been trying to do is store in a variable the total number of rows the CSV also. ..

jQuery Mobile Page refresh mechanism

I'm having a lot of pain understanding how jQuery Mobile handles pages refresh after an ajax update. I'm having a two pages - unique file site: a search engine. First page is a search field. Submit..

Should I use SVN or Git?

I am starting a new distributed project. Should I use SVN or Git, and why?..

How to keep environment variables when using sudo

When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY the command wget works fine without sudo. However if I type sudo wget it says it can't by..

using mailto to send email with an attachment

How can i send an email with an attachment (either local file or a file in the intranet) using outlook 2010? <a href=" report&body=see attachment&attachment=c:..

Easy way to test an LDAP User's Credentials

Is there an easy way to test the credentials of a user against an LDAP instance? I know how to write a Java program that would take the 'User DN' and password, and check it against the LDAP instance...

Send JSON data from Javascript to PHP?

How can I send JSON data from Javascript in the browser, to a server and have PHP parse it there?..

What version of Java is running in Eclipse?

How do I know what version of Java is being run in Eclipse? Is there a way to write code to find out? Is "JRE System Library [JavaSE-1.6]" in "Package Explorer" the right version?..

Nginx: Permission denied for nginx on Ubuntu

I am new to system administration. After installing nginx via puppet on Ubuntu I get the following output: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permiss..

How might I force a floating DIV to match the height of another floating DIV?

My HTML code is just dividing the pages into two columns, 65%,35% respectively. <div style="float : left; width :65%; height:auto;background-color:#FDD017;"> <div id="response"> <..

How to rename HTML "browse" button of an input type=file?

How to rename the browse button as "Select the file"? E.g.: <input type=file name=browse > ..

Number of visitors on a specific page

I'd like to see the number of visitors on a specific page (for which I have URL). I don't find in Analytics where to enter a URL in order to look for statistics for this specific page...

C++ Array Of Pointers

In C++ if I want an array of pointers so that I may have them point to different objects at a latter stage what does the syntax look like. EDIT I need to clarify what I am trying to do I guess. I ha..

How to register multiple implementations of the same interface in Asp.Net Core?

I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { } public class ServiceB : IService { } public class ServiceC : IService { }..

Using a different font with twitter bootstrap

I want to use a different font for my website, which is not a regular webfont. I have created EOT files already. Now how can I integrate those fonts with twitter bootstrap ? Can anyone help ? Thanks..

What are the options for storing hierarchical data in a relational database?

Good Overviews Generally speaking, you're making a decision between fast read times (for example, nested set) or fast write times (adjacency list). Usually, you end up with a combination of the optio..

delete_all vs destroy_all?

I am looking for the best approach to delete records from a table. For instance, I have a user whose user ID is across many tables. I want to delete this user and every record that has his ID in all t..

Call to undefined method mysqli_stmt::get_result

Here's my code: include 'conn.php'; $conn = new Connection(); $query = 'SELECT EmailVerified, Blocked FROM users WHERE Email = ? AND SLA = ? AND `Password` = ?'; $stmt = $conn->mysqli->prepare..

How to use OrderBy with findAll in Spring Data

I am using spring data and my DAO looks like public interface StudentDAO extends JpaRepository<StudentEntity, Integer> { public findAllOrderByIdAsc(); // I want to use some thing like thi..

How do I run a command on an already existing Docker container?

I created a container with -d so it's not interactive. docker run -d shykes/pybuilder bin/bash I see that the container has exited: CONTAINER ID IMAGE COMMAND ..

Writing files in Node.js

I've been trying to find a way to write to a file when using Node.js, but with no success. How can I do that?..

how to show confirmation alert with three buttons 'Yes' 'No' and 'Cancel' as it shows in MS Word

I'm showing a confirmation alert box through JavaScript: function checked() { if (hdnval.toLowerCase() != textbox1.toLowerCase()) { var save = window.confirm('valid') if (save == true) { ..

Angular 4: How to include Bootstrap?

I'm a backend developer and I'm just playing around with Angular4. So I did this installation tutorial: Given this, how can I add bootstrap to the app so ..

How to Create Multiple Where Clause Query Using Laravel Eloquent?

I'm using the Laravel Eloquent query builder and I have a query where I want a WHERE clause on multiple conditions. It works, but it's not elegant. Example: $results = User::where('this', '=', 1) ..

Align the form to the center in Bootstrap 4

I am trying to align the form to the center and keep it responsive. I have tried several ways but no success. I am trying to center all the text and the form. I am using Bootstrap v4. I am not sure if..

What does the CSS rule "clear: both" do?

What does the following CSS rule do: .clear { clear: both; } And why do we need to use it?..

When should you use constexpr capability in C++11?

It seems to me that having a "function that always returns 5" is breaking or diluting the meaning of "calling a function". There must be a reason, or a need for this capability or it wouldn't be in C..

Python requests - print entire http request (raw)?

While using the requests module, is there any way to print the raw HTTP request? I don't want just the headers, I want the request line, headers, and content printout. Is it possible to see what ult..

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

Handling errors in Promise.all

I have an array of Promises that I'm resolving with Promise.all(arrayOfPromises); I go on to continue the promise chain. Looks something like this existingPromiseChain = existingPromiseChain.then(fu..

pass **kwargs argument to another function with **kwargs

I do not understand the following example, lets say I have these functions: # python likes def save(filename, data, **kwargs): fo = openX(filename, "w", **kwargs) # <- #1 fo.write(data) ..

How to check date of last change in stored procedure or function in SQL server

I need to check when function was changed last time. I know how to check creation date (it is in function properties window in SQL Server Management Studio). I found that in SQL Server 2000 it wasn't ..

Select statement to find duplicates on certain fields

Can you help me with SQL statements to find duplicates on multiple fields? For example, in pseudo code: select count(field1,field2,field3) from table where the combination of field1, field2, field..

How do you setLayoutParams() for an ImageView?

I want to set the LayoutParams for an ImageView but cant seem to find out the proper way to do it. I can only find documentation in the API for the various ViewGroups, but not an ImageView. Yet the I..

Python: printing a file to stdout

I've searched and I can only find questions about the other way around: writing stdin to a file :) Is there a quick and easy way to dump the contents of a file to stdout?..

CSS: background image on background color

I have panel which I colored blue if this panel is being selected (clicked on it). Additionally, I add a small sign (.png image) to that panel, which indicates that the selected panel has been already..

How to set javascript variables using MVC4 with Razor

Can someone format the code below so that I can set srcript variables with c# code using razor? The below does not work, i've got it that way to make is easy for someone to help. @{int proID = 123; ..

How can I insert a line break into a <Text> component in React Native?

I want to insert a new line (like \r\n, <br />) in a Text component in React Native. If I have: <text> <br /> Hi~<br /> this is a test message.<br /> </text> Then ..

How to find rows in one table that have no corresponding row in another table

I have a 1:1 relationship between two tables. I want to find all the rows in table A that don't have a corresponding row in table B. I use this query: SELECT id FROM tableA WHERE id NOT IN (SELE..

How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how you..

Eclipse memory settings when getting "Java Heap Space" and "Out of Memory"

When trying to launch and run a flex/java project in eclipse I kept getting a "Out of Memory Exception" and "Java Heap Space" using Eclipse, Tomcat and a JRE. While researching trying to adjust the m..

Finding common rows (intersection) in two Pandas dataframes

Assume I have two dataframes of this format (call them df1 and df2): +------------------------+------------------------+--------+ | user_id | business_id | rating | +-------..

How can I remove all my changes in my SVN working directory?

I have an SVN working directory. I made some changes in that directory, and it shows in svn status. But is there any way for me to remove all my changes in there and just get everything from the trunk..

Group dataframe and get sum AND count?

I have a dataframe that looks like this: Company Name Organisation Name Amount 10118 Vifor Pharma UK Ltd Welsh Assoc for Gastro & Endo 2700.00 10119 Vifor Pharma UK..

Cmake is not able to find Python-libraries

Getting this error: sudo: unable to resolve host coderw@ll -- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandle..

How to uninstall a package installed with pip install --user

There is a --user option for pip which can install a Python package per user: pip install --user [python-package-name] I used this option to install a package on a server for which I do not have ro..

NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference

I am getting this error at runtime. java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Strin..

change cursor to finger pointer

I have this a and I don't know that I need to insert into the "onmouseover" so that the cursor will change to finger pointer like a regular link: <a class="menu_links" onclick="displayData(11,1,0,..

equals vs Arrays.equals in Java

When comparing arrays in Java, are there any differences between the following 2 statements? Object[] array1, array2; array1.equals(array2); Arrays.equals(array1, array2); And if so, what are they?..

Get Today's date in Java at midnight time

I need to create two date objects. If the current date and time is March 9th 2012 11:30 AM then date object d1 should be 9th March 2012 12:00 AM date object d2 should contain the current dat..

Merge 2 DataTables and store in a new one

If I have 2 DataTables (dtOne and dtTwo) and I want to merge them and put them in another DataTable (dtAll). How can I do this in C#? I tried the Merge statement on the datatable, but this returns v..

Meaning of "[: too many arguments" error from if [] (square brackets)

I couldn't find any one simple straightforward resource spelling out the meaning of and fix for the following BASH shell error, so I'm posting what I found after researching it. The error: -bash: [:..

Does Python have “private” variables in classes?

I'm coming from the Java world and reading Bruce Eckels' Python 3 Patterns, Recipes and Idioms. While reading about classes, it goes on to say that in Python there is no need to declare instance var..

How to specify jackson to only use fields - preferably globally

Default jackon behaviour seems to use both properties (getters and setters) and fields to serialize and deserialize to json. I would like to use the fields as the canonical source of serialization co..

C library function to perform sort

Is there any library function available in C standard library to do sort? ..

Differences between Html.TextboxFor and Html.EditorFor in MVC and Razor

Why by default were these changed when adding a new "edit" view? What are advantages when using EditorFor() vs. TextboxFor()? I found this By default, the Create and Edit scaffolds now use the ..

Reading from file using read() function

I have to write a program that reads numbers in separate lines each. Is it possible to read only one line of the file and then read an int from the buffer, and so on until the end of file? It is reall..

Conditionally change img src based on model data

I want to represent model data as different images using Angular but having some trouble finding the "right" way to do it. The Angular API docs on expressions say that conditional expressions are not..

What is the difference between g++ and gcc?

What is the difference between g++ and gcc? Which one of them should be used for general c++ development?..

Error creating bean with name

I'm using SpringMVC for a web app as well as to inject my sessionFactory for Hibernate. When I run my application, I get the following error... Apr 29, 2012 3:18:05 PM org.apache.catalina.core.AprLi..

Is there a way to "limit" the result with ELOQUENT ORM of Laravel?

Is there a way to "limit" the result with ELOQUENT ORM of Laravel? SELECT * FROM `games` LIMIT 30 , 30 And with Eloquent ? ..

How to delete or change directory of a cloned git repository on a local computer

Used git clone [url] to clone an open source project but it cloned to the C:\Documents and Setings\$USER\project What I wanted to do is clone the project to C:\project. I don't want to have duplica..

What is a PDB file?

What is a PDB file and how can I exclude it from the release folder when I rebuild my solution?..

How do I modify fields inside the new PostgreSQL JSON datatype?

With postgresql 9.3 I can SELECT specific fields of a JSON data type, but how do you modify them using UPDATE? I can't find any examples of this in the postgresql documentation, or anywhere online. I ..

Closing Twitter Bootstrap Modal From Angular Controller

I have a modal window that I use to present a form to users. They enter the information and then press a button the has an ng-click. The server processes the request and sends back a response. When..

Simple java program of pyramid

I am a beginner in Java programing and I want to print a pyramid ,but due to mistake in coding I am not getting favorable output. class p1 { public static void main(String agrs[]) { Syste..

How to exit from the application and show the home screen?

I have an application where on the home page I have buttons for navigation through the application. On that page I have a button "EXIT" which when clicked should take the user to the home screen on t..

What are these ^M's that keep showing up in my files in emacs?

So I think it may have to do with textmate, but we work in a small team and are having some issues with full-file conflicts of nearly identical files in git because each line of one branch has a ^M ap..

Java: Check if command line arguments are null

I am looking to do some error checking for my command line arguments public static void main(String[] args) { if(args[0] == null) { System.out.println("Proper Usage is: java program f..

Reading from memory stream to string

I am trying to write an object to an Xml string and take that string and save it to a DB. But first I need to get the string... private static readonly Encoding LocalEncoding = Encoding.UTF8; ..

Add SUM of values of two LISTS into new LIST

I have the following two lists: first = [1,2,3,4,5] second = [6,7,8,9,10] Now I want to add the items from both of these lists into a new list. output should be third = [7,9,11,13,15] ..

Button Width Match Parent

I want to know that how can I set a width to match parent layout width new Container( width: 200.0, padding: const EdgeInsets.only(top: 16.0), child: new RaisedButton( child: new Text( ..

What's the simplest way to list conflicted files in Git?

I just need a plain list of conflicted files. Is there anything simpler than: git ls-files -u | cut -f 2 | sort -u or: git ls-files -u | awk '{print $4}' | sort | uniq I guess I could set up ..

Cross-platform way of getting temp directory in Python

Is there a cross-platform way of getting the path to the temp directory in Python 2.6? For example, under Linux that would be /tmp, while under XP C:\Documents and settings\[user]\Application setti..

How to remove package using Angular CLI?

Angular 6 has new CLI command ng add <package>. How can I remove the package using Angular CLI? UPDATE documentation ng add will use your package manager to download new dependencies and ..

Command output redirect to file and terminal

I am trying to throw command output to file plus console also. This is because i want to keep record of output in file. I am doing following and it appending to file but not printing ls output on term..

Calculating bits required to store decimal number

This is a homework question that I am stuck with. Consider unsigned integer representation. How many bits will be required to store a decimal number containing: i) 3 digits ii) 4 digits iii) 6..

Web Application Problems (web.config errors) HTTP 500.19 with IIS7.5 and ASP.NET v2

This is driving the whole team crazy. There must be some simple mis-configured part of IIS or our Web Server, but every time we try to run out ASP.NET Web Application on IIS 7.5 we get the following e..

Set port for php artisan.php serve

How do we set a custom port for test server? Normally when we do php artisan serve the folder gets served as : localhost:8000 How do could we access one folder as: localhost:8080 I want to ..

This page didn't load Google Maps correctly. See the JavaScript console for technical details

I am using this code from Google Map API's and it is not working <!DOCTYPE html> <html> <head> <title>Place Autocomplete</title> <meta name="viewport" content="ini..

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create() function and a destroy() function. I..

jQuery pass more parameters into callback

Is there a way to pass more data into a callback function in jQuery? I have two functions and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as w..

C split a char array into different variables

In C how can I separate a char array by a delimiter? Or is it better to manipulate a string? What are some good C char manipulation functions? ..

joining two select statements

Can anyone tell me why the following won't work? It complains of a syntax error near the join key word between the two selects. SELECT * FROM ( select * from orders_products inner JOIN orders ON ord..

How to remove word wrap from textarea?

my simple textarea doesn't show a horizontal bar when text overflows. It wraps text for a new line. So how do I remove wordwrap and display horizontal bar when text overflows?..

Oracle 12c Installation failed to access the temporary location

I have Windows 8.1 64-bit OS running on 64-bit architecture. I am installing a fresh copy of Oracle 12C, means I haven't installed any version before on my system. During the installation, I encounte..

Is there a command to undo git init?

I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?..

How to convert flat raw disk image to vmdk for virtualbox or vmplayer?

I have some old images of old Linux filesystems in flat file format. they can be used by Bochs, but I need to run them with Virtual Box. Virtual Box cannot use images in this format, so I need to conv..

Getting all types in a namespace via reflection

How do you get all the classes in a namespace through reflection in C#?..

jQuery if checkbox is checked

I have a function below that I want to only trigger when a checkbox in the same tr is checked. Please tell me what I am doing wrong, the usual methods are not working. Thanks JS $(".add_menu_item_ta..

A simple scenario using wait() and notify() in java

Can I get a complete simple scenario i.e. tutorial that suggest how this should be used, specifically with a Queue?..

How to get a function name as a string?

In Python, how do I get a function name as a string, without calling the function? def my_function(): pass print get_function_name_as_string(my_function) # my_function is not in quotes should ..

sudo echo "something" >> /etc/privilegedFile doesn't work

This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux. There are a lot of times when I just want to append something to /etc/hosts or a similar file b..

How can I join on a stored procedure?

I have a stored procedure that takes no parameters, and it returns two fields. The stored procedure sums up all transactions that are applied to a tenant, and it returns the balance and the id of the ..

Use dynamic (variable) string as regex pattern in JavaScript

I want to add a (variable) tag to values with regex, the pattern works fine with PHP but I have troubles implementing it into JavaScript. The pattern is (value is the variable): /(?!(?:[^<]+>|..

How to configure nginx to enable kinda 'file browser' mode?

Once I've seen this before when I type a URL, instead of give me a html page, it gives me a 'file browser' like interface to browse all the files in the given location. I think ..

How to update MySql timestamp column to current timestamp on PHP?

I want to update the columns of data type timestamp manually through my PHP code. Can you please tell me how to do that?..

Parsing arguments to a Java command line program

What if I wanted to parse this: java MyProgram -r opt1 -S opt2 arg1 arg2 arg3 arg4 --test -A opt3 And the result I want in my program is: regular Java args[] of size=4 org.apache.commons.cli.Opti..

Check if value exists in Postgres array

Using Postgres 9.0, I need a way to test if a value exists in a given array. So far I came up with something like this: select '{1,2,3}'::int[] @> (ARRAY[]::int[] || value_variable::int) But I k..

How to handle screen orientation change when progress dialog and background thread active?

My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler. This all works fine, except when screen orientation..

How to convert InputStream to FileInputStream

I have this line in my program : InputStream Resource_InputStream=this.getClass().getClassLoader().getResourceAsStream("Resource_Name"); But how can I get FileInputStream from it [Resource_InputStr..

How to fill 100% of remaining height?

+--------------------+ | | | | | | | | | 1 | | | | | | ..

Resolve Git merge conflicts in favor of their changes during a pull

How do I resolve a git merge conflict in favor of pulled changes? Basically I need to remove all conflicting changes from a working tree without having to go through all of the conflicts with a git ..

phpMyAdmin says no privilege to create database, despite logged in as root user

I need to login to mysql using root user and create a database. However, when I login to PhpMyAdmin as root user, it tells me that it has "no privileges", therefore cannot create a database. I did no..

jQuery/Javascript function to clear all the fields of a form

I am looking for a jQuery function that will clear all the fields of a form after having submitted the form. I do not have any HTML code to show, I need something generic. Can you help? Thanks!..

What is the most effective way for float and double comparison?

What would be the most efficient way to compare two double or two float values? Simply doing this is not correct: bool CompareDoubles1 (double A, double B) { return A == B; } But something like..

ASP.NET MVC: What is the correct way to redirect to pages/actions in MVC?

I am fairly new to MVC but not sure exactly which Redirect... replaces the standard redirect used in WebForms is the standard Response.Redirect() For instance, I need to redirect to other pages in a c..

How to make <a href=""> link look like a button?

I have this button image: I was wondering whether it would be possible to make a simple <a href="">some words</a> and style that link to appear as that button? If it is possible, how do..

How to check if a string starts with a specified string?

I'm trying to check if a string starts with http. How can I do this check? $string1 = ''; $string2 = ''; ..

Django Model() vs Model.objects.create()

What it the difference between running two commands: foo = FooModel() and bar = BarModel.objects.create() Does the second one immediately create a BarModel in the database, while for FooModel, t..

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

How do I run a node.js app as a background service?

Since this post has gotten a lot of attention over the years, I've listed the top solutions per platform at the bottom of this post. Original post: I want my node.js server to run in the backgroun..

Get fragment (value after hash '#') from a URL in php

How can i select the fragment after the '#' symbol in my URL using PHP? The result that i want is "photo45". This is an example URL:

Finding out current index in EACH loop (Ruby)

Possible Duplicate: Automatic counter in Ruby for each? I want to find out the current index while i am in the each loop. how do i do so? X=[1,2,3] X.each do |p| puts "current index..." ..

Parse date string and change format

I have a date string with the format 'Mon Feb 15 2010'. I want to change the format to '15/02/2010'. How can I do this?..

Calling Member Functions within Main C++

#include <iostream> using namespace std; class MyClass { public: void printInformation(); }; void MyClass::printInformation() { return; } int main() { MyClass::printInformat..

How do I force a vertical scrollbar to appear?

My site has both very short and longer pages. Since I center it in the viewport with margin: 0 auto, it jumps around a few pixels when switching from a page that has a scrollbar to one that hasn't and..

Share application "link" in Android

I want my application user to be able to share/recommend my app to other users. I use the ACTION_SEND intent. I add plain text saying something along the lines of: install this cool application. But I..

How to make <div> fill <td> height

I've looked through several posts on StackOverflow, but haven't been able to find an answer to this rather simple question. I have an HTML construct like this: <table> <tr> <td ..

Return multiple values to a method caller

I read the C++ version of this question but didn't really understand it. Can someone please explain clearly if it can be done and how?..

AmazonS3 putObject with InputStream length example

I am uploading a file to S3 using Java - this is what I got so far: AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials("XX","YY")); List<Bucket> buckets = s3.listBuckets(); s3.putObject..

How to scale Docker containers in production

So I recently discovered this awesome tool, and it says Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same cont..

Getting Hour and Minute in PHP

I need to get the current time, in Hour:Min format can any one help me in this...

How do I check if an integer is even or odd?

How can I check if a given number is even or odd in C?..

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL in different browsers? Does it differ among browsers? Is a maximum URL length part of the HTTP specification?..

How can I introduce multiple conditions in LIKE operator?

I want to write an SQL statement like below: select * from tbl where col like ('ABC%','XYZ%','PQR%'); I know it can be done using OR. But I want to know is there any better solution...

vim line numbers - how to have them on by default?

I can :set number from within a file I'm editing but how can I have them always be on by default?..

What are the calling conventions for UNIX & Linux system calls (and user-space functions) on i386 and x86-64

Following links explain x86-32 system call conventions for both UNIX (BSD flavor) & Linux:

Multipart forms from C# client

I am trying to fill a form in a php application from a C# client (Outlook addin). I used Fiddler to see the original request from within the php application and the form is transmitted as a multipart/..

constant pointer vs pointer on a constant value

What is the difference between the following declarations? char * const a; const char * a; In order to understand the difference I wrote this small program: #include <stdio.h> #include <s..

CSS transition with visibility not working

In the fiddle below, I've a transition on visibility and opacity separately. The latter works but the former doesn't. Moreover, in case of visibility, the transition time is interpreted as delay on ho..

Java, reading a file from current directory?

I want a java program that reads a user specified filename from the current directory (the same directory where the .class file is run). In other words, if the user specifies the file name to be "myF..

How to get the separate digits of an int number?

I have numbers like 1100, 1002, 1022 etc. I would like to have the individual digits, for example for the first number 1100 I want to have 1, 1, 0, 0. How can I get it in Java?..

Check if at least two out of three booleans are true

An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true. My solution follows: boolean atLeastTwo(boolean a, ..

jQuery - Appending a div to body, the body is the object?

When I'm adding a div to body, it's returning the body as the object and then whenever I use that - it's obviously using body. Bad. Code:- var holdyDiv = $('body').append('div'); $(holdyDiv).attr('i..

using batch echo with special characters

This maybe really easy but there were no answers for it over the net. I want to echo a XML line via batch into a file but it misunderstands the XML closing tag for redirection ">". The line is as foll..

Download and save PDF file with Python requests module

I am trying to download a PDF file from a website and save it to disk. My attempts either fail with encoding errors or result in blank PDFs. In [1]: import requests In [2]: url = 'http://www.hrecos...

"java.lang.OutOfMemoryError : unable to create new native Thread"

We are getting "java.lang.OutOfMemoryError : unable to create new native Thread" on 8GB RAM VM after 32k threads (ps -eLF| grep -c java) However, "top" and "free -m" shows 50% free memory available. ..

Haskell: Converting Int to String

I know you can convert a String to an number with read: Prelude> read "3" :: Int 3 Prelude> read "3" :: Double 3.0 But how do you grab the String representation of an Int value?..

google maps v3 marker info window on mouseover

I have scoured stackoverflow and other forums including the google maps v3 api docs for an answer but I cannot find how to change the event that fires the marker info window from click to mouseover in..

How to find nth occurrence of character in a string?

Similar to a question posted here, am looking for a solution in Java. That is, how to find the index of nth occurrence of a character/string from a string? Example: "/folder1/folder2/folder3/". In ..

AngularJS - difference between pristine/dirty and touched/untouched

AngularJS Developer Guide - Forms tell there are many styles and directives regarding forms and fields. For each one, a CSS class: ng-valid ng-invalid ng-pristine ng-dirty ng-touched ng-untouched W..

How to achieve pagination/table layout with Angular.js?

Let's say I receive an object literal with 15+ objects and I need to display them in a nice layout (not all in a row), what is the most efficient method for controlling when the line should break/page..

"Error: Main method not found in class MyClass, please define the main method as..."

New Java programmers often encounter these messages when they attempt to run a Java program. Error: Main method not found in class MyClass, please define the main method as: public static void m..

kubectl apply vs kubectl create?

What I understood by the documentation is that: kubectl create = Creates a new k8s resource in the cluster kubectl replace = Updates a resource in the live cluster kubectl apply = If I want to do cr..

Show a leading zero if a number is less than 10

Possible Duplicate: JavaScript equivalent to printf/string.format How can I create a Zerofilled value using JavaScript? I have a number in a variable: var number = 5; I need that numbe..

MySQL: how to get the difference between two timestamps in seconds

Is there a way I can make a query in MySQL that will give me the difference between two timestamps in seconds, or would I need to do that in PHP? And if so, how would I go about doing that?..

trigger click event from angularjs directive

How can i trigger a click event for li elements specifying their index from the angularjs directive? I have tried using $first for triggering click for the first element, but its not working. Thanks ..

C# : "A first chance exception of type 'System.InvalidOperationException'"

Working on a class assignment in C#, I came across a program crash without any error (except what's written in VS2010's debug window). Here is the typical code causing the crash : public partial clas..