Questions Tagged with #Memorystream

A memory stream is a kind of stream that has several methods to access and store data in memory.

Save and load MemoryStream to/from a file

I am serializing an structure into a MemoryStream and I want to save and load the serialized structure. So, How to Save a MemoryStream into a file and also load it back from file?..

Reading from memory stream to string

I am trying to write an object to an Xml string and take that string and save it to a DB. But first I need to get the string... private static readonly Encoding LocalEncoding = Encoding.UTF8; ..

How do you get a string from a MemoryStream?

If I am given a MemoryStream that I know has been populated with a String, how do I get a String back out?..

Attach a file from MemoryStream to a MailMessage in C#

I am writing a program to attach a file to email. Currently I am saving file using FileStream into disk, and then I use System.Net.Mail.MailMessage.Attachments.Add( new System.Net.Mail.Attachmen..

Serializing/deserializing with memory stream

I'm having an issue with serializing using memory stream. Here is my code: /// <summary> /// serializes the given object into memory stream /// </summary> /// <param name="objectType"&..

How to get a MemoryStream from a Stream in .NET?

I have the following constructor method which opens a MemoryStream from a file path: MemoryStream _ms; public MyClass(string filePath) { byte[] docBytes = File.ReadAllBytes(filePath); _ms = ..

Difference between java.lang.RuntimeException and java.lang.Exception

Someone please explain the difference between java.lang.RuntimeException and java.lang.Exception? How do I decide which one to extend if I create my own exception?..

What is a file with extension .a?

I downloaded this: And now I'm trying to use it inside my C program, but I don't know what to do with the generated .a files. What are they? I couldn't find ..

how to run a command at terminal from java program?

I need to run a command at terminal in Fedora 16 from a JAVA program. I tried using Runtime.getRuntime().exec("xterm"); but this just opens the terminal, i am unable to execute any command. I als..

ReactJS - How to use comments?

How can I use comments inside the render method in a React component? I have the following component: 'use strict'; var React = require('react'), Button = require('./button'), UnorderedList =..

&& (AND) and || (OR) in IF statements

I have the following code: if(!partialHits.get(req_nr).containsKey(z) || partialHits.get(req_nr).get(z) < tmpmap.get(z)){ partialHits.get(z).put(z, tmpmap.get(z)); } where partialHits ..

How to fix div on scroll

If you scroll down the page in the following URL, the 'share' div will lock onto the browser: I'm assuming they are applying a position: fixed; att..

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

Change language of Visual Studio 2017 RC

I have installed Visual Studio 2017 RC, and by default it set language to my system language (Polish) so I was trying to change it to EN but in Options > Environment > International Settings i have on..

How to ignore files/directories in TFS for avoiding them to go to central source repository?

Is it possible to set up files/folders to ignore on a per-project basis in TFS source control? For example, I've a website with an assets folder that I do not want to go in to source control. These a..

Can you use a trailing comma in a JSON object?

When manually generating a JSON object or array, it's often easier to leave a trailing comma on the last item in the object or array. For example, code to output from an array of strings might look l..

Under what circumstances can I call findViewById with an Options Menu / Action Bar item?

I am trying to obtain a handle on one of the views in the Action Bar. I have tried calling: findViewById( but this returns null unless I call it in the onOptionsItemSelected method. ..

How to start a background process in Python?

I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I ach..

Loop through each cell in a range of cells when given a Range object

Let's say I have the following code: Sub TestRangeLoop() Dim rng As Range Set rng = Range("A1:A6") ''//Insert code to loop through rng here End Sub I want to be able to iterate through..

C++ cast to derived class

How can i cast to a derived class? The below approaches all give the following error: Cannot convert from BaseType to DerivedType. No constructor could take the source type, or constructor overl..

What does Python's eval() do?

In the book that I am reading on Python, it keeps using the code eval(input('blah')) I read the documentation, and I understand it, but I still do not see how it changes the input() function. What..

How do I convert a byte array to Base64 in Java?

Okay, I know how to do it in C#. It's as simple as: Convert.ToBase64String(byte[]) and Convert.FromBase64String(string) to get byte[] back. How can I do this in Java?..

The activity must be exported or contain an intent-filter

when I tried to run my application its show the error below Error running Dashboard: The activity must be exported or contain an intent-filter How can I solve this error?..

How to amend a commit without changing commit message (reusing the previous one)?

Is there a way to amend a commit without vi (or your $EDITOR) popping up with the option to modify your commit message, but simply reusing the previous message?..

How to capitalize the first letter in a String in Ruby

The upcase method capitalizes the entire string, but I need to capitalize only the first letter. Also, I need to support several popular languages, like German and Russian. How do I do it?..

How do you create a UIImage View Programmatically - Swift

I'm trying to create a UIImage View programmatically, I have a new view and I tried doing this let imageName = "yourImage.png" yourview.backgroundColor = UIColor.colorWithPatternImage(UIImage(named:i..

Has Facebook sharer.php changed to no longer accept detailed parameters?

We have been opening a sharing popup (via with the URL like[title]=EXAMPLE&p[summary]=EXAMPLE&p[url]=EXAMPLE&p[images][..

How can I combine flexbox and vertical scroll in a full-height app?

I want to use a full-height app using flexbox. I found what I want using old flexbox layout module (display: box; and other things) in this link: CSS3 Flexbox full-height app and overflow This is a c..

How to find the Windows version from the PowerShell command line

How do I find which Windows version I'm using? I'm using PowerShell 2.0 and tried: PS C:\> ver The term 'ver' is not recognized as the name of a cmdlet, function, script file, or operable program..

Selecting non-blank cells in Excel with VBA

I'm just beginning to dive into VBA and I've hit a bit of a roadblock. I have a sheet with 50+ columns, 900+ rows of data. I need to reformat about 10 of those columns and stick them in a new workboo..

When do I need to use AtomicBoolean in Java?

How I can use AtomicBoolean and what is that class for?..

Javascript/jQuery: Set Values (Selection) in a multiple Select

I have a multiple select: <select name='strings' id="strings" multiple style="width:100px;"> <option value="Test">Test</option> <option value="Prof">Prof</option>..

Get HTML5 localStorage keys

I'm just wondering how to get all key values in localStorage. I have tried to retrieve the values with a simple JavaScript loop for (var i=1; i <= localStorage.length; i++) { alert(localSto..

How to retrieve a user environment variable in CMake (Windows)

I know how to retrieve a normal machine wide environment variable in CMAKE using $ENV{EnvironmentVariableName} but I can not retrieve a user specific environment variable. Is it possible and how?..

json_decode to array

I am trying to decode a JSON string into an array but i get the following error. Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\temp\asklaila.php on line 6 Here is..

Fastest way to convert Image to Byte array

I am making Remote Desktop sharing application in which I capture an image of the Desktop and Compress it and Send it to the receiver. To compress the image I need to convert it to a byte[]. Currentl..

Java ArrayList - Check if list is empty

How can I check if a list is empty? If so, the system has to give a message saying List is empty. If not, the system has to give a message saying List is not empty. Users can enter numbers, -1 to stop..

What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

I have a project in which I'd like to use some of the .NET 4.0 features but a core requirement is that I can use the System.Data.SQLite framework which is compiled against 2.X. I see mention of this b..

Displaying a message in iOS which has the same functionality as Toast in Android

I need to know if there is any method in iOS which behaves like Toast messages in Android. That is, I need to display a message which is dismissed automatically after few seconds. This is similar to ..

How to check if input date is equal to today's date?

I have a form input with an id of 'date_trans'. The format for that date input (which is validated server side) can be any of: dd/mm/yyyy dd-mm-yyyy yyyy-mm-dd yyyy/mm/dd However, before posting t..

How do I write a bash script to restart a process if it dies?

I have a python script that'll be checking a queue and performing an action on each item: # while True: check_queue() do_something() How do I write a bash script that will check i..

What are file descriptors, explained in simple terms?

What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it? Does a process ta..

How to remove package using Angular CLI?

Angular 6 has new CLI command ng add <package>. How can I remove the package using Angular CLI? UPDATE documentation ng add will use your package manager to download new dependencies and ..

Tooltips for cells in HTML table (no Javascript)

Is it possible to have tooltips for table cells with no JavaScript. Can't use it...

List of Stored Procedures/Functions Mysql Command Line

How can I see the list of the stored procedures or stored functions in mysql command line like show tables; or show databases; commands...

What is the simplest C# function to parse a JSON string into an object?

What is the simplest C# function to parse a JSON string into a object and display it (C# XAML WPF)? (for example object with 2 arrays - arrA and arrB) ..

Where to find the complete definition of off_t type?

I am sending file from client to server using TCP. To mark the end of the file I like to send file size before the actual data. So I use stat system call to find the size of the file. This is of type ..

What is "Advanced" SQL?

Looking at a job descriptions where "advanced SQL" is a requirement. I can write basic queries as well as anyone, and have worked with MySQL databases in a professional setting, but what would I be g..

How to add to an NSDictionary

I was using a NSMutableArray and realized that using a dictionary is a lot simpler for what I am trying to achieve. I want to save a key as a NSString and a value as an int in the dictionary. How is ..

Beginner Python: AttributeError: 'list' object has no attribute

The error says: AttributeError: 'list' object has no attribute 'cost' I am trying to get a simple profit calculation to work using the following class to handle a dictionary of bicycles: class Bi..

How do I make a WinForms app go Full Screen

I have a WinForms app that I am trying to make full screen (somewhat like what VS does in full screen mode). Currently I am setting FormBorderStyle to None and WindowState to Maximized which gives me..

JPG vs. JPEG image formats

I often use JPEG images, and I have noticed that there are two very similar file extensions: .jpg, which my mobile's camera and the Preview application use, and .jpeg, with which Image Capture saves t..

Using std::max_element on a vector<double>

I'm trying to use std::min_element and std::max_element to return the min and max elements in a vector of doubles. My compiler doesn't like how I'm currently trying to use them, and I don't understan..

CSS text-align not working

I have this css code here .navigation{ width:100%; background-color:#7a7a7a; font-size:18px; } .navigation ul { list-style-type: none; margin: 0; } .navigation li { float: l..

Why use sys.path.append(path) instead of sys.path.insert(1, path)?

Edit: based on a Ulf Rompe's comment, it is important you use "1" instead of "0", otherwise you will break sys.path. I have been doing python for quite a while now (over a year), and I am always conf..

How to merge two sorted arrays into a sorted array?

This was asked of me in an interview and this is the solution I provided: public static int[] merge(int[] a, int[] b) { int[] answer = new int[a.length + b.length]; int i = 0, j = 0, k = 0; ..

Changing default encoding of Python?

I have many "can't encode" and "can't decode" problems with Python when I run my applications from the console. But in the Eclipse PyDev IDE, the default character encoding is set to UTF-8, and I'm fi..

Cannot find name 'require' after upgrading to Angular4

I want to use Chart.js within my Angular project. In previous Angular2 versions, I have been doing this well by using a 'chart.loader.ts' which has: export const { Chart } = require('chart.js'); Th..

Match line break with regular expression

<li><a href="#">Animal and Plant Health Inspection Service Permits Provides information on the various permits that the Animal and Plant Health Inspection Service issues as well as onl..

How to send an email from JavaScript

I want my website to have the ability to send an email without refreshing the page. So I want to use Javascript. <form action="javascript:sendMail();" name="pmForm" id="pmForm" method="post"> E..


I have a table for storing coupons/discounts, and I want to use the coupon_code column as the primary key, which is a VARCHAR. My rationale is that, each coupon will have a unique code, and the only ..

Laravel Blade html image

My image file path is public/img/logo.png and my app.blade.php file path is resources/views/app.blade.php Inside of my app.blade.php file I use {{HTML::image('/img/stuvi-logo.png')}} to display an im..

Best way to check if column returns a null value (from database to .net application)

I have a table with a DateTime column the column can have NULL values Now I connect to the database using an ODBC connection and get the value into a DataTable in .net / c#. I am able to check it fo..

Haversine Formula in Python (Bearing and Distance between two GPS points)

Problem I would like to know how to get the distance and bearing between 2 GPS points. I have researched on the haversine formula. Someone told me that I could also find the bearing using the same da..

How to change value of object which is inside an array using JavaScript or jQuery?

The code below comes from jQuery UI Autocomplete: var projects = [ { value: "jquery", label: "jQuery", desc: "the write less, do more, JavaScript library", icon: "..

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

I am fairly new to coding in general and really new to Xcode (Swift). I understand that I need to register a nib or a class but I don't understand 'where or how?'. import UIKit class NotesListViewCo..

How to map an array of objects in React

I have an array of objects. I would like to map this array of objects. I know how to map an array, but can't figure out how to map an array of objects. Here is what I have done so far : The array ..

grid controls for ASP.NET MVC?

If you are using ASP.NET MVC how are you doing grid display? Rolled your own? Got a library from somewhere? These are some of the known grid display solutions I have found for ASP.NET MVC ASP.NET M..

System.Runtime.InteropServices.COMException (0x800A03EC)

Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs() method is working fine on Windows server 2003 and also on XP but not on Windows server 2008. I copied it as it is gave all Dll's and permissions ..

iloc giving 'IndexError: single positional indexer is out-of-bounds'

I am trying to encode some information to read into a Machine Learning model using the following import numpy as np import pandas as pd import matplotlib.pyplot as py Dataset = pd.read_csv('filenam..

Difference between INNER JOIN and LEFT SEMI JOIN

What is the difference between an INNER JOIN and LEFT SEMI JOIN? In the scenario below, why am I getting two different results? The INNER JOIN result set is a lot larger. Can someone explain? I am..

android get real path by Uri.getPath()

I'm trying to get image from gallery. Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Selec..

List files with certain extensions with ls and grep

I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else. So I thought I could just do this: ls | grep \.mp4$ | grep \.mp3$ | grep \.exe$ But no, as the f.. Date without time

How do you format the date time to just date? For example, this is what I retrieved from the database: 12/31/2008 12:00:00 AM, but I just want to show the date and no time...

Converting byte array to string in javascript

How do I convert a byte array into a string? I have found these functions that do the reverse: function string2Bin(s) { var b = new Array(); var last = s.length; for (var i = 0; i < ..

`getchar()` gives the same output as the input string

I am confused by a program mentioned in K&R that uses getchar(). It gives the same output as the input string: #include <stdio.h> main(){ int c; c = getchar(); while(c != EOF){..

How do I make a dotted/dashed line in Android?

I'm trying to make a dotted line. I'm using this right now for a solid line: LinearLayout divider = new LinearLayout( this ); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearL..

"Adaptive Server is unavailable or does not exist" error connecting to SQL Server from PHP

I'm attempting to connect to a SQL Server 2005 DB from my Mac using unixODBC and FreeTDS as I have outlined here. However, when I try to connect in to a different DB using the same setup, I get: Conn..

Import python package from local directory into interpreter

I'm developing/testing a package in my local directory. I want to import it in the interpreter (v2.5), but sys.path does not include the current directory. Right now I type in sys.path.insert(0,'.'). ..

SQLite equivalent to ISNULL(), NVL(), IFNULL() or COALESCE()

I'd like to avoid having many checks like the following in my code: myObj.someStringField = rdr.IsDBNull(someOrdinal) ? string.Empty : rdr.Ge..

How to throw RuntimeException ("cannot find symbol")

I'm trying to throw an exception in my code like this: throw RuntimeException(msg); But when I build in NetBeans I get this error: C:\ cannot find symbol symbol : method RuntimeExcept..

How to PUT a json object with an array using curl

I have a series of data to enter into database. The user interface to enter the data isn't good for bulk entry, so I'm trying to formulate a command line equivalent. When I examine the network reque..

How to solve "Could not establish trust relationship for the SSL/TLS secure channel with authority"

Really thought I had this issue fixed, but it was only disguised before. I have a WCF service hosted in IIS 7 using HTTPS. When I browse to this site in Internet Explorer, it works like a charm, thi..

convert strtotime to date time format in php

i need to convert strtotime to date btime format (from 1307595105 to 06/08/2011 09:51:45 PM PDT) in php Could you please give me an answer..

How can I pretty-print JSON using Go?

Does anyone know of a simple way to pretty-print JSON output in Go? The stock package does not seem to include functionality for this (EDIT: it does, see accepted..

How to add external fonts to android application

I was looking for some stylish fonts for my android application. but the problem is how can i make my android application supportable for external fonts. Thank you...

symfony2 twig path with parameter url creation

i got the following: <a href="{{ path('_be_activatecategory', {'id':, 'active': 1}) }}">Aktivieren</a> creates /backend/categories/activate/8/1 and then i got <a h..

Javascript decoding html entities

Possible Duplicate: How to decode HTML entities using jQuery? I want to convert this text: "&lt;p&gt;name&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:xx-small;"..

GZIPInputStream reading line by line

I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file ..

How do I install g++ for Fedora?

How do I install g++ for Fedora Linux? I have been searching the dnf command to install g++ but didn't find anything. How do I install it? I have already installed gcc..

Format date in a specific timezone

I'm using Moment.js to parse and format dates in my web app. As part of a JSON object, my backend server sends dates as a number of milliseconds from the UTC epoch (Unix offset). Parsing dates in a s..

Read data from SqlDataReader

I have a SQL Server 2008 database and I am working on it in the backend. I am working on SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { //how do I read ..


I am trying all the ways of creating react application. I have tried with maven and now i am trying with crate-react-app build system from Facebook Incubators. When i tried to run the command create-..

How do I float a div to the center?

I want to be able to center a div in the middle of a page but can't get it to work. I tried float: center; in css but it doesn't seem to work...

Environment.GetFolderPath(...CommonApplicationData) is still returning "C:\Documents and Settings\" on Vista

As I understand it, you're supposed to use the Environment.GetFolderPath method so you have OS independent code... Windows XP uses C:\Documents and Settings\. Windows Vista uses C:\ProgramData and C:..

What is the difference between BIT and TINYINT in MySQL?

In which cases would you use which? Is there much of a difference? Which I typically used by persistence engines to store booleans?..

Function overloading in Javascript - Best practices

What is the best way(s) to fake function overloading in Javascript? I know it is not possible to overload functions in Javascript as in other languages. If I needed a function with two uses foo(x) ..

Dividing two integers to produce a float result

Possible Duplicate: Why can't I return a double from two ints being divided My C++ program is truncating the output of my integer devision even when I try and place the output into a fl..

DIV table colspan: how?

How do I achieve colspan/rowspan behavior in tableless (e.g. div.table {display: table;} {display: table-row;} etc.) table?..

File is universal (three slices), but it does not contain a(n) ARMv7-s slice error for static libraries on iOS, anyway to bypass?

I upgraded Xcode version and when using external static libraries, I get this message: ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /file/location for architecture armv..

Bootstrap: Position of dropdown menu relative to navbar item

I have the following dropdown <label class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#"> Action <b class="caret"></b></label> <ul class="dropd..

Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js

With a downloaded and installed version of Visual Studio Code 1.2.1, and a 64bit version of node.exe msi placed in my working directory (I am assuming that is correct), how do we add node and npm comm..

Fastest way to check if string contains only digits

I know a few ways how to check this. regex,int.parse,tryparse,looping. can anyone tell me what is the fastest way to check? the need is to only CHECK no need to actually parse. this is not the same..

What is the difference between a web API and a web service?

Is there any difference between a web API and a web service ? Or are they one and the same ? ..

When doing a MERGE in Oracle SQL, how can I update rows that aren't matched in the SOURCE?

I have a main database and a report database, and I need to sync a table from main into report. However, when an item gets deleted in the main database, I only want to set an IsDeleted flag in the re..

How to scroll to bottom in a ScrollView on activity startup

I am displaying some data in a ScrollView. On activity startup (method onCreate) I fill the ScrollView with data and want to scroll to the bottom. I tried to use getScrollView().fullScroll(ScrollView..

How to copy static files to build directory with Webpack?

I'm trying to move from Gulp to Webpack. In Gulp I have task which copies all files and folders from /static/ folder to /build/ folder. How to do the same with Webpack? Do I need some plugin?..

Change the current directory from a Bash script

Is it possible to change current directory from a script? I want to create a utility for directory navigation in Bash. I have created a test script that looks like the following: #!/bin/bash cd /hom..

Execute curl command within a Python script

I am trying to execute a curl command within a python script. If I do it in the terminal, it looks like this: curl -X POST -d '{"nw_src": "", "nw_dst": "", "nw_proto": "ICMP",..

I want my android application to be only run in portrait mode?

I want my android application to be only run in portrait mode? How can I do that?..

How to check a string against null in java?

How can I check a string against null in java? I am using stringname.equalsignorecase(null) but it's not working...

'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository

I am not able to clone or push to a git repository at Bitbucket in Eclipse: It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error ke..

error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’

Wrong form: int &z = 12; Correct form: int y; int &r = y; Question: Why is the first code wrong? What is the "meaning" of the error in the title?..

Query based on multiple where clauses in Firebase

{ "movies": { "movie1": { "genre": "comedy", "name": "As good as it gets", "lead": "Jack Nicholson&qu..

How do I use setsockopt(SO_REUSEADDR)?

I am running my own http server on a raspberry pi. The problem is when I stop the program and restart it, the port is no longer available. Sometimes I get the same issue when receiving lots of request..

Data-frame Object has no Attribute

I know that this kind of question was asked before and I've checked all the answers and I have tried several times to find a solution but in vain. In fact I call a Dataframe using Pandas. I've upload..

There is no argument given that corresponds to the required formal parameter - .NET Error

I have been re-factoring one of my old MSSQL Connection helper library and I got the following error: Severity Code Description Project File Line Error CS7036 There is no argument given..

'Missing contentDescription attribute on image' in XML

I get an warning about [Accessibility]Missing contentDescription attribute on image in eclipse. This warning show at line 5 (declare ImageView) in XML code below. This not make any error when build a..

Render Content Dynamically from an array map function in React Native

I'm trying to get data from an array and using map function to render content. Look at **{this.lapsList()}** and the associated **lapsList()** function to understand what I'm trying to do. T..

Click event on select option element in chrome

I'm having a problem in Chrome with the following: var items = $("option", obj); items.each(function(){ $(this).click(function(){ // alert("test"); process($(this).html()); ..

Android - save/restore fragment state

I have an Activity in which I go through several fragments. In every fragment I have several views (EditText, ListView, Map, etc). How can I save the instance of the fragment that is shown at that mo..

How can I remove text within parentheses with a regex?

I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example: filename = "Exam..

How do you execute an arbitrary native command from a string?

I can express my need with the following scenario: Write a function that accepts a string to be run as a native command. It's not too far fetched of an idea: if you're interfacing with other command..

jQuery - Appending a div to body, the body is the object?

When I'm adding a div to body, it's returning the body as the object and then whenever I use that - it's obviously using body. Bad. Code:- var holdyDiv = $('body').append('div'); $(holdyDiv).attr('i..

Altering user-defined table types in SQL Server

How can I alter a user-defined table type in SQL Server ?..

Cleanest way to write retry logic?

Occasionally I have a need to retry an operation several times before giving up. My code is like: int retries = 3; while(true) { try { DoSomething(); break; // success! } catch { if(..

Environment variable in Jenkins Pipeline

Is there any environment variable available for getting the Jenkins Pipeline Title? I know we can use $JOB_NAME to get title for a freestyle job, but is there anything that can be used for getting P..

Using GZIP compression with Spring Boot/MVC/JavaConfig with RESTful

We use Spring Boot/MVC with annotation-based java-config for series of RESTful services and we want to selectively enable HTTP GZIP stream compression on some API responses. I know I can do this manua..

Is Visual Studio Community a 30 day trial?

I installed the supposedly free VS Community 2017 on my PC and 30 days later I get this message from VS saying that my license has expired. License? Expired? I thought the community edition was "free..

How to run html file using node js

I have a simple html page with angular js as follows: //Application name var app = angular.module("myTmoApppdl", []); app.controller("myCtrl", function ($scope) { //Sample login ..

C# LINQ find duplicates in List

Using LINQ, from a List<int>, how can I retrieve a list that contains entries repeated more than once and their values?..

Return a value of '1' a referenced cell is empty

In Excel, I need to return a value of 1 if a referenced cell is empty I can do it if the value is zero but how do I do it if it is empty?..

Changing the tmp folder of mysql

Our Mysql queries use temporary tables which creates temporary files in the process. Currently the files are written to /tmp. How exactly can the path of the temp folder to which mysql writes to be ch..

How do I navigate to a parent route from a child route?

My problem is quite classic. I have a private part of an application which is behind a login form. When the login is successful, it goes to a child route for the admin application. My problem is that..

Extract specific columns from delimited file using Awk

Sorry if this is too basic. I have a csv file where the columns have a header row (v1, v2, etc.). I understand that to extract columns 1 and 2, I have to do: awk -F "," '{print $1 "," $2}' infile.csv..

Gaussian fit for Python

I'm trying to fit a Gaussian for my data (which is already a rough gaussian). I've already taken the advice of those here and tried curve_fit and leastsq but I think that I'm missing something more fu..

Refresh an page on button click

I need to refresh a page on button click without increasing the hit counter...

How to set selected value from Combobox?

I use combobox in c# windows form. I bound the item list as below: var employmentStatus = new BindingList<KeyValuePair<string, string>>(); employmentStatus.Add(new KeyValuePair<string..

Go Back to Previous Page

I am using a form to "Rate" a page. This form "posts" data to a php script elsewhere. I simply want to display a link after the form is processed which will bring the user back to previous page. Can I..

How to create a byte array in C++?

Please have a look at the followng header file #pragma once class MissileLauncher { public: MissileLauncher(void); private: byte abc[3]; }; This generated the error Error 1 error C21..

PHP - Notice: Undefined index:

Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” I am trying to do a registration form that registers a user in a database (MySQL). The code is ..

PHP Array to JSON Array using json_encode();

I've encoded an Array I've made using the inbuilt json_encode(); function. I need it in the format of an Array of Arrays like so: [["Afghanistan",32,12],["Albania",32,12]] However, it is returning ..

React.js, wait for setState to finish before triggering a function?

Here's my situation: on this.handleFormSubmit() I am executing this.setState() inside this.handleFormSubmit(), I am calling this.findRoutes(); - which depends on the successful completion of

How to check the first character in a string in Bash or UNIX shell?

I'm writing a script in UNIX where I have to check whether the first character in a string is "/" and if it is, branch. For example I have a string: /some/directory/file I want this to return 1, a..

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

How to get the size of a string in Python?

For example, I get a string: str = "please answer my question" I want to write it to a file. But I need to know the size of the string before writing the string to the file. What function can I us..

Getting IPV4 address from a sockaddr structure

How can I extract an IP address into a string? I can't find a reference that tells me how char sa_data[14] is encoded...

Round a double to 2 decimal places

If the value is 200.3456, it should be formatted to 200.34. If it is 200, then it should be 200.00...

Converting a string to int in Groovy

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

INSERT INTO @TABLE EXEC @query with SQL Server 2000

Is it true that SQL Server 2000, you can not insert into a table variable using exec? I tried this script and got an error message EXECUTE cannot be used as a source when inserting into a table varia..

Html.BeginForm and adding properties

How would I go about adding enctype="multipart/form-data" to a form that is generated by using <% Html.BeginForm(); %>?..

Unable to compile class for JSP: The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

I can't get tomcat7 to compile jsps. It till run the example servlets just fine and the service is up and running. I am running oracle java 8. Can anyone point me in the right direction? Here is the..

JavaScript loop through json array?

I am trying to loop through the following json array: { "id": "1", "msg": "hi", "tid": "2013-05-05 23:35", "fromWho": "[email protected]" }, { "id": "2", "msg": "there", "tid": "2013-05-0..

How do I send a JSON string in a POST request in Go

I tried working with Apiary and made a universal template to send JSON to mock server and have this code: package main import ( "encoding/json" "fmt" "" "l..

Python Git Module experiences?

What are people's experiences with any of the Git modules for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.) I am writing a program which will h..

How to set environment variables in Jenkins?

I would like to be able to do something like: AOEU=$(echo aoeu) and have Jenkins set AOEU=aoeu. The Environment Variables section in Jenkins doesn't do that. Instead, it sets AOEU='$(echo aoeu)'. ..

Check if DataRow exists by column name in c#?

I want to do something like this: private User PopulateUsersList(DataRow row) { Users user = new Users(); user.Id = int.Parse(row["US_ID"].ToString()); ..

Initialize empty vector in structure - c++

I have a struct: typedef struct user { string username; vector<unsigned char> userpassword; } user_t; I need to initialize userpassword with an empty vector: struct user r={"",?}; ..

What's the difference between RANK() and DENSE_RANK() functions in oracle?

What's the difference between RANK() and DENSE_RANK() functions? How to find out nth salary in the following emptbl table? DEPTNO EMPNAME SAL ------------------------------ 10 rrr 10000...

assembly to compare two numbers

What is the assembler syntax to determine which of two numbers is greater? What is the lower level (machine code) for it? Can we go even lower? Once we get to the bit level, what happens? How is it r..

Set max-height on inner div so scroll bars appear, but not on parent div

I have my HTML, CSS set up as per the code below. I have also added a JSFiddle link since it will be far more convenient to see the code in action. The problem I'm having is that when there is a lot ..

How to get input text length and validate user in javascript

I want to valid if user has entered username and password at the time of creating an account is safe or not based on its length(for my case five) on the right side of input field by showing that in d..

CSS background opacity with rgba not working in IE 8

I am using this CSS for background opacity of a <div>: background: rgba(255, 255, 255, 0.3); It’s working fine in Firefox, but not in IE 8. How do I make it work?..

How can I debug what is causing a connection refused or a connection time out?

I have the following code that has worked for about a year: import urllib2 req = urllib2.Request('','<Request></Request>') data = urllib2.urlopen(req) print data.rea..

How to start and stop android service from a adb shell?

I need to write a shell script to start and stop an android service ...

background: fixed no repeat not working on mobile

I am building a webpage where I want the background image to scale to fit the whole screen, maintain aspect ratio and be fixed (so if you scroll down, the background image stays in the same place). I..

How to override the [] operator in Python?

What is the name of the method to override the [] operator (subscript notation) for a class in Python?..

Simple JavaScript problem: onClick confirm not preventing default action

I'm making a simple remove link with an onClick event that brings up a confirm dialog. I want to confirm that the user wants to delete an entry. However, it seems that when Cancel is clicked in the di..

CSS '>' selector; what is it?

I've seen the "greater than" (>) used in CSS code a few times, but I can't work out what it does. What does it do?..

What are major differences between C# and Java?

I just want to clarify one thing. This is not a question on which one is better, that part I leave to someone else to discuss. I don't care about it. I've been asked this question on my job interview ..

UTF-8 in Windows 7 CMD

I've tried to display UTF-8 in the win7 cmd. Currently, I'm using the standard font because as I see with the mysql.exe, it works fine with the characters I'm working with (currently the german umlaut..

How do I make a div full screen?

I am using Flot to graph some of my data and I was thinking it would be great to make this graph appear fullscreen (occupy full space on the monitor) upon clicking on a button. Currently, my div is as..

how to configure lombok in eclipse luna

I configure lombok in eclipse Luna with Maven. Annotation is added properly, but no getter and setter are generated. eclipse.ini `-vm E:\Program Files\Java\jdk1.7.0_60\bin` `-vmargs` `-Dosgi.require..

When is it appropriate to use UDP instead of TCP?

Since TCP guarantees packet delivery and thus can be considered "reliable", whereas UDP doesn't guarantee anything and packets can be lost. What would be the advantage of transmitting data using UDP i..

member names cannot be the same as their enclosing type C#

The code below is in C# and I'm using Visual Studio 2010. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; namespace FrontEnd { class ..

loop through json array jquery

I'm trying to loop through this to get the 'name' values. This is what I currently have, but it doesn't seem to be working, tried a few others from what was posted here but nothing seemed to work. ..

Click a button programmatically - JS

I've seen this done in other webapps, but I'm fairly new to Javascript and can't really figure this out on my own. I want to create a Google Hangout programmatically. However, in the official API the ..

jQuery if Element has an ID?

How would I select elements that have any ID? For example: if ($(".parent a").hasId()) { /* then do something here */ } I, by no means, am a master at jQuery...

How to do a LIKE query with linq?

How can i perform an LIKE query within Linq? I have the following query i would like to execute. var results = from c in db.costumers where c.FullName LIKE "%"+FirstName+"%,"+LastName ..

Extract digits from string - StringUtils Java

I have a String and I want to extract the (only) sequence of digits in the string. Example: helloThisIsA1234Sample. I want the 1234 It's a given that the sequence of digits will occur only once wit..

What does -> mean in C++?

Possible Duplicates: What is the difference between the dot (.) operator and -> in C++? What is the arrow operator (->) synonym for in C++? The header says it all. What does -> me..

How do I make entire div a link?

I have a div like this <div class="xyz"></div> and all the content in that div is in the css. How do I make that div into a link? I tried wrapping the a tag around it, but that didn't see..

Group by in LINQ

Let's suppose if we have a class like: class Person { internal int PersonID; internal string car; } I have a list of this class: List<Person> persons; And this list can have multi..

jquery multiple checkboxes array

<input type="checkbox" name="options[]" value="1" /> <input type="checkbox" name="options[]" value="2" /> <input type="checkbox" name="options[]" value="3" /> <input type="checkbo..

Hide html horizontal but not vertical scrollbar

I have an HTML textarea that is of fixed width, but variable height. I would like to set overflow:scroll and be able to show a vertical scrollbar, but not a horizontal one. I am not able to use overfl..

Make div 100% Width of Browser Window

I'm trying to make one of my containers 100% of the width of the screen. Here is my SASS body, html { width: 100%; height: 100%; padding: 0; margin: 0; } #neo_wrapper { width..

Build Step Progress Bar (css and jquery)

You've seen iterations of this type of progress bar on sites like paypal. How does one go about setting this up using CSS and jquery? I have 4 pages and each page is a step... so 4 steps...

Conversion failed when converting from a character string to uniqueidentifier - Two GUIDs

I don't understand why I can't insert this. I can't spot the problem. The error message is Conversion failed when converting from a character string to uniqueidentifier. The GUIDs are the ones that I..

Handle Button click inside a row in RecyclerView

I am using following code for handling row clicks. (source) static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private GestureDetector gestureDetector; private ..

Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

I get the following error when trying to connect to SQL Server: Cannot connect to A network-related or instance-specific error occurred while establishing a connection to SQL Server...

Kendo grid date column not formatting

I have a KendoGrid like below and when I run the application, I'm not getting the expected format for date column. $("#empGrid").kendoGrid({ dataSource: { data: empModel.Value, pa..

Using Spring MVC Test to unit test multipart POST request

I have the following request handler for saving autos. I have verified that this works when I use e.g. cURL. Now I want to unit test the method with Spring MVC Test. I have tried to use the fileUpload..

Setting a max height on a table

I am trying to design a page where there are some tables. It seems that styling tables is much more painful than it ought to be. The problem is the following: The tables should have a fixed height an..

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create() function and a destroy() function. I..

Subset data to contain only columns whose names match a condition

Is there a way for me to subset data based on column names starting with a particular string? I have some columns which are like ABC_1 ABC_2 ABC_3 and some like XYZ_1, XYZ_2,XYZ_3 let's say. How can ..

Daemon not running. Starting it now on port 5037

[2014-04-16 14:01:05 - Abc] ------------------------------ [2014-04-16 14:01:05 - Abc] Android Launch! [2014-04-16 14:01:05 - Abc] The connection to `ADB` is down, and a severe error has occurred. [20..

Specify an SSH key for git push for a given domain

I have the following use case: I would like to be able to push to [email protected]:gitolite-admin using the private key of user gitolite-admin, while I want to push to [email protected]:some_repo..

Navigation Drawer (Google+ vs. YouTube)

Does anyone know how to implement a sliding menu like some of the top apps of today? Other Stack Overflow questions haven't had any answers on how to do this, so I'm trying to gather as much info to..

How can I divide two integers stored in variables in Python?

I've got two numbers stored in varibles, a and b, and i'd like to see of the ratio of those two is an integer or not in python. However when I try result = a./b it gives me a SyntaxError: invali..

Is there a concise way to iterate over a stream with indices in Java 8?

Is there a concise way to iterate over a stream whilst having access to the index in the stream? String[] names = {"Sam","Pamela", "Dave", "Pascal", "Erik"}; List<String> nameList; Stream<I..

Android: View.setID(int id) programmatically - how to avoid ID conflicts?

I'm adding TextViews programmatically in a for-loop and add them to an ArrayList. How do I use TextView.setId(int id)? What Integer ID do I come up with so it doesn't conflict with other IDs?..

PL/pgSQL checking if a row exists

I'm writing a function in PL/pgSQL, and I'm looking for the simplest way to check if a row exists. Right now I'm SELECTing an integer into a boolean, which doesn't really work. I'm not experienced wit..

What is the best Java email address validation method?

What are the good email address validation libraries for Java? Are there any alternatives to commons validator?..

ERROR 2006 (HY000): MySQL server has gone away

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

Easiest way to convert int to string in C++

What is the easiest way to convert from int to equivalent string in C++. I am aware of two methods. Is there any easier way? (1) int a = 10; char *intStr = itoa(a); string str = string(intStr); (..

Get loop count inside a Python FOR loop

In a Python for loop that iterates over a list we can write: for item in list: print item and it neatly goes through all the elements in the list. Is there a way to know within the loop how man..