Questions Tagged with #Cppcms

CppCMS is an open source, high performance, model-view-controller, C++ web development framework.

How to run test methods in specific order in JUnit4?

I want to execute test methods which are annotated by @Test in specific order. For example: public class MyTest { @Test public void test1(){} @Test public void test2(){} } I want to ensure..

Delete default value of an input text on click

I have an input text : <input name="Email" type="text" id="Email" value="[email protected]" /> I want to put a default value like "What's your programming question ? be specific." in StackOverFlo..

Imshow: extent and aspect

I'm writing a software system that visualizes slices and projections through a 3D dataset. I'm using matplotlib and specifically imshow to visualize the image buffers I get back from my analysis code..

JOptionPane Yes or No window

I am trying to create a message with a Yes or No button. Then a window will appear with a certain message that depends on if the user clicked Yes or No. Here is my code: public class test{ pu..

Adding a tooltip to an input box

I am using the CSS.Tooltips library to try an get a tooltip to show up on an input tag. I can get it to work on a p tag but not an input tag. Any ideas? Here is link to the fiddle: http://jsfiddle.n..

What is dtype('O'), in pandas?

I have a dataframe in pandas and I'm trying to figure out what the types of its values are. I am unsure what the type is of column 'Test'. However, when I run myFrame['Test'].dtype, I get; dtype('O')..

Python script to copy text to clipboard

I just need a python script that copies text to the clipboard. After the script gets executed i need the output of the text to be pasted to another source. Is it possible to write a python script tha..

How to get the real and total length of char * (char array)?

For a char [], I can easily get its length by: char a[] = "aaaaa"; int length = sizeof(a)/sizeof(char); // length=6 However, I cannot do like this to get the length of a char * by: char *a = new c..

How do I properly set the Datetimeindex for a Pandas datetime object in a dataframe?

I have a pandas dataframe: lat lng alt days date time 0 40.003834 116.321462 211 39745.175405 2008-10-24 04:12:35 1 40.003783 116.321431 201 39..

Is there a unique Android device ID?

Do Android devices have a unique ID, and if so, what is a simple way to access it using Java?..

package does not exist ; in Android studio 0.8

I've recently updated the android studio IDE to 0.8 to work with the new android L SDK. To start I imported a finished android project that receives no errors in the older version of android studio. I..

Difference between binary semaphore and mutex

Is there any difference between a binary semaphore and mutex or are they essentially the same?..

Algorithm to find all Latitude Longitude locations within a certain distance from a given Lat Lng location

Given a database of places with Latitude + Longitude locations, such as 40.8120390, -73.4889650, how would I find all locations within a given distance of a specific location? It doesn't seem very ef..

Twitter Bootstrap - add top space between rows

How to add margin top to class="row" elements using twitter bootstrap framework?..

How to undo "git commit --amend" done instead of "git commit"

I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file. Is there a way to undo that last commit? If I do something ..

Automatically creating directories with file output

Possible Duplicate: mkdir -p functionality in python Say I want to make a file: filename = "/foo/bar/baz.txt" with open(filename, "w") as f: f.write("FOOBAR") This gives an IOError,..

Maintain the aspect ratio of a div with CSS

I want to create a div that can change its width/height as the window's width changes. Are there any CSS3 rules that would allow the height to change according to the width, while maintaining its asp..

ERROR: permission denied for relation tablename on Postgres while trying a SELECT as a readonly user

GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; The readonly user can connect, see the tables but when it tries to do a simple select it gets: ERROR: permission denied for relation mytable..

Convert RGBA PNG to RGB with PIL

I'm using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken. Source file Code'/tmp/output.jpg', 'JPEG') or I..

Difference between onStart() and onResume()

I can't get the meaning of onStart() transition state. The onResume() method is always called after onStart(). Why can't it be the onResume() is invoked after onRestart() and onCreate() methods just e..

Determine the number of lines within a text file

Is there an easy way to programmatically determine the number of lines within a text file? ..

C# MessageBox dialog result

I want to make a MessageBox confirmation. Here is the message box: MessageBox.Show("Do you want to save changes?", "Confirmation", messageBoxButtons.YesNoCancel); And I want to make something like ..

How to get just one file from another branch

I am using git and working on master branch. This branch has a file called app.js. I have an experiment branch in which I made a bunch of changes and tons of commits. Now I want to bring all the chan..

How to make html <select> element look like "disabled", but pass values?

When I'm disabling a <select name="sel" disabled> <option>123</option> </select> element, it doesnt pass its variable. What to do to look it like disabled, but be in "..

what is the difference between $_SERVER['REQUEST_URI'] and $_GET['q']?

what is the difference between $_SERVER['REQUEST_URI'] and $_GET['q'] (which is used in Drupal)?..

Head and tail in one line

Is there a pythonic way to unpack a list in the first element and the "tail" in a single command? For example: >> head, tail = **some_magic applied to** [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] >..

How to generate unique IDs for form labels in React?

I have form elements with labels and I want to have unique IDs to link labels to elements with htmlFor attribute. Something like this: React.createClass({ render() { const id = ???; ..

Python Regex - How to Get Positions and Values of Matches

How can I get the start and end positions of all matches using the re module? For example given the pattern r'[a-z]' and the string 'a1b2c3d4' I'd want to get the positions where it finds each letter...

Convert sqlalchemy row object to python dict

Is there a simple way to iterate over column name and value pairs? My version of sqlalchemy is 0.5.6 Here is the sample code where I tried using dict(row), but it throws exception , TypeError: 'User..

Do fragments really need an empty constructor?

I have a Fragment with a constructor that takes multiple arguments. My app worked fine during development, but in production my users sometimes see this crash:$Instant..

Shortcut for echo "<pre>";print_r($myarray);echo "</pre>";

Is there a Shortcut for echo "<pre>"; print_r($myarray); echo "</pre>"; It is really annoying typing those just to get a readable format of an array...

How can I convert an integer to a hexadecimal string in C?

How can I convert an integer to a hexadecimal string in C? Example: The integer 50 would be converted to the hexadecimal string "32" or "0x32"...

Trigger change() event when setting <select>'s value with val() function

What is the easiest and best way to trigger change event when setting the value of select element. I've expected that executing the following code $('select#some').val(10); or $('select#some').at..

AJAX Mailchimp signup form integration

Is there any way to integrate mailchimp simple (one email input) with AJAX, so there is no page refresh and no redirection to default mailchimp page. This solution doesn't work jQuery Ajax POST not w..

CSS background image to fit height, width should auto-scale in proportion

I want background image fit with the height of the div, there's a way to do that? background-size:cover; fit only with the width and height autoscale (I need the opposite effect). Thanks...

Centering the image in Bootstrap

I m using bootstrap 3.0 to creating a website. I am new to bootstrap. what i want, i want image in center of div when browser size is extra small i have this code. <div class="col-lg-10 ccol-lg-of..

sudo: docker-compose: command not found

I am trying to run docker-compose using sudo. I have both docker and docker-compose installed on Ubuntu 16.01. Due to an error while trying to download compose using curl, I ended up installing it u..

Resize image proportionally with MaxHeight and MaxWidth constraints

Using System.Drawing.Image. If an image width or height exceed the maximum, it need to be resized proportionally . After resized it need to make sure that neither width or height still exceed the lim..

Using union and count(*) together in SQL query

I have a SQL query, looks something like this: select name, count (*) from Results group by name order by name and another, identical which loads from a archive results table, but the fields are th..

How do I add a newline using printf?

How do I add a new line to a print command using printf? printf "I want this on a new line!" I thought it would be something like this but it didn't work printf "/n I want this on a new line!/n" ..

Where can I find documentation on formatting a date in JavaScript?

I noticed that JavaScript's new Date() function is very smart in accepting dates in several formats. Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new D..

codes for ADD,EDIT,DELETE,SEARCH in vb2010

I'm currently working on my thesis in school and they required me to use VB2010 and MS ACCESS 2010. what could be the easier way to connect and manipulate the DB? is it by using MS ACCESS 2003? or M..

Java ArrayList Index

int[] alist = new int [3]; alist.add("apple"); alist.add("banana"); alist.add("orange"); Say that I want to use the second item in the ArrayList. What is the coding in order to get the following out..

Rotating a Div Element in jQuery

Trying to rotate a div element...This might be DOM blasphemy, could it work possibly with a canvas element? I'm not sure - if anybody has any ideas of how this could work or why it doesn't, I'd love t..

Send email with PHPMailer - embed image in body

I'm trying to send HTML mail, with PHPMailer, with images. The body is loaded from a html file, that contains all the info. When sending the mail, the image does not appear in the body, although I ev..

How do I make Git ignore file mode (chmod) changes?

I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo. Git picks up on chmod -R 777 . and marks all files as c..

Git: How to reset a remote Git repository to remove all commits?

How can I reset a remote and local Git repository to remove all commits? I would like to start fresh with the current Head as the initial commit...

export html table to csv

I am trying to add a feature of csv download option in my website. It should convert the html table present in the website in to csv content and make it downloadable. Ive been searching through intern..

How to compile .c file with OpenSSL includes?

I am trying to compile a small .c file that has the following includes: #include <openssl/ssl.h> #include <openssl/rsa.h> #include <openssl/x509.h> #include <openssl/evp.h> ..

Android - Get value from HashMap

I have tried to search on HashMap in Android, but getting problem: Consider this example: HashMap<String, String> meMap=new HashMap<String, String>(); meMap.put("Color1","Red"); meMap.pu..

Is there a way to get rid of accents and convert a whole string to regular letters?

Is there a better way for getting rid of accents and making those letters regular apart from using String.replaceAll() method and replacing letters one by one? Example: Input: orcpžsíáýd Output..

Get source JARs from Maven repository

Does anyone have any idea if you can find source JARs on Maven repositories?..

Check if a string contains a number

Most of the questions I've found are biased on the fact they're looking for letters in their numbers, whereas I'm looking for numbers in what I'd like to be a numberless string. I need to enter a stri..

Converting an integer to a string in PHP

Is there a way to convert an integer to a string in PHP?..

Build an iOS app without owning a mac?

Please correct me if I'm wrong. I'm new to mobile development and I would like to develop an app to submit to the apple store. But I am heavily discouraged by the prices of the macs that I am develo..

How do I get the current date and current time only respectively in Django?

I came across an interesting situation when using this class: class Company(models.Model): date = models.DateField() time = models.TimeField() c = Company(, time..

How do I find the version of Apache running without access to the command line?

I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line acces..

Compare two Lists for differences

I would like some feedback on how we can best write a generic function that will enable two Lists to be compared. The Lists contain class objects and we would like to iterate through one list, looking..

Freemarker iterating over hashmap keys

Freemarker has two collection datatypes, lists and hashmaps Is there a way to iterate over hashmap keys just as we do with lists? So if I have a var with data lets say: user : { name : "user" em..

Python timedelta in years

I need to check if some number of years have been since some date. Currently I've got timedelta from datetime module and I don't know how to convert it to years...

unsigned APK can not be installed

I am trying to distribute my application to some people for testing. I have installed it on my Desire directly from eclipse and it works fine. To create an APK-file, I choose "Export Unsigned Applica..

Eclipse IDE: How to zoom in on text?

I want the same behaviour Firefox has, when you use the scroll button in the mouse to zoom in and out on the current view. Is there something like it for eclipse?..

constant pointer vs pointer on a constant value

What is the difference between the following declarations? char * const a; const char * a; In order to understand the difference I wrote this small program: #include <stdio.h> #include <s..

Set JavaScript variable = null, or leave undefined?

When declaring variables at the top of the JavaScript function, is it best practice to set them equal to null, or leave as 'undefined'? Another way to ask, what circumstances call for each option belo..

How to set a text box for inputing password in winforms?

how to set a text box for inputing password in winforms? Also I want to show "Capslock is ON" popup if capslock is on. I want something like <input type="password" /> in HTML...

ReactJs: What should the PropTypes be for this.props.children?

Given a simple component that renders its children: class ContainerComponent extends Component { static propTypes = { children: PropTypes.object.isRequired, } render() { return ( ..

What does the function then() mean in JavaScript?

I’ve been seeing code that looks like: myObj.doSome("task").then(function(env) { // logic }); Where does then() come from?..

PHP Echo a large block of text

Im new to PHP and I can't figure out what the rules are for using the echo function. For example, if I need to echo a large block of css/js, do I need to add echo to each line of text or is there a wa..

How to write a caption under an image?

I have two images that need to kept inline; I want to write a caption under each image. <center> <a href=""> <img src="hello.png" width="100px" height..

How to clone ArrayList and also clone its contents?

How can I clone an ArrayList and also clone its items in Java? For example I have: ArrayList<Dog> dogs = getDogs(); ArrayList<Dog> clonedList = ....something to do with dogs.... And I ..

How to check if a string starts with "_" in PHP?

Example: I have a $variable = "_foo", and I want to make absolutely sure that $variable does not start with an underscore "_". How can I do that in PHP? Is there some access to the char array behind t..

Javascript change font color

I need to change the font color. I have the following: var clr="green"; <font color=clr>' + onlineff + ' </font> The font color does not change to green. Just wondering how thi..

ionic 2 - Error Could not find an installed version of Gradle either in Android Studio

I create ionic 2 project and add diagnostic cordova plugin like this : ionic plugin add cordova.plugins.diagnostic npm install --save @ionic-native/diagnostic and add android platform like this : ..

How to remove focus from single editText

In my application I have a single EditText together with some TextViews, button and a spinner. My EditText receives focus since it is the only focusable view in this activity, I believe. My EditText s..

"CSV file does not exist" for a filename with embedded quotes

I am currently learning Pandas for data analysis and having some issues reading a csv file in Atom editor. When I am running the following code: import pandas as pd df = pd.read_csv("FBI-CRIME11...

How to custom switch button?

I am looking to Custom The Switch Button to becoming as following : How to achieve this ?..

What difference is there between WebClient and HTTPWebRequest classes in .NET?

What difference is there between the WebClient and the HttpWebRequest classes in .NET? They both do very similar things. In fact, why weren't they merged into one class (too many methods/variables etc..

Android: Reverse geocoding - getFromLocation

I am trying to get an address based on the long/lat. it appears that something like this should work? Geocoder myLocation = Geocoder(Locale.getDefault()); List myList = myLocation.getFromLocatio..

How much should a function trust another function

Consider the following two functions in a class called Graph. The entire source code is found here: public void addNode(T node) { ..

extract date only from given timestamp in oracle sql

The following query: select cdate from rprt where cdate <= TO_CHAR(sysdate, 'YYYY/MM/DD-HH24-MI-SS-SSSSS') and ryg='R' and cnum='C002'; return: 2013/04/27-10:06:26:794 as stored in the table. I..

PHP append one array to another (not array_push or +)

How to append one array to another without comparing their keys? $a = array( 'a', 'b' ); $b = array( 'c', 'd' ); At the end it should be: Array( [0]=>a [1]=>b [2]=>c [3]=>d ) If I use s..

Replace Div Content onclick

I know nothing about jQuery but want to achieve something really important. I want to have a button/link that will replace the div content and if I press that button again so it will put the original..

if variable contains

Possible Duplicate: JavaScript: string contains I have a postcode variable and want to use JS to add a location into a different variable when the postcode is changed/entered. So for examp..

Please run `npm cache clean`

I'm trying to install IPFS from herenpm install ipfs --save and it is giving me the error as npm ERR! tar.unpack error reading /media/FLASH/Tech/IPFS/ipfs npm ERR! addLocal Could not insta..

Automatically create an Enum based on values in a database lookup table?

How do I automatically create an enum and subsequently use its values in C# based on values in a database lookup table (using enterprise library data layer)? For example, If I add a new lookup value ..

What do the python file extensions, .pyc .pyd .pyo stand for?

What do these python file extensions mean? .pyc .pyd .pyo What are the differences between them and how are they generated from a *.py file?..

mysql command for showing current configuration variables

Can not find a command that displays the current configuration of mysql from within the database. I know I could look at /etc/mysql/my.cnf but that is not what I need...

How to format numbers as currency string?

I would like to format a price in JavaScript. I'd like a function which takes a float as an argument and returns a string formatted like this: "$ 2,500.00" What's the best way to do this?..

Connecting an input stream to an outputstream

update in java9: I saw some similar, but not-quite-what-i-need threads. I have a server, which wil..

How to find out whether a file is at its `eof`?

fp = open("a.txt") #do many things with fp c = if c is None: print 'fp is at the eof' Besides the above method, any other way to find out whether is fp is already at the eof?..

How to suppress "error TS2533: Object is possibly 'null' or 'undefined'"?

I have a type: type tSelectProtected = { handleSelector?: string, data?: tSelectDataItem[], wrapperEle?: HTMLElement, inputEle?: HTMLElement, listEle?: HTMLElement, resultEle?: HTMLEleme..

How can I download HTML source in C#

How can I get the HTML source given a web address in c#?..

Getting only response header from HTTP POST using curl

One can request only the headers using HTTP HEAD, as option -I in curl(1). $ curl -I / Lengthy HTML response bodies are a pain to get in command-line, so I'd like to get only the header as feedback..

Converting BigDecimal to Integer

I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass that number but it accepts Integer as parameter. I cannot change return types or variable types..

What programming languages can one use to develop iPhone, iPod Touch and iPad (iOS) applications?

What programming languages can one use to develop iPhone, iPod Touch and iPad (iOS) applications? Also are there plans in the future to expand the amount of programming languages that iOS will suppor..

on change event for file input element

I have 4 file inputs that I want them trigger upload proccess when their value is changed. I mean when you select a picture and click open on select image dialog, the script to upload the picture be t..

axios post request to send form data

axios POST request is hitting the url on the controller but setting null values to my POJO class, when I go through developer tools in chrome, the payload contains data. What am I doing wrong? Axios ..

How to run a cronjob every X minutes?

I'm running a PHP script in a cronjob and I want to send emails every 5 minutes My current (crontab) cronjob: 10 * * * * /usr/bin/php / > /dev/null 2>&1 The cronma..

Git refusing to merge unrelated histories on rebase

During git rebase origin/development the following error message is shown from Git: fatal: refusing to merge unrelated histories Error redoing merge 1234deadbeef1234deadbeef My Git version is 2.9.0..

How to remove RVM (Ruby Version Manager) from my system

How can I remove RVM (Ruby Version Manager) from my system?..

Call a method of a controller from another controller using 'scope' in AngularJS

I am trying to call a method of second controller in first controller by using scope variable. This is a method in my first controller: $scope.initRestId = function(){ var catapp = document.g..

What are metaclasses in Python?

In Python, what are metaclasses and what do we use them for?..

Print to standard printer from Python?

Is there a reasonably standard and cross platform way to print text (or even PS/PDF) to the system defined printer? Assuming CPython here, not something clever like using Jython and the Java printing..

Paste MS Excel data to SQL Server

I have a bunch of rows in Excel that I want to paste into a new table in MS SQL. Is there a simple way ?..

node.js remove file

How do I delete a file with node.js? I don't see a remove command?..

Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedly

I'm attempting to deploy my code to heroku with the following command line: git push heroku master but get the following error: Permission denied (publickey). fatal: The remote end hung up unexpec..

OnChange event handler for radio button (INPUT type="radio") doesn't work as one value

I'm looking for a generalized solution for this. Consider 2 radio type inputs with the same name. When submitted, the one that is checked determines the value that gets sent with the form: <input..

How to represent e^(-t^2) in MATLAB?

I am a beginner in MATLAB, and I need to represent e(-t2). I know that, for example, to represent ex I use exp(x), and I have tried the following 1) tp=t^2; / tp=t*t; x=exp(-tp); 2) x=exp(-t^2);..

How to get and set the current web page scroll position?

How can I get and set the current web page scroll position? I have a long form which needs to be refreshed based on user actions/input. When this happens, the page resets to the very top, which is a..

How do I negate a condition in PowerShell?

How do I negate a conditional test in PowerShell? For example, if I want to check for the directory C:\Code, I can run: if (Test-Path C:\Code){ write "it exists!" } Is there a way to negate that..

NSAttributedString add text alignment

How can I add text alignment attribute to an NSAttributedString to center the text? Edit: Am I doing anything wrong? It doesn't seem to change the alignment. CTParagraphStyleSetting setting; setting..

Making a DateTime field in a database automatic?

I'm putting together a simple test database to learn MVC with. I want to add a DateTime field to show when the record was CREATED. ID = int Name = Char DateCreated = (dateTime, DateTime2..?) I hav..

Construct pandas DataFrame from list of tuples of (row,col,values)

I have a list of tuples like data = [ ('r1', 'c1', avg11, stdev11), ('r1', 'c2', avg12, stdev12), ('r2', 'c1', avg21, stdev21), ('r2', 'c2', avg22, stdev22) ] and I would like to put them into a pa..

How to declare Return Types for Functions in TypeScript

I checked here which is the TypeScript Language Specifications but I couldn't see one thing that how I can declare a return type of the ..

How to POST request using RestSharp

I m trying to POST the request using RestSharp client as follows I m passing the Auth Code to following function public void ExchangeCodeForToken(string code) { if (string.IsNullOrEmpty(code)) ..

Why does the 260 character path length limit exist in Windows?

I have come up against this problem a few times at inopportune moments: Trying to work on open source Java projects with deep paths Storing deep Fitnesse wiki trees in source control An error trying..

How to run regasm.exe from command line other than Visual Studio command prompt?

I want to run regasm.exe from cmd. which is available in c:\windows\\framework\2.057 I do like this c:\ regasm.exe It gives regasm is not recognized as internal or external command. So..

How to send an email using PHP?

I am using PHP on a website and I want to add emailing functionality. I have WAMPSERVER installed. How do I send an email using PHP?..

Convert xlsx file to csv using batch

How do you convert multiple xlsx files to csv files with a batch script?..

Creating random colour in Java?

I want to draw random coloured points on a JPanel in a Java application. Is there any method to create random colours?..

import sun.misc.BASE64Encoder results in error compiled in Eclipse

For this two imports; import sun.misc.BASE64Encoder; import sun.misc.BASE64Decoder; I got this error: Access restriction: The type BASE64Decoder is not accessible due to restriction on required li..

Postgres password authentication fails

I tried to login with the postgres user from my windows machine to my server with Pgadmin. But it keeps giving me this error: psql: FATAL: password authentication failed for user "postgres" So th..

How to find tag with particular text with Beautiful Soup?

I have the following html (line breaks marked with \n): ... <tr> <td class="pos">\n "Some text:"\n <br>\n <strong>some value</strong>\n </td>..

What is path of JDK on Mac ?

Im using Mac only at work and I need to set JAVA_HOME to proper path of JDK. I downloaded JDK, installed it and now I can't find it anywhere. I was looking at the internet for the solution, but there ..

Sorting a Python list by two fields

I have the following list created from a sorted csv list1 = sorted(csv1, key=operator.itemgetter(1)) I would actually like to sort the list by two criteria: first by the value in field 1 and then b..

How to have jQuery restrict file types on upload?

I would like to have jQuery limit a file upload field to only jpg/jpeg, png, and gif. I am doing backend checking with PHP already. I am running my submit button through a JavaScript function already ..

Excel - Sum column if condition is met by checking other column in same table

I am trying to create spreadsheet to use in a small retail shop. I have a workbook which contains expenses figures on a sheet and income figure on another sheet. We can say that the common ground ..

Bootstrap: Open Another Modal in Modal

So, I'm using this code to open another modal window in a current opened modal window: <a onclick=\"$('#login').modal('hide');$('#lost').modal('show');\" href='#'>Click</a> What happens..

regex match any single character (one character only)

How do you match any one character with a regular expression? I am writing this question and the following answer for a general reference. A number of other questions on Stack Overflow sound like the..

Using FileUtils in eclipse

When trying to use FileUtils I get "cannot be resolved" error. Then, how do I install FileUtils library to be able to use it in Eclipse? I see it is an Ant utility, but I am not sure how many jars ..

Add 2 hours to current time in MySQL?

Which is the valid syntax of this query in MySQL? SELECT * FROM courses WHERE (now() + 2 hours) > start_time note: start_time is a field of courses table..

I would like to see a hash_map example in C++

I don't know how to use the hash function in C++, but I know that we can use hash_map. Does g++ support that by simply including #include <hash_map>? What is a simple example using hash_map?..

HTML table sort

So basically I am running a mysql query that fetches data from my database and displays it in an easy to read layout for my users. Name-----Address----Sales Person You get the gist. And now I want ..

var functionName = function() {} vs function functionName() {}

I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer used two way..

Python 3.6 install win32api?

Is there a way to install the win32api module for python 3.6 or do I have to change my version of python? Everytime I try to install it using pip I get the following error: Could not find a version ..

What does 'Unsupported major.minor version 52.0' mean, and how do I fix it?

Ok so I loosely understand that 52.0 is Java 8, and that the exceptions means that some code is compiled with one version of java, and some with another. What I can't get my head around is which way ..

ComboBox SelectedItem vs SelectedValue

The following code works as you’d expect — MyProperty on the model is updated when the user picks a new item in the dropdown. comboBox1.DataBindings.Add("SelectedValue", myModel, "MyProperty", tr..

How do I URL encode a string

I have a URL string (NSString) with spaces and & characters. How do I url encode the entire string (including the & ampersand character and spaces)?..

How do I check if a Socket is currently connected in Java?

I'm trying to find out whether a Java TCP Socket is currently connected, the following just seems to tell me whether the socket has been connected at some point - not whether it is currently still con..

AngularJS: Basic example to use authentication in Single Page Application

I am new to AngularJS and gone through their tutorial and got a feel for it. I have a backend for my project ready where each of the REST endpoints needs to be authenticated. What I want to do a.) I..

Set active tab style with AngularJS

I have routes set in AngularJS like this: $routeProvider .when('/dashboard', {templateUrl:'partials/dashboard', controller:widgetsController}) .when('/lab', {templateUrl:'partials/lab', contr..

How to call a JavaScript function, declared in <head>, in the body when I want to call it

I have a working JavaScript function declared in the head of an HTML page. I know how to create a button and call the function when the user clicks the button. I want to call it myself some where on t..

Regex to split a CSV

I know this (or similar) has been asked many times but having tried out numerous possibilities I've not been able to find a a regex that works 100%. I've got a CSV file and I'm trying to split it int..

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

I've spend over 6 hours to find an exception or a special character to find in my code but I couldn't. I checked every similar messages in here. I'm sending the form with magnific popup. First I'm us..

How to convert string to date to string in Swift iOS?

Am learning swift and am struck in converting the date String to NSDate to string. Am getting the date string in this format "Thu, 22 Oct 2015 07:45:17 +0000". I need to show the date in the MM-dd-yyy..

Explain __dict__ attribute

I am really confused about the __dict__ attribute. I have searched a lot but still I am not sure about the output. Could someone explain the use of this attribute from zero, in cases when it is used ..

Download Excel file via AJAX MVC

I have a large(ish) form in MVC. I need to be able to generate an excel file containing data from a subset of that form. The tricky bit is that this shouldn't affect the rest of the form and so I w..

How to get the size of a range in Excel

Using VBA, is it possible to get the size of a given range in terms of pixels or units? (I don't care which unit as I am only using it to relate to other measurements with the same unit). Thanks...

Command-line tool for finding out who is locking a file

I would like to know who is locking a file (win32). I know about WhoLockMe, but I would like a command-line tool which does more or less the same thing. I also looked at this question, but it seems o..

How to create major and minor gridlines with different linestyles in Python

I am currently using matplotlib.pyplot to create graphs and would like to have the major gridlines solid and black and the minor ones either greyed or dashed. In the grid properties, which=both/major..

In git how is fetch different than pull and how is merge different than rebase?

I just cant understand this. I been reading a lot on the web and books and something is just not staying in my head. Can someone please give me the dummy version of the following: git fetch vs pull ..

Split string into tokens and save them in an array

How to split a string into an tokens and then save them in an array? Specifically, I have a string "abc/qwe/jkh". I want to separate "/", and then save the tokens into an array. Output will be such ..

Getting android.content.res.Resources$NotFoundException: exception even when the resource is present in android

Please let me know where I am going wrong to get the error. I am creating an app which have one of its activity to be only in landscape mode. So I added the following in AndroidManifest.xml file <..

What is context in _.each(list, iterator, [context])?

I am new to underscore.js. What is the purpose of [context] in _.each()? How should it be used?..

1114 (HY000): The table is full

I'm trying to add a row to an InnoDB table with a simply query: INSERT INTO zip_codes (zip_code, city) VALUES ('90210', 'Beverly Hills'); But when I attempt this query, I get the following: ERR..

Could not commit JPA transaction: Transaction marked as rollbackOnly

I'm using Spring and Hibernate in one of the applications that I'm working on and I've got a problem with handling of transactions. I've got a service class that loads some entities from the database..

Internet Explorer cache location

Where is cache for IE for current user located?..

psql: FATAL: database "<user>" does not exist

I'm using the PostgreSql app for mac ( I've used it in the past on other machines but it's giving me some trouble when installing on my macbook. I've installed the application..

UIImage: Resize, then Crop

I've been bashing my face into this one for literally days now and even though I feel constantly that I am right on the edge of revelation, I simply cannot achieve my goal. I thought, ahead of time i..

Why do I get "'property cannot be assigned" when sending an SMTP email?

I can't understand why this code is not working. I get an error saying property can not be assigned MailMessage mail = new MailMessage(); SmtpClient client = new SmtpClient(); client.Port..

Excel formula to reference 'CELL TO THE LEFT'

I'm trying to do conditional formatting so that the cell color will change if the value is different from the value in the cell left of it (each column is a month, in each row are the expenses on cert..

Windows 8.1 gets Error 720 on connect VPN

I use windows 8.1 64-bit on my machine and recently, without having installed any new application, I get the following error when connecting to VPN: Error 720: Unable to establish a connection to the..

How to add one column into existing SQL Table

I have a SQL Server table and it is located on a remote server. I can connect to it with SQL Server Management Studio but opening it takes time instead, I am doing my jobs with SQL Query window withou..

Delete rows with foreign key in PostgreSQL

I would like to delete rows which contain a foreign key, but when I try something like this: DELETE FROM osoby WHERE id_osoby='1' I get this statement: ERROR: update or delete on table "osoby"..

Convert SVG to PNG in Python

How do I convert an svg to png, in Python? I am storing the svg in an instance of StringIO. Should I use the pyCairo library? How do I write that code?..

Origin <origin> is not allowed by Access-Control-Allow-Origin

XMLHttpRequest cannot load http://localhost:8080/api/test. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. I read about cross domain ajax requests, and understand the un..

Change Schema Name Of Table In SQL

I want to change schema name of table Employees in Database. In the current table Employees database schema name is dbo I want to change it to exe. How can I do it ? Example: FROM dbo.Employees ..

ImportError: cannot open shared object file: No such file or directory

When trying to import OpenCV, using import cv2 I get the following error: /usr/local/lib/python2.7/dist-packages/cv2/ in <module>() 7 8 # make IDE's (PyCharm) autocomple..

How to reload the current state?

I'm using Angular UI Router and would like to reload the current state and refresh all data / re-run the controllers for the current state and it's parent. I have 3 state levels: directory.organisati..

What is an HttpHandler in ASP.NET

What is an HttpHandler in ASP.NET? Why and how is it used?..

How to properly express JPQL "join fetch" with "where" clause as JPA 2 CriteriaQuery?

Consider the following JPQL query: SELECT foo FROM Foo foo INNER JOIN FETCH bar WHERE bar.baz = :baz I'm trying to translate this into a Criteria query. This is as far as I have gotten: Crite..

copy db file with adb pull results in 'permission denied' error

I just rooted my Nexus 5 using this method: I also enabled USB debugging in the developer options. Then I tried to pull a database f..

Read and write to binary files in C?

Does anyone have an example of code that can write to a binary file. And also code that can read a binary file and output to screen. Looking at examples I can write to a file ok But when I try to rea..

Passing capturing lambda as function pointer

Is it possible to pass a lambda function as a function pointer? If so, I must be doing something incorrectly because I am getting a compile error. Consider the following example using DecisionFn = b..

IOError: [Errno 22] invalid mode ('r') or filename: 'c:\\Python27\test.txt'

What is wrong with the following: test_file=open('c:\\Python27\test.txt','r') ..

I need to convert an int variable to double

My friend is trying to make some kind of calculation as a task for class, and he's having some trouble... I hope you can help him. The problem is that he gets an input from the user as int (it has to..

How do I find the CPU and RAM usage using PowerShell?

I am trying to get PowerShell to give me the RAM and CPU usage, but I can't figure out what WMI class to use. My computer has two processors, so it would be useful to have the information for both of ..

Call apply-like function on each row of dataframe with multiple arguments from each row

I have a dataframe with multiple columns. For each row in the dataframe, I want to call a function on the row, and the input of the function is using multiple columns from that row. For example, let..

ViewDidAppear is not called when opening app from background

I have a View Controller in which my value is 0 (label) and when I open that View Controller from another ViewController I have set viewDidAppear to set value 20 on label. It works fine but when I cl..

jQuery to remove an option from drop down list, given option's text/value

I have a drop down list and would like to remove an option from it, given the text/value of that particular option. Is it possible using jQuery? Just like 'append' which adds an option to the drop dow..

How to configure static content cache per folder and extension in IIS7?

I would like to set up rules in IIS7 for static content caching in my ASP.NET website. I have seen these articles, which details how to do it using the <clientCache /> element in web.config: ..

How to check if there exists a process with a given pid in Python?

Is there a way to check to see if a pid corresponds to a valid process? I'm getting a pid from a different source other than from os.getpid() and I need to check to see if a process with that pid does..

How to download a branch with git?

I have a project hosted on GitHub. I created a branch on one computer, then pushed my changes to GitHub with: git push origin branch-name Now I am on a different computer, and I want to download t..

The "backspace" escape character '\b': unexpected behavior?

So I'm finally reading through K&R, and I learned something within the first few pages, that there is a backspace escape character, \b. So I go to test it out, and there is some very odd behavior..

How to use [DllImport("")] in C#?

I found a lot of questions about it, but no one explains how I can use this. I have this: using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; usi..

Changing java platform on which netbeans runs

I am using Netbeans 6.7. I had first installed Java 1.5 before installing Netbeans. When i installed Netbeans it took Java 1.5 as the default version. Then i installed Java 1.6 on my machine. I need t..

Why are my PHP files showing as plain text?

I've been writing PHP applications using PHP for a while in WAMP. Now I'm installing PHP and Apache HTTP Server separately on my work PC. I've installed PHP 5, and the latest Apache. I go to localhost..

Printing Even and Odd using two Threads in Java

I tried the code below. I took this piece of code from some other post which is correct as per the author. But when I try running, it doesn't give me the exact result. This is mainly to print even a..

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

append to url and refresh page

I am looking to write a piece of javascript that will append a parameter to the current url and then refresh the page - how can I do this?..

How can I compare two strings in java and define which of them is smaller than the other alphabetically?

I want to use the binary search algorithm to search the string which has been entered by the user in a very big sorted file. I can not compare the string which has been entered by the user with the st..

Check if at least two out of three booleans are true

An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true. My solution follows: boolean atLeastTwo(boolean a, ..

Adding null values to arraylist

Can I add null values to an ArrayList even if it has a generic type parameter? Eg. ArrayList<Item> itemList = new ArrayList<Item>(); itemList.add(null); If so, will itemsList.size(); ..

ldconfig error: is not a symbolic link

When running: sudo /sbin/ldconfig the following error appears: /sbin/ldconfig: /usr/local/lib/ is not a symbolic link When I run file: file /usr/local/lib/ /usr/local/lib/: dire..

How can I get the last day of the month in C#?

How can I find the last day of the month in C#?..

Best way to get all selected checkboxes VALUES in jQuery

I am looking to get all checkboxes' VALUE which have been selected through jQuery...

HashMap get/put complexity

We are used to saying that HashMap get/put operations are O(1). However it depends on the hash implementation. The default object hash is actually the internal address in the JVM heap. Are we sure it ..

How to embed fonts in CSS?

I want to use some fonts and I want it to work without having this font on the client computer. I have done this but doesn't work: @font-face { font-family: EntezareZohoor2; src: url(Entezar2..

Date / Timestamp to record when a record was added to the table?

Does anyone know of a function as such that I can use to add an automatic date and timestamp in a column for when a user adds a record to the database table?..

cannot resolve symbol javafx.application in IntelliJ Idea IDE

I tried to create a JavaFX application in IntelliJ Idea IDE but I got compile error that said: java: package javafx.application does not exist. I have changed the Project SDK and the Project La..