Questions Tagged with #Swig

SWIG is an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl.

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader

Is there someone who had experience with this error? java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.swig.simple-2/base.apk"],nativeLibraryDirectori..

C# guid and SQL uniqueidentifier

I want to create a GUID and store it in the DB. In C# a guid can be created using Guid.NewGuid(). This creates a 128 bit integer. SQL Server has a uniqueidentifier column which holds a huge hexidec..

Detecting a redirect in ajax request?

I want to use jQuery to GET a URL and explicitly check if it responded with a 302 redirect, but not follow the redirect. jQuery's $.ajax appears to always follow redirects. How can I prevent this, a..

Python unittest passing arguments

In python how would I pass an argument from the command line to a unittest function. Here is the code so far… I know it's wrong. class TestingClass(unittest.TestCase): def testEmails(self): ..

Getting the error "Java.lang.IllegalStateException Activity has been destroyed" when using tabs with ViewPager

I have an application that consists of using ActionBarSherlock in tab mode.I have 5 tabs and the content of each tab is handled using fragments. For tab2 though, I have a fragment the xml file of whic..

Setting up a websocket on Apache?

So I'm doing some research on websockets, and I have a few questions I can't seem to find a definitive answer for: How can I set up a web socket on my Linux server? Is there an Apache module? Would ..

DateTime.TryParse issue with dates of yyyy-dd-MM format

I have the following date in string format "2011-29-01 12:00 am" . Now I am trying to convert that to datetime format with the following code: DateTime.TryParse(dateTime, out dt); But I am alwayws..

In SQL Server, how to create while loop in select

data will be like this: id | data ----|--------- 1 | AABBCC 2 | FFDD 3 | TTHHJJKKLL what the result I want is id | data ----|--------- 1 | AA 1 ..

CSS 100% height with padding/margin

With HTML/CSS, how can I make an element that has a width and/or height that is 100% of it's parent element and still has proper padding or margins? By "proper" I mean that if my parent element is 20..

How to change the value of attribute in appSettings section with Web.config transformation

Is it possible to transform the following Web.config appSettings file: <appSettings> <add key="developmentModeUserId" value="00297022" /> <add key="developmentMode" value="true..

Is it possible to make an HTML anchor tag not clickable/linkable using CSS?

For example if I have this: <a style="" href="page.html">page link</a> Is there anything I can use for the style attribute that will make it so the link isn't clickable and won't take me..

Why std::cout instead of simply cout?

I get these error messages for all cout and endl: main.cc:17:5: error: ‘cout’ was not declared in this scope main.cc:17:5: note: suggested alternative: /usr/include/c++/4.6/iostream:62:18: note: ..

Specify JDK for Maven to use

I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but th..

SQL Server : Columns to Rows

Looking for elegant (or any) solution to convert columns to rows. Here is an example: I have a table with the following schema: [ID] [EntityID] [Indicator1] [Indicator2] [Indicator3] ... [Indicator1..

Add a default value to a column through a migration

How do I add a default value to a column that already exists through a migration? All the documentation I can find shows you how to do it if the column doesn't already exist but in this case it does..

! [rejected] master -> master (fetch first)

Is there a good way to explain how to resolve "! [rejected] master -> master (fetch first)'" in Git? When I use this command $ git push origin master it display an error message. ! [rejected] ..

Checking the form field values before submitting that page

I have written following function which checks whether start_date field is not empty and displays proper message when submit button is clicked. But then it takes the control to the previous page. So u..

How do I get the currently-logged username from a Windows service in .NET?

I have a Windows service which need the currently logged username. I tried System.Environment.UserName, Windows identity and Windows form authentication, but all are returning "System" as the user as ..

Finding index of character in Swift String

It's time to admit defeat... In Objective-C, I could use something like: NSString* str = @"abcdefghi"; [str rangeOfString:@"c"].location; // 2 In Swift, I see something similar: var str = "ab..

'and' (boolean) vs '&' (bitwise) - Why difference in behavior with lists vs numpy arrays?

What explains the difference in behavior of boolean and bitwise operations on lists vs NumPy arrays? I'm confused about the appropriate use of & vs and in Python, illustrated in the following ex..

Cron and virtualenv

I am trying to run a Django management command from cron. I am using virtualenv to keep my project sandboxed. I have seen examples here and elsewhere that show running management commands from within..

How to install older version of node.js on Windows?

I need to install node.js of version 4.0.0 I tried this: npm install -g [email protected] But I got this message: npm is not recognized as an internal or external command, operable program or batch file..

Read large files in Java

I need the advice from someone who knows Java very well and the memory issues. I have a large file (something like 1.5GB) and I need to cut this file in many (100 small files for example) smaller file..

How to reload a page after the OK click on the Alert Page

I need to reload the page after the OK button is clicked on the Alert box. I am using the following code for it alert("Successful Message"); window.location.reload(); But the window is reloaded im..

ECONNREFUSED error when connecting to mongodb from node.js

I know I'm doing some very stupid and noobish, but I'm hoping someone can help me set up a basic database connection to mongodb from node.js on a mac. I've installed mongodb using homebrew, seems to ..

Description Box using "onmouseover"

I am playing with the onmouseover event in javascript I would like a little box to pop up and remain up until there is no onmouseover anymore I think it's called a description box, but I am not sure..

Android sample bluetooth code to send a simple string via bluetooth

I want to send a simple string data such as 'a' from an android device to other one via bluetooth. I looked sample bluetooth code in android sdk but it is so complex for me. I cannot understand how I ..

How to check if a word is an English word with Python?

I want to check in a Python program if a word is in the English dictionary. I believe nltk wordnet interface might be the way to go but I have no clue how to use it for such a simple task. def is_en..

Failed to install *.apk on device 'emulator-5554': EOF

The project I tried to run is set to minSDK level 7. I have gotten the above error message when running Android virtual device-5554(the other devices work well). It is working so slowly, and taking to..

How to make the tab character 4 spaces instead of 8 spaces in nano?

When I press TAB in nano editor, the cursor will jump with 8 spaces like this: def square(x): return x * x def cube(y): return y * y * y how can I set the tab stop width to 4 spaces..

A TypeScript GUID class?

Does anyone know of a good, solid, implementation of C# like GUID (UUID) in TypeScript? Could do it myself but figured I'd spare my time if someone else done it before...

'MOD' is not a recognized built-in function name

I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message: 'MOD' is not a recognized built-in function name. DECLARE @m INT SET @m = MOD(321,11) SELECT..

How to copy marked text in notepad++

I have a part of HTML source file that contains strings that I want to select and copy at once, using the regex functionality of Notepad++. Here is a part of the text source: <option value="Perfo..

Spring Boot without the web server

I have a simple Spring Boot application that gets messages from a JMS queue and saves some data to a log file, but does not need a web server. Is there any way of starting Spring Boot without the web ..

Get a specific bit from byte

I have a byte, specifically one byte from a byte array which came in via UDP sent from another device. This byte stores the on/off state of 8 relays in the device. How do I get the value of a specifi..

How to cut first n and last n columns?

How can I cut off the first n and the last n columns from a tab delimited file? I tried this to cut first n column. But I have no idea to combine first and last n column cut -f 1-10 -d "<CTR>v..

How can I see function arguments in IPython Notebook Server 3?

I've recently switched to IPython Notebook 3 (3.1.0-cbccb68 to be exact), the Anaconda version. Previously when I typed a function and opened a parenthesis like this: time.sleep() and if the cursor..

C split a char array into different variables

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

Increasing the timeout value in a WCF service

How do I increase the default timeout to larger than 1 minute on a WCF service?..

How do I unset an element in an array in javascript?

How do I remove the key 'bar' from an array foo so that 'bar' won't show up in for(key in foo){alert(key);} ..

How to initialize List<String> object in Java?

I can not initialize a List as in the following code: List<String> supplierNames = new List<String>(); supplierNames.add("sup1"); supplierNames.add("sup2"); supplierNames.add("sup3"); Sys..

How eliminate the tab space in the column in SQL Server 2008

I have an column with email in table customer where the data in the column contains special character: TAB When I do a select, I need to remove the TAB space from that column. Means there is an empt..

Pandas Replace NaN with blank/empty string

I have a Pandas Dataframe as shown below: 1 2 3 0 a NaN read 1 b l unread 2 c NaN read I want to remove the NaN values with an empty string so that it looks like so: ..

Android check permission for LocationManager

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

How do I catch a numpy warning like it's an exception (not just for testing)?

I have to make a Lagrange polynomial in Python for a project I'm doing. I'm doing a barycentric style one to avoid using an explicit for-loop as opposed to a Newton's divided difference style one. The..

javascript regular expression to check for IP addresses

I have several ip addresses like: 115.42.150.37 115.42.150.38 115.42.150.50 What type of regular expression should I write if I want to search for the all the 3 ip addresses? Eg, if I do 115.42.15..

Where are SQL Server connection attempts logged?

Does SQL Server has an external log file or internal table for attempted connections, or is that kind of info put somewhere in the Windows Event Log? ..

Reason for Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

I got an error - Column 'Employee.EmpID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. select loc.LocationID, emp.EmpID f..

MySQL Trigger - Storing a SELECT in a variable

I have a trigger in which I want to have a variable that holds an INT I get from a SELECT, so I can use it in two IF statements instead of calling the SELECT twice. How do you declare/use variables in..

Permission denied (publickey). fatal: The remote end hung up unexpectedly while pushing back to git repository

Possible Duplicate: github: newbie problems -> Permission denied (publickey). fatal: The remote end hung up unexpectedly please see the below command , $ git clone git://github.com/{use..

Does Google Chrome work with Selenium IDE (as Firefox does)?

I can't find an equivalent of Selenium IDE that works with Chrome. Does anyone know how to use Selenium IDE with Chrome instead of Firefox? Or is there an alternative tool which works with Chrome?..

Excel Create Collapsible Indented Row Hierarchies

I would like to create indented collapsible row hierarchies in Excel for my spreadsheet. I have used group function but that becomes hard to manage for me. Here is an example of what I am trying to ..

Testing if a list of integer is odd or even

Trying to determine if my list of integer is made of odd or even numbers, my desired output is a list of true an/or false. Can I perform the following operation on the list lst or do I need to create..

Metadata file '.dll' could not be found

I am working on a WPF, C# 3.0 project, and I get this error: Error 1 Metadata file 'WORK=- \Tools\VersionManagementSystem\BusinessLogicLayer\bin\Debug \BusinessLogicLayer.dll' could not be found C:\-..

Inheriting from a template class in c++

Let's say we have a template class Area, which has a member variable T area, a T getArea() and a void setArea(T) member functions. I can create an Area object of a specific type by typing Area<int..

Run JavaScript code on window close or page refresh?

Is there a way to run a final JavaScript code when a user closes a browser window or refreshes the page? I'm thinking of something similar to onload but more like onclose? Thanks. I don't like the ..

Eclipse C++: Symbol 'std' could not be resolved

I am getting this error in the TestExecute.cpp - "Symbol 'std' could not be resolved" CODE #include <iostream> using namespace std; I just created a executable project in Eclipse (in W..

How can I use Async with ForEach?

Is it possible to use Async when using ForEach? Below is the code I am trying: using (DataContext db = new DataLayer.DataContext()) { db.Groups.ToList().ForEach(i => async { await GetA..

The most efficient way to implement an integer based power function pow(int, int)

What is the most efficient way given to raise an integer to the power of another integer in C? // 2^3 pow(2,3) == 8 // 5^5 pow(5,5) == 3125 ..

jquery toggle slide from left to right and back

I have a "Menu" button on the left hand side of the page and once selected I have a div containing the menu items show. I then have another button that can be selected to hide the menu. Ideally I wa..

How do I get the current date in JavaScript?

How do I get the current date in JavaScript?..

Adding a favicon to a static HTML page

I have a few static pages that are just pure HTML, that we display when the server goes down. How can I put a favicon that I made (it's 16x16px and it's sitting in the same directory as the HTML file;..

jQuery animated number counter from zero to value

I have created a script to animate a number from zero to it's value. Working jQuery _x000D_ _x000D_ $({ Counter: 0 }).animate({_x000D_ Counter: $('.Single').text()_x000D_ }, {_x000D_ duration: ..

Is there a simple way to increment a datetime object one month in Python?

So I am trying to find a way to increment a datetime object by one month. However, it seems this is not so simple, according to this question. I was hoping for something like: import datetime as d..

How can I install pip on Windows?

pip is a replacement for easy_install. But should I install pip using easy_install on Windows? Is there a better way?..

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". in a Maven Project

I have a dependency for SLF4J. I am getting this error: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http:..

Formatting a field using ToText in a Crystal Reports formula field

I'm trying to create a Crystal Reports formula field (to calculate the percentage change in a price) that will return "N/A" if a particular report field is null, but return a number to two decimal pla..

Last executed queries for a specific database

I know how to get the last executed queries using the following SQL in SSMS - SELECT deqs.last_execution_time AS [Time], dest.text AS [Query] FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_e..

How to select between brackets (or quotes or ...) in Vim?

I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally), so I'll just ask nice and simple. What is the easiest way to select between brack..

Setting up an MS-Access DB for multi-user access

We're thinking of "growing" a little MS-Access DB with a few tables, forms and queries for multiple users. (Using a different back-end is another, but more long-term option that is unfortunately curre..

Ant: How to execute a command for each file in directory?

I want to execute a command from an Ant buildfile, for each file in a directory. I am looking for a platform-independent solution. How do I do this? Sure, I could write a script in some scripting la..

How do I get into a Docker container's shell?

I'm getting started working with Docker. I'm using the WordPress base image and docker-compose. I'm trying to ssh into one of the containers to inspect the files/directories that were created during ..

How do I install Python libraries in wheel format?

I was looking for a tutorial on how to install Python libraries in the wheel format. It does not seem straightforward so I'd appreciate a simple step by step tutorial how to install the module name..

Regex to match URL end-of-line or "/" character

I have a URL, and I'm trying to match it to a regular expression to pull out some groups. The problem I'm having is that the URL can either end or continue with a "/" and more URL text. I'd like to ma..

WPF Button with Image

I'm trying to attach an image on a button in WPF, however this code fails. Seems strange after similar code would work perfectly in Mozilla XUL. <Button Height="49.086" Margin="3.636,12,231.795,0..

How to get the screen width and height in iOS?

How can one get the dimensions of the screen in iOS? Currently, I use: lCurrentWidth = self.view.frame.size.width; lCurrentHeight = self.view.frame.size.height; in viewWillAppear: and willAnimateR..

adding directory to sys.path /PYTHONPATH

I am trying to import a module from a particular directory. The problem is that if I use sys.path.append(mod_directory) to append the path and then open the python interpreter, the directory mod_dir..

How to implement reCaptcha for ASP.NET MVC?

How do I implement reCaptcha in ASP.NET MVC and C#?..

how to load CSS file into jsp

I created a jsp page as follows: <%@ page contentType="text/css" %> <html> <head> <title>Login page</title> <link href="/css/loginstyle.css" rel="stylesheet" type="t..

Match exact string

What is the regular expression (in JavaScript if it matters) to only match if the text is an exact match? That is, there should be no extra characters at other end of the string. For example, if I'm ..

How do I measure execution time of a command on the Windows command line?

Is there a built-in way to measure execution time of a command on the Windows command line?..

HTML-encoding lost when attribute read from input field

I’m using JavaScript to pull a value out from a hidden field and display it in a textbox. The value in the hidden field is encoded. For example, <input id='hiddenId' type='hidden' value='chalk ..

html <input type="text" /> onchange event not working

I am trying to do some experiment. What I want to happen is that everytime the user types in something in the textbox, it will be displayed in a dialog box. I used the onchange event property to make ..

How do I correctly setup and teardown for my pytest class with tests?

I am using selenium for end to end testing and I can't get how to use setup_class and teardown_class methods. I need to set up browser in setup_class method, then perform a bunch of tests defined as c..

Update Git branches from master

I'm new to Git, and now I'm in this situation: I have four branches (master, b1, b2, and b3). After I worked on b1-b3, I realized I have something to change on branch master that should be in all ot..

How do I remove my IntelliJ license in 2019.3?

I have JetBrains IntelliJ installed, how do I remove the license settings? I can find the license details in Help > Register... menu but that does not allow me to remove license settings or to ente..

Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java

I'd like to know the difference between the following in Java System.exit(0); System.exit(-1); System.exit(1); When do I have to use the above code appropriately?..

Remove element by id

When removing an element with standard JavaScript, you must go to its parent first: var element = document.getElementById("element-id"); element.parentNode.removeChild(element); Having to go to the..

OpenSSL: unable to verify the first certificate for Experian URL

I am trying to verify an SSL connection to Experian in Ubuntu 10.10 with OpenSSL client. openssl s_client -CApath /etc/ssl/certs/ -connect dm1.experian.com:443 The problem is that the connection c..

Looping Over Result Sets in MySQL

I am trying to write a stored procedure in MySQL which will perform a somewhat simple select query, and then loop over the results in order to decide whether to perform additional queries, data transf..

Getting SyntaxError for print with keyword argument end=' '

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

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

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

Find all tables containing column with specified name - MS SQL Server

Is it possible to query for table names which contain columns being LIKE '%myName%' ?..

How to create a jQuery plugin with methods?

I'm trying to write a jQuery plugin that will provide additional functions/methods to the object that calls it. All the tutorials I read online (have been browsing for the past 2 hours) include, at th..

Hashing a dictionary?

For caching purposes I need to generate a cache key from GET arguments which are present in a dict. Currently I'm using sha1(repr(sorted(my_dict.items()))) (sha1() is a convenience method that uses h..

tkinter: how to use after method

Hey I am new to python and am using tkinter for my gui. I am having trouble using the "after" method. The goal is to make a random letter appear every 5 seconds. Here is my code: import random impor..

How to bind Dataset to DataGridView in windows application

I have created Windows Application. In this, I have multiple tables in dataset, now I want to bind that to a single DataGridView. Can anybody help me?..

php string to int

$a = '88'; $b = '88 8888'; echo (int)$a; echo (int)$b; as expected, both produce 88. Anyone know if there's a string to int function that will work for $b's value and produce 888888? I've googled a..

How to get rid of "Unnamed: 0" column in a pandas DataFrame?

I have a situation wherein sometimes when I read a csv from df I get an unwanted index-like column named unnamed:0. file.csv ,A,B,C 0,1,2,3 1,4,5,6 2,7,8,9 The CSV is read with this: pd.read_c..

How do I use WPF bindings with RelativeSource?

How do I use RelativeSource with WPF bindings and what are the different use-cases?..

How do I display the current value of an Android Preference in the Preference summary?

This must come up very often. When the user is editing preferences in an Android app, I'd like them to be able to see the currently set value of the preference in the Preference summary. Example: if..

Remote Linux server to remote linux server dir copy. How?

What is the best way to copy a directory (with sub-dirs and files) from one remote Linux server to another remote Linux server? I have connected to both using SSH client (like Putty). I have root acce..

Can I change the height of an image in CSS :before/:after pseudo-elements?

Suppose I want to decorate links to certain file types using an image. I could declare my links as <a href='foo.pdf' class='pdflink'>A File!</a> then have CSS like .pdflink:after { co..

How to start Fragment from an Activity

I already want to start my RecipientFragment from my MainActivity and pass data onto the Fragment from my MainActivity. Here is the code that I have implemented. But the fragment does not start. Bund..

How can I pass a list as a command-line argument with argparse?

I am trying to pass a list as an argument to a command line program. Is there an argparse option to pass a list as option? parser.add_argument('-l', '--list', type=list, action=..

Is there an API to get bank transaction and bank balance?

I'm using CHASE bank. (Also Bank of America) and I want to get my bank transactions and my balance if I can. Is there an API for that? in PHP or JAVA? If so, please let me know how to get them...

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

I am using Python3.6, when I try to install "modules" using pip3, I am facing the below mentioned issue "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not ..

Converting from byte to int in java

I have generated a secure random number, and put its value into a byte. Here is my code. SecureRandom ranGen = new SecureRandom(); byte[] rno = new byte[4]; ranGen.nextBytes(rno); int i = rno[0].int..

Checking if a variable exists in javascript

I know there are two methods to determine if a variable exists and not null(false, empty) in javascript: 1) if ( typeof variableName !== 'undefined' && variableName ) 2) if ( window.variabl..

Get all files modified in last 30 days in a directory

CentOS. Need to find files modified in last 30 days to see if any of them have been infected with malware. I tried this: root@server [/home/someuser/public_html/]# find . -mtime +30 -exec ls -l {} ..

Best Free Text Editor Supporting *More Than* 4GB Files?

I am looking for a text editor that will be able to load a 4+ Gigabyte file into it. Textpad doesn't work. I own a copy of it and have been to its support site, it just doesn't do it. Maybe I need ..

How to load GIF image in Swift?

I have a String with an URL of GIF banner which I need to put into app. My code: func showAdd(){ Request.get("http://www.kyst.no/api/?apiMode=advertisement&lang=no", { (error: NSError?, dat..

COALESCE Function in TSQL

Can someone explain how the COALESCE function in TSQL works? The syntax is as follows COALESCE(x, y) The MSDN document on this function is pretty vague..

php REQUEST_URI

I have the following php script to read the request in URL : $id = '/' != ($_SERVER['REQUEST_URI']) ? str_replace('/?id=' ,"", $_SERVER['REQUEST_URI']) : 0; It was used when the URL is http://..

Convert double/float to string

I need to convert a floating point number to an equivalent string in decimal (or other base). Conversion at first needs to be done in the format xE+0 where x is the floating point number. The idea I ..

Stop form refreshing page on submit

How would I go about preventing the page from refreshing when pressing the send button without any data in the fields? The validation is setup working fine, all fields go red but then the page is imm..

How to get Last record from Sqlite?

I have a one table question_table and one ImageButton (Back). I need to get the last inserted record from the database after clicking on the Back. My row contains the following columns: question, op..

What’s the difference between “{}” and “[]” while declaring a JavaScript array?

What’s the difference between “{}” and “[]” while declaring a JavaScript array? Normally I declare like var a=[]; What is the meaning of declaring the array as var a={}..

Removing leading and trailing spaces from a string

How to remove spaces from a string object in C++. For example, how to remove leading and trailing spaces from the below string object. //Original string: " This is a sample string ..

HTTP GET request in JavaScript?

I need to do an HTTP GET request in JavaScript. What's the best way to do that? I need to do this in a Mac OS X dashcode widget...

SELECT * WHERE NOT EXISTS

I think I'm going down the right path with this one... Please bear with me as my SQL isn't the greatest I'm trying to query a database to select everything from one table where certain cells don't ex..

How to convert a hex string to hex number

I want to convert a hex string (ex: 0xAD4) to hex number, then to add 0x200 to that number and again want to print that number in form of 0x as a string. i tried for the first step: str(int(str(item..

How to find the statistical mode?

In R, mean() and median() are standard functions which do what you'd expect. mode() tells you the internal storage mode of the object, not the value that occurs the most in its argument. But is there..

How to calculate 1st and 3rd quartiles?

I have DataFrame: time_diff avg_trips 0 0.450000 1.0 1 0.483333 1.0 2 0.500000 1.0 3 0.516667 1.0 4 0.533333 2.0 I want to get 1st quartile, 3rd quartile and median f..

Javascript Regular Expression Remove Spaces

So i'm writing a tiny little plugin for JQuery to remove spaces from a string. see here (function($) { $.stripSpaces = function(str) { var reg = new RegExp("[ ]+","g"); return str..

How do I use raw_input in Python 3

import sys print(sys.platform) print(2**100) raw_input() I am using Python 3.1 and can't get the raw_input to "freeze" the dos pop-up. The book I'm reading is for Python 2.5 and I'm using Python 3.1..

Join a list of items with different types as string in Python

I need to join a list of items. Many of the items in the list are integer values returned from a function; i.e., myList.append(munfunc()) How should I convert the returned result to a string i..

Differences between utf8 and latin1

what is the difference between utf8 and latin1?..

Mocking member variables of a class using Mockito

I am a newbie to development and to unit tests in particular . I guess my requirement is pretty simple, but I am keen to know others thoughts on this. Suppose I have two classes like so - public..

What happens to C# Dictionary<int, int> lookup if the key does not exist?

I tried checking for null but the compiler warns that this condition will never occur. What should I be looking for?..

Converting string to double in C#

I have a long string with double-type values separated by # -value1#value2#value3# etc I splitted it to string table. Then, I want to convert every single element from this table to double type and I..

PHP foreach loop key value

I am running this DB call to get me multi-dimensional array I am trying to get the keys of each but when I try it comes up blank or as array. $root_array = array(); $sites = $this->sites($membe..

Rails 4 image-path, image-url and asset-url no longer work in SCSS files

Are we supposed to use something else aside from image-url and others in Rails 4? They return different values that don't seem to make sense. If I have logo.png in /app/assets/images/logo.png and I do..

Difference between Static methods and Instance methods

I was just reading over the text given to me in my textbook and I'm not really sure I understand what it is saying. It's basically telling me that static methods or class methods include the "mod..

Parsing json and searching through it

I have this code import json from pprint import pprint json_data=open('bookmarks.json') jdata = json.load(json_data) pprint (jdata) json_data.close() How can I search through it for u'uri': u'http..

Angularjs -> ng-click and ng-show to show a div

I am trying just to display a div when user press a button, seems to be easy, but after spent a lot of time I am getting really crazy with this. My code is My fiddle: http://jsfiddle.net/jmhostalet/..

Is there a way to delete created variables, functions, etc from the memory of the interpreter?

I've been searching for the accurate answer to this question for a couple of days now but haven't got anything good. I'm not a complete beginner in programming, but not yet even on the intermediate le..

Where to find Application Loader app in Mac?

I have downloaded applicationloader_1.3.dmg and installed in the destination Macintosh HD. The messages show The installation was successfully done. But, there is the ApplicationLoader app that does..

input() error - NameError: name '...' is not defined

I am getting an error when I try to run this simple script: input_variable = input ("Enter your name: ") print ("your name is" + input_variable) Let's say I type in "dude", the error I am getting i..

Adding content to a linear layout dynamically?

If for example I have defined a root linear layout whose orientation is vertical: main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/ap..

How to draw a circle with given X and Y coordinates as the middle spot of the circle?

I have developed a telecommunication application for locating signal strengths from the towers. I have used java swing and I'm having a problem when drawing the circle around the given point of the mo..

Complex nesting of partials and templates

My question involves how to go about dealing with complex nesting of templates (also called partials) in an AngularJS application. The best way to describe my situation is with an image I created: ..

Implement touch using Python?

touch is a Unix utility that sets the modification and access times of files to the current time of day. If the file doesn't exist, it is created with default permissions. How would you implement it..

How to get the current location in Google Maps Android API v2?

Using mMap.setMyLocationEnabled(true) can set the myLocation layer enable. But the problem is how to get the myLocation when the user clicks on the button? I want to get the longitude and latitude..

Pandas: Convert Timestamp to datetime.date

I have a pandas column of Timestamp data In [27]: train["Original_Quote_Date"][6] Out[27]: Timestamp('2013-12-25 00:00:00') How can check equivalence of these objects to datetime.date objects of t..

React won't load local images

I am building a small react app and my local images won't load. Images like placehold.it/200x200 loads. I thought maybe it could be something with the server? Here is my App.js import React, { Compo..

How to list the contents of a package using YUM?

I know how to use rpm to list the contents of a package (rpm -qpil package.rpm). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use..

Can we update primary key values of a table?

Can we update primary key values of a table?..

.do extension in web pages?

I want to know what is .do extension in web pages. Is it a standard extension, or, if it's not, can we change the extension (like client-login.php to client-login.do and still run as PHP)? Thanks...

Windows task scheduler error 101 launch failure code 2147943785

I'm trying to schedule my C# program to run on Windows scheduler. I'm using, Windows 7 Professional. I can create the task security options set to run whether or not the user is logged in, gave it hi..

What is setBounds and how do I use it?

I cannot find anything on setBounds, what it is for, or what its function actually is. Could someone clear me up on this? Thanks so much!..

How to submit http form using C#

I have a simple html file such as <form action="http://www.someurl.com/page.php" method="POST"> <input type="text" name="test"><br/> <input type="submit" name="submit"> ..

What is the difference between attribute and property?

These seem to mean the same thing. But what term is more appropriate in what context?..

Format numbers in django templates

I'm trying to format numbers. Examples: 1 => 1 12 => 12 123 => 123 1234 => 1,234 12345 => 12,345 It strikes as a fairly common thing to do but I can't figure out which filt..

Call and receive output from Python script in Java?

What's the easiest way to execute a Python script from Java, and receive the output of that script? I've looked for different libraries like Jepp or Jython, but most appear out of date. Another proble..

Flash CS4 refuses to let go

I have a Flash project, and it has many source files. I have a fairly heavily-used class, call it Jenine. I recently (and, perhaps, callously) relocated Jenine from one namespace to another. I thought..

Getting random numbers in Java

I would like to get a random value between 1 to 50 in Java. How may I do that with the help of Math.random();? How do I bound the values that Math.random() returns?..

'Invalid update: invalid number of rows in section 0

I've read all of the related posts regarding this and I am still having an error: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the ..

PHP and MySQL Select a Single Value

I'd like to know how to select a single value from my MySQL table. The table includes columns username and id amongst others (id is auto-increment and username is unique). Given the username, I want t..

setTimeout in React Native

I'm trying to load a splash screen for an iOS app built in React Native. I'm trying to accomplish this through class states and then a setTimeout function as follows: class CowtanApp extends Compon..

Repair all tables in one go

How to check all the tables in the database in one go? Rather than typing the query check table ''tablename''; for all the tables one by one. Is there any simple command like check all or anything l..

Jenkins: Failed to connect to repository

I'm trying to connect jenkins on a github repo. When I specify the Repo URL jenkins return the following error message: Failed to connect to repository : Command "git ls-remote -h [email protected]..

How do I apply a style to all children of an element

I have an element with class='myTestClass'. How do I apply a css style to all children of this elements? I only want to apply the style to the elements children. Not its grand children. I could use ..

Install a Windows service using a Windows command prompt?

I want to install a Windows service using a Windows command prompt (not the Visual Studio command prompt). How do I do this?..

checking if number entered is a digit in jquery

I have a simple textbox in which users enter number. Does jQuery have a isDigit function that will allow me to show an alert box if users enter something other than digits? The field can have decimal..

How do you perform address validation?

Is it even possible to perform address (physical, not e-mail) validation? It seems like the sheer number of address formats, even in the US alone, would make this a fairly difficult task. On the oth..

System.Collections.Generic.IEnumerable' does not contain any definition for 'ToList'

Here is the problem. I am getting IEnumerable from ViewPage and when I tried it to convert List it is showing me error like: 'System.Collections.Generic.IEnumerable<Pax_Detail>' does not con..

Using true and false in C

As far as I can see there are 3 ways to use booleans in c with the bool type, from then using true and false defining using preprocessor #define FALSE 0 ... #define TRUE !(FALSE) Just to use consta..

If greater than batch files

I wrote a simple batch file to run Frequently Used websites based on a number selection. Here's the code I have. I am trying to set it so if someone inputs a number 6 or greater it will go to :N but w..

Excel: macro to export worksheet as CSV file without leaving my current Excel sheet

There are a lot of questions here to create a macro to save a worksheet as a CSV file. All the answers use the SaveAs, like this one from SuperUser. They basically say to create a VBA function like th..

How to mock a final class with mockito

I have a final class, something like this: public final class RainOnTrees{ public void startRain(){ // some code here } } I am using this class in some other class like this: publi..

How to set the maximum memory usage for JVM?

I want to limit the maximum memory used by the JVM. Note, this is not just the heap, I want to limit the total memory used by this process...

Duplicate symbols for architecture x86_64 under Xcode

I now have the same question with above title but have not found the right answer yet. I got the error: /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooy..

How to execute a JavaScript function when I have its name as a string

I have the name of a function in JavaScript as a string. How do I convert that into a function pointer so I can call it later? Depending on the circumstances, I may need to pass various arguments int..

Strange Jackson exception being thrown when serializing Hibernate object

Jackson is throwing a weird exception that I don't know how to fix. I'm using Spring, Hibernate and Jackson. I have already considered that lazy-loading is causing the problem, but I have taken measu..

Checking network connection

I want to see if I can access an online API, but for that I need to have Internet access. How can I see if there's a connection available and active using Python?..

Difference between spring @Controller and @RestController annotation

Difference between spring @Controller and @RestController annotation. Can @Controller annotation be used for both Web MVC and REST applications? If yes, how can we differentiate if it is Web MVC or R..

Sharing url link does not show thumbnail image on facebook

I have some example url that provide for facebook sharing. But the image inside the url page does not show on facebook comment box. I have already inserted Meta tag like this <meta property="fb:ap..

Oracle PL/SQL : remove "space characters" from a string

In my Oracle 10g database I would like to remove "space characters" (spaces, tabs, carriage returns...) from the values of a table field. Is TRANSLATE() the way to go ? For example something like: M..

How to convert Java String to JSON Object

This question has been asked earlier, but I am unable to figure out the error in my code from the responses to those questions. I am trying to convert a java string into json object. Here is the co..

ASP.NET GridView RowIndex As CommandArgument

How can you access and display the row index of a gridview item as the command argument in a buttonfield column button? <gridview> <Columns> <asp:ButtonField ButtonType="Button" ..

Permission denied error on Github Push

Recently, I'm added as a member/contributor for Github project. I have cloned that project on local machine. I have made some changes and committed locally and now trying to Push changes to original ..

Silent installation of a MSI package

I have a MSI package that I need to install if the package is not already installed. Also I need to install it silently. The package prompts user for: Installation location (C:\Program Files\Foobar)..

Subtracting two lists in Python

In Python, How can one subtract two non-unique, unordered lists? Say we have a = [0,1,2,1,0] and b = [0, 1, 1] I'd like to do something like c = a - b and have c be [2, 0] or [0, 2] order doesn't matt..

How does createOrReplaceTempView work in Spark?

I am new to Spark and Spark SQL. How does createOrReplaceTempView work in Spark? If we register an RDD of objects as a table will spark keep all the data in memory? ..

LaTeX: Prevent line break in a span of text

How can I prevent LaTeX from inserting linebreaks in my \texttt{...} or \url{...} text regions? There's no spaces inside I can replace with ~, it's just breaking on symbols. Update: I don't want to ..

What's the best way to override a user agent CSS stylesheet rule that gives unordered-lists a 1em margin?

I'm working on a web app that has a topBar similar to facebook's blue bar at the top. I have an unordered list within the div of that bar to list some items, like Inbox, Notifications, etc. The UL ha..

Extract year from date

How can I remove the first elements from a variable, especially if this variable has a special characters. For example, I have the following column: Date 01/01/2009 01/01/2010 01/01/2011 01/01/2012 ..

Java Compare Two List's object values?

I have two list **ListA<MyData> listA = new ArrayList<MyData>()** and ListB<MyData> listB = new ArrayList<MyData>() both contain object of type MyData and MyData contain these ..

How to convert NSDate into unix timestamp iphone sdk?

How to convert an NSDate into Unix timestamp? I've read many posts which do the reverse. But I'm not finding anything related to my question...

Loading inline content using FancyBox

Well, I'm simply writing this post to hopefully help others that might come across the same issue. The examples on the vendor website are a little vague and I had assumed the following scenario. Y..

Joining two lists together

If I have two lists of type string (or any other type), what is a quick way of joining the two lists? The order should stay the same. Duplicates should be removed (though every item in both links are..

Get the filename of a fileupload in a document through JavaScript

var fu1 = document.getElementById("FileUpload1"); How can I get the filename of the fileupload control with id FileUpload1?..

Redirect Windows cmd stdout and stderr to a single file

I'm trying to redirect all output (stdout + stderr) of a DOS command to a single file: C:\>dir 1> a.txt 2> a.txt The process cannot access the file because it is being used by another proces..

How to clear the cache of nginx?

I use nginx to as the front server, I have modified the CSS files, but nginx is still serving the old ones. I have tried to restart nginx, to no success and I have Googled, but not found a valid way ..

Converting A String To Hexadecimal In Java

I am trying to convert a string like "testing123" into hexadecimal form in java. I am currently using BlueJ. And to convert it back, is it the same thing except backward?..

The type WebMvcConfigurerAdapter is deprecated

I just migrate to spring mvc version 5.0.1.RELEASE but suddenly in eclipse STS WebMvcConfigurerAdapter is marked as deprecated public class MvcConfig extends WebMvcConfigurerAdapter { @Override ..

C++: How to round a double to an int?

I have a double (call it x), meant to be 55 but in actuality stored as 54.999999999999943157 which I just realised. So when I do double x = 54.999999999999943157; int y = (int) x; y = 54 instead ..

subsampling every nth entry in a numpy array

I am a beginner with numpy, and I am trying to extract some data from a long numpy array. What I need to do is start from a defined position in my array, and then subsample every nth data point from t..

How to break nested loops in JavaScript?

I tried this: for(i = 0; i < 5; i++){ for(j = i + 1; j < 5; j++){ break(2); } alert(1); } only to get: SyntaxError: missing ; before statement So, how would I break ..

Writing files in Node.js

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