Questions Tagged with #Wix

The WiX Toolset (formerly known as Windows Installer XML) is a toolset that builds Windows installation packages and WiX bootstrappers from XML source code. The toolset supports a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages and EXE bootstrappers. For cloud-based web development platform use [] tag.

How to add a WiX custom action that happens only on uninstall (via MSI)?

I would like to modify an MSI installer (created through WiX) to delete an entire directory on uninstall. I understand the RemoveFile and RemoveFolder options in WiX, but these are not robust enough ..

"Automatic" vs "Automatic (Delayed start)"

When installing Windows services there are two options for automatically starting a Windows service on Windows startup. One is Automatic, and the other is Automatic (Delayed start). What is the differ..

Extract MSI from EXE

I want to extract the MSI of an EXE setup to publish over a network. For example, using Universal Extractor, but it doesn't work for Java Runtime Environment...

WiX tricks and tips

We've been using WiX for a while now, and despite the usual gripes about ease of use, it's going reasonably well. What I'm looking for is useful advice regarding: Setting up a WiX project (layout, r..

How to find the UpgradeCode and ProductCode of an installed application in Windows 7

I have an application installed on my machine. I also have its source code but somehow the ProductCode and UpgradeCode of this application were changed. Now I want to get the UpgradeCode and ProductC..

xml.LoadData - Data at the root level is invalid. Line 1, position 1

I'm trying to parse some XML inside a WiX installer. The XML would be an object of all my errors returned from a web server. I'm getting the error in the question title with this code: XmlDocument ..

Silent installation of a MSI package

I have a MSI package that I need to install if the package is not already installed. Also I need to install it silently. The package prompts user for: Installation location (C:\Program Files\Foobar)..

How to implement WiX installer upgrade?

At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine. I've read on several p..

How to uninstall with msiexec using product id guid without .msi file present

I'm trying to automate the uninstallation of packages created using WiX for the purposes of changing the installed software stack & configuration without reprovisioning a whole OS. Eventually I'll..

How can I find the product GUID of an installed MSI setup?

I need to find the product GUID for an installed MSI file in order to perform maintenance such as patching, uninstall (how-to uninstall) and also for auditing purposes...

Reactjs convert html string to jsx

I'm having trouble dealing with facebook's ReactJS. Whenever I do ajax and want to display an html data, ReactJS displays it as text. (See figure below) The data is displayed through the success ca..

Detecting endianness programmatically in a C++ program

Is there a programmatic way to detect whether or not you are on a big-endian or little-endian architecture? I need to be able to write code that will execute on an Intel or PPC system and use exactly..

How to loop through all the properties of a class?

I have a class. Public Class Foo Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) _..

How to print a list of symbols exported from a dynamic library

So I've been trying to get dynamic libraries to work in my XCode project under Mac OS X. So far no joy. I am able to load the dylib file, but when I call dlsym to get the function pointer, it returns..

Is it possible to capture the stdout from the sh DSL command in the pipeline

For example: var output=sh "echo foo"; echo "output=$output"; I will get: output=0 So, apparently I get the exit code rather than the stdout. Is it possible to capture the stdout into a pipeline..

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project...

What are projection and selection?

What is the difference between projection and selection? Is it: Projection --> for selecting the columns of table; and Selection ---> to select the rows of table? So are projection and selection v..

How do I get the day of week given a date?

I want to find out the following: given a date (datetime object), what is the corresponding day of the week? For instance, Sunday is the first day, Monday: second day.. and so on And then if the inp..

How to test an Oracle Stored Procedure with RefCursor return type?

I'm looking for a good explanation on how to test an Oracle stored procedure in SQL Developer or Embarcardero Rapid XE2. Thank you...

jQuery has deprecated synchronous XMLHTTPRequest

Like many others, my website is using jQuery. When I open the developer tools, I see a warning that says that XMLHTTPRequest is deprecated because of its detrimental effects to the end user's exp..

How does a hash table work?

I'm looking for an explanation of how a hash table works - in plain English for a simpleton like me! For example, I know it takes the key, calculates the hash (I am looking for an explanation how) a..

Maven: How do I activate a profile from command line?

This is a snippet from my pom.xml. I tried the following, but the profile was not activated. mvn clean install -Pdev1 mvn clean install -P dev1 When I tried mvn help:active-profiles no profiles wer..

What is the difference between docker-compose ports vs expose

What is the difference between ports and expose options in docker-compose.yml..

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


I have a very complex CTE and I would like to insert the result into a physical table. Is the following valid? INSERT INTO dbo.prf_BatchItemAdditionalAPartyNos ( BatchID, AccountNo, AP..

WhatsApp API (java/python)

I am looking for WhatsApp API, preferably a Python or Java library. I've tried Yowsup, but could not get my number registered; I am based in India and I am not sure if that has got anything to do wit..

Increasing the maximum number of TCP/IP connections in Linux

I am programming a server and it seems like my number of connections is being limited since my bandwidth isn't being saturated even when I've set the number of connections to "unlimited". How can I i..

how to fix EXE4J_JAVA_HOME, No JVM could be found on your system error?

I installed java 64bit 1.7 and exe4j 64bit version. I tried to generate an exe from exe4j, but while running the program I'm having this error. This is how I set up path variable. And this is right j..

What exactly is LLVM?

I keep hearing about LLVM all the time. It's in Perl, then it's in Haskell, then someone uses it in some other language? What is it? What exactly distinguishes it from GCC (perspectives = safety etc...

Regex empty string or email

I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or email only? I want to hav..

Error: Jump to case label

I wrote a program which involves use of switch statements... However on compilation it shows: Error: Jump to case label. Why does it do that? #include <iostream> #include <cstdlib> ..

HTTP 404 Page Not Found in Web Api hosted in IIS 7.5

I have a Web Api application. It works perfectly well when I tested it using the VS 2010 debugging dev server. But I now deployed it to IIS 7.5 and I am getting a HTTP 404 error when trying to access ..

jQuery Ajax calls and the Html.AntiForgeryToken()

I have implemented in my app the mitigation to CSRF attacks following the informations that I have read on some blog post around the internet. In particular these post have been the driver of my imple..

jQuery checkbox check/uncheck

What would be a proper way to check/uncheck checkbox that's placed inside the element that triggers my function? Here's my code: <table id="news_list"> <tr> <td><input type=..

Alphanumeric, dash and underscore but no spaces regular expression check JavaScript

Trying to check input against a regular expression. The field should only allow alphanumeric characters, dashes and underscores and should NOT allow spaces. However, the code below allows spaces. W..

Lambda function in list comprehensions

Why is the output of the following two list comprehensions different, even though f and the lambda function are the same? f = lambda x: x*x [f(x) for x in range(10)] and [lambda x: x*x for x in ra..

Where is svcutil.exe in Windows 7?

For my WCF, I need to generate configuration file for my client application to specify things such as binding of service, the address of the service and the contract...

Create a temporary table in MySQL with an index from a select

I have a stored function where I use temporary tables. For performance reasons, I need an index in that table. Unfortunately, I cannot use ALTER TABLE because this causes an implicit commit. Therefor..

.NET / C# - Convert char[] to string

What is the proper way to turn a char[] into a string? The ToString() method from an array of characters doesn't do the trick...

Conversion failed when converting from a character string to uniqueidentifier

Created a stored procedure in SQL 9 (2005) and have since upgraded to SQL 10 (2008). Since then, the following stored procedure has stopped working and thrown up the above error: ALTER PROCEDURE [dbo..

Cocoa Touch: How To Change UIView's Border Color And Thickness?

I saw in the inspector that I can change the background color, but I'd like to also change the border color and thickness, is this possible?..

Correct way of using log4net (logger naming)

There are two ways of configuring and using log4net. First one is when I can configure my own appender and associated logger: <!-- language: xml --> <appender name="myLogAppender" type="log..

Importing images from a directory (Python) to list or dictionary

I am trying to import all the images inside a directory (the directory location is known). path = /home/user/mydirectory I already know a way of finding out the length of the directory. What I'm not ..

How do I get my Python program to sleep for 50 milliseconds?

How do I get my Python program to sleep for 50 milliseconds?..

PostgreSQL ERROR: canceling statement due to conflict with recovery

I'm getting the following error when running a query on a PostgreSQL db in standby mode. The query that causes the error works fine for 1 month but when you query for more than 1 month an error result..

Changing upload_max_filesize on PHP

I'm using PHP 5.3.0 and have encountered something that might be a bug (in which case I'll report it) or might be me - so I'm asking to make sure. When running this code: <?php ini_set('upload_ma..

The specified DSN contains an architecture mismatch between the Driver and Application. JAVA

I'm trying to connect to a database made by MS Access using Java, but I cannot seem to manage. I am using ODBC and I'm getting this exception: java.sql.SQLException: [Microsoft][ODBC Driver Manager] ..

What is the default lifetime of a session?

If I hit a page which calls session_start(), how long would I have to wait before I get a new session ID when I refresh the page?..

Reading in from - Java

I am not sure how you are supposed to read in from system input from a Java file. I want to be able to call java myProg < file Where file is what I want to be read in as a string and given to myP..

C++ display stack trace on exception

I want to have a way to report the stack trace to the user if an exception is thrown. What is the best way to do this? Does it take huge amounts of extra code? To answer questions: I'd like it to be..

How to call a javaScript Function in jsp on page load without using <body onload="disableView()">

How can a JavaScript function in JSP be called during page load without using <body onload="disableView()"> I have to call this function in a few JSP's on page load but JSP's are divided into..

How do I make a <div> move up and down when I'm scrolling the page?

How can I make a div element move up and down the page when the user is scrolling the page? (where that element is always visible)..

JBoss vs Tomcat again

This will appear to be the age old question (which it is :)) that which server is better between Tomcat and JBoss, but I have not found a good enough answer yet to solve my problem. I know that Tomca..

pod install -bash: pod: command not found

I installed pod some time ago. However, it's stopped working so I'm working through this again. However, I almost immediately run into a problem here: pod install -bash: pod: command not found Any..

Delete all the queues from RabbitMQ?

I installed rabbitmqadmin and was able to list all the exchanges and queues. How can I use rabbitmqadmin or rabbitmqctl to delete all the queues...

How to resolve this JNI error when trying to run LWJGL "Hello World"?

I'm trying to run the sample "Hello World" from the LWJGL website From this link: LWJGL "Getting Started" I'm trying to do this via the command line, just so I understand the "behind the scenes" a b..

Error: "The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods

I've encounter an strange issue after installing RestKit with cocoapods. after resolving RestKit dependency for my project with cocoapods and trying to build it, I face this error: The sandbox is..

Installing PHP Zip Extension

I'm attempting to install the PHP Zip extension. My server does not have external internet access, so I downloaded it myself from PECL: I chose 1.10.2, the latest ..

intellij incorrectly saying no beans of type found for autowired repository

I have created a simple unit test but IntelliJ is incorrectly highlighting it red. marking it as an error No beans? As you can see below it passes the test? So it must be Autowired? ..

ListBox vs. ListView - how to choose for data binding

I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to ..

How to reset (clear) form through JavaScript?

I have tried $("#client.frm").reset(); but it is not working.So how to reset form via jQuery?..

Check if a key is down?

Is there a way to detect if a key is currently down in JavaScript? I know about the "keydown" event, but that's not what I need. Some time AFTER the key is pressed, I want to be able to detect if it ..

Find if a textbox is disabled or not using jquery

I need to find if a textbox is disabled or enabled using Jquery...

sqlite3.OperationalError: unable to open database file

I get this error when setting up a server in Django. It is sqlite3 which means it should create the .db file but it doesn't seem to be doing so. I've stipulated SQLite as the backend and an absolute f..

Deep copy, shallow copy, clone

I need clarification on the differences between deep copy, shallow copy, and clone in Java..

How can I repeat a character in Bash?

How could I do this with echo? perl -E 'say "=" x 100' ..

HintPath vs ReferencePath in Visual Studio

What exactly is the difference between the HintPath in a .csproj file and the ReferencePath in a .csproj.user file? We're trying to commit to a convention where dependency DLLs are in a "releases" svn..

How do I handle too long index names in a Ruby on Rails ActiveRecord migration?

I am trying to add an unique index that gets created from the foreign keys of four associated tables: add_index :studies, ["user_id", "university_id", "subject_name_id", "subject_type_id"], :uniq..

PHPMailer AddAddress()

I don't know how the data should be formatted for AddAddress PHPMailer function; I need the email to be sent to multiple recipients so I tried $to = "[email protected],[email protected],[email protected]"; $ob..

how to implement a long click listener on a listview

I want to add OnLongClickListener on my list view. Whenever the user long press the item in list some action should be performed, But my code does not catch this listener. Please let me know where I a..

How to get .pem file from .key and .crt files?

How can I create a PEM file from an SSL certificate? These are the files that I have available: .crt server.csr server.key ..

How to analyze disk usage of a Docker container

I can see that Docker takes 12GB of my filesystem: 2.7G /var/lib/docker/vfs/dir 2.7G /var/lib/docker/vfs 2.8G /var/lib/docker/devicemapper/mnt 6.3G /var/lib/docker/devicemapper/devicemapp..

What is the equivalent to getch() & getche() in Linux?

I am not able to find the equivalent header file for conio.h in Linux. Is there any option for getch() & getche() function in Linux? I want to make a switch case base menu where the user will gi..

Git add and commit in one command

Is there any way I can do git add -A git commit -m "commit message" in one command? I seem to be doing those two commands a lot, and if Git had an option like git commit -Am "commit message", it ..

How to Clear Console in Java?

I have been pulling my hair for this since quite long time. I have researched for an hour on how to clear a console in Java. All I found was dirty hacking either by printing a bunch of lines or execu..

Algorithm to return all combinations of k elements from n

I want to write a function that takes an array of letters as an argument and a number of those letters to select. Say you provide an array of 8 letters and want to select 3 letters from that. Then y..

Any good boolean expression simplifiers out there?

I was refactoring old code and encountered several IF conditions that were way too complex and long and I'm certain they can be simplified. My guess is that those conditions grew so much because of la..

Impact of Xcode build options "Enable bitcode" Yes/No

Yesterday I recognized a ton of warnings regarding the library: URGENT: all bitcode will be dropped because '[path]/Parse.framework/Parse(PFAnalytics.o)' was built without bitcode. You ..

Measure string size in Bytes in php

I am doing a real estate feed for a portal and it is telling me the max length of a string should be 20,000 bytes (20kb), but I have never run across this before. How can I measure byte size of a var..

Javascript "Cannot read property 'length' of undefined" when checking a variable's length

I'm building a node scraper that uses cheerio to parse the DOM. This is more or a vanilla javascript question though. At one part of my scrape, I'm loading some content into a variable, then checking ..

how to pass value from one php page to another using session

I can pass values form one page to another but I need to pass value like this, Page 1: Page4.php Page3.php I need to pass the value in a text field in the Page1.php to a text field in Page2.php..

How to replace (or strip) an extension from a filename in Python?

Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one)? Example: print replace_extension('/home/user/somefile.txt', '.jpg') In my ..

Why does rand() yield the same sequence of numbers on every run?

Every time I run a program with rand() it gives me the same results. Example: #include <iostream> #include <cstdlib> using namespace std; int random (int low, int high) { if (low &..

Windows Scheduled task succeeds but returns result 0x1

I have a scheduled task on a Windows 2008 R2 server. The task includes a Start In directory entry. The task runs, and the batch file it runs does what it is supposed to do. When I run the batch fil..

How to check if two arrays are equal with JavaScript?

var a = [1, 2, 3]; var b = [3, 2, 1]; var c = new Array(1, 2, 3); alert(a == b + "|" + b == c); demo How can I check these array for equality and get a method which returns true if they are equal?..

vim - How to delete a large block of text without counting the lines?

In vim, I often find myself deleting (or copying) large blocks of text. One can count the lines of text and say (for example) 50dd to delete 50 lines. But how would one delete this large block of te..

How do I get the computer name in .NET

How do I get the computer name in .NET c#..

How to detect query which holds the lock in Postgres?

I want to track mutual locks in postgres constantly. I came across Locks Monitoring article and tried to run the following query: SELECT AS blocked_pid, a.usename AS blocked_user, ..

Which method performs better: .Any() vs .Count() > 0?

in the System.Linq namespace, we can now extend our IEnumerable's to have the Any() and Count() extension methods. I was told recently that if i want to check that a collection contains 1 or more ite..

jquery append div inside div with id and manipulate

after 2 hours of searching I decided to ask my question. I have a div: <div id="box"></div> I want to add a div inside the above div using jquery. I tried (following code is inside a ..

What's the difference between select_related and prefetch_related in Django ORM?

In Django doc, select_related() "follows" foreign-key relationships, selecting additional related-object data when it executes its query. prefetch_related() does a separate lookup for each ..

No 'Access-Control-Allow-Origin' header is present on the requested resource - Resteasy

I am working on a webapplication comprises UI-Angular , Server-Java , RestEasy 3.0.9.Final for rest api calls When i tried to access the rest service from another domain am getting below error CANNO..

Out-File -append in Powershell does not produce a new line and breaks string into characters

I'm trying to understand some weird behaviour with this cmdlet. If I use "Out-File -append Filename.txt" on a text file that I created and entered text into via the windows context menu, the string w..

Visual Studio Code - is there a Compare feature like that plugin for Notepad ++?

Is there a Compare feature like the Plugin for Notepad++?..

How to create strings containing double quotes in Excel formulas?

How can I construct the following string in an Excel formula: Maurice "The Rocket" Richard If I'm using single quotes, it's trivial = "Maurice 'The Rocket' Richard" but what about double quotes?..

Even though JRE 8 is installed on my MAC -" No Java Runtime present,requesting to install " gets displayed in terminal

Even though JRE 8 is installed on my MAC OS Yosemite 10.10.3,while running the Android present in tools in sdk - the error - " No Java Runtime present,requesting to install " gets displayed in term..

SCCM 2012 application install "Failed" in client Software Center

We're using SCCM 2012 and I'm packaging all of our application and testing them as I go. Some only have .exe's and are more difficult than the .msi's. Some have no documentation and I'm trying diffe..

Send Message in C#

I'm creating an application that uses a main project that is connected to several different DLLs. From one DLL window I need to be able to open a window in another but the DLL's can't reference each o..

Append Char To String in C?

How do I append a single char to a string in C? i.e char* str = "blablabla"; char c = 'H'; str_append(str,c); /* blablablaH */ ..

Google Chrome Full Black Screen

I'm facing a weird problem. If a webpage includes jquery graphs or libraries the page loads with a full black screen. I can see the source code and the mouse pointer finds the buttons or links. I uni..

Private vs Protected - Visibility Good-Practice Concern

I've been searching and I know the theoretic difference. public - Any class/function may access the method/property. protected - Only this class and any subclasses may access the method/property. pr..

What is the cleanest way to get the progress of JQuery ajax request?

In plain javascript is very simple: need just to attach the callback to {XMLHTTPRequest}.onprogress var xhr = new XMLHttpRequest(); xhr.onprogress = function(e){ if (e.lengthComputable) ..

How do you share constants in NodeJS modules?

Currently I'm doing this: foo.js const FOO = 5; module.exports = { FOO: FOO }; And using it in bar.js: var foo = require('foo'); foo.FOO; // 5 Is there a better way to do this? It feels aw..

What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany association

What is the difference between: @Entity public class Company { @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY) @JoinColumn(name = "companyIdRef", referencedColumnName = "compa..

Asynchronous shell exec in PHP

I've got a PHP script that needs to invoke a shell script but doesn't care at all about the output. The shell script makes a number of SOAP calls and is slow to complete, so I don't want to slow down ..

show icon in actionbar/toolbar with AppCompat-v7 21

I tried these - but still do not see the icon like before: getSupportActionBar().setLogo(R.drawable.ic_launcher); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setIcon(R..

How to form tuple column from two columns in Pandas

I've got a Pandas DataFrame and I want to combine the 'lat' and 'long' columns to form a tuple. <class 'pandas.core.frame.DataFrame'> Int64Index: 205482 entries, 0 to 209018 Data columns: Month..

How to get an input text value in JavaScript

How go get an input text value in JavaScript? <script language="javascript" type="text/javascript"> lol = document.getElementById('lolz').value; function kk(){ alert(lol); } <..

Why do we need the "finally" clause in Python?

I am not sure why we need finally in try...except...finally statements. In my opinion, this code block try: run_code1() except TypeError: run_code2() other_code() is the same with this one ..

Find the nth occurrence of substring in a string

This seems like it should be pretty trivial, but I am new at Python and want to do it the most Pythonic way. I want to find the index corresponding to the n'th occurrence of a substring within a stri..

Email Address Validation in Android on EditText

How can we perform Email Validation on edittext in android ? I have gone through google & SO but I didn't find out a simple way to validate it...

Turn a single number into single digits Python

I want to make a number , for example 43365644 into single numbers [4,3,3....,4,4] and append it on a list..

How can I see the current value of my $PATH variable on OS X?

$ $PATH returns: -bash: /usr/local/share/npm/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/sbin:~/bin:/Library/Frameworks/Python.framework/Versions/Curre..

What's the difference between "Layers" and "Tiers"?

What's the difference between "Layers" and "Tiers"?..

Best way to define private methods for a class in Objective-C

I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods. I understand there may be several conventions and ha..

Get list of databases from SQL Server

How can I get the list of available databases on a SQL Server instance? I'm planning to make a list of them in a combo box in VB.NET...

Can't load AMD 64-bit .dll on a IA 32-bit platform

I download the Gurobi package for linear programming. I import the corresponding gurobi.jar package. Then run the example program. Then it appears the following errors: Exception in thread "main" ..

How can I perform a reverse string search in Excel without using VBA?

I have an Excel spreadsheet containing a list of strings. Each string is made up of several words, but the number of words in each string is different. Using built in Excel functions (no VBA), is the..

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

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

Android Imagebutton change Image OnClick

I just added a new drawable folder under res folder. In the drawable folder, i copied the ic_launcher.png file from drawable-hdpi folder. I wanna change the standard ImageButton image through the new ..

NPM global install "cannot find module"

I wrote a module which I published to npm a moment ago ( So it installs fine from the command line: $ npm i -g wisp However, when I run it from the command line, I ke..

Resolve promises one after another (i.e. in sequence)?

Consider the following code that reads an array of files in a serial/sequential manner. readFiles returns a promise, which is resolved only once all files have been read in sequence. var readFile = fu..

How to convert a list into data table

I have a data list with some property. I want to convert that list data into data table. How to convert a list into datable. ..

javax.servlet.ServletException cannot be resolved to a type in spring web app

I am developing web app using spring frame work, but i am getting following error in some of the jsp pages. javax.servlet.ServletException cannot be resolved to a type I have included servlet-api a..

Create a Path from String in Java7

How can I create a java.nio.file.Path object from a String object in Java 7? I.e. String textPath = "c:/dir1/dir2/dir3"; Path path = ?; where ? is the missing code that uses textPath...

Stripping everything but alphanumeric chars from a string in Python

What is the best way to strip all non alphanumeric characters from a string, using Python? The solutions presented in the PHP variant of this question will probably work with some minor adjustments, ..

HTML5 required attribute seems not working

I can't figure out why the new required attribute of HTML5 seems to not be working, and I know my simple code seems to be okay. What should I do to make this work? Here is my code in HTML: <input..

How to resize image (Bitmap) to a given size?

How to resize image (Bitmap) to for example 800*480 programatically ? I have retrieved a picture in my app which is ~1MB and I need to scale it down to 800*480 I have loaded that picture and compresse..

How do I get the AM/PM value from a DateTime?

The code in question is below: public static string ChangePersianDate(DateTime dateTime) { System.Globalization.GregorianCalendar PC = new System.Globalization.GregorianCalendar(); PC.Calen..

High Quality Image Scaling Library

I want to scale an image in C# with quality level as good as Photoshop does. Is there any C# image processing library available to do this thing?..

Auto detect mobile browser (via user-agent?)

How can I detect if a user is viewing my web site from a mobile web browser so that I can then auto detect and display the appropriate version of my web site?..

How does Facebook disable the browser's integrated Developer Tools?

So apparently because of the recent scams, the developer tools is exploited by people to post spam and even used to "hack" accounts. Facebook has blocked the developer tools, and I can't even use the ..

Using a PagedList with a ViewModel ASP.Net MVC

I'm trying to using a PagedList in my ASP.Net application and I found this example on the Microsoft website

Retrieving JSON Object Literal from HttpServletRequest

I am writing code that needs to extract an object literal posted to a servlet. I have studied the API for the HttpServletRequest object, but it is not clear to me how to get the JSON object out of the..

get all the elements of a particular form

function getInputElements() { var inputs = document.getElementsByTagName("input"); } The above code gets all the input elements on a page which has more than one form. How do I get the input ele..

Remove spaces from a string in VB.NET

How do you remove spaces from a string in VB.NET?..

SSIS package creating Hresult: 0x80004005 Description: "Login timeout expired" error

I have an SSIS package that is being executed by an SQL Job which runs twice a day. I recently updated the SSIS package by removing a where clause of a Select statement in it. Now the results have aro..

Set System.Drawing.Color values

Hi how to set R G B values in System.Drawing.Color.G ? which is like System.Drawing.Color.G=255; is not allowed because its read only Property or indexer 'System.Drawing.Color.G' cannot be assigned..

How to write a file with C in Linux?

I want to rewrite the "cp" command of Linux. So this program will work like #./a.out originalfile copiedfile. I can open the file, create new file but can't write the new file. Nothing is written. Wha..

How to use PHP OPCache?

PHP 5.5 has been released and it features a new code caching module called OPCache, but there doesn't appear to be any documentation for it. So where is the documentation for it and how do I use OPc..

How to convert unsigned long to string

In the C language, how do I convert unsigned long value to a string (char *) and keep my source code portable or just recompile it to work on other platform (without rewriting code? For example, if ..

how to create a cookie and add to http response from inside my service layer?

I am creating a custom authentication service in my spring mvc application: @Service public class AuthenticationServiceImpl implements AuthenticationService { @Autowired UserService userServic..

Where can I find the TypeScript version installed in Visual Studio?

Maybe it's obvious, but I checked everywhere (besides the right place) and googled it. Nothing...

Does C have a "foreach" loop construct?

Almost all languages have a foreach loop or something similar. Does C have one? Can you post some example code?..

Proper way to handle multiple forms on one page in Django

I have a template page expecting two forms. If I just use one form, things are fine as in this typical example: if request.method == 'POST': form = AuthorForm(request.POST,) if form.is_valid..

What does "res.render" do, and what does the html file look like?

What does res.render do, and what does the html file look like? My end goal is to load arbitrary comma-separated-values from a text file into an html file (for example). I was only able to deduc..

Keras model.summary() result - Understanding the # of Parameters

I have a simple NN model for detecting hand-written digits from a 28x28px image written in python using Keras (Theano backend): model0 = Sequential() #number of epochs to train for nb_epoch = 12 #am..

How to generate different random numbers in a loop in C++?

Is it possible to generate different random number, every time loop runs. For example, i have: for (int t=0;t<10;t++) { int random_x; srand ( time(NULL) ); random_x = rand() % 100; ..

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

git pull while not in a git directory

Let's say I have a directory, /X/Y, which is a git repository. Is it possible to somehow call a command like git pull from inside /X, but targeting the /X/Y directory? EDIT: I guess I was wondering s..

Display an image with Python

I tried to use IPython.display with the following code: from IPython.display import display, Image display(Image(filename='MyImage.png')) I also tried to use matplotlib with the following code: im.. - <customErrors mode="Off"/> error when trying to access working webpage

I have created an webpage and have uploaded it onto a webserver. However when I try to view the page remotely, I get errors about the customerror tag in the web.config file. The page works loc..

ORA-12170: TNS:Connect timeout occurred

I was trying to connect to the database here in my laptop using Oracle Toad but I kept on having this error: ORA-12170: TNS:Connect timeout occurred What are the possible reasons why I kept on h..

Getting value from appsettings.json in .net core

Not sure what am I missing here but I am not able to get the values from my appsettings.json in my .net core application. I have my appsettings.json as: { "AppSettings": { "Version": "One..

How to obtain the start time and end time of a day?

How to obtain the start time and end time of a day? code like this is not accurate: private Date getStartOfDay(Date date) { Calendar calendar = Calendar.getInstance(); int year = calendar.g..

Disable a link in Bootstrap

The first example didn't work. I need to have always a list to disable links? Or what is wrong with my first demo? <a class="disabled" href="#">Disabled link</a> <ul class="nav nav..

Alternative to Intersect in MySQL

I need to implement the following query in MySQL. (select * from emovis_reporting where (id=3 and cut_name= '?????' and cut_name='??') ) intersect ( select * from emovis_reporting where (id=3) and (..

UTC Date/Time String to Timezone

How do I convert a date/time string (e.g. 2011-01-01 15:00:00) that is UTC to any given timezone php supports, such as America/New_York, or Europe/San_Marino...

Getting Error 800a0e7a "Provider cannot be found. It may not be properly installed."

So I am going back to a project I created in College, so I can transfer it to PHP. I orginally coded it in ASP Classic. I am on Windows 8 and running Access 2013. I am currently getting the followi..

What is the Difference Between Mercurial and Git?

I've been using git for some time now on Windows (with msysGit) and I like the idea of distributed source control. Just recently I've been looking at Mercurial (hg) and it looks interesting. However, ..

Which Eclipse version should I use for an Android app?

I am starting to develop Android applications. Which version of Eclipse should I use? I see there are 11 versions. I am confused with these: Eclipse IDE for Java Developers Eclipse Classic 3.6.1 Ec..

Using JSON POST Request

I'm attempting to use JSON to initiate a POST request to an API. I've found some example code, and before I get too far I wanted to get that working, but I'm stuck... <html> <head> <s..

get the data of uploaded file in javascript

I want to upload a csv file and process the data inside that file. What is the best method to do so? I prefer not to use php script. I did the following steps. But this method only returns the file na..

Firefox "ssl_error_no_cypher_overlap" error

My co-workers and I are having a problem using Firefox 3.0.6 to access a Java 1.6.0___11 web application we're developing. Everything works fine anywhere from 1-30 minutes into the session...but even..

Difference between @Mock and @InjectMocks

What is the difference between @Mock and @InjectMocks in Mockito framework?..

Setting focus on an HTML input box on page load

I'm trying to set the default focus on an input box when the page loads (example: google). My page is very simple, yet I can't figure out how to do this. This is what I've got so far: <html> &..

"SMTP Error: Could not authenticate" in PHPMailer

I'm using PHPMailer in a Simple Script For Send Email's Through Gmail, and I'm getting an "Unknown Error" (At least for me!): SMTP Error: Could not authenticate. Error: SMTP Error: Could not a..

Jackson - Deserialize using generic class

I have a json string, which I should deSerialize to the following class class Data <T> { int found; Class<T> hits } How do I do it? This is the usual way mapper.readValue(jsonS..

Maven – Always download sources and javadocs

Is there a way I can configure maven to always download sources and javadocs? Specifying -DdownloadSources=true -DdownloadJavadocs=true everytime (which usually goes along with running mvn compile twi..

Intent from Fragment to Activity

I was trying to go to another page using button, but it always fail. Here is my First Class with its XML: public class FindPeopleFragment extends Fragment { public FindPeopleFragment(){} @..

How does String.Index work in Swift

I've been updating some of my old code and answers with Swift 3 but when I got to Swift Strings and Indexing it has been a pain to understand things. Specifically I was trying the following: let st..

How do I implement Cross Domain URL Access from an Iframe using Javascript?

I need to access the Parent Domain URL from my Iframe which is in another domain. For example, "" is my website which has an Iframe from another parent domain, such as "". Here I..

HTML span align center not working?

I have some HTML: <div align="center" style="border:1px solid red"> This is some text in a div element! </div> The Div is changing the spacing on my document, so I want to use a span fo..

How to downgrade the installed version of 'pip' on windows?

On a windows 7 machine I have pip version 1.5.6 installed: pip 1.5.6 from C:\Users\dietz\PNC\tas\ENV\lib\site-packages (python 2.7) In order to find the reason for an error I want to install a diff..

How to consume a webApi from Web API to store result in database?

I'm wondering how to consume a WEBAPI from another ASP.Net Web API to store the response in a database. I know how to consume a WEBAPI from clients like javascript,console application etc. But the re..

How to open my files in data_folder with pandas using relative path?

I'm working with pandas and need to read some csv files, the structure is something like this: folder/folder2/scripts_folder/ folder/folder2/data_folder/data.csv How can I open the data.csv..

Programmatically saving image to Django ImageField

Ok, I've tried about near everything and I cannot get this to work. I have a Django model with an ImageField on it I have code that downloads an image via HTTP (tested and works) The image is saved ..

Python 2.7: Print to File

Why does trying to print directly to a file instead of sys.stdout produce the following syntax error: Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", "c..

How to avoid 'undefined index' errors?

I am working through some code done by a previous developer. I'm pretty new to PHP so I am wondering if there is any well known pattern or solution to this problem. Basically the original author does ..

Accessing UI (Main) Thread safely in WPF

I have an application which updates my datagrid each time a log file that I'm watching gets updated (Appended with new text) in the following manner: private void DGAddRow(string name, FunctionType f..

How to specify function types for void (not Void) methods in Java8?

I'm playing around with Java 8 to find out how functions as first class citizens. I have the following snippet: package test; import java.util.*; import java.util.function.*; public class Test { ..

Is mathematics necessary for programming?

I happened to debate with a friend during college days whether advanced mathematics is necessary for any veteran programmer. He used to argue fiercely against that. He said that programmers need only ..

Mocking python function based on input arguments

We have been using Mock for python for a while. Now, we have a situation in which we want to mock a function def foo(self, my_param): #do something here, assign something to my_result retur..

Setting state on componentDidMount()

I know that it is an anti-pattern to set state on componentDidMount and a state should be set on componentWillMount but suppose I want to set the length of the number of li tags as a state. In that ca..

Formatting Phone Numbers in PHP

I am working on an SMS app and need to be able to convert the sender's phone number from +11234567890 to 123-456-7890 so it can be compared to records in a MySQL database. The numbers are stored in ..

How can I show dots ("...") in a span with hidden overflow?

My CSS: #content_right_head span { display:inline-block; width:180px; overflow:hidden !important; } Now it's showing content content But I want to show like content content ... I need to s..

check the null terminating character in char*

I was just trying to see how to check for the null terminating character in the char * array but I failed. I can find the length using the for loop procedure where you keep on checking each element, b..

What is the time complexity of indexing, inserting and removing from common data structures?

There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc...

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


I'm getting the exception java.lang.ClassNotFoundException when I am trying to run my code, My Code try { Class.forName("com.mysql.jdbc.Driver"); Connection

Split a python list into other "sublists" i.e smaller lists

I have a python list which runs into 1000's. Something like: data=["I","am","a","python","programmer".....] where, len(data)= say 1003 I would now like to create a subset of this list (data) by sp..

How to check cordova android version of a cordova/phonegap project?

I have received a Security Alert from Google this week that tells me to upgrade my android version of cordova app. The email from google is as below - This is a notification that your --apps ids--, i..

Set Canvas size using javascript

I have the following code in html: <canvas id="myCanvas" width =800 height=800> I want, instead of specifying the width as 800, to call the JavaScript function getWidth() to get the width e..

Cannot connect to Database server (mysql workbench)

Could you help me solve this problem ? When I try to click "query database" under database menu in Mysql workbench. it gives me an error: Cannot Connect to Database Server Your connection attempt f..

How to reset form body in bootstrap modal box?

I am looking for a way to clear all elements found within an HTML form contained inside a Bootstrap modal without refreshing the page. Currently: The user enters data and closes the modal. When the..

Call a url from javascript

Is there a way to call a url and get a response using javascript? I need the equivalent of ASP.NET: WebRequest req = HttpWebRequest.Create(""); WebResponse webResponse = req.GetResp..

How to make Python script run as service?

I want to run a python script in a CENTOS server: #!/usr/bin/env python import socket try: import thread except ImportError: import _thread as thread #Py3K changed it. class Polserv(objec..

Updating a java map entry

I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map, and I want to update the value in a Key-Value pair. Right now, I'm doing it lik this: private Map<Str..

How to check if mysql database exists

Is it possible to check if a (MySQL) database exists after having made a connection. I know how to check if a table exists in a DB, but I need to check if the DB exists. If not I have to call another..

Disable all gcc warnings

I'm working on a project that will read compiler error messages of a particular variety and do useful things with them. The sample codebase I'm testing this on (a random open-source application), and ..

MySQL: Check if the user exists and drop it

There’s not standard way to check if a MySQL user exists and based on that drop it. Are there any workarounds for this? Edit: I need a straight way to run this without throwing up an error e.g. ..

How can I reference a commit in an issue comment on GitHub?

I find a lot of answers on how to reference a GitHub issue in a git commit (using the #xxx notation). I'd like to reference a commit in my comment, generating a link to the commit details page?..

How to set value to form control in Reactive Forms in Angular

Hi Everyone I'm new to angular. Actually, I'm trying to subscribe data from a service and that data, I'm passing to form control of mine from (example, it's like an edit form). import { Component, On..

How to compare arrays in C#?

Possible Duplicate: Easiest way to compare arrays in C# How can I compare two arrays in C#? I use the following code, but its result is false. I was expecting it to be true. Array.Equals(..

OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection

I successfully implemented the OpenCV square-detection example in my test application, but now need to filter the output, because it's quite messy - or is my code wrong? I'm interested in the four co..

List of All Locales and Their Short Codes?

I'm looking for a list of all locales and their short codes for a PHP application I am writing. Is there much variation in this data between platforms? Also, if I am developing an international appli..

How to convert an XML file to nice pandas dataframe?

Let's assume that I have an XML like this: <author type="XXX" language="EN" gender="xx" feature="xx" web=""> <documents count="N"> <document KEY="e95a9a6c790ecb95..

How to encrypt and decrypt file in Android?

I want to encrypt file and store it in SD card. I want to decrypt that encrypted file and store it in SD card again. I have tried to encrypt file by opening it as file stream and encrypt it but it is ..

How do I shutdown, restart, or log off Windows via a bat file?

I've been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power options in Start Menu. I need an alternative way to shutdown or restart. How do I ..

Can I nest a <button> element inside an <a> using HTML5?

I am doing the following: <a href=""> <button disabled="disabled" >ABC</button> </a> This works good but I get a HTML5 validation error that says..