problem
stringlengths
26
131k
labels
class label
2 classes
Colon after method declaration? : <pre><code>public function getRecords(int $id): array; </code></pre> <p>Hi, can someone tell me what colon is doing here, in this method declaration inside PHP interface? Is this PHP 7 syntax and what array is meaning here? Method must return array or something else? </p>
0debug
is there an easy way to find a most similar keyword out of an array using javascript? : javascript, find a reslut most like with search text in array example var testData = [ '101', '102C', '103B', 'A', 'BD', 'AB', 'A102B', 'A1', ]; //if search Text is 102 var searchText = "102"; // result should be 102C //if search Text is 102B var searchText = "102B"; // result should be A102B, 102C //if search Text is A var searchText = "A"; // result should be A, A1, AB, A102 is there an easy way to find a most like keyword out of an array using javascript? Thank you.
0debug
static struct omap_sysctl_s *omap_sysctl_init(struct omap_target_agent_s *ta, omap_clk iclk, struct omap_mpu_state_s *mpu) { struct omap_sysctl_s *s = (struct omap_sysctl_s *) g_malloc0(sizeof(struct omap_sysctl_s)); s->mpu = mpu; omap_sysctl_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_sysctl_ops, s, "omap.sysctl", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); return s; }
1threat
i want to add non database field in a form in ORACLE APEX : i have a department table and it contains Employee information what i need is i want to add text fields(non-database) and performs and calculation tasks using stored procedures can anyone help me at this[i want to add text fields here][1] [1]: http://i.stack.imgur.com/wJ194.jpg
0debug
unsigned ff_els_decode_unsigned(ElsDecCtx *ctx, ElsUnsignedRung *ur) { int i, n, r, bit; ElsRungNode *rung_node; if (ctx->err) return 0; for (n = 0; n < ELS_EXPGOLOMB_LEN + 1; n++) if (ff_els_decode_bit(ctx, &ur->prefix_rung[n])) break; if (ctx->err || n >= ELS_EXPGOLOMB_LEN) { ctx->err = AVERROR(EOVERFLOW); return 0; } if (!n) return 0; if (!ur->rem_rung_list) { ur->rem_rung_list = av_realloc(NULL, RUNG_SPACE); if (!ur->rem_rung_list) { ctx->err = AVERROR(ENOMEM); return 0; } memset(ur->rem_rung_list, 0, RUNG_SPACE); ur->rung_list_size = RUNG_SPACE; ur->avail_index = ELS_EXPGOLOMB_LEN; } for (i = 0, r = 0, bit = 0; i < n; i++) { if (!i) rung_node = &ur->rem_rung_list[n]; else { if (!rung_node->next_index) { if (ur->rung_list_size <= (ur->avail_index + 2) * sizeof(ElsRungNode)) { ptrdiff_t pos = rung_node - ur->rem_rung_list; ur->rem_rung_list = av_realloc(ur->rem_rung_list, ur->rung_list_size + RUNG_SPACE); if (!ur->rem_rung_list) { av_free(ur->rem_rung_list); ctx->err = AVERROR(ENOMEM); return 0; } memset((uint8_t *) ur->rem_rung_list + ur->rung_list_size, 0, RUNG_SPACE); ur->rung_list_size += RUNG_SPACE; rung_node = &ur->rem_rung_list[pos]; } rung_node->next_index = ur->avail_index; ur->avail_index += 2; } rung_node = &ur->rem_rung_list[rung_node->next_index + bit]; } bit = ff_els_decode_bit(ctx, &rung_node->rung); if (ctx->err) return bit; r = (r << 1) + bit; } return (1 << n) - 1 + r; }
1threat
Java, declaring static methods in interface : <p>This subject already has questions and answers, none with conclusive results. If this is not possible, then can someone determine the best workaround? Some of the answers say that this is possible with Java 8, but my IDE (eclipse) is still showing errors even though it is set to compiler compliance 1.8. If someone can get it to work on their system, let me know and I'll fix the problems with my system.</p> <p>Problem: I need to create an interface with both static and non-static methods. An example of this:</p> <pre><code>// I need to create an interface with both static and non-static methods. public interface TestInterface { // No problem int objectMethod(); // static is an illegal modifier in an interface static int classMethod(); } // TestClass is one of many classes that will implement the interface. public class TestClass implements TestInterface { // static and non-static variables are no problem private int objectVal; public static int classVal; // this method has no problem public int objectMethod() { return objectVal; } // this one has problems because it implements a method that has problems public static int classMethod() { return classVal; } } </code></pre> <p>And I need a class that will use classes that implement the interface</p> <pre><code>// a class that will use classes that implement from the interface // what is the syntax for this? my IDE doesnt like the implements keyword public class TestGeneric &lt;T implements TestInterface&gt; { // stored instances of the class private T t; public void foo() { System.out.printf("t's value is: %d\n", t.objectMethod()); System.out.printf("T's value is: %d\n", T.classMethod()); } } </code></pre> <p>The only problems in the above code are with the static methods. The only workaround I can think of is to not declare any methods as static, but use them in the way most similar to static use.</p>
0debug
static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int discard) { AviSynthContext *avs = s->priv_data; AVRational fps, samplerate; int samples; const char* error; if (avs->curr_sample >= avs->vi->num_audio_samples) return AVERROR_EOF; fps.num = avs->vi->fps_numerator; fps.den = avs->vi->fps_denominator; samplerate.num = avs->vi->audio_samples_per_second; samplerate.den = 1; if (avs_has_video(avs->vi)) { if (avs->curr_frame < avs->vi->num_frames) samples = av_rescale_q(avs->curr_frame, samplerate, fps) - avs->curr_sample; else samples = av_rescale_q(1, samplerate, fps); } else { samples = 1000; } if (samples <= 0) { pkt->size = 0; pkt->data = NULL; return 0; } if (avs->curr_sample + samples > avs->vi->num_audio_samples) samples = avs->vi->num_audio_samples - avs->curr_sample; avs->curr_sample += samples; if (discard) return 0; pkt->pts = avs->curr_sample; pkt->dts = avs->curr_sample; pkt->duration = samples; pkt->size = avs_bytes_per_channel_sample(avs->vi) * samples * avs->vi->nchannels; if (!pkt->size) return AVERROR_UNKNOWN; pkt->data = av_malloc(pkt->size); if (!pkt->data) return AVERROR_UNKNOWN; avs_library->avs_get_audio(avs->clip, pkt->data, avs->curr_sample, samples); error = avs_library->avs_clip_get_error(avs->clip); if (error) { av_log(s, AV_LOG_ERROR, "%s\n", error); avs->error = 1; av_freep(&pkt->data); return AVERROR_UNKNOWN; } return 0; }
1threat
Python 2.7.12- How to have the same length for a new string as well as letters? : <p>I've just started learning Python 2.7.12 and in my first homework I was given a string called str2, and I'm supposed to create another string which will be the same length as the previous one. In addition,I need to check the third letter (if it's an Upper I need to convert to lower and the opposite, as well as if it's not a letter, I need to change it with '%'). The other characters of the first string should be copied to the second one.</p> <p>We were given just the basic commends and nothing else so I can't really solve it. please help me! :)</p>
0debug
def square_Sum(n): return int(n*(4*n*n-1)/3)
0debug
How do you do a chance out of 100 with a variable that can change? : <p>I was wondering if there was a way to make a chance out of 100 and for example there would be an variable out of 100 chance that something is going to happen. and i know how to make a chance normally but i'm not sure about a variable that changes. any help would be nice. Thanks!</p>
0debug
void object_delete(Object *obj) { object_unparent(obj); g_assert(obj->ref == 1); object_unref(obj); g_free(obj); }
1threat
How to return a vector from a class into another class : <p>I'm trying to use arrays with java and when i return the array froma class it prints [I@7d4991ad (that should be the address), but how to return all the elements?</p> <p>(by the way, I always mess with JavaScript and Java and I don't know which one eclipse is, I apologize)</p> <p>Basically I did a return of the name of the vector with the metod int[]</p> <pre><code>public class TestVettori { private int vector[]; private int length; //function input lengt public void setLength(int newLung) { if(newLung&gt;=1) length=newLung; } //function input public void inputValue(int[] vett) { vector = new int [length]; for(int i=0;i&lt;length;i++) vector[i]=vett[i]; } //function print array **public int[] getVector() { return vector; }** } </code></pre> <pre><code>import java.util.Scanner; public class ProgTestVettori { public static void main(String[] args) { Scanner in= new Scanner (System.in); int lung ; int vett[]; TestVettori vector; System.out.println("Put the length of the array"); lung = in.nextInt(); vett = new int [lung]; vector = new TestVettori(); vector.setLength(lung); for(int i=0;i&lt;lung;i++) { System.out.println("Input the"+(i+1)+" number"); vett[i]=in.nextInt(); } vector.inputValue(vett); **for(int i=0;i&lt;lung;i++) { System.out.println("the "+(i+1)+"° number is"+vector.getVector()); }** in.close(); } } </code></pre> <p>I pasted all the code so you can see all of it: I put the length, let's suppose 3 i put numbers and i should expect numbers from the console, but i get 3 times [I@7d4991ad the address...</p>
0debug
C# Writing a file to the APP_DATA folder and getting bitdefender (antivirus) to scan/delete it : This is the code I use to write my file to the app_data folder: var filename = Server.MapPath("~/App_Data") + "/" thefilename; var ms = new MemoryStream(); file.InputStream.CopyTo(ms); file.InputStream.Position = 0; byte[] contents = ms.ToArray(); var fileStream = new System.IO.FileStream(filename, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); fileStream.Write(contents, 0, contents.Length); fileStream.Close(); This writes the file fine however bitdefender does not delete this file if there is a virus on it unless I go on the IIS and manually try to open/move the file, if I do that then it is instantly deleted. If I copy and paste the test virus file into the app_data folder directly then bitdefender removes it instantly. I have tried to use various ways to read/move the file with System.IO.File.Move/Open/ReadAllLines Yet nothing triggers bit defender to remove the file. The only thing I got to work was creating a new process to open the file, however I don't want to be doing that on the server and I am looking for a different solution. This is the code that does this: Process cmd = new Process(); cmd.StartInfo.FileName = filename; cmd.Start(); A solution with System.IO.File.Open would be best for me in this situation but I cannot figure out why it isn't working.
0debug
Raycast in Three.js with only a projection matrix : <p>I'm rendering some custom layers using Three.js in a Mapbox GL JS page following <a href="https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/" rel="noreferrer">this example</a>. I'd like to add raycasting to determine which object a user has clicked on.</p> <p>The issue is that I only get a projection matrix from Mapbox, which I use to render the scene:</p> <pre class="lang-js prettyprint-override"><code>class CustomLayer { type = 'custom'; renderingMode = '3d'; onAdd(map, gl) { this.map = map; this.camera = new THREE.Camera(); this.renderer = new THREE.WebGLRenderer({ canvas: map.getCanvas(), context: gl, antialias: true, }); this.scene = new THREE.Scene(); // ... } render(gl, matrix) { this.camera.projectionMatrix = new THREE.Matrix4() .fromArray(matrix) .multiply(this.cameraTransform); this.renderer.state.reset(); this.renderer.render(this.scene, this.camera); } } </code></pre> <p>This renders just great, and tracks changes in view when I pan/rotate/zoom the map.</p> <p><a href="https://i.stack.imgur.com/iQXGc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iQXGc.png" alt="A cube on Liberty Island"></a></p> <p>Unfortunately, when I try to add raycasting I get an error:</p> <pre class="lang-js prettyprint-override"><code> raycast(point) { var mouse = new THREE.Vector2(); mouse.x = ( point.x / this.map.transform.width ) * 2 - 1; mouse.y = 1 - ( point.y / this.map.transform.height ) * 2; const raycaster = new THREE.Raycaster(); raycaster.setFromCamera(mouse, this.camera); console.log(raycaster.intersectObjects(this.scene.children, true)); } </code></pre> <p>This gives me an exception:</p> <pre><code>THREE.Raycaster: Unsupported camera type. </code></pre> <p>I can change from a generic <code>THREE.Camera</code> to a <code>THREE.PerspectiveCamera</code> without affecting the rendering of the scene:</p> <pre class="lang-js prettyprint-override"><code>this.camera = new THREE.PerspectiveCamera(28, window.innerWidth / window.innerHeight, 0.1, 1e6); </code></pre> <p>This fixes the exception but also doesn't result in any objects being logged. Digging a bit reveals that the camera's <code>projectionMatrixInverse</code> is all <code>NaN</code>s, which we can fix by calculating it:</p> <pre class="lang-js prettyprint-override"><code> raycast(point) { var mouse = new THREE.Vector2(); mouse.x = ( point.x / this.map.transform.width ) * 2 - 1; mouse.y = 1 - ( point.y / this.map.transform.height ) * 2; this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix); // &lt;-- const raycaster = new THREE.Raycaster(); raycaster.setFromCamera(mouse, this.camera); console.log(raycaster.intersectObjects(this.scene.children, true)); } </code></pre> <p>Now I get two intersections wherever I click, with two faces of the cube. Their distances are 0:</p> <pre><code>[ { distance: 0, faceIndex: 10, point: Vector3 { x: 0, y: 0, z: 0 }, uv: Vector2 {x: 0.5, y: 0.5}, ... }, { distance: 0, faceIndex: 11, point: Vector3 { x: 0, y: 0, z: 0 }, uv: Vector2 {x: 0.5, y: 0.5}, ... }, ] </code></pre> <p>So clearly something isn't working here. Looking at the <a href="https://github.com/mrdoob/three.js/blob/441fefadc017ebafd2d10089b6d48e1cd28795c2/src/core/Raycaster.js#L81-L83" rel="noreferrer">code for <code>setCamera</code></a>, it involves both <code>projectionMatrix</code> and <code>matrixWorld</code>. Is there a way I can set <code>matrixWorld</code>, or construct the raycaster's ray directly using only the projection matrix? It seems that I only need the projection matrix to render the scene, so I'd hope that it would also be all I need to cast a ray.</p> <p>Full example <a href="https://codepen.io/danvk/pen/GRggjmg?editors=0010" rel="noreferrer">in this codepen</a>.</p>
0debug
How To Use ScrollMagic with GSAP and Webpack : <p>In order to use <a href="http://scrollmagic.io/examples/basic/simple_tweening.html">ScrollMagic with GSAP</a>, you need to load the <code>animation.gsap.js</code> plugin. With Webpack you would do something like this to accomplish that (assuming you use the CommonJS syntax and installed everything with npm):</p> <pre><code>var TweenMax = require('gsap'); var ScrollMagic = require('scrollmagic'); require('ScrollMagicGSAP'); </code></pre> <p>To make sure that this actually works, you have to add an alias to your Webpack configuration, so that Webpack knows where the plugin lives.</p> <pre><code>resolve: { alias: { 'ScrollMagicGSAP': 'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap' } } </code></pre> <p><strong>Unfortunately</strong>, ScrollMagic keeps throwing an error, when you are using this configuration and the CommonJS syntax like above.</p> <pre><code>(ScrollMagic.Scene) -&gt; ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js </code></pre>
0debug
static int amr_probe(AVProbeData *p) { if (p->buf_size < 5) return 0; if(memcmp(p->buf,AMR_header,5)==0) return AVPROBE_SCORE_MAX; else return 0; }
1threat
Please help why I can not click on this element as followings code: : Actions action = new Actions(driver); IWebElement we = driver.FindElement(By.XPath(".//*[@class='ms-crm-CommandBar-Button ms-crm-Menu-Label']")); action.MoveToElement(driver.FindElement(By.XPath(".//*[@class='ms-crm-CommandBar-Button ms-crm-Menu-Label-Hovered']"))).Click().Build().Perform(); expect element as followings: < span tabindex = "-1" class="ms-crm-CommandBar-Button ms-crm-Menu-Label" style="max-width: 200px;"><a tabindex = "0" class="ms-crm-Menu-Label" onclick="return false"><img tabindex = "-1" class="ms-crm-ImageStrip-New_16 ms-crm-commandbar-image16by16" style="vertical-align: top;" src="/_imgs/imagestrips/transparent_spacer.gif"> <span tabindex = "-1" class="ms-crm-CommandBar-Menu" [enter image description here][1]style="max-width: 150px;" command="lead|NoRelationship|HomePageGrid|Mscrm.NewRecordFromGrid"> New</span><div class="ms-crm-div-NotVisible"> Create a new Lead record. </div> </a> </span> Note that this class "ms-crm-CommandBar-Button ms-crm-Menu-Label" turns to be "ms-crm-CommandBar-Button ms-crm-Menu-Label-Hovered" when mouseover. Many thanks. [1]: https://i.stack.imgur.com/szHeF.png
0debug
static void syborg_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; qemu_irq *cpu_pic; qemu_irq pic[64]; ram_addr_t ram_addr; DeviceState *dev; int i; if (!cpu_model) cpu_model = "cortex-a8"; env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } ram_addr = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_addr | IO_MEM_RAM); cpu_pic = arm_pic_init_cpu(env); dev = sysbus_create_simple("syborg,interrupt", 0xC0000000, cpu_pic[ARM_PIC_CPU_IRQ]); for (i = 0; i < 64; i++) { pic[i] = qdev_get_gpio_in(dev, i); } sysbus_create_simple("syborg,rtc", 0xC0001000, NULL); dev = qdev_create(NULL, "syborg,timer"); qdev_prop_set_uint32(dev, "frequency", 1000000); qdev_init(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xC0002000); sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[1]); sysbus_create_simple("syborg,keyboard", 0xC0003000, pic[2]); sysbus_create_simple("syborg,pointer", 0xC0004000, pic[3]); sysbus_create_simple("syborg,framebuffer", 0xC0005000, pic[4]); sysbus_create_simple("syborg,serial", 0xC0006000, pic[5]); sysbus_create_simple("syborg,serial", 0xC0007000, pic[6]); sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]); sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]); if (nd_table[0].vlan) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(&nd_table[0], "virtio"); dev = qdev_create(NULL, "syborg,virtio-net"); dev->nd = &nd_table[0]; qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0xc000c000); sysbus_connect_irq(s, 0, pic[9]); } syborg_binfo.ram_size = ram_size; syborg_binfo.kernel_filename = kernel_filename; syborg_binfo.kernel_cmdline = kernel_cmdline; syborg_binfo.initrd_filename = initrd_filename; syborg_binfo.board_id = 0; arm_load_kernel(env, &syborg_binfo); }
1threat
I Want to Query a table with two parameters in where condition and both the parameters are returned from another query : I Want to Query a table with two parameters in where condition and both the parameters are returned from another query. Let us say a table t1 with column1 and column2, if I use a query select column1,column2 from t1,suppose it return 10 records I want to query something like below for(int j=0;j<10;j++) { select * from t2 where t2.column1=t1.column1(jth position) and t2.column2=t1.column2(jth position) }
0debug
how to swap value in php? : I have an array $a = [1,9,8,7,6,5] I want to swap value in such way in PHP that if there is a 1,it should swap with next value i.e output should be $b = [9,1,8,7,6,5]
0debug
The Python Ethos : <p>I've read in an <em>Computer Science edX Course</em> that you can write <code>programs</code> to do the same thing in many ways. </p> <p>Then I came across two examples of simple <code>search</code> procedures:</p> <p>a 'pythonic' search:</p> <pre><code> def search(list, element): for e in list: if e == element: return True return False </code></pre> <p>a recursive search:</p> <pre><code>def rSearch(list,element): if element == list[0]: return True if len(list) == 1: return False return rSearch(list[1:],element) </code></pre> <p><strong>I ask</strong>: what is the essence of a pythonic code? </p>
0debug
convert jquery to plain JS : How do i convert this jquery code to plain plain JS? $("#txtTestNumbersOnlyRegex").keyup(function () { var newValue = $(this).val().replace(/[^0-9]/g,''); $(this).val(newValue); }); Thanks!!
0debug
alright this is my most rescent code : highest = {} def reader(): myfile = open("scores.txt","r") pre = myfile.readlines() print(pre) for line in pre : print(line) x = line.split(",") a = x[0] b = x[1] c = len(b)-1 b = b[0:c] highest[a] = b and this is the Traceback error message in full Traceback (most recent call last): File "C:/Python34/my boto snaky/snaky.py", line 568, in gameLoop reader() File "C:/Python34/my boto snaky/snaky.py", line 531, in reader b = x[1] IndexError: list index out of range
0debug
static int decode_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const HEVCParamSets *ps, void *logctx) { HEVCSEIPictureTiming *h = &s->picture_timing; HEVCSPS *sps; if (!ps->sps_list[s->active_seq_parameter_set_id]) return(AVERROR(ENOMEM)); sps = (HEVCSPS*)ps->sps_list[s->active_seq_parameter_set_id]->data; if (sps->vui.frame_field_info_present_flag) { int pic_struct = get_bits(gb, 4); h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN; if (pic_struct == 2) { av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n"); h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; } else if (pic_struct == 1) { av_log(logctx, AV_LOG_DEBUG, "TOP Field\n"); h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD; } get_bits(gb, 2); get_bits(gb, 1); } return 1; }
1threat
How to compile all included files into one using Babel? : <p>I am using Babel in my project. The thing is, I have this line of code in my <code>server.js</code>:</p> <pre><code>import schema from "./data/schema"; </code></pre> <p>(<code>data/schema.js</code> is in ES2015 syntax).</p> <p>And when I am trying to compile my <code>server.js</code> with babel, like this:</p> <pre><code>babel -o server_production.js --minified server.js </code></pre> <p>it produces a new file without errors and replaces <code>import</code> instruction with <code>require</code>. But the thing is, when I am trying to run my babel-compiled <code>server.js</code> with <code>node</code>, it complains about <code>data/schema.js</code>, because it wasn't transpiled into ES5, only required (the exact error is <code>Unexpected token "import"</code>, because I am using some other imports in <code>data/schema.js</code>).</p> <p>So, the question is: how can I compile my file and all the files it <code>import</code>s into one file? I tried <code>babel -o server_production.js --minified data/schema.js server.js</code>, but that didn't work either.</p>
0debug
"Solving Environment" during `conda install -c <my_channel> tensorflow` takes 3+ min but changing the name a bit reduces the time significantly : <p>I am writing a custom conda package for tensorflow. When I name the package "tensorflow" it takes it more than 3 minutes to get past the "solving environment" part but if I change the package name even a little bit, to "tensorflowp3" it loads in around 10 seconds. I am using the commands - </p> <p><code>conda install -c &lt;my_channel&gt; tensorflow</code></p> <p><code>conda install -c &lt;my_package&gt; tensorflowp3</code></p> <p>I am not sure why setting a slightly different package name causes such a significant time change. I am specifying which channel the package should be loaded from in the command as well. I have tried doing the same with locally stored packages using the --use-local tag as well but it still behaves the same way as with the channel name. Any help would be very appreciated. </p>
0debug
Switching between file paths in Java : <p>I am writing a mergesort for an externalsort, which reads 2 chunks of data at a time from a file A, merges them into a larger chunk, and writes it to a file B. After this, I need to then read 2 of these increased chunks at a time from file B, merge them into 1 larger chunk, and write this to file A. This switching goes on until all the data counts as 1 chunk at the end. </p> <p>I have tried swapping the identifiers around like this after each iteration:</p> <pre><code>RandomAccessFile temp = fileA; fileA = fileB; fileB = temp; </code></pre> <p>This requires, that I update the BufferedInput and BufferedOutputStreams with the new file directory names and construct them each time. </p> <p>I have a limited amount of RAM, so I cannot keep creating new objects unless I have to. Is there a better way to switch the target file and source file each iteration? </p>
0debug
cbind 2 dataframes with different number of rows : <p>I have two lists named <code>h</code> and <code>g</code>. They each contain 244 dataframes and they look like the following:</p> <pre><code>h[[1]] year avg hr sal 1 2010 0.300 31 2000 2 2011 0.290 30 4000 3 2012 0.275 14 600 4 2013 0.280 24 800 5 2014 0.295 18 1000 6 2015 0.330 26 7000 7 2016 0.315 40 9000 g[[1]] year pos fld 1 2010 A 0.990 2 2011 B 0.995 3 2013 C 0.970 4 2014 B 0.980 5 2015 D 0.990 </code></pre> <p>I want to <code>cbind</code> these two dataframes. But as you see, they have different number of rows. I want to combine these dataframes so that the rows with the same year will be combined in one row. And I want the empty spaces to be filled with <code>NA</code>. The result I expect looks like this:</p> <pre><code> year avg hr sal pos fld 1 2010 0.300 31 2000 A 0.990 2 2011 0.290 30 4000 B 0.995 3 2012 0.275 14 600 NA NA 4 2013 0.280 24 800 C 0.970 5 2014 0.295 18 1000 B 0.980 6 2015 0.330 26 7000 D 0.990 7 2016 0.315 40 9000 NA NA </code></pre> <p>Also, I want to repeat this for all the 244 dataframes in each list, <code>h</code> and <code>g</code>. I'd like to make a new list named <code>final</code> which contains the 244 combined dataframes.</p> <p>How can I do this...? All answers will be greatly appreciated :)</p>
0debug
Extract/Trim part of string, Java : <p>Say String x = MynameisMary;</p> <p>I want String Y to be "Mary"</p> <p>How do i remove the first 8 characters to make Y equal to Mary??</p>
0debug
Type int? vs type int : <p>I've this comparison which equals <code>false</code> as expected</p> <pre><code>bool eq = typeof(int?).Equals(typeof(int)); </code></pre> <p>now I have this code</p> <pre><code>List&lt;object&gt; items = new List&lt;object&gt;() { (int?)123 }; int result = items.OfType&lt;int&gt;().FirstOrDefault(); </code></pre> <p>but this returns <code>123</code> - anyway that value is of type <code>int?</code></p> <p>How can this be?</p>
0debug
static void put_bitmap(QEMUFile *f, void *pv, size_t size) { unsigned long *bmp = pv; int i, idx = 0; for (i = 0; i < BITS_TO_U64S(size); i++) { uint64_t w = bmp[idx++]; if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) { w |= ((uint64_t)bmp[idx++]) << 32; } qemu_put_be64(f, w); } }
1threat
static void patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_insn_unit *target; tcg_insn_unit old; value += addend; target = (tcg_insn_unit *)value; switch (type) { case R_PPC_REL14: reloc_pc14(code_ptr, target); break; case R_PPC_REL24: reloc_pc24(code_ptr, target); break; case R_PPC_ADDR16: assert(value == (int16_t)value); old = *code_ptr; old = deposit32(old, 0, 16, value); *code_ptr = old; break; default: tcg_abort(); } }
1threat
Write only, read only fields in django rest framework : <p>I have models like this:</p> <pre><code>class ModelA(models.Model): name = models.CharField() class ModelB(models.Model): f1 = models.CharField() model_a = models.ForeignKey(ModelA) </code></pre> <p>Serializers:</p> <pre><code>class ASerializer(serializers.ModelSerializer): model_b_ids = serializers.CharField() class Meta: model = ModelA write_only_fields = ('model_b_ids',) </code></pre> <p>views:</p> <pre><code>class AView(CreateModelMixin, GenericViewSet): def perform_create(self, serializer): model_b_ids = parse_somehow(serializer.validated_data["model_b_ids"]) #do something... </code></pre> <p>The problem I am getting is the with the "model_b_ids"</p> <p>The user should submit it while sending post data.</p> <p>I use it in perform_create to link to related models. </p> <p>But thats not "real column" in ModelA so when I try to save it is raising exception.</p> <p>I tried to it pop from validated_data but then again getting error somewhere that cannot read model_b_ids from model. Any idea on using this kind of field correctly ?</p>
0debug
void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) { int reslevelno, bandno, precno; for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) { Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; for (bandno = 0; bandno < reslevel->nbands; bandno++) { Jpeg2000Band *band = reslevel->band + bandno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) { Jpeg2000Prec *prec = band->prec + precno; av_freep(&prec->zerobits); av_freep(&prec->cblkincl); av_freep(&prec->cblk); } av_freep(&band->prec); } av_freep(&reslevel->band); } ff_dwt_destroy(&comp->dwt); av_freep(&comp->reslevel); av_freep(&comp->data); }
1threat
How to trim after 1 letter from space C#? : <p>Hello I'm trying to take out the first word and the first from the second and with no blank space from a string but I got no success. How can I do it?</p> <p>Example: I have the words: HELLO WORLD! and I want to get: HELLOW Or: LAPTOP COVER and get LAPTOPC</p> <p>There's no limit of letters for the first word. Thank you all!</p>
0debug
Sudden SQL problem - need to understand the source of the issue : So I have a list of servers as a website - out of no where - when you try to add a new server it gives an error - https://media.discordapp.net/attachments/346650145565179904/545234753142652932/unknown.png?width=1063&height=598 I went ahead and set a default value for it in phpymadmin, it asked for default values of more things - and after I set it it gave me some problems with the database. Any ideas what could be the source of this issue and where I could try to fix it?
0debug
Python 3.X iteration through lists : Looking for some help iterating through lists. I have the following code: import numpy as np import random dic = {2:[],4:[]} lis = [] for number in range(0,10): lis.append(random.sample(range(0,9),8)) lis[-1].append(random.randint(2,4)) for i in lis: dic[i[-1]].append(i[:-1]) I am trying to place the randomized items, appended with a 2 or a 4 at the end, into a predefined dictionary called dir. Thanks in advance - this is my first question so I apologize for any redundancy.
0debug
static void qemu_rdma_init_one_block(void *host_addr, ram_addr_t block_offset, ram_addr_t length, void *opaque) { rdma_add_block(opaque, host_addr, block_offset, length); }
1threat
TCGv_i32 tcg_global_reg_new_i32(int reg, const char *name) { int idx; idx = tcg_global_reg_new_internal(TCG_TYPE_I32, reg, name); return MAKE_TCGV_I32(idx); }
1threat
static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver, SocketAddress *addr, size_t *naddrs, SocketAddress ***addrs, Error **errp) { struct addrinfo ai, *res, *e; InetSocketAddress *iaddr = addr->u.inet.data; char port[33]; char uaddr[INET6_ADDRSTRLEN + 1]; char uport[33]; int rc; Error *err = NULL; size_t i; *naddrs = 0; *addrs = NULL; memset(&ai, 0, sizeof(ai)); ai.ai_flags = AI_PASSIVE; if (iaddr->has_numeric && iaddr->numeric) { ai.ai_flags |= AI_NUMERICHOST | AI_NUMERICSERV; } ai.ai_family = inet_ai_family_from_address(iaddr, &err); ai.ai_socktype = SOCK_STREAM; if (err) { error_propagate(errp, err); return -1; } if (iaddr->host == NULL) { error_setg(errp, "host not specified"); return -1; } if (iaddr->port != NULL) { pstrcpy(port, sizeof(port), iaddr->port); } else { port[0] = '\0'; } rc = getaddrinfo(strlen(iaddr->host) ? iaddr->host : NULL, strlen(port) ? port : NULL, &ai, &res); if (rc != 0) { error_setg(errp, "address resolution failed for %s:%s: %s", iaddr->host, port, gai_strerror(rc)); return -1; } for (e = res; e != NULL; e = e->ai_next) { (*naddrs)++; } *addrs = g_new0(SocketAddress *, *naddrs); for (i = 0, e = res; e != NULL; i++, e = e->ai_next) { SocketAddress *newaddr = g_new0(SocketAddress, 1); InetSocketAddress *newiaddr = g_new0(InetSocketAddress, 1); newaddr->u.inet.data = newiaddr; newaddr->type = SOCKET_ADDRESS_KIND_INET; getnameinfo((struct sockaddr *)e->ai_addr, e->ai_addrlen, uaddr, INET6_ADDRSTRLEN, uport, 32, NI_NUMERICHOST | NI_NUMERICSERV); *newiaddr = (InetSocketAddress){ .host = g_strdup(uaddr), .port = g_strdup(uport), .has_numeric = true, .numeric = true, .has_to = iaddr->has_to, .to = iaddr->to, .has_ipv4 = false, .has_ipv6 = false, }; (*addrs)[i] = newaddr; } freeaddrinfo(res); return 0; }
1threat
Keras loading color images : <p>I have 3 folders with color images. Name of the folder is label for the images inside.</p> <pre><code>cls1 |____img_0.png |____ ... |____img_n.png cls2 |____img_0.png |____ ... |____img_n.png cls3 |____img_0.png |____ ... |____img_n.png </code></pre> <p>I would like to use Keras library to create Convolutional neural network for classification, but I can't find, how to create dataset from color images. Can you help me?</p>
0debug
Javascript -What happens if a variable and a function have the same name? : <p>Might be a kind of easy question, but I have a question on the issue of having the same name for a variable and a function.</p> <p>If there's a variable,</p> <pre><code>var add = 1; </code></pre> <p>and a function,</p> <pre><code>function add(x,y) {return x+y;} </code></pre> <p>and there're two console.log,</p> <pre><code>console.log(add) console.log(add(1,2)) </code></pre> <p>I've expected those 2 console.log would work properly since add contains the Number and add() is classified as a Function, but the second one prints an error. So they aren't considered the same.</p> <p>But the result says I'm wrong. Can anyone explain what's going on in my code?</p>
0debug
Test instrumentation process crashed - where is the .txt file? : <p>Sometimes, while Espresso testing, I see the following exception. </p> <pre><code>Test instrumentation process crashed. Check package_name.TestName#methodName.txt for details </code></pre> <p>Where is this <code>.txt</code> file stored? I can't seem to find it anywhere.</p> <h3>Use Case</h3> <p>In Jenkins (CI), I want the logs to see exactly what stacktrace caused the crash.</p>
0debug
X = Y = Lists vs Numbers : <p>In python : I have 2 pieces of code behaving different when I modify values:</p> <p>X = Y = Number</p> <pre><code>x = y = 2 x = 3 print(x) print(y) Output: 3 2 </code></pre> <p>X = Y = [List]</p> <pre><code>x = y = ['a','b'] x[0] = 'd' print(x) print(y) Output: ['d', 'b'] ['d', 'b'] </code></pre> <p><strong>Why don't LISTS respect the original value of variable Y if X is changed?</strong> </p>
0debug
Mongodb how to insert ONLY if does not exists (no update if exist)? : <p>How can I insert a document if it does not exist while not updating existing document if it exists? </p> <p>let's say I have a document as follows:</p> <pre><code> { "company":"test", "name":"nameVal" } </code></pre> <p>I want to check whether the collection contains company <code>test</code>, if it doesn't exist I want to create a new document. If it exists I want to do NOTHING. I tried <code>update</code> with <code>upsert = true</code>. But it updates the existing document if it exists. </p> <p>This is what I tried: </p> <pre><code>db.getCollection('companies').update( { "company": "test" }, { "company": "test", "name": "nameVal2" }, {upsert:true} ) </code></pre> <p>Appreciate any help to resolve this using one query. </p>
0debug
How to style all links of a div with subelements? : <div class="container-1"> <div class="container-2"> <a href="#">Link 1</a> <div class="container-3"> <a href="#">Link 2</a> </div </div> <div class="container-4"> <a href="#">Link 3</a> </div> </div> <div class="container-5"> <div class="container-6"> <a href="#">Link 4</a> <div class="container-7"> <a href="#">Link 5</a> </div </div> <div class="container-8"> <a href="#">Link 6</a> </div> </div> I want every link in **container-1** to have the attribute **"text-decoration: underline;"**. What is the best way to achieve this without also changing **container-5** links?
0debug
really basic newbie python : <p>any reason why this doesn't work?</p> <pre><code>import random answer = random.randint(2, 4) print(answer) txt = input("what number") if answer == txt: print("correct") </code></pre> <p>every time I enter the correct answer, it just comes back empty (or as an else statement if I put it) I had this working last night although now I cannot work out why it won't, PS. i've just started to learn python this week so please go easy on me </p>
0debug
SQL get the min time record per date : i need a help here, im trying to build a query which returns the max and min time per date in one row for example i have this table: +---------+------------------------+----------+ |name |Dates |Door | +---------+------------------------+----------+ |Maria |2012-02-14 09:04:45.397 |Garage | |Maria |2012-02-14 12:14:20.997 |Enctrance | |Maria |2013-02-14 12:20:59.407 |Exit | |Maria |2012-02-13 12:24:20.997 |garage | |Eli |2013-02-13 10:30:59.407 |Entrance | |Eli |2013-02-13 12:30:59.407 |Exit | +---------+------------------------+----------+ the results should be like +---------+------------------------+-----------------------------+ |name |Entrance |Exit | +---------+------------------------+-----------------------------+ |Maria |2012-02-14 09:04:45.397 |2013-02-14 12:20:59.407 | |Maria |2012-02-13 12:14:20.997 | null | |Eli |2013-02-13 10:30:59.407 |2013-02-13 12:30:59.407 | +---------+------------------------+-----------------------------+ any help would appreciate :)
0debug
how to check an ip address is local : <p>Here is code:</p> <pre><code>def isSrsInternal(srcip): here i want to write code to check that srcip is local source to thet network or not if srcip is local than it will return true else return false </code></pre> <p>1 Can anyone give me the idea to writing that function</p>
0debug
Denying a Sign-up request in Cognito User Pools : <p>The description of a Cognito User Pools Pre Sign-up Lambda Trigger is: </p> <blockquote> <p>This trigger is invoked when a user submits their information to sign up, allowing you to perform custom validation to accept or deny the sign up request.</p> </blockquote> <p>I want to deny a sign-up request based on a certain condition in my Lambda. The trigger parameters (reproduced from the docs below) seem to only support auto-verification and auto-confirmation: </p> <pre><code>{ "request": { "userAttributes": { "string": "string", .... }, "validationData": { "string": "string", "string": "string", .... } }, "response": { "autoConfirmUser": "boolean", "autoVerifyPhone": "boolean", "autoVerifyEmail": "boolean" } } </code></pre> <p>How can I accept or deny a sign-up request based on the outcome of the Pre Sign-up Lambda Trigger?</p>
0debug
static int htab_load(QEMUFile *f, void *opaque, int version_id) { sPAPRMachineState *spapr = opaque; uint32_t section_hdr; int fd = -1; if (version_id < 1 || version_id > 1) { error_report("htab_load() bad version"); return -EINVAL; } section_hdr = qemu_get_be32(f); if (section_hdr) { Error *local_err; spapr_reallocate_hpt(spapr, section_hdr, &local_err); if (local_err) { error_report_err(local_err); return -EINVAL; } return 0; } if (!spapr->htab) { assert(kvm_enabled()); fd = kvmppc_get_htab_fd(true); if (fd < 0) { error_report("Unable to open fd to restore KVM hash table: %s", strerror(errno)); } } while (true) { uint32_t index; uint16_t n_valid, n_invalid; index = qemu_get_be32(f); n_valid = qemu_get_be16(f); n_invalid = qemu_get_be16(f); if ((index == 0) && (n_valid == 0) && (n_invalid == 0)) { break; } if ((index + n_valid + n_invalid) > (HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) { error_report( "htab_load() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)", index, n_valid, n_invalid, spapr->htab_shift); return -EINVAL; } if (spapr->htab) { if (n_valid) { qemu_get_buffer(f, HPTE(spapr->htab, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { memset(HPTE(spapr->htab, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { int rc; assert(fd >= 0); rc = kvmppc_load_htab_chunk(f, fd, index, n_valid, n_invalid); if (rc < 0) { return rc; } } } if (!spapr->htab) { assert(fd >= 0); close(fd); } return 0; }
1threat
static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors, int sector_size) { s->lba = lba; s->packet_transfer_size = nb_sectors * sector_size; s->io_buffer_index = 0; s->io_buffer_size = 0; s->cd_sector_size = sector_size; block_acct_start(bdrv_get_stats(s->bs), &s->acct, s->packet_transfer_size, BLOCK_ACCT_READ); s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT; ide_start_dma(s, ide_atapi_cmd_read_dma_cb); }
1threat
changing the date format from 1-3-2019 to 01-03-2019 : I don't know to format the dates which are inserted as "7-1-2019" to "07-01-2019" can someone help me with that? I was trying with this [, rq_date_inserted1:= as.Date(rq_date_inserted1, "%d/%mm/%Y")] but thats not working properly as after doing so some of the dates are not recognized;/
0debug
Column in sql writes for too many times : I'm trying to make a query which shows the name of the guys(Angajat.nume and Angajat.prenume) and the salary (Angajat.salar) working at a restaurant(Restau.nume) and instead of writing it for 5 times, it writes for 25 times. I have 5 workers(id_a) and 1 restaurant(id_r) and 5 menu(id_m). How can I make it to show only for 5 times and keep the Meniu table in the query? [My Relations and Data Base][1] [My Query][2] [1]: https://i.stack.imgur.com/qRYgF.png [2]: https://i.stack.imgur.com/vtWZL.png
0debug
static int rtmp_handshake(URLContext *s, RTMPContext *rt) { AVLFG rnd; uint8_t tosend [RTMP_HANDSHAKE_PACKET_SIZE+1] = { 3, 0, 0, 0, 0, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4, }; uint8_t clientdata[RTMP_HANDSHAKE_PACKET_SIZE]; uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1]; int i; int server_pos, client_pos; uint8_t digest[32], signature[32]; int ret, type = 0; av_log(s, AV_LOG_DEBUG, "Handshaking...\n"); av_lfg_init(&rnd, 0xDEADC0DE); for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++) tosend[i] = av_lfg_get(&rnd) >> 24; if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { tosend[0] = 6; tosend[5] = 128; tosend[6] = 0; tosend[7] = 3; tosend[8] = 2; if ((ret = ff_rtmpe_gen_pub_key(rt->stream, tosend + 1)) < 0) client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, rt->encrypted); if (client_pos < 0) return client_pos; if ((ret = ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1)) < 0) { av_log(s, AV_LOG_ERROR, "Cannot write RTMP handshake request\n"); if ((ret = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1)) < 0) { av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); if ((ret = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE)) < 0) { av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); av_log(s, AV_LOG_DEBUG, "Type answer %d\n", serverdata[0]); av_log(s, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n", serverdata[5], serverdata[6], serverdata[7], serverdata[8]); if (rt->is_input && serverdata[5] >= 3) { server_pos = rtmp_validate_digest(serverdata + 1, 772); if (server_pos < 0) return server_pos; if (!server_pos) { type = 1; server_pos = rtmp_validate_digest(serverdata + 1, 8); if (server_pos < 0) return server_pos; if (!server_pos) { av_log(s, AV_LOG_ERROR, "Server response validating failed\n"); return AVERROR(EIO); ret = ff_rtmp_calc_digest(tosend + 1 + client_pos, 32, 0, rtmp_server_key, sizeof(rtmp_server_key), digest); if (ret < 0) ret = ff_rtmp_calc_digest(clientdata, RTMP_HANDSHAKE_PACKET_SIZE - 32, 0, digest, 32, signature); if (ret < 0) if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1, tosend + 1, type)) < 0) ff_rtmpe_encrypt_sig(rt->stream, signature, digest, serverdata[0]); if (memcmp(signature, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) { av_log(s, AV_LOG_ERROR, "Signature mismatch\n"); return AVERROR(EIO); for (i = 0; i < RTMP_HANDSHAKE_PACKET_SIZE; i++) tosend[i] = av_lfg_get(&rnd) >> 24; ret = ff_rtmp_calc_digest(serverdata + 1 + server_pos, 32, 0, rtmp_player_key, sizeof(rtmp_player_key), digest); if (ret < 0) ret = ff_rtmp_calc_digest(tosend, RTMP_HANDSHAKE_PACKET_SIZE - 32, 0, digest, 32, tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32); if (ret < 0) if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { ff_rtmpe_encrypt_sig(rt->stream, tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32, digest, serverdata[0]); if ((ret = ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE)) < 0) if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0) } else { if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1, tosend + 1, 1)) < 0) if (serverdata[0] == 9) { ff_rtmpe_encrypt_sig(rt->stream, signature, digest, serverdata[0]); if ((ret = ffurl_write(rt->stream, serverdata + 1, RTMP_HANDSHAKE_PACKET_SIZE)) < 0) if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0) return 0;
1threat
static void usbredir_realize(USBDevice *udev, Error **errp) { USBRedirDevice *dev = USB_REDIRECT(udev); int i; if (!qemu_chr_fe_get_driver(&dev->cs)) { error_setg(errp, QERR_MISSING_PARAMETER, "chardev"); return; } if (dev->filter_str) { i = usbredirfilter_string_to_rules(dev->filter_str, ":", "|", &dev->filter_rules, &dev->filter_rules_count); if (i) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "filter", "a usb device filter string"); return; } } dev->chardev_close_bh = qemu_bh_new(usbredir_chardev_close_bh, dev); dev->device_reject_bh = qemu_bh_new(usbredir_device_reject_bh, dev); dev->attach_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, usbredir_do_attach, dev); packet_id_queue_init(&dev->cancelled, dev, "cancelled"); packet_id_queue_init(&dev->already_in_flight, dev, "already-in-flight"); usbredir_init_endpoints(dev); udev->auto_attach = 0; dev->compatible_speedmask = USB_SPEED_MASK_FULL | USB_SPEED_MASK_HIGH; qemu_chr_fe_set_handlers(&dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev, NULL, true); qemu_add_vm_change_state_handler(usbredir_vm_state_change, dev); }
1threat
Unable to send messages to google firebase : Everything is setup on my android project from installing android studio, enabling the firebase, then assigning the context to my oncreate() method and then giving reference to my database URL . Everything runs fine but when i try to send a sample message to my database from a edittext nothing gets updated on it. i am totally new to firebase. maybe im missing basic things but what, i cant figure out.
0debug
how would i append and overwrite to a position in a list : How would i append to a position in a list and if that position is taken overwrite it and then display the position in the list next to it if the user then selected the second option in the program i have created so far sorry i'm new to python names = [] while True: print ('1 = Add Name ') print ('2 = Display List ') print ('3 = Quit \n') choice = input('What would you like to do: ') if choice == '1': number=input('Enter name: ') position= input('What position in the list would you like to add to: ') names.append(name) if(len(names) > 11): print("You cannot enter more names") continue if choice == '2': print(names) continue if choice == '3': print('Program Terminating') break else: print('You have entered something invalid please use numbers from 1-3 ') continue
0debug
pandas pd.options.display.max_rows not working as expected : <p>I’m using pandas 0.25.1 in Jupyter Lab and the maximum number of rows I can display is 10, regardless of what <code>pd.options.display.max_rows</code> is set to. </p> <p>However, if <code>pd.options.display.max_rows</code> is set to less than 10 it takes effect and if <code>pd.options.display.max_rows = None</code> then all rows show.</p> <p>Any idea how I can get a <code>pd.options.display.max_rows</code> of more than 10 to take effect?</p>
0debug
What does this C program do? : <pre><code>#include &lt;stdio.h&gt; int main(){ char c; while((c = getchar()) != EOF){ if(c &gt;= 'A' &amp;&amp; c &lt;= 'Z') c = c - 'A' + 'a'; putchar(c); } return 0; } </code></pre> <p>Came across this C code in MIT's Practical Programming in C. Can anyone explain how this program works?</p>
0debug
How do i change custom url links in Druapl 7? : Am using druapl 7 website. My default page url is website.com/category/4 I want to change this url like website.com/category/title Pls suggest me to change syntax.
0debug
python: converting data from sqlite3 database into an array format : i have a problem where i am trying to call a specific field from the data recovered by the "self.results" variable from the sqlite3 login database, although i am unable to do this as i believe that the fetched data is not in an array format and therefore the system is unable to use that field, i got rid of all the " ' ", "(", ")" but i do not know what to do now to convert this text file into an array so that a field can be fetched and printed. could you help please? Thank you while True: username = self.usernameEntry.get() password = self.passwordEntry.get() conn = sqlite3.connect("database.db") cursor = conn.cursor() findUser = ("SELECT * FROM students WHERE CardNumberID = ? AND Password = ?") cursor.execute(findUser, [(username), (password)]) self.results = cursor.fetchone() fetchedResults = str(self.results) fetchedResults = fetchedResults.replace('(', '') fetchedResults = fetchedResults.replace(')', '') fetchedResults = fetchedResults.replace("'", '') fetchedResults.split(',') print(fetchedResults[2]) print(self.results) and here are the results that i get... [outcome "print" from logging in, into an account ][1] [1]: https://i.stack.imgur.com/O550B.png
0debug
ser_read(void *opaque, target_phys_addr_t addr, unsigned int size) { struct etrax_serial *s = opaque; D(CPUCRISState *env = s->env); uint32_t r = 0; addr >>= 2; switch (addr) { case R_STAT_DIN: r = s->rx_fifo[(s->rx_fifo_pos - s->rx_fifo_len) & 15]; if (s->rx_fifo_len) { r |= 1 << STAT_DAV; } r |= 1 << STAT_TR_RDY; r |= 1 << STAT_TR_IDLE; break; case RS_STAT_DIN: r = s->rx_fifo[(s->rx_fifo_pos - s->rx_fifo_len) & 15]; if (s->rx_fifo_len) { r |= 1 << STAT_DAV; s->rx_fifo_len--; } r |= 1 << STAT_TR_RDY; r |= 1 << STAT_TR_IDLE; break; default: r = s->regs[addr]; D(qemu_log("%s " TARGET_FMT_plx "=%x\n", __func__, addr, r)); break; } return r; }
1threat
Excel sumproduct proble, : [Spreadsheet with data (TV tab)][1] [Summary tab][2] Hi I am trying to get the revenue for the year to date in the Summary tab . I did this but it doesn't work =SUMPRODUCT((TB!A:A="IS-1*")*(Months<=E2)*(TB!C5:N41)) [Instructions][3] [1]: https://i.stack.imgur.com/2g1aX.png [2]: https://i.stack.imgur.com/eFz8C.png [3]: https://i.stack.imgur.com/FfhoT.png
0debug
Angular2 FormGroup disabled field value : <p>I have a reactive form. One field is disabled, so how do i get that value from the form in controller? Writing the the FormGroup to console it doesnt display the disabled field at all, even tho it's displayed in the view.</p>
0debug
JavaScript: I don't understant where that 'value' come from, and what that 'set' is? : The task is: </br> Modify the code of makeCounter() </br>so that the counter can also decrease and set the number:</br> function makeCounter() { let count = 0; function counter() { return count++ } Here is this 'value'. I understand what it does. But what is it, </br> and where did it come from. How can I use it in general? </br> counter.set = value => count = value; counter.decrease = () => count--; return counter; } let counter = makeCounter(); alert( counter() ); // 0 alert( counter() ); // 1 // Also here. What kind of 'set' is this? </br> I've seen one in Map.prototype.set(), but there is no Map here. </br> counter.set(10); // set the new count alert( counter() ); // 10 counter.decrease(); // decrease the count by 1 alert( counter() ); // 10 (instead of 11) source: http://javascript.info/function-object </br> Thanks a lot for you understanding and your help.
0debug
How to split a string in a list into multiple string based on whitespaces in python? : <p>Here, 'list' is my list of strings, i want to split 'a b' into 'a','b' and merge it back into the list with other strings</p> <pre><code>list = ['abc','a b', 'a b c','1234'] Expected Output after splitting = ['abc','a','b','a','b','c','1234'] </code></pre>
0debug
static void rac_normalise(RangeCoder *c) { for (;;) { c->range <<= 8; c->low <<= 8; if (c->src < c->src_end) { c->low |= *c->src++; } else if (!c->low) { c->got_error = 1; return; } if (c->range >= RAC_BOTTOM) return; } }
1threat
static void ape_unpack_mono(APEContext *ctx, int count) { if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n"); return; } entropy_decode(ctx, count, 0); ape_apply_filters(ctx, ctx->decoded[0], NULL, count); predictor_decode_mono(ctx, count); if (ctx->channels == 2) { memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1])); } }
1threat
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float* in, int buffer_length, int filter_length) { int i,n; #if 0 for (n = 0; n < buffer_length; n++) { out[n] = in[n]; for (i = 1; i <= filter_length; i++) out[n] -= filter_coeffs[i-1] * out[n-i]; } #else float out0, out1, out2, out3; float old_out0, old_out1, old_out2, old_out3; float a,b,c; a = filter_coeffs[0]; b = filter_coeffs[1]; c = filter_coeffs[2]; b -= filter_coeffs[0] * filter_coeffs[0]; c -= filter_coeffs[1] * filter_coeffs[0]; c -= filter_coeffs[0] * b; old_out0 = out[-4]; old_out1 = out[-3]; old_out2 = out[-2]; old_out3 = out[-1]; for (n = 0; n <= buffer_length - 4; n+=4) { float tmp0,tmp1,tmp2; float val; out0 = in[0]; out1 = in[1]; out2 = in[2]; out3 = in[3]; out0 -= filter_coeffs[2] * old_out1; out1 -= filter_coeffs[2] * old_out2; out2 -= filter_coeffs[2] * old_out3; out0 -= filter_coeffs[1] * old_out2; out1 -= filter_coeffs[1] * old_out3; out0 -= filter_coeffs[0] * old_out3; val = filter_coeffs[3]; out0 -= val * old_out0; out1 -= val * old_out1; out2 -= val * old_out2; out3 -= val * old_out3; for (i = 5; i <= filter_length; i += 2) { old_out3 = out[-i]; val = filter_coeffs[i-1]; out0 -= val * old_out3; out1 -= val * old_out0; out2 -= val * old_out1; out3 -= val * old_out2; old_out2 = out[-i-1]; val = filter_coeffs[i]; out0 -= val * old_out2; out1 -= val * old_out3; out2 -= val * old_out0; out3 -= val * old_out1; FFSWAP(float, old_out0, old_out2); old_out1 = old_out3; } tmp0 = out0; tmp1 = out1; tmp2 = out2; out3 -= a * tmp2; out2 -= a * tmp1; out1 -= a * tmp0; out3 -= b * tmp1; out2 -= b * tmp0; out3 -= c * tmp0; out[0] = out0; out[1] = out1; out[2] = out2; out[3] = out3; old_out0 = out0; old_out1 = out1; old_out2 = out2; old_out3 = out3; out += 4; in += 4; } out -= n; in -= n; for (; n < buffer_length; n++) { out[n] = in[n]; for (i = 1; i <= filter_length; i++) out[n] -= filter_coeffs[i-1] * out[n-i]; } #endif }
1threat
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); } }
1threat
Changing Theme in Windows 10 UWP App Programmatically : <p>I was able to change theme using <code>this.RequestedTheme = ElementTheme.Dark;</code> But what I need is the whole application level, since this one only change the theme of the current page to dark.</p> <p>Whenever I try this <code>App.Current.RequestedTheme = ApplicationTheme.Dark;</code> I always get this error</p> <blockquote> <p>An exception of type 'System.NotSupportedException' occurred in UWPApp.exe but was not handled in user code</p> </blockquote> <p>Is there such a way that I can change the whole application theme from Light to Dark or vice versa?</p> <p>I'm using VS2015</p>
0debug
React js - What is the difference betwen HOC and decorator : <p>Can someone explain what is the difference between these two? I mean except the syntactic difference, do both of these techniques are used to achieve the same thing (which is to reuse component logic)?</p>
0debug
i can not identify the mistake in my code : <p>// i dont know where is the problem here </p> <p>package javaapplication3; import java.util.Scanner;</p> <p>public class JavaApplication3 {</p> <pre><code>public static void main(String[] args) { Scanner keyboard=new Scanner(System.in); int num1,num2; String input; input= new String(); char again; while (again =='y' || again =='Y') { System.out.print("enter a number:"); num1=keyboard.nextInt(); System.out.print("enter another number:"); num2=keyboard.nextInt(); System.out.println("their sum is "+ (num1 + num2)); System.out.println("do you want to do this again?"); } } </code></pre>
0debug
Replacing all fixed size substring of string - Pyhton : I have the following problem: 1. I have a very long string (len of strings = 54883508) 2. I need to replace all sub-strings in a very short time The string contains stuff following this pattern: aaaaaaaaaaaaaaaaaaaaaaXXXXXXXXXCCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaXXXXXXXXXCCaaaaaaaaaaXXXXXXXXXCCaaaaaaaaaaaaXXXXXXXXXCCaaaaaaaaaaaaaaaaXXXXXXXXXCCaaXXXXXXXXXCCaXXXXXXXXXCCaaaaaaaaaaaaaaaaaaaaXXXXXXXXXCC I need to replace XXXXXXXXXCC but the only thing I know is the position of CC as XXXXXXXXX is dynamic and random. Any ideea?
0debug
How do I store a Swift Struct in Core Data on iOS? : <p>At the moment I'm storing one of my classes as NSData in a plist and obviously that isn't a good way to do it.</p> <p>So I'm trying to set up Core Data, but my class has Structs. This is what I have:</p> <pre><code>import Foundation import CoreData class Favourite: NSManagedObject { @NSManaged var origin: Stop struct Stop { var name: String; var id: String; } } </code></pre> <p>But this is no good because it says</p> <p><em>Property cannot be marked as @NSManaged because its type cannot be represented in Objective-C</em></p> <p>Furthermore, if this error did not occur, I don't know what I'd set it up as in my xcdatamodeld file.</p> <p>I guess I could store the values in the struct and assign on initialisation of the object? Is this the most optimal/clean way?</p>
0debug
How do I make a music start in thebackground when my program starts in c#? : <p>I am trying to make a .wav music file start whenever the program starts. <strong>No, I am not trying to make music play when the user click on a button</strong>, I am trying to make music start by itself whenever the program starts.</p> <p>I need it for my C# program.</p>
0debug
static long kvm_hypercall(unsigned long nr, unsigned long param1, unsigned long param2) { register ulong r_nr asm("1") = nr; register ulong r_param1 asm("2") = param1; register ulong r_param2 asm("3") = param2; register long retval asm("2"); asm volatile ("diag 2,4,0x500" : "=d" (retval) : "d" (r_nr), "0" (r_param1), "r"(r_param2) : "memory", "cc"); return retval; }
1threat
separate file for routes in express : <p>I was wondering how do I move all of my api routes in express into a separate <code>routes.js</code> file from my <code>server.js</code> file</p> <p>I have a long list of api routes using <code>app.use()</code> for each route. So each route is in its own file, e.g. <code>movies.js</code>, <code>movie.js</code> but when I list these it makes for a long list in <code>server.js</code></p> <p>So I want to remove the list of api endpoints section from the below <code>server.js</code> out to a <code>routes.js</code> file. </p> <p>Here is what I have currently:</p> <p><strong>server.js</strong></p> <pre><code>import path from 'path' import express from 'express' import webpack from 'webpack' import webpackDevMiddleware from 'webpack-dev-middleware' import webpackConfig from './webpack.config.dev' const app = express(); /* api endpoints, can be many more, I want them in routes.js */ app.use('/api/movies', require('./src/api/routes/movies')) app.use('/api/movie', require('./src/api/routes/movie')) app.use(webpackDevMiddleware(webpack(webpackConfig), { publicPath: webpackConfig.output.publicPath })); app.use('/public', express.static(__dirname + '/public')) app.get('*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); }); app.listen(3000, 'localhost', function (err) { if (err) { console.log(err); return; } }) </code></pre> <p>An example route </p> <p><strong>movies.js</strong></p> <pre><code>var express = require('express'); var request = require("request"); var router = express.Router(); router.get('/', function(req, res) { res.json({}) }); module.exports = router; </code></pre>
0debug
bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, bool is_read) { BlockDriver *drv = bs->drv; if (!drv) { return -ENOMEDIUM; } else if (drv->bdrv_load_vmstate) { return is_read ? drv->bdrv_load_vmstate(bs, qiov, pos) : drv->bdrv_save_vmstate(bs, qiov, pos); } else if (bs->file) { return bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read); } return -ENOTSUP; }
1threat
theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts) { struct ogg *ogg = ctx->priv_data; struct ogg_stream *os = ogg->streams + idx; struct theora_params *thp = os->private; uint64_t iframe = gp >> thp->gpshift; uint64_t pframe = gp & thp->gpmask; if (thp->version < 0x030201) iframe++; if(!pframe) os->pflags |= AV_PKT_FLAG_KEY; if (dts) *dts = iframe + pframe; return iframe + pframe; }
1threat
"ERROR: Unexpected action: build" when building a project with Swift 3 and Cocoapods on Travis-CI : <p>Evening/morning/afternoon all,</p> <p>Been hitting my head over this for a bit now and couldn't find anything online about this so my best bet is here.</p> <p>When Travis-CI builds my project I get the following error:</p> <pre><code> xctool -workspace Project.xcworkspace -scheme ProjectTests build test ERROR: Unexpected action: build </code></pre> <p>and here is my config:</p> <pre><code>language: objective-c xcode_workspace: Project.xcworkspace xcode_scheme: ProjectTests osx_image: xcode8.2 </code></pre> <p>Perhaps I missed something in the tutorial? I got a little lost on the pods dependency section but I believe I did it right. This happens with a new scheme (ProjectTests) created and with the original scheme (Project). I added the dependencies for the ProjectTests scheme in the Build phase like it said but still no dice. Any ideas?</p>
0debug
vdi_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVdiState *s = bs->opaque; QEMUIOVector local_qiov; uint32_t bmap_entry; uint32_t block_index; uint32_t offset_in_block; uint32_t n_bytes; uint64_t bytes_done = 0; int ret = 0; logout("\n"); qemu_iovec_init(&local_qiov, qiov->niov); while (ret >= 0 && bytes > 0) { block_index = offset / s->block_size; offset_in_block = offset % s->block_size; n_bytes = MIN(bytes, s->block_size - offset_in_block); logout("will read %u bytes starting at offset %" PRIu64 "\n", n_bytes, offset); bmap_entry = le32_to_cpu(s->bmap[block_index]); if (!VDI_IS_ALLOCATED(bmap_entry)) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); ret = 0; } else { uint64_t data_offset = s->header.offset_data + (uint64_t)bmap_entry * s->block_size + offset_in_block; qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file->bs, data_offset, n_bytes, &local_qiov, 0); } logout("%u bytes read\n", n_bytes); bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } qemu_iovec_destroy(&local_qiov); return ret; }
1threat
How to play audio while animation in unity 3D? : <p>I'm new unity 3D developer i want to play audio while animation at the time set. How to play audio while animation in unity 3D?</p>
0debug
int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int l2_index, ret; uint64_t l2_offset, *l2_table; int64_t cluster_offset; unsigned int nb_clusters, i = 0; QCowL2Meta *old_alloc; ret = get_cluster_table(bs, offset, &l2_table, &l2_offset, &l2_index); if (ret < 0) { return ret; } again: nb_clusters = size_to_clusters(s, n_end << 9); nb_clusters = MIN(nb_clusters, s->l2_size - l2_index); cluster_offset = be64_to_cpu(l2_table[l2_index]); if (cluster_offset & QCOW_OFLAG_COPIED) { nb_clusters = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], 0, 0); cluster_offset &= ~QCOW_OFLAG_COPIED; m->nb_clusters = 0; goto out; } if (cluster_offset & QCOW_OFLAG_COMPRESSED) nb_clusters = 1; while (i < nb_clusters) { i += count_contiguous_clusters(nb_clusters - i, s->cluster_size, &l2_table[l2_index], i, 0); if ((i >= nb_clusters) || be64_to_cpu(l2_table[l2_index + i])) { break; } i += count_contiguous_free_clusters(nb_clusters - i, &l2_table[l2_index + i]); if (i >= nb_clusters) { break; } cluster_offset = be64_to_cpu(l2_table[l2_index + i]); if ((cluster_offset & QCOW_OFLAG_COPIED) || (cluster_offset & QCOW_OFLAG_COMPRESSED)) break; } assert(i <= nb_clusters); nb_clusters = i; QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) { uint64_t end_offset = offset + nb_clusters * s->cluster_size; uint64_t old_offset = old_alloc->offset; uint64_t old_end_offset = old_alloc->offset + old_alloc->nb_clusters * s->cluster_size; if (end_offset < old_offset || offset > old_end_offset) { } else { if (offset < old_offset) { nb_clusters = (old_offset - offset) >> s->cluster_bits; } else { nb_clusters = 0; } if (nb_clusters == 0) { qemu_co_mutex_unlock(&s->lock); qemu_co_queue_wait(&old_alloc->dependent_requests); qemu_co_mutex_lock(&s->lock); goto again; } } } if (!nb_clusters) { abort(); } QLIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight); cluster_offset = qcow2_alloc_clusters(bs, nb_clusters * s->cluster_size); if (cluster_offset < 0) { ret = cluster_offset; goto fail; } m->offset = offset; m->n_start = n_start; m->nb_clusters = nb_clusters; out: ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); if (ret < 0) { goto fail_put; } m->nb_available = MIN(nb_clusters << (s->cluster_bits - 9), n_end); m->cluster_offset = cluster_offset; *num = m->nb_available - n_start; return 0; fail: qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); fail_put: QLIST_REMOVE(m, next_in_flight); return ret; }
1threat
Java reduntancy : I'm working in a lesson to create a vacation plan, however I'm having some trouble with redundancy when I try to call the variable "money" and "days". I've search over the internet and didn't find an answer, how can I call those towo variables to make thi piece of code workout? Thanks. public static void Bugdet() { Scanner input=new Scanner(System.in); System.out.print("How many days are you going to spend traveling? "); int days = input.nextInt(); System.out.print("How much money, in USD, are you planning to spend on your trip? "); int money = input.nextInt(); System.out.print("What is the three letter currency symbol for your travel destination?"); String let = input.next(); System.out.print("How many " + let + " are there in 1 USD? "); String cov = input.next(); int hours = 24; int finhours = days *hours; int min = finhours * 60; double money1 = money / days; money1 = money*100; money1 = (int) money1/ 100.0; System.out.println("If you are traveling for " + days + " that is the same as " + finhours + " hours or " + min + " minutes"); System.out.print("If you are going to spend $" + money + " USD that means per day you can spend up to " + money1 + " USD");
0debug
I get a really strange error when I try to run a very simple program : "Unhandled exception at 0x0F29F365 (msvcr120d.dll) in HW2_1_JM.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF." This is my first post, and that is the error I consistently get when I attempt to run this program. I'm new to programming, so I'm sorry for my code quality. My mom couldn't figure out what it was. When it's not throwing this error, it's simply pausing endlessly before the while. We think the error is with "int d" because when we tried to print both n and d we get the error again after printing n. int main() { int a[10]; puts("Please input a value: \n"); int n; scanf("%i", &n); printf("\n you chose: %i\n", n); puts("Please input a base value, between 1 and 11: \n"); int d; scanf("%i", &d); while (!(n = -1)); { int q = n; int k = 0; printf(q); while (q != 0); { a[k] = (q % d); q = q / d; printf(q); k++; } for (int j = 0; j < 11; j++) { printf("Element [%d] = %d \n", j, a[j]); } puts("Please input a value: \n"); scanf("%i", &n); printf("\n you chose: %i\n", n); puts("Please input a base value, between 1 and 11: \n"); scanf("%i", &d); } system("pause"); return 0; }
0debug
How about 30~ish BizTalk applications, good practice? : <p>Trying to introduce BTDF for deployment, having a legacy of 30ish solutions, with the principle of 1:1 mapping between solution and biztalk application, this will result in 30ish BizTalk applications deployed. Never did this or saw this before, would this consider a bad practice or does it impact performance in any sense?</p> <p>If this is not a good way to go for deployment, could you please suggest a better way to deploy without major refactor the solutions?</p> <p>Thanks!</p>
0debug
Google store says Ready to Publish : <p>I'm trying to publish my ionic2 app on Google play.But still, I cannot do that.It doesn't show any errors.Can you tell me how to do this?</p> <p><a href="https://i.stack.imgur.com/qdXSk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qdXSk.png" alt="enter image description here"></a></p> <p>When I press the "Ready to Publish" button then it shows below screen.</p> <p><a href="https://i.stack.imgur.com/Co0YA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Co0YA.png" alt="enter image description here"></a></p>
0debug
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, int is_read) { BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, is_read); VirtIOBlock *s = req->dev; if (action == BLOCK_ERR_IGNORE) { bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read); return 0; } if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC) || action == BLOCK_ERR_STOP_ANY) { req->next = s->rq; s->rq = req; bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read); vm_stop(0); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read); } return 1; }
1threat
GList *range_list_insert(GList *list, Range *data) { GList *l, *next = NULL; Range *r, *nextr; if (!list) { list = g_list_insert_sorted(list, data, range_compare); return list; } nextr = data; l = list; while (l && l != next && nextr) { r = l->data; if (ranges_can_merge(r, nextr)) { range_merge(r, nextr); l = g_list_remove_link(l, next); next = g_list_next(l); if (next) { nextr = next->data; } else { nextr = NULL; } } else { l = g_list_next(l); } } if (!l) { list = g_list_insert_sorted(list, data, range_compare); } return list; }
1threat
No overload for method 'ReadLine' arguments when only 1 argument is given : <p>I am trying to read the first line in a file, but I keep getting this error every time I do sr.ReadLine(1); and I can not find an answer to this error. My code:</p> <pre><code>using (StreamReader sr = new StreamReader(DataStore)) { string Conent; Conent = sr.ReadLine(1); }; </code></pre>
0debug
android webview using youtube api : i'm developed a simple android app using webview method. my string link is: [This][1] [1]: http://gurujibd.net/tube/ now question is - can i upload my app that developed by me using this above link? i'm not using admob ads at this moment. can i use admob ads to this app? please don't refer admob policy link, i was read that before. i just need to know that from real developers experience. clear: can i use youtube videos into my android application using webview? can i use admob ads? if admob not allowed - can i use another ad-network ads? advanced thanks.
0debug
How to reset form validation on submission of the form in ANGULAR 2 : <p>I have to reset my form along with validation. is there any method to reset the state of form from ng-dirty to ng-pristine.</p>
0debug
how do I store data in an array if the data is more than 1? : My script like this : let data = [ {day: 1, time: '08:00', note: 'madrid'}, {day: 2, time: '08:00', note: 'barcelona'}, {day: 3, time: '10:00', note: 'juventus'}, ] let days = [7, 1, 2, 3, 4, 5, 6] let list = [] days.forEach(element => { let item = data.find(x => x.day === element) if (item) { list.push(item) } else { list.push({ day: element, time: undefined }) } }) If the script executed, it works. It will show schedule from day 1 to day 7 But my problem is variable data is dynamic. So 1 day can have more than 1 schedule. So the variable data can like this : let data = [ {day: 1, time: '08:00', note: 'madrid'}, {day: 1, time: '09:00', note: 'chelsea'}, {day: 2, time: '08:00', note: 'barcelona'}, {day: 2, time: '09:00', note: 'mu'}, {day: 3, time: '10:00', note: 'juventus'} ] maybe i should make an array inside key day. so I can save data days that are more than 1 schedule. how do i do that?
0debug
AWS Cognito Authentication USER_PASSWORD_AUTH flow not enabled for this client : <p>I have an mobile app with user pool (username &amp; password). The app works fine with aws-amplify sdk. But, wanted to move the code out to Lambdas. So, I have written the following Lambda using Boto3.</p> <p>Here is Lambda:</p> <pre><code>import boto3 def lambda_handler(event, context): client = boto3.client('cognito-idp') response = client.initiate_auth( ClientId='xxxxxxxxxxxxxx', AuthFlow='USER_PASSWORD_AUTH', AuthParameters={ 'USERNAME': 'xxxxxx', 'PASSWORD': 'xxxxxx' } ) return response </code></pre> <p>Tried admin_initiate_auth too. </p> <pre><code>import boto3 def lambda_handler(event, context): client = boto3.client('cognito-idp') response = client.initiate_auth( UserPoolId='xxxxxxxxx', ClientId='xxxxxxxxxxxxxx', AuthFlow='USER_PASSWORD_AUTH', AuthParameters={ 'USERNAME': 'xxxxxx', 'PASSWORD': 'xxxxxx' } ) return response </code></pre> <p>Here is the error the I get.</p> <blockquote> <p>An error occurred (InvalidParameterException) when calling the InitiateAuth operation: USER_PASSWORD_AUTH flow not enabled for this client: InvalidParameterException Traceback (most recent call last):<br> File "/var/task/lambda_function.py", line 12, in lambda_handler 'PASSWORD': 'xxxxx' File "/var/runtime/botocore/client.py", line 317, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 615, in _make_api_call raise error_class(parsed_response, operation_name) InvalidParameterException: An error occurred (InvalidParameterException) when calling the InitiateAuth operation: USER_PASSWORD_AUTH flow not enabled for this client</p> </blockquote> <p>Any thoughts?</p>
0debug
static void spapr_machine_init(MachineState *machine) { sPAPRMachineState *spapr = SPAPR_MACHINE(machine); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; PCIHostState *phb; int i; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *rma_region; void *rma = NULL; hwaddr rma_alloc_size; hwaddr node0_size = spapr_node0_size(machine); long load_limit, fw_size; char *filename; Error *resize_hpt_err = NULL; msi_nonbroken = true; QLIST_INIT(&spapr->phbs); QTAILQ_INIT(&spapr->pending_dimm_unplugs); kvmppc_check_papr_resize_hpt(&resize_hpt_err); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DEFAULT) { if (resize_hpt_err) { spapr->resize_hpt = SPAPR_RESIZE_HPT_DISABLED; error_free(resize_hpt_err); resize_hpt_err = NULL; } else { spapr->resize_hpt = smc->resize_hpt_default; } } assert(spapr->resize_hpt != SPAPR_RESIZE_HPT_DEFAULT); if ((spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) && resize_hpt_err) { error_report_err(resize_hpt_err); exit(1); } rma_alloc_size = kvmppc_alloc_rma(&rma); if (rma_alloc_size == -1) { error_report("Unable to create RMA"); exit(1); } if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; } else { spapr->rma_size = node0_size; if (kvm_enabled()) { spapr->vrma_adjust = 1; spapr->rma_size = MIN(spapr->rma_size, 0x10000000); } spapr->rma_size = MIN(spapr->rma_size, 0x400000000ull); } if (spapr->rma_size > node0_size) { error_report("Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")", spapr->rma_size); exit(1); } load_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; xics_system_init(machine, XICS_IRQS_SPAPR, &error_fatal); spapr->ov5 = spapr_ovec_new(); spapr->ov5_cas = spapr_ovec_new(); if (smc->dr_lmb_enabled) { spapr_ovec_set(spapr->ov5, OV5_DRCONF_MEMORY); spapr_validate_node_memory(machine, &error_fatal); } spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); } if (spapr->use_hotplug_event_source) { spapr_ovec_set(spapr->ov5, OV5_HP_EVT); } if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) { spapr_ovec_set(spapr->ov5, OV5_HPT_RESIZE); } spapr_set_vsmt_mode(spapr, &error_fatal); spapr_init_cpus(spapr); if (kvm_enabled()) { kvmppc_enable_logical_ci_hcalls(); kvmppc_enable_set_mode_hcall(); kvmppc_enable_clear_ref_mod_hcalls(); } memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", machine->ram_size); memory_region_add_subregion(sysmem, 0, ram); if (rma_alloc_size && rma) { rma_region = g_new(MemoryRegion, 1); memory_region_init_ram_ptr(rma_region, NULL, "ppc_spapr.rma", rma_alloc_size, rma); vmstate_register_ram_global(rma_region); memory_region_add_subregion(sysmem, 0, rma_region); } if (machine->ram_size < machine->maxram_size) { ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; int max_memslots = kvm_enabled() ? kvm_get_max_memslots() / 2 : SPAPR_MAX_RAM_SLOTS; if (max_memslots < SPAPR_MAX_RAM_SLOTS) { max_memslots = SPAPR_MAX_RAM_SLOTS; } if (machine->ram_slots > max_memslots) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", machine->ram_slots, max_memslots); exit(1); } spapr->hotplug_memory.base = ROUND_UP(machine->ram_size, SPAPR_HOTPLUG_MEM_ALIGN); memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr), "hotplug-memory", hotplug_mem_size); memory_region_add_subregion(sysmem, spapr->hotplug_memory.base, &spapr->hotplug_memory.mr); } if (smc->dr_lmb_enabled) { spapr_create_lmb_dr_connectors(spapr); } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); if (!filename) { error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin"); exit(1); } spapr->rtas_size = get_image_size(filename); if (spapr->rtas_size < 0) { error_report("Could not get size of LPAR rtas '%s'", filename); exit(1); } spapr->rtas_blob = g_malloc(spapr->rtas_size); if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) { error_report("Could not load LPAR rtas '%s'", filename); exit(1); } if (spapr->rtas_size > RTAS_MAX_SIZE) { error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)", (size_t)spapr->rtas_size, RTAS_MAX_SIZE); exit(1); } g_free(filename); spapr_events_init(spapr); spapr_rtc_create(spapr); spapr->vio_bus = spapr_vio_bus_init(); for (i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { spapr_vty_create(spapr->vio_bus, serial_hds[i]); } } spapr_create_nvram(spapr); spapr_pci_rtas_init(); phb = spapr_create_phb(spapr, 0); for (i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!nd->model) { nd->model = g_strdup("ibmveth"); } if (strcmp(nd->model, "ibmveth") == 0) { spapr_vlan_create(spapr->vio_bus, nd); } else { pci_nic_init_nofail(&nd_table[i], phb->bus, nd->model, NULL); } } for (i = 0; i <= drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus); } if (spapr_vga_init(phb->bus, &error_fatal)) { spapr->has_graphics = true; machine->usb |= defaults_enabled() && !machine->usb_disabled; } if (machine->usb) { if (smc->use_ohci_by_default) { pci_create_simple(phb->bus, -1, "pci-ohci"); } else { pci_create_simple(phb->bus, -1, "nec-usb-xhci"); } if (spapr->has_graphics) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { error_report( "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", MIN_RMA_SLOF); exit(1); } if (kernel_filename) { uint64_t lowaddr = 0; spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) { spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0, 0); spapr->kernel_le = spapr->kernel_size > 0; } if (spapr->kernel_size < 0) { error_report("error loading %s: %s", kernel_filename, load_elf_strerror(spapr->kernel_size)); exit(1); } if (initrd_filename) { spapr->initrd_base = (KERNEL_LOAD_ADDR + spapr->kernel_size + 0x1ffff) & ~0xffff; spapr->initrd_size = load_image_targphys(initrd_filename, spapr->initrd_base, load_limit - spapr->initrd_base); if (spapr->initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } } } if (bios_name == NULL) { bios_name = FW_FILE_NAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!filename) { error_report("Could not find LPAR firmware '%s'", bios_name); exit(1); } fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); if (fw_size <= 0) { error_report("Could not load LPAR firmware '%s'", filename); exit(1); } g_free(filename); vmstate_register(NULL, 0, &vmstate_spapr, spapr); register_savevm_live(NULL, "spapr/htab", -1, 1, &savevm_htab_handlers, spapr); qemu_register_boot_set(spapr_boot_set, spapr); if (kvm_enabled()) { qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change, &spapr->tb); kvmppc_spapr_enable_inkernel_multitce(); } }
1threat
How to start with FIWARE? : <p>I'm new with FIWARE and I'm disoriented by the large amount of information related to this platform, the amount of components called Generic Enablers that exists. I don't know where to start.</p> <p>Any advice?</p> <p>Thanks!</p>
0debug
pgadmin can't log in after update : <p>Just updated pgadmin4 to version 4.8 and now it won't accept ssh tunnel password into server, I get the following error message:</p> <pre><code>Failed to decrypt the SSH tunnel password. Error: 'utf-8' codec can't decode byte 0x8c in position 0: invalid start byte </code></pre> <p>Is there a way around this, I can't restart the database server at this time. </p>
0debug
static void virgl_cmd_submit_3d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_cmd_submit cs; void *buf; size_t s; VIRTIO_GPU_FILL_CMD(cs); trace_virtio_gpu_cmd_ctx_submit(cs.hdr.ctx_id, cs.size); buf = g_malloc(cs.size); s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, sizeof(cs), buf, cs.size); if (s != cs.size) { qemu_log_mask(LOG_GUEST_ERROR, "%s: size mismatch (%zd/%d)", __func__, s, cs.size); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } if (virtio_gpu_stats_enabled(g->conf)) { g->stats.req_3d++; g->stats.bytes_3d += cs.size; } virgl_renderer_submit_cmd(buf, cs.hdr.ctx_id, cs.size / 4); g_free(buf); }
1threat