Questions Tagged with #Cider

is it possible to add colors to python output?

so i made a small password strength tester for me, my friends and my family, as seen here: import re strength = ['You didnt type anything','Terrible','weak sause','avarage','Good!','Very Strong', 'TH.. Invalid Keystore format

Does anyone know how to solve this? I tried many things, but none of them worked. And when I click more details I get this: at Source) atsun.sec..

In Python, when to use a Dictionary, List or Set?

When should I use a dictionary, list or set? Are there scenarios that are more suited for each data type?..

Uninstall old versions of Ruby gems

I have several versions of a Ruby gem: $ gem list rjb (1.3.4, 1.3.3, 1.1.9) How can I remove old versions but keep the most recent?..

Get the Year/Month/Day from a datetime in php?

I used date('w', timestamp) and date('w', timestamp) to know the day, date('n', timestamp) for months, etc. Now I'm using datetime and I'd like to know what are the equivalent functions to get a day,..

Convert an integer to a byte array

I have a function which receives a []byte but I what I have is an int, what is the best way to go about this conversion? err = a.Write([]byte(myInt)) I guess I could go the long way and get it into..

Maximum value of maxRequestLength?

If we are using IIS 7 and .Net Framework 4, what will be the maximum value of maxRequestLength?..

Install an apk file from command prompt?

I want to install a file using the Windows command line. First I want to build after compiling all the .jar files to create an .apk file for an Android application without using Eclipse. Does anyone ..

Why is PHP session_destroy() not working?

I tried to destroy all session variable by using the session_destroy() method, but after using this method, the values are not destroyed. Why is session_destroy() not working? Is there any other way..

Cannot open include file: 'unistd.h': No such file or directory

After having installed libpng into my computer, I've included it into my project using #include <png.h> on a Windows 7 SP1 plateform and using Visual Studio Ultimate 2013. But at build time, I'..

Traits vs. interfaces

I've been trying to study up on PHP lately, and I find myself getting hung up on traits. I understand the concept of horizontal code reuse and not wanting to necessarily inherit from an abstract class..

Storing Form Data as a Session Variable

So I was wondering if it would be possible to store data coming in from a form as a session variable. Heres what I have so far, but I don't know what to put for the Form Action. Thanks for looking!..

Nested select statement in SQL Server

Why doesn't the following work? SELECT name FROM (SELECT name FROM agentinformation) I guess my understanding of SQL is wrong, because I would have thought this would return the same thing as SE..

Total Number of Row Resultset getRow Method

Read the Following Code: public class selectTable { public static ResultSet rSet; public static int total=0; public static ResultSet onLoad_Opetations(Connection Conn, int rownum,String sql) { int r..

Running Selenium WebDriver python bindings in chrome

I ran into a problem while working with Selenium. For my project, I have to use Chrome. However, I can't connect to that browser after launching it with Selenium. For some reason, Selenium can't find..

Android studio logcat nothing to show

I installed Android Studio yesterday, and I tried to use the LogCat to see the logs. But there is nothing to show in the logcat. I used the terminal to run ./adb logcat and it works. Is there someo..

Gradle build without tests

I want to execute gradle build without executing the unit tests. I tried: $ gradle -Dskip.tests build That doesn't seem to do anything. Is there some other command I could use?..

Difference between @Before, @BeforeClass, @BeforeEach and @BeforeAll

What is the main difference between @Before and @BeforeClass and in JUnit 5 @BeforeEach and @BeforeAll @After and @AfterClass According to the JUnit Api @Before is used in the following case: ..

Convert String to SecureString

How to convert String to SecureString?..

What is the difference between, and localhost?

I am using Jekyll and Vagrant on my mac. I found that Jekyll server will bind to instead of Also gem server will bind to this address by default. I can still visit it via ..

Base64 encoding in SQL Server 2005 T-SQL

I'd like to write a T-SQL query where I encode a string as a Base64 string. Surprisingly, I can't find any native T-SQL functions for doing Base64 encoding. Does a native function exist? If not, wh..

Clear Application's Data Programmatically

I want to clear my application's data programmatically. Application's data may contain anything like databases, shared preferences, Internal-External files or any other files created within the appl..

How to build minified and uncompressed bundle with webpack?

Here's my webpack.config.js var webpack = require("webpack"); module.exports = { entry: "./entry.js", devtool: "source-map", output: { path: "./dist", filename: "bundle.min.js" }, ..

async await return Task

Can somebody explain what does this means into a synchronous method? If I try to change the method to async then VS complain about it. This works: public Task MethodName() { return Task.FromRes..

Getting the names of all files in a directory with PHP

For some reason, I keep getting a '1' for the file names with this code: if (is_dir($log_directory)) { if ($handle = opendir($log_directory)) { while($file = readdir($handle) !== FALS..

How to remove duplicate objects in a List<MyObject> without equals/hashcode?

I have to remove duplicated objects in a List. It is a List from the object Blog that looks like this: public class Blog { private String title; private String author; private String url;..

How to return a value from a Form in C#?

I have a main form (let's call it frmHireQuote) that is a child of a main MDI form (frmMainMDI), that shows another form (frmImportContact) via ShowDialog() when a button is clicked. When the user cl..

How to use and style new AlertDialog from appCompat 22.1 and above

I am trying to migrate from default android AlertDialog to the new one included in appCompat-22.1 So far I understand you only have to import package in order to us..

MySQL ON DUPLICATE KEY UPDATE for multiple rows insert in single query

I have a SQL query where I want to insert multiple rows in single query. so I used something like: $sql = "INSERT INTO beautiful (name, age) VALUES ('Helen', 24), ('Katrina', 21), ('Samia', 2..

How to use null in switch

Integer i = ... switch (i){ case null: doSomething0(); break; } In the code above I cant use null in switch case statement. How can I do this differently? I can't use de..

Dropdownlist width in IE

In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. This basically means that I have..

C++ Cout & Cin & System "Ambiguous"

I was just programming in c++, when all of a sudden all the "cout"s and "cin"s were errors and "Ambiguous". Including System. I don't know why this happened. Everything was fine, I was coding the sam..

HTML Table cell background image alignment

I need the background image of a table cell to be aligned as Top in vertical side - Right in Horizontal But it is displaying as, Center in Vertical side ; Right in Horizontal Take a look a..

OnclientClick and OnClick is not working at the same time?

I have a button like the following, <asp:Button ID="pagerLeftButton" runat="server" OnClientClick="disable(this)" onclick="pager_Left_Click" Text="<" /> When I use my button like that, onc..

How to run the Python program forever?

I need to run my Python program forever in an infinite loop.. Currently I am running it like this - #!/usr/bin/python import time # some python code that I want # to keep on running # Is this ..

how do I get eclipse to use a different compiler version for Java?

It seems like this should be a simple task, with the options in the Preferences menu for different JREs and the ability to set different compiler and build paths per project. However, it also seems to..

How to check whether a str(variable) is empty or not?

How do I make a: if str(variable) == [contains text]: condition? (or something, because I am pretty sure that what I just wrote is completely wrong) I am sort of trying to check if a random.choi..

Convert pandas Series to DataFrame

I have a Pandas series sf: email [email protected] [1.0, 0.0, 0.0] [email protected] [2.0, 0.0, 0.0] [email protected] [1.0, 0.0, 0.0] [email protected] [4.0, 0.0, 0.0] [email protected] [1..

How to create Gmail filter searching for text only at start of subject line?

We receive regular automated build messages from Jenkins build servers at work. It'd be nice to ferret these away into a label, skipping the inbox. Using a filter is of course the right choice. The..

How to git clone a specific tag

From git-clone(1) Manual Page --branch can also take tags and detaches the HEAD at that commit in the resulting repository. I tried git clone --branch <tag_name> <repo_url> But ..

While, Do While, For loops in Assembly Language (emu8086)

I want to convert simple loops in high-level languages into assembly language (for emu8086) say, I have this code: for(int x = 0; x<=3; x++) { //Do something! } or int x=1; do{ //Do som..

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need he..

How to save image in database using C#

I want to save user image into a database in C#. How do I do that?..

Preventing an image from being draggable or selectable without using JS

Does anyone know of a way to make an image not draggable and not selectable -- at the same time -- in Firefox, without resorting to Javascript? Seems trivial, but here's the issue: Can be dragged and..

Get controller and action name from within controller?

For our web application I need to save the order of the fetched and displayed items depending on the view - or to be precise - the controller and action that generated the view (and the user id of cou..

sh: react-scripts: command not found after running npm start

I cloned a react application onto my system and ran following commands npm install -g create-react-app npm install --save react react-dom After that i ran npm start But it threw the above ment..

API Gateway CORS: no 'Access-Control-Allow-Origin' header

Although CORS has been set up through API Gateway and the Access-Control-Allow-Origin header is set, I still receive the following error when attempting to call the API from AJAX within Chrome: XM..

Rename a table in MySQL

Renaming a table is not working in MySQL RENAME TABLE group TO member; The error message is #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL se..

How can I grep for a string that begins with a dash/hyphen?

I want to grep for the string that starts with a dash/hyphen, like -X, in a file, but it's confusing this as a command line argument. I've tried: grep "-X" grep \-X grep '-X' ..

How do I connect to a SQL Server 2008 database using JDBC?

I have MSSQL 2008 installed on my local PC, and my Java application needs to connect to a MSSQL database. I am a new to MSSQL and I would like get some help on creating user login for my Java applicat..

Do C# Timers elapse on a separate thread?

Does a System.Timers.Timer elapse on a separate thread than the thread that created it? Lets say I have a class with a timer that fires every 5 seconds. When the timer fires, in the elapsed method, s..

How can I detect keydown or keypress event in angular.js?

I'm trying to get the value of a mobile number textbox to validate its input value using angular.js. I'm a newbie in using angular.js and not so sure how to implement those events and put some javascr..

is vs typeof

Which of these pieces of code is faster? if (obj is ClassA) {} if (obj.GetType() == typeof(ClassA)) {} Edit: I'm aware that they don't do the same thing...

SQL Server : GROUP BY clause to get comma-separated values

Possible Duplicate: SQL group_concat function in SQL Server I am looking to create a query but somehow I am unable to do so. Can anyone please help me out here? The original data ID Re..

Playing Sound In Hidden Tag

I am trying to set sound on web page. I found this code. It is working code when the div is visible but I want to be hidden and working. In this case it is not working because it is hidden with style..

Set cursor position on contentEditable <div>

I am after a definitive, cross-browser solution to set the cursor/caret position to the last known position when a contentEditable='on' <div> regains focus. It appears default functionality of a c..

How do I rewrite URLs in a proxy response in NGINX

I'm used to using Apache with mod_proxy_html, and am trying to achieve something similar with NGINX. The specific use case is that I have an admin UI running in Tomcat on port 8080 on a server at the..

How to parse JSON data with jQuery / JavaScript?

I have a AJAX call that returns some JSON like this: $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://example/functions.php', data: { get_param: 'valu..

Generate ER Diagram from existing MySQL database, created for CakePHP

For CakePHP application, I created MySQL database. Which tool to be used to create ER Diagram of database? Fields and relations between tables are created in a way cakePHP likes. thank you in advan..

Select2() is not a function

So i have downloaded select2 i have "installed it" by putting it into my folder and then loaded it on my site when i check the console (where i can see all of the scripts being loaded) i can see the f..

Using $_POST to get select option value from HTML

I use select as below: <select name="taskOption"> <option>First</option> <option>Second</option> <option>Third</option> </select> How do ..

Does tkinter have a table widget?

I'm learning Python, and I would like to use it to create a simple GUI application, and since Tkinter is already built-in (and very simple to use) I would like to use it to build my application. I wo..

Local Storage vs Cookies

I want to reduce load times on my websites by moving all cookies into local storage since they seem to have the same functionality. Are there any pros/cons (especially performance-wise) in using local..

WPF binding to Listbox selectedItem

Can anyone help with the following - been playing about with this but can't for the life of me get it to work. I've got a view model which contains the following properties; public ObservableCollect..

Is it possible to set a custom font for entire of application?

I need to use certain font for my entire application. I have .ttf file for the same. Is it possible to set this as default font, at application start up and then use it elsewhere in the application? W..

REST, HTTP DELETE and parameters

Is there anything non-RESTful about providing parameters to a HTTP DELETE request? My scenario is that I'm modelling the "Are you sure you want to delete that?" scenario. In some cases, the state o..

Where are the Properties.Settings.Default stored?

I thought I knew this, but today I'm being proven wrong - again. Running VS2008, .NET 3.5 and C#. I added the User settings to the Properties Settings tab with default values, then read them in usin..

Convert generic list to dataset in C#

I have a Generic list of Objects. Each object has 9 string properties. I want to turn that list into a dataset that i can pass to a datagridview......Whats the best way to go about doing this?..

How do I compare strings in Java?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it ..

How to set Field value using id in javascript?

I want to set an HTML field's value using JavaScript when onclick event is raised by clicking a button/hyperlink.. I Googled and found many articles using the name attribute, but I want to set the val..

What's an object file in C?

I am reading about libraries in C but I have not yet found an explanation on what an object file is. What's the real difference between any other compiled file and an object file? I would be glad if s..

Angular expression if array contains

I'm trying to add a class to an element if a jobSet has not been selected for approval using expressions. <li class="approvalUnit" ng-repeat="jobSet in dashboard.currentWork" ng-class="{-1:'approv..

How to split strings into text and number?

I'd like to split strings like these 'foofo21' 'bar432' 'foobar12345' into ['foofo', '21'] ['bar', '432'] ['foobar', '12345'] Does somebody know an easy and simple way to do this in python?..

Java File - Open A File And Write To It

I know we are supposed to add a snipit of code to our questions, but I am seriously dumbfounded and can't wrap my head or find any examples to follow from. Basically I want to open file C:\A.txt , w..

Extension mysqli is missing, phpmyadmin doesn't work

I have a problem with phpmyadmin on ubuntu 12.04. I have already installed apache2, php5, mysql and phpmyadmin. The phpinfo(); script, don't show nothing about mysqli or mysql extension. When I try ..

Git checkout: updating paths is incompatible with switching branches

My problem is related to Fatal Git error when switching branch. I try to fetch a remote branch with the command git checkout -b local-name origin/remote-name but I get this error message: fata..

How do I get the last character of a string?

How do I get the last character of a string? public class Main { public static void main(String[] args) { String s = "test string"; //char lastChar = ??? } } ..

How to trigger jQuery change event in code

I have a change event that is working fine but I need to get it to recurse. So I have a function that is triggered on change that will "change" other drop downs based on a class selector (notice "dro..

Working with INTERVAL and CURDATE in MySQL

I'm building a chart and I want to receive data for each month. Here's my first request which is working: SELECT s.GSP_nom AS nom, timestamp, AVG( + v.prix ) /2 AS avg FROM votes_serveur ..

DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server

Getting error when script move to other server. (node:15707) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.alloc..

library not found for -lPods

I got an error when archiving a project. This is my environment. Mac OS Lion Xcode 4.3.1 iOS SDK 5.1 The project deployment target is: IPHONEOS_DEPLOYMENT_TARGET 3.2 The error shows: ld: libra..

SQL Server remove milliseconds from datetime

select * from table where date > '2010-07-20 03:21:52' which I would expect to not give me any results... EXCEPT I'm getting a record with a datetime of 2010-07-20 03:21:52.577 how can I make th..

Convert String with Dot or Comma as decimal separator to number in JavaScript

An input element contains numbers a where comma or dot is used as decimal separator and space may be used to group thousands like this: '1,2' '110 000,23' '100 1.23' How would one convert th..

How to test if parameters exist in rails

I'm using an IF statement in Ruby on Rails to try and test if request parameters are set. Regardless of whether or not both parameters are set, the first part of the following if block gets triggered..

How to make the main content div fill height of screen with css

So I have a webpage with a header, mainbody, and footer. I want the mainbody to fill 100% of the page (fill 100% in between footer and header) My footer is position absolute with bottom: 0. Everytime ..

Break out of a While...Wend loop

I am using a While...Wend loop of VBA. Dim count as Integer While True count=count+1 If count = 10 Then ''What should be the statement to break the While...Wend loop? ''Bre..

Parsing JSON using

I'm trying to parse some JSON using the JSon.Net library. The documentation seems a little sparse and I'm confused as to how to accomplish what I need. Here is the format for the JSON I need to pars..

Running sites on "localhost" is extremely slow

Having real trouble using my localhost to test sites. It runs extremely slowly! Sometimes it takes up to a minute to load a page. I'm using Firefox and the sites I'm testing run fine on other develope..

"UnboundLocalError: local variable referenced before assignment" after an if statement

I have also tried searching for the answer but I don't understand the answers to other people's similar problems... tfile= open("/home/path/to/file",'r') def temp_sky(lreq, breq): for line in t..

Angular 4: How to include Bootstrap?

I'm a backend developer and I'm just playing around with Angular4. So I did this installation tutorial: Given this, how can I add bootstrap to the app so ..

How to change sender name (not email address) when using the linux mail command for autosending mail?

Mailbox shows the sender name as "Apache", because the mail I am autosending is being sent from a Perl CGI program. How do I change it to something else?..

getting error HTTP Status 405 - HTTP method GET is not supported by this URL but not used `get` ever?

I'm a beginner and making a small registration program with database But i'm trying to run this but it's giving me some errors pls help: HTTP Status 405 - HTTP method GET is not supported by this URL..

Perform commands over ssh with Python

I'm writing a script to automate some command line commands in Python. At the moment I'm doing calls thus: cmd = "some unix command" retcode =,shell=True) However I need to run ..

How to get value from form field in django framework?

How do I get values from form fields in the django framework? I want to do this in views, not in templates.....

Using R to download zipped data file, extract, and import data

@EZGraphs on Twitter writes: "Lots of online csvs are zipped. Is there a way to download, unzip the archive, and load the data to a data.frame using R? #Rstats" I was also trying to do this today, bu..

Why does the program give "illegal start of type" error?

here is the relevent code snippet: public static Rand searchCount (int[] x) { int a ; int b ; int c ; int d ; int f ; int g ; int h ; int i ; int j ; ..

What's the difference between HEAD, working tree and index, in Git?

Can someone tell me the difference between HEAD, working tree and index, in Git? From what I understand, they are all names for different branches. Is my assumption correct? Edit I found this ..

How to format JSON in notepad++

I want to format JSON String in notepad++. Kindly guide me how to do so. I looked into this solution Notepad ++ JSON Format. It tells me to download the a tool from This web site. But I don't know whi..

What Does 'zoom' do in CSS?

I found that some jQuery Plugin, in their css rule uses 'zoom' descriptor, I even Look into w3c website and found that it is used to magnify but how can I actually implement it? Or I have to Define so..

How to pass text in a textbox to JavaScript function?

Suppose I have the following HTML code, how can I pass the user's input to execute(str) JavaScript function as an argument? <body> <input name="textbox1" type="text" /> <input name="b..

How to make a rest post call from ReactJS code?

I am new to ReactJS and UI and I wanted to know how to make a simple REST based POST call from ReactJS code. If there is any example present it would be really helpful...

How to set cookie in node js using express framework?

In my application, I need to set a cookie using the express framework.I have tried the following code but it's not setting the cookie. Can anyone help me to do this? var express = require('express')..

How to copy to clipboard in Vim?

Is it possible to copy to clipboard directly from Vim? yy only copies stuff to Vim's internal buffer. I want to copy to the OS's clipboard. Is there any such command in Vim or you can only yank stuff ..

Eclipse fonts and background color

I have been trying to change the background color of Eclipse's windows to black and customize the font colors. There doesn't seem to be a way to do this, at least not in an obvious way. I am using ver..

Install specific branch from github using Npm

I would like to install bootstrap-loader from github in my project using npm Currently they are maintaining two version of this project which are comaptible with webpack version 1 and 2. I would lik..

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

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

POST data with request module on Node.JS

This module is 'request I think i'm following every step but i'm missing an argument.. var request = require('request');{ url: 'http://localh..

Sending Multipart File as POST parameters with RestTemplate requests

I am working with Spring 3 and RestTemplate. I have basically, two applications and one of them have to post values to the other app. through rest template. When the values to post are Strings, it's..

Get path from open file in Python

If I have an opened file, is there an os call to get the complete path as a string? f = open('/Users/Desktop/febROSTER2012.xls') From f, how would I get "/Users/Desktop/febROSTER2012.xls" ?..

CSS Cell Margin

In my HTML document, I have a table with two columns and multiple rows. How can I increase the space in between the first and second column with css? I've tried applying "margin-right: 10px;" to each ..

Sort array of objects by object fields

How can I sort this array of objects by one of its fields, like name or count ? Array ( [0] => stdClass Object ( [ID] => 1 [name] => Mary Jane ..

Cannot add a project to a Tomcat server in Eclipse

I cannot add my project to a server in Eclipse - why is that? I installed all necessary tools (Web Dev, Java EE, Server Adapters, and Tomcat itself, everything) I configured the runtime environments, ..

Save internal file in my own internal folder in Android

I try to save a txt file in my folder, in internal storage, but I face the same problem every time: "Source Not Found" I write my code in different ways expressed here as follows but in all ways..

Converting time stamps in excel to dates

I have a very large excel spread sheet that has a column of time stamps. Does anyone know convert that over to a date? Is there a function I can use? I tried format cell date but that doesn't work. My..

Concatenate multiple node values in xpath

I have a XML that looks like this <element1> <element2> <element3> <element4>Hello</element4> <element5>World</element5&..

How to fetch all Git branches

I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of them: $ git branch * master I know that I can do git branch -a to see all the branches..

Converting an int or String to a char array on Arduino

I am getting an int value from one of the analog pins on my Arduino. How do I concatenate this to a String and then convert the String to a char[]? It was suggested that I try char msg[] = myString.g..

Debugging with Android Studio stuck at "Waiting For Debugger" forever

UPDATE The supposed duplicate is a question on being stucking in "Waiting For Debugger" when executing Run, while this question is on being stucking in "Waiting For Debugger" when executing Debug, the..

Python if not == vs if !=

What is the difference between these two lines of code: if not x == 'val': and if x != 'val': Is one more efficient than the other? Would it be better to use if x == 'val': pass else: ..

MySQL "between" clause not inclusive?

If I run a query with a between clause, it seems to exclude the ending value. For example: select * from person where dob between '2011-01-01' and '2011-01-31' This gets all results with dob from '..

How to get the last char of a string in PHP?

I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PHP?..

Using an instance of an object as a key in hashmap, and then access it with exactly new object?

I have a hasmap with a key object, HashMap<Key, Object> test; and make new Key("the same") as key.. so its like..: test.put(new Key("the same"), someObject); (without storing that key in..

How to connect to SQL Server database from JavaScript in the browser?

Can anybody give me some sample source code showing how to connect to a SQL Server 2005 database from JavaScript locally? I am learning web programming on my desktop. Or do I need to use any other sc..

Getting data posted in between two dates

How can I retrieve data from the database by querying records between two dates using CodeIgniter's activerecord?..

Extract data from log file in specified range of time

I want to extract information from a log file using a shell script (bash) based on time range. A line in the log file looks like this: - - [31/Mar/2002:19:30:41 +0200] "GET / HTTP/1.1" 200..

Finding an item in a List<> using C#

I have a list which contains a collection of objects. How can I search for an item in this list where object.Property == myValue?..

Make div fill remaining space along the main axis in flexbox

I have 2 divs side-by-side in a flexbox. The right hand one should always be the same width, and I want the left hand one to just grab the remaining space. But it won't unless I specifically set its w..

What are the differences between delegates and events?

What are the differences between delegates and an events? Don't both hold references to functions that can be executed?..

A default document is not configured for the requested URL, and directory browsing is not enabled on the server

I have just deployed my mvc-2 website to a server (using dotnetpanel). But getting this error A default document is not configured for the requested URL, and directory browsing is not enabled..

What is a good naming convention for vars, methods, etc in C++?

I come from a the Objective-C and Cocoa world where there are lots of conventions and many people will say it makes your code beautiful! Now programming in C++ I cannot find a good document like this ..

setTimeout in React Native

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

jQuery Dialog Box

Im trying to do a dialog box with jquery. In this dialog box Im going to have terms and conditions. The problem is that the dialog box is only displayed for the FIRST TIME. This is the code. JavaScr..

How to annotate MYSQL autoincrement field with JPA annotations

Straight to the point, problem is saving the object Operator into MySQL DB. Prior to save, I try to select from this table and it works, so is connection to db. Here is my Operator object: @Entity p..

How to press back button in android programmatically?

In my app I have a logout functionality. If user clicks logout it goes to home screen. Now I am exiting my app by pressing back button. But what I want is I need to exit automatically(i.e Programmati..

How can I perform static code analysis in PHP?

Is there a static analysis tool for PHP source files? The binary itself can check for syntax errors, but I'm looking for something that does more, like: unused variable assignments arrays that are as..

Create HTML table using Javascript

My question will ultimately be related to this site: EDIT: View unencrypted page source code here >>> This is an HTML..

Date formatting in WPF datagrid

I want to change is the date column from a format "DD/MM/YYYY HH:MM:SS" to "DD.MM.YYYY". <DataGrid Name="dgBuchung" AutoGenerateColumns="True" ..

What are advantages of Artificial Neural Networks over Support Vector Machines?

ANN (Artificial Neural Networks) and SVM (Support Vector Machines) are two popular strategies for supervised machine learning and classification. It's not often clear which method is better for a part..

Resize font-size according to div size

It is made of 9 boxes, with the middle on has text it in. I've made it so the boxes so they will resize with the screen resize so it will remain in the same place all the time. The text, however, doe..

Tomcat in Intellij Idea Community Edition

Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition? I tried to find some information about it but haven't achived any success...

Selecting multiple columns with linq query and lambda expression

I'm new to C# ASP.NET, and am working on my first application. I'm trying to create a linq statment that return an arrary. I have a table of products. I want to be able to select name, id, and price..

str.startswith with a list of strings to test for

I'm trying to avoid using so many if statements and comparisons and simply use a list, but not sure how to use it with str.startswith: if link.lower().startswith("js/") or link.lower().startswith("ca..

Server.UrlEncode vs. HttpUtility.UrlEncode

Is there a difference between Server.UrlEncode and HttpUtility.UrlEncode?..

How to calculate age in T-SQL with years, months, and days

What would be the best way to calculate someone's age in years, months, and days in T-SQL (SQL Server 2000)? The datediff function doesn't handle year boundaries well, plus getting the months and day..

How do I use cx_freeze?

I've created my file as instructed but I don't actually.. understand what to do next. Typing "python build" into the command line just gets a syntax error. So, what do I do? setup...

How to get current route in react-router 2.0.0-rc5

I have a router like below: <Router history={hashHistory}> <Route path="/" component={App}> <IndexRoute component={Index}/> <Route path="login" component={Log..

"The page you are requesting cannot be served because of the extension configuration." error message

I'm getting this error message when trying to run my application. I don't know how to fix it: HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension..

How do I merge a git tag onto a branch

I'm trying to find the syntax for merging a tagged commit onto another branch. I'm guessing that it's straight forward but my feeble search attempts aren't finding it...

The multi-part identifier could not be bound

I've seen similar errors on SO, but I don't find a solution for my problem. I have a SQL query like: SELECT DISTINCT a.maxa , b.mahuyen , a.tenxa , b.tenhuyen , ..

c# replace \" characters

I am sent an XML string that I'm trying to parse via an XmlReader and I'm trying to strip out the \" characters. I've tried .Replace(@"\", "") .Replace("\\''", "''") .Replace("\\''", "\"") plus s..

The import cannot be resolved

I am trying to run the code provided HERE I downloaded the code from their Github and imported into Android SDK, but it shows error at the lines import; impo..

Meaning of numbers in "col-md-4"," col-xs-1", "col-lg-2" in Bootstrap

I am confused with the grid system in the new Bootstrap, particularly these classes: col-lg-* col-md-* col-xs-* (where * represents some number). Can anyone please explain the following: How tha..

How to get the URL of the current page in C#

Can anyone help out me in getting the URL of the current working page of ASP.NET in C#?..

Force table column widths to always be fixed regardless of contents

I have an html table with table-layout: fixed and a td with a set width. The column still expands to hold the contents of text that doesn't contain a space. Is there a way to fix this other than wra..

What are enums and why are they useful?

Today I was browsing through some questions on this site and I found a mention of an enum being used in singleton pattern about purported thread safety benefits to such solution. I have never used enu..

How to send a header using a HTTP request through a curl call?

I wish to send a header to my Apache server on a Linux box. How can I achieve this via a curl call?..

HTML: how to make 2 tables with different CSS

I want to put two tables (on the same page) which should render differently (i.e. use different CSS for each table). Is it possible?..

Importing class from another file

Before you mark it as duplicate please read my problem: I am trying to import a class from a file from a subdirectory > > --->folder/ > -----> and in i have a c..

Resetting a form in Angular 2 after submit

I am aware that Angular 2 currently lacks a way to easily reset a form to a pristine state. Poking around I have found a solution like the one below that resets the form fields. It has been suggested..

Import Google Play Services library in Android Studio

I have an Android project that has been developed entirely within Android Studio (currently version 4.2, gradle version 1.9-all). I want to add functionality from Google Play Services. The project is ..

Is there a "theirs" version of "git merge -s ours"?

When merging topic branch "B" into "A" using git merge, I get some conflicts. I know all the conflicts can be solved using the version in "B". I am aware of git merge -s ours. But what I want is some..

How to convert list to string

How can I convert a list to a string using Python?..

java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String() in Java EE application

I am developing a Java EE application in which I need Base64 Encoding/Decoding So I added commons-codec-1.5.jar in WEB-INF/lib folder of my application and used import org.apache.commons.codec.bina..

How do I replace a double-quote with an escape-char double-quote in a string using JavaScript?

Say I have a string variable (var str) as follows- Dude, he totally said that "You Rock!" Now If I'm to make it look like as follows- Dude, he totally said that "You Rock!" How..

MySQL SELECT x FROM a WHERE NOT IN ( SELECT x FROM b ) - Unexpected result

I expect the result of the third query below to contain id=732. It doesn't. Why is that? mysql> SELECT id FROM match ORDER BY id DESC LIMIT 5 ; +------------+ | id | +------------+ | ..

How to Store Historical Data

Some co-workers and I got into a debate on the best way to store historical data. Currently, for some systems, I use a separate table to store historical data, and I keep an original table for the cu..

How to make Java 6, which fails SSL connection with "SSL peer shut down incorrectly", succeed like Java 7?

I'm seeing an SSL connection from a client running Java 6 fail with an exception like: Caused by: Remote host closed connection during handshake at

DisplayName attribute from Resources?

I have a localized application, and I am wondering if it is possible to have the DisplayName for a certain model property set from a Resource. I'd like to do something like this: public class MyMode..

How to access POST form fields

Here is my simple form: <form id="loginformA" action="userlogin" method="post"> <div> <label for="email">Email: </label> <input type="text" id="email" n..

Oracle DB : java.sql.SQLException: Closed Connection

Reasons for java.sql.SQLException: Closed Connection from Oracle?? java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException( ..

Command line .cmd/.bat script, how to get directory of running script

How can you get the directory of the script that was run and use it within the .cmd file?..

How to apply multiple transforms in CSS?

Using CSS, how can I apply more than one transform? Example: In the following, only the translation is applied, not the rotation. li:nth-child(2) { transform: rotate(15deg); transform: trans..

How to get root directory in yii2

yii2 Question My yii2 install in d:\wamp\www\yii2store I want to get above path to save images which will be uploaded by me or users. I have pass all available arguments in Yii::getAlias('@webroot'..

REST API using POST instead of GET

Let's assume a service offers some funcionality that I can use like this: GET /service/function?param1=value1&param2=value2 Is it right to say that I can use it with a POST query? POST /servic..

Filtering a pyspark dataframe using isin by exclusion

I am trying to get all rows within a dataframe where a columns value is not within a list (so filtering by exclusion). As an example: df = sqlContext.createDataFrame([('1','a'),('2','b'),('3','b'),(..

Difference between a View's Padding and Margin

What is the difference between a View's Margin and Padding?..

Extension methods must be defined in a non-generic static class

I'm getting the error: Extension methods must be defined in a non-generic static class On the line: public class LinqHelper Here is the helper class, based on Mark Gavells code. I'm really c..

How to make a div have a fixed size?

I made a site so when you click the button 30px it changes the font inside the div. I have a ul inside it with the bottons. When I change the size of font the div expands and the nav buttons move wit..

ini_set("memory_limit") in PHP 5.3.3 is not working at all

I had this working before : echo ini_get("memory_limit")."\n"; ini_set("memory_limit","256M"); echo ini_get("memory_limit")."\n"; That would input this : 32M 256M on a php script executed by c..

SQL Server: Filter output of sp_who2

Under SQL Server, is there an easy way to filter the output of sp_who2? Say I wanted to just show rows for a certain database, for example...

Python: converting a list of dictionaries to json

I have a list of dictionaries, looking some thing like this: list = [{'id': 123, 'data': 'qwerty', 'indices': [1,10]}, {'id': 345, 'data': 'mnbvc', 'indices': [2,11]}] and so on. There may be more ..

Break or return from Java 8 stream forEach?

When using external iteration over an Iterable we use break or return from enhanced for-each loop as: for (SomeObject obj : someObjects) { if (some_condition_met) { break; // or return obj ..

Python: Differentiating between row and column vectors

Is there a good way of differentiating between row and column vectors in python? So far I'm using numpy and scipy and what I see so far is that If I was to give one a vector, say from numpy import * ..

Loop structure inside gnuplot?

Is there any way to iteratively retrieve data from multiple files and plot them on the same graph in gnuplot. Suppose I have files like data1.txt, data2.txt......data1000.txt; each having the same num..

javascript: pause setTimeout();

If I have an active timeout running that was set through var t = setTimeout("dosomething()", 5000), Is there anyway to pause and resume it? Is there any way to get the time remaining on the current ..

Simple way to repeat a string

I'm looking for a simple commons method or operator that allows me to repeat some string n times. I know I could write this using a for loop, but I wish to avoid for loops whenever necessary and a sim..

Python: How exactly can you take a string, split it, reverse it and join it back together again?

How exactly can you take a string, split it, reverse it and join it back together again without the brackets, commas, etc. using python?..

MySQL compare now() (only date, not time) with a datetime field

I have a duedate column(datetime format) that specifies the due date of a ticket, now i need to get 'Due today' tickets base on the comparison between now() with duedate. i.e 2010-04-29 02:00 vs 2010-..

How to get Git to clone into current directory

I'm doing: git clone ssh://[email protected]/home/user/private/repos/project_hub.git ./ I'm getting: Fatal: destination path '.' already exists and is not an empty directory. I know path . alre..

Easy way to write contents of a Java InputStream to an OutputStream

I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, bu..

How to test that no exception is thrown?

I know that one way to do it would be: @Test public void foo() { try { // execute code that you expect not to throw Exceptions. } catch(Exception e) { fail("Should not have thro..

How do I install Java on Mac OSX allowing version switching?

I want to install OpenJDK Java on Mac OSX and have it work alongside other JDK's since it is a newer release. Currently, I downloaded the tar.gz and placed it in my path but that is hard to maintain...

MS Access: how to compact current database in VBA

Pretty simple question, I know. ..

Getting the last n elements of a vector. Is there a better way than using the length() function?

If, for argument's sake, I want the last five elements of a 10-length vector in Python, I can use the "-" operator in the range index so: >>> x = range(10) >>> x [0, 1, 2, 3, 4, 5, ..

How to deep merge instead of shallow merge?

Both Object.assign and Object spread only do a shallow merge. An example of the problem: // No object nesting const x = { a: 1 } const y = { b: 1 } const z = { ...x, ...y } // { a: 1, b: 1 } The o..

Div side by side without float

How can I make div 'left' and 'right' look like columns side by side? I know I can use float:left on them and that will work... but on step 5 and 6 in here

How to exit a function in bash

How would you exit out of a function if a condition is true without killing the whole script, just return back to before you called the function. Example # Start script Do scripty stuff here Ok now ..

What is a good Hash Function?

What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a good hash function. As a rule of ..

How to determine SSL cert expiration date from a PEM encoded certificate?

If I have the actual file and a Bash shell in Mac or Linux, how can I query the cert file for when it will expire? Not a web site, but actually the certificate file itself, assuming I have the csr, k..

Put a Delay in Javascript

I need to add a delay of about 100 miliseconds to my Javascript code but I don't want to use the setTimeout function of the window object and I don't want to use a busy loop. Does anyone have any sug..

How do I format a date in Jinja2?

Using Jinja2, how do I format a date field? I know in Python I can simply do this: print(car.date_of_manufacture.strftime('%Y-%m-%d')) But how do I format the date in Jinja2?..

How do I trim whitespace?

Is there a Python function that will trim whitespace (spaces and tabs) from a string? Example: \t example string\t ? example string..