Examples On Programing Languages

Row count where data exists

I need to count the total number of rows that have data. I want to be able to use this on multiple sheets with different amounts of data rows. I cannot figure out generic code that will count the number of rows from A1-A100 or A1-A300. I am tryin...

Installing R on Mac - Warning messages: Setting LC_CTYPE failed, using "C"

I would like install R on my laptop Mac OS X version 10.7.3 I downloaded the last version and I double click on it and it was installed, when i start up I get the following error, I searched in internet but I could not solve the problem, any help wo...

Angular expression if array contains

I'm trying to add a class to an element if a jobSet has not been selected for approval using expressions. <li class="approvalUnit" ng-repeat="jobSet in dashboard.currentWork" ng-class="{-1:'approved'}[selectedForApproval.indexOf(jobSet)]"> T...

HttpGet with HTTPS : SSLPeerUnverifiedException

Using HttpClient, I receive the following error when attempting to communicate over HTTPS: Exception in thread "main" javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated. Here is my code: URI loginUri = new URI("https://myUrl.asp"...

How can strip whitespaces in PHP's variable?

I know this comment PHP.net. I would like to have a similar tool like tr for PHP such that I can run simply tr -d " " "" I run unsuccessfully the function php_strip_whitespace by $tags_trimmed = php_strip_whitespace($tags); I run the regex func...

Python non-greedy regexes

How do I make a python regex like "(.*)" such that, given "a (b) c (d) e" python matches "b" instead of "b) c (d"? I know that I can use "[^)]" instead of ".", but I'm looking for a more general solution that keeps my regex a little cleaner. Is ther...

Angular 4 HttpClient Query Parameters

I have been looking for a way to pass query parameters into an API call with the new HttpClientModule's HttpClient and have yet to find a solution. With the old Http module you would write something like this. getNamespaceLogs(logNamespace) { /...

Drawable image on a canvas

How can I get an image to the canvas in order to draw on that image?...

How to see the actual Oracle SQL statement that is being executed

I'm using a custom-built inhouse application that generates a standard set of reports on a weekly basis. I have no access to the source code of the application, and everyone tells me there is no documentation available for the Oracle database schema....

Angular 2 beta.17: Property 'map' does not exist on type 'Observable<Response>'

I just upgraded from Angular 2 beta16 to beta17, which in turn requires rxjs 5.0.0-beta.6. (Changelog here: https://github.com/angular/angular/blob/master/CHANGELOG.md#200-beta17-2016-04-28) In beta16 all was working well regarding Observable/map fu...

How to prevent http file caching in Apache httpd (MAMP)

I am developing a single page Javascript application in MAMP. My JavaScript and HTML template files are getting cached between requests. Is there a simple way to indicate in MAMP that I want to prevent http file caching? Possibly with a .htaccess fi...

How to fill in proxy information in cntlm config file?

Cntlm is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft proprietary world. I have my proxy URL in the following format: http://user:passwords@my_proxy_server.com:...

Any way to Invoke a private method?

I have a class that uses XML and reflection to return Objects to another class. Normally these objects are sub fields of an external object, but occasionally it's something I want to generate on the fly. I've tried something like this but to no avai...

Concatenating strings in C, which method is more efficient?

I came across these two methods to concatenate strings: Common part: char* first= "First"; char* second = "Second"; char* both = malloc(strlen(first) + strlen(second) + 2); Method 1: strcpy(both, first); strcat(both, " "); // or space coul...

Eclipse does not highlight matching variables

Eclipse does not highlight matching variables for me: I've already tried to change "Mark occurrences" via Window -> Preferences -> Java -> Editor -> Mark Occurrences but it didn't work. I am not sure why this is not working while ot...

How can I increment a date by one day in Java?

I'm working with a date in this format: yyyy-mm-dd. How can I increment this date by one day?...

How can I search sub-folders using glob.glob module?

I want to open a series of subfolders in a folder and find some text files and print some lines of the text files. I am using this: configfiles = glob.glob('C:/Users/sam/Desktop/file1/*.txt') But this cannot access the subfolders as well. Does any...

Is there a way that I can check if a data attribute exists?

Is there some way that I can run the following: var data = $("#dataTable").data('timer'); var diffs = []; for(var i = 0; i + 1 < data.length; i++) { diffs[i] = data[i + 1] - data[i]; } alert(diffs.join(', ')); Only if there is an attribut...

Convert array of integers to comma-separated string

It's a simple question; I am a newbie in C#, how can I perform the following I want to convert an array of integers to a comma-separated string. I have int[] arr = new int[5] {1,2,3,4,5}; I want to convert it to one string string => "1,2,...

What are alternatives to ExtJS?

So what I'm looking for is a javascript framework I can use that has several UI controls. I have taken a look at jQuery but those controls are very basic compared to ExtJS. Are there any other competitive alternatives? This question exists becaus...

'Missing contentDescription attribute on image' in XML

I get an warning about [Accessibility]Missing contentDescription attribute on image in eclipse. This warning show at line 5 (declare ImageView) in XML code below. This not make any error when build and run my application. But I really want to know w...

C# - How to get Program Files (x86) on Windows 64 bit

I'm using: FileInfo( System.Environment.GetFolderPath( System.Environment.SpecialFolder.ProgramFiles) + @"\MyInstalledApp" In order to determine if a program is detected on a users machine (it's not ideal, but the program I'm look...

How do I check whether an array contains a string in TypeScript?

Currently I am using Angular 2.0. I have an array as follows: var channelArray: Array<string> = ['one', 'two', 'three']; How can I check in TypeScript whether the channelArray contains a string 'three'?...

INSERT IF NOT EXISTS ELSE UPDATE?

I've found a few "would be" solutions for the classic "How do I insert a new record or update one if it already exists" but I cannot get any of them to work in SQLite. I have a table defined as follows: CREATE TABLE Book ID INTEGER PRIMARY KEY...

Conversion failed when converting the varchar value to data type int in sql

I wrote the store procedure which should return the values like- J1 J2 J3 I have table named Journal_Entry. When the row count of the table is 0, it gives the result J1 but as the row count increases it shows the error- "Conversion failed when c...

Setting Timeout Value For .NET Web Service

I have a web service written in C# that is living on a SharePoint site. I have modified the web.config with the following code: <configuration> <system.web> <httpRuntime executionTimeout="360" /> ... for the IIS Inetpub f...

Difference between angle bracket < > and double quotes " " while including header files in C++?

Possible Duplicate: What is the difference between #include <filename> and #include “filename”? What is the difference between angle bracket < > and double quotes " " while including header files in C++? I mean which files...

What is the equivalent of Java's final in C#?

What is the equivalent of Java's final in C#?...

Style input element to fill remaining width of its container

Let's say I have an html snippet like this: <div style="width:300px;"> <label for="MyInput">label text</label> <input type="text" id="MyInput" /> </div> This isn't my exact code, but the important thing is the...

Best lightweight web server (only static content) for Windows

I got application server running in Windows – IIS6.0 with Zend Server to execute PHP. I am looking for lightweight static content only web server on this same machine which will relive IIS form handling static content and increase performance. It ...

How do I declare and use variables in PL/SQL like I do in T-SQL?

In Sql Server, often times when I'm testing the body of a stored procedure, I copy the body into SSMS, DECLARE the variables at the top of the page, set them to some sample values, and execute the body as-is. For Example, if my proc is CREATE PROC ...

How do I print to the debug output window in a Win32 app?

I've got a win32 project that I've loaded into Visual Studio 2005. I'd like to be able to print things to the Visual Studio output window, but I can't for the life of me work out how. I've tried 'printf' and 'cout <<' but my messages stay stubb...

Play audio from a stream using C#

Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possibl...

Converting unix timestamp string to readable date

I have a string representing a unix timestamp (i.e. "1284101485") in Python, and I'd like to convert it to a readable date. When I use time.strftime, I get a TypeError: >>>import time >>>print time.strftime("%B %d %Y&...

How to get the <html> tag HTML with JavaScript / jQuery?

Using $('html').html() I can get the HTML within the <html> tag (<head>, <body>, etc.). But how can I get the actual HTML of the <html> tag (with attributes)? Alternatively, is it possible to get the entire HTML of the page (...

An array of List in c#

I want to have an array of Lists. In c++ I do like: List<int> a[100]; which is an array of 100 Lists. each list can contain many elements. I don't know how to do this in c#. Can anyone help me?...

Call PHP function from jQuery?

I have a PHP function on my site which takes a couple of seconds to complete. This holds the whole page up which I don't want. Would it be possible with jquery to call this PHP function after the page has loaded and display the results in a div? Als...

Nginx location "not equal to" regex

How do I set a location condition in Nginx that responds to anything that isn't equal to the listed locations? I tried: location !~/(dir1|file2\.php) { rewrite ^/(.*) http://example.com/$1 permanent; } But it doesn't trigger the redirect. I...

AngularJS : Custom filters and ng-repeat

I'm an AngularJS newbie and I'm building up a small proof-of-concept car hire listings app that pulls in some JSON and renders out various bits of that data via an ng-repeat, with a couple of filters: <article data-ng-repeat="result in results...

What is android:ems attribute in Edit Text?

Possible Duplicate: What means Ems? (Android TextView) In EditText there is an attribute named android:ems. The description is "Makes the EditText be exactly this many ems wide" What does ems mean? ...

Importing from a relative path in Python

I have a folder for my client code, a folder for my server code, and a folder for code that is shared between them Proj/ Client/ Client.py Server/ Server.py Common/ __init__.py Common.py How do I import ...

jQuery selectors on custom data attributes using HTML5

I would like to know what selectors are available for these data attributes that come with HTML5. Taking this piece of HTML as an example: <ul data-group="Companies"> <li data-company="Microsoft"></li> <li data-company="Goo...

Map with Key as String and Value as List in Groovy

Can anyone point me to an example of how to use a Map in Groovy which has a String as its key and a List as value?...

How to send value attribute from radio button in PHP

I am struggling with sending the value of a radiobutton to an email. I have coded 2 radiobuttons, where I have set the first on to be default checked. The form and values work, however the radio button value is not submitted. Any wise words?...

What is the LD_PRELOAD trick?

I came across a reference to it recently on proggit and (as of now) it is not explained. I suspect this might be it, but I don't know for sure....

How do I open multiple instances of Visual Studio Code?

Today Microsoft released the Visual Studio Code file/folder editor. The first limitation is it appears to be a single-instance application. Is there a way of getting multiple instances, or otherwise having it open multiple folders simultaneously?...

How to truncate milliseconds off of a .NET DateTime

I'm trying to compare a time stamp from an incoming request to a database stored value. SQL Server of course keeps some precision of milliseconds on the time, and when read into a .NET DateTime, it includes those milliseconds. The incoming request to...

Django optional url parameters

I have a Django URL like this: url( r'^project_config/(?P<product>\w+)/(?P<project_id>\w+)/$', 'tool.views.ProjectConfig', name='project_config' ), views.py: def ProjectConfig(request, product, project_id=None, template_na...

Using "-Filter" with a variable

I try to filter out something like this: Get-ADComputer -Filter {name -like "chalmw-dm*" -and Enabled -eq "true"} ... This works like a charm and gets exactly what I want... Now I want the "name -like ..." part as a variable like this: Get-ADCom...

Get value when selected ng-option changes

I have in my .html page a dropdown list, Dropdown: <select ng-model="blisterPackTemplateSelected" data-ng-options="blisterPackTemplate as blisterPackTemplate.name for blisterPackTemplate in blisterPackTemplates"> <option value="">Se...

Bootstrap change carousel height

I have a jsfiddle here - http://jsfiddle.net/gh4Lur4b/8/ It's a full width bootstrap carousel. I'd like to change the height and still keep it full width. Is the height determined by the image height. How can I chanhe the height of the carousel a...

What equivalents are there to TortoiseSVN, on Mac OSX?

I am using a MacBook Pro running Mac OS X 10.5. I am new to this development environment, and previously worked on Windows. I find there is no TortoiseSVN for Mac PC, and I am wondering any alternative (better free and easy to use GUI tools) tools fo...

Project Links do not work on Wamp Server

I am installing the Wamp Server on another computer to run a mid-sized database and UI. I have been successful in blocking IIS and routing the server to Localhost:8080. But whenever I try to access on of my projects from the localhost homepage, in th...

How to dismiss a Twitter Bootstrap popover by clicking outside?

Can we get popovers to be dismissable in the same way as modals, ie. make them close when user clicks somewhere outside of them? Unfortunately I can't just use real modal instead of popover, because modal means position:fixed and that would be no po...

What's a redirect URI? how does it apply to iOS app for OAuth2.0?

Beginner programmer here, please pardon ignorance & explanations will be really nice :) I've tried to read the tutorials for a certain OAuth 2.0 service, but I don't understand this redirect URI... in my particular context, let's say I'm trying ...

Convert object string to JSON

How can I convert a string that describes an object into a JSON string using JavaScript (or jQuery)? e.g: Convert this (NOT a valid JSON string): var str = "{ hello: 'world', places: ['Africa', 'America', 'Asia', 'Australia'] }" into this: str...

How to remove all the punctuation in a string? (Python)

For example: asking="hello! what's your name?" Can I just do this? asking.strip("!'?") ...

How can I close a Twitter Bootstrap popover with a click from anywhere (else) on the page?

I'm currently using popovers with Twitter Bootstrap, initiated like this: $('.popup-marker').popover({ html: true, trigger: 'manual' }).click(function(e) { $(this).popover('toggle'); e.preventDefault(); }); ...

Pandas sum by groupby, but exclude certain columns

What is the best way to do a groupby on a Pandas dataframe, but exclude some columns from that groupby? e.g. I have the following dataframe: Code Country Item_Code Item Ele_Code Unit Y1961 Y1962 Y1963 2 Afghanistan 15 ...

Text inset for UITextField?

I would like to inset the text of a UITextField. Is this possible?...

How to empty a Heroku database

I'm working on a Ruby on Rails 3 webapp on Heroku. How do I empty the database?...

How do I get LaTeX to hyphenate a word that contains a dash?

In a LaTeX document I'm writing, I get an overfull hbox warning because of the word "multi-disciplinary", which happens to be rendered at the end of a line. I can get rid of this particular warning by changing it into multi-discipli\-nary, but the s...

Call a REST API in PHP

Our client had given me a REST API to which I need to make a PHP call to. But as a matter of fact the documentation given with the API is very limited, so I don't really know how to call the service. I've tried to Google it, but the only thing that ...

how does Request.QueryString work?

I have a code example like this : location.href = location.href + "/Edit?pID=" + hTable.getObj().ID; ; //aspx parID = Request.QueryString["pID"]; //c# it works, my question is - how ? what is the logic ? thanks :)...

Is there a way to cast float as a decimal without rounding and preserving its precision?

So it appears that if you CAST(field1 as decimal) field1 this will automatically add rounding. The original is defined as: field1 type:float length:8 prec:53 I need to cast it to decimal, because I need my Entity Framework layer to genera...

Importing Excel spreadsheet data into another Excel spreadsheet containing VBA

We need to write an Excel spreadsheet with VBA code in it; the code reads and performs operations on the data in the first worksheet. The user will be receiving spreadsheets containing data but that do not contain the VBA code. We need to be able t...

Unresolved external symbol in object files

During coding in Visual Studio I got an unresolved external symbol error and I've got no idea what to do. I don't know what's wrong. Could you please decipher me? Where should I be looking for what kind of errors? 1>Form.obj : error LNK2019: unre...

Getting assembly name

C#'s exception class has a source property which is set to the name of the assembly by default. Is there another way to get this exact string (without parsing a different string)? I have tried the following: catch(Exception e) { string str = ...

How can I download a specific Maven artifact in one command line?

I can install an artifact by install:install-file, but how can I download an artifact? For example: mvn download:download-file -DgroupId=.. -DartifactId=.. -Dversion=LATEST ...

How to delete row based on cell value

I have a worksheet, I need to delete rows based on cell value .. Cells to check are in Column A .. If cell contains "-" .. Delete Row I can't find a way to do this .. I open a workbook, copy all contents to another workbook, then delete entire row...

How do I fix a Git detached head?

I was doing some work in my repository and noticed a file had local changes. I didn't want them anymore so I deleted the file, thinking I can just checkout a fresh copy. I wanted to do the Git equivalent of svn up . Using git pull didn't seem to w...

C# DLL config file

Im trying to add an app.config file to my DLL, but all attempts have failed. According to MusicGenesis in 'Putting configuration information in a DLL' this should not be a problem. So obviously I'm doing something wrong... The following code shoul...

How can I echo a newline in a batch file?

How can you you insert a newline from your batch file output? I want to do something like: echo hello\nworld Which would output: hello world ...

Git: How to return from 'detached HEAD' state

If one would checkout a branch: git checkout 760ac7e from e.g. b9ac70b, how can one go back to the last known head b9ac70b without knowing its SHA1?...

Difference between jar and war in Java

What is the difference between a .jar and a .war file? Is it only the file extension or is there something more?...

set gvim font in .vimrc file

I am using gVim 7.2 on Windows 7. I can set the gui font as Consolas 10 (font size) from the menu. I am trying to set this in .vimrc file like below: set guifont=Consolas\ 10 But it doesn't work. Does anyone know how to set this?...

How to "properly" print a list?

So I have a list: ['x', 3, 'b'] And I want the output to be: [x, 3, b] How can I do this in python? If I do str(['x', 3, 'b']), I get one with quotes, but I don't want quotes....

How to run iPhone emulator WITHOUT starting Xcode?

On my old Mac running Snow Leopard, I could type "ios" into spotlight and it would start up the iPhone/iPad emulator by itself. I have since had to get a new machine running Lion. I have installed Xcode for Lion, I have installed the developer tool ...

How to send custom headers with requests in Swagger UI?

I have some endpoints in the API - /user/login, /products. In Swagger UI I post email and password to /user/login and as a response I receive a token string. Then, I can copy the token from the response and want to use it as Authorization header va...

Phonegap + jQuery Mobile, real world sample or tutorial

Does anyone know of a really good tutorial or sample project where Phonegap and jQuery Mobile is used for a real world example? All the examples I found were showing fancy transitions or theming in jQuery Mobile. The Phonegap examples mostly showcas...

AngularJS - convert dates in controller

Could anyone please suggest me how to convert date from this 1387843200000 format into this 24/12/2013 inside my controller? Just FYI my dates are stored in this way & when binding to edit form with input type="date" field is not being populated...

AJAX jQuery refresh div every 5 seconds

I got this code from a website which I have modified to my needs: <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> </head> <div id="links"> </div&g...

Output first 100 characters in a string

Can seem to find a substring function in python. Say I want to output the first 100 characters in a string, how can I do this? I want to do it safely also, meaing if the string is 50 characters it shouldn't fail....

How to create tar.gz archive file in Windows?

How to create tar.gz archive of my files in Windows to upload and extract in cPanel?...

What is two way binding?

I have read lots that Backbone doesn't do two way binding but I don't exactly understand this concept. Could somebody give me an example of how two way binding works in an MVC codebase and how it does not with Backbone?...

Add a property to a JavaScript object using a variable as the name?

I'm pulling items out of the DOM with jQuery and want to set a property on an object using the id of the DOM element. Example const obj = {} jQuery(itemsFromDom).each(function() { const element = jQuery(this) const name = element.attr('id') ...

How to access global js variable in AngularJS directive

First of all, I checked and I didn't find any article covering my question. How to access a pre-defined js global variable in angularJS built-in directive? For example, I define this variable in <script>var variable1 = true; </script> ...

Get SSID when WIFI is connected

I'm trying to get the SSID of the WIFI network when my android device is connected to WIFI. I've registered a BroadcastReceiver listening for android.net.wifi.supplicant.CONNECTION_CHANGE . I get the notification when WIFI is disconnected or reconne...

Disable keyboard on EditText

I'm doing a calculator. So I made my own Buttons with numbers and functions. The expression that has to be calculated, is in an EditText, because I want users can add numbers or functions also in the middle of the expression, so with the EditText I h...

Using (Ana)conda within PyCharm

I've got Pycharm 4 running on my Linux (Ubuntu 14.04) machine. In addition to the system python, I've also got Anaconda installed. Getting the two to play nicely together seems to be a bit of a problem... PyCharm provides some interesting integrati...

Passing parameters from jsp to Spring Controller method

I am working in a Spring MVC application which uses Hibernate. In the JSP page I have a function which lists the values stored in the database(currently all the value). I have written a method, where the list is only limited to an ID passed in th...

How to create a CPU spike with a bash command

I want to create a near 100% load on a Linux machine. It's quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of time and then stop. I'm hoping there's some trick in bash. I'm thinking som...

HSL to RGB color conversion

I am looking for an algorithm to convert between HSL color to RGB. It seems to me that HSL is not very widely used so I am not having much luck searching for a converter....

reading HttpwebResponse json response, C#

In one of my apps, I am getting the response from a webrequest. The service is Restful service and will return a result similar to the JSON format below: { "id" : "1lad07", "text" : "test", "url" : "http:\/\/twitpic.com\/1lacuz", "wi...

Update Multiple Rows in Entity Framework from a list of ids

I am trying to create a query for entity framework that will allow me to take a list of ids and update a field associated with them. Example in SQL: UPDATE Friends SET msgSentBy = '1234' WHERE id IN (1, 2, 3, 4) How do I convert the above into e...

Command output redirect to file and terminal

I am trying to throw command output to file plus console also. This is because i want to keep record of output in file. I am doing following and it appending to file but not printing ls output on terminal. $ls 2>&1 > /tmp/ls.txt ...

How to hide axes and gridlines in Matplotlib (python)

I would like to be able to hide the axes and gridlines on a 3D matplotlib graph. I want to do this because when zooming in and out the image gets pretty nasty. I'm not sure what code to include here but this is what I use to create the graph. fig =...

Android: How can I pass parameters to AsyncTask's onPreExecute()?

I use an AsyncTask for loading operations that I implemented as an inner class. In onPreExecute() I show a loading dialog which I then hide again in onPostExecute(). But for some of the loading operations I know in advance that they will finish ver...

ReactJS - Get Height of an element

How can I get the Height of an element after React renders that element? HTML <div id="container"> <!-- This element's contents will be replaced with your component. --> <p> jnknwqkjnkj<br> jhiwhiw (this is 36px height) <...

Safely limiting Ansible playbooks to a single machine?

I'm using Ansible for some simple user management tasks with a small group of computers. Currently, I have my playbooks set to hosts: all and my hosts file is just a single group with all machines listed: # file: hosts [office] imac-1.local imac-2.l...

Easy way to turn JavaScript array into comma-separated list?

I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the arr...

Get local href value from anchor (a) tag

I have an anchor tag that has a local href value, and a JavaScript function that uses the href value but directs it to a slightly different place than it would normally go. The tag looks like <a onclick="return follow(this);" href="sec/IF00.html...

How to compare only date in moment.js

I am new to moment.js. I have a date object and it has some time associated with it. I just want to check if that date is greater than or equal to today's date, excluding the time when comparing. var dateToCompare = 2015-04-06T18:30:00.000Z I jus...

how to make label visible/invisible?

I have these date and time fields, and I want to set a javascript validation for the time. If the format is invalid, it should make the label visible, else it should be invisible. This is the code I have so far. <td nowrap="nowrap" align="l...

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 the memory (even with explicit calls to gc.collec...

POST data with request module on Node.JS

This module is 'request https://github.com/mikeal/request I think i'm following every step but i'm missing an argument.. var request = require('request'); request.post({ url: 'http://localhost/test2.php', body: "mes=heydude" ...

Android: No Activity found to handle Intent error? How it will resolve

No Activity found to handle Intent error? How it will resolve. Preference customPref = (Preference) findPreference("DataEntryScreen"); customPref .setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onP...

jquery select option click handler

given: <select id="mySelect"> <option>..</option> ... </select> Using the select id, how can I trigger a click event on one of the options? I tried attaching the event directly to the select, but this triggers an event ...

Get Android Device Name

How to get Android device name? I am using HTC desire. When I connected it via HTC Sync the software is displaying the Name 'HTC Smith' . I would like to fetch this name via code. How is this possible in Android?...

Create Windows service from executable

Is there any quick way to, given an executable file, create a Windows service that, when started, launches it?...

Access the css ":after" selector with jQuery

I have the following css: .pageMenu .active::after { content: ''; margin-top: -6px; display: inline-block; width: 0px; height: 0px; border-top: 14px solid white; border-left: 14px solid transparent; border-bottom: 14p...

Delete from two tables in one query

I have two tables in MySQL #messages table : messageid messagetitle . . #usersmessages table usersmessageid messageid userid . . Now if I want to delete from messages table it's ok. But when I delete message by messageid the record still ex...

How can I start pagenumbers, where the first section occurs in LaTex?

This question is related to the post about having abstract at the titlepage. I want to reset the page numbering at the given section....

How to make Unicode charset in cmd.exe by default?

866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode. Can I install Unicode by default or replace cmd.exe to another console and make it default so programms use it instead of cmd.exe? I un...

How to get the excel file name / path in VBA

Say, I'm writing a VBA inside my excel file sample.xls. Now I want to get the full path of sample.xls in my VBA. How do I do it?...

Using iFrames In ASP.NET

I have an asp.net website with a master-page, can I use the iframe so my .aspx pages will load inside the iframes. (Meaning it wont load the master-page) Kinda like my iframe will be the contentplaceholder or maybe the contentplaceholder will be ins...

Difference between /res and /assets directories

I know that files in the res directory are accessible from R.class while assets behaves like a file system, but I would like to know, in general, when it's best to use one and the other. Can anyone help me in knowing the real differences between res ...

How to draw polygons on an HTML5 canvas?

I need to know how to draw polygons on a canvas. Without using jQuery or anything like that....

How to view the contents of an Android APK file?

Is there a way to extract and view the content of an .apk file?...

How to do left join in Doctrine?

This is my function where I'm trying to show the User history. For this I need to display the user's current credits along with his credit history. This is what I am trying to do: public function getHistory($users) { $qb = $this->entityMana...

Android Studio Gradle Configuration with name 'default' not found

I am having problems compiling my app with Android Studio (0.1.5). The app uses 2 libraries which I have included as follows: settings.gradle include ':myapp',':library',':android-ColorPickerPreference' build.gradle buildscript { reposito...

1114 (HY000): The table is full

I'm trying to add a row to an InnoDB table with a simply query: INSERT INTO zip_codes (zip_code, city) VALUES ('90210', 'Beverly Hills'); But when I attempt this query, I get the following: ERROR 1114 (HY000): The table zip_codes is full Doi...

How do I select a MySQL database through CLI?

I've managed to get into MySQL using the command line terminal, but when I tried to enter some SQL, it said 'no database selected' how do I select a database? my database name is: photogallery What code do I use to select it?...

./configure : /bin/sh^M : bad interpreter

I've been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error [root@localhost lpng142]# ./configure bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory [root@localhost lpng142]# How do ...

laravel 5.4 upload image

My controller code for upload file in laravel 5.4: if ($request->hasFile('input_img')) { if($request->file('input_img')->isValid()) { try { $file = $request->file('input_img'); $name = rand(11111, 9999...

DTO and DAO concepts and MVC

1) Why do we use DTO and DAO, and when should we use them. I am developing a GUI Java software to do with inserting, editing, deleting data. But I am struggling to distinguish between DTO/DAO and Model, View, Controller (MVC) Structure? Are they sim...

Phone: numeric keyboard for text input

Is there a way to force the number keyboard to come up on the phone for an <input type="text">? I just realized that <input type="number"> in HTML5 is for “floating-point numbers”, so it isn’t suitable for credit card numbers, ZIP c...

What is the LDF file in SQL Server?

What is the LDF file in SQL Server? what is its purpose? can I safely delete it? or reduce its size because sometimes it's 10x larger than the database file mdf....

Convert multiple rows into one with comma as separator

If I issue SELECT username FROM Users I get this result: username -------- Paul John Mary but what I really need is one row with all the values separated by comma, like this: Paul, John, Mary How do I do this?...

Set min-width in HTML table's <td>

My table has several columns. Each column should have dynamic width that depends on the browser window size. On the other hand, each column must not be too tiny. So I tried to set min-width for those columns but it's not a valid property. Tried min...

Timing Delays in VBA

I would like a 1 second delay in my code. Below is the code I am trying to make this delay. I think it polls the date and time off the operating system and waits until the times match. I am having an issue with the delay. I think it does not poll...

Default text which won't be shown in drop-down list

I have a select which initially shows Select language until the user selects a language. When the user opens the select, I don't want it to show a Select language option, because it's not an actual option. How can I achieve this?...

How to select all instances of selected region in Sublime Text

Is there a shortcut key or single-step menu option to find and select all instances of a highlighted selection in Sublime Text?...

how to make a full screen div, and prevent size to be changed by content?

for my web application, i would like the main div to be full screen (both width and height = 100%), and regardless of content, i want it to stay at that size. that means, if there are not much content, it shouldn't shrink, and if there are too much c...

Rails: Address already in use - bind(2) (Errno::EADDRINUSE)

I am trying to deploy Rails app with the Puma web server. When trying to start Puma server with a config file bundle exec puma -C config/puma.rb I get an error that the address is already in use. Does someone know how to fix this? bundle exec puma ...

Selenium webdriver click google search

I'm searching text "Cheese!" on google homepage and unsure how can I can click on the searched links after pressing the search button. For example I wanted to click the third link from top on search page then how can I find identify the link and clic...

Mail not sending with PHPMailer over SSL using SMTP

I am trying to use PHPMailer to send e-mails over SMTP but so far have had no luck. I've gone through a number of SO questions, PHPMailer tutorials and forum posts but still cannot get it to work. I'll document as many of my failed attempts as I can ...

how to change background image of button when clicked/focused?

I want to change the background image of a button when clicked or focused. This is my code: Button tiny = (Button)findViewById(R.id.tiny); tiny.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TO...

Intercept a form submit in JavaScript and prevent normal submission

There seems to be lots of info on how to submit a form using javascript, but I am looking for a solution to capture when a form has been submitted and intercept it in javascript. HTML <form> <input type="text" name="in" value="some data" ...

Is Python faster and lighter than C++?

I've always thought that Python's advantages are code readibility and development speed, but time and memory usage were not as good as those of C++. These stats struck me really hard. What does your experience tell you about Python vs C++ time and ...

How to merge 2 List<T> and removing duplicate values from it in C#

I have two lists List that I need to combine in third list and remove duplicate values from that lists A bit hard to explain, so let me show an example of what the code looks like and what I want as a result, in sample I use int type not ResultAnaly...

Why doesn't java.io.File have a close method?

While java.io.RandomAccessFile does have a close() method java.io.File doesn't. Why is that? Is the file closed automatically on finalization or something?...

Export to xls using angularjs

I am working on angular js app and I stuck in a situation in which I have to export data to Xls using angular js. I have searched a lot on the internet for export functionality or any library for angular js so I can do that or at least I can get the ...

Git: How to pull a single file from a server repository in Git?

I am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this question and entered the commands below, but it didn't work. How do I p...

Whether a variable is undefined

How do I find if a variable is undefined? I currently have: var page_name = $("#pageToEdit :selected").text(); var table_name = $("#pageToEdit :selected").val(); var optionResult = $("#pageToEditOptions :selected").val(); var string = "?z=z"; if (...

Content Security Policy: The page's settings blocked the loading of a resource

I am using CAPTCHA on page load, but it is blocking because of some security reason. I am facing this problem: Content Security Policy: The page's settings blocked the loading of a resource at http://www.google.com/recaptcha/api.js?onloa...

How to Call a Function inside a Render in React/Jsx

I want to call a function inside some embedded html. I tried the following but the function isn't called. Would this be the incorrect way of calling a function inside a render method? import React, { Component, PropTypes } from 'react'; export def...

How can I disable HREF if onclick is executed?

I have an anchor with both HREF and ONCLICK attributes set. If clicked and Javascript is enabled, I want it to only execute ONCLICK and ignore HREF. Likewise, if Javascript is disabled or unsupported, I want it to follow the HREF URL and ignore ONCLI...

"pip install json" fails on Ubuntu

Cannot install the json module. As far as I know I shouldn't use sudo. what's the matter? pip install json The directory '/home/snow/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please c...

jQuery input button click event listener

Brand new to jQuery. I was trying to set up an event listener for the following control on my page which when clicked would display an alert: <input type="button" id="filter" name="filter" value="Filter" /> But it didn't work. $("#filter")....

AttributeError: can't set attribute in python

Here is my code N = namedtuple("N", ['ind', 'set', 'v']) def solve() items=[] stack=[] R = set(range(0,8)) for i in range(0,8): items.append(N(i,R,8)) stack.append(N(0,R-set(range(0,1)),i)) while(len(stack)&...

Define an alias in fish shell

I would like to define some aliases in fish. Apparently it should be possible to define them in ~/.config/fish/functions but they don't get auto loaded when I restart the shell. Any ideas?...

Selecting multiple items in ListView

How to select multiple item in ListView in android....

How to set initial value and auto increment in MySQL?

How do I set the initial value for an "id" column in a MySQL table that start from 1001? I want to do an insert "INSERT INTO users (name, email) VALUES ('{$name}', '{$email}')"; Without specifying the initial value for the id column....

How to get Database Name from Connection String using SqlConnectionStringBuilder

I never want to split connection string using string manipulation and get server,database,uid and password. I read the following link and read the accepted answer , I found that is the best way to get userid and password out from connection string, ...

Why am I getting tree conflicts in Subversion?

I had a feature branch of my trunk and was merging changes from my trunk into my branch periodically and everything was working fine. Today I went to merge the branch back down into the trunk and any of the files that were added to my trunk after the...

Postman addon's like in firefox

Is there a recommended add-ons in the firefox, which is has the most features that postman have? ...

How to read appSettings section in the web.config file?

My XML looks like this and the filename is web.config <?xml version="1.0"?> <configuration> <appSettings> <add key="configFile" value="IIS.config"/> <add key="RialtoDomain" value="ASNC_AUDITORS"/> <...

tsc is not recognized as internal or external command

I updated from VSCode 0.10.6 to 0.10.8, and tried using Typescript for the first time. Unfortunately I when I tell VSCode to build, I get the error: tsc is not a recognized as an internal or external command... Here are the relevant details: I cr...

How to select option in drop down using Capybara

I'm trying to select an item from a drop down menu using Capybara (2.1.0). I want to select by number (meaning select the second, third, etc option). I've Googled like crazy trying all sorts of things but no luck. I was able to select it by using...

BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly

When I run mongo, I get the warning: Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly. ...

Get full path of a file with FileUpload Control

I am working on a web application which uses the FileUpload control. I have an xls file in the full filepath 'C:\Mailid.xls' that I am attempting to upload. When I use the command FileUpload1.PostedFile.FileName I cannot get the full filepath f...

Get current value when change select option - Angular2

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

Argument of type 'X' is not assignable to parameter of type 'X'

Good day. I'm new to Type Script, using VSCode. Getting following errors: error TS2322: Type '() => string' is not assignable to type 'string'. error TS2322: Type '() => number' is not assignable to type 'number'. The Code: DTO.ts int...

How to add a custom Ribbon tab using VBA?

I am looking for a way to add a custom tab in the Excel ribbon which would carry a few buttons. I chanced on some resources addressing it via Google but all look dodgy and outrageously complicated. What is a quick and simple way to do that ? I'd li...

Retrieve data from website in android app

How can we retrieve data from a website and parse it into a readable format in the Android application? This means I want to extract data from website and use it in my android application, formatted in my way. It could be any website....

SQL Query Where Field DOES NOT Contain $x

I want to find an SQL query to find rows where field1 does not contain $x. How can I do this?...

Write string to text file and ensure it always overwrites the existing content.

I have a string with a C# program that I want to write to a file and always overwrite the existing content. If the file isn't there, the program should create a new file instead of throwing an exception....

Why is Github asking for username/password when following the instructions on screen and pushing a new repo?

I'm the owner of an organization on github and just created a repo and tried pushing but I'm running into an issue where it's asking me for my username even though I can SSH just fine: $ ssh -T [email protected] Hi Celc! You've successfully authenticat...

How to read an excel file in C# without using Microsoft.Office.Interop.Excel libraries

I have a .Net-Windows application in C#. I need to open an excel and process it. How can I do this without using Microsoft.Office.Interop.Excel libraries?...

disabling spring security in spring boot app

I have a spring boot web app with spring security configured. I want to disable authentication for a while (until needed). I add this to the application.properties: security.basic.enable: false management.security.enabled: false Here is som...

How do I make a JAR from a .java file?

I was writing a simple program using a Java application (not application that has projects, but application within a project; .java) that has a single frame. Both of the files are .java so I can't write a manifest needed by the JAR. The MyApp.java st...

SQL Server 2008 - Login failed. The login is from an untrusted domain and cannot be used with Windows authentication

I've just installed SQL Server 2008 Developer edition and I'm trying to connect using SQLCMD.exe, but I get the following error: H:\>sqlcmd.exe -S ".\SQL2008" Msg 18452, Level 14, State 1, Server DEVBOX\SQL2008, Line 1 Login failed. The login i...

What’s the best way to check if a file exists in C++? (cross platform)

I have read the answers for What's the best way to check if a file exists in C? (cross platform), but I'm wondering if there is a better way to do this using standard c++ libs? Preferably without trying to open the file at all. Both stat and access...

MySQL, Check if a column exists in a table with SQL

I am trying to write a query that will check if a specific table in MySQL has a specific column, and if not — create it. Otherwise do nothing. This is really an easy procedure in any enterprise-class database, yet MySQL seems to be an exception. ...

Force decimal point instead of comma in HTML5 number input (client-side)

I have seen that some browsers localize the input type="number" notation of numbers. So now, in fields where my application displays longitude and latitude coordinates, I get stuff like "51,983" where it should be "51.982559". My workaround is to u...

Get AVG ignoring Null or Zero values

How can I get the AVG of a column ignoring NULL and zero values? I have three columns to get their average, I try to use the following script: SELECT distinct AVG(cast(ISNULL(a.SecurityW,0) as bigint)) as Average1 ,AVG(cast(ISNULL(a.Trans...

Cookies vs. sessions

I started using PHP a couple of months ago. For the sake of creating a login system for my website, I read about cookies and sessions and their differences (cookies are stored in the user's browser and sessions on the server). At that time, I preferr...

How do I find the install time and date of Windows?

This might sound like a little bit of a crazy question, but how can I find out (hopefully via an API/registry key) the install time and date of Windows? The best I can come up with so far is to look at various files in C:\Windows and try to guess......

How to declare variable and use it in the same Oracle SQL script?

I want to write reusable code and need to declare some variables at the beginning and reuse them in the script, such as: DEFINE stupidvar = 'stupidvarcontent'; SELECT stupiddata FROM stupidtable WHERE stupidcolumn = &stupidvar; How can I decl...

How to break out or exit a method in Java?

The keyword break in Java can be used for breaking out of a loop or switch statement. Is there anything which can be used to break from a method?...

How can I discover the "path" of an embedded resource?

I am storing a PNG as an embedded resource in an assembly. From within the same assembly I have some code like this: Bitmap image = new Bitmap(typeof(MyClass), "Resources.file.png"); The file, named "file.png" is stored in the "Resources" folder ...

How to create duplicate table with new name in SQL Server 2008

How do I create a duplicate table with only the structure duplicated with a new name in SQL server 2008? I have table with 45 fields so I want to create new with same structure but new name....

Append data frames together in a for loop

I have a for loop which produces a data frame after each iteration. I want to append all data frames together but finding it difficult. Following is what I am trying, please suggest how to fix it: d = NULL for (i in 1:7) { # vector output mode...

What is the difference between an IntentService and a Service?

Can you please help me understand what the difference between an IntentService and a Service is?...

Why does configure say no C compiler found when GCC is installed?

I am trying to make Sphinx from source on a 32-bit CentOS 6 VPS. When I run this command: ./configure --prefix=/usr/local/sphinx I get this error output: checking build environment -------------------------- checking for a BSD-compatible instal...

LINQ orderby on date field in descending order

How can I change the LINQ query in the code below to sort by date in descending order (latest first, earliest last)? using System; using System.Linq; using System.Collections.Generic; namespace Helloworld { class MainClass { public...

Creating a Pandas DataFrame from a Numpy array: How do I specify the index column and column headers?

I have a Numpy array consisting of a list of lists, representing a two-dimensional array with row labels and column names as shown below: data = array([['','Col1','Col2'],['Row1',1,2],['Row2',3,4]]) I'd like the resulting DataFrame to have Row1 an...

How to use RANK() in SQL Server

I have a problem using RANK() in SQL Server. Here’s my code: SELECT contendernum, totals, RANK() OVER (PARTITION BY ContenderNum ORDER BY totals ASC) AS xRank FROM ( SELECT ContenderNum, SUM(Criteria1+Criteria2+Criteri...

how to drop database in sqlite?

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

How to refer environment variable in POM.xml?

I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?...

Encrypt & Decrypt using PyCrypto AES 256

I'm trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message. I found several links on the web to help me out, but each one of them has flaws: This one at codekoala uses ...

Slide right to left?

How can I have a div go from collapsed to expanded (and vice versa), but do so from right to left? Most everything I see out there is always left to right....

What does the Java assert keyword do, and when should it be used?

What are some real life examples to understand the key role of assertions?...

How to use php serialize() and unserialize()

My problem is very basic. I did not find any example to meet my needs as to what exactly serialize() and unserialize() mean in php? They just give an example - serialize an array and show an output in an unexplained format. It is really hard to unde...

PowerShell Script to Find and Replace for all Files with a Specific Extension

I have several configuration files on Windows Server 2008 nested like such: C:\Projects\Project_1\project1.config C:\Projects\Project_2\project2.config In my configuration I need to do a string replace like such: <add key="Environment" value=...

What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?

The title pretty much says it all. What's the simplest/most elegant way that I can convert, in Java, a string from the format "THIS_IS_AN_EXAMPLE_STRING" to the format "ThisIsAnExampleString"? I figure there must be at least one way to do it using St...

How to select last one week data from today's date

How to select week data (more precisely, last 7 days data) from the current date in the fastest way as I have millions or rows in the table. I have a time stamp of created_date in sql table. I have tried this SELECT Created_Date FROM Table_Name W...

Adding multiple columns AFTER a specific column in MySQL

I need to add multiple columns to a table but position the columns after a column called lastname. I have tried this: ALTER TABLE `users` ADD COLUMN ( `count` smallint(6) NOT NULL, `log` varchar(12) NOT NULL, `status` int(10) unsigned N...

Javascript onHover event

Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time....

Cleanest way to write retry logic?

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

How to copy file from host to container using Dockerfile

I have written a Dockerfile which looks like this FROM ubuntu:12.04 RUN apt-get update RUN apt-get install -y wget Now I'm having a file called abc.txt in my host machine. How can I copy it to this container. Is there any step that I can add in D...

How do I change the font size and color in an Excel Drop Down List?

I was wondering if its possible to Style a Drop Down List in Excel. The text is rather small and has no styling and I was wondering if the drop down list styling could be changed? What would actually make sense is if the drop down list items copied...

Create a custom View by inflating a layout?

I am trying to create a custom View that would replace a certain layout that I use at multiple places, but I am struggling to do so. Basically, I want to replace this: <RelativeLayout android:id="@+id/dolphinLine" android:layout_width="fill_pa...

Remove an entire column from a data.frame in R

Does anyone know how to remove an entire column from a data.frame in R? For example if I am given this data.frame: > head(data) chr genome region 1 chr1 hg19_refGene CDS 2 chr1 hg19_refGene exon 3 chr1 hg19_refGene CDS 4 chr1 hg1...

Check if string contains a value in array

I am trying to detect whether a string contains at least one URL that is stored in an array. Here is my array: $owned_urls = array('website1.com', 'website2.com', 'website3.com'); The string is entered by the user and submitted via PHP. On the co...

A transport-level error has occurred when receiving results from the server

I'm getting a SQL Server error: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The handle is invalid.) I'm running Sql Server 2008 SP1, Windows 2008 Standard 64...

How do I search for an object by its ObjectId in the mongo console?

I've found this question answered for C# and Perl, but not in the native interface. I thought this would work: db.theColl.find( { _id: ObjectId("4ecbe7f9e8c1c9092c000027") } ) The query returned no results. I found the 4ecbe7f9e8c1c9092c000027 by ...

Android Paint: .measureText() vs .getTextBounds()

I'm measuring text using Paint.getTextBounds(), since I'm interested in getting both the height and width of the text to be rendered. However, the actual text rendered is always a bit wider than the .width() of the Rect information filled by getTextB...

Java reflection: how to get field value from an object, not knowing its class

Say, I have a method that returns a custom List with some objects. They are returned as Object to me. I need to get value of a certain field from these objects, but I don't know the objects' class. Is there a way to do this via Reflecion or somehow...

How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved

I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or th...

How do Python functions handle the types of the parameters that you pass in?

Unless I'm mistaken, creating a function in Python works like this: def my_func(param1, param2): # stuff However, you don't actually give the types of those parameters. Also, if I remember, Python is a strongly typed language, as such, it seem...

chai test array equality doesn't work as expected

Why does the following fail? expect([0,0]).to.equal([0,0]); and what is the right way to test that?...

can you host a private repository for your organization to use with npm?

Npm sounds like a great platform to use within an organization, curious if a private repo is possible, like with Nexus/Maven. Nothing comes up on Google :(...

Copying formula to the next row when inserting a new row

I have a row in which there are formulas using values of the same row. The next row is empty, just with a different background color. Now, if I insert a new row (by right-clicking on the empty row and "insert"), I get a new row with NO background co...

Detecting a mobile browser

I'm looking for a function which return boolean value if user has mobile browser or not. I know that I can use navigator.userAgent and write that function by using regex, but user-agents are too various for different platforms. I doubt that match al...

Why is my Spring @Autowired field null?

Note: This is intended to be a canonical answer for a common problem. I have a Spring @Service class (MileageFeeCalculator) that has an @Autowired field (rateService), but the field is null when I try to use it. The logs show that both the MileageFe...

How to use if-else option in JSTL

Is there an if-else tag available in JSTL?...

How to run shell script on host from docker container?

How to control host from docker container? For example, how to execute copied to host bash script?...

Pass a JavaScript function as parameter

How do I pass a function as a parameter without the function executing in the "parent" function or using eval()? (Since I've read that it's insecure.) I have this: addContact(entityId, refreshContactList()); It works, but the problem is that refr...

Does this app use the Advertising Identifier (IDFA)? - AdMob 6.8.0

I'm currently uploading my App to the App Store and Apple is asking me if this app users IDFA. I'm using the latest Admob SDK or 6.8.0 and I don't know if it uses IDFA or not, and if it does which check boxes should I hit X.X Image http://i.gyazo.co...

Error:java: invalid source release: 8 in Intellij. What does it mean?

Im trying to compile some code in I'm using Intellij Ultimate 13.1.4, but I get the following error and I have no idea what it means: Information:Using javac 1.7.0_55 to compile java sources Information:java: Errors occurred while compiling module '...

Excel how to fill all selected blank cells with text

Is it possible to select all the bank cells in an excel sheet and put the same value in all the cells? I just want to populate them with "null" I have Excel student 2010...

HTML5 pattern for formatting input box to take date mm/dd/yyyy?

I used jQuery datepicker and I want to restrict my input field with a HTML5 pattern if a user, instead of getting the date from jQuery datepicker, types the date. How can I restrict my users with a HTML5 pattern so that they can just type the date ...

JavaFX Application Icon

Is it possible to change the application icon using JavaFX, or does it have to be done using Swing?...

What is a clean, Pythonic way to have multiple constructors in Python?

I can't find a definitive answer for this. As far as I know, you can't have multiple __init__ functions in a Python class. So how do I solve this problem? Suppose I have a class called Cheese with the number_of_holes property. How can I have two ways...

Python Pip install Error: Unable to find vcvarsall.bat. Tried all solutions

I tried to install Scrapy for Python 2.7.8 (anaconda 2.1.0) 32-bit using pip install scrapy And I got this error error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). I have followed the solutions found in these stacko...

How to mark a build unstable in Jenkins when running shell scripts

In a project I'm working on, we are using shell scripts to execute different tasks. Some are sh/bash scripts that run rsync, and some are PHP scripts. One of the PHP scripts is running some integration tests that output to JUnit XML, code coverage re...

ORA-28000: the account is locked error getting frequently

I am getting the error : ORA-28000: the account is locked Is this a DB Issue? When I unlock user account using the command ALTER USER username ACCOUNT UNLOCK temporarily it will be OK. Then after some time the same account lock happens again. T...

How to enable support of CPU virtualization on Macbook Pro?

I have the VirtualBox installed on my Macbook Pro, and I want to install a linux VM on VirtualBox. When I launched the new VM, it prompts that "Your CPU does not support long mode. Use a 32bit distribution." After searching for this problem, I foun...

jquery loop on Json data using $.each

I have the following JSON returned in a variable called data. THIS IS THE JSON THAT GETS RETURNED... [ {"Id": 10004, "PageName": "club"}, {"Id": 10040, "PageName": "qaz"}, {"Id": 10059, "PageName": "jjjjjjj"} ] and I am trying to loop through ...

Determine device (iPhone, iPod Touch) with iOS

Is there a way to determine the device running an application. I want to distinguish between iPhone and iPod Touch, if possible....

"configuration file /etc/nginx/nginx.conf test failed": How do I know why this happened?

I'm an nginx noob trying out this this tutorial on nginx 1.1.19 on ubuntu 12.04. I have this nginx config file. When I run this command the test fails: $ sudo service nginx restart Restarting nginx: nginx: [crit] pread() "/etc/nginx/sites-enabled/c...

Remove all unused resources from an android project

I want to remove all unused layouts, strings, drawables, colors, etc from my Android res directory. Are there any tools that will give me a list of files and I can remove from my repository and elements within specifics files (e.g. unused string entr...

How to use Git for Unity3D source control?

What are best practices for using Git source control with Unity 3D, particularly in dealing with the binary nature of Unity 3D projects? Please describe the workflow, what paths would be included in .gitignore, what settings should be set in Unity an...

How can I get name of element with jQuery?

How can I get name property of HTML element with jQuery?...

Retrieving the COM class factory for component failed

I am using an excel object (COM component) for excel manipulation. It works fine on my PC, but when I deploy the application to our Intranet I am getting this error: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C0...

Object creation on the stack/heap?

The following code creates an object on the stack: Object o; When creating an object on the heap we can use: Object* o; o = new Object(); rather than: Object* o = new Object(); When we split the heap object-creation over two lines and call ...

How do I create a Python function with optional arguments?

I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios. def some_function (self, a, b, c, d = None, e = None, f = None, g = None, h = None): #code The arguments d through h are string...

How do I change the UUID of a virtual disk?

I am trying to create a new virtual machine with Oracle VirtualBox, using an already-existing hard disk. When I try to select the existing hard disk file, a .vhd file, it displays an error saying the virtual hard disk cannot be used because the UUID ...

Window vs Page vs UserControl for WPF navigation?

I am currently writing a desktop application, but I cannot seem to get my head around what to use when redirecting someone to a new section of the application. My options appear to be Window Page UserControl but I don't understand what the diffe...

Printing Mongo query output to a file while in the mongo shell

2 days old with Mongo and I have a SQL background so bear with me. As with mysql, it is very convenient to be in the MySQL command line and output the results of a query to a file on the machine. I am trying to understand how I can do the same with M...

What are the First and Second Level caches in (N)Hibernate?

Can anyone explain in simple words what First and Second Level caching in Hibernate/NHibernate are?...

Shell Script Syntax Error: Unexpected End of File

In the following script I get an error: syntax error: unexpected end of file What is this error how can I resove it? It is pointing at the line whee the function is called. #!/bin/sh expected_diskusage="264" expected_dbconn="25" expected_htt...

Difference between a SOAP message and a WSDL?

I am confused about how SOAP messages and WSDL fit together? I have started looking into SOAP messages such as: POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version...

print call stack in C or C++

Is there any way to dump the call stack in a running process in C or C++ every time a certain function is called? What I have in mind is something like this: void foo() { print_stack_trace(); // foo's body return } Where print_stack_tr...

PHP Array to JSON Array using json_encode();

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

How to insert programmatically a new line in an Excel cell in C#?

I'm using the Aspose library to create an Excel document. Somewhere in some cell I need to insert a new line between two parts of the text. I tried "\r\n" but it doesn't work, just displays two square symbols in cell. I can however press Alt+Enter t...

How to update gradle in android studio?

I installed Android Studio 0.1.9. Today I got and update to version 0.2 and of course I updated. After the installation I restarted Android Studio but now I get this message: Project is using an old version of the Android Gradle plug-in. The m...

.gitignore exclude folder but include specific subfolder

I have the folder application/ which I add to the .gitignore. Inside the application/ folder is the folder application/language/gr. How can I include this folder? I've tried this application/ !application/language/gr/ with no luck......

A url resource that is a dot (%2E)

I have a resource that is a . This means my url looks like this: http://myapp/index/. And i need to add query parameters so that it looks like this: http://myapp/index/.?type=xml I use Freemarker for the presentation of my resources and made a percen...

How do I remove quotes from a string?

$string = "my text has \"double quotes\" and 'single quotes'"; How to remove all types of quotes (different languages) from $string?...

How can I add new item to the String array?

Possible Duplicate: how to add new elements to a String[] array? How can I add new item to the String array ? I am trying to add item to the initially empty String. Example : String a []; a.add("kk" ); a.add("pp"); ...

How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?

In Firefox 3, the answer is 6 per domain: as soon as a 7th XmlHttpRequest (on any tab) to the same domain is fired, it is queued until one of the other 6 finish. What are the numbers for the other major browsers? Also, are there ways around these l...

Need to ZIP an entire directory using Node.js

I need to zip an entire directory using Node.js. I'm currently using node-zip and each time the process runs it generates an invalid ZIP file (as you can see from this Github issue). Is there another, better, Node.js option that will allow me to ZIP...

PHP PDO: charset, set names?

I had this previously in my normal mysql_* connection: mysql_set_charset("utf8",$link); mysql_query("SET NAMES 'UTF8'"); Do I need it for the PDO? And where should I have it? $connect = new PDO("mysql:host=$host;dbname=$db", $user, $pass, array(P...

Oracle Add 1 hour in SQL

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

Python send POST with header

I try to build a python script who sends a POST with parameters for extracting the result. With fiddler, I have extracted the post request who return that I want. The website uses https only. POST /Services/GetFromDataBaseVersionned HTTP/1.1 Host: ...

Reorder bars in geom_bar ggplot2 by value

I am trying to make a bar-plot where the plot is ordered from the miRNA with the highest value to the miRNA with the lowest. Why does my code not work? > head(corr.m) miRNA variable value 1 mmu-miR-532-3p pos 7 2 m...

C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what && address operator is supposed to do. Here is a code example from stl_vector.h: vector& operator=(vector&& __x) // <-- Note double ampersands here { // NB: DR 675. t...

How can I check out a GitHub pull request with git?

I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr But when I add fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to the git config f...

Combating AngularJS executing controller twice

I understand AngularJS runs through some code twice, sometimes even more, like $watch events, constantly checking model states etc. However my code: function MyController($scope, User, local) { var $scope.User = local.get(); // Get locally save us...

Find out where MySQL is installed on Mac OS X

How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?...

Can Python test the membership of multiple values in a list?

I want to test if two or more values have membership on a list, but I'm getting an unexpected result: >>> 'a','b' in ['b', 'a', 'foo', 'bar'] ('a', True) So, Can Python test the membership of multiple values at once in a list? What does t...

Make text wrap in a cell with FPDF?

Right now when I use a cell with text, it all stays on one line. I know I could use the write function, but I want to be able to specify the height and width. This is what I have now, but as I said the text does not wrap to stay in the dimensions: ...

ApiNotActivatedMapError for simple html page using google-places-api

I'm trying to create a simple html page (I'd later like to add an autocomplete input there) that include google-places-api. I have an api-key (which is enabled) but I still get an error message. Here is my html- <head> <meta charset="u...

How to fill a Javascript object literal with many static key/value pairs efficiently?

The typical way of creating a Javascript object is the following: var map = new Object(); map[myKey1] = myObj1; map[myKey2] = myObj2; I need to create such a map where both keys and values are Strings. I have a large but static set of pairs to add...

Split data frame string column into multiple columns

I'd like to take data of the form before = data.frame(attr = c(1,30,4,6), type=c('foo_and_bar','foo_and_bar_2')) attr type 1 1 foo_and_bar 2 30 foo_and_bar_2 3 4 foo_and_bar 4 6 foo_and_bar_2 and use split() on the column...

Center a H1 tag inside a DIV

I have the following DIV inside a body tag: <div id="AlertDiv"><h1>Yes</h1></div> And these are their CSS classes: #AlertDiv { position:absolute; height: 51px; left: 365px; top: 198px; width: 62px; ...

Should I use Python 32bit or Python 64bit

I have a win7 64bit installation. Must I use Python 64bit? What are the differences between the 32bit and 64bit Python versions anyway? Do different Python packages (such as south, django, mysqldb etc) support only 32bit/64bit?...

What is "Linting"?

PHPLint, JSLint, and I recently came across "you can lint your JS code on the fly" while reading something about some IDE. So, what is "linting"?...

How to import a bak file into SQL Server Express

I have a .bak file, and I want to use this file to recreate the database in a fresh install of SQL Server 2008 Management Studio. Can someone point me in the right direction on how this can be done? I have tried: right click on the Databases cont...

Is a Python dictionary an example of a hash table?

One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?...

How to create a multi line body in C# System.Net.Mail.MailMessage

If create the body property as System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.Body ="First Line \n second line"; I also tried message.Body ="First Line" + system.environment + "second line"; Both of these wer...

Android LinearLayout Gradient Background

I am having trouble applying a gradient background to a LinearLayout. This should be relatively simple from what I have read but it just doesn't seem to work. For reference sakes I am developing on 2.1-update1. header_bg.xml: <?xml version="1.0...

CreateProcess error=2, The system cannot find the file specified

I am writing a program in java which would execute winrar and unzip a jar file for me placed in h:\myjar.jar into the folder h:\new. My java code goes something like this import java.io.File; import java.io.IOException; public class MainClass { ...

Laravel Carbon subtract days from current date

I am trying to extract objects from Model "Users" whose created_at date has been more than 30 days from today. Carbon::now() ==> I want as ==> Carbon::now() - 30days $users = Users::where('status_id', 'active') ->where( 'created_a...

Using HTML and Local Images Within UIWebView

I have a UIWebView in my app which I want to use to display an image which will link to another url. I'm using <img src="image.jpg" /> to load the image. The problem is that the image doesn't load (ie. it can't be found) even though it's ad...

How do I create variable variables?

How do I accomplish variable variables in Python? Here is an elaborative manual entry, for instance: Variable variables I hear this is a bad idea in general though, and it is a security hole in PHP. Is that true?...

Jquery - Uncaught TypeError: Cannot use 'in' operator to search for '324' in

I'm trying to send a Get request by ajax and output json data that is returned by server in html. But, I got this error. Uncaught TypeError: Cannot use 'in' operator to search for '324' in [{"id":50,"name":"SEO"},{"id":22,"name":"LPO",}] This is...

validation of input text field in html using javascript

<script type='text/javascript'> function required() { var empt = document.forms["form1"]["Name"].value; if (empt == "") { alert("Please input a Value"); return false; } } </script> <f...

C++ -- expected primary-expression before ' '

I am new to C++ and programming, and have run into an error that I cannot figure out. When I try to run the program, I get the following error message: stringPerm.cpp: In function ‘int main()’: stringPerm.cpp:12: error: expected primary-expressio...

Two statements next to curly brace in an equation

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

android adb turn on wifi via adb

My phone has been locked (too many pattern attempts). To unlock I need to enter username and password on my gmail account. This is the only way I can unlock it. I cant launch any activities, even to turn on wifi connection. Without internet connectio...

javascript create array from for loop

I have a years range stored into two variables. I want to create an array of the years in the range. something like: var yearStart = 2000; var yearEnd = 2040; var arr = []; for (var i = yearStart; i < yearEnd; i++) { var obj = { ...

How to enable CORS in ASP.net Core WebAPI

What I am trying to do I have a backend ASP.Net Core Web API hosted on an Azure Free Plan (Source Code: https://github.com/killerrin/Portfolio-Backend). I also have a Client Website which I want to make consume that API. The Client Application wil...

Semaphore vs. Monitors - what's the difference?

What are the major differences between a Monitor and a Semaphore?...

How to disable action bar permanently

I can hide the action bar in honeycomb using this code: getActionBar().hide(); But when the keyboard opens, and user copy-pastes anything, the action bar shows again. How can I disable the action bar permanently?...

Strip Leading and Trailing Spaces From Java String

Is there a convenience method to strip any leading or trailing spaces from a Java String? Something like: String myString = " keep this "; String stripppedString = myString.strip(); System.out.println("no spaces:" + strippedString); Result: no...

How to convert date to timestamp?

I want to convert date to timestamp, my input is 26-02-2012. I used new Date(myDate).getTime(); It says NaN.. Can any one tell how to convert this?...

How to set the opacity/alpha of a UIImage?

I know you can do this with a UIImageView, but can it be done to a UIImage? I want to have the animation images array property of a UIImageView to be an array of the same image but with different opacities. Thoughts?...

Closing WebSocket correctly (HTML5, Javascript)

I am playing around with HTML5 WebSockets. I was wondering, how do I close the connection gracefully? Like, what happens if user refreshes the page, or just closes the browser? There is a weird behavior when a user just refresh the page without call...

JAVA_HOME directory in Linux

Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but I can't find the directory....

How to re-index all subarray elements of a multidimensional array?

The question is how to reset key e.g. for an array: Array ( [1_Name] => Array ( [1] => leo [4] => NULL ) [1_Phone] => Array ( [1] => 12345 [4] => 434324 ) ) reset to : Arr...

Android set bitmap to Imageview

Hi i have a string in Base64 format. I want to convert it ot a bitmap and then display it to an ImageView. This is the code: ImageView user_image; Person person_object; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreat...

What does getActivity() mean?

What does getActivity() mean? I saw in somewhere, they wrote MainActivity.this.startActionMode(mActionModeCallback) instead of getActivity(). could someone explain what this two lines mean? someView.setOnLongClickListener(new View.OnLongClickListe...

Stopping Docker containers by image name - Ubuntu

On Ubuntu 14.04 (Trusty Tahr) I'm looking for a way to stop a running container and the only information I have is the image name that was used in the Docker run command. Is there a command to find all the matching running containers that mat...

JavaScript getElementByID() not working

Why does refButton get null in the following JavaScript code? <html> <head> <title></title> <script type="text/javascript"> var refButton = document.getElementById("btnButton"); refButton.onclic...

Capturing browser logs with Selenium WebDriver using Java

Is there a way to capture browser logs while running automated test cases with Selenium? I found an article on how to capture JavaScript errors in Selenium. But that is just for Firefox and only for errors. I would like to get all the console logs....

How to remove whitespace from a string in typescript?

In my angular 5 project, with typescript I am using the .trim() function on a string like this, But it is not removing the whitespace and also not giving any error. this.maintabinfo = this.inner_view_data.trim().toLowerCase(); // inner_view_data ha...

How To Convert A Number To an ASCII Character?

I want to create an application where user would input a number and the program will throw back a character to the user. Edit: How about vice versa, changing a ascii character into number?...

Finding which process was killed by Linux OOM killer

When Linux runs out of memory (OOM), the OOM killer chooses a process to kill based on some heuristics (it's an interesting read: http://lwn.net/Articles/317814/). How can one programmatically determine which processes have recently been killed by t...

Get Substring - everything before certain char

I'm trying to figure out the best way to get everything before the - character in a string. Some example strings are below. The length of the string before - varies and can be any length 223232-1.jpg 443-2.jpg 34443553-5.jpg so I need the value ...

design a stack such that getMinimum( ) should be O(1)

This is one of an interview question. You need to design a stack which holds an integer value such that getMinimum() function should return the minimum element in the stack. For example: consider the below example case #1 5 --> TOP 1 4 6 2 When...

Are email addresses case sensitive?

I've read that by standard first part of e-mail is case sensitive, however I've tried to send e-mail to [email protected], [email protected] and [email protected] - it has arrived in each case. How do mail servers handles usernames? Is it possible to m...

no target device found android studio 2.1.1

i'm using android studio 2.1.1 in ubuntu 14.04.Now my question is,i want to run the program through my phone without emulator. so i chose the target as usb device but whenever i run this,below mentioned error is rasing. Error running app : No target...

makefile:4: *** missing separator. Stop

This is my makefile: all:ll ll:ll.c gcc -c -Wall -Werror -02 c.c ll.c -o ll $@ $< clean : \rm -fr ll When I try to make clean or make make, I get this error: :makefile:4: *** missing separator. Stop. How can I fix it?...

How to prevent Screen Capture in Android

Is it possible to prevent the screen recording in Android Application? I would like to develop an Android Secure Application. In that I need to detect screen recording software which are running background and kill them. I have used SECURE FLAG for ...

React Modifying Textarea Values

I am working on a project which is basically notepad. I am having problems though updating the <textarea>'s value when an ajax call is made. I tried setting the textarea's value property but then no changes to its value can be made. How can I m...

How can foreign key constraints be temporarily disabled using T-SQL?

Are disabling and enabling foreign key constraints supported in SQL Server? Or is my only option to drop and then re-create the constraints?...

Show Current Location and Update Location in MKMapView in Swift

I am learning how to use the new Swift language (only Swift, no Objective-C). To do it, I want to do a simple view with a map (MKMapView). I want to find and update the location of the user (like in the Apple Map app). I tried this, but nothing happ...

How to access SOAP services from iPhone

I'm planning to develop an app for the iPhone and that app would have to access a couple of SOAP services. While doing some basic checking in the iPhone SDK I was not able to find any support for accessing SOAP services, a bit of Googling lead to the...

How to add double quotes to a string that is inside a variable?

I have variable like: string title = string.empty; My need is that whatever string is passed to it I have to display the content inside a div with in a double quotes. So I have written something like: ... ... <div>"+ title +@"</div> ...

MySQL Cannot Add Foreign Key Constraint

So I'm trying to add Foreign Key constraints to my database as a project requirement and it worked the first time or two on different tables, but I have two tables on which I get an error when trying to add the Foreign Key Constraints. The error mes...

Redeploy alternatives to JRebel

JRebel allows for newly compiled code to be redeployed without restarting the application. I am wondering if there are any alternative (free?). The FAQ page answers this question, but I am sure it's biased towards JRebel. This question was asked ...

How do I join two SQLite tables in my Android application?

Background I have an Android project that has a database with two tables: tbl_question and tbl_alternative. To populate the views with questions and alternatives I am using cursors. There are no problems in getting the data I need until I try to join...

How to use mouseover and mouseout in Angular 6

I have this older Angular code which works but not in the latest version of Angular 6. <div ng-mouseover="changeText=true" ng-mouseleave="changeText=false" ng-init="changeText=false"> <span ng-hide="changeText">Hide</span> <...

How to force 'cp' to overwrite directory instead of creating another one inside?

I'm trying to write a Bash script that will overwrite an existing directory. I have a directory foo/ and I am trying to overwrite bar/ with it. But when I do this: cp -Rf foo/ bar/ a new bar/foo/ directory is created. I don't want that. There are ...

Setting default value in select drop-down using Angularjs

I have an object as below. I have to display this as a drop-down: var list = [{id:4,name:"abc"},{id:600,name:"def"},{id:200,name:"xyz"}] In my controller I have a variable that carries a value. This value decided which of the above three items in ...

tsconfig.json: Build:No inputs were found in config file

I have an ASP.NET core project and I'm getting this error when I try to build it: error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' ...

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 almost 1000 files....

Javascript switch vs. if...else if...else

Guys I have a couple of questions: Is there a performance difference in JavaScript between a switch statement and an if...else? If so why? Is the behavior of switch and if...else different across browsers? (FireFox, IE, Chrome, Opera, Safari) ...

Where to find the complete definition of off_t type?

I am sending file from client to server using TCP. To mark the end of the file I like to send file size before the actual data. So I use stat system call to find the size of the file. This is of type off_t. I like to know how many bytes it occupies s...

How do getters and setters work?

I'm from the php world. Could you explain what getters and setters are and could give you some examples?...

Functional, Declarative, and Imperative Programming

What do the terms functional, declarative, and imperative programming mean?...

change directory in batch file using variable

Here's the question: set Pathname = C:\Program Files cd %Pathname% pause The above doesn't change the directory, as I would expect. Can anybody please tell me why?...

How to get Client location using Google Maps API v3?

How do you get Client location using Google Maps API v3? I tried the following code but kept getting the "google.loader.ClientLocation is null or not an object" error. Any ideas why ?? if (google.loader.ClientLocation) { alert(google.loa...

How to add to the PYTHONPATH in Windows, so it finds my modules/packages?

I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > ...

ASP.NET MVC Html.ValidationSummary(true) does not display model errors

I have some problem with Html.ValidationSummary. I don't want to display property errors in ValidationSummary. And when I set Html.ValidationSummary(true) it does not display error messages from ModelState. When there is some Exception in controller ...

How to update primary key

Here is my problem - I have 2 tables: WORKER, with columns |ID|OTHER_STAF| , where ID is primary key FIRM, with columns |FPK|ID|SOMETHING_ELSE| , where combination FPK and ID make primary key, and also ID is a foreign key referenced to WORKER.ID (no...

Bootstrap onClick button event

This seems a silly question but just got bootstrap and it doesn't gives any examples on the website about adding a Javascript callback to a button... Tried setting my button an id flag and then <div class="btn-group"> <button id="rectBut...

INSERT statement conflicted with the FOREIGN KEY constraint - SQL Server

I am getting the following error. Could you please help me? Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Sup_Item_Sup_Item_Cat". The conflict occurred in database "dev_bo", table "dbo.Su...

How to generate UML diagrams (especially sequence diagrams) from Java code?

How can I generate UML diagrams (especially sequence diagrams) from existing Java code?...

Python 3 turn range to a list

I'm trying to make a list with numbers 1-1000 in it. Obviously this would be annoying to write/read, so I'm attempting to make a list with a range in it. In Python 2 it seems that: some_list = range(1,1000) would have worked, but in Python 3 the r...

Nodemailer with Gmail and NodeJS

I try to use nodemailer to implement a contact form using NodeJS but it works only on local it doesn't work on a remote server... My error message : [website.fr-11 (out) 2013-11-09T15:40:26] { [AuthError: Invalid login - 534-5.7.14 <https://acco...

Preloading images with JavaScript

Is the function I wrote below enough to preload images in most, if not all, browsers commonly used today? function preloadImage(url) { var img=new Image(); img.src=url; } I have an array of image URLs that I loop over and call the preloadI...

Property '...' has no initializer and is not definitely assigned in the constructor

in my Angular app i have a component: import { MakeService } from './../../services/make.service'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-vehicle-form', templateUrl: './vehicle-form.component.html', sty...

Toolbar Navigation Hamburger Icon missing

I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true); it display the back arrow but not the hambuerge...

Single selection in RecyclerView

I know there are no default selection methods in recyclerview class, But I have tried in following way, public void onBindViewHolder(ViewHolder holder, final int position) { holder.mTextView.setText(fonts.get(position).getName()); holder.che...

VB.NET - How to move to next item a For Each Loop?

Is there a statment like Exit For, except instead of exiting the loop it just moves to the next item. For example: For Each I As Item In Items If I = x Then ' Move to next item End If ' Do something Next I know could simpl...

make an ID in a mysql table auto_increment (after the fact)

I acquired a database from another developer. He didn't use auto_incrementers on any tables. They all have primary key ID's, but he did all the incrementing manually, in code. Can I turn those into Auto_incrementers now? Wow, very nice, thanks ...

Div Size Automatically size of content

I am trying to make a h2 header for sidebar widgets but I want the width of the div class to be whatever width the content becomes. It seems I can't just set a width because those headlines with longer content then shorter content makes it break. Ho...

include external .js file in node.js app

I have an app.js node application. As this file is starting to grow, I would like to move some part of the code in some other files that I would "require" or "include" in the app.js file. I'm trying things like: // Declare application var app = req...

shorthand If Statements: C#

Just a quick one, Is there anyway to shorthand this? It's basically determining the direction left or right, 1 for left, 0 for right In C#: if (column == 0) { direction = 0; } else if (column == _gridSize - 1) { direction = 1; } else { direction =...

Export specific rows from a PostgreSQL table as INSERT SQL script

I have a database schema named: nyummy and a table named cimory: create table nyummy.cimory ( id numeric(10,0) not null, name character varying(60) not null, city character varying(50) not null, CONSTRAINT cimory_pkey PRIMARY KEY (id) ); I...

Absolute position of an element on the screen using jQuery

How do I find out the absolute position of an element on the current visible screen (viewport) using jQuery? I am having position:relative, so offset() will only give the offset within the parent. I have hierarchical divs, so $("#me").parent().offs...

invalid use of non-static member function

I have something like this: class Bar { public: pair<string,string> one; std::vector<string> cars; Bar(string one, string two, string car); }; class Car { public: string rz;...

How to verify CuDNN installation?

I have searched many places but ALL I get is HOW to install it, not how to verify that it is installed. I can verify my NVIDIA driver is installed, and that CUDA is installed, but I don't know how to verify CuDNN is installed. Help will be much appre...

jQuery change input text value

I can't find the right selector for: <input maxlength="6" size="6" id="colorpickerField1" name="sitebg" value="#EEEEEE" type="text"> I want to change the value to = 000000. I need the selector to find the "name" not the id of the text input....

Assigning strings to arrays of characters

I am a little surprised by the following. Example 1: char s[100] = "abcd"; // declare and initialize - WORKS Example 2: char s[100]; // declare s = "hello"; // initalize - DOESN'T WORK ('lvalue required' error) I'm wondering why the second app...

How to install PyQt5 on Windows?

When I try installing the PyQt5 on Windows using the command python configure.py I get this error: Error: Make sure you have a working Qt qmake on your PATH. I got the pyQt5 from PyQt5 Download. How can I install PyQt5? Update: I instal...

Android Layout Weight

I am new to Android development and I have a question about setting weight in a linear layout. I am trying to create a row with two custom buttons and a custom edit text. The edit text should only take up as much room as its content, and the two ...

Choosing the correct upper and lower HSV boundaries for color detection with`cv::inRange` (OpenCV)

I have an image of a coffee can with an orange lid position of which I want to find. Here is it . gcolor2 utility shows HSV at the center of the lid to be (22, 59, 100). The question is how to choose the limits of the color then? I tried min = (18, ...

How to enable explicit_defaults_for_timestamp?

When I try to start my mySQL server I get message: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). I find answer on: http://dev....

Where is Java Installed on Mac OS X?

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

Is it possible to declare a public variable in vba and assign a default value?

I want to do this but it won't compile: Public MyVariable as Integer = 123 What's the best way of achieving this?...

jQuery animate margin top

I have a script on jsfiddle: http://jsfiddle.net/kX7b6/ Nothing happens on hover On hover I want the green box to overlap the red box with a negative margin -50px. Nothing happens. The animation works, but not margin Just to show that the animati...

Multiple conditions in a C 'for' loop

I came across this piece of code. I generally use '&&' or '||' to separate multiple conditions in a for loop, but this code uses commas to do that. Surprisingly, if I change the order of the conditions the output varies. #include<stdio.h...

Searching if value exists in a list of objects using Linq

Say I have a class Customer which has a property FirstName. Then I have a List<Customer>. Can LINQ be used to find if the list has a customer with Firstname = 'John' in a single statement.. how?...

Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

I have a java project that runs on a webserver. I always hit this exception. I read some documentation and found that pessimistic locking (or optimistic, but I read that pessimistic is better) is the best way to prevent this exception. But I couldn't...

Apache Tomcat :java.net.ConnectException: Connection refused

while i try to stop tomcat server its giving an error like this. [root@server classes]# service tomcat restart Stopping Tomcat service: Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Us...

how to Call super constructor in Lombok

I have a class @Value @NonFinal public class A { int x; int y; } I have another class B @Value public class B extends A { int z; } lombok is throwing error saying it cant find A() constructor, explicitly call it what i want lombok ...

Check if a div exists with jquery

Yes, I know this has been asked a lot. But, it confuses me, since the results on google for this search show different methods (listed below) $(document).ready(function() { if ($('#DivID').length){ alert('Found with Length'); } ...

What is an .axd file?

What kind of purpose do .axd files serve? I know that it is used in the ASP.Net AJAX Toolkit and its controls. I'd like to know more about it. I tried Googling for it, but could not find getting basic information....

PostgreSQL Exception Handling

I am new to PostgreSQL. Could anybody please correct this query. BEGIN TRANSACTION; BEGIN; CREATE TABLE "Logs"."Events" ( EventId BIGSERIAL NOT NULL PRIMARY KEY, PrimaryKeyId bigint NOT NULL, EventDateTime date NOT N...

How to get setuptools and easy_install?

I downloaded the ez_setup code from here: http://peak.telecommunity.com/dist/ez_setup.py and ran it, but i don't think setuptools was properly installed. When i try to open an egg using easy_install i am getting a NameError. Any thoughts? Here is th...

How to set the font style to bold, italic and underlined in an Android TextView?

I want to make a TextView's content bold, italic and underlined. I tried the following code and it works, but doesn't underline. <Textview android:textStyle="bold|italic" .. How do I do it? Any quick ideas?...

Difference between maven scope compile and provided for JAR packaging

What is the difference between the maven scope compile and provided when artifact is built as a JAR? If it was WAR, I'd understand - the artifact would be included or not in WEB-INF/lib. But in case of a JAR it doesn't matter - dependencies aren't in...

CheckBox in RecyclerView keeps on checking different items

Here's the XML for my items inside the RecyclerView <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/cvItems" and...

Send Outlook Email Via Python?

I am using Outlook 2003. What is the best way to send email (through Outlook 2003) using Python?...

Pandas - How to flatten a hierarchical index in columns

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

Specifying number of decimal places in Python

When accepting user input with a decimal in Python I'm using: #will input meal subtotal def input_meal(): mealPrice = input('Enter the meal subtotal: $') mealPrice = float (mealPrice) return mealPrice which returns exactly ...

Verifying a specific parameter with Moq

public void SubmitMessagesToQueue_OneMessage_SubmitSuccessfully() { var messageServiceClientMock = new Mock<IMessageServiceClient>(); var queueableMessage = CreateSingleQueueableMessage(); var message = queueableMessage[0]; var ...

How to call a mysql stored procedure, with arguments, from command line?

How can I call a stored procedure from command line? I have a procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `insertEvent`(IN `dateTimeIN` DATETIME) NO SQL BEGIN SET @eventIDOut = NULL; IF EXISTS(SELECT * FROM `events` WHERE `...

Centering the image in Bootstrap

I m using bootstrap 3.0 to creating a website. I am new to bootstrap. what i want, i want image in center of div when browser size is extra small i have this code. <div class="col-lg-10 ccol-lg-offset-1 col-md-12 col-sm-12 "> <div class...

Comments in Android Layout xml

I would like to enter some comments into the layout XML files, how would I do that?...

onSaveInstanceState () and onRestoreInstanceState ()

I'm trying to save and restore the state of an Activity using the methods onSaveInstanceState() and onRestoreInstanceState(). The problem is that it never enters the onRestoreInstanceState() method. Can anyone explain to me why this is?...

onclick event function in JavaScript

I have some JavaScript code in an HTML page with a button. I have a function called click() that handles the onClick event of the button. The code for the button is as follows: <input type="button" onClick="click()">button t...

Checking if a string can be converted to float in Python

I've got some Python code that runs through a list of strings and converts them to integers or floating point numbers if possible. Doing this for integers is pretty easy if element.isdigit(): newelement = int(element) Floating point numbers are...

Set value to currency in <input type="number" />

I am trying to format a number input by the user into currency using javascript. This works fine on <input type="text" />. However, on <input type="number" /> I cannot seem to be able to set the value to anything that contains non-numeric...

How to check ASP.NET Version loaded on a system?

How can I check the version of ASP.NET that is installed on my system?...

How to change status bar color in Flutter?

I am trying to change the status bar color to white. I found this pub on flutter. I tried to use the example code on my dart files....

how to find host name from IP with out login to the host

i need to find the host name of a UNIX host whose IP is known with out login to that UNIX host...

Pick images of root folder from sub-folder

Let's say following is the directory structure of my website : Now in index.html I can simply refer images like: <img src="./images/logo.png"> But I want to refer the same image from sub.html. What should be the src?...

laravel-5 passing variable to JavaScript

is there any ways that JavaScript can get the variable from compact controller Laravel-5. Example: I have the code below: $langs = Language::all(); return View::make('NAATIMockTest.Admin.Language.index',compact('langs')); Can I get this lan...

What does cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC1);

What does the cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC1); do in OpenCV? I went through the documentation and was unable to understand what alpha, beta, NORM_MINMAX and CV_8UC1 actually do. I am aware alpha sets the lower and beta the hi...

How do I initialize Kotlin's MutableList to empty MutableList?

Seems so simple, but, how do I initialize Kotlin's MutableList to empty MutableList? I could hack it this way, but I'm sure there is something easier available: var pusta: List<Kolory> = emptyList() var cos: MutableList<Kolory> = pusta....

What rules does software version numbering follow?

I have been developing some software and want to give it version numbers. How do I do this? How is it that some software gets two versions like 1.3v1.1 or some have 3 numbers - 4.0.1 What is the method behind all this? Thanks....

How do I get information about an index and table owner in Oracle?

I want to write a select statement to display the index_name, table_name, table_owner and uniqueness that exist in the data dictionary for the table user indexes. Any help would be great. My problem is I havent been able to find how to display an ind...

Is it possible to forward-declare a function in Python?

Is it possible to forward-declare a function in Python? I want to sort a list using my own cmp function before it is declared. print "\n".join([str(bla) for bla in sorted(mylist, cmp = cmp_configs)]) I've organized my code to put the definition...

Run a php app using tomcat?

Is it possible to run a PHP app using tomcat? Before you tell me to just use httpd, I already have a Java application running on my webserver at host/myapp. Now I want to install RoundCube at host/roundcube. One is PHP and one is Java. I keep seei...

Firebase (FCM) how to get token

It's my first time using FCM. I download a sample from firebase/quickstart-android and I install the FCM Quickstart. But I can't get any token from the log even hit the LOG TOKEN button in the app. Then I try to send a message with Firebase console a...

How is TeamViewer so fast?

Sorry about the length, it's kinda necessary. Introduction I'm developing a remote desktop software (just for fun) in C# 4.0 for Windows Vista/7. I've gotten through basic obstacles: I have a robust UDP messaging system, relatively clean program de...

How to convert / cast long to String?

I just created sample BB app, which can allow to choose the date. DateField curDateFld = new DateField("Choose Date: ", System.currentTimeMillis(), DateField.DATE | DateField.FIELD_LEFT); After choosing the date, I need to convert that long valu...

Difference between Activity Context and Application Context

This has me stumped, I was using this in Android 2.1-r8 SDK: ProgressDialog.show(getApplicationContext(), ....); and also in Toast t = Toast.makeText(getApplicationContext(),....); using getApplicationContext() crashes both ProgressDialog and ...

How to remove a build from itunes connect?

I want to delete one of my app builds from new itunes connect site. But I couldn't find a delete/remove button. Any ideas? ...

Radio buttons and label to display in same line

Why my labels and radio buttons won't stay in the same line, what can I do ? Here is my form: <form name="submit" id="submit" action="#" method="post"> <?php echo form_hidden('what', 'item-'.$identifier);?> <label for="one"&...

Check play state of AVPlayer

Is there a way to know whether an AVPlayer playback has stalled or reached the end?...

how to use python2.7 pip instead of default pip

I just installed python 2.7 and also pip to the 2.7 site package. When I get the version with: pip -V It shows: pip 1.3.1 from /usr/lib/python2.6/site-packages (python 2.6) How do I use the 2.7 version of pip located at: /usr/local/lib/pytho...

Selecting the first "n" items with jQuery

With Jquery, I need to select just the first "n" items from the page, for example the first 20 links instead of selecting all of them with the usual $("a") Sounds simple but the jQuery manual has no evidence of something like this....

Displaying standard DataTables in MVC

Perhaps this is just completely wrong, but back in the days of Webforms you would return a Dataset which you would then bind to a grid. But now in MVC you're not supposed to pass a datatable because you cannot serialize it and it's technically passi...

LD_LIBRARY_PATH vs LIBRARY_PATH

I'm building a simple C++ program and I want to temporarily substitute a system supplied shared library with a more recent version of it, for development and testing. I tried setting the LD_LIBRARY_PATH variable but the linker (ld) failed with: ...

Node.js console.log() not logging anything

Trying out node.js for the first time. Set up node, set up the example app from the nodejs.org site. Can start the server fine, but console.log() isn't actually logging anything. Tried the Javascript console in Chrome, Firefox, and Safari - nothing a...

How to increase space between dotted border dots

I am using dotted style border in my box like .box { width: 300px; height: 200px; border: dotted 1px #f00; float: left; } I want to the increase the space between each dot of the border....

Using a Python subprocess call to invoke a Python script

I have a Python script that needs to invoke another Python script in the same directory. I did this: from subprocess import call call('somescript.py') I get the following error: call('somescript.py') File "/usr/lib/python2.6/subprocess.py", line ...

AngularJs event to call after content is loaded

I have a function which I want to call after page content is loaded. I read about $viewContentLoaded and it doesn't work for me. I am looking for something like document.addEventListener('DOMContentLoaded', function () { //Content goes here ...

XOR operation with two strings in java

How to do bitwise XOR operation to two strings in java....

Faking an RS232 Serial Port

I'm developing a project that has a number of hardware sensors connecting to the deployment machine through RS232 serial ports. But ... I'm developing on a machine without an physical RS232 serial ports, but I would like to make fake serial ports th...

How to display the first few characters of a string in Python?

Hi I just started learning Python but I'm sort of stuck right now. I have hash.txt file containing thousands of malware hashes in MD5, Sha1 and Sha5 respectively separated by delimiters in each line. Below are 2 examples lines I extracted from the ...

How can I list all tags for a Docker image on a remote registry?

How can I list all tags of a Docker image on a remote Docker registry using the CLI (preferred) or curl? Preferably without pulling all versions from the remote registry. I just want to list the tags....

Difference between HttpModule and HttpClientModule

Which one to use to build a mock web service to test the Angular 4 app?...

Difference between \w and \b regular expression meta characters

Can anyone explain the difference between \b and \w regular expression metacharacters? It is my understanding that both these metacharacters are used for word boundaries. Apart from this, which meta character is efficient for multilingual content?...

How do I write a batch script that copies one directory to another, replaces old files?

I'd like a batch script in Windows with which I can copy one directory to another. If this directory already exists, and then for each file that already exists in both with the same name and location, it should be overwritten, if it does not exists, ...

HttpClient 4.0.1 - how to release connection?

I have a loop over a bunch of URLs, for each one I'm doing the following: private String doQuery(String url) { HttpGet httpGet = new HttpGet(url); setDefaultHeaders(httpGet); // static method HttpResponse response = httpClient.execute(httpGet...

Default SecurityProtocol in .NET 4.5

What is the default security protocol for communicating with servers that support up to TLS 1.2? Will .NET by default, choose the highest security protocol supported on the server side or do I have to explicitly add this line of code: System.Net.Ser...

What do .c and .h file extensions mean to C?

It's all in the title; super-simple I reckon, but it's so hard to search for syntactical things anywhere. These are two library files that I'm copying from CS50.net, and I'm wondering why they have two different extensions....

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 do I use two submit buttons, and differentiate between which one was used to submit the form?

Currently, I have an HTML form where the user will enter a title and text for an article. When it is time to submit, they are presented with two buttons. One is to 'save' their article without publishing it, and the other is to 'publish' the article ...

C# if/then directives for debug vs release

In Solution properties, I have Configuration set to "release" for my one and only project. At the beginning of the main routine, I have this code, and it is showing "Mode=Debug". I also have these two lines at the very top: #define DEBUG #defin...

What exactly is "exit" in PowerShell?

You can exit PowerShell by typing exit. So far so good. But what exactly is this? PS Home:\> gcm exit Get-Command : The term 'exit' is not recognized as the name of a cmdlet, function, script file, or operable program. Ch eck the spelling of the ...

Duplicate / Copy records in the same MySQL table

I have been looking for a while now but I can not find an easy solution for my problem. I would like to duplicate a record in a table, but of course, the unique primary key needs to be updated. I have this query: INSERT INTO invoices SELECT * F...

Change MySQL default character set to UTF-8 in my.cnf?

Currently we are using the following commands in PHP to set the character set to UTF-8 in our application. Since this is a bit of overhead, we'd like to set this as the default setting in MySQL. Can we do this in /etc/my.cnf or in another location?...

How to put a Scanner input into an array... for example a couple of numbers

Scanner scan = new Scanner(System.in); double numbers = scan.nextDouble(); double[] avg =..???? ...

Get a resource using getResource()

I need to get a resource image file in a java project. What I'm doing is: URL url = TestGameTable.class.getClass(). getClassLoader().getResource("unibo.lsb.res/dice.jpg"); The directory structure is the following: unibo/ lsb/ res/...

How can I manually set an Angular form field as invalid?

I am working on a login form and if the user enters invalid credentials we want to mark both the email and password fields as invalid and display a message that says the login failed. How do I go about setting these fields to be invalid from an obser...

Submit HTML form on self page

I want an HTML form to submit to itself. How do I use the action attribute? <form action=""> <form action="#"> <form action="some/address"> <form> Which was is preferable?...

I want to calculate the distance between two points in Java

OK, so I've written most of a program that will allow me to determine if two circles overlap. I have no problems whatsoever with my program aside from one issue: the program won't accept the code I've written for the distance between the two center...

JavaScript push to array

How do I push new values to the following array? json = {"cool":"34.33","alsocool":"45454"} I tried json.push("coolness":"34.33");, but it didn't work....

Binding arrow keys in JS/jQuery

How do I go about binding a function to left and right arrow keys in Javascript and/or jQuery? I looked at the js-hotkey plugin for jQuery (wraps the built-in bind function to add an argument to recognize specific keys), but it doesn't seem to suppor...

React Native Change Default iOS Simulator Device

When I run this command: react-native run-ios My app runs by default in the iPhone6 simulator device: Found Xcode project RN.xcodeproj Launching iPhone 6 (9.2)... How can I have the app run in a different simulator device (like iPhone5s) by def...

Disable hover effects on mobile browsers

I'm writing a Web site that's meant to be used from both desktops and tablets. When it's being visited from a desktop, I want the clickable areas of the screen to light up with :hover effects (different background color, etc.) With a tablet, there's ...

How can I find out which server hosts LDAP on my windows domain?

I am trying develop an application (C#) to query an LDAP server. I don't know the actual server named to query - is there a way to find out using standard windows tools or something in .net? I've also heard rumors that having the server name (ldap:...

Responsive dropdown navbar with angular-ui bootstrap (done in the correct angular kind of way)

I've created a JSFiddle with a dropdown navbar using angular-ui-boostrap's module "ui.bootstrap.dropdownToggle": http://jsfiddle.net/mhu23/2pmz5/ <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="contain...

PHP get dropdown value and text

<select id="animal" name="animal"> <option value="0">--Select Animal--</option> <option value="1">Cat</option> <option value="2">Dog</option> <option value="3">Cow</option> &...

Foreign key referencing a 2 columns primary key in SQL Server

This question is pretty much similar to this one, but for SQL Server 2005 : I have 2 tables in my database: --'#' denotes the primary key [Libraries] #ID #Application Name 1 MyApp Title 1 2 MyApp Title 2 [Content] #ID ...

How to get back to most recent version in Git?

I have recently moved from SVN to Git and am a bit confused about something. I needed to run the previous version of a script through a debugger, so I did git checkout <previous version hash> and did what I needed to do. Now I want to get back...

How to get controls in WPF to fill available space?

Some WPF controls (like the Button) seem to happily consume all the available space in its' container if you don't specify the height it is to have. And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more w...

How to set up tmux so that it starts up with specified windows opened?

How to set up tmux so that it starts up with specified windows opened?...

php how to go one level up on dirname(__FILE__)

I have a folder structure as follows: mydomain.com ->Folder-A ->Folder-B I have a string from Database that is '../Folder-B/image1.jpg', which points to an image in Folder-B. Inside a script in Folder-A, I am using dirname(FILE) to fet...

How to build splash screen in windows forms application?

I need to show splash screen on my application start for few seconds. Does anybody know how to implement this? Will be much appreciate for the help....

How to make borders collapse (on a div)?

Suppose I have markup like: http://jsfiddle.net/R8eCr/1/ <div class="container"> <div class="column"> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div&...

Using onBlur with JSX and React

I am trying to create a password confirmation feature that renders an error only after a user leaves the confirmation field. I'm working with Facebook's React JS. This is my input component: <input type="password" placeholder="Password (c...

(Deep) copying an array using jQuery

Possible Duplicate: What is the most efficient way to clone a JavaScript object? I need to copy an (ordered, not associative) array of objects. I'm using jQuery. I initially tried jquery.extend({}, myArray) but, naturally, this gives m...

How to initialize List<String> object in Java?

I can not initialize a List as in the following code: List<String> supplierNames = new List<String>(); supplierNames.add("sup1"); supplierNames.add("sup2"); supplierNames.add("sup3"); System.out.println(supplierNames.get(1)); I face th...

Intent.putExtra List

Possible Duplicate: How to put a List in intent I want to pass a List from one activity to another. So far I have not been successful. This is my code. //desserts.java private List<Item> data; @Override public void onCreate(...

Communication between tabs or windows

I was searching for a way how to communicate between multiple tabs or windows in a browser (on the same domain, not CORS) without leaving traces. There were several solutions: using window object postMessage cookies localStorage The first is prob...

Batch File; List files in directory, only filenames?

This is probably a very simple question, but I'm having trouble with it. Basically, I am trying to write a Batch File and I need it to list all the files in a certain directory. The dir command will do this, but it also gives a bunch of other informa...

How to write asynchronous functions for Node.js

I've tried to research on how exactly asynchronous functions should be written. After a lot of plowing through a lot of documentation, it's still unclear to me. How do I write asynchronous functions for Node? How should I implement error event handl...

AttributeError: Module Pip has no attribute 'main'

I am trying to build the python api for an open source project called Zulip and I keep running into the same issue as indicated by the screenshot below. I am running python3 and my pip version is 10.0.0. The file in question is setup.py and the code...

Find element's index in pandas Series

I know this is a very basic question but for some reason I can't find an answer. How can I get the index of certain element of a Series in python pandas? (first occurrence would suffice) I.e., I'd like something like: import pandas as pd myseries =...

Push git commits & tags simultaneously

I'm aware of the reason that git push --tags is a separate operation to plain old git push. Pushing tags should be a conscious choice since you don't want accidentally push one. That's fine. But is there a way to push both together? (Aside from git p...

MYSQL query between two timestamps

I have the following entry in my DB table eventName(varchar 100) -> myEvent date(timestamp) -> 2013-03-26 09:00:00 and I am trying to use the following query; SELECT * FROM eventList WHERE `date` BETWEEN UNIX_TIMESTAMP(1364256001) AND UNI...

Bootstrap: How do I identify the Bootstrap version?

I want to update Bootstrap on a site, but I don't know the installed version. How can I identify the bootstrap version, with only bootstrap.css and bootstrap.min.js files? There is no version in the CSS file and the min.js file contains the followi...

Plot multiple lines (data series) each with unique color in R

I am fairly new to R and I have the following queries : I am trying to generate a plot in R which has multiple lines (data series). Each of these lines is a category and I want it to have a unique color. Currently my code is setup in this way : F...

What causes: "Notice: Uninitialized string offset" to appear?

I have a form that users fill out, and on the form there are multiple identical fields, like "project name", "project date", "catagory", etc. Based on how many forms a user is submitting, my goal is to: loop over the number of forms create individu...

How to prevent a double-click using jQuery?

I have a button as such: <input type="submit" id="submit" value="Save" /> Within jQuery I am using the following, but it still allows for double-clicks: <script type="text/javascript"> $(document).ready(function () { $("#submit"...

Unit testing click event in Angular

I'm trying to add unit tests to my Angular 2 app. In one of my components, there is a button with a (click) handler. When the user clicks the button a function is called which is defined in the .ts class file. That function prints a message in the co...

Python timedelta in years

I need to check if some number of years have been since some date. Currently I've got timedelta from datetime module and I don't know how to convert it to years....

How to read PDF files using Java?

I want to read some text data from a PDF file using Java. How can I do that?...

Execute action when back bar button of UINavigationController is pressed

I need to execute an action (emptying an array), when the back button of a UINavigationController is pressed, while the button still causes the previous ViewController on the stack to appear. How could I accomplish this using swift? ...

How to create localhost database using mysql?

I download mysql installer here: http://dev.mysql.com/downloads/installer/ And then I downloaded MySql WorkBench. At workbench's connection configuration I put hostname as "127.0.0.1", port "3306", user: "root", password is empty. I click "test co...

Spring profiles and testing

I've got a web application where I have the typical problem that it requires different configuration files for different environments. Some configuration is placed in the application server as JNDI datasources, however some configuration stays in pro...

ssh: check if a tunnel is alive

I have written a small bash script which needs an ssh tunnel to draw data from a remote server, so it prompts the user: echo "Please open an ssh tunnel using 'ssh -L 6000:localhost:5432 example.com'" I would like to check whether the user had open...

Aliases in Windows command prompt

I have added notepad++.exe to my Path in Environment variables. Now in command prompt, notepad++.exe filename.txt opens the filename.txt. But I want to do just np filename.txt to open the file. I tried using DOSKEY np=notepad++. But it is just br...

Make virtualenv inherit specific packages from your global site-packages

I'm looking for a way to make a virtualenv which will contain just some libraries (which i chose) of the base python installation. To be more concrete, I'm trying to import my matplotlib to virtualenv during the creation of virtualenv. It can't be i...

Seedable JavaScript random number generator

The JavaScript Math.random() function returns a random value between 0 and 1, automatically seeded based on the current time (similar to Java I believe). However, I don't think there's any way to set you own seed for it. How can I make a random num...

CSS text-transform capitalize on all caps

Here is my HTML: <a href="#" class="link">small caps</a> & <a href="#" class="link">ALL CAPS</a> Here is my CSS: .link {text-transform: capitalize;} The output is: Small Caps & ALL CAPS and I want the output ...

Selecting empty text input using jQuery

How do I identify empty textboxes using jQuery? I would like to do it using selectors if it is at all possible. Also, I must select on id since in the real code where I want to use this I don't want to select all text inputs. In my following two cod...

How to automatically generate unique id in SQL like UID12345678?

I want to automatically generate unique id with per-defined code attach to it. ex: UID12345678 CUSID5000 I tried uniqueidentifier data type but it generate a id which is not suitable for a user id. Any one have suggestions?...

SqlDataAdapter vs SqlDataReader

What are the differences between using SqlDataAdapter vs SqlDataReader for getting data from a DB? I am specifically looking into their Pros and Cons as well as their speed and memory performances. Thanks...

Reverse Contents in Array

I have an array of numbers that I am trying to reverse. I believe the function in my code is correct, but I cannot get the proper output. The output reads: 10 9 8 7 6. Why can't I get the other half of the numbers? When I remove the "/2" from count,...

Sequelize.js delete query?

Is there a way to write a delete/deleteAll query like findAll? For example I want to do something like this (assuming MyModel is a Sequelize model...): MyModel.deleteAll({ where: ['some_field != ?', something] }) .on('success', function() { /* ...

Java: How to check if object is null?

I am creating an application which retrieves images from the web. In case the image cannot be retrieved another local image should be used. While trying to execute the following lines: Drawable drawable = Common.getDrawableFromUrl(this, product.get...

Visibility of global variables in imported modules

I've run into a bit of a wall importing modules in a Python script. I'll do my best to describe the error, why I run into it, and why I'm tying this particular approach to solve my problem (which I will describe in a second): Let's suppose I have a ...

How do I collapse a table row in Bootstrap?

I am using Bootstrap 2.3.2 in my app and I need to completely hide a row using the collapse plugin. Below is an example: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Collaps...

How to show "Done" button on iPhone number pad

There is no "Done" button on the number pad. When a user finishes entering numeric information in a text field, how can I make the number pad disappear? I could get a "Done" button by using the default keyboard, but then users would have to switch t...

Search text in fields in every table of a MySQL database

I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as: SELECT * FROM * WHERE * LIKE '%stuff%' Is it possible to do something like this? ...

What's the best way to store a group of constants that my program uses?

I have various constants that my program uses... string's, int's,double's, etc... What is the best way to store them? I don't think I want an Enum, because the data is not all the same type, and I want to manually set each value. Should I just store ...

bootstrap multiselect get selected values

How do I get back on onChange all selected values in my multiselect dropdown. Used plugin here. Trying to use the following but I think I'm on the wrong track $('#multiselect1').multiselect({ selectAllValue: 'multiselect-all', enable...

How to initialize/instantiate a custom UIView class with a XIB file in Swift

I have a class called MyClass which is a subclass of UIView, that I want to initialize with a XIB file. I am not sure how to initialize this class with the xib file called View.xib class MyClass: UIView { // what should I do here? //init(...

What does git rev-parse do?

What does git rev-parse do? I have read the man page but it raised more questions than answers. Things like: Pick out and massage parameters Massage? What does that mean? I'm using as a resolver (to SHA1) of revision specifiers, like git rev...

How to properly create an SVN tag from trunk?

I am creating my first project in Subversion. So far I have branches tags trunk I think I immediately need to make branches singular and start over. Update branches is the norm. I have been doing work in trunk and moving the contents to tags ...

Differences between socket.io and websockets

What are the differences between socket.io and websockets in node.js? Are they both server push technologies? The only differences I felt was, socket.io allowed me to send/emit messages by specifying an event name. In the case of socket.io a me...

Bootstrap date time picker

I am trying to implement the date time picker as explained here https://eonasdan.github.io/bootstrap-datetimepicker/#minimum-setup, I have downloaded the js file css file to the directory js and css. But the calendar is not popup up when click on ic...

CSV in Python adding an extra carriage return, on Windows

import csv outfile = file('test.csv', 'w') writer = csv.writer(outfile, delimiter=',', quoting=csv.QUOTE_MINIMAL) writer.writerow(['hi','dude']) writer.writerow(['hi2','dude2']) outfile.close() It generates a file, test.csv, with an extra \r at eac...

preg_match(); - Unknown modifier '+'

Alright, so I'm currently working on parsing an RSS feed. I've gotten the data I need no problem, and all I have left is parsing the game title. Here is the code I currently have (ignore the sloppiness, it is just a proof of concept): <?php $url...

How to terminate the script in JavaScript?

How can I exit the JavaScript script much like PHP's exit or die? I know it's not the best programming practice but I need to....

How to get position of a certain element in strings vector, to use it as an index in ints vector?

I am trying to get the index of an element in a vector of strings, to use it as an index in another vector of int type, is this possible ? Example: vector <string> Names; vector <int> Numbers; ... // condition to check whether the n...

java.lang.ClassNotFoundException: HttpServletRequest

I just got tomcat 7.0.27. I have kept the time to start tomcat 45sec. Also it was running fine with older version on tomcat. but running it I get the following error : SEVERE: A child container failed during start java.util.concurrent.ExecutionExce...

How to control the width and height of the default Alert Dialog in Android?

AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Title"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { ...

How can I pass parameters to a partial view in mvc 4

I have a link like this: <a href='Member/MemberHome/Profile/Id'><span>Profile</span></a> and when I click on this it will call this partial page: @{ switch ((string)ViewBag.Details) { case "Profile": ...

T-SQL Substring - Last 3 Characters

Using T-SQL, how would I go about getting the last 3 characters of a varchar column? So the column text is IDS_ENUM_Change_262147_190 and I need 190...

Problems using Maven and SSL behind proxy

I just downloaded Maven and was trying to run the simple command found on the "Maven in Five Minutes" page (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). This is the command: mvn archetype:generate -DgroupId=com.mycompa...

Having trouble setting working directory

I created a folder in order for it to be the main work directory meaning all the files I create go there, and files I read will be from there. For some reason after I created the folder and I'm trying to set it as the working directory I get this mes...

How do I use grep to search the current directory for all files having the a string "hello" yet display only .h and .cc files?

How do I use grep to search the current directory for any and all files containing the string "hello" and display only .h and .cc files?...

how to convert date to a format `mm/dd/yyyy`

I'm having a sql table with date column named CREATED_TS which holds the dates in different format eg. as shown below Feb 20 2012 12:00AM 11/29/12 8:20:53 PM Feb 20 2012 12:00AM 11/29/12 8:20:53 PM Feb 20 2012 12:00AM 11/29/12 ...

JavaScript null check

I've come across the following code: function test(data) { if (data != null && data !== undefined) { // some code here } } I'm somewhat new to JavaScript, but, from other questions I've been reading here, I'm under the impr...

Import data into Google Colaboratory

What are the common ways to import private data into Google Colaboratory notebooks? Is it possible to import a non-public Google sheet? You can't read from system files. The introductory docs link to a guide on using BigQuery, but that seems a bit......

find if an integer exists in a list of integers

i have this code: List<T> apps = getApps(); List<int> ids; List<SelectListItem> dropdown = apps.ConvertAll(c => new SelectListItem { Selected = ids.Contains(c.Id), Text = c.Nam...

How to find a value in an array and remove it by using PHP array functions?

How to find if a value exists in an array and then remove it? After removing I need the sequential index order. Are there any PHP built-in array functions for doing this? ...