Questions Tagged with #Imagefield

"Post Image data using POSTMAN"

I am trying to POST data to my API. I have a model with an image field where: image = models.ImageField() I have an image on my local box, which I am trying to send. Am I sending it correctly? { ..

Django: OperationalError No Such Table

I'm building a fairly simple application, research, in my Django project that uses Django-CMS. (It's my first ground-up attempt at a project/application.) It's main purpose is to store various intel..

Django. Override save for model

Before saving model I'm re-size a picture. But how can I check if new picture added or just description updated, so I can skip rescaling every time the model is saved? class Model(model.Model): i..

When saving, how can you check if a field has changed?

In my model I have : class Alias(MyBaseModel): remote_image = models.URLField(max_length=500, null=True, help_text="A URL that is downloaded and cached for the image. Only used when the alias is..

Programmatically saving image to Django ImageField

Ok, I've tried about near everything and I cannot get this to work. I have a Django model with an ImageField on it I have code that downloads an image via HTTP (tested and works) The image is saved ..

WPF: ItemsControl with scrollbar (ScrollViewer)

I followed this small "tutorial" on how to add a scrollbar to an ItemsControl, and it works in Designer view, but not when I compile and execute the program (only the first few items show up, and no s..

Java: how to represent graphs?

I'm implementing some algorithms to teach myself about graphs and how to work with them. What would you recommend is the best way to do that in Java? I was thinking something like this: public class ..

How do you input command line arguments in IntelliJ IDEA?

I usually input command line arguments in Eclipse via run configuration. But I don't know how do achieve the same task in IntelliJ IDEA...

How to return value from Action()?

In regards to the answer for this question Passing DataContext into Action(), how do I return a value from action(db)? SimpleUsing.DoUsing(db => { // do whatever with db }); Should be more li..

How to iterate over associative arrays in Bash

Based on an associative array in a Bash script, I need to iterate over it to get the key and value. #!/bin/bash declare -A array array[foo]=bar array[bar]=foo I actually don't understand how to ge..

Override standard close (X) button in a Windows Form

How do I go about changing what happens when a user clicks the close (red X) button in a Windows Forms application (in C#)?..

How to pass a parameter to Vue @click event handler

I am creating a table using Vue.js and I want to define an onClick event for each row that passes contactID. Here is the code: <tr v-for="item in items" class="static" v-bind:class="{'evenRo..

How do I set the figure title and axes labels font size in Matplotlib?

I am creating a figure in Matplotlib like this: from matplotlib import pyplot as plt fig = plt.figure() plt.plot(data) fig.suptitle('test title') plt.xlabel('xlabel') plt.ylabel('ylabel') fig.savefi..

How to debug stored procedures with print statements?

I am trying to debug stored procedures in SQL Server Management Studio 2008. I want to insert some print statements to test some IF-statements that I know are wrong. In order to do debugging, I tried..

Move existing, uncommitted work to a new branch in Git

I started some work on a new feature and after coding for a bit, I decided this feature should be on its own branch. How do I move the existing uncommitted changes to a new branch and reset my curre..

Cannot push to GitHub - keeps saying need merge

I'm new to GitHub. Today I met some issue when I was trying to push my code to GitHub. Pushing to [email protected]:519ebayproject/519ebayproject.git To g[email protected]:519ebayproject/519ebayproject.git ..

CSS '>' selector; what is it?

I've seen the "greater than" (>) used in CSS code a few times, but I can't work out what it does. What does it do?..

How to know Hive and Hadoop versions from command prompt?

How can I find which Hive version I am using from the command prompt. Below is the details- I am using Putty to connect to hive table and access records in the tables. So what I did is- I opened Putt..

Rendering an array.map() in React

I am having a problem where I am trying to use array of data to render a <ul> element. In the code below the console.log's are working fine, but the list items aren't appearing. var Main = Rea..

Regular expression for extracting tag attributes

I'm trying to extract the attributes of a anchor tag (<a>). So far I have this expression: (?<name>\b\w+\b)\s*=\s*("(?<value>[^"]*)"|'(?<value>[^']*)'|(?<value>[^"'<&..

how to print an exception using logger?

I have a situation in which I want to print all the exception caught in catch block using logger. try { File file = new File("C:\\className").mkdir(); fh = new FileHandler("C:\\class..

php $_GET and undefined index

A new problem has arisen for me as I tried to run my script on a different PHP Server. ON my old server the following code appears to work fine - even when no s parameter is declared. <?php if..

Event system in Python

What event system for Python do you use? I'm already aware of pydispatcher, but I was wondering what else can be found, or is commonly used? I'm not interested in event managers that are part of larg..

java collections - keyset() vs entrySet() in map

I put a string array elements is a map where elements of string array is key and frequency of word is value, e.g.: String[] args = {"if","it","is","to","be","it","is","up","me","to","delegate"}; ..

Bad Request, Your browser sent a request that this server could not understand

There are two application servers and a switch. When i access application by using application server ip it works fine. However if i use switch ip in my url Bad request error throws up only for firefo..

Setting focus to iframe contents

I have a page with a document.onkeydown event handler, and I'm loading it inside an iframe in another page. I have to click inside the iframe to get the content page to start "listening". Is there s..

Enable/disable buttons with Angular

I'm making an web-app in angular 4 and there is a question i came up with. It's the following: I use a property called currentLesson. This property has a variable number from 1 to 6. In my component..

How to unpack an .asar file?

I have packed my Electron application using the following command: asar pack app app.asar Now, I need to unpack it and get the whole code back. Is there any way to do so?..

Convert Long into Integer

How to convert a Long value into an Integer value in Java?..

Should I use `import os.path` or `import os`?

According to the official documentation, os.path is a module. Thus, what is the preferred way of importing it? # Should I always import it explicitly? import os.path Or... # Is importing os enough..

Vagrant error : Failed to mount folders in Linux guest

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

PHP: merge two arrays while keeping keys instead of reindexing?

How can I merge two arrays (one with string => value pairs and another with int => value pairs) while keeping the string/int keys? None of them will ever overlap (because one has only strings and the ..

How do I create a SQL table under a different schema?

This is from SQL Server 2008, ssms When I create a table, it creates under dbo. I would like to create it under a different schema, but when I use the 'New Table' dialog, I can never find the field ..

setBackground vs setBackgroundDrawable (Android)

I want to set background drawable of a view. There are two methods for this (as far as I see): setBackground and setBackgroundDrawable. When I use setBackground, it says it has been added in API lev..

How to convert a negative number to positive?

How can I convert a negative number to positive in Python? (And keep a positive one.)..

How to select the first row for each group in MySQL?

In C# it would be like this: table .GroupBy(row => row.SomeColumn) .Select(group => group .OrderBy(row => row.AnotherColumn) .First() ) Linq-To-Sql translates it to ..

Cannot use object of type stdClass as array?

I get a strange error using json_decode(). It decode correctly the data (I saw it using print_r), but when I try to access to info inside the array I get: Fatal error: Cannot use object of type stdCl..

How to change xampp localhost to another folder ( outside xampp folder)?

How can I change my default xampp localhost c:xampp/htdoc to another folder i.e. c:/alan? When I use the IP address I should be able to view my website file in C:/alan. Thanks for helping me...

How to make an authenticated web request in Powershell?

In C#, I might do something like this: System.Net.WebClient w = new System.Net.WebClient(); w.Credentials = new System.Net.NetworkCredential(username, auth, domain); string webpage = w.DownloadString..

Android lollipop change navigation bar color

In my app I need to change the bottom navigation bar color. I watched many post but cant find with the solution. I am using appCompat library. v21/styles.xml <style name="AppTheme" parent="Them..

UTF-8 output from PowerShell

I'm trying to use Process.Start with redirected I/O to call PowerShell.exe with a string, and to get the output back, all in UTF-8. But I don't seem to be able to make this work. What I've tried: P..

How to print variable addresses in C?

When i run this code. #include <stdio.h> void moo(int a, int *b); int main() { int x; int *y; x = 1; y = &x; printf("Address of x = %d, value of x = %d\n", &x, ..

Error: [$injector:unpr] Unknown provider: $routeProvider

I am trying to get an AngularJS 1.2 RC2 app up and running. Currently, I've been using the Angular Seed project to try and get my app up and running. Unfortunately, the Angular Seed project uses v1.0...

SQL Server database restore error: specified cast is not valid. (SqlManagerUI)

I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localhost as a database. Few days..

Android API 21 Toolbar Padding

How do I get rid of the extra padding in the new Toolbar with Android SDK API version 21 (the support library)? I am talking about the red arrows on this picture: Here is the code I am using: <..

The name does not exist in the namespace error in XAML

Using VS2012 working on a VB.NET WPF application. I have a simple MusicPlayer tutorial app I am using to learn WPF. I am converting a C# version of the tutorial to VB.NET step by step. It has 2 c..

Java switch statement multiple cases

Just trying to figure out how to use many multiple cases for a Java switch statement. Here's an example of what I'm trying to do: switch (variable) { case 5..100: doSomething(); break..

Shorter syntax for casting from a List<X> to a List<Y>?

I know its possible to cast a list of items from one type to another (given that your object has a public static explicit operator method to do the casting) one at a time as follows: List<Y> Li..

How to delete/remove nodes on Firebase

I'm using Firebase for a web app. It's written in plain Javascript using no external libraries. I can "push" and retrieve data with '.on("child_added")', but '.remove()' does not work the way it says..

no debugging symbols found when using gdb

GNU gdb Fedora (6.8-37.el5) Kernal 2.6.18-164.el5 I am trying to debug my application. However, everytime I pass the binary to the gdb it says: (no debugging symbols found) Here is the file ou..

Change the background color of a pop-up dialog

I wrote android code that shows a pop-up dialog but I want to change the background color from black to white , and then the color of the writing. This is the dialog's code: mPrefs = PreferenceMana..

What is std::move(), and when should it be used?

What is it? What does it do? When should it be used? Good links are appreciated...

Rendering React Components from Array of Objects

I have some data called stations which is an array containing objects. stations : [ {call:'station one',frequency:'000'}, {call:'station two',frequency:'001'} ] I'd like to render a ui componen..

Mean per group in a data.frame

I have a data.frame and I need to calculate the mean per group (i.e. per Month, below). Name Month Rate1 Rate2 Aira 1 12 23 Aira 2 18 73 Aira 3 ..

Use formula in custom calculated field in Pivot Table

In Excel Pivot table report there is possibility for user intervention by inserting "Calculated Field" so that user can further manipulate the report. This seems like best approach compared to using f..

Best way to check if an PowerShell Object exist?

I am looking for the best way to check if a Com Object exists. Here is the code that I have; I'd like to improve the last line: $ie = New-Object -ComObject InternetExplorer.Application $ie.Navigate(..

Set bootstrap modal body height by percentage

I am trying to make a modal with a body that will scroll when the content becomes too large. However, I want the modal to be responsive to the screen size. When I set the max-height to 40% it has no e..

Text size of android design TabLayout tabs

I have difficulties changing the text size of the tabs of design library tablayout (android.support.design.widget.TabLayout). I managed to change it by assigning tabTextAppearance in TabLayout app:..

Command to escape a string in bash

I need a bash command that will convert a string to something that is escaped. Here's an example: echo "hello\world" | escape | someprog Where the escape command makes "hello\world" into "hello\\\..

How to use git merge --squash?

I have a remote Git server, here is the scenario which I want to perform: For each bug/feature I create a different Git branch I keep on committing my code in that Git branch with un-official Git me..

Convert special characters to HTML in Javascript

Does any one know how to convert special characters to HTML in Javascript? Example: & (ampersand) becomes &amp. " (double quote) becomes &quot when ENT_NOQUOTES is not set. ' (single qu..

Drawing a dot on HTML5 canvas

Drawing a line on the HTML5 canvas is quite straightforward using the context.moveTo() and context.lineTo() functions. I'm not quite sure if it's possible to draw a dot i.e. color a single pixel. The..

Meaning of delta or epsilon argument of assertEquals for double values

I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public static void assertEquals(double expected, double actual) Deprecated. Use assertEqu..

Can you test google analytics on a localhost address?

I have to test out my new GA account on my local machine. Will this work just by copying the standard snippet supplied by Google onto the page ? I don't want to spend 24 hours waiting to see if it..

Parsing a YAML file in Python, and accessing the data?

I am new to YAML and have been searching for ways to parse a YAML file and use/access the data from the parsed YAML. I have come across explanations on how to parse the YAML file, for example, the P..

Count work days between two dates

How can I calculate the number of work days between two dates in SQL Server? Monday to Friday and it must be T-SQL...

Responsive Images with CSS

I'm finding it tricky to resize images to make them responsive. I'm developing a php application to automatically convert a website to a responsive version. I'm a little stuck on the images. I've su..

List all employee's names and their managers by manager name using an inner join

The following is my CREATE TABLE script: create table EMPLOYEES (EmpID char(4) unique Not null, Ename varchar(10), Job varchar(9), MGR char(4), Hiredat..

How do I get the coordinates of a mouse click on a canvas element?

What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)? No legacy browser compatibility requir..

Entity framework self referencing loop detected

I have a strange error. I'm experimenting with a .NET 4.5 Web API, Entity Framework and MS SQL Server. I've already created the database and set up the correct primary and foreign keys and relationshi..

How can I flush GPU memory using CUDA (physical reset is unavailable)

My CUDA program crashed during execution, before memory was flushed. As a result, device memory remained occupied. I'm running on a GTX 580, for which nvidia-smi --gpu-reset is not supported. Placin..

Parcelable encountered IOException writing serializable object getactivity()

so I am getting this in logcat: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.resources.student_list.Student) I know this means that my stud..

Find commit by hash SHA in Git

I need to find a commit in Git by a given hash, SHA. For example, if I have the "a2c25061" hash, and I need to get the author and the committer of this commit. What is the command to get that?..

Laravel Fluent Query Builder Join with subquery

Okay after hours of research and still using DB::select I have to ask this question. Because I am about to trough my computer away ;). I want to get the last input of a user (base on the timestamp). ..

Angular2 RC5: Can't bind to 'Property X' since it isn't a known property of 'Child Component'

I have a small Angular2 project based on the Angular2 Seed project that I am trying to upgrade to Angular2 RC5. My project has a few features, one of them called home. Home component uses a child co..

How to check if a value exists in a dictionary (python)

I have the following dictionary in python: d = {'1': 'one', '3': 'three', '2': 'two', '5': 'five', '4': 'four'} I need a way to find if a value such as "one" or "two" exists in this dictionary. F..

gdb: "No symbol table is loaded"

I keep getting this error mesage when trying to add a breakpoint in gdb. I've used these commands to compile: gcc -g main.c utmpib2.c -o main.o and: cc -g main.c utmpib2.c -o main.o and also: g++ -g..

href="tel:" and mobile numbers

If I use tel: I should write the international phone code, like that. <a href="tel:+6494461709">61709</a> So far, so good, but I can't find information on how to write a cell phone numb..

Checking if an Android application is running in the background

By background, I mean none of the application's activities are currently visible to the user?..

Using braces with dynamic variable names in PHP

I'm trying to use dynamic variable names (I'm not sure what they're actually called) But pretty much like this: for($i=0; $i<=2; $i++) { $("file" . $i) = file($filelist[$i]); } var_dump($file..

Returning JSON response from Servlet to Javascript/JSP page

I think (actually I KNOW!) I'm doing something wrong here I am trying to populate some values into HashMap and add each hasmap to a list which will be added to a JSON object: JSONObject json = new JS..

How to add Headers on RESTful call using Jersey Client API

Here is the Format for RESTful call: HEADERS: Content-Type: application/json;charset=UTF-8 Authorization: Bearer Rc7JE8P7XUgSCPogjhdsVLMfITqQQrjg REQUEST: GET https://api.example.com/1/r..

How to call two methods on button's onclick method in HTML or JavaScript?

How to call two methods on button's onclick method in HTML or JavaScript ?..

How to change the version of the 'default gradle wrapper' in IntelliJ IDEA?

I want to use Gradle 1.10 instead of 1.9. I cannot seem to find where to change this. If I put this: task wrapper(type: Wrapper) { gradleVersion = '1.10' } in my build.gradle and rebuild, it i..

How do I pass a string into subprocess.Popen (using the stdin argument)?

If I do the following: import subprocess from cStringIO import StringIO subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0] I..

Adding background image to div using CSS

I have been trying to add background image to a div class using CSS, but I didn't have any success. HTML code: <header id="masthead" class="site-header" role="banner"&..

Get all rows from SQLite

I have been trying to get all rows from the SQLite database. But I got only last row from the following codes. FileChooser class: public ArrayList<String> readFileFromSQLite() { fileName =..

inject bean reference into a Quartz job in Spring?

I managed to configure and schedule a Quartz job using JobStoreTX persistent store in Spring. I do not use Spring's Quartz jobs, because I need to schedule them dynamically, at run time, and all exam..

adb remount permission denied, but able to access super user in shell -- android

so, i'm trying to push some files to /system on android device (zte) I've rooted, connected with ADB, adb remount -> I get permission denied adb shell su -> I'm able to access shell and create folde..

Changing every value in a hash in Ruby

I want to change every value in a hash so as to add '%' before and after the value so { :a=>'a' , :b=>'b' } must be changed to { :a=>'%a%' , :b=>'%b%' } What's the best way to do thi..

How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()?

I am trying to parse url-encoded strings that are made up of key=value pairs separated by either & or &amp;. The following will only match the first occurrence, breaking apart the keys and v..

Convert Decimal to Varchar

I have a decimal column in a table defined as decimal(8,3). I would like to include this column in a Select statement, convert it to a Varchar and only display two decimal places. I can't seem to find..

Angular 2 optional route parameter

Is it possible to have an optional route parameter in the Angular 2 route? I tried the Angular 1.x syntax in RouteConfig but received below error: "ORIGINAL EXCEPTION: Path "/user/:id?" contains ..

What's the strangest corner case you've seen in C# or .NET?

I collect a few corner cases and brain teasers and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example,..

How can I check whether a option already exist in select by JQuery

How can I check whether a option already exist in select by JQuery? I want to dynamically add options into select and so I need to check whether the option is already exist to prevent duplication...

Simplest way to merge ES6 Maps/Sets?

Is there a simple way to merge ES6 Maps together (like Object.assign)? And while we're at it, what about ES6 Sets (like Array.concat)?..

Deprecated Java HttpClient - How hard can it be?

All I'm trying to do is download some JSON and deserialize it into an object. I haven't got as far as downloading the JSON yet. Almost every single HttpClient example I can find, including those on t..

Alter SQL table - allow NULL column value

Initially, the table "MyTable" has been defined in the following way: CREATE TABLE IF NOT EXISTS `MyTable` ( `Col1` smallint(6) NOT NULL AUTO_INCREMENT, `Col2` smallint(6) DEFAULT NULL, `Col3` ..

calling Jquery function from javascript

How can i call a jQuery function from javascript? //jquery $(function() { function my_fun(){ /.. some operations ../ } }); //just js function js_fun () { ..

Create Table from View

I have a view that I want to create a table from in SQL Enterprise Manager, but I always get an error when I run this query: CREATE TABLE A AS (SELECT top 10 FROM dbo.myView) So far the error is: ..

Reading specific columns from a text file in python

I have a text file which contains a table comprised of numbers e.g: 5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6 if for example I want the numbers contained only in the second column, how do i extract ..

Remove legend ggplot 2.2

I'm trying to keep the legend of one layer (smooth) and remove the legend of the other (point). I have tried shutting off the legends with guides(colour = FALSE) and geom_point(aes(color = vs), show.l..

An "and" operator for an "if" statement in Bash

I'm trying to create a simple Bash script to check if the website is down and for some reason the "and" operator doesn't work: #!/usr/bin/env bash WEBSITE=domain.com SUBJECT="$WEBSITE DOWN!" EMAILID..

How to zoom in/out an UIImage object when user pinches screen?

I would like to zoom in/out an UIImage object when the user performs the standard pinch action on my application. I'm currently using a UIImageView to display my image, if that detail helps in any way..

Getting value GET OR POST variable using JavaScript?

How to get value of the get or post variable on page load using JavaScript?..

Custom Listview Adapter with filter Android

Please am trying to implement a filter on my listview. But whenever the text change, the list disappears.Please Help Here are my codes. The adapter class. package com.talagbe.schymn; import java.ut..

insert/delete/update trigger in SQL server

I am trying to produce an all-in-one delete/insert/update trigger. I get two "incorrect syntax near AFTER at the second and third AFTERS and a syntax error near the last END. CREATE TRIGGER trig_all..

WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

I am trying to launch chrome with an URL, the browser launches and it does nothing after that. I am seeing the below error after 1 minute: Unable to open browser with url: 'https://www.google.com' ..

How can I find and run the keytool

I am reading an development guide of Facebook Developers at here It says that I must use keytool to export the signature for my app such as: keytool -exportcert -alias androiddebugkey -keystore ~/...

How to declare a variable in a template in Angular

I have the following template : <div> <span>{{aVariable}}</span> </div> and would like to end up with : <div "let a = aVariable"> <span>{{a}}</spa..

How to detect if a browser is Chrome using jQuery?

I have a bit of an issue with a function running in chrome that works properly in Safari, both webkit browsers... I need to customize a variable in a function for Chrome, but not for Safari. Sadly, ..

How do I "commit" changes in a git submodule?

I have, in my naivety, set up a git submodule and treated it like a Subversion external - i.e. it's now full of changes that I've just realized haven't been committed or pushed anywhere. Is there som..

How to connect HTML Divs with Lines?

On my page I have a set of div elements that should be connected with lines like I showed in the image below. I know that with a canvas I can draw lines between these elements, but is it possible to d..

How to justify navbar-nav in Bootstrap 3

I'm attempting to justify a navbar (make the navbar contents stretch) in Bootstrap 3. I've added margin: 0 auto; max-width: 1000px; to the nav* classes, and also attempted to add a container element a..

Selecting empty text input using jQuery

How do I identify empty textboxes using jQuery? I would like to do it using selectors if it is at all possible. Also, I must select on id since in the real code where I want to use this I don't want t..

Get current URL/URI without some of $_GET variables

How, in Yii, to get the current page's URL. For example: http://www.yoursite.com/your_yii_application/?lg=pl&id=15 but excluding the $GET_['lg'] (without parsing the string manually)? I mean, ..

How to install "ifconfig" command in my ubuntu docker image?

I've just installed ubuntu docker image, when I execute "ifconfig" it says there's no such command, I tried apt-get install by there's no package named "ifconfig"(I can install some other images). So..

Change default text in input type="file"?

I want to change default text on button that is "Choose File" when we use input="file". How can I do this? Also as you can see in image button is on left side of text. How can I put it on right sid..

Can't install any package with node npm

I'm trying to install some node packages through npm, but it won't go. I've already tried to install/unistall/update node, but nothing seems to work. I'm using ubuntu 12.04 - Here is how i'm trying t..

How to securely save username/password (local)?

I'm making a Windows application, which you need to log into first. The account details consist of username and password, and they need to be saved locally. It's just a matter of security, so other p..

How to get the current time as datetime

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

Resize UIImage and change the size of UIImageView

I have this UIImageView and I have the values of its max height and max width. What I want to achieve is that I want to take the image (with any aspect ratio and any resolution) and I want it to fit i..

in python how do I convert a single digit number into a double digits string?

So say i have a = 5 i want to print it as a string '05'..

Asp.net 4.0 has not been registered

When I try to open my Visual Studio project I get the following error: Asp.Net has not been registered on the webserver you need to manually configure your webserver for Asp.net 4.0. Update: N..

Strings and character with printf

I was confused with usage of %c and %s in the following C program #include <stdio.h> void main() { char name[]="siva"; printf("%s\n",name); printf("%c\n..

A cycle was detected in the build path of project xxx - Build Path Problem

I'm in the process of converting my projects to OSGI bundles using maven and eclipse. Maven builds the stuff just fine, only I get the above error now within Eclipse. How can I find out which project ..

How do I find an element position in std::vector?

I need to find an element position in an std::vector to use it for referencing an element in another vector: int find( const vector<type>& where, int searchParameter ) { for( int i = 0;..

You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application

I am working on Django project with virtualenv and connect it to local postgres database. when i run the project is says, ImportError: No module named psycopg2.extensions then i used this command t..

How to handle the modal closing event in Twitter Bootstrap?

In Twitter bootstrap, looking at the modals documentation. I wasn't able to figure out if there is a way to listen to the close event of the modal and execute a function. e.g. lets take this modal as..

Python: OSError: [Errno 2] No such file or directory: ''

I have a 100 lines, 3 years old python scraper that now bug. Starting lines are: import urllib, re, os, sys, time # line 1: import modules os.chdir(os.path.dirname(sys.argv[0])) # line 2: all work..

Insert Multiple Rows Into Temp Table With SQL Server 2012

These StackOverflow questions here, here, and here all say the same thing, but I can't get it to run in SSMS or SQLFiddle CREATE TABLE #Names ( Name1 VARCHAR(100), Name2 VARCHAR(100) ) ..

Is it possible to center text in select box?

I tried this: http://jsfiddle.net/ilyaD/KGcC3/ HTML: <select name="state" class="ddList"> <option value="">(please select a state)</option> <option class="lt" value="--"..

Update MySQL version from 5.1 to 5.5 in CentOS 6.2

I tried to update MySQL from 5.1 to 5.5 in CentOS 6.2. The following is the process I did: 1. rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm 2. yum install libmysqlclient15 --enablerepo=we..

How to remove leading zeros from alphanumeric text?

I've seen questions on how to prefix zeros here in SO. But not the other way! Can you guys suggest me how to remove the leading zeros in alphanumeric text? Are there any built-in APIs or do I need to..

Know relationships between all the tables of database in SQL Server

I wish to all know how the tables in my database are related to each other (i.e PK/FK/UK) and hence i created a database diagram of all my tables in SQL Server. The diagram that was created was not ea..

JavaScript/jQuery - How to check if a string contain specific words

$a = 'how are you'; if (strpos($a,'are') !== false) { echo 'true'; } In PHP, we can use the code above to check if a string contain specific words, but how can I do the same function in JavaScri..

Why doesn't JavaScript support multithreading?

Is it a deliberate design decision or a problem with our current day browsers which will be rectified in the coming versions?..

Javascript sleep/delay/wait function

Sorry if this question has already been asked here before, I could not find a suitable answer. I am wanting to create a JavaScript sleep/delay/wait function that I can call anywhere in the script, li..

TypeError: 'str' object is not callable (Python)

Code: import urllib2 as u import os as o inn = 'dword.txt' w = open(inn) z = w.readline() b = w.readline() c = w.readline() x = w.readline() m = w.readline() def Dict(Let, Mod): global str in..

How to stop C++ console application from exiting immediately?

Lately, I've been trying to learn C++ from this website. Unfortunately whenever I try to run one of the code samples, I see that program open for about a half second and then immediately close. Is the..

HTTP get with headers using RestTemplate

How can I send a GET request using the Spring RestTemplate? Other questions have used POST, but I need to use GET. When I run this, the program continues to work, but it seems that the network is clog..

How to check if two arrays are equal with JavaScript?

var a = [1, 2, 3]; var b = [3, 2, 1]; var c = new Array(1, 2, 3); alert(a == b + "|" + b == c); demo How can I check these array for equality and get a method which returns true if they are equal?..

Getting Chrome to accept self-signed localhost certificate

I have created a self-signed SSL certificate for the localhost CN. Firefox accepts this certificate after initially complaining about it, as expected. Chrome and IE, however, refuse to accept it, even..

How to find the minimum value in an ArrayList, along with the index number? (Java)

I need to get the index value of the minimum value in my arraylist in Java. MY arraylist holds several floats, and I'm trying to think of a way I can get the index number of the smallest float so I ca..

How can I get a specific parameter from location.search?

If I had a URL such as http://localhost/search.php?year=2008 How would I write a JavaScript function to grab the variable year and see if it contains anything? I know it can be done with location...

Git Push ERROR: Repository not found

I am having a very strange problem with git and github. When I try and push, I am getting: git push -u origin master ERROR: Repository not found. fatal: The remote end hung up unexpectedly I added ..

Postman: sending nested JSON object

I am using ASP.NET Web API: http://xyzdomain.com:16845/api/returns/returns How do I send a POST request to the endpoint using Postman Chrome extension, given Items is a collection: [ { "Items"..

How to properly assert that an exception gets raised in pytest?

Code: # coding=utf-8 import pytest def whatever(): return 9/0 def test_whatever(): try: whatever() except ZeroDivisionError as exc: pytest.fail(exc, pytrace=True) Out..

How do I select an entire row which has the largest ID in the table?

How would I do something like this? SQL SELECT row FROM table WHERE id=max(id) ..

Clicking the back button twice to exit an activity

I've noticed this pattern in a lot of Android apps and games recently: when clicking the back button to "exit" the application, a Toast comes up with a message similar to "Please click BACK again to e..

Difference between UTF-8 and UTF-16?

Difference between UTF-8 and UTF-16? Why do we need these? MessageDigest md = MessageDigest.getInstance("SHA-256"); String text = "This is some text"; md.update(text.getBytes("UTF-8")); // Change th..

Using grep to search for a string that has a dot in it

I am trying to search for a string 0.49 (with dot) using the command grep -r "0.49" * But what happening is that I am also getting unwanted results which contains the string such as 0449, 0949 etc,..

How do I trim a file extension from a String in Java?

What's the most efficient way to trim the suffix in Java, like this: title part1.txt title part2.html => title part1 title part2 ..

scikit-learn random state in splitting dataset

Can anyone tell me why we set random state to zero in splitting train and test set. X_train, X_test, y_train, y_test = \ train_test_split(X, y, test_size=0.30, random_state=0) I have seen situati..

jQuery ajax error function

I have an ajax call passing data to a page which then returns a value. I have retrieved the successful call from the page but i have coded it so that it raises an error in the asp. How do i retrieve ..

Property 'json' does not exist on type 'Object'

I'm trying fetch data via REST with angular 2 HttpClient. I'm following the angular tutorial here https://angular.io/tutorial/toh-pt6 and under the Heroes and HTTP section you'll see this snippet of c..

.NET Short Unique Identifier

I need a unique identifier in .NET (cannot use GUID as it is too long for this case). Do people think that the algorithm used here is a good candidate or do you have any other suggestions?..

How to remove files and directories quickly via terminal (bash shell)

From terminal window: When I use the rm command it can only remove files. When I use the rmdir command it only removes empty folders. If I have a directory nested with files and folders within f..

Can Google Chrome open local links?

I am linking on an intranet page to a local file on a shared drive: <a href="file:///s:/test.xls"> Test</a> This works in IE and Firefox with an addon called local link. How can..

How to dynamically create CSS class in JavaScript and apply?

I need to create a CSS stylesheet class dynamically in JavaScript and assign it to some HTML elements like - div, table, span, tr, etc and to some controls like asp:Textbox, Dropdownlist and datalist...

How Big can a Python List Get?

In Python, how big can a list get? I need a list of about 12000 elements. Will I still be able to run list methods such as sorting, etc?..

How to prevent background scrolling when Bootstrap 3 modal open on mobile browsers?

How to prevent background scrolling when Bootstrap 3 modal open on mobile platforms? On desktop browsers the background is prevented from scrolling and works as it should. On mobile browsers (Safari..

How to convert .pem into .key?

I already have purchased SSL certificate and i have received certificate and a .pem file as a private key? from the supplier; now i need to convert this .pem key into .key for bitnami Redmine Apache w..

Create a file if one doesn't exist - C

I want my program to open a file if it exists, or else create the file. I'm trying the following code but I'm getting a debug assertion at freopen.c. Would I be better off using fclose and then fopen ..

The order of keys in dictionaries

Code: d = {'a': 0, 'b': 1, 'c': 2} l = d.keys() print l This prints ['a', 'c', 'b']. I'm unsure of how the method keys() determines the order of the keywords within l. However, I'd like to be able..

Visual Studio 2015 Update 3 Offline Installer (ISO)

After digging around for Visual Studio IDE 2015 update 3 offline installer, aka ISO file, I found it and I am sharing the url. And, I know this may be posted elsewhere. But I also do know that many p..

Difference between Xms and Xmx and XX:MaxPermSize

What the difference between -Xms4096m -Xmx2048M -XX:MaxPermSize=712M I am getting confused of this two -Xmx2048M and -XX:MaxPermSize=712M and will happen if I use -Xmx2048M or -Xmx2048m..

Set icon for Android application

How can I set an icon for my Android application?..

Pandas split DataFrame by column value

I have DataFrame with column Sales. How can I split it into 2 based on Sales value? First DataFrame will have data with 'Sales' < s and second with 'Sales' >= s ..

How to Display Selected Item in Bootstrap Button Dropdown Title

I am using the bootstrap Dropdown component in my application like this: <div class="btn-group"> <button class="btn">Please Select From List</button> <button class="btn d..

Two Page Login with Spring Security 3.2.x

We are brand new to Java, Spring, and Spring Security, but not new to development. We've been able to create a Spring Security-based Thymeleaf login page that uses a JNDI datasource to connect to our ..

Sqlite in chrome

Is it possible to make chrome extension that interacts with sqlite database similarly as firefox extension? Could you give me some advise or link where is more info about developing chrome extension i..

How to install the Six module in Python2.7

I am using Python 2.7 and trying to use dateutil as follows: from dateutil import parser as _date_parser However, I get the following error: Traceback (most recent call last): File "<pyshell#..

Best way to check if a Data Table has a null value in it

what is the best way to check if a Data Table has a null value in it ? Most of the time in our scenario, one column will have all null values. (This datatable is returned by a 3rd party application ..

How To Set Up GUI On Amazon EC2 Ubuntu server

I'm using an amazon Ubuntu EC2 instance which is only has a command line interface. I want to setup UI for that server to access using remote desktop tools. Is there any way to apply GUI to the EC2 in..

Function for C++ struct

Usually we can define a variable for a C++ struct, as in struct foo { int bar; }; Can we also define functions for a struct? How would we use those functions?..

Python: Maximum recursion depth exceeded

I have the following recursion code, at each node I call sql query to get the nodes belong to the parent node. here is the error: Exception RuntimeError: 'maximum recursion depth exceeded' in <..

The controller for path was not found or does not implement IController

I have an MVC4 project with language selection: en nl fr de 1 main part with: About Common (for the menu) Contact Faq Home And 3 areas: Admin Customers Shop In each area I have at least on..

make iframe height dynamic based on content inside- JQUERY/Javascript

I am loading an aspx web page in an iframe. The content in the Iframe can be of more height than the iframe's height. The iframe should not have scroll bars. I have a wrapper div tag inside the ifram..

What is a Question Mark "?" and Colon ":" Operator Used for?

Two questions about using a question mark "?" and colon ":" operator within the parentheses of a print function: What do they do? Also, does anyone know the standard term for them or where I can find..

How to call a javaScript Function in jsp on page load without using <body onload="disableView()">

How can a JavaScript function in JSP be called during page load without using <body onload="disableView()"> I have to call this function in a few JSP's on page load but JSP's are divided into..

What is the difference between bottom-up and top-down?

The bottom-up approach (to dynamic programming) consists in first looking at the "smaller" subproblems, and then solve the larger subproblems using the solution to the smaller problems. The top-down ..

How to display Toast in Android?

I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I t..

Failed to load JavaHL Library

After updating to Snow Lion I started receiving these errors in Flash Builder / Eclipse when trying to use SVN: Failed to load JavaHL Library. These are the errors that were encountered: no libsvnja..

T-SQL: Looping through an array of known values

Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: exe..

Checking if a file is a directory or just a file

I'm writing a program to check if something is a file or is a directory. Is there a better way to do it than this? #include <stdio.h> #include <sys/types.h> #include <dirent.h> #in..

Align image to left of text on same line - Twitter Bootstrap3

Currently I have a paragraph heading and an image to its right, on the same line: <div class="paragraphs"> <div class="row"> <div class="span4"> <div class="content-h..

Why are exclamation marks used in Ruby methods?

In Ruby some methods have a question mark (?) that ask a question like include? that ask if the object in question is included, this then returns a true/false. But why do some methods have exclamatio..

How to convert string to integer in UNIX

I have d1="11" and d2="07". I want to convert d1 and d2 to integers and perform d1-d2. How do I do this in UNIX? d1 - d2 currently returns "11-07" as result for me...

How to hide the bar at the top of "youtube" even when mouse hovers over it?

I am attempting to embed a youtube video, however, I have not discovered a way to keep the bar at the top from showing when the mouse hovers over it. For my purposes it is important that users are not..

Difference between VARCHAR and TEXT in MySQL

When we create a table in MySQL with a VARCHAR column, we have to set the length for it. But for TEXT type we don't have to provide the length. What are the differences between VARCHAR and TEXT?..

Add a string of text into an input field when user clicks a button

Basically just trying to add text to an input field that already contains a value.. the trigger being a button.. Before we click button, form field would look like.. (user inputted some data) [This ..

Using headers with the Python requests library's get method

So I recently stumbled upon this great library for handling HTTP requests in Python; found here http://docs.python-requests.org/en/latest/index.html. I love working with it, but I can't figure out ho..

How to check if a process is in hang state (Linux)

Is there any command in Linux through which i can know if the process is in hang state...

dispatch_after - GCD in Swift?

I've gone through the iBook from Apple, and couldn't find any definition of it: Can someone explain the structure of dispatch_after? dispatch_after(<#when: dispatch_time_t#>, <#queue: dispa..

Possible to restore a backup of SQL Server 2014 on SQL Server 2012?

I know that you can't (at least not easily) restore a SQL Server 2012 backup on SQL Server 2008. But how does it work for SQL Server 2014 to SQL Server 2012 ? On database level there is the property ..

How to format column to number format in Excel sheet?

Below is the VBA code. Sheet2 contains all of the values in general format. After running the code, values in column 'C' of Sheet3 contain exponential values for numbers which are 13 or more digits...

Failed to allocate memory: 8

From today, when I tried to run an app in NetBeans on a 2.3.3 Android platform, it shows me that: Failed to allocate memory: 8 This application has requested the Runtime to terminate it in an..

How to delete and recreate from scratch an existing EF Code First database

I am using EF Code First with EF 5 in VS 2012. I use PM update-database command and I have a simple seed method to fill some tables with sample data. I would like to delete and recreate my x.mdb. The..

How to make an embedded video not autoplay

I'm embedding a Flash video into an HTML and would like the user to have to click it to begin playing. According to the Adobe <object> / <embed> element documentation, there are variety of..

How can I compile a Java program in Eclipse without running it?

I would like to compile my Java program in Eclipse but not to run it. I can't understand how to do it. How can I compile a Java program to .class files in Eclipse without running it?..

Gradle Error:Execution failed for task ':app:processDebugGoogleServices'

I am following this link to integrate Google sign-in in my android app.https://developers.google.com/identity/sign-in/android/start-integrating As given in last step on the above given page we have t..

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

How to get the current working directory in Java?

I want to access my current working directory using java. My code : String current = new java.io.File( "." ).getCanonicalPath(); System.out.println("Current dir:"+current); String currentD..

Laravel stylesheets and javascript don't load for non-base routes

Okay--I know this is a really elementary issue, but I can't figure it out. This is a question regarding Laravel. Basically, I have my stylesheets embedded in my default layout view. I'm currently jus..