Questions Tagged with #Constant expression

Constant expressions can be evaluated at compile time.

CRON job to run on the last day of the month

I need to create a CRON job that will run on the last day of every month. I will create it using cPanel. Any help is appreciated. Thanks..

Cannot kill Python script with Ctrl-C

I am testing Python threading with the following script: import threading class FirstThread (threading.Thread): def run (self): while True: print 'first' class SecondThread ..

jQuery AJAX submit form

I have a form with name orderproductForm and an undefined number of inputs. I want to do some kind of jQuery.get or ajax or anything like that that would call a page through Ajax, and send along all ..

How can I declare and use Boolean variables in a shell script?

I tried to declare a Boolean variable in a shell script using the following syntax: variable=$false variable=$true Is this correct? Also, if I wanted to update that variable would I use the same s..

Function for C++ struct

Usually we can define a variable for a C++ struct, as in struct foo { int bar; }; Can we also define functions for a struct? How would we use those functions?..

Get the short Git version hash

Is there a cleaner way to get the short version hash of HEAD from Git? I want to see the same output as I get from: git log -n 1 | head -n 1 | sed -e 's/^commit //' | head -c 8 I originally use..

PUT vs. POST in REST

According to the HTTP/1.1 Spec: The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-..

Linker Error C++ "undefined reference "

Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I fix it? Trying to compile my program via g++ -o prog1 main.cpp -std=c++0x I get the error: /tmp/cc1p..

Get the name of an object's type

Is there a JavaScript equivalent of Java's class.getName()?..

SQL Inner Join On Null Values

I have a Join SELECT * FROM Y INNER JOIN X ON ISNULL(X.QID, 0) = ISNULL(y.QID, 0) Isnull in a Join like this makes it slow. It's like having a conditional Join. Is there any work around to somet..

How to use Select2 with JSON via Ajax request?

My Select2 3.4.5 is not working with JSON data. Here is my input box on HTML: <input class='form-control col-lg-5 itemSearch' type='text' placeholder='select item' /> …and my JavaScript $..

Replace an element into a specific position of a vector

I want to replace an element into a specific position of a vector, can I just use an assignment: // vec1 and 2 have the same length & filled in somehow vec1; vec2; vec1[i] = vec2[i] // insert ve..

Is it valid to define functions in JSON results?

Part of a website's JSON response had this (... added for context): {..., now:function(){return(new Date).getTime()}, ...} Is adding anonymous functions to JSON valid? I would expect each time you..

Laravel view not found exception

I have problem with laravel view is not found by route function I did composer dumpautoload but no use ArticleController.php <?php class ArticleController extends BaseController { public func..

Rails: How does the respond_to block work?

I'm going through the Getting Started with Rails guide and got confused with section 6.7. After generating a scaffold I find the following auto-generated block in my controller: def index @posts = ..

css padding is not working in outlook

I have following html in email template. I am getting different view in MS Outlook and in gmail for the same. <tr> <td bgcolor="#7d9aaa" style="color: #fff; font-size:15px; font-family:..

regex string replace

I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no expl..

What is the difference between a Shared Project and a Class Library in Visual Studio 2015?

I was looking at the new features for Visual Studio 2015 and Shared Project came up a lot but I don't understand how it is different to using a Class Library or a Portable Class Library. Can anyone ex..

What is android:weightSum in android, and how does it work?

I want to know: What is android:weightSum and layout weight, and how do they work?..

Connect to SQL Server database from Node.js

The question duplicates some older questions, but the things may have changed since then. Is there some official support for connecting to SQL Server from Node.js (e.g. official library from MS)? Or ..

Using ping in c#

When I Ping a remote system with windows it says there is no reply, but when I ping with c# it says success. Windows is correct, the device is not connected. Why is my code able to successfully ping w..

Determining if Swift dictionary contains key and obtaining any of its values

I am currently using the following (clumsy) pieces of code for determining if a (non-empty) Swift dictionary contains a given key and for obtaining one (any) value from the same dictionary. How can o..

How do I get the total Json record count using JQuery?

I couldn't find anything about getting the total JSON record count using jQuery. Here is the JSON returned: {"Email":"Please enter your Email.","Password":"Please enter a password."} Here is my cod..

Default Values to Stored Procedure in Oracle

I have a stored procedure as follows. CREATE OR REPLACE PROCEDURE TEST( X IN VARCHAR2 DEFAULT 'P', Y IN NUMBER DEFAULT 1) AS BEGIN DBMS_OUTPUT.PUT_LINE('X'|| X||'--'||'Y'||Y); END; ..

:touch CSS pseudo-class or something similar?

I am trying to make a button, such that when the user clicks on it, it changes its style while the mouse button is being held down. I also want it to change its style in a similar way if it is touched..

How to update a value, given a key in a hashmap?

Suppose we have a HashMap<String, Integer> in Java. How do I update (increment) the integer-value of the string-key for each existence of the string I find? One could remove and reenter the pa..

Vuejs: Event on route change

In my main page I have dropdowns that show v-show=show by clicking on link @click = "show=!show" and I want to set show=false when I change route. Advise me please how to realize this thing...

Countdown timer in React

I have seen lots of countdown timers in JavaScript and wanted to get one working in React. I have borrowed this function I found online: secondsToTime(secs){ let hours = Math.floor(secs / (60 * ..

Plot a bar using matplotlib using a dictionary

Is there any way to plot a bar plot using matplotlib using data directly from a dict? My dict looks like this: D = {u'Label1':26, u'Label2': 17, u'Label3':30} I was expecting fig = plt.figure(..

How to find the sum of an array of numbers

Given an array [1, 2, 3, 4], how can I find the sum of its elements? (In this case, the sum would be 10.) I thought $.each might be useful, but I'm not sure how to implement it...

Limiting floats to two decimal points

I want a to be rounded to 13.95. >>> a 13.949999999999999 >>> round(a, 2) 13.949999999999999 The round function does not work the way I expected...

How to make Bootstrap carousel slider use mobile left/right swipe

DEMO JSSFIDDLE <div class="col-md-4"> <!--Carousel--> <div id="sidebar-carousel-1" class="carousel slide" data-ride="carousel"> <ol class="carou..

How to find when a web page was last updated

Is there a way to find out how much time has passed since a web page was changed? For example, I have a page hosted at: www.mywebsitenotupdated.com Is there a way to find out when this HTML page w..

What is secret key for JWT based authentication and how to generate it?

Recently I started working with JWT based authentication. After user login, a user token is generated which will look like "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6I..

ImportError: No module named MySQLdb

I am referring the following tutorial to make a login page for my web application. http://code.tutsplus.com/tutorials/intro-to-flask-signing-in-and-out--net-29982 I am having issue with the database...

How to center a View inside of an Android Layout?

I want to put a layout in the center of the screen. ..

How to check if a file exists in Go?

Go's standard library does not have a function solely intended to check if a file exists or not (like Python's os.path.exists). What is the idiomatic way to do it?..

Operation Not Permitted when on root - El Capitan (rootless disabled)

I am trying to move something to /usr/bin on OS X El Capitan. I have disabled rootless using the following commands: sudo nvram boot-args="rootless=0"; sudo reboot, but I keep getting the same error:..

What is the meaning of polyfills in HTML5?

What is the meaning of polyfills in HTML5? I saw this word in many sites about HTML5, e.g. HTML5-Cross-Browser-Polyfills. So here we're collecting all the shims, fallbacks, and polyfills in orde..

Where is localhost folder located in Mac or Mac OS X?

I just started developing PHP projects on my mac (using PDT) and was wondering where localhost is located? How does Mac OS X serve websites, I haven't changed any settings during the installation of P..

How to set value to variable using 'execute' in t-sql?

DECLARE @dbName nvarchar(128) = 'myDb' DECLARE @siteId int exec ('SELECT TOP 1 @siteId = Id FROM ' + @dbName + '..myTbl') select @siteId When I run the script above I get the following error Msg..

CMake unable to determine linker language with C++

I'm attempting to run a cmake hello world program on Windows 7 x64 with both Visual Studio 2010 and Cygwin, but can't seem to get either to work. My directory structure is as follows: HelloWorld -- C..

How to put/get multiple JSONObjects to JSONArray?

Is it possible to store multiple different JSONObjects into a single JSONArray? This is the structure, I want to store in a JSONArray. [{"value1":1,"value2":900,"value3":1368349},{"value1":2,"value2"..

Changing Font Size For UITableView Section Headers

Can someone please instruct me on the easiest way to change the font size for the text in a UITableView section header? I have the section titles implemented using the following method: - (NSString ..

80-characters / right margin line in Sublime Text 3

You can have 80-characters / right margin line in Netbeans, Text Mate and probably many, many more other IDEs. Is it possible to have it in Sublime Text 3 as well? Any option, plugin etc.?..

Finding first blank row, then writing to it

I need to find the first blank row in a workbook and write information to (row, 1) and (row, 2). I think I'm currently pretty stuck... Function WriteToMaster(num, path) As Boolean 'Declare variables..

How do you read a CSV file and display the results in a grid in Visual Basic 2010?

How do you read a CSV file and display the results in a grid in Visual Basic 2010? This sounds so simple but I still can't find the answer to it after googling for a while. I have DataGridView on a fo..

Does Ruby have a string.startswith("abc") built in method?

Does Ruby have a some_string.starts_with("abc") method that's built in?..

How to get main div container to align to centre?

I have always been wondering how other people get to align to the centre the main div container as the only way I manage so far is adding to the css file the following: *{ padding:auto; margin:auto; ..

How to make HTML element resizable using pure Javascript?

I was wondering how we can make a HTML element like <div> or <p> tag element resizable when clicked using pure JavaScript, not the jQuery library or any other library...

jQuery object equality

How do I determine if two jQuery objects are equal? I would like to be able to search an array for a particular jQuery object. $.inArray(jqobj, my_array);//-1 alert($("#deviceTypeRoot") == $("#de..

Installing mcrypt extension for PHP on OSX Mountain Lion

Apologies in advance for the potential n00b questions, I am trying to install the mcrypt extension for PHP on my OSX Mountain Lion machine. The following steps in terminal is what I have done so far ..

Autonumber value of last inserted row - MS Access / VBA

I have a JET table with an auto-number as the primary key, and I would like to know how I can retrieve this number after inserting a row. I have thought of using MAX() to retrieve the row with the hi..

MySQL/Writing file error (Errcode 28)

I have the following error with one of our web applications - Query3 failed: Error writing file '/tmp/MY1fnqpm' (Errcode: 28) ... INSERT MailList... (removed the rest of the query for security reaso..

Shell script to get the process ID on Linux

I want to write a shell script (.sh file) to get a given process id. What I'm trying to do here is once I get the process ID, I want to kill that process. I'm running on Ubuntu (Linux). I was able to..

How do I find the current directory of a batch file, and then use it for the path?

I have a batch file that I intend to distribute to our customers to run a software task. We distribute them as a folder or .zip with the files inside. Inside, there is the batch files and another fo..

Get the current language in device

How can we get the current language selected in the Android device?..

Python: avoid new line with print command

I've started programming today and have this issue with Python. It's pretty dumb but I can't figure out how to do it. When I use the print command, it prints whatever I want and then goes to a differe..

How to debug SSL handshake using cURL?

I would like to troubleshoot per directory authentication with client certificate. I would specially like to find out which acceptable client certificates does server send. How do I debug SSL handsha..

Remove Server Response Header IIS7

Is there any way to remove "Server" response header from IIS7? There are some articles showing that using HttpModules we can achieve the same thing. This will be helpful if we don't have admin right t..

How to install ia32-libs in Ubuntu 14.04 LTS (Trusty Tahr)

I installed Ubuntu 14.04 (Trusty Tahr) yesterday. Everything seems OK. But when I tried to compile some C code, I encounter the following error. The error seems to be due to the OS lacking the 32-bit ..

How do I define a method in Razor?

How do I define a method in Razor?..

How to redirect page after click on Ok button on sweet alert?

I am able to display sweet alert after the page refresh but I have to click on Ok button which I am getting on sweet alert to redirect the page.Please help me in this. <?php echo '<script ..

Is there a good Valgrind substitute for Windows?

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a eq..

Python Database connection Close

Using the code below leaves me with an open connection, how do I close? import pyodbc conn = pyodbc.connect('DRIVER=MySQL ODBC 5.1 driver;SERVER=localhost;DATABASE=spt;UID=who;PWD=testest') csr..

Changing file extension in Python

Suppose from index.py with CGI, I have post file foo.fasta to display file. I want to change foo.fasta's file extension to be foo.aln in display file. How can I do it?..

The opposite of Intersect()

Intersect can be used to find matches between two collections, like so: // Assign two arrays. int[] array1 = { 1, 2, 3 }; int[] array2 = { 2, 3, 4 }; // Call Intersect extension method. var intersect..

Allow anything through CORS Policy

How can I disable cors? For some reason I wild carded the allowed origins and headers yet my ajax requests still complain that the origin was not allowed by my CORS policy.... My applications control..

What is the difference between a pandas Series and a single-column DataFrame?

Why does pandas make a distinction between a Series and a single-column DataFrame? In other words: what is the reason of existence of the Series class? I'm mainly using time series with datetime ind..

How to delete a line from a text file in C#?

I have a problem: how can I delete a line from a text file in C#?..

How can I increase a scrollbar's width using CSS?

Is it possible to increase the width of a scrollbar on a <div> element placed inside the <body>? I am not talking about the default scrollbar on the browser itself, this page runs in full..

How to remove an element from the flow?

I know position: absolute will pop an element from the flow and it stops interacting with its neighbors. What other ways are there to achieve this?..

Convert UTC to local time in Rails 3

I'm having trouble converting a UTC Time or TimeWithZone to local time in Rails 3. Say moment is some Time variable in UTC (e.g. moment = Time.now.utc). How do I convert moment to my time zone, takin..

How to create a testflight invitation code?

I am a registered iOS developer and a developer friend of mine is trying to send me a testflight version. For some reason he can't sent me an invitation - I believe this is because I am registered as..

Only on Firefox "Loading failed for the <script> with source"

I want to integrate Marketo form with my existing website on yii framework. My code works on all the browsers except Firefox. Excerpt from my code: $('#button').click(function () { var formD..

Regular expression to match standard 10 digit phone number

I want to write a regular expression for a standard US type phone number that supports the following formats: ###-###-#### (###) ###-#### ### ### #### ###.###.#### where # means any number. So far ..

Is there a way to view past mysql queries with phpmyadmin?

I'm trying to track down a bug that's deleting rows in a mysql table. For the life of me I can't track it down in my PHP code, so I'd like to work backwards by finding the actual mysql query that's ..

How to [recursively] Zip a directory in PHP?

Directory is something like: home/ file1.html file2.html Another_Dir/ file8.html Sub_Dir/ file19.html I am using the same PHP Zip class used in PHPMyAdmin http://trac.seagul..

Raise to power in R

This is a beginner's question. What's the difference between ^ and **? For example: 2 ^ 10 [1] 1024 2 ** 10 [1] 1024 Is there a function such as power(x,y)? ..

How to set Python's default version to 3.x on OS X?

I'm running Mountain Lion and the basic default Python version is 2.7. I downloaded Python 3.3 and want to set it as default. Currently: $ python version 2.7.5 $ python3.3 version 3.3 How ..

How to uninstall Eclipse?

I want to uninstall Eclipse version Mars 2, but it doesn't appear in the "Programs and Features" area of the Windows Control Panel. The installer has installed start menu shortcuts and other artifacts..

Slidedown and slideup layout with animation

how can I display a layout in the center with slideUp when I press the button, and press again to hide ... slideDown in ANDROID help me with that, thnkss..

How can I get date in application run by node.js?

Do I have to manually run date command using child_process and fetch the result from it to get the date? Is there any other way using node?..

Android Completely transparent Status Bar?

I've searched the documentation but only found this: Link. Which is used to make the bar translucent? What I'm trying to do is to make the status bar completely transparent (as shown in the image belo..

How to force IE10 to render page in IE9 document mode

I have two questions: How can I force IE10 to render in IE9 document mode? Currently it's rendering my page in Standard document mode. In IE10's developer toolbar, I am not able to see the option of..

How to save/restore serializable object to/from file?

I have a list of objects and I need to save that somewhere in my computer. I have read some forums and I know that the object has to be Serializable. But it would be nice if I can get an example. For ..

Tower of Hanoi: Recursive Algorithm

Although I have no problem whatsoever understanding recursion, I can't seem to wrap my head around the recursive solution to the Tower of Hanoi problem. Here is the code from Wikipedia: procedure Ha..

jQuery append text inside of an existing paragraph tag

I am trying to add additional text to the end of a paragraph using jQuery. My thought was to produce a structure like this: Judging by my answers I will clarify. I need to create this structure first..

Implement touch using Python?

touch is a Unix utility that sets the modification and access times of files to the current time of day. If the file doesn't exist, it is created with default permissions. How would you implement it..

Android Volley - BasicNetwork.performRequest: Unexpected response code 400

Problem statement: I am trying to access an REST API that will return a JSON object for various HTTP status codes (400, 403, 200 etc) using Volley. For any HTTP status other than 200, it seems the '..

What are the best use cases for Akka framework

I have heard lots of raving about Akka framework (Java/Scala service platform), but so far have not seen many actual examples of use cases it would be good for. So I would be interested in hearing abo..

How to redirect all HTTP requests to HTTPS

I'm trying to redirect all insecure HTTP requests on my site (e.g. http://www.example.com) to HTTPS (https://www.example.com). I'm using PHP btw. Can I do this in .htaccess?..

getting file size in javascript

given a path of a file like: C:\file.jpg how can i get the size of the file in javascript?..

Build a basic Python iterator

How would one create an iterative function (or iterator object) in python?..

How to implement onBackPressed() in Fragments?

Is there a way in which we can implement onBackPressed() in Android Fragment similar to the way in which we implement in Android Activity? As the Fragment lifecycle do not have onBackPressed(). Is th..

Append TimeStamp to a File Name

I have come across this problem several times in which I would like to have multiple versions of the same file in the same directory. The way I have been doing it using C# is by adding a time stamp to..

show distinct column values in pyspark dataframe: python

Please suggest pyspark dataframe alternative for Pandas df['col'].unique(). I want to list out all the unique values in a pyspark dataframe column. Not the SQL type way (registertemplate then SQL qu..

git diff file against its last change

Is it possible to get git to produce a diff between a specific file as it exists now, and as it existed before the last commit that changed it? That is, if we know: $ git log --oneline myfile 123abc..

Show div when radio button selected

I am novice in javascript and jQuery. In my html have 2 radio buttons and one div. I want to show that div if I check the first radio-button but otherwise I want it to be hidden so: If radio button #..

Return HTML from ASP.NET Web API

How to return HTML from ASP.NET MVC Web API controller? I tried the code below but got compile error since Response.Write is not defined: public class MyController : ApiController { [HttpPost] ..

Is there a concurrent List in Java's JDK?

How can I create a concurrent List instance, where I can access elements by index? Does the JDK have any classes or factory methods I can use?..

Excel VBA Open workbook, perform actions, save as, close

This question has been edited due to lengthy comments and updates from proposed answers. As requested here is module 13; Sub SaveInFormat() Application.DisplayAlerts = False Workbooks.Application.Ac..

Convert JS Object to form data

How can I can convert my JS Object to FormData? The reason why I want to do this is, I have an object that I constructed out of the ~100 form field values. var item = { description: 'Some Item',..

How to find all serial devices (ttyS, ttyUSB, ..) on Linux without opening them?

What is the proper way to get a list of all available serial ports/devices on a Linux system? In other words, when I iterate over all devices in /dev/, how do I tell which ones are serial ports in th..

Padding a table row

<html> <head> <title>Table Row Padding Issue</title> <style type="text/css"> tr { padding: 20px; } <..

In PHP, how do you change the key of an array element?

I have an associative array in the form key => value where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This ..

Detecting installed programs via registry

I need to develop a process that will detect if the users computer has certain programs installed and if so, what version. I believe I will need a list with the registry location and keys to look for ..

Laravel 5.4 Specific Table Migration

Hi read all the included documentation here in https://laravel.com/docs/5.4/migrations. Is there a way on how to migrate a certain migration file (1 migration only), cause right now every time there ..

Ruby optional parameters

If I define a Ruby functions like this: def ldap_get ( base_dn, filter, scope=LDAP::LDAP_SCOPE_SUBTREE, attrs=nil ) How can I call it supplying only the first 2 and the last args? Why isn't somethi..

C++ - How to append a char to char*?

I've tried so may ways on the Internet to append a character to a char* but none of them seems to work. Here is one of my incomplete solution: char* appendCharToCharArray(char * array, char a) { ..

Create a batch file to run an .exe with an additional parameter

I need a batch file which will do the following: 1. Open CMD and navigate to a location C:/Users/...../program.exe 2. Run the program.exe with an additional command to point it to a config file: e.g...

Set Session variable using javascript in PHP

Is it possible to set PHP session variables using Javascript?..

How to calculate age in T-SQL with years, months, and days

What would be the best way to calculate someone's age in years, months, and days in T-SQL (SQL Server 2000)? The datediff function doesn't handle year boundaries well, plus getting the months and day..

Best way to create unique token in Rails?

Here's what I'm using. The token doesn't necessarily have to be heard to guess, it's more like a short url identifier than anything else, and I want to keep it short. I've followed some examples I've ..

If input value is blank, assign a value of "empty" with Javascript

So I have an input field, if it's blank, I want its value to be the words "empty", but if there is any value inputted, I want the value to be the inputted value. I want to use javascript for this, any..

How does strcmp() work?

I've been looking around a fair bit for an answer. I'm going to make a series of my own string functions like my_strcmp(), my_strcat(), etc. Does strcmp() work through each index of two arrays of cha..

How to test my servlet using JUnit

I have created a web system using Java Servlets and now want to make JUnit testing. My dataManager is just a basic piece of code that submits it to the database. How would you test a Servlet with JUni..

How to write JUnit test with Spring Autowire?

Here are the files that I use: component.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchem..

How to get the date from the DatePicker widget in Android?

I use a DatePicker widget in Android for the user to set a date, and want to get the date value when a confirm button is clicked, how can I do that?..

Getting DOM node from React child element

Using the React.findDOMNode method that was introduced in v0.13.0 I am able to get the DOM node of each child component that was passed into a parent by mapping over this.props.children. However, if ..

How to fill DataTable with SQL Table

I am currently creating and reading a DataTable with the following code in my Page_Load protected void Page_Load(object sender, EventArgs e) { if (Session["AllFeatures1"] == null) { S..

How to copy a string of std::string type in C++?

I used the strcpy() function and it only works if I use C-string arrays like: char a[6] = "text"; char b[6] = "image"; strcpy(a,b); but whenever I use string a = "text";..

Access properties file programmatically with Spring?

We use the code below to inject Spring beans with properties from a properties file. <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name=..

Create list of single item repeated N times

I want to create a series of lists, all of varying lengths. Each list will contain the same element e, repeated n times (where n = length of the list). How do I create the lists, without using a list..

std::unique_lock<std::mutex> or std::lock_guard<std::mutex>?

I have two use cases. A. I want to synchronise access to a queue for two threads. B. I want to synchronise access to a queue for two threads and use a condition variable because one of the threads wil..

React - Preventing Form Submission

I've been experimenting with React. In my experiement, I'm using the Reactstrap framework.When I click a button, I've noticed that the HTML form submits. Is there a way to prevent form submission when..

What does 'git blame' do?

I saw a lot of questions about methods of using git blame, but I don't really understand them. I see a Blame button on top of files on the GitHub interface. Upon clicking it, it shows some diff with ..

HTML Table different number of columns in different rows

Like in Excel sheet can I have 2 columns in 1st row 1 long column in the 2nd row is this possible in html ?..

Close Current Tab

I have a close link on my web page. I would like to function it to close the current tab when click it. I have written <a href="#" onclick = "javascript:self.close();">close</a> The abo..

How to parse SOAP XML?

SOAP XML: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas...

Fatal error: Call to undefined function socket_create()

My code is like this: if( ($this->master=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) < 0 ) { die("socket_create() failed, reason: ".socket_strerror($this->master)); } when I r..

Facebook Access Token for Pages

I have a Facebook Page that I want to get some things from it. First thing are feeds and from what I read they are public (no need for access_token). But I want to also get the events... and they aren..

Perl - If string contains text?

I want to use curl to view the source of a page and if that source contains a word that matches the string then it will execute a print. How would I do a if $string contains? In VB it would be like. ..

How to store printStackTrace into a string

How can I get the e.printStackTrace() and store it into a String variable? I want to use the string generated by e.printStackTrace() later in my program. I'm still new to Java so I'm not too familiar..

Reimport a module in python while interactive

I know it can be done, but I never remember how. How can you reimport a module in python? The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I ..

How can I convert JSON to CSV?

I have a JSON file I want to convert to a CSV file. How can I do this with Python? I tried: import json import csv f = open('data.json') data = json.load(f) f.close() f = open('data.csv') csv_file =..

What is the best way to measure execution time of a function?

Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more sophisticated. Any tips appreciated...

ServletContext.getRequestDispatcher() vs ServletRequest.getRequestDispatcher()

why getRequestDispatcher(String path) of the ServletRequest interface cannot extend outside the current servlet context where as getRequestDispatcher(String path) of the ServletCon..

DOUBLE vs DECIMAL in MySQL

OK, so I know there are tons of articles stating I shouldn't use DOUBLE to store money on a MySQL database, or I'll end up with tricky precision bugs. The point is I am not designing a new database, I..

What's the name for hyphen-separated case?

This is PascalCase: SomeSymbol This is camelCase: someSymbol This is snake_case: some_symbol So my questions is whether there is a widely accepted name for this: some-symbol? It's commonly used in ..

Git - How to fix "corrupted" interactive rebase?

I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the following instructions. Before running the "git commit --amend" (and after the git rebase..

How to Execute a Python File in Notepad ++?

I prefer using Notepad ++ for developing, How do I execute the files in Python through Notepad++?..

Using app.config in .Net Core

I have problem. I need to write a program in .Net Core(C#) which use app.config like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section..

Unable to Resolve Module in React Native App

I'm getting an error in React Native saying it can't resolve a module. It's saying a certain folder doesn't exist but the path isn't accurate. It is telling me that Directory /Users/user/Desktop/RNApp..

iOS 10: "[App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction"

I sometimes get this message in the logs of Xcode 8b3 when running my app, everything seems to work, but I'd like to know where this comes from. Google did not help at all...

How to use a variable from a cursor in the select statement of another cursor in pl/sql

I want to run a query, get the results and then iterate through the results of that query with another select statement using the values of the first statement in my 2nd statement (cursor). I have 40..

Storing money in a decimal column - what precision and scale?

I'm using a decimal column to store money values on a database, and today I was wondering what precision and scale to use. Since supposedly char columns of a fixed width are more efficient, I was thi..

How to ignore the certificate check when ssl

I am trying find a way to ignore the certificate check when request a Https resource, so far, I found some helpful article in internet. But I still have some problem. Please review my code. I just d..

How to make the 'cut' command treat same sequental delimiters as one?

I'm trying to extract a certain (the fourth) field from the column-based, 'space'-adjusted text stream. I'm trying to use the cut command in the following manner: cat text.txt | cut -d " " -f 4 Unf..

Angular JS update input field after change

I'm trying to build a simple calculator in Angular in which I can override the total if I want. I have this part working but when I then go back to enter in a number in fields one or two the total isn..

py2exe - generate single executable file

I thought I heard that py2exe was able to do this, but I never figured it out. Has anyone successfully done this? Can I see your setup.py file, and what command line options you used? Basically I'm..

Perform a Shapiro-Wilk Normality Test

I want to perform a Shapiro-Wilk Normality Test test. My data is csv format. It looks like this: heisenberg HWWIchg 1 -15.60 2 -21.60 3 -19.50 4 -19.10 5 -20.90 6 -20.70 7 -..

How to change package name in flutter?

Is there any way to change Package Name of Flutter project? I want to change package name and application name in flutter project...

@Resource vs @Autowired

Which annotation, @Resource (jsr250) or @Autowired (Spring-specific) should I use in DI? I have successfully used both in the past, @Resource(name="blah") and @Autowired @Qualifier("blah") My instin..

Bootstrap dropdown sub menu missing

Bootstrap 3 is still at RC, but I was just trying to implement it. I couldn't figure out how to put a sub menu class. Even there is no class in css and even the new docs don't say anything about it I..

How to escape % in String.Format?

I am storing a SQL query in my strings.xml file and I want to use String.Format to build the final string in code. The SELECT statement uses a like, something like this: SELECT Field1, Field2 FROM m..

Printing list elements on separated lines in Python

I am trying to print out Python path folders using this: import sys print sys.path The output is like this: >>> print sys.path ['.', '/usr/bin', '/home/student/Desktop', '/home/student/my..

OperationalError, no such column. Django

I am very new to django and was able to finish the tutorial on djangoproject.com without any errors. I am now going through the Django REST framework tutorial found at http://www.django-rest-framework..

Detect change to ngModel on a select tag (Angular 2)

I am attempting to detect a change on ngModel in a <select> tag. In Angular 1.x, we might solve this with a $watch on ngModel, or by using ngChange, but I've yet to understand how to detect a ch..

Export database schema into SQL file

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

How to pass model attributes from one Spring MVC controller to another controller?

I am redirecting from a controller to another controller. But I also need to pass model attributes to the second controller. I don't want to put the model in session. Please help...

add allow_url_fopen to my php.ini using .htaccess

I want to allow allow_url_fopen on my server . I have asked my host and they said it can be done with a .htaccess file. Can anyone tell me how to go about this ?..

Binding multiple events to a listener (without JQuery)?

While working with browser events, I've started incorporating Safari's touchEvents for mobile devices. I find that addEventListeners are stacking up with conditionals. This project can't use JQuery. ..

UnsupportedClassVersionError: JVMCFRE003 bad major version in WebSphere AS 7

I am getting this error java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=map/CareMonths, offset=6 My Eclipse's Java compiler is set to 1.6 and my installed Java SDK in C:\..

How do you show animated GIFs on a Windows Form (c#)

I have a form showing progress messages as a fairly long process runs. It's a call to a web service so I can't really show a percentage complete figure on a progress bar meaningfully. (I don't particu..

Access images inside public folder in laravel

How can I access the images stored inside public/images folder without the use of Laravel's own functions like assets()? I just want to get the direct URL of the images stored in images folder. Eg:..

how get yesterday and tomorrow datetime in c#

I have a code: int MonthNow = System.DateTime.Now.Month; int YearNow = System.DateTime.Now.Year; int DayNow = System.DateTime.Now.Day; How can I get yesterday and tomorrow day, month and year in C#..

Select the first 10 rows - Laravel Eloquent

So far I have the following model: class Listing extends Eloquent { //Class Logic HERE } I want a basic function that retrieves the first 10 rows of my table "listings" and passes them on to t..

Strange Characters in database text: Ã, Ã, ¢, â‚ €,

I'm not certain when this first occured. I have a new drop-shipping affiliate website, and receive an exported copy of the product catalog from the wholesaler. I format and import this into Prestasho..

How to read until EOF from cin in C++

I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using cin.get( input, '\0' )..

Is there any difference between a GUID and a UUID?

I see these 2 acronyms thrown around, and I was wondering if there are any differences between a GUID and a UUID?..

Force unmount of NFS-mounted directory

I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work: $ umount -f /mnt/data $ umount2: Device or resource busy $ umount: /mnt/..

whitespaces in the path of windows filepath

I am working on file operations using python. I have a filepath as : filepath = "E:/ABC/SEM 2/testfiles/all.txt" when I am opening the file using python, it says me : IOError: No such file:..

Unique random string generation

I'd like to generate random unique strings like the ones being generated by MSDN library.(Error Object), for example. A string like 't9zk6eay' should be generated...

Granting DBA privileges to user in Oracle

How do I grant a user DBA rights in Oracle? I guess something like: CREATE USER NewDBA IDENTIFIED BY passwd; GRANT DBA TO NewDBA WITH ADMIN OPTION; Is it the right way, or.....

Unix epoch time to Java Date object

I have a string containing the UNIX Epoch time, and I need to convert it to a Java Date object. String date = "1081157732"; DateFormat df = new SimpleDateFormat(""); // This line try { Date expiry ..

How to sum array of numbers in Ruby?

I have an array of integers. For example: array = [123,321,12389] Is there any nice way to get the sum of them? I know, that sum = 0 array.each { |a| sum+=a } would work...

Fastest way to convert string to integer in PHP

Using PHP, what's the fastest way to convert a string like this: "123" to an integer? Why is that particular method the fastest? What happens if it gets unexpected input, such as "hello" or an array?..

Makefiles with source files in different directories

I have a project where the directory structure is like this: $projectroot | +---------------+----------------+ | ..

SQLAlchemy: print the actual query

I'd really like to be able to print out valid SQL for my application, including values, rather than bind parameters, but it's not obvious how to do this in SQLAlchemy (by design, I'm fairly sure). H..

Calling remove in foreach loop in Java

In Java, is it legal to call remove on a collection when iterating through the collection using a foreach loop? For instance: List<String> names = .... for (String name : names) { // Do som..

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

How to find the process id of a running Java process on Windows? And how to kill the process alone?

I want to kill the particular Java process in Windows, like in Linux (ps -aux to get processid and then kill processid to kill the process)...

check if a file is open in Python

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

Playing .mp3 and .wav in Java?

How can I play an .mp3 and a .wav file in my Java application? I am using Swing. I tried looking on the internet, for something like this example: public void playSound() { try { AudioInp..

How to find top three highest salary in emp table in oracle?

How to find top three highest salary in emp table in oracle?..

Flash CS4 refuses to let go

I have a Flash project, and it has many source files. I have a fairly heavily-used class, call it Jenine. I recently (and, perhaps, callously) relocated Jenine from one namespace to another. I thought..

How to fire a button click event from JavaScript in ASP.NET

How do I fire a server side button click event from JavaScript? I tried like this: document.getElementById("<%= ButtonID.ClientID %>").click(); But no use. How can I do it?..

How to handle back button in activity

How to handle a back button in an activity? I have some buttons. If I click one of the button it's redirecting to the buttons which I required. It's working fine but When I press back button it gets f..

How to return values in javascript

I have a javascript function: function myFunction(value1,value2,value3) { //Do stuff and value2=somevalue2 //to return value3=somevalue3 //to return } function call in Code: .... ..

Remove border from IFrame

How would I remove the border from an iframe embedded in my web app? An example of the iframe is: <iframe src="myURL" width="300" height="300">Browser not compatible.</iframe> I would l..

how to force maven to update local repo

I compiled a jar file in one project so it can be consumed in the 2nd one. I can see the jar file in .m2 folder. But in the 2nd project it complains about artifact not found. I guess I have to force ..

What is your favorite C programming trick?

For example, I recently came across this in the linux kernel: /* Force a compilation error if condition is true */ #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) So, in ..

How to create the most compact mapping n ? isprime(n) up to a limit N?

Naturally, for bool isprime(number) there would be a data structure I could query. I define the best algorithm, to be the algorithm that produces a data structure with lowest memory consumption for th..

Anaconda / Python: Change Anaconda Prompt User Path

I want to change my Anaconda Prompt User file path. Currently it is as follows: I want it to change to: C:\Users\u354590 How do I do this? The current version of anaconda I have is: Python 3.6..

How do you run JavaScript script through the Terminal?

For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename. How do you do this with .js files?..

How to rename files and folder in Amazon S3?

Is there any function to rename files and folders in Amazon S3? Any related suggestions are also welcome...

Importing class from another file

Before you mark it as duplicate please read my problem: I am trying to import a class from a file from a subdirectory > main.py > --->folder/ > ----->file.py and in file.py i have a c..

restart mysql server on windows 7

How do I restart MySQL on Windows 7? I'm using HeidiSql as a front end and there's no option in there. The only other things I have is the MySQL 5.5 command line client...

Current time formatting with Javascript

I want to get current time in a specific format with javascript. With the function below and calling it will give me Fri Feb 01 2013 13:56:40 GMT+1300 (New Zealand Daylight Time) but I want to forma..