Questions Tagged with #Javarebel

how to use sqltransaction in c#

I am using following code to execute two commands at once. I used sqltransaction to assure either all command get executed or rolled back.When I run my program without "transaction" it run properly bu..

Python: Binding Socket: "Address already in use"

I have a question regarding client socket on TCP/IP network. Let's say I use try: comSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) comSocket.setsockopt(socket.SOL_SOCKET, socket..

What's the difference between tilde(~) and caret(^) in package.json?

After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are the..

What is the difference between screenX/Y, clientX/Y and pageX/Y?

What is the difference between screenX/Y, clientX/Y and pageX/Y? Also for iPad Safari, are the calculations similar as on desktop—OR there is some difference because of viewport? It would be great..

HTML 5 Geo Location Prompt in Chrome

Just starting to get into HTML 5 and an testing out geo location...liking it so far. I am hitting a bit of a speed bump though...when I try to get my geo location, chrome automatically blocks the page..

Why does Java have transient fields?

Why does Java have transient fields?..

URL Encode a string in jQuery for an AJAX request

I'm implementing Google's Instant Search in my application. I'd like to fire off HTTP requests as the user types in the text input. The only problem I'm having is that when the user gets to a space in..

Subprocess check_output returned non-zero exit status 1

This is my python code: import subprocess subprocess.check_output("ls",shell=True,stderr=subprocess.STDOUT) import subprocess subprocess.check_output("yum",shell=True,stderr=subprocess.STDOUT) The..

jquery disable form submit on enter

I have the following javascript in my page which does not seem to be working. $('form').bind("keypress", function(e) { if (e.keyCode == 13) { e.preventDefault(); return false..

PostgreSQL: How to make "case-insensitive" query

Is there any way to write case-insensitive queries in PostgreSQL, E.g. I want that following 3 queries return same result. SELECT id FROM groups where name='administrator' SELECT id FROM groups wher..

Try/catch does not seem to have an effect

I am new to powershell, and I am trying to add error handling via try/catch statements, but they don't seem to actually be catching the error. This is powershell v2 CP3. $objComputer = $objResult.Pro..

MySQL: Check if the user exists and drop it

There’s not standard way to check if a MySQL user exists and based on that drop it. Are there any workarounds for this? Edit: I need a straight way to run this without throwing up an error e.g. ..

Maximum filename length in NTFS (Windows XP and Windows Vista)?

I'm designing a database table which will hold filenames of uploaded files. What is the maximum length of a filename in NTFS as used by Windows XP or Vista?..

Rails: select unique values from a column

I already have a working solution, but I would really like to know why this doesn't work: ratings = Model.select(:rating).uniq ratings.each { |r| puts r.rating } It selects, but don't print unique ..

How to check status of PostgreSQL server Mac OS X

How can I tell if my Postgresql server is running or not? I'm getting this message: [~/dev/working/sw] sudo bundle exec rake db:migrate rake aborted! could not connect to server: Connection refused..

How to implement swipe gestures for mobile devices?

I have an application made in AngularJS which has arrow key navigation to switch views. I want to implement this navigation using swipe for touch devices. I tried jGestures library but it doesn't go ..

Difference between web reference and service reference?

What is the difference between web reference and service reference in WCF? Which is preferable in WCF?..

Convert String (UTF-16) to UTF-8 in C#

I need to convert a string to UTF-8 in C#. I've already try many ways but none works as I wanted. I converted my string into a byte array and then to try to write it to an XML file (which encoding is ..

Escaping ampersand in URL

I am trying to send a GET message that contains strings with ampersands and can't figure how to escape the ampersand in the URL. Example: http://www.example.com?candy_name=M&M result => candy..

How to detect a textbox's content has changed

I want to detect whenever a textbox's content has changed. I can use the keyup method, but that will also detect keystrokes which do not generate letters, like the arrow keys. I thought of two methods..

UICollectionView Set number of columns

I just started learning about UICollectionViews. I'm wondering if anyone knows how to specify the number of columns in a collectionview. The default is set to 3 (iPhone/portrait). I've looked at the d..

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize

When building a Java 8 project with Maven: mvn clean package I get this message: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 How to..

How do I change the IntelliJ IDEA default JDK?

I use IntelliJ IDEA as my development environment, and Maven for dependency management. I frequently build my project structure (directories, poms, etc) outside of IDEA and then import the project in..

How to correctly use the extern keyword in C

My question is about when a function should be referenced with the extern keyword in C. I am failing to see when this should be used in practice. As I am writing a program all of the functions that ..

Maven project version inheritance - do I have to specify the parent version?

I have two projects: Parent project: A, Sub project: B A/pom.xml: <groupId>com.dummy.bla</groupId> <artifactId>parent</artifactId> <version>0.1-SNAPSHOT</version>..

List append() in for loop

In Python, trying to do the most basic append function to a list with a loop: Not sure what i am missing here: a=[] for i in range(5): a=a.append(i) a returns: 'NoneType' object has no attr..

What is pipe() function in Angular

Pipes are filters for transforming data (formats) in the template. I came across the pipe() function as below. What does this pipe() function exactly mean in this case? return this.http.get<Hero..

Full examples of using pySerial package

Can someone please show me a full python sample code that uses pyserial, i have the package and am wondering how to send the AT commands and read them back!..

MySQL equivalent of DECODE function in Oracle

I am trying to find an equivalent of DECODE function in MySQL. It works like this: Select Name, DECODE(Age, 13,'Thirteen',14,'Fourteen',15,'Fifteen',16,'Sixteen', 17,'Seventeen',18,'Eig..

laravel 5.3 new Auth::routes()

Recently I start to use laravel 5.3 to write a blog, but I have a question after run php artisan make:auth when I run this, it will generate routes in my web.php this is the code in it: Auth::route..

How do I get a substring of a string in Python?

Is there a way to substring a string in Python, to get a new string from the third character to the end of the string? Maybe like myString[2:end]? If leaving the second part means 'till the end', an..

Android refresh current activity

I want to program my android app to refresh its current activity on ButtonClick. I have one button on the top of the activity layout which will do the job. When I click on button the current activity ..

javax.naming.NoInitialContextException - Java

Here is my code: import javax.naming.InitialContext; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.QueueSender; import javax.jms.DeliveryMode; impor..

"Series objects are mutable and cannot be hashed" error

I am trying to get the following script to work. The input file consists of 3 columns: gene association type, gene name, and disease name. cols = ['Gene type', 'Gene name', 'Disorder name'] no_header..

Compiler error: "class, interface, or enum expected"

I have been troubleshooting this program for hours, trying several configurations, and have had no luck. It has been written in java, and has 33 errors (lowered from 50 before) Source Code: /*This p..

Deserialize JSON to ArrayList<POJO> using Jackson

I have a Java class MyPojo that I am interested in deserializing from JSON. I have configured a special MixIn class, MyPojoDeMixIn, to assist me with the deserialization. MyPojo has only int and Strin..

Tkinter understanding mainloop

Till now, I used to end my Tkinter programs with: tk.mainloop(), or nothing would show up! See example: from Tkinter import * import random import time tk = Tk() tk.title = "Game" tk.resiza..

Append lines to a file using a StreamWriter

I want to append lines to my file. I am using a StreamWriter: StreamWriter file2 = new StreamWriter(@"c:\file.txt"); file2.WriteLine(someString); file2.Close(); The output of my file should be seve..

What is a predicate in c#?

I am very new to using predicates and just learned how to write: Predicate<int> pre = delegate(int a){ a %2 == 0 }; What will the predicate return, and how is it useful when programming?..

On design patterns: When should I use the singleton?

The glorified global variable - becomes a gloried global class. Some say breaking object-oriented design. Give me scenarios, other than the good old logger where it makes sense to use the singleton...

NULL values inside NOT IN clause

This issue came up when I got different records counts for what I thought were identical queries one using a not in where constraint and the other a left join. The table in the not in constraint had o..

How to delete/unset the properties of a javascript object?

Possible Duplicates: How to unset a Javascript variable? How to remove a property from a javascript object I'm looking for a way to remove/unset the properties of a JS object so they'll n..

How do I check if a list is empty?

For example, if passed the following: a = [] How do I check to see if a is empty?..

Scanner vs. StringTokenizer vs. String.Split

I just learned about Java's Scanner class and now I'm wondering how it compares/competes with the StringTokenizer and String.Split. I know that the StringTokenizer and String.Split only work on String..

comparing two strings in ruby

I've just started to learn ruby and this is probably very easy to solve. How do I compare two strings in Ruby? I've tried the following : puts var1 == var2 //false, should be true (I think) puts var..

VB.NET Switch Statement GoTo Case

I am writing some code in VB.NET that uses a switch statement but in one of the cases it needs to jump to another block. In C# it would look like this: switch (parameter) { case "userID": ..

Bootstrap - How to add a logo to navbar class?

I would like to add a logo to the top navbar within the navbar-brand. I would like it to scale with the viewport size so I'm using img-responsive2 class. It appear that both the image and the text in..

PHP Session timeout

I am creating a session when a user logs in like so: $_SESSION['id'] = $id; How can I specify a timeout on that session of X minutes and then have it perform a function or a page redirect once it h..

How to use BeanUtils.copyProperties?

I am trying to copy properties from one bean to another. Here are the signature of two beans: SearchContent: public class SearchContent implements Serializable { private static final long seria..

Merge 2 arrays of objects

Lets have a look at an example. var arr1 = new Array({name: "lang", value: "English"}, {name: "age", value: "18"}); var arr2 = new Array({..

webpack: Module not found: Error: Can't resolve (with relative path)

I have this structure of an app (node_modules dir excluded from this list): +-- actions.js +-- bundle.js +-- components ¦   +-- App.js ¦   +-- Footer.js ¦   +-- Link.js ¦   +-- Todo.js ¦..

How to add hours to current time in python

I am able to get the current time as below: from datetime import datetime str(datetime.now())[11:19] Result '19:43:20' Now, i am trying to add 9 hours to the above time, how can I add hours t..

Create dataframe from a matrix

How to get a data frame with the same data as an already existing matrix has? A simplified example of my matrix: mat <- matrix(c(0, 0.5, 1, 0.1, 0.2, 0.3, 0.3, 0.4, 0.5), ncol = 3, ..

How to get current route in Symfony 2?

How do I get the current route in Symfony 2? For example, routing.yml: somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" } How can I get this somePage value?..

Disable click outside of angular material dialog area to close the dialog (With Angular Version 4.0+)

I am currently working on password reset page of an Angular 4 project. We are using Angular Material to create the dialog, however, when the client clicks out of the dialog, it will close automaticall..

How to validate a credit card number

I just want to validate a credit card number in the JavaScript code. I have used a regular expression for digit numbers, but I don't know why it is not working! Here is my function as per below: fun..

What are .NET Assemblies?

What are .NET Assemblies? I browsed over the net and I am not able to understand the definition...

How to print variable addresses in C?

When i run this code. #include <stdio.h> void moo(int a, int *b); int main() { int x; int *y; x = 1; y = &x; printf("Address of x = %d, value of x = %d\n", &x, ..

php string to int

$a = '88'; $b = '88 8888'; echo (int)$a; echo (int)$b; as expected, both produce 88. Anyone know if there's a string to int function that will work for $b's value and produce 888888? I've googled a..

Alternative for <blink>

The <blink> tag was never an official standard, and is now completely abandoned by all browsers. Is there a standards compliant way of making text blink?..

How to consume REST in Java

Using Java tools, wscompile for RPC wsimport for Document etc.. I can use WSDL to generate the stub and Classes required to hit the SOAP Web Service. But I have no idea how I can do the same in RE..

How to use a link to call JavaScript?

How to use a link to call JavaScript code?..

How to get selected value from Dropdown list in JavaScript

How can you get the selected value from drop down list using JavaScript? I have tried the following but it does not work. var sel = document.getElementById('select1'); var sv = sel.options[sel.select..

How to play video with AVPlayerViewController (AVKit) in Swift

How do you play a video with AV Kit Player View Controller in Swift? override func viewDidLoad() { super.viewDidLoad() let videoURLWithPath = "http://****/5.m3u8" let videoURL..

Validating IPv4 addresses with regexp

I've been trying to get an efficient regex for IPv4 validation, but without much luck. It seemed at one point I had had it with (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?(\.|$)){4}, but it produces some st..

Markdown and image alignment

I am making a site that publishes articles in issues each month. It is straightforward, and I think using a Markdown editor (like the WMD one here in Stack Overflow) would be perfect. However, t..

How to configure log4j to only keep log files for the last seven days?

I have the following logging problem with several Java applications using log4j for logging: I want log files to be rotated daily, like log.2010-09-10 log.2010-09-09 log.2010-09-08 log.2010-09-07 lo..

Uninstall / remove a Homebrew package including all its dependencies

I have a Homebrew formula that I wish to uninstall/remove along with all its dependencies, skipping packages whom other packages depend upon (a.k.a. Cascading package removal in Package manager parlan..

Calculate correlation with cor(), only for numerical columns

I have a dataframe and would like to calculate the correlation (with Spearman, data is categorical and ranked) but only for a subset of columns. I tried with all, but R's cor() function only accepts n..

Adding CSRFToken to Ajax request

I need to pass CSRFToken with Ajax based post request but not sure how this can done in a best way. Using a platform which internally checking CSRFToken in request (POST request only) initially I was..

Clear git local cache

I have a Webstorm project that I was about to commit, but before pressing the commit button in the Git Windows GUI, I remembered that I don't want to commit my .idea folder content. So I used the we..

how to create a window with two buttons that will open a new window

I need program - main JFrame have 2 buttons button button2 When I click button it has to open new JFrame window with new options, while if I click button2 then open another window. In these 2 ne..

WPF Image Dynamically changing Image source during runtime

I have a window with a title on it. When the user selects a choice from a drop down list, the title image can change. The problem is when the image loads, it's a blurred, stretched, and pixelated. The..

What is the purpose of mvnw and mvnw.cmd files?

When I created a Spring Boot application I could see mvnw and mvnw.cmd files in the root of the project. What is the purpose of these two files?..

Compiler warning - suggest parentheses around assignment used as truth value

When I try to compile the piece of code below, I get this warning: warning: suggest parentheses around assignment used as truth value Why does this happen? This is a rather common idiom, I believe. ..

How to copy a string of std::string type in C++?

I used the strcpy() function and it only works if I use C-string arrays like: char a[6] = "text"; char b[6] = "image"; strcpy(a,b); but whenever I use string a = "text";..

Rounding to two decimal places in Python 2.7?

Using Python 2.7 how do I round my numbers to two decimal places rather than the 10 or so it gives? print "financial return of outcome 1 =","$"+str(out1) ..

How to show one layout on top of the other programmatically in my case?

My main layout main.xml simply contains two LinearLayouts: The 1st LinearLayout hosts a VideoView and a Button, The 2nd LinearLayout hosts an EditText, and this LinearLayout has set the visibility v..

How do I make XAML DataGridColumns fill the entire DataGrid?

I am using DataGrids in XAML (not Silverlight) with resizable columns, the DataGrid will expand if the user resizes the screen. Currently if the widths of all the DataGrid columns are less than the w..

Swift: Display HTML data in a label or textView

I have some HTML data, which contains headings, paragraphs , images and lists tags. Is there a way to display this data in one UITextView or UILabel?..

How to check if all elements of a list matches a condition?

I have a list consisting of like 20000 lists. I use each list's 3rd element as a flag. I want to do some operations on this list as long as at least one element's flag is 0, it's like: my_list = [["a..

LINQ query on a DataTable

I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example: var results = from myRow in myDataT..

ASP.NET MVC controller actions that return JSON or partial html

I am trying to create controller actions which will return either JSON or partial html depending upon a parameter. What is the best way to get the result returned to an MVC page asynchronously?..

How to retrieve Key Alias and Key Password for signed APK in android studio(migrated from Eclipse)

I have an android app currently published in Google Play which I update periodically. I follow the following process to sign the app before a new push: Press right-mouse on the project, the 'Android..

ImportError: No module named Crypto.Cipher

When I try to run app.py (Python 3.3, PyCrypto 2.6) my virtualenv keeps returning the error listed above. My import statement is just from Crypto.Cipher import AES. I looked for duplicates and you mig..

Android studio - Failed to find target android-18

I have a problem with Android Studio 0.2.3. When I run my project the build stops and appears message that says: Gradle: Execution failed for task ':AppName:compileDebugAidl'. > failed to find ..

Pass variables to Ruby script via command line

I've installed RubyInstaller on Windows and I'm running IMAP Sync but I need to use it to sync hundreds of accounts. If I could pass these variables to it via command line I could automate the whole p..

Getting the value of an attribute in XML

How would one get the value of attribute1 (blah) in the following xml using xslt: <name attribute1="blah" attribute2="blahblah"> </name> ..

Why does a base64 encoded string have an = sign at the end

I know what base64 encoding is and how to calculate base64 encoding in C#, however I have seen several times that when I convert a string into base64, there is an = at the end. A few questions came u..

Does JavaScript pass by reference?

Does JavaScript pass by references or pass by values? Here is an example from JavaScript: The Good Parts. I am very confused about the my parameter for the rectangle function. It is actually undefined..

Update int column in table with unique incrementing values

I am trying to populate any rows missing a value in their InterfaceID (INT) column with a unique value per row. I'm trying to do this query: UPDATE prices SET interfaceID = (SELECT ISNULL(MAX(interf..

python catch exception and continue try block

Can I return to executing try-block after exception occurs? (The goal is to write less) For Example: try: do_smth1() except: pass try: do_smth2() except: pass vs try: do_smth1..

Command to get time in milliseconds

Is there a shell command in Linux to get the time in milliseconds?..

Why is Java's SimpleDateFormat not thread-safe?

Please tell with a code example why is SimpleDateFormat not threadsafe. What is the problem in this class? Is The problem with format function of SimpleDateFormat? Please give a code which demonstra..

How do I wrap text in a pre tag?

pre tags are super-useful for code blocks in HTML and for debugging output while writing scripts, but how do I make the text word-wrap instead of printing out one long line?..

How do I migrate an SVN repository with history to a new Git repository?

I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like: SVN repository in: svn://myserver/path/to/svn/repos G..

In C++ check if std::vector<string> contains a certain value

Is there any built in function which tells me that my vector contains a certain element or not e.g. std::vector<string> v; v.push_back("abc"); v.push_back("xyz"); if (v.contains("abc")) // I a..

Automatically plot different colored lines

I'm trying to plot several kernel density estimations on the same graph, and I want them to all be different colors. I have a kludged solution using a string 'rgbcmyk' and stepping through it for each..

how to auto select an input field and the text in it on page load

Upon page load I want to move the cursor to a particular field. No problem. But I also need to select and highlight the default value that is placed in that text field...

Technically what is the main difference between Oracle JDK and OpenJDK?

I have been using OpenJDK for ages, initially for small projects where it has no problems. But since I started to play with it for big toys, I started to notice random/unknown fatal error and crashes ..

Simplest SOAP example

What is the simplest SOAP example using Javascript? To be as useful as possible, the answer should: Be functional (in other words actually work) Send at least one parameter that can be set elsewher..

Open files in 'rt' and 'wt' modes

Several times here on SO I've seen people using rt and wt modes for reading and writing files. For example: with open('input.txt', 'rt') as input_file: with open('output.txt', 'wt') as output_f..

Should Jquery code go in header or footer?

Where is the best place to put Jquery code (or separate Jquery file)? Will pages load faster if I put it in the footer?..

Creating and playing a sound in swift

So what I want to do is create and play a sound in swift that will play when I press a button, I know how to do it in Objective-C, but does anyone know how to in Swift? It would be like this for Obje..

TypeError: a bytes-like object is required, not 'str'

The following is the code that tries to modify the input supplied by a user by using sockets: from socket import * serverName = '127.0.0.1' serverPort = 12000 clientSocket = socket(AF_INET, SOCK_DGR..

Dilemma: when to use Fragments vs Activities:

I know that Activities are designed to represent a single screen of my application, while Fragments are designed to be reusable UI layouts with logic embedded inside of them. Until not long ago, I dev..

Set a button background image iPhone programmatically

In Xcode, how do you set the background of a UIButton as an image? Or, how can you set a background gradient in the UIButton?..

Serialize JavaScript object into JSON string

I have this JavaScript prototype: Utils.MyClass1 = function(id, member) { this.id = id; this.member = member; } and I create a new object: var myobject = new MyClass1("5678999", "text"); If I do..

DNS caching in linux

I am confused about DNS caching. I am writing a small forward proxy server and want to use OS DNS cache on a Linux system. If I understand correctly, then there is DNS caching at the browser level. T..

How to create an empty R vector to add new items

I want to use R in Python, as provided by the module Rpy2. I notice that R has very convenient [] operations by which you can extract the specific columns or lines. How could I achieve such a function..

how to implement regions/code collapse in javascript

How can you implement regions a.k.a. code collapse for JavaScript in Visual Studio? If there are hundreds of lines in javascript, it'll be more understandable using code folding with regions as in vb..

How to get the indexpath.row when an element is activated?

I have a tableview with buttons and I want to use the indexpath.row when one of them is tapped. This is what I currently have, but it always is 0 var point = Int() func buttonPressed(sender: AnyObjec..

What is [Serializable] and when should I use it?

I found out that some classes use the [Serializable] attribute. What is it? When should I use it? What kinds of benefits will I get? ..

bootstrap jquery show.bs.modal event won't fire

i'm using the modal example from the bootstrap 3 docs. the modal works. however i need to access the show.bs.modal event when it fires. for now i'm just trying: $('#myModal').on('show.bs.modal', fun..

Running multiple commands in one line in shell

Say I have a file /templates/apple and I want to put it in two different places and then remove the original. So, /templates/apple will be copied to /templates/used AND /templates/inuse and then a..

Git Clone - Repository not found

git clone <url> gives the message fatal: repository 'url' not found I tried the options in the link, but it didn't work. ..

What does MissingManifestResourceException mean and how to fix it?

The situation: I have a class library, called RT.Servers, containing a few resources (of type byte[], but I don't think that's important) The same class library contains a method which returns one o..

How do you launch the JavaScript debugger in Google Chrome?

When using Google Chrome, I want to debug some JavaScript code. How can I do that?..

How to use random in BATCH script?

How to use random in BATCH script?..

How to correctly catch change/focusOut event on text input in React.js?

I've got a form, in which I want to handle change event on text inputs, but React onChange triggering on key down (opposite to native JS, that triggers change event when an input field is out of focus..

How do I get a file's directory using the File object?

Consider the code: File file = new File("c:\\temp\\java\\testfile"); testfile is a file, and it may or may not exist. I want to get the directory c:\\temp\\java\\ using the File object. How do I g..

How to putAll on Java hashMap contents of one to another, but not replace existing keys and values?

I need to copy all keys and values from one A HashMap onto another one B, but not to replace existing keys and values. Whats the best way to do that? I was thinking instead iterating the keySet and ..

Unable to capture screenshot. Prevented by security policy. Galaxy S6. Android 6.0

Does someone know how to turn off this screen? Also phone has a message (Toast) when trying to make a screenshot: Unable to capture screenshot. Prevented by security policy . One of recomme..

Sorting table rows according to table header column using javascript or jquery

I have something like this <table> <thead> <tr> <th>S.L.</th> <th>name</th> </tr> </thead> &l..

How to get diff between all files inside 2 folders that are on the web?

So I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/...

How to get box-shadow on left & right sides only

Any way to get box-shadow on left & right (horizontal?) sides only with no hacks or images. I am using: box-shadow: 0 0 15px 5px rgba(31, 73, 125, 0.8); But it gives shadow all around. I have ..

regex to remove all text before a character

Is there an easy way to remove all chars before a "_"? For example, change 3.04_somename.jpg to somename.jpg. Any suggestions for where to learn to write regex would be great too. Most places I check..

Getting value from JQUERY datepicker

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

Can grep show only words that match search pattern?

Is there a way to make grep output "words" from files that match the search expression? If I want to find all the instances of, say, "th" in a number of files, I can do: grep "th" * but the output..

Is it possible to interactively delete matching search pattern in Vim?

There is a phrase that I want to look for in Vim. When found, I want to delete that occurrence of the phrase. What is the easiest way to cycle through all the occurrences (via n), and delete a match..

How do you add an in-app purchase to an iOS application?

How do you add an in-app purchase to an iOS app? What are all the details and is there any sample code? This is meant to be a catch-all of sorts for how to add in-app purchases to iOS apps..

Create a zip file and download it

I am trying to download a 2 files by creating the zip file on local-server.the file is downloaded in zip format but when i try to extract it.it gives error: End-of-central-directory signature not fou..

Python object deleting itself

Why won't this work? I'm trying to make an instance of a class delete itself. >>> class A(): def kill(self): del self >>> a = A() >>> a.kill() >>> a..

Could not load file or assembly Exception from HRESULT: 0x80131040

I created my first MVC 4 project and it works perfectly on local server. But when I publish it on to local folder and upload the folder contents to hosting server. I try to run it and I get this error..

Starting of Tomcat failed from Netbeans

I have problem with starting Apache Tomcat 6 from Netbeans IDE 7.4 (on 7.3 version I had the same troubles. Other people mentioned that this problem exist also in other versions, like 8.0 etc). What..

Eloquent get only one column as an array

How to get only one column as one dimentional array in laravel 5.2 using eloquent? I have tried: $array = Word_relation::select('word_two')->where('word_one', $word_id)->get()->toArray(); ..

Git error on commit after merge - fatal: cannot do a partial commit during a merge

I ran a git pull that ended in a conflict. I resolved the conflict and everything is fine now (I used mergetool also). When I commit the resolved file with git commit file.php -m "message" I get the..

NodeJS / Express: what is "app.use"?

In the docs for the NodeJS express module, the example code has app.use(...). What is the use function and where is it defined?..

Python unittest - opposite of assertRaises?

I want to write a test to establish that an Exception is not raised in a given circumstance. It's straightforward to test if an Exception is raised ... sInvalidPath=AlwaysSuppliesAnInvalidPath() se..

How can I center text (horizontally and vertically) inside a div block?

I have a div set to display:block (90px height and width), and I have some text inside. I need the text to be aligned in the center both vertically and horizontally. I have tried text-align:center, ..

Strings and character with printf

I was confused with usage of %c and %s in the following C program #include <stdio.h> void main() { char name[]="siva"; printf("%s\n",name); printf("%c\n..

SET NOCOUNT ON usage

Inspired by this question where there are differing views on SET NOCOUNT... Should we use SET NOCOUNT ON for SQL Server? If not, why not? What it does Edit 6, on 22 Jul 2011 It suppresses the "..

jQuery - How to dynamically add a validation rule

I'm trying to dynamically add a validation rule to some dynamic controls: $("input[id*=Hours]").rules("add", "required"); However this line gives me the following error: $.data(element.form, "vali..

Regex not operator

Is there an NOT operator in Regexes? Like in that string : "(2001) (asdf) (dasd1123_asd 21.01.2011 zqge)(dzqge) name (20019)" I want to delete all \([0-9a-zA-z _\.\-:]*\) but not the one where it is ..

How to select all elements with a particular ID in jQuery?

I'm trying to select all <div>s with the same ID in jQuery. How do i do it? I tried this and it did not work jQuery('#xx').each(function(ind,obj){ //do stuff; }); ..

Understanding the difference between Object.create() and new SomeFunction()

I recently stumbled upon the Object.create() method in JavaScript, and am trying to deduce how it is different from creating a new instance of an object with new SomeFunction(), and when you would wan..

EditText underline below text property

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

How to find the remainder of a division in C?

Which is the best way to find out whether the division of two numbers will return a remainder? Let us take for example, I have an array with values {3,5,7,8,9,17,19}. Now I need to find the perfect di..

Create an array or List of all dates between two dates

I am generating multi-series graphs with the date along the X-Axis. The problem is that not all of the series in the graph have the same dates in the date range. Meaning that if I choose 1 Feb thr..

How to consume a webApi from asp.net Web API to store result in database?

I'm wondering how to consume a WEBAPI from another ASP.Net Web API to store the response in a database. I know how to consume a WEBAPI from clients like javascript,console application etc. But the re..

How to tell if a connection is dead in python

I want my python application to be able to tell when the socket on the other side has been dropped. Is there a method for this?..

How to change text transparency in HTML/CSS?

I'm very new to HTML/CSS and I'm trying to display some text as like 50% transparent. So far I have the HTML to display the text with full opacity <html><font color=\"black\" face=\"arial\"..

JavaScript closures vs. anonymous functions

A friend of mine and I are currently discussing what is a closure in JS and what isn't. We just want to make sure we really understand it correctly. Let's take this example. We have a counting loop a..

how to hide the content of the div in css

I have this html code <div id="mybox"> aaaaaaa </div> and this is my css #mybox{ background-color:green; } #mybox:hover{ background-color:red; } the question is how to hide th..

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

Position of a string within a string using Linux shell script?

If I have the text in a shell variable, say $a: a="The cat sat on the mat" How can I search for "cat" and return 4 using a Linux shell script, or -1 if not found?..

Removing leading zeroes from a field in a SQL statement

I am working on a SQL query that reads from a SQLServer database to produce an extract file. One of the requirements to remove the leading zeroes from a particular field, which is a simple VARCHAR(10..

Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository

I am unable to clone a Git repository, and getting this error: krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://stage.abc.com:10088/pqr http://<url>/<repository> Cloning into '..

Reload an iframe with jQuery

I have two iframes on a page and one makes changes to the other but the other iframe doesn't show the change until I refresh. Is there an easy way to refresh this iframe with jQuery? <div class="p..

Laravel password validation rule

How to added password validation rule in the validator? Validation rule: The password contains characters from at least three of the following five categories: English uppercase characters (A – ..

Auto Increment after delete in MySQL

I have a MySQL table with a primary key field that has AUTO_INCREMENT on. After reading other posts on here I've noticed people with the same problem and with varied answers. Some recommend not using ..

How do you do block comments in YAML?

How do I comment a block of lines in YAML?..

Can I check if Bootstrap Modal Shown / Hidden?

Can I check if Bootstrap Modal currently Shown / Hidden Programatically? Like bool a = if("#myModal").shown(); ? I need true/false..

Select from table by knowing only date without time (ORACLE)

I'm trying to retrieve records from table by knowing the date in column contains date and time. Suppose I have table called t1 which contains only two column name and date respectively. The data sto..

Convert float64 column to int64 in Pandas

I tried to convert a column from data type float64 to int64 using: df['column name'].astype(int64) but got an error: NameError: name 'int64' is not defined The column has number of people but..

log4j logging hierarchy order

What is the hierarchy of log4j logging? DEBUG INFO WARN ERROR FATAL Which one provides the highest logging which would be helpful to troubleshoot issues? Can any one provide the order or hierarchy ..

What is the coolest thing you can do in <10 lines of simple code? Help me inspire beginners!

I'm looking for the coolest thing you can do in a few lines of simple code. I'm sure you can write a Mandelbrot set in Haskell in 15 lines but it's difficult to follow. My goal is to inspire studen..

What is time(NULL) in C?

I learning about some basic C functions and have encountered time(NULL) in some manuals. What exactly does this mean?..

How to wrap async function calls into a sync function in Node.js or Javascript?

Suppose you maintain a library that exposes a function getData. Your users call it to get actual data: var output = getData(); Under the hood data is saved in a file so you implemented getData using N..

How to hide iOS status bar

In my iOS video app status bar is hidden in some view controllers. I have done this using following code. [[UIApplication sharedApplication] setStatusBarHidden:YES]; It works for iOS 5 and iOS 6 ,..

How do I open multiple instances of Visual Studio Code?

Today Microsoft released the Visual Studio Code file/folder editor. The first limitation is it appears to be a single-instance application. Is there a way of getting multiple instances, or otherwise..

How to generate keyboard events?

short summary: I am trying to create a program that will send keyboard events to the computer that for all purposes the simulated events should be treated as actual keystrokes on the keyboard. origi..

Java Security: Illegal key size or default parameters?

I had asked a question about this earlier, but it didn't get answered right and led nowhere. So I've clarified few details on the problem and I would really like to hear your ideas on how could I fix..

Why java.security.NoSuchProviderException No such provider: BC?

The jar (bcprov-jdk16-145.jar) has been added to the project, Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()) has been added to the class, and BouncyCastleProvider.PROVI..

Can anyone explain what JSONP is, in layman terms?

I know JSONP is JSON with padding. I understand what JSON is, and how to use it with jQuery.getJSON(). However, I do not understand the concept of the callback when introducing JSONP. Can anyone ex..

How to change text color of cmd with windows batch script every 1 second

The color command has to do with changing color of windows command promt background/text color 0A - where 0 is the background color and A is the text color I want to change these color of text every..

How to make android listview scrollable?

I have two listviews, but they don't scroll. How do I correct this? Here is my layout.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/..

Making an API call in Python with an API that requires a bearer token

Looking for some help with integrating a JSON API call into a Python program. I am looking to integrate the following API into a Python .py program to allow it to be called and the response to be pri..

How do I select which GPU to run a job on?

In a multi-GPU computer, how do I designate which GPU a CUDA job should run on? As an example, when installing CUDA, I opted to install the NVIDIA_CUDA-<#.#>_Samples then ran several instance..

RestTemplate: How to send URL and query parameters together

I am trying to pass path param and query params in a URL but I am getting a weird error. below is the code String url = "http://test.com/Services/rest/{id}/Identifier" Map<String, String&g..

Markdown `native` text alignment

Does markdown support native text-alignment without usage html + css?..

Update MongoDB field using value of another field

In MongoDB, is it possible to update the value of a field using the value from another field? The equivalent SQL would be something like: UPDATE Person SET Name = FirstName + ' ' + LastName And th..

Change width of select tag in Twitter Bootstrap

How do I change the width of a select field, when using Twitter bootstrap? Adding input-xxlarge CSS classes doesn't seem to work (like it does on other form elements), so the elements in my drop down ..

Understanding events and event handlers in C#

I understand the purpose of events, especially within the context of creating user interfaces. I think this is the prototype for creating an event: public void EventName(object sender, EventArgs e); ..

Write bytes to file

I have a hexadecimal string (e.g 0CFE9E69271557822FE715A8B3E564BE) and I want to write it to a file as bytes. For example, Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 00000000 0C FE..

How do you set the max number of characters for an EditText in Android?

How do you set the max number of characters for an Android EditText input? I see setMaxLines, setMaxEMS, but nothing for the number of characters...

How to cat <<EOF >> a file containing code?

I want to print code into a file using cat <<EOF >>: cat <<EOF >> brightup.sh !/bin/bash curr=`cat /sys/class/backlight/intel_backlight/actual_brightness` if [ $curr -lt 4477 ..

How can I make Visual Studio wrap lines at 80 characters?

Is there any way to make Visual Studio word-wrap at 80 characters? I'm using VS2008. This post is loosely related...

How can I make sticky headers in RecyclerView? (Without external lib)

I want to fix my header views in the top of the screen like in the image below and without using external libraries. In my case, I don't want to do it alphabetically. I have two different types of ..

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 load url into div tag

I have a <div id="content"> want to load url: http://vnexpress.net content into my code: <html> <head> <script type="text/javascript"> $(document).rea..

Tkinter: How to use threads to preventing main event loop from "freezing"

I have a small GUI test with a "Start" button and a Progress bar. The desired behavior is: Click Start Progressbar oscillates for 5 seconds Progressbar stops The observed behavior is the "Start" b..

How to search for file names in Visual Studio?

In Eclipse you can search for a file in the project by pressing CTRL-SHIFT-R. Is there a way to do this in Visual Studio?..

Convert .class to .java

I have some .class files that I need to convert to .java so I did: javap -c ClassName.class and all the time I have the same error ERROR:Could not find ClassName.class Do you guys have any idea of w..

java: HashMap<String, int> not working

HashMap<String, int> doesn't seem to work but HashMap<String, Integer> does work. Any ideas why?..

How to use mysql JOIN without ON condition?

Is it possible to write join query without ON statement? and how do these joins differ LEFT JOIN, RIGHT JOIN works...

c# how to add byte to byte array

How to add a byte to the beginning of an existing byte array? My goal is to make array what's 3 bytes long to 4 bytes. So that's why I need to add 00 padding in the beginning of it...

Merging two images in C#/.NET

Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150. Basic idea is this: Create an empty canvas that is 500x500, position th..

ERROR 2006 (HY000): MySQL server has gone away

I get this error when I try to source a large SQL file (a big INSERT query). mysql> source file.sql ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection..

How using try catch for exception handling is best practice

while maintaining my colleague's code from even someone who claims to be a senior developer, I often see the following code: try { //do something } catch { //Do nothing } or sometimes they write ..