After my script finishes I can delete the file, but while it's running I can't touch it, even after an fclose(). Here is the code I'm trying to use: $Files = glob("$_SERVER[DOCUMENT_ROOT]/files/*.csv"); $File = fopen($Files[0], "r"); //while (($Data = fgetcsv($File)) !== false) {... $i = 0; while (is_resource($File)) { $i && sleep(1); echo "Closing handle.\n"; fclose($File); if (++$i > 5) die("Could not close handle."); } foreach ($Files as $File) { $i = 0; while (file_exists($File)) { $i && sleep(1); echo "Deleting file.\n"; @unlink($File); echo 'www-data@debian:~$ ', $Command = "rm -f '$File
In a world I am building, the day lasts longer than the year, 9 times longer in fact. The native people of this world have been forced to migrate around the world, both avoiding the scorching desert of noon and the freezing winter of night. This world is otherwise rather unremarkable on the surface. Outside of the planet is a ring as well as many small moons, so many that the tides are rather small and unpredictable, but as I was designing their culture I realized something, without seeing the stars, would the have astronomy? How would a species that lives in eternal day have any knowledge of
I have two mongo collections, one which refers to the production env and the other to the testing env. How can I compare a diff between my two collections? I tried dumping them to a bson and then converting to a json. But I cant just perform a simple diff on them since the sorting might vary and the json file is way too large to be sorted.
i've made a webpage where i used a code that i found on the internet. in this code is a link to an ajax page. I uploaded my html and css to a webserver, now i get a message "this website is trying to load unverified sources". is it possible to copy this code to a file and add this this to my webserver, so the message doesn't appear? thanks in advance. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
Resently I enabled the Sentry policy file for Hive. So when I try to execute a query in Impala using Impala-JDBC4 (version 2.5.16) I get this error: errorMessage:AuthorizationException: User '' does not have privileges to execute 'SELECT' on: db.table In my code I set the user and password of my admin account of my DB. So I don't undestand why it don't reads that. public static double getDolarFromImpala(String date) { double dolar = 0.0; try { Class.forName(JDBC_DRIVER_IMPALA); String sql = "SELECT value FROM db.table where date ='"+date+"'"; String JDBC_IMPALA_URL = "jdbc:impala://impala1:210
I need to read a string from a particular text file using CAPL. Is there any CANoe/CAPL function to read from a text file and store it in a buffer? If not, how to create a general function to achieve this?
I want Auto Increment ID in SharePoint and ID should be in the form of CZAR1001,CZAR1002,CZAR1003 and so on. I have tried =RIGHT(EmpID-LEN(EmpID-4)) this formula but its not giving proper output. Might be due to EmpID is single line text type
I am trying to find a curve fitting my data that visually seem to have a power law distribution. I hoped to utilize scipy.optimize.curve_fit, but no matter what function or data normalization I try, I am getting either a RuntimeError (parameters not found or overflow) or a curve that does not fit my data even remotely. Please help me to figure out what I am doing wrong here. %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import curve_fit df = pd.DataFrame({ 'x': [ 1000, 3250, 5500, 10000, 32500, 55000, 77500, 100000, 200000 ], 'y':
I have a text file containing a list of titles that I need to change to title case (words should begin with a capital letter except for most articles, conjunctions, and prepositions). For example, this list of book titles: barbarians at the gate hot, flat, and crowded A DAY LATE AND A DOLLAR SHORT THE HITCHHIKER'S GUIDE TO THE GALAXY should be changed to: Barbarians at the Gate Hot, Flat, and Crowded A Day Late and a Dollar Short The Hitchhiker's Guide to the Galaxy I wrote the following code: while(<DATA>) { $_=~s/(\s+)([a-z])/$1.uc($2)/eg; print $_; } But it capitalizes the first letter of e
What is the best way to create one to one relationship from these two tables ? CREATE TABLE hotel( id_Hotel ... ) CREATE TABLE Manager( ID_Manager ... )
I have tried inserting calculated field, but it only gives a count value or a sum. I want to calculate the Average Transaction value which is (Total Sales/No of bills)
Question: How can i solve no-ascii character error executing pserve on virtualenv in windows? Description: I'm trying to execute pserve (pyllons/pyramid development web server) inside a virtualenv on windows. It's a fresh install, so maybe it is related to versions. Problem: With the virtualenv activated, execute pserve config.ini throw error: SyntaxError: Non-ASCII character '\x90' in file C:\PATH_TO_MY_ENV_HOME\env\Scripts\pserve.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details. Command line: pserve development.ini --reload Notes: this error happe
I'm working in react and I'm creating a button with a tooltip, but I can't place it. I mean I can't read the button's distance from the top and left. I tried offsetTop and offsetLeft and I got this error: "Uncaught TypeError: Cannot read property 'offsetWidth' of undefined" so I tried getBoundingClientRect() and all I got is another error: "Uncaught TypeError: elem.getBoundingClientRect is not a function". I'm passing the information from component to the second component by assigning the distances to the global variable and read it in this second component when I need to place it. This is my
We have to implement an iOS application which will support car play feature. Can any one you guide how to start Integrating Car play in an existing iOS app?
Imagine two groups of people exploring the same location, but at different times. For convenience, think of the group exploring first as the "ancestors" and the group exploring later as the "descendants." It is easy to invent ways for the ancestors to affect the descendants. For example, they leave treasure buried and a map to find the spot in an urn. How can the exploration decisions the descendants make "matter" for the ancestors? This relevance could be figurative, narrative, or even silly. Not necessarily physical cause-and-effect. I would prefer to avoid traditional sci-fi time travel, wi
I'm trying to create a table using HTML+Bootstrap CSS with Angularjs framework where if the table data reaches the end of the row, then create a horizontal scrollbar. Each row should take up exactly 1 line. How do I do this? If I add css style onto the td element for currItem and play around with width and height, I can get it the way I want, but it depends on the screen size. Is there a way to do it to satisfy any size browser window? style="width:200px; height: 50px;display: block; overflow-x: scroll; <table class="table table-striped"> <tr ng-repeat="currItem in allItems"> <td>{{currItem}}<
I can't seem to reset the default state; how do I do that? I tried this but all it does is add state to state and calls it undefined. const initialState = { name: null, coins: 0, image: null, }; export default function reducer(state = initialState, action = {}) { switch (action.type) { case types.ADD_GROUP_COINS: return { ...state, coins: state.coins + action.coins }; case types.DELETE_GROUP: return { state: undefined }; default: return state; } }
I am trying to convert html to pdf. Is there any custom directive, which i can use.I also tried to use angular-save-html-to-pdf from npm site but there is some error while using. Is there any other way to convert html to css in angular js.
I want to see the logs from my Docker Swarm service. Not only because I want all my logs to be collected for the usual reason, but also because I want to work out why the service is crashing with "task: non-zero exit (1)". I see that there is work to implement docker logs in the pipeline, but there a way to access logs for production services? Or is Docker Swarm not ready for production wrt logging?
I am running Python 3.5.2 on a Macbook OSX 10.2.1 (Sierra). While attempting to run some code for the Titanic Dataset from Kaggle, I keep getting the following error: NotFittedError Traceback (most recent call last) in () 6 7 # Make your prediction using the test set and print them. ----> 8 my_prediction = my_tree_one.predict(test_features) 9 print(my_prediction) 10 /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sklearn/tree/tree.py in predict(self, X, check_input) 429 """ 430 --> 431 X = self._validate_X_predict(X, check_input) 432 proba = self.tree_.predict(X)
I noticed not all the Javascript functions are constructors. var obj = Function.prototype; console.log(typeof obj === 'function'); //true obj(); //OK new obj(); //TypeError: obj is not a constructor Question 1: How do I check if a function is a constructor so that it can be called with new keyword? Question 2: When I create a function, is it possible to make it NOT a constructor?
I installed IntelliJ IDEA 2016.3 Community Edition and I created a simple Java class containing a main method that just prints a message. When I run that "program", the following window appears: Windows Firewall has blocked some features of this program Window Firewall has blocked some features of IntelliJ IDEA on all public and private networks. If I go to File > Settings... > Appeareance & Behavior > System Settings > Usage Statistics > Allow sending usage statistics to JetBrains s.r.o is unchecked. If I go to C:\Users\myusername\.IdeaIC2016.3\system\log: build-log\build.log - nothing seems
I use google cloud storage to read files from it. It's working when I build it from within Eclipse. But when I build it with maven, it compiles but fails at runtime. When I build with eclipse no runtime exceptions occur. I need help, see the exception after the build is conducted via Maven: java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createUnstarted()Lcom/google/common/base/Stopwatch; at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156) at com.google.appengine.tools.cloudstorage.GcsServiceImpl.getMetadata(GcsServiceImpl.java:132) Here is
i am having a problem dealing with this error, when i run my app it stops and shows error in logcat: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.os.BuildCompat" on path: DexPathList[[zip file "/data/app/homeseek.app.android.capstonehomeseek-2/base.apk"],nativeLibraryDirectories=[/data/app/homeseek.app.android.capstonehomeseek-2/lib/arm64, /vendor/lib64, /system/lib64]] full error: FATAL EXCEPTION: main 11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: Process: homeseek.app.android.capstonehomeseek, PID: 1919 11-29 13:00:24.538 1919-1919/? E/AndroidRuntime:
I'm trying to use Bootbox confirmation. I started testing it with bootbox.alert(), but it's not working. I confirm that I have bootstrab.css, bootstrab.js, jquery.js and -bootbox.min.js included in the web header: <link href="{% static "css/patients.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> <link href="{% static "css/jquery-ui.min.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap-datetimepicker.min
trying to use Bootbox confirmation but i start testing it with bootbox.alert(), but it's not working. I confirm that i have bootstrab.css, bootstrab.js, jquery.js and -bootbox.min.js included in the web header: <link href="{% static "css/patients.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> <link href="{% static "css/jquery-ui.min.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap-datetimepicker.min.cs
I have successfully build the version 3.0.3 of the MongoDB driver for C++ on Windows 10 with CMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver But I don't know how to set up a project in Visual Studio 2015 that can use this driver. I found this post here, but I don't understand the exact solution. I tried the following properties but failed: C/C++ > Additional Include Directories: C:\mongo-c-driver\include\libbson-1.0;C:\mongo-c-driver\include\libmongoc-1.0;C:\mongo-cxx-driver\include\bsoncxx\v_noabi;C:\mongo-cxx-driver\include\mongocxx\v_noabi;%(AdditionalIncludeDirectories) Linker > Additional Librar
I have a project with dependencies in package.json. When I install with npm install, I get packages installed in ~/.npm but not in the current folder's node_modules. NPM is creating node_modules, but not installing packages there. There's a .staging folder within node_modules, which contains all of the packages for the projects, but they're not being moved out after retrieval. Using Node v6.9.1 / npm v3.10.8. There aren't any other projects/node_modules installed in directories higher than the current one, though there is a package.json in the parent directory as well. No node_modules director