Questions Tagged with #Parallel testing

C# binary literals

Is there a way to write binary literals in C#, like prefixing hexadecimal with 0x? 0b doesn't work. If not, what is an easy way to do it? Some kind of string conversion?..

Floating point exception( core dump

Program: So I made a program that take two numbers, N and L. N is the size of a 2D array and L is a number from 3 - 16. The program builds the array and starts at the center and works its way out in a..

Render HTML to PDF in Django site

For my django powered site, I am looking for an easy solution to convert dynamic html pages to pdf. Pages include HTML and charts from Google visualization API (which is javascript based, yet includi..

How to sort rows of HTML table that are called from MySQL

I know it's such a basic thing, but a Google search hasn't shown me how to re-sort the rows after clicking the th links. I've got this: <table border="1"> <tr> <th>Type:</..

What is the equivalent of "!=" in Excel VBA?

The problem is that != does not work as a function in excel vba. I want to be able to use If strTest != "" Then instead of If strTest = "" Then Is there another approach to do this besides !=? My..

Sharing a variable between multiple different threads

I want to share a variable between multiple threads like this: boolean flag = true; T1 main = new T1(); T2 help = new T2(); main.start(); help.start(); I'd like to share flag between main and help ..

The backend version is not supported to design database diagrams or tables

I'm trying to add a table to my newly created database through SQL Server Management Studio. However I get the error: the backend version is not supported to design database diagrams or tables T..

Array Index Out of Bounds Exception (Java)

Here is my code: public class countChar { public static void main(String[] args) { int i; String userInput = new String(); userInput = Input.getString("Please enter a se..

Making a Windows shortcut start relative to where the folder is?

I have a game that uses this file structure: GAME FOLDER ->data ->data->run.bat I want to put a shortcut to run.bat in GAME FOLDER, but if I move it, or someone else installs it it won't w..

How to define custom configuration variables in rails

I was wondering how to add custom configuration variables to a rails application and how to access them in the controller, for e.g I wanna be able to define an upload_directory in the configuration fi..

Convert Decimal to Varchar

I have a decimal column in a table defined as decimal(8,3). I would like to include this column in a Select statement, convert it to a Varchar and only display two decimal places. I can't seem to find..

Should I use "camel case" or underscores in python?

So which is better and why? def my_function(): or def myFunction(): ..

Viewing all `git diffs` with vimdiff

I setup git diff to wrap into vimdiff, using "Git Diff with Vimdiff" as a guide, and it's working as expected unless there are many files with changes. When there are multiple files with changes and..

LaTeX "\indent" creating paragraph indentation / tabbing package requirement?

The LaTeX code provided below shows the usage of the command "\indent" as it appears in the document, but it does not produce the desired indentation within the document. Is there a specific package a..

Twitter Bootstrap button click to toggle expand/collapse text section above button

I have recently come accross bootstrap and I am working on extending the hero example. I want to add the following behaviour to my page: When a button (i.e. an element with selector '.row .btn') is c..

Retrieve the position (X,Y) of an HTML element relative to the browser window

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window...

Deleting an object in C++

Here is a sample code that I have: void test() { Object1 *obj = new Object1(); . . . delete obj; } I run it in Visual Studio, and it crashes at the line with 'delete obj;'. Isn't thi..

read input separated by whitespace(s) or newline...?

I'm grabbing input from a standard input stream. Such as, 1 2 3 4 5 or 1 2 3 4 5 I'm using: std::string in; std::getline(std::cin, in); But that just grabs upto the newline, correct? How can ..

Is there a limit on how much JSON can hold?

I am using jquery, JSON, and AJAX for a comment system. I am curious, is there a size limit on what you can send through/store with JSON? Like if a user types a large amount and I send it through JSO..

How to set a radio button in Android

I have an app that uses radio buttons. The default for this button is set in the main.xml file, ie: android:id="@+id/rb_sat1E" android:checked="true" In the Java file I have: final RadioButton ra..

How to approach a "Got minus one from a read call" error when connecting to an Amazon RDS Oracle instance

I'm running Oracle 11GR2 on an Amazon RDS instance. occasionally I get an IO Error: Got minus one from a read call when making a call to DriverManager.getConnection(getUrl()) and I'm not sure why. Oth..

Creating an empty file in C#

What's the simplest/canonical way to create an empty file in C#/.NET? The simplest way I could find so far is: System.IO.File.WriteAllLines(filename, new string[0]); ..

ie8 var w= - "Message: Invalid argument."

I have a site that has an IE8-only problem: The code is: var w =, wname, wfeatures, 'false'); The error is: Message: Invalid argument. Line: 419 Char: 5 Code: 0 ..

How to create a horizontal loading progress bar?

When uninstalling an android application, or do some configuration, there will show such a horizontal progress bar, like following picture: It's not the same style like @android:style/Widget.Progre..

login to remote using "mstsc /admin" with password

I want to use mstsc /admin to login to a server silently. My batch file reads the code as mstsc / /admin But it ask me to enter password. Can anyone help me to skip this step? I w..

Remove all subviews?

When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews. How can I do this?..

How to display list of repositories from subversion server

I'm looking for a way to search a whole subversion server. I already got a piece of the puzzle to search within a repository. Now I need to do this for every repository. Update: I have to access t..

What is the difference between single and double quotes in SQL?

What is the difference between single quotes and double quotes in SQL?..

python date of the previous month

I am trying to get the date of the previous month with python. Here is what i've tried: str( time.strftime('%Y') ) + str( int(time.strftime('%m'))-1 ) However, this way is bad for 2 reasons: First ..

git checkout all the files

How can I get rid of all the changes in all the files of my repository? Say I am in a branch and I did some changes. git status returns a set of files in the "Changes not staged for commit" and I not..

Can I have an onclick effect in CSS?

I have an image element that I want to change on click. <img id="btnLeft"> This works: #btnLeft:hover { width:70px; height:74px; } But what I need is: #btnLeft:onclick { width..

pdftk compression option

I use pdftk to compress a pdf using the following command line pdftk file1.pdf output file2.pdf compress It works as the weight of my file decreased. Are there [options] to change the compression..

What is the iBeacon Bluetooth Profile

I'd like to create my own iBeacon with some Bluetooth Low Energy dev kits. Apple has yet to release a specification for iBeacons, however, a few hardware developers have reverse Engineered the iBeacon..

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

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

IPC performance: Named Pipe vs Socket

Everyone seems to say named pipes are faster than sockets IPC. How much faster are they? I would prefer to use sockets because they can do two-way communication and are very flexible but will choose s..

How to append multiple items in one line in Python

I have: count = 0 i = 0 while count < len(mylist): if mylist[i + 1] == mylist[i + 13] and mylist[i + 2] == mylist[i + 14]: print mylist[i + 1], mylist[i + 2] newlist.append(mylist[..

Center an item with position: relative

I've got a menu that appears on hover over an absolutely positioned div. All of the menu items have to be relatively positioned because the absolutely div will appear multiple times on a page and will..

Bash foreach loop

I have an input (let's say a file). On each line there is a file name. How can I read this file and display the content for each one...

Laravel Checking If a Record Exists

I am new to Laravel. Please excuse the newbie question but how do I find if a record exists? $user = User::where('email', '=', Input::get('email')); What can I do here to see if $user has a record?..

Validate phone number with JavaScript

I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: (123) 456-7890 or 123-456-7890 The problem is that my client (I don't know ..

Check if a string has white space

I'm trying to check if a string has white space. I found this function but it doesn't seem to be working: function hasWhiteSpace(s) { var reWhiteSpace = new RegExp("/^\s+$/"); // Check for ..

Java and SSL -

I've built a Java program as a front end for a database on a server, and I'm trying to use SSL to encrypt traffic between clients and the server. Here is the command I issued to create the server cer..

Fitting empirical distribution to theoretical ones with Scipy (Python)?

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47,47,47,...] sampled from some continuous distribution. The val..

Attempted to read or write protected memory

I've started seeing an AccessViolationException being thrown in my application a several different spots. It never occured on my development pc, our test server. It also only manifested itself on 1 o..

Send PHP variable to javascript function

I have a php file that generates a variable and I would like the variable to be put into a javascript function which is called by onclick on the main page. Is this possible to send from PHP to javasc..

How can I data bind a list of strings to a ListBox in WPF/WP7?

I am trying to bind a list of string values to a listbox so that their values are listed line by line. Right now I use this: <ListBox Margin="20" ItemsSource="{Binding Path=PersonNames}"> &..

Oracle Add 1 hour in SQL

I am just trying to add 1 hour to a value, it is kind of complicated on where and why i am doing this but basically i just need to query something like this select DATE_ADD(hh,1,'2014-10-15 03:30:00..

Can't execute jar- file: "no main manifest attribute"

I have installed an application, when I try to run it (it's an executable jar) nothing happens. When I run it from the commandline with: java -jar "app.jar" I get the following message: no ..

How to set border's thickness in percentages?

How to set border-width of an element in percentages? I tried the syntax border-width:10%; But it doesn't work. The reason I want to set border-width in percentages is I have an element with width..

Getting individual colors from a color map in matplotlib

If you have a Colormap cmap, for example: cmap ='Spectral') How can you get a particular colour out of it between 0 and 1, where 0 is the first colour in the map and 1 is th..

How to append output to the end of a text file

How do I append the output of a command to the end of a text file?..

How can I use/create dynamic template to compile dynamic Component with Angular 2.0?

I want to dynamically create a template. This should be used to build a ComponentType at runtime and place (even replace) it somewhere inside of the hosting Component. Until RC4 I was using Componen..

SUM of grouped COUNT in SQL Query

I have a table with 2 fields: ID Name -- ------- 1 Alpha 2 Beta 3 Beta 4 Beta 5 Charlie 6 Charlie I want to group them by name, with 'count', and a row 'SUM' Name Count -------..

How to print colored text to the terminal?

How can I output colored text to the terminal in Python?..

Pad left or right with string.format (not padleft or padright) with arbitrary string

Can I use String.Format() to pad a certain string with arbitrary characters? Console.WriteLine("->{0,18}<-", "hello"); Console.WriteLine("->{0,-18}<-", "hello"); returns -> ..

C#: easiest way to populate a ListBox from a List

If I have a list of strings, eg: List<string> MyList = new List<string>(); MyList.Add("HELLO"); MyList.Add("WORLD"); Is there an easy way to populate a ListBox using the contents of MyL..

Find Process Name by its Process ID

Suppose I know the process ID. I want to find the process name by its ID, using windows batch script. How can I do this?..

Built in Python hash() function

Windows XP, Python 2.5: hash('') Result: 1934711907 Google App Engine ( hash('') Result: -5768830964305142685 Why is th..

Drop shadow for PNG image in CSS

I have a PNG image, that has free form (non square). I need to apply drop-shadow effect to this image. The standard approach ... -o-box-shadow: 12px 12px 29px #555; -icab-box-shadow: 12px 12..

How do I turn off Unicode in a VC++ project?

I have a VC++ project in Visual Studio 2008. It is defining the symbols for unicode on the compiler command line (/D "_UNICODE" /D "UNICODE"), even though I do not have this symbol turned on in the..

select2 - hiding the search box

For my more significant selects, the search box in Select2 is wonderful. However, in one instance, I have a simple selection of 4 hard-coded choices. In this case, the search box is superfluous and lo..

How to avoid HTTP error 429 (Too Many Requests) python

I am trying to use Python to login to a website and gather information from several webpages and I get the following error: Traceback (most recent call last): File "", line 43, in &..

Extract substring from a string

what is the best way to extract a substring from a string in android?..

Two statements next to curly brace in an equation

How can I write an equation with one curly brace ({), and on the right-hand side next to the curly, two statements in two different lines?..

Using DNS to redirect to another URL with a path

I'm trying to redirect a domain to another via DNS. I know that using IN CNAME it's posible. IN CNAME What i need is a redirection with a path. When someone types ..

Delete data with foreign key in SQL Server table

I'm going to delete data in an SQL Server table (parent) which has a relationship with another table (child). I tried the basic Delete query. But it isn't working (and I know it won't). DELETE FROM t..

Unable to import path from django.urls

Tried to run command: from django.urls import path Getting error: Traceback (most recent call last): File "< stdin >", line 1, in ImportError: cannot import name 'path' I am using dja..

Guid is all 0's (zeros)?

I'm testing out some WCF services that send objects with Guids back and forth. In my web app test code, I'm doing the following: var responseObject = proxy.CallService(new RequestObject { Data = ..

Get current date in milliseconds

Can any one give me an idea how to get the current date in milliseconds?..

Compare two Timestamp in java

How can I compare if mytime is between fromtime and totime: Timestamp fromtime; Timestamp totime; Timestamp mytime; ..

VBA, if a string contains a certain letter

I do not usually work with VBA and I cannot figure this out. I am trying to determine whether a certain letter is contained within a string on my spreadhseet. Private Sub CommandButton1_Click() Dim ..

The EntityManager is closed

[Doctrine\ORM\ORMException] The EntityManager is closed. After I get a DBAL exception when inserting data, EntityManager closes and I'm not able to reconnect it. I tried like this but it didn..

ImportError: No module named site on Windows

I am trying to install Python for the first time. I downloaded the following installer from the Python website: Python 2.7.1 Windows Installer (Windows binary -- does not include source). I then ran t..

What is %2C in a URL?

I'm trying to understand the structure of a URL, and I'm seeing a lot of %2C. I'm guessing this is a result of some encoding. What does that stand for?..

How to prevent robots from automatically filling up a form?

I'm trying to come up with a good enough anti-spamming mechanism to prevent automatically generated input. I've read that techniques like captcha, 1+1=? stuff work well, but they also present an extra..

Detecting when user scrolls to bottom of div with jQuery

I have a div box (called flux) with a variable amount of content inside. This divbox has overflow set to auto. Now, what I am trying to do, is, when the use scroll to the bottom of this DIV-box, load..

Difference between objectForKey and valueForKey?

What is the difference between objectForKey and valueForKey? I looked both up in the documentation and they seemed the same to me...

jQuery disable a link

Anyone know how to disable a link in jquery WITHOUT using return false;? Specifically, what I'm trying to do is disable the link of an item, performing a click on it using jquery which triggers some ..

Check whether a string is not null and not empty

How can I check whether a string is not null and not empty? public void doStuff(String str) { if (str != null && str != "**here I want to check the 'str' is empty or not**") { ..

How can I overwrite file contents with new content in PHP?

I tried to use fopen, but I only managed to append content to end of file. Is it possible to overwrite all contents with new content in PHP?..

Authentication failed to bitbucket

I'm trying to push my project via the https protocol on bitbucket using sourcetree. But I can't connect to bitbucket with my login and password (which work on the website), I have a fatal error : "Aut..

Convert string in base64 to image and save on filesystem in Python

I have a string in base64 format, which represents PNG image. Is there a way to save this image to the filesystem, as a PNG file? I encoded the image using flex. Actually this is what I get on serv..

jQuery: How to get to a particular child of a parent?

To give a simplified example, I've got the following block repeated on the page lots of times (it's dynamically generated): <div class="box"> <div class="something1"></div> &l..

Convert Rtf to HTML

We have a crystal report that we need to send out as an e-mail, but the HTML generated from the crystal report is pretty much just plain ugly and causes issues with some e-mail clients. I wanted to e..

Two HTML tables side by side, centered on the page

I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with): <style> #ou..

How to convert a selection to lowercase or uppercase in Sublime Text

I have several strings selected in a file in Sublime Text and I want to convert them all to lowercase. How can I convert them all to lowercase in Sublime Text?..

How to repeat a string a variable number of times in C++?

I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there any direct way to do this using either std::strings or char* strings? E.g. in Python you could simply do >..

chart.js load totally new data

The API for chart.js allows one to edit points of the datasets loaded into it, for example: .update( ) Calling update() on your Chart instance will re-render the chart with any updated valu..

Remove json element

I want to remove JSON element or one whole row from JSON. I have following JSON string: { "result":[ { "FirstName": "Test1", "LastName": "User", }, { ..

How Do I Upload Eclipse Projects to GitHub?

I have code in Eclipse that I'd like to upload to GitHub but so far I can't figure out how. It says "create a repository" but that looks more like a folder that holds your projects and I'm not sure ho..

What is VanillaJS?

I have one simple question, that got stuck in my mind for a few days: What is VanillaJS? Some people refer to it as a framework, you can download a library from the official pages. But when I check s..

Convert seconds to hh:mm:ss in Python

How do I convert an int (number of seconds) to the formats mm:ss or hh:mm:ss? I need to do this with Python code (and if possible in a Django template)...

gnuplot : plotting data from multiple input files in a single graph

I am trying to plot a graph using gnuplot. I have six text files. Each text file contains two columns. The first column represents time in seconds (a floating point number). The second one is a sequen..

Any easy way to use icons from resources?

I have an C# app. I need to add an icon to that app so i added an icon resource. Adding resource went fine, but is there any way to use my (resource) icon as form icon WITHOUT adding additional code? ..

How to hide image broken Icon using only CSS/HTML?

How can I hide the broken image icon? Example: I have an image with error src: <img src="Error.src"/> The solution must work in all browsers...

Exchange Powershell - How to invoke Exchange 2010 module from inside script?

I'm writing a script that does a number of things with AD and Exchange and just got to the part of the GUI where I need to start working with Exchange but don't see where I can manually specify to inc..

How do I split a string by a multi-character delimiter in C#?

What if I want to split a string using a delimiter that is a word? For example, This is a sentence. I want to split on is and get This and a sentence. In Java, I can send in a string as a delimiter..

Is there a way to get a <button> element to link to a location without wrapping it in an <a href ... tag?

Just wondering if there is a way to get a HTML <button> element to link to a location without wrapping it in an <a href... tag? Button currently looks like: <button>Visit Page Now<..

Can you change what a symlink points to after it is created?

Does any operating system provide a mechanism (system call — not command line program) to change the pathname referenced by a symbolic link (symlink) — other than by unlinking the old one and crea..

Is JavaScript object-oriented?

There have been some questions about whether or not JavaScript is an object-oriented language. Even a statement, "just because a language has objects doesn't make it OO." Is JavaScript an object-orie..

Read line with Scanner

EDIT for further readers: the problem was that my input file was corrupted. I don't understand what I'm doing wrong : I was using this code : File f = new File("C:\\Temp\\dico.txt"); Buffer..

push_back vs emplace_back

I'm a bit confused regarding the difference between push_back and emplace_back. void emplace_back(Type&& _Val); void push_back(const Type& _Val); void push_back(Type&& _Val); As..

How to time Java program execution speed

How do you time the execution of a java program? I'm not sure what class I should use to do this. I'm kinda looking for something like: // Some timer starts here for (int i = 0; i < length; i++) ..

Internal vs. Private Access Modifiers

What is the difference between the internal and private access modifiers in C#?..

WPF Datagrid Get Selected Cell Value

I want to get value for selected cell in datagrid , please anyone tell how to do this. i used SelectedCell changed event , how can i do that? dataGrid1.CurrentCell ..

Export database schema into SQL file

Is it possible in MS SQL Server 2008 to export database structure into a T-SQL file? I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedu..

How to get the last N rows of a pandas DataFrame?

I have pandas dataframe df1 and df2 (df1 is vanila dataframe, df2 is indexed by 'STK_ID' & 'RPT_Date') : >>> df1 STK_ID RPT_Date TClose sales discount 0 000568 20060331 3...

Viewing contents of a .jar file

What would be the easiest way to view classes, methods, properties, etc. inside a jar file? I'm looking for something equivalent to the very useful Lutz Roeder .NET Reflector - for Java..

Scheduled run of stored procedure on SQL server

Is it possible to set up somehow Microsoft SQL Server to run a stored procedure on regular basis?..

How to use Bootstrap in an Angular project?

I am starting my first Angular application and my basic setup is done. How can I add Bootstrap to my application? If you can provide an example then it would be a great help...

In Unix, how do you remove everything in the current directory and below it?

I know this will delete everything in a subdirectory and below it: rm -rf <subdir-name> But how do you delete everything in the current directory as well as every subdirectory below it and th..

Escape sequence \f - form feed - what exactly is it?

\f is said to be the form feed. \t is a tab, \a is a beep, \n is a newline. What exactly is a form feed - \f? The following program #include <iostream> int main() { std::cout << "hello..

How to display text in pygame?

I can't figure out to display text in pygame. I know I can't use print like in regular python IDLE but i dont know how import pygame, sys from pygame.locals import * BLACK = ( 0, 0, 0) WHITE = (25..

What's the best practice to round a float to 2 decimals?

I'm using eclipse + Android SDK. I need to round a float value to 2 decimals. I usually use the next "trick" using Math library. float accelerometerX = accelerometerX * 100; accelerometerX = rou..

How to parse XML using jQuery?

How do I parse XML, and how can I navigate the result using jQuery? Here is my sample XML: <Pages> <Page Name="test"> <controls> <test>this is a test.</test>..

Find unique lines

How can I find the unique lines and remove all duplicates from a file? My input file is 1 1 2 3 5 5 7 7 I would like the result to be: 2 3 sort file | uniq will not do the job. Will show all va..

Postgresql -bash: psql: command not found

I have installed PostgreSQL and it is working ok. However, when I went to restore a backup I got the error -bash: psql: command not found: [root@server1 ~]# su postgres [postgres@server1 root]$ psq..

How to read user input into a variable in Bash?

I'm trying to create a script that simplifies the process of creating a new user on an iOS device. Here are the steps broken down. fullname="USER INPUT" user="USER INPUT" group=$us..

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?..

CSS: How to position two elements on top of each other, without specifying a height?

I have two DIVs that I need to position exactly on top of each other. However, when I do that, the formatting gets all screwed up because the containing DIV acts like there is no height. I think this ..

Continuous Integration vs. Continuous Delivery vs. Continuous Deployment

What's the difference between these three terms? My university provides the following definitions: Continuous Integration basically just means that the developer's working copies are synchronized wit..

How to load npm modules in AWS Lambda?

I've created several Lambda functions using the web based editor. So far so good. I'd now like to start extending those with modules (such as Q for promises). I can't figure out how to get the modules..

How do you push a tag to a remote repository using Git?

I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran git tag mytag master When I run git tag on my laptop the tag mytag is shown. I then want to push this to the ..

Linq filter List<string> where it contains a string value from another List<string>

I have 2 List objects (simplified): var fileList = Directory.EnumerateFiles(baseSourceFolderStr, fileNameStartStr + "*", SearchOption.AllDirectories); var filterList = new List<string>(); filt..

How do you do a ‘Pause’ with PowerShell 2.0?

OK, I'm losing it. PowerShell is annoying me. I'd like a pause dialog to appear, and it won't. PS W:\>>> $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Exception calling "ReadKey" with "1" ..

How to efficiently change image attribute "src" from relative URL to absolute using jQuery?

I need to change the src for an html image tag from relative to absolute url. I am using the following code. urlRelative and urlAbsolute are created correctly but I cannot modify the image in the la..

Can you blur the content beneath/behind a div?

I'm creating a new web design in Photoshop at the moment, but I'd like to know if it's possible to blur the content beneath a div? I'd like to create a half transparent nav bar on my page that's fixe..

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

Difference between String replace() and replaceAll()

What's the difference between java.lang.String 's replace() and replaceAll() methods, other than later uses regex? For simple substitutions like, replace . with / , is there any difference?..

What exactly does stringstream do?

I am trying to learn C++ since yesterday and I am using this document: (page 32) . I found a code in the document and I ran it. I tried inputting Rs 5.5 for ..

How to get the first 2 letters of a string in Python?

Let's say I have a string Str1 = "TN 81 NZ 0025" str2 = "DL 11C AA 1111" two = first2(str1) print(two) >>>TN How do I get the first two letters of these strings. I need the first2 functi..

Why is it OK to return a 'vector' from a function?

Please consider this code. I have seen this type of code several times. words is a local vector. How is it possible to return it from a function? Can we guarantee it will not die? std::vector<st..

How to parse string into date?

How can I convert a String to a Date in T-SQL? My test case is the string: '24.04.2012'..

How to run crontab job every week on Sunday

I'm trying to figure out how to run a crontab job every week on Sunday. I think the following should work, but I'm not sure if I understand correctly. Is the following correct? 5 8 * * 6 ..

ActiveMQ connection refused

I am trying to use activemq in my application, but keep getting an error when I try and connect to localhost: log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardE..

How can I find the length of a number?

I'm looking to get the length of a number in JavaScript or jQuery? I've tried value.length without any success, do I need to convert this to a string first?..

How to set the height of an input (text) field in CSS?

Sorry for this question but I can't seem to find an answer anywhere. I have CSS code that should set the height of my text box. I am using VS2010 Express for Windows phone, coding in HTML/CSS/Javascri..

How to close activity and go back to previous activity in android

I have a main activity, that when I click on a button, starts a new activity, i used the following code to do so: Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); Th..

IPhone/IPad: How to get screen width programmatically?

Hi I'm wondering if there's a way to get the width programmatically. I'm looking for something general enough to accomodate iphone 3gs, iphone 4, ipad. Also, the width should change based on if the ..

Is there a way to provide named parameters in a function call in JavaScript?

I find the named parameters feature in C# quite useful in some cases. calculateBMI(70, height: 175); What can I use if I want this in JavaScript? What I don’t want is this: myFunction({ para..

Get Selected value from dropdown using JavaScript

I have the following HTML <form> <div class="answer1wrap"> <select id="mySelect"> <option value="void">Choose your answer</option> <option value="To..

Insert HTML from CSS

Is there any way to insert an HTML element, dom or code from CSS(3)?..

How to easily duplicate a Windows Form in Visual Studio?

How can I easily duplicate a C#/VB Form in Visual Studio? If I copy & paste in the Solution Explorer, it uses the same class internally and gets messed up. How do you do it? ..

How do I turn off the output from tar commands on Unix?

I had a look at the options, but nothing seemed obvious as a manner in which to turn off the output when uncompressing a file. The below is the code I am currently using... I just need the option to s..

How to implement private method in ES6 class with Traceur

I use Traceur Compiler to have advantage with ES6 features now. I want to implement this stuff from ES5: function Animal() { var self = this, sayHi; sayHi = function() { s..

Reading and writing value from a textfile by using vbscript code

i have a variable named 'data' i need to write in to a textfile named "listfile.txt".Can you tell me the vbscript code to do that..And i need vbscript code for reading value from textfile "listfile.tx..

How can I get the name of an html page in Javascript?

I have an html page and I would like inside the html page to retrieve the name of the html document via Javascript. Is that possible? e.g. name of html document = "indexOLD.html"..

iPhone keyboard, Done button and resignFirstResponder

This is probably a dumb question, but I can't find the answer in the docs. Did the "Done" button on the pop-up keyboard always cause the keyboard to disappear? I see a lot of code around the web like ..

html5 <input type="file" accept="image/*" capture="camera"> display as image rather than "choose file" button

I've been looking into using html 5 <input type="file" accept="image/*" capture="camera"> to take a picture from my webapp and upload the image to the database using php - this is now working co..

ReactJS map through Object

I have a response like this: I want to display the name of each object inside this HTML: {, i) => ( <li className="travelcompany-input" key={i}> <span classNam..

What does an exclamation mark before a cell reference mean?

In a text about Excel I have read the following: =SUM(!B1:!K1) when defining a name for a cell and this was entered into the Refers To field. What does this mean?..

Is there an exponent operator in C#?

For example, does an operator exist to handle this? float Result, Number1, Number2; Number1 = 2; Number2 = 2; Result = Number1 (operator) Number2; In the past the ^ operator has served as an expo..

Javascript to Select Multiple options

I have a form with a select box that allows multiple options. After a user saves these options, it stores them in a database table. I can then read this database table to get the options they chose ..

Recommended way to save uploaded files in a servlet application

I read here that one should not save the file in the server anyway as it is not portable, transactional and requires external parameters. However, given that I need a tmp solution for tomcat (7) and t..

Define static method in source-file with declaration in header-file in C++

I am having a little trouble working with static methods in C++ Example .h: class IC_Utility { public: IC_Utility(); ~IC_Utility(); std::string CP_PStringToString( const unsigned char *..

Iterate over object attributes in python

I have a python object with several attributes and methods. I want to iterate over object attributes. class my_python_obj(object): attr1='a' attr2='b' attr3='c' def method1(self, ..

jQuery - Uncaught RangeError: Maximum call stack size exceeded

The following code (see Fiddle here) throws the stack overflow referred to in the question title. I'm trying to get a box shadow to display around a circular image in a pulse effect. Can anyone point ..

Can you pass parameters to an AngularJS controller on creation?

I have a controller responsible for communicating with an API to update properties of a user, name, email, etc. Each user has an 'id' which is passed from the server when the profile page is viewed. ..

How to take character input in java

In C, we are able to take input as character with the keyword char from keyboard as scanf("%c", &ch); But In Java how to do this? I have tried this: import java.util.Scanner; public class Ma..

Fixed GridView Header with horizontal and vertical scrolling in

I want to fix(Freeze) gridview header while vertical scrolling. I also want to fix first column while horizontal scrolling. I want this in both chrome and IE...

Regex not operator

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

How to get number of video views with YouTube API?

The question is very simple. How to get number of video views with YouTube API? The task is simple but I would like to use that query on large number of videos very often. Is there any way to call..

understanding private setters

I don't understand the need of having private setters which started with C# 2. Having a setter method for me is letting the user to set some variables in that class. In doing so, we will not expose ..

AngularJS : ng-click not working

I am new in AngularJs, ng-click is not working as expected. I searched on the internet , Follow the tutorial , (that was working) - but this is not working!!! My Code: <div class="row" ng:repeat..

A valid provisioning profile for this executable was not found... (again)

I know this has been asked and answered multiple times but I'm tearing my hair out as none of the proposed solutions appears to work. I receive the above error, despite having a valid provisioning ..

PHP Echo a large block of text

Im new to PHP and I can't figure out what the rules are for using the echo function. For example, if I need to echo a large block of css/js, do I need to add echo to each line of text or is there a wa..

How to Consolidate Data from Multiple Excel Columns All into One Column

Lets say I have an excel sheet with 4 columns of data & 20,000 rows of data in each column. What is the most efficient way to get it so that I have all of that data consolidated into one column (..

Compiling Java 7 code via Maven

My pom file lists <project> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId&g..

Connect to mysql on Amazon EC2 from a remote server

I want to connect to db on EC2 from my local machine, I am not able to do and have tried everything- I am using this command to connect to EC2: mysql -uUSERNAME -hEC2_IP -pPASSWORD This error is g..

How do I get an animated gif to work in WPF?

What control type should I use - Image, MediaElement, etc.?..

Java - creating a new thread

I'm new to threads. I wanted to create some simple function working separately from main thread. But it doesn't seem to work. I'd just like to create new thread and do some stuff there independently o..

How to perform mouseover function in Selenium WebDriver using Java?

I want to do mouseover function over a drop down menu. When we hover over the menu, it will show the new options. I tried to click the new options using the xpath. But cannot click the menus directly...

How to set Apache Spark Executor memory

How can I increase the memory available for Apache spark executor nodes? I have a 2 GB file that is suitable to loading in to Apache Spark. I am running apache spark for the moment on 1 machine, so t..

Imshow: extent and aspect

I'm writing a software system that visualizes slices and projections through a 3D dataset. I'm using matplotlib and specifically imshow to visualize the image buffers I get back from my analysis code..

How to delete all files from a specific folder?

I save files in a specific folder at run time. After some time, I want to delete them programmatically. How do I delete all files from a specific folder?..

Found 'OR 1=1/* sql injection in my newsletter database

I found the following in the "e-mail" field of my newsletter subscriber database: ' OR 1=1/* I know it's a SQL injection, but that's it. I've googled it a little bit, but I'm still on clear on what e..

How to align entire html body to the center?

How do I align entire html body to the center ?..

How to catch segmentation fault in Linux?

I need to catch segmentation fault in third party library cleanup operations. This happens sometimes just before my program exits, and I cannot fix the real reason of this. In Windows programming I co..

Where is Java Installed on Mac OS X?

I just downloaded Java 7u17 on Mac OS 10.7.5 from here and then successfully installed it. In order to do some JNI programming, I need to know where Java installed on my Mac. I thought that inside t..

How to use curl in a shell script?

I'm trying to run this shell script in order to install RVM in an Ubuntu box #!/bin/bash RVMHTTP="" CURLARGS="-f -s -S -k" bash..

Comparing object properties in c#

This is what I've come up with as a method on a class inherited by many of my other classes. The idea is that it allows the simple comparison between properties of Objects of the same Type. Now, this..

How to convert a structure to a byte array in C#?

How do I convert a structure to a byte array in C#? I have defined a structure like this: public struct CIFSPacket { public uint protocolIdentifier; //The value must be "0xFF+'SMB'". public ..

Last executed queries for a specific database

I know how to get the last executed queries using the following SQL in SSMS - SELECT deqs.last_execution_time AS [Time], dest.text AS [Query] FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_e..

Fuzzy matching using T-SQL

I have a table Persons with personaldata and so on. There are lots of columns but the once of interest here are: addressindex, lastname and firstname where addressindex is a unique address drilled dow..

How to fix the "508 Resource Limit is reached" error in WordPress?

508 Resource Limit is reached - Wordpress This error occurs again and again, and I can't post a single post without seeing this error: The website is temporarily unable to service your reques..

What's the purpose of git-mv?

From what I understand, Git doesn't really need to track file rename/move/copy operations, so what's the real purpose of git mv? The man page isn't specially descriptive... Is it obsolete? Is it an in..

How to set the title text color of UIButton?

I tried changing the colors of the text for a button, but it's still staying white. isbeauty = UIButton() isbeauty.setTitle("Buy", forState: UIControlState.Normal) isbeauty.titleLabel?.textColor = UI..

How to remove the bottom border of a box with CSS

I have a rectangular div, like the one above. I want to remove the bottom border (from C to D) in my div. How can I do this?. Edit: Here is my CSS: _x000D_ _x000D_ #index-03 {_x000D_ position: a..

Can't connect Nexus 4 to adb: unauthorized

I have a Nexus 4 with Android 4.3 and I am trying to connect the device to a computer with Windows 7 64bit. I installed the latest drivers and the latest adb version. I think I tried almost everythin..

What's the idiomatic syntax for prepending to a short python list?

list.append() is the obvious choice for adding to the end of a list. Here's a reasonable explanation for the missing list.prepend(). Assuming my list is short and performance concerns are negligible..

Perl read line by line

I have a simple Perl script to read a file line by line. Code is below. I want to display two lines and break the loop. But it doesn't work. Where is the bug? $file='SnPmaster.txt'; open(INFO, $file)..

How can I change the default width of a Twitter Bootstrap modal box?

I tried the following: <div class="modal hide fade modal-admin" id="testModal" style="display: none;"> <div class="modal-header"> <a data-dismiss="modal" class="cl..

Creating the Singleton design pattern in PHP5

How would one create a Singleton class using PHP5 classes?..

Convert a JSON string to object in Java ME?

Is there a way in Java/J2ME to convert a string, such as: {name:"MyNode", width:200, height:100} to an internal Object representation of the same, in one line of code? Because the current method ..

How do I install Composer on a shared hosting?

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

Strip off URL parameter with PHP

I have some links in a powerpoint presentation, and for some reason, when those links get clicked, it adds a return parameter to the URL. Well, that return parameter is causing my Joomla site's MVC pa..

How to change value of process.env.PORT in node.js?

I'd like to change the value of process.env.PORT, how can I do this? I'm running Ubuntu 12.04...

Force re-download of release dependency using Maven

I'm working on a project with dependency X. X, in turn, depends on Y. I used to explicitly include Y in my project's pom. However, it was not used and to make things cleaner, I instead added it to X'..

How to replace all dots in a string using JavaScript

I want to replace all the occurrences of a dot(.) in a JavaScript string For example, I have: var mystring = ''; I want to get: okay this is a string. So far I tried: mystri..

How to remove border of drop down list : CSS

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