problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
rename process using pm2 programmatic api : <p>I have an electron app which uses pm2 to start some apps using the pm2 module.Everything is fine.However I am trying to implement the following feature:Renaming an app you have started.I know that using the cli I can do the following:</p>
<p><code>pm2 restart app --name"New name"</code>;</p>
<p>So I found the <code>pm2.restart</code> function which takes an Object and a callback as a parameter.So I tried this:</p>
<pre><code>var options = {app:"Blogsport App",name:"New name"};
var callback = function(err){
if(err) {console.log('Failed')}
else {console.log('App renamed')}
};
pm2.restart(options,callback);
</code></pre>
<p>This will always log "App renamed".However If I do <code>pm2 list</code> I see that the app has not be renamed.Is there anything I can do to rename an app without deleting it and start it again with a different name?</p>
| 0debug
|
static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
{
int r;
if (s->avctx->hwaccel) {
assert(!pic->f.hwaccel_picture_private);
if (s->avctx->hwaccel->priv_data_size) {
pic->f.hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
if (!pic->f.hwaccel_picture_private) {
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
return -1;
}
}
}
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
s->codec_id != AV_CODEC_ID_VC1IMAGE &&
s->codec_id != AV_CODEC_ID_MSS2)
r = ff_thread_get_buffer(s->avctx, &pic->f);
else
r = avcodec_default_get_buffer(s->avctx, &pic->f);
if (r < 0 || !pic->f.type || !pic->f.data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
r, pic->f.type, pic->f.data[0]);
av_freep(&pic->f.hwaccel_picture_private);
return -1;
}
if (s->linesize && (s->linesize != pic->f.linesize[0] ||
s->uvlinesize != pic->f.linesize[1])) {
av_log(s->avctx, AV_LOG_ERROR,
"get_buffer() failed (stride changed)\n");
free_frame_buffer(s, pic);
return -1;
}
if (pic->f.linesize[1] != pic->f.linesize[2]) {
av_log(s->avctx, AV_LOG_ERROR,
"get_buffer() failed (uv stride mismatch)\n");
free_frame_buffer(s, pic);
return -1;
}
return 0;
}
| 1threat
|
Different results when I type in my input : **Hello,**
do you know why when i tape in input '**coup**', next '**cou**', next '**coup**' results its differents (use backspace) ?
[jsfiddle.net/xbuppd1r/43][1]
var data = {"cards":[{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":89,"Name":"anathar","CardType":0,"CostAP":7,"Life":7,"Attack":4,"MovementPoint":2,"Families":[70],"IsToken":false,"Rarity":3,"GodType":0,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Anathar","DescFR":"<b>CONTRE COUP :</b>\nTant qu'il est en vie, Anathar prend le contrôle de son adversaire.","NameEN":"Anathar","DescEN":"<b>COUNTERATTACK:</b>\nSo long as he is alive, Anathar takes control of his opponent.","NameES":"Anathar","DescES":"<b>VENGANZA:</b>\nMientras esté vivo, Anathar toma el control de su contrincante."}},{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":137,"Name":"appel_a_la_baston","CardType":1,"CostAP":7,"Life":0,"Attack":0,"MovementPoint":0,"Families":[1],"IsToken":false,"Rarity":3,"GodType":1,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Appel à la Baston","DescFR":"Piochez portée 4 cartes.\r\nGardez les invocations et défaussez les autres.","NameEN":"Call to Brawl","DescEN":"Draw 4 cards.\r\nKeep the Summons and discard any others.","NameES":"Toque de Refriega","DescES":"Robas 4 cartas.\r\nConservas las invocaciones y descartas las otras."}},{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":20,"Name":"sphincter_cell","CardType":0,"CostAP":5,"Life":4,"Attack":4,"MovementPoint":3,"Families":[19],"IsToken":false,"Rarity":2,"GodType":0,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Sphincter Cell","DescFR":"<b>COUP DE GRÂCE :</b>\nRécupérez le dernier Rat parti dans votre défausse.\r","NameEN":"Sphincter Cell","DescEN":"<b>FINAL BLOW:</b>\nRetrieve the last Rat that went to your discard pile.\n","NameES":"Sfinter Cell","DescES":"<b>GOLPE DE GRACIA:</b>\nRecuperas la última rata enviada a tu descarte.\n"} },{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":20,"Name":"sphincter_cell","CardType":0,"CostAP":5,"Life":4,"Attack":4,"MovementPoint":3,"Families":[19],"IsToken":false,"Rarity":2,"GodType":0,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Sphincter Cell","DescFR":"<b>COUP DE GRÂCE :</b>\nRécupérez le dernier Rat parti dans votre défausse.\r","NameEN":"Sphincter Cell","DescEN":"<b>FINAL BLOW:</b>\nRetrieve the last Rat that went to your discard pile.\n","NameES":"Sfinter Cell","DescES":"<b>GOLPE DE GRACIA:</b>\nRecuperas la última rata enviada a tu descarte.\n"} },{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":20,"Name":"sphincter_cell","CardType":0,"CostAP":5,"Life":4,"Attack":4,"MovementPoint":3,"Families":[19],"IsToken":false,"Rarity":2,"GodType":0,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Sphincter Cell","DescFR":"<b>COUP DE GRÂCE :</b>\nRécupérez le dernier Rat parti dans votre défausse.\r","NameEN":"Sphincter Cell","DescEN":"<b>FINAL BLOW:</b>\nRetrieve the last Rat that went to your discard pile.\n","NameES":"Sfinter Cell","DescES":"<b>GOLPE DE GRACIA:</b>\nRecuperas la última rata enviada a tu descarte.\n"} },{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+SimpleData, Assembly-CSharp-Editor","Id":20,"Name":"sphincter_cell","CardType":0,"CostAP":5,"Life":4,"Attack":4,"MovementPoint":3,"Families":[19],"IsToken":false,"Rarity":2,"GodType":0,"Extension":1,"LinkedCards":[],"Texts":{"$type":"Assets.Code.Editor.Helpers.SimpleCardDataExporter+TextData, Assembly-CSharp-Editor","NameFR":"Sphincter Cell","DescFR":"<b>COUP DE GRÂCE :</b>\nRécupérez le dernier Rat parti dans votre défausse.\r","NameEN":"Sphincter Cell","DescEN":"<b>FINAL BLOW:</b>\nRetrieve the last Rat that went to your discard pile.\n","NameES":"Sfinter Cell","DescES":"<b>GOLPE DE GRACIA:</b>\nRecuperas la última rata enviada a tu descarte.\n"} }]}
$('#search').keyup( function() {
var InputVal = $('#search').val();
var myExp = new RegExp(InputVal, "i");
if(InputVal.length > 0) {
var results = data.cards.filter( function(obj){
for ( var key in obj )
if ( String( obj.Texts.DescFR ).toLowerCase().match(myExp)) return true;
if ( String( obj.Name ).toLowerCase().match(myExp) ) return true;
return false;
});
var newHTML = [];
for (var i = 0; i < results.length; i++) {
newHTML.push(results[i].Name);
}
console.log(JSON.stringify(newHTML));
// our variable holding starting index of this "page"
var index = 0;
// display our initial list
displayNext();
$("#next").click(function(event) {
event.preventDefault();
// display next elements
displayNext();
});
function displayNext() {
// get the list element
var list = $('#list');
// get index stored as a data on the list, if it doesn't exist then assign 0
var index = list.data('index') % newHTML.length || 0;
// save next index - for next call
list.data('index', index + 16);
// 1) get 20 elements from array - starting from index, using Array.slice()
// 2) map them to array of li strings
// 3) join the array into a single string and set it as a HTML content of list
list.html($.map(newHTML.slice(index, index + 16), function(val) {
console.log(val);
return '<div class="col-md-2">' + val + '</div>';
}).join(''));
}
}
});
[1]: http://jsfiddle.net/xbuppd1r/43
I don't kknow why its different results when I type in my entry, its very strange :/
Thx
| 0debug
|
only higher values from array as variable number : <p>I have array with numbers and variable number:</p>
<pre><code>$a = array(1,2,3,4,5,6,7,8,9,10);
$v = 5;
</code></pre>
<p>I need result all numbers if is higher as $v:</p>
<pre><code>$result = ?? //array(6,7,8,9,10)
</code></pre>
| 0debug
|
Swap Function in Kotlin : <p>is there any better way to write generic swap function in kotlin other than java way described in <a href="https://stackoverflow.com/questions/3624525/how-to-write-a-basic-swap-function-in-java">How to write a basic swap function in Java</a>.</p>
<p>Is there any kotlin language feature which can make generic swap function more concise and intuitive?</p>
| 0debug
|
static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)
{
if (palcode >= 0x80 && palcode < 0xC0) {
switch (palcode) {
case 0x86:
break;
case 0x9E:
tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_unique);
break;
case 0x9F:
tcg_gen_mov_i64(cpu_unique, cpu_ir[IR_A0]);
break;
default:
palcode &= 0xbf;
goto do_call_pal;
}
return NO_EXIT;
}
#ifndef CONFIG_USER_ONLY
if (palcode < 0x40 && (ctx->tb->flags & TB_FLAGS_USER_MODE) == 0) {
switch (palcode) {
case 0x01:
break;
case 0x02:
break;
case 0x2D:
tcg_gen_st_i64(cpu_ir[IR_A0], cpu_env, offsetof(CPUAlphaState, vptptr));
break;
case 0x31:
tcg_gen_mov_i64(cpu_sysval, cpu_ir[IR_A0]);
break;
case 0x32:
tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_sysval);
break;
case 0x35: {
TCGv tmp;
tcg_gen_ld8u_i64(cpu_ir[IR_V0], cpu_env, offsetof(CPUAlphaState, ps));
tmp = tcg_temp_new();
tcg_gen_andi_i64(tmp, cpu_ir[IR_A0], PS_INT_MASK);
tcg_gen_st8_i64(tmp, cpu_env, offsetof(CPUAlphaState, ps));
tcg_temp_free(tmp);
break;
}
case 0x36:
tcg_gen_ld8u_i64(cpu_ir[IR_V0], cpu_env, offsetof(CPUAlphaState, ps));
break;
case 0x38:
tcg_gen_mov_i64(cpu_usp, cpu_ir[IR_A0]);
break;
case 0x3A:
tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_usp);
break;
case 0x3C:
tcg_gen_ld32s_i64(cpu_ir[IR_V0], cpu_env,
-offsetof(AlphaCPU, env) + offsetof(CPUState, cpu_index));
break;
default:
palcode &= 0x3f;
goto do_call_pal;
}
return NO_EXIT;
}
#endif
return gen_invalid(ctx);
do_call_pal:
#ifdef CONFIG_USER_ONLY
return gen_excp(ctx, EXCP_CALL_PAL, palcode);
#else
{
TCGv pc = tcg_const_i64(ctx->pc);
TCGv entry = tcg_const_i64(palcode & 0x80
? 0x2000 + (palcode - 0x80) * 64
: 0x1000 + palcode * 64);
gen_helper_call_pal(cpu_env, pc, entry);
tcg_temp_free(entry);
tcg_temp_free(pc);
if (!ctx->singlestep_enabled && !(ctx->tb->cflags & CF_LAST_IO)) {
tcg_gen_goto_tb(0);
tcg_gen_exit_tb((uintptr_t)ctx->tb);
return EXIT_GOTO_TB;
}
return EXIT_PC_UPDATED;
}
#endif
}
| 1threat
|
How to change the textClock as a textview in Android Studio : I want to develop an app fro getting location with time.so i have been writing code for getting time using text Clock .i need to display time in text View to store.
what is the method for this process.
| 0debug
|
Real-time navigation for Web development : <p>For an app I'm building, I need real-time navigation. I've chosen Google maps, but I'm noticing there's nothing on real-time navigation for websites.</p>
<p>What are my options? Am I better off going with another provider, like Bing or Mapquest?</p>
| 0debug
|
Why are Arrays reference types? : <pre><code>int[] age=new int[5];
</code></pre>
<p>After reading many posts and blogs ,I am still not clear about the fact why arrays are reference types.I know this question is like very old and have been asked plenty times but still couldnt find direct answer.</p>
<p><strong>Known things</strong> :Since Arrays are allocated on heap,hence they are reference types .</p>
<p><strong>Need to know</strong>:Whats the reason behind making(compiler) arrays as reference types?.
Suppose age[0]=5,age[1]=25 ,what is the difficulty in assigning these on stack or make reference to heap if their type was object.why consider heap as accessing time is slow comparatively?.</p>
<p>Why heap ,why not on stack like for structures?.</p>
| 0debug
|
Will it be possible to do live video streaming in a webpage without using server side scripting or programming? : <p>Will it be possible to do live video streaming in a webpage without using server side scripting or programming?, if possible, Can anyone help me to do live video streaming in my website using jQuery or JavaScript? </p>
| 0debug
|
How to overcome issue of ".. is not function" while referring to earlier defined function expression in same js file : On accessing function expression in same file, gives error of .. "is not a function".
I need this below function expression to be available both outside the js file to other .js files and as well inside the same js file.
I have tried below things from below blogs,nothing seems working
https://github.com/nodejs/node/issues/2923
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function
// this is in abc.js
function qpValidations() {
this.addDaystoGetDate = function(noOfDays){
...
}
this.constructDate = function(){
this.addDaystoGetDate (2);// here issue is coming
}
}
module.exports = new qpValidations();
//need addDaystoGetDate () function to be called in another file as below
var qpFns = require(abc.js);
qpFns.addDaystoGetDate() working as expected.
This is the exact error shown
Failed: this.addDaystoGetDate is not a function
Any help is most appreciated!!, though this issue occured many times with me, tried avoiding file circular dependency and as well clubbing function expression and declaration, had solved the issues earlier, but now again it has poped up not sure what the root cause of this issue..?
| 0debug
|
How do I detect and connect to a hidden SSID on my Raspiberry Pi 3 (Raspbian)? : <p>How do I configure my Raspberry Pi 3 (running Raspbian) to connect to a hidden network? I know it involves editing the /etc/network/interfaces file and the wpa_supplicant.conf file. I've followed a few other guides, but when I make these file changes and reboot, I can't even detect visible networks, as they disappear from my wifi menu. I think I'm just editing these files with incorrect configurations. </p>
| 0debug
|
Xcode: 2 swift control : I have an app with 2 swift control to hide or show some textfield depending of the user if he switch them on/off.
The problem is the first swift seems to control the second one. If the first is off, the second one is off also. I would like them to work independently from each other.
Any advice?
Thanks guys
@IBAction func switchP(_ sender: UISwitch) {
if (sender.isOn == true){
textFieldP.isHidden = false
}else{
textFieldP.isHidden = true
}
}
@IBAction func switchT(_ sender: UISwitch) {
if (sender.isOn == true){
textFieldT.isHidden = false
}else{
textFieldT.isHidden = true
}
}
| 0debug
|
static bool main_loop_should_exit(void)
{
RunState r;
if (qemu_debug_requested()) {
vm_stop(RUN_STATE_DEBUG);
}
if (qemu_suspend_requested()) {
qemu_system_suspend();
}
if (qemu_shutdown_requested()) {
qemu_kill_report();
monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
if (no_shutdown) {
vm_stop(RUN_STATE_SHUTDOWN);
} else {
return true;
}
}
if (qemu_reset_requested()) {
pause_all_vcpus();
cpu_synchronize_all_states();
qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus();
if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
runstate_check(RUN_STATE_SHUTDOWN)) {
runstate_set(RUN_STATE_PAUSED);
}
}
if (qemu_wakeup_requested()) {
pause_all_vcpus();
cpu_synchronize_all_states();
qemu_system_reset(VMRESET_SILENT);
resume_all_vcpus();
monitor_protocol_event(QEVENT_WAKEUP, NULL);
}
if (qemu_powerdown_requested()) {
qemu_system_powerdown();
}
if (qemu_vmstop_requested(&r)) {
vm_stop(r);
}
return false;
}
| 1threat
|
document.write('<script src="evil.js"></script>');
| 1threat
|
how to link website to a facebook group, tweeter, youtube? : <p>I want to link the website to facebook group, tweeter, youtube, VK. So that when I click on the social media button on the website, I will follow them.</p>
| 0debug
|
Getting value outside (for) loop : I need to get values of Z variable outside a `for` but when i print it in console from inside the loop it gives correct values, while i printing it from outside the loop, it gives one value of value that supposed to be returned
fetch('http://open.mapquestapi.com/elevation/v1/profile?key=tHXSNAGXRx6LAoBNdgjjLycOhGqJalg7&shapeFormat=raw&latLngCollection='+profile)
.then(r => r.json())
.then(data => {
var Z;
for(var i=0;i<data.elevationProfile.length;i++){
//console.log(data.elevationProfile[i].height);
Z = (data.elevationProfile[i].height);
//console.log(Z);
}
console.log(Z);
| 0debug
|
GIT/TortoiseGIT hangs after Clone/Check out runs to 100% : am running into problems with GIT command line/Tortoise GIT checkout, please see attached images...
Hang pic [hang pic][1]
Command line hang pic [Command line hang][2]
Have tried usual Google search haul, network settings etc, but am fast running out of ideas on this one. Bitbucket account & ssh keys all seem to be in order, as does linux environment, running from Windows 10 seems to be a no-go for me, as the next step (Filtering content) never starts.
Cheers,
Mark
[1]: https://i.stack.imgur.com/8pjwq.png
[2]: https://i.stack.imgur.com/e6xW2.png
| 0debug
|
javascript error : cannot read property 'style' of null (i run it on chrome mobile browser) : That's how my JavaScript look like
JS:
const secondHand = document.querySelector(".sechand");
secondHand.style.width = "10px";
Can anyone help me?
| 0debug
|
jQuer convert C# datetime type to proper datetime and display it in jquery datatable : <p>I have a datetime (mssql) in my database which looks basically like this:</p>
<pre><code>2018-03-27 17:50:38.703
</code></pre>
<p>When I try to display it in my jQuery datatable it looks like this:</p>
<pre><code>/Date(1522165838703)/
</code></pre>
<p>The jQuery datatable requires this date format which is valid for sorting:</p>
<pre><code>dd-MM-yy
</code></pre>
<p>I have tried to convert it like this:</p>
<pre><code>new Date(data).toString('dd-MM-yy')
</code></pre>
<p>But I'm getting value as:</p>
<pre><code>Invalid Date
</code></pre>
<p>What am I doing wrong here? How can I convert it to a proper jQuery datatable format dd-MM-yy ?</p>
<p>Can someone help me out?</p>
| 0debug
|
static int nic_load(QEMUFile * f, void *opaque, int version_id)
{
EEPRO100State *s = opaque;
int i;
int ret;
if (version_id > 3)
return -EINVAL;
if (version_id >= 3) {
ret = pci_device_load(&s->dev, f);
if (ret < 0)
return ret;
}
if (version_id >= 2) {
qemu_get_8s(f, &s->rxcr);
} else {
s->rxcr = 0x0c;
}
qemu_get_8s(f, &s->cmd);
qemu_get_be32s(f, &s->start);
qemu_get_be32s(f, &s->stop);
qemu_get_8s(f, &s->boundary);
qemu_get_8s(f, &s->tsr);
qemu_get_8s(f, &s->tpsr);
qemu_get_be16s(f, &s->tcnt);
qemu_get_be16s(f, &s->rcnt);
qemu_get_be32s(f, &s->rsar);
qemu_get_8s(f, &s->rsr);
qemu_get_8s(f, &s->isr);
qemu_get_8s(f, &s->dcfg);
qemu_get_8s(f, &s->imr);
qemu_get_buffer(f, s->phys, 6);
qemu_get_8s(f, &s->curpag);
qemu_get_buffer(f, s->mult, 8);
qemu_get_buffer(f, s->mem, sizeof(s->mem));
qemu_get_8s(f, &s->scb_stat);
qemu_get_8s(f, &s->int_stat);
for (i = 0; i < 3; i++) {
qemu_get_be32s(f, &s->region[i]);
}
qemu_get_buffer(f, s->macaddr, 6);
for (i = 0; i < 19; i++) {
qemu_get_be32s(f, &s->statcounter[i]);
}
for (i = 0; i < 32; i++) {
qemu_get_be16s(f, &s->mdimem[i]);
}
qemu_get_be32s(f, &s->device);
qemu_get_be32s(f, &s->pointer);
qemu_get_be32s(f, &s->cu_base);
qemu_get_be32s(f, &s->cu_offset);
qemu_get_be32s(f, &s->ru_base);
qemu_get_be32s(f, &s->ru_offset);
qemu_get_be32s(f, &s->statsaddr);
qemu_get_be32s(f, &s->statistics.tx_good_frames);
qemu_get_be32s(f, &s->statistics.tx_max_collisions);
qemu_get_be32s(f, &s->statistics.tx_late_collisions);
qemu_get_be32s(f, &s->statistics.tx_underruns);
qemu_get_be32s(f, &s->statistics.tx_lost_crs);
qemu_get_be32s(f, &s->statistics.tx_deferred);
qemu_get_be32s(f, &s->statistics.tx_single_collisions);
qemu_get_be32s(f, &s->statistics.tx_multiple_collisions);
qemu_get_be32s(f, &s->statistics.tx_total_collisions);
qemu_get_be32s(f, &s->statistics.rx_good_frames);
qemu_get_be32s(f, &s->statistics.rx_crc_errors);
qemu_get_be32s(f, &s->statistics.rx_alignment_errors);
qemu_get_be32s(f, &s->statistics.rx_resource_errors);
qemu_get_be32s(f, &s->statistics.rx_overrun_errors);
qemu_get_be32s(f, &s->statistics.rx_cdt_errors);
qemu_get_be32s(f, &s->statistics.rx_short_frame_errors);
qemu_get_be32s(f, &s->statistics.fc_xmt_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_unsupported);
qemu_get_be16s(f, &s->statistics.xmt_tco_frames);
qemu_get_be16s(f, &s->statistics.rcv_tco_frames);
qemu_get_be32s(f, &s->statistics.complete);
#if 0
qemu_get_be16s(f, &s->status);
#endif
qemu_get_buffer(f, s->configuration, sizeof(s->configuration));
return 0;
}
| 1threat
|
how to implement any genetic ant finding food in Push,Clojush,Clojure? : <p>I am trying to use Push,Clojush,Clojure to implement an ant finding food in a 2d map, but I am not sure how to represent map? Could someone give me a example? Thank you.</p>
| 0debug
|
def surfacearea_cuboid(l,w,h):
SA = 2*(l*w + l * h + w * h)
return SA
| 0debug
|
static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
{
FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail);
FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail);
FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
for(int ch = 0; ch < s->channels; ch++)
s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;
return 0;
alloc_fail:
return AVERROR(ENOMEM);
}
| 1threat
|
static void usb_msd_class_initfn_storage(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->realize = usb_msd_realize_storage;
dc->props = msd_properties;
}
| 1threat
|
document.write('<script src="evil.js"></script>');
| 1threat
|
static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size)
{
PutBitContext pb;
int buf_pos, len;
if (buf_size < 5)
return -1;
init_put_bits(&pb, buf, buf_size * 8);
put_bits(&pb, 4, (s->block_width >> 4) - 1);
put_bits(&pb, 12, s->image_width);
put_bits(&pb, 4, (s->block_height >> 4) - 1);
put_bits(&pb, 12, s->image_height);
flush_put_bits(&pb);
buf_pos = 4;
buf[buf_pos++] = s->flags;
if (s->flags & HAS_PALLET_INFO) {
len = write_palette(s, buf + buf_pos, buf_size - buf_pos);
if (len < 0)
return -1;
buf_pos += len;
}
return buf_pos;
}
| 1threat
|
forum posts have inappropriate, invisible line breaks : <p>I cannot for the life of me figure out why, when people post on my php forum (called Just A Forum, from codecanyon [unsupported]), the posts tend to look like this:</p>
<p><a href="https://i.stack.imgur.com/yIy11.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yIy11.png" alt="forum post sample screenshot"></a></p>
<p>Inspecting with chrome dev tools, the text looks fine and I don't see any evidence of line-breaks. I've played around with the textarea width, making it match the text container width, but that doesn't seem to help. Neither did making sure the padding also matches, the font, etc.</p>
<p>Rather than post a bunch of CSS that could turn out to be irrelevant, I guess I'll wait for some instruction. I really just would like a clue as to where I should look, things I could try. I don't even know where to begin, with this. </p>
| 0debug
|
HighChart vs D3.Chart or C3.Chart : <p>I require some charting options in my CMS Application. I will be using Pie Charts, Area Charts, Column Charts, Bar Charts and Gauge Charts.
From all options available on internet, I found C3.js chart and HighCharts.js good for my project. Apart from licensing what are the differences between these two?
Which option is better?</p>
<p>Thanks</p>
| 0debug
|
Google Recaptcha javascript loading multiple times : <p>I'm including the Google Recaptcha on my website in the following way;</p>
<p>In the header section;</p>
<pre><code><script async src='https://www.google.com/recaptcha/api.js?hl=fr'></script>
</code></pre>
<p>And in the body section (I've removed my key for the sake of the example);</p>
<pre><code><div class="g-recaptcha" data-sitekey="*"></div>
</code></pre>
<p>Yet when the page loads, the Google Chrome console shows the following;</p>
<p><a href="https://i.stack.imgur.com/StqeC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/StqeC.png" alt="Google Chrome Console"></a></p>
<p>Does anyone have an idea of what's going on? Why is seemingly the same 69.0kb file being loaded 3 times?</p>
| 0debug
|
Is there any other purpose of "dictionary.get" function in Python with two elements in it, apart from checking for a variable in the list? : <p>I thougt it could store the answer for the case when user inputs a wrong key in it, like this:</p>
<pre><code>month_conversion.get("Git", "Not a valid key")
month_conversion = input()
</code></pre>
<p>So, if user input "Git" it would print out "Not a valid key"
But it doesn't store it and just prints out "None"</p>
| 0debug
|
Real world use cases where Apache Kafka is used : <p>I wanted to understand some of the real world use cases where using Apache Kafka as the message broker is most suitable. Considering Kafka topics cannot hold the messages indefinitely.</p>
| 0debug
|
static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr,
int count, int copy)
{
struct target_iovec *target_vec;
abi_ulong base;
int i;
target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1);
if (!target_vec)
return -TARGET_EFAULT;
for(i = 0;i < count; i++) {
base = tswapl(target_vec[i].iov_base);
unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0);
}
unlock_user (target_vec, target_addr, 0);
return 0;
}
| 1threat
|
Disable VS Code Output Window (not Visual Studio) : <p>Simple Question:</p>
<p>How do I keep the output window from displaying in VS Code. I don't need it and it takes up a lot of screen real estate. I don't see any options in preferences and can't find anything to help with it.</p>
<p>Thanks!</p>
| 0debug
|
int udp_output2(struct socket *so, struct mbuf *m,
struct sockaddr_in *saddr, struct sockaddr_in *daddr,
int iptos)
{
register struct udpiphdr *ui;
int error = 0;
DEBUG_CALL("udp_output");
DEBUG_ARG("so = %p", so);
DEBUG_ARG("m = %p", m);
DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr);
DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr);
m->m_data -= sizeof(struct udpiphdr);
m->m_len += sizeof(struct udpiphdr);
ui = mtod(m, struct udpiphdr *);
memset(&ui->ui_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr));
ui->ui_x1 = 0;
ui->ui_pr = IPPROTO_UDP;
ui->ui_len = htons(m->m_len - sizeof(struct ip));
ui->ui_src = saddr->sin_addr;
ui->ui_dst = daddr->sin_addr;
ui->ui_sport = saddr->sin_port;
ui->ui_dport = daddr->sin_port;
ui->ui_ulen = ui->ui_len;
ui->ui_sum = 0;
if ((ui->ui_sum = cksum(m, m->m_len)) == 0)
ui->ui_sum = 0xffff;
((struct ip *)ui)->ip_len = m->m_len;
((struct ip *)ui)->ip_ttl = IPDEFTTL;
((struct ip *)ui)->ip_tos = iptos;
error = ip_output(so, m);
return (error);
}
| 1threat
|
def get_Inv_Count(arr,n):
inv_count = 0
for i in range(n):
for j in range(i + 1,n):
if (arr[i] > arr[j]):
inv_count += 1
return inv_count
| 0debug
|
After installing Ionic i wanna to build ionic platform and android and is not working : mercy@mercy-DL-H61M-VG3:~/Desktop/todo$ ionic platform add android
The platform command has been renamed. To find out more, run:
ionic cordova platform --help
| 0debug
|
How do I activate type annotations hints in Kotlin like depicted? : <p>I was able to activate this option once in my MacOS intellij version, but could never find this option anymore, I forgot its name.</p>
<p>I know there is the CTRL+SHIFT+P alternative to this, but it is not as user-friendly.</p>
<p>How can I activate the option to make intellij show me all the inferred types like depicted? This screenshot came out of the intellij where I was able to put it showing "type hints" like this, so it is possible. I just don't remember where to find this option anymore so I can activate in all my other intellij's.</p>
<p><a href="https://i.stack.imgur.com/tiqjc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tiqjc.png" alt="enter image description here"></a></p>
| 0debug
|
from heapq import heappop, heappush
class Node:
def __init__(self, value, list_num, index):
self.value = value
self.list_num = list_num
self.index = index
def __lt__(self, other):
return self.value < other.value
def find_minimum_range(list):
high = float('-inf')
p = (0, float('inf'))
pq = []
for i in range(len(list)):
heappush(pq, Node(list[i][0], i, 0))
high = max(high, list[i][0])
while True:
top = heappop(pq)
low = top.value
i = top.list_num
j = top.index
if high - low < p[1] - p[0]:
p = (low, high)
if j == len(list[i]) - 1:
return p
heappush(pq, Node(list[i][j + 1], i, j + 1))
high = max(high, list[i][j + 1])
| 0debug
|
static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename,
int pci_enabled, const char *cpu_model)
{
char buf[1024];
int ret, linux_boot, i;
ram_addr_t ram_addr, vga_ram_addr, bios_offset, vga_bios_offset;
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
int bios_size, isa_bios_size, vga_bios_size;
PCIBus *pci_bus;
int piix3_devfn = -1;
CPUState *env;
NICInfo *nd;
qemu_irq *cpu_irq;
qemu_irq *i8259;
int index;
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BlockDriverState *fd[MAX_FD];
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
below_4g_mem_size = 0xe0000000;
} else {
below_4g_mem_size = ram_size;
}
linux_boot = (kernel_filename != NULL);
if (cpu_model == NULL) {
#ifdef TARGET_X86_64
cpu_model = "qemu64";
#else
cpu_model = "qemu32";
#endif
}
for(i = 0; i < smp_cpus; i++) {
env = cpu_init(cpu_model);
if (!env) {
fprintf(stderr, "Unable to find x86 CPU definition\n");
exit(1);
}
if (i != 0)
env->halted = 1;
if (smp_cpus > 1) {
env->cpuid_features |= CPUID_APIC;
}
qemu_register_reset(main_cpu_reset, env);
if (pci_enabled) {
apic_init(env);
}
}
vmport_init();
ram_addr = qemu_ram_alloc(0xa0000);
cpu_register_physical_memory(0, 0xa0000, ram_addr);
ram_addr = qemu_ram_alloc(0x100000 - 0xa0000);
ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000);
cpu_register_physical_memory(0x100000,
below_4g_mem_size - 0x100000,
ram_addr);
if (above_4g_mem_size > 0) {
ram_addr = qemu_ram_alloc(above_4g_mem_size);
cpu_register_physical_memory(0x100000000ULL,
above_4g_mem_size,
ram_addr);
}
vga_ram_addr = qemu_ram_alloc(vga_ram_size);
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
bios_size = get_image_size(buf);
if (bios_size <= 0 ||
(bios_size % 65536) != 0) {
goto bios_error;
}
bios_offset = qemu_ram_alloc(bios_size);
ret = load_image(buf, phys_ram_base + bios_offset);
if (ret != bios_size) {
bios_error:
fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf);
exit(1);
}
if (cirrus_vga_enabled) {
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
} else {
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
}
vga_bios_size = get_image_size(buf);
if (vga_bios_size <= 0 || vga_bios_size > 65536)
goto vga_bios_error;
vga_bios_offset = qemu_ram_alloc(65536);
ret = load_image(buf, phys_ram_base + vga_bios_offset);
if (ret != vga_bios_size) {
vga_bios_error:
fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
exit(1);
}
cpu_register_physical_memory(0xc0000, 0x10000,
vga_bios_offset | IO_MEM_ROM);
isa_bios_size = bios_size;
if (isa_bios_size > (128 * 1024))
isa_bios_size = 128 * 1024;
cpu_register_physical_memory(0x100000 - isa_bios_size,
isa_bios_size,
(bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
{
ram_addr_t option_rom_offset;
int size, offset;
offset = 0;
for (i = 0; i < nb_option_roms; i++) {
size = get_image_size(option_rom[i]);
if (size < 0) {
fprintf(stderr, "Could not load option rom '%s'\n",
option_rom[i]);
exit(1);
}
if (size > (0x10000 - offset))
goto option_rom_error;
option_rom_offset = qemu_ram_alloc(size);
ret = load_image(option_rom[i], phys_ram_base + option_rom_offset);
if (ret != size) {
option_rom_error:
fprintf(stderr, "Too many option ROMS\n");
exit(1);
}
size = (size + 4095) & ~4095;
cpu_register_physical_memory(0xd0000 + offset,
size, option_rom_offset | IO_MEM_ROM);
offset += size;
}
}
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
bochs_bios_init();
if (linux_boot)
load_linux(kernel_filename, initrd_filename, kernel_cmdline);
cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);
i8259 = i8259_init(cpu_irq[0]);
ferr_irq = i8259[13];
if (pci_enabled) {
pci_bus = i440fx_init(&i440fx_state, i8259);
piix3_devfn = piix3_init(pci_bus, -1);
} else {
pci_bus = NULL;
}
register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
if (cirrus_vga_enabled) {
if (pci_enabled) {
pci_cirrus_vga_init(pci_bus,
ds, phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size);
} else {
isa_cirrus_vga_init(ds, phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size);
}
} else if (vmsvga_enabled) {
if (pci_enabled)
pci_vmsvga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size);
else
fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
} else {
if (pci_enabled) {
pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size, 0, 0);
} else {
isa_vga_init(ds, phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size);
}
}
rtc_state = rtc_init(0x70, i8259[8]);
qemu_register_boot_set(pc_boot_set, rtc_state);
register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
if (pci_enabled) {
ioapic = ioapic_init();
}
pit = pit_init(0x40, i8259[0]);
pcspk_init(pit);
if (pci_enabled) {
pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
}
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
if (serial_hds[i]) {
serial_init(serial_io[i], i8259[serial_irq[i]], 115200,
serial_hds[i]);
}
}
for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
if (parallel_hds[i]) {
parallel_init(parallel_io[i], i8259[parallel_irq[i]],
parallel_hds[i]);
}
}
for(i = 0; i < nb_nics; i++) {
nd = &nd_table[i];
if (!nd->model) {
if (pci_enabled) {
nd->model = "ne2k_pci";
} else {
nd->model = "ne2k_isa";
}
}
if (strcmp(nd->model, "ne2k_isa") == 0) {
pc_init_ne2k_isa(nd, i8259);
} else if (pci_enabled) {
if (strcmp(nd->model, "?") == 0)
fprintf(stderr, "qemu: Supported ISA NICs: ne2k_isa\n");
pci_nic_init(pci_bus, nd, -1);
} else if (strcmp(nd->model, "?") == 0) {
fprintf(stderr, "qemu: Supported ISA NICs: ne2k_isa\n");
exit(1);
} else {
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
exit(1);
}
}
if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
fprintf(stderr, "qemu: too many IDE bus\n");
exit(1);
}
for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
if (index != -1)
hd[i] = drives_table[index].bdrv;
else
hd[i] = NULL;
}
if (pci_enabled) {
pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259);
} else {
for(i = 0; i < MAX_IDE_BUS; i++) {
isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]],
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
}
}
i8042_init(i8259[1], i8259[12], 0x60);
DMA_init(0);
#ifdef HAS_AUDIO
audio_init(pci_enabled ? pci_bus : NULL, i8259);
#endif
for(i = 0; i < MAX_FD; i++) {
index = drive_get_index(IF_FLOPPY, 0, i);
if (index != -1)
fd[i] = drives_table[index].bdrv;
else
fd[i] = NULL;
}
floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd);
cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
if (pci_enabled && usb_enabled) {
usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
}
if (pci_enabled && acpi_enabled) {
uint8_t *eeprom_buf = qemu_mallocz(8 * 256);
i2c_bus *smbus;
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, i8259[9]);
for (i = 0; i < 8; i++) {
smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
}
}
if (i440fx_state) {
i440fx_init_memory_mappings(i440fx_state);
}
if (pci_enabled) {
int max_bus;
int bus, unit;
void *scsi;
max_bus = drive_get_max_bus(IF_SCSI);
for (bus = 0; bus <= max_bus; bus++) {
scsi = lsi_scsi_init(pci_bus, -1);
for (unit = 0; unit < LSI_MAX_DEVS; unit++) {
index = drive_get_index(IF_SCSI, bus, unit);
if (index == -1)
continue;
lsi_scsi_attach(scsi, drives_table[index].bdrv, unit);
}
}
}
}
| 1threat
|
static inline int get_segment(CPUState *env, mmu_ctx_t *ctx,
target_ulong eaddr, int rw, int type)
{
target_phys_addr_t hash;
target_ulong vsid;
int ds, pr, target_page_bits;
int ret, ret2;
pr = msr_pr;
ctx->eaddr = eaddr;
#if defined(TARGET_PPC64)
if (env->mmu_model & POWERPC_MMU_64) {
ppc_slb_t *slb;
target_ulong pageaddr;
int segment_bits;
LOG_MMU("Check SLBs\n");
slb = slb_lookup(env, eaddr);
if (!slb) {
return -5;
}
if (slb->vsid & SLB_VSID_B) {
vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T;
segment_bits = 40;
} else {
vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT;
segment_bits = 28;
}
target_page_bits = (slb->vsid & SLB_VSID_L)
? TARGET_PAGE_BITS_16M : TARGET_PAGE_BITS;
ctx->key = !!(pr ? (slb->vsid & SLB_VSID_KP)
: (slb->vsid & SLB_VSID_KS));
ds = 0;
ctx->nx = !!(slb->vsid & SLB_VSID_N);
pageaddr = eaddr & ((1ULL << segment_bits)
- (1ULL << target_page_bits));
if (slb->vsid & SLB_VSID_B) {
hash = vsid ^ (vsid << 25) ^ (pageaddr >> target_page_bits);
} else {
hash = vsid ^ (pageaddr >> target_page_bits);
}
ctx->ptem = (slb->vsid & SLB_VSID_PTEM) |
((pageaddr >> 16) & ((1ULL << segment_bits) - 0x80));
} else
#endif
{
target_ulong sr, pgidx;
sr = env->sr[eaddr >> 28];
ctx->key = (((sr & 0x20000000) && (pr != 0)) ||
((sr & 0x40000000) && (pr == 0))) ? 1 : 0;
ds = sr & 0x80000000 ? 1 : 0;
ctx->nx = sr & 0x10000000 ? 1 : 0;
vsid = sr & 0x00FFFFFF;
target_page_bits = TARGET_PAGE_BITS;
LOG_MMU("Check segment v=" TARGET_FMT_lx " %d " TARGET_FMT_lx " nip="
TARGET_FMT_lx " lr=" TARGET_FMT_lx
" ir=%d dr=%d pr=%d %d t=%d\n",
eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir,
(int)msr_dr, pr != 0 ? 1 : 0, rw, type);
pgidx = (eaddr & ~SEGMENT_MASK_256M) >> target_page_bits;
hash = vsid ^ pgidx;
ctx->ptem = (vsid << 7) | (pgidx >> 10);
}
LOG_MMU("pte segment: key=%d ds %d nx %d vsid " TARGET_FMT_lx "\n",
ctx->key, ds, ctx->nx, vsid);
ret = -1;
if (!ds) {
if (type != ACCESS_CODE || ctx->nx == 0) {
LOG_MMU("htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx
" hash " TARGET_FMT_plx "\n",
env->htab_base, env->htab_mask, hash);
ctx->hash[0] = hash;
ctx->hash[1] = ~hash;
ctx->raddr = (target_phys_addr_t)-1ULL;
if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx ||
env->mmu_model == POWERPC_MMU_SOFT_74xx)) {
ret = ppc6xx_tlb_check(env, ctx, eaddr, rw, type);
} else {
LOG_MMU("0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx
" vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx
" hash=" TARGET_FMT_plx "\n",
env->htab_base, env->htab_mask, vsid, ctx->ptem,
ctx->hash[0]);
ret = find_pte(env, ctx, 0, rw, type, target_page_bits);
if (ret < 0) {
if (eaddr != 0xEFFFFFFF)
LOG_MMU("1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx
" vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx
" hash=" TARGET_FMT_plx " pg_addr="
TARGET_FMT_plx "\n", env->htab_base,
env->htab_mask, vsid, ctx->ptem, ctx->hash[1]);
ret2 = find_pte(env, ctx, 1, rw, type,
target_page_bits);
if (ret2 != -1)
ret = ret2;
}
}
#if defined (DUMP_PAGE_TABLES)
if (qemu_log_enabled()) {
target_phys_addr_t curaddr;
uint32_t a0, a1, a2, a3;
qemu_log("Page table: " TARGET_FMT_plx " len " TARGET_FMT_plx
"\n", sdr, mask + 0x80);
for (curaddr = sdr; curaddr < (sdr + mask + 0x80);
curaddr += 16) {
a0 = ldl_phys(curaddr);
a1 = ldl_phys(curaddr + 4);
a2 = ldl_phys(curaddr + 8);
a3 = ldl_phys(curaddr + 12);
if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) {
qemu_log(TARGET_FMT_plx ": %08x %08x %08x %08x\n",
curaddr, a0, a1, a2, a3);
}
}
}
#endif
} else {
LOG_MMU("No access allowed\n");
ret = -3;
}
} else {
LOG_MMU("direct store...\n");
switch (type) {
case ACCESS_INT:
break;
case ACCESS_CODE:
return -4;
case ACCESS_FLOAT:
return -4;
case ACCESS_RES:
return -4;
case ACCESS_CACHE:
ctx->raddr = eaddr;
return 0;
case ACCESS_EXT:
return -4;
default:
qemu_log("ERROR: instruction should not need "
"address translation\n");
return -4;
}
if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) {
ctx->raddr = eaddr;
ret = 2;
} else {
ret = -2;
}
}
return ret;
}
| 1threat
|
jquary Add a class to a different class? : `<div class="bookmark_outer">
<div class="bookmark_txt">
<h4 id="bookmark_id">Bookmark 1</h4><a href="#" class="bokmarksave"> <img src="icheck-icon.png" class="bookmark_edit"> </a>
<p> Lorem Ipsum is simply dummy text of the printing and </p>
<p class="page_num">Page 3 </p>
</div>
<div class="bookmark_icon">
<a href="#"><img src="edit.png" class="bookmark_icons"></a>
<a href="#" class="Bkhide"><img src="idelete.png" class="bookmark_icons"> </a>
</div>
</div>`
I want to add a class to "bookmark_edit" when I click the "bookmark_icons" class.How can I do it with the jquary?
| 0debug
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
Print odd numbers 1-100 (JavaScript - No extra conditional statements) : <p>I've looked at similar questions but not seeing something that directly answers my question.
I'm looking for the most efficient way to print odd numbers 1-100, without using any extra conditional statements (using JavaScript).</p>
| 0debug
|
Counting the Digits in a number : <p>So, I want to find a way to make sure an int is exactly 18 digits long, in Python, and give different responses depending on whether it is or isn't. So, if, say, 336819654318227461 was entered, it would respond by saying "Yes, that's 18 digits!" or whatever else, but if, say, 15 was entered, it would say something like "No, that's not 18 digits!"</p>
<p>It's for a bot I'm making on Discord, where, if it is 18 digits, it'll try to kick a person based off their ID, but, if it isn't, it'll just say that it's not a real person.</p>
| 0debug
|
tensorflow einsum vs. matmul vs. tensordot : <p>In tensorflow, the functions <code>tf.einsum</code>, <code>tf.matmul</code>, and <code>tf.tensordot</code> can all be used for the same tasks. (I realize that <code>tf.einsum</code> and <code>tf.tensordot</code> have more general definitions; I also realize that <code>tf.matmul</code> has batch functionality.) In a situation where any of the three could be used, does one function tend to be fastest? Are there other recommendation rules?</p>
<p>For example, suppose that <code>A</code> is a rank-2 tensor, and <code>b</code> is rank-1 tensor, and you want to compute the product <code>c_j = A_ij b_j</code>. Of the three options:</p>
<p><code>c = tf.einsum('ij,j->i', A, b)</code></p>
<p><code>c = tf.matmul(A, tf.expand_dims(b,1))</code></p>
<p><code>c = tf.tensordot(A, b, 1)</code></p>
<p>is any generally preferable to the others?</p>
| 0debug
|
Add 2 new columns to existing dataframe using apply : <p>I want to use the apply function that:
- Takes 2 columns as inputs - Outputs two new columns based on a function.</p>
<p>An example is with this add_multiply function. </p>
<pre class="lang-py prettyprint-override"><code>#function with 2 column inputs and 2 outputs
def add_multiply (a,b):
return (a+b, a*b )
#example dataframe
df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
#this doesn't work
df[['add', 'multiply']] = df.apply(lambda x: add_multiply(x['col1'], x['col2']), axis=1)
</code></pre>
<p>ideal result: </p>
<pre class="lang-py prettyprint-override"><code>col1 col2 add multiply
1 3 4 3
2 4 6 8
</code></pre>
| 0debug
|
Context over onCreate : <p>I get :</p>
<pre><code>android.content.Context.getResources()' on a null object reference
</code></pre>
<p>Android Studio is pointing to </p>
<pre><code>Toast toast = Toast.makeText(MainActivity.this, "as", Toast.LENGTH_LONG);
</code></pre>
<p>This toast is over <code>onCreate</code> method and below </p>
<pre><code>public class MainActivity extends AppCompatActivity
</code></pre>
<p>I think it is a problem with context, but i cant debug where is null, app crash instant before breakpoint on this toast.<br>
I tried use <code>this</code> instead <code>MainActivity.this</code> or <code>getAppicationContext()</code>
and i get this same result :/</p>
| 0debug
|
get distinct ids for each group value mysql : I have a result-set as following:
client_id status
------------------
67 1
67 0
67 0
67 0
77 0
I need to get only those `client_id` whose `latest (top)` entry is `0`.
I tried following but get both `67 and 77`. `67` should be excluded.
SELECT DISTINCT client_id FROM
(
SELECT client_id, status FROM client_history
WHERE (DATE(updated_on) BETWEEN '$from' AND '$to')
ORDER BY DATE(updated_on) DESC
) as ch
WHERE status = 0
GROUP BY client_id
How to set condition so that I can get only those records whose `status` is 0.
| 0debug
|
static void virtio_crypto_free_request(VirtIOCryptoReq *req)
{
if (req) {
if (req->flags == CRYPTODEV_BACKEND_ALG_SYM) {
g_free(req->u.sym_op_info);
}
g_free(req);
}
}
| 1threat
|
Comparing the characters : <p>I am writing a code for solving arithmetic expression like:<code>4+3-2*6*(3+4/2)</code></p>
<p>For that I need to compare the operators in the string with precedence like:</p>
<pre><code>1. ( or )
2. * or /
3. + or -
</code></pre>
<p>Can someone tell me how to compare two characters. As their ASCII values are not in the order which I want!</p>
| 0debug
|
Font-Awesome icon with an onclick event set : <p>I am trying to use the following font-awesome icon</p>
<pre><code><i class="fa fa-minus-circle"></i>
</code></pre>
<p>as a delete icon next to items in a list on my page like this:</p>
<pre><code>Item 1 delete-icon
Item 2 delete-icon
</code></pre>
<p>On click of one of these icons I need to run a JavaScript function...</p>
<p>What html element should I be wrapping the icon with? I noticed that when I use an anchor tag it turns blue and when I use a button it ends up being wrapped in a button. Are there any other options?</p>
<p>Essentially I want to do this</p>
<pre><code><a onclick="Remove()"><i class="fa fa-minus-circle"></i></a>
</code></pre>
<p>or this</p>
<pre><code><button onclick="Remove()"><i class="fa fa-minus-circle"></i></button>
</code></pre>
<p>But have only the icon appear as is with no modifications. No blue color, and not wrapped inside a button.</p>
| 0debug
|
My signup form isn't responsive : <p>I have made a signup form for my website. But if I zoom or open it on my phone, some input fields are not visible.
Can you help me to fix this error?
My webpage is privately visible at <a href="http://lfsite.net/beta/signup.php" rel="nofollow noreferrer">http://lfsite.net/beta/signup.php</a>.
You will be asked for a username and password, use username: 'guest' and password: 'passw0rd!'.
Please, can you help me fixing this problem? I want to publish my new site soon.</p>
<p>Regards, Luuk Faasse</p>
| 0debug
|
void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
{
int memory_map_mode, plane, write_mode, b, func_select, mask;
uint32_t write_mask, bit_mask, set_mask;
#ifdef DEBUG_VGA_MEM
printf("vga: [0x" TARGET_FMT_plx "] = 0x%02x\n", addr, val);
#endif
memory_map_mode = (s->gr[VGA_GFX_MISC] >> 2) & 3;
addr &= 0x1ffff;
switch(memory_map_mode) {
case 0:
break;
case 1:
if (addr >= 0x10000)
return;
addr += s->bank_offset;
break;
case 2:
addr -= 0x10000;
if (addr >= 0x8000)
return;
break;
default:
case 3:
addr -= 0x18000;
if (addr >= 0x8000)
return;
break;
}
if (s->sr[VGA_SEQ_MEMORY_MODE] & VGA_SR04_CHN_4M) {
plane = addr & 3;
mask = (1 << plane);
if (s->sr[VGA_SEQ_PLANE_WRITE] & mask) {
assert(addr < s->vram_size);
s->vram_ptr[addr] = val;
#ifdef DEBUG_VGA_MEM
printf("vga: chain4: [0x" TARGET_FMT_plx "]\n", addr);
#endif
s->plane_updated |= mask;
memory_region_set_dirty(&s->vram, addr, 1);
}
} else if (s->gr[VGA_GFX_MODE] & 0x10) {
plane = (s->gr[VGA_GFX_PLANE_READ] & 2) | (addr & 1);
mask = (1 << plane);
if (s->sr[VGA_SEQ_PLANE_WRITE] & mask) {
addr = ((addr & ~1) << 1) | plane;
if (addr >= s->vram_size) {
return;
}
s->vram_ptr[addr] = val;
#ifdef DEBUG_VGA_MEM
printf("vga: odd/even: [0x" TARGET_FMT_plx "]\n", addr);
#endif
s->plane_updated |= mask;
memory_region_set_dirty(&s->vram, addr, 1);
}
} else {
write_mode = s->gr[VGA_GFX_MODE] & 3;
switch(write_mode) {
default:
case 0:
b = s->gr[VGA_GFX_DATA_ROTATE] & 7;
val = ((val >> b) | (val << (8 - b))) & 0xff;
val |= val << 8;
val |= val << 16;
set_mask = mask16[s->gr[VGA_GFX_SR_ENABLE]];
val = (val & ~set_mask) |
(mask16[s->gr[VGA_GFX_SR_VALUE]] & set_mask);
bit_mask = s->gr[VGA_GFX_BIT_MASK];
break;
case 1:
val = s->latch;
goto do_write;
case 2:
val = mask16[val & 0x0f];
bit_mask = s->gr[VGA_GFX_BIT_MASK];
break;
case 3:
b = s->gr[VGA_GFX_DATA_ROTATE] & 7;
val = (val >> b) | (val << (8 - b));
bit_mask = s->gr[VGA_GFX_BIT_MASK] & val;
val = mask16[s->gr[VGA_GFX_SR_VALUE]];
break;
}
func_select = s->gr[VGA_GFX_DATA_ROTATE] >> 3;
switch(func_select) {
case 0:
default:
break;
case 1:
val &= s->latch;
break;
case 2:
val |= s->latch;
break;
case 3:
val ^= s->latch;
break;
}
bit_mask |= bit_mask << 8;
bit_mask |= bit_mask << 16;
val = (val & bit_mask) | (s->latch & ~bit_mask);
do_write:
mask = s->sr[VGA_SEQ_PLANE_WRITE];
s->plane_updated |= mask;
write_mask = mask16[mask];
if (addr * sizeof(uint32_t) >= s->vram_size) {
return;
}
((uint32_t *)s->vram_ptr)[addr] =
(((uint32_t *)s->vram_ptr)[addr] & ~write_mask) |
(val & write_mask);
#ifdef DEBUG_VGA_MEM
printf("vga: latch: [0x" TARGET_FMT_plx "] mask=0x%08x val=0x%08x\n",
addr * 4, write_mask, val);
#endif
memory_region_set_dirty(&s->vram, addr << 2, sizeof(uint32_t));
}
}
| 1threat
|
Need help writing if statement in powershell : So I have this script that creates a snap mirror on our dr server based on its location. Below is just a small part of a the script. I need to write an if statement so if location='uk' then to not run the below function otherwise if location = 'us' then create snap-mirror.
function Create-SnapMirror
{
[CmdletBinding(PositionalBinding=$false,
HelpUri = 'http://www.microsoft.com/',
ConfirmImpact='Medium')]
[OutputType([Boolean])]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false,
Position=0)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String]
$SourcePath,
# Param2 help description
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false,
Position=1)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String]
$DestinationPath,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false,
Position=2)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String]
$LogName
)
$success = $null
$error.clear()
}
| 0debug
|
static void adb_kbd_realizefn(DeviceState *dev, Error **errp)
{
ADBKeyboardClass *akc = ADB_KEYBOARD_GET_CLASS(dev);
akc->parent_realize(dev, errp);
qemu_input_handler_register(dev, &adb_keyboard_handler);
}
| 1threat
|
Why compiler says that " possible lossy conversion from int to byte" for this java code ? : <p>When I tried to run this code in an online java compiler it says "<strong>possible lossy conversion from int to byte</strong>". But i can't understand the meaning of this message. Badly need help. I am a beginner at Java. </p>
<pre><code>class HelloWorld{
public static void main(String args[]){
byte b=9;
b+=6;
System.out.println(b);
b=b+5;
System.out.println(b);
}
}
</code></pre>
| 0debug
|
bool qvirtio_wait_queue_isr(const QVirtioBus *bus, QVirtioDevice *d,
QVirtQueue *vq, uint64_t timeout)
{
do {
clock_step(100);
if (bus->get_queue_isr_status(d, vq)) {
break;
}
} while (--timeout);
return timeout != 0;
}
| 1threat
|
selecting multiple items form multiple tables with min and max : <p>I'm having a little trouble figuring out this SQL statement. I have three tables <code>employee</code>, <code>job</code>, and <code>job type</code>.</p>
<p><code>job type</code> is reference table. It has the name of the job, how long that job takes, and how much is charged for that job.</p>
<p><code>job</code> has records of what job was performed for what client by which employee and the date performed. It links to <code>job type</code> <code>jobname</code>.</p>
<p><code>employee</code> has name of employee, and <code>employee id</code>. It links to <code>job</code> table by <code>employee id</code>.</p>
<p>I need to display a list of all employees as well as the cheapest and most expensive jobs they did for a given year.</p>
<p>I think I will probably have to have an embedded select and a few <code>joins</code>. Maybe a <code>union</code>The complexity is just too far out of my experience. I'm not even sure where to being to be honest.</p>
| 0debug
|
static void scsi_remove_request(SCSIDiskReq *r)
{
qemu_free(r->iov.iov_base);
scsi_req_free(&r->req);
}
| 1threat
|
How can i use my email to get the message send by the guest in PHP : <p>I have created a simple contact form, i just want to know how can i use my email inside this code to get the message of the guest directly to my email. Am using this form in laravel.<br>
Here is contact form code:</p>
<pre><code>This is my php code
<?php
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
$nameErr = "Only letters and white space allowed";
}
}
if (empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = test_input($_POST["email"]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
}
if (empty($_POST["website"])) {
$website = "";
} else {
$website = test_input($_POST["website"]);
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
$websiteErr = "Invalid URL";
}
}
if (empty($_POST["comment"])) {
$comment = "";
} else {
$comment = test_input($_POST["comment"]);
}
if (empty($_POST["gender"])) {
$genderErr = "Gender is required";
} else {
$gender = test_input($_POST["gender"]);
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
</code></pre>
<p>This is my html code
<</p>
<pre><code>h2>PHP Form Validation Example</h2>
<p><span class="error">* required field.</span></p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Name: <input type="text" name="name" value="<?php echo $name;?>">
<span class="error">* <?php echo $nameErr;?></span>
<br><br>
E-mail: <input type="text" name="email" value="<?php echo $email;?>">
<span class="error">* <?php echo $emailErr;?></span>
<br><br>
Website: <input type="text" name="website" value="<?php echo $website;?>">
<span class="error"><?php echo $websiteErr;?></span>
<br><br>
Comment: <textarea name="comment" rows="5" cols="40"><?php echo $comment;?></textarea>
<br><br>
Gender:
<input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?> value="female">Female
<input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?> value="male">Male
<span class="error">* <?php echo $genderErr;?></span>
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</code></pre>
<p>Also i want to know how to print a success message to the guest when they send the message. The success message should be printed below the contact form. </p>
| 0debug
|
Random word(Meaningful) generation : <p>I am trying to build a game in SpriteKit. which I planned to create some random words. I found some links but unfortunately, I am not able to figure out a solution.
Does anybody know of a way to generate a random word?</p>
| 0debug
|
static inline uint16_t mipsdsp_trunc16_sat16_round(int32_t a,
CPUMIPSState *env)
{
int64_t temp;
temp = (int32_t)a + 0x00008000;
if (a > (int)0x7fff8000) {
temp = 0x7FFFFFFF;
set_DSPControl_overflow_flag(1, 22, env);
}
return (temp >> 16) & 0xFFFF;
}
| 1threat
|
int qemu_fsdev_add(QemuOpts *opts)
{
int i;
struct FsDriverListEntry *fsle;
const char *fsdev_id = qemu_opts_id(opts);
const char *fsdriver = qemu_opt_get(opts, "fsdriver");
const char *writeout = qemu_opt_get(opts, "writeout");
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
if (!fsdev_id) {
fprintf(stderr, "fsdev: No id specified\n");
return -1;
}
if (fsdriver) {
for (i = 0; i < ARRAY_SIZE(FsDrivers); i++) {
if (strcmp(FsDrivers[i].name, fsdriver) == 0) {
break;
}
}
if (i == ARRAY_SIZE(FsDrivers)) {
fprintf(stderr, "fsdev: fsdriver %s not found\n", fsdriver);
return -1;
}
} else {
fprintf(stderr, "fsdev: No fsdriver specified\n");
return -1;
}
fsle = g_malloc0(sizeof(*fsle));
fsle->fse.fsdev_id = g_strdup(fsdev_id);
fsle->fse.ops = FsDrivers[i].ops;
if (writeout) {
if (!strcmp(writeout, "immediate")) {
fsle->fse.export_flags |= V9FS_IMMEDIATE_WRITEOUT;
}
}
if (ro) {
fsle->fse.export_flags |= V9FS_RDONLY;
} else {
fsle->fse.export_flags &= ~V9FS_RDONLY;
}
if (fsle->fse.ops->parse_opts) {
if (fsle->fse.ops->parse_opts(opts, &fsle->fse)) {
return -1;
}
}
QTAILQ_INSERT_TAIL(&fsdriver_entries, fsle, next);
return 0;
}
| 1threat
|
i have a button it should work on from 09.00 Am to 04.00 pm and rest of time it should not work : i have a button it should work according to time from 09.00 Am to 04.00 pm and rest of time it should not work.
i am developing an app. i am new in android.... i have three buttons namely register, events, gallery.
when i click register button it should work according to time mentioned above...
if the user click register on that time it should pass on to the next activity.... and rest of times the button click action should not work.... i am stuck in this... plz help for me.....
| 0debug
|
static av_cold int vqa_decode_init(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
unsigned char *vqa_header;
int i, j, codebook_index;
s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
vqa_header = (unsigned char *)s->avctx->extradata;
s->vqa_version = vqa_header[0];
s->width = AV_RL16(&vqa_header[6]);
s->height = AV_RL16(&vqa_header[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
s->vector_width = vqa_header[10];
s->vector_height = vqa_header[11];
s->partial_count = s->partial_countdown = vqa_header[13];
if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) {
return -1;
}
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
if (!s->codebook)
goto fail;
s->next_codebook_buffer = av_malloc(s->codebook_size);
if (!s->next_codebook_buffer)
goto fail;
s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size);
if (!s->decode_buffer)
goto fail;
if (s->vector_height == 4) {
codebook_index = 0xFF00 * 16;
for (i = 0; i < 256; i++)
for (j = 0; j < 16; j++)
s->codebook[codebook_index++] = i;
} else {
codebook_index = 0xF00 * 8;
for (i = 0; i < 256; i++)
for (j = 0; j < 8; j++)
s->codebook[codebook_index++] = i;
}
s->next_codebook_buffer_index = 0;
s->frame.data[0] = NULL;
return 0;
fail:
av_freep(&s->codebook);
av_freep(&s->next_codebook_buffer);
av_freep(&s->decode_buffer);
return AVERROR(ENOMEM);
}
| 1threat
|
Does priority_queue really produce a Heap? : <p>I am bit confused between Heap and priority_queue in C++ STL. Does priority_queue really produce a Heap?</p>
<pre>
If we insert elements in order - 5, 1, 10, 30, 20
Output for maxHeap will be: 30, 20, 5, 1, 10
While output for priority_queue will be: 30, 20, 10, 5, 1
</pre>
<p>What is the reason behind this? </p>
<p>Is priority_queue always sorted?</p>
| 0debug
|
Maven JAR Plugin 3.0.2 Error: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them : <p>Maven JAR plugin (version 3.0.2) keeps throwing the following error, <strong>even for a single invocation of the <code>jar</code> goal</strong>: </p>
<blockquote>
<p>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar (default) on project test: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. -> [Help 1]</p>
</blockquote>
<p>Here's a (minimal?) <code>pom.xml</code> which demonstrates the problem: </p>
<pre><code><project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</code></pre>
<p>The invocation is just <code>mvn package</code>. </p>
<ul>
<li>It doesn't seem to matter whether there are any classes/resources at all — the above error message appears anyway. </li>
<li>The problem also appears if two goals are specified (<code>jar</code> and <code>test-jar</code>). </li>
<li>The problem does NOT appear if <strong>no goals</strong> are specified. But this is not an option, since I really need both <code>jar</code> and <code>test-jar</code>. </li>
</ul>
<p>According to the <a href="https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html#classifier" rel="noreferrer">documentation</a>, <code>classifier</code> only needs to be specified on multiple invocations of the same goal, and there's a reasonable default for the <code>test-jar</code> goal which I don't intend to change. </p>
<p>Also, <strong>the problem doesn't seem to appear on the 2.x line of the JAR plugin.</strong></p>
<p>Did I miss something?
Could anybody please suggest what I am doing wrong? </p>
<p>P.S. The Maven version is 3.3.9. </p>
| 0debug
|
int MPV_encode_picture(AVCodecContext *avctx,
unsigned char *buf, int buf_size, void *data)
{
MpegEncContext *s = avctx->priv_data;
AVFrame *pic_arg = data;
int i, stuffing_count;
for(i=0; i<avctx->thread_count; i++){
int start_y= s->thread_context[i]->start_mb_y;
int end_y= s->thread_context[i]-> end_mb_y;
int h= s->mb_height;
uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h);
uint8_t *end = buf + (size_t)(((int64_t) buf_size)* end_y/h);
init_put_bits(&s->thread_context[i]->pb, start, end - start);
}
s->picture_in_gop_number++;
if(load_input_picture(s, pic_arg) < 0)
return -1;
select_input_picture(s);
if(s->new_picture.data[0]){
s->pict_type= s->new_picture.pict_type;
MPV_frame_start(s, avctx);
vbv_retry:
if (encode_picture(s, s->picture_number) < 0)
return -1;
avctx->real_pict_num = s->picture_number;
avctx->header_bits = s->header_bits;
avctx->mv_bits = s->mv_bits;
avctx->misc_bits = s->misc_bits;
avctx->i_tex_bits = s->i_tex_bits;
avctx->p_tex_bits = s->p_tex_bits;
avctx->i_count = s->i_count;
avctx->p_count = s->mb_num - s->i_count - s->skip_count;
avctx->skip_count = s->skip_count;
MPV_frame_end(s);
if (s->out_format == FMT_MJPEG)
mjpeg_picture_trailer(s);
if(avctx->rc_buffer_size){
RateControlContext *rcc= &s->rc_context;
int max_size= rcc->buffer_index/3;
if(put_bits_count(&s->pb) > max_size && s->qscale < s->avctx->qmax){
s->next_lambda= s->lambda*(s->qscale+1) / s->qscale;
s->mb_skipped = 0;
if(s->pict_type==P_TYPE){
if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
s->no_rounding ^= 1;
}
for(i=0; i<avctx->thread_count; i++){
PutBitContext *pb= &s->thread_context[i]->pb;
init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
}
goto vbv_retry;
}
assert(s->avctx->rc_max_rate);
}
if(s->flags&CODEC_FLAG_PASS1)
ff_write_pass1_stats(s);
for(i=0; i<4; i++){
s->current_picture_ptr->error[i]= s->current_picture.error[i];
avctx->error[i] += s->current_picture_ptr->error[i];
}
if(s->flags&CODEC_FLAG_PASS1)
assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb));
flush_put_bits(&s->pb);
s->frame_bits = put_bits_count(&s->pb);
stuffing_count= ff_vbv_update(s, s->frame_bits);
if(stuffing_count){
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < stuffing_count + 50){
av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n");
return -1;
}
switch(s->codec_id){
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
while(stuffing_count--){
put_bits(&s->pb, 8, 0);
}
break;
case CODEC_ID_MPEG4:
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1C3);
stuffing_count -= 4;
while(stuffing_count--){
put_bits(&s->pb, 8, 0xFF);
}
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n");
}
flush_put_bits(&s->pb);
s->frame_bits = put_bits_count(&s->pb);
}
if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1
&& 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){
int vbv_delay;
assert(s->repeat_first_field==0);
vbv_delay= lrintf(90000 * s->rc_context.buffer_index / s->avctx->rc_max_rate);
assert(vbv_delay < 0xFFFF);
s->vbv_delay_ptr[0] &= 0xF8;
s->vbv_delay_ptr[0] |= vbv_delay>>13;
s->vbv_delay_ptr[1] = vbv_delay>>5;
s->vbv_delay_ptr[2] &= 0x07;
s->vbv_delay_ptr[2] |= vbv_delay<<3;
}
s->total_bits += s->frame_bits;
avctx->frame_bits = s->frame_bits;
}else{
assert((pbBufPtr(&s->pb) == s->pb.buf));
s->frame_bits=0;
}
assert((s->frame_bits&7)==0);
return s->frame_bits/8;
}
| 1threat
|
static int h261_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
H261Context *h= avctx->priv_data;
MpegEncContext *s = &h->s;
int ret;
AVFrame *pict = data;
#ifdef DEBUG
printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
#endif
s->flags= avctx->flags;
s->flags2= avctx->flags2;
if (buf_size == 0) {
return 0;
}
h->gob_start_code_skipped=0;
retry:
init_get_bits(&s->gb, buf, buf_size*8);
if(!s->context_initialized){
if (MPV_common_init(s) < 0)
return -1;
}
if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
int i= ff_find_unused_picture(s, 0);
s->current_picture_ptr= &s->picture[i];
}
ret = h261_decode_picture_header(h);
if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
}
if (s->width != avctx->coded_width || s->height != avctx->coded_height){
ParseContext pc= s->parse_context;
s->parse_context.buffer=0;
MPV_common_end(s);
s->parse_context= pc;
}
if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height);
goto retry;
}
s->current_picture.pict_type= s->pict_type;
s->current_picture.key_frame= s->pict_type == I_TYPE;
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
if(MPV_frame_start(s, avctx) < 0)
return -1;
ff_er_frame_start(s);
s->mb_x=0;
s->mb_y=0;
while(h->gob_number < (s->mb_height==18 ? 12 : 5)){
if(ff_h261_resync(h)<0)
break;
h261_decode_gob(h);
}
MPV_frame_end(s);
assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
assert(s->current_picture.pict_type == s->pict_type);
*pict= *(AVFrame*)s->current_picture_ptr;
ff_print_debug_info(s, pict);
avctx->frame_number = s->picture_number - 1;
*data_size = sizeof(AVFrame);
return get_consumed_bytes(s, buf_size);
}
| 1threat
|
int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len,
int flags)
{
target_ulong len_mask = ~(len - 1);
CPUWatchpoint *wp;
TAILQ_FOREACH(wp, &env->watchpoints, entry) {
if (addr == wp->vaddr && len_mask == wp->len_mask
&& flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
cpu_watchpoint_remove_by_ref(env, wp);
return 0;
}
}
return -ENOENT;
}
| 1threat
|
int ff_h264_decode_sei(H264Context *h)
{
while (get_bits_left(&h->gb) > 16) {
int size = 0;
int type = 0;
int ret = 0;
int last = 0;
while (get_bits_left(&h->gb) >= 8 &&
(last = get_bits(&h->gb, 8)) == 255) {
type += 255;
}
type += last;
last = 0;
while (get_bits_left(&h->gb) >= 8 &&
(last = get_bits(&h->gb, 8)) == 255) {
size += 255;
}
size += last;
if (size > get_bits_left(&h->gb) / 8) {
av_log(h->avctx, AV_LOG_ERROR, "SEI type %d truncated at %d\n",
type, get_bits_left(&h->gb));
return AVERROR_INVALIDDATA;
}
switch (type) {
case SEI_TYPE_PIC_TIMING:
ret = decode_picture_timing(h);
if (ret < 0)
return ret;
break;
case SEI_TYPE_USER_DATA_UNREGISTERED:
ret = decode_unregistered_user_data(h, size);
if (ret < 0)
return ret;
break;
case SEI_TYPE_RECOVERY_POINT:
ret = decode_recovery_point(h);
if (ret < 0)
return ret;
break;
case SEI_TYPE_BUFFERING_PERIOD:
ret = decode_buffering_period(h);
if (ret < 0)
return ret;
break;
case SEI_TYPE_FRAME_PACKING:
ret = decode_frame_packing_arrangement(h);
if (ret < 0)
return ret;
break;
case SEI_TYPE_DISPLAY_ORIENTATION:
ret = decode_display_orientation(h);
if (ret < 0)
return ret;
break;
default:
av_log(h->avctx, AV_LOG_DEBUG, "unknown SEI type %d\n", type);
skip_bits(&h->gb, 8 * size);
}
align_get_bits(&h->gb);
}
return 0;
}
| 1threat
|
void gdb_exit(CPUArchState *env, int code)
{
GDBState *s;
char buf[4];
s = gdbserver_state;
if (!s) {
return;
}
#ifdef CONFIG_USER_ONLY
if (gdbserver_fd < 0 || s->fd < 0) {
return;
}
#endif
snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
put_packet(s, buf);
#ifndef CONFIG_USER_ONLY
if (s->chr) {
qemu_chr_delete(s->chr);
}
#endif
}
| 1threat
|
Threads exercise. Print alternatively the ids of two distinct threads. : //A programme which creates 2 threads that print their own ID and then finish.
// Be careful at printing the threads alternatively (A, B, A, B, ...).
// Here is my code:
void *funct();
//void *functz();
//int functie=0;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
int main(){
int rc1, rc2;
pthread_t thread1, thread2;
if( (rc1 = pthread_create(&thread1, NULL, &funct, NULL)) )
{
printf("Eroare la creare thread: %d \n", rc1);
}
if( (rc2 = pthread_create(&thread2, NULL, &funct, NULL)) )
{
printf("Eroare la creare thread: %d \n", rc2);
}
pthread_join (thread1, NULL);
pthread_join (thread2, NULL);
return 0;
}
void *funct()
{
int i;
//pthread_mutex_lock(&mutex1);
for( i=0; i<10; i++)
{
//pthread_mutex_lock(&mutex1);
//pthread_mutex_lock(&mutex2);
printf("Thread ID: %li \n", pthread_self() );
//pthread_mutex_unlock(&mutex2);
//pthread_mutex_unlock(&mutex1);
}
//pthread_mutex_unlock(&mutex1);
}
/*
void *functz()
{
int i;
//pthread_mutex_lock(&mutex1);
for( i=0; i<10; i++)
{
pthread_mutex_lock(&mutex2);
printf("Thread ID: %li \n", pthread_self() );
pthread_mutex_lock(&mutex1);
}
*/
//As you can see, I have tried multiple strategies, but none of them was successful.
| 0debug
|
Passing btimap image from one activity to another activity without loosing quality of image : <p>When i pass captured image result from one activity to another activity image is loosing quality and getting blur.
Is there any way to pass big size image from one activity to another activity without loosing quality???</p>
| 0debug
|
static av_cold int Faac_encode_close(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
av_freep(&avctx->coded_frame);
av_freep(&avctx->extradata);
faacEncClose(s->faac_handle);
return 0;
}
| 1threat
|
spinner dose not show items [android, mysql, php, json] : I am trying to make spinner that take list of values from mysql database
spinner should display just names then I will get id of this name to move it to other activity
the problem is spinner does not display any thing in run time
even thought it working well when i run just PHP page
please I need help
this is my code
| 0debug
|
isoscele triangle (pyramid) of number in Python3.x : We easily find triangle of number as below:
1
22
333, etc...
What I'm looking for is the way to get the answer as:
1
22
333 ( each number at the center of the following, 1 between 22,etc.)
I can do it with stars''*' with this code:/
n=int(input("give the number of star's lines:")/
for i in range(n):/
T=' '*(n-i-1) + 'x'*(2*i+1)/
print(T)
Must have i to use the def function or others?
Thank you
| 0debug
|
Could not find a version that satisfies the requirement torch>=1.0.0? : <p>Could not find a version that satisfies the requirement torch>=1.0.0
No matching distribution found for torch>=1.0.0 (from stanfordnlp)</p>
| 0debug
|
def count_integer(list1):
ctr = 0
for i in list1:
if isinstance(i, int):
ctr = ctr + 1
return ctr
| 0debug
|
Vertically centering an image within a coloumn : Hi I'm relatively naïve with CSS and am currently re-arranging a template site for my purposes. I've got it all working how I would like apart from I can't vertically centre images in the columns in relation to the size of the other column. Is this possible?
I've tried a few suggestions but no luck yet. Thanks for any help.
<div class="col-sm-6">
<img class="img-responsive img-rounded center-block" src="images/test.jpg" alt="">
</div>
| 0debug
|
static int mpidr_read(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t *value)
{
CPUState *cs = CPU(arm_env_get_cpu(env));
uint32_t mpidr = cs->cpu_index;
if (arm_feature(env, ARM_FEATURE_V7MP)) {
mpidr |= (1 << 31);
}
*value = mpidr;
return 0;
}
| 1threat
|
Combine data from multiple rows : <p>I have the following data in a sql server table:</p>
<hr>
<p><a href="https://i.stack.imgur.com/wgGQH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wgGQH.png" alt="enter image description here"></a></p>
<p>What I need is to combine these rows based on Bulletin_Number and Speed between the mile posts. I need the following output: </p>
<p><a href="https://i.stack.imgur.com/GW6zC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GW6zC.png" alt="enter image description here"></a></p>
<p>How can I do this in SQL Server?</p>
| 0debug
|
Can't boot after installing ubunto with windows 10 : <p>I have asus computer with uefi mode and windows 10 installed on.</p>
<p>I istalled ubuntu 16 with custom installation and then i can.t run both systems. There is no boot file. </p>
<p>I have this message when booting the computer: reboot and select proper boot device or insert boot media in selected boot device and press a key</p>
<p>What i have to do? I don't want to loose my files on windowd 10.</p>
| 0debug
|
static void network_init(void)
{
int i;
for(i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
const char *default_devaddr = NULL;
if (i == 0 && (!nd->model || strcmp(nd->model, "pcnet") == 0))
default_devaddr = "0b";
pci_nic_init(nd, "pcnet", default_devaddr);
}
}
| 1threat
|
Format text file using poweshell : Picup the text file : C:\file.txt
VersionID|VersionNumber|UpgradeDate|Comments
---------|-------------|-----------|--------
1156|3.3.0|2017-01-04 23:13:04.687|3.3 comment
I want to Remove ---------| and create output in a Table format
VersionID|VersionNumber|UpgradeDate |Comments
1156 |3.3.0 |2017-01-04 23:13:04.687|3.3 comment
And Write the output in a new file
C:\output.txt
| 0debug
|
Why use dereferencing when function takes arguments in C++ : <pre><code>#include <iostream>
using namespace std;
class Dummy {
public:
bool isitme (Dummy& param);
};
bool Dummy::isitme (Dummy& param)
{
if (&param == this) return true;
else return false;
}
int main () {
Dummy a;
Dummy* b = &a;
if ( b->isitme(a) )
cout << "yes, &a is b\n";
return 0;
}
</code></pre>
<p>I was looking at this C++ example and I don't understand why <code>bool isitme (Dummy& param);</code> uses the dereferencing sign '&'. The argument is an Dummy object itself right, why it is the object's address?</p>
| 0debug
|
int kvm_arch_init(MachineState *ms, KVMState *s)
{
MachineClass *mc = MACHINE_GET_CLASS(ms);
mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS);
cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF);
cap_mem_op = kvm_check_extension(s, KVM_CAP_S390_MEM_OP);
cap_s390_irq = kvm_check_extension(s, KVM_CAP_S390_INJECT_IRQ);
if (!kvm_check_extension(s, KVM_CAP_S390_GMAP)
|| !kvm_check_extension(s, KVM_CAP_S390_COW)) {
phys_mem_set_alloc(legacy_s390_alloc);
}
kvm_vm_enable_cap(s, KVM_CAP_S390_USER_SIGP, 0);
kvm_vm_enable_cap(s, KVM_CAP_S390_VECTOR_REGISTERS, 0);
kvm_vm_enable_cap(s, KVM_CAP_S390_USER_STSI, 0);
if (ri_allowed()) {
if (kvm_vm_enable_cap(s, KVM_CAP_S390_RI, 0) == 0) {
cap_ri = 1;
}
}
if (gs_allowed()) {
if (kvm_vm_enable_cap(s, KVM_CAP_S390_GS, 0) == 0) {
cap_gs = 1;
}
}
qemu_mutex_init(&qemu_sigp_mutex);
return 0;
}
| 1threat
|
Pyspark converting between two date types : <p>I am having trouble converting a column of dates with one format to another format in pyspark. I know that there is an easy way to get this achieved but don't know how. I already have them in the format of</p>
<pre><code>2019-05-21T13:35:16.203Z
</code></pre>
<p>and I would like it to be in the format</p>
<pre><code>6/10/2019 6:33:34 PM
</code></pre>
<p>Part of the problem is that I don't know what these formats are called for calling a spark dataframe function to do it.</p>
| 0debug
|
Corn Jobs not working : Corn Job dose not work, what m I doing wrong, my config.xml is below, I have 2 methods in my 'Kodework_Ongoing_Model_Observer' class.
The first method works perfectly on checkout, the cornjob method dose not produce any entry to my log, please help me out.
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<?xml version="1.0"?>
<config>
<modules>
<kodework_ongoing>
<version>0.1.0</version>
</kodework_ongoing>
</modules>
<frontend>
<routers>
<mymodule>
<use>standard</use>
<args>
<module>kodework_ongoing</module>
<frontName>ongoing</frontName>
</args>
</mymodule>
</routers>
<events>
<sales_order_place_before>
<observers>
<Kodework_Ongoing_Observer>
<type>singleton</type>
<class>Kodework_Ongoing_Model_Observer</class>
<method>ProcessOrder</method>
</Kodework_Ongoing_Observer>
</observers>
</sales_order_place_before>
</events>
<crontab>
<jobs>
<Kodework_Ongoing_corn>
<schedule><cron_expr>0 1 * * *</cron_expr></schedule>
<run><model>Ongoing/observer::DoSomething</model></run>
</Kodework_Ongoing_corn>
</jobs>
</crontab>
</frontend>
</config>
<!-- end snippet -->
| 0debug
|
static void render_fragments(Vp3DecodeContext *s,
int first_fragment,
int width,
int height,
int plane )
{
int x, y;
int m, n;
int i = first_fragment;
int j;
int16_t *dequantizer;
DCTELEM dequant_block[64];
unsigned char *output_plane;
unsigned char *last_plane;
unsigned char *golden_plane;
int stride;
int motion_x, motion_y;
int motion_x_limit, motion_y_limit;
int motion_halfpel_index;
unsigned int motion_source;
debug_vp3(" vp3: rendering final fragments for %s\n",
(plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane");
if (plane == 0) {
dequantizer = s->intra_y_dequant;
output_plane = s->current_frame.data[0];
last_plane = s->last_frame.data[0];
golden_plane = s->golden_frame.data[0];
stride = -s->current_frame.linesize[0];
} else if (plane == 1) {
dequantizer = s->intra_c_dequant;
output_plane = s->current_frame.data[1];
last_plane = s->last_frame.data[1];
golden_plane = s->golden_frame.data[1];
stride = -s->current_frame.linesize[1];
} else {
dequantizer = s->intra_c_dequant;
output_plane = s->current_frame.data[2];
last_plane = s->last_frame.data[2];
golden_plane = s->golden_frame.data[2];
stride = -s->current_frame.linesize[2];
}
motion_x_limit = width - 8;
motion_y_limit = height - 8;
for (y = 0; y < height; y += 8) {
for (x = 0; x < width; x += 8, i++) {
if (s->all_fragments[i].coding_method != MODE_COPY) {
motion_x = s->all_fragments[i].motion_x;
motion_y = s->all_fragments[i].motion_y;
motion_halfpel_index = s->all_fragments[i].motion_halfpel_index;
motion_source = s->all_fragments[i].first_pixel;
motion_source += motion_x;
motion_source += (motion_y * stride);
if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||
(s->all_fragments[i].coding_method == MODE_GOLDEN_MV)) {
s->dsp.put_pixels_tab[1][motion_halfpel_index](
output_plane + s->all_fragments[i].first_pixel,
golden_plane + motion_source,
stride, 8);
} else
if (s->all_fragments[i].coding_method != MODE_INTRA) {
s->dsp.put_pixels_tab[1][motion_halfpel_index](
output_plane + s->all_fragments[i].first_pixel,
last_plane + motion_source,
stride, 8);
}
debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n",
i, s->all_fragments[i].coding_method,
s->all_fragments[i].coeffs[0], dequantizer[0]);
for (j = 0; j < 64; j++)
dequant_block[dequant_index[j]] =
s->all_fragments[i].coeffs[j] *
dequantizer[j];
debug_idct("dequantized block:\n");
for (m = 0; m < 8; m++) {
for (n = 0; n < 8; n++) {
debug_idct(" %5d", dequant_block[m * 8 + n]);
}
debug_idct("\n");
}
debug_idct("\n");
if (s->all_fragments[i].coding_method == MODE_INTRA) {
dequant_block[0] += 1024;
s->dsp.idct_put(
output_plane + s->all_fragments[i].first_pixel,
stride, dequant_block);
} else {
s->dsp.idct_add(
output_plane + s->all_fragments[i].first_pixel,
stride, dequant_block);
}
debug_idct("block after idct_%s():\n",
(s->all_fragments[i].coding_method == MODE_INTRA)?
"put" : "add");
for (m = 0; m < 8; m++) {
for (n = 0; n < 8; n++) {
debug_idct(" %3d", *(output_plane +
s->all_fragments[i].first_pixel + (m * stride + n)));
}
debug_idct("\n");
}
debug_idct("\n");
} else {
s->dsp.put_pixels_tab[1][0](
output_plane + s->all_fragments[i].first_pixel,
last_plane + s->all_fragments[i].first_pixel,
stride, 8);
}
}
}
emms_c();
}
| 1threat
|
void ff_h264_direct_ref_list_init(H264Context * const h){
MpegEncContext * const s = &h->s;
Picture * const ref1 = &h->ref_list[1][0];
Picture * const cur = s->current_picture_ptr;
int list, j, field;
int sidx= (s->picture_structure&1)^1;
int ref1sidx = (ref1->f.reference&1)^1;
for(list=0; list<2; list++){
cur->ref_count[sidx][list] = h->ref_count[list];
for(j=0; j<h->ref_count[list]; j++)
cur->ref_poc[sidx][list][j] = 4 * h->ref_list[list][j].frame_num + (h->ref_list[list][j].f.reference & 3);
}
if(s->picture_structure == PICT_FRAME){
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
memcpy(cur->ref_poc [1], cur->ref_poc [0], sizeof(cur->ref_poc [0]));
}
cur->mbaff= FRAME_MBAFF;
h->col_fieldoff= 0;
if(s->picture_structure == PICT_FRAME){
int cur_poc = s->current_picture_ptr->poc;
int *col_poc = h->ref_list[1]->field_poc;
h->col_parity= (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc));
ref1sidx=sidx= h->col_parity;
} else if (!(s->picture_structure & h->ref_list[1][0].f.reference) && !h->ref_list[1][0].mbaff) {
h->col_fieldoff = 2 * h->ref_list[1][0].f.reference - 3;
}
if (cur->f.pict_type != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
return;
for(list=0; list<2; list++){
fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0);
if(FRAME_MBAFF)
for(field=0; field<2; field++)
fill_colmap(h, h->map_col_to_list0_field[field], list, field, field, 1);
}
}
| 1threat
|
static void tcg_out_brcond64(TCGContext *s, TCGCond cond,
TCGArg arg1, TCGArg arg2, int const_arg2,
int label_index, int small)
{
tcg_out_cmp(s, arg1, arg2, const_arg2, P_REXW);
tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index, small);
}
| 1threat
|
AES input and output : <p>I want an implementation of AES that takes as parameters two String inputs (plaintext, key) and outputs the encrypted String ciphertext. I have search all over the Internet but I haven't found. I have found AES that has byte[] input and outputs String and the other way round. Is it already implemented or I have to play aroundwith Java and create some methods that will finally do the job?
Thank you!</p>
| 0debug
|
static int ehci_fill_queue(EHCIPacket *p)
{
EHCIQueue *q = p->queue;
EHCIqtd qtd = p->qtd;
uint32_t qtdaddr;
for (;;) {
if (NLPTR_TBIT(qtd.altnext) == 0) {
break;
}
if (NLPTR_TBIT(qtd.next) != 0) {
break;
}
qtdaddr = qtd.next;
get_dwords(q->ehci, NLPTR_GET(qtdaddr),
(uint32_t *) &qtd, sizeof(EHCIqtd) >> 2);
ehci_trace_qtd(q, NLPTR_GET(qtdaddr), &qtd);
if (!(qtd.token & QTD_TOKEN_ACTIVE)) {
break;
}
p = ehci_alloc_packet(q);
p->qtdaddr = qtdaddr;
p->qtd = qtd;
p->usb_status = ehci_execute(p, "queue");
if (p->usb_status == USB_RET_PROCERR) {
break;
}
assert(p->usb_status == USB_RET_ASYNC);
p->async = EHCI_ASYNC_INFLIGHT;
}
return p->usb_status;
}
| 1threat
|
eth_read(void *opaque, target_phys_addr_t addr, unsigned int size)
{
struct fs_eth *eth = opaque;
uint32_t r = 0;
addr >>= 2;
switch (addr) {
case R_STAT:
r = eth->mdio_bus.mdio & 1;
break;
default:
r = eth->regs[addr];
D(printf ("%s %x\n", __func__, addr * 4));
break;
}
return r;
}
| 1threat
|
Regular expression to remove the dot (.) from a number : <p>I want to write a regular expression in Java to remove the dot (.) from a number and all the numbers that come after it.</p>
<p>Example: 3.14</p>
<p>Need a regex to return only 3.</p>
<p>I'm trying to use this block:</p>
<pre><code>String value = "3.14";
value = value.replaceAll("[[.]]", "");
System.out.println(value);
</code></pre>
<p>Obviously, it just removes the ".". I tried other matches like [[.*$]] to remove everything until the end of the line, but it is taking me nowhere. </p>
<p>I'm using this table (<a href="http://tutorials.jenkov.com/java-regex/syntax.html" rel="nofollow noreferrer">http://tutorials.jenkov.com/java-regex/syntax.html</a>), what I'm finding pretty good actually, and test its use.</p>
| 0debug
|
static void choose_sample_rate(AVStream *st, AVCodec *codec)
{
if(codec && codec->supported_samplerates){
const int *p= codec->supported_samplerates;
int best;
int best_dist=INT_MAX;
for(; *p; p++){
int dist= abs(st->codec->sample_rate - *p);
if(dist < best_dist){
best_dist= dist;
best= *p;
}
}
if(best_dist){
av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best);
}
st->codec->sample_rate= best;
}
}
| 1threat
|
Connecting two elements using a line/wire mannualy : [enter image description here][1]
[1]: https://i.stack.imgur.com/pPg04.jpg
I want that user can connect these points using a wire or line . Connection get complete when point 1,2,6 are connected other wise if he/she makes wrong connections screen show wrong connections.
| 0debug
|
warning: Corrupted shared library list : <p>Under linux, when debugging my program with gdb the following message appears:</p>
<pre><code>warning: Corrupted shared library list: 0x639130 != 0x7ffff7fd9598
</code></pre>
<p>In my program I am loading several .so files via dlopen(). After calling dlopen(), the message appears. </p>
<p>Then, when I load the next .so, the message appears again, but this time with different addresses:</p>
<pre><code>warning: Corrupted shared library list: 0x63c9e0 != 0x639130
</code></pre>
<p>I have looked for references about this message on the internet but have not found anything. There are some references about a corrupted shared library, but not about a corrupted shared library list.</p>
<p>Does anyone know what might be the cause for this?</p>
<p>I am running Ubuntu AMD64 and compile in 64bit with g++ command line options:</p>
<pre><code>-std=c++11 -fPIC
</code></pre>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.