Questions Tagged with #Stack dump

How to make a copy of a file in android?

In my app I want to save a copy of a certain file with a different name (which I get from user) Do I really need to open the contents of the file and write it to another file? What is the best way t..

Rails 4 Authenticity Token

I was working on a new Rails 4 app (on Ruby 2.0.0-p0) when I ran into some authenticity token problems. While writing a controller that responds to json (using the respond_to class method), I got to ..

Python executable not finding libpython shared library

I am installing Python 2.7 on CentOS 5. I built and installed Python as follows ./configure --enable-shared --prefix=/usr/local make make install When I try to run /usr/local/bin/python, I get this..

What is meant by Ems? (Android TextView)

What is meant by Ems (related to a TextView)? For example in android:ems setEms(int) Makes the TextView be exactly this many ems wide...

SQL Server - Convert date field to UTC

I have recently updated my system to record date/times as UTC as previously they were storing as local time. I now need to convert all the local stored date/times to UTC. I was wondering if there is ..

Extract directory path and filename

I have a variable which has the directory path, along with the file name. I want to extract the filename alone from the Unix directory path and store it in a variable. fspec="/exp/home1/abc.txt" ..

How can I find out a file's MIME type (Content-Type)?

Is there a way to find out the MIME type (or is it called "Content-Type"?) of a file in a Linux bash script? The reason I need it is because ImageShack appears to need it to upload a file, as for som..

What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?

The title pretty much says it all. What's the simplest/most elegant way that I can convert, in Java, a string from the format "THIS_IS_AN_EXAMPLE_STRING" to the format "ThisIsAnExampleString"? I figur..

In Javascript, how do I check if an array has duplicate values?

Possible Duplicate: Easiest way to find duplicate values in a javascript array How do I check if an array has duplicate values? If some elements in the array are the same, then return true..

configure Git to accept a particular self-signed server certificate for a particular https remote

The sysadmin for a project I'm on has decided that SSH is "too much trouble"; instead, he has set up Git to be accessible via an https:// URL (and username/password authentication). The server for thi..

How can I select records ONLY from yesterday?

I've spent hours searching the web for an answer to this question... Here's what I currently have: select * from order_header oh where tran_date = sysdate-1 ..

How can I solve the error LNK2019: unresolved external symbol - function?

I get this error, but I don't know how to fix it. I'm using Visual Studio 2013. I made the solution name MyProjectTest This is the structure of my test solution: -function.h #ifndef MY_FUNCTION_H #de..

Detecting arrow key presses in JavaScript

How do I detect when one of the arrow keys are pressed? I used this to find out: function checkKey(e) { var event = window.event ? window.event : e; console.log(event.keyCode) } Though it w..

Hide text within HTML?

I'll be completing a website soon for my university (in fact, it's mostly finished now other than some mild tweaking) and I'd like to add a hidden thank-you to some bloggers who helped, and the stack ..

Android adding simple animations while setvisibility(view.Gone)

I have designed a simple layout.I have finished the design without animation, but now I want to add animations when textview click event and I don't know how to use it. Did my xml design looks good or..

Using Vim's tabs like buffers

I have looked at the ability to use tabs in Vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers. I would like every..

How do I fetch only one branch of a remote Git repository?

I'd like to grab a single branch (not all of them) of a remote repository and create a local tracking branch that can track further updates to that remote branch. The other branches in the remote rep..

Vertical align in bootstrap table

I am trying to display a table with 4 columns, one of which is an image. Below is the snapshot:- I want to vertically align the text to the center position, but somehow the css doesn't seem to work. ..

How does the "view" method work in PyTorch?

I am confused about the method view() in the following code snippet. class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) ..

"int cannot be dereferenced" in Java

I'm fairly new to Java and I'm using BlueJ. I keep getting this "Int cannot be dereferenced" error when trying to compile and I'm not sure what the problem is. The error is specifically happening in ..

Capturing a single image from my webcam in Java or Python

I want to capture a single image from my webcam and save it to disk. I want to do this in Java or Python (preferably Java). I want something that will work on both 64-bit Win7 and 32-bit Linux. EDI..

Copy all the lines to clipboard

Is there any way to copy all lines from open file to clipboard in VI editor. I tried yG but it's not using clipboard to store those lines. So is it possible?..

Looping through array and removing items, without breaking for loop

I have the following for loop, and when I use splice() to remove an item, I then get that 'seconds' is undefined. I could check if it's undefined, but I feel there's probably a more elegant way to do..

What's the difference between a null pointer and a void pointer?

Whats the difference between a Null pointer & a Void pointer?..

Understanding the basics of Git and GitHub

I don't fully understand the purpose of using Git or Github; I know it helps to keep track of your changes and it's helpful for people collaborating with other people, but I don't collaborate with any..

How to input matrix (2D list) in Python?

I tried to create this code to input an m by n matrix. I intended to input [[1,2,3],[4,5,6]] but the code yields [[4,5,6],[4,5,6]. Same things happen when I input other m by n matrix, the code yields ..

django import error - No module named core.management

Ok, I see plenty of these errors around. I have tried everything I know to do and have yet to figure this out. I am working on a development server running python 2.5 and Django 1.3. Django 1.3 was i..

Return index of greatest value in an array

I have this: var arr = [0, 21, 22, 7]; What's the best way to return the index of the highest value into another variable?..

Convert datetime value into string

I am fetching the current date & time using NOW() in mysql. I want to convert the date value into a varchar and concat it with another string. How do I do it?..

What are the aspect ratios for all Android phone and tablet devices?

I'm looking for a list of all screen aspect ratios for popular Android based Phones and Tablets...

Apply a function to every row of a matrix or a data frame

Suppose I have a n by 2 matrix and a function that takes a 2-vector as one of its arguments. I would like to apply the function to each row of the matrix and get a n-vector. How to do this in R? For ..

How to extract duration time from ffmpeg output?

To get a lot of information about a media file one can do ffmpeg -i <filename> where it will output a lot of lines, one in particular Duration: 00:08:07.98, start: 0.000000, bitrate: 2080 kb..

Asynchronous shell exec in PHP

I've got a PHP script that needs to invoke a shell script but doesn't care at all about the output. The shell script makes a number of SOAP calls and is slow to complete, so I don't want to slow down ..

SQL Server stored procedure parameters

I am developing a framework, where in I am a calling stored procedure with dynamically created parameters. I am building parameter collection at the runtime. The problem occurs when I am passing a p..

How to find out which JavaScript events fired?

I have a select list: <select id="filter"> <option value="Open" selected="selected">Open</option> <option value="Closed">Closed</option> </select> When I sel..

How to add (vertical) divider to a horizontal LinearLayout?

I'm trying to add a divider to a horizontal linear layout but am getting nowhere. The divider just doesn't show. I am a total newbie with Android. This is my layout XML: <RelativeLayout xmlns:and..

Group query results by month and year in postgresql

I have the following database table on a Postgres server: id date Product Sales 1245 01/04/2013 Toys 1000 1245 01/04/2013 Toys 2000 1231 01/02/2013 Bicycle..

How does Trello access the user's clipboard?

When you hover over a card in Trello and press Ctrl+C, the URL of this card is copied to the clipboard. How do they do this? As far as I can tell, there is no Flash movie involved. I've got Flashbloc..

How to get ELMAH to work with ASP.NET MVC [HandleError] attribute?

I am trying to use ELMAH to log errors in my ASP.NET MVC application, however when I use the [HandleError] attribute on my controllers ELMAH doesn't log any errors when they occur. As I am guessing i..

Excluding files/directories from Gulp task

I have a gulp rjs task that concatenates and uglifies all my custom .JS files (any non vendor libraries). What i am trying to do, is exclude some files/directories from this task (controllers and dir..

How do I restore a dump file from mysqldump?

I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine. I tried using MySQL Administrator, but I got the following error: The selected file was g..

show and hide divs based on radio button click

I want to be able to dynamically change what divs are show using radio button and jQuery - HTML: <div id="myRadioGroup"> 2 Cars<input type="radio" name="cars" checked="checked" value="..

PHP Fatal error when trying to access phpmyadmin mb_detect_encoding

Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. Trying to debug a different problem and ran into this. Not really possible to revert back ..

nginx: how to create an alias url route?

basically an server instance is running at somesite.com/production/folder/here?param=here&count=1 I want to point someite.com/demo to /production/folder/here so when user types somesite.com/pr..

How to disable all div content

I was under the assumption that if I disabled a div, all content got disabled too. However, the content is grayed but I can still interact with it. Is there a way to do that? (disable a div and get ..

jQuery UI Datepicker - Multiple Date Selections

Is there a way to use the jQuery UI Datepicker widget to select multiple dates? All help is appreciated! If its not posable to use the jquery UI datepicker then is there something similar that doe..

Postgres: INSERT if does not exist already

I'm using Python to write to a postgres database: sql_string = "INSERT INTO hundred (name,name_slug,status) VALUES (" sql_string += hundred + ", '" + hundred_slug + "', " + status + ");" cursor.execu..

Set variable in jinja

I would like to know how can I set a variable with another variable in jinja. I will explain, I have got a submenu and I would like show which link is active. I tried this: {% set active_link = {{rec..

Mockito - NullpointerException when stubbing Method

So I started writing tests for our Java-Spring-project. What I use is JUnit and Mockito. It's said, that when I use the when()...thenReturn() option I can mock services, without simulating them or s..

Can I load a .NET assembly at runtime and instantiate a type knowing only the name?

Is it possible to instantiate an object at runtime if I only have the DLL name and the class name, without adding a reference to the assembly in the project? The class implements a interface, so once ..

How can I clear an HTML file input with JavaScript?

I want to clear the file input in my form. I know about setting the sources to the same method... But that method wont erase the selected file path. Note: I would like to avoid having to reload the ..

How to get ID of button user just clicked?

Possible Duplicate: Getting the ID of the element that fired an event using JQuery I have many buttons with ID attribute. <button id="some_id1"></button> <button id="some_id..

Attaching click to anchor tag in angular

I am trying to attach click event to anchor tags (coming from ajax) and block the default redirection. How can I do it in angular ? <ul> <li><a href="/abc"><p>abc</p&g..

How to reset radiobuttons in jQuery so that none is checked

I have radio buttons in HTML like this: <td> <input id="radio1" type="radio" name="correctAnswer" value="1">1</input> <input id="radio2" type="radio" name="correctAnswer"..

Assigning default value while creating migration file

rails generate migration AddRetweetsCountToTweet retweets_count:integer Ok I use above line to create migration file that automatically generates code in the generated file to add a column to a mod..

Difference between margin and padding?

What exactly is the difference between margin and padding in CSS? It really doesn't seem to serve much purpose. Could you give me an example of where the differences lie (and why it is important to kn..

Restart container within pod

I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test. Is it possible to restart a single container within a pod and how? If not, how do I restart..

Difference between numpy dot() and Python 3.5+ matrix multiplication @

I recently moved to Python 3.5 and noticed the new matrix multiplication operator (@) sometimes behaves differently from the numpy dot operator. In example, for 3d arrays: import numpy as np a = np...

Comments in Android Layout xml

I would like to enter some comments into the layout XML files, how would I do that?..

CURRENT_TIMESTAMP in milliseconds

Is there any way to get milliseconds out of a timestamp in MySql or PostgreSql (or others just out of curiosity)? SELECT CURRENT_TIMESTAMP --> 2012-03-08 20:12:06.032572 Is there anything like t..

Refresh certain row of UITableView based on Int in Swift

I am a beginning developer in Swift, and I am creating a basic app that includes a UITableView. I want to refresh a certain row of the table using: self.tableView.reloadRowsAtIndexPaths(paths, withRo..

ReactJS SyntheticEvent stopPropagation() only works with React events?

I'm trying to use event.stopPropagation() within a ReactJS component to stop a click event from bubbling up and triggering a click event that was attached with JQuery in legacy code, but it seems like..

Centering floating divs within another div

I've searched other questions and, while this problem seems similar to a couple of others, nothing I've seen so far seems to address the issue that I'm having. I have a div which contains a number of..

"Parameter" vs "Argument"

I got parameter and argument kind of mixed up and did not really pay attention to when to use one and when to use the other. Can you please tell me? ..

Getting SyntaxError for print with keyword argument end=' '

I have this python script where I need to run gdal_retile.py, but I get an exception on this line: if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ..

How do I change screen orientation in the Android emulator?

How do we change emulator screen orientation to landscape or portrait?..

Ansible playbook shell output

I would like to quickly monitor some hosts using commands like ps,dstat etc using ansible-playbook. The ansible command itself perfectly does what I want, for instance I'd use: ansible -m shell -a "p..

filemtime "warning stat failed for"

I already read it so many questions and answers about it but I can't still solve my problem... I'm trying to create a function that deletes all the files with "xml" or "xsl" extension that has been c..

How to play videos in android from assets folder or raw folder?

I am trying to play a video in android emulator I have the video in my assets folder as well as the raw folder But after doing some research still i cant play video in my emulator i am working on and..

How to use Scanner to accept only valid int as input

I'm trying to make a small program more robust and I need some help with that. Scanner kb = new Scanner(System.in); int num1; int num2 = 0; System.out.print("Enter number 1: "); num1 = kb.nextInt();..

What are Maven goals and phases and what is their difference?

What is the difference/relation between Maven goals and phases? How they are related to each other?..

Generate insert script for selected records?

I have a table with the following data: Pk_Id ProductName Fk_CompanyId Price ------------------------------------------------------ 1 AMX 1 10..

Using colors with printf

When written like this, it outputs text in blue: printf "\e[1;34mThis is a blue text.\e[0m" But I want to have format defined in printf: printf '%-6s' "This is text" Now I have tried several opt..

Any good boolean expression simplifiers out there?

I was refactoring old code and encountered several IF conditions that were way too complex and long and I'm certain they can be simplified. My guess is that those conditions grew so much because of la..

MongoDB: How to query for records where field is null or not set?

I have an Email document which has a sent_at date field: { 'sent_at': Date( 1336776254000 ) } If this Email has not been sent, the sent_at field is either null, or non-existant. I need to get th..

Convert to absolute value in Objective-C

How do I convert a negative number to an absolute value in Objective-C? i.e. -10 becomes 10?..

SQL Server stored procedure creating temp table and inserting value

I am trying to select values from different table and inset it in to the temporary table. I need a identity field in the temporary table. When I try to execute the following code it throws an error: ..

How to use adb command to push a file on device without sd card

How to push a file from computer to an Android device having no SD Card in it. I tried: C:\anand>adb push anand.jpg /data/local 3399 KB/s (111387 bytes in 0.032s) C:\anand>adb push anand.jpg /d..

duplicate 'row.names' are not allowed error

I am trying to load a csv file that has 14 columns like this: StartDate, var1, var2, var3, ..., var14 when I issue this command: systems <- read.table("http://getfile.pl?test.csv", header = TRU..

Does VBA contain a comment block syntax?

In VBA is there a short way to comment out a block of code the same way java uses /*...*/?..

Rails: How do I create a default value for attributes in Rails activerecord's model?

I want to create a default value for an attribute by defining it in ActiveRecord. By default everytime the record is created, I want to have a default value for attribute :status. I tried to do this: ..

How to match, but not capture, part of a regex?

I have a list of strings. Some of them are of the form 123-...456. The variable portion "..." may be: the string "apple" followed by a hyphen, e.g. 123-apple-456 the string "banana" followed by a hy..

Vue.js img src concatenate variable and text

I want to concatenate Vue.js variable with image URL. What I computed: imgPreUrl : function() { if (androidBuild) return "android_asset/www/"; else return ""; } If I build for android: &l..

Column/Vertical selection with Keyboard in SublimeText 3

I'm on a Mac. I have 7 columns in Sublime Text 3, each 300 lines each. If possible, I would like to select only the 4th column using a single keyboard shortcut. Unsuitable options ctrl + shift + u..

Get the first element of an array

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

Split array into chunks of N length

How to split an array (which has 10 items) into 4 chunks, which contain a maximum of n items. var a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; //a function splits it to four arrays. consol..

Using ADB to capture the screen

I'm trying to get a screenshot of the phone screen as fast as possible. Currently, I am doing: adb shell screencap -p /sdcard/screencap.png && adb pull /sdcard/screencap.png Howeve..

Parse date without timezone javascript

I want to parse date without timezone in JavaScript. I have tried: new Date(Date.parse("2005-07-08T00:00:00+0000")); Returns Fri Jul 08 2005 02:00:00 GMT+0200 (Central European Daylight Time) new ..

How to find my php-fpm.sock?

I'm running Wordpress with: Nginx + PHP-FPM + APC + W3 Total Cache + PageSpeed. After 3 days researching and configuring, I succeeded to make it work. I configured PHP-FPM to run via 127.0.0.1:9000. ..

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in

I am trying to build a simple custom CMS, but I'm getting an error: Warning: mysqli_query() expects parameter 1 to be MySQLi, null given in Why am I getting this error? All my code is already My..

Convert bytes to bits in python

I am working with Python3.2. I need to take a hex stream as an input and parse it at bit-level. So I used bytes.fromhex(input_str) to convert the string to actual bytes. Now how do I convert these ..

Multiple REPLACE function in Oracle

I am using the REPLACE function in oracle to replace values in my string like; SELECT REPLACE('THE NEW VALUE IS #VAL1#','#VAL1#','55') from dual So this is OK to replace one value, but what about ..

The HTTP request is unauthorized with client authentication scheme 'Ntlm'

While calling a web service I get the following error: The HTTP request is unauthorized with client authentication scheme 'NTLM'. The authentication header received from the server was 'NTLM'. The..

Angular 2 @ViewChild annotation returns undefined

I am trying to learn Angular 2. I would like to access to a child component from a parent component using the @ViewChild Annotation. Here some lines of code: In BodyContent.ts I have: import {View..

How to check if a std::thread is still running?

How can I check if a std::thread is still running (in a platform independent way)? It lacks a timed_join() method and joinable() is not meant for that. I thought of locking a mutex with a std::lock_g..

How can I see which Git branches are tracking which remote / upstream branch?

I know I can do git branch --all, and that shows me both local and remote branches, but it's not that useful in showing me the relationships between them. How do I list branches in a way that shows w..

How to find the Target *.exe file of *.appref-ms

I have to make a Backup of the Program running from the file *.appref-ms When i Opened the File GitHub.appref-ms using text editor i found http://github-windows.s3.amazonaws.com/GitHub.application..

Command to get latest Git commit hash from a branch

How can I check with the command line the latest commit hash of a particular Git branch?..

Regular expression matching a multiline block of text

I'm having a bit of trouble getting a Python regex to work when matching against text that spans multiple lines. The example text is ('\n' is a newline) some Varying TEXT\n \n DSJFKDAFJKDAFJDSAKFJADS..

How to install and run Typescript locally in npm?

I want to install and run Typescript (i.e. no global dependencies). Here is my package.json file: { "name": "foo", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { ..

IF EXISTS in T-SQL

If we have a SELECT statement inside an IF EXISTS, does the execution stop as soon as it finds a record in the table? For example: IF EXISTS(SELECT * FROM table1 WHERE Name='John' ) return 1 els..

To add server using sp_addlinkedserver

I tried to insert values from one server to another server and I got the error: Msg 7202, Level 11, State 2, Line 1 Could not find server 'SNRJDI\SLAMANAGEMENT' in sysservers. Execute sp_addlin..

How to embed a YouTube channel into a webpage

Can anyone suggest how I embed a youtube channel into a webpage - I am getting conflicting information from various sites, ideally using the custom player if possible? thanks..

How to discard local commits in Git?

I'd been working on something, and decided it was completely screwed...after having committed some of it. So I tried the following sequence: git reset --hard git rebase origin git fetch git pull git ..

standard_init_linux.go:190: exec user process caused "no such file or directory" - Docker

When I am running my docker image on windows 10. I am getting this error: standard_init_linux.go:190: exec user process caused "no such file or directory" my docker file is: FROM openjdk:8 EXPOSE..

How do I add a Maven dependency in Eclipse?

I don't know how to use Maven at all. I've been developing for a couple years with Eclipse and haven't yet needed to know about it. However, now I'm looking at some docs that suggest I do the follow..

JSON Stringify changes time of date because of UTC

My date objects in JavaScript are always represented by UTC +2 because of where I am located. Hence like this Mon Sep 28 10:00:00 UTC+0200 2009 Problem is doing a JSON.stringify converts the above ..

How to make a transparent HTML button?

I am using dreamweaver to create a website and I thought of just using Photoshop to create backgrounds. I decided to do so only because in case I'd choose to change the button name easily by just edit..

Removing duplicates from a String in Java

I am trying to iterate through a string in order to remove the duplicates characters. For example the String aabbccdef should become abcdef and the String abcdabcd should become abcd Here is what I ..

Programmatically navigate using React router

With react-router I can use the Link element to create links which are natively handled by react router. I see internally it calls this.context.transitionTo(...). I want to do a navigation. Not fro..

Search input with an icon Bootstrap 4

No clue how I can do this, since BS 4 doesn't support glyphicons. Do I set it up as a background or do I apply different positioning to a font-awesome icon? This is my code so far: _x000D_ _x000D_ ..

How to check if a file is empty in Bash?

I have a file called diff.txt. I Want to check whether it is empty. I wrote a bash script something like below, but I couldn't get it work. if [ -s diff.txt ] then touch empty.txt rm f..

Eliminate space before \begin{itemize}

In Latex, how do I eliminate the space inserted before itemize? \begin{itemize} % produces lots of vertical space \item ... \item ... \end{itemize} ..

How to check whether the user uploaded a file in PHP?

I do some form validation to ensure that the file a user uploaded is of the right type. But the upload is optional, so I want to skip the validation if he didn't upload anything and submitted the rest..

Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I am getting error: "Lost connection to MySQL server at 'reading initial communication packet, system error: 0" while I am going to connect my db. If I am using localhost everything is working ..

Could not find or load main class org.gradle.wrapper.GradleWrapperMain

I cleaned the whole project by deleting local directories like ~/.gradle, ~/.m2 ~./android and ~/workspace/project/.gradle and chosing File -> Invalidate Caches / Restart... in Android Studio. Now ..

bootstrap popover not showing on top of all elements

I'm working on a bootstrap site and after updating to bootstrap 2.2 from 2.0 everything worked except the popover. The popovers still show up fine, but they don't show up on top of all other elements..

Fling gesture detection on grid layout

I want to get fling gesture detection working in my Android application. What I have is a GridLayout that contains 9 ImageViews. The source can be found here: Romain Guys's Grid Layout. That file I ..

Breaking/exit nested for in vb.net

How do I get out of nested for or loop in vb.net? I tried using exit for but it jumped or breaked only one for loop only. How can I make it for the following: for each item in itemList for eac..

How to use multiple conditions (With AND) in IIF expressions in ssrs

I just want to hide rows in SSRS report having Zero Quantity.. There are following multiple Quantity Columns like Opening Stock , Gross Dispatched,Transfer Out, Qty Sold, Stock Adjustment and Closing ..

Javascript - validation, numbers only

I'm trying to get my login form to only validate if only numbers were inputted. I can it to work if the input is only digits, but when i type any characters after a number, it will still validate etc...

What is the purpose of Order By 1 in SQL select statement?

I'm reading through some old code at work, and have noticed that there are several views with an order by 1 clause. What does this accomplish? Example: Create view v_payment_summary AS SELECT A.PA..

Write-Host => Export to a file

I have got a script with some commands such as Write-Host "Server1". How can I export it to a file? When I tried with script > export.txt it didn't work...

How do I install g++ for Fedora?

How do I install g++ for Fedora Linux? I have been searching the dnf command to install g++ but didn't find anything. How do I install it? I have already installed gcc..

Convert factor to integer

I am manipulating a data frame using the reshape package. When using the melt function, it factorizes my value column, which is a problem because a subset of those values are integers that I want to b..

Can't access 127.0.0.1

I can't figure out when this started to happen, but the result is - 127.0.0.1 is not working on any port from anywhere (for example, browser says Unable to connect). Here are the results of my researc..

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154

I developed a Windows service using C#.NET to generate PDF report. To generate PDF file I am using a third party dll. The application is running in my Windows XP platform. When I deployed the service ..

JavaScript style.display="none" or jQuery .hide() is more efficient?

document.getElementById("elementId").style.display="none" is used in JavaScript to hide an element. But in jQuery, $("#elementId").hide(); is used for the same purpose. Which way is more efficien..

Using port number in Windows host file

After installing TeamViewer, I have changed the wampserver port to 8080, so the address is http://localhost:8080. For the host file located at C:\WINDOWS\system32\drivers\etc\, I have also made the c..

Nginx no-www to www and www to no-www

I am using nginx on Rackspace cloud following a tutorial and having searched the net and so far can't get this sorted. I want www.mysite.com to go to mysite.com as normal in .htaccess for SEO and oth..

How to add pandas data to an existing csv file?

I want to know if it is possible to use the pandas to_csv() function to add a dataframe to an existing csv file. The csv file has the same structure as the loaded data. ..

double free or corruption (!prev) error in c program

I get the following error when running a c program: *** glibc detected *** ./a.out: double free or corruption (!prev): 0x080b8008 *** I believe this is due to free() being called at the end of the ..

android: how to use getApplication and getApplicationContext from non activity / service class

I'm using extending application class on Android to share my data across the entire app. I can use getApplication() method from all my activities. However, there are certain custom helper classes I ..

<hr> tag in Twitter Bootstrap not functioning correctly?

Here is my code: <div class="container"> <div> <h1>Welcome TeamName1</h1> asdf <hr> asdf </div> </div> <!-- /container --> The hr tag does not..

OAuth 2.0 Authorization Header

I want to develop a SDK that encapsules the OAuth 2.0 functions. I have checked the differences between OAuth 1.0 & 2.0, and I have some confusion on Authorization Header (1.0 and 2.0), OAuth 1...

Change Select List Option background colour on hover

Is it possible to change the default background color of a select list option on hover? HTML: <select id="select"> <option value="1">One</option> <option value="2">Tw..

Where to install Android SDK on Mac OS X?

Where should the Android SDK be installed on Mac OS X?..

SQL: ... WHERE X IN (SELECT Y FROM ...)

Is the following the most efficient in SQL to achieve its result: SELECT * FROM Customers WHERE Customer_ID NOT IN (SELECT Cust_ID FROM SUBSCRIBERS) Could some use of joins be better and achie..

Python check if list items are integers?

I have a list which contains numbers and letters in string format. mylist=['1','orange','2','3','4','apple'] I need to come up with a new list which only contains numbers: mynewlist=['1','2','3','..

AngularJS - Trigger when radio button is selected

I searched and tried many ng-xxxx kind of options but couldn't find the one.. I just want to call some function in the controller when radio button is selected. So it might be similar to following..(..

References with text in LaTeX

In LaTeX you can easily reference a section by using \label{} next to a section and then \ref{} to create the reference. However, the reference only includes the number of the section, or the page wit..

How to return a dictionary | Python

I have a .txt file with the following lines in it: 23;Pablo;SanJose 45;Rose;Makati I have this program: file = open("C:/Users/renato/Desktop/HTML Files/myfile2.txt") def query(id): for line i..

Extract the first (or last) n characters of a string

I want to extract the first (or last) n characters of a string. This would be the equivalent to Excel's LEFT() and RIGHT(). A small example: # create a string a <- paste('left', 'right', sep = '')..

Send email by using codeigniter library via localhost

public function sendemail(){ $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => '[email protected]', 'smtp..

Node.js - use of module.exports as a constructor

According to the Node.js manual: If you want the root of your module's export to be a function (such as a constructor) or if you want to export a complete object in one assignment instead of b..

Removing all line breaks and adding them after certain text

I have text file in which I have to remove all line breaks, and later add new ones after each text </row>. how could I do that using replace tool?..

Validation failed for one or more entities while saving changes to SQL Server Database using Entity Framework

I want to save my Edit to Database and I am using Entity FrameWork Code-First in ASP.NET MVC 3 / C# but I am getting errors. In my Event class, I have DateTime and TimeSpan datatypes but in my databas..

Permission denied for relation

I tried to run simple sql command: select * from site_adzone; and I got this error ERROR: permission denied for relation site_adzone What could be the problem here? I tried also to do select f..

Attaching click event to a JQuery object not yet added to the DOM

I've been having a lot of trouble attaching the click event to a JQuery object before adding it to the DOM. Basically I have this button that my function returns, then I append it to the DOM. What I ..

Fastest way to download a GitHub project

I need to download the source code of the project Spring data graph example into my box. It has public read-only access. Is there is an extremely fast way of downloading this code? I have no idea of ..

How to export DataTable to Excel

How can I export a DataTable to Excel in C#? I am using Windows Forms. The DataTable is associated with a DataGridView control. I have to export records of DataTable to Excel...

In Ruby on Rails, what's the difference between DateTime, Timestamp, Time and Date?

In my experience, getting dates/times right when programming is always fraught with danger and difficulity. Ruby and Rails have always eluded me on this one, if only due to the overwhelming number o..

Add an index (numeric ID) column to large data frame

I have a read large csv file into a data frame. Data in the csv file are from multiple web sites representing user information. For example here is the structure of the data frame. user_id, number_of..

jQuery: Currency Format Number

I have number like this in my html <div class="number">950000</div> and I want jQuery change it to <div class="number">Rp. 950.000</div> How can I do that in jQUery?..

ImportError: No module named matplotlib.pyplot

I am currently practicing matplotlib. This is the first example I practice. #!/usr/bin/python import matplotlib.pyplot as plt radius = [1.0, 2.0, 3.0, 4.0] area = [3.14159, 12.56636, 28.27431, 50.2..

Android Studio Gradle Already disposed Module

I have installed Android Studio version 1.0.1. I have imported my projects from eclipse and it works fine. Then I deleted a module and reimported it into my Android Studio project. The gradle build sa..

What is the best way to clone/deep copy a .NET generic Dictionary<string, T>?

I've got a generic dictionary Dictionary<string, T> that I would like to essentially make a Clone() of ..any suggestions. ..

How do I open a new fragment from another fragment?

I tried making a navigation between fragments. I've got the NewFragment.java with the new fragment working. My problem is: How do I make this onClickListener run NewFragment.java correctly? button...

Android Service needs to run always (Never pause or stop)

I created a service and want to run this service always until my phone restarts or force closed. The service should run in background. Sample code of created service and start services: Start the s..

Find the unique values in a column and then sort them

I have a pandas dataframe. I want to print the unique values of one of its columns in ascending order. This is how I am doing it: import pandas as pd df = pd.DataFrame({'A':[1,1,3,2,6,2,8]}) a = df['..

com.jcraft.jsch.JSchException: UnknownHostKey

I'm trying to use Jsch to establish an SSH connection in Java. My code produces the following exception: com.jcraft.jsch.JSchException: UnknownHostKey: mywebsite.com. RSA key fingerprint is 22:fb:ee..

Play infinitely looping video on-load in HTML5

I'm looking to place a video in an HTML5 page that will begin playing on page-load, and once completed, loop back to the beginning without a break. The video should also NOT have any controls associat..

How to select rows for a specific date, ignoring time in SQL Server

Given a table with a datetime column, how do I query for rows where the date matches the value I specify but ignores the time portion? For example, select * from sales where salesDate = '11/11/2010' ..

How can I get a vertical scrollbar in my ListBox?

In the example below I have a ListBox with dozens of font names in it. I would have thought it would automatically have a vertical scrollbar on it so that you can select ANY font, not just the first ..

Auto increment in phpmyadmin

I have an existing database using PHP, MySQL and phpMyAdmin. When users become a member on my website, I need the system to create a unique membership number for them using a five digit number. for e..

What is the difference between UTF-8 and ISO-8859-1?

What is the difference between UTF-8 and ISO-8859-1?..

AngularJS : Initialize service with asynchronous data

I have an AngularJS service that I want to initialize with some asynchronous data. Something like this: myModule.service('MyService', function($http) { var myData = null; $http.get('data.jso..

Save bitmap to location

I am working on a function to download an image from a web server, display it on the screen, and if the user wishes to keep the image, save it on the SD card in a certain folder. Is there an easy way ..

Count table rows

What is the MySQL command to retrieve the count of records in a table?..

jQuery load first 3 elements, click "load more" to display next 5 elements

I have an unordered list: <ul id="myList"></ul> <div id="loadMore">Load more</div> I wish to populate this list with list items from another HTML file: <li>One</li..

SQL Group By with an Order By

I have a table of tags and want to get the highest count tags from the list. Sample data looks like this id (1) tag ('night') id (2) tag ('awesome') id (3) tag ('night') using SELECT COUNT(*), `T..

How to update large table with millions of rows in SQL Server?

I've an UPDATE statement which can update more than million records. I want to update them in batches of 1000 or 10000. I tried with @@ROWCOUNT but I am unable to get desired result. Just for testin..

Difference between an API and SDK

I am trying to explain to a non-developer the difference between an API an SDK. I need to explain why a commercial fingerprint software vendor will likely not provide an SDK, although they may certain..

Why rgb and not cmy?

Seeing as how the three primary colors are cyan, magenta and yellow (CMY), why do monitors and almost all the GUI components out there use red, green and blue (RGB)? (If I'm not mistaken, printers use..

Call a python function from jinja2

I am using jinja2, and I want to call a python function as a helper, using a similar syntax as if I were calling a macro. jinja2 seems intent on preventing me from making a function call, and insists ..

does linux shell support list data structure?

this question is not the same as Does the shell support sets? i know lots of script language support list structure, such as python, python, ruby, and javascript, so what about linux shell? does she..

parsing JSONP $http.jsonp() response in angular.js

I am using angular's $http.jsonp() request which is successfully returning json wrapped in a function: var url = "http://public-api.wordpress.com/rest/v1/sites/wtmpeachtest.wordpress.com/posts?callba..

Sending files using POST with HttpURLConnection

Since the Android developers recommend to use the HttpURLConnection class, I was wondering if anyone can provide me with a good example on how to send a bitmap "file" (actually an in-memory stream) vi..

Convert International String to \u Codes in java

How can I convert an international (e.g. Russian) String to \u numbers (unicode numbers) e.g. \u041e\u041a for OK ?..

How do I run a batch file from my Java Application?

In my Java application, I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type" It seems that I can't even get my batch file to execute. I'm ..

Interface vs Base class

When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods? If I have a Dog and Cat ..

Add inline style using Javascript

I'm attempting to add this code to a dynamically created div element style = "width:330px;float:left;" The code in which creates the dynamic div is var nFilter = document.createElement('div'); n..

Difference between session affinity and sticky session?

What is the difference between session affinity and sticky session in context of load balancing servers? ..

Function for Factorial in Python

How do I go about computing a factorial of an integer in Python?..

Decreasing for loops in Python impossible?

I could be wrong (just let me know and I'll delete the question) but it seems python won't respond to for n in range(6,0): print n I tried using xrange and it didn't work either. How can I impl..

How to get the server path to the web directory in Symfony2 from inside the controller?

The question is as follows: How can I get the server path to the web directory in Symfony2 from inside the controller (or from anywhere else for that reason) What I've already found (also, by search..

GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly

I have followed these instructions below to upload a project. Global setup: Download and install Git git config --global user.name "Your Name" git config --global user.email [email protected] ..

How do I send a JSON string in a POST request in Go

I tried working with Apiary and made a universal template to send JSON to mock server and have this code: package main import ( "encoding/json" "fmt" "github.com/jmcvetta/napping" "l..

jQuery Array of all selected checkboxes (by class)

Possible Duplicate: Select values of checkbox group with jQuery In HTML I have a set of checkboxes grouped together by a class. I want to get an array in jQuery containing all the checkboxe..

MySQL: How to allow remote connection to mysql

I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source. How can I do that?..

Getting input values from text box

I'm trying to get the text from a text box. I have 2 input text boxes that are not in a form, and I'm trying to retrieve the value and store it in a variable. This code returns undefined in the a..

Is bool a native C type?

I've noticed that the Linux kernel code uses bool, but I thought that bool was a C++ type. Is bool a standard C extension (e.g., ISO C90) or a GCC extension?..

Difference between classification and clustering in data mining?

Can someone explain what the difference is between classification and clustering in data mining? If you can, please give examples of both to understand the main idea...

How do I combine 2 javascript variables into a string

I would like to join a js variable together with another to create another variable name... so it would be look like; for (i=1;i<=2;i++){ var marker = new google.maps.Marker({ position:"myLatl..

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on

I have a scenario. (Windows Forms, C#, .NET) There is a main form which hosts some user control. The user control does some heavy data operation, such that if I directly call the UserControl_Load me..

How to use onSaveInstanceState() and onRestoreInstanceState()?

I am trying to save data across orientation changes. As demonstrated in the code below, I use onSaveInstanceState() and onRestoreInstanceState(). I try to get the saved value and I check if it is the ..

Best way to restrict a text field to numbers only?

I'm using the following Javascript to restrict a text field on my website to only accept numerical input, and no other letters or characters. The problem is, it REALLY rejects all other key inputs, li..

Add space between cells (td) using css

I am trying to add a table with space between cell as the background colour of the cell is white and the background color of the table is blue, you can easily see that padding and margin are not worki..

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

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

Is there a Java equivalent or methodology for the typedef keyword in C++?

Coming from a C and C++ background, I found judicious use of typedef to be incredibly helpful. Do you know of a way to achieve similar functionality in Java, whether that be a Java mechanism, pattern..