2018-10-22         Sophia

Stopping and Starting read / copy on binary file

So i'm attempting to copy a binary file up to a certain point...stop...perform some operations, then copy the remaining contents from the original binary out to my new binary. However when i perform my second read operation, my read buffer is empty. Can someone point out what I'm doing wrong here? Thanks so much...ifstream fin;fin.open(argv[1], ios::in | ios::binary);ofstream fout("test.bin", ios::out | ios::binary);int position = getPositionX();fin.seekg(position);streamoff initialCopyLength = fin.tellg();char * readBuffer = new char[initialCopyLength];fin.seekg(0, fin.beg...

 c++                     1 answers                     25 view
 2018-10-22         Sophia

Terraform destroy to get error response from AWS API?

AWS wont let you delete a VPC if there are instances in it.If I create a non tf managed instance in a vpc (that I did create with terraform) and then do a terraform destroy tf hangs waiting.I can then go to aws console and manually delete the vpc and get a useful response from aws as to why it cant be deleted and a list of the offending resources i can manually delete.Is there a verbose switch where terraform would spit out these messages from the AWS API? I assume the AWS API returns this info, but perhaps it only does that when deleting via the console?I havent found any ...

 amazon-web-services                     1 answers                     94 view
 2018-10-22         Sophia

How to check an object has the type 'dict_items'?

In Python 3, I need to test whether my variable has the type 'dict_items', so I tried something like that :>>> d={'a':1,'b':2}>>> d.items()dict_items([('a', 1), ('b', 2)])>>> isinstance(d.items(),dict_items)Traceback (most recent call last): File "<stdin>", line 1, in <module>NameError: name 'dict_items' is not definedBut dict_items is not a known type. it is not defined in types module neither. How can I test an object has the type dict_items (without consuming data) ? You can use collections.abc:from collections import abcisinsta...

 python                     1 answers                     42 view
 2018-10-22         Sophia

Accuracy doesn't change over all epochs with multi-class classification

I am trying to train a model to solve multi-class classification problem.I've got a problem that is training accuracy and validation accuracy doesn't change over all epochs. Like this:Train on 4642 samples, validate on 516 samplesEpoch 1/100- 1s - loss: 1.7986 - acc: 0.4649 - val_loss: 1.7664 - val_acc: 0.4942Epoch 2/100- 1s - loss: 1.6998 - acc: 0.5017 - val_loss: 1.7035 - val_acc: 0.4942Epoch 3/100- 1s - loss: 1.6956 - acc: 0.5022 - val_loss: 1.7000 - val_acc: 0.4942Epoch 4/100- 1s - loss: 1.6900 - acc: 0.5022 - val_loss: 1.6954 - val_acc: 0.4942Epoch 5/100- 1s - loss: 1....

 machine-learning                     1 answers                     24 view
 2018-10-22         Sophia

install "atom-beautify@0.33.0" failed

I have installed the atom-beautify packages and I received this notify: gyp info it worked if it ends with okgyp info using node-gyp@3.4.0gyp info using node@6.9.5 | win32 | x64gyp http GET https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gzgyp http 200 https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gzgyp WARN install got an error, rolling back installgyp ERR! install error gyp ERR! stack Error: read ECONNRESETgyp ERR! stack at exports._errnoException (util.js:1022:11)gyp ERR! stack at TLSWrap.onread (net.js:569:26)gyp ERR! System Windows_NT 10.0.1...

 package                     1 answers                     38 view
 2018-10-22         Sophia

Would it be possible to scrap data from Airbnb directly into a Google Sheet?

I'm trying to build a super simple Google Sheet dashboard comparing the prices at D+7 and D+30 in real-time of specific listings/rooms that are both on Airbnb and Booking.com.On the Booking.com side, it was super easy : I just created a formula concatenating the URL with the check-in/check-out dates, number of guests and trip duration as parameters and using the =IMPORTXML function and the proper class, I was able to automatically retrieve the price.It is more difficult on Airbnb, as the price is dynamic(see here: https://www.airbnb.com/rooms/25961741). When I use what I th...

 google-apps-script                     1 answers                     74 view
 2018-10-22         Sophia

jquery event handlers within a loop

I currently use javascript to create a html table. When the user clicks on a button. It appends a tr to the table. Inside the tr I also append a select2 <select> element. The id of the select element is accompanied by a number that increments.So the select element on the first row has an id of item-project-no-0 and the element on the second row has an id of item-project-no-1. So on and so forth. But now, I need to register the event listener for all the select elements in that table which is dynamically generated. Something like this: $('#item-project-no-' + x).on...

 javascript                     2 answers                     12 view
 2018-10-22         Sophia

Hive Error: FAILED: SemanticException [Error 10017]: Line 4:28 Both left and right aliases encountered in JOIN 'status_cd'

I have the following query in HIVE which throwing "FAILED: SemanticException [Error 10017]: Line 4:28 Both left and right aliases encountered in JOIN 'status_cd'" Error.Whole query seems to be correct, I executed similar query in MYSQL also which is working fine. Only in Hive it throwing error.Is there any limitation in HIVE which causing the problem.Please look into below query, Any help will be appreciated.INSERT INTO TABLE stg_dim_gate_package SELECT `16_1693_418`.`package_id` AS `6896_package_id`, `16_1723_432`.`status_cd` AS `7075_status_cd`, `16_1723_432`.`lo...

 mysql                     3 answers                     6 view
 2018-10-22         Sophia

Consistency of ElementTree elements

I am using xml to describe bounding boxes and intend to filter out some elements of the xml files. A typical xml might look like:<annotation> <folder>original2</folder> <filename>beach146.jpg</filename> <path>/home/train/original/beach146.jpg</path> <source> <database>Unknown</database> </source> <size> <width>800</width> <height>533</height> <depth>3</depth> </size> <segmented>0</segmented> <...

 python                     1 answers                     71 view
 2018-10-22         Sophia

SQL error reading a value from a text file to use in WHERE clause and YYYY-DD-MM localized DATETIME

There is a file C: /date.txt, there is only one date stored here, for example 02-08-2018.How do I in SQL select the data that is greater than this date?if I so will write a requestSELECT Dt, col,col2, col3...FROM mytab1 WHERE Dt> C: /date.txtHow do I make the condition > C: /date.txt, and not > 02-08-2018?Edit:DECLARE @FileContents VARCHAR(MAX)SELECT @FileContents = BulkColumnFROM OPENROWSET(BULK 'C:\sql\rscript\SQL_MaxDate.txt', SINGLE_BLOB) x;SELECT t.*FROM (SELECT CustomerName, [ItemRelation], [DocumentNum], [DocumentYear], CustomerType FROM ...

 sql                     2 answers                     83 view
 2018-10-22         Sophia

KafkaConsumer.close() Why?

I am here asking about closing a kafka consumer. Do I need to close kafka consumer even if the using thread exits? Would not closing it leak resources by any change? Here is a code example: public class MyThread extends Thread{ private KafkaConsumer<String, Message> kafkaConsumer; @Override public void run() { kafkaConsumer = initConsumer(); while(true){ kafkaconsumer.poll(1000000) //Code goes here. } }}Does the kafkaConsumer close when MyThread exits using System.exit? Quoting from "Kafka - the definitive guid...

 java                     1 answers                     58 view
 2018-10-22         Sophia

Remote git branch checkout from within a git subtree

We've been using Heroku's review apps to help us better QA our Github issues but recently we switched from one app to two (1 backend, 1 frontend). Often times an issue in one repo will have two PRs (one from each repo) and both will be needed to test the issue.This has caused me to rethink how we get a single "review app" to work with two separate repos and still have a review app that is unique for each individual Github issue we have.My current plan is to use Gitlab's review apps feature. I'll leave out some of the details for brevity but the problem I'm struggling with r...

 git                     1 answers                     39 view
 2018-10-22         Sophia

Unable to change GitLab timezone

I am having a little bit of an issue trying to find where to change the GitLab timezone for my profile through the web UI.Looking at some other posts and documentation which mentioned there was an option between Public email and Preferred language, this option I am unable to find under my profile settings.Hopefully someone else has experienced the same issue, and found a solution to this, that could help point me in the right direction If this is not exposed by the GitLab UI, you would need to modify the GitLab configuration itself (config/gitlab.rb, or for Omnibus: /et...

 timezone                     1 answers                     48 view
 2018-10-22         Sophia

How can I modify the Location of my web site in Windows azure?

When configured my website on windows azure, I chose Est of USA for the Web site, and North Europe for database.As you can guess, the performances are very bad, most of my users are in Europe.Looking on msdn, they said it is not possible to change database of location.So how can I change the location of my web site? You need to redeploy your website code to a new Web Site, located in Europe. If you're using git, this should be as simple as setting up a new remote location to the new Web Site and re-doing a push.In the future: Always deploy website + database in the same ...

 azure                     1 answers                     93 view
 2018-10-22         Sophia

Display the chosen selected CF7 from admin on Woocommerce single products

For a custom WooCommerce theme I'm trying to achieve the following:BackendUser can select if product can have a product enquiry formUser can select a CF7 form from within a single product from a dropdown.FrontendSingle product page displays standard product information but if the "product enquiry form" is checked then the single product page displays a button that says "Product Enquiry"When that button is clicked a CF7 form is displayed that contains product attributes (sizes,colors,etc)Example of what I'm trying to achieve.http://www.blumeta.nl/tuininrichting/houtopslag/co...

 php                     1 answers                     18 view
 2018-10-22         Sophia

how to create a new type with custom bytes in C?

Is it possible to create a new type in C that uses the amount of bytes that I decide? I know that an int takes 4 bytes, but I need to work with very small numbers so allocating 4 bytes with malloc for every int is a bit of a waste, i was thinking of creating a new type for numbers that takes only 1 byte...if it's possible You can just use char instead of intOr, you can create structure, it is the most commonly used custom data type in C.For example:struct customStructure { char c;}; [XXX] Is it possible to create a new type in C that uses the amount of bytes that ...

 c                     5 answers                     128 view

Page 1 of 144  |  Show More Pages:  Top Prev Next Last