Questions Tagged with #Objective c blocks

Blocks are Apple’s implementation of closures for C, which are also available for Objective-C and C++.

What does the "__block" keyword mean?

What exactly does the __block keyword in Objective-C mean? I know it allows you to modify variables within blocks, but I'd like to know... What exactly does it tell the compiler? Does it do anythin..

Can I use Objective-C blocks as properties?

Is it possible to have blocks as properties using the standard property syntax? Are there any changes for ARC?..

Waiting until two async blocks are executed before starting another block

When using GCD, we want to wait until two async blocks are executed and done before moving on to the next steps of execution. What is the best way to do that? We tried the following, but it doesn't s..

How do you trigger a block after a delay, like -performSelector:withObject:afterDelay:?

Is there a way to call a block with a primitive parameter after a delay, like using performSelector:withObject:afterDelay: but with an argument like int/double/float?..

Assign a variable inside a Block to a variable outside a Block

I'm getting an error Variable is not assignable (missing __block type specifier) on the line aPerson = participant;. How can I make sure the block can access the aPerson variable and the aPerso..

Store a closure as a variable in Swift

In Objective-C, you can define a block's input and output, store one of those blocks that's passed in to a method, then use that block later: // in .h typedef void (^APLCalibrationProgressHandle..

How to delete duplicate lines in a file without sorting it in Unix?

Is there a way to delete duplicate lines in a file in Unix? I can do it with sort -u and uniq commands, but I want to use sed or awk. Is that possible?..

How to represent a DateTime in Excel

What is the best way of representing a DateTime in Excel? We use Syncfusions Essential XlsIO to output values to an Excel document which works great. But I can't figure out how to display a DateTime i..

How to determine whether code is running in DEBUG / RELEASE build?

I am making an app that processes sensitive credit card data. If my code is running in debug mode I want to log this data to the console and make some file dumps. However on the final appstore ve..

Run ScrollTop with offset of element by ID

Trying to make the browser scroll to a specific ID with an added offset - $('html, body').animate({scrollTop: $('#contact').offset().top}, 'slow'); What I need to do is to set the offset by -100px...

X-Frame-Options on apache

I am trying to allow some particular domain to access my site via iframe Header set X-Frame-Options ALLOW-FROM https://www.that-site.com I know this could be done by add the line above to the conf..

Update with two tables?

I am trying to update table A with data from table B. I thought I could do something like: UPDATE A SET A.name = B.name WHERE A.id = B.id but alas, this does not work. Anyone have an idea of h..

How to install MySQLi on MacOS

I cannot find instructions about installing MySQLi on a Mac. Just to be clear, MySQL is up to date and I am running PHP 5. How do I install it? Where do I even get it from? Thanks for your help. I'll ..

libstdc++.so.6: cannot open shared object file: No such file or directory

I want to run Cilkscreen command with a cilk++ program but I'v got this error /usr/local/cilk/bin/../lib32/pinbin: error while loading shared libraries: libstdc++.so.6: cannot open shared objec..

How to write html code inside <?php ?>, I want write html code within the PHP script so that it can be echoed from Backend

I want to create table inside php script .. Is there any way that i could create table inside php script.? <?php html code to create table ?> ..

Is there a short contains function for lists?

I see people are using any to gather another list to see if an item exists in a list, but is there a quick way to just do?: if list.contains(myItem): # do something ..

Converting from IEnumerable to List

I want to convert from IEnumerable<Contact> to List<Contact>. How can I do this?..

Disabling buttons on react native

I'm making an android app using react native and I've used TouchableOpacity component to create buttons. I use a text input component to accept text from the user and the button should only be enabled..

Java: Check the date format of current string is according to required format or not

I wanted to know that is there any method available in Java that can do this.Otherwise I may go for Regex solution. I have input string from user that can be any characters. And I want to check that t..

Windows 7 - Add Path

I need to add a new path (sumatraPDF) on my PATH variable. I don't know why it does not work... I think everything is right but when I try to execute sumatrapdf.exe from CMD it cannot find the program..

What is the difference between i++ & ++i in a for loop?

I've just started learning Java and now I'm into for loop statements. I don't understand how ++i and i++ works in a for-loop. How do they work in mathematics operations like addition and subtraction?..

Bootstrap 3 - Set Container Width to 940px Maximum for Desktops?

I am adding a whole new section to a website using Twitter Bootstrap 3, however the container cannot go wider than 940px in total for Desktop - as it will throw out the Header and Footer {includes}. ..

If WorkSheet("wsName") Exists

I'm wondering if there is clean cut functionality that returns True or False if a worksheet inside a workbook exists? It would be good, but not essential, if it's possible to do it without skipping ..

What is the proper #include for the function 'sleep()'?

I am using the Big Nerd Ranch book Objective-C Programming, and it starts out by having us write in C in the first few chapters. In one of my programs it has me create, I use the sleep function. In th..

ASP.NET MVC3 - textarea with @Html.EditorFor

I have ASP.NET MVC3 app and I have also form for add news. When VS2010 created default view I have only text inputs for string data, but I want to have textarea for news text. How I can do it with Raz..

How to type ":" ("colon") in regexp?

: ("colon") has a special meaning in regexp, but I need to use it as is, like [A-Za-z0-9.,-:]*. I have tried to escape it, but this does not work [A-Za-z0-9.,-\:]*..

How can I change column types in Spark SQL's DataFrame?

Suppose I'm doing something like: val df = sqlContext.load("com.databricks.spark.csv", Map("path" -> "cars.csv", "header" -> "true")) df.printSchema() root |-- year: string (nullable = true) ..

mssql '5 (Access is denied.)' error during restoring database

I want to restore a database from a file (Tasks ? Restore ? Database; after I select from device and select file) via SQL Server Management Studio. After that, I get this error: The operating sy..

css h1 - only as wide as the text

I have an H1 style for my site: .centercol h1 { color: #006bb6; font-weight: normal; font-size: 18px; padding:3px 3px 3px 6px; border-left:3px solid #c6c1b8; background:#f2efe..

CSS Font "Helvetica Neue"

I often see the websites using font "Helvetica Neue". Is this font safe to use, like eg. Arial? Or do the browsers have trouble rendering it or not many machines have this font? Thanks...

In Chrome 55, prevent showing Download button for HTML 5 video

I am getting this download button with <video> tags in Chrome 55, but not on Chrome 54: How can I remove this so no one can see the download button in Chrome 55? I have used <video> tag..

How to restart a single container with docker-compose

I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker During the development of worker, I often need to restart it in order to apply changes. Is there any good way..

Using JavaMail with TLS

I found several other questions on SO regarding the JavaMail API and sending mail through an SMTP server, but none of them discussed using TLS security. I'm trying to use JavaMail to send status updat..

What is __gxx_personality_v0 for?

This is a second-hand question from an OS development site, but it made me curious since I couldn't find a decent explanation anywhere. When compiling and linking a free-standing C++ program using gc..

Python reshape list to ndim array

Hi I have a list flat which is length 2800, it contains 100 results for each of 28 variables: Below is an example of 4 results for 2 variables [0, 0, 1, 1, 2, 2, 3, 3] I would like to reshap..

Add User to Role ASP.NET Identity

I know the new Membership includes a "Simple Role Provider." I can't find any help related to creating a user and assigning a role when the user is created. I've added a user which created the table..

How can I color Python logging output?

Some time ago, I saw a Mono application with colored output, presumably because of its log system (because all the messages were standardized). Now, Python has the logging module, which lets you spe..

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in ionic 3

When I run ionic 3 project using "ionic serve" command than getting this error: ..

How to convert comma-separated String to List?

Is there any built-in method in Java which allows us to convert comma separated String to some container (e.g array, List or Vector)? Or do I need to write custom code for that? String commaSeparated ..

check if a file is open in Python

In my app, I write to an excel file. After writing, the user is able to view the file by opening it. But if the user forgets to close the file before any further writing, a warning message should appe..

Custom Python list sorting

I was refactoring some old code of mine and came across of this: alist.sort(cmp_items) def cmp_items(a, b): if a.foo > b.foo: return 1 elif a.foo == b.foo: return 0 el..

Lock screen orientation (Android)

I'm writing an android application that uses tabs with different contents (activities). In one of these activities, I would like to lock the screen orientation to "Landscape"-mode, but in the other ac..

Best C++ IDE or Editor for Windows

What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio...

Cannot delete or update a parent row: a foreign key constraint fails

When doing: DELETE FROM `jobs` WHERE `job_id` =1 LIMIT 1 It errors: #1451 - Cannot delete or update a parent row: a foreign key constraint fails (paymesomething.advertisers, CONSTRAINT advertise..

Mocha / Chai expect.to.throw not catching thrown errors

I'm having issues getting Chai's expect.to.throw to work in a test for my node.js app. The test keeps failing on the thrown error, but If I wrap the test case in try and catch and assert on the caught..

How to determine if OpenSSL and mod_ssl are installed on Apache2

Does anyone know the command to determine if OpenSSL and mod_ssl are installed on Apache2?..

What exactly does an #if 0 ..... #endif block do?

In C/C++ What happens to code placed between an #if 0/#endif block? #if 0 //Code goes here #endif Does the code simply get skipped and therefore does not get executed?..

Enter key in textarea

I have a textarea, On every Enter key pressed in textarea I want new line to be started with a bullet say (*). How to go about it ? No jQuery please. I can observe for the Enter key , after that !?..

Can I hide the HTML5 number input’s spin box?

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) render for HTML input of type number? I am looking for a CSS or JavaScript method to prevent t..

Dropdown select with images

I wanted to create a dropdown select which has images instead of text as the options. I've done some Googling and searching here on Stack Overflow, and the answer generally given is to use the jQuery..

Re-render React component when prop changes

I'm trying to separate a presentational component from a container component. I have a SitesTable and a SitesTableContainer. The container is responsible for triggering redux actions to fetch the appr..

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 read/write from/to file using Go?

I've been trying to learn Go on my own, but I've been stumped on trying read from and write to ordinary files. I can get as far as inFile, _ := os.Open(INFILE, 0, 0), but actually getting the content..

What's NSLocalizedString equivalent in Swift?

Is there an Swift equivalent of NSLocalizedString(...)? In Objective-C, we usually use: NSString *string = NSLocalizedString(@"key", @"comment"); How can I achieve the same in Swift? I found a func..

SVN: Folder already under version control but not comitting?

mark@mark-ubuntu:~/myproject$ svn stat ? runserver.sh ? media/images/icons ? apps/autocomplete mark@mark-ubuntu:~/myproject$ svn add apps/autocomplete svn: warning: 'apps/autocomplet..

Compare two dates in Java

I need to compare two dates in java. I am using the code like this: Date questionDate = question.getStartDate(); Date today = new Date(); if(today.equals(questionDate)){ System.out.println("Both..

How to find difference between two columns data?

I have a temp table with two columns of integer data i want to find the difference between two columns in 3rd column. #TEMP1 Present previous 59 88 75 75 45 45 77 ..

Adding whitespace in Java

There is a class trim() to remove white spaces, how about adding/padding? Note: " " is not the solution...

How do I fix a NoSuchMethodError?

I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?..

Changing Jenkins build number

Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build nu..

How can I make a SQL temp table with primary key and auto-incrementing field?

What am I missing here? I'm trying to get the ID field to be the primary key and auto increment so that I don't need to insert it explicitly. CREATE TABLE #tmp ( ID INT IDENTITY(1, 1) , AssignedTo NV..

Android Studio cannot resolve R in imported project?

I'm trying the new Android Studio. I've exported a project from eclipse, using the build gradle option. I've then imported it in Android Studio. The R.java file under gen has a j in a little red circl..

Initializing select with AngularJS and ng-repeat

I'm trying to get select-box to start off with a pre-filled option using ng-repeat with AngularJS 1.1.5. Instead the select always starts out with nothing selected. It also has an empty option, which ..

How can I restore the MySQL root user’s full privileges?

I accidentally removed some of the privileges from my MySQL root user, including the ability to alter tables. Is there some way I can restore this user to its original state (with all privileges)? UP..

HTML: can I display button text in multiple lines?

I have a button with long text like "Click here to start playing". I want to control the width and display the text in multiple lines. Is it possible in html/css?..

Are one-line 'if'/'for'-statements good Python style?

Every so often on here I see someone's code and what looks to be a 'one-liner', that being a one line statement that performs in the standard way a traditional 'if' statement or 'for' loop works. I'v..

How can I generate Javadoc comments in Eclipse?

Is there a way to generate Javadoc comments in Eclipse? If so, what is it?..

Launch Image does not show up in my iOS App

I want to get a simple launch screen to show in my app, built using Xcode 6.0.1. I have added a launch screen in two ways: As an XIB (with the default name, LaunchScreen.xib) and as a launchimage set..

How to get public directory?

I am a beginner here so pardon me for this question am using return File::put($path , $data); to create a file in public folder on Laravel. I used this piece of code from controller I need to know the..

Relative path in HTML

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

Eclipse interface icons very small on high resolution screen in Windows 8.1

The various icons and buttons in the Eclipse (Kepler) interface are very, very small on a laptop with a 3200x1800px screen. The red error decoration that appears to indicate errors on files is diffic..

C# error: Use of unassigned local variable

I'm not sure why I'm getting this error, but shouldn't this code compile, since I'm already checking to see if queue is getting initialized? public static void Main(String[] args) { Byte maxSize..

How do I format a String in an email so Outlook will print the line breaks?

I'm trying to send an email in Java but when I read the body of the email in Outlook, it's gotten rid of all my linebreaks. I'm putting \n at the ends of the lines but is there something special I nee..

How to add/subtract time (hours, minutes, etc.) from a Pandas DataFrame.Index whos objects are of type datetime.time?

I've got a DataFrame who's index is just datetime.time and there's no method in DataFrame.Index and datetime.time to shift the time. datetime.time has replace but that'll only work on individual item..

Update Jenkins from a war file

I have a machine with Ubuntu 12.04 and have installed Jenkins ver. 1.424.6 using apt-get based on this guide, but there is a new version: New version of Jenkins (1.447.2) is available for download (c..

Flutter - Wrap text on overflow, like insert ellipsis or fade

I'm trying to create a line in which center text has a maximum size, and if the text content is too large, it fits in size. I insert the TextOverflow.ellipsis property to shorten the text and inserti..

Bootstrap Align Image with text

I am trying to align an image on the left side with text using boostrap, and when page is viewed on mobile devices the images becomes centred on top of the text ! <div class="container"> <di..

How to list all dates between two dates

I would like list dates between two date in a SQL Server stored procedure. For example: Date1: 2015-05-28 Date2: 2015-05-31 Results : 2015-05-29 2015-05-30 How to calculate all dates between t..

Sending email in .NET through Gmail

Instead of relying on my host to send an email, I was thinking of sending the email messages using my Gmail account. The emails are personalized emails to the bands I play on my show. Is it possible..

Run batch file as a Windows service

In order to run one application, a batch file has to be kicked off (which does things like start Jetty, display live logs, etc). The application will work only if this batch file is running. I am henc..

PHP string concatenation

I need to know if its possible to concatenate strings, as follows ? and if not, what is the alternative of doing so ? while ($personCount < 10) { $result+= $personCount . "person "; } echo $resul..

Change a column type from Date to DateTime during ROR migration

I need to change my column type from date to datetime for an app I am making. I don't care about the data as its still being developed. How can I do this? ..

Log record changes in SQL server in an audit table

The table : CREATE TABLE GUESTS ( GUEST_ID int IDENTITY(1,1) PRIMARY KEY, GUEST_NAME VARCHAR(50), GUEST_SURNAME VARCHAR(50), ADRESS VARCHAR(100), CITY VARCHAR(50..

Material Design not styling alert dialogs

I've added the appCompat material design to my app and it seems that the alert dialogs are not using my primary, primaryDark, or accent colors. Here is my base style: <style name="MaterialNavyTh..

How to find the serial port number on Mac OS X?

I have just started experimenting with Serproxy and Arduino to get some serial data into Flash Builder/Flex. Serproxy seems to work fine and seems to connect to whatever port is specified. However, I ..

How do I get NuGet to install/update all the packages in the packages.config?

I have a solution with multiple projects in it. Most of the third party references are missing, yet there are packages.config file for each project. How do I get NuGet to install/update all the packa..

Default interface methods are only supported starting with Android N

I upgraded to android studio 3.1 and I'm getting the following error: Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleO..

Sort Pandas Dataframe by Date

I have a pandas dataframe as follows: Symbol Date A 02/20/2015 A 01/15/2016 A 08/21/2015 I want to sort it by Date, but the column is just an object. I tried to make the column ..

AngularJS - difference between pristine/dirty and touched/untouched

AngularJS Developer Guide - Forms tell there are many styles and directives regarding forms and fields. For each one, a CSS class: ng-valid ng-invalid ng-pristine ng-dirty ng-touched ng-untouched W..

How to make a rest post call from ReactJS code?

I am new to ReactJS and UI and I wanted to know how to make a simple REST based POST call from ReactJS code. If there is any example present it would be really helpful...

re.sub erroring with "Expected string or bytes-like object"

I have read multiple posts regarding this error, but I still can't figure it out. When I try to loop through my function: def fix_Plan(location): letters_only = re.sub("[^a-zA-Z]", # Search for ..

Storyboard doesn't contain a view controller with identifier

I keep getting the following error: Storyboard (<UIStoryboard: 0x7ebdd20>) doesn't contain a view controller with identifier 'drivingDetails' This is the code: - (void)tableView:(UITableView..

How do I set a fixed background image for a PHP file?

I have an .html file with a login form and wish to recreate it and save it as a .php file. However, I'm encountering difficulties with setting the background image and other CSS related stuff. Below..

OpenCV NoneType object has no attribute shape

Hello I'm working on Raspberry Pi with OpenCV. I want to try a tutorial which is ball tracking in link http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/ But when I compile it, i get ..

How do I enable NuGet Package Restore in Visual Studio?

There's a similar post on stack but it doesn't help with my issue possibly because I am using Visual Studio 2015. How do I get the "Enable NuGet Package Restore" option to appear in VS2015? I chose ..

What is the difference between dynamic and static polymorphism in Java?

Can anyone provide a simple example that explains the difference between Dynamic and Static polymorphism in Java?..

Update style of a component onScroll in React.js

I have built a component in React which is supposed to update its own style on window scroll to create a parallax effect. The component render method looks like this: function() { let sty..

Understanding the ngRepeat 'track by' expression

I'm having difficulties understanding how the track by expression of ng-repeat in angularjs works. The documentation is very scarce: http://docs.angularjs.org/api/ng/directive/ngRepeat Can you explai..

How do I write dispatch_after GCD in Swift 3, 4, and 5?

In Swift 2, I was able to use dispatch_after to delay an action using grand central dispatch: var dispatchTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC))) ..

convert double to int

What is the best way to convert a double to an int? Should a cast be used?..

SQL Server database backup restore on lower version

How to restore a higher version SQL Server database backup file onto a lower version SQL Server? Using SQL Server 2008 R2 (10.50.1600), I made a backup file and now I want to restore it on my live se..

Split array into chunks

Let's say that I have an Javascript array looking as following: ["Element 1","Element 2","Element 3",...]; // with close to a hundred elements. What approach would be appropriate to chunk (split)..

What is output buffering?

What is output buffering and why is one using it in PHP?..

IIS 500.19 with 0x80070005 The requested page cannot be accessed because the related configuration data for the page is invalid error

I want to upload my own asp.net website on IIS with IIS Manager. But when I do this, I get the following error HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed b..

Selected tab's color in Bottom Navigation View

I'm adding a BottomNavigationView to a project, and I would like to have a different text (and icon tint) color for the selected tab (to achieve greying out non-selected tabs effect). Using a differen..

How can I get a first element from a sorted list?

I used Collections.sort(playersList); to sort a List. So, I think playersList is sorted now. But how can I get the first element of the list? playersList[0] does not work...

Certificate is trusted by PC but not by Android

Since this morning, my certificate is not trusted anymore on Android and then my application cannot connect anymore: Catch exception while startHandshake: javax.net.ssl.SSLHandshakeException: java...

Do you use source control for your database items?

I feel that my shop has a hole because we don't have a solid process in place for versioning our database schema changes. We do a lot of backups so we're more or less covered, but it's bad practice to..

PHP array: count or sizeof?

To find the number of elements in a PHP $array, which is faster/better/stronger? count($array) or sizeof($array) ? Edit Thanks to Andy Lester, I have refined my question to mean from a multilingual..

how to add values to an array of objects dynamically in javascript?

this is an array of objects, var data = [ {"label" : "1", "value" : 12}, {"label" : "1", "value" : 12}, {"label" : "1", "value" : 12}, {"label" : "1", "value" : 12} ]; h..

What causes this error? "Runtime error 380: Invalid property value"

we had developed an application using vb6.0 and SQL server 2000 a few years ago. recently, some of our customers tell us that while running the application, on some of computers which use Winxp sp2 a..

Best way to use PHP to encrypt and decrypt passwords?

Possible Duplicate: PHP 2-way encryption: I need to store passwords that can be retrieved I plan to store foreign account information for my users on my website, aka rapidshare username and..

Dynamically adding elements to ArrayList in Groovy

I am new to Groovy and, despite reading many articles and questions about this, I am still not clear of what is going on. From what I understood so far, when you create a new array in Groovy, the unde..

docker : invalid reference format

I'm following this tutorial: https://medium.com/towards-data-science/number-plate-detection-with-supervisely-and-tensorflow-part-1-e84c74d4382c and they use docker. When I tried to run docker (inside ..

ES6 exporting/importing in index file

I am currently using ES6 in an React app via webpack/babel. I am using index files to gather all components of a module and export them. Unfortunately, that looks like this: import Comp1_ from './Com..

Python json.loads shows ValueError: Extra data

I am getting some data from a JSON file "new.json", and I want to filter some data and store it into a new JSON file. Here is my code: import json with open('new.json') as infile: data = json.loa..

Regex for checking if a string is strictly alphanumeric

How can I check if a string contains only numbers and alphabets ie. is alphanumeric?..

What does ON [PRIMARY] mean?

I'm creating an SQL setup script and I'm using someone else's script as an example. Here's an example of the script: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[be_Categorie..

'python3' is not recognized as an internal or external command, operable program or batch file

I am using Python 3.5.2 version on Windows 7 and tried using python3 app.py. I am getting this error message: 'python3' is not recognized as an internal or external command, operable program or batch ..

How to use group by with union in t-sql

How can I using group by with union in t-sql? I want to group by the first column of a result of union, I wrote the following sql but it doesn't work. I just don't know how to reference the specified ..

Enzyme - How to access and set <input> value?

I'm confused about how to access <input> value when using mount. Here's what I've got as my test: it('cancels changes when user presses esc', done => { const wrapper = mount(<Editab..

Get all dates between two dates in SQL Server

How to get all the dates between two dates? I have a variable @MAXDATE which is storing the maximum date from the table. Now I want to get the all dates between @Maxdate and GETDATE() and want to stor..

How to show SVG file on React Native?

I want to show svg files (I have bunch of svg images) but the thing I couldn't find the way to show. I tried to use Image and Use components of react-native-svg but they don't work with that. And I tr..

How to POST JSON data with Python Requests?

I need to POST a JSON from a client to a server. I'm using Python 2.7.1 and simplejson. The client is using Requests. The server is CherryPy. I can GET a hard-coded JSON from the server (code not show..

Open URL in new window with JavaScript

I'm making a "share button" to share the current page. I would like to take the current page URL and open it in a new window. I have the current URL part working, but can't seem to get the next part w..

Apache Spark: The number of cores vs. the number of executors

I'm trying to understand the relationship of the number of cores and the number of executors when running a Spark job on YARN. The test environment is as follows: Number of data nodes: 3 Data node ..

How to remove a package from Laravel using composer?

What is the correct way to remove a package from Laravel using composer? So far I've tried: Remove declaration from composer.json (in "require" section) Remove any Class Aliases from app.ph..

How do I set the colour of a label (coloured text) in Java?

How do I set the color of the text of a label? myLabel.setText("Text Color: Red"); myLabel.??? Can I have two seperate colors in one label? For example here: The "Text Color:" to be black and the..

Is there any way to call a function periodically in JavaScript?

Is there any way to call a function periodically in JavaScript?..

Open new Terminal Tab from command line (Mac OS X)

Is it possible to open a new tab in Mac OS X's terminal from the command line in a currently opened tab? I know that the keyboard shortcut to open a new tab in Terminal is "CMD+t" but I am looking fo..

Controlling Spacing Between Table Cells

I'm trying to create a table where each cell has a background color with white space between them. But I seem to be having trouble doing this. I tried setting td margins but it seems to have no effec..

Converting XML to JSON using Python?

I've seen a fair share of ungainly XML->JSON code on the web, and having interacted with Stack's users for a bit, I'm convinced that this crowd can help more than the first few pages of Google results..

Replace String in all files in Eclipse

How can I search and replace a String in all files of my current project? Let's say I have the string "/sites/default/" now I want it to be "/public/sites/default/", but there are ..

Changing selection in a select with the Chosen plugin

I'm trying to change the currently selected option in a select with the Chosen plugin. The documentation covers updating the list, and triggering an event when an option is selected, but nothing (tha..

Run script on mac prompt "Permission denied"

I'm new to mac with not familiar on terminal command, i put the dvtcolorconvert.rb file on root directory of my volume, this ruby script can converting xcode 3 themes into xcode 4 themes format, which..

Typescript: No index signature with a parameter of type 'string' was found on type '{ "A": string; }

I have some vanilla javascript code that takes a string input, splits the string into characters, and then matches those characters to a key on an object. DNATranscriber = { "G":"C", "C": "G"..

What is the difference between % and %% in a cmd file?

I recently included a line similar to this in a .cmd file: for /f %%f in ('dir /b .\directory\*.sql') DO sqlcmd -b -o ".\directory\output\%%f.txt" -i ".\directory\%%f" Originally I had only used %f..

How to check if an option is selected?

$('#mySelectBox option').each(function() { if ($(this).isChecked()) alert('this option is selected'); else alert('this is not'); }); Apparently, the isChecked doesn't work. SO..

How to hide column of DataGridView when using custom DataSource?

I have a small app in c#, it has a DataGridView that gets filled using: grid.DataSource = MyDatasource array; MyClass hold the structure for the columns, it looks something like this: class MyDatas..

Angular File Upload

I'm a beginner with Angular, I want to know how to create Angular 5 File upload part, I'm trying to find any tutorial or doc, but I don't see anything anywhere. Any idea for this? And I tried ng4-fil..

Copy rows from one Datatable to another DataTable?

How can I copy specific rows from DataTable to another Datable in c#? There will be more than one row...

How to get text with Selenium WebDriver in Python

I'm trying to get text using Selenium WebDriver and here is my code. Please note that I don't want to use XPath, because in my case the ID gets changed on every relaunch of the web page. My code: text..

How to check if Receiver is registered in Android?

I need to check if my registered receiver is still registered if not how do i check it any methods?..

Read properties file outside JAR file

I have a JAR file where all my code is archived for running. I have to access a properties file which need to be changed/edited before each run. I want to keep the properties file in the same director..

How to Detect Browser Back Button event - Cross Browser

How do you definitively detect whether or not the user has pressed the back button in the browser? How do you enforce the use of an in-page back button inside a single page web application using a #..

How to add Tomcat Server in eclipse

I just installed Java EE plugin in plain eclipse and I am trying to add tomcat server. I opened add new server which showing "Choose the type of server to create" but there is no server list. How can..

Error 6 (net::ERR_FILE_NOT_FOUND): The files c or directory could not be found

I am working with scriptcase php code generator, which is installed in a server but i access it via the web. It was fine till someone logged off the administrator of the server (which is the user I us..

Binding a WPF ComboBox to a custom list

I have a ComboBox that doesn't seem to update the SelectedItem/SelectedValue. The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a Coll..

How do you add PostgreSQL Driver as a dependency in Maven?

I'm trying to develop a Java application with Maven while using Hibernate with a PostgreSQL database for persistence. I don't understand how I'm supposed to connect the PostgreSQL drivers to my applic..

What does Html.HiddenFor do?

Although I have read the documentation on Html.HiddenFor, I've not grasped what is it used for... Could somebody explain its uses and give a short example? Where should those helpers go in the code?..

document.createElement("script") synchronously

Is it possible to call in a .js file synchronously and then use it immediately afterward? <script type="text/javascript"> var head = document.getElementsByTagName('head').item(0); var s..

laravel Unable to prepare route ... for serialization. Uses Closure

When I clear caches in my Laravel 5.2 project, I see this error message: [LogicException] Unable to prepare route [panel] for serialization. Uses Closure. I think that it's related with a route ..

Tomcat in Intellij Idea Community Edition

Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition? I tried to find some information about it but haven't achived any success...

Git diff against a stash

How can I see the changes un-stashing will make to the current working tree? I would like to know what changes will be made before applying them!..

Why I get 411 Length required error?

This is how I call a service with .NET: var requestedURL = "https://accounts.google.com/o/oauth2/token?code=" + code + "&client_id=" + client_id + "&client_secret=" + client_secret + "&re..

nginx showing blank PHP pages

I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on display_errors in php.ini but ..

Is the LIKE operator case-sensitive with MSSQL Server?

In the documentation about the LIKE operator, nothing is told about the case-sensitivity of it. Is it? How to enable/disable it? I am querying varchar(n) columns, on an Microsoft SQL Server 2005 inst..

Clear ComboBox selected text

I have a ComboBox control with the DropDownStyle properties set to DropDownList. Once there is an item selected, how can I clear the selection from the ComboBox without deleting any Items in it ? I'd..

Find JavaScript function definition in Chrome

Chrome's Developer Tools rock, but one thing they don't seem to have (that I could find) is a way to find a JavaScript function's definition. This would be super handy for me because I'm working on a ..

C# loop - break vs. continue

In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration? Example: foreach..

How do I "select Android SDK" in Android Studio?

After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error "Please select Android SDK" when I click on the button to run the application in simulator, bu..

Where is debug.keystore in Android Studio

I need to enable google+ api, so I need the debug.keystore. I switched to Android Studio and do not know where it is. I can find it in eclipse at path ~/.android/debug.keystore...

Linux command (like cat) to read a specified quantity of characters

Is there a command like cat in linux which can return a specified quantity of characters from a file? e.g., I have a text file like: Hello world this is the second line this is the third line And ..

How to change Toolbar Navigation and Overflow Menu icons (appcompat v7)?

I am having a hard time with v7 Toolbar. What was once a simple task for ActionBar, now seems overly complex. No matter what style I set, I cannot change either navigation icon (which opens a Drawer) ..

How To Launch Git Bash from DOS Command Line?

I've got what I'm hoping is a simple question, but I haven't been able to find the answer yet. I would like to launch Git Bash from a DOS batch file. Here is what I tried so far: Launched Git Bash..

AngularJS $location not changing the path

I'm having an issue with changing the URL of the page after a form has been submitted. Here's the flow of my app: Routes are set, URL is recognized to some form page. Page loads, controller sets va..

How to send data to COM PORT using JAVA?

Possible Duplicate: Java Serial Communication on Windows Friends, I want to connect and transfer data to COM PORT (either virtual or original) in JAVA?..

How to find the .NET framework version of a Visual Studio project?

I have a project in Visual Studio. How can I find out which .NET Framework version it's for?..

How to create an Array with AngularJS's ng-model

I'm trying to create an array holding telephones, i have this code <input type="text" ng-model="telephone[0]" /> <input type="text" ng-model="telephone[1]" /> But i can't access $scope...

How to add line break for UILabel?

Let see that I have a string look like this: NSString *longStr = @"AAAAA\nBBBBB\nCCCCC"; How do I make it so that the UILabel display the message like this AAAAA BBBBB CCCCC I don..

What's the best way to dedupe a table?

I've seen a couple of solutions for this, but I'm wondering what the best and most efficient way is to de-dupe a table. You can use code (SQL, etc.) to illustrate your point, but I'm just looking for ..

How to upgrade Git on Windows to the latest version?

I just upgraded to Git 1.8.0.1 for Windows, from my previous version 1.7.9.mysysgit.0. I downloaded the new version from the Git site and installed through the normal Git installer EXE. That said, wh..

Returning binary file from controller in ASP.NET Web API

I'm working on a web service using ASP.NET MVC's new WebAPI that will serve up binary files, mostly .cab and .exe files. The following controller method seems to work, meaning that it returns a file,..

Remove non-numeric characters (except periods and commas) from a string

If I have the following values: $var1 = AR3,373.31 $var2 = 12.322,11T How can I create a new variable and set it to a copy of the data that has any non-numeric characters removed, with the excep..

Installing J2EE into existing eclipse IDE

I have Eclipse Galileo (Version: 3.5.2), which I use to develop Jave SE applications. I want to learn Java EE. How do I incorporate Java EE? Or do I need to install a Java EE specific Eclipse IDE? Fo..

converting string to long in python

Python provides a convenient method long() to convert string to long: long('234') ; converts '234' into a long If user keys in 234.89 then python will raise an error message: ValueError: invalid..

Python 3 ImportError: No module named 'ConfigParser'

I am trying to pip install the MySQL-python package, but I get an ImportError. Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python Downloading/u..

Replacing some characters in a string with another character

I have a string like AxxBCyyyDEFzzLMN and I want to replace all the occurrences of x, y, and z with _. How can I achieve this? I know that echo "$string" | tr 'x' '_' | tr 'y' '_' would work..

How to copy directories in OS X 10.7.3?

Hi I'm trying to copy my rails_projects directory from haseebjaved/Desktop/rails_projects to my home directory, which is haseebjaved. How can I do this via the Command Line? Also, can I see my home ..

How to show DatePickerDialog on Button click?

I'm developing an app that requires user to select date(dd/mm/yyyy). I want to show a dialog box with DatePicker on button click. once date is selected it must show in EditText. I'm using Android Stu..

How to redirect 'print' output to a file using python?

I want to redirect the print to a .txt file using python. I have a 'for' loop, which will 'print' the output for each of my .bam file while I want to redirect ALL these output to one file. So I tried ..

How to get the connection String from a database

I have created a database with SQL Server Management Studio, I would like to now use it in my C# application. I need the connection string? Where can I find the connection string, and where is my dat..

Create a symbolic link of directory in Ubuntu

Below is my code for creating a symlink of a directory: sudo ln -s /usr/local/nginx/conf/ /etc/nginx I already created the directory /etc/nginx. I just want the contents of the source directory (/..

How to open child forms positioned within MDI parent in VB.NET?

How do we arrange child forms in a parent MDI window? I'm able to call and display a child form from a menu on the parent, but the child pops up outside the parent - I want it to actually be inside th..

How to remove leading and trailing white spaces from a given html string?

I've the following HTML string. What would be sample code in JavaScript to remove leading and trailing white spaces from this string? <p>&nbsp;&nbsp;</p> <div>&nbsp;<..

Text File Parsing with Python

I am trying to parse a series of text files and save them as CSV files using Python (2.7.3). All text files have a 4 line long header which needs to be stripped out. The data lines have various delimi..

How to use unicode characters in Windows command line?

We have a project in Team Foundation Server (TFS) that has a non-English character (š) in it. When trying to script a few build-related things we've stumbled upon a problem - we can't pass the š let..

C/C++ Struct vs Class

After finishing my C++ class it seemed to me the structs/classes are virtually identical except with a few minor differences. I've never programmed in C before; but I do know that it has structs. In ..

Searching a list of objects in Python

Let's assume I'm creating a simple class to work similar to a C-style struct, to just hold data elements. I'm trying to figure out how to search a list of objects for objects with an attribute equali..

History or log of commands executed in Git

Is there a way I can keep track of commands I used in Git under Windows? I want to view all the commands that I have applied on my repository. I want to be able to go back through the command histor..

How do I verify that an Android apk is signed with a release certificate?

How can I check that an Android apk is signed with a release and not debug cert?..

Google Play app description formatting

I've made an Android application that is available on Google Play. Now I want to add some more formatting to my app description (eg. indent, links, lists..). But I cannot find any website where possib..

The difference between fork(), vfork(), exec() and clone()

I was looking to find the difference between these four on Google and I expected there to be a huge amount of information on this, but there really wasn't any solid comparison between the four calls. ..

UTL_FILE.FOPEN() procedure not accepting path for directory?

I am trying to write in a file stored in c:\ drive named vin1.txt and getting this error .Please suggest! > ERROR at line 1: ORA-29280: invalid > directory path ORA-06512: at > "SYS.UTL_FILE..

Why am I getting ImportError: No module named pip ' right after installing pip?

I have installed pip and ez setup. I also checked the system path and I can see the module in the folder structure. Still when i try to run pip command, I get an Import error saying no module named pi..

asp.net validation to make sure textbox has integer values

I have a required validation setup on a textbox, but I also have to make sure it is an integer. How can I do this?..

jQuery SVG, why can't I addClass?

I am using jQuery SVG. I can't add or remove a class to an object. Anyone know my mistake? The SVG: <rect class="jimmy" id="p5" x="200" y="200" width="100" height="100" /> The jQuery that wo..

dropping infinite values from dataframes in pandas?

what is the quickest/simplest way to drop nan and inf/-inf values from a pandas DataFrame without resetting mode.use_inf_as_null? I'd like to be able to use the subset and how arguments of dropna, exc..

XmlSerializer giving FileNotFoundException at constructor

An application I've been working with is failing when I try to serialize types. A statement like XmlSerializer lizer = new XmlSerializer(typeof(MyType)); produces: System.IO.FileNotFoundException..

SecurityException: Permission denied (missing INTERNET permission?)

this error is really really really strange and I don't know how to reproduce it and how to fix it because I made a lot of searches but nothing was useful. Here's the stacktrace: Stack Trace ________..

Remove a git commit which has not been pushed

I did a git commit but I have not pushed it to the repository yet. So when I do git status, I get '# Your branch is ahead of 'master' by 1 commit. So if I want to roll back my top commit, can I just ..

Make child visible outside an overflow:hidden parent

In CSS the overflow:hidden is set on parent containers in order to allow it to expand with the height of their floating children. But it also has another interesting feature when combined with marg..

How to debug in Django, the good way?

So, I started learning to code in Python and later Django. The first times it was hard looking at tracebacks and actually figure out what I did wrong and where the syntax error was. Some time has pass..

Difference between WebStorm and PHPStorm

I'm choosing an IDE for web development and I would like to know what the differences between WebStorm and PHPStorm are. I couldn't find any major points on JetBrains' website and even Google didn't ..

What is the incentive for curl to release the library for free?

I recently started using libCurl for my VC++ project. I've been wondering: what is the incentive for the curl creators to release the entire library for free? Is it purely to help their fellow develo..

How to create a new branch from a tag?

I'd like to create a new master branch from an existing tag. Say I have a tag v1.0. How to create a new branch from this tag?..