Questions Tagged with #P4win

how to define variable in jquery

I would like to know how to declare a variable in jQuery The code I am currently using is $.name = 'anirudha'; alert($.name); That code works fine, but if I write it as $.name = document.myForm.t..

How to add new elements to an array?

I have the following code: String[] where; where.append(ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"); where.append(ContactsContract.Contacts.IN_VISIBLE_GROUP + "=1"); Those two appends are no..

Insert 2 million rows into SQL Server quickly

I have to insert about 2 million rows from a text file. And with inserting I have to create some master tables. What is the best and fast way to insert such a large set of data into SQL Server?..

How to clear the entire array?

I have an array like this: Dim aFirstArray() As Variant How do I clear the entire array? What about a collection?..

'cl' is not recognized as an internal or external command,

I am trying to compile a hello world program in Qt Using Qt Creator. I am getting 'cl' is not recognized as an internal or external command. I am using Windows 7 and Both Vs 2008 and 2010 installed ..

Python dictionary replace values

I have a dictionary with 20 000 plus entries with at the moment simply the unique word and the number of times the word was used in the source text (Dante's Divine Comedy in Italian). I would like to..

Where does flask look for image files?

I am setting up a local server using flask. All I want to do currently is display an image using the img tag in the index.html page. But I keep getting error GET http://localhost:5000/ ayrton_senna_..

CodeIgniter - How to return Json response from controller

How do I return response from the controller back to the Jquery Javascript? Javascript $('.signinform').submit(function() { $(this).ajaxSubmit({ type : "POST", url: 'index.php/use..

sort files by date in PHP

I currently have an index.php file which allows me to output the list of files inside the same directory, the output shows the names then I used filemtime() function to show the date when the file was..

Change GridView row color based on condition

I want to change a particular row color of gridview based on some condition, I am using ASP.NET with c#. Thank you...

Show a message box from a class in c#?

How do you get a class to interact with the form to show a message box?..

How do I subscribe to all topics of a MQTT broker

I want to connect a client which will monitor all the topics of the broker to respond to the events when I don't know what are names of topic...

Eloquent ORM laravel 5 Get Array of ids

I'm using Eloquent ORM laravel 5.1, i want to return an array of ids greater than 0, My model called test. I have tried : $test=test::select('id')->where('id' ,'>' ,0)->get()->toarray();..

Conditional WHERE clause with CASE statement in Oracle

I'm brand-new to the Oracle world so this could be a softball. In working with an SSRS report, I'm passing in a string of states to a view. The twist is that the users could also pick a selection fr..

Bypass invalid SSL certificate errors when calling web services in .Net

We are setting up a new SharePoint for which we don't have a valid SSL certificate yet. I would like to call the Lists web service on it to retrieve some meta data about the setup. However, when I try..

Recursive file search using PowerShell

I am searching for a file in all the folders. Copyforbuild.bat is available in many places, and I would like to search recursively. $File = "V:\Myfolder\**\*.CopyForbuild.bat" How can I do it in P..

How to get a random number in Ruby

How do I generate a random number between 0 and n?..

How to write ternary operator condition in jQuery?

In this fiddle, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be..

Convert ASCII number to ASCII Character in C

In C is there a way to convert an ASCII value typed as an int into the the corresponding ASCII character as a char?..

How do DATETIME values work in SQLite?

I’m creating Android apps and need to save date/time of the creation record. The SQLite docs say, however, "SQLite does not have a storage class set aside for storing dates and/or times" and it's "c..

Gson and deserializing an array of objects with arrays in it

I am trying to use Gson to deserialize a json string returned from my webservice The structure would be returned as TypeDTO[]. where TypeDTO is like int id; String name; ArrayList<ItemDTO> i..

Android check permission for LocationManager

I'm trying to get the GPS coordinates to display when I click a button in my activity layout. The following is the method that gets called when I click the button: public void getLocation(View view) ..

MySQL: Grant **all** privileges on database

I've created database, for example 'mydb'. CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'myuser'@'%' IDENTIFIED BY PASSWORD '*HASH'; GRANT ALL ON mydb.* TO 'myuser'@'%'; GRA..

How can I set selected option selected in vue.js 2?

My component vue is like this : <template> <select class="form-control" v-model="selected" :required @change="changeLocation"> <option :selected>Choose Province</opti..

'typeid' versus 'typeof' in C++

I am wondering what the difference is between typeid and typeof in C++. Here's what I know: typeid is mentioned in the documentation for type_info which is defined in the C++ header file typeinfo. ..

What is the use of the square brackets [] in sql statements?

I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them. Example: Visual..

How to append rows in a pandas dataframe in a for loop?

I have the following for loop: for i in links: data = urllib2.urlopen(str(i)).read() data = json.loads(data) data = pd.DataFrame(data.items()) data = data.transpose()

Injecting content into specific sections from a partial view ASP.NET MVC 3 with Razor View Engine

I have this section defined in my _Layout.cshtml @RenderSection("Scripts", false) I can easily use it from a view: @section Scripts { @*Stuff comes here*@ } What I'm struggling with is how..

Design Patterns web based applications

I am designing a simple web-based application. I am new to this web-based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, criter..

Get spinner selected items text?

How to get spinner selected item's text? I have to get the text on the item selected in my spinner when i click on the save button. i need the text not the Index...

How to check queue length in Python

How to check Queue's length in python? I dont see they provide Queue.lenght in python.... from collections import deque queue = deque(["Eric", "J..

Java JRE 64-bit download for Windows?

I'm working on a web site project with a Java component and am currently testing for cross-browser compatibility. Most is fine but the Java part won't load on 64-bit browsers. Looks like I need a 64-b..

len() of a numpy array in python

If I use len(np.array([[2,3,1,0], [2,3,1,0], [3,2,1,1]])), I get back 3. Why is there no argument for len() about which axis I want the length of in multidimensional arrays? This is alarming. Is t..

Saving Excel workbook to constant path with filename from two fields

I tried to search and put together a code to fit my purpose. Sub save() ActiveWorkbook.SaveAS Filename:="C:\-docs\cmat\Desktop\New folder\ck.xls", FileFormat:= _ xlNormal, Password:="", WriteResPas..

Mock functions in Go

I'm puzzled with dependencies. I want to be able to replace some function calls with mock ones. Here's a snippet of my code: func get_page(url string) string { get_dl_slot(url) defer free_dl_s..

PHP Array to CSV

I'm trying to convert an array of products into a CSV file, but it doesn't seem to be going to plan. The CSV file is one long line, here is my code: for($i=0;$i<count($prods);$i++) { $sql = "SELE..

shell-script headers (#!/bin/sh vs #!/bin/csh)

Why do all script files start with #!/bin/sh or with #!/bin/csh Is that required? What's the purpose of this? And what's the difference between the two?..

Git and nasty "error: cannot lock existing info/refs fatal"

After cloning from remote git repository (at bettercodes) I made some changes, commited and tried to push: git push origin master Errors with: error: cannot lock existing info/refs fatal: g..

C++ unordered_map using a custom class type as the key

I am trying to use a custom class as key for an unordered_map, like the following: #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; class nod..

How to see tomcat is running or not

Which command is used to find tomcat is running or not in windows? How do we know if JVM crashes suddenly? After googling I posted it, I am not able to find expected result...

How to create/read/write JSON files in Qt5

Qt5 has a new JSON parser and I want to use it. The problem is that it isn't too clear about what the functions do in layman's terms and how to write code with it. That or I could be reading it wrong...

What causes a TCP/IP reset (RST) flag to be sent?

I'm trying to figure out why my app's TCP/IP connection keeps hiccuping every 10 minutes (exactly, within 1-2 seconds). I ran Wireshark and discovered that after 10 minutes of inactivity the other en..

How do I use System.getProperty("line.separator").toString()?

I have a Tab-delimited String (representing a table) that is passed to my method. When I print it to the command line, it appears like a table with rows: The comma..

IIS7 URL Redirection from root to sub directory

I am using Windows Server 2008 with IIS7. I need to redirect the users who come to to Here is the file structure I have for the projects: -Sites..

Android Device not recognized by adb

My Android device isn't recognized by eclipse nor adb anymore. My OS is Windows 7 64-bit, and I'm using a Nexus 4 with Stock Android 4.4.2. Here are some details on the problem: Yesterday I could r..

Getting rid of all the rounded corners in Twitter Bootstrap

I love Twitter Bootstrap 2.0 - I love how it's such a complete library... but I want to make a global modification for a very boxy-not-round site, which is to get rid of all the rounded corners in Boo..

Bold black cursor in Eclipse deletes code, and I don't know how to get rid of it

When I edit code in the middle of statements, it replaces the current code around it. I cannot find a way to replace this with a normal cursor that only inserts data instead of replacing it. Is that f..

How to remove line breaks from a file in Java?

How can I replace all line breaks from a string in Java in such a way that will work on Windows and Linux (ie no OS specific problems of carriage return/line feed/new line etc.)? I've tried (note rea..

Mutex example / tutorial?

I'm new to multithreading, and was trying to understand how mutexes work. Did a lot of Googling but it still left some doubts of how it works because I created my own program in which locking didn't w..

Round a divided number in Bash

How would I round the result from two divided numbers, e.g. 3/2 As when I do testOne=$((3/2)) $testOne contains "1" when it should have rounded up to "2" as the answer from 3/2=1.5..

Mailto on submit button

Is it possible to implement mailto: function on submit button like <input type="submit" />? I use ASP.NET MVC. Maybe there is some tricky controller action result to achieve this. Could you plea..

How can I send an email by Java application using GMail, Yahoo, or Hotmail?

Is it possible to send an email from my Java application using a GMail account? I have configured my company mail server with Java app to send email, but that's not going to cut it when I distribute ..

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

I am following this link to integrate Google sign-in in my android app. As given in last step on the above given page we have t..

How do I stretch a background image to cover the entire HTML element?

I'm trying to get a background image of a HTML element (body, div, etc.) to stretch its entire width and height. Not having much luck. Is it even possible or do I have to do it some other way besides..

How to set up Android emulator proxy settings

I want to to use the browser inside the Android emulator, and I want to use the proxy settings on my machine. How can I set this up? Reading the very good Android manuals, they tell me that I should ..

How to install pip3 on Windows?

I use python 2.7, 3.5.2 and 3.6. Normally pip3 is installed with python3.x. But ... The code: where pip3 gives me: INFO: Could not find files for the given pattern(s). How can I fix this?..

'profile name is not valid' error when executing the sp_send_dbmail command

I have a windows account with users group and trying to exec sp_send_dbmail but getting an error: profile name is not valid. However, when I logged in as administrator and execute the sp_send_dbmail..

Python vs Cpython

What's all this fuss about Python and CPython (Jython,IronPython), I don't get it: mentions that CPython is: The "traditional" implementation of Python (nicknamed CPython) yet anothe..

Setting up MySQL and importing dump within Dockerfile

I'm trying to setup a Dockerfile for my LAMP project, but i'm having a few problems when starting MySQL. I have the folowing lines on my Dockerfile: VOLUME ["/etc/mysql", "/var/lib/mysql"] ADD dump.s..

How to add image for button in android?

How can I add an image to a button, rather than text?..

iOS: How to store username/password within an app?

I have a login-screen in my iOS app. The username and password will be saved in the NSUserDefaults and be loaded into the login-screen again when you enter the app again (of course, NSUserDefaults are..

Java 8 stream map to list of keys sorted by values

I have map Map<Type, Long> countByType and I want to have a list which has sorted (min to max) keys by their corresponding values. My try is: countByType.entrySet().stream().sorted().collect(Co..

What are the benefits to marking a field as `readonly` in C#?

What are the benefits of having a member variable declared as read only? Is it just protecting against someone changing its value during the lifecycle of the class or does using this keyword result i..

How to update (append to) an href in jquery?

I have a list of links that all go to a google maps api. the links already have the daddr (destination) parameter in them as static. I am using Geo-Location to find the users position and I want to a..

How can we dynamically allocate and grow an array

I am working on a project, but I cannot use any existing java data structures (ie, ArraysList, trees, etc) I can only use arrays. Therefore, I need to dynamically update an array with new memory. I ..

How can I copy data from one column to another in the same table?

Is it possible to copy data from column A to column B for all records in a table in SQL?..

How to set the color of "placeholder" text?

Is that possible to set the color of placeholder text ? <textarea placeholder="Write your message here..."></textarea> ..

After installing SQL Server 2014 Express can't find local db

I have downloaded and installed SQL Server 2014 Express (from this site: The pr..

Where do I put image files, css, js, etc. in Codeigniter?

Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I have to specify the path i..

"Unorderable types: int() < str()"

I'm trying to make a retirement calculator right now on Python. There's nothing wrong with the syntax but when I run the following program: def main(): print("Let me Retire Financial Calculator")..

Count how many files in directory PHP

I'm working on a slightly new project. I wanted to know how many files are in a certain directory. <div id="header"> <?php $dir = opendir('uploads/'); # This is the directory it will co..

How do you remove the title text from the Android ActionBar?

I'm looking through the Holo.Light theme, and I can't seem to find the magic style to override to get rid of the title text that briefly shows up when my app first launches. How can I do that?..

How do I change the default location for Git Bash on Windows?

I am using Git on Windows 7 and access my repositories through Git Bash. How can I change the default location that Git Bash opens in a convenient folder when I start it? It's somewhat time consuming..

Retrieving subfolders names in S3 bucket from boto3

Using boto3, I can access my AWS S3 bucket: s3 = boto3.resource('s3') bucket = s3.Bucket('my-bucket-name') Now, the bucket contains folder first-level, which itself contains several sub-folders nam..

How do you debug React Native?

How does one debug their React code with React Native while the app is running in app simulator? ..

sqldeveloper error message: Network adapter could not establish the connection error

I had made connection to the remote oracle database through sqldeveloper on my system. Suddenly the power went down and I had to restart the system. Now, when I am trying to connect to the remote ora..

jQuery click events not working in iOS

Second update: Looks like one of my functions (resetFigures) was preventing the event handler, so moving that to the end of the bind function sorted it out. Update: I realized after some basic testin..

maven... Failed to clean project: Failed to delete ..\org.ow2.util.asm-asm-tree-3.1.jar

I use STS(spring tool suite) + maven plugin. Every time when I run my application using maven-clean I see following error: [INFO] Scanning for projects... [INFO] ..

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

I've a form which I'm submitting (through GET as it is required this way) to a crm (ViciDial). I can successfully submit the form however if I do that the processing file at crm will just echo a succe..

Matplotlib scatter plot legend

I created a 4D scatter plot graph to represent different temperatures in a specific area. When I create the legend, the legend shows the correct symbol and color but adds a line through it. The code I..

How to check the extension of a filename in a bash script?

I am writing a nightly build script in bash. Everything is fine and dandy except for one little snag: #!/bin/bash for file in "$PATH_TO_SOMEWHERE"; do if [ -d $file ] then ..

What is the best way to compare 2 folder trees on windows?

I'm moving a repository from sourcesafe to subversion and I need to ensure that vital points are equal. Is it any existing command / tool for windows that allows me to compare two folder trees that th..

YouTube iframe embed - full screen

I have a form that is iframed into a web page. Upon completion of the form, a YouTube video is displayed from using iframe embed. When I enter full screen mode of the YouTube video, nothing really ha..

How to write to file in Ruby?

I need to read the data out of database and then save it in a text file. How can I do that in Ruby? Is there any file management system in Ruby?..

Convert timedelta to total seconds

I have a time difference import time import datetime time1 = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())) ... time2 = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())) diff =..

Import existing source code to GitHub

How can I import source code from my computer to my GitHub account?..

Split data frame string column into multiple columns

I'd like to take data of the form before = data.frame(attr = c(1,30,4,6), type=c('foo_and_bar','foo_and_bar_2')) attr type 1 1 foo_and_bar 2 30 foo_and_bar_2 3 4 foo_and_bar 4 ..

List files with certain extensions with ls and grep

I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else. So I thought I could just do this: ls | grep \.mp4$ | grep \.mp3$ | grep \.exe$ But no, as the f..

How to create local notifications?

How can I setup local notifications so that at the time I set, my app generates a notification/alert with a customized message?..

How to convert enum value to int?

I have a function which return a type int. However, I only have a value of the TAX enumeration. How can I cast the TAX enumeration value to an int? public enum TAX { NOTAX(0),SALESTAX(10),IMPORT..

How to resolve "git pull,fatal: unable to access '\': Empty reply from server"

It's failed when I used Git command "git pull" to update my repository, messages as below: fatal: unable to access '...': Empty reply from server. And the I tried to use the GitHub App, but alert th..

How to test valid UUID/GUID?

How to check if variable contains valid UUID/GUID identifier? I'm currently interested only in validating types 1 and 4, but it should not be a limitation to your answers...

No provider for Http StaticInjectorError

I am trying to pull the data from my api, and populate it in my ionic app, but it is crashing when I enter the page the data should be populated on. Below are my two .ts files: import { Component } ..

How to resize an image to fit in the browser window?

This seems trivial but after all the research and coding I can't get it to work. Conditions are: The browser window size is unknown. So please don't propose a solution involving absolute pixel sizes..

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

Response.Redirect to new window

I want to do a Response.Redirect("MyPage.aspx") but have it open in a new browser window. I've done this before without using the JavaScript register script method. I just can't remember how?..

html select only one checkbox in a group

So how can I only allow a user to select only one checkbox? I know radio buttons are "ideal", but for my's not. I have a field where users need to select either or of the two options, b..

How do I call ::CreateProcess in c++ to launch a Windows executable?

Looking for an example that: Launches an EXE Waits for the EXE to finish. Properly closes all the handles when the executable finishes. ..

Permutations in JavaScript?

I'm trying to write a function that does the following: takes an array of integers as an argument (e.g. [1,2,3,4]) creates an array of all the possible permutations of [1,2,3,4], with each permutati..

fatal error: Python.h: No such file or directory

I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below: gcc -Wall utilsmodule.c -o Utilc After executing the command, I ge..

Do HTTP POST methods send data as a QueryString?

I'd like to know if the POST method on HTTP sends data as a QueryString, or if it use a special structure to pass the data to the server. In fact, when I analyze the communication with POST method f..

Maven: Failed to read artifact descriptor

I am hoping someone can help me with a problem I am struggling with. When I try to build my project from the terminal I get this error: Failed to read artifact descriptor for com.morrislgn.merchandi..

Calling onclick on a radiobutton list using javascript

How do I call onclick on a radiobutton list using javascript?..

Make new column in Panda dataframe by adding values from other columns

I have a dataframe with values like A B 1 4 2 6 3 9 I need to add a new column by adding values from column A and B, like A B C 1 4 5 2 6 8 3 9 12 I believe this can be done using lambda functi..

What Process is using all of my disk IO

If I use "top" I can see what CPU is busy and what process is using all of my CPU. If I use "iostat -x" I can see what drive is busy. But how do I see what process is using all of the drive's throug..

'method' object is not subscriptable. Don't know what's wrong

I'm writing some code to create an unsorted list but whenever I try to insert a list using the insert method I get the 'method' object is not subscriptable error. Not sure how to fix it. Thanks. clas..

Node.js Hostname/IP doesn't match certificate's altnames

I have code: var r = require('request'); r({ method: 'POST', url: ''}, function() { console.log(arguments) } ) When I run it on desktop with Node 0.9.4, I get this in ..

Create a data.frame with m columns and 2 rows

I would like to create a data.frame in R with m (a variable) number of columns (for example 30), and 2 rows and fill all the values in the data.frame initially with 0's. It seems as though data.frame ..

JavaScript TypeError: Cannot read property 'style' of null

I have JavaScript code and below line has problem. if ((hr==20)) document.write("Good Night"); document.getElementById('Night).style.display='' ERROR Uncaught TypeError: Cannot read property 'styl..

What does the 'b' character do in front of a string literal?

Apparently, the following is the valid syntax: my_string = b'The string' I would like to know: What does this b character in front of the string mean? What are the effects of using it? What are a..

Check whether IIS is installed or not?

I am trying to create a Local IIS Website using ASP.NET. When I click on New -----> Website and select the type as HTTP and from the dialog box if I select the option as LOCAL IIS WEBSITE I am get..

How to copy Java Collections list

I have an ArrayList and I want to copy it exactly. I use utility classes when possible on the assumption that someone spent some time making it correct. So naturally, I end up with the Collections cla..

The property 'value' does not exist on value of type 'HTMLElement'

I am playing around with typescript and am trying to create a script that will update a p-element as text is inputted in a input box. The html looks as following: <html> <head> &..

UIImageView - How to get the file name of the image assigned?

Is it possible to read the name of an UIImageView's UIImage that's presently stored in the UIImageView? I was hoping you could do something kind of like this, but haven't figured it out. NSString *c..

Python sockets error TypeError: a bytes-like object is required, not 'str' with send function

I am trying to create a program that will open a port on the local machine and let others connect into it via netcat. My current code is. s = socket.socket() host = '' port = 12345 s.bind((h..

How to search JSON tree with jQuery

I have a question about searching the JSON for the specific information. For example, I have this JSON file: { "people": { "person": [ { "name": "Peter", ..

Check string for nil & empty

Is there a way to check strings for nil and "" in Swift? In Rails, I can use blank() to check. I currently have this, but it seems overkill: if stringA? != nil { if !stringA!.isEmpty { ..


I want to count the number of distinct items in a column subject to a certain condition, for example if the table is like this: tag | entryID ----+--------- foo | 0 foo | 0 bar | 3 If I want to cou..

How to test if a double is zero?

I have some code like this: class Foo { public double x; } void test() { Foo foo = new Foo(); // Is this a valid way to test for zero? 'x' hasn't been set to anything yet. if (foo.x..

Selecting Folder Destination in Java?

I am a newbie to Java. I am trying to dynamically choose the file location to save the outcome of my project (to be initiated at the very start of my project). I worked around with a few FileDialog ex..

malloc an array of struct pointers

I have the following struct: typedef struct _chess { int **array; int size; struct _chess *parent; } chess; and I have: typedef struct _chess *Chess; Now, I want to create an array of d..

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do 'Run As---> Maven install', I am getting the following error: [INFO] Scanning for projects... [INFO] ..

What does LPCWSTR stand for and how should it be handled with?

First of all, what is it exactly? I guess it is a pointer (LPC means long pointer constant), but what does "W" mean? Is it a specific pointer to a string or a pointer to a specific string? For exampl..

Jackson JSON: get node name from json-tree

How can I receive the node names from a JSON tree using Jackson? The JSON-File looks something like this: { node1:"value1", node2:"value2", node3:{ node3.1:"value3.1", ..

How to get the start time of a long-running Linux process?

Is it possible to get the start time of an old running process? It seems that ps will report the date (not the time) if it wasn't started today, and only the year if it wasn't started this year. Is th..

What is a "callable"?

Now that it's clear what a metaclass is, there is an associated concept that I use all the time without knowing what it really means. I suppose everybody made once a mistake with parenthesis, result..

Read a text file using Node.js?

I need to pass in a text file in the terminal and then read the data from it, how can I do this? node server.js file.txt How do I pass in the path from the terminal, how do I read that on the other..

jQuery change method on input type="file"

I'm trying to embrace jQuery 100% with it's simple and elegant API but I've run into an inconsistency between the API and straight-up HTML that I can't quite figure out. I have an AJAX file uploader ..

How to handle configuration in Go

I'm new at Go programming, and I'm wondering: what is the preferred way to handle configuration parameters for a Go program (the kind of stuff one might use properties files or ini files for, in other..

Preview an image before it is uploaded

I want to be able to preview a file (image) before it is uploaded. The preview action should be executed all in the browser without using Ajax to upload the image. How can I do this?..

does linux shell support list data structure?

this question is not the same as Does the shell support sets? i know lots of script language support list structure, such as python, python, ruby, and javascript, so what about linux shell? does she..

Open PDF in new browser full window

How do I open PDF document in new browser window? The window should be full and withouth menu. Just a PDF document in a clean full window with native Javascript or jQuery...

Angular 6 Material mat-select change method removed

In Angular Material Design 6, the (change) method was removed. I cant find how to replace the change method to execute code in the component when the user change selection Thanks!..

Counting the number of occurences of characters in a string

I am trying to write a Java program which takes in as input a string and counts the number of occurrences of characters in a string and then prints a new string having the character followed by the no..

How do I install an R package from source?

A friend sent me along this great tutorial on webscraping NYtimes with R. I would really love to try it. However, the first step is to installed a package called RJSONIO from source. I know R reasona..

Search All Fields In All Tables For A Specific Value (Oracle)

Is it possible to search every field of every table for a particular value in Oracle? There are hundreds of tables with thousands of rows in some tables so I know this could take a very long time to ..

Force an SVN checkout command to overwrite current files

I'm adding an existing site to SVN. The files already exist on the webserver, and now identical copies (- configuration files) exist in the repository. I want to convert the webserver directory into..

Using gradle to find dependency tree

Is it possible to use gradle to produce a tree of what depends on what? I have a project and would like to find out all the dependencies so I may be able to prune it a little with forward declaration..

How to read the Stock CPU Usage data

On Ice Cream Sandwich, an option in the Developer Options is "Show CPU Usage", which adds an overlay on the screen (see screenshot below). My question is, how do I read the data ? I guessed that the..

insert/delete/update trigger in SQL server

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

Determining image file size + dimensions via Javascript?

As part of a web app, once images have been downloaded and rendered on a web page, I need to determine an image's file size (kb) and resolution within the browser context (so I could, for example, dis..

How to pass an object into a state using UI-router?

I'd like to be able to transition to a state and a pass an arbitrary object using ui-router. I'm aware that usually $stateParams is used, but I believe this value is inserted into the URL, and I don'..

How to specify table's height such that a vertical scroll bar appears?

I have a table with many rows on my page. I would like to set table's height, say for 500px, such that if the height of the table is bigger than that, a vertical scroll bar will appear. I tried to use..

RelativeLayout center vertical

I want to make a list row layout. This layout has a imageview in the most left, a textview right next to the imageview, and a imageview in the most right. I want all of them are center vertical. <..

remove inner shadow of text input

So I have a text input, im using html5, on chrome, and I want to change the look of a text input, I've removed the outline on focus (orange on chrome), I set the background to a light color #f1f1f1 bu..

How to check if field is null or empty in MySQL?

I am trying to figure out how to check if a field is NULL or empty. I have this: SELECT IFNULL(field1, 'empty') as field1 from tablename I need to add an additional check field1 != "" somet..

difference between @size(max = value ) and @min(value) @max(value)

I want to do some domain validation in my object I am having one integer, now my question is: if I write @Min(SEQ_MIN_VALUE) @Max(SEQ_MAX_VALUE) private Integer sequence; and @Size(min = 1, max = NA..

python: how to check if a line is an empty line

Trying to figure out how to write an if cycle to check if a line is empty. The file has many strings, and one of these is a blank line to separate from the other statements (not a ""; is a carriage r..

How to detect if a string contains special characters?

How to detect if a string contains special characters like #,$,^,&,*,@,! etc (non-alphanumeric characters) in SQL server 2005?..

How do I parallelize a simple Python loop?

This is probably a trivial question, but how do I parallelize the following loop in python? # setup output lists output1 = list() output2 = list() output3 = list() for j in range(0, 10): # calc ..

How to enable php7 module in apache?

When I try to run a2enmod php7.0 - I got message "Considering conflict php5 for php7.0". After restarting apache - apache can't start. How to solve this? Maybe some already enabled modules links t..

What is the difference between parseInt() and Number()?

How do parseInt() and Number() behave differently when converting strings to numbers?..

T-SQL: Export to new Excel file

I have a script that does various things and the end result is one large table. I was wondering how I could export this final table to a new Excel file (with column headers as well). I would need to ..

how to change color of TextinputLayout's label and edittext underline android

I am using android design library's TextinputLayout. But couldn't customize the hint color, label color and the underline color of EditText inside TextinputLayout. Please help...

Casting objects in Java

I'm confused about what it means to cast objects in Java. Say you have... Superclass variable = new Subclass object(); (Superclass variable).method(); What is happening here? Does the variable typ..

Using RegEX To Prefix And Append In Notepad++

I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to add a string before each line and after each line.. So that: wordone wordtwo wo..

What is the difference between % and %% in a cmd file?

I recently included a line similar to this in a .cmd file: for /f %%f in ('dir /b .\directory\*.sql') DO sqlcmd -b -o ".\directory\output\%%f.txt" -i ".\directory\%%f" Originally I had only used %f..

UTF-8 byte[] to String

Let's suppose I have just used a BufferedInputStream to read the bytes of a UTF-8 encoded text file into a byte array. I know that I can use the following routine to convert the bytes to a string, but..

std::string formatting like sprintf

I have to format std::string with sprintf and send it into file stream. How can I do this?..

how to activate a textbox if I select an other option in drop down box

suppose I've a 3 options in a drop down box say red , blue, others. If a user select option as an others then below a text box should be visible to wrtie his own favourite color. I can populat..

How to change maven logging level to display only warning and errors?

I want to prevent maven from displaying INFO messages, I want to see only WARNINGS and ERRORS (if any). How can I achieve this, preferably by changing the command line that calls maven?..

How generate unique Integers based on GUIDs

Is it possible to generate (highly probable) unique Integer from GUIDs? int i = Guid.NewGuid().GetHashCode(); int j = BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0); Which one is better?..

How to use zIndex in react-native

I've want to achieve the following: The following images are what I can do right now, but that's NOT what I want. Sample of code I have right now: renderA() { return ( <View style..

Setting the JVM via the command line on Windows

Is it possible to specify the JVM to use when you call "java jar jar_name.jar" . I have two JVM installed on my machine. I can not change JAVA_HOME as it may break code that is all ready running. Kin..

JavaScript isset() equivalent

In PHP you can do if(isset($array['foo'])) { ... }. In JavaScript you often use if( { ... } to do the same, but this is not exactly the same statement. The condition will also evaluate to fa..

Forgot Oracle username and password, how to retrieve?

I have forgotten my Oracle username and password and hence not able to use it. My Oracle version is I consulted Internet. They asked me to execute commands like ‘SYSDBA’ but I was..

mysqli::mysqli(): (HY000/2002): Can't connect to local MySQL server through socket 'MySQL' (2)

I get this error when I try to connect to the mysql database using php mysqli class. Using following code: $db = new MySQLi("localhost","kamil","*****"); if (mysqli_connect_errno()) { echo "An er..

What is the difference between max-device-width and max-width for mobile web?

I need to develop some html pages for iphone/android phones, but what is the difference between max-device-width and max-width? I need to use different css for different screen size. @media all and (..

Can I have multiple background images using CSS?

Is it possible to have two background images? For instance, I'd like to have one image repeat across the top (repeat-x), and another repeat across the entire page (repeat), where the one across the e..

What does PHP keyword 'var' do?

This is probably a very trivial question, but I haven't been able to find the answer neither through web search engines, nor on Please just direct me to where I can read about this, if you ha..

Reset the graphical parameters back to default values without use of

Such as margins, orientations and such... does not work for me. I am often using RStudio, with its inbuilt graphics device. I then have plotting functions, which I want to plot either in th..

Store a cmdlet's result value in a variable in Powershell

I would like to run a cmdlet and store the result's value in a variable. For example C:\PS>Get-WSManInstance -enumerate wmicimv2/win32_process | select Priority It lists priorities with a heade..

How to get the Parent's parent directory in Powershell?

So if I have a directory stored in a variable, say: $scriptPath = (Get-ScriptDirectory); Now I would like to find the directory two parent levels up. I need a nice way of doing: $parentPath = Spl..

Copy and Paste a set range in the next empty row

This should be simple but I am having a tough time.. I want to copy the cells A3 through E3, and paste them into the next empty row on a different worksheet. I have used this code before in longer str..

Comparing a variable with a string python not working when redirecting from bash script

First I'll show you both the bash and python script (both are in the /bin directory on my mac): The bash script (esh_1): #! /bin/bash echo -n "Enter bash or natural-language command: " read INPUT e..

Best way to store data locally in .NET (C#)

I'm writing an application that takes user data and stores it locally for use later. The application will be started and stopped fairly often, and I'd like to make it save/load the data on application..

Ant build failed: "Target "build..xml" does not exist"

When I run the ant file in verbose mode, I got an error like the one below. Does anyone have any ideas what is going wrong? I am new to this] Could not load definitions fr..

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: SELECT COUNT(*) AS total FROM table1 WHERE ... and check to see if the total is non-zero or is ..

What's the best way to share data between activities?

I have one activity which is the main activity used throughout the app and it has a number of variables. I have two other activities which I would like to be able to use the data from the first activi..

How do I remove a library from the arduino environment?

In the Arduino GUI on windows, if I click on Sketch --> Import Library, at the bottom of the menu there is a section called "Contributed". Unfortunately, I had misclicked and added a library I did no..

How can I verify a Google authentication API access token?

How can I verify a Google authentication access token? I need to somehow query Google and ask: Is [given access token] valid for the [[email protected]] Google account? Short version: It's clear h..

iTerm 2: How to set keyboard shortcuts to jump to beginning/end of line?

I can see that Ctrl+left/right jumps to the beginning/end of line. How to change this to Cmd+left/right arrow? In order to get Alt+left/right arrow working correctly for word jumping follow this arti..

How to access the services from RESTful API in my angularjs page?

I am very new to angularJS. I am searching for accessing services from RESTful API, but I didn't get any idea. How can I do that?..

display:inline vs display:block

What is the basic difference between the following CSS: display:inline and this: display:block Using these separately on an element, I get the same result...

JavaScript operator similar to SQL "like"

Possible Duplicate: Emulating SQL LIKE in JavaScript Is there an operator in JavaScript which is similar to the like operator in SQL? Explanations and examples are appreciated...

Very simple log4j2 XML configuration file using Console and File appender

I'd like a very simple XML configuration file with a console and a file appender using log4j2. (The Apache Website is killing me with much Information.)..

Converting 24 hour time to 12 hour time w/ AM & PM using Javascript

What is the best way to convert the following JSON returned value from a 24-hour format to 12-hour format w/ AM & PM? The date should stay the same - the time is the only thing that needs formatti..

How do I abort the execution of a Python script?

I have a simple Python script that I want to stop executing if a condition is met. For example: done = True if done: # quit/stop/exit else: # do other stuff Essentially, I am looking for s..

How to install a Notepad++ plugin offline?

I am trying to install a Notepad++ plugin from Plugins -> Plugin Manager, but my office firewall is restricting its download. Is there any alternate way to download plugin offline?..

Decorators with parameters?

I have a problem with the transfer of variable 'insurance_mode' by the decorator. I would do it by the following decorator statement: @execute_complete_reservation(True) def test_booking_gta_object(se..

Why use a ReentrantLock if one can use synchronized(this)?

I'm trying to understand what makes the lock in concurrency so important if one can use synchronized (this). In the dummy code below, I can do either: synchronized the entire method or synchronize t..

Differences between action and actionListener

What is the difference between action and actionListener, and when should I use action versus actionListener?..

Adding a new entry to the PATH variable in ZSH

I'm using zsh and I'm trying to add a new entry (/home/david/pear/bin) to the PATH variable but I don't know how. The thing that confuses me the most is that there's not a single reference to a PATH ..

How to run an external program, e.g. notepad, using hyperlink?

I'm generating an HTML report by C# to print pairs of files in a table which has 3 columns: the first two columns used for the filenames and the 3rd column is a hyperlink Compare - I want this link to..

$(window).scrollTop() vs. $(document).scrollTop()

What's the difference between: $(window).scrollTop() and $(document).scrollTop() Thanks...

How to get an Array with jQuery, multiple <input> with the same name

I have a form where users can add input fields with jQuery. <input type="text" id="task" name="task[]" /> After submitting the form I get an array in PHP. I want to handle this with the $.aj..

How to spyOn a value property (rather than a method) with Jasmine

Jasmine's spyOn is good to change a method's behavior, but is there any way to change a value property (rather than a method) for an object? the code could be like below: spyOn(myObj, 'valueA').andRe..

How to scroll to top of page with JavaScript/jQuery?

Is there a way to control browser scrolling with JavaScript/jQuery? When I scroll my page half way down, then trigger a reload, I want the page to go pack to the top, but instead it tries to find the..

jQuery Combobox/select autocomplete?

Does a jQuery plug-in exist for replacing select/combo box? I tried SexyCombo, and it is as close to what I want, but it doesn't complete if you are writing from middle, only from beginning. I have ..

Catching exceptions from Guzzle

I'm trying to catch exceptions from a set of tests I'm running on an API I'm developing and I'm using Guzzle to consume the API methods. I've got the tests wrapped in a try/catch block but it is still..