I just need to ask something as follow.
Suppose I am having a dictionary.
NSMutableDictionary *xyz=[[NSMutableDictionary alloc] init];
[xyz setValue:@"sagar" forKey:@"s"];
[xyz setValue:@"amit" forKey:@"a"];
[xyz setValue:@"nirav" forKey:@"n"];
[xyz...
What's the UNC path to a folder on my local computer, and how can I access it?
I have tried:
Security for the folder -- set to Everyone Full Control (for now!)
Sharing permissions -- set to Everyone Full Control (for now!)
I can see the folder in...
I have a spark streaming application which produces a dataset for every minute.
I need to save/overwrite the results of the processed data.
When I tried to overwrite the dataset org.apache.hadoop.mapred.FileAlreadyExistsException stops the execution...
It is wanted of me to implement the following function:
void calc ( double* a, double* b, int r, int c, double (*f) (double) )
Parameters a, r, c and f are input and b is output. “a” and “b” are 2d matrices ...
How is the conditional operator (? :) used in Ruby?
For example, is this correct?
<% question = question.size > 20 ? question.question.slice(0, 20)+"..." : question.question %>
...
I am working in progress bar concept in ASP.NET MVC 2. Here i have a DropDownList which has 10 values. i want to calculate the percentage for progress bar, e.g. 10 values from DropDownList and i am having a query which returns the value 2. so, out of...
When I specify an ancestor commit object in Git, I'm confused between HEAD^ and HEAD~.
Both have a "numbered" version like HEAD^3 and HEAD~2.
They seem very similar or the same to me, but are there any differences between the tilde and the caret?...
I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for shared_ptr (and working). Simply stating std, tr1 and <memory> is not helping ...
I am still quite new to Java programming and I am trying to update an existing value of an ArrayList by using this code:
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
list.add( "Zero" );
...
I opened a ssh tunnel as described in this post: Zend_Db: How to connect to a MySQL database over SSH tunnel?
But now I don't know what I actually did. Does this command affect anything on the server?
And how do I close this tunnel, because now I ca...
I'm trying to create a ZIP archive with a simple demo text file using a MemoryStream as follows:
using (var memoryStream = new MemoryStream())
using (var archive = new ZipArchive(memoryStream , ZipArchiveMode.Create))
{
var demoFile = archive.Cr...
I'm trying to write a code that lets me find the first few multiples of a number. This is one of my attempts:
def printMultiples(n, m):
for m in (n,m):
print(n, end = ' ')
I figured out that, by putting for m in (n, m):, it would run through t...
I see there are several ways we can start hadoop ecosystem,
start-all.sh & stop-all.sh
Which say it's deprecated use start-dfs.sh & start-yarn.sh.
start-dfs.sh, stop-dfs.sh and start-yarn.sh, stop-yarn.sh
hadoop-daemon.sh namenode/datanode...
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...
Example: If I have a document with 2 space indentation, and I want it to have 4 space indentation, how do I automatically convert it by using the Sublime Text editor?...
I just added a new drawable folder under res folder. In the drawable folder, i copied the ic_launcher.png file from drawable-hdpi folder.
I wanna change the standard ImageButton image through the new one when i press the button. I wrote some code, bu...
I've been running a project for some months now using the same TortoiseSVN repository without much hassle, until now.
I need to add another box to the project but it seems to be impossible for TSVN to connect to the repository. This is the stuff I'v...
I switched lecturers today and he stated using a weird code to me. (He said it's better to use .equals and when I asked why, he answered "because it is!")
So here's an example:
if (o1.equals(o2))
{
System.out.println("Both integer objects are the ...
I downloaded spyder using the
pip install spyder
in my windows 10 32-bit operating system, but i dont see any desktop icons or exe files to start running the IDE. I downloaded spyder 3, any my python is 3.6.
I even tried creating a shortcut of spy...
Currently I'm doing this:
foo.js
const FOO = 5;
module.exports = {
FOO: FOO
};
And using it in bar.js:
var foo = require('foo');
foo.FOO; // 5
Is there a better way to do this? It feels awkward to declare the constant in the exports objec...
I know people have asked similar questions, but I believe the causes of their problems to be different. I did a hard reset because I had messed up my code pretty bad
git reset --hard 41651df8fc9
I've made quite some changes, I've made some commi...
I have a SQLite database that I am trying to sort by Alphabetical order. The problem is, SQLite doesn't seem to consider A=a during sorting, thus I get results like this:
A
B
C
T
a
b
c
g
I want to get:
A
a
b
B
C
c
g
T
What special SQL thing need...
Integer i = ...
switch (i){
case null:
doSomething0();
break;
}
In the code above I cant use null in switch case statement. How can I do this differently?
I can't use default because then I want to do something else....
I want to click on one div and rotate another div then when the firsts div is clicked again the other div rotates back to its original position.
I can reference this library if required http://ricostacruz.com/jquery.transit....
What do the question mark (?) and colon (:) mean?
((OperationURL[1] == "GET") ? GetRequestSignature() : "")
It appears in the following statement:
string requestUri = _apiURL + "?e=" + OperationURL[0] + ((OperationURL[1...
I have read multiple posts regarding this error, but I still can't figure it out. When I try to loop through my function:
def fix_Plan(location):
letters_only = re.sub("[^a-zA-Z]", # Search for all non-letters
" ", ...
My Eclipse CDT keeps complaining "make: *** no rule to make target all" when I am trying to compile the piece of code below:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!!!" << endl; // prints Hel...
How do I achieve formatting of a text inside a TextBlock control in my WPF application?
e.g.: I would like to have certain words in bold, others in italic, and some in different colors, like this example:
The reason behind my question is this act...
There are two files called "a.txt" and "b.txt" both have a list of words. Now I want to check which words are extra in "a.txt" and are not in "b.txt".
I need a efficient algorithm as I need to compare two dictionaries....
I have a Python 2.7.11 installed on one of my LAB stations. I would like to upgrade Python to at least 3.5.
How should I do that ?
Should I prefer to completely uninstall 2.7.11 and than install the new one ?
Is there a way to update it ? Is an upda...
I am new to JavaScript and I'm getting an error as below.
Uncaught TypeError: time.indexOf is not a function
Gee, I really thought indexOf() really was a function. Here is a snippet of my code:
var timeofday = new Date().getHours() + (new...
Since Microsoft Web API isn't MVC, you cannot do something like this:
var a = Request.MapPath("~");
nor this
var b = Server.MapPath("~");
because these are under the System.Web namespace, not the System.Web.Http namespace.
So how do you figur...
I'm tring to diplay results in php from sql database
MySQL statement is correct and does what i want in phpMyAdmin but for some reason my code breaks in the webpage
here is the code
require_once('db.php');
$sql="SELECT * FROM modul1open WHERE...
I'm trying to find a way to use an Excel sheetname as a variable in a macro that I've written. Every month I deal with a workbook that is sent to me with 2 sheets. Part of the macro uses the 'Open File' interface to navigate to the folder and open th...
I would like to know how can I query an array of objects. For example I have an array object like CarList. So CarList[0] would return me the object Car. Car has properties Model and Make. Now, I want to use linq to query the array CarList to get the ...
My problem..
I have a number of images (inside hyperlinks), and I want each to darken on mouseover (i.e. apply a black mask with high opacity or something), and then go back to normal on mouseout . But I can't figure out the best way to do it.
I've...
Hello I'm creating API using REST and Laravel following this article.
Everything works well as expected.
Now, I want to map GET request to recognise variable using "?".
For example: domain/api/v1/todos?start=1&limit=2
Below is the content of ...
I am trying to set a Spring Boot applications context root programmatically. The reason for the context root is we want the app to be accessed from localhost:port/{app_name} and have all the controller paths append to it.
Here is the application co...
I want to change images every few seconds, this is my code:
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "ht...
I know that I can return the index of a particular character of a string with the indexof() function, but how can I return the character at a particular index?...
I just installed matplotlib in Ubuntu 9.10 using the synaptic package system.
However, when I try the following simple example
>>> from pylab import plot;
>>> plot([1,2,3],[1,2,3])
[<matplotlib.lines.Line2D object at 0x9aa78ec&...
Ok so this is probably a trivial question but I'm having trouble visualizing and understanding the differences and when to use each. I'm also a little unclear as to how concepts like uni-directional and bi-directional mappings affect the one-to-many/...
I have a regular C# code. I have no exceptions. I want to programmatically log the current stack trace for debugging purpose. Example:
public void executeMethod()
{
logStackTrace();
method();
}
...
I was trying to go to another page using button, but it always fail.
Here is my First Class with its XML:
public class FindPeopleFragment extends Fragment {
public FindPeopleFragment(){}
@Override
public View onCreateView(LayoutInflat...
I have some issues with Vagrant shared folders, my base system is Ubuntu 13.10 desktop.
I do not understand why I have this error is something that is not right configured ? Is a NFS issue or Virtualbox Guest Additions ? I have tried with different ...
I am hoping you can help with this question. I am using Oracle SQL (SQL Developer for this view)...
If I have a table with the following columns:
ColumnA (Number)
ColumnB (Number)
ColumnC (Number)
In my view I have
Select
ColumnA,
ColumnB...
This is my test ajax in laravel 5 (refer below)
$("#try").click(function(){
var url = $(this).attr("data-link");
$.ajax({
url: "test",
type:"POST",
data: { testdata : 'testdataco...
I am using Log4J in my application for logging. Previously I was using debug call like:
Option 1:
logger.debug("some debug text");
but some links suggest that it is better to check isDebugEnabled() first, like:
Option 2:
boolean debugEnabled =...
In MySQL, can I select columns only where something exists?
For example, I have the following query:
select phone, phone2
from jewishyellow.users
where phone like '813%'
and phone2
I'm trying to select only the rows where phone starts with 813 a...
I am trying hard to compare two floating point numbers within a bash script. I have to variables, e.g.
let num1=3.17648e-22
let num2=1.5
Now, I just want do a simple comparison of these two numbers:
st=`echo "$num1 < $num2" | bc`
if [ $...
I have an app which is signed and several keystore files. I'd like to update the app, so I need to find out which one of keys was used.
How can I match which keystore was used to originally sign my app against various keystores I have on my machine?...
Let's say I have a class that has a member called data which is a list.
I want to be able to initialize the class with, for example, a filename (which contains data to initialize the list) or with an actual list.
What's your technique for doing t...
There are Implicit and Explicit wait in Selenium WebDriver. What's the difference between them?
Kindly share the knowledge about Selenium WebDriver. Please show the real time example with Implicit & Explicit wait....
I am having issue with importing Observable.of function in my project. My Intellij sees everything. In my code I have:
import {Observable} from 'rxjs/Observable';
and in my code I use it like that:
return Observable.of(res);
Any ideas?...
I'm just wondering how I could remove everything after a certain substring in PHP
ex:
Posted On April 6th By Some Dude
I'd like to have it so that it removes all the text including, and after, the sub string "By"
Thanks...
I have a service running, and would like to send a notification. Too bad, the notification object requires a Context, like an Activity, and not a Service.
Do you know any way to by pass that ? I tried to create an Activity for each notification but ...
I wrote a Python script that does some task to generate, and then keep changing some text stored as a string variable. This works, and I can print the string each time it gets changed.
I can get the Label to display the string for the first time, bu...
How can I close a browser window without receiving the Do you want to close this window prompt?
The prompt occurs when I use the window.close(); function....
I would like to get the query execution time in Oracle. I don't want the time Oracle needs to print the results - just the execution time.
In MySQL it is easy to get the execution time from the shell.
How can I do this in SQL*Plus?...
I am starting to configure my development environment and I am using Spring Tool Suite 2.8.1 along with m2E 1.01.
As far as I can tell, since this is a Maven Project (my first), my Maven POM is dictating (along with m2E smarts) my project build conf...
I am a beginner to python and am at the moment having trouble using the command line. I have a script test.py (which only contains print("Hello.")), and it is located in the map C:\Python27. In my system variables, I have specified python to be C:\Py...
I need to position a button to the bottom of the screen. I need to use relative size and not absolute sizes, so it fits any screen size.
my CSS code:
position:relative;
left:20%;
right:20%;
bottom:5%;
top:60%;
...
In the Oracle PL/SQL, how to escape single quote in a string ? I tried this way, it doesn't work.
declare
stmt varchar2(2000);
begin
for i in 1021 .. 6020
loop
stmt := 'insert into MY_TBL (Col) values(\'ER0002\')';
dbms_output.put_li...
How can I upload files to server using JSP/Servlet? I tried this:
<form action="upload" method="post">
<input type="text" name="description" />
<input type="file" name="file" />
<input type="submit" />
</form&g...
I realize that temporary tables are session/connection bound and not visible or accessible out of the session/connection.
I have a long running stored procedure that creates temporary tables at various stages.
Is there a way I can see the list of c...
I'm trying to create two buttons on a page. Each one I would like to carry out a different Python script on the server. So far I have only managed to get/collect one button using.
def contact():
form = ContactForm()
if request.method == 'POST':
...
I want to be able to detect when the mouse leaves the window so I can stop events from firing while the user's mouse is elsewhere.
Any ideas of how to do this?...
So if I have two sets:
Set<Integer> test1 = new HashSet<Integer>();
test1.add(1);
test1.add(2);
test1.add(3);
Set<Integer> test2 = new HashSet<Integer>();
test2.add(1);
test2.add(2);
test2.add(3);
test2.add(4);
test2.add(5);...
I wish to get the file extension of an image I am uploading, but I just get an array back.
$userfile_name = $_FILES['image']['name'];
$userfile_extn = explode(".", strtolower($_FILES['image']['name']));
Is there a way to just get the extension it...
I'm not referring to textInput, either. I mean that once you have static text in a TextView (populated from a Database call to user inputted data (that may not be Capitalized)), how can I make sure they are capitalized?
Thanks!...
Using jQuery I am trying to access div id="element".
<body>
<iframe id="uploads">
<iframe>
<div id="element">...</div>
</iframe>
</iframe>
</body>
All iframes are ...
Possible Duplicate:
How to measure time in milliseconds using ANSI C?
How can I get the Windows system time with millisecond resolution?
We want to calculate the time which a player have taken to finish the game.
But with time.h we could...
After git init, I added and committed a few files, made some changes, added and committed. Set up the git daemon (running under Cygwin on WinXP) and cloned the repository once.
Now, I get this error with the cloned repository:
$ git status
error: b...
I have created a URL preview box for the entered URL.
Preview is shown in the div box. I want to add a close option on the right top.
How could be done so that when users click on its box should be disabled?
Here is my fiddle.
<a class="fragm...
Maybe a fool question, I installed jenkins on windows by default, have set no user/password, it worked at first, no need to login. But when launch the 8080 webpage now, it hangs the login page, I've tried some normal user/password combinations, none ...
I have a filename (C:\folder\foo.txt) and I need to retrieve the folder name (C:\folder) in unmanaged C++. In C# I would do something like this:
string folder = new FileInfo("C:\folder\foo.txt").DirectoryName;
Is there a function that can be used ...
I need to declare 12 decimal variables, corresponding to each month's year, with a cursor I sum values to this variables, then later I Update some sales information.
I don't know if sql server has this syntax
Declare MonthsSale(1 to 12) as decimal...
I need to modify a static text (few words) in 3 rpt files. But I dont have Crystal Reports. How can I do it?
Is there a free editor or software to be able to modify a simple text of the report?...
After reading some material on this subject I'm still not sure what the difference between a compiled language and an interpreted language is. I was told this is one of the differences between Java and JavaScript. Would someone please help me in unde...
I try to read the file into pandas.
The file has values separated by space, but with different number of spaces
I tried:
pd.read_csv('file.csv', delimiter=' ')
but it doesn't work...
I need to receive an HTTP Post Multipart which contains only 2 parameters:
A JSON string
A binary file
Which is the correct way to set the body?
I'm going to test the HTTP call using Chrome REST console, so I'm wondering if the correct solution ...
What's the simplest way to do a find and replace for a given input string, say abc, and replace with another string, say XYZ in file /tmp/file.txt?
I am writting an app and using IronPython to execute commands through SSH — but I don't know Un...
I have a number of tables with values I need to sum up. They are not linked either, but the order is the same across all the tables.
Basically, I would like to take this two tables:
CASH TABLE
London 540
France 240
Belgium 340
CHEQUE TABLE
Lon...
I generated a bubble chat thingy from http://www.ilikepixels.co.uk/drop/bubbler/
In my page I put a number inside of it
.bubble {
position: relative;
width: 20px;
height: 15px;
padding: 0;
background: #FFF;
border: 1px solid #000;
bor...
How do I go to the next iteration of a JavaScript Array.forEach() loop?
For example:
var myArr = [1, 2, 3, 4];
myArr.forEach(function(elem){
if (elem === 3) {
// Go to "next" iteration. Or "continue" to next iteration...
}
console.log(e...
Is there any way to compare two vectors?
if (vector1 == vector2)
DoSomething();
Note: Currently, these vectors are not sorted and contain integer values....
For a code like this:
class foo {
protected:
int a;
public:
class bar {
public:
int getA() {return a;} // ERROR
};
foo()
: a (p->param)
};
I get this error:
invalid use of non-static data member 'foo:...
I'm struggling to deal with my plot margins in matplotlib. I've used the code below to produce my chart:
plt.imshow(g)
c = plt.colorbar()
c.set_label("Number of Slabs")
plt.savefig("OutputToUse.png")
However, I get an output figure with lots of wh...
I want to run some c++ code on Linux and Windows. There are some pieces of code that I want to include only for one operating system and not the other. Is there a standard #ifdef that once can use?
Something like:
#ifdef LINUX_KEY_WORD
... ...
I'm using this code to reset the identity on a table:
DBCC CHECKIDENT('TableName', RESEED, 0)
This works fine most of the time, with the first insert I do inserting 1 into the Id column. However, if I drop the DB and recreate it (using scripts I've ...
I'd like to write a shell script which checks if a certain file, archived_sensor_data.json, exists, and if so, deletes it. Following http://www.cyberciti.biz/tips/find-out-if-file-exists-with-conditional-expressions.html, I've tried the following:
[...
I'm trying to display the list I made in my view but keep getting : "The model item passed into the dictionary is of type 'System.Collections.Generic.List1[System.String]', but this dictionary requires a model item of type 'System.Collections.Generic...
How do I get the "x" to be vertically-aligned in the middle of the span?
.foo {
height: 50px;
border: solid black 1px;
display: inline-block;
vertical-align: middle;
}
<span class="foo">
x
</span>
...
How can I set the dark holo theme in my app?
At this time I got this:
<style name="AppTheme" parent="android:Theme.Holo.Light" />
But when I change it to:
<style name="AppTheme" parent="android:Theme.Holo.Dark" />
I get an error err...
I want to know which account running my Web Service/Application so that I can assign the read/write access to that account. I have researched and see most of the sources mentions about ASPNET account, but on my 2008 server, there is not any acount na...
Is there any way to make a synchronous call with AngularJS?
The AngularJS documentation is not very explicit or extensive for figuring out some basic stuff.
ON A SERVICE:
myService.getByID = function (id) {
var retval = null;
$http({
...
How does one go about sorting a vector containing custom (i.e. user defined) objects.
Probably, standard STL algorithm sort along with a predicate (a function or a function object) which would operate on one of the fields (as a key for sorting) in th...
Ok, I've searched all over and have spent quite a bit of my time installing, uninstalling, trying various option but without success.
I'm on Mac OS X Lion (10.7.3) and am trying to setup a Python, MySQL.
I successfully installed Python and MySQL vi...
How do I make a Bootstrap input field be exactly 100% as wide as its parent?
As steve-obrien wrote in Bootstrap Issue #1058:
Setting to 100% does not work when applied directly to an input field as it does not take in to account the padding. So ...
How can I get a PL/SQL block to output the results of a SELECT statement the same way as if I had done a plain SELECT?
For example how to do a SELECT like:
SELECT foo, bar FROM foobar;
Hint :
BEGIN
SELECT foo, bar FROM foobar;
END;
doesn't wor...
I am looking to implement a sort feature for my address book application.
I want to sort an ArrayList<Contact> contactArray. Contact is a class which contains four fields: name, home number, mobile number and address. I want to sort on name.
...
I am trying to make a json call using C#. I made a stab at creating a call, but it did not work:
public bool SendAnSMSMessage(string message)
{
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://api...
Without getting into a religious argument about why one is better than the other, what are the practical differences between Emacs and Vim? I'm looking to learn one or the other, but I realize the learning curve for each is high and I can't decide. I...
Using instance methods as callbacks for event handlers changes the scope of this from "My instance" to "Whatever just called the callback". So my code looks like this
function MyObject() {
this.doSomething = function() {
...
}
var self = ...
Possible Duplicate:
How to format a JSON date?
I have the following result from a $getJSON call from JavaScript. How do I convert the start property to a proper date in JavaScript?
[
{"id":1,"start":"/Date(1238540400000)/"},
{"id"...
I have a long running python script that I want to do someting at 01:00 every morning.
I have been looking at the sched module and at the Timer object but I can't see how to use these to achieve this....
So Im learning to develop in Rails, and have discovered the power of zsh. However, for some of my other tasks, I wish to use normal Bash. Although they are the same, I just feel comfortable with the lay out of bash in some situations. How do I switch...
Is there a CSS/JavaScript technique to display a long HTML table such that the column headers stay fixed on-screen and the first coloumn stay fixed and scroll with the data.
I want to be able to scroll through the contents of the table, but to alway...
When do you use which in general? Examples are highly encouraged!
I am referring so MySql, but can't imagine the concept being different on another DBMS...
Does anyone know where I can find a quick reference for all commands in gitbash for windows? The help command covers the most important, but I can't find info on basic navigation such as getting the current directory, changing directory etc....
Currently, Twitter Bootstrap 3 have the following responsive breakpoints: 768px, 992px and 1200px, representing small, medium and large devices respectively.
How can I detect these breakpoints using JavaScript?
I would like to listen with JavaScrip...
I'm sure this question has been asked before but I can't quite find the answer I'm looking for, so here goes:
I have two objects, as follows:
const response = {
lat: -51.3303,
lng: 0.39440
}
let item = {
id: 'qwenhee-9763ae-lenfya',
addres...
How do I grant a user DBA rights in Oracle? I guess something like:
CREATE USER NewDBA
IDENTIFIED BY passwd;
GRANT DBA TO NewDBA WITH ADMIN OPTION;
Is it the right way, or......
Visual Studio Code was recently released and I liked the look of it and the features it offered, so I figured I would give it a go.
I downloaded the application from the downloads page, fired it up, messed around a bit with some of the features ... a...
a<- c(2,2)
b<- c(3,4)
plot(a,b) # It works perfectly here
Then I tried:
t<-xy.coords(a,b)
plot(t) # It also works well here
Finally, I tried:
plot(t,1)
Now it shows me:
Error in xy.coords(x, y, xlabel, ylabel, log) :
...
I am trying to write a windows client application that calls a web site for data. To keep the install to a minimum I am trying only use dlls in the .NET Framework Client Profile. Trouble is that I need to UrlEncode some parameters, is there an easy w...
I have very limited knowledge in AD and LDAP queries so I have a simple question on how to use wildcards.
Supposed there is object with a displayName of "ITSM - Problem Management"
My current implementation of the filter with a wildcard is as such:...
I have a page with a row of about 10 imgs. For readability of the HTML, I want to put a linebreak in between each img tag, but doing so renders whitespace between the images, which I do not want. Is there anything I can do other than break in the mid...
I am doing the angular2 tutorial at this address: https://angular.io/docs/ts/latest/tutorial/toh-pt3.html I have put the hero interface in a single file under the app folder, in the console I have this error:
app/app.component.ts(2,20): error TS2306...
I am getting the error
Critical Error: Object doesn't support this property or method addeventlistener
while accessing the InfoPath form page (using InfoPath enabled list form e.g. displayifs.aspx) in IE 11 browser.
This error is specific to ...
Actually I was trying to extract code of a .apk file called cloudfilz.apk and wanted to manipulate in its source code so I followed the steps given below:-
make a new folder and put .apk file (which you want to decode) now rename this .apk file with ...
I recently started working with Python and I am trying to concatenate one of my JSON String with existing JSON String. I am also working with Zookeeper so I get the existing json string from zookeeper node as I am using Python kazoo library.
# gets ...
I'm trying to access a dict_key's element by its index:
test = {'foo': 'bar', 'hello': 'world'}
keys = test.keys() # dict_keys object
keys.index(0)
AttributeError: 'dict_keys' object has no attribute 'index'
I want to get foo.
same with:
keys[...
I'm trying to use ES6 arrow function with .filter to return adults (Jack & Jill). It appears I cannot use an if statement.
What do I need to know in order to do this in ES6?
var family = [{"name":"Jack", "age": 26},
{"name":"Jil...
What's the difference between a REST system and a system that is RESTful?
From a few things I've read most so called REST services are actually RESTful services. So what is the difference between the two. ...
I have an Excel spreadsheet with three sheets. One of the sheets contains formulas for one of the other sheets.
Is there a programmatic way to hide the sheet which contains these formulas?...
The line-height property usually takes care of vertical alignment, but not with inputs. Is there a way to automatically center text without playing around with padding?...
I'm trying to view the files and folders at root level on an android device using USB Debugging mode and windows. Is this possible? Phone is rooted.
I've downloaded a file explorer app which allows me to view it on the phone itself.
My main goal is...
I just recently downloaded WAMP Server to view and edit php webpages but now I would also like other people in my network (connected to the same wifi) to be able to access localhost and all the files that I have saved. I have already tried to access ...
I have a database table with 3 columns firstname, Lastname and age. In my C# Windows application I have 3 textboxes called textbox1... I made my connectivity to my SQL Server using this code:
SqlConnection con = new SqlConnection("Data Source = .;
...
Console.log and debug not printing, only return undefined. Why it can be?
I've tried to re-install chrome, but it doesn't help.
Here is screenshot from chrome's main page, so functions are not redefined in some code
...
I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it.
However, every time I try to run an MVC app, I get the following error:
H...
suppose I've a 3 options in a drop down box say red , blue, others.
If a user select option as an others then below a text box should be visible to wrtie his own favourite color.
I can populate the drop down box with colors but do not know ho...
i'm using android studio 2.1.1 in ubuntu 14.04.Now my question is,i want to run the program through my phone without emulator. so i chose the target as usb device but whenever i run this,below mentioned error is rasing.
Error running app : No target...
Can you help me on putting labels on the following graph?
The code i use is:
valbanks<-scan("banks.txt", what=list(0,0,""), sep="", skip=1, comment.char="#")
valbanks
valj2007<-valbanks[[1]]
valj2009<-valbanks[[2]]
namebank<-valban...
Let's say I have an application that utilizes the Executor framework as such
Executors.newSingleThreadExecutor().submit(new Runnable(){
@Override
public void run(){
// do stuff
}
}
When I run this application in the debugger, a...
I was asked to build a site , and one of the co-developer told me That I would need to include the keep-alive header.
Well I read alot about it and still I have questions.
msdn ->
The open connection improves performance when a client makes mult...
I need to perform a null or empty check on a collection; I think that !members?.empty is incorrect. Is there a groovier way to write the following?
if (members && !members.empty) {
// Some Work
}
...
I see something strange like:
http://github.com/zoul/Finch.git
Now I'm not that CVS, SVN, etc. dude. When I open that in the browser it tells me that I did something wrong. So I bet I need some hacker-style tool? Some client?
(I mean... why not j...
I just installed Java EE plugin in plain eclipse and I am trying to add tomcat server. I opened add new server which showing "Choose the type of server to create" but there is no server list. How can I add tomcat server?
Eclipse: Indigo....
I am trying to change the background color of one list item while there is another background color for other list items.
This is what I have:
_x000D_
_x000D_
<style type="text/css">_x000D_
_x000D_
ul.nav li_x000D_
{_x000D_
display:inli...
When I tried to submit an App to Itunes Connect I got the following error.
iTunes Store Operation Failed
Error ITMS-90717: "Invalid App Store Icon. The App Store Icon in the asset catalog in 'YourApp.app' can't be transparent nor contain an alpha c...
I am developing an Android app. I need to know how we can have a EditText with border. In Lolipop they have completely changed the EditText style. Can we do it without using drawables?...
I have a bad experience while installing laravel. However, I was able to do so and move to the next level. I used generators and created my migrations.
But when I type the last command
php artisan migrate
It's throwing a PDOException - could not...
I have a string that is up to 3 characters long when it's first created in SQL Server 2008 R2.
I would like to pad it with leading zeros, so if its original value was '1' then the new value would be '001'. Or if its original value was '23' the new v...
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 ...
I am trying to post multiple parameters on a WebAPI controller. One param is from the URL, and the other from the body. Here is the url:
/offers/40D5E19D-0CD5-4FBD-92F8-43FDBB475333/prices/
Here is my controller code:
public HttpResponseMessage Pu...
I have 2 pages: xyz.com/a and xyz.com/b. I can only access xyz.com/b if and only if I login to xyz.com/a first. If accessing xyz.com/b without going through the other, I simply get access denied (no redirect to login) via the browser. Once I login at...
Any ideas how to fix this?
UserService.UserServiceClient userServiceClient = new UserServiceClient();
userServiceClient.GetUsersCompleted += new EventHandler<GetUsersCompletedEventArgs>(userServiceClient_GetUsersCompleted);
...
I'm having trouble getting my browser to display the css for the app I am creating. I have looked at the same question asked by other users but have not found any of the answers to help in my situation. When I goto the page, all that is displayed is ...
I am trying to replicate what you can see here in this image.
I want to be able to either type in the text field above the box or just click on the option directly.
What would be the best way to go about that? Is there anything bootstrap related ...
The line of code DateTime d = DateTime.Today; results in 10/12/2011 12:00:00 AM. How can I get only the date part.I need to ignore the time part when I compare two dates. ...
Objective:
The intent of this query is to select all of the distinct values in one column that don't exist in a similar column in a different table.
Current Query:
SELECT DISTINCT Table1.Column1
FROM Table2, Table1
WHERE Table1.Column1 <> Ta...
How do I properly display the date and time in AngularJS?
The output below shows both the input and the output, with and without the AngularJS date filter:
In: {{v.Dt}}
AngularJS: {{v.Dt | date:'yyyy-MM-dd HH:mm:ss Z'}}
This prints:
In: 2012-1...
Working with xenserver, and I want to perform a command on each file that is in a directory, grepping some stuff out of the output of the command and appending it in a file.
I'm clear on the command I want to use and how to grep out string(s) as nee...
The Microsoft .NET Framework 4.0 full installer (32- and 64-bit) is 48.1 MB and the Client Profile installer is 41.0 MB. The extracted installation files are 237 MB and 194 MB respectively, and once installed, they are 537 MB...
How do I set the index of a dropdown in jQuery if the way I'm finding the control is as follows:
$("*[id$='" + originalId + "']")
I do it this way because I'm creating controls dynamically and since the ids are changed when using Web Forms, I fou...
I have got a user in my database that hasn't got an associated login. It seems to have been created without login.
Whenever I attempt to connect to the database with this user I get the following error:
Msg 916, Level 14, State 1, Line 1
The serve...
The title of this question kind of explains my question. How do I redirect the PHP page visitor back to their previous page with the header( "Location: URL of previous page" );...
When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site.
What is the difference between ASP.NET Web Application and ASP.NET Web Site? Why would I choose one over other?
Is the...
The Binary Tree here is may not necessarily be a Binary Search Tree.
The structure could be taken as -
struct node {
int data;
struct node *left;
struct node *right;
};
The maximum solution I could work out with a friend was something ...
I need to check if a value is an integer. I found this: How to check whether input value is integer or float?, but if I'm not mistaken, the variable there is still of type double even though the value itself is indeed an integer....
In numpy, I have two "arrays", X is (m,n) and y is a vector (n,1)
using
X*y
I am getting the error
ValueError: operands could not be broadcast together with shapes (97,2) (2,1)
When (97,2)x(2,1) is clearly a legal matrix operation and shoul...
Does C# have extension properties?
For example, can I add an extension property to DateTimeFormatInfo called ShortDateLongTimeFormat which would return ShortDatePattern + " " + LongTimePattern?...
I am new to TensorFlow and machine learning. I am trying to classify two objects a cup and a pendrive (jpeg images). I have trained and exported a model.ckpt successfully. Now I am trying to restore the saved model.ckpt for prediction. Here is the sc...
When using LINQ to get data from a list I encounter this error. How can this be fixed?
Value cannot be null. Parameter name: source
var nCounts = from sale in sal
select new
{
SaleID = sale.OrderID,...
I want to create a set of random numbers without duplicates in Java.
For example I have an array to store 10,000 random integers from 0 to 9999.
Here is what I have so far:
import java.util.Random;
public class Sort{
public static void main(S...
I have two SQL Servers (both 2005 version).
I want to migrate several tables from one to another.
I have tried:
On source server I have right clicked on the database, selected Tasks/Generate scripts.
The problem is that under Table/View options t...
I'm trying to use CSS3 media queries to make a class that only appears when the width is greater than 400px and less than 900px. I know this is probably extremely simple and I am missing something obvious, but I can't figure it out. What I have com...
Using pip3 to install a package in a virtualenv causes the package to be installed in the global site-packages folder instead of the one in the virtualenv folder. Here's how I set up Python3 and virtualenv on OS X Mavericks (10.9.1):
I installed Pyt...
How would I add the backgroung image to my JPanel without creating a new class or method, but simply by inserting it along with the rest of the JPanel's attributes?
I am trying to set a JPanel's background using an image, however, every example I f...
I am using Oracle 10.2.
I am working in some scripts to move some ORACLE Objects from one SCHEMA (S1) to another (S2).
I am creating the functions with DBA role.
When moved, one of my functions becomes invalid, but I don't understand why.
Its code ...
Gradle is a bit confusing to me, and also for any new Android developer. Can anyone explain what Gradle in Android Studio is and what its purpose is? Why is it included in Android Studio?...
Why doesn't the following work?
SELECT name FROM (SELECT name FROM agentinformation)
I guess my understanding of SQL is wrong, because I would have thought this would return the same thing as
SELECT name FROM agentinformation
Doesn't the inne...
I am a beginner with Python. Before I start, here's my Python folder structure
-project
----src
------model
--------order.py
------hello-world.py
Under src I have a folder named model which has a Python file called order.py which contents follow:
...
I have stored values in my database that look like 5XXXXXX, where X can be any digit. In other words, I need to match incoming SQL query strings like 5349878.
Does anyone have an idea how to do it?
I have different cases like XXXX7XX for example, ...
I would like to use regex to match a string of exactly 2 characters, and both of those characters have to be between 0 and 9. The string to match against would be coming from a single-line text input field when an ASP.NET MVC view is rendered
So far...
Maybe this is a stupid question but it's bugging me.
I have a bi-directional one to many relationship of Employee to Vehicles. When I persist an Employee in the database for the first time (i.e. it has no assigned ID) I also want its associated Vehi...
I have a slideshow div, and I have a datepicker field above that div.
When I click in the datepicker field, the datepicker panel show behind slideshow div.
And I have put the script as:
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery...
How do I remove leading or trailing spaces of all cells in an entire column?
The worksheet's conventional Find and Replace (aka Ctrl+H) dialog is not solving the problem....
What is this error ? How can I fix this? My app is running but can't load data. And this is my Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
This is my fragment :
public class news extends Fragment {
priv...
I have a List of Objects like List<Object> p.I want to sort this list alphabetically using Object name field. Object contains 10 field and name field is one of them.
if (list.size() > 0) {
Collections.sort(list, new Comparator<Campai...
I have the key of a python dictionary and I want to get the corresponding index in the dictionary. Suppose I have the following dictionary,
d = { 'a': 10, 'b': 20, 'c': 30}
Is there a combination of python functions so that I can get the index val...
I got a list, programmed like this: public class MyList<T>. Is there any way to use the T variable to get the name of class (so I can, from within MyList, know if T is String, Socket, etc.)?
EDIT: Nevermind, found the answer here....
What's the easiest and/or shortest way possible to get the names of enum elements as an array of Strings?
What I mean by this is that if, for example, I had the following enum:
public enum State {
NEW,
RUNNABLE,
BLOCKED,
WAITING,
...
From inside a batch file, I would like to test whether I'm running with Administrator/elevated privileges.
The username doesn't change when "Run as Administrator" is selected, so that doesn't work.
If there were a universally available command, whi...
This has been asked on this site before but I couldn't find a sufficient answer. If I'm doing a query like:
Select Seller from Table where Location = 'San Jose'
How can I make it return only Sellers with Location 'San Jose' instead of 'san jose' o...
How do I get this directory out of conflict? I don't care if it's resolved using "theirs" or "mine" or whatever...
PS C:\Users\Mark\Desktop\myproject> svn ci -m "gr"
svn: Commit failed (details follow):
svn: Aborting commit: 'C:\Users\Mark\Deskt...
I'm getting the error ...
Command failed due to signal: Segmentation fault: 11
... when trying to compile my Swift app. I'm using Xcode 6.1, trying to build for an iPhone 5 on iOS 8.1.
My Code
import UIKit
class ViewController: UIViewControl...
How to select row number in postgres.
I tried this:
select
row_number() over (ORDER BY cgcode_odc_mapping_id)as rownum,
cgcode_odc_mapping_id
from access_odc.access_odc_mapping_tb
order by cgcode_odc_mapping_id
and got this error:
ERROR...
How do I get the key value in a JSON object and the length of the object using JavaScript?
For example:
[
{
"amount": " 12185",
"job": "GAPA",
"month": "JANUARY",
"yea...
How do I select data between a date range in MySQL. My datetime column is in 24-hour zulu time format.
select * from hockey_stats
where game_date between '11/3/2012 00:00:00' and '11/5/2012 23:59:00'
order by game_date desc;
Returns nothing des...
Ok, so I have the following query:
SELECT MIN(`date`), `player_name`
FROM `player_playtime`
GROUP BY `player_name`
I then need to use this result inside the following query:
SELECT DATE(`date`) , COUNT(DISTINCT `player_name`)
FROM `player_playt...
I have a large image and I want to make certain sections of the image clickable. I also want to specify the shape of the clickable area (square, circle, custom). Without relying on Javascript, how can I use CSS and HTML to create an interactive ima...
This is the code I am currently using to extract a zip file that lives in the same current working directory as the script. How can I specify a different directory to extract to?
The code I tried is not extracting it where I want.
import zipfile
f...
I constructed a pandas dataframe of results. This data frame acts as a table. There are MultiIndexed columns and each row represents a name, ie index=['name1','name2',...] when creating the DataFrame. I would like to display this table and save it as...
I am looking for the clean, elegant and smart solution to remove namespacees from all XML elements? How would function to do that look like?
Defined interface:
public interface IXMLUtils
{
string RemoveAllNamespaces(string xmlDocument);
}
...
I'm working on a little personal todo list app and so far everything has been working quite well. There is one little quirk I'd like to figure out. Whenever I go to add a new item, I have a Dialog with an EditText view showing inside. When I select t...
We are using a git repository to store our project. We have our branches departing from the original branch. But now we want to create a small new project to track some documentation. For that we would want to create a new empty branch to start stori...
Possible Duplicate:
What does BigInteger having no limit mean?
The Javadoc for BigInteger does not define any maximum or minimum. However, it does say:
(emphasis added)
Immutable arbitrary-precision integers
Is there such a maximum...
I want to verify if a table exists in a database, and if it doesn't exist, to create it.
How can I get a list of all the tables in the current database?
I could get the database list with a SELECT like this:
SELECT * FROM sys.databases
What's lef...
In a test at university there was a question; is it possible to use an aggregate function in the SQL WHERE clause.
I always thought this isn't possible and I also can't find any example how it would be possible. But my answer was marked false and n...
Well, my question is I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable is a given as 'undefined'".
//app.js
..
app.get('/someurl/', middleware1, middleware2)
...
...
I am trying to show some details of a receive in a table.
I want that table to have a min height to show the products. So if there is only one product, the table would have at least some white space at the end. In the other hand if there are 5 or mo...
I'm trying to create the icon for my iPhone app, but don't know how to get the exact radius that the iPhone's icons use. I've searched and searched for a tutorial or a template but can't find one.
I'm sure that I'm just a moron, but how do you get t...
HTML:
<a href="mysite.com/uploads/asd4a4d5a.pdf" download="foo.pdf">
Uploads get a unique file name while there real name is kept in database. I want to realize a simple file download. But the code above redirects to / because of:
$routePro...
On Snow Leopard, starting MySQL gives the following error:
The server quit without updating PID file
my.cnf
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
pid-file=/var/run/mys...
I looked around for the code to get the current path in a Twig template (and not the full URL), i.e.
I don't want http://www.sitename.com/page, I only need /page....
I have a script where I want to disconnect from the mapped drives before I create a new PSDrive.
Otherwise I get this error:
New-PSDrive : Multiple connections to a server or shared resource by the same user
, using more than one user name, a...
In a test spec, I need to click a button on a web page, and wait for the new page completely loaded.
emailEl.sendKeys('jack');
passwordEl.sendKeys('123pwd');
btnLoginEl.click();
// ...Here need to wait for page complete... How?
ptor.waitForAngula...
I have 2 nested div's that should be 100% wide. Unfortunately the inner div with the Textbox overflows and is actually larger than the outer div. It has a left margin and overflows by about the size of the margin.
How can I fix that?
<div style...
I am extremely new at writing in VB.NET, and I did not even realise that there was a significant difference between VB.NET and VBA. I have been writing my application in Visual Studio, but I realised that I will need to port it over to VBA in Outlook...
We get sometimes the following error from our partner's database:
<i>ORA-01438: value larger than specified precision allows for this column</i>
The full response looks like the following:
<?xml version="1.0" encoding="windows-1251...
I have a homework assignment and I was wondering if anyone could help me as I am new to Java and programming and am stuck on a question. The question is:
The first method finds the average of the elements of an integer array:
public double average...
I tend to use CGFloat all over the place, but I wonder if I get a senseless "performance hit" with this. CGFloat seems to be something "heavier" than float, right? At which points should I use CGFloat, and what makes really the difference?...
I am new to the OpenFileDialog function, but have the basics figured out. What I need to do is open a text file, read the data from the file (text only) and correctly place the data into separate text boxes in my application. Here's what I have in my...
How can I include one java file into another java file?
For example:
If I have 2 java file one is called Person.java and one is called Student.java. How can I include Person.java into Student.java so that I can extend the class from Person.java in ...
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...
In SQL Server we can use this:
DECLARE @variable INT;
SELECT @variable= mycolumn from myTable;
How can I do the same in Oracle? I'm currently attempting the following:
DECLARE COMPID VARCHAR2(20);
SELECT companyid INTO COMPID from app where appid...
I can't figure out how to set default property values for my components using Typescript.
This is the source code:
class PageState
{
}
export class PageProps
{
foo: string = "bar";
}
export class PageComponent extends React.Component<PageP...
I have a dynamic HTML5 document that does not contain any external resources (no images, css and scripts are coded inside of document). This HTML5 application is working fine with internet browser. I was wondering, if it would be possible to convert ...
I am redirecting from a controller to another controller. But I also need to pass model attributes to the second controller.
I don't want to put the model in session.
Please help....
Related to this question here. Can I check if an element in the DOM has a value or not? I'm trying to put it into an 'if' statement and not sure if my approach is correct. Here goes:
if (document.getElementById('customx')){
//do something
}
Or...
I have a menu which is a <ul>. Each menu item is a <li> and currently clickable.
Based on some conditions, I want to disable (make it not clickable) a particular <li> element.
How can I achieve this? I tried using the disabled attri...
When a function takes a shared_ptr (from boost or C++11 STL), are you passing it:
by const reference: void foo(const shared_ptr<T>& p)
or by value: void foo(shared_ptr<T> p) ?
I would prefer the first method because I suspect it w...
I have a number of elements that I want to be visible under certain conditions.
In AngularJS I would write
<div ng-show="myVar">stuff</div>
How can I do this in Angular 2+?...
I'm trying to set up a connecting string in my web.config file (Visual Studio 2008/ASP.NET 3.5) to a local server (SQL server 2008).
In my web.config, how and where do I place the connection string?
Here's what web.config file looks like right now:...
What does this error message mean?
error: call of overloaded ‘setval(int)’ is ambiguous
huge.cpp:18: note: candidates are: void huge::setval(unsigned int)
huge.cpp:28: note: void huge::setval(const char*)
My code looks like thi...
In C++, I can iterate over an std::string like this:
std::string str = "Hello World!";
for (int i = 0; i < str.length(); ++i)
{
std::cout << str[i] << std::endl;
}
How do I iterate over a string in Python?...
I'm receiving a dict from one "layer" of code upon which some calculations/modifications are performed before passing it onto another "layer". The original dict's keys & "string" values are unicode, but the layer they're being passed onto only ac...
Suppose I have a string "qwerty" and I wish to find the index position of the e character in it. (In this case the index would be 2)
How do I do it in C?
I found the strchr function but it returns a pointer to a character and not the index....
I've been searching for a solution but it's seem I can't get it right, no matter what I try.
After successful login, the user should be redirected to the page he came from, let's say he's been browsing a post and wants to log in so he can leave a ...
jQuery trim not working. I wrote the following command to remove white space. Whats wrong in it?
var str = $('input').val();
str = jquery.trim(str);
console.log(str);
Fiddle example....
I want to create a layout with rounded corners and a filled color background.
This is my layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="210dp"
android:orientation="vertical"
android:layout_margin...
How do I find the number of arguments passed to a Bash script?
This is what I have currently:
#!/bin/bash
i=0
for var in "$@"
do
i=i+1
done
Are there other (better) ways of doing this?...
I have a log4j.xml config file. and a RollingFileAppender to which I need to provide file path for storing logs. The problem is my code will be deployed on Unix machine as a runnable jar. So if I pass parameter something like this:
value=logs/messag...
I found out ways to terminate (shut-down or stop) my Java programs. I found two solutions for it.
using return;When I want to quit or terminate my program execution , I add this.
using System.exit() ; Sometimes I used it. I read about Sytem.exit(...
When I try to upload a folder with subfolders to S3 through the AWS console, only the files are uploaded not the subfolders.
You also can't select a folder. It always requires opening the folder first before you can select anything.
Is this even p...
I'd rather not do this in PHP so I'm hoping a someone decent at shell scripting can help.
I need a script that runs through directory recursively and finds all files with last modified date is greater than some date. Then, it will tar and zip the f...
Important notice:
If you register for testing, go to your profile settings and to your interests add delete profile.
Trying to login with Facebook to my website:
I get the following error:
URL Blocked: This redirect failed because the redirec...
What language does one need to use when programming with Unity? Or is it an API for many languages?
I read through the docs and I guess I missed the point on the language used.
It says it has iOS deployment, would this still allow the programmer to...
I want to display 3 buttons on the same line in html. I tried two options:
This one:
<div style="width:500px;">
<div style="float: left; width: 130px"><button type="submit" class="msgBtn" onClick="return false;" >Save...
I'm trying to present query results, but I keep getting a blank data grid.
It's like the data itself is not visible
Here is my code:
private void Employee_Report_Load(object sender, EventArgs e)
{
string select = "SELECT * FROM tblEmployee"...
I'm trying to add a button to a spreadsheet that when clicked will copy a specific URL to my clipboard.
I had a bit of knowledge of Excel VBA but it's been a while and I'm struggling....
I've setup a self-signed certificate to test an ssl java connection - however, it is refusing to locate the java trustStore. I've saved copies of it in /Java/jre6/lib/security in addition to the folder where the classes are compiled to (im using netb...
I have a vector for example
a = [0 1 0 3]
I want to turn a into b which equals b = [1 3].
How do I perform this in general? So I have a vector with some zero components and I want to remove the zeroes and leave just the non-zero numbers?...
The new Java 8 stream framework and friends make for some very concise java code, but I have come across a seemingly-simple situation that is tricky to do concisely.
Consider a List<Thing> things and method Optional<Other> resolve(Thing ...
I have a table Persons with personaldata and so on. There are lots of columns but the once of interest here are: addressindex, lastname and firstname where addressindex is a unique address drilled down to the door of the apartment.
So if I have 'like...
How can I set a transparent background on JPEG image? This is a doubt of many colleagues of mine.
What would be the solution using Paint on Windows?
What are the other simple alternatives?...
I normally use document.getElementById('id').style.display = 'none' to hide a single div via Javascript. Is there a similarly simple way to hide all elements belonging to the same class?
I need a plain Javascript solution that does not use jQuery....
I followed the official docs on https setup located here: https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html#https-configuration
I had to remove the +CompatEnvVars from
SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequi...
I have the following code to instantiate a JTable: the table comes up with the right number of rows and columns, but there is no sign of the titles atop the columns.
public Panel1()
{
int nmbrRows;
setLayout(null);
setBackground(Color...
I'm trying to create a dictionary using for loops. Here is my code:
dicts = {}
keys = range(4)
values = ["Hi", "I", "am", "John"]
for i in keys:
for x in values:
dicts[i] = x
print(dicts)
This outputs:
{0: 'John', 1: 'John', 2: 'John'...
properties> date created... I thought this meant the date the video was created, but finally realized that date changes every time I move, reorganize, even open a file. often, the date modified is earlier than date created. the date a jpeg was ta...
I have a directory that stores all the .py files.
bin/
main.py
user.py # where class User resides
dir.py # where class Dir resides
I want to use classes from user.py and dir.py in main.py.
How can I import these Python classes into main.p...
I found some websites that claim to verify if email addresses are valid. Is it possible to check if an email address is valid using just PHP?
<?php
if($_POST['email'] != ''){
// The email to validate
$email = $_POST['email'];...
I have a link in an HTML page:
<a href="#foo">foo</a>
The color of the link text is originally blue. When the link is clicked, the color of the link text changes to Red first, and then changes back to Blue. I want to the color of the l...
I can't access to HttpContext.Current on my project MVC4 with C#4.5
I've added my reference to System.Web in my project and added the using instruction on my controller page...
But I can access currentHandler only...
var context = HttpContext.Curr...
I've been saving all the data received from services direct to local variable, controller, or scope. What I suppose would be considered a shallow copy, is that correct?
Example:
DataService.callFunction()
.then(function(response) {
$scope.example...
In one of my apps, I am getting the response from a webrequest. The service is Restful service and will return a result similar to the JSON format below:
{
"id" : "1lad07",
"text" : "test",
"url" : "http:\/\/twitpic.com\/1lacuz",
"wi...
Is there a way of combining border-top,border-right,border-left,border-bottom in CSS like a super shorthand style.
eg:
border: (1px solid #ff0) (2px dashed #f0F) (3px dotted #F00) (5px solid #09f);
...
I have the following DateTime 4/25/2011 5:12:13 PM
and tried this to convert it to int
int result = dateDate.Year * 10000 + dateDate.Month * 100
+ dateDate.Day + dateDate.Hour + dateDate.Minute + dateDate.Second;
But it still gettin...
How can you run GUI applications in a Docker container?
Are there any images that set up vncserver or something so that you can - for example - add an extra speedbump sandbox around say Firefox?...
I heard several times that jQuery's strongest asset is the way it queries and manipulates elements in the DOM: you can use CSS queries to create complex queries that would be very hard to do in regular javascript .
However , as far as I know, you ca...
When editing a page within my system, a user might decide to navigate to another website and in doing so could lose all the edits they have not saved.
I would like to intercept any attempt to go to another page and prompt the user to be sure they wa...
I'm trying to scp a file from a remote server to my local machine. Only port 80 is accessible.
I tried:
scp -p 80 [email protected]:/root/file.txt .
but got this error: cp: 80: No such file or directory
How do I specify the port number i...
if (message.value[0] == "/" or message.value[0] == "\"):
do stuff.
I'm sure it's a simple syntax error, but something is wrong with this if statement....
The images (icons) come in roughly the same size, but I need to resize them in order for the buttons to remain the same height.
How do I do this?
Button button = new Button(this);
button.setText(apiEventObject.getTitle());
button.setOnClickListener...
The numpy docs recommend using array instead of matrix for working with matrices. However, unlike octave (which I was using till recently), * doesn't perform matrix multiplication, you need to use the function matrixmultipy(). I feel this makes the c...
Say that I have two figures in matplotlib, with one plot per figure:
import matplotlib.pyplot as plt
f1 = plt.figure()
plt.plot(range(0,10))
f2 = plt.figure()
plt.plot(range(10,20))
Then I show both in one shot
plt.show()
Is there a way to sho...
I have a question.
I have 3 jsp page.
The first is a menu with 2 button.
When I click the first button I want to open the second jsp page.
When I click the second button I want to open the third jsp page.
Can you help me? I must use a servlet(it's ...
I'm using CKEditor. I am saving the form values with ajax using page methods.
But the content of CKEditor value cannot be saving into the table.
I dont postback the page.
What can I do for that?...
I have these two tables just for example:
TAB_TEACHER
- id_teacher // primary key, autoincrement
- name_teacher // a varchar
TAB_STUDENT
- id_student // primary key, autoincrement
- name_student // a varchar
- id_teacher_fk // foreign key ref...
I have a list of numbers and I want to get the number of times a number appears in a list that meets a certain criteria. I can use a list comprehension (or a list comprehension in a function) but I am wondering if someone has a shorter way.
# list o...
I'm starting to use PowerShell and am trying to figure out how to echo a system environment variable to the console to read it.
Neither of the below are working. The first just prints %PATH%, and the second prints nothing.
echo %PATH%
echo $PATH
...
A column height is integer type in my SQL Server table. I want to do a division and have the result as decimal in my query:
Select (height/10) as HeightDecimal
How do I cast so that the HeightDecimal is no longer integer? Thanks....
This has been bothering me for a while, and I'm wondering if there's any consensus on how to do this properly. When I'm using an HTML list, how do I semantically include a header for the list?
One option is this:
<h3>Fruits I Like:</h3>...
When I create a table in html, a table with a width of 100%, if I want all the cells (tds) to be divided in equal parts, do I have to enter the width % for each cell? Am I "obliged" to do it?
E.g.:
<table cellpadding="0" cellspacing="0" width="1...
At the moment a default entry looks something like this:
Oct 12, 2008 9:45:18 AM myClassInfoHere
INFO: MyLogMessageHere
How do I get it to do this?
Oct 12, 2008 9:45:18 AM myClassInfoHere - INFO: MyLogMessageHere
Clarification I'm using java.ut...
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...
I'm trying to set the style of an action link like so:
<text><p>Signed in as @Html.ActionLink(Context.User.Identity.Name,"Index",new { Controller="Account", @style="text-transform:capitalize;" })</p>
I'd expect this to be rende...
How do I make my flex item (article in this example), which has flex-grow: 1; not to overflow it's flex parent/container (main)?
In this example article is just text, though it might contains other elements (tables, etc).
_x000D_
_x000D_
main, asi...
I'm trying to find an effective method of filtering Sharepoint lists based on the age of an item. In other words, if I want to find list items that are 7 days old, I should be able to build a filtered view on the data.
There is a hack to build a "...
I have 1-50 records in the database. I am fetching those data using cursor and set those values to Spinner using Simple Cursor Adapter. Now what i need is i want to set one value say 39th value as default. But not by its position i want to set by its...
It seems that Java 6 supports TLS up to v1.0, is there any way to use TLS 1.2 in Java 6?
Maybe a patch or a particular update of Java 6 will have support for it?...
In a program I'm writing I have Python use the re.search() function to find matches in a block of text and print the results. However, the program exits once it finds the first match in the block of text.
How do I do this repeatedly where the progra...
I have to write some documents that will include source code examples. Some of the examples will be written from the IDE, and others would be written in place. My examples are primarily in Java.
As someone who is used to LaTeX, doing this in Word is...
Assuming the Subject Alternative Name (SAN) property of an SSL certificate contains two DNS names
domain.tld
host.domain.tld
but the Common Name (CN) is set to only one of both: CN=domain.tld.
Does this setup have a special meaning, or any [dis]ad...
I need to write a simple function that takes a URL and processes the response which is XML or JSON, I have checked the Sun website https://swingx-ws.dev.java.net/servlets/ProjectDocumentList , but the HttpRequest object is to be found nowhere, is it ...
I would like to create a temporary table in a Oracle database
something like
Declare table @table (int id)
In SQL server
And then populate it with a select statement
Is it possible?
Thanks...
My code works perfectly: every time an item in Navigation Drawer is clicked the item is selected.
Of course I want to start the app with a default fragment (home), but Navigation Drawer doesn't have the item selected. How can I select that item prog...
I wrote a quick jsfiddle here, where I pass a small JSON object to a new variable and modify the data from the original variable (not the new variable), but the new variable's data gets updated as well. This must mean that the JSON object was passed ...
Here's the very dumb way:
def divisorGenerator(n):
for i in xrange(1,n/2+1):
if n%i == 0: yield i
yield n
The result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-)...
I've built a GUI using Swing and the MigLayout.
I am using Eclipse 4.2.2 (64-bit) on Windows 7 Ultimate.
Every time I click back into the window to edit my code, a popup comes up, then I'm prompted to restart Eclipse, and the Event log says the foll...
I am getting a little confused. I was reading the below from Java Database Connectivity:
Connection conn = DriverManager.getConnection(
"jdbc:somejdbcvendor:other data needed by some jdbc vendor",
"myLogin",
"m...
How do you return 1 value per row of the max of several columns:
TableName
[Number, Date1, Date2, Date3, Cost]
I need to return something like this:
[Number, Most_Recent_Date, Cost]
Query?...
how to create an XML document like this?
<body>
<level1>
<level2>text</level2>
<level2>other text</level2>
</level1>
</body>
using XmlDocument in C#...
I am trying to use the new async features and I hope solving my problem will help others in the future. This is my code which is working:
async function asyncGenerator() {
// other code
while (goOn) {
// other code
var fileList...
I am serializing an structure into a MemoryStream and I want to save and load the serialized structure.
So, How to Save a MemoryStream into a file and also load it back from file?...
I have to face a new little project. It will have about 7 or 9 tables, the biggest of them will grow by a max rate of 1000 rows a month.
I thought about SQLite as my db... But i will need to protect the db in case anybody wants to change data from t...
Can you please help me how to convert the following codes to using "in" operator of criteria builder?
I need to filter by using list/array of usernames using "in".
I also tried to search using JPA CriteriaBuilder - "in" method but cannot find good r...
This is a line for a hyperlink in HTML:
<a href="http://www.starfall.com/">Starfall</a>
Thus, if I click on "Starfall" my browser - I am using FireFox - will take me to that new page and the contents of my window will change. I wonder,...
First off, here is some code:
int main()
{
int days[] = {1,2,3,4,5};
int *ptr = days;
printf("%u\n", sizeof(days));
printf("%u\n", sizeof(ptr));
return 0;
}
Is there a way to find out the size of the array that ptr is pointin...
I'm making a pagination system (sort of like Facebook) where the content loads when the user scrolls to the bottom. I imagine the best way to do that is to find when the user is at the bottom of the page and run an ajax query to load more posts.
The...
I'm trying to retrive the data from my channel using the YouTube Data API V3.
For that I need my channel ID.
I've tried to find my channel ID from my YouTube account, and I failed in every single way.
If anyone have a single tip for me, I would be in...
Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the Worksheet_SelectionChange event, as that will not trigger multiple times if the cell is clicked multiple times. BeforeDoubleClick does not solve my problem either,...
I am trying to remove some columns in a dataframe.
I want to know why it worked for a single column but not with multible columns
e.g.
this works
album2[,5]<- NULL
this doesn't work
album2[,c(5:7)]<- NULL
Error in `[<-.data.frame`(`*tmp...
EDIT:
After I modified the web.config and I don't get error that's good.... then I add a new page (html) and write this small code to consume the service like this:
$("#btn12").click(function (event) {
$.getJSON('http://localhost:3...
This seems a silly question but just got bootstrap and it doesn't gives any examples on the website about adding a Javascript callback to a button...
Tried setting my button an id flag and then
<div class="btn-group">
<button id="rectBut...
I am writing a script in bash, which is calling two bash scripts internally. Where first script includes different tests which runs in background and second script print results of first script.
When I run these two scripts one after other, sometime...
I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester.
I want to measure the request, response, and total time using cURL.
My example request looks like:
curl -X POST -d @file serv...
Can you explain to me the output of this Java code?
int a=5,i;
i=++a + ++a + a++;
i=a++ + ++a + ++a;
a=++a + ++a + a++;
System.out.println(a);
System.out.println(i);
The output is 20 in both cases...
I'm interested in sorting a list from a stream. This is the code I'm using:
list.stream()
.sorted((o1, o2)->o1.getItem().getValue().compareTo(o2.getItem().getValue()))
.collect(Collectors.toList());
Am I missing something? The list is n...
I'm looking to display data in a tree structure in a web app. I was hoping to use Angular for this task.
Looks like ng-repeat will allow me to iterate through a list of nodes, but how can I then do nesting when a given node's depth increases?
I tri...
I'm testing PHP7, and have a weird issue after a recent update. SimpleXML should be enabled by default, and my phpinfo page shows that it is available:
However, the functions are not available:
<?php
if (function_exists('simplexml_load_file')...
Consider the following:
items = []
items.append("apple")
items.append("orange")
items.append("banana")
# FAKE METHOD:
items.amount() # Should return 3
How do I get the number of elements in the list items?...
I have an input defined as
<input class="datepicker" type="text" ng-model="clientForm.birthDate" />
Which is rigged up to be displayed elsewhere on the page:
<tr>
<th>Birth Date</th>
<td>{{client.birthDate|da...
I understand JQuery in the basic sense but am definitely new to it, and suspect this is very easy.
I've got my image src and id in a JSON response (converted to an object), and therefore the correct values in responseObject.imgurl and responseObject...
I want to center a div vertically with CSS. I don't want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support.
<body>
<div>Div to be aligned vertically</div>
&...
I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use Number(), but is there any similar method available in PHP?
Input Output
'2' 2
'2.34' 2.34
'0.3454545' ...
How do I set it so the application is running in portrait mode only? I want the landscape mode to be disabled while the application is running. How do I do it programmatically?...
I'm creating a website using WooCommerce and I want to restrict the available products to users depending on the postcode that they enter in the search form on my home page.
To be able to achieve that I'll have to specify the conditions of each pro...
I had an html navigation code as below
_x000D_
_x000D_
function Data(string) {
//1. get some data from server according to month year etc.,
//2. unactive all the remaining li's and make the current clicked element active by adding "active" class ...
How can I overwrite the stylings in Twitter Bootstrap? For instance, I am currently using a .sidebar class that has the CSS rule 'float: left;' How can I change this so that it goes to the right instead? I'm using HAML and SASS but am relatively n...
How do i extract the time using moment.js?
"2015-01-16T12:00:00"
It should return "12:00:00 pm".
The string return will be passed to the timepicker control below.
http://jdewit.github.com/bootstrap-timepicker
Any idea? ...
Just looking for a simple solution to downloading and unzipping .zip or .tar.gz files in Node.js on any operating system.
Not sure if this is built in or I have to use a separate library. Any ideas? Looking for just a couple lines of code so when ...
I am trying to run pip install mitmproxy on Windows, but I keep getting access denied, even with cmd and PowerShell using the Run as Administrator option.
WindowsError: [Error 5] Access is denied: 'c:\\users\\bruno\\appdata\\local\\temp\\easy_instal...
I have been moving from Webstorm and RubyMine to Atom and I really miss a feature from the Jetbrains editors where you select a code block and press CMD + - and it adds language specific comment character(s) to the beginning of each line. (# for ruby...
I have implemented a custom dialog for my application. I want to implement that when the user clicks outside the dialog, the dialog will be dismissed.
What do I have to do for this?...
I am new to Mysqli_* and I am getting these errors:
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string
given in D:\Hosting\9864230\html\includes\connection.php on line 11
Warning: mysqli_error() expects exactly 1 paramete...
From the PyQt4 website their instructions for installing the package are to download the tarball and use the config file. I have two versions of Python, one is my normal system and the other is within anaconda. I'm not sure how I get this to install ...
I opened a webcam by using the following JavaScript code:
const stream = await navigator.mediaDevices.getUserMedia({ /* ... */ });
Is there any JavaScript code to stop or close the webcam? Thanks everyone....
A lot of people still use tables to layout controls, data etc. - one example of this is the popular jqGrid. However, there is some magic happening that I cant seem to fathom (its tables for crying out loud, how much magic could there possibly be?)
H...
I am trying to write a regular expression which returns a string which is between parentheses. For example: I want to get the string which resides between the strings "(" and ")"
I expect five hundred dollars ($500).
would return
$500
Found Reg...
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-...
What is the general idea of a delegate in C++? What are they, how are they used and what are they used for?
I'd like to first learn about them in a 'black box' way, but a bit of information on the guts of these things would be great too.
This is no...
I am trying to export my SQL Server query results into a folder in .txt format (this is for an automated job)
I know the equivalent in MySQL works with INTO OUTFILE. Does anyone know the best way to do this in SQL Server 2008 Management Studio?
SE...
I'm fairly new to Linux (Ubuntu 10.04) and a total novice to assembler. I was following some tutorials and I couldn't find anything specific to Linux.
So, my question is, what is a good package to compile/run assembler and what are the command line c...
Edit: I wanted to come back to note that the problem wasn't on my end at all, but rather with with code on the other company's side.
I'm trying to pull up a page using Basic Authentication. I keep getting a 404 Page not found error. I can copy and p...
If not, is there a de facto standard? Basically I'm writing a command line help text like so:
usage: app_name [options] required_input required_input2
options:
-a, --argument Does something
-b required Does something with "required...
How do I iterate through an existing array and add the items to a new array.
var array = [];
forEach( calendars, function (item, index) {
array[] = item.id
}, done );
function done(){
console.log(array);
}
The above code would normally wo...
I recently downloaded Xcode 5 DP to test my apps in iOS 7. The first thing I noticed and confirmed is that my view's bounds is not always resized to account for the status bar and navigation bar.
In viewDidLayoutSubviews, I print the view's bounds:
...
I have a target array ["apple","banana","orange"], and I want to check if other arrays contain any one of the target array elements.
For example:
["apple","grape"] //returns true;
["apple","banana","pineapple"] //returns true;
["grape", "pineap...
I have a calendar and a textbox that contains a time of day. I want to create a datetime that is the combination of the two. I know I can do it by looking at the hours and mintues and then adding these to the calendar DateTime, but this seems rather ...
How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc....
What I'm trying to do seems very simple, but after a few days of searching I can't quite figure it out.
I have an application that allows the user to select multiple(up to 5) images. I'm using an ImageView. When the user clicks on the ImageView, I'...
Typically, when I plug in my Zebra LP 2844-Z to the USB port, the computer sees it as a printer and I can print to it from notepad like any other generic printer. However, my application has some bar code features. My application parses some input an...
What is the difference between onInterceptTouchEvent and dispatchTouchEvent in Android?
According to the android developer guide, both methods can be used to intercept a touch event (MotionEvent), but what is the difference?
How do onInterceptTouch...
I want to extract the MSI of an EXE setup to publish over a network.
For example, using Universal Extractor, but it doesn't work for Java Runtime Environment....
Why is this code gives an Debug Assertion Fail?
std::string query;
int ClientID = 666;
query = "select logged from login where id = ";
query.append((char *)ClientID);
...
I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition.
I started in the Form Designer and made a button named "Click Me!" proceede...
I've got several domains operating under a single .htaccess file, each having an SSL certificate.
I need to force a https prefix on every domain while also ensuring www versions redirect to no-www ones.
Below is my code; it doesn't work:
RewriteCo...
FirstActivity.Java has a FragmentA.Java which calls startActivityForResult().
SecondActivity.Java call finish() but onActivityResult never get called which is
written in FragmentA.Java.
FragmentA.Java code:
@Override
public void onActivityCrea...
We have this json schema draft. I would like to get a sample of my JSON data and generate a skeleton for the JSON schema, that I can rework manually, adding things like description, required, etc, which can not be infered from the specific examples.
...
I have the following django template (http://IP/admin/start/ is assigned to a hypothetical view called view):
{% for source in sources %}
<tr>
<td>{{ source }}</td>
<td>
<form action="/admin/start/" method="...
I have a method with a HandlerThread. A value gets changed inside the Thread and I'd like to return it to the test() method. Is there a way to do this?
public void test()
{
Thread uiThread = new HandlerThread("UIHandler"){
public sync...
I'm trying to correct the usual IE bugs around CSS 2.1 and need a way to alter an elements style properties to add a custom text-align style.
Currently in jQuery you can do something like
$(this).width() or $(this).height()
but I can't seem to f...
I'm getting $row['message'] from a MySQL database and I need to remove all whitespace like \n \t and so on.
$row['message'] = "This is a Text \n and so on \t Text text.";
should be formatted to:
$row['message'] = 'This is a Text and so on T...
I need to execute a PowerShell script from within C#. The script needs commandline arguments.
This is what I have done so far:
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
Runspace runspace = RunspaceFactory.Create...
I create dynamic a table with <tr> and <td> tags. One of the td tags gets the id "detailInfo". I have an onclick function on some button. I would like to set some value in the td "detailInfo" after pressing on the button.
So how can I se...
I have JSON object like below
{
"txt_inc_Application": {
"EWS": true,
"EWindow": true
},
"txt_inc_IncidentType": {
"Brand Damage": true,
"Internal failure": true
}
}
And I am using angular.forEach to...
Here is my code, I need to sum an undefined number of elements in the list. How to do this?
l = raw_input()
l = l.split(' ')
l.pop(0)
My input: 3 5 4 9
After input I delete first element via l.pop(0).
After .split(' ') my list is ['5', '4', '9'] a...
TL;DR: I need a way to decode a QR-code from an image file using (preferable pure) Python.
I've got a jpg file with a QR-code which I want to decode using Python. I've found a couple libraries which claim to do this:
PyQRCode (website here) whi...
I have implemented a WKWebView in an app.
there's a file input in the shown web page where it should import an image from photos.
Whenever i press on that input and select either "Take Photo" or "Photo Library" the app suddenly crash, which I believe...
I just started developing PHP projects on my mac (using PDT) and was wondering where localhost is located? How does Mac OS X serve websites, I haven't changed any settings during the installation of PDT....
I am wondering if it will work best to actually write the following for example:
<table>
<?php foreach($array as $key=>$value){ ?>
<tr>
<td><?php echo $key; ?></td>
</tr>
<?php ...
I have a problem to plot a subset of a data frame with ggplot2. My df is like:
df = data.frame(ID = c('P1', 'P1', 'P2', 'P2', 'P3', 'P3'),
Value1 = c(100, 120, 300, 400, 130, 140),
Value2 = c(12, 13, 11, 16, 15, 12))
...
I'd like to run an external process and capture it's command output to a variable in PowerShell. I'm currently using this:
$params = "/verify $pc /domain:hosp.uhhg.org"
start-process "netdom.exe" $params -WindowStyle Hidden -Wait
I've confirmed t...
I installed the latest versions of SDK (API 16) and got the latest ADT. I'm now seeing these messages in the logcat, that I'm quite sure, I haven't seen before. Does anyone have an idea about this?
06-29 23:11:17.796: I/Choreographer(691): Skippe...
I have a date "10/10/11(m-d-y)" and I want to add 5 days to it using a Python script. Please consider a general solution that works on the month ends also.
I am using following code:
import re
from datetime import datetime
StartDate = "10/10/11"
...
I understand that I need to use LoadLibrary(). But what other steps do I need to take in order to use a third-party DLL file?
I simply jumped into C++ and this is the only part that I do not get (as a Java programmer). I am just looking into how I c...
Hi I am working with multiple tablet devices, iPad, Galaxy Tab, Acer Iconia, LG 3D Pad and so on.
iPad - 1024 x 768
LG Pad - 1280 x 768
Galaxy Tab - 1280 x 800
I want to target iPad only using CSS3 media query. Since, device width of LG and iPad ...
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......
My button uses AJAX to add information to the database and change the button text. However, I wish to have the button disabled after one click (or else the person can spam the information in the dataabase). How do I do this?
HTML
<button class="...
How do you do reverse gmtime(), where you put the time + date and get the number of seconds?
I have strings like 'Jul 9, 2009 @ 20:02:58 UTC', and I want to get back the number of seconds between the epoch and July 9, 2009.
I have tried time.strfti...
My company has a VB6 application using Crystal Reports 7 which a client has asked to be installed on Windows 7 32 bit. It is currently installed on Windows XP 32bit SP2 machines at the client. Connection to the DB is done via ODBC to SQL Server 2000 ...
I would like to make a copy of my project. I would rather not start doing it from scratch by adding files and references, etc. Please note that I don't mean copy for deployment. Just plain copy.
Is there a tool in VS to do this? I am using VS 2008...
I have following data:
1||1||Abdul-Jabbar||Karim||1996||1974
I want to delimit the tokens.
Here the delimiter is "||".
My delimiter setter is:
public void setDelimiter(String delimiter) {
char[] c = delimiter.toCharArray();
this.delimit...
I have the following json :
{
"users":
[{
"user":
{
"user_id" :"a11uhk22hsd3jbskj",
"username" :"tom",
"location" : null
}
}]
}
I get this json in response to a request to an api. Lookin...
I have a simple android client which needs to 'talk' to a simple C# HTTP listener. I want to provide a basic level of authentication by passing username/password in POST requests.
MD5 hashing is trivial in C# and provides enough security for my need...
I get this Tomcat Error:
Sep 09, 2012 4:16:54 PM org.apache.catalina.core.AprLifecycleListener init
Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library...
On my website I would like to display images uploaded by user in a new window with a specific size (width: 600px). The problem is that the images may be big. So if they are bigger than these 600px, I would like to resize them, preserving the aspect r...
(All done in poshgit on Windows 8):
git init --bare test-repo.git
cd test-repo.git
(Folder is created with git-ish files and folders inside)
git status
fatal: This operation must be run in a work tree
(Okay, so I can't use git status with a bar...
int day = Integer.parseInt(request.getParameter("day")); // 25
int month = Integer.parseInt(request.getParameter("month")); // 12
int year = Integer.parseInt(request.getParameter("year")); // 1988
System.out.println(year);
Calendar c = Calendar.ge...
I just downloaded Docker Toolbox for Windows 10 64bit today. I'm going through the tutorial. I'm receving the following error when trying to build an image using a Dockerfile.
Steps:
Launched Docker Quickstart terminal.
testdocker after creating...
I can't seem to grasp why this is happening. This code:
mProgressDialog = ProgressDialog.show(this, "", getString(R.string.loading), true);
works just fine. However, this code:
mProgressDialog = ProgressDialog.show(getApplicationContext(), "", ge...
I'm working on a project in React and ran into a problem that has me stumped.
Whenever I run yarn start I get this error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type
string. Received type undefined
I have no idea w...
I know this question has been asked a couple of times already but most of the time, the solution is to handle this in the parent, as the flow of responsibility is only descending. However, sometimes, you need to kill a component from one of its metho...
I have a small GUI test with a "Start" button and a Progress bar. The desired behavior is:
Click Start
Progressbar oscillates for 5 seconds
Progressbar stops
The observed behavior is the "Start" button freezes for 5 seconds, then a Progressbar is...
I want to open a website in my local computer's web browser (Chrome or Internet Explorer) using Python.
open("http://google.co.kr") # something like this
Is there a module that can do this for me?...
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn(gridColumn1, typeof(bool)));
I was expecting the result of the below line to include info about the DataColumns Type (bool):
?dt.Columns[0].GetType()
...
I need to see all of the POST results that are submitted to the server for testing.
What would be an example of how I can create a new file to submit to that will echo out all of the fields which were submitted with that form?
It's dynamic, so some...
I'm working on a project that involves Raphaeljs. Turns out, it doesn't work on Android. It does on the iPhone.
How the heck to I go about debugging something on the Android browser? It's WebKit, so if I know the version, will debugging it on that f...
I did a simple test case:
def setUp(self):
self.testListNone = None
def testListSlicing(self):
self.assertRaises(TypeError, self.testListNone[:1])
and I am expecting test to pass, but I am getting exception:
Traceback (most recent call las...
I am trying to understand why Dijkstra's algorithm will not work with negative weights. Reading an example on Shortest Paths, I am trying to figure out the following scenario:
2
A-------B
\ /
3 \ / -2
\ /
C
From the website:
...
I have a Person class:
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
@ManyToMany(fetch = FetchType.LAZY)
private List<Role> roles;
// etc
}
With a many-to-many relation that is lazy.
In my cont...
I imported a date picker in a project and was wondering if there was any official recent component from angular and material to include time in the calendar as well.
I've seen plenty of time pickers in material documentation and researched a lot of t...
When I use the below code and parse the xml locally it works fine but when upload the same script at the server it shows error.
Note: I retrieved the $lng and $lat from the query string and it works fine locally.
$lng=$_GET['lng'];
$lat=$_GET['lat...
I am trying to understand what is machine epsilon. According to the Wikipedia, it can be calculated as follows:
def machineEpsilon(func=float):
machine_epsilon = func(1)
while func(1)+func(machine_epsilon) != func(1):
machine_epsilon...
I am using Service Class on the Android O OS.
I plan to use the Service in the background.
The Android documentation states that
If your app targets API level 26 or higher, the system imposes restrictions on using or creating background serv...
I have a problem with list within a class in python. Here's my code :
class Residues:
def setdata(self, name):
self.name = name
self.atoms = list()
a = atom
C = Residues()
C.atoms.append(a)
Something like this. I get an error ...
I have a class that uses XML and reflection to return Objects to another class.
Normally these objects are sub fields of an external object, but occasionally it's something I want to generate on the fly. I've tried something like this but to no avai...
I have a kendoUI grid.
@(Html.Kendo().Grid<EntityVM>()
.Name("EntitesGrid")
.HtmlAttributes(new { style = "height:750px;width:100%;scrollbar-face-color: #eff7fc;" })
...
Aside from trying
perldoc <module name>
individually for any CPAN module that takes my fancy or going through the file system and looking at the directories I have no idea what modules we have installed.
What's the easiest way to just get ...
How can I write data to a text file automatically by shell scripting in Linux?
I was able to open the file. However, I don't know how to write data to it....
I know ECMAScript 6 has constructors but is there such a thing as destructors for ECMAScript 6?
For example if I register some of my object's methods as event listeners in the constructor, I want to remove them when my object is deleted.
One soluti...
I am new to ReactJS and am creating a simple TODO application in it. Actually, it is a very basic app with no db connection, tasks are stored in an array. I added Edit and Delete functionality to it now I want to add pagination. How do I implement it...
The MySQL reference manual does not provide a clearcut example on how to do this.
I have an ENUM-type column of country names that I need to add more countries to. What is the correct MySQL syntax to achieve this?
Here's my attempt:
ALTER TABLE ca...
I was curious about how other people use the this keyword. I tend to use it in constructors, but I may also use it throughout the class in other methods. Some examples:
In a constructor:
public Light(Vector v)
{
this.dir = new Vector(v);
}
El...
I want the variable sum/NR to be printed side-by-side in each iteration. How do we avoid awk from printing newline in each iteration ? In my code a newline is printed by default in each iteration
for file in cg_c ep_c is_c tau xhpl
printf "\n $file"...
I have a value in a cell that's in bytes. But nobody can read 728398112238. I'd rather it say 678.37GB
To write a formula to format it relatively easy (here's one: http://www.yonahruss.com/2007/02/format-excel-numbers-as-gb-mb-kb-b.html)
But is the...
Suppose I have a template function and two classes
class animal {
}
class person {
}
template<class T>
void foo() {
if (T is animal) {
kill();
}
}
How do I do the check for T is animal? I don't want to have
something that checks dur...
When I push my deployments, for some reason, I'm getting the error on my pods:
pod has unbound PersistentVolumeClaims
Here are my YAML below:
This is running locally, not on any cloud solution.
apiVersion: extensions/v1beta1
kind: Deploymen...
I have a scenario where I need to run a linux shell command frequently (with different filenames) from windows. I am using PuTTY and WinSCP to do that (requires login name and password). The file is copied to a predefined folder in the linux machine...
I installed Visual Studio 2010. I wrote a simple code which I'm sure is correct but unfortunately, when I run the code, I get the error below.
Here is my code:
#include<iostream>
using namespace std;
int main (){
cout <<"Hello StackO...
I'm currently working on a project where I have no control over the HTML that I am applying CSS styles to. And the HTML is not very well labelled, in the sense that there are not enough id and class declarations to differentiate between elements.
So...
I have around 1000 pdf filesand I need to convert them to 300 dpi tiff files. What is the best way to do this? If there is an SDK or something or a tool that can be scripted that would be ideal. ...
I have a column that looks something like this:
CASE
WHEN col1 > col2 THEN SUM(col3*col4)
ELSE 0
END AS some_product
And I would like to put it in my GROUP BY clause, but this seems to cause problems because there is an aggregate functi...
I am using this code from Google Map API's and it is not working
<!DOCTYPE html>
<html>
<head>
<title>Place Autocomplete</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta cha...
Just started with the playground. I'm trying to create a simple app.
I've created a date object like this:
var date = NSDate()
How can I get the current hour? In other languages I can do something like this:
var hour = date.hour
But I can't fi...
I want to get my NetBeans project to Eclipse. It's a web application project.
I imported war files into Eclipse but I am not able to get the Java files and the war files are giving me many errors. What is the best way to import the whole project?...
I am having this issue in Android studio.
Error:Failed to resolve: com.android.support:appcompat-v7:27.+
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="open.dependency.in.project.structure">Show...
If I select a cell containing a formula, I know I can drag the little box in the right-hand corner downwards to apply the formula to more cells of the column. Unfortunately, I need to do this for 300,000 rows!
Is there a shortcut, similar to CTRL+SP...
I need to connect to a Oracle DB (external) through Visual Studio 2010. But I dont want to install Oracle on my machine.
In my project I referenced: System.Data.OracleClient. But its not fulfilling the need.
I have an "Oracle SQL Developer IDE" in ...
The website in the iframe isn't located in the same domain, but both are mine, and I would like to communicate between the iframe and the parent site. Is it possible?...
In Visual Studio 2015, I cannot find the designer for RDLC reports anymore. Does anyone know if this is only a bug and if it is provided later on or if Microsoft wants to kill the RDLC or if they want us to use an external designer and when, which de...
<script>
$(document).ready(function(){
//Load City by State
$('#billing_state_id').live('change', function() {
//do something
});
$('#click_me').live('click', function() {
//do something
//need to recal...
How can I restrict users from entering special characters in the text box. I want only numbers and alphabets to be entered ( Typed / Pasted ).
Any samples?...
I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullPointerException? From the javadocs, both seem appr...
I'm running a simple ng-repeat over a JSON file and want to get category names. There are about 100 objects, each belonging to a category - but there are only about 6 categories.
My current code is this:
<select ng-model="orderProp" >
<...
I wanted to write a piece of code like the following:
from bs4 import BeautifulSoup
import urllib2
url = 'http://www.thefamouspeople.com/singers.php'
html = urllib2.urlopen(url)
soup = BeautifulSoup(html)
But I found that I have to install urllib...
How can I get the difference between two timestamps in days? Should I be using a datetime column for this?
I switched my column to datetime. Simple subtraction doesn't seem to give me a result in days.
mysql> SELECT NOW(), last_confirmation_att...
I want to verify if a method is called at least once through mockito verify. I used verify and it complains like this:
org.mockito.exceptions.verification.TooManyActualInvocations:
Wanted 1 time:
But was 2 times. Undesired invocation:
...
I have a list of certain files that I see using the command below, but how can I copy those files listed into another folder, say ~/test?
find . -mtime 1 -exec du -hc {} +
...
I have been using the scikit-learn library. I'm trying to use the Gaussian Naive Bayes Module under the scikit-learn library but I'm running into the following error. TypeError: cannot perform reduce with flexible type
Below is the code snippet.
t...
What is the simplest way to to wait for all tasks of ExecutorService to finish? My task is primarily computational, so I just want to run a large number of jobs - one on each core. Right now my setup looks like this:
ExecutorService es = Executors...
I have two ggplots which I align horizontally with grid.arrange. I have looked through a lot of forum posts, but everything I try seem to be commands that are now updated and named something else.
My data looks like this;
# Data plot 1 ...
Without foreach,
how can I turn an array like this
array("item1"=>"object1", "item2"=>"object2",......."item-n"=>"object-n");
to a string like this
item1='object1', item2='object2',.... item-n='object-n'
I thought about implode() alre...
This is my package.json:
{
"name": "my-example-app",
"version": "0.1.0",
"dependencies": {
"request": "*",
"nano": "3.3.x",
"async": "~0.2"
}
}
Now, when I open the cmd and run npm install, the install hangs. What am I doing wrong?...
I am trying to send a DELETE request with a url parameter using CURL. I am doing:
curl -H application/x-www-form-urlencoded -X DELETE http://localhost:5000/locations` -d 'id=3'
However, the server is not seeing the parameter id = 3. I tried using ...
In a DOS window, how can I get the full DOS name/short name of the directory I am in?
For example, if I am in the directory C:\Program Files\Java\jdk1.6.0_22, I want to display it's short name C:\PROGRA~1\Java\JDK16~1.0_2.
I know running dir /x wil...
I am very new to web development, but have a lot of experience in development in general. I have an ASP page that has a few input fields and a submit button. This submit button purely calls $.ajax, which I intended to have call a method in the code-b...
BY default when you run
docker run -it [myimage]
OR
docker attach [mycontainer]
you connect to the terminal as root user, but I would like to connect as a different user. Is this possible? ...
What is the difference between user variables such as PATH, TMP, etc. and system variables?
I accidentally deleted the user variable PATH. What am I supposed to do?...
I've inherited a project I'm working on and I'm updating some jquery animations (very little practice with jquery).
I have a div I need to add and remove the style attribute from. Here is the div:
<div id='voltaic_holder'>
At one point in t...
I am getting the above error:
error opening trace file: No such file or directory (2)
when I run my android application on the emulator. Can someone tell me what could be the possible reason for this?
I am using android-sdk-20 and below line...
I'm working with data that has the data has 3 plotting parameters: x,y,c. How do you create a custom color value for a scatter plot?
Extending this example I'm trying to do:
import matplotlib
import matplotlib.pyplot as plt
cm = matplotlib.cm.get_...