Questions Tagged with #Mnemonics

How to convert NSDate into unix timestamp iphone sdk?

How to convert an NSDate into Unix timestamp? I've read many posts which do the reverse. But I'm not finding anything related to my question...

Escaping backslash in string - javascript

I need to show the name of the currently selected file (in <input type="file"> element). Everything is fine, the only problem is I'm getting this kind of string "C:\fakepath \typog_rules.pdf" ..

What is the purpose of the word 'self'?

What is the purpose of the self word in Python? I understand it refers to the specific object created from that class, but I can't see why it explicitly needs to be added to every function as a parame..

jQuery detect if string contains something

I'm trying to write jQuery code to detect if a live string contains a specific set of characters then the string alerts me. HTML <textarea class="type"></textarea> My Jquery $('.type'..

Number input type that takes only integers?

I'm using the jQuery Tools Validator which implements HTML5 validations through jQuery. It's been working great so far except for one thing. In the HTML5 specification, the input type "number&quo..

Hibernate throws MultipleBagFetchException - cannot simultaneously fetch multiple bags

Hibernate throws this exception during SessionFactory creation: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags This is my test case: @Ent..

Error Code: 1062. Duplicate entry '1' for key 'PRIMARY'

I have a problem on this error message, when i try this: INSERT INTO `PROGETTO`.`UFFICIO-INFORMAZIONI` (`ID`, `viale`, `num_civico`, `data_apertura`, `data_chiusura`, `orario_apertura`, `orario_chi..

Maximum number of rows of CSV data in excel sheet

It is known that Excel sheets can display a maximum of 1 million rows. Is there any row limit for csv data, i.e. does Excel allow more than 1 million rows in csv format? One more question: About this..

How to catch a unique constraint error in a PL/SQL block?

Say I have an Oracle PL/SQL block that inserts a record into a table and need to recover from a unique constraint error, like this: begin insert into some_table ('some', 'values'); exception ..

Getting the source of a specific image element with jQuery

I have many image elements and want to get a specific image's source where the alternative text is "example". I tried this: var src = $('.conversation_img').attr('src'); but I can't get the one I ..

How to get main window handle from process id?

How to get main window handle from process id? I want to bring this window to the front. It works well in "Process Explorer"...

What does jQuery.fn mean?

What does the fn here mean? jQuery.fn.jquery ..

How can I iterate through a string and also know the index (current position)?

Often when iterating through a string (or any enumerable object), we are not only interested in the current value, but also the position (index). To accomplish this by using string::iterator we have t..

How to find the day, month and year with moment.js

2014-07-28 How do I find the month, year and day with moment.js given the date format above? var check = moment(n.entry.date_entered).format("YYYY/MM/DD"); var month = check.getUTCMonth(); var day ..

How to run a jar file in a linux commandline

How to set the classpath to the current directory and also run the jar file named load.jar present in the current directory by providing the argument as load=2 from a linux command line. I did try to..

How would I create a UIAlertView in Swift?

I have been working to create a UIAlertView in Swift, but for some reason I can't get the statement right because I'm getting this error: Could not find an overload for 'init' that accepts the su..

How does the modulus operator work?

Let's say that I need to format the output of an array to display a fixed number of elements per line. How do I go about doing that using modulus operation? Using C++, the code below works for displa..

JavaScript Infinitely Looping slideshow with delays?

How do I make an infinite loop in JavaScript? I'm trying to make a slideshow, which I have working, but I can't get it to loop. I can't even get it to loop twice. The code I'm using right now is w..

Developing C# on Linux

I'd like to know if there are effective and open source tools to develop C# applications on Linux (Ubuntu). In particular, I have to develop Windows Forms applications. I know about the Mono project,..

How to add many functions in ONE ng-click?

I've be looking for how to execute this but I can't find anything related so far, :( I could nest both functions yes but I'm just wondering if this is possible? I'd like to do this literally: <td..

Get the previous month's first and last day dates in c#

I can't think of an easy one or two liner that would get the previous months first day and last day. I am LINQ-ifying a survey web app, and they squeezed a new requirement in. The survey must includ..

Lost httpd.conf file located apache

How can I find where my httpd.conf file is located? I am running an Ubuntu Linux server from the Amazon Web Services EC2 (Elastic Compute Cloud) and I can't find my Apache config...

Get the time difference between two datetimes

I know I can do anything and some more envolving Dates with momentjs. But embarrassingly, I'm having a hard time trying to do something that seems simple: geting the difference between 2 times. Examp..

font awesome icon in select option

I try to add a caret down icon to the first selection of several options as shown on the picture below: here is a Fiddle with my example. I can't get the icon to be visible on the Fiddle above. ..

How do I center text vertically and horizontally in Flutter?

I'd like to know how to center the contents of a Text widget vertically and horizontally in Flutter. I only know how to center the widget itself using Center(child: Text("test")) but not the..

How can I iterate over files in a given directory?

I need to iterate through all .asm files inside a given directory and do some actions on them. How can this be done in a efficient way?..

prevent property from being serialized in web API

I'm using an MVC 4 web API and web forms 4.0 to build a rest API. It's working great: [HttpGet] public HttpResponseMessage Me(string hash) { HttpResponseMessage httpResponseMessage; L..

Is it possible to animate scrollTop with jQuery?

I want to smoothly scroll down. I do not want to have to write a function for that - especially if jQuery already has one...

How to parse json string in Android?

Possible Duplicate: JSON Array iteration in Android/Java I am fetching JSON string from server and I have already got JSON string by code. But I didn't understand how to parse it. Below is..

How do I replace NA values with zeros in an R dataframe?

I have a data frame and some columns have NA values. How do I replace these NA values with zeroes?..

Write Array to Excel Range

I'm currently trying to write data from an array of objects to a range in Excel using the following code, where objData is just an array of strings: private object m = System.Type.Missing; object[] o..

How to create an installer for a .net Windows Service using Visual Studio

How do I create an installer for a Windows Service that I have created using Visual Studio?..

Android Studio - Failed to notify project evaluation listener error

Following is the build.gradle code in Android Studio apply plugin: '' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicatio..

How to fix Error: listen EADDRINUSE while using nodejs?

If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE Why is it problem for nodejs, if I want to do a request, while I run a server on the por..

Get resultset from oracle stored procedure

I'm working on converting a stored procedure from SQL server to Oracle. This stored procedure provides a direct resultset. I mean that if you call the stored procedure in eg Management Studio you di..

How do I grant read access for a user to a database in SQL Server?

I want to grant access to a user to a specific database with read and write access. The user is already available in the domain but not in the DB. So, how can I give them that access with creating a ..

Where does application data file actually stored on android device?

I have developed an Android app using Appcelerator Titanium. This app will create a file in applicationDataDirectory and install a database as well. If run on emulator, I can locate those files using..

Pass a variable to a PHP script running from the command line

I have a PHP file that is needed to be run from the command line (via crontab). I need to pass type=daily to the file, but I don't know how. I tried: php myfile.php?type=daily but this error was retu..

Appending a line break to an output file in a shell script

I have a shell script that I am executing in Cygwin (maybe this is the problem). For this bit of code, I simply want to write the first line, and append a line break: echo "`date` User `whoami` start..

Why are Python's 'private' methods not actually private?

Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: __myPrivateMethod(). How, then, can one explain this >>> ..

Determine if running on a rooted device

My app has a certain piece of functionality that will only work on a device where root is available. Rather than having this feature fail when it is used (and then show an appropriate error message to..

When do you use Java's @Override annotation and why?

What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there cert..

Locking a file in Python

I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix b..

Make a link in the Android browser start up my app?

Is it possible to make a link such as: <a href="anton://useful_info_for_anton_app">click me!</a> cause my Anton app to start up? I know that this works for the Android Market app with ..

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

How do we determine the number of days for a given month in python

I need to calculate the number of days for a given month in python. If a user inputs Feb 2011 the program should be able to tell me that Feb 2011 has 28 days. Could any one tell me which library I sho..

Transfer data from one HTML file to another

I'm new to HTML and JavaScript, what I'm trying to do is from an HTML file I want to extract the things that set there and display it to another HTML file through JavaScript. Here's what I've done so..

javascript scroll event for iPhone/iPad?

I can't seem to capture the scroll event on an iPad. None of these work, what I am doing wrong? window.onscroll=myFunction; document.onscroll=myFunction; window.attachEvent("scroll",myFunction,fals..

Use of Greater Than Symbol in XML

I had created the xml document with xml version="1.0". In that document I need to use the greater than symbol > and less than symbol <. How should I include those symbols? It's not working. &..

Can HTML be embedded inside PHP "if" statement?

I would like to embed HTML inside a PHP if statement, if it's even possible, because I'm thinking the HTML would appear before the PHP if statement is executed. I'm trying to access a table in a dat..

Random state (Pseudo-random number) in Scikit learn

I want to implement a machine learning algorithm in scikit learn, but I don't understand what this parameter random_state does? Why should I use it? I also could not understand what is a Pseudo-rand..

MIPS: Integer Multiplication and Division

So I'm building a calculator program in MIPS and I'm trying to write the multiply and divide functions. Currently I read in the integers in a loop like so: li $v0, 5 syscall and then eventually ..

How do you upload a file to a document library in sharepoint?

How do you programmatically upload a file to a document library in sharepoint? I am currently making a Windows application using C# that will add documents to a document library list...

How to add an element to Array and shift indexes?

I need to add an element to Array specifying position and value. For example, I have Array int []a = {1, 2, 3, 4, 5, 6}; after applying addPos(int 4, int 87) it should be int []a = {1, 2, 3, 4, 87..

xlrd.biffh.XLRDError: Excel xlsx file; not supported

I am trying to read a macro-enabled Excel worksheet using pandas.read_excel with the xlrd library. It's running fine in local, but when I try to push the same into PCF, I am getting this error: 2020-1..

How to use subList()

I have a JSF page which displays list of Glassfish log files. I use lazy loading for pagination. I keep the list of the log files names into Java List. private List<directoryListObj> dataList =..

Best way to convert text files between character sets?

What is the fastest, easiest tool or method to convert text files between character sets? Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa. Everything goes: one-liners in you..

Python find elements in one list that are not in the other

I need to compare two lists in order to create a new list of specific elements found in one list but not in the other. For example: main_list=[] list_1=["a", "b", "c", "d", "e"] list_2=["a", "f", "c"..

Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues

I have found plenty of information out there about this error: 'ERROR: Could not load file or assembly '*.dll' or one of its dependencies. Access is denied.’ But i haven't found answer specific to ..

How does one convert a HashMap to a List in Java?

In Java, how does one get the values of a HashMap returned as a List?..

VBA code to set date format for a specific column as "yyyy-mm-dd"

I have a macro which I specify the date (in mm/dd/yyyy) in a textbox and I want to set this value for column A in yyyy-mm-dd format. I have the following code: Sheets("Sheet1").Range("A2", "A50000")..

How to display items side-by-side without using tables?

For example you want to display an image beside a text, usually I would do this: <table> <tr> <td><img ...></td> <td>text</td> </t..

How to display and hide a div with CSS?

In my script there are three divs. I want to display div with class="ab" when I hover on first line and display div with class="abc", when hover on second line. Otherwise I want to display div with cl..

Insert a line break in mailto body

I would like to insert a line break into my mailto body. I tried %0A, %0D and %0D%0A. Nothing worked for me. I tested on Gmail, Yahoo, Apple Mail, Outlook 2010, and Thunderbird with Googl..

CSS white space at bottom of page despite having both min-height and height tag

I am unable to get the white space at the bottom of this page to disappear. I have both min-height and height tags in body. Any suggestions? Thanks!

How to iterate through a DataTable

I need to iterate through a DataTable. I have an column there named ImagePath. When I am using DataReader I do it this way: SqlDataReader dr = null; dr = cmd.ExecuteReader(); while (dr.Read()) { ..

Where is the Keytool application?

I need to use mapview control in android and I can't seem to understand how to run keytool. Is it installed with eclipse? I can't seem to find a download link. Thanks..

How do you input command line arguments in IntelliJ IDEA?

I usually input command line arguments in Eclipse via run configuration. But I don't know how do achieve the same task in IntelliJ IDEA...

How do negative margins in CSS work and why is (margin-top:-5 != margin-bottom:5)?

A common trick for vertical positioning elements is to use the following CSS: .item { position:absolute; top:50%; margin-top:-8px; /* half of height */ height: 16px; } When seen in ..

jQuery returning "parsererror" for ajax request

Been getting a "parsererror" from jquery for an Ajax request, I have tried changing the POST to a GET, returning the data in a few different ways (creating classes, etc.) but I cant seem to figure out..

Getting the Facebook like/share count for a given URL

I'm using the Facebook API to get the like/share count for given URLs. The strange thing is that it seems to be quite inconsistent in returning results. For example, this page returns results: https..

How to express a One-To-Many relationship in Django

I'm defining my Django models right now and I realized that there wasn't a OneToManyField in the model field types. I'm sure there's a way to do this, so I'm not sure what I'm missing. I essentially h..

How to access component methods from “outside” in ReactJS?

Why can’t I access the component methods from “outside” in ReactJS? Why is it not possible and is there any way to solve it? Consider the code: var Parent = React.createClass({ render..

Difference between setTimeout with and without quotes and parentheses

I am learning JavaScript and I have learned recently about JavaScript timing events. When I learned about setTimeout at W3Schools, I noticed a strange figure which I didn’t run into before. They are..

How to print all key and values from HashMap in Android?

I am very new for Android development, and I am trying to use HashMap in Android sample project. Now, am doing sample project for learn android. I just store keys and values in HashMap, i want to show..

What's the best practice for primary keys in tables?

When designing tables, I've developed a habit of having one column that is unique and that I make the primary key. This is achieved in three ways depending on requirements: Identity integer column t..

Split files using tar, gz, zip, or bzip2

I need to compress a large file of about 17-20 GB. I need to split it into several files of around 1GB per file. I searched for a solution via Google and found ways using split and cat commands. But ..

SQL Server CASE .. WHEN .. IN statement

On SQL server 2005 I am trying to query this select statement SELECT AlarmEventTransactionTableTable.TxnID, CASE AlarmEventTransactions.DeviceID WHEN DeviceID IN( '7', '10', '62', '5..

Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS?

I'm a beginner RoR programmer who's planning to deploy my app using Heroku. Word from my other advisor friends says that Heroku is really easy, good to use. The only problem is that I still have no id..

How to create JSON string in JavaScript?

window.onload = function(){ var obj = '{ "name" : "Raj", "age" : 32, "married" : false }'; var val = eval('(' + obj + ')'); alert( "name :..

Incomplete type is not allowed: stringstream

Why does this line give the error Error: incomplete type is not allowed? stringstream ss; ..

how to change namespace of entire project?

I'm modifying demo application from this article: I need to update all files to use my namespace, for example now file located here: MySolution..

Get last 30 day records from today date in SQL Server

I have small question about SQL Server: how to get last 30 days information from this table Sample data: Product: Pdate ---------- 2014-11-20 2014-12-12 2014-11-10 2014-12-13 2014-10-12 2014-11-15..

Multi-threading in VBA

Does anybody here know how to get VBA to run multiple threads? I am using Excel...

How to get Spinner selected item value to string?

I have 5 Spinners. In order to make it summary to this. This is Spinner in xml <Spinner android:id="@+id/text_interested" android:layout_span="2" android:layou..

How to Deep clone in javascript

How do you deep clone a JavaScript object? I know there are various functions based on frameworks like JSON.parse(JSON.stringify(o)) and $.extend(true, {}, o) but I don't want to use a framework like ..

Why is my CSS bundling not working with a bin deployed MVC4 app?

I have bin deployed an MVC4 application to my hosting provider, based on advice given here and one or two on-the-fly fixes, but the most immediately apparent problem is that the bundling for css doesn..

How to develop or migrate apps for iPhone 5 screen resolution?

The new iPhone 5 display has a new aspect ratio and a new resolution (640 x 1136 pixels). What is required to develop new or transition already existing applications to the new screen size? What sho..

remove table row with specific id

I have the following table: <table id="test"> <tr id=1><td>bla</td></tr> <tr id=2><td>bla</td></tr> <tr id=3><td>bla</td><..

Change the "No file chosen":

I have a button "Choose file" as follows (I am using Jade but it should be the same as Html5): input(type='file', name='videoFile') In the browser this shows a button with a text next to it "No fi..

Cross origin requests are only supported for HTTP but it's not cross-domain

I'm using this code to make an AJAX request: $("#userBarSignup").click(function(){ $.get("C:/xampp/htdocs/webname/resources/templates/signup.php", {/*params*/}, function(response)..

"CASE" statement within "WHERE" clause in SQL Server 2008

I am working with a query which contains "CASE" statement within "WHERE" clause. But SQL Server 2008 is giving some errors while executing it. Can anyone please help me with the correct query? Here is..

#ifdef in C#

I would like to do the below but in C# instead of C++ #ifdef _DEBUG bool bypassCheck=TRUE_OR_FALSE;//i will decide depending on what i am debugging #else bool bypassCheck = false; //NEVER bypass it #..

Round button with text and icon in flutter

how to have a button with text and icon for the flutter? I wanted to have a button which looks like icon with a text that is able to put at the bottom of the screen For example, the icon is like at ..

True and False for && logic and || Logic table

Table true/false for C Language I have heard of a table true false for C Language for and && or || is kind of the mathematics one for which they say if true+true=true and false+true=false I'm ..

How to use a parameter in ExecStart command line?

I try to convert a SysVintit script used on Debian (and derivatives distros such as LinuxMint and Ubuntu & Co.) to a systemd service to be used on Fedora or ArchLinux (and derivative distros such ..

Is it possible to run JavaFX applications on iOS, Android or Windows Phone 8?

Can one develop an entire application using JavaFX and run it on iOS, Android or Windows Phone 8, without writing platform-specific code?..

Accessing Object Memory Address

When you call the object.__repr__() method in Python you get something like this back: <__main__.Test object at 0x2aba1c0cf890> Is there any way to get a hold of the memory address if you..

How to give Jenkins more heap space when it´s started as a service under Windows?

I want to increase the available heap space for Jenkins. But as it is installed as a service I don´t know how to do it...

Making the main scrollbar always visible

What CSS is required to make the browser's vertical scrollbar remain visible when a user visits a web page (when the page hasn't enough content to trigger the scrollbar's activation)?..

What is the best java image processing library/approach?

I am using both the JAI media apis and ImageMagick? ImageMagick has some scalability issues and the JNI based JMagick isn't attractive either. JAI has poor quality results when doing resizing operati..

Cannot implicitly convert type from Task<>

I am trying to master async method syntax in .NET 4.5. I thought I had understood the examples exactly however no matter what the type of the async method is (ie Task<T>), I always get the same..

How to install JSTL? The absolute uri: cannot be resolved

I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception: org.apache.jasper.JasperException: The absolute uri:

How to replace a char in string with an Empty character in C#.NET

I have a string like this: string val = "123-12-1234"; How can I replace the dashes using an empty string in C#. I mean val.Replace(char oldChar, newChar); What needs to go in oldChar and newChar..

Do I need to pass the full path of a file in another directory to open()?

I have a folder with ten files in it which I want to loop through. When I print out the name of the file my code works fine: import os indir = '/home/des/test' for root, dirs, filenames in os.walk(in..

How do I center a Bootstrap div with a 'spanX' class?

I use bootstrap and am trying to center a div(span7) like that: <div class="row-fluid"> <div id="main" class="span7"> Lorem ipsum dolor sit amet </div> </div> ..

In Java, how can I determine if a char array contains a particular character?

Here's what I have: char[] charArray = new char[] {'h','e','l','l','o'}; I want to write something to the effect of: if(!charArray contains 'q'){ break; } I realize that .contains() can't b..

Drop all duplicate rows across multiple columns in Python Pandas

The pandas drop_duplicates function is great for "uniquifying" a dataframe. However, one of the keyword arguments to pass is take_last=True or take_last=False, while I would like to drop all rows whic..

ValueError: math domain error

I was just testing an example from Numerical Methods in Engineering with Python. from numpy import zeros, array from math import sin, log from newtonRaphson2 import * def f(x): f = zeros(len(x))..

What are some great online database modeling tools?

What's your favorite open source database design/modeling tool? I'm looking for one that supports several databases, especially Firebird SQL but I can't find one on Google...

How to execute a stored procedure within C# program

I want to execute this stored procedure from a C# program. I have written the following stored procedure in a SqlServer query window and saved it as stored1: use master go create procedure dbo.tes..

How to set portrait and landscape media queries in css?

Here is my media query: @media screen and (min-device-width: 768px) and (max-device-width: 1824px) and (orientation : portrait){ .hidden-desktop { display: inherit !important; } .visible-de..

What's the source of Error: getaddrinfo EAI_AGAIN?

My server threw this today, which is a Node.js error I've never seen before: Error: getaddrinfo EAI_AGAIN at Object.exports._errnoException (util.js:870:11) at errn..

PostgreSQL function for last inserted ID

In PostgreSQL, how do I get the last id inserted into a table? In MS SQL there is SCOPE_IDENTITY(). Please do not advise me to use something like this: select max(id) from table ..

Remove multiple whitespaces

I'm getting $row['message'] from a MySQL database and I need to remove all whitespace like \n \t and so on. $row['message'] = "This is a Text \n and so on \t Text text."; should be formatted ..

What is the problem with shadowing names defined in outer scopes?

I just switched to PyCharm and I am very happy about all the warnings and hints it provides me to improve my code. Except for this one which I don't understand: This inspection detects shadowing name..

What is the HTML unicode character for a "tall" right chevron?

I am looking for a unicode right chevron character, with no handle on the left, and I would like the top point and bottom point to be spread far apart. Similar to Ubuntu's (website) arrow in the searc..

How can I tell if a VARCHAR variable contains a substring?

I thought it was CONTAINS, but that's not working for me. I'm looking to do this: IF CONTAINS(@stringVar, 'thisstring') ... I have to run one select or another, depending on whether that varia..

Windows recursive grep command-line

I need to do a recursive grep in Windows, something like this in Unix/Linux: grep -i 'string' `find . -print` or the more-preferred method: find . -print | xargs grep -i 'string' I'm stuck with ..

Class vs. static method in JavaScript

I know this will work: function Foo() {}; = function () { alert('hello~\n'); }; var a = new Foo;; // 'hello~\n' But if I want to call // this will not w..

Check if a string is a valid date using DateTime.TryParse

I am using DateTime.TryParse() function to check if a particular string is a valid datetime not depending on any cultures. To my surprise , the function returns true for even strings like "1-1", "1/1..

MVC Redirect to View from jQuery with parameters

I have seen some posts relating to this but can't seem to get it to work. With the redirect I get a 'resource cannot be found error'. I am trying to redirect to a Details page. There is an ID in ele..

How do I speed up the gwt compiler?

We're starting to make heavier use of GWT in our projects, and the performance of the GWT compiler is becoming increasingly annoying. We're going to start altering our working practices to mitigate ..

Finding the source code for built-in Python functions?

Is there a way to see how built in functions work in python? I don't mean just how to use them, but also how were they built, what is the code behind sorted or enumerate etc...?..

How to exclude property from Json Serialization

I have a DTO class which I Serialize Json.Serialize(MyClass) How can I exclude a public property of it? (It has to be public, as I use it in my code somewhere else)..

Python Flask, how to set content type

I am using Flask and I return an XML file from a get request. How do I set the content type to xml ? e.g. @app.route('/ajax_ddl') def ajax_ddl(): xml = 'foo' header("Content-type: text/xml")..

Rebase array keys after unsetting elements

I have an array: $array = array(1,2,3,4,5); If I were to dump the contents of the array they would look like this: array(5) { [0] => int(1) [1] => int(2) [2] => int(3) [3] => i..

How to use the "required" attribute with a "radio" input field

I am just wondering how to use the new HTML5 input attribute "required" in the right way on radio buttons. Does every radio button field need the attribute like below or is it sufficient if only one f..

How to make a section of an image a clickable link

I have a banner on web page, and part of the image there is a graphic of a button box. How do I make just the part where the button is a clickable link such as a href? You can see a sample image below..

Splitting String and put it on int array

I have to input a string with numbers ex: 1,2,3,4,5. That's a sample of the input, then I have to put that in an array of INT so I can sort it but is not working the way it should work. package array..

Returning a boolean value in a JavaScript function

I am doing a client side form validation to check if passwords match. But the validation function always returns undefined. function validatePassword(errorMessage) { var password = document.getEle..

Get data from php array - AJAX - jQuery

I have a page as below; <head> <script type="text/javascript" src="jquery-1.6.1.js"></script> <script type="text/javascript"> $(document).ready( function() { $('#prev').click(..

How to put a symbol above another in LaTeX?

How to put a symbol above (on the head of) another? For example, I want to produce something like this in one line. a # i.e., a above #. The effect should be almost the same with $#^a$ except th..

Getting visitors country from their IP

I want to get visitors country via their IP... Right now I'm using this ( ) Here is my code: <?php if (isset($_SERVER['HTTP_CLIENT_IP'])) { $real_..

Why did I get the compile error "Use of unassigned local variable"?

My code is the following int tmpCnt; if (name == "Dude") tmpCnt++; Why is there an error "Use of unassigned local variable tmpCnt"? I know I didn't explicitly initialize ..

Calculate last day of month in JavaScript

If you provide 0 as the dayValue in Date.setFullYear you get the last day of the previous month: d = new Date(); d.setFullYear(2008, 11, 0); // Sun Nov 30 2008 There is reference to this behaviour..

Git: How to update/checkout a single file from remote origin master?

The scenario: I make some changes in a single file locally and run git add, git commit and git push The file is pushed to the remote origin master repository I have another local repository that is ..

Copy Files from Remote RDP to Local Machine

Is there a way I can launch a RDP session to a remote Windows server, and perform a file transfer to the local computer? Versions of the remote Windows Server varies. Ranges anywhere from 2000 to 2008..

VBA collection: list of keys

After I add some values to the VBA collection, is there any way to retain the list of all keys? For example Dim coll as new Collection Dim str1, str2, str3 str1="first string" str2="second string" ..

How do I extract part of a string in t-sql

If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it? Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part?..

How to do a subquery in LINQ?

Here's an example of the query I'm trying to convert to LINQ: SELECT * FROM Users WHERE Users.lastname LIKE '%fra%' AND Users.Id IN ( SELECT UserId FROM CompanyRolesToUsers ..

jquery select option click handler

given: <select id="mySelect"> <option>..</option> ... </select> Using the select id, how can I trigger a click event on one of the options? I tried attaching the event d..

HTML embed autoplay="false", but still plays automatically

On the front page of this website, there is a sticky post titled "National Radio Advertising Campaign ForACURE" which contains the following HTML: <embed type="audio/x-wav" src="http://www.foracur..

How can I change eclipse's Internal Browser from IE to Firefox on Windows XP?

How can I change eclipse's Internal Browser from IE to Firefox on Windows XP? To be more specific I need to change the Internal Browser instead of adding the External Browser through Preferences -> G..

What does "static" mean in C?

I've seen the word static used in different places in C code; is this like a static function/class in C# (where the implementation is shared across objects)? ..

How do I disable a href link in JavaScript?

I have a tag <a href="#"> Previous </a> 1 2 3 4 <a href="#"> Next </a> and in some conditions I want this tag to be completely disabled. Code from comments (this is how the li..

VBA Public Array : how to?

So today's problem is getting me mad because that should be easy and i can not find the answer : How to declare a public array in VBA ? I'm using an array with the letters A, B, C,... because i'm wor..

ngFor with index as value in attribute

I have a simple ngFor loop which also keeps track of the current index. I want to store that index value in an attribute so I can print it. But I can't figure out how this works. I basically have thi..

How to declare std::unique_ptr and what is the use of it?

I try to understand how std::unique_ptr works and for that I found this document. The author starts from the following example: #include <utility> //declarations of unique_ptr using std::unique..

converting drawable resource image into bitmap

I am trying to use the Notification.Builder.setLargeIcon(bitmap) that takes a bitmap image. I have the image I want to use in my drawable folder so how do I convert that to bitmap?..

How to convert current date to epoch timestamp?

How to convert current date to epoch timestamp ? Format current date: 29.08.2011 11:05:02 ..

How to build a Horizontal ListView with RecyclerView?

I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android? howeve..

Ant error when trying to build file, can't find tools.jar?

When I run ant it says: Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar Buildfile: build.xml does not exist! Build failed What package can I use to downl..

Configuring Log4j Loggers Programmatically

I am trying to use SLF4J (with log4j binding) for the first time. I would like to configure 3 different named Loggers that can be returned by a LoggerFactory which will log different levels and push ..

Error: EPERM: operation not permitted, unlink 'D:\Sources\**\node_modules\fsevents\node_modules\abbrev\package.json'

I just updated npm to 5.4.0. Now, Whenever I want install a npm package I get the following error: D:\Sources\DownloadCms\Md.Download\Web.Angular>npm install mds.angular.datetimepicker@latest --sa..

link_to method and click event in Rails

How do I create a link of this type: <a href="#" onclick="document.getElementById('search').value=this.value"> using method link_to in Rails? I couldn't figure it out from Rails docs...

Validate fields after user has left a field

With AngularJS, I can use ng-pristine or ng-dirty to detect if the user has entered the field. However, I want to do client-side validation only after the user has left the field area. This is because..

How to prevent text in a table cell from wrapping

Does anyone know how I can prevent the text in a table cell from wrapping? This is for the header of a table, and the heading is a lot longer than the data under it, but I need it to display on only ..

Flask example with POST

Suppose the following route which accesses an xml file to replace the text of a specific tag with a given xpath (?key=): @app.route('/resource', methods = ['POST']) def update_text(): # CODE Th..

Change Oracle port from port 8080

How do I change Oracle from port 8080? My Eclipse is using 8080, so I can't use that...

Extract Month and Year From Date in R

I have tried a number of methods to no avail. I have data in terms of a date (YYYY-MM-DD) and am trying to get in terms of just the month and year, such as: MM-YYYY or YYYY-MM. Ultimately, I would li..

How to get substring from string in c#?

I have a large string and its stored in a string variable str. And i want to get a substring from that in c#? Suppose the string is : " Retrieves a substring from this instance. The substring starts a..

What does the return keyword do in a void method in Java?

I'm looking at a path finding tutorial and I noticed a return statement inside a void method (class PathTest, line 126): if ((x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= ma..

Can I redirect the stdout in python into some sort of string buffer?

I'm using python's ftplib to write a small FTP client, but some of the functions in the package don't return string output, but print to stdout. I want to redirect stdout to an object which I'll be ab..

Tooltip on image

I am using the tooltip. But I want that on image tag, like when I mouseover the image then the tooltip should work. I have tried but not working for me on image tag...

How to convert existing non-empty directory into a Git working directory and push files to a remote repository

I have a non-empty directory (eg /etc/something) with files that cannot be renamed, moved, or deleted. I want to check this directory into git in place. I want to be able to push the state of this re..

Explanation of the UML arrows

I have recently been studying UML and drawing simple diagrams with ordinary plain arrows between classes, but I know it's not enough. There are plenty of other arrows: generalization, realisation and ..

IIS7 Settings File Locations

Where does IIS7 saves its configuration for each virtual directory/ application and its physical path? Is it an XML file? And if so, will editing this XML file affect the IIS configuration (after re..

How to select min and max values of a column in a datatable?

For the following datatable column, what is the fastest way to get the min and max values? AccountLevel 0 1 2 3 ..

How to create custom spinner like border around the spinner with down triangle on the right side?

I want to develop custom spinner like line around spinner with triangle at right bottom corner. like following image For above fig I wrote my custom spinner like a spinner.xml <Spinner androi..

How to color System.out.println output?

How can I color Java output? For example in C and other languages I can use ANSI-escape like \033[0m to do this. But in Java it doesn't work. public static void main(String[] x) {

Make a dictionary in Python from input values

Seems simple, yet elusive, want to build a dict from input of [key,value] pairs separated by a space using just one Python statement. This is what I have so far: d={} n = 3 d = [ map(str,raw_input()..

Change One Cell's Data in mysql

How can I change the data in only one cell of a mysql table. I have problem with UPDATE because it makes all the parameters in a column change but I want only one changed. How?..


How to perform left outer join in C# LINQ to objects without using join-on-equals-into clauses? Is there any way to do that with where clause? Correct problem: For inner join is easy and I have a solu..

What does the ^ (XOR) operator do?

What mathematical operation does XOR perform?..

Output single character in C

When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?..

Change collations of all columns of all tables in SQL Server

I imported a database with some data to compare with another database. The target database has collation Latin1_General_CI_AS and the source database has SQL_Latin1_General_CP1_CI_AS. I did change the..

How to check if a string contains text from an array of substrings in JavaScript?

Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array...

Easiest way to toggle 2 classes in jQuery

If I have class .A and class .B and want to switch in between on button click, what's a nice solution for that in jQuery? I still don't understand how toggleClass() works. Is there an inline solution..

Set HTML dropdown selected option using JSTL

In the same context i have another query <select multiple="multiple" name="prodSKUs"> <c:forEach items="${productSubCategoryList}" var="productSubCategoryList"> <..

How to disable a particular checkstyle rule for a particular line of code?

I have a checkstyle validation rule configured in my project, that prohibits to define class methods with more than 3 input parameters. The rule works fine for my classes, but sometimes I have to exte..

How can I hide a TD tag using inline JavaScript or CSS?

How can I hide a <td> tag using JavaScript or inline CSS?..

Twitter Bootstrap alert message close and open again

I have a problem with alert messages. It is displayed normally, and I can close it when the user presses x (close), but when the user tries to display it again (for example, click on the button event)..

How do I show the value of a #define at compile-time?

I am trying to figure out what version of Boost my code thinks it's using. I want to do something like this: #error BOOST_VERSION but the preprocessor does not expand BOOST_VERSION. I know I could ..

Why is Node.js single threaded?

In PHP (or Java/ASP.NET/Ruby) based webservers every client request is instantiated on a new thread. But in Node.js all the clients run on the same thread (they can even share the same variables!) I u..

Select the first row by group

From a dataframe like this test <- data.frame('id'= rep(1:5,2), 'string'= LETTERS[1:10]) test <- test[order(test$id), ] rownames(test) <- 1:10 > test id string 1 1 A 2 1 ..

How to return a struct from a function in C++?

I've tried on a few different forums and can't seem to get a straight answer, how can I make this function return the struct? If I try 'return newStudent;' I get the error 'No suitable user-defined co..

Can dplyr join on multiple columns or composite key?

I realize that dplyr v3.0 allows you to join on different variables: left_join(x, y, by = c("a" = "b") will match x.a to y.b However, is it possible to join on a combination of variables or do I hav..

Python socket connection timeout

I have a socket that I want to timeout when connecting so that I can cancel the whole operation if it can't connect yet it also want to use the makefile for the socket which requires no timeout. Is ..

What values for checked and selected are false?

I think according to W3 spec, you're supposed to do <input type="checkbox" checked="checked" /> And selected="selected" But, most browsers will accept it you just write "CHECKED" and don'..

Java: How to convert String[] to List or Set

How to convert String[] (Array) to Collection, like ArrayList or HashSet?..

Android Studio gradle takes too long to build

My Android Studio project used to build faster but now it takes a long time to build. Any ideas what could be causing the delays? I have tried but no effect..

How do I install Composer on a shared hosting?

I have these things: the file ftp access cPanel Cron jobs on FreeBSD PHP, Perl, CGI-BIN, Python, Curl. How can I install Composer? (..

Node.js: How to read a stream into a buffer?

I wrote a pretty simple function that downloads an image from a given URL, resize it and upload to S3 (using 'gm' and 'knox'), I have no idea if I'm doing the reading of a stream to a buffer correctly..

How to set the environmental variable LD_LIBRARY_PATH in linux

I have first executed the command: export LD_LIBRARY_PATH=/usr/local/lib Then I have opened .bash_profile file: vi ~/.bash_profile. In this file, I put: LD_LIBRARY_PATH=/usr/local/lib export LD_LIBR..

Cross-Origin Request Headers(CORS) with PHP headers

I have a simple PHP script that I am attempting a cross-domain CORS request: <?php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *"); ... Yet I still get the er..

Pass props in Link react-router

I am using react with react-router. I am trying to pass property’s in a "Link" of react-router var React = require('react'); var Router = require('react-router'); var CreateIdeaView = require('./..

More elegant way of declaring multiple variables at the same time

To declare multiple variables at the "same time" I would do: a, b = True, False But if I had to declare much more variables, it turns less and less elegant: a, b, c, d, e, f, g, h, i, j = True, Tr..

Setting an int to Infinity in C++

I have an int a that needs to be equal to "infinity". This means that if int b = anyValue; a>b is always true. Is there any feature of C++ that could make this possible?..

Min/Max-value validators in mvc

Validation using attributes in mvc is really nice. I have been using the [Range(min, max)] validator this far for checking values, like e.g.: [Range(1, 10)] public int SomeNumber { get; set;..