Questions Tagged with #Inputstream

An abstract mechanism for reading a data stream in Java

How to convert OutputStream to InputStream?

I am on the stage of development, where I have two modules and from one I got output as a OutputStream and second one, which accepts only InputStream. Do you know how to convert OutputStream to InputS..

How to read all of Inputstream in Server Socket JAVA

I am using at one of my project. and I wrote a App Server that gets inputStream from a client. But some times my (buffered)InputStream can not get all of OutputStream that client sent to my s..

Convert InputStream to BufferedReader

I'm trying to read a text file line by line using InputStream from the assets directory in Android. I want to convert the InputStream to a BufferedReader to be able to use the readLine(). I have the..

Can you explain the HttpURLConnection connection process?

I am using HTTPURLConnection to connect to a web service. I know how to use HTTPURLConnection but I want to understand how it works. Basically, I want to know the following: On which point does HTTP..

Difference between Console.Read() and Console.ReadLine()?

I'm new to this field and I'm very confused: what is the real difference between Console.Read() and Console.ReadLine()?..

How do I read / convert an InputStream into a String in Java?

If you have a object, how should you process that object and produce a String? Suppose I have an InputStream that contains text data, and I want to convert it to a String, so fo..

What is InputStream & Output Stream? Why and when do we use them?

Someone explain to me what InputStream and OutputStream are? I am confused about the use cases for both InputStream and OutputStream. If you could also include a snippet of code to go along with you..

Convert InputStream to byte array in Java

How do I read an entire InputStream into a byte array?..

Convert InputStream to JSONObject

I am converting InputStream to JSONObject using following code. My question is, is there any simple way to convert InputStream to JSONObject. Without doing InputStream -> BufferedReader -> StringBuild..

Read input stream twice

How do you read the same inputstream twice? Is it possible to copy it somehow? I need to get a image from web, save it locally and then return the saved image. I just thought it would be faster to use..

AmazonS3 putObject with InputStream length example

I am uploading a file to S3 using Java - this is what I got so far: AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials("XX","YY")); List<Bucket> buckets = s3.listBuckets(); s3.putObject..

FileNotFoundException while getting the InputStream object from HttpURLConnection

I am trying to send a post request to a url using HttpURLConnection (for using cUrl in java). The content of the request is xml and at the end point, the application processes the xml and stores a re..

How to convert byte[] to InputStream?

Possible Duplicate: Can we convert a byte array into an InputStream in Java? There is a way to convert an array of bytes (byte[]) to InputStream in Java? I looked at some methods in Apache ..

Is it possible to read from a InputStream with a timeout?

Specifically, the problem is to write a method like this: int maybeRead(InputStream in, long timeout) where the return value is the same as if data is available within 'timeout' milliseco..

How can I check if an InputStream is empty without reading from it?

I want to know if an InputStream is empty, but without using the method read(). Is there a way to know if it's empty without reading from it?..

Can we convert a byte array into an InputStream in Java?

Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn't find it. I have a method that has an InputStream as argument. The InputStream cph I have is ..

Creating a byte array from a stream

What is the prefered method for creating a byte array from an input stream? Here is my current solution with .NET 3.5. Stream s; byte[] b; using (BinaryReader br = new BinaryReader(s)) { b = ..

Connecting an input stream to an outputstream

update in java9: I saw some similar, but not-quite-what-i-need threads. I have a server, which wil..

getResourceAsStream() is always returning null

I have the following structure in a Java Web Application: TheProject -- [Web Pages] -- -- [WEB-INF] -- -- -- abc.txt -- -- index.jsp -- [Source Packages] -- -- [wservices] -- -- -- WS.j..

Reading a binary input stream into a single byte array in Java

The documentation says that one should not use available() method to determine the size of an InputStream. How can I read the whole content of an InputStream into a byte array? InputStream in; //assu..

How to convert an Stream into a byte[] in C#?

Is there a simple way or method to convert an Stream into a byte[] in C#?..

How can I read a text file in Android?

I want to read the text from a text file. In the code below, an exception occurs (that means it goes to the catch block). I put the text file in the application folder. Where should I put this text..

How to create streams from string in Node.Js?

I am using a library, ya-csv, that expects either a file or a stream as input, but I have a string. How do I convert that string into a stream in Node?..

Reading InputStream as UTF-8

I'm trying to read from a text/plain file over the internet, line-by-line. The code I have right now is: URL url = new URL(""); BufferedReader in = new BufferedReader(n..

How to clone an InputStream?

I have a InputStream that I pass to a method to do some processing. I will use the same InputStream in other method, but after the first processing, the InputStream appears be closed inside the method..

Capture characters from standard input without waiting for enter to be pressed

I can never remember how I do this because it comes up so infrequently for me. But in C or C++, what is the best way to read a character from standard input without waiting for a newline (press enter)..

Open URL in Java to get the content

I´m searching for a opportunity to open a url in java. URL url = new URL(""); InputStream is = url.openConnection().getInputSt..

How do I convert a String to an InputStream in Java?

Given a string: String exampleString = "example"; How do I convert it to an InputStream?..

Byte[] to InputStream or OutputStream

I have a blob column in my database table, for which I have to use byte[] in my Java program as a mapping and to use this data I have to convert it to InputStream or OutputStream. But I don't know wha..

byte[] to file in Java

With Java: I have a byte[] that represents a file. How do I write this to a file (ie. C:\myfile.pdf) I know it's done with InputStream, but I can't seem to work it out...

Java - How Can I Write My ArrayList to a file, and Read (load) that file to the original ArrayList?

I am writing a program in Java which displays a range of afterschool clubs (E.G. Football, Hockey - entered by user). The clubs are added into the following ArrayList: private ArrayList<Club>..

Different ways of loading a file as an InputStream

What's the difference between: InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName) and InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStre..

Determine the size of an InputStream

My current situation is: I have to read a file and put the contents into InputStream. Afterwards I need to place the contents of the InputStream into a byte array which requires (as far as I know) the..

Getting the inputstream from a classpath resource (XML file)

In Java web application, Suppose if I want to get the InputStream of an XML file, which is placed in the CLASSPATH (i.e. inside the sources folder), how do I do it?..

InputStream from a URL

How do I get an InputStream from a URL? for example, I want to take the file at the url and read it as an InputStream in Java, through a servlet. I've tried InputStream i..

How to get access to raw resources that I put in res folder?

In J2ME, I've do this like that: getClass().getResourceAsStream("/raw_resources.dat"); But in android, I always get null on this, why?..

Relative path in HTML

I am creating a website on localhost. I want to make all of link resources in my website to relative path ( I mean only internal resources). website is located in http://localhost/mywebsite I rea..

How to programmatically send a 404 response with Express/Node?

I want to simulate a 404 error on my Express/Node server. How can I do that?..

Select method in List<t> Collection

I have an application, and now I am using datasets for data manipulation. I recently started to convert this dataset to a List collection. But, in some places it doesn't work. One is that in m..

jQuery: get data attribute

In my html I have a span element: <span class="field" data-fullText="This is a span element">This is a</span> And I want to get the data-fullText attribute. I tried these two ways, but ..

Scanner only reads first word instead of line

In my current program one method asks the user to enter the description of a product as a String input. However, when I later attempt to print out this information, only the first word of the String s..

What is the purpose of the single underscore "_" variable in Python?

What is the meaning of _ after for in this code? if tbh.bag: n = 0 for _ in tbh.bag.atom_set(): n += 1 ..

Streaming video from Android camera to server

I've seen plenty of info about how to stream video from the server to an android device, but not much about the other way, ala Qik. Could someone point me in the right direction here, or give me some..

How to assign Php variable value to Javascript variable?

Possible Duplicate: What's the best way to pass a PHP variable to Javascript? I am using the following code: <script type="text/javascript"> <?php $ctnme = $_SERVER['REQUEST_URI..

comparing two strings in SQL Server

Is there any way to compare two strings in SQL Server 2008 stored procedure like below? int returnval = STRCMP(str1, str2) returns 0 if the strings are the same returns -1 if the first argument is..

Check whether an input string contains a number in javascript

My end goal is to validate an input field. The input may be either alphabetic or numeric...

Get filename and path from URI from mediastore

I have an onActivityResult returning from an mediastore image selection which I can get a URI for an image using the following: Uri selectedImage = data.getData(); Converting this to a string gives..

Modifying a file inside a jar

I would like to modify a file inside my jar. Is it possible to do this without extracting and re jarring, from within my application? File i want to modify are configuration files, mostly xml based. ..

How do I convert Int/Decimal to float in C#?

How does one convert from an int or a decimal to a float in C#? I need to use a float for a third-party control, but I don't use them in my code, and I'm not sure how to end up with a float...

Change Timezone in Lumen or Laravel 5

I am using Lumen framework. How can I change Timezone to Europe/Paris CEST? I added a varaible in my .env file: APP_TIMEZONE=Europe/Paris But this doesnt work. What is the right way to update time..

Android ListView not refreshing after notifyDataSetChanged

My ListFragment code public class ItemFragment extends ListFragment { private DatabaseHandler dbHelper; private static final String TITLE = "Items"; private static final String LOG_TAG ..

Bootstrap visible and hidden classes not working properly

I tried to use the Bootstrap visible and hidden classes to create content only visible on mobile/desktop. I noticed the classes weren't working properly (and I have noticed a lot of people had this pr..

Grant Select on a view not base table when base table is in a different database

I have a view which is selecting rows from a table in a different database. I'd like to grant select access to the view, but not direct access to the base table. The view has a where clause restrict..

Gradle sync failed: failed to find Build Tools revision 24.0.0 rc1

As of today I've been running into an error setting up new projects in Android Studio. Right after creating a blank project the log mentions "Gradle sync failed: failed to find Build Tools revision 2..

SQL Server ORDER BY date and nulls last

I am trying to order by date. I want the most recent dates coming in first. That's easy enough, but there are many records that are null and those come before any records that have a date. I have tri..

Can I have multiple primary keys in a single table?

Can I have multiple primary keys in a single table?..

Calculating time difference in Milliseconds

I am making a call to a method by passing ipAddress and it will return back the location of ipAddress like Country, City, etc etc. So I was trying to see how much time it is taking for each call. So I..

Maintain/Save/Restore scroll position when returning to a ListView

I have a long ListView that the user can scroll around before returning to the previous screen. When the user opens this ListView again, I want the list to be scrolled to the same point that it was pr..

What's the difference between process.cwd() vs __dirname?

What's the difference between console.log(process.cwd()) and console.log(__dirname); I've seen both used in similar contexts...

C++ Cout & Cin & System "Ambiguous"

I was just programming in c++, when all of a sudden all the "cout"s and "cin"s were errors and "Ambiguous". Including System. I don't know why this happened. Everything was fine, I was coding the sam..

Spark java.lang.OutOfMemoryError: Java heap space

My cluster: 1 master, 11 slaves, each node has 6 GB memory. My settings: spark.executor.memory=4g, Dspark.akka.frameSize=512 Here is the problem: First, I read some data (2.19 GB) from HDFS to RD..

Convert JSONObject to Map

I have a JSONObject with some attributes that I want to convert into a Map<String, Object> Is there something that I can use from the or ObjectMapper?..

How to trim a file extension from a String in JavaScript?

For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let's assume the file name only contains [a-zA-Z0-9-_] to simplify.). I saw x.substring(0, ..

Connecting to Postgresql in a docker container from outside

I have Postgresql on a server in a docker container. How can I connect to it from the outside, that is, from my local computer? What setting should I apply to allow that?..

SyntaxError: import declarations may only appear at top level of a module

I am trying to use a plugin called "Simplebar" found on GitHub, GitHub SimpleBar but after downloading the scripts and looking at the simple.js script, it looks like it has an error "SyntaxError: impo..

AttributeError: 'DataFrame' object has no attribute

I keep getting different attribute errors when trying to run this file in ipython...beginner with pandas so maybe I'm missing something Code: from pandas import Series, DataFrame import pandas as p..

How to get back Lost phpMyAdmin Password, XAMPP

I have a local host running on XAMPP on a Mac. At some point I set a password in phpMyAdmin which I've ow forgotten. Can anyone help me get back into phpMyAdmin? I've followed a ton of tutorials but t..

TypeScript error TS1005: ';' expected (II)

First of all, I've already seen the other posts about error TS1005. Same error code, but totally different. A simple let x: number; will generate the error TS1005 during compilation. It's not about a..

How to check task status in Celery?

How does one check whether a task is running in celery (specifically, I'm using celery-django)? I've read the documentation, and I've googled, but I can't see a call like: my_example_task.state() ==..

in python how do I convert a single digit number into a double digits string?

So say i have a = 5 i want to print it as a string '05'..

Native query with named parameter fails with "Not all named parameters have been set"

I want to execute a simple native query, but it does not work: @Autowired private EntityManager em; Query q = em.createNativeQuery("SELECT count(*) FROM mytable where username = :username"); em.setP..

Checking host availability by using ping in bash scripts

I want to write a script, that would keep checking if any of the devices in network, that should be online all day long, are really online. I tried to use ping, but if [ "`ping -c 1 some_ip_here`" ] ..

PHP page redirect

Can PHP make a redirect call after executing a function? I am creating a function on the completion of which I want it to redirect to a file located in the same root folder. Can it be done? if (.....

Linq Query Group By and Selecting First Items

I have a String array kinda like this: // icon, category, tool String[,] subButtonData = new String[,] { {"graphics/gui/brushsizeplus_icon", "Draw", "DrawBrushPlus"}, {"graphics/gui/brushsize..

Removing the textarea border in HTML

I'm working with the textarea element in HTML and want to remove the border of the box. I also want to align the text in the bottom of my textarea...

Resize jqGrid when browser is resized?

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

Find an element by class name, from a known parent element

I want to find an element by class name. I know it will appear in a particular parent div, so rather than search the entire dom, I'd like to search only the particular div. I am trying this, but does ..

ModelState.AddModelError - How can I add an error that isn't for a property?

I am checking my database in Create(FooViewModel fvm){...} to see if the fvm.prop1 and fvm.prop2 already exist in that combination; if so, I want to add an error to the modelstate, then return the who..

Refused to load the script because it violates the following Content Security Policy directive

When I tried to deploy my app onto devices with Android system above 5.0.0 (Lollipop), I kept getting these kind of error messages: 07-03 18:39:21.621: D/SystemWebChromeClient(9132): file:///android_..

How to list files in an android directory?

Here's my code so far: String path = Environment.getExternalStorageDirectory().toString()+"/Pictures"; AssetManager mgr = getAssets(); try { String list[] = mgr.list(pa..

how to drop database in sqlite?

I'm using SQLite in android. I want to drop the database. For example: mysql- drop database dbname How do I implement this code in SQLite? ..

How do we count rows using older versions of Hibernate (~2009)?

For example, if we have a table Books, how would we count total number of book records with hibernate?..

Understanding .get() method in Python

sentence = "The quick brown fox jumped over the lazy dog." characters = {} for character in sentence: characters[character] = characters.get(character, 0) + 1 print(characters) I don't unders..

Replacing blank values (white space) with NaN in pandas

I want to find all values in a Pandas dataframe that contain whitespace (any arbitrary amount) and replace those values with NaNs. Any ideas how this can be improved? Basically I want to turn this: ..

error: the details of the application error from being viewed remotely

I have 2 login pages: Login.aspx-for customer login and xlogin.aspx for admin login i just uploaded my project to the server and all application pages works great but when i log in the admin

How to destroy Fragment?

I have one Activity. The Activity has two Fragments. Fragment A is Menu. Fragment B is Detail. I try to Make other Fragment C in Fragment B, so, There are 3 Fragment in the Activity. And I try to Rep..

How can I reduce the waiting (ttfb) time

I have a query which involves getting a list of user from a table in sorted order based on at what time it was created. I got the following timing diagram from the chrome developer tools. You can s..

Creating a PDF from a RDLC Report in the Background

I am running a month-end process and want to have it automatically create some of the reports that need to be created at that time. I am using rdlc reports. Is there a way to automatically create a PD..

How to Ignore "Duplicate Key" error in T-SQL (SQL Server)

I have a transaction that contains multiple SQL Statements (INSERT, UPDATE and/or DELETES). When executing, I want to ignore Duplicate Error statements and continue onto the next statement. What's the..

Bulk insert with SQLAlchemy ORM

Is there any way to get SQLAlchemy to do a bulk insert rather than inserting each individual object. i.e., doing: INSERT INTO `foo` (`bar`) VALUES (1), (2), (3) rather than: INSERT INTO `foo` (`b..

How to handle screen orientation change when progress dialog and background thread active?

My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler. This all works fine, except when screen orientation..

javascript how to create a validation error message without using alert

I am looking to make a simple form validation error message that displays under the username field. I cannot seem to figure it out. <form name ="myform" onsubmit="validation()"> Username..


Which of these queries is the faster? NOT EXISTS: SELECT ProductID, ProductName FROM Northwind..Products p WHERE NOT EXISTS ( SELECT 1 FROM Northwind..[Order Details] od WHERE p.Produ..

How to center a View inside of an Android Layout?

I want to put a layout in the center of the screen. ..

How can I escape square brackets in a LIKE clause?

I am trying to filter items with a stored procedure using like. The column is a varchar(15). The items I am trying to filter have square brackets in the name. For example: WC[R]S123456. If I do a L..

What is a deadlock?

When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My questions to the community are: What is a deadlock? How do you detect them? Do you handle..

In Java, how to find if first character in a string is upper case without regex

In Java, find if the first character in a string is upper case without using regular expressions...

How to create/make rounded corner buttons in WPF?

I need to create a rounded corner glossy button in WPF. Can anyone please explain me what steps are needed?..

Importing variables from another file?

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

pop/remove items out of a python tuple

I am not sure if I can make myself clear but will try. I have a tuple in python which I go through as follows (see code below). While going through it, I maintain a counter (let's call it 'n') and 'p..

The program can't start because libgcc_s_dw2-1.dll is missing

I have created a simple program in C++ with Code::Blocks. If I run it from Code::Blocks, it works correctly; but if I run it by doubleclicking on the executable file, a window pops up with this messa..

Handling JSON Post Request in Go

So I have the following, which seems incredibly hacky, and I've been thinking to myself that Go has better designed libraries than this, but I can't find an example of Go handling a POST request of JS..

Remove last 3 characters of string or number in javascript

I'm trying to remove last 3 zeroes 1437203995000 How do i this in javascript. Im generating the numbers from new date() function..

How to set a cron job to run every 3 hours

Is this the correct way for setting a cron job to run every 3 hours? After setting it this way, cron is executing the command every minute. ..

Creating virtual directories in IIS express

Is there any way to create a virtual directory in IIS express? I know that Cassini can't do this and it would be nice to be able to do this without using a full version of IIS. I've got it so far tha..

Simple way to encode a string according to a password?

Does Python have a built-in, simple way of encoding/decoding strings using a password? Something like this: >>> encode('John Doe', password = 'mypass') 'sjkl28cn2sx0' >>> decode('s..

Convert .cer certificate to .jks

I need to convert a .cer file to a .jks file. I saw a few questions about it, but haven't seen a solution to what I need. I don't need it in order to add it to my local certificates, but as a file to..

How do I convert a javascript object array to a string array of the object attribute I want?

Possible Duplicate: Accessing properties of an array of objects Given: [{ 'id':1, 'name':'john' },{ 'id':2, 'name':'jane' }........,{ 'id':2000, 'name':'zack' }] W..

Is there a better jQuery solution to this.form.submit();?

I want to trigger the submit event of the form the current element is in. A method I know works sometimes is: this.form.submit(); I'm wondering if there is a better solution, possibly using jQuery,..

how do I query sql for a latest record date for each user

I have a table that is a collection entries as to when a user was logged on. username, date, value -------------------------- brad, 1/2/2010, 1.1 fred, 1/3/2010, 1.0 bob, 8/4/2009..

How to use custom font in a project written in Android Studio

I was trying to use custom font in Android Studio as we did in Eclipse. But unfortunately could not figure out where to put the 'assets' folder!..

Is there any way to have a fieldset width only be as wide as the controls in them?

It seems that fieldset defaults to 100% width of its container. Is there any way that you can have the field set just be as big as the widest control inside the fieldset?..

How to get row from R data.frame

I have a data.frame with column headers. How can I get a specific row from the data.frame as a list (with the column headers as keys for the list)? Specifically, my data.frame is A B ..

How do I find what Java version Tomcat6 is using?

Is there a OS command to find what Java version Tomcat6 is using? I need to use a Perl (including system()) command. I using Linux. Ubuntu and CentOS Is there something like? tomcat6 version ..

Looping each row in datagridview

How to loop each row that readed? in my code, the row won't bind to next row because of the same productID, so the datagridview won't move to new row, it still in the same row and overwrite the price ..

Pandas - How to flatten a hierarchical index in columns

I have a data frame with a hierarchical index in axis 1 (columns) (from a groupby.agg operation): USAF WBAN year month day s_PC s_CL s_CD s_CNT tempf ..

How to split a file into equal parts, without breaking individual lines?

I was wondering if it was possible to split a file into equal parts (edit: = all equal except for the last), without breaking the line? Using the split command in Unix, lines may be broken in half. Is..

What's the difference between "static" and "static inline" function?

IMO both make the function to have a scope of the translation unit only. What's the difference between "static" and "static inline" function? Why should inline be put in a header file, not in .c fil..

Java and SQLite

I'm attracted to the neatness that a single file database provides. What driver/connector library is out there to connect and use SQLite with Java. I've discovered a wrapper library,

HTML Entity Decode

How do I encode and decode HTML entities using JavaScript or JQuery? var varTitle = "Chris&apos; corner"; I want it to be: var varTitle = "Chris' corner"; ..

unable to install pg gem

I tried using gem install pg but it doesn't seem to work. gem install pg gives this error Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERRO..

Read next word in java

I have a text file that has following content: ac und accipio annehmen ad zu adeo hinzugehen ... I read the text file and iterate through the lines: Scanner sc = new Scanner(new File("translate.tx..

What is the difference between Python and IPython?

What exactly is the difference between Python and IPython? If I write code in Python, will it run in IPython as is or does it need to be modified? I know IPython is supposed to be an interactive she..

how to implement a pop up dialog box in iOS

After a calculation, I want to display a pop up or alert box conveying a message to the user. Does anyone know where I can find more information about this?..

How to get different colored lines for different plots in a single figure?

I am using matplotlib to create the plots. I have to identify each plot with a different color which should be automatically generated by Python. Can you please give me a method to put different colo..

complex if statement in python

I need to realize a complex if-elif-else statement in Python but I don't get it working. The elif line I need has to check a variable for this conditions: 80, 443 or 1024-65535 inclusive I tried ..

Regular expression for not allowing spaces in the input field

I have a username field in my form. I want to not allow spaces anywhere in the string. I have used this regex: var regexp = /^\S/; This works for me if there are spaces between the characters. That..

Find elements inside forms and iframe using Java and Selenium WebDriver

I'm trying to access elements that are present under <form> <iFrame> <form> elements </form> </iFrame> </form>. Could you help me on accessing these 'elements', wh..

Java double.MAX_VALUE?

For my assignment I have to create a Gas Meter System for a Gas company to allow employees to create new costumer accounts and amend data such as name and unit costs along with taking(depositing) mone..

Why does writeObject throw and how do I fix it?

I have this exception and I don't understand why it would be thrown or, how I should handle it. try { os.writeObject(element); } catch (IOException e) { e.printStackTrace(); } Where elemen..

Can I call a constructor from another constructor (do constructor chaining) in C++?

As a C# developer I'm used to running through constructors: class Test { public Test() { DoSomething(); } public Test(int count) : this() { DoSomethingWithCount(count);..

Copy map values to vector in STL

Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions to their single element counterparts. I currently wish to copy all the va..

Python one-line "for" expression

I'm not sure if I need a lambda, or something else. But still, I need the following: I have an array = [1,2,3,4,5]. I need to put this array, for instance, into another array. But write it all in one..

Format / Suppress Scientific Notation from Python Pandas Aggregation Results

How can one modify the format for the output from a groupby operation in pandas that produces scientific notation for very large numbers? I know how to do string formatting in python but I'm at a lo..

Web-scraping JavaScript page with Python

I'm trying to develop a simple web scraper. I want to extract text without the HTML code. In fact, I achieve this goal, but I have seen that in some pages where JavaScript is loaded I didn't obtain go..

Making a Bootstrap table column fit to content

I'm using Bootstrap, and drawing a table. The rightmost column has a button in it, and I want it to drop down to the minimum size it needs to fit said button. _x000D_ _x000D_ <link href="https://m..

Unable to add window -- token null is not valid; is your activity running?

i want to show a custom popup menu when user click on a floating icon the float icon create with an service and i have no activity this is my floating icon code public class copy_actions_service ex..

Insert HTML into view from AngularJS controller

Is it possible to create an HTML fragment in an AngularJS controller and have this HTML shown in the view? This comes from a requirement to turn an inconsistent JSON blob into a nested list of id: va..

Difference between clean, gradlew clean

What is the difference between the following statements when issued from a Android Studio Project's terminal : Android_Studio_Project_Path: ./gradlew clean Android_Studio_Project_Path: ./gradlew clea..

Extract substring in Bash

Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them into a variable. So to emphasize the point, I have a filename with x number of characters th..

Position a div container on the right side

I want to develop some kind of utility bar. I can position each element in this bar side by side using float:left; But I want the second element to be positioned at the very right of the bar. This is..

Align vertically using CSS 3

With CSS 3, are there any way to vertically align an block element? Do you have an example? Thank you...

Extracting extension from filename in Python

Is there a function to extract the extension from a filename?..

Can I concatenate multiple MySQL rows into one field?

Using MySQL, I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; My Output: shopping fishing coding but instead I just want 1 row, 1 col: Expected Output: shoppin..

How to write a basic swap function in Java

I am new to java. How to write the java equivalent of the following C code. void Swap(int *p, int *q) { int temp; temp = *p; *p = *q; *q = temp; } ..

How to change port number in vue-cli project

How to change Port number in Vue-cli project so that it run's on another port instead of 8080...

Python: 'ModuleNotFoundError' when trying to import module from imported package

I'm using Python 3.7.1 on macOS Mojave Version 10.14.1 This is my directory structure: man/ Mans/ MansTest/ SoftLib/ ..

Python conditional assignment operator

Does a Python equivalent to the Ruby ||= operator ("set the variable if the variable is not set") exist? Example in Ruby : variable_not_set ||= 'bla bla' variable_not_set == 'bla bla' variable_s..

Convert JSON to Map

What is the best way to convert a JSON code as this: { "data" : { "field1" : "value1", "field2" : "value2" } } in a Java Map in which one the keys are (field1, field..

python max function using 'key' and lambda expression

I come from OOP background and trying to learn python. I am using the max function which uses a lambda expression to return the instance of type Player having maximum totalScore among the list players..

WSDL vs REST Pros and Cons

Related: Why would one use REST instead of Web services? When deciding whether to implement a web service using SOAP or REST (by which I mean HTTP/XML in a RESTful manner) what should I be aware..

coercing to Unicode: need string or buffer, NoneType found when rendering in django admin

I have this error since a long time but can't figure it out : Caught TypeError while rendering: coercing to Unicode: need string or buffer, NoneType found It happens in admin when I try to add or mo..

javascript function wait until another function to finish

I have two javascript functions that are called from android. After long debug sessions finally I realized that the problem is arising from the fact that second function is getting called before first..

jQuery Change event on an <input> element - any way to retain previous value?

I've been searching around this morning and I'm not finding any simple solutions... basically, I want to capture a change in an input element, but also know the previous value. Here's a change event..

In PowerShell, how can I test if a variable holds a numeric value?

In PowerShell, how can I test if a variable holds a numeric value? Currently, I'm trying to do it like this, but it always seems to return false. add-type -Language CSharpVersion3 @' public clas..

Connecting to via command line

I am in the process of writing an application that sends mail via an valid GMail user ID and password. I just wanted to simulate the SMTP connection on my Windows XP command line, and when I telnet s..

How to make my layout able to scroll down?

I can not scroll down the screen to view the data in the "Replied By:" section. How can I make my layout scrollable? ..

How to make an executable JAR file?

I have a program which consists of two simple Java Swing files. How do I make an executable JAR file for my program?..

creating a random number using MYSQL

I would like to know is there a way to select randomly generated number between 100 and 500 along with a select query. Eg: SELECT name, address, random_number FROM users I dont have to store this n..

What is the equivalent of bigint in C#?

What am I supposed to use when handling a value in C#, which is bigint for an SQL Server database?..

Change text color with Javascript?

I want to change the color of a title when a button is clicked. This is my code, but it's not working and I can't figure out why not... <div id="about">About Snakelane</div> <..

How can I center <ul> <li> into div

How can I center an unordered list of <li> into a fixed-width div? _x000D_ _x000D_ <table width="100%">_x000D_ <tbody>_x000D_ <tr>_x000D_ <td width="41%"><img..

Get current value when change select option - Angular2

I'm writing an angular2 component and am facing this problem. Description: I want to push an option value in select selector to its handler when the (change) event is triggered. Such as the below temp..

Can a JSON value contain a multiline string

I am writing a JSON file which would be read by a Java program. The fragment is as follows... { "testCases" : { "case.1" : { "scenario" : "this the case 1.", "result" : "this ..

What size should apple-touch-icon.png be for iPad and iPhone?

Are Apple touch icons bigger than 60x60 supported, and if so, what dimensions should I use for the iPad and iPhone?..

Converting a pointer into an integer

I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itsel..

How to call a PHP file from HTML or Javascript

I've looked around for a long while now and I can't find anywhere that answers this seemingly basic question. I don't care if the page reloads or displays the results immediately; I just want to have ..

How to split a string content into an array of strings in PowerShell?

I have a string that has email addresses separated by semi-colon: $address = ";;" How can I split this into an array of strings that would result as the following..

What is the most efficient way to check if a value exists in a NumPy array?

I have a very large NumPy array 1 40 3 4 50 4 5 60 7 5 49 6 6 70 8 8 80 9 8 72 1 9 90 7 .... I want to check to see if a value exists in the 1st column of the array. I've got a bunch of homegrown..

Chrome & Safari Error::Not allowed to load local resource: file:///D:/CSS/Style.css

When I access my aspx page in chrome or safari it shows this error in console Not allowed to load local resource: file:///D:/CSS/Style.css Everything works fine in IE and FF. I use an external ..

How can I check if an element exists in the visible DOM?

How do you test an element for existence without the use of the getElementById method? I have set up a live demo for reference. I will also print the code on here as well: <!DOCTYPE html> <..

How to define a List bean in Spring?

I'm using Spring to define stages in my application. It's configured that the necessary class (here called Configurator) is injected with the stages. Now I need the List of Stages in another class, na..

How to make the main content div fill height of screen with css

So I have a webpage with a header, mainbody, and footer. I want the mainbody to fill 100% of the page (fill 100% in between footer and header) My footer is position absolute with bottom: 0. Everytime ..

How to select some rows with specific rownames from a dataframe?

I have a data frame with several rows. I want to select some rows with specific rownames (such as stu2,stu3,stu5,stu9) from this dataframe. The input example dataframe is as follows: attr1 at..

Return the most recent record from ElasticSearch index

I would like to return the most recent record (top 1) from ElasticSearch index similar to the sql query below; SELECT TOP 1 Id, name, title FROM MyTable ORDER BY Date DESC; Can this be done?..

SQL Server : converting varchar to INT

I am stuck on converting a varchar column UserID to INT. I know, please don't ask why this UserID column was not created as INT initially, long story. So I tried this, but it doesn't work. and give m..

How to debug stored procedures with print statements?

I am trying to debug stored procedures in SQL Server Management Studio 2008. I want to insert some print statements to test some IF-statements that I know are wrong. In order to do debugging, I tried..

What is a good regular expression to match a URL?

Currently I have an input box which will detect the URL and parse the data. So right now, I am using: var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+) (?::(\d+))?(?:\/([^?#]*))?(?..

The type List is not generic; it cannot be parameterized with arguments [HTTPClient]

import java.awt.List; import java.awt.image.BufferedImage; import; import; import; import; import java.util...

How do I simulate placeholder functionality on input date field?

It's impossible to use placeholder on date fields but I really need it. I want two date inputs with texts "From" and "To" on each one as placeholders...

How to convert int to QString?

Is there a QString function which takes an int and outputs it as a QString?..

Python: printing a file to stdout

I've searched and I can only find questions about the other way around: writing stdin to a file :) Is there a quick and easy way to dump the contents of a file to stdout?..

What's the difference between .so, .la and .a library files?

I know an .so file is a kind of dynamic library (lots of threads can share such libraries so there is no need to have more than one copy of it in memory). But what is the difference between .a and .la..

phpexcel to download

hello i am new to phpexcel, and i was wondering if there is some way send the excel i have created to the clients download without saving it on my server or to delete it right after he downloads it ..

sql primary key and index

Say I have an ID row (int) in a database set as the primary key. If I query off the ID often do I also need to index it? Or does it being a primary key mean it's already indexed? Reason I ask is beca..

Apply function to each element of a list

How do I apply a function to the list of variable inputs? For e.g. the filter function returns true values but not the actual output of the function. from string import upper mylis=['this is test', '..

How to break a while loop from an if condition inside the while loop?

I want to break a while loop of the format below which has an if statement. If that if statement is true, the while loop also must break. Any help would be appreciated. while(something.hasnext()) { ..

How to set date format in HTML date input tag?

I am wondering whether it is possible to set the date format in the html <input type="date"></input> tag... Currently it is yyyy-mm-dd, while I need it in the dd-mm-yyyy format...

How to fix ReferenceError: primordials is not defined in node

I have installed node modules by npm install, then I tried to do gulp sass-watch in command prompt. After that I got the below response. [18:18:32] Requiring external module babel-register fs.js:27 c..

How can the default node version be set using NVM?

I have installed nvm (ubuntu with zsh shell) with two node version: v6.11.5 and v9.0.0 and the default version in nvm is the v9.0.0 Every time I need to change the node version $ nvm list ..

In CSS what is the difference between "." and "#" when declaring a set of styles?

What is the difference between # and . when declaring a set of styles for an element and what are the semantics that come into play when deciding which one to use?..

FIFO class in Java

I want to implement FIFO through a class in Java. Does such a class already exist? If not, how can I implement my own? NOTE I found a class here

How can I copy a Python string?

I do this: a = 'hello' And now I just want an independent copy of a: import copy b = str(a) c = a[:] d = a + '' e = copy.copy(a) map( id, [ a,b,c,d,e ] ) Out[3]: [4365576160, 4365576160, 4365..

Is putting a div inside an anchor ever correct?

I've heard that putting a block element inside a inline element is a HTML sin: <a href=""><div> What we have here is a problem. You see, an anchor element is an in..

Changing the interval of SetInterval while it's running

I have written a javascript function that uses setInterval to manipulate a string every tenth of a second for a certain number of iterations. function timer() { var section = document.getElementB..

How different is Scrum practice from Agile Practice?

Mostly people say Scrum and Agile interchangeably but what is the difference between Scrum Practice as compared to Agile Practice ?..

TestNG ERROR Cannot find class in classpath

I'm trying to run testng via command line and I have following things in classpath: testng jar, jar of compiled test case file, and other required jars. testng.xml points to appropriate class in the..

PHP array value passes to next row

I have an array building multiple instances of the following fields: <div class="checkbox_vm"> <input type="hidden" name="fk_row[]" value="<?php echo $i; ?>"> <input type..

How to copy from CSV file to PostgreSQL table with headers in CSV file?

I want to copy a CSV file to a Postgres table. There are about 100 columns in this table, so I do not want to rewrite them if I don't have to. I am using the \copy table from 'table.csv' delimiter ',..

How should I do integer division in Perl?

What is a good way to always do integer division in Perl? For example, I want: real / int = int int / real = int int / int = int ..

How to split CSV files as per number of rows specified?

I've CSV file (around 10,000 rows ; each row having 300 columns) stored on LINUX server. I want to break this CSV file into 500 CSV files of 20 records each. (Each having same CSV header as present i..

Is there any publicly accessible JSON data source to test with real world data?

I'm working on a JavaScript dynamically loaded tree view user control. I'd like to test it with real world data. Does anybody know any public service with an API that provides access to hierarchical ..

Difference between x86, x32, and x64 architectures?

Please explain the difference between x86, x32 and x64? Its a bit confusing when it comes to x86 and x32 because most of the time 32-bit programs run on x86... ..

JavaScript: remove event listener

I'm trying to remove an event listener inside of a listener definition: canvas.addEventListener('click', function(event) { click++; if(click == 50) { // remove this event listener her..

Check if multiple strings exist in another string

How can I check if any of the strings in an array exists in another string? Like: a = ['a', 'b', 'c'] str = "a123" if a in str: print "some of the strings found in str" else: print "no strings f..

How to convert a GUID to a string in C#?

I'm new to C#. I know in, i can do this: Dim guid as string = System.Guid.NewGuid.ToString In C#, I'm trying to do String guid = System.Guid.NewGuid().ToString; but i get an "Cannot co..

Convert hex string to int in Python

How do I convert a hex string to an int in Python? I may have it as "0xffff" or just "ffff"...

Convert any object to a byte[]

I am writing a prototype TCP connection and I am having some trouble homogenizing the data to be sent. At the moment, I am sending nothing but strings, but in the future we want to be able to send an..

jQuery: Best practice to populate drop down?

The example I see posted all of the time seems like it's suboptimal, because it involves concatenating strings, which seems so not jQuery. It usually looks like this: $.getJSON("/Admin/GetFolderList/..

The representation of if-elseif-else in EL using JSF

The following JSF code contains two separate <c:if></c:if>. Let's look at it. <?xml version='1.0' encoding='UTF-8' ?> <html xmlns="" xmlns:h="ht..

Read input from console in Ruby?

I want to write a simple A+B program in ruby, but I have no idea how to work with the console...

"Android library projects cannot be launched"?

Now I am totally confused by this error message: Android library projects cannot be launched. I carefully checked the build path and library, everything seems "OK", and there is no error on Problems..

How do I convert a Python 3 byte-string variable into a regular string?

I have read in an XML email attachment with bytes_string=part.get_payload(decode=False) The payload comes in as a byte string, as my variable name suggests. I am trying to use the recommended Pyth..

Deleting a file in VBA

Using VBA, how can I: test whether a file exists, and if so, delete it? ..

How can I clear the content of a file?

I need to clear the contents of a particular file every time the applications starts. How do I do it?..

Change bundle identifier in Xcode when submitting my first app in IOS

I'm trying to submit my first app in iOS. I have entered iOS Provisioning Portal and I am about to create an app ID. Lets say that I name my bundle identifier: com.mycompany.appdemo Then going to..

Set height 100% on absolute div

I am facing a problem with overlaying a 100% height div. I could use position fixed to solve the cover, but that's not really what I want because you should be able to scroll down on the 'cover' > so ..

CSS center display inline block?

I have a working code here: (you might need to make the result window bigger to see the align center effect) Question The code works fine but I don't like to have display:..

How to delete a certain row from mysql table with same column values?

I have a problem with my queries in MySQL. My table has 4 columns and it looks something like this: id_users id_product quantity date 1 2 1 2013 1 ..

Difference between opening a file in binary vs text

I've done some stuff like: FILE* a = fopen("a.txt", "w"); const char* data = "abc123"; fwrite(data, 6, 1, a); fclose(a); and then in the generated text file, it says "abc123" just like expected. Bu..

Chrome blocks different origin requests

When script tries to access a frame from a different origin Chrome blocks it and throws exception as "Uncaught SecurityError: Blocked a frame with origin 'provider domain' from accessing a frame ..

PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

While running an app on the virtual device (AVD) created on Android studio (in Windows 10), I am getting an error and panic. Emulator: PANIC: Cannot find AVD system path. Please define ANDROID_SDK_RO..

What Java FTP client library should I use?

Since I received no positives answers to my last question. I will try to write a Java FTP upload applet myself. My question is: "Can you recommend a Java FTP client library for me to use?" I want it..

Uncaught TypeError: data.push is not a function

I am trying to push data.push({"country": "IN"}); as new id and value to a json string. but it gives the following error Uncaught TypeError: data.push is not a function data{"name":"ananta","age..

SOAP PHP fault parsing WSDL: failed to load external entity?

I'm trying to run a web service using PHP & SOAP, but all I'm getting so far is this: (SoapFault)[2] message which states: 'SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/MyReg..

background-size in shorthand background property (CSS3)

I'm trying to mix background-image and background-size properties in a shorthanded background property. Based on W3C documentation background-size should come after background-position property separa..

Inserting a text where cursor is using Javascript/jquery

I have a page with a lot of textboxes. When someone clicks a link, i want a word or two to be inserted where the cursor is, or appended to the textbox which has the focus. For example, if the cursor..

Custom designing EditText

I have custom designed EditText search_page.xml <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:p..

Combine two or more columns in a dataframe into a new column with a new name

For example if I have this: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) n s b 1 2 aa TRUE 2 3 bb FALSE 3 5 cc TRUE Then how do I combine th..

Example on ToggleButton

I am developing an application using a toggle button, I entered 1 or 0 in EditText. When button is clicked, the toggle button has to change if I enter 1 the toggle button shows TOGGLE ON, if I enter 0..

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 enter special characters like "&" in oracle database?

I want to insert special character & in my insert statement. My insert is: INSERT INTO STUDENT(name, class_id) VALUES ('Samantha', 'Java_22 & Oracle_14'); If I try to run this query I am ge..

What does the "~" (tilde/squiggle/twiddle) CSS selector mean?

Searching for the ~ character isn't easy. I was looking over some CSS and found this .check:checked ~ .content { } What does it mean?..

VSCode Change Default Terminal

I am using Visual Studio Code on my Windows 10 PC. I want to change my default terminal from Windows PowerShell to Bash on Ubuntu (on Windows). How can I do that?..

Hashset vs Treeset

I've always loved trees, that nice O(n*log(n)) and the tidiness of them. However, every software engineer I've ever known has asked me pointedly why I would use a TreeSet. From a CS background, I don'..

Could not load file or assembly 'System.Data.SQLite'

I've installed ELMAH 1.1 .Net 3.5 x64 in my ASP.NET project and now I'm getting this error (whenever I try to see any page): Could not load file or assembly 'System.Data.SQLite, Version=