Questions Tagged with #Nsexception

NSException is a Mac Developer Library class used to implement exception handling and contains information about an exception.

@try - catch block in Objective-C

Why doesn't @try block work? It crashed the app, but it was supposed to be caught by the @try block. NSString* test = [NSString stringWithString:@"ss"]; @try { [test characterAtIndex:6]; } ..

Find the location of a character in string

I would like to find the location of a character in a string. Say: string = "the2quickbrownfoxeswere2tired" I would like the function to return 4 and 24 -- the character location of the 2s in strin..

Connecting to Postgresql in a docker container from outside

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

Excel VBA: AutoFill Multiple Cells with Formulas

I have big amount of data that I collected from different files. In this main workbook, I have different types of formulas for every cells. In range A to F is where the data from other files are colle..

How to only get file name with Linux 'find'?

I'm using find to all files in directory, so I get a list of paths. However, I need only file names. i.e. I get ./dir1/dir2/file.txt and I want to get file.txt..

How to reset index in a pandas dataframe?

I have a dataframe from which I remove some rows. As a result, I get a dataframe in which index is something like that: [1,5,6,10,11] and I would like to reset it to [0,1,2,3,4]. How can I do it? T..

OpenSSL Command to check if a server is presenting a certificate

I'm trying to run an openssl command to narrow down what the SSL issue might be when trying to send an outbound message from our system. I found this command in another topic: Using openssl to get th..

How to find the length of an array in shell?

How do I find the length of an array in shell? For example: arr=(1 2 3 4 5) And I want to get its length, which is 5 in this case...

Loop through Map in Groovy?

I have a very simple task I am trying to do in Groovy but cannot seem to get it to work. I am just trying to loop through a map object in groovy and print out the key and value but this code does not ..

How to compile C program on command line using MinGW?

What command does one have to enter at the command line in Windows 7 to compile a basic C program? Like I am literally wondering what you type in the command prompt, to compile a .c file. I tried: ..

Rmi connection refused with localhost

I have a problem using java rmi: When I'm trying to run my server, I get a connectException (see below). Exception happens when executing the rebind method: Runtime.getRuntime().exec("rmiregistry 2..

Open a webpage in the default browser

I want my users to be able to click a button to open my company's webpage in the default browser when clicked. How would I do this? I'm using VB.net so all .net examples are acceptable...

Populating a razor dropdownlist from a List<object> in MVC

I have a model: public class DbUserRole { public int UserRoleId { get; set; } public string UserRole { get; set; } } public class DbUserRoles { public List<DbU..

Return an empty Observable

The function more() is supposed to return an Observable from a get request export class Collection{ public more = (): Observable<Response> => { if (this.hasMore()) { re..

Simple file write function in C++

I have this code: // basic file operations #include <iostream> #include <fstream> using namespace std; int main() { writeFile(); } int writeFile () { ofstream myfile; myfile.op..

Can´t run .bat file under windows 10

I have few .bat files that I used under Windows XP. Now I want to use them under Windows 10, but when I run one of the files (even as administrator) it shows the command prompt screen for 1 second and..

Keyboard shortcuts with jQuery

How can I wire an event to fire if someone presses the letter g? (Where is the character map for all the letters BTW?)..

How to install Java 8 on Mac

I want to do some programming with the latest JavaFX, which requires Java 8. I'm using IntelliJ 13 CE and Mac OS X 9 Mavericks. I ran Oracle's Java 8 installer, and the files look like they ended up a..

Explanation of the UML arrows

I have recently been studying UML and drawing simple diagrams with ordinary plain arrows between classes, but I know it's not enough. There are plenty of other arrows: generalization, realisation and ..

Python subprocess.Popen "OSError: [Errno 12] Cannot allocate memory"

Note: This question was originally asked here but the bounty time expired even though an acceptable answer was not actually found. I am re-asking this question including all details provided in the or..

PostgreSQL: insert from another table

I'm trying to insert data to a table from another table and the tables have only one column in common. The problem is, that the TABLE1 has columns that won't accept null values so I can't leave them e..

Force encode from US-ASCII to UTF-8 (iconv)

I'm trying to transcode a bunch of files from US-ASCII to UTF-8. For that, I'm using iconv: iconv -f US-ASCII -t UTF-8 file.php > file-utf8.php My original files are US-ASCII encoded, which mak..

Changing the tmp folder of mysql

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

How to encrypt String in Java

What I need is to encrypt string which will show up in 2D barcode(PDF-417) so when someone get an idea to scan it will get nothing readable. Other requirements: should not be complicated it shoul..

What is the meaning of 'No bundle URL present' in react-native?

When I run a react-native project, I get a error no bundle URL present , but I don't know what mistakes I do, I was very confused. ..

Parse rfc3339 date strings in Python?

I have a datasets where all the dates have the following format: 2012-10-09T19:00:55Z I'd like to be able to be able to use methods like .weekday on them. How do I convert them to the proper format..

Show constraints on tables command

I have tables that I've tried setting PK FK relationships on but I want to verify this. How can I show the PK/FK restraints? I saw this manual page, but it does not show examples and my google search ..

OS X Terminal Colors

I'm new to OS X, having just gotten a Mac after working with Ubuntu Linux for some time. Among the many things I'm trying to figure out is the absence of colors in my terminal window - like the ones t..

How to find and replace string?

If s is a std::string, then is there a function like the following? s.replace("text to replace", "new text"); ..

Count number of occurrences for each unique value

Basically I have a table similar to this: time.....activities.....length 13:00........3.............1 13:15........2.............2 13:00........3.............2 13:30........1.............1 ..

Download Returned Zip file from URL

If I have a URL that, when submitted in a web browser, pops up a dialog box to save a zip file, how would I go about catching and downloading this zip file in Python?..

VBA Count cells in column containing specified value

I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as "19/12/11" or "Green" then associate this number with a variable, Does anyon..

java Compare two dates

I want to compare two dates and check if the date has expired or not. Here is the code I used : SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:ss:ii"); Date date1 = sdf.parse("20012-10-4..

How to loop over a Class attributes in Java?

How can I loop over a class attributes in java dynamically. For eg : public class MyClass{ private type1 att1; private type2 att2; ... public void function(){ for(var in MyC..

How to resize a VirtualBox vmdk file

I've run out of space on a virtual machine disk which is a vmdk and need to resize the virtual image. Resizing with the command vboxmanage modifyhd Machine-disk1.vmdk --resize 30720 gives the erro..

using mailto to send email with an attachment

How can i send an email with an attachment (either local file or a file in the intranet) using outlook 2010? <a href="mailto:[email protected]?subject=my report&body=see attachment&attachment=c:..

Generic type conversion FROM string

I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add typed properties, so that th..

MySQL Data Source not appearing in Visual Studio

I just installed the ADO.NET connector from here http://dev.mysql.com/downloads/connector/net/ Yet MySQL doesn't appear as a data source like it should. I tried restarting Visual Studio. It doesn't f..

DataTables: Cannot read property style of undefined

I am getting this error with the following: jquery.dataTables.js:4089 Uncaught TypeError: Cannot read property 'style' of undefined(…) _fnCalculateColumnWidths @ jquery.dataTables.js:4089 _fnInitia..

How to execute my SQL query in CodeIgniter

I have a problem with my query and I need to join two tables from different databases now my problem is how can I execute my query. I got my syntax format from here Please visit first this link so y..

phpMyAdmin allow remote users

I need to modify the file /etc/httpd/conf.d/phpMyAdmin.conf in order to allow remote users (not only localhost) to login # phpMyAdmin - Web based MySQL browser written in php # # Allows only localho..

favicon not working in IE

I have a site using a custom favicon.ico. The favicon displays as expected in all browsers except IE. When trying to display the favicon in IE, I get the big red x; when displaying the favicon in anot..

how to convert a string date to date format in oracle10g

My date value is stored as varchar2 and the value is 15/August/2009,4:30 PM, how to convert this to a proper date format like DD-MM-YYYY...

Adding onClick event dynamically using jQuery

Due to a plugin being used, I can't add the "onClick" attribute to the HTML form inputs like usual. A plugin is handling the forms part in my site and it doesn't give an option to do this automaticall..

Why doesn't Console.Writeline, Console.Write work in Visual Studio Express?

I just open a console application and I type Console.WriteLine("Test"); But the output window doesn't show this. I go to the output window with Ctrl+W,O But nothing shows up when I run my program,..

Why does ANT tell me that JAVA_HOME is wrong when it is not?

I get the error: C:\dev\ws\springapp\build.xml:81: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set..

Find the files existing in one directory but not in the other

I'm trying to find the files existing in one directory but not in the other, I tried to use this command: diff -q dir1 dir2 The problem with the above command that it finds both the files in dir1 b..

Scroll to bottom of Div on page load (jQuery)

I have a div on my page: <div id='div1' style='overflow:scroll;overflow-x:hidden;max-height:200px;'></div> How can I make the div scroll to the bottom of the div?? Not the page, just th..

How do I get the path of the assembly the code is in?

Is there a way to get the path for the assembly in which the current code resides? I do not want the path of the calling assembly, just the one containing the code. Basically my unit test needs to ..

XSLT counting elements with a given value

I need to count the number of elements in an XML file that have a particular value (to verify uniqueness). The XML file looks like this: EDIT: I updated the original "simplified" XML with the actual ..

Best practice to validate null and empty collection in Java

I want to verify whether a collection is empty and null. Could anyone please let me know the best practice. Currently, I am checking as below: if (null == sampleMap || sampleMap.isEmpty()) { // do..

How do I create a transparent Activity on Android?

I want to create a transparent Activity on top of another activity. How can I achieve this?..

how to dynamically add options to an existing select in vanilla javascript

I'd like to add option to a select dynamically using plain javascript. Everything I could find involves JQuery or tries to create the select dynamically as well. The closest thing I could find was D..

How to determine the version of Gradle?

How can I know which version of Gradle I am using in my Android Studio? Please guide. I want to make sure I am using Gradle version 2.2.1...

How to recognize vehicle license / number plate (ANPR) from an image?

I have a web site that allows users to upload images of cars and I would like to put a privacy filter in place to detect registration plates on the vehicle and blur them. The blurring is not a proble..

How to set table name in dynamic SQL query?

I want to set table name in a dynamic SQL query. I tried successfully for parameter as following: /* Using sp_executesql */ /* Build and Execute a Transact-SQL String with a single parameter value U..

MSBuild doesn't copy references (DLL files) if using project dependencies in solution

I have four projects in my Visual Studio solution (everyone targeting .NET 3.5) - for my problem only these two are important: MyBaseProject <- this class library references a third-party DLL fil..

Update int column in table with unique incrementing values

I am trying to populate any rows missing a value in their InterfaceID (INT) column with a unique value per row. I'm trying to do this query: UPDATE prices SET interfaceID = (SELECT ISNULL(MAX(interf..

Cropping images in the browser BEFORE the upload

Many libraries I have found, like Jcrop, do not actually do the cropping, it only creates an image cropping UI. It then depends on the server doing the actual cropping. How can I make the image cropp..

How can I compare two ordered lists in python?

If I have one long list: myList = [0,2,1,0,2,1] that I split into two lists: a = [0,2,1] b = [0,2,1] how can I compare these two lists to see if they are both equal/identical, with the constraint t..

editing PATH variable on mac

How to edit PATH variable on mac (Lion). I cannot find any file where I can add paths. can someone guide me about it? Whats the file name? .profile or .bash_profile??? and where I can find it? I hav..

Export Postgresql table data using pgAdmin

I am using pgAdmin version 1.14.3. PostgreSQL database version is 9.1. I got all Db script for table creation but unable to export all data inside tables. Could not find any option to export data in ..

How to get $HOME directory of different user in bash script?

I need to execute part of a bash script as a different user, and inside that user's $HOME directory. However, I'm not sure how to determine this variable. Switching to that user and calling $HOME does..

How can I get the corresponding table header (th) from a table cell (td)?

Given the following table, how would I get the corresponding table header for each td element? <table> <thead> <tr> <th id="name">Name</th> ..

No such keg: /usr/local/Cellar/git

I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing $git add -i and I got this error: Can't locate ..

Getting the number of filled cells in a column (VBA)

My first column is an index, with monotonously increasing numbers, which ends at a non predictable point. Now I want to find out, how many entries this column has. Is there a better way than iterating..

How to change app default theme to a different app theme?

I have an Android app that has a default theme of Holo.Light but I want to change it to Theme.Black.I tried to do this by changing the style tag in the manifest android:theme="@style/AppTheme" to Them..

DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703

I am getting this JDBC exception. I googled it but the explanation was very abstract. DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703 com.misys.liq.jsqlaccess.adapter.jdbcadapter.util.JDBCAdapterExcep..

create table with sequence.nextval in oracle

i created a sequence using the following query, create sequence qname_id_seq start with 1 increment by 1 nocache; Now when i try to create a table which uses the above sequence, it is throwing the ..

Swift: Testing optionals for nil

I'm using Xcode 6 Beta 4. I have this weird situation where I cannot figure out how to appropriately test for optionals. If I have an optional xyz, is the correct way to test: if (xyz) // Do somethi..

How to flip background image using CSS?

How to flip any background image using CSS? Is it possible? currenty I'm using this arrow image in a background-image of li in css On :visited I need to flip this arrow horizontally. I can do this..

How do I combine a background-image and CSS3 gradient on the same element?

How do I use CSS3 gradients for my background-color and then apply a background-image to apply some sort of light transparent texture?..

Amazon S3 exception: "The specified key does not exist"

I am using the AmazonS3Client in an Android app using a getObject request to download an image from my Amazon S3 bucket. Currently, I am getting this exception: com.amazonaws.services.s3.model.Amazo..

Submit button doesn't work

I have a form with <input type="submit". In chrome submit doesn't do anything. On a "network" in tab in developer tools I see nothing. No errors in developer tools either. Meanwhile, if I do save a..

How to get current working directory using vba?

I am using MS Excel 2010 and trying to get the current directory using the below code, path = ActiveWorkbook.Path But ActiveWorkbook.Path returns blank...

How do I specify unique constraint for multiple columns in MySQL?

I have a table: table votes ( id, user, email, address, primary key(id), ); Now I want to make the columns user, email, address unique (together). How do I do this in MySql? O..

A simple algorithm for polygon intersection

I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be max..

How do I call a SQL Server stored procedure from PowerShell?

I have a large CSV file and I want to execute a stored procedure for each line. What is the best way to execute a stored procedure from PowerShell?..

update package.json version automatically

Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program. Is there a way to edit the file package.json automatically? Would using a git p..

VBA vlookup reference in different sheet

In Excel 2007, I am looping through the values of column 4 in Sheet 2. Still in Sheet 2, I want to output the result of my vlookup formula into column 5. The vlookup formula needs to refer to Sheet 1 ..

How to store arrays in MySQL?

I have two tables in MySQL. Table Person has the following columns: id | name | fruits The fruits column may hold null or an array of strings like ('apple', 'orange', 'banana'), or ('strawberry'), ..

How to do SQL Like % in Linq?

I have a procedure in SQL that I am trying to turn into Linq: SELECT O.Id, O.Name as Organization FROM Organizations O JOIN OrganizationsHierarchy OH ON O.Id=OH.OrganizationsId where OH.Hierarchy lik..

Fastest way to tell if two files have the same contents in Unix/Linux?

I have a shell script in which I need to check whether two files contain the same data or not. I do this a for a lot of files, and in my script the diff command seems to be the performance bottleneck...

How to make JavaScript execute after page load?

I'm executing an external script, using a <script> inside <head>. Now since the script executes before the page has loaded, I can't access the <body>, among other things. I'd like t..

Collapse all methods in Visual Studio Code

In Visual Studio Professional, we have a shortcut key, Ctrl + M Ctrl + O to collapse all methods and properties in a class. How can I do a similar thing in Visual Studio Code? I know there are short..

Does hosts file exist on the iPhone? How to change it?

I am developing an application that query to the server. In my Mac, I use the hosts file to change the dns to point to a local server within my local area network. Now I need to test it with my iPhon..

Image encryption/decryption using AES256 symmetric block ciphers

Is there any good example of how to encrypt and decrypt image and other files with AES on Android?..

Why do we assign a parent reference to the child object in Java?

I am asking a quite simple question, but I am bit confused in this. Suppose I have a class Parent: public class Parent { int name; } And have another class Child: public class Child extends Pare..

How does Java deal with multiple conditions inside a single IF statement

Lets say I have this: if(bool1 && bool2 && bool3) { ... } Now. Is Java smart enough to skip checking bool2 and bool2 if bool1 was evaluated to false? Does java even check them from ..

Test whether string is a valid integer

I'm trying to do something common enough: Parse user input in a shell script. If the user provided a valid integer, the script does one thing, and if not valid, it does something else. Trouble is, I h..

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 MVC3 Razor - Html.ActionLink style

I'm trying to set the style of an action link like so: <text><p>Signed in as @Html.ActionLink(Context.User.Identity.Name,"Index",new { Controller="Account", @style="text-transform:capit..

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 /v:xxx.xxx.xxx.xxx /admin But it ask me to enter password. Can anyone help me to skip this step? I w..

How to know if .keyup() is a character key (jQuery)

How to know if .keyup() is a character key (jQuery) $("input").keyup(function() { if (key is a character) { //such as a b A b c 5 3 2 $ # ^ ! ^ * # ...etc not enter key or shift or Esc or space ...e..

Jenkins: Can comments be added to a Jenkinsfile?

Are comments possible in a Jenkinsfile? If so, what's the syntax? I am using the declarative pipeline syntax. I want to comment out the "post" section below until my SMTP server is working. pipelin..

What does $(function() {} ); do?

Sometimes I make a function and call the function later. Example: function example { alert('example'); } example(); // <-- Then call it later Somehow, some functions cannot be called. I have to..

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

form_for but to post to a different action

I want to have a form_for @user, but post to a custom action in the users controller. How can I do this?..

Rounding up to next power of 2

I want to write a function that returns the nearest next power of 2 number. For example if my input is 789, the output should be 1024. Is there any way of achieving this without using any loops but ju..

Why is NULL undeclared?

I have a problem with this struct contructor when I try to compile this code: typedef struct Node { Node( int data ) // { this->data = data; previous = NULL; // Compiler in..

It says that TypeError: document.getElementById(...) is null

Althought I pushed a parameter to getElementById I wonder from where is this 'is null' error coming from? TypeError: document.getElementById(...) is null [Break On This Error] document.getElemen..

What is this weird colon-member (" : ") syntax in the constructor?

Recently I've seen an example like the following: #include <iostream> class Foo { public: int bar; Foo(int num): bar(num) {}; }; int main(void) { std::cout << Foo(42).bar <<..

Setting Authorization Header of HttpClient

I have an HttpClient that I am using for a REST API. However I am having trouble setting up the Authorization header. I need to set the header to the token I received from doing my OAuth request. I sa..

How to do an update + join in PostgreSQL?

Basically, I want to do this: update vehicles_vehicle v join shipments_shipment s on v.shipment_id=s.id set v.price=s.price_per_vehicle; I'm pretty sure that would work in MySQL (my backgroun..

T-SQL datetime rounded to nearest minute and nearest hours with using functions

In SQL server 2008, I would like to get datetime column rounded to nearest hour and nearest minute preferably with existing functions in 2008. For this column value 2007-09-22 15:07:38.850, the outpu..

How to check if the request is an AJAX request with PHP

I would like to check server-side if a request to my php page is an ajax request or not. I saw two ways to do this: First way: sending a GET parameter in the request which tells the page that this i..

How do I use T-SQL's Case/When?

I have a huge query which uses case/when often. Now I have this SQL here, which does not work. (select case when xyz.something = 1 then 'SOMETEXT' else (select case when xyz.somethingel..

How to get pip to work behind a proxy server

I am trying to use python package manager pip to install a package and it's dependencies from the internet. However I am behind a proxy in my college and have already set the http_proxy environment va..

UUID max character length

We are using UUID as primary key for out oracle DB, and trying to determine an appropriate max character length for the VARCHAR. Apparently this is 36 characters but we have noticed UUID'S generated w..

"The public type <<classname>> must be defined in its own file" error in Eclipse

I have written the following code: package staticshow; public class StaticDemo { static int a = 3; static int b = 4; static { System.out.println("Voila! Static block put into action"); ..

PHP DateTime __construct() Failed to parse time string (xxxxxxxx) at position x

I had this construction error when trying to creating a new DateTime object using a timestamp: Exception: DateTime::_construct(): Failed to parse time string (1372622987) at position 8 (8): Unexpe..

Python Pandas : pivot table with aggfunc = count unique distinct

df2 = pd.DataFrame({'X' : ['X1', 'X1', 'X1', 'X1'], 'Y' : ['Y2','Y1','Y1','Y1'], 'Z' : ['Z3','Z1','Z1','Z2']}) X Y Z 0 X1 Y2 Z3 1 X1 Y1 Z1 2 X1 Y1 Z1 3 X1 Y1 Z2 g=df2.groupby('X'..

POST request via RestTemplate in JSON

I didn't find any example how to solve my problem, so I want to ask you for help. I can't simply send POST request using RestTemplate object in JSON Every time I get: org.springframework.web.clie..

How do I declare a namespace in JavaScript?

How do I create a namespace in JavaScript so that my objects and functions aren't overwritten by other same-named objects and functions? I've used the following: if (Foo == null || typeof(Foo) != "ob..

asp.net mvc @Html.CheckBoxFor

I have checkboxes in my form I added at my model using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace CorePartners_Site2.Models { public class Care..

Is it possible to wait until all javascript files are loaded before executing javascript code?

We have several JavaScript files which we load at the bottom of the master page. However, I have the situation that I need to perform some JavaScript before the other scripts are loaded. Is it possibl..

Difference between two DateTimes C#?

I need a function that can return the difference between the below two dates as 24. DateTime a = new DateTime(2008, 01, 02, 06, 30, 00); DateTime b = new DateTime(2008, 01, 03, 06, 30, 00); ..

javac option to compile all java files under a given directory recursively

I am using the javac compiler to compile java files in my project. The files are distributed over several packages like this: com.vistas.util, com.vistas.converter, com.vistas.LineHelper, com.current...

How to hide the Google Invisible reCAPTCHA badge

When implementing the new Google Invisible reCATPTCHA, by default you get a little "protected by reCAPTCHA" badge in the bottom right of the screen that pops out when you roll over it. I'd like to ..

How to remove lines in a Matplotlib plot

How can I remove a line (or lines) of a matplotlib axes in such a way as it actually gets garbage collected and releases the memory back? The below code appears to delete the line, but never releases..

How can I pretty-print JSON in a shell script?

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... into something like this: { "foo"..

Get page title with Selenium WebDriver using Java

How can I verify some text in the title tag using Selenium WebDriver and java?..

how to use concatenate a fixed string and a variable in Python

I want to include file name 'main.txt' in the subject for that I am passing file name from command line. but getting error in doing so python sample.py main.txt #running python with argument msg['..

Calculate date/time difference in java

I want to calculate difference between 2 dates in hours/minutes/seconds. I have a slight problem with my code here it is : String dateStart = "11/03/14 09:29:58"; String dateStop = "11/03/14 09:33:..

How can building a heap be O(n) time complexity?

Can someone help explain how can building a heap be O(n) complexity? Inserting an item into a heap is O(log n), and the insert is repeated n/2 times (the remainder are leaves, and can't violate the ..

background:none vs background:transparent what is the difference?

Is there a difference between these two CSS properties: background: none; background: transparent; Are they both valid? Which one should be used and why? ..

font-family is inherit. How to find out the font-family in chrome developer pane?

In the Chrome's developer pane, I can see these css settings of an element. As far as I can see, every single font-family value is inherit. How can I find what is the actual value of the font fam..

How do I sort arrays using vbscript?

I'm scanning through a file looking for lines that match a certain regex pattern, and then I want to print out the lines that match but in alphabetical order. I'm sure this is trivial but vbscript isn..

Is SMTP based on TCP or UDP?

Is SMTP based on TCP or UDP ? I really can't confirm it . In my opinion, SMTP should be based on UDP, but someone told me that is must be TCP...

How to use PHP to connect to sql server

I want to use PHP to connect to sql server database. I installed xampp 1.7.0(php 5.2) and SQLSRV20. I've added the extensions in php.ini and I get this error: Warning: mssql_connect() [function.mss..

Handling the window closing event with WPF / MVVM Light Toolkit

I'd like to handle the Closing event (when a user clicks the upper right 'X' button) of my window in order to eventually display a confirm message or/and cancel the closing. I know how to do this in ..

How do you normalize a file path in Bash?

I want to transform /foo/bar/.. to /foo Is there a bash command which does this? Edit: in my practical case, the directory does exist...

jQuery scrollTop() doesn't seem to work in Safari or Chrome (Windows)

I've got a simple setup to allow a "help"-style window to be loaded and scrolled to a particular point on the page. More or less the code looks like this: var target = /* code */; target.offsetParent..

Parse HTML in Android

I am trying to parse HTML in android from a webpage, and since the webpage it not well formed, I get SAXException. Is there a way to parse HTML in Android?..

What's the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?

1 - I'm reading the documentation and I'm slightly confused with the wording. It says: ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable..

How does spring.jpa.hibernate.ddl-auto property exactly work in Spring?

I was working on my Spring boot app project and noticed that, sometimes there is a connection time out error to my Database on another server(SQL Server). This happens specially when I try to do some..

jQuery - on change input text

I am trying to make a function which will execute when the value of a text input field is changed. The value of the field changes when a table cell is clicked, not on keyup, nor paste. I tried it like..

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'?

When I run: C:\Users\ashahria\Downloads>java -jar schemaSpy_5.0.0.jar I get the error below. What is wrong? How can I fix it? Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\Curre..

Android device chooser - My device seems offline

I have developed an application and i was planning to deploy it to my HTC Desire. I have installed USB driver. I turned on USB debugging on the phone and choosed charge only when phone plugged-in. Whe..

Resize image proportionally with CSS?

Is there a way to resize (scale down) images proportionally using ONLY CSS? I'm doing the JavaScript way, but just trying to see if this is possible with CSS...

How to extract numbers from a string and get an array of ints?

I have a String variable (basically an English sentence with an unspecified number of numbers) and I'd like to extract all the numbers into an array of integers. I was wondering whether there was a qu..

Set NOW() as Default Value for datetime datatype?

I have two columns in table users namely registerDate and lastVisitDate which consist of datetime data type. I would like to do the following. Set registerDate defaults value to MySQL NOW() Set last..

m2eclipse not finding maven dependencies, artifacts not found

I'm using m2eclipse as my maven 2 plugin for eclipse. I'm brand new to maven, so my mistake might be simple, although searching has not yielded any solutions for me. I can run maven from the command..

Python - Get path of root project structure

I've got a python project with a configuration file in the project root. The configuration file needs to be accessed in a few different files throughout the project. So it looks something like: <..

How to push local changes to a remote git repository on bitbucket

I'm testing out Git and Bitbucket. I've created a repository on Bitbucket and have created a local copy of the repo and I am committing files into it. I can't seem to push the files from my local rep..

How to show git log history (i.e., all the related commits) for a sub directory of a git repo?

Lets say that I have a git repo that looks like this. foo/ .git/ A/ ... big tree here B/ ... big tree here Is there a way to ask git log to show only the log messages for a specific dir..

How to change maximum number of POST variable in PHP?

I'm using WAMP in my local machine, when a FORM(method="POST") with 2000 input fields is submitted I'm able to read only 1001 _POST variable. i.e With Netbeans debugger I can clearly see _PO..

How to recursively list all the files in a directory in C#?

How to recursively list all the files in a directory and child directories in C#?..

How can I import Swift code to Objective-C?

I have written a library in Swift and I wasn't able to import it to my current project, written in Objective-C. Are there any ways to import it? #import "SCLAlertView.swift" - 'SCLAlertView.swift' ..

How to reverse an std::string?

Im trying to figure out how to reverse the string temp when I have the string read in binary numbers istream& operator >>(istream& dat1d, binary& b1) { string..

How do I generate a random int number?

How do I generate a random integer in C#?..

Getting all types that implement an interface

Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations? This is what I want to re-write: foreach (Type t in this.Ge..

How to remove undefined and null values from an object using lodash?

I have a Javascript object like: var my_object = { a:undefined, b:2, c:4, d:undefined }; How to remove all the undefined properties? False attributes should stay...

Run text file as commands in Bash

If I have a text file with a separate command on each line how would I make terminal run each line as a command? I just don't want to have to copy and paste 1 line at a time. It doesn't HAVE to be a t..

Bootstrap table striped: How do I change the stripe background colour?

With Bootstrap class table-striped, every other row in my table has a background colour equal to #F9F9F9. How can I change this colour?..

Authentication plugin 'caching_sha2_password' is not supported

I am trying to connect to a MySQL server with python connector. I created a new user lcherukuri with the authentication plugin mysql_native_password. But I got the error mysql.connector.errors.No..

Invalid Host Header when ngrok tries to connect to React dev server

I'm trying to test my React application on a mobile device. I'm using ngrok to make my local server available to other devices and have gotten this working with a variety of other applications. Howeve..

JAVA - using FOR, WHILE and DO WHILE loops to sum 1 through 100

As the title states, I have trouble understanding loops and have come up with a way to do a simple 1 through 100 sum, but like I said, the loops are causing me some confusion. I think I have the FOR L..

Adding header to all request with Retrofit 2

Retrofit 2's documentation says: Headers that need to be added to every request can be specified using an OkHttp interceptor. It can be done easily using the previous version, here's the related..

Adding rows to tbody of a table using jQuery

I am trying to add rows to the tbody of a table. But I am having issues with achieving that. Firstly, the function where everything takes place is called on change of a dropdown from a html page. I cr..

How do I send email with JavaScript without opening the mail client?

I'm writing a HTML page with a registration button that should just silently send an email without opening the local mail client. Here is my HTML: <form method="post" action=""> <input t..

How to clear variables in ipython?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every tim..

How to use WebRequest to POST some data and read response?

Need to have the server make a POST to an API, how do I add POST values to a WebRequest object and how do I send it and get the response (it will be a string) out? I need to POST TWO values, and some..

SQL Query with Join, Count and Where

I have 2 tables and am trying to do one query to save myself some work. Table 1: id, category id, colour Table 2: category id, category name I want to join them so that I get id, category id, cate..

Adding a 'share by email' link to website

I have an HMTL / CSS website built in Dreamweaver CS4 and I would like to add a 'share by email' link to the site (so that anyone who clicks on it can easily send a link to the site to their chosen re..

How to set a Javascript object values dynamically?

It's difficult to explain the case by words, let me give an example: var myObj = { 'name': 'Umut', 'age' : 34 }; var prop = 'name'; var value = 'Onur'; myObj[name] = value; // This does not..

mat-form-field must contain a MatFormFieldControl

We are trying to build our own form-field-Components at our Company. We are trying to wrap material design's Components like this: field: <mat-form-field> <ng-content></ng-content..

Trees in Twitter Bootstrap

I have been trying to work on creating a tree (like a directory tree) that uses as much CSS and as little JS as possible (only for states, etc), and I want to know if there are some good existing tree..

What's the best way to send a signal to all members of a process group?

I want to kill a whole process tree. What is the best way to do this using any common scripting languages? I am looking for a simple solution...

ASP.Net MVC: How to display a byte array image from model

I've a model with a byte array image file that I want to show on the page. How can I do that without going back to the Database? All the solutions that I see use an ActionResult to go back to the da..

How to auto-reload files in Node.js?

Any ideas on how I could implement an auto-reload of files in Node.js? I'm tired of restarting the server every time I change a file. Apparently Node.js' require() function does not reload files if t..

socket.error: [Errno 48] Address already in use

I'm trying to set up a server with python from mac terminal. I navigate to folder location an use: python -m SimpleHTTPServer But this gives me error: socket.error: [Errno 48] Address already ..

How do I get a PHP class constructor to call its parent's parent's constructor?

I need to have a class constructor in PHP call its parent's parent's (grandparent?) constructor without calling the parent constructor. // main class that everything inherits class Grandpa { pub..

How to capitalize the first letter of a String in Java?

I am using Java to get a String input from the user. I am trying to make the first letter of this input capitalized. I tried this: String name; BufferedReader br = new InputStreamReader(System.in)..

What is a superfast way to read large files line-by-line in VBA?

I believe I have come up with a very efficient way to read very, very large files line-by-line. Please tell me if you know of a better/faster way or see room for improvement. I am trying to get bette..

How to load external webpage in WebView

My problem is that the webpage is not loaded inside the WebView. mWebview.loadUrl("http://www.google.com"); launches the web browser... This is the code of my activity: import android.app.Ac..

How to start jenkins on different port rather than 8080 using command prompt in Windows?

I have jenkins.war and I started it from command prompt in Windows as: java -jar jenkins.war It was started well and easily browsed as http://localhost:8080 I want to start on 9090 port. How can I..

What does jQuery.fn mean?

What does the fn here mean? jQuery.fn.jquery ..

How to erase the file contents of text file in Python?

I have text file which I want to erase in Python. How do I do that?..

Android error: Failed to install *.apk on device *: timeout

I'm getting this error from time to time and don't know what causing this: When trying to run/debug an Android app on a real device (Galaxy Samsung S in my case) I'm getting the following error in the..

Mockito : doAnswer Vs thenReturn

I am using Mockito for service later unit testing. I am confused when to use doAnswer vs thenReturn. Can anyone help me in detail? So far, I have tried it with thenReturn. ..

How to calculate number of days between two given dates?

If I have two dates (ex. '8/18/2008' and '9/26/2008'), what is the best way to get the number of days between these two dates?..

Removing duplicates from a list of lists

I have a list of lists in Python: k = [[1, 2], [4], [5, 6, 2], [1, 2], [3], [4]] And I want to remove duplicate elements from it. Was if it a normal list not of lists I could used set. But unfortun..

How do I get a platform-dependent new line character?

How do I get a platform-dependent newline in Java? I can’t use "\n" everywhere...

mysql: see all open connections to a given database?

With administrative permissions im mysql, how can I see all the open connections to a specific db in my server?..

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

I keep receiving this error when I do some Ajax calls... It may even be something to do with Geocoding but I really have no idea how to capture the error to display something useful to users... or ev..

How to convert a string to a date in sybase

I need to specify a date value in a sybase where clause. For example: select * from data where dateVal < [THE DATE] ..

How to print a double with two decimals in Android?

Maybe this is a silly question, but I cannot guess how to solve it if it's not creating a method. Maybe there's a "natural way" to do it, like in C for example. Here's the problem: I have a var: dou..

RelativeLayout center vertical

I want to make a list row layout. This layout has a imageview in the most left, a textview right next to the imageview, and a imageview in the most right. I want all of them are center vertical. <..

FCM getting MismatchSenderId

I have an application that uses Google FCM for sending push notifications. When i send a push notification to a group of users, i get a response of MismatchSenderId for some of them. Even though, all..

'Syntax Error: invalid syntax' for no apparent reason

I've been trying to get a fix and can't find why the error keeps appearing. Pmin,Pmax,w,fi1 and fi2 have all been assigned finite values guess=Pmin+(Pmax-Pmin)*((1-w**2)*fi1+(w**2)*fi2) When i r..

Change width of select tag in Twitter Bootstrap

How do I change the width of a select field, when using Twitter bootstrap? Adding input-xxlarge CSS classes doesn't seem to work (like it does on other form elements), so the elements in my drop down ..

Angularjs - simple form submit

I am going through learning curve with AngularJs and I am finding that there are virtually no examples that serve real world use. I am trying to get a clear understanding of how to submit a form with..

How do you reverse a string in place in C or C++?

How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string?..

Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

I working with node.js by expressjs I try to store an account to session. So, i try to test to use session with code in expressjs var RedisStore = require('connect-redis')(express); app.use(express...

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

How do you explicitly set a new property on `window` in TypeScript?

I setup global namespaces for my objects by explicitly setting a property on window. window.MyNamespace = window.MyNamespace || {}; TypeScript underlines MyNamespace and complains that: The pro..

How to create a css rule for all elements except one class?

I have created a CSS stylesheet for my project. Is there any way I can create a css rule that applies to all table elements EXCEPT table elements belonging to the class "dojoxGrid"? Something like: ...

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 2: ordinal not in range(128)

I am attempting to work with a very large dataset that has some non-standard characters in it. I need to use unicode, as per the job specs, but I am baffled. (And quite possibly doing it all wrong.) ..

How to change css property using javascript

I want to change css property of class using javascript. What i actually want is when a div is hoverd, another div should become visible. My css is like.. .left, .right{ margin:10px; float:l..

fetch from origin with deleted remote branches?

When I do git fetch origin and origin has a deleted branch, it doesn't seem to update it in my repository. When I do git branch -r it still shows origin/DELETED_BRANCH. How can I fix this?..