So I have a list:
['x', 3, 'b']
And I want the output to be:
[x, 3, b]
How can I do this in python?
If I do str(['x', 3, 'b']), I get one with quotes, but I don't want quotes....
I have a server with a self signed certificate, but also requires client side cert authentication. I am having a rough time trying to get the raw CA server cert so I can import it into a keystore. Anyone have some suggestions on how to easily do that...
I have a problem splitting single column values to multiple column values.
For Example:
Name
------------
abcd efgh
ijk lmn opq
asd j. asdjja
asb (asdfas) asd
asd
and I need the output something like this:
first_name last_name
------...
Is there a way to find out how much time has passed since a web page was changed?
For example,
I have a page hosted at: www.mywebsitenotupdated.com
Is there a way to find out when this HTML page was uploaded to the server?
I have no access to se...
I've read about SPA and it advantages. I find most of them unconvincing. There are 3 advantages that arouse my doubts.
Question: Can you act as advocate of SPA and prove that I am wrong about first three statements?
==...
I am trying to create an alert dialog with an EditText object. I need to set the initial text of the EditText programmatically. Here's what I have.
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
// ...Irrelevant code for customiz...
Is it possible to hide the Javascript code from the html of a webpage, when the source code is viewed through the browsers View Source feature?
I know it is possible to obfuscate the code, but I would prefer it being hidden from the view source fea...
What's the best way to make an element of 100% minimum height across a
wide range of browsers ?
In particular if you have a layout with a header and footer of fixed height,
how do you make the middle content part fill 100% of the space in bet...
This is a question about how to determine the CUDA grid, block and thread sizes. This is an additional question to the one posted here.
Following this link, the answer from talonmies contains a code snippet (see below). I don't understand the commen...
I can scroll to 200px using the following
btn.addEventListener("click", function(){
window.scrollTo(0,200);
})
But I want a smooth scroll effect. How do I do this?...
I have the following simple code written in Swift 3:
let str = "Hello, playground"
let index = str.index(of: ",")!
let newStr = str.substring(to: index)
From Xcode 9 beta 5, I get the following warning:
'substring(to:)' is deprecated: Please u...
I want to have the ListItems to extend with their orange background the full width of the Listbox.
Currently they are only as wide as the FirstName + LastName.
I've set every element I can to: HorizontalAlignment="Stretch".
I want the background o...
In some languages you can pass a parameter by reference or value by using a special reserved word like ref or val. When you pass a parameter to a Python function it never alters the value of the parameter on leaving the function.The only way to do th...
I am sure this has been asked before but I cannot find the answer.
I have an AngularJS script that is pulling from a DB and then rendering to content. Everything is working correctly except a couple of places that I am trying to concatenate some wo...
We have a batch job that runs every day and copies a file to a pickup folder. I want to also take a copy of that file and drop it into an archive folder with the filename
yyyy-MM-dd.log
What's the easiest way to do this in a Windows batch job?
I...
I'm making my first app in Laravel and am trying to get my head around the session flash messages. As far as I'm aware in my controller action I can set a flash message either by going
Redirect::to('users/login')->with('message', 'Thanks for regi...
How to host a Node.Js application in a shared hosting
I want to host a node.js application in shared hosting. Does anyone have any reference or documentation to refer to?...
Please am trying to implement a filter on my listview. But whenever the text change, the list disappears.Please Help
Here are my codes. The adapter class.
package com.talagbe.schymn;
import java.util.ArrayList;
import android.content.Context;
imp...
I have an int a that needs to be equal to "infinity". This means that if
int b = anyValue;
a>b is always true.
Is there any feature of C++ that could make this possible?...
I don't know how to set the value of a hiddenField in Javascript. Can somebody show me how to do this?
Javascript:
document.getElementById('hdntxtbxTaksit').value = "";
HTML:
<asp:HiddenField ID="hdntxtbxTaksit" runat="server" Value="" Visib...
When I'm disabling a
<select name="sel" disabled>
<option>123</option>
</select>
element, it doesnt pass its variable.
What to do to look it like disabled, but be in "normal" state?
This is because I have a list of "...
I am trying to iterate through a list of keys from a hash table using enumeration however I keep getting a NoSuchElementException at the last key in list?
Hashtable<String, String> vars = new Hashtable<String, String>();
vars.put("POST...
The question that I have is regarding converting the process of reading lines from a text file into an array instead of just reading it.
The error in my codes appear at string[] lines = File.ReadLines("c:\\file.txt"); with cannot implicity convert.....
I get the following error when trying to run Django from the command line.
File manage.py, line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
Any idea...
On Android 1.0 there was a com.google.googlenav namespace for driving directions:
Route - Improved Google Driving Directions
But in newer SDK it was removed by some reason...
Android: DrivingDirections removed since API 1.0 - how to do it in 1.5/1.6?...
I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using cin.get( input, '\0' ) but '\0' is not really the EOF character, that ju...
I am a newbie of C# and MS visual studio, and I want to use the C# class which defined in another file, but can't get it work.
Here is the program.cs(and why can't I rename that file ?)
using System;
namespace TestCSharp2
{
class Program
{...
I'm new to Python and have been trying to install some packages with pip.
But pip install unroll gives me
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\
How can...
I am using DateTime.TryParse() function to check if a particular string is a valid datetime not depending on any cultures.
To my surprise , the function returns true for even strings like "1-1", "1/1" .etc.
How can I solve this problem?
Update:
D...
When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn't consider that it's being run as a login shell, although it's started as ‘-zsh’ (‘-’ is put as the first character of arg[0]) which is supposed to mean that...
I want to close my application, so that it no longer runs in the background.
How to do that? Is this good practice on Android platform?
If I rely on the "back" button, it closes the app, but it stays in background. There is even application called ...
What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a difference between the following code blocks in the way th...
Can you redirect the output of a command to a variable with pipes?
I haven't tried much as I haven't been able to think of anything to try, but I have tried one method (with two variations)...
For example:
echo Hello|set text=
Didn't work, neith...
I've gotten accustomed to many of the Java IDEs (Eclipse, NetBeans, and IntelliJ IDEA) providing you with a command to generate a default constructor for a class based on the fields in the class.
For example:
public class Example
{
public decim...
I want to install my tomcat v7.0.12 as a service on my Windows 2008 Server.
On the tomcat page I found this tutorial. But there isn't a service.bat file in my installation dir.
In the service overview of WS2008 it isn't possible easily create a new ...
How do I store the select column in a variable?
I tried this, but it throws me an error "Incorrect syntax":
declare @EmpId int
SELECT dbo.Employee.Id as @EmpId FROM dbo.Employee
...
I'm trying to use multiprocessing's Pool.map() function to divide out work simultaneously. When I use the following code, it works fine:
import multiprocessing
def f(x):
return x*x
def go():
pool = multiprocessing.Pool(processes=4) ...
Possible Duplicates:
What’s the use of do while(0) when we define a macro?
Why are there sometimes meaningless do/while and if/else statements in C/C++ macros?
do { … } while (0) what is it good for?
I've seen some multi-l...
I want to execute a script inside a subdirectory/superdirectory (I need to be inside this sub/super-directory first). I can't get subprocess to enter my subdirectory:
tducin@localhost:~/Projekty/tests/ve$ python
Python 2.7.4 (default, Sep 26 2013, 0...
I am working on an open source C++ project, for code that compiles on Linux and Windows. I use CMake to build the code on Linux. For ease of development setup and political reasons, I must stick to Visual Studio project files/editor on Windows (I can...
I hope when I click the button, I can get the specific img src and show the img src in the div class img-block block.
HTML
<button class="button">Click</button>
<div class="img1">
<img src="img.jpg" alt="">
</div>
...
In jQuery when you do this:
$(function() {
alert("DOM is loaded, but images not necessarily all loaded");
});
It waits for the DOM to load and executes your code. If all the images are not loaded then it still executes the code. This is obvious...
My post title here could be misleading. first have a look at HTML i have currently:
As you can see, each column's text content overflows to next column. Secondly, each of them is not horizontal aligned. (eg the link for view details does not align ...
mark@mark-ubuntu:~/myproject$ svn stat
? runserver.sh
? media/images/icons
? apps/autocomplete
mark@mark-ubuntu:~/myproject$ svn add apps/autocomplete
svn: warning: 'apps/autocomplete' is already under version control
svn stat say...
How can I check if a list is empty? If so, the system has to give a message saying List is empty. If not, the system has to give a message saying List is not empty.
Users can enter numbers, -1 to stop the program.
This is the code I now have, but thi...
I need to add an image to the res/drawable folder...
When I choose new > Image Asset, it comes out a dialog to choose Asset Type...
How can I add an image to res/drawable folder?...
What does the phrase std::string::npos mean in the following snippet of code?
found = str.find(str2);
if (found != std::string::npos)
std::cout << "first 'needle' found at: " << int(found) << std::endl;
...
When I run ffmpeg on Ubuntu, it shows:
$ ffmpeg
ffmpeg version v0.8, Copyright (c) 2000-2011 the Libav developers
built on Feb 28 2012 13:27:36 with gcc 4.6.1
This program is not developed anymore and is only provided for compatibility. Use avcon...
I am working on SpringMVC, Hibernate & JSON but I am getting this error.
HTTP Status 500 - Could not write JSON: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create Be...
I want remove "Language" querystring from my url. How can I do this? (using Asp.net 3.5 , c#)
Default.aspx?Agent=10&Language=2
I want to remove "Language=2", but language would be the first,middle or last. So I will have this...
I've always been unsure of where to start as a general best practice baseline. Yes, I know it depends on your design, but what's most common?
Here's what I currently have as a starter:
h1 { font-size: 24px;}
h2 { font-size: 22px;}
h3 { font-size: 18p...
The code below fails to start documents. I get error 193 (%1 is not a valid Win32 app). Starting executables work fine.
The files are properly associated, they start the corresponding app when double clicked.
I have searched SO and elsewhere for the ...
I was trying to navigate to my drive location E:/Study/Codes in git bash in windows. In command prompt in order to change drive I use E: It returns an error in git bash.
bash: E:: command not found.
How do I change my current directory locatio...
Is there any way to efficiently check if the variable is Object or Array, in NodeJS & V8?
I'm writing a Model for MongoDB and NodeJS, and to traverse the object tree I need to know if the object is simple (Number, String, ...) or composite (Has...
I want to use jackson json library for a generic method as follows:
public MyRequest<T> tester() {
TypeReference<MyWrapper<T>> typeRef = new TypeReference<MyWrapper<T>>();
MyWrapper<T> requestWrapper = (...
I'm having a hard time wrapping my brain around PEP 380.
What are the situations where "yield from" is useful?
What is the classic use case?
Why is it compared to micro-threads?
[ update ]
Now I understand the cause of my difficulties. I've use...
I have created a custom UITableViewCell. The table view is showing data fine. What I am stuck in is when user touches cell of tableview, then I want to show the background color of the cell other than the default [blue color] values for highlighting ...
I am not new to *nix, however lately I have been spending a lot of time at the prompt. My question is what are the advantages of using KornShell (ksh) or Bash Shell? Where are the pitfalls of using one over the other?
Looking to understand from the...
In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a few items to a cart and checkout).
Just hitting th...
Hello I have working json parsing code for swift2.2 but when i use it for Swift 3.0 gives me that error
ViewController.swift:132:31: Ambiguous reference to member 'dataTask(with:completionHandler:)'
My codes here
let listUrlString = "http:...
This is a follow-up to Dynamic Shared Library compilation with g++.
I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I fou...
I'm trying to create a new row in a table. There are two constraints on the table -- one is on the key field (DB_ID), the other constrains a value to be one of several the the field ENV. When I do an insert, I do not include the key field as one of...
I want to add some items to a combobox like this :
public class ComboboxItem
{
public string Text { get; set; }
public object Value { get; set; }
public override string ToString()
{
return Text;
}
}
ComboboxItem item...
I have a text file on HDFS and I want to convert it to a Data Frame in Spark.
I am using the Spark Context to load the file and then try to generate individual columns from that file.
val myFile = sc.textFile("file.txt")
val myFile1 = myFile.map(x...
I've been looking at dynamic evaluation of Python code, and come across the eval() and compile() functions, and the exec statement.
Can someone please explain the difference between eval and exec, and how the different modes of compile() fit in?...
I want to wrap some text that is added to a <td> element.
I have tried with style="word-wrap: break-word;" width="15%".
But it is not wrapping the text. Is it mandatory to give it 100% width?
I have other controls to display so only 15% width i...
I want an event to fire client side when a checkbox is checked / unchecked:
$('.checkbox').click(function() {
if ($(this).is(':checked')) {
// Do stuff
}
});
Basically I want it to happen for every checkbox on the page. Is this method of f...
I'm trying to use axios for a GET request with an API which requires an Authorization header.
My current code:
const AuthStr = 'Bearer ' + USER_TOKEN;
where USER_TOKEN is the access token needed. This string concatenation may be the issue as if I...
Possible Duplicate:
Abstract class in Java
I got several explanations but so far I'm not able to understand that what are the abstract classes and methods in Java.
Some said it has to do something with the security of the program, other s...
Questions:
What are raw types in Java, and why do I often hear that they shouldn't be used in new code?
What is the alternative if we can't use raw types, and how is it better?
...
I'm using win8 previously I had been running Eclipse Juno on my pc but from now on I wanted to start using STS, I am getting the below error as soon as I create a new project. I deleted my .m2 folder and everything related to Eclipse in order to star...
Usually, we only put the data we want to send as websocket.send() method's parameter, but I want to know whether there are other parameters like IP that we can put inside the brackets. Can we use it this way:
websocket.send(ip, data); // send data ...
I'm trying to load a jar using
@echo off
java -jar Test.jar
pause
With the manifest of
Manifest-Version: 1.0
Main-Class: classes.TestClass
In the Jar directory, I can clearly see a classes\TestClass file when I extract it.
Edit: classes.TestC...
If I have the following:
<div class="apple-monkey"></div>
<div class="apple-horse"></div>
<div class="cow-apple-brick"></div>
I can use the following selector to find the first two DIVs:
$("div[class^='apple-']...
After installing mechanize, I don't seem to be able to import it.
I have tried installing from pip, easy_install, and via python setup.py install from this repo: https://github.com/abielr/mechanize. All of this to no avail, as each time I enter my P...
I have a Git repository with few branches and dangling commits. I would like to search all such commits in repository for a specific string.
I know how to get a log of all commits in history, but these don't include branches or dangling blobs, just ...
With TortoiseSVN, I can move a file into the ignore-on-commit changelist, so that when I commit a whole tree, changes to that file do not get committed.
Is there a way to do something like that using the svn command-line tool?
EDIT: Thanks for the ...
I want to set a cookie value on an AJAX request but the code below doesn't work.
$.ajax({
type: "GET",
url: "http://example.com",
cache: false,
setCookies: "lkfh89asdhjahska7al446dfg5kgfbfgdhfdbfgcvbcbc dfskljvdfhpl",
crossD...
How do you grep and only return the matching line? i.e. The path/filename is omitted from the results.
In this case I want to look in all .bar files in the current directory, searching for the term FOO
find . -name '*.bar' -exec grep -Hn FOO {} \;
...
In Excel 2007, I am looping through the values of column 4 in Sheet 2. Still in Sheet 2, I want to output the result of my vlookup formula into column 5. The vlookup formula needs to refer to Sheet 1 where the reference columns are. In order to do so...
Is it possible to express 1 or 0 as a bit when used as a field value in a select statement?
e.g.
In this case statement (which is part of a select statement) ICourseBased is of type int.
case
when FC.CourseId is not null then 1
else 0
end
as IsCo...
I could read registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0.
However, it doesn't give me any information about the edition of it - Professional/Ultimate or whatever.
How can I get the information with programmatically (preferably ...
I'm trying to assign the output of a command to a variable - as in, I'm trying to set the current flash version to a variable. I know this is wrong, but this is what I've tried:
set var=reg query hklm\SOFTWARE\Macromedia\FlashPlayer\CurrentVersion&g...
A large part of my app consists of web views to provide functionality not yet available through native implementations. The web team has no plans to implement a dark theme for the website. As such, my app will look a bit half/half with Dark Mode supp...
I am having some problems pulling values from a JSON object. Here is my code
try {
JSONObject json = new JSONObject(result);
JSONObject json2 = json.getJSONObject("results");
test = json2.getString("name");
} catch (JSONException e)...
I often need to kill a process during programming.
The way I do it now is:
[~]$ ps aux | grep 'python csp_build.py'
user 5124 1.0 0.3 214588 13852 pts/4 Sl+ 11:19 0:00 python csp_build.py
user 5373 0.0 0.0 8096 960 pts/6 S+ ...
During the most recent Google IO, there was a presentation about implementing restful client applications. Unfortunately, it was only a high level discussion with no source code of the implementation.
In this diagram, on the return path there are va...
I have a datareader that return a lsit of records from a sql server database. I have a field in the database called "Additional". This field is 50% of the time empty or null.
I am trying to write code that checks if this field isnull. The l...
Possible Duplicate:
round double to two decimal places in java
I want to round up the double value upto 2 decimal points.
for example: I have double d=2; and the result should be result =2.00...
What is the simplest way to compare two NumPy arrays for equality (where equality is defined as: A = B iff for all indices i: A[i] == B[i])?
Simply using == gives me a boolean array:
>>> numpy.array([1,1,1]) == numpy.array([1,1,1])
arra...
Currently, my database is in Single User mode. When I try to expand me database, I get an error:
The database 'my_db' is not accessible.(ObjectExplorer)
Also, when I try to delete the database, I get the error:
Changes to the state or optio...
I'm trying to make an animated "scroll to top" effect without using jQuery.
In jQuery, I usually use this code:
$('#go-to-top').click(function(){
$('html,body').animate({ scrollTop: 0 }, 400);
return false;
});
How do I animate scro...
I have a function that helps filter data. I am using v-on:change when a user changes the selection but I also need the function to be called even before the user selects the data. I have done the same with AngularJS previously using ng-init but I und...
I want to add some calculation inside my case statement to dynamically create the contents of a new column but I get the error:
Column 'Test1.qrank' is invalid in the select list because it is not contained in either an aggregate function or the...
I need to know exactly the width and height for an arbitrary g element in my SVG because I need to draw a selection marker around it once the user has clicked it.
What I've seen in the internet is something like: d3.select("myG").style("width"). The...
I have a class named Entry declared like this:
class Entry{
string Id {get;set;}
string Name {get;set;}
}
and then a method that will accept multiple such Entry objects for insertion into the database using ADO.NET:
static void Inse...
I wanted to divide one column by another to get the per person time how can I do this?I couldn't find anything on how you can divide.
Here is some data that I want to use
min count2.freq
263807.0 1582
196190.5 1016
586689.0 3479
...
Did anybody have similar problem with this, I import android project and I get
errors like
[2011-10-03 17:20:09 - Screen] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Propert...
I have built two RPM packages
proj1-1.0-1.x86_64.rpm
libtest1-1.0-1.x86_64.rpm
proj1 depends on the file libtest1.so being present and it is reflected correctly in the RPM packages as seen here:
user@my-pc:~$ rpm -qp --requires proj1-1.0-1.x86_6...
I have a Ruby on Rails application that I am deploying on a computer running Mac OS X 10.6. The code where the problem arises is run by a delayed_job. The problem only occurs when it is run through delayed_job. If I run it within a console (rails con...
I have this json data:
{
userID: 'a7664093-502e-4d2b-bf30-25a2b26d6021',
itemKind: 0,
value: 1,
description: 'Saude',
itemID: '03e76d0a-8bab-11e0-8250-000c29b481aa'
}
and I need to post into json url:
http://domain/OnLeagueRes...
I know this is very easy question, but I couldn't find the answer anywhere. Only answers are the ones using jQuery, not pure JS. I've tried the code below and it doesn't work. I don't know why.
var t = document.getElementById("table"),
d = t.ge...
Ok, so I've read both PEP 8 and PEP 257, and I've written lots of docstrings for functions and classes, but I'm a little unsure about what should go in a module docstring. I figured, at a minimum, it should document the functions and classes that th...
Please clarify two things for me:
Can a Foreign key be NULL?
Can a Foreign key be duplicate?
As fair as I know, NULL shouldn't be used in foreign keys, but in some application of mine I'm able to input NULL in both Oracle and SQL Server, and I do...
Note: I'm sorry if this is an extremely simple question but I'm somewhat obsessive compulsive over the formatting of my code.
I have a class that has a function that returns a string that will make up the body text of an email. I want this text form...
I've found the following contract in a Node.js module:
module.exports = exports = nano = function database_module(cfg) {...}
I wonder whats the different between module.exports and exports and why both are used here....
The question is confusing, but it is much more clear as described in the following codes:
List<List<T>> listOfList;
// add three lists of List<T> to listOfList, for example
/* listOfList = new {
{ 1, 2, 3}, // list...
I was testing my app on the simulator when it crashed on clicking a button of a UIAlertView. I stopped debugging there, made some changes to the code and built the app again. Now when I run the application, I get this error in the console
Couldn'...
Update
After a bit of investigating. What seems to be the issue is that the SelectedValue/SelectedItem is occurring before the Item source is finished loading. If I sit in a break point and wait a few seconds it works as expected. Don't know how ...
What's the reason why Java doesn't allow us to do
private T[] elements = new T[initialCapacity];
I could understand .NET didn't allow us to do that, as in .NET you have value types that at run-time can have different sizes, but in Java all kinds o...
I am pretty new to Ubuntu, but I can't seem to get this to work. It works fine on my school computers and I don't know what I am not doing. I have checked usr/include and time.h is there just fine. Here is the code:
#include <iostream>
#inc...
How do I post a form from an HTML page to and ASPX page (2.0) and be able to read the values?
I currently have an ASP.NET site using the Membership provider and everything is working fine. Users can log in from the Login.aspx page.
We now want to ...
I have a bog-standard login form - an email text field, a password field and a submit button on an AIR project that's using HTML/jQuery. When I hit Enter on the form, the entire form's contents vanish, but the form isn't submitted. Does anyone know...
I have a 2D array as follows:
long[,] arr = new long[4, 4] {{ 0, 0, 0, 0 },
{ 1, 1, 1, 1 },
{ 0, 0, 0, 0 },
{ 1, 1, 1, 1 }};
I want to print the values of th...
Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP.
I have a project under Git control. I'd like to add a submodule:
git submodule add http://github.com/j...
I'm simply trying to create a node server that outputs the HTTP status of a given URL.
When I try to flush the response with res.write, I get the error: throw new TypeError('first argument must be a string or Buffer');
But if I replace them with co...
I have two components as follows and I want to call a function from another component. Both components are included in the third parent component using directive.
Component 1:
@component(
selector:'com1'
)
export class com1{
function1(){....
I am using reactjs.
When I run the code below the browser says:
Uncaught TypeError: Super expression must either be null or a function, not undefined
Any hints at all as to what is wrong would be appreciated.
First the line used to compile the co...
I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the following instructions. Before running the "git commit --amend" (and after the git rebase --interactive) I decided that my changes were inc...
Traditionally I use custom domains with my localhost development server. Something along the lines of:
dev.example.com
dev.api.example.com
This has provided me a ton of flexibility when working with external API's such as Facebook. This has worked...
How do I change the content of the cell containing the 'c' letter in the HTML sample using jQuery?
<table id="table_header">
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
</table>
...
In an extract I am dealing with, I have 2 datetime columns. One column stores the dates and another the times as shown.
How can I query the table to combine these two fields into 1 column of type datetime?
Dates
2009-03-12 00:00:00.000
2009-03-26 ...
I have a server with Rackspace. I want to access the database from my local machine command line.
I tried like:
mysql -u username -h my.application.com -ppassword
But it gives an error:
ERROR 2003 (HY000):
Can't connect to MySQL server on 'my.appli...
I want to make a button that starts my php script after I click it. So do I just make 2 separate files and have action post to the php file and then let it start? or is there a better way to do this? Possibly in one document?
Update:
Well, I basica...
Sample console program.
class Program
{
static void Main(string[] args)
{
// ... code to build dll ... not written yet ...
Assembly assembly = Assembly.LoadFile(@"C:\dyn.dll");
// don't know what or how to cast here
...
I would like to refresh the current page when a button is clicked.
Using JavaScript, I have the following:
<button type="button" onClick="refreshPage()">Close</button>
<script>
function refreshPage() {
// What do I pu...
I have these URLs:
http://backend.domain.com/system/setting/edit/12
http://backend.domain.com/product/edit/1
How to get controller name, action name from these URLs. I'm CodeIgniter newbie. Are there any helper function to get this info
Ex:
$p...
I noticed that with the optional parameters in C# 4 if you specify an optional parameter on an interface you don,t have to make that parameter optional on any implementing class:
public interface MyInterface
{
void TestMethod(bool flag = false)...
I have a specific value, let's say string 'comments'. I need to find all instances of this in the database as I need to do an update on the format to change it to (*) Comments.
How can I do this? The database is in SQL Server 2000 format....
I'm very new to R and am working on updating an R script to iterate through a series of .dbf tables created using ArcGIS and produce a series of graphs.
I have a directory, C:\Scratch, that will contain all of my .dbf files. However, when ArcGIS cre...
Does any one know how to wrap text in TextView in Android platform. i.e if the text in textview exceed the screen length it should be displayed in the second line.
I have searched and tried the following:
android:scrollHorizontally="false",
android...
I have a script which reads the input and than lists it, however i want it to convert upper case letters to lower case, how can i do that?
this is what i got
for words in text.readlines():
sentence = [w.strip(',.') for w in line.split() if w.s...
I am confused by the usage of brackets, parentheses, curly braces in Bash, as well as the difference between their double or single forms. Is there a clear explanation?...
I am still trying to grasp the finer points of how I can run a linux or windows shell command and capture output within node.js; ultimately, I want to do something like this...
//pseudocode
output = run_command(cmd, args)
The important piece is th...
I know that it is impossible to actually modify an image with CSS, which is why I put crop in quotes.
What I'd like to do is take rectangular images and use CSS to make them appear square without distorting the image at all.
I'd basically like to ...
I am running VBA code on a large spreadsheet. How do I clear the memory between procedures/calls to prevent an "out of memory" issue occurring?
Thanks...
I am trying to use hex color values in Swift, instead of the few standard ones that UIColor allows you to use, but I have no idea how to do it.
Example: how would I use #ffffff as a color?...
this is the error Fatal error: Call to undefined function assign(
this is the code, as you can see i obviously have defined the function so why is it not working
class shades {
function create($name, $shades, $slug, $shortDesc, $longDesc, $posit...
Why am I unable to set the size of an array based on a variable? What's the best way around this?
Dim NumberOfZombies as integer
NumberOfZombies = 20000
Dim Zombies(NumberOfZombies) as New Zombie
...
I just need to check if an array has more than one element.
I am trying to do it this way :
if (isset($arr['1']))
the other traditional way is
if (sizeof($arr)>1)
Which of the two is better? In such situaions, how should I judge between tw...
I have a spring project that runs fine on my tomcat7 server when I deploy from eclipse: Run As >> Run on server.
In the eclipse tab "Servers" I see:
Servers
Tomcat v7.0 Server at localhost [Started, Synchronized]
my_project [Synchronized]
s...
I´m searching for a opportunity to open a url in java.
URL url = new URL("http://maps.google.at/maps?saddr=4714&daddr=Marchtrenk&hl=de");
InputStream is = url.openConnection().getInputStream();
BufferedReader reader = new BufferedR...
How can I check if a URL has changed in JavaScript? For example, websites like GitHub, which use AJAX, will append page information after a # symbol to create a unique URL without reloading the page. What is the best way to detect if this URL changes...
I'm writing a program to check if something is a file or is a directory. Is there a better way to do it than this?
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
int isFile(const char* name...
I have to perform some inserts into an Oracle DB. I have some dates
in the following format
'23.12.2011 13:01:001'
Following the documentation I wrote inserts to_date as follows:
to_date('23.12.2011 13:01:01', 'DD.MM.YYYY HH24:MI:SS')
which wo...
I have a database schema on Oracle server installed on a Linux machine. I need to export the schema related information in a dump file.
How to do this ?...
I am trying to create a column ID based on logical statements for values of other columns. For example, in the following dataframe
test <- structure(list(time = c(10L, 20L, NA, 30L), type = structure(c(1L,
2L, 3L, NA), .Label = c("A", "B", "C"),...
Possible Duplicate:
Converting std::string to std::vector<char>
I tried:
std::string str = "hello";
std::vector<char> data;
std::copy(str.c_str(), str.c_str()+str.length(), data);
but it does not work=( So I wonder How to co...
I'm trying to use the :before selector to place an image over another image, but I'm finding that it simply doesn't work to place an image before an img element, only some other element. Specifically, my styles are:
.container
{
position: relati...
When I attempt to install the latest version of compass (https://rubygems.org/gems/compass/versions/1.0.0.alpha.17), I get the following error.
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
ERROR: Error installing...
I'm writing a simple server for Node.js and I'm using my own class called User which looks like:
function User(socket) {
this.socket = socket;
this.nickname = null;
/* ... just the typical source code like functions, variables and bugs ...
Things I've tried after searching:
in Web.Config put a binding on the old version:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersi...
What's the simplest way to get the String representation of a XML Document (org.w3c.dom.Document)? That is all nodes will be on a single line.
As an example, from
<root>
<a>trge</a>
<b>156</b>
</root>
(this...
Warning: mysqli::query(): Couldn't fetch mysqli in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\my portable files\class_EventCalendar.php on line 43
The following is my connection file:
<?php
if(!isset($_SESSION))
{
s...
I can't seem to find where my code has went wrong. Here is my full error:
Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\GigaLoad.com\register.php on line 102
But I've been looking a that line for hours. I will give you t...
I'm trying to style a file upload button to my personal preferences, but I couldn't find any really solid ways to do this without JS. I did find two other questions about this subject, but the answers there either involved JavaScript, or suggested Qu...
Python will not run in git bash (Windows). When I type python in the command line, it takes me to a blank line without saying that it has entered python 2.7.10 like its does in Powershell. It doesn't give me an error message, but python just doesn't ...
The Swift Programming Language guide has the following example:
class Person {
let name: String
init(name: String) { self.name = name }
var apartment: Apartment?
deinit { println("\(name) is being deinitialized") }
}
class Apartmen...
I am fairly new to unit testing in C# and learning to use Moq. Below is the class that I am trying to test.
class MyClass
{
SomeClass someClass;
public MyClass(SomeClass someClass)
{
this.someClass = someClass;
}
pu...
I have an Excel file and I want to read a value of a cell i.e a cell contains (S:1 P:0 K:1 Q:1) I want to read each value and save each value to another column. For example if S:1, then should be another cell 1, how can I read the data from a cell a...
Can I disable right click on my web page without using JavaScript? I ask this because most browsers allow user to disable JavaScript.
If not, how do I use JavaScript to disable right click?...
I'm measuring text using Paint.getTextBounds(), since I'm interested in getting both the height and width of the text to be rendered. However, the actual text rendered is always a bit wider than the .width() of the Rect information filled by getTextB...
I've just tried to deploy my first web application to IIS on my Windows 7 Home Premium notebook. After creating the application, I had to change to the Classic App Pool, then set that pool for framework 4.0. Now I get the following error:
HTTP ...
I am trying to read a simple text file into a String. Of course there is the usual way of getting the input stream and iterating with readLine() and reading contents into String.
Having done this hundreds of times in past, I just wondered how can I...
Shall this be the example:
#include <iostream>
using namespace std;
int main()
{
cout << "Hola, moondo.\n";
}
It throws the error:
gcc -c main.cpp gcc -o edit main.o main.o: In function `main':
main.cpp:(.text+0xa): undefined ref...
I need to create an Oracle DB function that takes a string as parameter. The string contains letters and numbers. I need to extract all the numbers from this string. For example, if I have a string like RO1234, I need to be able to use a function, sa...
Not sure why this isn't working.
When people click the 'edit' button of my application, the disabled textfields become editable:
$("#bewerken").click(function(e) {
$("input[disabled='disabled']").removeAttr('disabled');
});
I then want to ...
I know how to create a histogram (just use "with boxes") in gnuplot if my .dat file already has properly binned data. Is there a way to take a list of numbers and have gnuplot provide a histogram based on ranges and bin sizes the user provides?...
How do I redirect users after submit button click? My javascript isn't working:
Javascript
<script type="text/javascript" language="javascript">
function redirect()
{
window.location.href="login.php";
}
</script>
Form Page
<fo...
I often use this list command in Unix (AIX / KSH):
ls -Artl
It displays the files as this:
-rw-r--r-- 1 myuser mygroup 0 Apr 2 11:59 test1.txt
-rw-r--r-- 1 myuser mygroup 0 Apr 2 11:59 test2.txt
I would like to modify the command such a way...
I want to display animated GIF images in my aplication.
As I found out the hard way Android doesn't support animated GIF natively.
However it can display animations using AnimationDrawable:
Develop > Guides > Images & Graphics > Drawables Overv...
I am currently using python 2.7 and trying to open an Excel sheet.
When using the code below:
import os
from win32com.client import Dispatch
xlApp = win32com.client.Dispatch("Excel.Application")
xlApp.Visible = True
# Open the file we want in Excel...
I am trying to get a small box to appear on the bottom-left side of an image when a mouse moves over it. Inside the box there will be a link to a different page.
Here is somewhat similar to what I want, but the box to be smaller and not connected to...
When I try to do any svn command and supply the --username and/or --password options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified by --username. Neither --no-auth-cache nor --non-...
Which class would work best for a non-ordered list of pairs? I'll be taking a bunch of (float,short) pairs and will need to be able to perform simple math (like multiplying the pair together to return a single float, etc). List only takes one argumen...
For running an ASP.NET Core application, I generated a dockerfile which build the application and copys the source code in the container, which is fetched by Git using Jenkins. So in my workspace, I do the following in the dockerfile:
WORKDIR /app
...
Say I have a javascript object that looks like this :
var data = {
name: "cliff",
age: "34",
name: "ted",
age: "42",
name: "bob",
age: "12"
}
var jsonData = JSON.stringify(data);
I stringify it to convert...
I want to paste a range of cells in Outlook.
Here is my code:
Sub Mail_Selection_Range_Outlook_Body()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
On Error Resume Next
' Only send the visible cells in the selecti...
I checked out nearly every relevant article on stackoverflow already, but I just cant fix my problem.
Here is the code:
web.xml:
<display-name>Spring3MVC</display-name>
<welcome-file-list>
<welcome-file>index....
I have two tables where column [date] is type of DATETIME2(0).
I have to compare two records only by theirs Date parts (day+month+year), discarding Time parts (hours+minutes+seconds).
How can I do that?...
I would like to know how to generate a random number between two given values.
I am able to generate a random number with the following:
Random r = new Random();
for(int i = 0; i < a.length; i++){
for(int j = 0; j < a[i].length; j++){
...
I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as "19/12/11" or "Green" then associate this number with a variable,
Does anyone have any ideas?...
I have reviewed quite a few demos and have no idea why I can't get the CSS3 spin to function. I am using the latest stable release of Chrome.
The fiddle:
http://jsfiddle.net/9Ryvs/1/
_x000D_
_x000D_
div {_x000D_
margin: 20px;_x000D_
width: 100p...
How do I convert the contents of an HTML table (<table>) to CSV format? Is there a library or linux program that does this? This is similar to copy tables in Internet Explorer, and pasting them into Excel....
Assuming
boolean a = false;
I was wondering if doing:
a &= b;
is equivalent to
a = a && b; //logical AND, a is false hence b is not evaluated.
or on the other hand it means
a = a & b; //Bitwise AND. Both a and b are evaluat...
I'm new to React and I'm puzzled on something kind of basic.
I need to append a component to the DOM after the DOM is rendered, on a click event.
My initial attempt is as follows, and it doesn't work. But it's the best thing I've thought to try. (A...
I'm trying to add a row to an InnoDB table with a simply query:
INSERT INTO zip_codes (zip_code, city) VALUES ('90210', 'Beverly Hills');
But when I attempt this query, I get the following:
ERROR 1114 (HY000): The table zip_codes is full
Doi...
create procedure sp_First
@columnname varchar
AS
begin
select @columnname from Table_1
end
exec sp_First 'sname'
My requirement is to pass column names as input parameters.
I tried like that but it gave wrong output.
So Help me...
I am getting warning as
"[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint
What does that mean?...
How can I check if an application is running from a batch (well cmd) file?
I need to not launch another instance if a program is already running. (I can't change the app to make it single instance only.)
Also the application could be running as any...
Is there a measurable performance difference between using INT vs. VARCHAR as a primary key in MySQL? I'd like to use VARCHAR as the primary key for reference lists (think US States, Country Codes) and a coworker won't budge on the INT AUTO_INCREMENT...
I am in need of creating a table in Ionic. I thought of using Ionic grid but could not achieve what I wanted. How can I do this? Here is an image of something similar to what i want:
I can use this but how can I divide the rows like in the picture...
I found this.
And I am trying this:
x='some
thing'
y=(${x//\n/})
And I had no luck, I thought it could work with double backslash:
y=(${x//\\n/})
But it did not.
To test I am not getting what I want I am doing:
echo ${y[1]}
Getting:
s...
I am trying to create a matrix of random numbers, but my solution is too long and looks ugly
random_matrix = [[random.random() for e in range(2)] for e in range(3)]
this looks ok, but in my implementation it is
weights_h = [[random.random() for e...
I want to setup my local development machine so that any requests for *.local are redirected to localhost. The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local, site2.local etc, and have them all resolve to...
I just started to read "Pro Spring MVC with web flow" and it comes with a code sample that I want to follow.
What I want - I want to build the applications as it's done in the book, using Gradle
What is the problem - I have never used Gradle befor...
I have done a project in Matlab and now I have uninstalled Matlab. Now, I need some reference of my project. I'm left with all the .mat files. I'm trying to open them in notepad and I'm getting unicode characters over there. My question is simple. Ho...
I have pandas DataFrame like this
X Y Z Value
0 18 55 1 70
1 18 55 2 67
2 18 57 2 75
3 18 58 1 35
4 19 54 2 70
I want to write this data to a text file ...
Is there a good reason not to set the PHP configuration variable max_execution_time to 0?
A coworker recently checked in a change to a file that added:
ini_set('max_execution_time', 0);
The default value had been too low for a page that did some ...
I'm trying to replace the arrow of a select with a picture of my own. I'm including the select in a div with the same size, I set the background of the select as transparent and I'm including a picture(with the same size as the arrow) in the right to...
Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.
The problem being I have no idea where to start or how to write ...
I'm trying to import a project from VCS (well, I'm doing it for the first time actually) and this is my (imported) project's structure:
BTW. this screen is made after many tries of changing these directories' properties (in their context menus).
...
So I am working on something that wasn't well thought out in the build from the backend team. That leaves me with a document full of divs.
What I am doing is rolling back from the element I need to click on, get the parent container then find an el...
I have just installed XAMPP and everything works fine except that I can't get apache to run. It seems that port 80 is the problem, I have disabled Skype to use port 80 but it doesn't seem to fix it. I read somewhere that the SSL port can be the pro...
I've used a number of different *nix-based systems of the years, and it seems like every flavor of Bash I use has a different algorithm for deciding which startup scripts to run. For the purposes of tasks like setting up environment variables and al...
I was curious to know how I can round a number to the nearest whole number. For instance, if I had:
int a = 59 / 4;
which would be 14.75 if calculated in floating point; how can I store the result as 15 in "a"?...
When my app starts, I want it to check if a particular alarm (registered via AlarmManager) is already set and running. Results from google seem to indicate that there is no way to do this. Is this still correct? I need to do this check in order to ad...
I am trying to collect some data from multiple subsets of a data set and need to create a data frame to collect the results. My problem is don't know how to create an empty data frame with defined number of columns without actually having data to pu...
I am currently using this type of SQL on MySQL to insert multiple rows of values in one single query:
INSERT INTO `tbl` (`key1`,`key2`) VALUES ('r1v1','r1v2'),('r2v1','r2v2'),...
On the readings on PDO, the use prepared statements should give me a...
How can I increase the memory available for Apache spark executor nodes?
I have a 2 GB file that is suitable to loading in to Apache Spark. I am running apache spark for the moment on 1 machine, so the driver and executor are on the same machine. Th...
I can't get my refresh token with my code. I can only get my access token, token type etc.,
I have followed some tutorials like putting access_type=offline on my login URL:
echo "<a href='https://accounts.google.com/o/oauth2/auth?"
. "access...
I am trying to find the most recent record based on a date field. When I set latest = 1 in the where clause, I get an error. Please help if possible. DATE is a the field I'm sorting by. I have tried both latest = 1 and latest = '1'
SELECT
STAFF_I...
Are there any issues with using async/await in a forEach loop? I'm trying to loop through an array of files and await on the contents of each file.
import fs from 'fs-promise'
async function printFiles () {
const files = await getFilePaths() // ...
What is the difference in terms of functionality between the Apache HTTP Server and Apache Tomcat?
I know that Tomcat is written in Java and the HTTP Server is in C, but other than that I do not really know how they are distinguished. Do they have d...
How can I get the class name from an ActiveRecord object?
I have:
result = User.find(1)
I tried:
result.class
# => User(id: integer, name: string ...)
result.to_s
# => #<User:0x3d07cdc>"
I need only the class name, in a string (Use...
With window.open method I open new site with parameters, which I have to pass by post method.I've found solution, but unfortunately it doesn't work. This is my code:
<script type="text/javascript">
function openWindowWithPost(url,name,k...
Installed:
SharePoint Server 2010 for Internet Enterprise Beta (x64)
On:
Windows Server 2008 Standard (x64) on 64 bit hardware
Attempts to access the Central Administration console led to IIS returning 503. The service is unavailable
And this error...
I would like to have all elements in my JPanel to be aligned to the left. I try to do it in the following way:
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
As ...
I'm in the in the process of developing an application for a client, which will have an SSL certificate and be served under https. However, to integrate with their existing site they want to provide their navigation inside an iframe.
I can see this ...
I am newbie in git and I am working on git.
I added some files in git :
git add <file1>
git add <file2>
then I wanted to push that for review, but mistakenly I did
git commit
so the files which I have changed don't go for revie...
For the following ajax post request for Flask (how can I use data posted from ajax in flask?):
$.ajax({
url: "http://127.0.0.1:5000/foo",
type: "POST",
contentType: "application/json",
data: JSON.stringify({'inputVar': 1}),
succ...
Is it possible to have the contain function find if the string contains 2 words or more?
This is what I'm trying to do:
string d = "You hit someone for 50 damage";
string a = "damage";
string b = "someone";
string c = "you";
if(d.Contains(b + a))
{...
My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK.
CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What...
How do I get my project's runtime dependencies copied into the target/lib folder?
As it is right now, after mvn clean install the target folder contains only my project's jar, but none of the runtime dependencies....
In other languages like Python 2 and Python 3, you can define and assign values to a tuple variable, and retrieve their values like this:
tuple = ("Bob", 24)
name, age = tuple
print(name) #name evaluates to Bob
print(age) #age e...
So I've given Android Studio a try, because I really like Resharper and noticed that the IDE had some of their functionality built into it. Having now created a default new project, I added a new layout file and wanted to change the existing default ...
It's my understanding that these two functions will have the same behavior in JavaScript:
const whatever1 = (): Promise<number> => {
return new Promise((resolve) => {
resolve(4);
});
};
const whatever2 = async (): Promis...
I have two div, one on the left and the other is on the right. Now I want to divide this two div with a border between them. But the border with full height looks bad.
I want to control the height of the border. How could I do this?...
Is there a way to substring a string in Python, to get a new string from the third character to the end of the string?
Maybe like myString[2:end]?
If leaving the second part means 'till the end', and if you leave the first part, does it start from ...
I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.
Updating all my local branches is tedious:
git fetch --all
git rebase origin/master
git checkout staging
git rebase o...
I have a branch set up to track a ref in origin. git checkout <branchname> switches to that branch, and a git status will show me how far ahead or behind my branch is from origin, but I'm surprised that origin/HEAD still points at origin/maste...
In Android, when I set background image to Button, I can not see any effect on button.
I need some effect on button so user can recognize that button is clicked.
Button should be dark while a few second when it clicked, so what should I do for thi...
I have developed a reverse-string program. I am wondering if there is a better way to do this, and if my code has any potential problems. I am looking to practice some advanced features of C.
char* reverse_string(char *str)
{
char temp;
siz...
I am trying to define some endpoints and do a test using nodejs. In server.js I have:
var express = require('express');
var func1 = require('./func1.js');
var port = 8080;
var server = express();
server.configure(function(){
server.use(express.bo...
how can I change image opacity using javascript? I'm going to create a fading effect using javascript, is there any sample? is there anything like image.opacity that can be changed through JS code? how is it set?
thanks...
I have a string column COL1 when I am doing this
SELECT TO_CHAR(TO_DATE(COL1,'dd-mon-yy'), 'mm/dd/yyyy')
FROM TABLE1
The data in COL1 is in dd-mon-yy, eg: 27-11-89 and 89 is 1989 but the select returns it as 11/27/2089.
I have to do an inner TO_D...
Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode the string back to the original string?
I know I'm making a very ...
Countless times during the day I am copying and pasting records from SQL Server Management Studio to Excel.
My problem is that a DateTime value such as 8/23/2013 4:51:02 PM does not display correctly as shown in the image below even though it show...
Basically what I've done is write an enum for States, and I want to not only be able to access them just as states but also access their abbreviation and whether or not they were an original colony.
public enum States {
...
MASSACHUS...
I've run into a unique situation that I have so far been unable to find a solution for: dynamically assigning a value to a CSS style. I know how to use jQuery to assign width, height, etc. to an element, but what I'm trying to do is actually change ...
I added a linked server, which is showing in the linked server list, but when I query it, it throws an error with the db server name.
EXEC sp_helpserver
EXEC sp_addlinkedserver 'aa-db-dev01'
Select * from openquery('aa-db-dev01','Select * from Test...
How to create new table which structure should be same as another table
I tried
CREATE TABLE dom AS SELECT * FROM dom1 WHERE 1=2
but its not working error occurred ...
I am a total newbie. Can somebody tell me how to remove an HTML element using the original Javascript not jQuery.
index.html
<html>
<head>
<script type="text/javascript" src="myscripts.js" > </script>
<style>
#dummy...
How to include a Javascript or CSS file in Yii Framework?
I want to create a page on my site that has a little Javascript application running, so I want to include .js and .css files in a specific view....
I have written the following code:
class FigureOut:
def setName(self, name):
fullname = name.split()
self.first_name = fullname[0]
self.last_name = fullname[1]
def getName(self):
return self.first_name, self.last_name
...
To add a legend to a matplotlib plot, one simply runs legend().
How to remove a legend from a plot?
(The closest I came to this is to run legend([]) in order to empty the legend from data. But that leaves an ugly white rectangle in the upper right ...
I have two lists of objects. Each list is already sorted by a property of the object that is of the datetime type. I would like to combine the two lists into one sorted list. Is the best way just to do a sort or is there a smarter way to do this in P...
I have a list of many data.frames that I want to merge. The issue here is that each data.frame differs in terms of the number of rows and columns, but they all share the key variables (which I've called "var1" and "var2" in the code below). If the da...
What is your favorite Visual Studio keyboard shortcut? I'm always up for leaving my hands on the keyboard and away from the mouse!
One per answer please....
With React 16.8.6 (it was good on previous version 16.8.3), I get this error when I attempt to prevent an infinite loop on a fetch request
./src/components/BusinessesList.js
Line 51: React Hook useEffect has a missing dependency: 'fetchBusinesses'.
...
I have setup gunicorn with 3 workers 30 worker connections and using eventlet worker class. It is setup behind Nginx. After every few requests, I see this in the logs.
[ERROR] gunicorn.error: WORKER TIMEOUT (pid:23475)
None
[INFO] gunicorn.error: Bo...
I see in C++ there are multiple ways to allocate and free data and I understand that when you call malloc you should call free and when you use the new operator you should pair with delete and it is a mistake to mix the two (e.g. Calling free() on so...
I have been using Vim, and I would really like to save my settings. The problem I am having is that I cannot find my .vimrc file, and it is not in the standard /home/user/.vimrc location. How might I find this file?...
I want to create a vector out of a row of a data frame. But I don't want to have to row and column names. I tried several things... but had no luck.
This is my data frame:
> df <- data.frame(a=c(1,2,4,2),b=c(2,6,2,1),c=c(2.6,8.2,7.5,3))
> ...
I'm writing a small API-connected application in C#.
I connect to a API which has a method that takes a long string, the contents of a calendar(ics) file.
I'm doing it like this:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);...
I have added "illuminate/html": "5.*" to composer.json and ran "composer update".
- Installing illuminate/html (v5.0.0)
Loading from cache
I ran this command in the root of the website. I modified the composer.json file in /root/.composer......
When I run this command:
wget --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://yahoo.com
...I get this result (with nothing else in the file):
<!-- hw147.fp.gq1.yahoo.com uncompressed/chu...
In Angular 1.x you can define constants like this:
angular.module('mainApp.config', [])
.constant('API_ENDPOINT', 'http://127.0.0.1:6666/api/')
What would be the equivalent in Angular (with TypeScript)?
I just don't want to repeat the API bas...
Is there a way in Python to pass optional parameters to a function while calling it and in the function definition have some code based on "only if the optional parameter is passed"...
Through using IntelliSense and looking at other people's code, I have come across this IntPtr type; every time it has needed to be used I have simply put null or IntPtr.Zero and found most functions to work. What exactly is it and when/why is it used...
I use log4j and would like to route the output of certain Loggers to specific files.
I already have multiple appenders in place. Now, to make debugging easier, I want to tell log4j that the output generated by a specific class (e.g. foo.bar.Baz) sh...
Following Question:
<div id="id-74385" class="guest clearfix" style="z-index: 999;">
Given above,
If I want a XPath expression with checks both id and class, can we do it w/ 'and' condition LIKE:
//div[@id='id-74385'] and div[@class='guest...
I have this strange issue, and im dealing with it for more than 8 hours now.. Depending on situation i have to calculate UILabels size dynamically,
e.g my UIViewController receives an event and i change UILabels size. from bigger to smaller. The si...
I am trying to encode some information to read into a Machine Learning model using the following
import numpy as np
import pandas as pd
import matplotlib.pyplot as py
Dataset = pd.read_csv('filename.csv', sep = ',')
X = Dataset.iloc[:,:-1].values...
I have the following input:
string txt = " i am a string "
I want to remove space from start of starting and end from a string.
The result should be: "i am a string"
How can I do this in c#?...
I have a table and the columns on this table contains empty spaces for some records. Now I need to move the data to another table and replace the empty spaces with a NULL value.
I tried to use:
REPLACE(ltrim(rtrim(col1)),' ',NULL)
but it doesn'...
I have migrated a database from oracle, and now have a few Scalar-valued Functions.
However, when I call them, I get an error saying:
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.chk_mgr", or the name is ambiguo...
I want to stop execution for 2 seconds. So is this, but now follows a code block:
<html>
<head>
<title> HW 10.12 </title>
<script type="text/javascript">
for (var i = 1; i <= 5; i++) {
...
I have gone across the JavaScript questions on this topic, this question is specifically about Angular2 with TypeScript.
What I am trying to do is to concatenate the json objects to an array.
My code looks something like this,
public results: [];
...
I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous 4 cars). There are also classic easily-deadlocked problems like The Dining Phil...
I came across a new term in Java 8: "functional interface". I could only find one use of it while working with lambda expressions.
Java 8 provides some built-in functional interfaces and if we want to define any functional interface then we...
I have some code which sets the value of cells in a DataRow by column name i.e.
row["ColumnName"] = someValue;
I want to also set the value for this row in the column immediately to the right of the one found above. Clearly if I was getting the c...
I have two UITextFields (e.g. username and password) but I cannot get rid of the keyboard when pressing the return key on the keyboard. How can I do this? ...
I need to give a default value for input type=text field as follows:
<input type="text" size="32" value="" name="fee" />
There is one way to give this default value as I know:
<input type="text" size="32" value="1000" name="fee" />
...
I'm using kafka 0.10 without zookeeper. I want to get kafka topics list. This command is not working since we're not using zookeeper:
bin/kafka-topics.sh --list --zookeeper localhost:2181. How can I get the same output without zookeeper?...
How can I insert multiple figures each of them has a caption and label, without using minipage.
I wrote this code, but just there is one caption :(
\begin{figure}[htp]
\centering
\label{figur}\caption{equation...}
\begin{tabular}{cc}
...
I need to read an image file in C/C++. It would be very great, if some one can post the code for me.
I work on gray scale images and the images are JPEG. I would like to read the images into a 2D array which will make my work easy. ...
I've just started using gerrit and I want to know why we need to do git push gerrit HEAD:refs/for/master instead of doing git push origin master
If I do git push origin master I get the error saying ! [remote rejected] master -> master (prohibite...
So I want to do something like this sql code below:
select s.id, s.name,s.city
from stuff s
group by s.name having count(where city and name are identical) > 1
To produce the following, (but ignore where only name or only city match, it has to...
I tried to use the matplotlib package via Pycharm IDE on windows 10.
when I run this code:
from matplotlib import pyplot
I get the following error:
ImportError: No module named 'tkinter'
I know that in python 2.x it was called Tkinter, but that...
I'm trying to create a bunch of records in my MySQL database. This is a one time creation so I am not trying to create a stored procedure. Here is my code:
BEGIN
SET i = 2376921001;
WHILE (i <= 237692200) DO
INSERT INTO `mytable` (code, act...
I have been successfully using gcc on Linux Mint 12. Now I am getting an error. I have recently been doing some .so builds and installed Clang not to long ago, but have successfully compiled since both of those events, so not sure what has changed. I...
I'm trying to install github private repository by npm that includes other private github repositories as dependency.
Have tried a lot of ways and posts but none is working. Here is what i'm doing :
npm install git+https://github.com/myusername/myg...
What are the main differences between Objective-C and C++ in terms of the syntax, features, paradigms, frameworks and libraries?
*Important: My goal is not to start a performance war between the two languages. I only want real hard facts. In fact, m...
Here's a question that I don't quite understand:
The command, system("pause"); is taught to new programmers as a way to pause a program and wait for a keyboard input to continue. However, it seems to be frowned on by many veteran programmers as some...
I have a DataFrame df:
A B
a 2 2
b 3 1
c 1 3
I want to create a new column based on the following criteria:
if row A == B: 0
if rowA > B: 1
if row A < B: -1
so given the above table, it should be:
A B C...
What I'm trying to do is make it so that if you click on a button, it scrolls down (smoothly) to a specific div on the page.
What I need is if you click on the button, it smooth scrolls to the div 'second'.
_x000D_
_x000D_
.first {_x000D_
width...
Anyone have experience for both? How do they stack up against each other?
We are planning on using one of them for logging in an enterprise application.
References:
log4net
nlog
EDIT: We have no existing dependencies to either nlog or log4net....
So I'm fairly new to Java and programming and I was wondering how to create a node class?
So far I have:
public class ItemInfoNode{
private ItemInfoNode next;
private ItemInfoNode prev;
private ItemInfo info;
public ItemInfoNode(I...
Is there a way to clear the value of a variable in python?
For example if I was implementing a binary tree:
class Node:
self.left = somenode1
self.right = somenode2
If I wanted to remove some node from the tree, I would need to set self.left...
Should you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classes which are calling using the DAO objects? Or does it make sense to annotate both "layers"?...
I have a Person model that has a foreign key relationship to Book, which has a number of fields, but I'm most concerned about author (a standard CharField).
With that being said, in my PersonAdmin model, I'd like to display book.author using list_di...
I'm using Maven 3.0.3, JUnit 4.8.1, and Jacoco 0.6.3.201306030806, and I am trying to create test coverage reports.
I have a project with unit tests only, but I can't get reports to run, I'm repeatedly getting the error: Skipping JaCoCo execution du...
If I have a python class as:
class BaseClass(object):
#code and the init function of the base class
And then I define a child class such as:
class ChildClass(BaseClass):
#here I want to call the init function of the base class
If the init funct...
The below code will not join, when debugged the command does not store the whole path but just the last entry.
os.path.join('/home/build/test/sandboxes/', todaystr, '/new_sandbox/')
When I test this it only stores the /new_sandbox/ part of the cod...
I am using AngularJS, and I have a MVC 4 API that returns a HttpResponseMessage with an attachment.
var result = new MemoryStream(pdfStream, 0, pdfStream.Length) {
Position = 0
};
var response = new HttpResponseMessage {
StatusCode = HttpS...
In my HTML page, I have two sets of Boolean based radio buttons: Labeled: "Yes" and "No" / Values: True and False respectively. I'm populating a full form from a PostgreSQL database table to allow the authenticated user to view the form with populate...
Perhaps this is just completely wrong, but back in the days of Webforms you would return a Dataset which you would then bind to a grid. But now in MVC you're not supposed to pass a datatable because you cannot serialize it and it's technically passi...
Given two Date() objects, where one is less than the other, how do I loop every day between the dates?
for(loopDate = startDate; loopDate < endDate; loopDate += 1)
{
}
Would this sort of loop work? But how can I add one day to the loop counte...
I have a resources folder/package in the root of my project, I "don't" want to load a certain File. If I wanted to load a certain File, I would use class.getResourceAsStream and I would be fine!! What I actually want to do is to load a "Folder" withi...
Is it possible to know if the app was launched/opened from a push notification?
I guess the launching event can be caught here:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (...
I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals() returns true.
Here is the code:
if (((ListBoxItem)lstBaseMenu.SelectedItem).Content.Equals("Energy Attack"))
{
...
What is the most direct route to get a DataSet if I have a sql command?
string sqlCommand = "SELECT * FROM TABLE";
string connectionString = "blahblah";
DataSet = GetDataSet(sqlCommand,connectionString);
GetDataSet()
{
//...?
}
I started with...
How can I get the year/month/day of a NSDate object, given no other information? I realize that I could probably do this with something similar to this:
NSCalendar *cal = [[NSCalendar alloc] init];
NSDateComponents *components = [cal components:0 fr...
Can you explain to me:
What is a Predicate Delegate?
Where should we use predicates?
Any best practices when using predicates?
Descriptive source code will be appreciated....
I have a DataFrame with 4 columns of which 2 contain string values. I was wondering if there was a way to select rows based on a partial string match against a particular column?
In other words, a function or lambda function that would do something ...
I see that we have multiple url's as value of this attribute like in spring:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xs...
Does anyone know why CGContextDrawImage would be drawing my image upside down? I am loading an image in from my application:
UIImage *image = [UIImage imageNamed:@"testImage.png"];
And then simply asking core graphics to draw it to my context:
CG...
Is there an easy and straight-forward method to select elements based on their data attribute? For example, select all anchors that has data attribute named customerID which has value of 22.
I am kind of hesitant to use rel or other attributes to...
In my activity, I'm calling a second activity from the main activity by startActivityForResult. In my second activity, there are some methods that finish this activity (maybe without a result), however, just one of them returns a result.
For example...
I made a console app to consume a Web API I just made. The console app code does not compile. It gives me the compilation error:
'System.Net.Http.HttpContent' does not contain a definition for
'ReadAsAsync' and no extension method 'ReadAsAsync' acc...
I am a beginner here so pardon me for this question am using return File::put($path , $data); to create a file in public folder on Laravel. I used this piece of code from controller I need to know the value of $path how should it be....
I have TextView added Programmatically in to LinearLayout and on some external events I want to decrease bottom margin of that TextView to -10, for that I tried following.
LinearLayout.LayoutParams lastTxtParams = new LinearLayout.LayoutParams(Line...
I need a database of every single valid word in English. I checked the /usr/share/dict/words file, it contains less than 100k words. Wikipedia says English has 475k words. Where do I get the complete list (American spelling)?
Also, is there a singl...
I would like to create a stored routine for MySQL that figures out the number of business or working days for a month (Working Days are Monday thru Friday).
It's a syntax error however I don't know what the syntax error is. All it tells me is:
...
Trying to do something I would think would be very simple. I would like to import an existing JavaScript library and then call it's functions. So for example I would like to import blah.js and then call blah().
import React from 'react';
import {b...
I need to dynamically create an instance of a class in Python. Basically I am using the load_module and inspect module to import and load the class into a class object, but I can't figure out how to create an instance of this class object.
Please he...
bash: flutter: command not found
Apparently, none of the flutter commands are working on the terminal of an android studio which I believe I am trying to run it at the root of my project....
I need to add a dynamic class to a list of regular classes, but have no idea how (I'm using babel), something like this:
<div className="wrapper searchDiv {this.state.something}">
...
</div>
Any ideas?...
I am trying to figure out what version of Boost my code thinks it's using. I want to do something like this:
#error BOOST_VERSION
but the preprocessor does not expand BOOST_VERSION.
I know I could print it out at run-time from the program, and I k...
I want to customize my app's look by using a logo image as the navigation bar's title, instead of plain text. When I use this code
let logo = UIImage(named: "logo.png")
self.navigationItem.titleView = logo;
I get the error "UIImage is not converti...
Is there a way to set the textStyle attribute of a TextView programmatically? There doesn't appear to be a setTextStyle() method.
To be clear, I am not talking about View / Widget styles! I am talking about the following:
<TextView
android:id=...
I have a list of countries, some with a very long name:
<select name=countries>
<option value=af>Afghanistan</option>
<option value=ax>Åland Islands</option>
...
<option value=gs>South Georgia and the South S...
When working in a Bash environment, to set the value of a variable as the result of a command, I usually do:
var=$(command -args)
where var is the variable set by the command command -args. I can then access that variable as $var.
A more conventi...
I tried stopping tomcat. It failed with this message:
Tomcat did not stop in time. PID file was not removed.
I then tried again and got this:
PID file (/opt/tomcat/work/catalina.pid) found but no matching
process was found. Stop aborted.
I t...
I'm working on a browser based app, currently I'm developing and styling for the ipad safari browser.
I'm looking for two things on the ipad: How can I disable vertical scrolling for pages that don't require it? & how can I disable the elastic b...
For any arbitrary instance (collections of different objects, compositions, single objects, etc)
How can I determine its size in bytes?
(I've currently got a collection of various objects and i'm trying to determine the aggregated size of it)
EDIT...
I have been troubleshooting this program for hours, trying several configurations, and have had no luck. It has been written in java, and has 33 errors (lowered from 50 before)
Source Code:
/*This program is named derivativeQuiz.java, stored on a n...
If I use a break statement, it will only break inner loop and I need to use some flag to break the outer loop. But if there are many nested loops, the code will not look good.
Is there any other way to break all of the loops? (Please don't use goto ...
I am trying to use the :after CSS pseudo-element on an input field, but it does not work. If I use it with a span, it works OK.
<style type="text/css">
.mystyle:after {content:url(smiley.gif);}
.mystyle {color:red;}
</style>
This work...
I have stored some data to a Global Class By using the Application Context In One Activity. Later I have to Retrieve those values in A Fragment. I have done something like this to store in Global Class.
AndroidGlobalClass AGC = ((AndroidGlobalClass...
I'm trying to work this form so when the first radio button is selected, run a certain validation. When the second radio button is selected, run a different validation, etc. Currently using Alerts to check the functionality, but whichever radio butto...
I am Debian user, and I want to install python-dev, but when I run the code in the shell as a root:
# aptitude install python-dev
I get the following error:
Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 28, in ...
I am not sure what is this error!
#1292 - Truncated incorrect DOUBLE value:
I don't have double value field or data!
I have wasted a whole hour trying to figure this out!
here is my query
INSERT INTO call_managment_system.contact_numbers
...
I am fairly new to python and have no html experience. The question has been asked and either not answered at all or not answered in enough detail for me to set the default font within iPython (not change to browser). Specifically, what has to be put...
I need to copy a database from a remote server to a local one. I tried to use SQL Server Management Studio, but it only backs up to a drive on the remote server.
Some points:
I do not have access to the remote server in a way that I could copy fil...
I know how to do it normally, but I could swear that you could fill out out like a[0] = {0,0,0,0}; How do you do it that way? I did try Google, but I didn't get anything helpful....
Is there anyway in .Net (C#) to extract data from a zip file without decompressing the complete file?
Simply I possibly want to extract data (file) from the start of a zip file, obviously this depends if the compression algorithm compress the file i...
I'm not able to split values from this string:
"Food 1 | Service 3 | Atmosphere 3 | Value for money 1 "
Here's my current code:
String rat_values = "Food 1 | Service 3 | Atmosphere 3 | Value for money 1 ";
String[] value_split = rat_values.split(...
There's a common problem I've come across a few times when logging Exceptions. There seem to be various different types to deal with. E.g. some wrap other Exceptions, some don't have a message at all - just a type.
Most code I've seen logs Exception...
Is there a way using HTML/CSS (with relative sizing) to make a row of cells stretch the entire width of the table within which it is contained?
The cells should be equal widths and the outer table size is also dynamic with <table width="100%">...
I'm doing a ajax call to my own server on a platform which they set prevent these ajax calls (but I need it to fetch the data from my server to display retrieved data from my server's database).
My ajax script is working , it can send the data over t...
I was trying to add Tomcat 7 in my Eclipse in Ubuntu. When I click "Add new server" in Eclipse and select "Tomcat v7.0 Server", the field "Server Name" is blank and I cannot type in anything in that textbox as shown below:
What I did before is I d...
In my package.json I have these two scripts:
"scripts": {
"start-watch": "nodemon run-babel index.js",
"wp-server": "webpack-dev-server",
}
I have to run these 2 scripts in parallel everytime I start developing in Node.js. The first th...
Is there a reference for the memory size of Python data stucture on 32- and 64-bit platforms?
If not, this would be nice to have it on SO. The more exhaustive the better! So how many bytes are used by the following Python structures (depending on th...
I'm using impdp to import a backup. But I want change default directory dumpfile.
$ impdp system/password@$ORACLE_SID schemas=USER_SCHEMA dumpfile=mydumpfile.dmp logfile=impdpmydumpfile.log
Import: Release 11.2.0.3.0 - Production on Mon Mar 16 09:3...
When I do a \dt in psql I only get a listing of tables in the current schema (public by default).
How can I get a list of all tables in all schemas or a particular schema?...
I have been given a Source Folder (src) of a Java Project. I have created a .project file, kept it inside that folder and imported that Project into Eclipse 3.6 through the Import Existing Projects into Workspace Option and added required jars to it....
I'm not a programmer but I couldn't find any answer on this website. I'm trying to run a game on linux ubuntu with Java Open JDK but nothing happen. I tried to run it with the prompt command and it said this:
leops95@leops95-SATELLITE-C660:~$ '/home...
At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file.
Are there tool or libraries that we can use for automated testing to check that the generate...
Suppose I have some jQuery code that attaches an event handler to all elements with class .myclass.
For example:
$(function(){
$(".myclass").click( function() {
// do something
});
});
And my HTML might be as follows:
<a clas...
What is the best way to create a zero-filled pandas data frame of a given size?
I have used:
zero_data = np.zeros(shape=(len(data),len(feature_list)))
d = pd.DataFrame(zero_data, columns=feature_list)
Is there a better way to do it?...
I am looking for an efficient way to remove all elements from a javascript array if they are present in another array.
// If I have this array:
var myArray = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
// and this one:
var toRemove = ['b', 'c', 'g'];
I ...
I've just installed XAMPP for Windows - should be the newest version (XAMPP Control Panel v3.2.1).
Apache is running just fine on port 80 and 443, but MySQL is not starting. When I press the start button, I get this message:
Attempting to start...
I have seen some Apps and Websites who use Data from the Android Play store. E.g. Apps or Sites with a top Apps ranking etc. But how can you get the Data? From where I can parse it? ...
I have a form from which I would like to copy some default values into the inputs. The form inputs are using the selectize.js plugin. I would like to set some of the form values programatically. The standard way of doing this:
$("#my_input").val(...
I'm trying to parse a document that has reference numbers littered throughout it.
Text text text {4:2} more incredible text {4:3} much later on
{222:115} and yet some more text.
The references will always be wrapped in brackets, and there wil...
I want to upload multiple files and store them in a folder and get the path and store it in the database... Any good example you looked for doing multiple file upload...
Note: Files can be of any type......
I have an android application which contains multiple activities.
In one of them I'm using a button which will call the device camera :
public void onClick(View view) {
Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
star...
I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a git push. The response tells me that everything is up to date, but clearly it's not.
git remote show origin
responds with the ...
I'm looking at MySQL stored procedures and function. What is the real difference?
They seem to be similar, but a function has more limitations.
I'm likely wrong, but it seems a stored procedure can do everything and more a stored function can. Why...
I want to validate an IPv4 address using Java. It should be written using the dot-decimal notation, so it should have 3 dots ("."), no characters, numbers in between the dots, and numbers should be in a valid range. How should it be done?...
I'm aware of the conceptual differences between Aggregation and Composition. Can someone tell me the implementation difference in Java between them with examples? ...
My website is http://www.collegeanswerz.com/. I'm using rails. The code is for searching for colleges. I want the user to be able to type in the colleges name, click enter, and be taken to the url, rather than seeing the search results (if the use...
I've spent entirely too long researching how to get two subplots to share the same y-axis with a single colorbar shared between the two in Matplotlib.
What was happening was that when I called the colorbar() function in either subplot1 or subplot2,...
I have some data in ViewData.Model, and in my views I want to write a partial view and to pass their current model I have in my page.
How I can pass their current ViewData.Model and render them through the location of partials?...
I want to read the metadata in media files and then save that metadata in a text/xml file, so that I can later insert that data in my database. I would prefer to use ffmpeg.
Also is the same thing possible with MediaInfo?? I know I can get the metad...
Why would someone prefer either the Lodash or Underscore.js utility library over the other?
Lodash seems to be a drop-in replacement for underscore, the latter having been around longer.
I think both are brilliant, but I do not know enough about how ...
Why doesn't Java include support for unsigned integers?
It seems to me to be an odd omission, given that they allow one to write code that is less likely to produce overflows on unexpectedly large input.
Furthermore, using unsigned integers can...
I am trying to optimize a function which does binary search of strings in JavaScript.
Binary search requires you to know whether the key is == the pivot or < the pivot.
But this requires two string comparisons in JavaScript, unlike in C like lan...
I am attempting to do some data conversion. Unfortunately, much of the data is in strings, where it should be int's or double, etc...
So what I've got is something like:
double? amount = Convert.ToDouble(strAmount);
The problem with this approac...
An existing web application is running on Tomcat 4.1. There is an XSS issue with a page, but I can't modify the source. I've decided to write a servlet filter to sanitize the parameter before it is seen by the page.
I would like to write a Filter ...
Since I updated to Maven 3 I get the following warning messages at each build :
How can I get rid of these warnings?
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for proj:id:...
I'm using the jQuery DatePicker control for the first time. I've got it working on my form, but it's about twice as big as I would like, and about 1.5 times as big as the demo on the jQuery UI page. Is there some simple setting I'm missing to control...
I am completely stumped as to why this doesn't work. It seems the HTML file can't load the CSS for some reason, even though both are in the same directory. Any idea what might be the problem?
index.html
<!DOCTYPE html>
<html>
<head&g...
When I have this code
$.ajax({
type: 'POST',
//contentType: "application/json",
url: 'http://localhost:16329/Hello',
data: { name: 'norm' },
dataType: 'json'
});
in Fiddler I can see following raw request
POST http://localhost...
I am trying to make a stored procedure using mySQL. This procedure will validate a username and a password. I'm currently running mySQL 5.0.32 so it should be possible to create procedures.
Heres the code I've used. All I get is an SQL syntax error...
In VB6/VBA, you can declare module-level variables outside of a specific Sub or Function method. I've used Private and Public before inside modules and understand them like so:
Public - visible to all code inside the module and all code outside th...
I have a EditText and button aligned to parent's bottom.
When I enter text in it and press the button to save data, the virtual keyboard does not disappear.
Can any one guide me how to hide the keyboard?...
I am using aspx. If I have HTML as follows:
<div id="classMe"></div>
I am hoping to dynamically add a css class through the code behind file, ie on Page_Load. Is it possible?...
Is it possible to bind javascript (jQuery is best) event to "change" form input value somehow?
I know about .change() method, but it does not trigger until you (the cursor) leave(s) the input field. I have also considered using .keyup() method but ...
I have a text file containing a specific date and time.
I want to be able to run a script at the time specified in that file.
How would you achieve that?
Create another script that runs in background (sort of a deamon) and checks every second if the...
I got this error with Xcode 5 when I try to run the app on my device.
The executable was signed with invalid entitlement
It worked fine with Xcode 4.x. Anyone knows how to get rid of the error?
...
I developed a dynamic web project in Eclipse.
I can access the app through my browser using the following URL:
http://localhost:8080/MyDynamicWebApp
I want to change the access URL to:
http://localhost:8080/app
To do so, I changed the context...
I am trying to connect MySQL database in Netbeans and stuck at the very first step- connecting the database. My Database is working fine on the console - tried command mysqladmin -u root -p ping
and it says mysql id is alive. I have even created data...
I'm trying to get a better understanding of the difference. I've found a lot of explanations online, but they tend towards the abstract differences rather than the practical implications.
Most of my programming experiences has been with CPython (dyn...
I have an html paragraph (inside a div) in which I want to display a simple fixed text. The text is a bit long so I'd rather the text will be in a seperate txt file.
something like
<div><p txt=file.txt></p></div>
Can I do ...
When I use show() to plot the graphs in X, the graphs looks very good. However when I start to use savefig() to generate large amount of graphs, the savefig() generated graphs
' font, lines, polygons all look smaller than the show() generated graph. ...
Basically, I'm trying to make a link that, when pressed, will hide the current body div tag and show another one in its place, unfortunately, when I click the link, the first body div tag still appears. Here is the HTML code:
<div id="body">
...
is there anyway to get the class when click event is fired. My code as below, it only work for id but not class.
_x000D_
_x000D_
$(document).ready(function() {_x000D_
$("a").click(function(event) {_x000D_
alert(event.target.id + " and " + even...
Ever since I upgraded my Samsung Galaxy S3 to android 4.3 (from 4.1.2) I am unable to use Chrome's remote debugging for android (more details here).
I have the developer options and USB debugging enabled on my phone, and this worked perfectly fine o...
I'm writing a bash script that needs to delete old files.
It's currently implemented using :
find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete
This will delete of the files older than 1 day.
However, what if I need a finer resolutio...
I would like to specify that a decimal field for a price must be >= 0 but I don't really want to impose a max value.
Here's what I have so far...I'm not sure what the correct way to do this is.
[Range(typeof(decimal), "0", "??"] public decimal Pric...
Is there a way to make Python logging using the logging module automatically output things to stdout in addition to the log file where they are supposed to go? For example, I'd like all calls to logger.warning, logger.critical, logger.error to go to ...
Say I have records with ID 3,4,7,9
I want to be able to go from one to another by navigation via next/previous links.
The problem is, that I don't know how to fetch record with nearest higher ID.
So when I have a record with ID 4, I need to be able t...
I am trying to fetch the JSON data from an url.It is in the form of object i have to push the object data into array.
var my_json;
$.getJSON("https://api.thingspeak.com/channels/"+did+"/feeds.json?api_key="+apikey+"&results=300", function(json1)...
I want to disable all the future dates after today in Jquery Ui Datepicker
Here is the Demo :
Code :
$( "#start_date" ).datepicker(
{
maxDate: '0',
beforeShow : function()
{
jQuery( t...
I'm trying to convert some strings that are in French Canadian and basically, I'd like to be able to take out the French accent marks in the letters while keeping the letter. (E.g. convert é to e, so crème brûlée would become creme brulee)
What ...
What is the simplest way to find if two Lists contain exactly the same elements, in the standard Java libraries?
It shouldn't matter if the two Lists are the same instance or not, and it shouldn't matter if the type parameter of the Lists are diffe...
I have a small application with a CheckBox option that the user can set if they want the app to start with Windows.
My question is how do I actually set the app to run at startup.
ps: I'm using C# with .NET 2.0....
Hi I was trying to add a row to a table using jQuery, but it is not working.
What might be the reason?
And, can I put in some value to the newly added row..?
Here is the code:
<html>
<head>
<script type="text/javascript" src="jq...
I'm creating a form for sending private messages and want to set the maxlength value of a textarea appropriate to the max length of a text field in my MySQL database table. How many characters can a type text field store?
If a lot, would I be able t...
I would like to implement a JavaScript code which states this:
if the page is loaded completely, refresh the page immediately, but only once.
I'm stuck at the "only once":
window.onload = function () {window.location.reload()}
this gives a loop wi...
Is it possible in windows cmd line to check all of the network addresses (with ping or similar) to see which ones are taken/ have active devices:
ie. something that does something like the following:
for i = 0 to 255
ping 192.168.1.i //Print th...
UPDATE
I have reverted back to Jquery 1.3.2 and everything is working, not sure what the problem is/was as I have not changed anything else apart of the jquery and ui library versions.
UPDATE END
I having an issue with the JQuery UI datepicker. The ...
I have the following jquery code to call a webmethod in an aspx page
$.ajax({
type: "POST",
url: "popup.aspx/GetJewellerAssets",
contentType: "application/json; charset=utf-8",
data: '{"jewellerId":' + filter + '}',
dataType: "js...
I really don't enjoy writing in every controller:
$this->load->view('templates/header');
$this->load->view('body');
$this->load->view('templates/footer');
Is it possible to do, that header and footer would be included...
I'm currently involved in developing a product (developed in C#) that'll be available for downloading and installing for free but in a very limited version. To get access to all the features the user has to pay a license fee and receive a key. That k...
Using the Datepicker the year drop down by default shows only 10 years. The user has to click the last year in order to get more years added.
How can we set the initial range to be 100 years so that the user will see a large list by default?
...
This Question is almost the same as the previously asked Get the IP Address of local computer-Question. However I need to find the IP address(es) of a Linux Machine.
So: How do I - programmatically in C++ - detect the IP addresses of the linux serve...
I noticed that Scala provide lazy vals. But I don't get what they do.
scala> val x = 15
x: Int = 15
scala> lazy val y = 13
y: Int = <lazy>
scala> x
res0: Int = 15
scala> y
res1: Int = 13
The REPL shows that y is a lazy val, bu...
I am performing some tests on a HSQLDB server with a table containing 500 000 entries. The table has no indices. There are 5000 distinct business keys. I need a list of them. Naturally I started with a DISTINCT query:
SELECT DISTINCT business_key FR...
While installing pip and python I have ran into a that says:
The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of ...
Let's assume there are two resources Binder and Doc with association relationship meaning that the Doc and Binder stand on their own. Doc might or might not belong to Binder and Binder might be empty.
If I want to design a REST API that allows a use...
So for the past hour I've been trying to figure out how to reset my 'root' password for MySQL as I cannot log into PHPMyAdmin. I've tried changing the password in the config.inc.php file and searching through other methods. I cannot find a successful...
I'm currently building a HTML5 web app/Phonegap native app and I can't seem to figure out how to save my canvas as an image with canvas.toDataURL(). Can somebody help me out?
Here's the code, what's wrong with it?
//My canvas was named "canvasSigna...
I have xml files that contain href file paths to images (e.g. "....\images\image.jpg"). The hrefs contain relative paths. Now, I need to extract the hrefs to the images and turn them into absolute paths in the file system.
I know about the GetFullPa...
I have the following table in MySQL version 5.5.24
DROP TABLE IF EXISTS `momento_distribution`;
CREATE TABLE IF NOT EXISTS `momento_distribution`
(
`momento_id` INT(11) NOT NULL,
`momento_idmember` INT(11) NOT NULL,
`created_...
I'm trying to find a way to split a String into an array of String(s), and I need to split it whenever a white spice is encountered, example
"hi i'm paul"
into"
"hi" "i'm" "paul"
How do you represent white spaces in split() method using ...
I have created my tables in my SQLiteOpenHelper onCreate() but receive
SQLiteException: no such table
or
SQLiteException: no such column
errors. Why?
NOTE:
(This is the amalgamated summary of tens of similar questions every week. Attem...
let's say I have a markup like this:
<div id="foo">
...
<span id="moo">
...
</span>
...
</div>
and I want to select #moo.
why $('#foo').find('span') works, but $('span', $('#foo')); doesn't ?...
I have created a script using argparse.
The script needs to take a configuration file name as an option, and user can specify whether they need to proceed totally the script or only simulate it.
The args to be passed: ./script -f config_file -s or ...
I need some help with this:
Example:
void method1{
MyObject obj1=new MyObject();
obj1.method1();
}
I want to mock obj1.method1() in my test but to be transparent so I don't want make and change of code.
Is there any way to do this in Mock...
Why would someone use WHERE 1=1 AND <conditions> in a SQL clause (Either SQL obtained through concatenated strings, either view definition)
I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird.
...
I am trying to install numpy on macOS X but after executing the command pip install numpy I am getting the error:
Environment error :[error 13]: permission denied : 'usr/local/bin/f2py
How do I fix it?...
Suddenly this keeps happening during a JUnit test. Everything was working, I wrote some new tests and this error occured. If I revert it, it won't go away. Why is that?
log4j:WARN No appenders could be found for logger (org.springframework.test.cont...
How can I set a background image for my main view controller in Xcode 6 using swift? I know that you can do this in the assistant editor as below:
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.yellowCol...
I have date and time in a string formatted like that one:
"2011-03-21 13:26" //year-month-day hour:minute
How can I parse it to System.DateTime?
I want to use functions like DateTime.Parse() or DateTime.ParseExact() if possible, to be able to spe...
I was looking for a way to run an external process from python script and print its stdout messages during the execution.
The code below works, but prints no stdout output during runtime. When it exits I am getting the following error:
sys.stdout...
I have a Facebook desktop application and am using the Graph API.
I am able to get the access token, but after that is done - I don't know how to get the user's ID.
My flow is like this:
I send the user to https://graph.facebook.com/oauth/author...
I had an interesting job interview experience a while back. The question started really easy:
Q1: We have a bag containing numbers 1, 2, 3, …, 100. Each number appears exactly once, so there are 100 numbers. Now one number is randomly picked out o...
I need to draw a horizontal line in a UIView. What is the easiest way to do it. For example, I want to draw a black horizontal line at y-coord=200.
I am NOT using Interface Builder. ...
I want to know how to omit NA values in a data frame, but only in some columns I am interested in.
For example,
DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA), z=c(NA, 33, 22))
but I only want to omit the data where y is NA, therefore the r...
I have an asp.net MVC 4 solution. When I try to open it using Visual studio 2012, I get following error:
Microsoft Visual Studio
Configuring Web https://localhost: for ASP.NET 4.5 failed. You must
manually configure this site for ASP.NET 4...
I am working in a database where I load data in a raw table by a data loader. But today the data loader got stuck for unknown reasons. Then I stopped the data loader from windows task manager. But then I again tried to load data in the raw table but ...
I have this error since a long time but can't figure it out :
Caught TypeError while rendering: coercing to Unicode: need string or buffer, NoneType found
It happens in admin when I try to add or modify on one of my models (display works fine)
Thi...
I have a unix timestamp, and I'm trying to convert it into a calendar date such as MM/DD/YYYY.
So far, I have this:
$(document).ready(function() {
var value = $("#unixtime").val(); //this retrieves the unix timestamp
var dateString = moment(val...
I have written a small program that interacts with a server on a specific port. The program works fine, but:
Once the program terminated unexpectedly, and ever since that socket connection is shown in CLOSE_WAIT state. If I try to run a program it h...
I set up and configured a multi-node Hadoop cluster using this tutorial.
When I type in the start-all.sh command, it shows all the processes initializing properly as follows:
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-ro...
As usual, I create an error-handler using On Error Goto statement, there I put a few lines of cleaning codes and display the error message, but now I don't want to lose the comfortableness of the default handler which also point me to the exact line ...
I'm trying to capture a div into an image using html2canvas
I have read some similar question here like
How to upload a screenshot using html2canvas?
create screenshot of web page using html2canvas (unable to initialize properly)
I have tried t...
I have the jre7 and jdk1.7.0 installed along with the Tomcat 7.0 but it shows this error. servlet.http is not the only one that "does not exist", there are also other (servlet.) components.
Can anybody help me with this?
UPDATE:
This error occurs w...
I am trying to follow this railscast tutorial for authlogic - and it points to the source here -
I have git installed - how do I replicate the source onto my localhost so that I can follow the tutorial like in the screencast?...
What are the main differences between Hibernate and Spring Data JPA? When should we not use Hibernate or Spring Data JPA? Also, when may Spring JDBC template perform better than Hibernate / Spring Data JPA?...