Questions Tagged with #Tla+

TLA+ is a language and toolchain for specifications based on TLA, the Temporal Logic of Actions. The TLA Toolbox includes a translator from PlusCal to TLA+, the TLC model checker, and an IDE.

Unmount the directory which is mounted by sshfs in Mac

I've installed OSXFUSE in my mac and used sshfs to mount a remote directory. Now I would like to unmount it, but can't find the way. My OS is OSX 10.8 Mountain. Can anyone help?..

Difference between string object and string literal

What is the difference between String str = new String("abc"); and String str = "abc"; ..

Custom pagination view in Laravel 5

Laravel 4.2 has the option to specify a custom view in app/config/view.php such as: /* |-------------------------------------------------------------------------- | Pagination View |-----------------..

Web API optional parameters

I have a controller with the following signature: [Route("products/filter/{apc=apc}/{xpc=xpc}/{sku=sku}")] public IHttpActionResult Get(string apc, string xpc, int? sku) { ... } I call this method ..

Select All checkboxes using jQuery

I have the following html code: <input type="checkbox" id="ckbCheckAll" /> <p id="checkBoxes"> <input type="checkbox" class="checkBoxClass" id="Checkbox1" /> ..

Creating a random string with A-Z and 0-9 in Java

As the title suggest I need to create a random, 17 characters long, ID. Something like "AJB53JHS232ERO0H1". The order of letters and numbers is also random. I thought of creating an array with letters..

Disabled form inputs do not appear in the request

I have some disabled inputs in a form and I want to send them to a server, but Chrome excludes them from the request. Is there any workaround for this without adding a hidden field? <form actio..

In Angular, What is 'pathmatch: full' and what effect does it have?

In here it is use pathmatch as full and when i delete this pathmatch it doesn't even load the app or run the project import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/..

How to export table data in MySql Workbench to csv?

I am wondering how do I export table data into a csv? I read that I need to use mysql workbench command line but I can not figure out how to launch the cmd line(don't know what the command is). Runni..


Could someone give me some guidance on when I should use WITH (NOLOCK) as opposed to SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED What are the pros/cons of each? Are there any unintended consequ..

C# LINQ find duplicates in List

Using LINQ, from a List<int>, how can I retrieve a list that contains entries repeated more than once and their values?..

find -mtime files older than 1 hour

I have this command that I run every 24 hours currently. find /var/www/html/audio -daystart -maxdepth 1 -mtime +1 -type f -name "*.mp3" -exec rm -f {} \; I would like to run it every 1 hour and del..

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

Swift how to sort array of custom objects by property value

lets say we have a custom class named imageFile and this class contains two properties. class imageFile { var fileName = String() var fileID = Int() } lots of them stored in Array var im..

Find the max of 3 numbers in Java with different data types

Say I have the following three constants: final static int MY_INT1 = 25; final static int MY_INT2 = -10; final static double MY_DOUBLE1 = 15.5; I want to take the three of them and use Math.max() t..

moving changed files to another branch for check-in

This often happens to me: I write some code, go to check in my changes, and then realize I'm not in the proper branch to check in those changes. However I can't switch to another branch without my cha..


Could you explain the difference between CLOCK_REALTIME and CLOCK_MONOTONIC clocks returned by clock_gettime() on Linux? Which is a better choice if I need to compute elapsed time between timestamps ..

How to return a value from try, catch, and finally?

So when I do a code of blocks inside a try{}, and I try to return a value, it tells me no return values import org.w3c.dom.ranges.RangeException; public class Pg257E5 { public static void ma..

How to generate .json file with PHP?

CREATE TABLE Posts { id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(200), url VARCHAR(200) } json.php code <?php $sql=mysql_query("select * from Posts limit 20"); echo '{"posts": ['; while($ro..

How to add scroll bar to the Relative Layout?

I am new to the Android app development. Now I am designing an app, in that I have an Activity which is containing some content but these content is some what more so the content is out of the screen...

Is it possible to have SSL certificate for IP address, not domain name?

I want my site to use URLs like and for static content to avoid unnecessary cookies in request AND avoid additional DNS request. Is there any way to obtain ..

What is the most efficient way to create HTML elements using jQuery?

Recently I've been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelmingly been along the lines of: ..

Why so red? IntelliJ seems to think every declaration/method cannot be found/resolved

I just installed and re-installed IntelliJ. Every Java file is coming up RED. I checked the JDK; it is at 1.6.##. The maven clean install build worked just fine. I'm getting the usual highlighted err..

Show/Hide Div on Scroll

I have a div that sits at the bottom of a slideshow that I want to disappear when the user scrolls or uses down arrow then reappears when scrolls back to the top. I am guessing this is incorporating t..

'ssh' is not recognized as an internal or external command

I have been trying to deploy my app into the Fortrabbit servers using the command line. I'm using windows. Here is what I tried : C:\projects\riwaya>git remote add fort [email protected]:riw..

java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android

I developed an application that uses lots of images on Android. The app runs once, fills the information on the screen (Layouts, Listviews, Textviews, ImageViews, etc) and user reads the information...

How to change the decimal separator of DecimalFormat from comma to dot/point?

I have this little crazy method that converts BigDecimal values into nice and readable Strings. private String formatBigDecimal(BigDecimal bd){ DecimalFormat df = new DecimalFormat(); df.setM..

Apache redirect to another port

I've struggled with this for some time and am definitely doing something wrong. I have apache server and a JBoss server on the same machine. I'd like to redirect traffic for to JBoss ..

Eloquent Collection: Counting and Detect Empty

This may be a trivial question but I am wondering if Laravel recommends a certain way to check whether an Eloquent collection returned from $result = Model::where(...)->get() is empty, as well as c..

javascript toISOString() ignores timezone offset

I am trying to convert Twitter datetime to a local iso-string (for prettyDate) now for 2 days. I'm just not getting the local time right.. im using the following function: function getLocalISOTime(t..

How to programmatically connect a client to a WCF service?

I'm trying to connect an application (the client) to an exposed WCF service, but not through the application configuration file, but in code. How should I go about doing this?..


I'm trying to run MULTIPLE commands like this. docker run image cd /path/to/somewhere && python But this gives me "No such file or directory" error because it is interpreted as... "do..

SQL Server returns error "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'." in Windows application

An application that has been working without problem (and has not had any active development done on it in about 6 months or so) recently began failing to connect to database. Operations admins cant ..

Selenium Finding elements by class name in python

How can I filter elements that have the same class? <html> <body> <p class="content">Link1.</p> </body> </html> <html> <body> &l..


I am getting error only in IE7 as document.body is null; when I debug with Microsoft script editor I am getting the error in the following line: i.e. document.body.appendChild(i) Code: functio..

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)?

I need to get all controls on a form that are of type x. I'm pretty sure I saw that code once in the past that used something like this: dim ctrls() as Control ctrls = Me.Controls(GetType(TextBox)) ..

No input file specified

I'm running Anchor CMS and I just upgraded to version 0.8. When I try and run the installer I get a 'No input file specified' error. I believe it's more than likely a .htaccess problem but I'm not sur..

How to convert int to date in SQL Server 2008

I am using MS SQL Server 2008, and in a table I have column idate as date but in the integer format. But in the query I want that in the date format. Is it possible to convert integer date into proper..

Calculate number of hours between 2 dates in PHP

How do I calculate the difference between two dates in hours? For example: day1=2006-04-12 12:30:00 day2=2006-04-14 11:30:00 In this case the result should be 47 hours...

Swapping pointers in C (char, int)

I have been struggling to understand the different behaviour when swapping pointers in C. If I want to swap two int pointers, then I can do void intSwap (int *pa, int *pb){ int temp = *pa; *p..

adb devices command not working

I'm running Ubuntu 10.10 64 bit. I have ia32-libs installed along with Android Debug Bridge version 1.0.26. My problem(s): adb devices >>> ???????????? no permissions sudo adb devices >>>> sudo: ..

ng is not recognized as an internal or external command

Running windows 7 Professional 32bit. I tried running npm install -g angular-cli both under normal or admin. I also tried adding it to the Enviorment Variables under PATH: (C:\Users\Administrator\A..

How to solve munmap_chunk(): invalid pointer error in C++

I have an application in C++ and OpenCV which tries to use the classification model realized with SVMLight in order to add the weight values which can be use for HOG Calssificator under OpenCV. The p..

NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll

Recently I started to get this error: NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll. I am using React Native to build my app (I am not familiar with ios ..

How do I programmatically change file permissions?

In Java, I'm dynamically creating a set of files and I'd like to change the file permissions on these files on a linux/unix file system. I'd like to be able to execute the Java equivalent of chmod. I..

Https Connection Android

I am doing a https post and I'm getting an exception of ssl exception Not trusted server certificate. If i do normal http it is working perfectly fine. Do I have to accept the server certificate someh..

Cannot delete or update a parent row: a foreign key constraint fails

When doing: DELETE FROM `jobs` WHERE `job_id` =1 LIMIT 1 It errors: #1451 - Cannot delete or update a parent row: a foreign key constraint fails (paymesomething.advertisers, CONSTRAINT advertise..

How to find specific lines in a table using Selenium?

Here is an example code: <div id="productOrderContainer"> <table class="table gradient myPage"> So this table being in productOrderContainer has several columns and depending on several..

How to implement a secure REST API with node.js

I start planning a REST API with node.js ,express and mongodb. The API provides data for a website (public and private area) and maybe later a mobile app. The frontend will be developed with AngularJS..

How can I change the date format in Java?

I need to change the date format using Java from dd/MM/yyyy to yyyy/MM/dd ..

In C# check that filename is *possibly* valid (not that it exists)

Is there a method in the System.IO namespace that checks the validity of a filename? For example, C:\foo\bar would validate and :"~-* would not Or a little trickier, X:\foo\bar would validate is the..

HTML Code for text checkbox '?'

Is there an HTML code for the text checkbox '?'? EDIT: So to be clear, I need the HTML Number for the symbol ?, not the form element checkbox...

Installed SSL certificate in certificate store, but it's not in IIS certificate list

After installation of a wildcard SSL certificate into the certificate store, the certificate does not appear in the IIS certificate list for use with site bindings. The certificate was installed corr..

How do I do top 1 in Oracle?

How do I do the following? select top 1 Fname from MyTbl In Oracle 11g?..

How to use variables in a command in sed?

I have exec $ROOT/Subsystem/ On a Unix box, if I print echo $HOME then I get /HOME/COM/FILE. I want to replace $ROOT with $HOME using sed. Expected Output: exec /HOME/COM/FILE/Sub..

Can I loop through a table variable in T-SQL?

Is there anyway to loop through a table variable in T-SQL? DECLARE @table1 TABLE ( col1 int ) INSERT into @table1 SELECT col1 FROM table2 I use cursors as well, but cursors seem less flexible tha..

Excel - Combine multiple columns into one column

I have multiple lists that are in separate columns in excel. What I need to do is combine these columns of data into one big column. I do not care if there are duplicate entries, however I want it to ..

Rails: Why "sudo" command is not recognized?

In my application directory (on Windows) I run: sudo pdfkit --install-wkhtmltopdf as explained here, but I got this error: 'sudo' is not recognized as an internal or external command, op..

How to SHA1 hash a string in Android?

In Objective C I've been using the following code to hash a string: -(NSString *) sha1:(NSString*)stringToHash { const char *cStr = [stringToHash UTF8String]; unsigned char result[20]; ..

Change color and appearance of drop down arrow

I want to change the default appearance of the arrow of a dropdown list so that looks the same across browsers. Is there a way to override the default look and feel of the drop down arrow using CSS or..

Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger

I've got an interesting problem in which the org.apache.log4j.Logger class is not found during runtime. I'm trying to get authorized and that is where it's failing: OAuthAuthorizer oauthAuthorizer = ..

Removing items from a list

While looping through a list, I would like to remove an item of a list depending on a condition. See the code below. This gives me a ConcurrentModification exception. for (Object a : list) { if ..

Is there a way to override class variables in Java?

class Dad { protected static String me = "dad"; public void printMe() { System.out.println(me); } } class Son extends Dad { protected static String me = "son"; } public ..

mysql said: Cannot connect: invalid settings. xampp

I changed the root password to test and now I cannot login in phpMyAdmin page in XAMPP. I looked for help here and here which basically says changed file in XAMPP\PHPMYADMIN folder. /*..

Delete with Join in MySQL

Here is the script to create my tables: CREATE TABLE clients ( client_i INT(11), PRIMARY KEY (client_id) ); CREATE TABLE projects ( project_id INT(11) UNSIGNED, client_id INT(11) UNSIGNE..

Eclipse error "Could not find or load main class"

I know there are many duplicates of this question, but I have looked at them all, and none of them have solved the issue. I am trying to run a class that has a main function. I have cleaned the proje..

Stupid error: Failed to load resource: net::ERR_CACHE_MISS

I'm developing Web app in Yii framework. I need use AJAX in my some pages. So, when I clicked the button (which I loaded them with AJAX the Google Chrome Developer Tools browser says me: Failed t..

new Date() is working in Chrome but not Firefox

I am creating a datetime string that looks like this: 2010-07-15 11:54:21 And with the following code I get invalid date in Firefox but works just fine in Chrome var todayDateTime = year + '-' + mo..

Split array into chunks of N length

How to split an array (which has 10 items) into 4 chunks, which contain a maximum of n items. var a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; //a function splits it to four arrays. consol..

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()?

I am using a scientific software including a Python script that is calling os.system() which is used to run another scientific program. While the subprocess is running, Python at some point prints the..

Find size of object instance in bytes in c#

For any arbitrary instance (collections of different objects, compositions, single objects, etc) How can I determine its size in bytes? (I've currently got a collection of various objects and i'm tr..

Are there any SHA-256 javascript implementations that are generally considered trustworthy?

I am writing a login for a forum, and need to hash the password client side in javascript before sending it on to the server. I'm having trouble figuring out which SHA-256 implementation I can actuall..

git: diff between file in local repo and origin

I want to find the differences between a file I have in my local repo vs what is in the origin master. I know that there is git diff, however I just want to isolate it down to this one particular fil..

Running code in main thread from another thread

In an android service I have created thread(s) for doing some background task. I have a situation where a thread needs to post certain task on main thread's message queue, for example a Runnable. Is t..

Dynamically adding elements to ArrayList in Groovy

I am new to Groovy and, despite reading many articles and questions about this, I am still not clear of what is going on. From what I understood so far, when you create a new array in Groovy, the unde..

Padding a table row

<html> <head> <title>Table Row Padding Issue</title> <style type="text/css"> tr { padding: 20px; } <..

How do I select a sibling element using jQuery?

Can you help me with this jQuery selector? $(".auctiondiv .auctiondivleftcontainer .countdown").each(function () { var newValue = parseInt($(this).text(), 10) - 1; $(this).text(newValue); ..

Recursive query in SQL Server

I have a table with following structure Table name: matches That basically stores which product is matching which product. I need to process this table And store in a groups table like below. Tab..

How do you truncate all tables in a database using TSQL?

I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. ..

How to validate phone numbers using regex

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-23..

ps1 cannot be loaded because running scripts is disabled on this system

I try to run powershell script from c#. First i set the ExecutionPolicy to Unrestricted and the script is running now from PowerShell ISE. Now this is c# my code: class Program { private static..

Disabling Minimize & Maximize On WinForm?

WinForms have those three boxes in the upper right hand corner that minimize, maximize, and close the form. What I want to be able to do is to remove the minimize and maximize, while keeping the clos..

Export to CSV via PHP

Let's say I have a database.... is there a way I can export what I have from the database to a CSV file (and text file [if possible]) via PHP?..

javascript jquery radio button click

I have 2 radio buttons and jquery running. <input type="radio" name="lom" value="1" checked> first <input type="radio" name="lom" value="2"> second Now, with a button I can set onClick ..

dynamically set iframe src

I have a program which will dynamically set an iframe src to load pages. I need to hook a event handler for the page completely loaded. How can i do it? Thanks!..

Setting DataContext in XAML in WPF

I have following code: MainWindow.xaml <Window x:Class="SampleApplication.MainWindow" xmlns="" xmlns:x="http://schemas.mic..

Using Font Awesome icon for bullet points, with a single list item element

We'd like to be able to use a Font Awesome ( ) icon as a bullet point for unordered lists in a CMS. The text editor on the CMS only outputs raw HTML so add..

TypeError: Router.use() requires middleware function but got a Object

There have been some middleware changes on the new version of express and I have made some changes in my code around some of the other posts on this issue but I can't get anything to stick. We had it..

List<String> to ArrayList<String> conversion issue

I have a following method...which actually takes the list of sentences and splits each sentence into words. Here is it: public List<String> getWords(List<String> strSentences){ allWords =..

How do I put variables inside javascript strings?

s = 'hello %s, how are you doing' % (my_name) That's how you do it in python. How can you do that in javascript/node.js?..

How do I create and store md5 passwords in mysql

Probably a very newbie question but, Ive been reading around and have found some difficulty in understanding the creation and storage of passwords. From what i've read md5/hash passwords are the best ..

How do I set default values for functions parameters in Matlab?

Is it possible to have default arguments in Matlab? For instance, here: function wave(a, b, n, k, T, f, flag, fTrue=inline('0')) I would like to have the true solution be an optional argument to t..

jQuery - getting custom attribute from selected option

Given the following: <select id="location"> <option value="a" myTag="123">My option</option> <option value="b" myTag="456">My other option</option> </select&g..

How to declare global variables in Android?

I am creating an application which requires login. I created the main and the login activity. In the main activity onCreate method I added the following condition: public void onCreate(Bundle savedI..

SwiftUI - How do I change the background color of a View?

I'm beginning to try out SwiftUI and I'm surprised that it doesn't seem to be straightforward to change the background color of a View. How do you do this using SwiftUI?..

How can I access global variable inside class in Python

I have this: g_c = 0 class TestClass(): global g_c def run(self): for i in range(10): g_c = 1 print(g_c) t = TestClass() print(g_c) how can I actu..

Focus Next Element In Tab Index

I am trying to move the focus to the next element in the tab sequence based upon the current element which has focus. Thus far I have not turned up anything in my searches. function OnFocusOut() { ..

How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?

When I have a link that is wired-up with a jQuery or JavaScript event such as: <a href="#">My Link</a> How do I prevent the page from scrolling to the top? When I remove the href attri..

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

DATEDIFF function in Oracle

I need to use Oracle but DATEDIFF function doesn't work in Oracle DB. How to write the following code in Oracle? I saw some examples using INTERVAL or TRUNC. SELECT DATEDIFF ('2000-01-01','2000-01-..

How can I repeat a character in Bash?

How could I do this with echo? perl -E 'say "=" x 100' ..

NPM clean modules

Is there a way to get npm to unbuild all the modules under node_modules? Something like npm rebuild that removes all build artifacts but doesn't rebuild them?..

Styling HTML email for Gmail

I'm generating a html email that uses an internal stylesheet, i.e. <!doctype html> <html> <head> <style type="text/css"> {color: red} </style> </he..

JQuery: Change value of hidden input field

I'm having a hella time setting the value of a hidden input. I want to pass the HTML from between the option tags to the hidden field- end run it will the page title from wordpress' wp_list_dropdow..

List of foreign keys and the tables they reference in Oracle DB

I'm trying to find a query which will return me a list of the foreign keys for a table and the tables and columns they reference. I am half way there with SELECT a.table_name, a.column_name..

Best Practice to Use HttpClient in Multithreaded Environment

For a while, I have been using HttpClient in a multithreaded environment. For every thread, when it initiates a connection, it will create a completely new HttpClient instance. Recently, I have disco..

MVC 3 file upload and model binding

I have a form upload that works but I would like to pass model information for my database to save the file with a different name of course. Here is my Razor view: @model CertispecWeb.Models.Contain..

Remove duplicate elements from array in Ruby

I have a Ruby array which contains duplicate elements. array = [1,2,2,1,4,4,5,6,7,8,5,6] How can I remove all the duplicate elements from this array while retaining all unique elements without usin..

How to set Default Controller in MVC 4 & MVC 5

How do I set Default Controller for my ASP.NET MVC 4 project without making it HomeController? How should I setup a default Area when the application starts?..

How to add a JAR in NetBeans

Let's say you create a new project, and want it to make use of some 3rd party library, say, widget.jar. Where do you add this JAR: File >> Project Properties >> Libraries >> Compile-Time Libraries; ..

Regex to remove all special characters from string?

I'm completely incapable of regular expressions, and so I need some help with a problem that I think would best be solved by using regular expressions. I have list of strings in C#: List<string&g..

Check if xdebug is working

Without installing a texteditor or an IDE, is it possible to test if xdebug is working, i.e. if it can debug php code? The only part xdebug comes up in phpinfo() is the following: Additional .ini..

Allow User to input HTML in ASP.NET MVC - ValidateInput or AllowHtml

How can I allow a user to input HTML into a particular field using MVC. I have a long form with many fields that get mapped to this complex object in the controller. I would like to make one..

Count number of rows within each group

I have a dataframe and I would like to count the number of rows within each group. I reguarly use the aggregate function to sum data as follows: df2 <- aggregate(x ~ Year + Month, data = df1, sum)..

How to get html table td cell value by JavaScript?

I have an HTML table created with dynamic data and cannot predict the number of rows in it. What I want to do is to get the value of a cell when a row is clicked. I know to use td onclick but I do not..

How do I pipe a subprocess call to a text file?["/home/myuser/", "/tmp/ad_xml", "/tmp/video_xml"]) RIght now I have a script that I run. When I run it and it hits this line, it starts printing stuff because has prin..

Get the difference between dates in terms of weeks, months, quarters, and years

I have two dates let´s say 14.01.2013 and 26.03.2014. I would like to get the difference between those two dates in terms of weeks(?), months(in the example 14), quarters(4) and years(1). Do you kn..

SQL Query - Concatenating Results into One String

I have a sql function that includes this code: DECLARE @CodeNameString varchar(100) SELECT CodeName FROM AccountCodes ORDER BY Sort I need to concatenate all results from the select query into Cod..

Selenium Error - The HTTP request to the remote WebDriver timed out after 60 seconds

I've been using Selenium for a number of months, which we're using to automate some of our internal testing processes. The scripts have been passing fine. I've recently upgraded to C# 2.40.0 webdriver..

How does Django's Meta class work?

I am using Django which allows people to add extra parameters to a class by using class Meta. class FooModel(models.Model): ... class Meta: ... The only thing I found in Python's do..

What is the easiest way to encrypt a password when I save it to the registry?

Currently I'm writing it in clear text oops!, it's an in house program so it's not that bad but I'd like to do it right. How should I go about encrypting this when writing to the registry and how do I..

On delete cascade with doctrine2

I'm trying to make a simple example in order to learn how to delete a row from a parent table and automatically delete the matching rows in the child table using Doctrine2. Here are the two entities ..

SQL ORDER BY multiple columns

I want to sort my products table by two columns: prod_price and prod_name. SELECT prod_id, prod_price, prod_name FROM Products ORDER BY prod_price, prod_name; How is the sorting done here? I think..

What is the difference between C# and .NET?

May I know what is the difference between C# and .NET? When I think of C#, right away I would say it is a .NET language, but when I search for job posts, they require candidates to have C# and .NET ex..

gitx How do I get my 'Detached HEAD' commits back into master

Using Git X and must have fumbled royally on something. Looks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and..

AttributeError: 'str' object has no attribute

I'm pretty new to python programming and I wanted to try my hand at a simple text adventure game, but I've immediately stumbled on a roadblock. class userInterface: def __init__(self, roomID, roo..

TSQL Pivot without aggregate function

I have a table like this... CustomerID DBColumnName Data -------------------------------------- 1 FirstName Joe 1 MiddleName S 1 LastName Smith 1 ..

How do I make flex box work in safari?

How do I make flex boxes work in Safari? I have a responsive nav that uses a CSS flex box to be responsive and for some reason it won't work in Safari. Here is my code: _x000D_ _x000D_ #menu {_x000D..

Git keeps prompting me for a password

I've been using Git for a while now, but the constant requests for a password are starting to drive me up the wall. I'm using Mac OS X and GitHub, and I set up Git and my SSH keys as instru..

How to customize the background/border colors of a grouped table view cell?

I would like to customize both the background and the border color of a grouped-style UITableView. I was able to customize the background color by using the following: tableView.contentView.backgrou..

Capitalize the first letter of string in AngularJs

I want capitalize first character of string in angularjs As i used {{ uppercase_expression | uppercase}} it convert whole string to upper case...

Does :before not work on img elements?

I'm trying to use the :before selector to place an image over another image, but I'm finding that it simply doesn't work to place an image before an img element, only some other element. Specifically..

How to set date format in HTML date input tag?

I am wondering whether it is possible to set the date format in the html <input type="date"></input> tag... Currently it is yyyy-mm-dd, while I need it in the dd-mm-yyyy format...

Fastest way to compute entropy in Python

In my project I need to compute the entropy of 0-1 vectors many times. Here's my code: def entropy(labels): """ Computes entropy of 0-1 vector. """ n_labels = len(labels) if n_labels <..

how to get javaScript event source element?

Is there a way to retrieve the element source of an inline javaScript call? I have a button like this: <button onclick="doSomething('param')" id="id_button">action</button> Note: the..

Do I need to convert .CER to .CRT for Apache SSL certificates? If so, how?

I need to setup an Apache 2 server with SSL. I have my *.key file, but all the documentation I've found online, *.crt files are specified, and my CA only provided me with a *.cer file. Are *.cer fil..

Validating with an XML schema in Python

I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python? I'd prefer something using the standard library, but..

Oracle date format picture ends before converting entire input string

My table has two DATE format attributes, however, when i try to insert value it throws an error: date format picture ends before converting entire input string. Here is my attempted code: insert into..

IF a == true OR b == true statement

I can't find a way to have TWIG interpret the following conditional statement: {% if a == true or b == true %} do stuff {% endif %} Am I missing something or it's not possible?..

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbname

I have this Java program: import java.sql.*; import java.util.Properties; public class MySQLConnectExample { public static void main(String[] args) { Connection ..

Unable to locate an executable at "/usr/bin/java/bin/java" (-1)

I am having a pathetic issue with Java in my mac osx 10.7.3 . Previously I installed it and it was working fine. After some changes in the .bash_profile and .profile file in the course of time, I am h..

Solutions for INSERT OR UPDATE on SQL Server

Assume a table structure of MyTable(KEY, datafield1, datafield2...). Often I want to either update an existing record, or insert a new record if it doesn't exist. Essentially: IF (key exists) run..

oracle varchar to number

How do i convert a oracle varchar value to number eg table - exception exception_value 555 where exception_value is a varchar type I would like to test the value of exception_value column select..

Find position of a node using xpath

Anyone know how to get the position of a node using xpath? Say I have the following xml: <a> <b>zyx</b> <b>wvu</b> <b>tsr</b> <b>qpo&l..

How do I split a string so I can access item x?

Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?..

How do I remove all null and empty string values from an object?

Can you please tell me how to remove all null and empty string values from an object? I am getting an error while deleting the key. This is what I have so far, but it doesn't work properly: $.each(sjo..

OS X Bash, 'watch' command

I'm looking for the best way to duplicate the Linux 'watch' command on Mac OS X. I'd like to run a command every few seconds to pattern match on the contents of an output file using 'tail' and 'sed'..

Session only cookies with Javascript

I was wondering if it's possible to create session only cookies with Javascript. When the browser is closed the cookies should be removed. I can't use anything on the server as the website is HTML o..

What does "make oldconfig" do exactly in the Linux kernel makefile?

Can anyone explain what the target "oldconfig" does exactly in the Linux kernel makefile? I see it referenced in some build documentation but never explained what it does exactly...

How to set a header in an HTTP response?

I've a servlet A where I'm setting a header in the HTTP response: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Stri..

In C - check if a char exists in a char array

I'm trying to check if a character belongs to a list/array of invalid characters. Coming from a Python background, I used to be able to just say : for c in string: if c in invalid_characters: ..

Listing files in a specific "folder" of a AWS S3 bucket

I need to list all files contained in a certain folder contained in my S3 bucket. The folder structure is the following /my-bucket/users/<user-id>/contacts/<contact-id> I have files re..

How to get the file name from a full path using JavaScript?

Is there a way that I can get the last value (based on the '\' symbol) from a full path? Example: C:\Documents and Settings\img\recycled log.jpg With this case, I just want to get recycled log.jpg ..

Android sample bluetooth code to send a simple string via bluetooth

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

Getting Error - ORA-01858: a non-numeric character was found where a numeric was expected

I am getting the error in the below sql: ORA-01858: a non-numeric character was found where a numeric was expected SELECT c.contract_num, CASE WHEN ( MAX (TO_CHAR (TO_D..

How to handle click event in Button Column in Datagridview?

I am developing a windows application using C#. I am using DataGridView to display data. I have added a button column in that. I want to know how can I handle click event on that button in DataGridVie..

Set a default parameter value for a JavaScript function

I would like a JavaScript function to have optional arguments which I set a default on, which get used if the value isn't defined (and ignored if the value is passed). In Ruby you can do it like this:..

Difference between setUp() and setUpBeforeClass()

When unit testing with JUnit, there are two similar methods, setUp() and setUpBeforeClass(). What is the difference between these methods? Also, what is the difference between tearDown() and tearDownA..

Python 2.6: Class inside a Class?

Hey everyone, my problem is that im trying to figure out how to get a class INSIDE another class. What I am doing is I have a class for an Airplane with all its statistics as to how fast it can fly, ..

Converting array to list in Java

How do I convert an array to a list in Java? I used the Arrays.asList() but the behavior (and signature) somehow changed from Java SE 1.4.2 (docs now in archive) to 8 and most snippets I found on the..

IIS - 401.3 - Unauthorized

I am trying to get started with using IIS. I created a new site on IIS Manager, mapped it to a folder on my file system and added index.html to the folder. I have set the port to 85 for this site. Whe..

SQL MERGE statement to update data

I've got a table with data named energydata it has just three columns (webmeterID, DateTime, kWh) I have a new set of updated data in a table temp_energydata. The DateTime and the webmeterID stay..

Could not resolve in Android Studio new project

I know about this questions: Failed to resolve: android Could not resolve [duplicate] And I've read this documentation..

Unsupported major.minor version 52.0

Pictures: Command Prompt showing versions Picture of error import java.applet.Applet; import java.awt.*; public class Hello extends Applet { // Java applet to draw "Hello World"..

How to copy data to clipboard in C#

How can I copy a string (e.g "hello") to the System Clipboard in C#, so next time I press CTRL+V I'll get "hello"?..

Rendering HTML inside textarea

I need to be able to render some HTML tags inside a textarea (namely <strong>, <i>, <u>, <a>) but textareas only interpret their content as text. Is there an easy way of doing ..

List all virtualenv

In virtualenvwrapper, is there a simple way to list all virtualenv on my machine? (like what yolk -l does to list all python packages in the current virtual environment?) CLARIFICATION: "ls -la" in..

Java Calendar, getting current month value, clarification needed

On November 1st .. Calendar.getInstance().get(Calendar.MONTH); // prints 10 (October) It would make sense if we start with 0, but it appears that we do not Calendar.getInstance().get(Calendar...

Changing iframe src with Javascript

I am trying to change an <iframe src=... > when someone clicks a radio button. For some reason my code is not working correctly and I am having trouble figuring out why. Here is what I have: _x..

Number of days in particular month of particular year?

How to know how many days has particular month of particular year? String date = "2010-01-19"; String[] ymd = date.split("-"); int year = Integer.parseInt(ymd[0]); int month = Integer.parseInt(ymd[1]..

Copy all values in a column to a new column in a pandas dataframe

This is a very basic question, I just can not seem to find an answer. I have a dataframe like this, called df: A B C a.1 b.1 c.1 a.2 b.2 c.2 a.3 b.3 c.3 Then I extract all..

Can I access a form in the controller?

I'm currently using the following. $scope.$$childHead.customerForm[firstName], so that: <form name="customerForm"> <input type="text" name="firstName" ng-model="

Config Error: This configuration section cannot be used at this path

I've encountered an error deploying a site to a server. When trying to load the home page, or access authentication on the new site in IIS, I get the error: Config Error: This configuration secti..

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

I download from Laravel for openshift then upload over my repository over github. This code for connect to database not work. The problem is that load variable f..

How to dynamically create columns in datatable and assign values to it?

I will have to create columns in datatable during runtime and assign values to it. How can i do it in Any sample please.....

Find nginx version?

I have installed nginx on Debian 7 with the following steps sudo apt-get update sudo apt-get upgrade sudo apt-get install nginx sudo service nginx start I have confirmed that this starts nginx by a..

javascript : sending custom parameters with but its not working

<html> <head> <script> function open_win() {"http://localhost:8080/login","mywindow") } </script> </head> <body> <input type="button" value="Op..

How can I include a YAML file inside another?

So I have two YAML files, "A" and "B" and I want the contents of A to be inserted inside B, either spliced into the existing data structure, like an array, or as a child of an element, like the value ..

How do you create a Swift Date object?

How do you create a date object from a date in swift xcode. eg in javascript you would do: var day = new Date('2014-05-20');..

Powershell 2 copy-item which creates a folder if doesn't exist

$from = "\\something\1 XLS\2010_04_22\*" $to = "c:\out\1 XLS\2010_04_22\" copy-item $from $to -Recurse This works if c:\out\1 XLS\2010_04_22\ does exist . Is it possible with a single command to c..

How can I check if a string contains a character in C#?

Is there a function I can apply to a string that will return true of false if a string contains a character. I have strings with one or more character options such as: var abc = "s"; var def = "aB"..

Explaining the 'find -mtime' command

I'm trying to remove all the dateed logs except the most recent. Before I execute a script to remove the files, I want to of course test my commands to make sure I'm bringing up accurate results. Whe..

Change input text border color without changing its height

Let's say I have a default text input without any CSS <input type="text" /> I want to change its border color to red so I add an style <input type="text" style="border-color:red" /> ..

List of tables, db schema, dump etc using the Python sqlite3 API

For some reason I can't find a way to get the equivalents of sqlite's interactive shell commands: .tables .dump using the Python sqlite3 API. Is there anything like that?..

How do I vertically center text with CSS?

I have a <div> element which contains text and I want to align the contents of this <div> vertically center. Here is my <div> style: _x000D_ _x000D_ #box { height: 170px; width: ..

jQuery click not working for dynamically created items

I have a piece of jQuery that loops through each element in a given div( #container) and does a javascript alert each time a span is clicked. This works fine if the <span>'s are static. Howeve..

How to compare strings in an "if" statement?

I want to test and see if a variable of type "char" can compare with a regular string like "cheese" for a comparison like: #include <stdio.h> int main() { char favoriteDairyProduct[30]; ..

Java: how do I get a class literal from a generic type?

Typically, I've seen people use the class literal like this: Class<Foo> cls = Foo.class; But what if the type is generic, e.g. List? This works fine, but has a warning since List should be pa..

How can I simulate a click to an anchor tag?

I want to simulate a click to an anchor tag with all extras like correct target handling. There seems to be a "[click()][3]" method for anchor's DOM object but not all browsers support that. Firefox ..

javascript regex for password containing at least 8 characters, 1 number, 1 upper and 1 lowercase

I am trying to write a regular expression to validate a password which must meet the following criteria: Contain at least 8 characters contain at least 1 number contain at least 1 lowercase charact..

Google Drive as FTP Server

Is there a way to use Google Drive as an FTP Server? I mean I have host, username and password and using Filezilla I can access GDrive folders, upload and download data and automate backups with many..

recyclerview No adapter attached; skipping layout

Just implemented RecyclerView in my code, replacing ListView. Everything works fine. The data is displayed. But error messages are being logged: 15:25:53.476 E/RecyclerView: No adapter attached; sk..

Difference between size and length methods?

What is the difference between .size() and .length ? Is .size() only for arraylists and .length only for arrays? ..

Split List into Sublists with LINQ

Is there any way I can separate a List<SomeObject> into several separate lists of SomeObject, using the item index as the delimiter of each split? Let me exemplify: I have a List<SomeObject..

How do I override nested NPM dependency versions?

I would like to use the grunt-contrib-jasmine NPM package. It has various dependencies. Part of the dependency graph looks like this: -- grunt-contrib[email protected] ¦ +-- [email protected] ..

Replacing spaces with underscores in JavaScript?

I'm trying to use this code to replace spaces with _, it works for the first space in the string but all the other instances of spaces remain unchanged. Anybody know why? function updateKey() { v..

How to debug a stored procedure in Toad?

I have Oracle 10g installed and there is a package which has a number of cursors and procedures, how do I debug one of these procedures or cursors. Can you please provide steps for that? I ran a Goog..

Getting Chrome to accept self-signed localhost certificate

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

How do I create a file AND any folders, if the folders don't exist?

Imagine I wish to create (or overwrite) the following file :- C:\Temp\Bar\Foo\Test.txt Using the File.Create(..) method, this can do it. BUT, if I don't have either one of the following folders (fro..

How to Verify if file exist with VB script

How do I verify via VBScript if the file conf exist under Program Files (i.e. C:\Program Files\conf)? For example if it exists, then msgBox "File exists" If not, then msgbox "File doesn't exist"..