Questions Tagged with #Perlmagick

Image::Magick is an objected-oriented Perl interface to ImageMagick. Use it to read, manipulate, or write an image or image sequence from within a Perl

CSS selectors ul li a {...} vs ul > li > a {...}

What is the difference between ul > li > a {...} and ul li a {...} in CSS? Which one is more efficient and why? ..

Spring MVC: How to return image in @ResponseBody?

I'm getting image data (as byte[]) from DB. How to return this image in @ResponseBody ? EDIT I did it without @ResponseBody using HttpServletResponse as method parameter: @RequestMapping("/photo1")..

In SQL Server, what does "SET ANSI_NULLS ON" mean?

The definition says: When SET ANSI_NULLS is ON, a SELECT statement that uses WHERE column_name = NULL returns zero rows even if there are null values in column_name. A SELECT statement that uses W..

Fill username and password using selenium in python

How can I auto fill the username and password over the link below: from selenium import webdriver from selenium.webdriver.common.keys import Keys chromedriver = 'C:\\chromedriver.exe' browser = webd..

MySQL and GROUP_CONCAT() maximum length

I'm using GROUP_CONCAT() in a MySQL query to convert multiple rows into a single string. However, the maximum length of the result of this function is 1024 characters. I'm very well aware that I can ..

How to find the installed pandas version

I am having trouble with some of pandas functionalities. How do I check what is my installation version?..

Equivalent to 'app.config' for a library (DLL)

Is there an equivalent to app.config for libraries (DLLs)? If not, what is the easiest way to store configuration settings that are specific to a library? Please consider that the library might be use..

JAVA_HOME and PATH are set but java -version still shows the old one

I am using Linux Mint Cinnamon 14. I have set the $JAVA_HOME and $PATH environment variables in ~/.profile as follows: export JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35 export PATH=/home/aqeel..

Delete the 'first' record from a table in SQL Server, without a WHERE condition

Is it possible to delete the 'first' record from a table in SQL Server, without using any WHERE condition and without using a cursor?..

how we add or remove readonly attribute from textbox on clicking radion button in cakephp using jquery?

Here is my cakephp generated HTML radio box and text box script: <input type="radio" id="need_staff_on_site" name="data[CaterRequest][need_staff_on_site]" value="yes" class="staff_on_site"><..

WampServer orange icon

I am having problems with Wamp Server, the icon will never turn green. It is constantly stuck at orange. I have tried many ways, editing HOSTS file, .config files, disabling IIS, changing SKYPE's por..

Objective-C: Calling selectors with multiple arguments

In MyClass.m, I've defined - (void) myTest: (NSString *) withAString{ NSLog(@"hi, %@", withAString); } and the appropriate declaration in MyClass.h . Later I want to call [self performSelector..

How to get index in Handlebars each helper?

I'm using Handlebars for templating in my project. Is there a way to get the index of the current iteration of an "each" helper in Handlebars? <tbody> {{#each item}} <tr> ..

If input field is empty, disable submit button

I'm trying to disable submit button if the user hasn't provided any text. At first sight it looks that everything works just fine, but if user types some text, then deletes it, the submit button bec..

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex in Android Studio 3.0

This is my app level gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion '27.0.0' useLibrary 'org.apache.http.legacy' defaultCon..

Easy way to pull latest of all git submodules

We're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependent project as a ..

Nested lists python

Can anyone tell me how can I call for indexes in a nested list? Generally I just write: for i in range (list) but what if I have a list with nested lists as below: Nlist = [[2,2,2],[3,3,3],[4,4,..

PYTHONPATH vs. sys.path

Another developer and I disagree about whether PYTHONPATH or sys.path should be used to allow Python to find a Python package in a user (e.g., development) directory. We have a Python project with a ..

Node.js Port 3000 already in use but it actually isn't?

I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on localhost, port 3000. Today, I started to ..

How to get device make and model on iOS?

I was wondering if it's possible to determine what kind of iPhone (for example) the currentdevice is? I know it's possible to get the model through NSString *deviceType = [[UIDevice currentDevice]..

An array of List in c#

I want to have an array of Lists. In c++ I do like: List<int> a[100]; which is an array of 100 Lists. each list can contain many elements. I don't know how to do this in c#. Can anyone help m..

Send JSON data via POST (ajax) and receive json response from Controller (MVC)

I created a function in javascript like that: function addNewManufacturer() { var name = $("#id-manuf-name").val(); var address = $("#id-manuf-address").val(); var phone = $("#id..

Changing position of the Dialog on screen android

I made a simple AlertDialog in my Activity: View view = layoutInflater.inflate(R.layout.my_dialog, null); AlertDialog infoDialog = new AlertDialog.Builder(MyActivity.this) .setVie..

How to check View Source in Mobile Browsers (Both Android && Feature Phone)

I need to check the view source of the page from mobile / tablet browsers ( Android Phones/Tablets and Feature Phones). I tried some of the methods but is not feasible like in desktop. I feels diffi..

How do I read a text file of about 2 GB?

I have a .txt file whose memory is more than 2 GB. The problem is I cannot open it with Notepad, Notepad++ or any other editor programs. Any solutions?..

How can I write data attributes using Angular?

When I try to use a data attribute in my template, like this: <ol class="viewer-nav"> <li *ngFor="#section of sections" data-value="{{ section.value }}"> ..

Using multiple IF statements in a batch file

When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the command(s)? An example to use would be: IF EXI..

What does /p mean in set /p?

What does /p stand for in set /p=? I know that / enables a switch, and I'm fairly sure that I know /a is for arithmetic. I've heard numerous rumours, some saying /p is for prompt, others stating it st..

How to get the concrete class name as a string?

I want to avoid calling a lot of isinstance() functions, so I'm looking for a way to get the concrete class name for an instance variable as a string. Any ideas?..

Finding current executable's path without /proc/self/exe

It seems to me that Linux has it easy with /proc/self/exe. But I'd like to know if there is a convenient way to find the current application's directory in C/C++ with cross-platform interfaces. I've s..

Error converting data types when importing from Excel to SQL Server 2008

Every time that I try to import an Excel file into SQL Server I'm getting a particular error. When I try to edit the mappings the default value for all numerical fields is float. None of the fields ..

Best way to reset an Oracle sequence to the next value in an existing column?

For some reason, people in the past have inserted data without using sequence.NEXTVAL. So when I go to use sequence.NEXTVAL in order to populate a table, I get a PK violation, since that number is al..

Run R script from command line

I have a file, called a.r, it has a chmod of 755, sayHello <- function(){ print('hello') } sayHello() How can I run this via command-line?..

How do I prompt a user for confirmation in bash script?

I want to put a quick "are you sure?" prompt for confirmation at the top of a potentially dangerous bash script, what's the easiest/best way to do this?..

bitwise XOR of hex numbers in python

how can we XOR hex numbers in python eg. I want to xor 'ABCD' to '12EF'. answer should be B922. i used below code but it is returning garbage value def strxor(a, b): # xor two strings of differe..

How to get random value out of an array?

I have an array called $ran = array(1,2,3,4); I need to get a random value out of this array and store it in a variable, how can I do this?..

Jquery Setting Value of Input Field

I have an input field and i am trying to set its value using its class <form:input path="userName" id="userName" title="Choose A Unique UserName" readonly="${userNameStatus}" class="formData"/>..

How to kill/stop a long SQL query immediately?

I am using SQL server 2008 and its management studio. I executed a query that yields many rows. I tried to cancel it via the red cancel button, but it has not stopped for the past 10 minutes. It usual..

Difference between classification and clustering in data mining?

Can someone explain what the difference is between classification and clustering in data mining? If you can, please give examples of both to understand the main idea...

'mvn' is not recognized as an internal or external command, operable program or batch file

May be question is asked before but i found very strange kind of error. When I run mvn --version command from bin its gives the version and the other information. However when I run outside bin it giv..

Conditional formatting based on another cell's value

I'm using Google Sheets for a daily dashboard. What I need is to change the background color of cell B5 based on the value of another cell - C5. If C5 is greater than 80% then the background color i..

How do I find the width & height of a terminal window?

As a simple example, I want to write a CLI script which can print = across the entire width of the terminal window. #!/usr/bin/env php <?php echo str_repeat('=', ???); or #!/usr/bin/env python ..

How can I get argv[] as int?

i have a piece of code like this: int main (int argc, char *argv[]) { printf("%d\t",(int)argv[1]); printf("%s\t",(int)argv[1]); } and in shell i do this: ./test 7 but the first printf res..

Output array to CSV in Ruby

It's easy enough to read a CSV file into an array with Ruby but I can't find any good documentation on how to write an array into a CSV file. Can anyone tell me how to do this? I'm using Ruby 1.9.2 i..

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

Search for all files in project containing the text 'querystring' in Eclipse

I work in Dreamweaver and Eclipse when developing. I think Dreamweaver has a really nice search where you can search for text within all files of your current project. This is handy when you want to..

Test whether string is a valid integer

I'm trying to do something common enough: Parse user input in a shell script. If the user provided a valid integer, the script does one thing, and if not valid, it does something else. Trouble is, I h..

Maven – Always download sources and javadocs

Is there a way I can configure maven to always download sources and javadocs? Specifying -DdownloadSources=true -DdownloadJavadocs=true everytime (which usually goes along with running mvn compile twi..

Running Facebook application on localhost

I am planning to connect to Facebook chat from my localhost. I will need to get the session key from Facebook. When I give the site URL as localhost:8080 or ip-address:8080 it does not work. I read ..

Cannot set property 'display' of undefined

I'm writting script to hide/show menu but I get some troubles. function displayMenu() { //var classMenu = event.target.className; //classMenu += 'Menu'; //document.getElementsByClassName(clas..

Can a table row expand and close?

Is it possible to make a table row expand and collapse? Can anyone refer me to a script or an example? I prefer jQuery if possible. I have a drawing concept I would like to achieve: ..

Difference between InvariantCulture and Ordinal string comparison

When comparing two strings in c# for equality, what is the difference between InvariantCulture and Ordinal comparison?..

Throw keyword in function's signature

What is the technical reason why it is considered bad practice to use the C++ throw keyword in a function signature? bool some_func() throw(myExc) { ... if (problem_occurred) { throw myExc..

Lint: How to ignore "<key> is not translated in <language>" errors?

I can't compile/debug our Android app, because the localization files are not perfect yet. My IDE's validation tool Lint create errors saying: newCardsOrderVals is not translated in ar, bg, ca, c..

Angular 5 - Copy to clipboard

I am trying to implement an icon that when clicked will save a variable to the user's clipboard. I have currently tried several libraries and none of them have been able to do so. How do I properly ..

Where to place and how to read configuration resource files in servlet based application?

In my web application I have to send email to set of predefined users like [email protected], so I wish to add that to a .properties file and access it when required. Is this a correct procedure, if so ..

static const vs #define

Is it better to use static const vars than #define preprocessor? Or maybe it depends on the context? What are advantages/disadvantages for each method?..

How do the likely/unlikely macros in the Linux kernel work and what is their benefit?

I've been digging through some parts of the Linux kernel, and found calls like this: if (unlikely(fd < 0)) { /* Do something */ } or if (likely(!err)) { /* Do something */ } I've foun..

How to serve static files in Flask

So this is embarrassing. I've got an application that I threw together in Flask and for now it is just serving up a single static HTML page with some links to CSS and JS. And I can't find where in the..

In c++ what does a tilde "~" before a function name signify?

template <class T> class Stack { public: Stack(int = 10) ; ~Stack() { delete [] stackPtr ; } //<--- What does the "~" signify? int push(const T&); int pop(T&) ;..

How do I display local image in markdown?

Does anyone know how to display a local image in markdown? I don't want to setup a webserver for that. I try the following in markdown, but it doesn't work: ![image](files/Users/jzhang/Desktop/Isolate..

List Directories and get the name of the Directory

I am trying to get the code to list all the directories in a folder, change directory into that folder and get the name of the current folder. The code I have so far is below and isn't working at the ..

Django - makemigrations - No changes detected

I was trying to create migrations within an existing app using the makemigrations command but it outputs "No changes detected". Usually I create new apps using the startapp command but did not use it..

Add error bars to show standard deviation on a plot in R

For each X-value I calculated the average Y-value and the standard deviation (sd) of each Y-value x = 1:5 y = c(1.1, 1.5, 2.9, 3.8, 5.2) sd = c(0.1, 0.3, 0.2, 0.2, 0.4) plot (x, y) How can I use..

How to import js-modules into TypeScript file?

I have a Protractor project which contains such a file: var FriendCard = function (card) { var webElement = card; var menuButton; var serialNumber; this.getAsWebElement = function () ..

How do I check that a Java String is not all whitespaces?

I want to check that Java String or character array is not just made up of whitespaces, using Java? This is a very similar question except it's Javascript: How can I check if string contains charact..

Adding timestamp to a filename with mv in BASH

Well, I'm a linux newbie, and I'm having an issue with a simple bash script. I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a sta..

HTTPS setup in Amazon EC2

How do we enable HTTPS in Amazon EC2? Our site is working on HTTP...

Eclipse CDT: Symbol 'cout' could not be resolved

The error is as above. I have what should be all the necessary files include in the eclipse project: /usr/include/c++/4.6 /usr/include /usr/include/linux /usr/local/include etc. I tried std::cout..

Pass row number as variable in excel sheet

Suppose I have: a value of 5 in B1 I want to pass the number (5) in B1 as a row variable, which will be read in conjunction with column A into another cell (say C1) as "=A(B1)" i.e. "=A5" How wou..

Making a DateTime field in a database automatic?

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

MySQL Select Multiple VALUES

Totally out of ideas here, could be needing a simple solution. Basically my desired query is : SELECT * FROM table WHERE id = 3,4 I want to select only the row which has ID 3 and 4, or maybe name ..

Stash just a single file

I'd like to be able to stash just the changes from a single file: git stash save -- just_my_file.txt The above doesn't work though. Any alternatives?..

Using CSS to insert text

I'm relatively new to CSS, and have used it to change the style and formatting of text. I would now like to use it to insert text as shown below: <span class="OwnerJoe">reconcile all entries&l..

How to get the number of characters in a string

How can I get the number of characters of a string in Go? For example, if I have a string "hello" the method should return 5. I saw that len(str) returns the number of bytes and not the number of cha..

How to configure CORS in a Spring Boot + Spring Security application?

I use Spring Boot with Spring Security and Cors Support. If I execute following code url = 'http://localhost:5000/api/token' xmlhttp = new XMLHttpRequest xmlhttp.onreadystatechange = -> if ..

Is it possible to change the speed of HTML's <marquee> tag?

When one marquee leaves the screen then after a short time gap it enters from another side. Is there any way to reduce this time?..

How do you get a directory listing sorted by creation date in python?

What is the best way to get a list of all files in a directory, sorted by date [created | modified], using python, on a windows machine?..

How to support different screen size in android

I'm developing an app in android and I have to support all different screen sizes and density. So i've created different folder for layout : layout-small layout-large and layout. Then I've created d..

upstream sent too big header while reading response header from upstream

I am getting these kind of errors: 2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream, client: 107.21.193.210, server: aamjanata.co..

Redirecting a request using servlets and the "setHeader" method not working

I am new to servlet development, and I was reading an ebook, and found that I can redirect to a different web page using setHeader("Location", "http://www.google.com") But this is not working, as ..

Could someone explain this for me - for (int i = 0; i < 8; i++)

Could someone explain in the simplest terms, as if you are talking to an idiot (because you are), what this code is actually saying/doing for (int i = 0; i < 8; i++) ..

Regular Expression to find a string included between two characters while EXCLUDING the delimiters

I need to extract from a string a set of characters which are included between two delimiters, without returning the delimiters themselves. A simple example should be helpful: Target: extract the su..

Android Studio: Where is the Compiler Error Output Window?

When I 'Run' my project in Android Studio, in the 'Messages' window, I get: Gradle: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':play01:compileDebug'. >..

How to do a FULL OUTER JOIN in MySQL?

I want to do a Full Outer Join in MySQL. Is this possible? Is a Full Outer Join supported by MySQL?..

how to change attribute "hidden" in jquery

<td> <input id="check" type="checkbox" name="del_attachment_id[]" value="<?php echo $attachment['link'];?>"> </td> <td id="delete" hidden="true"> the file will be delete..

Before and After Suite execution hook in jUnit 4.x

I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm look..

Docker remove <none> TAG images

root@server:~# docker images -a REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE <none> <none> 5e2dfc8..

Can I change the Android startActivity() transition animation?

I am starting an activity and would rather have a alpha fade-in for startActivity(), and a fade-out for the finish(). How can I go about this in the Android SDK?..

How to go to a URL using jQuery?

How to go to a URL using jQuery or JavaScript. <a href="javascript:void(0)" onclick="javascript:goToURL()">Go To URL</a> function goToURL(url){ // some code to go to url } I don't w..

Show tables, describe tables equivalent in redshift

I'm new to aws, can anyone tell me what are redshifts' equivalents to mysql commands? show tables -- redshift command describe table_name -- redshift command ..

What is the difference between char * const and const char *?

What's the difference between: char * const and const char * ..

How to set up devices for VS Code for a Flutter emulator

I'd like to use VS Code as my editor for Flutter development, but I don't know how to get the emulator going. I've installed VS Code on Ubuntu 17.10. I followed the first half of instructions as outli..

iOS Simulator to test website on Mac

I need to test my site on an iOS device from a Mac. Is there a desktop simulator available to do this?..

JAVA_HOME does not point to the JDK

I am trying to follow a tutorial about how to use ant to build and run your application. I've followed all the steps and have created the build file, but when I try to run ant it gives me this error. ..

Server cannot set status after HTTP headers have been sent IIS7.5

Sometimes I get exception in my production environment: Process information Process ID: 3832 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception i..

'DataFrame' object has no attribute 'sort'

I face some problem here, in my python package I have install numpy, but I still have this error 'DataFrame' object has no attribute 'sort' Anyone can give me some idea.. This is my code : final.lo..

How to turn on line numbers in IDLE?

In the main shell of IDLE, errors always return a line number but the development environment doesn't even have line numbers. Is there anyway to turn on line numbers?..

Explain the concept of a stack frame in a nutshell

It seems that I get the idea of call stack in programming language design. But I cannot find (probably, I just don't search hard enough) any decent explanation of what stack frame is. So I would like..

asp.net validation to make sure textbox has integer values

I have a required validation setup on a textbox, but I also have to make sure it is an integer. How can I do this?..

validation of input text field in html using javascript

<script type='text/javascript'> function required() { var empt = document.forms["form1"]["Name"].value; if (empt == "") { alert("Please input a Value"); r..

C - gettimeofday for computing time?

do you know how to use gettimeofday for measuring computing time? I can measure one time by this code: char buffer[30]; struct timeval tv; time_t curtime; gettimeofday(&tv, NULL); cu..

How to convert an int value to string in Go?

i := 123 s := string(i) s is 'E', but what I want is "123" Please tell me how can I get "123". And in Java, I can do in this way: String s = "ab" + "c" // s is "abc" how can I concat two str..

Why can't Visual Studio find my DLL?

In Visual Studio 2010, under VC++ Directories > Executable Directories, I have specified the path to glew32d.dll. However, when I run the executable, it still complains. On the other hand, if I co..

What does java:comp/env/ do?

I just spent too much time of my day trying to figure out some errors when hooking up some JNDI factory bean. The problem turned out to be that instead of this... <bean id="someId" class="org.spri..

Difference between HashMap and Map in Java..?

Possible Duplicate: Java - HashMap vs Map objects I want to know the difference between HashMap and Map in java..??..

How to use Macro argument as string literal?

I am trying to figure out how to write a macro that will pass both a string literal representation of a variable name along with the variable itself into a function. For example given the following f..

VBA Copy Sheet to End of Workbook (with Hidden Worksheets)

I want to copy a sheet and add it to the end of all current sheets (regardless of whether the sheets are hidden). Sheets(1).Copy After:=Sheets(Sheets.Count) Sheets(Sheets.Count).name = "copied sheet!..

Read/Write String from/to a File in Android

I want to save a file to the internal storage by getting the text inputted from EditText. Then I want the same file to return the inputted text in String form and save it to another String which is to..

Check if returned value is not null and if so assign it, in one line, with one method call

Java is littered with statements like: if(cage.getChicken() != null) { dinner = cage.getChicken(); } else { dinner = getFreeRangeChicken(); } Which takes two calls to getChicken() before th..

Single line if statement with 2 actions

I'd like to do a single line if statement with more than 1 action. Default is this: (if) ? then : else userType = (user.Type == 0) ? "Admin" : "User"; But I don't need an "else" only, I need an "..

php delete a single file in directory

I've got the php list directory script from this link http://www.gaijin.at/en/scrphpfilelist.php. How do I delete a single file from the directoy? I tried unlink, but it deleted all the files from tha..

How to redirect back to form with input - Laravel 5

How do I redirect back to my form page, with the given POST params, if my form action throws an exception?..

HTML table needs spacing between columns, not rows

I have an HTML table. I need to have spacing between the table columns, but not the table rows. If I use the cellspacing CSS property it does it between both rows and columns. I also cannot use CSS i..

M_PI works with math.h but not with cmath in Visual Studio

I am using Visual Studio 2010. I have read that in C++ it is better to use <cmath> rather than <math.h>. But in the program I am trying to write (Win32 console application, empty project..

How to display special characters in PHP

I've seen this asked several times, but not with a good resolution. I have the following string: $string = "<p>Résumé</p>"; I want to print or echo the string, but the output will ret..

Resize jqGrid when browser is resized?

Is there any way to resize a jqGrid when the browser window is resized? I have tried the method described here but that technique does not work in IE7...

How to request Google to re-crawl my website?

Does someone know a way to request Google to re-crawl a website? If possible, this shouldn't last months. My site is showing an old title in Google's search results. How can I show it with the correct..

git stash blunder: git stash pop and ended up with merge conflicts

I did a git stash pop and ended up with merge conflicts. I removed the files from the file system and did a git checkout as shown below, but it thinks the files are still unmerged. I then tried replac..

Vendor code 17002 to connect to SQLDeveloper

I'm trying to connect to a database using SQLDeveloper and I get the following error: An Error was Encountered performing The requested operation: IO Error: Conection reset Vendor code 17002. Cou..

Django Server Error: port is already in use

Restarting the Django server displays the following error: this port is already running.... This problem occurs specifically on Ubuntu and not other operating systems. How can I free up the port to..

Java - using System.getProperty("user.dir") to get the home directory

I was wondering if using: System.getProperty("user.dir"); to get the absolute path of a folder is the best way to go about it? I am looking to pass my application onto other computers and I need a ..

How to align absolutely positioned element to center?

I am trying to stack two canvas together and make it a double layers canvas. I've saw an example here: <div style="position: relative;"> <canvas id="layer1" width="100" height="100" st..

Core dumped, but core file is not in the current directory?

While running a C program, It says "(core dumped)" but I can't see any files under the current path. I have set and verified the ulimit: ulimit -c unlimited ulimit -a I also tried to find a file..

removing new line character from incoming stream using sed

I am new to shell scripting and i am trying to remove new line character from each line using SED. this is what i have done so far : printf "{new\nto\nlinux}" | sed ':a;N;s/\n/ /g' removes only Ist..

Live search through table rows

I want to do a live search through the table rows, using jQuery, the "live" word is the key, because I want to type the keywords in the text input, on the same site and I'd like jQuery to automatical..

Update span tag value with JQuery

I'm trying to update a span tag that is in a fieldset tag that is in a legend tag. The idea is to update the cost of a Software Item as components are selected. The code below works fine if I only h..

Eclipse: Syntax Error, parameterized types are only if source level is 1.5

I try to use the following code: ArrayList<String> Map<String, String> Eclipse complains about both of them: Syntax Error, parameterized types are only if source level is 1.5. I use JD..

Angular 2 - NgFor using numbers instead collections

...for example... <div class="month" *ngFor="#item of myCollection; #i = index"> ... </div> Is possible to do something like... <div class="month" *ngFor="#item of 10; #i = index"&g..

How to select all textareas and textboxes using jQuery?

How can I select all textboxes and textareas, e.g: <input type='text' /> and <textarea></textarea> on a page and have the property style.width="90%"; applied to them?..

"The breakpoint will not currently be hit. The source code is different from the original version." What does this mean?

When debugging in Visual Studio, sometimes I add a breakpoint but it's hollow and VS says "The breakpoint will not currently be hit. The source code is different from the original version." Obviously ..

Using setDate in PreparedStatement

In order to make our code more standard, we were asked to change all the places where we hardcoded our SQL variables to prepared statements and bind the variables instead. I am however facing a prob..

Write in body request with HttpClient

I want to write the body of a request with XML content-type but I don't know how with HttpClient Object ( http://hc.apache.org/httpclient-3.x/apidocs/index.html ) DefaultHttpClient httpClient = new D..

Stop all active ajax requests in jQuery

I have a problem, when submitting a form all active ajax request fail, and that triggers error event. How to stop all active ajax requests in jQuery without trigerring error event?..

How to create a MySQL hierarchical recursive query?

I have a MySQL table which is as follows: id name parent_id 19 category1 0 20 category2 19 21 category3 20 22 category4 21 ... ... ... Now, I want to have a single MySQL query to w..

Python slice first and last element in list

Is there a way to slice only the first and last item in a list? For example; If this is my list: >>> some_list ['1', 'B', '3', 'D', '5', 'F'] I want to do this (obviously [0,-1] is not va..

Clear text area

In Onselect event I have script: $("#vinanghinguyen_images_bbocde").val(''); $("#vinanghinguyen_images_bbocde").val(vinanghinguyen_final_bbcode); I want clear text area id="vinanghinguyen_images_bb..

Android difference between Two Dates

I have two date like: String date_1="yyyyMMddHHmmss"; String date_2="yyyyMMddHHmmss"; I want to print the difference like: 2d 3h 45m How can I do that? Thanks!..

How to JUnit test that two List<E> contain the same elements in the same order?

Context I am writing a simple JUnit test for the MyObject class. A MyObject can be created from a static factory method that takes a varargs of String. MyObject.ofComponents("Uno", "Dos", "Tres"); ..

Java String encoding (UTF-8)

I have come across this line of legacy code, which I am trying to figure out: String newString = new String(oldString.getBytes("UTF-8"), "UTF-8")); As far as I can understand, it is encoding & ..

How to lock orientation of one view controller to portrait mode only in Swift

Since my app got support for all orientation. I would like to lock only portrait mode to specific UIViewController. e.g. assume it was Tabbed Application and when SignIn View appear modally, I only w..

Detect all changes to a <input type="text"> (immediately) using JQuery

There are many ways the value of a <input type="text"> can change, including: keypresses copy/paste modified with JavaScript auto-completed by browser or a toolbar I want my JavaScript funct..

Disable JavaScript error in WebBrowser control

I am developing a windows application with a WebBrowser control that navigates to a sharepoint site. My problem is that i am getting JavaScript error. How can i disable the JavaScript error? I don't ..

Where is my m2 folder on Mac OS X Mavericks

I cant seem to find the local .m2 folder on Mac OS X mavericks. Ideally it should be at {user.home}/.m2 but I cant seem to find it. Should I create it?..

MongoDB: How to query for records where field is null or not set?

I have an Email document which has a sent_at date field: { 'sent_at': Date( 1336776254000 ) } If this Email has not been sent, the sent_at field is either null, or non-existant. I need to get th..

Importing variables from another file?

How can I import variables from one file to another? example: file1 has the variables x1 and x2 how to pass them to file2? How can I import all of the variables from one to another?..

How do include paths work in Visual Studio?

Visual Studio drives me crazy and I am suspecting I am doing something wrong. This is what I do: I installed Visual Studio (Pro '08) a long time ago, I installed the Windows SDK (Win 7 x64), someone ..

Application Loader stuck at "Authenticating with the iTunes store" when uploading an iOS app

We have been trying to submit an app to the iTunes store using Application Loader for three days and keep getting stuck at the "Authenticating with the iTunes store" step. We have read many forums (in..

Testing whether a value is odd or even

I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return i..

Make Vim show ALL white spaces as a character

I can't find a way to make Vim show all white spaces as a character. All I found was about tabs, trailing spaces etc...

How to Auto-start an Android Application?

I'm not sure how to autostart an android application after the android emulator completes its booting. Does anyone have any code snippets that will help me?..

Why can't I initialize non-const static member or static array in class?

Why can't I initialize non-const static member or static array in a class? class A { static const int a = 3; static int b = 3; static const int c[2] = { 1, 2 }; static int d[2] = { ..

ASP.NET MVC 5 - Identity. How to get current ApplicationUser

I have an Article entity in my project which has the ApplicationUser property named Author. How can I get the full object of currently logged ApplicationUser? While creating a new article, I have to s..

Understanding React-Redux and mapStateToProps()

I'm trying to understand the connect method of react-redux, and the functions it takes as parameters. In particular mapStateToProps(). The way I understand it, the return value of mapStateToProps w..

File Upload in WebView

I have been struggling to upload files from WebView since last few days and there is no progress. I googled and implemented all suggested solutions but none works, like: solutions suggested here, and ..

Rich Text box scroll to the bottom when new data is written to it

My program calls Java and then redirects stdout to a RichTextBox. My problem is that the vertical scrollbar always stays at the top of the box every time data is written. Even if you scroll to the bo..

Endless loop in C/C++

There are several possibilities to do an endless loop, here are a few I would choose: for(;;) {} while(1) {} / while(true) {} do {} while(1) / do {} while(true) Is there a certain form which one s..

Javascript ES6/ES5 find in array and change

I have an array of objects. I want to find by some field, and then to change it: var item = {...} var items = [{id:2}, {id:2}, {id:2}]; var foundItem = items.find(x => x.id == item.id); foundItem..

Removing "bullets" from unordered list <ul>

I have set this: list-style: none outside none; And HTML: <ul class="menu custompozition4"> <li class="item-507"><a href=#">Strategic Recruitment Soluti..

Remove the last line from a file in Bash

I have a file, foo.txt, containing the following lines: a b c I want a simple command that results in the contents of foo.txt being: a b ..

How do I include a JavaScript script file in Angular and call a function from that script?

I have a JavaScript file called abc.js that has a 'public' function called xyz(). I want to call that function in my Angular project. How do I do that?..

Sorting 1 million 8-decimal-digit numbers with 1 MB of RAM

I have a computer with 1 MB of RAM and no other local storage. I must use it to accept 1 million 8-digit decimal numbers over a TCP connection, sort them, and then send the sorted list out over anothe..

How to match any non white space character except a particular one?

In Perl \S matches any non-whitespace character. How can I match any non-whitespace character except a backslash \?..

How do I serialize a C# anonymous type to a JSON string?

I'm attempting to use the following code to serialize an anonymous type to JSON: var serializer = new DataContractJsonSerializer(thing.GetType()); var ms = new MemoryStream(); serializer.WriteObject(..

C: socket connection timeout

I have a simple program to check if a port is open, but I want to shorten the timeout length on the socket connection because the default is far too long. I'm not sure how to do this though. Here's th..

Why does an onclick property set with setAttribute fail to work in IE?

Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBt..

Check if string doesn't contain another string

In T-SQL, how would you check if a string doesn't contain another string? I have an nvarchar which could be "Oranges Apples". I would like to do an update where, for instance, a columm doesn't conta..

How to display JavaScript variables in a HTML page without document.write

I am trying to display some JavaScript variable on my HTML page. I was first using document.write() but it use to overwrite the current page when the function was called. After searching around, t..

How to get MAC address of your machine using a C program?

I am working on Ubuntu. How can I get MAC address of my machine or an interface say eth0 using C program...

Rails.env vs RAILS_ENV

I see both in examples when checking what env one is running in. What's preferred? Are they, for all intents and purposes equal?..

How to show a running progress bar while page is loading

I want to show a running progress bar while my page is loading like here, in my page. I used a simple loading image in my example, but I want to convert it in a running progress bar. Here is my code:..

button image as form input submit button?

<form method="post" action="confirm_login_credentials.php"> <table> <tr> <td>User ID:</td> <td><input type="text" id="uid">..

How to create a laravel hashed password

I am trying to create an hashed password for Laravel. Now someone told me to use Laravel hash helper but I can't seem to find it or I'm looking in the wrong direction. How do I create a laravel hash..

Execute command without keeping it in history

I want to execute some commands but don't want to store them in the command history. So that nobody will be able to search it in the .bash_history file. Is there any way how to execute bash commands ..

Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query

I have a table with a column that stores the date and time. I need to write a query to get only the date from that column, SELECT CAST(CONVERT(VARCHAR, LoginTime, 101) AS datetime) FROM AuditTrail ..

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

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

How to install Boost on Ubuntu

I'm on Ubuntu, and I want to install Boost. I tried with sudo apt-get install boost But there was no such package. What is the best way to install Boost on Ubuntu?..

How to convert a Title to a URL slug in jQuery?

I'm working on an app in CodeIgniter, and I am trying to make a field on a form dynamically generate the URL slug. What I'd like to do is remove the punctuation, convert it to lowercase, and replace t..

Use FontAwesome or Glyphicons with css :before

Is there any way to embed HTML in the css content: element when using a :before pseudo-element? I want to use a Font Awesome (or Glyphicon) in a use case like this: h1:before { content: ..

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I have installed docker on windows 10 pro. I am facing an issue while running the following command in git-bash. docker-compose up -d --build and got following error. E: gnupg, gnupg2 and gnupg1 ..

How can I drop a "not null" constraint in Oracle when I don't know the name of the constraint?

I have a database which has a NOT NULL constraint on a field, and I want to remove this constraint. The complicating factor is that this constraint has a system-defined name, and that constraint's na..

How to convert image into byte array and byte array to base64 String in android?

Can someone tell me the code to convert image into byte array and that byte array into base64 string. i write the below code not getting proper result . String filepath = "/sdcard/Image/ic_launcher..

How to Auto resize HTML table cell to fit the text size

I have a table with 2 rows and variable columns. I tried width = 100% for the column. So the first content in the view will fit. But suppose if i am changing the contents dynamically then it is not dy..

What is private bytes, virtual bytes, working set?

I am trying to use the perfmon windows utility to debug memory leaks in a process. This is how perfmon explains the terms: Working Set is the current size, in bytes, of the Working Set of this proce..

Understanding ASP.NET Eval() and Bind()

Can anyone show me some absolutely minimal ASP.NET code to understand Eval() and Bind()? It is best if you provide me with two separate code-snippets or may be web-links...

Converting a string to int in Groovy

I have a String that represents an integer value and would like to convert it to an int. Is there a groovy equivalent of Java's Integer.parseInt(String)?..

install beautiful soup using pip

I am trying to install BeautifulSoup using pip in Python 2.7. I keep getting an error message, and can't understand why. I followed the instructions to install pip, which was installed to the followi..

How to check for DLL dependency?

Sometimes when I'm doing a little project I'm not careful enough and accidentally add a dependency for a DLL that I am not aware of. When I ship this program to a friend or other people, "it doesn't w..

How to enable TLS 1.2 support in an Android application (running on Android 4.1 JB)

As per the docs in Android for SSLSocket and SSLContext, TLS v1.1 and v1.2 protocols are supported in API level 16+, but are not enabled by default. http://developer.android.com/reference/javax/net/ss..

How to delete projects in Intellij IDEA 14?

I only found how to delete projects in older versions of IDEA but still don't see the button in my IDEA 14. Did the Jetbrains guys implement this feature or do I still have to delete my project folder..

Update MySQL version from 5.1 to 5.5 in CentOS 6.2

I tried to update MySQL from 5.1 to 5.5 in CentOS 6.2. The following is the process I did: 1. rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm 2. yum install libmysqlclient15 --enablerepo=we..

jQuery Form Validation before Ajax submit

JavaScript bit: $(document).ready(function() { $('#form').submit(function(e) { e.preventDefault(); var $form = $(this); ..

UNC path to a folder on my local computer

What's the UNC path to a folder on my local computer, and how can I access it? I have tried: Security for the folder -- set to Everyone Full Control (for now!) Sharing permissions -- set to Everyone..

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

Load local javascript file in chrome for testing?

I am trying to test some JavaScript on my local computer using the Chrome browser but Chrome will not load local resources. Is there an easy work around for this?..

JavaScript ternary operator example with functions

I am using jQuery 1.7.1 I am just starting to use the JavaScript ternary operator to replace simple if/else statements. I have done so successfully in several places. I was surprised when I successf..

Only allow specific characters in textbox

How can I only allow certain characters in a Visual C# textbox? Users should be able to input the following characters into a text box, and everything else should be blocked: 0-9, +, -, /, *, (, ). I..

Declaration of Methods should be Compatible with Parent Methods in PHP

Strict Standards: Declaration of childClass::customMethod() should be compatible with that of parentClass::customMethod() What are possible causes of this error in PHP? Where can I find information ..

Why is "forEach not a function" for this object?

This is probably something really dumb, but I don't understand why this doesn't work. var a = {"cat":"large"}; a.forEach(function(value, key, map){ console.log(value); }); Uncaught TypeError: ..

Changing case in Vim

Is there a command in Vim that changes the case of the selected text?..