Questions Tagged with #Whiteboard


Make element fixed on scroll

I'm attempting to make the navigation bar stick to the top, when the user scrolls down to the nav bar and then unstick when the user scrolls back up past the navbar. I understand that this can only be..

How do I create sql query for searching partial matches?

I have a set of items in db .Each item has a name and a description.I need to implement a search facility which takes a number of keywords and returns distinct items which have at least one of the key..

Find index of last occurrence of a substring in a string

I want to find the position (or index) of the last occurrence of a certain substring in given input string str. For example, suppose the input string is str = 'hello' and the substring is target = 'l..

Convert DataFrame column type from string to datetime, dd/mm/yyyy format

How can I convert a DataFrame column of strings (in dd/mm/yyyy format) to datetimes?..

Find records with a date field in the last 24 hours

In my SQL query how do i make it find the records in the last 24 hours? Eg SELECT * FROM news WHERE date < 24 hours I usually do it by setting a variable to date() - 1 day and comparing it to..

JQuery Bootstrap Multiselect plugin - Set a value as selected in the multiselect dropdown

I am having a multiselect dropdown using the Boostrap Multiselect plugin ( as below <select id="data" name="data" class="data" multiple="multiple"> ..

C++ string to double conversion

Usually when I write anything in C++ and I need to convert a char into an int I simply make a new int equal to the char. I used the code(snippet) string word; openfile >> word; double l..

Remove unused imports in Android Studio

I recently started Android Studio IDE to make my android apps. I find shortkey to remove unused import in Android Studio is not working (Ctrl+Shift+O) What is shortcut key to do same in Android Studi..

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

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

How To Include CSS and jQuery in my WordPress plugin?

How To Include CSS and jQuery in my WordPress plugin ?..

How do I get the localhost name in PowerShell?

How do I get the localhost (machine) name in PowerShell? I am using PowerShell 1.0...

How to get the CPU Usage in C#?

I want to get the overall total CPU usage for an application in C#. I've found many ways to dig into the properties of processes, but I only want the CPU usage of the processes, and the total CPU like..

JavaScript: filter() for Objects

ECMAScript 5 has the filter() prototype for Array types, but not Object types, if I understand correctly. How would I implement a filter() for Objects in JavaScript? Let's say I have this object: ..

How do I download a file using VBA (without Internet Explorer)

I need to download a CSV file from a website using VBA in Excel. The server also needed to authenticate me since it was data from a survey service. I found a lot of examples using Internet Explorer c..

How to convert SSH keypairs generated using PuTTYgen (Windows) into key-pairs used by ssh-agent and Keychain (Linux)

I've generated key pairs using PuTTYgen and been logging in using Pageant, so that I have to enter my pass-phrase only once when my system boots. How do I achieve this in Linux? I've heard of keycha..

How to access host port from docker container

I have a docker container running jenkins. As part of the build process, I need to access a web server that is run locally on the host machine. Is there a way the host web server (which can be configu..

Listing available com ports with Python

I am searching for a simple method to list all available com port on a PC. I have found this method but it is Windows-specific: Listing serial (COM) ports on Windows? I am using Python 3 with pySeri..

Compression/Decompression string with C#

I am newbie in .net. I am doing compression and decompression string in C#. There is a XML and I am converting in string and after that I am doing compression and decompression.There is no compilation..

How to find elements with 'value=x'?

I need to remove element that have value="123". I know that all elements with different values are located into #attached_docs, but I don't know how to select element with value="123". $('#attached_d..

Spring Hibernate - Could not obtain transaction-synchronized Session for current thread

I created an application with spring + hibernate, but I always get this error. This is my first application with hibernate, I read some guides but I can not solve this problem. Where am I doing wrong?..

How does java do modulus calculations with negative numbers?

Am I doing modulus wrong? Because in Java -13 % 64 is supposed to evaluate to -13 but I get 51...

How to get current date & time in MySQL?

Is there a value or command like DATETIME that I can use in a manual query to insert the current date and time? INSERT INTO servers ( server_name, online_status, exchange, disk_space, network_shar..

How do I get the last inserted ID of a MySQL table in PHP?

I have a table into which new data is frequently inserted. I need to get the very last ID of the table. How can I do this? Is it similar to SELECT MAX(id) FROM table?..

Android: Force EditText to remove focus?

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How ..

JSON Array iteration in Android/Java

I am building an android app that needs to download and synchronise with an online database, I am sending my query from the app to a php page which returns the relevant rows from a database in JSON fo..

What special characters must be escaped in regular expressions?

I am tired of always trying to guess, if I should escape special characters like '()[]{}|' etc. when using many implementations of regexps. It is different with, for example, Python, sed, grep, awk, ..

SQL order string as number

I have numbers saved as VARCHAR to a MySQL database. I can not make them INT due to some other depending circumstances. It is taking them as character not as number while sorting. In database I hav..

How can I check the system version of Android?

Does anyone know how can I check the system version (e.g. 1.0, 2.2, etc.) programatically?..

How do I load a file from resource folder?

My project has the following structure: /src/main/java/ /src/main/resources/ /src/test/java/ /src/test/resources/ I have a file in /src/test/resources/test.csv and I want to load the file from a un..

When do Java generics require <? extends T> instead of <T> and is there any downside of switching?

Given the following example (using JUnit with Hamcrest matchers): Map<String, Class<? extends Serializable>> expected = null; Map<String, Class<java.util.Date>> result = null;..

How to get the absolute path to the public_html folder?

$_SERVER['DOCUMENT_ROOT'] returns /usr/local/apache/htdocs/ is there a way to get /home/user/public_html/ The problem is that I have to write a script which can be in the public_html folder or..

Remove Identity from a column in a table

We have a 5GB table (nearly 500 million rows) and we want to remove the identity property on one of the column, but when we try to do this through SSMS - it times out. Can this be done through T-SQL?..

Django gives Bad Request (400) when DEBUG = False

I am new to django-1.6. When I run the django server with DEBUG = True, it's running perfectly. But when I change DEBUG to False in the settings file, then the server stopped and it gives the followin..

When should I create a destructor?

For example: public class Person { public Person() { } ~Person() { } } When should I manually create a destructor? When have you needed to create a destructor? ..


I have searched and read few post but my problem is not the same as described. So here's the issue: using git clone into folder under external partition of the disk works fine but all git commands fai..

Including JavaScript class definition from another file in Node.js

I'm writing a simple server for Node.js and I'm using my own class called User which looks like: function User(socket) { this.socket = socket; this.nickname = null; /* ... just the typic..

Pretty-Print JSON Data to a File using Python

A project for class involves parsing Twitter JSON data. I'm getting the data and setting it to the file without much trouble, but it's all in one line. This is fine for the data manipulation I'm tryin..

How do I find which transaction is causing a "Waiting for table metadata lock" state?

I am trying to perform some DDL on a table and SHOW PROCESSLIST results in a " Waiting for table metadata lock " message. How can I find out which transaction is not yet closed? I'm using MySQL v5.5..

Can you do greater than comparison on a date in a Rails 3 search?

I have this search in Rails 3: Note.where(:user_id =>, :notetype => p[:note_type], :date => p[:date]).order('date ASC, created_at ASC') But I need the :date => p[:date] ..

Get raw POST body in Python Flask regardless of Content-Type header

Previously, I asked How to get data received in Flask request because was empty. The answer explained that is the raw post body, but will be empty if form data is parsed. Ho..

Two inline-block, width 50% elements wrap to second line

I would like to have two columns of 50% width space, and avoid floats. So i thought using display:inline-block. When the elements add to 99% width (eg 50%, 49%, ) it work..

Returning an array using C

I am relatively new to C and I need some help with methods dealing with arrays. Coming from Java programming, I am used to being able to say int [] method()in order to return an array. However, I have..

How to make Bootstrap 4 cards the same height in card-columns?

I am using Bootstrap 4 alpha 2 and taking advantage on cards. Specifically, I am working with this example taken from the official docs. How can I make all cards to be the same height? All I can thi..

How to download an entire directory and subdirectories using wget?

I am trying to download the files for a project using wget, as the SVN server for that project isn't running anymore and I am only able to access the files through a browser. The base URLs for all the..

Python dict how to create key or append an element to key?

I have an empty dictionary. Name: dict_x It is to have keys of which values are lists. From a separate iteration, I obtain a key (ex: key_123), and an item (a tuple) to place in the list of dict_x's v..

Remove Unnamed columns in pandas dataframe

I have a data file from columns A-G like below but when I am reading it with pd.read_csv('data.csv') it prints an extra unnamed column at the end for no reason. colA ColB colC colD colE ..

What's the difference between ViewData and ViewBag?

I saw the ViewBag in MVC 3. How's that different than ViewData in MVC 2?..

`node-pre-gyp install --fallback-to-build` failed during MeanJS installation on OSX

I just bought myself a mac book after using Windows for a long time. I was trying to work on a MeanJS project that I had been working on. Doing npm install on the project throws error Failed to exe..

Write-Host => Export to a file

I have got a script with some commands such as Write-Host "Server1". How can I export it to a file? When I tried with script > export.txt it didn't work...

foreach for JSON array , syntax

my script is getting some array from php server side script. result = jQuery.parseJSON(result); now I want to check each variable of the array. if (result.a!='') { something.... } if (result.b!=''..

For loop for HTMLCollection elements

I'm trying to set get id of all elements in an HTMLCollectionOf. I wrote the following code: var list = document.getElementsByClassName("events"); console.log(list[0].id); for (key in list) { con..

Initializing a static std::map<int, int> in C++

What is the right way of initializing a static map? Do we need a static function that will initialize it? ..

Getting value from JQUERY datepicker

If I want to display the JQUERY UI datepicker inline by attaching it to a DIV like $("div#someID").datepicker() - how do I access the chosen date? I assume if it's not bound to an INPUT then it won't ..

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

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

Proper way to empty a C-String

I've been working on a project in C that requires me to mess around with strings a lot. Normally, I do program in C++, so this is a bit different than just saying string.empty(). I'm wondering what ..

C# how to convert File.ReadLines into string array?

The question that I have is regarding converting the process of reading lines from a text file into an array instead of just reading it. The error in my codes appear at string[] lines = File.ReadLine..

ExecuteNonQuery: Connection property has not been initialized.

Afternoon, So I have been at this one issue for hours and can't really get past this last hump. Below is the code for this program that I am writing: using System; using System.Collecti..

How to use SQL Select statement with IF EXISTS sub query?

How to select Boolean value from sub query with IF EXISTS statement (SQL Server)? It should be something like : SELECT TABEL1.Id, NewFiled = (IF EXISTS(SELECT Id FROM TABLE2 WHERE TABLE2.ID = ..

Paste multiple columns together

I have a bunch of columns in a dataframe which I want to paste together (seperated by "-") as follows: data <- data.frame('a' = 1:3, 'b' = c('a','b','c'), '..

How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

I got the opposite issue from here. By default in iOS7, back swipe gesture of UINavigationController's stack could pop the presented ViewController. Now I just uniformed all the self.navigationItem.le..

Is it possible to set a timeout for an SQL query on Microsoft SQL server?

I've got a scenario when sometimes a user selects the right parameters and makes a query which takes several minutes or more to execute. I cannot prevent him to select such a combination of parameters..

chart.js load totally new data

The API for chart.js allows one to edit points of the datasets loaded into it, for example: .update( ) Calling update() on your Chart instance will re-render the chart with any updated valu..

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into t..

Is there a default password to connect to vagrant when using `homestead ssh` for the first time?

I'm trying to connect to vagrant via homestead ssh: [email protected]'s password: But my public key password doesn't work. My Homestead.yaml looks like this: authorize: ~/.ssh/ keys: ..

Shell - How to find directory of some command?

I know that when you are on shell, the only commands that can be used are the ones that can be found on some directory set on PATH. Even I don't know how to see what dirs are on my PATH variable (and ..

Converting Numpy Array to OpenCV Array

I'm trying to convert a 2D Numpy array, representing a black-and-white image, into a 3-channel OpenCV array (i.e. an RGB image). Based on code samples and the docs I'm attempting to do this via Pytho..

What is the difference between the GNU Makefile variable assignments =, ?=, := and +=?

Can anybody give a clear explanation of how variable assignment really works in Makefiles. What is the difference between : VARIABLE = value VARIABLE ?= value VARIABLE := value VARIABLE += valu..

How can I change the font size of ticks of axes object in matplotlib

I have a figure I added subfigure to (inset). I have used: fig = plt.figure() ax = fig.add_subplot(111) subA = fig.add_axes([0.4,0.14,0.2,0.2]) I now want to change the xtick font size of the subfi..

EF Code First "Invalid column name 'Discriminator'" but no inheritance

I have a table in my database called SEntries (see below the CREATE TABLE statement). It has a primary key, a couple of foreign keys and nothing special about it. I have many tables in my database sim..

AngularJS Uploading An Image With ng-upload

I am trying to upload a file in AngularJS using ng-upload but I am running into issues. My html looks like this: <div class="create-article" ng-controller="PostCreateCtrl"> <form ng-..

Passing null arguments to C# methods

Is there a way to pass null arguments to C# methods (something like null arguments in c++)? For example: Is it possible to translate the following c++ function to C# method: private void Example(in..

104, 'Connection reset by peer' socket error, or When does closing a socket result in a RST rather than FIN?

We're developing a Python web service and a client web site in parallel. When we make an HTTP request from the client to the service, one call consistently raises a socket.error in, in read..

Declaring variable workbook / Worksheet vba

I know this might come off as a trivial question, but I can't seem to declare a workbook or a worksheet as a variable in VBA. I have the following code, but I can't figure out what I am doing wrong, i..

PDF to byte array and vice versa

I need to convert pdf to byte array and vice versa. Can any one help me? This is how I am converting to byte array public static byte[] convertDocToByteArray(String sourcePath) { byte[] byteAr..

setOnItemClickListener on custom ListView

I have a custom ListView. This ListView contains 1 Image and 6 TextViews. To retrieve the value I have created a setOnItemClickListener(...). Whenever I click on the ListView how could I actually retr..

T-SQL get SELECTed value of stored procedure

In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 So, it's possible to get the value of a SELECT and stuff it in a va..

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

After downloading the EF6 by nuget and try to run my project, it returns the following error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient..

Uncaught TypeError: Cannot read property 'split' of undefined

Using JavaScript to split a date and rearrange the format. Date is provided through a json feed as YYYY-MM-DD. To get the date, I do: var og_date = ([totalItems -1].inspection_date); consol..

How to find column names for all tables in all databases in SQL Server

I want to find all column names in all tables in all databases. Is there a query that can do that for me? The database is Microsoft SQL Server 2000...

Should I add the Visual Studio .suo and .user files to source control?

Visual Studio solutions contain two types of hidden user files. One is the solution .suo file which is a binary file. The other is the project .user file which is a text file. Exactly what data do the..

Confirm button before running deleting routine from website

I have a page on my website that is dynamically created with information from an SQL database. As well as the data being displayed a delete link is also created for each record which links to a php fi..

java : convert float to String and String to float

How could I convert from float to string or string to float? In my case I need to make the assertion between 2 values string (value that I have got from table) and float value that I have calculated...

jQuery get the location of an element relative to window

Given an HTML DOM ID, how to get an element's position relative to the window in JavaScript/JQuery? This is not the same as relative to the document nor offset parent since the element may be inside ..

What does it mean if a Python object is "subscriptable" or not?

Which types of objects fall into the domain of "subscriptable"?..

Reminder - \r\n or \n\r?

I just can't remember those. So, what is the right way to properly terminate old fashioned ASCII lines?..

What are all the uses of an underscore in Scala?

I've taken a look at the list of surveys taken on and noticed a curious question: "Can you name all the uses of “_”?". Can you? If yes, please do so here. Explanatory examples are a..

Writing an Excel file in EPPlus

I have been stuck on this for days and despite all of the help out there, none of these solutions have been working for me. What I want to do is create an excel file using the EPPlus library with some..

Last non-empty cell in a column

Does anyone know the formula to find the value of the last non-empty cell in a column, in Microsoft Excel?..

Can't install any package with node npm

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

splitting a number into the integer and decimal parts

Is there a pythonic way of splitting a number such as 1234.5678 into two parts (1234, 0.5678) i.e. the integer part and the decimal part?..

How to pass IEnumerable list to controller in MVC including checkbox state?

I have an mvc application in which I am using a model like this: public class BlockedIPViewModel { public string IP { get; set; } public int ID { get; set; } public bool Checked { get;..

Fastest way to check if a value exists in a list

What is the fastest way to know if a value exists in a list (a list with millions of values in it) and what its index is? I know that all values in the list are unique as in this example. The first me..

Removing body margin in CSS

I'm new to web development, and met a problem when removing margin of body. There's space between the very top of the browser and "logo" text. And my code is here on jsbin. Is body { margin: 0;} w..

EditText underline below text property

I would like to change the blue colour below the edit text, i don't know what property it is. I tried using a different background colour for it but it didn't work. I've attached an image below: ..

What is com.sun.proxy.$Proxy

I have seen that when errors occur deep in different frameworks (e.g frameworks implementing the EJB specification or some JPA providers) the stacktrace contain classes like com.sun.proxy.$Proxy. I kn..

How do I add more members to my ENUM-type column in MySQL?

The MySQL reference manual does not provide a clearcut example on how to do this. I have an ENUM-type column of country names that I need to add more countries to. What is the correct MySQL syntax to..

Set font-weight using Bootstrap classes

Is there any Twitter Bootstrap class for font-weight: bold and other values of font-weight? I would not create a new one if this already exists in Bootstrap...

How to get the file path from URI?

Please find my code below. I need to get the file path of the pdf document, selected by the user from SDcard. The issue is that the URI.getPath() returns: /file:///mnt/sdcard/my%20Report.pdf/my Repor..

Is there a naming convention for git repositories?

For example, I have a RESTful service called Purchase Service. Should I name my repository: purchaserestservice purchase-rest-service purchase_rest_service or something else? What's the convention..

jQuery val is undefined?

I have this code: <input type="hidden" id="editorTitle" name="title" value="home"> <textarea name="text" id="editorText"></textarea> But when i write $('#editorTitle').val() and $..

Creating a node class in Java

So I'm fairly new to Java and programming and I was wondering how to create a node class? So far I have: public class ItemInfoNode{ private ItemInfoNode next; private ItemInfoNode prev; ..

C++ - unable to start correctly (0xc0150002)

I'm trying to run an OpenCV application through Microsoft Visual C++ 2010 Express, and get the following message: How can I solve this issue?..

Remove and Replace Printed items

I was wondering if it was possible to remove items you have printed in Python - not from the Python GUI, but from the command prompt. e.g. a = 0 for x in range (0,3): a = a + 1 b = ("Lo..

ASP.NET Forms Authentication failed for the request. Reason: The ticket supplied has expired

I am getting this error many times in the event log and users are logged out. Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expir..

SecurityError: Blocked a frame with origin from accessing a cross-origin frame

I am loading an <iframe> in my HTML page and trying to access the elements within it using Javascript, but when I try to execute my code, I get the following error: SecurityError: Blocked a fra..

ASP.NET MVC - Getting QueryString values

Under ASP.NET MVC are you supposed to pick up QueryString params the same way you do in ASP.NET WebForms? or does the [AcceptVerbs(HttpVerbs.Get)] declaration get used somehow?..

How to write inline if statement for print?

I need to print some stuff only when a boolean variable is set to True. So, after looking at this, I tried with a simple example: >>> a = 100 >>> b = True >>> print a if b ..

How do I run a class in a WAR from the command line?

I have a Java class which has a main and I used to run as a standalone app from the command line e.g. java -jar myjar.jar params I needed to repackage the code to run under apache and all my code, ..

Very simple C# CSV reader

I'd like to create an array from a CSV file. This is about as simple as you can imagine, the CSV file will only ever have one line and these values: Device, SignalStrength, Location, Time, Age. I'..

How to send emails from my Android application?

I am developing an application in Android. I don't know how to send an email from the application?..

Add a property to a JavaScript object using a variable as the name?

I'm pulling items out of the DOM with jQuery and want to set a property on an object using the id of the DOM element. Example const obj = {} jQuery(itemsFromDom).each(function() { const element ..

How can I execute a python script from an html button?

I have a number of python scripts that I have saved on my computer, out of curiosity I have created a html file that just has one button. Instead on going into the terminal and running python <path..

How to filter by IP address in Wireshark?

I tried dst== but only get : Neither "dst" nor "" are field or protocol names. The following display filter isn't a valid display filter: dst== ..

Freezing Row 1 and Column A at the same time

I want to "freeze" Row 1 and Column A simultaneously in Excel 2010. Is this possible?..

What is the difference between And and AndAlso in VB.NET?

In VB.NET, what is the difference between And and AndAlso? Which should I use?..

What is the result of % in Python?

What does the % in a calculation? I can't seem to work out what it does. Does it work out a percent of the calculation for example: 4 % 2 is apparently equal to 0. How?.. no protocol on URL based on a string modified with URLEncoder

So I was attempting to use this String in a URL :-

How do I get the path of a process in Unix / Linux

In Windows environment there is an API to obtain the path which is running a process. Is there something similar in Unix / Linux? Or is there some other way to do that in these environments?..

$.ajax( type: "POST" POST method to php

I'm trying to use the POST method in jQuery to make a data request. So this is the code in the html page: <form> Title : <input type="text" size="40" name="title"/> <input type="button..

log4net vs. Nlog

Anyone have experience for both? How do they stack up against each other? We are planning on using one of them for logging in an enterprise application. References: log4net nlog EDIT: We have no..

Unable to copy file - access to the path is denied

I am using Visual Studio 2005. After taking code from version control first, the application runs correctly. But, after doing some modifications, when I build I am getting the following error..

Find Java classes implementing an interface

Some time ago, I came across a piece of code, that used some piece of standard Java functionality to locate the classes that implemented a given interface. I know the functions were hidden in some non..

Change onClick attribute with javascript

This is my function and it should change the onClick attribute of the HTML input, but if I use document.getElementById('buttonLED'+id).onclick = "writeLED(1,1)"; it does not work at all, but if I u..

Highlight Bash/shell code in Markdown files

How can I highlight the Bash/shell commands in Markdown files? For example, to highlight js, I write: ```js function () { return "This code is highlighted as Javascript!"} ``` To highlight..

angularjs directive call function specified in attribute and pass an argument to it

I want to create a directive that links to an attribute. The attribute specifies the function that should be called on the scope. But I also want to pass an argument to the function that is determined..

json_decode() expects parameter 1 to be string, array given

What causes this error in my code? $query = $this->db->query("SELECT * FROM tour_foreign ORDER BY id desc"); $data = array(); foreach ($query->result() as $row) $..

"unmappable character for encoding" warning in Java

I'm currently working on a Java project that is emitting the following warning when I compile: /src/com/myco/apps/ warning: unmappable character for encoding UTF8 [javac] ..

Removing fields from struct or hiding them in JSON Response

I've created an API in Go that, upon being called, performs a query, creates an instance of a struct, and then encodes that struct as JSON before sending back to the caller. I'd now like to allow the..

GSON - Date format

I'm trying to have a custom date format in Gson output, but .setDateFormat(DateFormat.FULL) doesn't seem to work and it the same with .registerTypeAdapter(Date.class, new DateSerializer()). It's like..

XPath to select element based on childs child value

Trying to select an element based on the value of one of it's childrens childrens Thinking the following but not working, appreciate any help, thanks ./book[/author/name = 'John'] or ./book[/author..

What size should apple-touch-icon.png be for iPad and iPhone?

Are Apple touch icons bigger than 60x60 supported, and if so, what dimensions should I use for the iPad and iPhone?..

Which is better: <script type="text/javascript">...</script> or <script>...</script>

Which is better or more convenient to use: <script type="text/javascript">...</script> or <script>...</script> ..

how to upload file using curl with php

I want to know how to upload file using cURL or anything else in PHP. I have searched in google many times but no results. In other words, the user sees a file upload button on a form, the form gets ..

Is there a way to delete all the data from a topic or delete the topic before every run?

Is there a way to delete all the data from a topic or delete the topic before every run? Can I modify the KafkaConfig.scala file to change the logRetentionHours property? Is there a way the messages..

Excel - Using COUNTIF/COUNTIFS across multiple sheets/same column

I am trying to "COUNT" the number of a certain object in column I (in this instance) across multiple sheets. That value in column I is the result of a formula (if it matters). So far I have: =COUNTIF..

setting textColor in TextView in layout/main.xml main layout file not referencing colors.xml file. (It wants a #RRGGBB instead of @color/text_color)

I'm trying to set some general colors for a program I'm writing. I created a colors.xml file and am trying to directly reference the colors from the layout.xml file. I believe I'm am doing this correc..

PHP using Gettext inside <<<EOF string

I use PHP's EOF string to format HTML content without the hassle of having to escape quotes etc. How can I use the function inside this string? <?php $str = <<<EOF <p>Hello..

How to get JavaScript caller function line number? How to get JavaScript caller source URL?

I am using the following for getting the JavaScript caller function name: var callerFunc = arguments.callee.caller.toString(); callerFuncName = (callerFunc.substring(callerFunc.indexOf("function") + ..

How do I delete all messages from a single queue using the CLI?

How do I delete all messages from a single queue using the cli? I have the queue name and I want to clean it...

What does the line "#!/bin/sh" mean in a UNIX shell script?

I was going through some shell script tutorials and found the following sample program: #!/bin/sh clear echo "HELLO WORLD" Can anyone please tell me what the significance of the comment #!/bin/sh a..

How can I modify a saved Microsoft Access 2007 or 2010 Import Specification?

Does anyone know how to modify an existing import specification in Microsoft Access 2007 or 2010? In older versions there used to be an Advanced button presented during the import wizard that allowed..

Default Xmxsize in Java 8 (max heap size)

In the oracle documentation I found: -Xmxsize Specifies the maximum size (in bytes) of the memory allocation pool in bytes ... The default value is chosen at runtime based on system configuratio..

Prevent textbox autofill with previously entered values

I have an asp page with some Textbox controls on it. By default, the browser will suggest previously entered values for each box. I'd like to prevent that behavior for some of the textboxes. Is the..

Accessing member of base class

See the inheritance example from the playground on the TypeScript site: class Animal { public name; constructor(name) { = name; } move(meters) { alert( + " moved " ..

Installing packages in Sublime Text 2

When I go to browse packages in Sublime Text 2, the packages folder is full of all the plugins I wanted like Zen coding and SidebarEnhancements. My installed packages folder only has package control i..

Installing SciPy and NumPy using pip

I'm trying to create required libraries in a package I'm distributing. It requires both the SciPy and NumPy libraries. While developing, I installed both using apt-get install scipy which installed..

C# importing class into another class doesn't work

I'm quite new to C#, and have made a class that I would like to use in my main class. These two classes are in different files, but when I try to import one into the other with using, cmd says says ..

How can I troubleshoot Python "Could not find platform independent libraries <prefix>"

I'm trying to use Fontcustom to create an icon font using svg files and fontforge. I'm on OSX.7. However, whenever I run the program I get the error Could not find platform independent libraries <..

How to define an enum with string value?

I am trying to define an Enum and add valid common separators which used in CSV or similar files. Then I am going to bind it to a ComboBox as a data source so whenever I add or remove from the Enum de..

Is it possible to pull just one file in Git?

I am working on a Git branch that has some broken tests, and I would like to pull (merge changes, not just overwrite) these tests from another branch where they are already fixed. I know I can do gi..

What does "O(1) access time" mean?

I have seen this term "O(1) access time" used to mean "quickly" but I don't understand what it means. The other term that I see with it in the same context is "O(n) access time". Could someone please ..

Assign a class name to <img> tag instead of write it in css file?

I am curious to know, is it true that it is better to assign a class name to the <img> tag in the html file instead of writing it down directly into css file? <div class="column"> <..

Keeping it simple and how to do multiple CTE in a query

I have this simple T-SQL query, it emits a bunch of columns from a table and also joins information from other related tables. My data model is simple. I have a scheduled event, with participants. I ..

Javascript - validation, numbers only

I'm trying to get my login form to only validate if only numbers were inputted. I can it to work if the input is only digits, but when i type any characters after a number, it will still validate etc...

ClassNotFoundException: org.slf4j.LoggerFactory

I am trying to run GWT RequestFactory and facing this error: ClassNotFoundException: org.slf4j.LoggerFactory I have tried to download slf4j-api-1.3.1.jar but it didnt resolve the issue Any idea e..

How can I determine if a .NET assembly was built for x86 or x64?

I've got an arbitrary list of .NET assemblies. I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?..

How to remove not null constraint in sql server using query

I am trying to remove not null constraint in sql server 2008 without losing data...

How to change fonts in matplotlib (python)?

It sounds as an easy problem but I do not find any effective solution to change the font (not the font size) in a plot made with matplotlib in python. I found a couple of tutorials to change the defa..

How do I change the background color of the ActionBar of an ActionBarActivity using XML?

Details: I'm extending ActionBarActivity. Eclipse and SDK fully patched as of 2011-11-06. <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" /> Deployed to Samsung device ..

AngularJS - How can I do a redirect with a full page load?

I want to do a redirect that does a full page reload so that the cookies from my web server are refreshed when the page loads. window.location = "/#/Next" and window.location.href = "/#/Next" don't wo..

Can I set the height of a div based on a percentage-based width?

Let's say I've got a div that has a width of 50% of the body. How do I make its height equal to that value? So that when the browser window is 1000px wide, the div's height and width are both 500px...

Evaluate if list is empty JSTL

I've been trying to evaluate if this array list is empty or not but none of these have even compiled: <c:if test="${myObject.featuresList.size == 0 }"> <c:if test="${myObj..

How can I make a CSS table fit the screen width?

Currently the table is too wide and causes the browser to add a horizontal scroll bar...

Git: can't undo local changes (error: path ... is unmerged)

I have following working tree state $ git status foo/bar.txt # On branch master # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as approp..

Convert JSON String to Pretty Print JSON output using Jackson

This is the JSON string I have: {"attributes":[{"nm":"ACCOUNT","lv":[{"v":{"Id":null,"State":null},"vt":"java.util.Map","cn":1}],"vt":"java.util.Map","status":"SUCCESS","lmd":13585},{"nm":"PROFILE","..

Spring Boot Remove Whitelabel Error Page

I'm trying to remove white label error page, so what I've done was created a controller mapping for "/error", @RestController public class IndexController { @RequestMapping(value = "/error") ..

Java8: sum values from specific field of the objects in a list

Suppose to have a class Obj class Obj{ int field; } and that you have a list of Obj instances, i.e. List<Obj> lst. Now, how can I find in Java8 with streams the sum of the values of the i..

Can't connect to docker from docker-compose

I installed docker-machine 0.1.0 and docker-compose 1.1.0 on Mac OS 10.8.5.Docker-machine is running normally and able to connect by docker-machine ssh. $ docker-machine ls NAME ACTIVE DRIVER ..

Import Certificate to Trusted Root but not to Personal [Command Line]

I am trying to import two certificates to my local machine using the command line. I have one certificate to add to the Personal Store of the local machine, and another one to add to the Trusted Root..

Process escape sequences in a string in Python

Sometimes when I get input from a file or the user, I get a string with escape sequences in it. I would like to process the escape sequences in the same way that Python processes escape sequences in s..

Show an image preview before upload

In my HTML form I have input filed with type file for example : <input type="file" multiple> Then I'm selecting multiple files by clicking that input button. Now I want to show preview of s..

Using Javascript in CSS

Is it possible to use Javascript inside CSS? If it is, can you give a simple example?..

LINQ with groupby and count

This is pretty simple but I'm at a loss: Given this type of data set: UserInfo(name, metric, day, other_metric) and this sample data set: joe 1 01/01/2011 5 jane 0 01/02/2011 9 john 2 01/03/2011 0 j..

How to sort a dataFrame in python pandas by two or more columns?

Suppose I have a dataframe with columns a, b and c, I want to sort the dataframe by column b in ascending order, and by column c in descending order, how do I do this?..

JavaScript get child element

Why this does not work in firefox i try to select the category and then make subcategory visible. <script type="text/javascript"> function show_sub(cat) { var cat = document.getElemen..

Creating a div element in jQuery

How do I create a div element in jQuery?..

How do I get the n-th level parent of an element in jQuery?

When I want to get, for example, the 3rd level parent of the element I must write $('#element').parent().parent().parent() Is there a more optimal method for this?..

Creating a very simple linked list

I am trying to create a linked list just to see if I can, and I am having trouble getting my head around it. Does anyone have an example of a very simple implementation of Linked list using C#? All ..

pandas groupby sort within groups

I want to group my dataframe by two columns and then sort the aggregated results within the groups. In [167]: df Out[167]: count job source 0 2 sales A 1 4 sales B 2 6 sales C 3 ..

How to link a folder with an existing Heroku app

I have an existing Rails app on GitHub and deployed on Heroku. I'm trying to set up a new development machine and have cloned the project from my GitHub repository. However, I'm confused as to how to ..

Virtual Memory Usage from Java under Linux, too much memory used

I have a problem with a Java application running under Linux. When I launch the application, using the default maximum heap size (64 MB), I see using the tops application that 240 MB of virtual Memor..

How does the getView() method work when creating your own custom adapter?

My questions are: What is exactly the function of the LayoutInflater? Why do all the articles that I've read check if convertview is null or not first? What does it mean when it is null and what doe..

How do I set up Visual Studio Code to compile C++ code?

Microsoft's Visual Studio Code editor is quite nice, but it has no default support for building C++ projects. How do I configure it to do this?..

ToList().ForEach in Linq

I am new to Linq. I want to set two values in foreach statement like this My actual code is this foreach (Employee emp in employees) { foreach(Department dept in emp.Departments) { dep..

How can I autoplay a video using the new embed code style for Youtube?

I can't work out how to autoplay a video using the new embed code style for Youtube. I tried adding &autoplay=1 to the url, which worked with the old style, but it didn't work. For example, http:/..

Perl - If string contains text?

I want to use curl to view the source of a page and if that source contains a word that matches the string then it will execute a print. How would I do a if $string contains? In VB it would be like. ..

Fastest way to update 120 Million records

I need to initialize a new field with the value -1 in a 120 Million record table. Update table set int_field = -1; I let it run for 5 hours before canceling it. I tried running it with tran..

Android error: Failed to install *.apk on device *: timeout

I'm getting this error from time to time and don't know what causing this: When trying to run/debug an Android app on a real device (Galaxy Samsung S in my case) I'm getting the following error in the..

What is __future__ in Python used for and how/when to use it, and how it works

__future__ frequently appears in Python modules. I do not understand what __future__ is for and how/when to use it even after reading the Python's __future__ doc. Can anyone explain with examples? ..

Batch script to find and replace a string in text file without creating an extra output file for storing the modified file

I have written a batch script to find and replace a string in a text file. Following is my script. @echo off &setlocal set "search=%1" set "replace=%2" set "textfile=Input.txt" set "newfile=Outpu..

How to mock location on device?

How can I mock my location on a physical device (Nexus One)? I know you can do this with the emulator in the Emulator Control panel, but this doesn't work for a physical device...

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

What are the differences between .so and .dylib on osx?

.dylib is the dynamic library extension on OSX, but it's never been clear to me when I can't / shouldn't use a traditional unix .so shared object. Some of the questions I have: At a conceptual leve..

PHP - Copy image to my server direct from URL

Possible Duplicate: save image from php url using php I want to have PHP code for following. Suppose I have one image URL, for example,

Changing background color of selected item in recyclerview

How to change the background color of only selected view in my recycle view example?only the background color of clicked itemview needs to be changed. Only one selected item must be displayed with bac..

Multi-character constant warnings

Why is this a warning? I think there are many cases when is more clear to use multi-char int constants instead of "no meaning" numbers or instead of defining const variables with same value. When pars..

Checkbox Check Event Listener

Recently I have been working with the Chrome Plugin API and I am looking to develop a plugin which will make life easier for me for managing a website. Now what I wish to do is to fire an event when ..

Which sort algorithm works best on mostly sorted data?

Which sorting algorithm works best on mostly sorted data?..

jquery can't get data attribute value

I am trying to set a variable in jQuery. The value is supposed to be set on the click event of the button. The onclick event fires but the x10Device variable remains undefined. I am on jquery 1.7.1..

How to override and extend basic Django admin templates?

How do I override an admin template (e.g. admin/index.html) while at the same time extending it (see

Capture key press without placing an input element on the page?

How to capture key press, e.g., Ctrl+Z, without placing an input element on the page in JavaScript? Seems that in IE, keypress and keyup events can only be bound to input elements (input boxes, textar..

Remove all special characters except space from a string using JavaScript

I want to remove all special characters except space from a string using JavaScript. For example, abc's test#s should output as abcs tests...