problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int64_t load_kernel (CPUMIPSState *env)
{
int64_t kernel_entry, kernel_low, kernel_high;
int index = 0;
long initrd_size;
ram_addr_t initrd_offset;
uint32_t *prom_buf;
long prom_size;
if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL,
(uint64_t *)&kernel_entry, (uint64_t *)&kernel_low,
(uint64_t *)&kernel_high, 0, ELF_MACHINE, 1) < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
loaderparams.kernel_filename);
exit(1);
}
initrd_size = 0;
initrd_offset = 0;
if (loaderparams.initrd_filename) {
initrd_size = get_image_size (loaderparams.initrd_filename);
if (initrd_size > 0) {
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (initrd_offset + initrd_size > ram_size) {
fprintf(stderr,
"qemu: memory too small for initial ram disk '%s'\n",
loaderparams.initrd_filename);
exit(1);
}
initrd_size = load_image_targphys(loaderparams.initrd_filename,
initrd_offset, ram_size - initrd_offset);
}
if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
loaderparams.initrd_filename);
exit(1);
}
}
prom_size = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE);
prom_buf = g_malloc(prom_size);
prom_set(prom_buf, index++, "%s", loaderparams.kernel_filename);
if (initrd_size > 0) {
prom_set(prom_buf, index++, "rd_start=0x%" PRIx64 " rd_size=%li %s",
cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size,
loaderparams.kernel_cmdline);
} else {
prom_set(prom_buf, index++, "%s", loaderparams.kernel_cmdline);
}
prom_set(prom_buf, index++, "busclock=33000000");
prom_set(prom_buf, index++, "cpuclock=100000000");
prom_set(prom_buf, index++, "memsize=%i", loaderparams.ram_size/1024/1024);
prom_set(prom_buf, index++, "modetty0=38400n8r");
prom_set(prom_buf, index++, NULL);
rom_add_blob_fixed("prom", prom_buf, prom_size,
cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR));
return kernel_entry;
} | 1threat |
button click inside Usercontrol loaded in main form : I have main form and 2 usercontrols.The main form contains split container, In splitcontainer.panel1 i loaded UserControl1. In usercontrol different buttons are placed. I wants to load usercontrol2 on panel2(in main form) on button clicks which are placed inside the usercontrol1. | 0debug |
static void select_soundhw (const char *optarg)
{
struct soundhw *c;
if (*optarg == '?') {
show_valid_cards:
printf ("Valid sound card names (comma separated):\n");
for (c = soundhw; c->name; ++c) {
printf ("%-11s %s\n", c->name, c->descr);
}
printf ("\n-soundhw all will enable all of the above\n");
exit (*optarg != '?');
}
else {
size_t l;
const char *p;
char *e;
int bad_card = 0;
if (!strcmp (optarg, "all")) {
for (c = soundhw; c->name; ++c) {
c->enabled = 1;
}
return;
}
p = optarg;
while (*p) {
e = strchr (p, ',');
l = !e ? strlen (p) : (size_t) (e - p);
for (c = soundhw; c->name; ++c) {
if (!strncmp (c->name, p, l) && !c->name[l]) {
c->enabled = 1;
break;
}
}
if (!c->name) {
if (l > 80) {
fprintf (stderr,
"Unknown sound card name (too big to show)\n");
}
else {
fprintf (stderr, "Unknown sound card name `%.*s'\n",
(int) l, p);
}
bad_card = 1;
}
p += l + (e != NULL);
}
if (bad_card)
goto show_valid_cards;
}
}
| 1threat |
How to extract characters from a string stored as json data and place them in dynamic number of columns in Sql server : Hi I have a column of string in sql server that stores Json data with all the braces and colons included. My problem is to extract all the key and value pairs and store them in separate columns with the key as the column header. What makes this challenging is that every record has different number of key/value pairs. For example in the image below showing 3 records, the first record has 5 key/value pairs- EndUseCommunityMarket of 2, EndUseProvincial Market of 0, and so on. The second record has 1 key/value pair, and the third record has two key/value pairs.
[![enter image description here][1]][1]
If I have to show how I want this in excel it would be like:
[![enter image description here][2]][2]
I have seen some Sql examples that does something similar but for a fixed number of columns, unlike this one it varies for every record.
Please I need a sql that can achieve this as I am working on thousands of records. Thanks.
[1]: https://i.stack.imgur.com/QoUOa.png
[2]: https://i.stack.imgur.com/9eGxp.png | 0debug |
static void watch_mem_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
check_watchpoint(addr & ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_WRITE);
switch (size) {
case 1:
stb_phys(addr, val);
break;
case 2:
stw_phys(addr, val);
break;
case 4:
stl_phys(addr, val);
break;
default: abort();
}
}
| 1threat |
I am confused with a single for loop : Please give me the solution for this in PHP language.
*
**
***
I want to print this stars shape in php but the condition is by using single for loop, how is this possible. Please help me out.
My Code is this where I am confused here:-
<?php
$a="*";
for($b=1;$b<=3;$b++)
{
echo "*".$a."<br/>";
}
echo "<br/>";
?>
Please help me out where I am wrong and stuck badly. | 0debug |
Difference between import http = require('http'); and import * as http from 'http';? : <p>I haven't been able to find a worthwhile NodeJS with Typescript tutorial out there so I'm diving in unguided and sure enough I have a question.</p>
<p>I don't understand the difference between these two lines:</p>
<pre><code>import * as http from 'http';
// and
import http = require('http');
</code></pre>
<p>They seem to function the same way but I imagine there's probably some nuance to their behavior or else one of them probably wouldn't exist.</p>
<p>I do understand that the first approach could let me selectively import from a module but if I'm importing all of the module then is there a difference between the two? Is there a preferred way? What if I'm importing from my own files, does that change anything?</p>
| 0debug |
Android Room Database DAO debug log : <p>Given a Room database DAO like this:</p>
<pre><code>import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Query;
import java.util.Date;
import java.util.List;
@Dao
public interface MyDao {
@Query("SELECT * FROM MyTable")
List<MyItem> all();
@Query("SELECT * FROM MyTable WHERE date = :date AND language = :language")
MyItem byDate(Date date, String language);
}
</code></pre>
<p>Is there a way to have a Logger or something like that added to <code>MyDao</code> so that I could see which statements are being performed. This would be really helpful during development, because I could immediately check if the functions are transformed correctly to the expected SQL statement or not.</p>
| 0debug |
Using geom_abline() and ggplot : <p>I am a beginner in <code>ggplot2</code>--it's been only 4 days since I have started experimenting with it. So, I apologize if this question sounds too basic. I'd appreciate any guidance--I've been struggling with this issue for about an hour.</p>
<p>I was experimenting with using <code>geom_abline()</code> as below:</p>
<pre><code> p <- ggplot(mpg, aes(cty, hwy)) + geom_point()
p + geom_abline() + facet_wrap(~cyl)
</code></pre>
<p>This works as in I can see a reference line in all four faceted graphs as below:</p>
<p><a href="https://i.stack.imgur.com/VZGTv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VZGTv.png" alt="enter image description here"></a></p>
<p>Later, I was using another related dataset <code>mtcars</code> to see what happens to <code>geom_abline()</code></p>
<pre><code> p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
p + geom_abline() + facet_wrap(~cyl)
</code></pre>
<p>However, when I ran this command, I couldn't see <code>geom_abline().</code> Quite surprisingly, I found similar version of above command in the help file, and it says "<em><code>geom_abline()</code> is out of the range</em>"</p>
<p>While I know what "out of range" means, but how do I know whether in a particular dataset, <code>abline()</code> will be out of range? I can override it by forcing it to use a specific slope and an intercept, but then I'd consider this a bit of hacking--i.e. modifying the code after seeing the output. Is there any way I can know what happens behind the scenes for <code>geom_abline()</code></p>
<p>Here's the graph I got without any <code>abline()</code>s
<a href="https://i.stack.imgur.com/o25Fh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/o25Fh.png" alt="enter image description here"></a></p>
<p>I'd appreciate any thoughts. I am really confused.</p>
| 0debug |
New UINavigationBar appearance in detail pane of UISplitViewController in iOS 13 : <p>Under iOS 13, if you setup a scrollable root view controller (such as a UITableViewController) in a navigation controller and then put that navigation controller in the detail pane of a UISplitViewController, then the nav bar's background isn't visible when the scrollable content is at the top.</p>
<p>You can see this by creating a new iOS project based on the Master/Detail template. Then modify the storyboard to use a UITableViewController inside the detail pane's nav controller. Put the device/simulator in Light Appearance mode (it shows the problem better than Dark mode). Run the app and notice the nav bar area is the same color as the table view background. Now scroll the table view up and the nav bar color changes to the standard light gray. Let the table view return to the top and the nav bar color disappears again.</p>
<p>I've only seen this in the detail pane of a split view controller.</p>
<p>How do you turn off this "feature" so that the nav bar looks normal just like every other nav bar used anywhere else other than the detail pane of a split view controller?</p>
<p>There are no relevant API changes for <code>UISplitViewController</code> or <code>UISplitViewControllerDelegate</code>. There's nothing in <code>UINavigationController</code> either.</p>
<p>After some digging I found one workaround but I'd love to find a way to avoid having to do this.</p>
<p>The <code>UINavigationBar</code> class now has some new properties for setting its appearance. Oddly, none of these are mentioned under the "Customizing the Appearance of a Navigation Bar" in the documentation for <code>UINavigationBar</code>.</p>
<p>There are three new properties in iOS 13:</p>
<ul>
<li><code>standardAppearance</code></li>
<li><code>compactAppearance</code></li>
<li><code>scrollEdgeAppearance</code></li>
</ul>
<p>All three are of type <code>UINavigationBarAppearance</code>.</p>
<p>Only the first one is set by default.</p>
<p>Even though <code>scrollEdgeAppearance</code> is <code>nil</code>, the detail pane of a split controller acts as if this has been set with the <code>backgroundColor</code> set to the <code>clear</code> color.</p>
<p>So the workaround is to add the following line to the <code>viewDidLoad</code> method of the navigation controller's root view controller:</p>
<pre><code>navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
</code></pre>
<p>Why is this needed only in this one case? Is there a more correct solution other than adding this code?</p>
<p>I noticed that none of Apple's apps (Mail, Notes, and Files at least) seem to use this "feature".</p>
| 0debug |
Coroutine *qemu_coroutine_create(CoroutineEntry *entry)
{
Coroutine *co;
co = QSLIST_FIRST(&pool);
if (co) {
QSLIST_REMOVE_HEAD(&pool, pool_next);
pool_size--;
} else {
co = qemu_coroutine_new();
}
co->entry = entry;
return co;
}
| 1threat |
bool kvm_arch_stop_on_emulation_error(CPUState *env)
{
return !(env->cr[0] & CR0_PE_MASK) ||
((env->segs[R_CS].selector & 3) != 3);
}
| 1threat |
.NET 4.7 returning Tuples and nullable values : <p>Ok lets say I have this simple program in .NET 4.6:</p>
<pre><code>using System;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static async void Main()
{
var data = await Task.Run(() =>
{
try
{
return GetResults();
}
catch
{
return null;
}
});
Console.WriteLine(data);
}
private static Tuple<int,int> GetResults()
{
return new Tuple<int,int>(1,1);
}
}
}
</code></pre>
<p>Works fine. So with .NET 4.7 we have the new Tuple value type. So if I convert this it becomes:</p>
<pre><code>using System;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static async void Main()
{
var data = await Task.Run(() =>
{
try
{
return GetResults();
}
catch
{
return null;
}
});
Console.WriteLine(data);
}
private static (int,int) GetResults()
{
return (1, 2);
}
}
}
</code></pre>
<p>Great! Except it doesn't work. The new tuple value type is not nullable so this does not even compile. </p>
<p>Anyone find a nice pattern to deal with this situation where you want to pass a value type tuple back but the result could also be null?</p>
| 0debug |
int monitor_read_bdrv_key(BlockDriverState *bs)
{
char password[256];
int i;
if (!bdrv_is_encrypted(bs))
return 0;
term_printf("%s (%s) is encrypted.\n", bdrv_get_device_name(bs),
bdrv_get_encrypted_filename(bs));
for(i = 0; i < 3; i++) {
monitor_readline("Password: ", 1, password, sizeof(password));
if (bdrv_set_key(bs, password) == 0)
return 0;
term_printf("invalid password\n");
}
return -EPERM;
}
| 1threat |
Php How to pass date and time to another .php file : <p>I want to pass time and date which I get from user input to another php file using but I dont know how to get the date and time input and pass it.</p>
<pre><code><a href="actionMAppointment.php?stu_id=<?php echo $row_RecEdit['stu_id'] ?>">Make Appointment (Test) </a>
&nbsp;&nbsp;
Time:
<input type = "time" id = "appointmentTime"/>
&nbsp;&nbsp;
Date:
<input type = "date" id = "appointmentDate"/>
</code></pre>
| 0debug |
Launching Squirrel SQL client on Mac OS : <p>I am Launching SQuirrel SQL on Mac OS X(El Capitan) that has JDK1.8 on it produces an error message saying the JDK-version should be at least 1.6. It then quits. SQL client version is 3.7. How do I resolve this?</p>
| 0debug |
static void memory_region_iorange_write(IORange *iorange,
uint64_t offset,
unsigned width,
uint64_t data)
{
MemoryRegionIORange *mrio
= container_of(iorange, MemoryRegionIORange, iorange);
MemoryRegion *mr = mrio->mr;
offset += mrio->offset;
if (mr->ops->old_portio) {
const MemoryRegionPortio *mrp = find_portio(mr, offset - mrio->offset,
width, true);
if (mrp) {
mrp->write(mr->opaque, offset, data);
} else if (width == 2) {
mrp = find_portio(mr, offset - mrio->offset, 1, true);
assert(mrp);
mrp->write(mr->opaque, offset, data & 0xff);
mrp->write(mr->opaque, offset + 1, data >> 8);
}
return;
}
access_with_adjusted_size(offset, &data, width,
mr->ops->impl.min_access_size,
mr->ops->impl.max_access_size,
memory_region_write_accessor, mr);
}
| 1threat |
void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr)
{
KVMState *s = kvm_state;
KVMDirtyLog d;
KVMSlot *mem = kvm_lookup_slot(s, start_addr);
unsigned long alloc_size;
ram_addr_t addr;
target_phys_addr_t phys_addr = start_addr;
dprintf("sync addr: %llx into %lx\n", start_addr, mem->phys_offset);
if (mem == NULL) {
fprintf(stderr, "BUG: %s: invalid parameters\n", __func__);
return;
}
alloc_size = mem->memory_size >> TARGET_PAGE_BITS / sizeof(d.dirty_bitmap);
d.dirty_bitmap = qemu_mallocz(alloc_size);
d.slot = mem->slot;
dprintf("slot %d, phys_addr %llx, uaddr: %llx\n",
d.slot, mem->start_addr, mem->phys_offset);
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
dprintf("ioctl failed %d\n", errno);
goto out;
}
phys_addr = start_addr;
for (addr = mem->phys_offset; phys_addr < end_addr; phys_addr+= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
unsigned long *bitmap = (unsigned long *)d.dirty_bitmap;
unsigned nr = (phys_addr - start_addr) >> TARGET_PAGE_BITS;
unsigned word = nr / (sizeof(*bitmap) * 8);
unsigned bit = nr % (sizeof(*bitmap) * 8);
if ((bitmap[word] >> bit) & 1)
cpu_physical_memory_set_dirty(addr);
}
out:
qemu_free(d.dirty_bitmap);
}
| 1threat |
Google Chrome default console context : <p>Lately when opening the Google Chrome developer console, the context has been wrong. </p>
<p>I load a page, press Ctrl + Shift + J and get this: <a href="http://i.imgur.com/2eTJgD0.png">http://i.imgur.com/2eTJgD0.png</a></p>
<p>It changes extensions sometimes but it should be 'top'. </p>
<p>I can change the context manually each time but this is getting kind of annoying to do.</p>
| 0debug |
Serial.print in arduino not write variables : <p>I'm developing in arduino but I'm having problem to write in Serial</p>
<p>My code:</p>
<pre><code>void send(String prefix, String cmd, String param) {
Serial.print("@");
Serial.print(prefix);
Serial.print(":");
Serial.print(cmd);
if (param.length() > 0) {
Serial.print("=");
Serial.print(param);
}
Serial.print(";");
}
void sendComand(String cmd, String param)
{
send("CMD", "xxx", "param");
}
</code></pre>
<p>Result:</p>
<pre><code>@:;@:;@:;@:;@:;@:;@:;@:;@:;@:;
</code></pre>
<p>Whats wrong?</p>
| 0debug |
static void qemu_kvm_eat_signal(CPUState *env, int timeout)
{
struct timespec ts;
int r, e;
siginfo_t siginfo;
sigset_t waitset;
ts.tv_sec = timeout / 1000;
ts.tv_nsec = (timeout % 1000) * 1000000;
sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
qemu_mutex_unlock(&qemu_global_mutex);
r = sigtimedwait(&waitset, &siginfo, &ts);
e = errno;
qemu_mutex_lock(&qemu_global_mutex);
if (r == -1 && !(e == EAGAIN || e == EINTR)) {
fprintf(stderr, "sigtimedwait: %s\n", strerror(e));
exit(1);
}
}
| 1threat |
Probability of A Random Sample Meeting Criteria : <p>I need to know how to find the probability that a random sample of 9 SAT‐ takers will get a group average score of 1340 and above. All I am given is the mean = 1060 and the standard deviation is 195. I am new to r and can't seem to find a tutorial online that shows me how to find this. I have found the probability of all SAT-takers scoring 1340 and above, I'm just not sure how to add a sample size restriction. </p>
| 0debug |
document.location = 'http://evil.com?username=' + user_input; | 1threat |
static void handle_rev16(DisasContext *s, unsigned int sf,
unsigned int rn, unsigned int rd)
{
TCGv_i64 tcg_rd = cpu_reg(s, rd);
TCGv_i64 tcg_tmp = tcg_temp_new_i64();
TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf);
TCGv_i64 mask = tcg_const_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff);
tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8);
tcg_gen_and_i64(tcg_rd, tcg_rn, mask);
tcg_gen_and_i64(tcg_tmp, tcg_tmp, mask);
tcg_gen_shli_i64(tcg_rd, tcg_rd, 8);
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp);
tcg_temp_free_i64(tcg_tmp);
} | 1threat |
ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, CharDriverState *chr)
{
ParallelState *s;
int io_sw;
s = qemu_mallocz(sizeof(ParallelState));
s->irq = irq;
s->chr = chr;
s->it_shift = it_shift;
qemu_register_reset(parallel_reset, s);
io_sw = cpu_register_io_memory(parallel_mm_read_sw, parallel_mm_write_sw,
s, DEVICE_NATIVE_ENDIAN);
cpu_register_physical_memory(base, 8 << it_shift, io_sw);
return s;
}
| 1threat |
static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
V9fsSynthOpenState *synth_open;
V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data;
synth_open = g_malloc(sizeof(*synth_open));
synth_open->node = node;
node->open_count++;
fs->private = synth_open;
return 0;
}
| 1threat |
static void test_visitor_in_native_list_uint64(TestInputVisitorData *data,
const void *unused)
{
test_native_list_integer_helper(data, unused,
USER_DEF_NATIVE_LIST_UNION_KIND_U64);
}
| 1threat |
JAVA - cannot find main : <p>I am trying out an association example in java; when compiling, it gives the error message saying "java cannot find main in CarClass". I double checked the "main" syntax, tried multiple versions - still doesn't work. Appreciate any help!</p>
<pre><code>class CarClass{
String carName;
int carId;
CarClass(String name, int id)
{
this.carName = name;
this.carId = id;
}
}
class Driver extends CarClass{
String driverName;
Driver(String name, String cname, int cid){
super(cname, cid);
this.driverName=name;
}
}
class TransportCompany{
public static void main(String args[])
{
Driver obj = new Driver("Andy", "Ford", 9988);
System.out.println(obj.driverName+" is a driver of car Id: "+obj.carId);
}
}
</code></pre>
<p>Thanks.</p>
| 0debug |
def parabola_vertex(a, b, c):
vertex=(((-b / (2 * a)),(((4 * a * c) - (b * b)) / (4 * a))))
return vertex | 0debug |
I need to find the sum of all the prime numbers under 2,000,000. This code takes way too long : <pre><code>##Problem 10
primes=[]
sumofprimes=0
for number in range(1,2000000):
##This goes through all the potential primes.
p=0
for tester in range(2,number):
if ((number%tester)==0):
break
else:
##every time the number is not divisible by something it adds 1 to p and when everything up to the number is not divisible by anything then it is a prime.
p=p+1
if(p==(number-2)):
</code></pre>
<h2>the "number minus 2" is because lets say you have the prime "3" it will only test "2" so p will equal 1 or (3-2).</h2>
<pre><code> sumofprimes=sumofprimes+number
print(sumofprimes)
</code></pre>
| 0debug |
static inline bool regime_translation_disabled(CPUARMState *env,
ARMMMUIdx mmu_idx)
{
if (arm_feature(env, ARM_FEATURE_M)) {
switch (env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)] &
(R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK)) {
case R_V7M_MPU_CTRL_ENABLE_MASK:
return mmu_idx == ARMMMUIdx_MNegPri ||
mmu_idx == ARMMMUIdx_MSNegPri;
case R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK:
return false;
case 0:
default:
return true;
}
}
if (mmu_idx == ARMMMUIdx_S2NS) {
return (env->cp15.hcr_el2 & HCR_VM) == 0;
}
return (regime_sctlr(env, mmu_idx) & SCTLR_M) == 0;
}
| 1threat |
static int setup_sigcontext(struct target_sigcontext *sc,
CPUOpenRISCState *regs,
unsigned long mask)
{
int err = 0;
unsigned long usp = regs->gpr[1];
__put_user(mask, &sc->oldmask);
__put_user(usp, &sc->usp); return err;
}
| 1threat |
Best way to use reactions as buttons in discord.js? : <p>Currently working a bot that bans maps players can/cannot play in CSGO. On click of a reaction, I would want to push a certain map to an array titled bannedMaps. What is the best way to go about this? I have the reactions reacted to the prompt, and the array of objects for the map also done.</p>
| 0debug |
Spark :Join Dataframe by an array column : I have two dataframes with a column `field` array<string>. So is it safe to do the following
df1.join(df2, "field");
Similarly in a SQL query on a hive table with an array column | 0debug |
static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f,
int version_id)
{
VirtIONet *n = VIRTIO_NET(vdev);
int i, link_down;
qemu_get_buffer(f, n->mac, ETH_ALEN);
n->vqs[0].tx_waiting = qemu_get_be32(f);
virtio_net_set_mrg_rx_bufs(n, qemu_get_be32(f),
virtio_has_feature(vdev, VIRTIO_F_VERSION_1));
if (version_id >= 3)
n->status = qemu_get_be16(f);
if (version_id >= 4) {
if (version_id < 8) {
n->promisc = qemu_get_be32(f);
n->allmulti = qemu_get_be32(f);
} else {
n->promisc = qemu_get_byte(f);
n->allmulti = qemu_get_byte(f);
}
}
if (version_id >= 5) {
n->mac_table.in_use = qemu_get_be32(f);
if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
qemu_get_buffer(f, n->mac_table.macs,
n->mac_table.in_use * ETH_ALEN);
} else {
int64_t i;
for (i = 0; i < (int64_t)n->mac_table.in_use * ETH_ALEN; ++i) {
qemu_get_byte(f);
}
n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
n->mac_table.in_use = 0;
}
}
if (version_id >= 6)
qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
if (version_id >= 7) {
if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) {
error_report("virtio-net: saved image requires vnet_hdr=on");
return -1;
}
}
if (version_id >= 9) {
n->mac_table.multi_overflow = qemu_get_byte(f);
n->mac_table.uni_overflow = qemu_get_byte(f);
}
if (version_id >= 10) {
n->alluni = qemu_get_byte(f);
n->nomulti = qemu_get_byte(f);
n->nouni = qemu_get_byte(f);
n->nobcast = qemu_get_byte(f);
}
if (version_id >= 11) {
if (qemu_get_byte(f) && !peer_has_ufo(n)) {
error_report("virtio-net: saved image requires TUN_F_UFO support");
return -1;
}
}
if (n->max_queues > 1) {
if (n->max_queues != qemu_get_be16(f)) {
error_report("virtio-net: different max_queues ");
return -1;
}
n->curr_queues = qemu_get_be16(f);
if (n->curr_queues > n->max_queues) {
error_report("virtio-net: curr_queues %x > max_queues %x",
n->curr_queues, n->max_queues);
return -1;
}
for (i = 1; i < n->curr_queues; i++) {
n->vqs[i].tx_waiting = qemu_get_be32(f);
}
}
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) {
n->curr_guest_offloads = qemu_get_be64(f);
} else {
n->curr_guest_offloads = virtio_net_supported_guest_offloads(n);
}
if (peer_has_vnet_hdr(n)) {
virtio_net_apply_guest_offloads(n);
}
virtio_net_set_queues(n);
for (i = 0; i < n->mac_table.in_use; i++) {
if (n->mac_table.macs[i * ETH_ALEN] & 1) {
break;
}
}
n->mac_table.first_multi = i;
link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0;
for (i = 0; i < n->max_queues; i++) {
qemu_get_subqueue(n->nic, i)->link_down = link_down;
}
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) &&
virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) {
n->announce_counter = SELF_ANNOUNCE_ROUNDS;
timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL));
}
return 0;
}
| 1threat |
Why is this code not working?output is not printed : When i compiled in devc++ compiler,output is not printed.
Is there any logical error?
This program should accept a number from the user,print the lowest palindrome greater than the given number.
It is a problem from SPOJ PALIN
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
cout<<endl;
while(t--)
{long long int i;
long long int k;
int flag;
long long int n;
int a[10000000];
cin>>n;
n++;
start:
i=0;
while(n!=0)
{
a[i]=n%10;
i++;
n=n/10;}
i--;
k=i;
for(int j=0;j<=k;j++)
{
if(a[i]!=a[j])
{flag=0;break;}
else
i--;
}
if(flag==1)
cout<<n<<endl;
else
{n++;goto start;}
}
return 0;
} | 0debug |
static void omap_clkdsp_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
uint16_t diff;
if (size != 2) {
return omap_badwidth_write16(opaque, addr, value);
}
switch (addr) {
case 0x04:
diff = s->clkm.dsp_idlect1 ^ value;
s->clkm.dsp_idlect1 = value & 0x01f7;
omap_clkdsp_idlect1_update(s, diff, value);
break;
case 0x08:
s->clkm.dsp_idlect2 = value & 0x0037;
diff = s->clkm.dsp_idlect1 ^ value;
omap_clkdsp_idlect2_update(s, diff, value);
break;
case 0x14:
s->clkm.dsp_rstct2 = value & 0x0001;
break;
case 0x18:
s->clkm.cold_start &= value & 0x3f;
break;
default:
OMAP_BAD_REG(addr);
}
}
| 1threat |
Context.Consumer vs useContext() to access values passed by Context.Provider : <pre><code><MyContext.Consumer>
{value => { }}
</MyContext.Consumer>
VS
let value = useContext(MyContext);
</code></pre>
<p>What is the difference between this two snippets, using Context.Consumer and using useContext hook to access values passed by the context Provider? I think useContext will subscribe to the context Provider, since we passed the Context as an argument, so that it will trigger a re-render, when the provider value changes.</p>
| 0debug |
Call native C++ function from C# : <p>I have C++ legacy code with functions in the form:</p>
<pre><code>double func(double)
</code></pre>
<p><strong>I have this as a source file</strong> - it isnt in the form of a DLL although it could be turned into one if necessary</p>
<p>How can I call <code>func</code> in my C# code (maybe over managed C++)? I heard of Marshalling and <code>DllImport</code> but I did not find MSDN very helpful.</p>
| 0debug |
static void vga_screen_dump(void *opaque, const char *filename, bool cswitch,
Error **errp)
{
VGACommonState *s = opaque;
DisplaySurface *surface = qemu_console_surface(s->con);
if (cswitch) {
vga_invalidate_display(s);
}
graphic_hw_update(s->con);
ppm_save(filename, surface, errp);
}
| 1threat |
QT Stacked Widgets : Hello i have a problem...
i created a stacked widget and 2 pages.
The first page have 1 label and 1 button.The second has 1 label when i press the button the pages changes to page2,but the label "cutted" in half. Sorry for my bad english.[enter image description here][1]
[page1][2]
[page2][3]
[program started][4]
[after i clicked the button][5]
[in mainwindow.cpp][1]
[1]: https://i.stack.imgur.com/B0sTD.png
[2]: https://i.stack.imgur.com/2mb9k.png
[3]: https://i.stack.imgur.com/RJGw6.png
[4]: https://i.stack.imgur.com/zdh1R.jpg
[5]: https://i.stack.imgur.com/wGnfC.png | 0debug |
static av_always_inline void autocorrelate(const int x[40][2], SoftFloat phi[3][2][2], int lag)
{
int i;
int64_t real_sum, imag_sum;
int64_t accu_re = 0, accu_im = 0;
if (lag) {
for (i = 1; i < 38; i++) {
accu_re += (int64_t)x[i][0] * x[i+lag][0];
accu_re += (int64_t)x[i][1] * x[i+lag][1];
accu_im += (int64_t)x[i][0] * x[i+lag][1];
accu_im -= (int64_t)x[i][1] * x[i+lag][0];
}
real_sum = accu_re;
imag_sum = accu_im;
accu_re += (int64_t)x[ 0][0] * x[lag][0];
accu_re += (int64_t)x[ 0][1] * x[lag][1];
accu_im += (int64_t)x[ 0][0] * x[lag][1];
accu_im -= (int64_t)x[ 0][1] * x[lag][0];
phi[2-lag][1][0] = autocorr_calc(accu_re);
phi[2-lag][1][1] = autocorr_calc(accu_im);
if (lag == 1) {
accu_re = real_sum;
accu_im = imag_sum;
accu_re += (int64_t)x[38][0] * x[39][0];
accu_re += (int64_t)x[38][1] * x[39][1];
accu_im += (int64_t)x[38][0] * x[39][1];
accu_im -= (int64_t)x[38][1] * x[39][0];
phi[0][0][0] = autocorr_calc(accu_re);
phi[0][0][1] = autocorr_calc(accu_im);
}
} else {
for (i = 1; i < 38; i++) {
accu_re += (int64_t)x[i][0] * x[i][0];
accu_re += (int64_t)x[i][1] * x[i][1];
}
real_sum = accu_re;
accu_re += (int64_t)x[ 0][0] * x[ 0][0];
accu_re += (int64_t)x[ 0][1] * x[ 0][1];
phi[2][1][0] = autocorr_calc(accu_re);
accu_re = real_sum;
accu_re += (int64_t)x[38][0] * x[38][0];
accu_re += (int64_t)x[38][1] * x[38][1];
phi[1][0][0] = autocorr_calc(accu_re);
}
}
| 1threat |
av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
unsigned int *sample_rate,
int channels, enum CodecID *codec_id)
{
AlsaData *s = ctx->priv_data;
const char *audio_device;
int res, flags = 0;
snd_pcm_format_t format;
snd_pcm_t *h;
snd_pcm_hw_params_t *hw_params;
snd_pcm_uframes_t buffer_size, period_size;
int64_t layout = ctx->streams[0]->codec->channel_layout;
if (ctx->filename[0] == 0) audio_device = "default";
else audio_device = ctx->filename;
if (*codec_id == CODEC_ID_NONE)
*codec_id = DEFAULT_CODEC_ID;
format = codec_id_to_pcm_format(*codec_id);
if (format == SND_PCM_FORMAT_UNKNOWN) {
av_log(ctx, AV_LOG_ERROR, "sample format 0x%04x is not supported\n", *codec_id);
return AVERROR(ENOSYS);
}
s->frame_size = av_get_bits_per_sample(*codec_id) / 8 * channels;
if (ctx->flags & AVFMT_FLAG_NONBLOCK) {
flags = SND_PCM_NONBLOCK;
}
res = snd_pcm_open(&h, audio_device, mode, flags);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot open audio device %s (%s)\n",
audio_device, snd_strerror(res));
return AVERROR(EIO);
}
res = snd_pcm_hw_params_malloc(&hw_params);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n",
snd_strerror(res));
goto fail1;
}
res = snd_pcm_hw_params_any(h, hw_params);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n",
snd_strerror(res));
goto fail;
}
res = snd_pcm_hw_params_set_access(h, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set access type (%s)\n",
snd_strerror(res));
goto fail;
}
res = snd_pcm_hw_params_set_format(h, hw_params, format);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set sample format 0x%04x %d (%s)\n",
*codec_id, format, snd_strerror(res));
goto fail;
}
res = snd_pcm_hw_params_set_rate_near(h, hw_params, sample_rate, 0);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set sample rate (%s)\n",
snd_strerror(res));
goto fail;
}
res = snd_pcm_hw_params_set_channels(h, hw_params, channels);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set channel count to %d (%s)\n",
channels, snd_strerror(res));
goto fail;
}
snd_pcm_hw_params_get_buffer_size_max(hw_params, &buffer_size);
buffer_size = FFMIN(buffer_size, ALSA_BUFFER_SIZE_MAX);
res = snd_pcm_hw_params_set_buffer_size_near(h, hw_params, &buffer_size);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set ALSA buffer size (%s)\n",
snd_strerror(res));
goto fail;
}
snd_pcm_hw_params_get_period_size_min(hw_params, &period_size, NULL);
if (!period_size)
period_size = buffer_size / 4;
res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n",
snd_strerror(res));
goto fail;
}
s->period_size = period_size;
res = snd_pcm_hw_params(h, hw_params);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set parameters (%s)\n",
snd_strerror(res));
goto fail;
}
snd_pcm_hw_params_free(hw_params);
if (channels > 2 && layout) {
if (find_reorder_func(s, *codec_id, layout, mode == SND_PCM_STREAM_PLAYBACK) < 0) {
char name[128];
av_get_channel_layout_string(name, sizeof(name), channels, layout);
av_log(ctx, AV_LOG_WARNING, "ALSA channel layout unknown or unimplemented for %s %s.\n",
name, mode == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
}
if (s->reorder_func) {
s->reorder_buf_size = buffer_size;
s->reorder_buf = av_malloc(s->reorder_buf_size * s->frame_size);
if (!s->reorder_buf)
goto fail1;
}
}
s->h = h;
return 0;
fail:
snd_pcm_hw_params_free(hw_params);
fail1:
snd_pcm_close(h);
return AVERROR(EIO);
}
| 1threat |
Best Practise Coding for R script running in production : <p>We have a linux production server and a number of scripts we are writing that we want to run on it to collect data which then will be put into a Spark data lake.</p>
<p>My background is SQL Server / Fortran and there are very specific <strong>best practices</strong> that should be followed. </p>
<ul>
<li>Production environments should be stable in terms of version control, both from the code point of view, but also the installed applications, operating system, etc. </li>
<li>Changes to code/applications/operating system should be done either in a separate environment or in a way that is controlled and can be <em>backed out</em>.</li>
<li>If a second environment exist, then the possibility of parallel execution to test system changes can be performed.</li>
<li>(Largely), developers are restricted from changing the production environment</li>
</ul>
<p>In reviewing the R code, there are a number of things that I have questions on.</p>
<ul>
<li>library(), install.packages() - I would like to exclude the possibility of installing newer versions of packages each time scripts are run?</li>
<li>how is it best to call R packages that are scheduled through a CRON job? There are a number of choices here.</li>
<li>When using RSelenium what is the most efficient way to use a gui/web browser or virtualised web browser?</li>
</ul>
| 0debug |
void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,
MemoryRegion *address_space_io, bool bridges_enabled)
{
s->io_len = ACPI_PCIHP_SIZE;
s->io_base = ACPI_PCIHP_ADDR;
s->root= root_bus;
s->legacy_piix = !bridges_enabled;
if (s->legacy_piix) {
unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);
s->io_len = ACPI_PCIHP_LEGACY_SIZE;
*bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,
bus_bsel, NULL);
}
memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
"acpi-pci-hotplug", s->io_len);
memory_region_add_subregion(address_space_io, s->io_base, &s->io);
object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base,
&error_abort);
object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len,
&error_abort);
}
| 1threat |
alert('Hello ' + user_input); | 1threat |
React native text like span : <p>I tried to follow the solution in <a href="https://stackoverflow.com/questions/34624100/simulate-display-inline-in-react-native">Simulate display: inline in React Native</a> but it's not work.</p>
<p>I would like to do the same thing just like in HTML</p>
<p>First line is short so seems like no problem, but second line content is too long and it's expected to fill all the space before go to next line.</p>
<p>But my output is look like...
<a href="https://i.stack.imgur.com/gnUJA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gnUJA.png" alt="output"></a></p>
<pre><code><View style={styles.contentView}>
<Text style={styles.username}>{s_username}</Text>
<Text style={styles.content}>{s_content}</Text>
</View>
contentView: {
paddingLeft: 10,
flex: 1,
flexDirection:'row',
flexWrap:'wrap'
},
username: {
fontWeight: 'bold'
},
content: {
},
</code></pre>
| 0debug |
mCustomScroll - Scrolling body focus on page load : <p>I am using mCustomScrollbar's keyboard support which will let user scroll using arrow keys.</p>
<p>But user will be able to use the arrow keys once he has clicked the scrolling frame. My requirement is to let user scroll the scrolling frame on page load.</p>
<p>So basically what I want is to focus the scrolling frame after page has been loaded. I have tried applying .focus() once scrolling frame has been generated but it didn't worked. </p>
<p>Any suggestions ?</p>
| 0debug |
Can i bind an error message to a TextInputLayout? : <p>I would like to bind a error message directly to a <code>android.support.design.widget.TextInputLayout</code>. I cannot find a way to set the error through the layout. Is this even possible?</p>
<p>This is how I imagined it working:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
<variable
name="error"
type="String" />
</data>
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:errorText="@{error}">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
</android.support.v7.widget.LinearLayoutCompat>
</layout>
</code></pre>
| 0debug |
Two most recurring words in a string without using any API : Please help me write code for it. I want to find the two words which are recurring maximum times in a string without using Collection.
| 0debug |
what is RMI TCP connection : <p>I'm making a desktop application in java and am doing some memory optimisations. That made me come across two threads running in the JVM, both named:</p>
<p>RMI TCP connection</p>
<p>And they're both contributing to heap growth quite considerably (at my perspective)</p>
<p>Now I don't know much, but TCP sounds to me like it's some internet thing. From what I've managed to find on google, it has something to do with serialization/deserialization over the internet. </p>
<p>But my application doesn't need the internet, so I would like to know two things:</p>
<ol>
<li>what are they and what are they doing in my JVM?</li>
<li>Can I get rid of them somehow?</li>
</ol>
<p><a href="https://i.stack.imgur.com/CVVT7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CVVT7.png" alt="enter image description here"></a></p>
<p>My tool has been "Java visualVM". A though has crossed my mind that the two threads are spawned as a result of using this tool, in which case I'll feel a bit stupid.</p>
| 0debug |
How to get the `next` element of `e.target`? : <p>I have an <code>input</code> tag, which is then followed by a <code>label</code> tag. I am trying to get the value of the <code>label</code> after the <code>input</code> has been clicked. My trial was <code>e.target.next.val;</code> but that seems to be wrong. Any ideas how I could achieve that? </p>
| 0debug |
static int proxy_init(FsContext *ctx)
{
V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));
int sock_id;
if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {
sock_id = connect_namedsocket(ctx->fs_root);
} else {
sock_id = atoi(ctx->fs_root);
if (sock_id < 0) {
fprintf(stderr, "socket descriptor not initialized\n");
}
}
if (sock_id < 0) {
g_free(proxy);
return -1;
}
g_free(ctx->fs_root);
ctx->fs_root = NULL;
proxy->in_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);
proxy->in_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;
proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);
proxy->out_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;
ctx->private = proxy;
proxy->sockfd = sock_id;
qemu_mutex_init(&proxy->mutex);
ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT;
ctx->exops.get_st_gen = proxy_ioc_getversion;
return 0;
}
| 1threat |
void bdrv_io_limits_enable(BlockDriverState *bs)
{
assert(!bs->io_limits_enabled);
throttle_init(&bs->throttle_state,
bdrv_get_aio_context(bs),
QEMU_CLOCK_VIRTUAL,
bdrv_throttle_read_timer_cb,
bdrv_throttle_write_timer_cb,
bs);
bs->io_limits_enabled = true;
}
| 1threat |
int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
{
if (avctx->internal->pkt) {
frame->pkt_pts = avctx->internal->pkt->pts;
av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);
av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);
av_frame_set_pkt_size (frame, avctx->internal->pkt->size);
} else {
frame->pkt_pts = AV_NOPTS_VALUE;
av_frame_set_pkt_pos (frame, -1);
av_frame_set_pkt_duration(frame, 0);
av_frame_set_pkt_size (frame, -1);
}
frame->reordered_opaque = avctx->reordered_opaque;
switch (avctx->codec->type) {
case AVMEDIA_TYPE_VIDEO:
if (frame->format < 0)
frame->format = avctx->pix_fmt;
if (!frame->sample_aspect_ratio.num)
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED)
av_frame_set_colorspace(frame, avctx->colorspace);
if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED)
av_frame_set_color_range(frame, avctx->color_range);
break;
case AVMEDIA_TYPE_AUDIO:
if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate;
if (frame->format < 0)
frame->format = avctx->sample_fmt;
if (!frame->channel_layout) {
if (avctx->channel_layout) {
if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=
avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "
"configuration.\n");
return AVERROR(EINVAL);
}
frame->channel_layout = avctx->channel_layout;
} else {
if (avctx->channels > FF_SANE_NB_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n",
avctx->channels);
return AVERROR(ENOSYS);
}
}
}
av_frame_set_channels(frame, avctx->channels);
break;
}
return 0;
}
| 1threat |
Kotlin Android / Java String DateTime Format, API21 : <p>I want convert string datetime to formatted string.
e.g "2018-12-14T09:55:00" to "14.12.2018 09:55" as String => Textview.text</p>
<p>how can I do this with kotlin or java for android ?</p>
| 0debug |
C# Reading Paths From Text File Says Path Doesn't Exist : <p>I'm developing a small command line utility to remove files from a directory. The user has the option to specify a path at the command line or have the paths being read from a text file.</p>
<p>Here is a sample text input:</p>
<pre><code>C:\Users\MrRobot\Desktop\Delete
C:\Users\MrRobot\Desktop\Erase
C:\Users\MrRobot\Desktop\Test
</code></pre>
<p>My Code:</p>
<pre><code>class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Number of command line parameters = {0}", args.Length);
if(args[0] == "-tpath:"){
clearPath(args[1]);
}
else
if(args[0] == "-treadtxt:"){
readFromText(args[1]);
}
}
public static void clearPath(string path)
{
if(Directory.Exists(path)){
int directoryCount = Directory.GetDirectories(path).Length;
if(directoryCount > 0){
DirectoryInfo di = new DirectoryInfo(path);
foreach (DirectoryInfo dir in di.GetDirectories())
{
dir.Delete(true);
}
}
else{
Console.WriteLine("No Subdirectories to Remove");
}
int fileCount = Directory.GetFiles(path).Length;
if(fileCount > 0){
System.IO.DirectoryInfo di = new DirectoryInfo(path);
foreach (FileInfo file in di.GetFiles())
{
file.Delete();
}
}
else{
Console.WriteLine("No Files to Remove");
}
}
else{
Console.WriteLine("Path Doesn't Exist {0}", path);
}
}
public static void readFromText(string pathtotext)
{
try
{ // Open the text file using a stream reader.
using (StreamReader sr = new StreamReader(pathtotext))
{
// Read the stream to a string, and write the string to the console.
string line = sr.ReadToEnd();
clearPath(line);
}
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
}
}
}
</code></pre>
<p><strong>My Problem:</strong></p>
<p>When reading from the text file, it says that the first path doesn't exist, and prints all the paths to the prompt, despite that I have no <code>Console.WriteLine()</code>. However, if I plug these same paths and call -tPath: it will work. My issue seems to be in the <code>readFromText()</code> I just can't seem to figure it out. </p>
| 0debug |
Aurora RDS instance can not be stopped : <p>I am trying Amazon Aurora instance and I can not see an option to stop it. The only options are Delete and Reboot. </p>
<p>Am I missing something. </p>
| 0debug |
uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
{
uint64_t result;
shift &= 63;
result = (uint64_t)val << shift;
env->cc_c = (result >> 32) & 1;
env->cc_n = result;
env->cc_z = result;
env->cc_v = 0;
env->cc_x = shift ? env->cc_c : env->cc_x;
return result;
}
| 1threat |
how to undo pending changes of files that are unchanged? : <p>One thing that drives me crazy with TFS is the fact that if you have a file checked out, but you made no changes to it, it still shows as a change, distracting you from real changes that you made. This is especially annoying when you use tools such as T4 to generate code, because most of the time the tool will generate the same code, but will leave the file checked out.</p>
<p>For some reason that I can't understand, Visual Studio insists in showing those as changes, and will even claim that there are conflicts if another person happened to check-in the same "changes".</p>
<p><s><a href="http://aaubry.net/undo-checkout-on-unchanged-files-tfs.html" rel="noreferrer">Fortunately, the TFS Power Tools include a command that compares checked-out files with the server version and undoes the unchanged files. I will explain how to integrate it into Visual Studio using a custom tool.</a></s></p>
<p><strong>This is unfortunately not available if you are using Visual Studio 2017!</strong></p>
<p>It used to be <a href="http://thesoftwarecondition.com/blog/2011/05/01/tfs-pending-changes-ignoring-files-which-are-identical-to-the-originals/" rel="noreferrer">very simple</a> to accomplish this with earlier versions of Visual Studio:</p>
<pre><code>tfpt uu /noget /r *
</code></pre>
<p><strong>How do we remove files from pending changes if they do not have any changes?</strong></p>
| 0debug |
How to compare recursively ignoring given fields using assertJ? : <p><code>AssertJ</code> has <code>isEqualToIgnoringGivenFields</code> and <code>isEqualToComparingFieldByFieldRecursively</code>. </p>
<p>But, there is no way I can compare two objects recursively by ignoring some fields. As per <a href="https://github.com/joel-costigliola/assertj-core/issues/698" rel="noreferrer">this</a> discussion, it must be in development.</p>
<p>How to still get my assert's return value to be compared recursively but ignoring some fields. Is it possible in any other library or can I do it somehow using <code>AssertJ</code>?</p>
| 0debug |
What's wrong with my Webpack config? : <p>I started to use Webpack for a student project, but I'm stuck configuring Webpack to include React and Babel. Here's my node packages :</p>
<pre><code>+-- babel-core@6.18.0
+-- babel-loader@6.2.5
+-- babel-polyfill@6.16.0
+-- babel-preset-es2015@6.18.0
+-- react@15.3.2
+-- react-dom@15.3.2
`-- webpack@1.13.2
</code></pre>
<p>... And m'y webpack config file :</p>
<pre><code>module.exports = {
entry: ['babel-polyfill', './src/index.jsx'],
output: {
path: './build',
filename: 'app.bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
}
]
}
};
</code></pre>
<p>But the <code>webpack</code> command show me this error :</p>
<pre><code>ERROR in ./src/index.jsx
Module build failed: ReferenceError: [BABEL] C:\wamp\www\tripfighter\src\index.jsx: Unknown option: C:\wamp\www\tripfighter\node_modules\react\react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: ['pluginName', {option: value}] }`
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. (While processing preset: "C:\\wamp\\www\\tripfighter\\node_modules\\react\\react.js")
at Logger.error (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\logger.js:41:11)
at OptionManager.mergeOptions (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:221:20)
at C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:260:14
at C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:329:22
at Array.map (native)
at OptionManager.resolvePresets (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:270:20)
at OptionManager.mergePresets (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:259:10)
at OptionManager.mergeOptions (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:244:14)
at OptionManager.init (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\options\option-manager.js:374:12)
at File.initOptions (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\index.js:216:65)
at new File (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\file\index.js:139:24)
at Pipeline.transform (C:\wamp\www\tripfighter\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (C:\wamp\www\tripfighter\node_modules\babel-loader\index.js:38:20)
at Object.module.exports (C:\wamp\www\tripfighter\node_modules\babel-loader\index.js:131:12)
@ multi main
</code></pre>
<p>(There is my sample index.jsx file)</p>
<pre><code>import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
import cats from './cats.js';
console.log(cats);
</code></pre>
<p>So the problem seems to come from my webpack.config.js, but I don't know why, despite having searched from many examples on the web.
Can you help me ? Thanks !</p>
| 0debug |
How to create an array object in the main method in java? : <p>I've just started Java this semester and I'm very new to it. I'm struggling to get an array method to print out anything through my main method. The example given below is from the notes, except for the info in the main method which I added, but I cannot get it to print anything through the main method since it gives me an error every time I try to compile it. </p>
<p>This is the array method example that was given:</p>
<pre><code>import java.util.*;
</code></pre>
<p>import java.text.*;
public class ArrayDemo
{</p>
<pre><code>private static Random rng = new Random();
private static DecimalFormat format =new DecimalFormat();
static{
format.setMaximumFractionDigits(4);
}
public static void main(String [] args){
int num1 = 5;
arrayDemo(num1);
}
public void arrayDemo(int n){
double [] a = new double[n];
double [] c = {42, -99.9999, rng.nextGaussian() * 50};
for (int i = 0; i < a.length; i++){
a [i] = rng.nextDouble();
}
double sum = 0;
for (int i =0; i< a.length; i++){
sum += a[i];
}
System.out.println("The values add up to" + format.format(sum));
System.out.println("The elements are:" + Arrays.toString(a));
}
}
</code></pre>
<p>The error that I keep getting is "non static method arrayDemo(int n) cannot be referenced from a static context.".</p>
<p>I've searched up many tutorials on arrays but I still cannot figure out why I keep getting this error. Any help will be greatly appreciated.</p>
| 0debug |
Install ONLY mongo shell, not mongodb : <p>As mentioned above, I need to install only the mongo shell on a RHEL instance (machine A).
I have a mongodb server on a separate instance (machine B) and need to connect to that from A to run <code>mongodump</code> and <code>mongorestore</code> commands.</p>
<p>I tried looking it up on the web but all I got was instructions to install the complete mongodb package.</p>
<p>Any help appreciated.</p>
| 0debug |
static void ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
{
int i;
assert(rc->type == 2);
rc->maxes = av_mallocz(sizeof(float[2]) * rc->classifications);
for (i = 0; i < rc->classifications; i++) {
int j;
vorbis_enc_codebook * cb;
for (j = 0; j < 8; j++)
if (rc->books[i][j] != -1)
break;
if (j == 8)
continue;
cb = &venc->codebooks[rc->books[i][j]];
assert(cb->ndimentions >= 2);
assert(cb->lookup);
for (j = 0; j < cb->nentries; j++) {
float a;
if (!cb->lens[j])
continue;
a = fabs(cb->dimentions[j * cb->ndimentions]);
if (a > rc->maxes[i][0])
rc->maxes[i][0] = a;
a = fabs(cb->dimentions[j * cb->ndimentions + 1]);
if (a > rc->maxes[i][1])
rc->maxes[i][1] = a;
}
}
for (i = 0; i < rc->classifications; i++) {
rc->maxes[i][0] += 0.8;
rc->maxes[i][1] += 0.8;
}
}
| 1threat |
PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index,
const char *busname)
{
DeviceState *dev;
dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE);
qdev_prop_set_uint32(dev, "index", index);
qdev_prop_set_string(dev, "busname", busname);
qdev_init_nofail(dev);
return PCI_HOST_BRIDGE(dev);
}
| 1threat |
Best way to send HTTP requests in an ASP.NET webforms project c# : <p>Hey guys im a newbie working with HTTP requests in C#/.Net and would love some tips and suggestions of the correct namespaces or classes that would make doing HTTP requests easier. GET,POST,.etc
Ive come across a few such as the HTTPrequest class, and also the HTTP.WebRequest but im lost as to which to actually use and any advice would be welcome!</p>
| 0debug |
what is the difference between ruby hash construction with => and :? : What is the difference between the below two examples?
I am confused with this
a = {'a' : 'b'}
a = {'a' => 'b'} | 0debug |
VBA - Print function selecting wrong Type of Change option : I have code below for a print function created in VBA. When I select Return from leave under the drop down of the Type of Change field and print, it prints as a salary change type, not return from leave. I cant see where I went wrong in my code or what is causing the issue... Any thoughts? Thanks in advance![![][1]][1]
Sub pcf_print()
Dim ws As Worksheet
Dim datasheet As Worksheet
Dim fs As Object
Dim str As String
Dim bool As Boolean
If Len(ActiveSheet.Name) < 3 Then
MsgBox "This worksheet is not a PCF"
Exit Sub
End If
If Left(ActiveSheet.Name, 3) <> "PCF" Then
MsgBox "This worksheet is not a PCF"
Exit Sub
End If
'MsgBox Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v")) 'Right(ActiveSheet.Name, 4)
If InStr(ActiveSheet.Name, " vv") Then
If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then
MsgBox "This form has not been completed"
Exit Sub
End If
Else
If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) < 1.2 And (ActiveSheet.Range("F9") = "(select)" Or ActiveSheet.Range("F9") = "")) Or (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then
MsgBox "This form has not been completed"
Exit Sub
End If
End If
Set datasheet = ActiveSheet
If ActiveWorkbook.Worksheets("Form Lists").Range("CorpOrStore") = "Corp" Then
str = "Corporate"
Else
str = "Stores"
End If
Set fs = CreateObject("Scripting.FileSystemObject")
bool = fs.FolderExists("H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\")
If Not bool Then
MkDir "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\"
End If
If InStr(ActiveSheet.Name, " vv") Then
If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 Then
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls"
End If
Else
If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 Then
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls"
Else
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & datasheet.Range("F9") & " for " & datasheet.Range("J16") & ", " & datasheet.Range("F16") & " effective " & Month(datasheet.Range("F11")) & "-" & Day(datasheet.Range("F11")) & "-" & Year(datasheet.Range("F11")) & ".xls"
End If
End If
Set ws = ActiveWorkbook.Worksheets("Payroll Forms")
If Right(ActiveSheet.Name, 5) = "v1.20" Then
ActiveWorkbook.Worksheets("Form Lists").Unprotect "0nl1n3"
ActiveWorkbook.Worksheets("Form Lists").Range("B8") = "A1:G76"
ActiveWorkbook.Worksheets("Form Lists").Range("B9") = "A80:G157"
ActiveWorkbook.Worksheets("Form Lists").Range("B10") = "A160:G225"
ActiveWorkbook.Worksheets("Form Lists").Range("B11") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B12") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B13") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B14") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B15") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B16") = "A343:G367"
ActiveWorkbook.Worksheets("Form Lists").Range("B17") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B18") = "A160:G225"
ActiveWorkbook.Worksheets("Form Lists").Range("B19") = "A370:G420"
ActiveWorkbook.Worksheets("Form Lists").Protect "0nl1n3"
End If
If Right(ActiveSheet.Name, 5) = "v1.20" Or Right(ActiveSheet.Name, 5) = "v1.21" Or str = "Corporate" Then
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("H2")
Else
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2")
End If
ActiveWorkbook.Unprotect "0nl1n3"
ws.Visible = xlSheetVisible
ws.PrintOut
ws.Visible = xlSheetHidden
ActiveWorkbook.Protect "0nl1n3"
ActiveWorkbook.Close False
End Sub
[1]: https://i.stack.imgur.com/iFZbg.png | 0debug |
How to create a nested resolver in apollo graphql server : <p>Given the following apollo server graphql schema
I wanted to break these down into separate modules so I don't want the author query under the root Query schema.. and want it separated. So i added another layer called authorQueries before adding it to the Root Query</p>
<pre><code>type Author {
id: Int,
firstName: String,
lastName: String
}
type authorQueries {
author(firstName: String, lastName: String): Author
}
type Query {
authorQueries: authorQueries
}
schema {
query: Query
}
</code></pre>
<p>I tried the following.. you can see that authorQueries was added as another layer before the author function is specified.</p>
<pre><code>Query: {
authorQueries :{
author (root, args) {
return {}
}
}
}
</code></pre>
<p>When querying in Graphiql, I also added that extra layer.. </p>
<pre><code>{
authorQueries {
author(firstName: "Stephen") {
id
}
}
}
</code></pre>
<p>I get the following error.</p>
<p><code>"message": "Resolve function for \"Query.authorQueries\" returned undefined",</code></p>
| 0debug |
Batch File Code Won't Work :( : Can anyone tell me why this code doesn't run?
Code:
@echo
color 0F
mode con: cols=51 lines=18
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |
echo _____________
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. |||||||||||||||||||||||
echo =============
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo Initializing.
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||||
echo =============
ping localhost -n 2 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo COMPLETE
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||||
echo =============
ping localhost -n 2 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||||
echo =============
ping localhost -n 2 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||||
echo
ping localhost -n 2 >nul
cls
echo.
echo.
echo.
echo.
echo.
echo =============
echo COMPLETE
echo =============
echo.
echo _____________
echo. ||||||||||||||||||||||||
echo =============
cls | 0debug |
How To Secure My Api Used For Customer Login Without Making It Vulnerable To Others : <p>I am very new to development with angularjs.
I am creating a user login system using angularjs.
I created a user login system using angularjs using json data.
But using my api link in controllers is vulnerable to anyone who is inside the source code to my login page.</p>
<p>I want to secure my api to be unvulnerable to anyone. Using the source code can help anyone to see all the users to my platform. Also if I am hashing the password then also some techy might decode the password.</p>
<p>Please help me with angular or json to secure my login platform.</p>
| 0debug |
NetFramework app referencing NetFramework library in same solution referencing NetStandard library in another soln.: could not load file or assembly : <p>There are many similar questions about problems referencing a .NET Standard class library from a .NET Framework project where a NuGet package dependency in the netstandard library doesn't flow to the netframework app, and the <code>Could not load file or assembly</code> error occurs at runtime:</p>
<p><a href="https://i.stack.imgur.com/lUGdX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lUGdX.png" alt="enter image description here"></a></p>
<p>Many sources exist, like the one below, that indicate this can be resolved by adding the missing dependency on the netframework project:</p>
<ul>
<li><a href="https://stackoverflow.com/a/46015829/2704659">https://stackoverflow.com/a/46015829/2704659</a></li>
</ul>
<p>This is unfavorable, however, because I don't want to have projects have to carry around direct references that they shouldn't require; the dependencies should flow naturally so future added/removed dependencies just work.</p>
<p>Other sources indicate that it can be resolved by adding <code><RestoreProjectStyle>PackageReference</RestoreProjectStyle></code> and <code><AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects></code> to the netframework project file:</p>
<ul>
<li><a href="https://stackoverflow.com/a/53654690/2704659">https://stackoverflow.com/a/53654690/2704659</a></li>
<li><a href="https://stackoverflow.com/a/53732075/2704659">https://stackoverflow.com/a/53732075/2704659</a></li>
<li><a href="https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx" rel="noreferrer">https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx</a></li>
</ul>
<p>I've tested both of the above fixes with projects <em>that reside within the same Visual Studio solution</em> and had success, but I prefer the second approach because it's a "set it and forget it" solution. </p>
<p>The problem I've found is when I try to reference a netstandard class library from a netframework project <em>in another VS solution</em> and I use the <code><RestoreProjectStyle>PackageReference</RestoreProjectStyle></code> and <code><AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects></code>approach in the latter project. In my specific case, I have a .NET Framework executable project that references a .NET Framework class library in the same solution, and that class library references a .NET Standard class library in another solution.</p>
<p>I've created <a href="https://github.com/roryap/Multi-Solution-NetStandard-from-NetFramework-Dependency-Issue" rel="noreferrer">an MCVE on GitHub that demonstrates this behavior</a>. I'm using VS 2017 v15.9.4.</p>
<p>Other than always adding the packages directly on the netframework project, is there a way to get this working?</p>
<hr>
<p>(Note: it sounds similar to the problem here, but I'm not using "click once": <a href="https://stackoverflow.com/a/47839628/2704659">https://stackoverflow.com/a/47839628/2704659</a>)</p>
| 0debug |
Displaying error message : How to display error messgae using javascript or jquery only when both the feilds are empty. For example a user can either enter Zipcode or select a state from dropdown. If the user doesnot select any one of those then the error should be displayed. | 0debug |
How to disable eslint rule max line length for paragraph in <template> of vue.js? : <p>I am using airbnb eslint and currently I am getting error:</p>
<blockquote>
<p>error: Line 6 exceeds the maximum line length of 100 (max-len) at
path/to/file.vue:6:1:</p>
</blockquote>
<pre><code><template lang="pug">
div
.container
.row
.col-xl-10.mx-auto
p Please let us know how you got here, and use the header buttons to navigate back to safe harbor.
</template>
</code></pre>
<p>Is there a way to disable lint for paragraph text like above?<br>
Also, how to increase the line length from 100 to 120?</p>
| 0debug |
For loop only runs once c++ : <p>Hi im trying to run the drunk walk problem which is similar to flipping a coin. I have the code written but it only enters the for loop once instead of 1,000,000 times like I want it to. I cant see what I did wrong so I hope you all can point me in the right direction, Thank you.</p>
<pre><code> cout << "enter the starting position.\n";
cin >> i;
cout << "At starting block " << i << endl;
for(j = 1; j < 1000000; j++)
{
while(i < 8 && i > 1)
{
x = rand() % 3;
if(x == 0)
{
i++;
tot_mov++;
}
else
{
i--;
tot_mov++;
}
}
if(i == 1)
{
tot_pub++;
}
if(i == 8)
{
tot_hom++;
}
}
avg_mov = tot_mov / 1000000;
avg_pub = tot_pub / 1000000;
avg_hom = tot_hom / 1000000;
cout << "Total moves " << tot_mov << endl;
cout << "Average moves " << avg_mov << endl;
cout << "Total Home " << tot_hom << endl;
cout << "Average home " << avg_hom << endl;
cout << "Total pub " << tot_pub << endl;
cout << "Average pub " << avg_pub << endl;
return;
</code></pre>
| 0debug |
PHP - No result when using prepared statements : So I want create a simple select with prepared statements but as result I just get NULL :( When I do it without prepared statements everything is working fine.
<?php
class DbHandler{
public function select($columns, $table_name, $alias, $where, $order){
//echo(phpinfo());
$db = new mysqli("localhost", "root", "", "superhelden");
if(!$db){
exit("Verbindungsfehler: ".mysqli_connect_error());
}
if(empty($columns)){
$columns = "*";
trigger_error("No columns chosen. Value set to *.", E_USER_WARNING);
} else{
$prepColumns = $columns;
}
if(empty($table_name)){
trigger_error("Tablename must not be empty.", E_USER_ERROR);
}
if(empty($where)){
trigger_error("WHERE is empty so no conditions are set. All entries will be selected.", E_USER_WARNING);
}
//I don't know why but I can't use a param for the tablename
$query = "SELECT ? FROM $table_name";
if(!empty($alias)){
$query .= " AS ?";
}
if(!empty($where)){
$query .= " WHERE ?";
}
//This is working..
$query1 = "SELECT name FROM karten WHERE name='Fausthieb'";
$res = $db->query($query1);
while($row = $res->fetch_assoc()){
echo($row["name"] . "<br>");
}
//.... :(
if(empty($order)){
//Show created query
echo("$query || ");
if($prep = $db->prepare($query)){
if(!empty($alias)){
if(!empty($where)){
$prep->bind_param("sss", $prepColumns, $alias, $where);
} else{
$prep->bind_param("ss", $prepColumns, $alias);
}
} else if(!empty($where)){
//Show params of function
echo("columns: $prepColumns || ");
echo("Where: $where || ");
$prep->bind_param("ss", $prepColumns, $where);
} else {
$prep->bind_param("s", $prepColumns);
}
// print_r($prep->result_metadata());
// echo(var_dump($prep));
$prep->execute();
var_dump($prep->error);
echo(" || ");
$prep->bind_result($result);
$prep->fetch();
echo(gettype($result));
$prep->close();
}else{
var_dump($db->error);
}
} else {
$query .= " ORDER BY ?";
if($prep = $db->prepare($query)){
if(!empty($alias)){
if(!empty($where)){
$prep->bind_param("ssss", $prepColumns, $alias, $where, $order);
} else{
$prep->bind_param("sss", $prepColumns, $alias, $order);
}
} else if(!empty($where)){
$prep->bind_param("sss", $prepColumns, $where, $order);
} else {
$prep->bind_param("ss", $prepColumns, $order);
}
$prep->execute();
$prep->bind_result($result);
$prep->fetch();
echo($result);
$prep->close();
}else{
var_dump($db->error);
}
}
}
}
?>
This code is calling my select function:
<?php
include("DbHandler_dominic.php");
$test = new DbHandler();
$test->select("name", "karten", "", "name='Fausthieb'", "");
?>
And then I got this one which works just fine.
<?php
include("dbconnect.php");
$pepper = "KratzigeStirn?!";
$username = $_POST["username"];
$prep = $db->prepare("SELECT name FROM spieler WHERE name=?");
$prep->bind_param("s", $username);
$prep->execute();
$prep->bind_result($user);
$prep->fetch();
$prep->close();
$email = $_POST["email"];
$prep = $db->prepare("SELECT email FROM spieler WHERE email=?");
$prep->bind_param("s", $email);
$prep->execute();
$prep->bind_result($mail);
$prep->fetch();
$prep->close();
if($user == "" && $mail == ""){
$password = password_hash($_POST["password"].$pepper, PASSWORD_BCRYPT);
$prep = $db->prepare("INSERT INTO spieler(name, passwort, email) VALUES(?, ?, ?)");
$prep->bind_param("sss", $username, $password, $email);
$prep->execute();
$prep->close();
} else if($user == $username){
echo "Benutzer existiert schon..";
} else if($mail == $email){
echo "E-Mail bereits vergeben..";
}
$db->close();
?>
What's the difference? And what can I do that the SELECT is working :/
My DB Diagram and Table properties:
[DB relationdiagram][1]
[Table properties][2]
If I forget any needed information just tell me and I'll add if possible :)
[1]: https://i.stack.imgur.com/fM1AP.png
[2]: https://i.stack.imgur.com/dcmCa.png | 0debug |
int ff_dxva2_decode_init(AVCodecContext *avctx)
{
FFDXVASharedContext *sctx = DXVA_SHARED_CONTEXT(avctx);
AVHWFramesContext *frames_ctx = NULL;
int ret = 0;
if (avctx->hwaccel_context)
return 0;
sctx->pix_fmt = avctx->hwaccel->pix_fmt;
if (avctx->codec_id == AV_CODEC_ID_H264 &&
(avctx->profile & ~FF_PROFILE_H264_CONSTRAINED) > FF_PROFILE_H264_HIGH) {
av_log(avctx, AV_LOG_VERBOSE, "Unsupported H.264 profile for DXVA HWAccel: %d\n",avctx->profile);
return AVERROR(ENOTSUP);
}
if (avctx->codec_id == AV_CODEC_ID_HEVC &&
avctx->profile != FF_PROFILE_HEVC_MAIN && avctx->profile != FF_PROFILE_HEVC_MAIN_10) {
av_log(avctx, AV_LOG_VERBOSE, "Unsupported HEVC profile for DXVA HWAccel: %d\n", avctx->profile);
return AVERROR(ENOTSUP);
}
if (!avctx->hw_frames_ctx && !avctx->hw_device_ctx) {
av_log(avctx, AV_LOG_ERROR, "Either a hw_frames_ctx or a hw_device_ctx needs to be set for hardware decoding.\n");
return AVERROR(EINVAL);
}
if (avctx->hw_frames_ctx) {
frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
} else {
avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx);
if (!avctx->hw_frames_ctx)
return AVERROR(ENOMEM);
frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
dxva_adjust_hwframes(avctx, frames_ctx);
ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
if (ret < 0)
goto fail;
}
sctx->device_ctx = frames_ctx->device_ctx;
if (frames_ctx->format != sctx->pix_fmt ||
!((sctx->pix_fmt == AV_PIX_FMT_D3D11 && CONFIG_D3D11VA) ||
(sctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && CONFIG_DXVA2))) {
av_log(avctx, AV_LOG_ERROR, "Invalid pixfmt for hwaccel!\n");
ret = AVERROR(EINVAL);
goto fail;
}
#if CONFIG_D3D11VA
if (sctx->pix_fmt == AV_PIX_FMT_D3D11) {
AVD3D11VADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx;
AVD3D11VAContext *d3d11_ctx = &sctx->ctx.d3d11va;
HRESULT hr;
ff_dxva2_lock(avctx);
ret = d3d11va_create_decoder(avctx);
ff_dxva2_unlock(avctx);
if (ret < 0)
goto fail;
d3d11_ctx->decoder = sctx->d3d11_decoder;
d3d11_ctx->video_context = device_hwctx->video_context;
d3d11_ctx->cfg = &sctx->d3d11_config;
d3d11_ctx->surface_count = sctx->nb_d3d11_views;
d3d11_ctx->surface = sctx->d3d11_views;
d3d11_ctx->workaround = sctx->workaround;
d3d11_ctx->context_mutex = INVALID_HANDLE_VALUE;
}
#endif
#if CONFIG_DXVA2
if (sctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
AVDXVA2FramesContext *frames_hwctx = frames_ctx->hwctx;
struct dxva_context *dxva_ctx = &sctx->ctx.dxva2;
ff_dxva2_lock(avctx);
ret = dxva2_create_decoder(avctx);
ff_dxva2_unlock(avctx);
if (ret < 0)
goto fail;
dxva_ctx->decoder = sctx->dxva2_decoder;
dxva_ctx->cfg = &sctx->dxva2_config;
dxva_ctx->surface = frames_hwctx->surfaces;
dxva_ctx->surface_count = frames_hwctx->nb_surfaces;
dxva_ctx->workaround = sctx->workaround;
}
#endif
return 0;
fail:
ff_dxva2_decode_uninit(avctx);
return ret;
}
| 1threat |
create a loop to check file.conf for content that could be in file or yet to be and exit only when content found : #!/bin/bash
cd /root/.OceanVieW
KEY= cat ocean.conf |grep "GreatSea" |cut -d "=" -f2
until [ `echo $key|wc -m` -gt 1 ]; do sleep 5 ; done
| 0debug |
How to get json date with jquery? : I try to get date with json format via jquery.I use this code :
new Date(parseInt(data[i].DepartureDateTime.substr(6)))
and get me this date :
Sun Apr 26 1970 02:58:20 GMT+0430 (Iran Standard Time)
But I want get date such as `4/6/2016 12:45:00 PM`.
How to do this? | 0debug |
While retreiving the data from mysql through php(while loop) it retrieves one extra row which is NOT present in database. Why? : <?php
$con = mysqli_connect('mysql.host.in','user','pass','db');
$sql = $con->query("SELECT * FROM info");
while($row = $sql->fetch_array()){
$image = $row['image_path'];
$caption = $row['caption'];
$id = $row['id'];
?>
<div class="col-md-4">
<div class="thumbnail">
<img src=<?php echo $image;?>>
<div class="caption text-center"><h3><?php echo $caption;?></h3></div>
<button class="btn btn-default" onclick="modal(<?php echo $id;?>)">View</button>
</div>
</div><!-- Column END -->
<?php
}
?>
| 0debug |
static void libschroedinger_free_frame(void *data)
{
FFSchroEncodedFrame *enc_frame = data;
av_freep(&enc_frame->p_encbuf);
av_free(enc_frame);
}
| 1threat |
static void rtl8139_write_buffer(RTL8139State *s, const void *buf, int size)
{
if (s->RxBufAddr + size > s->RxBufferSize)
{
int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize);
if (wrapped && s->RxBufferSize < 65536 && !rtl8139_RxWrap(s))
{
DEBUG_PRINT((">>> RTL8139: rx packet wrapped in buffer at %d\n", size-wrapped));
if (size > wrapped)
{
cpu_physical_memory_write( s->RxBuf + s->RxBufAddr,
buf, size-wrapped );
}
s->RxBufAddr = 0;
cpu_physical_memory_write( s->RxBuf + s->RxBufAddr,
buf + (size-wrapped), wrapped );
s->RxBufAddr = wrapped;
return;
}
}
cpu_physical_memory_write( s->RxBuf + s->RxBufAddr, buf, size );
s->RxBufAddr += size;
}
| 1threat |
Select all text between quotes, parentheses etc in Atom.io : <p>Sublime Text has this same functionality via:</p>
<p><code>ctrl+shift+m</code> or <code>cmd+shift+space</code></p>
<p>How do I accomplish the same thing in Atom?</p>
| 0debug |
static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
{
char *filename;
MemoryRegion *bios, *isa_bios;
int bios_size, isa_bios_size;
int ret;
if (bios_name == NULL) {
bios_name = BIOS_FILENAME;
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = get_image_size(filename);
} else {
bios_size = -1;
}
if (bios_size <= 0 ||
(bios_size % 65536) != 0) {
goto bios_error;
}
bios = g_malloc(sizeof(*bios));
memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_abort);
vmstate_register_ram_global(bios);
if (!isapc_ram_fw) {
memory_region_set_readonly(bios, true);
}
ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
if (ret != 0) {
bios_error:
fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
exit(1);
}
g_free(filename);
isa_bios_size = bios_size;
if (isa_bios_size > (128 * 1024)) {
isa_bios_size = 128 * 1024;
}
isa_bios = g_malloc(sizeof(*isa_bios));
memory_region_init_alias(isa_bios, NULL, "isa-bios", bios,
bios_size - isa_bios_size, isa_bios_size);
memory_region_add_subregion_overlap(rom_memory,
0x100000 - isa_bios_size,
isa_bios,
1);
if (!isapc_ram_fw) {
memory_region_set_readonly(isa_bios, true);
}
memory_region_add_subregion(rom_memory,
(uint32_t)(-bios_size),
bios);
}
| 1threat |
static av_cold int flic_decode_init(AVCodecContext *avctx)
{
FlicDecodeContext *s = avctx->priv_data;
unsigned char *fli_header = (unsigned char *)avctx->extradata;
int depth;
if (avctx->extradata_size != 0 &&
avctx->extradata_size != 12 &&
avctx->extradata_size != 128 &&
avctx->extradata_size != 1024) {
av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12, 128 or 1024 bytes\n");
return AVERROR_INVALIDDATA;
}
s->avctx = avctx;
if (s->avctx->extradata_size == 12) {
s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
depth = 8;
} else if (avctx->extradata_size == 1024) {
uint8_t *ptr = avctx->extradata;
int i;
for (i = 0; i < 256; i++) {
s->palette[i] = AV_RL32(ptr);
ptr += 4;
}
depth = 8;
} else if (avctx->extradata_size == 0) {
s->fli_type = FLI_TYPE_CODE;
depth = 8;
} else {
s->fli_type = AV_RL16(&fli_header[4]);
depth = AV_RL16(&fli_header[12]);
}
if (depth == 0) {
depth = 8;
}
if ((s->fli_type == FLC_FLX_TYPE_CODE) && (depth == 16)) {
depth = 15;
}
switch (depth) {
case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;
case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
case 24 : avctx->pix_fmt = PIX_FMT_BGR24;
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
default :
av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
return -1;
}
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL;
s->new_palette = 0;
return 0;
}
| 1threat |
static void dec_mul(DisasContext *dc)
{
if (dc->format == OP_FMT_RI) {
LOG_DIS("muli r%d, r%d, %d\n", dc->r0, dc->r1,
sign_extend(dc->imm16, 16));
} else {
LOG_DIS("mul r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1);
}
if (!(dc->env->features & LM32_FEATURE_MULTIPLY)) {
cpu_abort(dc->env, "hardware multiplier is not available\n");
}
if (dc->format == OP_FMT_RI) {
tcg_gen_muli_tl(cpu_R[dc->r1], cpu_R[dc->r0],
sign_extend(dc->imm16, 16));
} else {
tcg_gen_mul_tl(cpu_R[dc->r2], cpu_R[dc->r0], cpu_R[dc->r1]);
}
}
| 1threat |
document.getElementById('input').innerHTML = user_input; | 1threat |
apollo-link-state cache.writedata results in Missing field warning : <p>When I call a mutation on my client I get the following warning:</p>
<blockquote>
<p>writeToStore.js:111 Missing field updateLocale in {}</p>
</blockquote>
<p>This is my stateLink:</p>
<pre><code>const stateLink = withClientState({
cache,
resolvers: {
Mutation: {
updateLocale: (root, { locale }, context) => {
context.cache.writeData({
data: {
language: {
__typename: 'Language',
locale,
},
},
});
},
},
},
defaults: {
language: {
__typename: 'Language',
locale: 'nl',
},
},
});
</code></pre>
<p>And this is my component:</p>
<pre><code>export default graphql(gql`
mutation updateLocale($locale: String) {
updateLocale(locale: $locale) @client
}
`, {
props: ({ mutate }) => ({
updateLocale: locale => mutate({
variables: { locale },
}),
}),
})(LanguagePicker);
</code></pre>
<p>What am I missing?</p>
| 0debug |
Whats NDK (side-by-side) in android sdk? : <p>There's a ndk (side-by-side) at <a href="https://i.stack.imgur.com/UO8KE.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/UO8KE.jpg" alt="the sdk manager"></a>.
Is it needed to install or just need to install the ndk? </p>
| 0debug |
static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
bool last_stage)
{
int pages = -1;
uint64_t bytes_xmit = 0;
uint8_t *p;
int ret, blen;
RAMBlock *block = pss->block;
ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
p = block->host + offset;
ret = ram_control_save_page(rs->f, block->offset,
offset, TARGET_PAGE_SIZE, &bytes_xmit);
if (bytes_xmit) {
rs->bytes_transferred += bytes_xmit;
pages = 1;
}
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
if (ret != RAM_SAVE_CONTROL_DELAYED) {
if (bytes_xmit > 0) {
rs->norm_pages++;
} else if (bytes_xmit == 0) {
rs->zero_pages++;
}
}
} else {
if (block != rs->last_sent_block) {
flush_compressed_data(rs);
pages = save_zero_page(rs, block, offset, p);
if (pages == -1) {
bytes_xmit = save_page_header(rs, block, offset |
RAM_SAVE_FLAG_COMPRESS_PAGE);
blen = qemu_put_compression_data(rs->f, p, TARGET_PAGE_SIZE,
migrate_compress_level());
if (blen > 0) {
rs->bytes_transferred += bytes_xmit + blen;
rs->norm_pages++;
pages = 1;
} else {
qemu_file_set_error(rs->f, blen);
error_report("compressed data failed!");
}
}
if (pages > 0) {
ram_release_pages(block->idstr, offset, pages);
}
} else {
pages = save_zero_page(rs, block, offset, p);
if (pages == -1) {
pages = compress_page_with_multi_thread(rs, block, offset);
} else {
ram_release_pages(block->idstr, offset, pages);
}
}
}
return pages;
}
| 1threat |
Monospace tabular numbers in Android TextViews : <p>I have a custom font which has variable-width numeric glyphs by default, and I would like to use the font's monospace tabular numbers feature in an Android <code>TextView</code> so that numbers align vertically.</p>
<p>That is, change something like this:</p>
<p><a href="https://i.stack.imgur.com/gy2KA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gy2KA.png" alt=""></a></p>
<p>to something like this:</p>
<p><a href="https://i.stack.imgur.com/HWCQ9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HWCQ9.png" alt=""></a></p>
| 0debug |
int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan)
{
TAPState *s;
int fd, vnet_hdr;
if (!qemu_opt_get(opts, "br")) {
qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE);
}
if (!qemu_opt_get(opts, "helper")) {
qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER);
}
fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"),
qemu_opt_get(opts, "br"));
if (fd == -1) {
return -1;
}
fcntl(fd, F_SETFL, O_NONBLOCK);
vnet_hdr = tap_probe_vnet_hdr(fd);
s = net_tap_fd_init(vlan, "bridge", name, fd, vnet_hdr);
if (!s) {
close(fd);
return -1;
}
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s",
qemu_opt_get(opts, "helper"), qemu_opt_get(opts, "br"));
return 0;
}
| 1threat |
static void xenfb_handle_events(struct XenFB *xenfb)
{
uint32_t prod, cons, out_cons;
struct xenfb_page *page = xenfb->c.page;
prod = page->out_prod;
out_cons = page->out_cons;
if (prod - out_cons >= XENFB_OUT_RING_LEN) {
return;
}
xen_rmb();
for (cons = out_cons; cons != prod; cons++) {
union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons);
uint8_t type = event->type;
int x, y, w, h;
switch (type) {
case XENFB_TYPE_UPDATE:
if (xenfb->up_count == UP_QUEUE)
xenfb->up_fullscreen = 1;
if (xenfb->up_fullscreen)
break;
x = MAX(event->update.x, 0);
y = MAX(event->update.y, 0);
w = MIN(event->update.width, xenfb->width - x);
h = MIN(event->update.height, xenfb->height - y);
if (w < 0 || h < 0) {
xen_be_printf(&xenfb->c.xendev, 1, "bogus update ignored\n");
break;
}
if (x != event->update.x ||
y != event->update.y ||
w != event->update.width ||
h != event->update.height) {
xen_be_printf(&xenfb->c.xendev, 1, "bogus update clipped\n");
}
if (w == xenfb->width && h > xenfb->height / 2) {
xenfb->up_fullscreen = 1;
} else {
xenfb->up_rects[xenfb->up_count].x = x;
xenfb->up_rects[xenfb->up_count].y = y;
xenfb->up_rects[xenfb->up_count].w = w;
xenfb->up_rects[xenfb->up_count].h = h;
xenfb->up_count++;
}
break;
#ifdef XENFB_TYPE_RESIZE
case XENFB_TYPE_RESIZE:
if (xenfb_configure_fb(xenfb, xenfb->fb_len,
event->resize.width,
event->resize.height,
event->resize.depth,
xenfb->fb_len,
event->resize.offset,
event->resize.stride) < 0)
break;
xenfb_invalidate(xenfb);
break;
#endif
}
}
xen_mb();
page->out_cons = cons;
}
| 1threat |
static uint64_t pmsav5_insn_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
{
return simple_mpu_ap_bits(env->cp15.c5_insn);
}
| 1threat |
Please help!! forever grateful to the universe with traffic light code : **I LOVE YOU** Below is my code... it works perfectly fine but...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<img id="trafficlights" src="Redlight.jpeg" style="width:128px;height:128px;">
<button type="button" onclick="changetrafficlights()">Change Traffic Lights</button>
<script>
var position = 0;
var list = ["Redlight.jpeg","RedAmberlight.jpeg","Greenlight.jpeg", "Amberlight.jpeg"];
function changetrafficlights()
{position = position + 1;
if(position == list.length){
position = 0;
}
var image = document.getElementById('trafficlights');
image.src=list[position];}
</script>
</body>
</html>
**hey, im trying to make a javascript code in which will use a while loop or for loop in which will go through the variable "list" automatically... please help!!!!!**
| 0debug |
void qmp_memchar_write(const char *device, const char *data,
bool has_format, enum DataFormat format,
Error **errp)
{
CharDriverState *chr;
const uint8_t *write_data;
int ret;
size_t write_count;
chr = qemu_chr_find(device);
if (!chr) {
error_setg(errp, "Device '%s' not found", device);
return;
if (qemu_is_chr(chr, "memory")) {
error_setg(errp,"%s is not memory char device", device);
return;
if (has_format && (format == DATA_FORMAT_BASE64)) {
write_data = g_base64_decode(data, &write_count);
} else {
write_data = (uint8_t *)data;
write_count = strlen(data);
ret = cirmem_chr_write(chr, write_data, write_count);
if (ret < 0) {
error_setg(errp, "Failed to write to device %s", device);
return; | 1threat |
i want to pull a certian word from a line of text bash : i have a text file with the following text using bash scripting
awesomebitchesz2.0 Infra 6 54 Mbit/s 79 ▂▄▆_ WPA2
* Bourbonhouse Infra 6 130 Mbit/s 70 ▂▄▆_ WPA2
-- Infra 6 130 Mbit/s 34 ▂▄__ WPA2 802.1X
the base of the file stays the same but the first names alwasy change i want to be able to pull the name of the certain AP. for instance i want to grep Bourbonhouse it will print out bourbonhose with now white spaces
i figured to try and pull the first work before Infra as an indicator but all the solutions ive seen only pulls after the indicator. can someone either point me in the right direction or give me a demonstration. | 0debug |
Making a history quiz card from a acces database : I want to make a card set with 4 unique history objects (like: Urbanization, Pope, Knight, Feudalism) on each card (to play the board game 30 seconds with a history theme and teach my students things the need to learn in a fun way). I already have a access 2016 database with this information in it coupled with the time period each object is related to and several queries (to sort the object to time period). Problem is with a Report i got 4 times the same object on each card (using the label option within report). Maybe exporting it to a formatted word document (like this guy dose https://www.youtube.com/watch?v=JilB511V3AU) with a VB script is maybe the salution. But i dont get it to work as i like to. Mabey one of you can help me.
Thanks,
Martin | 0debug |
SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
{
SwsContext *c;
int i;
int usesVFilter, usesHFilter;
int unscaled;
int srcRange, dstRange;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if ARCH_X86
if (flags & SWS_CPU_CAPS_MMX)
__asm__ volatile("emms\n\t"::: "memory");
#endif
#if !CONFIG_RUNTIME_CPUDETECT
flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
flags |= ff_hardcodedcpuflags();
#endif
if (!rgb15to16) sws_rgb2rgb_init(flags);
unscaled = (srcW == dstW && srcH == dstH);
srcRange = handle_jpeg(&srcFormat);
dstRange = handle_jpeg(&dstFormat);
if (!isSupportedIn(srcFormat)) {
av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input pixel format\n", sws_format_name(srcFormat));
return NULL;
}
if (!isSupportedOut(dstFormat)) {
av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output pixel format\n", sws_format_name(dstFormat));
return NULL;
}
i= flags & ( SWS_POINT
|SWS_AREA
|SWS_BILINEAR
|SWS_FAST_BILINEAR
|SWS_BICUBIC
|SWS_X
|SWS_GAUSS
|SWS_LANCZOS
|SWS_SINC
|SWS_SPLINE
|SWS_BICUBLIN);
if(!i || (i & (i-1))) {
av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be chosen\n");
return NULL;
}
if (srcW<4 || srcH<1 || dstW<8 || dstH<1) {
av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",
srcW, srcH, dstW, dstH);
return NULL;
}
if(srcW > VOFW || dstW > VOFW) {
av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
return NULL;
}
if (!dstFilter) dstFilter= &dummyFilter;
if (!srcFilter) srcFilter= &dummyFilter;
FF_ALLOCZ_OR_GOTO(NULL, c, sizeof(SwsContext), fail);
c->av_class = &sws_context_class;
c->srcW= srcW;
c->srcH= srcH;
c->dstW= dstW;
c->dstH= dstH;
c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
c->flags= flags;
c->dstFormat= dstFormat;
c->srcFormat= srcFormat;
c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
c->vRounder= 4* 0x0001000100010001ULL;
usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
(srcFilter->chrV && srcFilter->chrV->length>1) ||
(dstFilter->lumV && dstFilter->lumV->length>1) ||
(dstFilter->chrV && dstFilter->chrV->length>1);
usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
(srcFilter->chrH && srcFilter->chrH->length>1) ||
(dstFilter->lumH && dstFilter->lumH->length>1) ||
(dstFilter->chrH && dstFilter->chrH->length>1);
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
c->chrSrcVSubSample+= c->vChrDrop;
if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
&& srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
&& srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
&& srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
&& ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&(SWS_FAST_BILINEAR|SWS_POINT))))
c->chrSrcHSubSample=1;
if (param) {
c->param[0] = param[0];
c->param[1] = param[1];
} else {
c->param[0] =
c->param[1] = SWS_PARAM_DEFAULT;
}
c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] , dstRange, 0, 1<<16, 1<<16);
if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isAnyRGB(dstFormat))) {
ff_get_unscaled_swscale(c);
if (c->swScale) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
return c;
}
}
if (flags & SWS_CPU_CAPS_MMX2) {
c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
}
if (usesHFilter) c->canMMX2BeUsed=0;
}
else
c->canMMX2BeUsed=0;
c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
if (flags&SWS_FAST_BILINEAR) {
if (c->canMMX2BeUsed) {
c->lumXInc+= 20;
c->chrXInc+= 20;
}
else if (flags & SWS_CPU_CAPS_MMX) {
c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
}
}
{
#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
#ifdef MAP_ANONYMOUS
c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
#elif HAVE_VIRTUALALLOC
c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
#endif
FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
#ifdef MAP_ANONYMOUS
mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
#endif
{
const int filterAlign=
(flags & SWS_CPU_CAPS_MMX) ? 4 :
(flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
1;
if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
srcW , dstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags,
srcFilter->lumH, dstFilter->lumH, c->param) < 0)
if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrH, dstFilter->chrH, c->param) < 0)
}
}
{
const int filterAlign=
(flags & SWS_CPU_CAPS_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
(flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
1;
if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
srcH , dstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags,
srcFilter->lumV, dstFilter->lumV, c->param) < 0)
if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrV, dstFilter->chrV, c->param) < 0)
#if ARCH_PPC && (HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT)
FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
int j;
short *p = (short *)&c->vYCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vLumFilter[i];
}
for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
int j;
short *p = (short *)&c->vCCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vChrFilter[i];
}
#endif
}
c->vLumBufSize= c->vLumFilterSize;
c->vChrBufSize= c->vChrFilterSize;
for (i=0; i<dstH; i++) {
int chrI= i*c->chrDstH / dstH;
int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1,
((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
nextSlice>>= c->chrSrcVSubSample;
nextSlice<<= c->chrSrcVSubSample;
if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
}
FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(c, c->chrPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], VOF+1, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
for (i=0; i<c->vChrBufSize; i++) {
FF_ALLOC_OR_GOTO(c, c->chrPixBuf[i+c->vChrBufSize], (VOF+1)*2, fail);
c->chrPixBuf[i] = c->chrPixBuf[i+c->vChrBufSize];
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], VOF+1, fail);
c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
}
for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, (VOF+1)*2);
assert(2*VOFW == VOF);
assert(c->chrDstH <= dstH);
if (flags&SWS_PRINT_INFO) {
if (flags&SWS_FAST_BILINEAR)
av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
else if (flags&SWS_BILINEAR)
av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
else if (flags&SWS_BICUBIC)
av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
else if (flags&SWS_X)
av_log(c, AV_LOG_INFO, "Experimental scaler, ");
else if (flags&SWS_POINT)
av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
else if (flags&SWS_AREA)
av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
else if (flags&SWS_BICUBLIN)
av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
else if (flags&SWS_GAUSS)
av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
else if (flags&SWS_SINC)
av_log(c, AV_LOG_INFO, "Sinc scaler, ");
else if (flags&SWS_LANCZOS)
av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
else if (flags&SWS_SPLINE)
av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
else
av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
av_log(c, AV_LOG_INFO, "from %s to %s%s ",
sws_format_name(srcFormat),
#ifdef DITHER1XBPP
dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ? "dithered " : "",
#else
"",
#endif
sws_format_name(dstFormat));
if (flags & SWS_CPU_CAPS_MMX2)
av_log(c, AV_LOG_INFO, "using MMX2\n");
else if (flags & SWS_CPU_CAPS_3DNOW)
av_log(c, AV_LOG_INFO, "using 3DNOW\n");
else if (flags & SWS_CPU_CAPS_MMX)
av_log(c, AV_LOG_INFO, "using MMX\n");
else if (flags & SWS_CPU_CAPS_ALTIVEC)
av_log(c, AV_LOG_INFO, "using AltiVec\n");
else
av_log(c, AV_LOG_INFO, "using C\n");
if (flags & SWS_CPU_CAPS_MMX) {
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
else {
if (c->hLumFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
else if (c->hLumFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
if (c->hChrFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
else if (c->hChrFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
}
} else {
#if ARCH_X86
av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
#else
if (flags & SWS_FAST_BILINEAR)
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
#endif
}
if (isPlanarYUV(dstFormat)) {
if (c->vLumFilterSize==1)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
} else {
if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
" 2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
}
if (dstFormat==PIX_FMT_BGR24)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
(flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
else if (dstFormat==PIX_FMT_RGB32)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR565)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR555)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
}
c->swScale= ff_getSwsFunc(c);
return c;
fail:
sws_freeContext(c);
return NULL;
} | 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.