problem
stringlengths
26
131k
labels
class label
2 classes
how to split string and get particular value c# : <p>i have below strings:</p> <pre><code>str1- {"ip":"xxx.xx.xx.xxx","power":"7.15","sat":"10","capacity":"20","status":"ok"} str2- {"ip":"xxx.xx.xx.xxx","power":"7.15","sat":"10","status":"ok"} </code></pre> <p>Now i want to get the data of <code>capacity</code> .</p> <p>how can i do it with split function ?</p>
0debug
Pytest: Getting addresses of all tests : <p>When I run <code>pytest --collect-only</code> to get the list of my tests, I get them in a format like <code>&lt;Function: test_whatever&gt;</code>. However, when I use <code>pytest -k ...</code> to run a specific test, I need to input the "address" of the test in the format <code>foo::test_whatever</code>. Is it possible to get a list of all the addresses of all the tests in the same format that <code>-k</code> takes?</p>
0debug
static void nvdimm_build_nvdimm_devices(GSList *device_list, Aml *root_dev) { for (; device_list; device_list = device_list->next) { DeviceState *dev = device_list->data; int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP, NULL); uint32_t handle = nvdimm_slot_to_handle(slot); Aml *nvdimm_dev; nvdimm_dev = aml_device("NV%02X", slot); aml_append(nvdimm_dev, aml_name_decl("_ADR", aml_int(handle))); nvdimm_build_device_dsm(nvdimm_dev); aml_append(root_dev, nvdimm_dev); } }
1threat
How do I remove newline in front of lower-case characters in sed? : <p>I have a text file with about 5,000 lines. I want to remove the lines in front of the lower-case characters, so that</p> <pre><code>Now is the time for all good men The quick brown fox jumped over </code></pre> <p>Becomes:</p> <pre><code>Now is the time for all good men The quick brown fox jumped over </code></pre>
0debug
What do html.oldie mean in CSS? : I find a code line in CSS; html.oldie .hero-gallery{height:860px}. What do html.ordie mean? I guess this is for different browser's view, but I don't know what exactly this mean. Thanks!
0debug
How to add photo over another photo in html : <p>how can I add picture over another picture like this: <a href="https://i.stack.imgur.com/p8qmc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p8qmc.png" alt="enter image description here"></a></p> <p>Here is my HTML code: </p> <pre><code>&lt;body&gt; &lt;div class="container-fluid"&gt; &lt;p&gt;&lt;a href="" class="as"&gt;Начало&lt;/a&gt; &lt;a href="" class="as"&gt;За нас&lt;/a&gt; &lt;a href="" class="as"&gt;Промоции&lt;/a&gt; &lt;a href="" class="as"&gt;Контакти&lt;/a&gt;&lt;/p&gt; &lt;p class="moto"&gt;Веднъж хапни, за цял живот се пристрасти!&lt;/p&gt; &lt;/div&gt; </code></pre> <p>and CSS code:</p> <pre><code>.container-fluid { height: 470px; background-image:linear-gradient(to bottom, black, black, transparent 70px, transparent 330px, black, black 500px),url("images.jpg"); background-size: 100% 100%; } </code></pre>
0debug
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFContext *mxf = arg; int item_num = avio_rb32(pb); int item_len = avio_rb32(pb); if (item_len != 18) { avpriv_request_sample(pb, "Primer pack item length %d", item_len); return AVERROR_PATCHWELCOME; } if (item_num > 65536) { av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num); return AVERROR_INVALIDDATA; } mxf->local_tags = av_calloc(item_num, item_len); if (!mxf->local_tags) return AVERROR(ENOMEM); mxf->local_tags_count = item_num; avio_read(pb, mxf->local_tags, item_num*item_len); return 0; }
1threat
What is Axiom K? : <p>I've noticed the discussion of "Axiom K" comes up more often since HoTT. I believe it's related to pattern matching. I'm surprised that I cannot find a reference in TAPL, ATTAPL or PFPL.</p> <ul> <li>What is Axiom K?</li> <li>Is it used for ML-style pattern matching as in SML (or just dependent pattern matching)?</li> <li>What's an appropriate reference for Axiom K?</li> </ul>
0debug
How to run .cpp application on .htm file? : <p>I've made a webpage on HTML and I want to run a .cpp application on it. With the way I've learnt to do it, the code is displayed. </p>
0debug
static uint64_t pmsav5_data_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) { return simple_mpu_ap_bits(env->cp15.c5_data); }
1threat
What are best practices when implementing an enum in Java? : <p>When implementing an enum, should we take care of its serialization or Standard Java takes care of it? Another point concerns the null safety, how can we make sure that enums are null safe? </p>
0debug
Advice on loopback.js vs express js : <p>Planning to build an enterprise level application using node js. Have already worked on express js for a few projects. </p> <p>When researching for other possible frameworks, came across loopback js. Loopback.js, a new framework(3-4 years) built over express framework. The initial configuration and set up of the application was so quick, as i able to set up api endpoints, basic crud, acl, user auth, jwt in few hours. The documentation is bit complex and coid maintenance not good.</p> <p>But for a bigger application, is loopback.js scalable and how about performance and its default ORM? With express we can write everything the way we want and in a custom way. </p> <p>Need some advise and points on this. loopback.js vs express js</p>
0debug
How to pass data to component to another component : <p>I need help, at the last days I was tring to pass data between components... I followed alot of samples around internet, and none of those works.</p> <p>The most tutorials says to me to use @input and @output. i think this is the most correct way to pass data in angular...</p> <p>Here is my structure:</p> <p>The componentA is called in html of componentC, like this: </p> <pre><code>&lt;app-componentA&lt;/app-componentA&gt; </code></pre> <p>The componentB is called via modalController</p> <p><a href="https://i.stack.imgur.com/By6jF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/By6jF.png" alt="my structure"></a></p> <p>in my actual code, i pass the data generated in componentB to componentC like this:</p> <pre class="lang-js prettyprint-override"><code>// componentB.ts dimiss(filters?: any) { this.modalController.dismiss(filters); } </code></pre> <p>and recive in componentC:</p> <pre class="lang-js prettyprint-override"><code>// componentC.ts const filters = await modal.onDidDismiss(); this.Myfilters = filters ; </code></pre> <p>now how i pass the data from componentB to ComponentA?</p>
0debug
static uint16_t read_u16(uint8_t *data, size_t offset) { return ((data[offset] & 0xFF) << 8) | (data[offset + 1] & 0xFF); }
1threat
Error when Using getSupportActionBar in Android Studio : I have an android project. I used android studio. In my project, I want to change the Title project with getSupportActionBar().setTitlte(), but I got an error. **Error** : 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: FATAL EXCEPTION: main 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: Process: com.mynotescode.apps.layout, PID: 16441 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mynotescode.apps.layout/com.mynotescode.apps.layout.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:147) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5264) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.mynotescode.apps.layout.MainActivity.onCreate(MainActivity.java:18) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5975) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:147)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5264)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)  **This is my MainActivity.java :** package com.mynotescode.apps.layout; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("Hotel Hilton"); actionBar.setSubtitle("Isla Nublar"); actionBar.setDisplayHomeAsUpEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_bookmark) { return true; } if (id == android.R.id.home){ finish(); } return super.onOptionsItemSelected(item); } } Please help me. Thank you.
0debug
How to print value in exponential notation? : <p>I have this:</p> <pre><code>print('bionumbers:',bionumbers) </code></pre> <p>which outputs:</p> <p>bionumbers: 9381343483.4</p> <p>How can I output this value in exponent notation?</p>
0debug
Disable word-wrap by default in Sublime "Find in Files" results : <p>Sublime's "Find in Files" (<kbd>CTRL</kbd>-<kbd>SHIFT</kbd>-<kbd>F</kbd> or <kbd>CMD</kbd>-<kbd>SHIFT</kbd>-<kbd>F</kbd>) search results always have word wrap on by default. This is really annoying whenever a file containing a single huge line of text gets caught in the results, since:</p> <ul> <li>wrapping the huge line takes ages and slows Sublime (and perhaps the whole computer) to a crawl, and</li> <li>it makes the results difficult to read, since the wrapped line may take up screens and screens of space</li> </ul> <p>It's possible to disable word-wrap from the "View" menu, but this change doesn't persist after closing the "Find Results" tab.</p> <p>Is there a way to turn off word wrap for all Find Results?</p>
0debug
Ruby on rails geting to the codes : <p>How do I get to where I can change the code of the web site? I cant find the file but I can not change the HTML of the site.</p>
0debug
No such file or directory: 'geckodriver' for a Python simple Selenium application : <p>I'm running a simple example of selenium on Linux:</p> <pre><code>from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get("something") </code></pre> <p>and get an error:</p> <pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver' </code></pre> <p>How to fix it?</p> <pre><code>$ python Python 3.5.2 (default, Jun 28 2016, 08:46:01) [GCC 6.1.1 20160602] on linux Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import selenium &gt;&gt;&gt; from selenium.webdriver.common.keys import Keys &gt;&gt;&gt; </code></pre>
0debug
Recreate iOS 13' share sheet modal in swift (not the share sheet itself, but the way it's presented) : <p>is there a way to easily recreate the modal presentation style of ios 13' new share sheet? (At first, it's only presented halfway and you can swipe up to make it a "full" modal sheet) I can do it using a completely custom presentation and stuff but is there a "native" api for this behavior so that you don't have to use custom code?</p> <p>Thanks!</p> <p><a href="https://i.stack.imgur.com/5DUcI.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/5DUcI.gif" alt="enter image description here"></a></p>
0debug
Textview three dots when text truncates but also include the ending quote : <p>I have a textview with the property</p> <p><code>android:maxLines="1"</code></p> <p>In case the text is too long it truncates and add the three dots. i.e</p> <p>If I want to put the text (including the quotes) "hello world one two three four"</p> <p>It will display</p> <p>"hello world one two....</p> <p>but I would like to display the closing quote.</p> <p>"hello world one two..."</p> <p>How to achieve this??</p>
0debug
Running tasks parallel in powershell : <p>I have a PowerShell script like this:</p> <pre><code>Foreach ($file in $files) { [Do something] [Do something] [Do something] } </code></pre> <p>This way one file is treated after the other. I want to treat 4 files at the same time.</p> <p>I know of the foreach -parallel loop, but that does the [do something] tasks in parallel. I basically want to run the whole foreach loop in parallel.</p> <p>How can I achieve this in PowerShell?</p>
0debug
How to get Url params after slash : <p>I have a URL "<a href="https://www.example.com/username" rel="nofollow noreferrer">https://www.example.com/username</a>" and I want to extract the username from the URL. For example '<a href="https://www.facebook.com/david" rel="nofollow noreferrer">https://www.facebook.com/david</a>'</p>
0debug
How to use if-else condition on gitlabci : <p>How to use if else condition inside the gitlab-CI.</p> <p>I have below code:</p> <pre><code>deploy-dev: image: testimage environment: dev tags: - kubectl script: - kubectl apply -f demo1 --record=true - kubectl apply -f demo2 --record=true </code></pre> <p>Now I want to add a condition something like this</p> <pre><code>script: - (if [ "$flag" == "true" ]; then kubectl apply -f demo1 --record=true; else kubectl apply -f demo2 --record=true); </code></pre> <p>Could someone provide the correct syntax for the same? Is there any documentation for the conditions (if-else, for loop) in gitlabci?</p>
0debug
static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, abi_ulong parent_tidptr, target_ulong newtls, abi_ulong child_tidptr) { int ret; TaskState *ts; uint8_t *new_stack; CPUState *new_env; #if defined(CONFIG_USE_NPTL) unsigned int nptl_flags; sigset_t sigmask; #endif if (flags & CLONE_VFORK) flags &= ~(CLONE_VFORK | CLONE_VM); if (flags & CLONE_VM) { TaskState *parent_ts = (TaskState *)env->opaque; #if defined(CONFIG_USE_NPTL) new_thread_info info; pthread_attr_t attr; #endif ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE); init_task_state(ts); new_stack = ts->stack; new_env = cpu_copy(env); #if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PPC) cpu_reset(new_env); #endif cpu_clone_regs(new_env, newsp); new_env->opaque = ts; ts->bprm = parent_ts->bprm; ts->info = parent_ts->info; #if defined(CONFIG_USE_NPTL) nptl_flags = flags; flags &= ~CLONE_NPTL_FLAGS2; if (nptl_flags & CLONE_CHILD_CLEARTID) { ts->child_tidptr = child_tidptr; } if (nptl_flags & CLONE_SETTLS) cpu_set_tls (new_env, newtls); pthread_mutex_lock(&clone_lock); memset(&info, 0, sizeof(info)); pthread_mutex_init(&info.mutex, NULL); pthread_mutex_lock(&info.mutex); pthread_cond_init(&info.cond, NULL); info.env = new_env; if (nptl_flags & CLONE_CHILD_SETTID) info.child_tidptr = child_tidptr; if (nptl_flags & CLONE_PARENT_SETTID) info.parent_tidptr = parent_tidptr; ret = pthread_attr_init(&attr); ret = pthread_attr_setstack(&attr, new_stack, NEW_STACK_SIZE); sigfillset(&sigmask); sigprocmask(SIG_BLOCK, &sigmask, &info.sigmask); ret = pthread_create(&info.thread, &attr, clone_func, &info); sigprocmask(SIG_SETMASK, &info.sigmask, NULL); pthread_attr_destroy(&attr); if (ret == 0) { pthread_cond_wait(&info.cond, &info.mutex); ret = info.tid; if (flags & CLONE_PARENT_SETTID) put_user_u32(ret, parent_tidptr); } else { ret = -1; } pthread_mutex_unlock(&info.mutex); pthread_cond_destroy(&info.cond); pthread_mutex_destroy(&info.mutex); pthread_mutex_unlock(&clone_lock); #else if (flags & CLONE_NPTL_FLAGS2) return -EINVAL; #ifdef __ia64__ ret = __clone2(clone_func, new_stack, NEW_STACK_SIZE, flags, new_env); #else ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); #endif #endif } else { if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) return -EINVAL; fork_start(); ret = fork(); if (ret == 0) { cpu_clone_regs(env, newsp); fork_end(1); #if defined(CONFIG_USE_NPTL) if (flags & CLONE_CHILD_SETTID) put_user_u32(gettid(), child_tidptr); if (flags & CLONE_PARENT_SETTID) put_user_u32(gettid(), parent_tidptr); ts = (TaskState *)env->opaque; if (flags & CLONE_SETTLS) cpu_set_tls (env, newtls); if (flags & CLONE_CHILD_CLEARTID) ts->child_tidptr = child_tidptr; #endif } else { fork_end(0); } } return ret; }
1threat
Parsec: Applicatives vs Monads : <p>I'm just starting with Parsec (having little experience in Haskell), and I'm a little confused about using monads or applicatives. The overall feel I had after reading "Real World Haskell", "Write You a Haskell" and a question here is that applicatives are preferred, but really I have no idea.</p> <p>So my questions are:</p> <ul> <li>What approach is preferred?</li> <li>Can monads and applicatives be mixed (use them when they are more useful than the other)</li> <li>If the last answer is yes, should I do it?</li> </ul>
0debug
static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) { STM32F205State *s = STM32F205_SOC(dev_soc); DeviceState *syscfgdev, *usartdev, *timerdev; SysBusDevice *syscfgbusdev, *usartbusdev, *timerbusdev; qemu_irq *pic; Error *err = NULL; int i; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *flash = g_new(MemoryRegion, 1); MemoryRegion *flash_alias = g_new(MemoryRegion, 1); memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE, &error_abort); memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", flash, 0, FLASH_SIZE); vmstate_register_ram_global(flash); memory_region_set_readonly(flash, true); memory_region_set_readonly(flash_alias, true); memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram); pic = armv7m_init(get_system_memory(), FLASH_SIZE, 96, s->kernel_filename, s->cpu_model); syscfgdev = DEVICE(&s->syscfg); object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } syscfgbusdev = SYS_BUS_DEVICE(syscfgdev); sysbus_mmio_map(syscfgbusdev, 0, 0x40013800); sysbus_connect_irq(syscfgbusdev, 0, pic[71]); for (i = 0; i < STM_NUM_USARTS; i++) { usartdev = DEVICE(&(s->usart[i])); object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } usartbusdev = SYS_BUS_DEVICE(usartdev); sysbus_mmio_map(usartbusdev, 0, usart_addr[i]); sysbus_connect_irq(usartbusdev, 0, pic[usart_irq[i]]); } for (i = 0; i < STM_NUM_TIMERS; i++) { timerdev = DEVICE(&(s->timer[i])); qdev_prop_set_uint64(timerdev, "clock-frequency", 1000000000); object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } timerbusdev = SYS_BUS_DEVICE(timerdev); sysbus_mmio_map(timerbusdev, 0, timer_addr[i]); sysbus_connect_irq(timerbusdev, 0, pic[timer_irq[i]]); } }
1threat
/bin/sh: 1: Syntax error: EOF in backquote substitution : <p>I created a new task in crontab as shown below :</p> <pre><code>*/2 * * * * mongodump --db prodys --out /backup/databases/mongoDatabases/`date +"%m-%d-%y"` </code></pre> <p>I'm getting following error :</p> <pre><code>/bin/sh: 1: Syntax error: EOF in backquote substitution </code></pre> <p>Please help, I don't have any clue whats wrong.</p>
0debug
ORA-907 missing right parenthesis when using AS keyword : <p>I get a ORA-907 with the following sql statement. It looks like that there's a problem with using the AS keyword. When I remove the AS keyword and use complete tablenames in my statement it works as expected.</p> <p>Is that a known issue with oracle? It's running on an 11g, when more details are needed I've to talk to my admin. I've found some older hints which state that there was a bug, in versions &lt; 11.</p> <pre><code>SELECT easbwaredgs_t.id, easbwaredgs_t.fk_easbware_id, easbwaredgs_t.mandant, easbwaredgs_t.reg_code_mc, easbwaredgs_t.hazard_code_ident, easbwaredgs_t.add_hazard_code, easbwaredgs_t.haz_code_version, easbwaredgs_t.undg_number, easbwaredgs_t.ship_flashpoint, easbwaredgs_t.flashpoint_type, easbwaredgs_t.cont_dopc, easbwaredgs_t.cont_dop, easbwaredgs_t.cont_phone, easbwaredgs_t.verpack_grp_mc, easbwaredgs_t.ems_nr, easbwaredgs_t.trem_card_nr, easbwaredgs_t.secondimo, easbwaredgs_t.thirdimo, ( SELECT COUNT(*) FROM easbwaredgs_t AS k LEFT OUTER JOIN easbdgstn_t AS p ON k.id = p.fk_easbwaredgsid WHERE k.mandant = '001' AND k.fk_easbware_id = 1 AND p.type_mc = 'TRANSPORT_DGS_LIM_QUANT' ) AS cc_is_limited_quantities FROM easbwaredgs_t WHERE easbwaredgs_t.mandant = '001' AND easbwaredgs_t.fk_easbware_id = 1 </code></pre>
0debug
OkHttpClient throws exception after upgrading to OkHttp3 : <p>I'm using following lines of code to add a default header to all of my requests sent using Retrofit2:</p> <pre><code>private static OkHttpClient defaultHttpClient = new OkHttpClient(); static { defaultHttpClient.networkInterceptors().add(new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request().newBuilder() .addHeader("Accept", "Application/JSON").build(); return chain.proceed(request); } }); } </code></pre> <p>After upgrading retrofit to beta-3 version, I had to upgrade OkHttp to OkHttp3 also (actually I just changed package names from okhttp to okhttp3, the library is included inside retrofit). After that I get exceptions from this line:</p> <pre><code>defaultHttpClient.networkInterceptors().add(new Interceptor()); </code></pre> <blockquote> <p>Caused by: java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.add(Collections.java:932)</p> </blockquote> <hr> <blockquote> <p>Caused by: java.lang.ExceptionInInitializerError</p> </blockquote> <hr> <p>What is the problem here?</p>
0debug
undefined output with Array.prototype.reduce : <p>Why the following code produce undefined as output?</p> <pre><code>function sumAll(arr) { arr.reduce( (a, b) =&gt; a + b ); } sumAll([1,2,3,4]); </code></pre> <p>While if i run this code without the function like this:</p> <pre><code>var arr = [1,2,3,4]; arr.reduce( (prev, curr) =&gt; prev + curr ); </code></pre> <p>it works properly and produce 10 as sum of all elements.</p> <p>What's wrong with the first one? I'm pretty new to JS that's why i can't figure it out what's wrong with the first one.</p> <p>Thanks in advance for the help.</p>
0debug
Where to store API keys on Swift? : <p>I have a bunch of API keys and secrets (Stripe, Cloudinary etc), that are currently hard coded in my app. Where is the right place to store them? Should they be in the server, and I just store the server URL at my end (so that if the keys changes, the app continues to work)? </p> <p>for example, I have this in my app delegate file:</p> <pre><code> func configureStripe(){ STPPaymentConfiguration.sharedConfiguration().publishableKey = "pk_test_1234rtyhudjjfjjs" STPPaymentConfiguration.sharedConfiguration().appleMerchantIdentifier = "merchant.com.myapp" } </code></pre>
0debug
What is the difference between ProcessPoolExecutor and ThreadPoolExecutor? : <p>I read the docs trying to get a basic understanding but it only shows that <code>ProcessPoolExecutor</code> allows to side-step the <code>Global Interpreter Lock</code> which I think is the way to lock a variable or function so that parallel processes do not update its value at the same time.</p> <p>What I am looking for is when to use <code>ProcessPoolExecutor</code> and when to use <code>ThreadPoolExecutor</code> and what should I keep in mind while using each approach!</p>
0debug
I dont get why is the correct answer the one circled in green and not the above one, what is the use of the // ( backslash) and /// ? : [enter image description here][1] [1]: https://i.stack.imgur.com/FDMZb.png I dont get why is the correct answer the one circled in green and not the above one, what is the use of the // ( backslash) and /// ?
0debug
How to get mimimum and maximum values in text file in C#? : In the text file(test.txt) have value "Hi this my code project file" Minimum=5 and maximum=6 I need out put is minimum= 5 ("Hi t) maximum=6 ("Hi th) "Hi th
0debug
How To use variable values from one method to another method in c#? : I have a GUI functioning code, in which I am using two 'button' methods. I want to use values of some variables from first method to another. like- I want to use values of h and w of button1_Click in button2_Click. How is it possible ?? public int h, w; public Form1() { InitializeComponent(); textBox1.Text = "Image Path here ..."; } public void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select an Image"; dlg.Filter = "jpg files (*.jpg)|*.jpg"; if (DialogResult.OK == dlg.ShowDialog()) { this.pictureBox1.Image = new Bitmap(dlg.FileName); Bitmap img = new Bitmap(dlg.FileName); int w = img.Width; int h = img.Height; pictureBox1.Height = h; pictureBox1.Width = w; textBox1.Text = dlg.FileName; } } public void button2_Click(object sender, EventArgs e) { MessageBox.Show("Height is- " + h.ToString() + " Width is- " + w.ToString(), "Height & Width"); } } }
0debug
Shell script to mail script output in table format : <p>I am new to shell script. I need your help on below scenario.</p> <p>Script: wc file1 file2 file3 file4</p> <pre><code>results : 1488 2977 2248 file1 123 345 657 file2 123 896 456 file3 567 987 124 file4 </code></pre> <p>Now I need to mail this result in below format with header name</p> <p>Here,2nd column is always default value.</p> <pre><code>Filename Destname rowcount bytesize file1 default 1488 2248 file2 default 123 657 file3 default 123 456 file4 default 567 124 </code></pre> <p>Please some one help me to write this script.</p>
0debug
static inline void gen_intermediate_code_internal(AlphaCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUAlphaState *env = &cpu->env; DisasContext ctx, *ctxp = &ctx; target_ulong pc_start; target_ulong pc_mask; uint32_t insn; uint16_t *gen_opc_end; CPUBreakpoint *bp; int j, lj = -1; ExitStatus ret; int num_insns; int max_insns; pc_start = tb->pc; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.tb = tb; ctx.pc = pc_start; ctx.mem_idx = cpu_mmu_index(env); ctx.implver = env->implver; ctx.singlestep_enabled = cs->singlestep_enabled; ctx.tb_rm = -1; ctx.tb_ftz = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (in_superpage(&ctx, pc_start)) { pc_mask = (1ULL << 41) - 1; } else { pc_mask = ~TARGET_PAGE_MASK; } gen_tb_start(); do { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == ctx.pc) { gen_excp(&ctx, EXCP_DEBUG, 0); break; } } } if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) tcg_ctx.gen_opc_instr_start[lj++] = 0; } tcg_ctx.gen_opc_pc[lj] = ctx.pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } insn = cpu_ldl_code(env, ctx.pc); num_insns++; if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(ctx.pc); } TCGV_UNUSED_I64(ctx.zero); TCGV_UNUSED_I64(ctx.sink); TCGV_UNUSED_I64(ctx.lit); ctx.pc += 4; ret = translate_one(ctxp, insn); if (!TCGV_IS_UNUSED_I64(ctx.sink)) { tcg_gen_discard_i64(ctx.sink); tcg_temp_free(ctx.sink); } if (!TCGV_IS_UNUSED_I64(ctx.zero)) { tcg_temp_free(ctx.zero); } if (!TCGV_IS_UNUSED_I64(ctx.lit)) { tcg_temp_free(ctx.lit); } if (ret == NO_EXIT && ((ctx.pc & pc_mask) == 0 || tcg_ctx.gen_opc_ptr >= gen_opc_end || num_insns >= max_insns || singlestep || ctx.singlestep_enabled)) { ret = EXIT_PC_STALE; } } while (ret == NO_EXIT); if (tb->cflags & CF_LAST_IO) { gen_io_end(); } switch (ret) { case EXIT_GOTO_TB: case EXIT_NORETURN: break; case EXIT_PC_STALE: tcg_gen_movi_i64(cpu_pc, ctx.pc); case EXIT_PC_UPDATED: if (ctx.singlestep_enabled) { gen_excp_1(EXCP_DEBUG, 0); } else { tcg_gen_exit_tb(0); } break; default: abort(); } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) tcg_ctx.gen_opc_instr_start[lj++] = 0; } else { tb->size = ctx.pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, ctx.pc - pc_start, 1); qemu_log("\n"); } #endif }
1threat
How to generate C# client from Swagger 1.2 spec? : <p>There seems to be millions of options out there for every platform, but I'm struggling to find a simple solution for C#. All the ones I have found seem to have given me trouble: either they simply don't work (e.g. <a href="http://swaggercodegen.azurewebsites.net/" rel="noreferrer">http://swaggercodegen.azurewebsites.net/</a>), or only support 2.0 (e.g. <a href="https://github.com/Azure/autorest" rel="noreferrer">AutoRest</a> and <a href="https://github.com/NSwag/NSwag" rel="noreferrer">NSwag</a>). Half the tools are not even clear what versions they support :-(</p> <p>I'm aware of the <a href="https://github.com/swagger-api/swagger-codegen/" rel="noreferrer">official tool</a>, but that requires JDK 7 which is not currently an option for me.</p> <p>In desperation I have even tried converting the swagger spec to 2.0, but half the conversion tools I tried didn't work, gave conflicting advice, or I couldn't figure out how to use (I found myself knee deep in nodejs very quickly...is this really the brave new world?! Bring back WSDL ;-) ).</p>
0debug
DOWNLOAD_SOURCE Failed AWS CodeBuild : <p>Whenever I start AWS CodeBuild I get this type of error every time. please help.</p> <blockquote> <p>DOWNLOAD_SOURCE Failed 3 mins, 2 secs </p> <p>Get <a href="https://github.com/themithunbiswas/test-repo.git/info/refs?service=git-upload-pack" rel="noreferrer">https://github.com/themithunbiswas/test-repo.git/info/refs?service=git-upload-pack</a>: dial tcp 192.30.253.113:443: i/o timeout</p> </blockquote>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Cut tile javascript in div : i have code cut tile: TITL1 - TITLE2 [XXX] var Enumber1 = new Array(); $("#id").each(function(i){ var text = $(this).text(); if(text.indexOf('[') != -1 || text.indexOf(']') != -1){ var Ntext1 = text.split('[')[0]; Enumber1[i] = text.split('[')[1].split(']')[0]; $(this).text(Ntext1); } }); $("#id").each(function(i){ $(this).fadeIn("slow"); if(Enumber1[i] != undefined){ $(this).text(Enumber1[i]); }else{ $(this).css('N/A'); } }); - TITLE1 -TITL2 - [XXX] Help me fix it - TILE1 in >>> in div class"title" - 2.TITLE >>> in div class"title2" - XXX >>> in div class"cut" thanks!!!
0debug
static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, long width, long height, long lumStride, long chromStride, long srcStride) { long y; const long chromWidth= -((-width)>>1); for (y=0; y<height; y++) { RENAME(extract_even)(src, ydst, width); RENAME(extract_odd2)(src, udst, vdst, chromWidth); src += srcStride; ydst+= lumStride; udst+= chromStride; vdst+= chromStride; } #if COMPILE_TEMPLATE_MMX __asm__( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif }
1threat
Swift 3 add new contact with phone and email information : <p>I'm trying to prompt the user to create a new contact and pass in information. (specifically a phone and email)</p> <p>I've found numerous examples of using a CNMutableContact and adding an email to it. However, any of the code involving the CNContact gives me a "Use of undeclared type" error. </p> <p>How can I setup my class to prompt the user to save the contact?</p>
0debug
redirecting to Google OAuth flow in progressive web app : <p>I've been working on an app using React and Next.js, currently adding PWA support.</p> <p>Users log in to the app via the Google OAuth flow. I was originally using the JS client which utilizes a pop-up window, but that ran into errors in the PWA. I'm now using the normal OAuth flow by redirecting the user to Google's OAuth URL.</p> <p>This works fine in the browser. In the standalone PWA on iOS, it opens the OAuth page in a new Safari window. This means that the OAuth flow is carried out in Safari, and at the end the user is left using the app in Safari rather than the standalone PWA.</p> <p>I'm redirecting using this method:</p> <pre><code>export function setHref(newLocation: string) { window.location.href = newLocation; } </code></pre> <p>This even looks to be the method everyone recommends to avoid pop-ups when redirecting in your PWA. Has this changed recently? Or is there another method to carry out redirects/OAuth flows inside a standalone progressive web app?</p>
0debug
static ssize_t mp_user_getxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { char buffer[PATH_MAX]; if (strncmp(name, "user.virtfs.", 12) == 0) { errno = ENOATTR; return -1; } return lgetxattr(rpath(ctx, path, buffer), name, value, size); }
1threat
Using passport-jwt and epilogue, my req.user is empty : <p>My middleware code is:</p> <pre><code>exports.isAuthenticated = (req, res, context) =&gt; { return new Promise((resolve, reject) =&gt; { return passport.authenticate('jwt',{session: false}, (err, user, info) =&gt; { if(err) { res.status(500).send({message: 'Internal Server Error'}) return resolve(context.stop); } if(user) { return resolve(context.continue); } else { res.status(401).send({message: 'Unauthorized'}) return resolve(context.stop) } })(req, res); }); } </code></pre> <p>My epilogue code is:</p> <pre><code>// Data plan REST API const dataplan = epilogue.resource({ model: global.db.DataPlan, endpoints: ['/api/dataplan', '/api/dataplan/:id'] }); dataplan.all.auth(middleware.isAuthenticated) dataplan.use(require('./epilogue/dataplan.js')) </code></pre> <p>And my <code>dataplan.js</code> is:</p> <pre><code>module.exports = { list: { auth: async function (req, res, context) { console.log(req.user) return context.continue }, send: { .... </code></pre> <p>But my <code>req.user</code> is empty in my <code>list.auth</code>. What am I doing wrong?</p>
0debug
void ff_put_h264_qpel16_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16, 1); }
1threat
How can i increase the performance of this function : how can i increase the performance of following function in `phalcon` framework.there are thousands of records in the table. i have trying to make different ways but i am stuck the point. how can i increase the efficiency and reduce the execution time. kindly guide me. thanks following are two methods. kindly review both and give me best tips and techniques. public function currentmonthAction() { $payload = $this->request->getJsonRawBody(); $this->setDB(); $ticketsmodel = new Tickets(); $fromcitycondition = ""; if( isset($payload->city->id) ) { $fromcitycondition = "and fromcity='{$payload->city->id}'"; } try{ $date = new \Datetime($payload->date); $year = $date->format('Y'); $month = $date->format('m'); $month = '08'; $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); /* result for all cities passenger */ $result = array(); // get all cities permutations $tmpcitiesdata = array(); $rawresultset = Tickets::find ( array( 'columns' => 'fromcity,tocity', 'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) ". $fromcitycondition, 'group' => 'fromcity,tocity' )); foreach ($rawresultset as $rawresult) { $tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['fromcity'] = $rawresult->fromcity; $tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['tocity'] = $rawresult->tocity; } //var_dump($rawresultset); // get tickets sold based on cities combinations $total = 0; foreach ($tmpcitiesdata as $tmpcities) { $rawresultset = Tickets::find ( array( 'columns' => 'customer', 'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity'], 'group' => 'customer' )); $totalsoldRaw = count($rawresultset); // get ticket cancellations $rawresultset = Tickets::find ( array( 'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (3) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity'] )); //make sure cancellations are tickets cancellations not booking cancellations foreach($rawresultset as $rawresult) { $resultNumber = Tickets::find("departure='$rawresult->departure' and seatno={$rawresult->seatno} and id < {$rawresult->id} and tickettype = 1" ); if( count($resultNumber) > 0 ){ $totalsoldRaw = $totalsoldRaw-1; } } $total += $totalsoldRaw; array_push($result, array('total' => $totalsoldRaw, 'fromcity' => Cities::findFirstById($tmpcities['fromcity'])->name, 'tocity' => Cities::findFirstById($tmpcities['tocity'])->name)); } //sort result based on counts arsort($result); //cut result to max 6 cities $result = array_slice($result, 0, 6); $this->response->setContentType('application/json') ->setJsonContent( array( 'totaltickets' => $total, "allcities" => $result ) ); $this->response->send(); return; } catch(\PDOException $e) { $this->response->setStatusCode('422','Invalid Payload'); $this->response->setContentType('application/json') ->setJsonContent(array( 'flash' => array( 'class' => 'danger', 'message' => $e->getMessage() ) )); $this->response->send(); return; } }
0debug
static int ogg_build_flac_headers(AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; enum FLACExtradataFormat format; uint8_t *streaminfo; uint8_t *p; if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo)) return -1; oggstream->header_len[0] = 51; oggstream->header[0] = av_mallocz(51); p = oggstream->header[0]; bytestream_put_byte(&p, 0x7F); bytestream_put_buffer(&p, "FLAC", 4); bytestream_put_byte(&p, 1); bytestream_put_byte(&p, 0); bytestream_put_be16(&p, 1); bytestream_put_buffer(&p, "fLaC", 4); bytestream_put_byte(&p, 0x00); bytestream_put_be24(&p, 34); bytestream_put_buffer(&p, streaminfo, FLAC_STREAMINFO_SIZE); oggstream->header_len[1] = 1+3+4+strlen(vendor)+4; oggstream->header[1] = av_mallocz(oggstream->header_len[1]); p = oggstream->header[1]; bytestream_put_byte(&p, 0x84); bytestream_put_be24(&p, oggstream->header_len[1] - 4); bytestream_put_le32(&p, strlen(vendor)); bytestream_put_buffer(&p, vendor, strlen(vendor)); bytestream_put_le32(&p, 0); return 0; }
1threat
Why import duplicates from a module : <p>I am learning tkinter and noticed that people import multiple things sometimes. </p> <pre><code>from tkinter import * from tkinter import ttk </code></pre> <p>I was wondering why people do this for many modules, not just tkinter. I always thought that <code>import *</code> meant that you were importing everything from a module. So why do people import more items?</p>
0debug
C++ Creating a Class : <p>So my project requires me to create a header file that defines the following class and its members/functions:</p> <pre><code>#include &lt;string&gt; using namespace std; class Ticket { public: string mName; string mFromCity; string mToCity; double mCost; Ticket(string name, string fromCity, string toCity, double cost) { string getName(); string getFromCity(); string getToCity(); double getCost(); void setName(string name); void setFromCity(string fromCity); void setToCity(string toCity); void setCost(double cost); } }; </code></pre> <p>The instructions said to copy the member and function names letter for letter but why is it that a bunch of the names for functions and members aren't consistent such as "mName", "name", and just "Name" later on? Furthermore the instructions had the declarations down in the form of "mName : string" (which generates errors) instead of just "string mName" like I did...</p>
0debug
how to create rounded corner hexagon in android : i want create a hexagon with rounded corners in android XML. i don't want java code.i want to set hexagon as a background of text view. please help me. thank you in advance.this vector image currently using <vector android:height="24dp" android:viewportHeight="628.0" android:viewportWidth="726.0" android:width="27dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#00ffffff" android:pathData="m723,314c-60,103.9 -120,207.8 -180,311.8 -120,0 -240,0 -360,0C123,521.8 63,417.9 3,314 63,210.1 123,106.2 183,2.2c120,0 240,0 360,0C603,106.2 663,210.1 723,314Z" android:strokeColor="#008000" android:strokeWidth="25" /> </vector>
0debug
static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, unsigned size) { VirtIOPCIProxy *proxy = opaque; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); uint32_t val = 0; int i; switch (addr) { case VIRTIO_PCI_COMMON_DFSELECT: val = proxy->dfselect; break; case VIRTIO_PCI_COMMON_DF: if (proxy->dfselect <= 1) { val = vdev->host_features >> (32 * proxy->dfselect); } break; case VIRTIO_PCI_COMMON_GFSELECT: val = proxy->gfselect; break; case VIRTIO_PCI_COMMON_GF: if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) { val = proxy->guest_features[proxy->gfselect]; } break; case VIRTIO_PCI_COMMON_MSIX: val = vdev->config_vector; break; case VIRTIO_PCI_COMMON_NUMQ: for (i = 0; i < VIRTIO_QUEUE_MAX; ++i) { if (virtio_queue_get_num(vdev, i)) { val = i + 1; } } break; case VIRTIO_PCI_COMMON_STATUS: val = vdev->status; break; case VIRTIO_PCI_COMMON_CFGGENERATION: val = vdev->generation; break; case VIRTIO_PCI_COMMON_Q_SELECT: val = vdev->queue_sel; break; case VIRTIO_PCI_COMMON_Q_SIZE: val = virtio_queue_get_num(vdev, vdev->queue_sel); break; case VIRTIO_PCI_COMMON_Q_MSIX: val = virtio_queue_vector(vdev, vdev->queue_sel); break; case VIRTIO_PCI_COMMON_Q_ENABLE: val = proxy->vqs[vdev->queue_sel].enabled; break; case VIRTIO_PCI_COMMON_Q_NOFF: val = vdev->queue_sel; break; case VIRTIO_PCI_COMMON_Q_DESCLO: val = proxy->vqs[vdev->queue_sel].desc[0]; break; case VIRTIO_PCI_COMMON_Q_DESCHI: val = proxy->vqs[vdev->queue_sel].desc[1]; break; case VIRTIO_PCI_COMMON_Q_AVAILLO: val = proxy->vqs[vdev->queue_sel].avail[0]; break; case VIRTIO_PCI_COMMON_Q_AVAILHI: val = proxy->vqs[vdev->queue_sel].avail[1]; break; case VIRTIO_PCI_COMMON_Q_USEDLO: val = proxy->vqs[vdev->queue_sel].used[0]; break; case VIRTIO_PCI_COMMON_Q_USEDHI: val = proxy->vqs[vdev->queue_sel].used[1]; break; default: val = 0; } return val; }
1threat
static void test_aio_external_client(void) { int i, j; for (i = 1; i < 3; i++) { EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true }; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, true, event_ready_cb); event_notifier_set(&data.e); for (j = 0; j < i; j++) { aio_disable_external(ctx); } for (j = 0; j < i; j++) { assert(!aio_poll(ctx, false)); assert(event_notifier_test_and_clear(&data.e)); event_notifier_set(&data.e); aio_enable_external(ctx); } assert(aio_poll(ctx, false)); event_notifier_cleanup(&data.e); } }
1threat
make alert dialog in BaseAdapter extended class : I have a MyListadapter java class that it like below: class MyListAdapter extends BaseAdapter implements TextToSpeech.OnInitListener{ now I want to make a confirmation dialogue on each list items like below: btnDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Delete"); alert.setMessage("Are you sure?"); alert.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete new DatabaseHelper(context).deleteEmployee(employees.get(position)); employees.remove(position); notifyDataSetChanged(); } }); but on AlertDialog.Builder alert = new AlertDialog.Builder(this); I have an error that it say: builder (android.content.Context) in Builder cannot be applied to (anonymous android.view.View.OnClickListner) How can I solve this? (I don't have any problem when my class extends from AppCompatActivity)
0debug
static int sigp_set_architecture(S390CPU *cpu, uint32_t param, uint64_t *status_reg) { CPUState *cur_cs; S390CPU *cur_cpu; bool all_stopped = true; CPU_FOREACH(cur_cs) { cur_cpu = S390_CPU(cur_cs); if (cur_cpu == cpu) { continue; } if (s390_cpu_get_state(cur_cpu) != CPU_STATE_STOPPED) { all_stopped = false; } } *status_reg &= 0xffffffff00000000ULL; *status_reg |= (all_stopped ? SIGP_STAT_INVALID_PARAMETER : SIGP_STAT_INCORRECT_STATE); return SIGP_CC_STATUS_STORED; }
1threat
how to convert JSON to structure type data in swift ? : I have an API for my user to login to the database . I am using the following code to send the credentials to the API and if they are valid I am going to get some JSON typed data about the users information . Otherwise I get a string saying that the username or password is wrong . Here is my HTTTP Post request : let url = URL(string: "http://128.199.199.17:3000/api/login")! var request = URLRequest(url: url) request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.httpMethod = "POST" let postString = "email=22222@gmail.com&password=123456" request.httpBody = postString.data(using: .utf8) let task = URLSession.shared.dataTask(with: request) { data, response, error in guard let data = data, error == nil else { print("error=\(String(describing: error))") return } if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 { print("statusCode should be 200, but is \(httpStatus.statusCode)") print("\(String(describing: response))") } let responseString = String(data: data, encoding: .utf8) print("responseString = \(responseString!)") } task.resume() It works fine and I get the following information in the console : { "user_id": 2, "email": "22222@gmail.com", "password": "123456", "user_name": "number 2 name", "full_name": "danial kosarifar", "sex": "male", "height": 0, "weight": 0, "number_of_meal_per_day": 3, "water_amount": 0, "calories": 0, "number_of_hours_to_sleep_per_day": 3, "createdAt": "2017-11-14T17:23:31.000Z", "updatedAt": "2017-11-14T17:25:37.000Z" } I've also created a decodable structure like so : struct User : Decodable { let user_id : Int let email : String let password : String let username : String } my question is instead of decoding the data to string how can I decode them in such way that I can put them in the structure thats I've defined . I am completely new to this topic please bear with me if my question too of much of a beginner . Thanks
0debug
static void encode_picture(MpegEncContext *s, int picture_number) { int mb_x, mb_y, last_gob, pdif = 0; int i; int bits; MpegEncContext best_s, backup_s; UINT8 bit_buf[7][3000]; s->picture_number = picture_number; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->mb_width*2 + 2; s->block_wrap[4]= s->block_wrap[5]= s->mb_width + 2; s->avg_mb_var = 0; s->mc_mb_var = 0; if (s->h263_pred && !s->h263_msmpeg4) ff_set_mpeg4_time(s, s->picture_number); if(s->pict_type != I_TYPE){ for(mb_y=0; mb_y < s->mb_height; mb_y++) { s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; if(s->pict_type==B_TYPE) ff_estimate_b_frame_motion(s, mb_x, mb_y); else ff_estimate_p_frame_motion(s, mb_x, mb_y); } } emms_c(); }else if(s->pict_type == I_TYPE){ memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); } if(s->avg_mb_var < s->mc_mb_var && s->pict_type == P_TYPE){ s->pict_type= I_TYPE; memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); if(s->max_b_frames==0){ s->input_pict_type= I_TYPE; s->input_picture_in_gop_number=0; } } if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) s->f_code= ff_get_best_fcode(s, s->p_mv_table, MB_TYPE_INTER); ff_fix_long_p_mvs(s); if(s->pict_type==B_TYPE){ s->f_code= ff_get_best_fcode(s, s->b_forw_mv_table, MB_TYPE_FORWARD); s->b_code= ff_get_best_fcode(s, s->b_back_mv_table, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_forw_mv_table, s->f_code, MB_TYPE_FORWARD); ff_fix_long_b_mvs(s, s->b_back_mv_table, s->b_code, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_bidir_forw_mv_table, s->f_code, MB_TYPE_BIDIR); ff_fix_long_b_mvs(s, s->b_bidir_back_mv_table, s->b_code, MB_TYPE_BIDIR); } if(s->flags&CODEC_FLAG_PASS2) s->qscale = ff_rate_estimate_qscale_pass2(s); else if (!s->fixed_qscale) s->qscale = ff_rate_estimate_qscale(s); if (s->out_format == FMT_MJPEG) { s->intra_matrix[0] = default_intra_matrix[0]; for(i=1;i<64;i++) s->intra_matrix[i] = (default_intra_matrix[i] * s->qscale) >> 3; convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, 8); } else { convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->qscale); convert_matrix(s->q_non_intra_matrix, s->q_non_intra_matrix16, s->non_intra_matrix, s->qscale); } s->last_bits= get_bit_count(&s->pb); switch(s->out_format) { case FMT_MJPEG: mjpeg_picture_header(s); break; case FMT_H263: if (s->h263_msmpeg4) msmpeg4_encode_picture_header(s, picture_number); else if (s->h263_pred) mpeg4_encode_picture_header(s, picture_number); else if (s->h263_rv10) rv10_encode_picture_header(s, picture_number); else h263_encode_picture_header(s, picture_number); break; case FMT_MPEG1: mpeg1_encode_picture_header(s, picture_number); break; } bits= get_bit_count(&s->pb); s->header_bits= bits - s->last_bits; s->last_bits= bits; s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->p_count=0; s->skip_count=0; s->last_dc[0] = 128; s->last_dc[1] = 128; s->last_dc[2] = 128; s->mb_incr = 1; s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4) { if (s->height <= 400) s->gob_index = 1; else if (s->height <= 800) s->gob_index = 2; else s->gob_index = 4; } s->avg_mb_var = s->avg_mb_var / s->mb_num; for(mb_y=0; mb_y < s->mb_height; mb_y++) { if (s->rtp_mode) { if (!mb_y) { s->ptr_lastgob = s->pb.buf; s->ptr_last_mb_line = s->pb.buf; } else if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4 && !(mb_y % s->gob_index)) { last_gob = h263_encode_gob_header(s, mb_y); if (last_gob) { s->first_gob_line = 1; } } } s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); s->block_index[4]= s->block_wrap[4]*(mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2); s->block_index[5]= s->block_wrap[4]*(mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { const int mb_type= s->mb_type[mb_y * s->mb_width + mb_x]; const int xy= (mb_y+1) * (s->mb_width+2) + mb_x + 1; PutBitContext pb; int d; int dmin=10000000; int best=0; s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; s->block_index[4]++; s->block_index[5]++; if(mb_type & (mb_type-1)){ int next_block=0; pb= s->pb; copy_context_before_encode(&backup_s, s, -1); if(mb_type&MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[1], 3000, NULL, NULL); s->block= s->blocks[next_block]; s->last_bits= 0; encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER); best=1; next_block^=1; } } if(mb_type&MB_TYPE_INTER4V){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTER4V); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->motion_val[s->block_index[i]][0]; s->mv[0][i][1] = s->motion_val[s->block_index[i]][1]; } init_put_bits(&s->pb, bit_buf[2], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER4V); best=2; next_block^=1; } } if(mb_type&MB_TYPE_FORWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_FORWARD); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[3], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_FORWARD); best=3; next_block^=1; } } if(mb_type&MB_TYPE_BACKWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_BACKWARD); s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[4], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[1][0][0], s->mv[1][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BACKWARD); best=4; next_block^=1; } } if(mb_type&MB_TYPE_BIDIR){ copy_context_before_encode(s, &backup_s, MB_TYPE_BIDIR); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[5], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BIDIR); best=5; next_block^=1; } } if(mb_type&MB_TYPE_DIRECT){ copy_context_before_encode(s, &backup_s, MB_TYPE_DIRECT); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[6], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->b_direct_mv_table[xy][0], s->b_direct_mv_table[xy][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_DIRECT); best=6; next_block^=1; } } if(mb_type&MB_TYPE_INTRA){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTRA); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; init_put_bits(&s->pb, bit_buf[0], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTRA); best=0; next_block^=1; } if(s->h263_pred || s->h263_aic) s->mbintra_table[mb_x + mb_y*s->mb_width]=1; } copy_context_after_encode(s, &best_s, -1); copy_bits(&pb, bit_buf[best], dmin); s->pb= pb; s->last_bits= get_bit_count(&s->pb); } else { int motion_x, motion_y; s->mv_type=MV_TYPE_16X16; switch(mb_type){ case MB_TYPE_INTRA: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case MB_TYPE_DIRECT: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; break; case MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; motion_x=0; motion_y=0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; break; default: motion_x=motion_y=0; printf("illegal MB type\n"); } encode_mb(s, motion_x, motion_y); } if(s->mb_intra ){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } MPV_decode_mb(s, s->block); } if (s->rtp_mode) { if (!mb_y) s->mb_line_avgsize = pbBufPtr(&s->pb) - s->ptr_last_mb_line; else if (!(mb_y % s->gob_index)) { s->mb_line_avgsize = (s->mb_line_avgsize + pbBufPtr(&s->pb) - s->ptr_last_mb_line) >> 1; s->ptr_last_mb_line = pbBufPtr(&s->pb); } s->first_gob_line = 0; } } emms_c(); if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type == I_TYPE) msmpeg4_encode_ext_header(s); if (s->rtp_mode) { flush_put_bits(&s->pb); pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; if (s->rtp_callback) s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); s->ptr_lastgob = pbBufPtr(&s->pb); } }
1threat
preq_replace href value only if there string x is not found in it : i have a problem with the following situation i want to replace the href value with preg_replace and dont know how i got 3 types of links 1:<a href="http://www.something.com"></a> 2:<a href="smartlink:webview-something"></a> 3:<a href="link/to/something"></a> i want to add the domain on link 3 (http://www.something.com/link/to/something) but 1 and 2 should stay untouched. how can i do that? kind regards martin
0debug
static inline bool check_lba_range(SCSIDiskState *s, uint64_t sector_num, uint32_t nb_sectors) { return (sector_num <= sector_num + nb_sectors && sector_num + nb_sectors - 1 <= s->qdev.max_lba); }
1threat
Golang Insert NULL into sql instead of empty string : <p>I'm trying to insert data into a mysql database using golang. In the case where my value takes on an empty string, I would want to insert a null. How can I adjust the following to insert nulls instead of empty string? Thanks.</p> <pre><code>_, err := m.Db.Exec(`INSERT INTO visitor_events (type, info, url_path, visitor_id, created_at, domain) VALUES (?, ?, ?, ?, ?, ?)`, m.SaveEventType(ve), ve.EventInfo, m.SaveURLPath(ve.UrlPath), ve.VisitorId, time.Now().UTC(), ve.Domain) </code></pre>
0debug
Draw horizontal rule in React Native : <p>I've tried <a href="https://github.com/Riglerr/react-native-hr" rel="noreferrer">react-native-hr</a> package - doesn't work for me nor on Android nor on iOS.</p> <p>Following code is also not suitable because it renders three dots at the end</p> <pre><code>&lt;Text numberOfLines={1}}&gt; ______________________________________________________________ &lt;/Text&gt; </code></pre>
0debug
Using responders gem with Rails 5 : <p>I'm using <a href="https://github.com/plataformatec/responders" rel="noreferrer"><strong>responders gem</strong></a> to dry up my controllers. Here's my current code: </p> <pre><code>class OfficehoursController &lt; ApplicationController def new @officehour = Officehour.new end def create @officehour = Officehour.create(officehour_params) respond_with(@officehour, location: officehours_path) end def officehour_params params.require(:officehour).permit(:end, :start, :status) end end </code></pre> <p>The problem that I'm facing right now is:</p> <p>When I send valid parameters to <code>create</code>, it redirects to <code>officehours/</code> as expected, however when I get 422 (validation error), it changes the URL from <code>officehours/new</code> to <code>officehours/</code> (however it stays at the form page... idk why). The same happens for edit/update actions.</p> <p>So, I want to stay at the <code>.../new</code> or <code>.../edit</code> when I get 422 error, how can I do this?</p>
0debug
static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hLumFilter, int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if(srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { RENAME(yuy2ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE) { RENAME(uyvyToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToY)(formatConvBuffer, src, srcW, pal); src= formatConvBuffer; } #ifdef HAVE_MMX if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if(!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if(canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %5 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE #if defined(PIC) "mov %5, %%"REG_b" \n\t" #endif :: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyYCode) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; } else { #endif long xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 2(%%"REG_D", %%"REG_a", 2)\n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $2, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for(i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; xpos+=xInc; } #endif } }
1threat
static inline int get_phys_addr(CPUARMState *env, uint32_t address, int access_type, int is_user, hwaddr *phys_ptr, int *prot, target_ulong *page_size) { if (address < 0x02000000) address += env->cp15.c13_fcse; if ((env->cp15.c1_sys & 1) == 0) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } else if (arm_feature(env, ARM_FEATURE_MPU)) { *page_size = TARGET_PAGE_SIZE; return get_phys_addr_mpu(env, address, access_type, is_user, phys_ptr, prot); } else if (extended_addresses_enabled(env)) { return get_phys_addr_lpae(env, address, access_type, is_user, phys_ptr, prot, page_size); } else if (env->cp15.c1_sys & (1 << 23)) { return get_phys_addr_v6(env, address, access_type, is_user, phys_ptr, prot, page_size); } else { return get_phys_addr_v5(env, address, access_type, is_user, phys_ptr, prot, page_size); } }
1threat
android networking in background while app is closed from recent apps : I want to fetch and send some data when the app is closed, I've already made foreground service but don't know where to use retrofit to that it can run. I also saw a tutorial to make a foreground app, I'm able to make the app which runs a piece of code in background, but how to perform networking. [code of foreground app][1] [1]: https://i.stack.imgur.com/n4Lmn.png
0debug
How to clear all items in a listbox when we change our selection in a dropdownlistbox? : I have a Listbox named listbox1 ,a show button and a dropdownlist box in my aspx page. *dropdownlistbox lists grouptypes. *show button on click will fetch data based on grouptype from DB and populate in Listbox1. *But if i change my selection of grouptype the items in listbox remains the same of earlier selection.I want to clear the items upon change in selection in dropdownlistbox before clicking the show button. Someone help me out.
0debug
Android call phone number side menu : <p>I'm busy making my first android app and i'm looking to create the following option: Whenn someone clicks on "Contact us" from "activit_main_drawer.xml" they will directly call "phone number"</p> <p>Is there anyone who can help me? :)</p> <p>This is how the "Button" is called </p> <pre><code> &lt;item android:id="@+id/nav_belnu" android:icon="@drawable/ic_phone_square_solid" android:title="BEL nu" /&gt; </code></pre>
0debug
Install Xdebug for PHP 5.6 on OSX with Homebrew : <p>The homebrew/php tap was <a href="https://github.com/Homebrew/homebrew-php/issues/4721" rel="noreferrer">recently deprecated</a>. This deprecation included versioned formulae for php installations (e.g., <code>php56</code>) as well as installation of individual extensions (e.g., <code>php56-xdebug</code>).</p> <p>Installing PHP 5.6 with Homebrew now requires the command: <code>brew install php@5.6</code>.</p> <p>Installing PHP 5.6 and then running <code>phpinfo()</code> indicates that Xdebug is not loaded in the list of extensions, and a debugger extension is not found. A selective copy of the output is as follows:</p> <pre><code>$ /usr/local/Cellar/php\@5.6/5.6.35/bin/php -r "phpinfo();" PHP Version =&gt; 5.6.35 System =&gt; Darwin [my hostname] 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64 Build Date =&gt; Mar 31 2018 20:19:57 Configure Command =&gt; './configure' '--prefix=/usr/local/Cellar/php@5.6/5.6.35' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.6' '--with-config-file-path=/usr/local/etc/php/5.6' '--with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-apxs2=/usr/local/opt/httpd/bin/apxs' '--with-bz2' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/opt/gmp' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos' '--with-layout=GNU' '--with-ldap' '--with-ldap-sasl' '--with-libedit' '--with-libzip' '--with-mhash' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd' '--with-mcrypt=/usr/local/opt/mcrypt' '--with-ndbm' '--with-openssl=/usr/local/opt/openssl' '--with-pdo-dblib=/usr/local/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-pdo-pgsql=/usr/local/opt/libpq' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' '--with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp' '--with-xmlrpc' '--with-xsl' '--with-zlib' '--with-curl' 'CC=clang' 'CPPFLAGS=-DU_USING_ICU_NAMESPACE=1' 'CXX=clang++' Server API =&gt; Command Line Interface Virtual Directory Support =&gt; disabled Configuration File (php.ini) Path =&gt; /usr/local/etc/php/5.6 Loaded Configuration File =&gt; /usr/local/etc/php/5.6/php.ini Scan this dir for additional .ini files =&gt; /usr/local/etc/php/5.6/conf.d Additional .ini files parsed =&gt; /usr/local/etc/php/5.6/conf.d/ext-opcache.ini ... ... </code></pre> <p>Running <code>brew options php</code> and <code>brew options php@5.6</code> yield no information on options to install additional extensions in the homebrew installation process. <code>brew search xdebug</code> yields no packages of interest.</p> <p>As far as I can tell, Xdebug is not installed by default, and there is currently no mechanism to install Xdebug using homebrew with this new generic <code>php</code> formula.</p> <p>Does anybody know how to go about installing Xdebug in a sensible way now that the original <code>homebrew/php</code> tap has been deprecated?</p>
0debug
static void xilinx_spips_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { int mask = ~0; int man_start_com = 0; XilinxSPIPS *s = opaque; DB_PRINT("addr=" TARGET_FMT_plx " = %x\n", addr, (unsigned)value); addr >>= 2; switch (addr) { case R_CONFIG: mask = 0x0002FFFF; if (value & MAN_START_COM) { man_start_com = 1; } break; case R_INTR_STATUS: mask = IXR_ALL; s->regs[R_INTR_STATUS] &= ~(mask & value); goto no_reg_update; case R_INTR_DIS: mask = IXR_ALL; s->regs[R_INTR_MASK] &= ~(mask & value); goto no_reg_update; case R_INTR_EN: mask = IXR_ALL; s->regs[R_INTR_MASK] |= mask & value; goto no_reg_update; case R_EN: mask = 0x1; break; case R_SLAVE_IDLE_COUNT: mask = 0xFF; break; case R_RX_DATA: case R_INTR_MASK: case R_MOD_ID: mask = 0; break; case R_TX_DATA: tx_data_bytes(s, (uint32_t)value, s->num_txrx_bytes); goto no_reg_update; case R_TXD1: tx_data_bytes(s, (uint32_t)value, 1); goto no_reg_update; case R_TXD2: tx_data_bytes(s, (uint32_t)value, 2); goto no_reg_update; case R_TXD3: tx_data_bytes(s, (uint32_t)value, 3); goto no_reg_update; } s->regs[addr] = (s->regs[addr] & ~mask) | (value & mask); no_reg_update: xilinx_spips_update_cs_lines(s); if ((man_start_com && s->regs[R_CONFIG] & MAN_START_EN) || (fifo8_is_empty(&s->tx_fifo) && s->regs[R_CONFIG] & MAN_START_EN)) { xilinx_spips_flush_txfifo(s); } xilinx_spips_update_cs_lines(s); xilinx_spips_update_ixr(s); }
1threat
ng-bootstrap modal animation : <p>The fade class doesn't appear to work on the ngb-modal.</p> <p>I've looked at trying to apply my own animation to the modal but the modal template is obviously injected into modal dialogue by ng-bootstrap e.g. I don't have access to the modal dialogue. I only have access to the template:</p> <pre><code>&lt;template #content let-c="close" let-d="dismiss"&gt; &lt;div class="modal-header card-header" style="border-radius: 10px;"&gt; &lt;h4 class="modal-title"&gt;Contact Form&lt;/h4&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;/div&gt; ...etc &lt;/template&gt; </code></pre> <p>I need to apply my animation to the top level dialogue otherwise just bits of the modal animate. If I apply it to the template it blows up.</p> <p>Any idea how I would animate the whole modal??</p>
0debug
Using python generate randon names and address to csv format : <p>Using python how do i generate randon names in the format of random email, first name , last name, address, city, state, zip, country(USA only)</p>
0debug
static void draw_axis_yuv(AVFrame *out, AVFrame *axis, const ColorFloat *c, int off) { int fmt = out->format, x, y, yh, w = axis->width, h = axis->height; int offh = (fmt == AV_PIX_FMT_YUV420P) ? off / 2 : off; float a, rcp_255 = 1.0f / 255.0f; uint8_t *vy = out->data[0], *vu = out->data[1], *vv = out->data[2]; uint8_t *vay = axis->data[0], *vau = axis->data[1], *vav = axis->data[2], *vaa = axis->data[3]; int lsy = out->linesize[0], lsu = out->linesize[1], lsv = out->linesize[2]; int lsay = axis->linesize[0], lsau = axis->linesize[1], lsav = axis->linesize[2], lsaa = axis->linesize[3]; uint8_t *lpy, *lpu, *lpv, *lpay, *lpau, *lpav, *lpaa; for (y = 0; y < h; y += 2) { yh = (fmt == AV_PIX_FMT_YUV420P) ? y / 2 : y; lpy = vy + (off + y) * lsy; lpu = vu + (offh + yh) * lsu; lpv = vv + (offh + yh) * lsv; lpay = vay + y * lsay; lpau = vau + yh * lsau; lpav = vav + yh * lsav; lpaa = vaa + y * lsaa; for (x = 0; x < w; x += 2) { a = rcp_255 * (*lpaa++); *lpy++ = a * (*lpay++) + (1.0f - a) * c[x].yuv.y + 0.5f; *lpu++ = a * (*lpau++) + (1.0f - a) * c[x].yuv.u + 0.5f; *lpv++ = a * (*lpav++) + (1.0f - a) * c[x].yuv.v + 0.5f; a = rcp_255 * (*lpaa++); *lpy++ = a * (*lpay++) + (1.0f - a) * c[x+1].yuv.y + 0.5f; if (fmt == AV_PIX_FMT_YUV444P) { *lpu++ = a * (*lpau++) + (1.0f - a) * c[x+1].yuv.u + 0.5f; *lpv++ = a * (*lpav++) + (1.0f - a) * c[x+1].yuv.v + 0.5f; } } lpy = vy + (off + y + 1) * lsy; lpu = vu + (off + y + 1) * lsu; lpv = vv + (off + y + 1) * lsv; lpay = vay + (y + 1) * lsay; lpau = vau + (y + 1) * lsau; lpav = vav + (y + 1) * lsav; lpaa = vaa + (y + 1) * lsaa; for (x = 0; x < out->width; x += 2) { a = rcp_255 * (*lpaa++); *lpy++ = a * (*lpay++) + (1.0f - a) * c[x].yuv.y + 0.5f; if (fmt != AV_PIX_FMT_YUV420P) { *lpu++ = a * (*lpau++) + (1.0f - a) * c[x].yuv.u + 0.5f; *lpv++ = a * (*lpav++) + (1.0f - a) * c[x].yuv.v + 0.5f; } a = rcp_255 * (*lpaa++); *lpy++ = a * (*lpay++) + (1.0f - a) * c[x+1].yuv.y + 0.5f; if (fmt == AV_PIX_FMT_YUV444P) { *lpu++ = a * (*lpau++) + (1.0f - a) * c[x+1].yuv.u + 0.5f; *lpv++ = a * (*lpav++) + (1.0f - a) * c[x+1].yuv.v + 0.5f; } } } }
1threat
How to use group by without using aggreagation function : I am trying to find the row number of the price while grouping them with respect to their ProductId. For Product Id = 1 Rank of Price(where price =1000 ) should be smt. For productId 3 rank of price (=1000) should be sth. Q1- How can I find row number of price for different productId in same table? Q2- How can I achieve this using group by without aggregation for Row_number. ProductId Price 1 2000 1 1600 1 1000 2 2200 2 1000 2 3250 3 1000 3 2500 3 1750 So result should be ProductId Price PriceRank 1 1000 3 2 1000 2 3 1000 1 here u can see my code SELECT ProductId,ROW_NUMBER() OVER (ORDER BY price ASC) AS PriceRank FROM product WHERE price =1000 group by ProductId
0debug
static int apply_window_and_mdct(vorbis_enc_context *venc, float **audio, int samples) { int channel; const float * win = venc->win[0]; int window_len = 1 << (venc->log2_blocksize[0] - 1); float n = (float)(1 << venc->log2_blocksize[0]) / 4.0; AVFloatDSPContext *fdsp = venc->fdsp; if (!venc->have_saved && !samples) return 0; if (venc->have_saved) { for (channel = 0; channel < venc->channels; channel++) memcpy(venc->samples + channel * window_len * 2, venc->saved + channel * window_len, sizeof(float) * window_len); } else { for (channel = 0; channel < venc->channels; channel++) memset(venc->samples + channel * window_len * 2, 0, sizeof(float) * window_len); } if (samples) { for (channel = 0; channel < venc->channels; channel++) { float *offset = venc->samples + channel * window_len * 2 + window_len; fdsp->vector_fmul_reverse(offset, audio[channel], win, samples); fdsp->vector_fmul_scalar(offset, offset, 1/n, samples); } } else { for (channel = 0; channel < venc->channels; channel++) memset(venc->samples + channel * window_len * 2 + window_len, 0, sizeof(float) * window_len); } for (channel = 0; channel < venc->channels; channel++) venc->mdct[0].mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len, venc->samples + channel * window_len * 2); if (samples) { for (channel = 0; channel < venc->channels; channel++) { float *offset = venc->saved + channel * window_len; fdsp->vector_fmul(offset, audio[channel], win, samples); fdsp->vector_fmul_scalar(offset, offset, 1/n, samples); } venc->have_saved = 1; } else { venc->have_saved = 0; } return 1; }
1threat
Can I record video with CameraX (Android Jetpack)? : <p>Google has released the new CameraX library as part of Jetpack. It looks great for taking pictures, but my use case also require making video's. I tried googling for that, but couldn't find anything. </p> <p>So, is it possible to record videos with the CameraX Jetpack library?</p>
0debug
detect pdf file in folder and also check if it is open : I need codes for below. as i try to find in this website, but nothing match my need. so please if anybody write some codes. 1- it should search file in folder and file name should be taken from cell whatever file name i type for search and if it is open it should warn me that file is open."file will be in pdf format". 2- File shall not be duplicate if it find duplicate it shall show me warning REPLACE or NO. 3- if it is not duplicate than save as pdf taking whatever name i write in cells and there will 2 different cells.
0debug
In Htpp url openConnection() show error plz help any body : btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new JsonParse().execute("http://jsonparsing.parseapp.com/jsonData/moviesDemoItems.txt");}});} public class JsonParse extends AsyncTask<String,String,String> @Override protected String doInBackground(String... params) { HttpURLConnection connection = null; BufferedReader reader = null; try { URI url = new URI(params[0]); connection = (HttpURLConnection) url.openConnection(); connection.connect(); InputStream stream = connection.getInputStream(); reader = new BufferedReader(new InputStreamReader(stream)); StringBuffer stringBuffer = new StringBuffer(); String linge = ""; while ((linge = reader.readLine()) != null) { stringBuffer.append(linge);} return stringBuffer.toString(); `} catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally {if (connection != null){connection.disconnect();try { if (reader != null) { reader.close();}} catch (IOException e) {e.printStackTrace(); }}return null } @Override protected void onPostExecute(String result{super.onPostExecute(result); tv.setText(result);} }}
0debug
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, mb_x, mb_y, i, y, referenced; enum AVDiscard skip_thresh; AVFrame *curframe; if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) return ret; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; goto skip_decode; } for (i = 0; i < 4; i++) if (&s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (curframe->data[0]) avctx->release_buffer(avctx, curframe); curframe->key_frame = s->keyframe; curframe->pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE; curframe->reference = referenced ? 3 : 0; if ((ret = avctx->get_buffer(avctx, curframe))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); return ret; } if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); return AVERROR_INVALIDDATA; } s->linesize = curframe->linesize[0]; s->uvlinesize = curframe->linesize[1]; if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(21*s->linesize); memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { memset(curframe->data[0] - s->linesize -1, 127, s->linesize +1); memset(curframe->data[1] - s->uvlinesize-1, 127, s->uvlinesize+1); memset(curframe->data[2] - s->uvlinesize-1, 127, s->uvlinesize+1); } for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + mb_y*s->mb_stride; uint8_t *intra4x4 = s->intra4x4_pred_mode + 4*mb_y*s->b4_stride; uint8_t *dst[3] = { curframe->data[0] + 16*mb_y*s->linesize, curframe->data[1] + 8*mb_y*s->uvlinesize, curframe->data[2] + 8*mb_y*s->uvlinesize }; memset(s->left_nnz, 0, sizeof(s->left_nnz)); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) for (i = 0; i < 3; i++) for (y = 0; y < 16>>!!i; y++) dst[i][y*curframe->linesize[i]-1] = 129; for (mb_x = 0; mb_x < s->mb_width; mb_x++) { decode_mb_mode(s, mb, mb_x, mb_y, intra4x4 + 4*mb_x); if (!mb->skip) decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz); else { AV_ZERO128(s->non_zero_count_cache); AV_ZERO64(s->non_zero_count_cache[4]); } if (mb->mode <= MODE_I4x4) { intra_predict(s, dst, mb, intra4x4 + 4*mb_x, mb_x, mb_y); memset(mb->bmv, 0, sizeof(mb->bmv)); } else { inter_predict(s, dst, mb, mb_x, mb_y); } if (!mb->skip) { idct_mb(s, dst[0], dst[1], dst[2], mb); } else { AV_ZERO64(s->left_nnz); AV_WN64(s->top_nnz[mb_x], 0); if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { s->left_nnz[8] = 0; s->top_nnz[mb_x][8] = 0; } } dst[0] += 16; dst[1] += 8; dst[2] += 8; mb++; } if (mb_y && s->filter.level && avctx->skip_loop_filter < skip_thresh) { if (s->filter.simple) filter_mb_row_simple(s, mb_y-1); else filter_mb_row(s, mb_y-1); } } if (s->filter.level && avctx->skip_loop_filter < skip_thresh) { if (s->filter.simple) filter_mb_row_simple(s, mb_y-1); else filter_mb_row(s, mb_y-1); } skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (s->update_altref == VP56_FRAME_GOLDEN && s->update_golden == VP56_FRAME_GOLDEN2) FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN], s->framep[VP56_FRAME_GOLDEN2]); else { if (s->update_altref != VP56_FRAME_NONE) s->framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; if (s->update_golden != VP56_FRAME_NONE) s->framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; } if (s->update_last) s->framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_CURRENT]; for (i = 0; i < 4; i++) if (s->frames[i].data[0] && &s->frames[i] != s->framep[VP56_FRAME_CURRENT] && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) avctx->release_buffer(avctx, &s->frames[i]); if (!s->invisible) { *(AVFrame*)data = *s->framep[VP56_FRAME_CURRENT]; *data_size = sizeof(AVFrame); } return avpkt->size; }
1threat
static gboolean ga_channel_listen_accept(GIOChannel *channel, GIOCondition condition, gpointer data) { GAChannel *c = data; int ret, client_fd; bool accepted = false; struct sockaddr_un addr; socklen_t addrlen = sizeof(addr); g_assert(channel != NULL); client_fd = qemu_accept(g_io_channel_unix_get_fd(channel), (struct sockaddr *)&addr, &addrlen); if (client_fd == -1) { g_warning("error converting fd to gsocket: %s", strerror(errno)); goto out; } fcntl(client_fd, F_SETFL, O_NONBLOCK); ret = ga_channel_client_add(c, client_fd); if (ret) { g_warning("error setting up connection"); goto out; } accepted = true; out: return !accepted; }
1threat
When should we use return methods and when should we use void methods in java : <p>I still don't understand when should we use return methods and when should we use void methods? What's the purpose of one and another? I get the syntax difference I just can't understand the purpose of using one instead of another?</p>
0debug
Can someone please explain this for-each loop in java : <p>My Java Code is given below</p> <pre><code>public class ForEachExample { public static void main(String[] args) { int arr[]={1,2,3,4,5}; for(int i:arr){ System.out.println(i); } } } </code></pre> <p>in this code <code>for(int i:arr)</code> in totally new for me. Can anyone explain me this line and how it's work.</p> <pre><code>Output: </code></pre> <p>1 2 3 4 5</p>
0debug
qemu_irq *mpic_init (MemoryRegion *address_space, hwaddr base, int nb_cpus, qemu_irq **irqs, qemu_irq irq_out) { OpenPICState *mpp; int i; struct { const char *name; MemoryRegionOps const *ops; hwaddr start_addr; ram_addr_t size; } const list[] = { {"glb", &openpic_glb_ops_be, MPIC_GLB_REG_START, MPIC_GLB_REG_SIZE}, {"tmr", &openpic_tmr_ops_be, MPIC_TMR_REG_START, MPIC_TMR_REG_SIZE}, {"src", &openpic_src_ops_be, MPIC_SRC_REG_START, MPIC_SRC_REG_SIZE}, {"cpu", &openpic_cpu_ops_be, MPIC_CPU_REG_START, MPIC_CPU_REG_SIZE}, }; mpp = g_malloc0(sizeof(OpenPICState)); memory_region_init(&mpp->mem, "mpic", 0x40000); memory_region_add_subregion(address_space, base, &mpp->mem); for (i = 0; i < sizeof(list)/sizeof(list[0]); i++) { memory_region_init_io(&mpp->sub_io_mem[i], list[i].ops, mpp, list[i].name, list[i].size); memory_region_add_subregion(&mpp->mem, list[i].start_addr, &mpp->sub_io_mem[i]); } mpp->nb_cpus = nb_cpus; mpp->nb_irqs = 80; mpp->vid = VID_REVISION_1_2; mpp->veni = VENI_GENERIC; mpp->spve_mask = 0xFFFF; mpp->tifr_reset = 0x00000000; mpp->ipvp_reset = 0x80000000; mpp->ide_reset = 0x00000001; mpp->max_irq = MPIC_MAX_IRQ; mpp->irq_ipi0 = MPIC_IPI_IRQ; mpp->irq_tim0 = MPIC_TMR_IRQ; for (i = 0; i < nb_cpus; i++) mpp->dst[i].irqs = irqs[i]; mpp->irq_out = irq_out; mpp->flags |= OPENPIC_FLAG_IDE_CRIT; register_savevm(NULL, "mpic", 0, 2, openpic_save, openpic_load, mpp); qemu_register_reset(openpic_reset, mpp); return qemu_allocate_irqs(openpic_set_irq, mpp, mpp->max_irq); }
1threat
static void cuda_receive_packet(CUDAState *s, const uint8_t *data, int len) { uint8_t obuf[16]; int ti, autopoll; switch(data[0]) { case CUDA_AUTOPOLL: autopoll = (data[1] != 0); if (autopoll != s->autopoll) { s->autopoll = autopoll; if (autopoll) { qemu_mod_timer(s->adb_poll_timer, qemu_get_clock(vm_clock) + (ticks_per_sec / CUDA_ADB_POLL_FREQ)); } else { qemu_del_timer(s->adb_poll_timer); } } obuf[0] = CUDA_PACKET; obuf[1] = data[1]; cuda_send_packet_to_host(s, obuf, 2); break; case CUDA_GET_TIME: case CUDA_SET_TIME: ti = time(NULL) + RTC_OFFSET; obuf[0] = CUDA_PACKET; obuf[1] = 0; obuf[2] = 0; obuf[3] = ti >> 24; obuf[4] = ti >> 16; obuf[5] = ti >> 8; obuf[6] = ti; cuda_send_packet_to_host(s, obuf, 7); break; case CUDA_FILE_SERVER_FLAG: case CUDA_SET_DEVICE_LIST: case CUDA_SET_AUTO_RATE: case CUDA_SET_POWER_MESSAGES: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); break; case CUDA_POWERDOWN: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); qemu_system_shutdown_request(); break; case CUDA_RESET_SYSTEM: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); qemu_system_reset_request(); break; default: break; } }
1threat
static BlockJob *test_block_job_start(unsigned int iterations, bool use_timer, int rc, int *result) { BlockDriverState *bs; TestBlockJob *s; TestBlockJobCBData *data; data = g_new0(TestBlockJobCBData, 1); bs = bdrv_new(); s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb, data, &error_abort); s->iterations = iterations; s->use_timer = use_timer; s->rc = rc; s->result = result; s->common.co = qemu_coroutine_create(test_block_job_run); data->job = s; data->result = result; qemu_coroutine_enter(s->common.co, s); return &s->common; }
1threat
What is the issue with this code(It shows error on abs value return)? Any help will be appreciated . : def distance_from_zero(n): if type(n) == int or type(n) == float: return abs else: return Nope
0debug
Broadcast Receiver is called everytime : Don't downvote it.. If you think question needs clarification then comment the issue. I want to update my sqlite table at midnight so calling broadcast receiver to hit at midnight automatically i.e. without launching the app. But it is updating **every time when I launch the app.** Code:- calling the function in the mainActivity.java in onCreate() private void setTheTimeToUpdateTables(Context context) { Log.i("Update table function","Yes"); AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE); Intent alarmIntent=new Intent(context,UpdateTables.class); PendingIntent pendingIntent=PendingIntent.getBroadcast(context,0,alarmIntent,PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pendingIntent); Calendar alarmStartTime = Calendar.getInstance(); alarmStartTime.setTimeInMillis(System.currentTimeMillis()); alarmStartTime.set(Calendar.HOUR_OF_DAY, 0); alarmStartTime.set(Calendar.MINUTE, 1); alarmStartTime.set(Calendar.SECOND, 0); System.out.println("Updating table time "+alarmStartTime); System.out.println("Time in millseconds "+alarmStartTime.getTimeInMillis()); alarmManager.setInexactRepeating(AlarmManager.RTC,alarmStartTime.getTimeInMillis(),AlarmManager.INTERVAL_DAY,pendingIntent); Log.d("Alarm","Set for midnight"); } public class UpdateTables extends BroadcastReceiver { DbHelper dbHelper; ArrayList<ListMedicine> reminderInfo; @Override public void onReceive(Context context, Intent intent) { dbHelper=new DbHelper(context); Log.i("Service Start", CalculateDaysService.TAG); context.startService(new Intent(context,CalculateDaysService.class)); Log.i("Done","Yes"); } } Issue:- 1. This broadcast receiver is called everytime whenever I am launching the app. 2. It is not called at the midnight.
0debug
Listing objects by date in python 3 : So, i have a list of objects, it looks like this: ID Date 1 15/11/2009 2 11/06/2010 3 11/09/2015 4 12/08/2013 5 09/08/2011 6 11/10/2012 7 11/10/2014 Now, I want to sort that list of objects by its date. I have tried `sorted(list,key=lambda x: datetime.datetime.strptime(x, '%m-%Y'))`, tried `list.sort()`, tried all kind of different things, but it simply doesnt sort. Can somebody help me?
0debug
how can I make the duplicate record to be RECORDED AS ONE and the QUANTITY will get the total as 3 based on the picture below : [enter image description here[1] [1]: https://i.stack.imgur.com/Hj5Uu.png // <?php $id=$_GET['invoice']; include('connect.php'); $result = $db->prepare("SELECT * FROM sales_order WHERE invoice= :userid"); $result->bindParam(':userid', $id); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ ?> // this is the code
0debug
What is not file in Linux : <p>When I first learned Linux, I was told <strong>almost</strong> everything in Linux is file. This morning, when I repeated it to my girlfriend. She asked what is not? I tried to find an example for half a day.</p> <p>So my question is what is not file in Linux?</p>
0debug
static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { long idx = 15 - src_size; uint8_t *s = (uint8_t *) src-idx, *d = dst-idx; #ifdef HAVE_MMX __asm __volatile( "test %0, %0 \n\t" "jns 2f \n\t" PREFETCH" (%1, %0) \n\t" "movq %3, %%mm7 \n\t" "pxor %4, %%mm7 \n\t" "movq %%mm7, %%mm6 \n\t" "pxor %5, %%mm7 \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1, %0) \n\t" "movq (%1, %0), %%mm0 \n\t" "movq 8(%1, %0), %%mm1 \n\t" # ifdef HAVE_MMX2 "pshufw $177, %%mm0, %%mm3 \n\t" "pshufw $177, %%mm1, %%mm5 \n\t" "pand %%mm7, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pand %%mm7, %%mm1 \n\t" "pand %%mm6, %%mm5 \n\t" "por %%mm3, %%mm0 \n\t" "por %%mm5, %%mm1 \n\t" # else "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm4 \n\t" "pand %%mm7, %%mm0 \n\t" "pand %%mm6, %%mm2 \n\t" "pand %%mm7, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "pslld $16, %%mm2 \n\t" "psrld $16, %%mm3 \n\t" "pslld $16, %%mm4 \n\t" "psrld $16, %%mm5 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm4, %%mm1 \n\t" "por %%mm3, %%mm0 \n\t" "por %%mm5, %%mm1 \n\t" # endif MOVNTQ" %%mm0, (%2, %0) \n\t" MOVNTQ" %%mm1, 8(%2, %0) \n\t" "add $16, %0 \n\t" "js 1b \n\t" SFENCE" \n\t" EMMS" \n\t" "2: \n\t" : "+&r"(idx) : "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one) : "memory"); #endif for (; idx<15; idx+=4) { register int v = *(uint32_t *)&s[idx], g = v & 0xff00ff00; v &= 0xff00ff; *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16); } }
1threat
int css_do_csch(SubchDev *sch) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { ret = -ENODEV; goto out; } s->ctrl &= ~(SCSW_CTRL_MASK_FCTL | SCSW_CTRL_MASK_ACTL); s->ctrl |= SCSW_FCTL_CLEAR_FUNC | SCSW_ACTL_CLEAR_PEND; do_subchannel_work(sch, NULL); ret = 0; out: return ret; }
1threat
static int cinepak_decode_init(AVCodecContext *avctx) { CinepakContext *s = avctx->priv_data; s->avctx = avctx; s->width = (avctx->width + 3) & ~3; s->height = (avctx->height + 3) & ~3; s->sega_film_skip_bytes = -1; if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) { s->palette_video = 0; avctx->pix_fmt = PIX_FMT_YUV420P; } else { s->palette_video = 1; avctx->pix_fmt = PIX_FMT_PAL8; } dsputil_init(&s->dsp, avctx); s->frame.data[0] = NULL; return 0; }
1threat
static void scsi_destroy(SCSIDevice *s) { scsi_device_purge_requests(s, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->conf.bs); }
1threat
Timer doesn't tick : <p>Today I've tried Visual Studio + WinForms (I've been using Xamarin) I dont use designer, just create empty project and link needed libraries. So, my timer doesn't work properly, it ticks only in minimized form.</p> <p>App.cs</p> <pre><code>using System; using System.Windows.Forms; namespace Line { class App { [STAThread] public static void Main() { Application.Run(new Window()); } } } </code></pre> <p>Window.cs</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing; using System.ComponentModel; namespace Line { class Window : Form { Timer timer; PictureBox pictureBox; Bitmap bmp; public struct Circle { public PointF position; public SizeF size; }; List&lt;Circle&gt; circles; public Window() { this.Text = "Line"; this.Size = SizeFromClientSize(new Size(640, 480)); pictureBox = new PictureBox(); pictureBox.Dock = DockStyle.Fill; pictureBox.BackColor = Color.White; pictureBox.Paint += new PaintEventHandler(pictureBox_Paint); this.Controls.Add(pictureBox); this.Load += new EventHandler(Window_Load); this.Resize += new EventHandler(Window_Resize); circles = new List&lt;Circle&gt;(); timer = new Timer(); timer.Interval = 15; timer.Enabled = true; timer.Tick += new EventHandler(timer_Tick); } private void pictureBox_Paint(object sender, PaintEventArgs e) { Graphics g = Graphics.FromImage(bmp); g.Clear(Color.Black); foreach (Circle c in circles) { g.DrawEllipse(Pens.White, new RectangleF(c.position, c.size)); } pictureBox.Image = bmp; } private void timer_Tick(object sender, EventArgs e) { Circle c; Console.WriteLine("Works"); for (int i = 0; i &lt; circles.Count; i++) { c = circles[i]; c.size.Width = (c.size.Width &gt; 200) ? 100 : c.size.Width + 1; circles[i] = c; } pictureBox.Invalidate(); } private void Window_Load(object sender, EventArgs e) { bmp = new Bitmap(this.Width, this.Height); circles.Add(new Circle()); Circle c = circles[0]; c.position = new PointF(100, 100); c.size = new SizeF(100, 100); circles[0] = c; } private void Window_Resize(object sender, EventArgs e) { bmp = new Bitmap(this.Width, this.Height); pictureBox.Invalidate(); } } } </code></pre> <p>Same code worked fine in Xamarin.</p>
0debug
Dosn't work this Javascript : this is a code which i'm find on internet, I would use it but do not know where is the mistake. This is Calendary with the Cookie saving, Just that someone hovers why it does not work window.onload = function(){ zegar(); WHCheckCookies(); }; function zegar() { var nazwy_mies = ['Styczeń', ' Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień']; var nazwy_dni = ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota']; var data = new Date(); var rok = data.getFullYear(); var mies = data.getMonth(); var dzien = data.getDay(); var dzienl = data.getDate(); var godz = data.getHours(); var min = data.getMinutes(); var sec = data.getSeconds(); if (min < 10) min = '0'+min; if(sec < 10) sec = '0'+sec; var dic = nazwy_dni[dzien]+' '+dzienl+' '+nazwy_mies[mies]+' '+rok+', '+godz+':'+min+':'+sec; document.getElementById('czas').innerHTML = dic; setTimeout("zegar();",1000); } function WHCreateCookie(name, value, days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = name+"="+value+expires+"; path=/"; } function WHReadCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function WHCheckCookies() { if(WHReadCookie('cookies_accepted') != 'T') { var message_container = document.createElement('div'); message_container.id = 'cookies-message-container'; var html_code = '<div id="cookies-message" style="font-size: 17px; color:#00FF00; border: 1px solid #ff0000; text-align: center; position: fixed; top: 0px; background-color: #000000;">Ta strona używa ciasteczek dzięki którym nasz serwis może działać lepiej <br>Co to ciasteczka?<br>To niewielkie pliki tekstowe, nazywane ciasteczkami (z ang. cookie – ciastko), wysyłane przez serwis internetowy, który odwiedzamy i zapisywane na urządzeniu końcowym (komputerze, laptopie, smartfonie), z którego korzystamy podczas przeglądania stron internetowych.<br>Aby dowiedzieć się więcej na ten temat <a href="http://wszystkoociasteczkach.pl" target="_blank">Kliknij tutaj</a><br>Jeżeli rozumiesz i zgadzasz się na wysyłanie ciasteczek <a href="java script:WHCloseCookiesWindow();" id="accept-cookies-checkbox" name="accept-cookies" style="background-color: #ff0000; padding: 5px 10px; color: #000000; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; display: inline-block; margin-left: 10px; text-decoration: none; cursor: pointer;">Kliknij tutaj</a></div>'; message_container.innerHTML = html_code; document.body.appendChild(message_container); } } function WHCloseCookiesWindow() { WHCreateCookie('cookies_accepted', 'T', 365); document.getElementById('cookies-message-container').removeChild(document.getElementById('cookies-message')); } Everybody know's why ?
0debug
Angular Templates - inline expressions vs calling to function : <p>Is there any difference between those two: </p> <pre><code>&lt;li [ngClass]="{disabledField: condition1 &amp;&amp; condition2 &amp;&amp; condition3}"&gt;Click&lt;/li&gt; </code></pre> <p>vs</p> <pre><code>&lt;li [ngClass]="{disabledField: shouldDisableField()}"&gt;Click&lt;/li&gt; </code></pre> <p>and in component class:</p> <pre><code>shouldDisableField(): boolean{ return this.condition1 &amp;&amp; this.condition2 &amp;&amp; this.condition3; } </code></pre>
0debug
How to change the assembly code in this shell for make it work with any IP and port? : I have read this blog: https://www.rcesecurity.com/2014/07/slae-shell-reverse-tcp-shellcode-linux-x86/, In the complete shellcode, As you read it, I ask the guy who created that blog, he say: "keep in mind that your port or ip should not contain a \x00, which could break it. If your IP contains a zero like 192.168.0.1 or your port contains a zero like 80, the shellcode will likely fail when you use it with a remote exploit". and I ask what IP and port can work with this shell code,he say:"all IPs and ports that do not contain a zero in their network byte-order representation. So 0x0101017f which is the network-byte order representation of 127.1.1.1 is fine. 0x100007f which would be 127.0.0.1 is not working". So can anyone help me how to edit just one thing : `push 0x0101017f ;sin_addr=127.1.1.1 (network byte order) push word 0x3905 ;sin_port=1337 (network byte order) inc ebx push word bx ;sin_family=AF_INET (0x2) mov ecx, esp ;save pointer to sockaddr struct` To make the the shell work with any ip address and port number.???
0debug
What are the possible usage scenarios for Number.EPSILON? : <p>I saw the documentation of JavaScript on MZO and I was read this part:</p> <blockquote> <p>The Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1.</p> </blockquote> <p>also I saw this example on the page:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var result = Math.abs(0.2 - 0.3 + 0.1); console.log(result); // expected output: 2.7755575615628914e-17 console.log(result &lt; Number.EPSILON);// expected output: true</code></pre> </div> </div> </p> <p>Okay I understand that I can use this function for see the difference between two floating point number but I cannot see a use in a website</p>
0debug