problem
stringlengths
26
131k
labels
class label
2 classes
Configuring Cypress, cypress-react-unit-test, and React : <p>I want to test our React components independently using the package <code>cypress-react-unit-test</code>. After several days, I have been unable to get it to work with the existing React Webpack configuration. I get the error: <code>TypeError: path argument is required to res.sendFile</code> when I open the file through Cypress' window.</p> <p>I am using the file from their example repo for testing: <a href="https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/unit-testing__react/greeting.jsx" rel="noreferrer">https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/unit-testing__react/greeting.jsx</a></p> <p>We do use TypeScript, but I wanted to get this working first.</p> <p>I have tried overwriting <code>path</code> as it is defaulting to <code>undefined</code>, but I'm getting the same error.</p> <pre><code>{ options: { path: "/my/home/dir/" } } </code></pre> <p>In my <code>cypress/plugins/index.js</code> file I have:</p> <pre><code>const wp = require("@cypress/webpack-preprocessor"); const webpackConfig = require("../../node_modules/react-scripts/config/webpack.config")("development"); module.exports = on =&gt; { const options = { webpackOptions: webpackConfig }; on("file:preprocessor", wp(options)); }; </code></pre> <p>I'm obviously missing something, but I don't know Webpack well enough. I would be grateful for any pointers! Thanks!</p>
0debug
Tensorflow Precision / Recall / F1 score and Confusion matrix : <p>I would like to know if there is a way to implement the different score function from the scikit learn package like this one :</p> <pre><code>from sklearn.metrics import confusion_matrix confusion_matrix(y_true, y_pred) </code></pre> <p>into a tensorflow model to get the different score.</p> <pre><code>with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as sess: init = tf.initialize_all_variables() sess.run(init) for epoch in xrange(1): avg_cost = 0. total_batch = len(train_arrays) / batch_size for batch in range(total_batch): train_step.run(feed_dict = {x: train_arrays, y: train_labels}) avg_cost += sess.run(cost, feed_dict={x: train_arrays, y: train_labels})/total_batch if epoch % display_step == 0: print "Epoch:", '%04d' % (epoch+1), "cost=", "{:.9f}".format(avg_cost) print "Optimization Finished!" correct_prediction = tf.equal(tf.argmax(pred, 1), tf.argmax(y, 1)) # Calculate accuracy accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) print "Accuracy:", batch, accuracy.eval({x: test_arrays, y: test_labels}) </code></pre> <p>Will i have to run the session again to get the prediction ?</p>
0debug
static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx) { int result, i, p, tile_size, pic_size_indx, mb_size, blk_size; int quant_mat, blk_size_changed = 0; IVIBandDesc *band, *band1, *band2; IVIPicConfig pic_conf; ctx->gop_flags = get_bits(&ctx->gb, 8); ctx->gop_hdr_size = (ctx->gop_flags & 1) ? get_bits(&ctx->gb, 16) : 0; if (ctx->gop_flags & IVI5_IS_PROTECTED) ctx->lock_word = get_bits_long(&ctx->gb, 32); tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0; if (tile_size > 256) { av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size); return -1; } pic_conf.luma_bands = get_bits(&ctx->gb, 2) * 3 + 1; pic_conf.chroma_bands = get_bits1(&ctx->gb) * 3 + 1; ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n", pic_conf.luma_bands, pic_conf.chroma_bands); return -1; } pic_size_indx = get_bits(&ctx->gb, 4); if (pic_size_indx == IVI5_PIC_SIZE_ESC) { pic_conf.pic_height = get_bits(&ctx->gb, 13); pic_conf.pic_width = get_bits(&ctx->gb, 13); } else { pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2; pic_conf.pic_width = ivi5_common_pic_sizes[pic_size_indx * 2 ] << 2; } if (ctx->gop_flags & 2) { av_log(avctx, AV_LOG_ERROR, "YV12 picture format not supported!\n"); return -1; } pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2; pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2; if (!tile_size) { pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_width = pic_conf.pic_width; } else { pic_conf.tile_height = pic_conf.tile_width = tile_size; } if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) { result = ff_ivi_init_planes(ctx->planes, &pic_conf); if (result) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n"); return -1; } ctx->pic_conf = pic_conf; blk_size_changed = 1; } for (p = 0; p <= 1; p++) { for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) { band = &ctx->planes[p].bands[i]; band->is_halfpel = get_bits1(&ctx->gb); mb_size = get_bits1(&ctx->gb); blk_size = 8 >> get_bits1(&ctx->gb); mb_size = blk_size << !mb_size; blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size; if (blk_size_changed) { band->mb_size = mb_size; band->blk_size = blk_size; } if (get_bits1(&ctx->gb)) { av_log(avctx, AV_LOG_ERROR, "Extended transform info encountered!\n"); return -1; } switch ((p << 2) + i) { case 0: band->inv_transform = ff_ivi_inverse_slant_8x8; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_zigzag_direct; break; case 1: band->inv_transform = ff_ivi_row_slant8; band->dc_transform = ff_ivi_dc_row_slant; band->scan = ff_ivi_vertical_scan_8x8; break; case 2: band->inv_transform = ff_ivi_col_slant8; band->dc_transform = ff_ivi_dc_col_slant; band->scan = ff_ivi_horizontal_scan_8x8; break; case 3: band->inv_transform = ff_ivi_put_pixels_8x8; band->dc_transform = ff_ivi_put_dc_pixel_8x8; band->scan = ff_ivi_horizontal_scan_8x8; break; case 4: band->inv_transform = ff_ivi_inverse_slant_4x4; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_ivi_direct_scan_4x4; break; } band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || band->inv_transform == ff_ivi_inverse_slant_4x4; if (!p) { quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0; } else { quant_mat = 5; } if (band->blk_size == 8) { band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0]; band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0]; band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0]; band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0]; } else { band->intra_base = ivi5_base_quant_4x4_intra; band->inter_base = ivi5_base_quant_4x4_inter; band->intra_scale = ivi5_scale_quant_4x4_intra; band->inter_scale = ivi5_scale_quant_4x4_inter; } if (get_bits(&ctx->gb, 2)) { av_log(avctx, AV_LOG_ERROR, "End marker missing!\n"); return -1; } } } for (i = 0; i < pic_conf.chroma_bands; i++) { band1 = &ctx->planes[1].bands[i]; band2 = &ctx->planes[2].bands[i]; band2->width = band1->width; band2->height = band1->height; band2->mb_size = band1->mb_size; band2->blk_size = band1->blk_size; band2->is_halfpel = band1->is_halfpel; band2->intra_base = band1->intra_base; band2->inter_base = band1->inter_base; band2->intra_scale = band1->intra_scale; band2->inter_scale = band1->inter_scale; band2->scan = band1->scan; band2->inv_transform = band1->inv_transform; band2->dc_transform = band1->dc_transform; band2->is_2d_trans = band1->is_2d_trans; } if (blk_size_changed) { result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width, pic_conf.tile_height); if (result) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate internal structures!\n"); return -1; } } if (ctx->gop_flags & 8) { if (get_bits(&ctx->gb, 3)) { av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n"); return -1; } if (get_bits1(&ctx->gb)) skip_bits_long(&ctx->gb, 24); } align_get_bits(&ctx->gb); skip_bits(&ctx->gb, 23); if (get_bits1(&ctx->gb)) { do { i = get_bits(&ctx->gb, 16); } while (i & 0x8000); } align_get_bits(&ctx->gb); return 0; }
1threat
How i solve this probelm in my ubuntu commond line ? i want to push my data to github but occur some error plese someone consider that : in my commond line not generate pull commond. therefore please consider this question and i'm new to here This is Linux/ubuntu os and when i pull my web site into github occor some error fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using git remote add <name> <url> and then push using the remote name git push <name> i expect the exact solution for my question
0debug
What does "gcc -lm -o [executable_name] [file_name].c" mean? : <p>Specifically, what does the "-lm" mean, and is it required to include that? Is there a "dictionary" online that will explain all of these command abbreviations like "-lm"?</p>
0debug
Clean Architecture - how to address database transactions? : <p>In 'clean architecture' the interactors (use cases) are responsible for defining busines logic. Most of the examples define use cases in such a way:</p> <pre><code>public MyUseCase() { public boolean execute(...) { int id = repository.insert(a) if(id &gt; 0) { b.aId= id; repository.insert(b); ... } } } </code></pre> <p>Interactors use mostly simple CRUD like operations or queries on repository. The above example is synchronous for the case of simplicity but you can find repos with the same approach using asynchronous solutions like callbacks or rxjava.</p> <p>But what about use case inegrity. For instance, you can't be 100% sure that after inserting <code>a</code> it will still be there when you insert <code>b</code>. What if after inserting <code>a</code> you get some RepositoryException while inserting <code>b</code>.</p> <p>All the repos I've seen so far don't take it into account, so my question is:</p> <p>What's the solution of the above problem in clean architecture?</p>
0debug
creat HDInsight Hadoop Cluster with Data Lake Store : I am new user of azure,i want to connect a data lake with HDinsight, I followed the instructions on azure documentation, but when i try to chose to connect a created data lake with HDinsight, i have this error Invalid emplacement. Can you help me please ? [Error hdinsight][1] [1]: https://i.stack.imgur.com/Q1aQw.png
0debug
int virtio_load(VirtIODevice *vdev, QEMUFile *f) { int num, i, ret; uint32_t features; uint32_t supported_features = vdev->binding->get_features(vdev->binding_opaque); if (vdev->binding->load_config) { ret = vdev->binding->load_config(vdev->binding_opaque, f); if (ret) return ret; } qemu_get_8s(f, &vdev->status); qemu_get_8s(f, &vdev->isr); qemu_get_be16s(f, &vdev->queue_sel); qemu_get_be32s(f, &features); if (features & ~supported_features) { fprintf(stderr, "Features 0x%x unsupported. Allowed features: 0x%x\n", features, supported_features); return -1; } if (vdev->set_features) vdev->set_features(vdev, features); vdev->guest_features = features; vdev->config_len = qemu_get_be32(f); qemu_get_buffer(f, vdev->config, vdev->config_len); num = qemu_get_be32(f); for (i = 0; i < num; i++) { vdev->vq[i].vring.num = qemu_get_be32(f); vdev->vq[i].pa = qemu_get_be64(f); qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); if (vdev->vq[i].pa) { virtqueue_init(&vdev->vq[i]); } num_heads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; if (num_heads > vdev->vq[i].vring.num) { fprintf(stderr, "VQ %d size 0x%x Guest index 0x%x " "inconsistent with Host index 0x%x: delta 0x%x\n", i, vdev->vq[i].vring.num, vring_avail_idx(&vdev->vq[i]), vdev->vq[i].last_avail_idx, num_heads); return -1; } if (vdev->binding->load_queue) { ret = vdev->binding->load_queue(vdev->binding_opaque, i, f); if (ret) return ret; } } virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); return 0; }
1threat
Inserting html tags on image at specific positions in html and css : <p>I have this image Map.png. i want to write text these location boxes using html. so that i can change it dynamically. I just do not know how to that.. please give me a direction. <a href="https://i.stack.imgur.com/rrFzo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rrFzo.png" alt="enter image description here"></a></p>
0debug
Retrieving data from Firebase Android Studio : My Database looks like this [Firebase Databse][1] [1]: https://i.stack.imgur.com/gab3H.png The code of my activity is this public class FirebaseActivity extends AppCompatActivity { ListView lv; private FirebaseDatabase database; private DatabaseReference myRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_firebase); final List<String> glocations = new ArrayList<String>(); lv = (ListView) findViewById(R.id.lv); database = FirebaseDatabase.getInstance(); myRef = database.getReference(); myRef.child("Users").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Iterable<DataSnapshot> children = dataSnapshot.getChildren(); for (DataSnapshot child: children){ String data = child.getValue(String.class); glocations.add(data); } } @Override public void onCancelled(DatabaseError databaseError) { } }); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,glocations); lv.setAdapter(adapter); } } Now whenever I try to open the activity from the settings menu on the main activity my application crashes. All I want it to do is show the Latitude, the longitude and the timestamps each time the user changes them in a listview by using a simple list with the array adapter. This is a different activity and not the main one. The main one works perfectly. I've watched countless videos and I cannot understand my mistake.
0debug
If I have N distinct points, how many different ways can I construct a set of distinct points? : <p>Lets say that I have 2 groups of distinct points. I'm trying to find all the possible different ways to travel between these points. In one group we have P1,P2 and in the other group P3,P4. Any point can be a starting point and can only end in the opposing group. I want to find a way to formalize how to find all combinations of these points. Each group can have an N distinct number of points, but I chose for each group to have 2 points. These are all the possible set of points from these two groups: </p> <ul> <li>Set 1: P1->P2->P3->P4</li> <li>Set 2: P1->P2->P4->P3</li> <li>Set 3: P2->P1->P3->P4</li> <li><p>Set 4: P2->P1->P4->P3 </p></li> <li><p>Set 5: P3->P4->P2->P1</p></li> <li>Set 6: P3->P4->P1->P2</li> <li>Set 7: P4->P3->P2->P1</li> <li>Set 8: P4->P3->P1->P2</li> </ul> <p>The "->" denotes a path traveled. Therefore I have 8 distinct paths traveled. How do I formalize this though? I've tried thinking of exponents, and factorials... I'm a bit stuck right now.</p>
0debug
static void powerpc_get_compat(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { char *value = (char *)""; Property *prop = opaque; uint32_t *max_compat = qdev_get_prop_ptr(DEVICE(obj), prop); switch (*max_compat) { case CPU_POWERPC_LOGICAL_2_05: value = (char *)"power6"; break; case CPU_POWERPC_LOGICAL_2_06: value = (char *)"power7"; break; case CPU_POWERPC_LOGICAL_2_07: value = (char *)"power8"; break; case 0: break; default: error_report("Internal error: compat is set to %x", *max_compat); abort(); break; } visit_type_str(v, name, &value, errp); }
1threat
Swift prorgamming IOS : <p>How to create an attributed text that can link to a particular URL and underline only the clickable string. How to use the UIAttributed text such that a tap on it links the current view controller to a particular URL.</p>
0debug
Running a shell script in PHP how do I insert the output data to MYSQL database? : I am trying to run a shellscript from PHP inline code and the ouptut of that script should be inserted into MYSQL table. How can that be done?
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
Trying to get property of non-object in yii : <p>I'm using yii framework and I'm new in yii and can't understand the problem in this code, it is giving error in this code and I just attached the image of my code</p> <p><a href="https://i.stack.imgur.com/ZTANB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZTANB.png" alt="image1"></a></p> <p>and when I just try to <code>echo '&lt;pre&gt;';print_r($role);echo '&lt;/pre&gt;';</code> it just print code like this</p> <p><a href="https://i.stack.imgur.com/Upc7A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Upc7A.png" alt="image2"></a></p> <p>can't understand why this is giving error.</p>
0debug
mysql dont repaet : I have in the table a field named chapter and the chapter is usually repeated in the entry, but I want to not repeat in the output Vjrj name of the chapter once and under it have the names registered
0debug
static void qvirtio_9p_stop(void) { qtest_end(); rmdir(test_share); g_free(test_share); }
1threat
How to calculate top5 accuracy in keras? : <p>I want to calculate top5 in imagenet2012 dataset, but i don't know how to do it in keras. fit function just can calculate top 1 accuracy.</p>
0debug
Maze won't backtrack [Python] : There are a couple of maze questions similar to this one but none of them ever really go into the why it won't work. This is for an assignment for my summer class. I don't need precise answers. I just need to know why this particular thing doesn't work. This is the bit of my class Maze that I need help with. ysize in my example is 10 xsize is 10 xend is 20 (changing it to 19 messes with the results and doesn't draw anything) yend is 10 (changing it to 9 does this too) ''' def solve(self, x, y): if y > (self.ysize) or x > (self.xsize): print("1") return False if self.maze[y][x] == self.maze[self.yend][self.xend]: print("2") return True if self.maze[y][x] != " ": print("3") return False self.maze[y][x] = "o" # MARKING WITH o for path already taken. if self.solve(x+1,y) == True: return True elif self.solve(x,y+1) == True: return True elif self.solve(x-1,y) == True: return True elif self.solve(x,y-1) == True: return True self.maze[y][x] = " " # ELSE I want it to be replaced with space return False ''' The expected result is the solved maze with a trailing path of "o" from 1 1 to 9 19 as per the current file. However what I get is a path from 1 1 to 13 4 (x)(y) format. There is a dead end around 13 4 and it won't backtrack to go up and left. Sorry if it doesn't make that much sense but copy pasting the drawing doesn't turn out well.
0debug
Is it possible to resize vuetify components? : <p>I recently use <strong>Vuetify</strong> to implement some UI designs. However, I found the default input component (such as v-text-field, v-select) are too large. I found that I can adjust the width of them, but for the height and font size, how can I change them?</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
asterisk stream asr plugin : <p>Is there any plugin/extension for Asterisk that is able to make ASR(automatic speech recognition) in stream mode and is able to use Google/Yandex speech kits? So, speech should be recognized in "online" mode, during the call. Russian language and language detection(at leat russian|not russian) should be supported. Main idea is that no programming should be required. And yes, I've heard about MRCP, but nothing clear about how to use it with Google/Yandex. And it should be free/open source. Thanks!</p>
0debug
Subclassing a UITableViewCell subclass and still use the existing Xib file : What is the proper way to *subclass* an existing *sublass of UITableViewCell* that has an attached Xib file. How do I subclass the UITableViewCell subclass and still use the Xib in the new class?
0debug
brute force Structure code in c# for bus reservation : I'm working on bus ticket reservation system. I have a problem in the booking module. Say we have bus a route starts from "A" to "D" via "B" & "C" The bus starts from "A" then reach "B", then "C" and final destination is "D". Assume some one is reserving seat no "1" for "B" to "C", this seat no should not be available for the person who is searching for a seat to travel from "A" to "D" or "B" to "D" but the same seat should be available for "A" to "B" or "C" to "D" Example in Summary Seat No 1 is Reserved for "B" to "C" Seat No 1 should not be available for "A"-"D" Seat No 1 should not be available for "B"-"D" Seat No 1 should not be available for "B"-"C" Seat No 1 should be available for "A" to "B" Seat No 1 should be available for "C" to "D" Could you please if there is already an algorithm or dotnet c# code to solve this problem. Thanks in advance
0debug
static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector, MSIMessage msg) { VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); VirtQueue *vq = virtio_vector_first_queue(vdev, vector); int ret, index, unmasked = 0; while (vq) { index = virtio_get_queue_index(vq); if (!virtio_queue_get_num(vdev, index)) { break; } ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg); if (ret < 0) { goto undo; } vq = virtio_vector_next_queue(vq); ++unmasked; } return 0; undo: vq = virtio_vector_first_queue(vdev, vector); while (vq && --unmasked >= 0) { index = virtio_get_queue_index(vq); virtio_pci_vq_vector_mask(proxy, index, vector); vq = virtio_vector_next_queue(vq); } return ret; }
1threat
Dependant NSURLConnections : All, In my project i have a service call based on the response we need to pass it to other service call and get the Response and it must be a Synchronous call. We can try in One way where Creating a NSURLConnection and having delegate menthos and in Didfinish we can do. Instead of it can we use NSoperationQueue and do it, How can we do? Any sample
0debug
how to properly use of sed in linux : <p>I have a folder in present working dir with a file</p> <pre><code>./folder/sample </code></pre> <p>The contents of the file were having some export commands and # lines, how do i get the output removing all those lines, i don't know how to use Sed here its pretty confusing.</p> <p>content inside the sample file is like this</p> <pre><code>#helloworld export a=foo export b=hello #helloworld2 export c=king export d=queen </code></pre> <p>the expected output should remove #(commented lines), export words and empty lines, the output should be like this. </p> <pre><code>a=foo b=hello c=king d=queen </code></pre> <p>and also it should rename the file in the same folder on the fly.</p> <pre><code>./folder/rename-sample </code></pre> <p>Please let me know how to achieve this using proper SED command.</p>
0debug
How to cast an int array to a byte array in c++ : <p>hey i would like to know how you could cast an Int array in C++ to an byte array and what would be the declaration method. I would appreciate if it is simpler and no use of pointers. thanks for the comments </p>
0debug
How to use Meteor : <p>I am a newbie to meteor, so can anyone help me out , how to use <code>meteor</code> for mobile application development. I am not getting relevant tutorials for it. I am currently working on Ubuntu 14.0 LTS</p> <p>Thanks in advance!!</p>
0debug
Pipe and Tap VS subscribe with ngxs : <p>I am playing around with pipe and subscribe. If I am using pipe with tap, nothing will log in console. If I am using subscribe, it's working. So what I am doing wrong?</p> <pre><code>import { Observable } from 'rxjs'; import { tap, take } from 'rxjs/operators'; this.store.select(state =&gt; state.auth.authUser).pipe( take(1), tap((data) =&gt; { //Not Working - no console output console.log('[Tap] User Data', data); }) ); this.store.select(state =&gt; state.auth.authUser).subscribe((data) =&gt; { // Working - user data output in console console.log('[Subscribe] User Data', data); }) </code></pre> <p>I am using RxJs 6, TypeScript and ngxs as store in Angular 6.</p>
0debug
No exception message in console : [enter image description here][1] [1]: https://i.stack.imgur.com/SwFQb.png when get the string of "dsadsdwqdwqqqqqqqqqqqq" in console,I am so surprised of finding that there are not IllegalArgumentException messages in console. And when I put the code of "throw new IllegalArgumentException(String.format("类型转换失败,需要格式[010-12345678],但格式是[%s]", source))" alone in @Test,I can find exception message in console. the last,I am so sorry for my poor English.
0debug
fread gets more chars than i ask in c while working with binary file : <p>i'm a beginner in C and in my internship i have to work with a binary file and i must read the information in a binary file, one information at a time, </p> <pre><code>int main() { FILE *ptr=fopen("C:\\Users\\Workstation\\Desktop\\TEST.MAILO","rb"); char header[65]; char CRLF[3]; char first40[41]; char rio[33]; char date_capture[9]; if (ptr==NULL){ printf("Erreur"); exit(EXIT_FAILURE); } fread(header, sizeof(char), 64, ptr); fread(CRLF, sizeof(char), 2, ptr); fread(first40,sizeof(char),40,ptr); fread(rio,sizeof(char),32,ptr); fread(date_capture,sizeof(char),8,ptr); printf("%s%s",header,CRLF); printf("%s|||%s|||",first40,rio); printf("%s||",date_capture); return 0; } </code></pre> <p>the problem is that in the last variable "date_capture" i ask for 8chars for the date but it gets more than 8</p> <p><strong>EIMG05050120170609007MADIMC0500014 0310000032050810011010358897200120007780|||007MAD00901020170609000109259941|||20170608■007MAD00901020170609000109259941||</strong></p> <p>it is supposed to print only 20170608 without the rest <strong>■007MAD00901020170609000109259941||</strong> please help me i looked everywhere i haven't found any problem like this. THANK YOU</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
how to scale kubernetes daemonset to 0? : <p>When the pod controlled by daemonset,Some error occur in the pod and it's state will be <code>CrashLoopBackOff</code>, I want to delete these pods but not delete the DaemonSet.</p> <p>So I want to scale daemonset to 0, as far as I known, DaemonSet Spec do not support the replica of the pod.</p> <p>How can I get there?</p>
0debug
How can we check the whole sql database for login username and password in mvc3 c# : I have more than one table in my sql server database.each table is for each users named developers, designers, users and so on.my home page contain a login screen.when user try to login with their username and password then it automatically check whether the username and password belongs to the database.if yes it redirect to a page else prompt an error.I need whole database check instead of one table because there is only one login page for all users.thanks
0debug
Android app: How do I make my app show up in audio output suggestions : <p>Example: When I click on attach audio button, I want my app to show in apps suggestion(along with sound recorder).</p>
0debug
C# to Java using the SAME Azure SDK, just different lanuages : I've been trying to convert this statement from C# to JAVA, without much luck. Yes I've search Azure, stackoverflow, and such, but can't find a good example of READDOCUMENT in java. UserInfo response = _DocumentClient.ReadDocument<UserInfo>(UriFactory.CreateDocumentUri(_DBConfiguration.DatabaseID, _DBConfiguration.DocumentCollectionId, pPhoneNumber)); Pointer to helpful documentation would be appreciated. This is as far as I've gotten: UserInfo returnUserInfo = null; try { //todo: document link is incorrect, but reference pPhoneNumber as key ResourceResponse<Document> response = _DocumentClient.readDocument(<<NEED To generate URI>>,null); if (response != null) { Document returnUserInfoDocument = response.getResource(); returnUserInfo = <<I have a document, but can't cast it to USERINFO>>; } } catch (DocumentClientException ex) { if (!ex.getError().getCode().equals("NotFound")) { throw ex; } } return returnUserInfo;
0debug
What happens when the Kubernetes master fails? : <p>I've been trying to figure out what happens when the Kubernetes master fails in a cluster that only has one master. Do web requests still get routed to pods if this happens, or does the entire system just shut down?</p> <p>According to the OpenShift 3 documentation, which is built on top of Kubernetes, (<a href="https://docs.openshift.com/enterprise/3.2/architecture/infrastructure_components/kubernetes_infrastructure.html" rel="noreferrer">https://docs.openshift.com/enterprise/3.2/architecture/infrastructure_components/kubernetes_infrastructure.html</a>), if a master fails, nodes continue to function properly, but the system looses its ability to manage pods. Is this the same for vanilla Kubernetes?</p>
0debug
How can I set breakpoints by the sourcefile line number in Delve? : <p>The title pretty much says it all. </p> <p>The only way I know how to set one is either during the runtime of the program or just before with <code>breakpoint main.main</code></p> <p>Is there a way I can do this by line number like <code>breakpoint ./otherfile.go:200</code>?</p>
0debug
How to make string pass from onclick to a function? : <p>My string is like this</p> <pre><code>sakjgbsd aksdg's ad asidg's iasudgbsb </code></pre> <p>but when i print the string in function it prints only</p> <pre><code> sakjgbsd aksdg </code></pre> <p>the part after (') is not printing</p> <p>here is how i send data</p> <pre><code>&lt;a href='#' data-status='" + data[i][col[j]] + "' " + "onclick='submit(this)'&gt;Click Here&lt;/a&gt; </code></pre> <p>here is Function</p> <pre><code>function submit(str) { var status = $(str).attr("data-status"); alert(status) } </code></pre>
0debug
trying to fix a code ms access : here is my code I keep getting the same error compile error: block if without end if here is my code that I am working with Private Sub Command1_Click() If IsNull(Me.txtusername) Then 'MsgBox "Please enter Username", vbInformation, "Username Required" If IsNull(Me.txtpassword) Then 'MsgBox "Please enter Password", vbInformation, "Password Required" Else 'processs the job If (IsNull(DLookup("[username]", "tbllogin info", "[username] ='" & Me.txtusername.Value & "' And password = '" & Me.txtpassword.Value & "'"))) Then MsgBox "login unsucessful" End If 'MsgBox "Login Succeddful" DoCmd.OpenForm "s-1 page" End Sub
0debug
static void handle_stream_probing(AVStream *st) { if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) { st->request_probe = AVPROBE_SCORE_EXTENSION; st->probe_packets = FFMIN(st->probe_packets, 14); } }
1threat
static int dxv_decompress_dxt5(AVCodecContext *avctx) { DXVContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; uint32_t value, op; int idx, prev, state = 0; int pos = 4; int run = 0; int probe, check; AV_WL32(ctx->tex_data + 0, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 8, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 12, bytestream2_get_le32(gbc)); while (pos + 2 <= ctx->tex_size / 4) { if (run) { run--; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { if (state == 0) { value = bytestream2_get_le32(gbc); state = 16; } op = value & 0x3; value >>= 2; state--; switch (op) { case 0: check = bytestream2_get_byte(gbc) + 1; if (check == 256) { do { probe = bytestream2_get_le16(gbc); check += probe; } while (probe == 0xFFFF); } while (check && pos + 4 <= ctx->tex_size / 4) { prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; check--; } continue; break; case 1: run = bytestream2_get_byte(gbc); if (run == 255) { do { probe = bytestream2_get_le16(gbc); run += probe; } while (probe == 0xFFFF); } prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; case 2: idx = 8 + bytestream2_get_le16(gbc); if (idx > pos || (unsigned int)(pos - idx) + 2 > ctx->tex_size / 4) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; case 3: prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; } } CHECKPOINT(4); if (pos + 2 > ctx->tex_size / 4) if (op) { if (idx > pos || (unsigned int)(pos - idx) + 2 > ctx->tex_size / 4) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { CHECKPOINT(4); if (op && (idx > pos || (unsigned int)(pos - idx) + 2 > ctx->tex_size / 4)) if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; CHECKPOINT(4); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } } return 0; }
1threat
int ff_unlock_avcodec(const AVCodec *codec) { if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; av_assert0(ff_avcodec_locked); ff_avcodec_locked = 0; atomic_fetch_add(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
1threat
cannot connect to mysqldb, php : Hello I trying to connect mysql database using mircloud host service but it does not connect I tried to connect locally using phpMyAdmin but still give me this error this is my connect code.
0debug
High Presicion Random Double Numbers : This is a follow up question on an answer on this page: [How to generate random double numbers with high precision in C++?][1] #include <iostream> #include <random> #include <iomanip> int main() { std::random_device rd; std::mt19937 e2(rd()); std::uniform_real_distribution<> dist(1, 10); for( int i = 0 ; i < 10; ++i ) { std::cout << std::fixed << std::setprecision(10) << dist(e2) << std::endl ; } return 0 ; } The answer works fine but I had a hard time to reliaze how to put the output of this code in a double variable instead of printing it on the STDOUT. Can anyone help with this? Thanks. [1]: http://stackoverflow.com/a/18131869/3199911
0debug
Swift 3 method to create utf8 encoded Data from String : <p>I know there's a bunch of pre Swift3 questions regarding NSData stuff. I'm curious how to go between a Swift3 <code>String</code> to a utf8 encoded (with or without null termination) to Swift3 <code>Data</code> object.</p> <p>The best I've come up with so far is:</p> <pre><code>let input = "Hello World" let terminatedData = Data(bytes: Array(input.nulTerminatedUTF8)) let unterminatedData = Data(bytes: Array(input.utf8)) </code></pre> <p>Having to do the intermediate <code>Array()</code> construction seems wrong.</p>
0debug
Pass PHP variable to Javascript won't work : <p>I have two different pages for my site, lets call them page1 and page2. On the first page I have a HTML form of which handles some information. Then I have a php document to process that information into a .txt file. Then I have an image on my page2, this image I would like to change depending on a specific variable. This variable is set in the php script, where it checks if a certain value is right then it will set this specific variable to either 1 or 2. Then as said on page2 I have this image I would like to change depending on whether the php variable is 1 or 2. This I am trying to do by getting the php variable through javascript on page2 and then displaying it first to make sure I am getting the right values. But when doing this I just get "null" and pretty much nothing really happens. It loads the page but doesn't display anything. Keep in mind when I am saying pages etc it is because the page1 is one HTML document, page2 is another HTML document and then of course the php function is a separate php document. </p> <h2>HTML page1 where the user would pick from a drop down menu</h2> <pre><code>&lt;div id="sKind"&gt; &lt;select border="0" size="1" name="produKind" id="cSK" data-selected="" required=""&gt; &lt;option value=""&gt;enter color&lt;/option&gt; &lt;option value="white"&gt;White&lt;/option&gt; &lt;option value="black"&gt;Black&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <h2>php file I am using to pass values and variables</h2> <pre><code>&lt;?php $field_skind = $_POST['produKind']; $imgShow = 1; if ($field_skind == white){ $imgShow = 1; } else if ($field_skind == black) { $imgShow = 2; } echo json_encode($imgShow); ?&gt; </code></pre> <h2>Code I am using on page2 html</h2> <pre><code>&lt;script&gt; var imgNumber = &lt;?php echo json_encode($imgShow)?&gt;; document.getElementById("insert").innerHTML = imgNumber; &lt;/script&gt; &lt;p id="insert"&gt;&lt;/p&gt; </code></pre>
0debug
department wise Sum of salary of employee with each employee details : <p>I Have following table which contains details of Employee</p> <pre><code>EmpId EmpName Mgr Salary Dept 1 Deepak 2 20000 1 2 Annu NULL 22000 1 3 Jai 2 19500 1 4 Jitendra 1 18000 2 5 Vaishali 1 18000 2 6 Philip 4 15000 3 </code></pre> <p>I wants to show salary of each dept with each employee details,if it repeats no issues as shown below</p> <pre><code>EmpId EmpName Mgr Salary Dept DeptSal 1 Deepak 2 20000 1 61500 2 Annu NULL 22000 1 61500 3 Jai 2 19500 1 61500 4 Jitendra 1 18000 2 36000 5 Vaishali 1 18000 2 36000 6 Philip 4 15000 3 15000 </code></pre>
0debug
uint64_t helper_cvttq_svic(CPUAlphaState *env, uint64_t a) { return inline_cvttq(env, a, float_round_to_zero, 1); }
1threat
static void find_compressor(char * compressor_name, int len, MOVTrack *track) { AVDictionaryEntry *encoder; int xdcam_res = (track->par->width == 1280 && track->par->height == 720) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); if (track->mode == MODE_MOV && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = track->st; int rate = av_q2d(find_fps(NULL, st)); av_strlcatf(compressor_name, len, "XDCAM"); if (track->par->format == AV_PIX_FMT_YUV422P) { av_strlcatf(compressor_name, len, " HD422"); } else if(track->par->width == 1440) { av_strlcatf(compressor_name, len, " HD"); } else av_strlcatf(compressor_name, len, " EX"); av_strlcatf(compressor_name, len, " %d%c", track->par->height, interlaced ? 'i' : 'p'); av_strlcatf(compressor_name, len, "%d", rate * (interlaced + 1)); } }
1threat
Using DB inside Laravel .blade files is secure ? : **Laravel** is secure `php` framework follows `MVC` pattern design . But it's a question for me if i use `Model` codes like `DB::` class inside `.blade` files , is it secure and good idea or not ?
0debug
How to read the oracle contains the coordinates of the blob data : similar to this,blob which is stored in the coordinate data, similar to the arcgis ST_GEOMETRY type of points, the storage is Contains the byte stream of the point coordinates that define the geometry [enter image description here][1] [1]: https://i.stack.imgur.com/gaVZg.png
0debug
static void tx_fifo_push(lan9118_state *s, uint32_t val) { int n; if (s->txp->fifo_used == s->tx_fifo_size) { s->int_sts |= TDFO_INT; return; } switch (s->txp->state) { case TX_IDLE: s->txp->cmd_a = val & 0x831f37ff; s->txp->fifo_used++; s->txp->state = TX_B; s->txp->buffer_size = extract32(s->txp->cmd_a, 0, 11); s->txp->offset = extract32(s->txp->cmd_a, 16, 5); break; case TX_B: if (s->txp->cmd_a & 0x2000) { s->txp->cmd_b = val; s->txp->fifo_used++; n = (s->txp->buffer_size + s->txp->offset + 3) >> 2; switch ((n >> 24) & 3) { case 1: n = (-n) & 3; break; case 2: n = (-n) & 7; break; default: n = 0; } s->txp->pad = n; s->txp->len = 0; } DPRINTF("Block len:%d offset:%d pad:%d cmd %08x\n", s->txp->buffer_size, s->txp->offset, s->txp->pad, s->txp->cmd_a); s->txp->state = TX_DATA; break; case TX_DATA: if (s->txp->offset >= 4) { s->txp->offset -= 4; break; } if (s->txp->buffer_size <= 0 && s->txp->pad != 0) { s->txp->pad--; } else { n = 4; while (s->txp->offset) { val >>= 8; n--; s->txp->offset--; } while (n--) { s->txp->data[s->txp->len] = val & 0xff; s->txp->len++; val >>= 8; s->txp->buffer_size--; } s->txp->fifo_used++; } if (s->txp->buffer_size <= 0 && s->txp->pad == 0) { if (s->txp->cmd_a & 0x1000) { do_tx_packet(s); } if (s->txp->cmd_a & 0x80000000) { s->int_sts |= TX_IOC_INT; } s->txp->state = TX_IDLE; } break; } }
1threat
Custom domain for API Gateway returning 403 : <p>I am creating an api using API Gateway and Lambda. Using the url designated in the API Gateway Stage editor everything works fine; however, when I try and move to a custom domain I am running into some issues. </p> <p>The first thing I tried was using a CNAME record in Route 53 straight from my domain onto the domain that I got from the API Gateway. That was returning some errors and I think it is the incorrect solution is that correct?</p> <p>Next I tried the Custom Domain Names feature in API Gateway. My understanding is this will roll up a CloudFront distribution that I can then map onto from Route 53. When I created the custom domain and added a Domain Mapping it provides me with a url to what I assume is a CloudFront distribution. The link is returning a 403 response and no distribution has been made in CloudFront. What is a good way of debugging this problem?</p>
0debug
int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu) { if (cap_has_mp_state) { struct kvm_mp_state mp_state = { .mp_state = cpu->powered_off ? KVM_MP_STATE_STOPPED : KVM_MP_STATE_RUNNABLE }; int ret = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MP_STATE, &mp_state); if (ret) { fprintf(stderr, "%s: failed to set MP_STATE %d/%s\n", __func__, ret, strerror(-ret)); return -1; } } return 0; }
1threat
DialogFragment getActivity() "might be null" lint warning in AndroidStudio 3.0.1 : <p>The closest existing question I can find regarding this is <a href="https://stackoverflow.com/questions/47138807/android-studio-3-0-lint-warnings-for-references-to-activity/47168730#comment82957500_47168730">Android Studio 3.0 lint warnings for references to activity</a>, but it does not help.</p> <p>Using AndroidStudio 3.0.1, I have a <code>DialogFragment</code> where I do this usual stuff:</p> <pre><code> @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); ... </code></pre> <p>I have a lint warning moaning at me that <code>Argument 'getActivity()' might be null</code>. </p> <p>I understand <em>why</em> <code>getActivity()</code> may be null, and I understand how the lint inspection knows this (from the <code>@Nullable</code> annotation). </p> <p>My question is: It's all very well and good that <code>getActivity()</code> may be null, but practically how am I supposed to deal with this gracefully and tidily? <code>onCreateDialog</code> <em>must</em> return a <code>Dialog</code> (because of the superclass' <code>@Nullable</code> annotation) so I <em>must</em> have the Activity context to create it. </p> <p>I could assume that <code>onCreateDialog</code> will never be called if the <code>DialogFragment</code> isn't attached to an Activity, but still - how do I address the untidy lint warning?</p>
0debug
unhashable type: 'list' while in function, but works well outside the function : <p>I am going to write a function instead of my old line by line code but looks like it doesn't work.</p> <p>This piece of code works well:</p> <pre><code> def gdp_fdi(odf, colname): tempo = odf[odf['id'].str.contains(temp, na=False)] df = tempo[['id',colname]] return df def sortdf(df): df['id'] = pd.Categorical(df.id, categories = top20code, ordered = True) df.sort_values(by='id') return df &lt;THIS PART&gt; top20 =fdi.sort_values('fdi_1987',ascending = False).groupby('fdi_1987').head(2) top20 = top20[['fdi_1987','id']].head(21) top20code = top20['id'] top20code = top20code.to_string(index=False) top20code = top20code.split() temp = '|'.join(top20code) top20_name=gdp_fdi(wb,'name') top20_region=gdp_fdi(wb,'region') top20_gdp=gdp_fdi(gdp,'gdp_1987') sort20gdp=sortdf(top20_gdp) sort20region=sortdf(top20_region) sort20name=sortdf(top20_name) from functools import reduce lists=[sort20gdp,sort20region,sort20name] df = reduce(lambda df1, df2: pd.merge(left=df1, right=df2, on=["id"], how="inner"), lists) df['id'] = pd.Categorical(df.id, categories = top20code, ordered = True) df.sort_values(by='id') raw=df.sort_values(by='id') raw &lt;/THIS PART&gt; </code></pre> <p>but when I write it as a function, I use <code>'fdi_'+str(year)</code> instead of <code>'fdi_1987'</code> and write <code>&lt;THIS PART&gt;</code> as a function named <code>top20(year)</code>.</p> <p>But when I run the fuction by <code>top20(1987)</code>, it sais I have </p> <blockquote> <p>unhashable type: 'list'</p> </blockquote> <p>May I ask why? any tips for redesign the function?</p>
0debug
static uint32_t get_cluster_count_for_direntry(BDRVVVFATState* s, direntry_t* direntry, const char* path) { int copy_it = 0; int was_modified = 0; int32_t ret = 0; uint32_t cluster_num = begin_of_direntry(direntry); uint32_t offset = 0; int first_mapping_index = -1; mapping_t* mapping = NULL; const char* basename2 = NULL; vvfat_close_current_file(s); if (cluster_num == 0) return 0; if (s->qcow) { basename2 = get_basename(path); mapping = find_mapping_for_cluster(s, cluster_num); if (mapping) { const char* basename; assert(mapping->mode & MODE_DELETED); mapping->mode &= ~MODE_DELETED; basename = get_basename(mapping->path); assert(mapping->mode & MODE_NORMAL); if (strcmp(basename, basename2)) schedule_rename(s, cluster_num, strdup(path)); } else if (is_file(direntry)) schedule_new_file(s, strdup(path), cluster_num); else { assert(0); return 0; } } while(1) { if (s->qcow) { if (!copy_it && cluster_was_modified(s, cluster_num)) { if (mapping == NULL || mapping->begin > cluster_num || mapping->end <= cluster_num) mapping = find_mapping_for_cluster(s, cluster_num); if (mapping && (mapping->mode & MODE_DIRECTORY) == 0) { if (offset != mapping->info.file.offset + s->cluster_size * (cluster_num - mapping->begin)) { assert(0); copy_it = 1; } else if (offset == 0) { const char* basename = get_basename(mapping->path); if (strcmp(basename, basename2)) copy_it = 1; first_mapping_index = array_index(&(s->mapping), mapping); } if (mapping->first_mapping_index != first_mapping_index && mapping->info.file.offset > 0) { assert(0); copy_it = 1; } if (!was_modified && is_file(direntry)) { was_modified = 1; schedule_writeout(s, mapping->dir_index, offset); } } } if (copy_it) { int i, dummy; int64_t offset = cluster2sector(s, cluster_num); vvfat_close_current_file(s); for (i = 0; i < s->sectors_per_cluster; i++) if (!s->qcow->drv->bdrv_is_allocated(s->qcow, offset + i, 1, &dummy)) { if (vvfat_read(s->bs, offset, s->cluster_buffer, 1)) return -1; if (s->qcow->drv->bdrv_write(s->qcow, offset, s->cluster_buffer, 1)) return -2; } } } ret++; if (s->used_clusters[cluster_num] & USED_ANY) return 0; s->used_clusters[cluster_num] = USED_FILE; cluster_num = modified_fat_get(s, cluster_num); if (fat_eof(s, cluster_num)) return ret; else if (cluster_num < 2 || cluster_num > s->max_fat_value - 16) return -1; offset += s->cluster_size; } }
1threat
converting string of datetime to datetime C# : I want to converting string of date-time to date-time format like this **5/10/2016 12:00:00 AM** format . i tried more than way but not working please any advice. DateTime myDate = DateTime.ParseExact(txtManufacturerDate.Text, "MM-dd-yyyy",null);
0debug
CONVERT OBJECT IN DATETIME : <p>I should convert this : '1986-07-11T00:00:00.000-02:00' (it's an object) into a datetime so that i can do evaluations after evaluation. How can I do that?</p> <p>Thanks </p>
0debug
Grab the return value and get out of forEach in JavaScript? : <p>How can I modify this code so that I can grab the field.DependencyFieldEvaluated value and get out of the function as soon I get this value?</p> <pre><code>function discoverDependentFields(fields) { fields.forEach(function (field) { if (field.DependencyField) { var foundFields = fields.filter(function (fieldToFind) { return fieldToFind.Name === field.DependencyField; }); if (foundFields.length === 1) { return field.DependencyFieldEvaluated = foundFields[0]; } } }); } </code></pre>
0debug
Use a CURSOR to move data in MS SQL : I maintain a list of new contacts that is sent from a subsidiary. Each month a list of contacts is sent to me. The list is complete and I only need the last few dozen rows to be added to the contacts list. I need to maintain the redundant lists for records purposes. I am trying to use a CURSOR to inspect the monthly inbound tables and place them into master list?
0debug
static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVCowState *s = bs->opaque; int ret, n; while (nb_sectors > 0) { ret = cow_co_is_allocated(bs, sector_num, nb_sectors, &n); if (ret < 0) { return ret; } if (ret) { ret = bdrv_pread(bs->file, s->cow_sectors_offset + sector_num * 512, buf, n * 512); if (ret < 0) { return ret; } } else { if (bs->backing_hd) { ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) { return ret; } } else { memset(buf, 0, n * 512); } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
1threat
static inline void sync_jmpstate(DisasContext *dc) { if (dc->jmp == JMP_DIRECT) { dc->jmp = JMP_INDIRECT; tcg_gen_movi_tl(env_btaken, 1); tcg_gen_movi_tl(env_btarget, dc->jmp_pc); } }
1threat
How can I create a function to count the last n elements in a list in DrRacket (without list-ref)? : I know how to count the first elements in a list, [(zero? n) '()] [else (cons (first list) (function (rest list)))] but how can I do something like this for the last n elements in a list **(without using list-ref)**?
0debug
why new websites are using .io domain these days? : <p>A number of startups and technology websites are using .io domain these days in lieu of .com or .org; Is there any specific reason for that ? Like:</p> <pre><code>github.io mean.io angular.io </code></pre>
0debug
Making golang Gorilla CORS handler work : <p>I have fairly simple setup here as described in the code below. But I am not able to get the <code>CORS</code> to work. I keep getting this error:</p> <blockquote> <p>XMLHttpRequest cannot load <a href="http://localhost:3000/signup" rel="noreferrer">http://localhost:3000/signup</a>. Response to preflight request doesn't pass access control check: No 'Access- Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:8000" rel="noreferrer">http://localhost:8000</a>' is therefore not allowed access. The response had HTTP status code 403.</p> </blockquote> <p>I am sure I am missing something simple here.</p> <p>Here is the code I have:</p> <pre><code>package main import ( "log" "net/http" "github.com/gorilla/handlers" "github.com/gorilla/mux" "myApp/src/controllers" ) func main() { ac := new(controllers.AccountController) router := mux.NewRouter() router.HandleFunc("/signup", ac.SignUp).Methods("POST") router.HandleFunc("/signin", ac.SignIn).Methods("POST") log.Fatal(http.ListenAndServe(":3000", handlers.CORS()(router))) } </code></pre>
0debug
How to separate presentation layer for Android from Windows in UWP app? : <p>I have rather larger enterprise class app in Silverlight. I want to convert it to a Windows 10 UWP app, which will be not too hard and I expect about 80% to be done without much problems.</p> <p>However I see that a UWP app can target Android and Apple using Xamarin.</p> <p>Can anyone share a practical guide - how to approach this?</p> <p>I expect 50% of functionality be present in Xamarin "version" of the app - as there will be not enough screen on tablets and other features might be not available.</p> <p>Whats the best architecture to reuse as much of the code as possible between Windows app and its mobile mini-me?</p> <p><strong>How to organize VS projects and share libraries etc?</strong> </p> <p><em>P.S. the data access in the Windows app will be WCF with EF and Oracle. I can easily mirror the WCF calls into REST service for the mobile app.</em></p>
0debug
Implementing a dynamic typed language with LLVM IR : <p>I'm trying to build a JIT compiler for a dynamic language using LLVM C API but I'm stuck at implementing dynamic types, for example in function definition, LLVM needs types for each argument but the type is unknown until runtime based on what the user passes, i googled this for a while but no any good resources about it anywhere, I also tried looking at Julia's source code to see how they did it, unfortunetely the code is big and complex and i have to eye jump everywhere to find such a small detail, from what i seen so far in it is they represent their types as an empty LLVM struct pointers and a func sig type that holds some extra data, but I'm very unsure of how that works or even if I'm explaining it right, any resources can be helpful, an example code is most appreciated, the example doesn't have to be in C API, C++ is also fine I'll convert it myself one way or the other.</p> <p>Thanks in advance.</p>
0debug
CMD - is not recognized as an internal/external command : <p>I have a problem with "<strong>Command Prompt</strong>" :</p> <p><a href="https://i.stack.imgur.com/sNGxH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sNGxH.png" alt="enter image description here"></a></p> <p>How to solve this problem ?</p>
0debug
WHY IT IS SHOWING ENUM ,INTERFACE EXPECTING ERRORS? : THIS program is showing this errors asking interface in package concept...why is it so? can't i do package without using interfaces? i tried with that too..but still the same error is showing..what to do..pls help please click on this link fr the screenshot [errors regaring interface and enum][1] [1]: http://i.stack.imgur.com/Jjq8W.jpg
0debug
I need report on chat system created in firebase : <p>I have created chat system in firebase and now i want report on daily,weekly,monthly that how many users are exchaging how many words and how much time they are engaged with app,</p>
0debug
How to compare two lists in python and write the similar index values in one list and non similar values in another list : <p>consider two lists a=[1,2,3], b=[1,4,5].The Code should print the similar values c=[1] and the Code should print d=[2,3,4,5] which shows different values</p>
0debug
e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) { E1000State *s = qemu_get_nic_opaque(nc); PCIDevice *d = PCI_DEVICE(s); struct e1000_rx_desc desc; dma_addr_t base; unsigned int n, rdt; uint32_t rdh_start; uint16_t vlan_special = 0; uint8_t vlan_status = 0; uint8_t min_buf[MIN_BUF_SIZE]; struct iovec min_iov; uint8_t *filter_buf = iov->iov_base; size_t size = iov_size(iov, iovcnt); size_t iov_ofs = 0; size_t desc_offset; size_t desc_size; size_t total_size; static const int PRCregs[6] = { PRC64, PRC127, PRC255, PRC511, PRC1023, PRC1522 }; if (!(s->mac_reg[STATUS] & E1000_STATUS_LU)) { return -1; } if (!(s->mac_reg[RCTL] & E1000_RCTL_EN)) { return -1; } if (size < sizeof(min_buf)) { iov_to_buf(iov, iovcnt, 0, min_buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); inc_reg_if_not_full(s, RUC); min_iov.iov_base = filter_buf = min_buf; min_iov.iov_len = size = sizeof(min_buf); iovcnt = 1; iov = &min_iov; } else if (iov->iov_len < MAXIMUM_ETHERNET_HDR_LEN) { iov_to_buf(iov, iovcnt, 0, min_buf, MAXIMUM_ETHERNET_HDR_LEN); filter_buf = min_buf; } if ((size > MAXIMUM_ETHERNET_LPE_SIZE || (size > MAXIMUM_ETHERNET_VLAN_SIZE && !(s->mac_reg[RCTL] & E1000_RCTL_LPE))) && !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) { inc_reg_if_not_full(s, ROC); return size; } if (!receive_filter(s, filter_buf, size)) { return size; } if (vlan_enabled(s) && is_vlan_packet(s, filter_buf)) { vlan_special = cpu_to_le16(be16_to_cpup((uint16_t *)(filter_buf + 14))); iov_ofs = 4; if (filter_buf == iov->iov_base) { memmove(filter_buf + 4, filter_buf, 12); } else { iov_from_buf(iov, iovcnt, 4, filter_buf, 12); while (iov->iov_len <= iov_ofs) { iov_ofs -= iov->iov_len; iov++; } } vlan_status = E1000_RXD_STAT_VP; size -= 4; } rdh_start = s->mac_reg[RDH]; desc_offset = 0; total_size = size + fcs_len(s); if (!e1000_has_rxbufs(s, total_size)) { set_ics(s, 0, E1000_ICS_RXO); return -1; } do { desc_size = total_size - desc_offset; if (desc_size > s->rxbuf_size) { desc_size = s->rxbuf_size; } base = rx_desc_base(s) + sizeof(desc) * s->mac_reg[RDH]; pci_dma_read(d, base, &desc, sizeof(desc)); desc.special = vlan_special; desc.status |= (vlan_status | E1000_RXD_STAT_DD); if (desc.buffer_addr) { if (desc_offset < size) { size_t iov_copy; hwaddr ba = le64_to_cpu(desc.buffer_addr); size_t copy_size = size - desc_offset; if (copy_size > s->rxbuf_size) { copy_size = s->rxbuf_size; } do { iov_copy = MIN(copy_size, iov->iov_len - iov_ofs); pci_dma_write(d, ba, iov->iov_base + iov_ofs, iov_copy); copy_size -= iov_copy; ba += iov_copy; iov_ofs += iov_copy; if (iov_ofs == iov->iov_len) { iov++; iov_ofs = 0; } } while (copy_size); } desc_offset += desc_size; desc.length = cpu_to_le16(desc_size); if (desc_offset >= total_size) { desc.status |= E1000_RXD_STAT_EOP | E1000_RXD_STAT_IXSM; } else { desc.status &= ~E1000_RXD_STAT_EOP; } } else { DBGOUT(RX, "Null RX descriptor!!\n"); } pci_dma_write(d, base, &desc, sizeof(desc)); if (++s->mac_reg[RDH] * sizeof(desc) >= s->mac_reg[RDLEN]) s->mac_reg[RDH] = 0; if (s->mac_reg[RDH] == rdh_start) { DBGOUT(RXERR, "RDH wraparound @%x, RDT %x, RDLEN %x\n", rdh_start, s->mac_reg[RDT], s->mac_reg[RDLEN]); set_ics(s, 0, E1000_ICS_RXO); return -1; } } while (desc_offset < total_size); increase_size_stats(s, PRCregs, total_size); inc_reg_if_not_full(s, TPR); s->mac_reg[GPRC] = s->mac_reg[TPR]; grow_8reg_if_not_full(s, TORL, size+4); s->mac_reg[GORCL] = s->mac_reg[TORL]; s->mac_reg[GORCH] = s->mac_reg[TORH]; n = E1000_ICS_RXT0; if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH]) rdt += s->mac_reg[RDLEN] / sizeof(desc); if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) <= s->mac_reg[RDLEN] >> s->rxbuf_min_shift) n |= E1000_ICS_RXDMT0; set_ics(s, 0, n); return size; }
1threat
AllowOverride not allowed here : <p>I have setup a virtualhost like following</p> <pre><code>&lt;VirtualHost *:80&gt; DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Options Includes AllowOverride All &lt;/VirtualHost&gt; </code></pre> <p>But always throws me</p> <pre><code>AH00526: Syntax error on line 6 of /etc/apache2/sites-enabled/000-my-site.conf: AllowOverride not allowed here </code></pre> <p>I'm a bit confused because I understand that is the right place to do it</p>
0debug
What is the reason that Encoding.UTF8.GetString and Encoding.UTF8.GetBytes are not inverse of each other? : <p>Probably I am missing something, but I do not understand why Encoding.UTF8.GetString and Encoding.UTF8.GetBytes are not working as inverse transformation of each other?</p> <p>In the following example the myOriginalBytes and asBytes are not equal, even their length is different. Could anyone explain what am I missing?</p> <pre><code>byte[] myOriginalBytes = GetRandomByteArray(); var asString = Encoding.UTF8.GetString(myOriginalBytes); var asBytes = Encoding.UTF8.GetBytes(asString); </code></pre>
0debug
static const char *keyval_parse_one(QDict *qdict, const char *params, const char *implied_key, Error **errp) { const char *key, *key_end, *s; size_t len; char key_in_cur[128]; QDict *cur; QObject *next; QString *val; key = params; len = strcspn(params, "=,"); if (implied_key && len && key[len] != '=') { key = implied_key; len = strlen(implied_key); } key_end = key + len; cur = qdict; s = key; for (;;) { for (len = 0; s + len < key_end && s[len] != '.'; len++) { } if (!len) { assert(key != implied_key); error_setg(errp, "Invalid parameter '%.*s'", (int)(key_end - key), key); return NULL; } if (len >= sizeof(key_in_cur)) { assert(key != implied_key); error_setg(errp, "Parameter%s '%.*s' is too long", s != key || s + len != key_end ? " fragment" : "", (int)len, s); return NULL; } if (s != key) { next = keyval_parse_put(cur, key_in_cur, NULL, key, s - 1, errp); if (!next) { return NULL; } cur = qobject_to_qdict(next); assert(cur); } memcpy(key_in_cur, s, len); key_in_cur[len] = 0; s += len; if (*s != '.') { break; } s++; } if (key == implied_key) { assert(!*s); s = params; } else { if (*s != '=') { error_setg(errp, "Expected '=' after parameter '%.*s'", (int)(s - key), key); return NULL; } s++; } val = qstring_new(); for (;;) { if (!*s) { break; } else if (*s == ',') { s++; if (*s != ',') { break; } } qstring_append_chr(val, *s++); } if (!keyval_parse_put(cur, key_in_cur, val, key, key_end, errp)) { return NULL; } return s; }
1threat
JPA concurrency issue "On release of batch it still contained JDBC statements" : <p>I have a a concurrency issue I tried to solve with a while loop that attempts to save an entity multiple times until it hits some max retry count. I'd like to avoid talking about whether or not there are other ways to solve this problem. I have other Stackoverflow posts about that. :) Long story short: there's a unique constraint on a column that is derived and includes a numeric portion that keeps incrementing to avoid collisions. In a loop, I:</p> <ol> <li>select max(some_value)</li> <li>increment the result</li> <li>attempt to save new object with this new result</li> <li>explicitly flush the entity and, if that fails because of the unique index, I catch a DataAccessException.</li> </ol> <p>All of this seems to work except when the loop goes back to step 1 and tries to select, I get:</p> <pre><code>17:20:46,111 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (http-localhost/127.0.0.1:8080-3) HHH000010: On release of batch it still contained JDBC statements 17:20:46,111 INFO [my.Class] (http-localhost/127.0.0.1:8080-3) MESSAGE="Failed to save to database. Will retry (retry count now at: 9) Exception: could not execute statement; SQL [n/a]; constraint [SCHEMA_NAME.UNIQUE_CONSTRAINT_NAME]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement" </code></pre> <p>And a new Exception is caught. It seems like the first flush that causes the unique constraint violation and throws the <code>DataAccessException</code> doesn't clear the entity manager's batch. What's the appropriate way to deal with this? I'm using Spring with JPA and don't have direct access to the entity manager. I guess I could inject it if I need it but that's a painful solution to this problem.</p>
0debug
Laravel - route to folder inside public folder : <p>I install Laravel and inside laravel public folder I install Wordpress inside folder wordpress.</p> <p>Now I need to make a route at domain.com to public/wordpress folder...</p> <p>How to do that?</p> <p>I try:</p> <pre><code>Route::get('/', [function () { return Redirect::to('/wordpress'); }]); </code></pre> <p>but this show me path in browser url ... domain.com/wordpress and I want only user to see just domain.com</p>
0debug
Prediction using Keras models : I trained a Keras model, however, I have difficulty in making it predict. My input array is of the shape (400,2) and the output array is of the shape (400,1) Now when I pass the argument array([1,2]) in the model.predict() function, I get the error: ValueError: Error when checking input: expected dense_1_input to have shape (2,) but got array with shape (1,). Which is nonsensical since shape(array([1,2])) = (2,) and hence the model.predict function should accept it as a valid input. Can somebody tell me as to what is going on? P.S. It works well when I pass an array of (2,2) dimensions but the output is also a (2,1) array.
0debug
Flutter Navigator.of(context).pop vs Navigator.pop(context) difference : <p>What's the difference between <code>Navigator.of(context).pop</code> and <code>Navigator.pop(context)</code>?</p> <p>To me both seems to do the same work, what is the actual difference. Is one deprecated? </p>
0debug
How to use a mask in excel vba? : I got as a required task to fix a date input in a vba form. In the form, there is a textbox. I'm required to have for the user the date entered as MM/DD/YYYY My task is to use an input mask, this is what I'm required, not allowed to do something as validating date after or using a calendar. So far I was able to use the 2 methods mentionned above (forcing the format after using `ISDATE`). However, it's has now been made clear it HAS to be a mask so keys are filtered on entry, with the mask being visible when entering the date: __/__/____ Is there a way to do it? I can only find tutorial for mask on access vba.
0debug
I have table in sql serv like this picture how to make an output like this picture : I have table Date1 | Date2 | Days 2017-01-25 2017-02-03 8 how to make an output like this Periode | Days January 5 Februari 3
0debug
Replacing letters from input with a changing item from a list : In python, I'm trying to write a python script that replaces each letter with another letter from a 3 item long **list**. I am doing this for each letter of the alphabet, so use the `replace` method. For example: `list_a = "B,C,D" % ` `$ what is your message? > aaaa` `$ This is your encrypted message: BCDB` Thanks a lot!!!!
0debug
i can't make a substring in c++ with weird error : i am trying to make a simple program that print a character and you should press it quickly to win and train to type quickly with a runtime error "Unhandled exception at 0x772A33D2 in Learn To Type Quickly.exe: Microsoft C++ exception: std::out_of_range at memory location 0x00FEF138. occurred" ``` #include <iostream> #include <ctime> #include <cstdlib> #include <string.h> using namespace std; int main() { srand((unsigned)time(NULL)); while (true) { int r = rand() % 26; string length = "abcdefghijklmnopqrstuvwxyz"; size_t found = r; size_t sz = 1; string sub = length.substr(length.at(found),sz); cout << sub << endl; } } ``` Unhandled exception at 0x772A33D2 in Learn To Type Quickly.exe: Microsoft C++ exception: std::out_of_range at memory location 0x00FEF138. occurred
0debug
void visit_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) { if (!error_is_set(errp)) { v->type_enum(v, obj, strings, kind, name, errp); } }
1threat
VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports) { VirtIOSerial *vser; VirtIODevice *vdev; uint32_t i; if (!max_nr_ports) return NULL; vdev = virtio_common_init("virtio-serial", VIRTIO_ID_CONSOLE, sizeof(struct virtio_console_config), sizeof(VirtIOSerial)); vser = DO_UPCAST(VirtIOSerial, vdev, vdev); vser->bus = virtser_bus_new(dev); vser->bus->vser = vser; QTAILQ_INIT(&vser->ports); vser->bus->max_nr_ports = max_nr_ports; vser->ivqs = qemu_malloc(max_nr_ports * sizeof(VirtQueue *)); vser->ovqs = qemu_malloc(max_nr_ports * sizeof(VirtQueue *)); vser->ivqs[0] = virtio_add_queue(vdev, 128, handle_input); vser->ovqs[0] = virtio_add_queue(vdev, 128, handle_output); vser->c_ivq = virtio_add_queue(vdev, 16, control_in); vser->c_ovq = virtio_add_queue(vdev, 16, control_out); for (i = 1; i < vser->bus->max_nr_ports; i++) { vser->ivqs[i] = virtio_add_queue(vdev, 128, handle_input); vser->ovqs[i] = virtio_add_queue(vdev, 128, handle_output); } vser->config.max_nr_ports = max_nr_ports; vser->ports_map = qemu_mallocz(((max_nr_ports + 31) / 32) * sizeof(vser->ports_map[0])); mark_port_added(vser, 0); vser->vdev.get_features = get_features; vser->vdev.get_config = get_config; vser->vdev.set_config = set_config; register_savevm(dev, "virtio-console", -1, 2, virtio_serial_save, virtio_serial_load, vser); return vdev; }
1threat
CSS: Position sticky js solution : [![question picture][1]][1] [1]: https://i.stack.imgur.com/nv3vU.png I have position sticky block that can be higher than window height and also can be less (depends on viewport). That means in some situations I cannot scroll to overflowed content. Is there a solution that allows to stick block from bottom if this block is bigger than window?
0debug
static void xen_init_pv(MachineState *machine) { DriveInfo *dinfo; int i; if (xen_be_init() != 0) { fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__); exit(1); } switch (xen_mode) { case XEN_ATTACH: break; #ifdef CONFIG_XEN_PV_DOMAIN_BUILD case XEN_CREATE: { const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; if (xen_domain_build_pv(kernel_filename, initrd_filename, kernel_cmdline) < 0) { fprintf(stderr, "xen pv domain creation failed\n"); exit(1); } break; } #endif case XEN_EMULATE: fprintf(stderr, "xen emulation not implemented (yet)\n"); exit(1); break; default: fprintf(stderr, "unhandled xen_mode %d\n", xen_mode); exit(1); break; } xen_be_register_common(); xen_be_register("vfb", &xen_framebuffer_ops); xen_be_register("qnic", &xen_netdev_ops); if (xenfb_enabled) { xen_config_dev_vfb(0, "vnc"); xen_config_dev_vkbd(0); } for (i = 0; i < 16; i++) { dinfo = drive_get(IF_XEN, 0, i); if (!dinfo) continue; xen_config_dev_blk(dinfo); } for (i = 0; i < nb_nics; i++) { if (!nd_table[i].model || 0 != strcmp(nd_table[i].model, "xen")) continue; xen_config_dev_nic(nd_table + i); } atexit(xen_config_cleanup); xen_init_display(xen_domid); }
1threat
How to save a view in BigQuery - Standard SQL Dialect : <p>I am trying to save a view using BigQuery's WebUI, which was created in Standard SQL Dialect, but I am getting this error:</p> <p><strong>Failed to save view. Bad table reference "myDataset.myTable"; table references in standard SQL views require explicit project IDs</strong></p> <p>Why is this error showing up? How can I fix it? Should the "Table ID" field of the "Save view" dialog include the project id? Or does this error appear because of the query itself? Just in case, the query is running without any problems.</p> <p><a href="https://i.stack.imgur.com/HMX07.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/HMX07.jpg" alt="BigQuery&#39;s Save View"></a></p> <p>Thanks for your help.</p>
0debug
Why will the CSS/Javscript and HTML only pass some properties, but not all? : I have downloaded source code for a hidden search bar, that when clicked, reveals a tex input bar. I have copied this html into my homepage.html: <div id="reserveButtonOuter"> <button id="reserveButton">Reserve a Table</button> </div> <div id="sb-search" class="sb-search"> <form> <input class="sb-search-input" placeholder="Enter your search term..." type="search" value="" name="search" id="search"> <input class="sb-search-submit" type="submit" value=""> <span class="sb-icon-search"></span> </form> </div> this is connected to my HomePage.js file, in which I have the code below: ;( function( window ) { function UISearch( el, options ) { this.el = el; this.inputEl = el.querySelector( 'form > input.sb-search-input' ); this._initEvents(); } UISearch.prototype = { _initEvents : function() { var self = this, initSearchFn = function( ev ) { if( !classie.has( self.el, 'sb-search-open' ) ) { // open it ev.preventDefault(); self.open(); } else if( classie.has( self.el, 'sb-search-open' ) && /^\s*$/.test( self.inputEl.value ) ) { // close it self.close(); } } this.el.addEventListener( 'click', initSearchFn ); this.inputEl.addEventListener( 'click', function( ev ) { ev.stopPropagation(); }); }, open : function() { classie.add( this.el, 'sb-search-open' ); }, close : function() { classie.remove( this.el, 'sb-search-open' ); } } This is only a small part of the code, as it is several hundred lines. The .css file is linked to my page fine as it is working for my other elements. The search bar is rendering as nothing more than an orange square, which when clicked shows no errors on the console. Im not sure what that means for the Javascript? Any advice would be great, thanks!
0debug
bool eth_parse_ipv6_hdr(struct iovec *pkt, int pkt_frags, size_t ip6hdr_off, uint8_t *l4proto, size_t *full_hdr_len) { struct ip6_header ip6_hdr; struct ip6_ext_hdr ext_hdr; size_t bytes_read; bytes_read = iov_to_buf(pkt, pkt_frags, ip6hdr_off, &ip6_hdr, sizeof(ip6_hdr)); if (bytes_read < sizeof(ip6_hdr)) { return false; } *full_hdr_len = sizeof(struct ip6_header); if (!eth_is_ip6_extension_header_type(ip6_hdr.ip6_nxt)) { *l4proto = ip6_hdr.ip6_nxt; return true; } do { bytes_read = iov_to_buf(pkt, pkt_frags, ip6hdr_off + *full_hdr_len, &ext_hdr, sizeof(ext_hdr)); *full_hdr_len += (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANULARITY; } while (eth_is_ip6_extension_header_type(ext_hdr.ip6r_nxt)); *l4proto = ext_hdr.ip6r_nxt; return true; }
1threat
static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; if (!drv) { return -ENOMEDIUM; } if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; } if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, false, nb_sectors); } return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); }
1threat
Docker named volumes vs DOC (data-only-containers) : <p>Up to recent version of Docker (v1.10), we were thought that we can use DOC: <em>data-only containers</em>. So I would create such DOC (based on e.g. busybox) and use <code>--volumes-from</code> to link it to my container. You can still read about this in <a href="https://docs.docker.com/engine/userguide/containers/dockervolumes/#creating-and-mounting-a-data-volume-container">Docker documentation</a>.</p> <p>With new version of docker, it is said that instead of DOC we should use <code>named volumes</code>. Here is an example of <code>docker-compose.yml</code>:</p> <pre><code>version: '2' services: elasticsearch: image: elasticsearch:2.2.0 command: elasticsearch -Des.network.host=0.0.0.0 ports: - "9201:9200" volumes: - "es-data:/usr/share/elasticsearch/data" volumes: es-data: </code></pre> <p>Here we created and use named volume <code>es-data</code>.</p> <p>There is still not much documentation on this new feature. I am asking:</p> <ul> <li>Can we replace DOC with named containers? How long volume is persisted? What if I remove the container that is using it?</li> <li>How can we e.g. backup now? Previously, I could <code>docker run --rm --volumes-from es-data ...</code> and then <code>tar</code> it.</li> </ul>
0debug
Flutter - Render new Widgets on click : <p>The title basically says it all. A very nooby question... I have this basic code to create the initial state of my app :</p> <pre><code>class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Flutter Demo', theme: new ThemeData( primarySwatch: Colors.blue, ), home: new MyHomePage(title: 'Some title'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() =&gt; new _MyHomePageState(); } class _MyHomePageState extends State&lt;MyHomePage&gt; { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar(title: new Text(config.title)), body: new Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ new InputWidget(), ] ), ); } } </code></pre> <p>Now, how can I render a new Widget when the user clicks on a button? Let's say I want to instantiate another InputWidget.</p> <p>thanks</p>
0debug
static void string_output_append(StringOutputVisitor *sov, int64_t a) { Range *r = g_malloc0(sizeof(*r)); r->begin = a; r->end = a + 1; sov->ranges = range_list_insert(sov->ranges, r); }
1threat
Keras: batch training for multiple large datasets : <p>this question regards the common problem of training on multiple large files in Keras which are jointly too large to fit on GPU memory. I am using Keras 1.0.5 and I would like a solution that does not require 1.0.6. One way to do this was described by fchollet <a href="https://github.com/fchollet/keras/issues/107" rel="noreferrer">here</a> and <a href="https://github.com/fchollet/keras/issues/68" rel="noreferrer">here</a>:</p> <pre><code># Create generator that yields (current features X, current labels y) def BatchGenerator(files): for file in files: current_data = pickle.load(open("file", "rb")) X_train = current_data[:,:-1] y_train = current_data[:,-1] yield (X_train, y_train) # train model on each dataset for epoch in range(n_epochs): for (X_train, y_train) in BatchGenerator(files): model.fit(X_train, y_train, batch_size = 32, nb_epoch = 1) </code></pre> <p>However I fear that the state of the model is not saved, rather that the model is reinitialized not only between epochs but also between datasets. Each "Epoch 1/1" represents training on a different dataset below:</p> <p>~~~~~ Epoch 0 ~~~~~~</p> <p>Epoch 1/1 295806/295806 [==============================] - 13s - loss: 15.7517<br> Epoch 1/1 407890/407890 [==============================] - 19s - loss: 15.8036<br> Epoch 1/1 383188/383188 [==============================] - 19s - loss: 15.8130<br> ~~~~~ Epoch 1 ~~~~~~</p> <p>Epoch 1/1 295806/295806 [==============================] - 14s - loss: 15.7517<br> Epoch 1/1 407890/407890 [==============================] - 20s - loss: 15.8036<br> Epoch 1/1 383188/383188 [==============================] - 15s - loss: 15.8130</p> <p>I am aware that one can use model.fit_generator but as the method above was repeatedly suggested as a way of batch training I would like to know what I am doing wrong.</p> <p>Thanks for your help,</p> <p>Max</p>
0debug
Symfony, how get current user (FOS) in entity, unused __construct()? : <p>I have an entity <code>Book</code>. Title of this <code>Book</code> is stored in different languages ​​(the entity <code>Book</code> is associated with <code>BookTranslates</code> as <code>OneToMane</code>).</p> <p>The entity <code>Book</code> is used as a form field in several places (like select). For this, I need to set <code>__toString ()</code> for the <code>Book</code> entity, which will return the title of the <code>Book</code> in the user's language.</p> <p>I tried to get the user inside the entity by passing <code>TokenStorageInterface</code> in the <code>__construct ()</code> method of the <code>Book</code> class, but the doctrine never calls the <code>__construct ()</code> method in that case.</p> <p>Brief statement of the problem: <code>__toString ()</code> in entity must return a field of one of the related entities. Which specifically related entities - depends on the current user. How to implement it correctly?</p>
0debug