Questions Tagged with #Jsr75

JSR 75 is Java ME API - PDA Optional Packages for file connection and PIM

Remove useless zero digits from decimals in PHP

I'm trying to find a fast way to remove zero decimals from number values like this: echo cleanNumber('125.00'); // 125 echo cleanNumber('966.70'); // 966.7 echo cleanNumber(844.011); // 844.011 D..

An unhandled exception was generated during the execution of the current web request

Below is my code IMG When I click on Submit button in my page, I have to get dropdownlist values and I have to send it to another page. I have followed f..

Find all files with a filename beginning with a specified string?

I have a directory with roughly 100000 files in it, and I want to perform some function on all files beginning with a specified string, which may match tens of thousands of files. I have tried ls my..

What is the difference between Views and Materialized Views in Oracle?

What is the difference between Views and Materialized Views in Oracle?..

Delete item from state array in react

The story is, I should be able to put Bob, Sally and Jack into a box. I can also remove either from the box. When removed, no slot is left. people = ["Bob", "Sally", "Jack"] I now need to remove, s..

SELECT last id, without INSERT

I'm trying to retrieve the id of one table A to insert into another table B. I cannot use last_insert_id() as i have not inserted anything into A. Any ideas on how to do this nicely? $n = mysql_query..

selecting from multi-index pandas

I have a multi-index data frame with columns 'A' and 'B'. Is there is a way to select rows by filtering on one column of the multi-index without resetting the index to a single column index? For ..

event.returnValue is deprecated. Please use the standard event.preventDefault() instead

I have this script: <script> $(document).ready(function () { $("#changeResumeStatus").click(function () { $.get("{% url 'main:changeResumeStatus' %}", function (data) { ..

Difference between TCP and UDP?

What is the difference between TCP and UDP? I know that TCP is used in the case of non-time critical applications, and UDP is used for games or applications that require fast transmission of data. I..

Using Mockito to test abstract classes

I'd like to test an abstract class. Sure, I can manually write a mock that inherits from the class. Can I do this using a mocking framework (I'm using Mockito) instead of hand-crafting my mock? How?..

Correct way to use get_or_create?

I'm trying to use get_or_create for some fields in my forms, but I'm getting a 500 error when I try to do so. One of the lines looks like this: customer.source = Source.objects.get_or_create(name="W..

Webclient / HttpWebRequest with Basic Authentication returns 404 not found for valid URL

Edit: I wanted to come back to note that the problem wasn't on my end at all, but rather with with code on the other company's side. I'm trying to pull up a page using Basic Authentication. I keep ge..

jQuery $("#radioButton").change(...) not firing during de-selection

About a month ago Mitt’s question went unanswered. Sadly, I’m running into the same situation now. Here’s the situation: I’m using jQuery to c..

Stored procedure return into DataSet in C# .Net

I want to return virtual table from stored procedure and I want to use it in dataset in c# .net. My procedure is a little complex and can't find how to return a table and set it in a dataset Here is..

How to run a PowerShell script

How do I run a PowerShell script? I have a script named myscript.ps1 I have all the necessary frameworks installed I set that execution policy thing I have followed the instructions on this MSDN hel..

How to convert JSON object to an Typescript array?

I have an API request which returns the following: {"page": 1, "results": [ { "poster_path": "/9O7gLzmreU0nGkIB6K3BsJbzvNv.jpg", "adult": false, "overview": "Framed in the 194..

wp-admin shows blank page, how to fix it?

I am working with WordPress 3.5.8. Yesterday I made some changes into it to a friend. I don't know what happened, but after some time when I try to log in at wp-admin side and execute URL www.mysite.c..

Getting next element while cycling through a list

li = [0, 1, 2, 3] running = True while running: for elem in li: thiselem = elem nextelem = li[li.index(elem)+1] When this reaches the last element, an IndexError is raised (as i..

Where to find extensions installed folder for Google Chrome on Mac?

I can not find them under ~/Library/Application Support/Google/Chrome/; Where are they? Mac Pro 10.8.4 Chrome Version 26.0.1410.65 ..

Concat scripts in order with Gulp

Say, for example, you are building a project on Backbone or whatever and you need to load scripts in a certain order, e.g. underscore.js needs to be loaded before backbone.js. How do I get it to conc..

Can I prevent text in a div block from overflowing?

Can I prevent text in a div block from overflowing?..

Creating a simple login form

I am trying to create a simple HTML log-in that is placed in a box. I want to have something like this: I have tried a few things but they all seem to have been in vain. Here is my code thus far. H..

How to concatenate strings with padding in sqlite

I have three columns in an sqlite table: Column1 Column2 Column3 A 1 1 A 1 2 A 12 2 C 13 2 B ..

How to push elements in JSON from javascript array

I want to add javascript array values into JSON values object. The other element is also replaced my element like recipients, subject, message. I got Json like: Below is my code. var BODY = { ..

npm install error - MSB3428: Could not load the Visual C++ component "VCBuild.exe"

I'm trying to use the npm install steam but I am getting an error saying I'm not sure how to fix this and I have gotten this on two different npm module installs. I can install other modules ho..

Alternate table row color using CSS?

I am using a table with alternate row color with this. _x000D_ _x000D_ tr.d0 td {_x000D_ background-color: #CC9999;_x000D_ color: black;_x000D_ }_x000D_ tr.d1 td {_x000D_ background-color: #999..

How to append a char to a std::string?

The following fails with the error prog.cpp:5:13: error: invalid conversion from ‘char’ to ‘const char*’ int main() { char d = 'd'; std::string y("Hello worl"); y.append(d); // Line 5 -..

Option to ignore case with .contains method?

Is there an option to ignore case with .contains() method? I have an ArrayList of DVD object. Each DVD object has a few elements, one of them is a title. And I have a method that searches for a speci..

How to get screen width and height

I tried to use following code to get screen width and height in android app development: Display display = getWindowManager().getDefaultDisplay(); int screenWidth = display.getWidth(); int screenHei..

Reading from stdin

What are the possible ways for reading user input using read() system call in Unix. How can we read from stdin byte by byte using read()?..

includes() not working in all browsers

right here is a block of my code. It works perfect in fireFox and Chrome. But not in IE. I get the error "Object doesn't support property or method 'includes'" function rightTreeSwapfunc2() { if ..

Get first and last date of current month with JavaScript or jQuery

As title says, I'm stuck on finding a way to get the first and last date of the current month with JavaScript or jQuery, and format it as: For example, for November it should be : var firstdate = '1..

Deleting all files from a folder using PHP?

For example I had a folder called `Temp' and I wanted to delete or flush all files from this folder using PHP. Could I do this?..

Node.js: close client connection

How can I close the socket connection on the client side? I am using: 0.9 node.js 0.10.15 express 3.3.4 i.e.: call localhost/test -- server side var test = io .of('/test') .on('conne..

ERROR 1049 (42000): Unknown database

I can't seem to login to my tutorial database development environment: Ayman$ mysql -u blog -p blog_development Enter password: ERROR 1049 (42000): Unknown database 'blog_development' I can login..

CSS: Position loading indicator in the center of the screen

How can I position my loading indicator in the center of the screen. Currently I'm using a little placeholder and it seems to work fine. However, when I scroll down, the loading indicator stays right ..

Javascript how to split newline

I'm using jquery, and I have a textarea. When I submit by my button I will alert each text separated by newline. How to split my text when there is a newline? var ks = $('#keywords').val().split("..

jQuery add text to span within a div

<div id="tagscloud"> <span></span> </div> How would I do to add some text within the span like code below ? <span>**tag cloud**</span> Edit: actually the..

How do you store Java objects in HttpSession?

So I am trying to get a servlet to add a Java object to the session of the user, when this servlet is requested. But after the servlet redirects to the next page and I try to retrieve the object, I ge..

Android set bitmap to Imageview

Hi i have a string in Base64 format. I want to convert it ot a bitmap and then display it to an ImageView. This is the code: ImageView user_image; Person person_object; @Override protected void onCre..

Why is it said that "HTTP is a stateless protocol"?

HTTP has HTTP Cookies. Cookies allow the server to track the user state, the number of connections, last connection, etc. HTTP has persistent connections (Keep-Alive) where several requests can be se..

How to write error log or exception into file in java

Is there any way to write error log or exception into a file in java. i have gone through Log4j. I googled about it but diidnt find a good solution. I have written a simple code catch (Exception e) ..

How to receive serial data using android bluetooth

I am new to android. I am designing an android application that receives serial data from a hardware device through bluetooth. I am working on Htc desire S. I used the sample Bluetooth chat code to re..

How can I switch my signed in user in Visual Studio 2013?

A new feature of Visual Studio 2013 is the ability to sign in with a Microsoft Account and have your settings be persisted across all of your instances of Visual Studio, amongst other things. When I ..

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

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

how to install gcc on windows 7 machine?

I have MinGW on my windows 7 machine. I wish to install and use complete gcc for C compiler. I found there is no single pre-compiled ready-made installation file for this purpose. I checked the follow..

How to create my json string by using C#?

I am new to json format. I want to create a following json string by using C# and package. This is my target Json format: { "GetQuestions": { "s1":"Q1,Q2", "s2":"Q1,Q3", "s..

How to get the result of OnPostExecute() to main activity because AsyncTask is a separate class?

I have this two classes. My main Activity and the one that extends the AsyncTask, Now in my main Activity I need to get the result from the OnPostExecute() in the AsyncTask. How can I pass or get the ..

Deserialize Java 8 LocalDateTime with JacksonMapper

I have read several questions with answers here in SO concerning serialization and deserialization between java.time.LocalDateTime and JSON property but I can't seem to get it working. I have managed..

Convert string to decimal number with 2 decimal places in Java

In Java, I am trying to parse a string of format "###.##" to a float. The string should always have 2 decimal places. Even if the String has value 123.00, the float should also be 123.00, not 123.0...

Refresh Part of Page (div)

I have a basic html file which is attached to a java program. This java program updates the contents of part of the HTML file whenever the page is refreshed. I want to refresh only that part of the pa..

Windows Forms ProgressBar: Easiest way to start/stop marquee?

I am using C# and Windows Forms. I have a normal progress bar working fine in the program, but now I have another operation where the duration cannot be easily calculated. I would like to display a pr..

Convert char * to LPWSTR

I am trying to convert a program for multibyte character to Unicode. I have gone through the program and preceded the string literals with L so they look like L"string". This has worked but I am now..

Detecting Enter keypress on VB.NET

I am using .NET 3.5 framework of VB.NET 2008. I have some textboxes in my form. I want the tab-like behavior when my user presses ENTER on one of my textboxes. I used the following code: Private Sub..

SimpleDateFormat parse loses timezone

Code: SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println(new Date()); try { String d = sdf.for..

Why do you have to link the math library in C?

If I include <stdlib.h> or <stdio.h> in a C program I don't have to link these when compiling but I do have to link to <math.h>, using -lm with gcc, for example: gcc test.c -o test ..

Write string to text file and ensure it always overwrites the existing content.

I have a string with a C# program that I want to write to a file and always overwrite the existing content. If the file isn't there, the program should create a new file instead of throwing an except..

how to convert a string to an array in php

how to convert a string in array in php i.e $str="this is string"; should be like this arr[0]=this arr[1]=is arr[2]=string The str_split($str, 3); split the string in 3 character wo..

Rounding integer division (instead of truncating)

I was curious to know how I can round a number to the nearest whole number. For instance, if I had: int a = 59 / 4; which would be 14.75 if calculated in floating point; how can I store the result ..

Saving and Reading Bitmaps/Images from Internal memory in Android

What I want to do, is to save an image to the internal memory of the phone (Not The SD Card). How can I do it? I have got the image directly from the camera to the image view in my app its all worki..

Correct set of dependencies for using Jackson mapper

I am new to Jackson and I was writing some code for practice. I found out the the new version of Jackson library can be found on Fasterxml: Jackson, so I added the below dependencies to my Maven pom f..

PHP mysql insert date format

Im using jQuery datepicker the format of the datepicker is this 08/25/2012 i have errors when inserting to my database it insert only 0000-00-00 00 00 00 my codes is <?php $id = $_POST['id']; $n..

How to merge multiple lists into one list in python?

Possible Duplicate: Making a flat list out of list of lists in Python Join a list of lists together into one list in Python I have many lists which looks like ['it'] ['was'] ['annoying'..

How to reduce the image file size using PIL

I am using PIL to resize the images there by converting larger images to smaller ones. Are there any standard ways to reduce the file size of the image without losing the quality too much, lets say th..

AngularJS open modal on button click

I am trying to learn to open a modal dialog box at the click of the button in AngularJS but unable to do so. I checked the chrome console but there are no errors. Also, since I am learning AngularJS, ..

How to create own dynamic type or dynamic object in C#?

There, is for example, ViewBag property of ControllerBase class and we can dynamically get/set values and add any number of additional fields or properties to this object, which is cool .I want to use..

Writing data into CSV file in C#

I am trying to write into a csv file row by row using C# language. Here is my function string first = reader[0].ToString(); string second=image.ToString(); string csv = string.Format("{0},{1}\n", fir..

pyplot axes labels for subplots

I have the following plot: import matplotlib.pyplot as plt fig2 = plt.figure() ax3 = fig2.add_subplot(2,1,1) ax4 = fig2.add_subplot(2,1,2) ax4.loglog(x1, y1) ax3.loglog(x2, y2) ax3.set_ylabel('hello..

VBA general way for pulling data out of SAP

Does anyone know how to use VBA to pull data from SAP Netweaver? I have a number of daily reports that require exporting data from SAP to Excel and formatting it into a report. I have already written..

Run jar file with command line arguments

How can I run a jar file in command prompt and pass arguments to it. ie: "test.jar -get" would be entered in command prompt/terminal..

How do I configure Apache 2 to run Perl CGI scripts?

I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work. What is the right way of achieving ..

Get current time in milliseconds using C++ and Boost

In my thread (using boost::thread) I need to retrieve the current time in ms or less and to convert into ms: Actually, reading here I've found this: tick = boost::posix_time::second_clock::local_tim..

Simple function to sort an array of objects

I would like to create a (non-anonymous) function that sorts an array of objects alphabetically by the key name. I only code straight-out JavaScript so frameworks don't help me in the least. var peop..

rake assets:precompile RAILS_ENV=production not working as required

I am trying to precompile assets using the command rake assets:precompile RAILS_ENV=production, but I always get the error below. ** Invoke assets:precompile (first_time) ** Execute assets:precom..

Git error: src refspec master does not match any error: failed to push some refs

I am trying to add a file to my repository on BitBucket and I am having trouble. I am using GIT and this is what I type in $ cd lis4368/assignments $ git remote $ git remote -v $ git remote rm orig..

Mongodb: Failed to connect to, reason: errno:10061

Here is my mongod.cfg file: bind_ip = dbpath = C:\mongodb\data\db logpath = C:\mongodb\log\mongo-server.log verbose=v Here is my mongod service command: mongod -f c:\mongodb\mongod.cfg -..

How can I combine two commits into one commit?

I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. The command git merge --squash sounds promising, but when I run git merge -..

CSS: How to change colour of active navigation page menu

I'm trying to change the colour of the active or current page navigation link which is selected by the user on my website. What am I doing wrong? Thanks. So far the CSS looks like this: div.menuBar ..

What is the difference between Sublime text and Github's Atom

Github announced Atom which is very similar to Sublime. Even some keyboard shortcuts like ? + P, ? + Shift + P etc. are same. How is Atom different from Sublime? Does it include IDE features lik..

JFrame.dispose() vs System.exit()

What is the difference between these two methods - System.exit() and JFrame.dispose()? If we want to close a Java Swing application when a button is clicked, which method should I use?..

Setting default permissions for newly created files and sub-directories under a directory in Linux?

I have a bunch of long-running scripts and applications that are storing output results in a directory shared amongst a few users. I would like a way to make sure that every file and directory created..

How to convert An NSInteger to an int?

For example when passing a value message to an NSInteger instance like so [a value] it causes an EXC_BAD_ACCESS. So how to convert an NSInteger to int? If it's relevant only small numbers < 32 a..

curl: (6) Could not resolve host: application

Getting url: (6) Could not resolve host: application error after this command : curl -i -H 'Content-Type: application/json' -d '{"Code":"FR","Name":"France"}' Full e..

private constructor

Possible Duplicate: What is the use of making constructor private in a class? Where do we need private constructor? How can we instantiate a class having private constructor? ..

Truncate Decimal number not Round Off

Possible Duplicate: c# - How do I round a decimal value to 2 decimal places (for output on a page) I want to truncate the decimals like below i.e. 2.22939393 -> 2.229 2.22977777 -> 2.229..

Objective-C - Remove last character from string

In Objective-C for iOS, how would I remove the last character of a string using a button action?..

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

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

Get root view from current activity

I know how to get the root view with View.getRootView(). I am also able to get the view from a button's onClick event where the argument is a View. But how can I get the view in an activity?..

convert:not authorized `aaaa` @ error/constitute.c/ReadImage/453

I want to create a captcha pic by use convert from ImageMagick. And I follow this, but there are some problem . Input In my linux shell: convert -background white -fill black -font FreeSerif-Bold -..

C# try catch continue execution

I have a question that might seem fairly simple (of course if you know the answer). A certain function I have calls another function but I want to continue execution from the caller even though the c..

Reducing video size with same format and reducing frame size

This question might be very basic Is there a way to reduce the frame size/rate of Lossy compressed (WMV, MPEG) format, to get a smaller video, of lesser size, with same format. Are there any open so..

How to exclude file only from root folder in Git

I am aware of using .gitignore file to exclude some files being added, but I have several config.php files in source tree and I need to exclude only one, located in the root while other keep under rev.. Trust anchor for certification path not found

I am using Retrofit to access my REST API. However, when I put my API behind ssl and access it by http://myhost/myapi then I get this error: Do I need to do something extra now that my API is behind ..

Unicode characters in URLs

In 2010, would you serve URLs containing UTF-8 characters in a large web portal? Unicode characters are forbidden as per the RFC on URLs (see here). They would have to be percent encoded to be standa..

How to ignore parent css style

I'm wondering how to ignore a parent style and use the default style (none). I'll show my specific case as an example but I'm pretty sure this is a general question. <style> #elementId select {..

How can I change an element's class with JavaScript?

How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?..

What is the meaning of the CascadeType.ALL for a @ManyToOne JPA association

I think I misunderstood the meaning of cascading in the context of a @ManyToOne relationship. The case: public class User { @OneToMany(fetch = FetchType.EAGER) protected Set<Address> us..

Fastest way to check if a string matches a regexp in ruby?

What is the fastest way to check if a string matches a regular expression in Ruby? My problem is that I have to "egrep" through a huge list of strings to find which are the ones that match a regexp t..

Javascript: The prettiest way to compare one value against multiple values

Whats the prettiest way to compare one value against multiples options? I know there are loads of ways of doing this, but I'm looking for the neatest. i ask because i'd hoped this was workable (it i..

Trying to make bootstrap modal wider

I am using this code but the modal is too thin: <div class="modal fade bs-example-modal-lg custom-modal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true" id="myModal"> ..

Convert from ASCII string encoded in Hex to plain ASCII?

How can I convert from hex to plain ASCII in Python? Note that, for example, I want to convert "0x7061756c" to "paul"...

Token based authentication in Web API without any user interface

I am developing a REST API in ASP.Net Web API. My API will be only accessible via non-browser based clients. I need to implement security for my API so I decided to go with Token based authentication...

Online SQL syntax checker conforming to multiple databases

Is there any site available online for verifying the syntax which conforms to multiple databases? For example: If I have a SQL statement with a 'usage' keyword, then the site should throw me an error..

Gridview with two columns and auto resized images

I'm trying to make a gridview with two columns. I mean two photos per row side by side just like this image. But my pictures have spaces between them, due to the fact that it's not the same size. H..

How can you profile a Python script?

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e., ..

Android Activity without ActionBar

I have different Activities in my App and in all of them I do not want the Action Bar. I cannot find how to disable it. I have tried to find an attribute to apply it to the main_activity.xml but so fa..

how to check and set max_allowed_packet mysql variable

Possible Duplicate: MySQL Error 1153 - Got a packet bigger than ‘max_allowed_packet’ bytes Hi I am getting the error : [1153] Got a packet bigger than 'max_allowed_packet'bytes but I ..

OS X cp command in Terminal - No such file or directory

this might be one of those days my brain just does not work, or i'm incredibly dumb. i've been trying to copy files (which are actually directories .app, .bundle, etc.) but consistently get an error '..

What is the effect of encoding an image in base64?

If I convert an image (jpg or png) to base64, then will it be bigger, or will it have the same size? How much greater will it be? Is it recommended to use base64 encoded images on my website?..

Get value of c# dynamic property via string

I'd like to access the value of a dynamic c# property with a string: dynamic d = new { value1 = "some", value2 = "random", value3 = "value" }; How can I get the value of d.value2 ("random") if I onl..

Custom thread pool in Java 8 parallel stream

Is it possible to specify a custom thread pool for Java 8 parallel stream? I can not find it anywhere. Imagine that I have a server application and I would like to use parallel streams. But the appl..

How to delete an app from iTunesConnect / App Store Connect

I submitted a brand new app to AppStore and it got rejected by the Lords ... (nothing new there). What I want to do is delete that app completely from my itunesconnect account. I don't know what apple..

Make xargs handle filenames that contain spaces

$ ls *mp3 | xargs mplayer Playing Lemon. File not found: 'Lemon' Playing Tree.mp3. File not found: 'Tree.mp3' Exiting... (End of file) My command fails because the file "Lemon Tree.mp3..

Making a request to a RESTful API using python

I have a RESTful API that I have exposed using an implementation of Elasticsearch on an EC2 instance to index a corpus of content. I can query the search by running the following from my terminal (Mac..

Convert unsigned int to signed int C

I am trying to convert 65529 from an unsigned int to a signed int. I tried doing a cast like this: unsigned int x = 65529; int y = (int) x; But y is still returning 65529 when it should return -7. ..

How to ssh connect through python Paramiko with ppk public key

i'm using Paramiko to connect through ssh to a server. Basic authentication works well, but i can't understand how to connect with public key. When i connect with putty, the server tell me this: Us..

Session 'app': Error Launching activity

After the Android Studio 2.0 update while the gradle build finishes I get this : Session 'app': Error Launching activity . It prevents the app from starting but it's installed in my emulator. This is..

How can I select from list of values in SQL Server

I have very simple problem that I can't solve. I need to do something like this: select distinct * from (1, 1, 1, 2, 5, 1, 6). Anybody can help?? Edit The data comes as a text file from one of o..

Add unique constraint to combination of two columns

I have a table and, somehow, the same person got into my Person table twice. Right now, the primary key is just an autonumber but there are two other fields that exist that I want to force to be uniqu..

Passing argument to alias in bash

Is it possible to do the following: I want to run the following: mongodb bin/mongod In my bash_profile I have alias = "./path/to/mongodb/$1" ..

Calling Oracle stored procedure from C#?

How does one call a stored procedure in oracle from C#?..

Python recursive folder read

I have a C++/Obj-C background and I am just discovering Python (been writing it for about an hour). I am writing a script to recursively read the contents of text files in a folder structure. The pro..

Web API optional parameters

I have a controller with the following signature: [Route("products/filter/{apc=apc}/{xpc=xpc}/{sku=sku}")] public IHttpActionResult Get(string apc, string xpc, int? sku) { ... } I call this method ..

How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)

Note: This question is only relevant for Grunt 0.3.x and has been left for reference. For help with the latest Grunt 1.x release please see my comment below this question. I'm currently trying to use..

Checking during array iteration, if the current element is the last element

Please help me to translate this pseudo-code to real php code: foreach ($arr as $k => $v) if ( THIS IS NOT THE LAST ELEMENT IN THE ARRAY) doSomething(); Edit: the array may have num..

How to embed PDF file with responsive width

I'm embedding pdf files using something like this: <div class="graph-outline"> <object style="width:100%;" data="path/to/file.pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" t..

Get item in the list in Scala?

How in the world do you get just an element at index i from the List in scala? I tried get(i), and [i] - nothing works. Googling only returns how to "find" an element in the list. But I alr..

How to change indentation mode in Atom?

I haven't been able to figure this out yet. Atom seems to use spaces as the default indentation mode. I prefer to have tabs instead though. Sublime Text has built in functionality for switching and co..

SQL Server tables: what is the difference between @, # and ##?

In SQL Server, what is the difference between a @ table, a # table and a ## table?..

difference between iframe, embed and object elements

HTML5 defines several embedded content elements, which, from a bird's-eye view, seem to be very similar to the point of being largely identical. What is the actual difference between iframe, embed an..

Mocking a method to throw an exception (moq), but otherwise act like the mocked object?

I have a Transfer class, simplified it looks like this: public class Transfer { public virtual IFileConnection source { get; set; } public virtual IFileConnection destination { get; set; } ..

How to set the holo dark theme in a Android app?

How can I set the dark holo theme in my app? At this time I got this: <style name="AppTheme" parent="android:Theme.Holo.Light" /> But when I change it to: <style name="AppTheme" parent="a..

How to add additional fields to form before submit?

Is there a way to use javascript and JQuery to add some additional fields to be sent from a HTTP form using POST? I mean: <form action="somewhere" method="POST" id="form"> <input type="su..

How can I make visible an invisible control with jquery? (hide and show not work)

How can I change the visibility of a control with jQuery? I have a control that its visible property to false (not css). When I used show() function for it nothing happened, it seems that hide() and s..

How to sort an array of ints using a custom comparator?

I need to sort an array of ints using a custom comparator, but Java's library doesn't provide a sort function for ints with comparators (comparators can be used only with objects). Is there any easy w..

Quickest way to find missing number in an array of numbers

I have an array of numbers from 1 to 100 (both inclusive). The size of the array is 100. The numbers are randomly added to the array, but there is one random empty slot in the array. What is the quic..

How do I pass a URL with multiple parameters into a URL?

Basically I'm trying to pass a URL like this: into a URL like this:

How to do a logical OR operation for integer comparison in shell scripting?

I am trying to do a simple condition check, but it doesn't seem to work. If $# is equal to 0 or is greater than 1 then say hello. I have tried the following syntax with no success: if [ "$#" == 0 -..

How to percent-encode URL parameters in Python?

If I do url = "" + urllib.quote(query) It doesn't encode / to %2F (breaks OAuth normalization) It doesn't handle Unicode (it throws an exception) Is there a better library?..

Checking something isEmpty in Javascript?

How can I check if a variable is empty in Javascript? Sorry for the stupid question, but I'm a newbie in Javascript! if( is empty { do something else { do something else } re..

Subtract days, months, years from a date in JavaScript

Does anybody know of a simple way of taking a date (e.g. Today) and going back X days, X months and X years? I have tried that: var date = new Date(); $("#searchDateFrom").val((date.getMonth() -1 ) ..

Java synchronized method lock on object, or method?

If I have 2 synchronized methods in the same class, but each accessing different variables, can 2 threads access those 2 methods at the same time? Does the lock occur on the object, or does it get as ..

How to get the home directory in Python?

I need to get the location of the home directory of the current logged-on user. Currently, I've been using the following on Linux: os.getenv("HOME") However, this does not work on Windows. What is ..

Setting active profile and config location from command line in spring boot

I have a spring boot application. I have three profiles in my application-> development, staging and production. So I have 3 files application-development.yml application-staging.yml application-p..

Return multiple values from a function in swift

How do I return 3 separate data values of the same type(Int) from a function in swift? I'm attempting to return the time of day, I need to return the Hour, Minute and Second as separate integers, but..

DB2 Date format

I just want to format current date into yyyymmdd in DB2. I see the date formats available, but how can I use them?

How to adjust the size of y axis labels only in R?

How can I adjust only the size of Y-axis labels in R? I know that cex.axis alters the size of the axis labels but it only affects the x-axis. Why, and how can I adjust the y axis?..

How to get unique values in an array

How can I get a list of unique values in an array? Do I always have to use a second array or is there something similar to java's hashmap in JavaScript? I am going to be using JavaScript and jQuery o..

Rerender view on browser resize with React

How can I get React to re-render the view when the browser window is resized? Background I have some blocks that I want to layout individually on the page, however I also want them to update when th..

How to vertically align elements in a div?

I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS ..

Resolving PKIX path building failed Error?

Edit :- Tried to format the question and accepted answer in more presentable way at mine Blog Here is the original issue. I am getting this error: detailed message

how to extract only the year from the date in sql server 2008?

In sql server 2008, how to extract only the year from the date. In DB I have a column for date, from that I need to extract the year. Is there any function for that?..

How to disable PHP Error reporting in CodeIgniter?

I've read the official documentation and all they say is that I should have a error_reporting() function located at the top of your main index.php file. But I don't have index.php file in my project. ..

What is a "callback" in C and how are they implemented?

From the reading that I have done, Core Audio relies heavily on callbacks (and C++, but that's another story). I understand the concept (sort of) of setting up a function that is called by another ..

What is the proper way to test if a parameter is empty in a batch file?

I need to test if a variable is set or not. I've tried several techniques but they seem to fail whenever %1 is surrounded by quotes such as the case when %1 is "c:\some path with spaces". I..

How to create a hidden <img> in JavaScript?

How can you make a simple tag like <img src="a.gif"> hidden programmatically using JavaScript?..

Eclipse Problems View not showing Errors anymore

For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View. It is still showing Warnings. This has suddenly happened and I cannot think of anything that I have chan..

Switch php versions on commandline ubuntu 16.04

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod php7.1 #to enable php7 When I disable php7.1 in Apache..

onClick function of an input type="button" not working

I have this code which on clicking the button "Get more fields" will create a copy of the entire div and create fields. But on clicking the button nothing is happening. All the other buttons are worki..

How to fix committing to the wrong Git branch?

I just made a perfectly good commit to the wrong branch. How do I undo the last commit in my master branch and then take those same changes and get them into my upgrade branch?..

iPhone hide Navigation Bar only on first page

I have the code below that hides and shows the navigational bar. It is hidden when the first view loads and then hidden when the "children" get called. Trouble is that I cannot find the event/action..

Find value in an array

In Ruby, how can I find a value in an array?..

How can I bold the fonts of a specific row or cell in an Excel worksheet with C#?

I am exporting data from a List<> to excel. I want to make some specific rows and cells bold. I need to make some cell merged also. Below is the code I am using. try { Excel..

How to remove border of drop down list : CSS

I want to remove the border that is coming just outside the drop down list. I am trying: select#xyz option { Border: none; } But does not work for me...

subtract two times in python

I have two datetime.time values, exit and enter and I want to do something like: duration = exit - enter However, I get this error: TypeError: unsupported operand type(s) for -: 'datetime.time'..

Issue when importing dataset: `Error in scan(...): line 1 did not have 145 elements`

I'm trying to import my dataset in R using read.table(): Dataset.df <- read.table("C:\\dataset.txt", header=TRUE) But I get the following error message: Error in scan(file, what, nmax, sep, dec..

Import JSON file in React

I'm new to React and I'm trying to import a JSON DATA variable from an external file. I'm getting the following error: Cannot find module "./customData.json" Could some one help me? It works if..

Which is the preferred way to concatenate a string in Python?

Since Python's string can't be changed, I was wondering how to concatenate a string more efficiently? I can write like it: s += stringfromelsewhere or like this: s = [] s.append(somestring) late..

How do I get the resource id of an image if I know its name?

How do I get the resource id of an image if I know its name (in Android)?..

HTTP Request in Kotlin

I'm completely new to Kotlin. I want to do a login validation using POST method and to get some information using GET method. I've URL, server Username and Password already of my previous project. I d..

Rearrange columns using cut

I am having a file in the following format Column1 Column2 str1 1 str2 2 str3 3 I want the columns to be rearranged. I tried below command cut -f2,1 file.txt The command..

Selenium and xPath - locating a link by containing text

I'm trying to use xPath to find an element containing a piece of text, but I can't get it to work.... WebElement searchItemByText = driver.findElement(By.xpath("//*[@id='popover-search']/div/div/ul/l..

Rounding a double to turn it into an int (java)

Right now I'm trying this: int a = round(n); where n is a double but it's not working. What am I doing wrong? ..

Split string every nth character?

Is it possible to split a string every nth character? For example, suppose I have a string containing the following: '1234567890' How can I get it to look like this: ['12','34','56','78','90'] ..

Longer object length is not a multiple of shorter object length?

I don't understand why R gives me a warning about "Longer object length is not a multiple of shorter object length" I have this object which is generated by doing an aggregate over an xts se..

How to restart remote MySQL server running on Ubuntu linux?

I'm using Ubuntu 12.04 LTS on my machine. There is on MySQL server situated remotely. I want to restart it. Can someone please give me in detail step-by-step instructions to restart the MySQL server..

StringStream in C#

I want to be able to build a string from a class that I create that derives from Stream. Specifically, I want to be able to write code like this: void Print(Stream stream) { // Some code that ope..

PHP upload image

Alright I have way to much time invested in this. I am new to PHP programming and trying to grasp the basics, but I am a little lost as of last night I was able to get a PHP form to upload basic data ..

How to select distinct rows in a datatable and store into an array

I have a dataset objds. objds contains a table named Table1. Table1 contains column named ProcessName. This ProcessName contains repeated names.So i want to select only distinct names.Is this possible..

How to configure a HTTP proxy for svn

I want to check code from the repository . I can only access the the repository url by setting a proxy. I guess if I want to get the code from the same URL by svn..

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

Open a URL without using a browser from a batch file

I want to open a particular URL without directly opening the browser using only a batch file. I know I can use something like: START But I want to open a URL without using a browser...

Python string.join(list) on object array rather than string array

In Python, I can do: >>> list = ['a', 'b', 'c'] >>> ', '.join(list) 'a, b, c' Is there any easy way to do the same when I have a list of objects? >>> class Obj: ... ..

Using json_encode on objects in PHP (regardless of scope)

I'm trying to output lists of objects as json and would like to know if there's a way to make objects usable to json_encode? The code I've got looks something like $related = $user->getRelatedUse..

How to convert a string into double and vice versa?

I want to convert a string into a double and after doing some math on it, convert it back to a string. How do I do this in Objective-C? Is there a way to round a double to the nearest integer too?..

Create a new object from type parameter in generic class

I'm trying to create a new object of a type parameter in my generic class. In my class View, I have 2 lists of objects of generic type passed as type parameters, but when I try to make new TGridView()..

How to write a unit test for a Spring Boot Controller endpoint

I have a sample Spring Boot app with the following Boot main class @SpringBootApplication public class DemoApplication { public static void main(String[] args) {

Where does this come from: -*- coding: utf-8 -*-

Python recognizes the following as instruction which defines file's encoding: # -*- coding: utf-8 -*- I definitely saw this kind of instructions before (-*- var: value -*-). Where does it come from..

Converting String to Double in Android

Trying to get double values from an EditText and manipulate them before passing them to another Intent. Not using primitive data type so I can use toString methods. Problem is when I include the prot..

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I have been following a manual to install a software suite on Ubuntu. I have no knowledge of MySQL at all. I have done the following installations on my Ubuntu. sudo apt-get update sudo apt-get instal..

Positioning the colorbar

I have a matplotlib plot with a colorbar attached. I want to position the colorbar so that it is horizontal, and underneath my plot. I have almost done this via the following: plt.colorbar(orientati..

How to convert date to string and to date again?

Hi i want to convert the current date to this format YYYY-MM-DD. However, it will convert the date into String format, but i want to convert it back into Date format. So can anyone advise on this? Th..

How to use refs in React with Typescript

I'm using Typescript with React. I'm having trouble understanding how to use refs so as to get static typing and intellisense with respect to the react nodes referenced by the refs. My code is as foll..

Cannot lower case button text in android studio

I have a trivial question that has been bothering me for a while. I tried to google this but no one seems to have the same problem as me or doesn't see it as an issue. When I make a button in activity..

How to set dropdown arrow in spinner?

I tried to set spinner with drop down arrow but i couldn't fix it can anyone help me with this? I have attached the source code. my class file: import android.os.Bundle; import android.view...

Found conflicts between different versions of the same dependent assembly that could not be resolved

When I clean and then build my solution that has several projects, the output window reports that the build succeeded. However, when I view the Error List Window, it shows me this warning: Found c..

CharSequence VS String in Java?

Programming in Android, most of the text values are expected in CharSequence. Why is that? What is the benefit, and what are the main impacts of using CharSequence over String? What are the main dif..

Simplest way to display current month and year like "Aug 2016" in PHP?

What is the shortest, simplest code to generate the curent month in Full English like September or in abbreviated three letter version like Feb and then add the current Year 2011? So the code will, d..

How to replace special characters in a string?

I have a string with lots of special characters. I want to remove all those, but keep alphabetical characters. How can I do this?..

CSS3 Transition not working

I couldn't get transitions to work on this page, anybody has any idea why? div.sicon a { transition: background 0.5s linear; -moz-transition: background 0.5s linear; /* Firefox 4 */ -webk..