problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
I am new to Unity, how to create an Cloud Recognition Application in unity? : I tried the below link
http://library.vuforia.com/articles/Solution/How-To-Implement-Cloud-Recognition-using-the-Native-SDKs As per the unity tutorial for Cloud Recognition is not Showing up the 3D model.
| 0debug
|
static void usbredir_iso_packet(void *priv, uint64_t id,
struct usb_redir_iso_packet_header *iso_packet,
uint8_t *data, int data_len)
{
USBRedirDevice *dev = priv;
uint8_t ep = iso_packet->endpoint;
DPRINTF2("iso-in status %d ep %02X len %d id %"PRIu64"\n",
iso_packet->status, ep, data_len, id);
if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_ISOC) {
ERROR("received iso packet for non iso endpoint %02X\n", ep);
free(data);
return;
}
if (dev->endpoint[EP2I(ep)].iso_started == 0) {
DPRINTF("received iso packet for non started stream ep %02X\n", ep);
free(data);
return;
}
bufp_alloc(dev, data, data_len, iso_packet->status, ep);
}
| 1threat
|
How to write Partitions to Postgres using foreachpartition (Pyspark) : I am new to Spark and trying to wite df partitions to Postgres
here is my code :
**#csv_new is a df with nearly 40 million rows and 6 coloumns**
csv_new .foreachPartition(callback)# there are 19204 partitions
def callback(iterator):
print(iterator)
# the print gives me itertools.chain object
but when Writing to db gives an error
iterator.write.option("numPartitions", count).option("batchsize",
1000000).jdbc(url=url, table="table_name", mode=mode,
properties=properties)
*AttributeError: 'itertools.chain' object has no attribute 'write'
# mode is append and properties are set
Any leads on how to to write the df partition to db
| 0debug
|
Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
unsigned long ram_size)
{
int i, n;
Exynos4210State *s = g_new(Exynos4210State, 1);
qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
unsigned long mem_size;
DeviceState *dev;
SysBusDevice *busdev;
ObjectClass *cpu_oc;
cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, "cortex-a9");
assert(cpu_oc);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
Object *cpuobj = object_new(object_class_get_name(cpu_oc));
if (object_property_find(cpuobj, "has_el3", NULL)) {
object_property_set_bool(cpuobj, false, "has_el3", &error_fatal);
}
s->cpu[n] = ARM_CPU(cpuobj);
object_property_set_int(cpuobj, EXYNOS4210_SMP_PRIVATE_BASE_ADDR,
"reset-cbar", &error_abort);
object_property_set_bool(cpuobj, true, "realized", &error_fatal);
}
s->irq_table = exynos4210_init_irq(&s->irqs);
for (i = 0; i < EXYNOS4210_NCPUS; i++) {
dev = qdev_create(NULL, "exynos4210.irq_gate");
qdev_prop_set_uint32(dev, "n_in", EXYNOS4210_IRQ_GATE_NINPUTS);
qdev_init_nofail(dev);
for (n = 0; n < EXYNOS4210_IRQ_GATE_NINPUTS; n++) {
gate_irq[i][n] = qdev_get_gpio_in(dev, n);
}
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0,
qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ));
}
dev = qdev_create(NULL, "a9mpcore_priv");
qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
sysbus_connect_irq(busdev, n, gate_irq[n][0]);
}
for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) {
s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n);
}
sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL);
dev = qdev_create(NULL, "exynos4210.gic");
qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_GIC_CPU_BASE_ADDR);
sysbus_mmio_map(busdev, 1, EXYNOS4210_EXT_GIC_DIST_BASE_ADDR);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
sysbus_connect_irq(busdev, n, gate_irq[n][1]);
}
for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) {
s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n);
}
dev = qdev_create(NULL, "exynos4210.combiner");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
sysbus_connect_irq(busdev, n, s->irqs.int_gic_irq[n]);
}
exynos4210_combiner_get_gpioin(&s->irqs, dev, 0);
sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR);
dev = qdev_create(NULL, "exynos4210.combiner");
qdev_prop_set_uint32(dev, "external", 1);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
sysbus_connect_irq(busdev, n, s->irqs.ext_gic_irq[n]);
}
exynos4210_combiner_get_gpioin(&s->irqs, dev, 1);
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
exynos4210_init_board_irqs(&s->irqs);
memory_region_init_io(&s->chipid_mem, NULL, &exynos4210_chipid_and_omr_ops,
NULL, "exynos4210.chipid", sizeof(chipid_and_omr));
memory_region_add_subregion(system_mem, EXYNOS4210_CHIPID_ADDR,
&s->chipid_mem);
memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom",
EXYNOS4210_IROM_SIZE, &error_fatal);
vmstate_register_ram_global(&s->irom_mem);
memory_region_set_readonly(&s->irom_mem, true);
memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR,
&s->irom_mem);
memory_region_init_alias(&s->irom_alias_mem, NULL, "exynos4210.irom_alias",
&s->irom_mem,
0,
EXYNOS4210_IROM_SIZE);
memory_region_set_readonly(&s->irom_alias_mem, true);
memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_ADDR,
&s->irom_alias_mem);
memory_region_init_ram(&s->iram_mem, NULL, "exynos4210.iram",
EXYNOS4210_IRAM_SIZE, &error_fatal);
vmstate_register_ram_global(&s->iram_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR,
&s->iram_mem);
mem_size = ram_size;
if (mem_size > EXYNOS4210_DRAM_MAX_SIZE) {
memory_region_init_ram(&s->dram1_mem, NULL, "exynos4210.dram1",
mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_fatal);
vmstate_register_ram_global(&s->dram1_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_DRAM1_BASE_ADDR,
&s->dram1_mem);
mem_size = EXYNOS4210_DRAM_MAX_SIZE;
}
memory_region_init_ram(&s->dram0_mem, NULL, "exynos4210.dram0", mem_size,
&error_fatal);
vmstate_register_ram_global(&s->dram0_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
&s->dram0_mem);
sysbus_create_simple("exynos4210.pmu", EXYNOS4210_PMU_BASE_ADDR, NULL);
sysbus_create_varargs("exynos4210.pwm", EXYNOS4210_PWM_BASE_ADDR,
s->irq_table[exynos4210_get_irq(22, 0)],
s->irq_table[exynos4210_get_irq(22, 1)],
s->irq_table[exynos4210_get_irq(22, 2)],
s->irq_table[exynos4210_get_irq(22, 3)],
s->irq_table[exynos4210_get_irq(22, 4)],
NULL);
sysbus_create_varargs("exynos4210.rtc", EXYNOS4210_RTC_BASE_ADDR,
s->irq_table[exynos4210_get_irq(23, 0)],
s->irq_table[exynos4210_get_irq(23, 1)],
NULL);
dev = qdev_create(NULL, "exynos4210.mct");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < 4; n++) {
sysbus_connect_irq(busdev, n,
s->irq_table[exynos4210_get_irq(1, 4 + n)]);
}
sysbus_connect_irq(busdev, 4,
s->irq_table[exynos4210_get_irq(51, 0)]);
sysbus_connect_irq(busdev, 5,
s->irq_table[exynos4210_get_irq(35, 3)]);
sysbus_mmio_map(busdev, 0, EXYNOS4210_MCT_BASE_ADDR);
for (n = 0; n < EXYNOS4210_I2C_NUMBER; n++) {
uint32_t addr = EXYNOS4210_I2C_BASE_ADDR + EXYNOS4210_I2C_SHIFT * n;
qemu_irq i2c_irq;
if (n < 8) {
i2c_irq = s->irq_table[exynos4210_get_irq(EXYNOS4210_I2C_INTG, n)];
} else {
i2c_irq = s->irq_table[exynos4210_get_irq(EXYNOS4210_HDMI_INTG, 1)];
}
dev = qdev_create(NULL, "exynos4210.i2c");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0, i2c_irq);
sysbus_mmio_map(busdev, 0, addr);
s->i2c_if[n] = (I2CBus *)qdev_get_child_bus(dev, "i2c");
}
exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
EXYNOS4210_UART0_FIFO_SIZE, 0, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 0)]);
exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
EXYNOS4210_UART1_FIFO_SIZE, 1, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 1)]);
exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
EXYNOS4210_UART2_FIFO_SIZE, 2, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 2)]);
exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
EXYNOS4210_UART3_FIFO_SIZE, 3, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]);
sysbus_create_varargs("exynos4210.fimd", EXYNOS4210_FIMD0_BASE_ADDR,
s->irq_table[exynos4210_get_irq(11, 0)],
s->irq_table[exynos4210_get_irq(11, 1)],
s->irq_table[exynos4210_get_irq(11, 2)],
NULL);
sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR,
s->irq_table[exynos4210_get_irq(28, 3)]);
return s;
}
| 1threat
|
MainActivity leaked using leakcanary : <p>I am using Leak Canary to track memory leak and it says the following were leaked: </p>
<pre><code>static hk.o
references ht.a
leaks MainActivity instance
</code></pre>
<p>what is the <code>hk.o</code> and <code>ht.a</code>? I dont have them in my MainActivity. </p>
| 0debug
|
Mixing PHP and HTML , Parse error: syntax error, unexpected end of file : <p>i was check all but i am confused for mixing this code with PHP and HTML ,
Parse error: syntax error, unexpected end of file</p>
<pre><code></style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="jquery.js"></script>
<script type="text/javascript">
(function() {
window.onload = function() {
var map;
var locations = [
<?php
//konfgurasi koneksi database
mysql_connect('localhost','root','');
mysql_select_db('candralab-map');
$sql_lokasi="select idlokasi,lat,lon
from lokasi ";
$result=mysql_query($sql_lokasi);
// ambil nama,lat dan lon dari table lokasi
while($data=mysql_fetch_object($result)){
?>
['<?=$data->idlokasi;?>', <?=$data->lat;?>, <?=$data->lon;?>],
<?
}
?>
];
var options = {
zoom: 12, //level zoom
//posisi tengah peta
center: new google.maps.LatLng(-7.8008, 110.380643),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('peta'), options);
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: 'icon.png'
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
var id= locations[i][0];
$.ajax({
url : "get_info.php",
data : "id=" +id ,
success : function(data) {
$("#info").html(data);
}
});
}
})(marker, i));
}
};
})();</script>
</code></pre>
<p>can u find the missing part ?because mixing PHP and HTML is confusing, plese help me for fix this code...</p>
| 0debug
|
Last html tags in html string in java : I have HTML string and want to get last closing tags.
e.g.
<h1>
<p>some text</p>
<p>
<ol>
<li>item1Text</li>
<ol>
</p>
</h1>
I want to insert a button after `item1Text`, thus I need to find
last tags in the html string, in this case it is `</li><ol></p></h1>`
| 0debug
|
Unity C# NullReferenceException : <p>I know, this question was already answered a lot here, and believe me, I've tried so many ways to fix that problem, but it occurs over and over again.</p>
<p>So basically, I'm trying to change e.g. money in my game, from a different script.</p>
<p>But as soon as I click the button, I get this error message. I think I'm doing anything fundamentally wrong here, but it also happens in my score script, but that is still working anyhow... But here is the error: </p>
<pre><code>NullReferenceException: Object reference not set to an instance of an object
Score.ResetScore () (at Assets/Scripts/Score.cs:36)
</code></pre>
<p>And here are the Scripts that <strong>should</strong> work together.</p>
<p>Script 1: </p>
<pre><code>void ResetScore()
{
GameManager gamemanag = GetComponent<GameManager>();
score = 0;
gamemanag.ResetQuestions();
}
</code></pre>
<p>Script 2:</p>
<pre><code>public void ResetQuestions()
{
unansweredQuestions = questions.ToList<Question>();
}
</code></pre>
<p>That was the score script because it's a bit cleaner. This doesn't really work as it should as well and I have no Idea why...</p>
<p>I'm posting the full code on pastebin at the end.</p>
<p>Would be great if you could help!</p>
<p>Script 1: <a href="http://pastebin.com/raw/qvbFYd3x" rel="nofollow noreferrer">http://pastebin.com/raw/qvbFYd3x</a></p>
<p>Script 2: <a href="http://pastebin.com/raw/8gMzaagq" rel="nofollow noreferrer">http://pastebin.com/raw/8gMzaagq</a></p>
| 0debug
|
Extract string after a multiline string using python regex : <p>I have a string</p>
<pre><code>a='''S
LINC SHORT LEGAL TITLE NUMBER
0038 073 623 1522744;27 182 246 612
+5
LEGAL DESCRIPTION
CONDOMINIUM PLAN 1522744
UNIT 27
AND 237 UNDIVIDED ONE TEN THOUSANDTH SHARES IN THE COMMON PROPERTY
EXCEPTING THEREOUT ALL MINES AND MINERALS
ESTATE: FEE SIMPLE
ATS REFERENCE: 4;25;52;8;NW
MUNICIPALITY: CITY OF EDMONTON
REFERENCE NUMBER: 172 303 453 +7
----------------------------------------------------------------------------
----
REGISTERED OWNER(S)
REGISTRATION DATE(DMY) DOCUMENT TYPE VALUE CONSIDERATION
----------------------------------------------------------------------------
----
182 246 612 01/10/2018 PHASED OF CASH & MTGE
CONDOMINIUM PLAN '''
</code></pre>
<p>I need to get the string after the word 'PHASED OF CONDOMINIUM PLAN' which should returns 'CASH & MTGE'
I have tried using the below expression</p>
<pre><code>date_value = (re.search(r'(\d+/\d+/\d+)', a)).group(1) //returns '01/10/2018'
doc_type = "".join(list(re.search(r"(?<={})\s*((?:\S+\s)+).*\s*((?:\S+\s)+)".format(date_value),a).group(1, 2))).strip() //returns 'PHASED OF CONDOMINIUM PLAN'
consideration = ((re.search(r"(?<={}).*".format(doc_type),a)).group()).strip()
</code></pre>
<p>I could not get any match </p>
| 0debug
|
static void init_parse_context(OptionParseContext *octx,
const OptionGroupDef *groups)
{
static const OptionGroupDef global_group = { "global" };
const OptionGroupDef *g = groups;
int i;
memset(octx, 0, sizeof(*octx));
while (g->name)
g++;
octx->nb_groups = g - groups;
octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups);
if (!octx->groups)
exit(1);
for (i = 0; i < octx->nb_groups; i++)
octx->groups[i].group_def = &groups[i];
octx->global_opts.group_def = &global_group;
octx->global_opts.arg = "";
init_opts();
}
| 1threat
|
How to calculate distance from path? : I have 2 coordinates (A1 and A2), connected by a straight line (my path). How can I calculate the distance of a given coordinate (B1 and B2) 90 degrees from the straight line?
[![A1 and A2 connected by straight line][1]][1]
[1]: https://i.stack.imgur.com/YKu7q.png
| 0debug
|
How to progromatically stop actions segue swift : <p>so I have multiple viewcontrollers in my project, and I perform an action segue from the first to the second when the button called <code>SignIn</code> is called. What I need to do, however, is stop this action segue from being performed, on a condition. For example, <code>if isThereAnError == true { write code to stop action segue }</code> I have looked all over apple documentation and stack overflow but to no prevail. Any and all help is greatly appreciated, thank you in advance.</p>
| 0debug
|
What the heck is going on? Chrome is giving "Uncaught SyntaxError: Unexpected token ," : <p>In chrome the following code is giving me an error on some pages, but not others...</p>
<pre><code>$.ajax({
url : '/package-assignments/add.json',
method : 'POST',
data : {
event_id : ,
package_id : $(this).data('package').id,
price : $(this).data('package').price,
deposit : $(this).data('package').deposit
}
});
</code></pre>
<p>For the life of me I can't figure out what is going on. the area red underlined in chrome editor tools is "e-assignments/add.json'," which makes even less sense, it starts mid string on an arbitrary letter 'e' and continues to end of the string...</p>
<p>When I remove the string after url and replace it with null the error stays the same but shows to be after "$.ajax({" which also... makes no freaking sense...</p>
| 0debug
|
Can anybody tell me why am i getting java.lang.ArrayIndexOutOfBoundsException: 1? : try{
DefaultTableModel tm = (DefaultTableModel) jTable1.getModel();
FileInputStream FI = new FileInputStream("C://Users//Dell-Pc//Documents//NetBeansProjects//MyBookShop//src//Layouts//book_store.txt");
DataInputStream DI = new DataInputStream(FI);
BufferedReader br= new BufferedReader(new InputStreamReader(DI));
String line="";
while((line=br.readLine()) != null){
Map m1 = new HashMap();
String[] data1=line.split(",");
m1.put("ISBN", data1[0]);
m1.put("TITLE", data1[1]);
m1.put("AUTHOR", data1[2]);
m1.put("PRICE", data1[3]);
m1.put("NUMBER", data1[4]);
//System.out.println(data1[1]);
//System.out.println("\t"+m1);
Vector v1 = new Vector();
v1.add(m1.get("ISBN"));
v1.add(m1.get("TITLE"));
v1.add(m1.get("AUTHOR"));
v1.add(m1.get("PRICE"));
v1.add(m1.get("NUMBER"));
tm.addRow(v1);
//v.clear();
//tm.setDataVector(data, cols);
}
}catch(Exception e){
// JOptionPane.showMessageDialog(this, e);
Logger.getLogger(HomePage.class.getName()).log(Level.SEVERE, null, e);
}
| 0debug
|
Is there any "serverless" / gobal database hosting? : Iam bulling a litte python + GTK app.
I need a way where I can store some index data on a server.
Frist I look at RedHat´s OpenShift as the server rest-backend (python + flask + mysql)
But now I am thinking is there a way to just put some data into the "cloud".
I know the cloud just i a buzz word for other peoples computers / servers.
But something like the bitcoin where you just push some key/val data then any node in the network gets the data after some time.
Apache Cassandre look like can do some thing like this.
But I don't want to host anything.
Some thing like this.
$ datacloud <openid> <password> <databucket>
$ datacloud add <key> <jsondata / val>
$ datacloud get <key>
$ <jsondata>
Or in python.
import datacloud as dc
import json
def main():
dc.connect("<myopenid.provider.org>", "<password>", "<databucket>")
ds.add("key", json.dumps({"hello":"world"}))
for data in dc:
print data
print dc.get("<key>")
--> { "hello": "world"}
Or better just with jquey.
<html>
<head>
<script href="pathto/jquery.js"></script>
<title>ServerLess / local site</title>
<script>
$(function(){
$.ajax({
url: "magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcad53426",
data: {
"openid": "<openid.myopenidprovier.org>",
"password": "<12345>",
"bucket": "<databucket>"
}
}).done(function(keys){
for(var i=0; i < keys.length; i++)
$('#news').append('<h3>'+key[i]+'</h3>');
});
});
</script
</head>
<body>
<h1>News with no server</h1>
<div id="news"></div>
</body>
</html>
Iam look for an p2p global key/val store.
... an freenet like data global key/val cache or store..
| 0debug
|
trying to get the selected items string out of a materialbetterSpinner but it shows can't resolve symbol getSelectedItem();(Which is for spinner). :
MaterialBetterSpinner university;
university = (MaterialBetterSpinner) findViewById(R.id.university);
and my select code is---
university.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
String seluniversity = (String) university.*getSelectedItem();*--here is the issue
| 0debug
|
ng generate component in subdirectory : <p>I have the following directory structure</p>
<p><a href="https://i.stack.imgur.com/ZmPdu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZmPdu.png" alt="enter image description here"></a></p>
<p>I would like to create a new page, let's say, an About page.
I want to put it in src/app/page/about/*</p>
<p>So I try:</p>
<pre><code>ng generate component pages/about
</code></pre>
<p>but I get this error:</p>
<pre><code>Error: More than one module matches. Use skip-import option to skip importing the component into the closest module.
More than one module matches. Use skip-import option to skip importing the component into the closest module.
</code></pre>
<p>Is it a good idea to use pages to store my separate pages?
How can I generate components in a subdirectory using the angular-cli?</p>
| 0debug
|
My program get crazy : <p>I tried to do a program that random 10000 numbers between 0-6 and check how much times every number get ruffle. It's get crazy and print lot's of things. please help me thanks!</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ARR_SIZE 10000
#define NUM_OF_FACES 6
int main()
{
srand(time(NULL));
int arrCube[ARR_SIZE];
int i=0,counter=0,j=0;
for(i = 0; i<ARR_SIZE; i++)
{
arrCube[i] = rand() % NUM_OF_FACES;
}
for(i=0;i<ARR_SIZE;i++)
{
counter=0;
for(j=i+1;j<ARR_SIZE -1;j++)
{
if (arrCube[i]==arrCube[j])
{
counter++;
}
}
printf("%d times %d showed up\n",counter,arrCube[i]);
}
return (0);
}
</code></pre>
<p>Another thing: I know that I can do this program with another array instead the nested loop. someone know?</p>
| 0debug
|
char *vnc_display_local_addr(const char *id)
{
VncDisplay *vs = vnc_display_find(id);
SocketAddress *addr;
char *ret;
Error *err = NULL;
assert(vs);
addr = qio_channel_socket_get_local_address(vs->lsock, &err);
if (!addr) {
return NULL;
}
if (addr->type != SOCKET_ADDRESS_KIND_INET) {
qapi_free_SocketAddress(addr);
return NULL;
}
ret = g_strdup_printf("%s;%s", addr->u.inet->host, addr->u.inet->port);
qapi_free_SocketAddress(addr);
return ret;
}
| 1threat
|
static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s)
{
assert(!s->blocker);
error_setg(&s->blocker, "block device is in use by data plane");
blk_op_block_all(s->conf->conf.blk, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker);
blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker);
}
| 1threat
|
CORS endpoints on asp.net Webforms [WebMethod] endpoints : <p>I am trying to add some <code>[WebMethod]</code> annotated endpoint functions to a Webforms style web app (.aspx and .asmx). </p>
<p>I'd like to annotate those endpoints with <code>[EnableCors]</code> and thereby get all the good ajax-preflight functionality.</p>
<p>VS2013 accepts the annotation, but still the endpoints don't play nice with CORS. (They work fine when used same-origin but not cross-origin).</p>
<p>I can't even get them to function cross-origin with the down and dirty</p>
<pre><code>HttpContext.Current.Response.AppendHeader("Access-Control-Allow-Origin", "*");
</code></pre>
<p>approach -- my browsers reject the responses, and the cross-origin response headers don't appear.</p>
<p>How can I get CORS functionality in these <code>[WebMethod]</code> endpoints?</p>
| 0debug
|
int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
{
Location loc;
DriveInfo *dinfo;
int res = 0, unit;
loc_push_none(&loc);
for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
dinfo = drive_get(IF_SCSI, bus->busnr, unit);
if (dinfo == NULL) {
continue;
}
qemu_opts_loc_restore(dinfo->opts);
if (!scsi_bus_legacy_add_drive(bus, dinfo->bdrv, unit)) {
res = -1;
break;
}
}
loc_pop(&loc);
return res;
}
| 1threat
|
Regex exclude &# : <p>How to determine that string doesn't contain both symbols &# together using regular expression ?</p>
| 0debug
|
Android studio search results view : <p>I have search and results activities. After submitting a search, webserver is contacted and i will get json array as a result. Each object in that array will contain few info pairs about that result.
I've made view design for results but i don't know how to copy and re-use that view for all search results, creating one text view for results would be simple, but what to do with this complicated layout?
This is code of view i want to copy and use for each result...
Also, i want results to be clickable and when clicked to be taken to details page where more details about that should be shown, so second question is how to keep track of what have user clicked (btw. i know ID's are messed up, i will set them later)</p>
<pre><code><LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginTop="10dp"
android:id="@+id/result"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="@drawable/background_border"
android:onClick="ShowDetails">
<ImageView
app:srcCompat="@drawable/golettaverde"
android:id="@+id/imageView2"
android:layout_weight="1"
android:background="@drawable/image_background_border"
android:scaleType="fitXY"
android:layout_width="120dp"
android:layout_height="120dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:gravity="center_vertical|center_horizontal">
<TextView
android:text="Goletta Verde"
android:layout_width="wrap_content"
android:id="@+id/textView5"
android:layout_weight="1"
android:textColor="?attr/colorButtonNormal"
android:textStyle="normal|bold"
android:textSize="26sp"
android:layout_height="10dp" />
<TextView
android:text="5 seats - 18.60 meters"
android:layout_width="wrap_content"
android:id="@+id/textView6"
android:layout_weight="1"
android:textColor="?attr/colorButtonNormal"
android:textSize="20sp"
android:layout_marginLeft="3dp"
android:layout_height="7dp" />
<TextView
android:text="Year 2009"
android:layout_width="wrap_content"
android:id="@+id/textView7"
android:layout_weight="1"
android:textSize="20sp"
android:textColor="?attr/colorButtonNormal"
android:layout_marginLeft="3dp"
android:layout_height="7dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="10dp"
android:layout_weight="1">
<ImageView
app:srcCompat="@android:drawable/btn_star_big_on"
android:id="@+id/imageView3"
android:layout_weight="1"
android:layout_width="30dp"
android:layout_height="wrap_content" />
<ImageView
app:srcCompat="@android:drawable/btn_star_big_on"
android:id="@+id/imageView3"
android:layout_weight="1"
android:layout_width="30dp"
android:layout_height="wrap_content" />
<ImageView
app:srcCompat="@android:drawable/btn_star_big_on"
android:id="@+id/imageView3"
android:layout_weight="1"
android:layout_width="30dp"
android:layout_height="wrap_content" />
<ImageView
app:srcCompat="@android:drawable/btn_star_big_on"
android:id="@+id/imageView3"
android:layout_weight="1"
android:layout_width="30dp"
android:layout_height="wrap_content" />
<ImageView
app:srcCompat="@android:drawable/btn_star_big_on"
android:id="@+id/imageView3"
android:layout_weight="1"
android:layout_width="30dp"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:text="300€"
android:layout_width="wrap_content"
android:id="@+id/textView7"
android:layout_weight="1"
android:textSize="24sp"
android:textColor="?attr/colorButtonNormal"
android:layout_marginLeft="3dp"
android:layout_height="7dp"
android:textStyle="normal|bold" />
</code></pre>
| 0debug
|
static int usb_net_handle_control(USBDevice *dev, int request, int value,
int index, int length, uint8_t *data)
{
USBNetState *s = (USBNetState *) dev;
int ret = 0;
switch(request) {
case DeviceRequest | USB_REQ_GET_STATUS:
data[0] = (1 << USB_DEVICE_SELF_POWERED) |
(dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP);
data[1] = 0x00;
ret = 2;
break;
case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
if (value == USB_DEVICE_REMOTE_WAKEUP) {
dev->remote_wakeup = 0;
} else {
goto fail;
}
ret = 0;
break;
case DeviceOutRequest | USB_REQ_SET_FEATURE:
if (value == USB_DEVICE_REMOTE_WAKEUP) {
dev->remote_wakeup = 1;
} else {
goto fail;
}
ret = 0;
break;
case DeviceOutRequest | USB_REQ_SET_ADDRESS:
dev->addr = value;
ret = 0;
break;
case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:
if (!s->rndis || value || index != 0)
goto fail;
#ifdef TRAFFIC_DEBUG
{
unsigned int i;
fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:");
for (i = 0; i < length; i++) {
if (!(i & 15))
fprintf(stderr, "\n%04x:", i);
fprintf(stderr, " %02x", data[i]);
}
fprintf(stderr, "\n\n");
}
#endif
ret = rndis_parse(s, data, length);
break;
case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE:
if (!s->rndis || value || index != 0)
goto fail;
ret = rndis_get_response(s, data);
if (!ret) {
data[0] = 0;
ret = 1;
}
#ifdef TRAFFIC_DEBUG
{
unsigned int i;
fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:");
for (i = 0; i < ret; i++) {
if (!(i & 15))
fprintf(stderr, "\n%04x:", i);
fprintf(stderr, " %02x", data[i]);
}
fprintf(stderr, "\n\n");
}
#endif
break;
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
switch(value >> 8) {
case USB_DT_DEVICE:
ret = sizeof(qemu_net_dev_descriptor);
memcpy(data, qemu_net_dev_descriptor, ret);
break;
case USB_DT_CONFIG:
switch (value & 0xff) {
case 0:
ret = sizeof(qemu_net_rndis_config_descriptor);
memcpy(data, qemu_net_rndis_config_descriptor, ret);
break;
case 1:
ret = sizeof(qemu_net_cdc_config_descriptor);
memcpy(data, qemu_net_cdc_config_descriptor, ret);
break;
default:
goto fail;
}
data[2] = ret & 0xff;
data[3] = ret >> 8;
break;
case USB_DT_STRING:
switch (value & 0xff) {
case 0:
data[0] = 4;
data[1] = 3;
data[2] = 0x09;
data[3] = 0x04;
ret = 4;
break;
case STRING_ETHADDR:
ret = set_usb_string(data, s->usbstring_mac);
break;
default:
if (usb_net_stringtable[value & 0xff]) {
ret = set_usb_string(data,
usb_net_stringtable[value & 0xff]);
break;
}
goto fail;
}
break;
default:
goto fail;
}
break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE;
ret = 1;
break;
case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:
switch (value & 0xff) {
case DEV_CONFIG_VALUE:
s->rndis = 0;
break;
case DEV_RNDIS_CONFIG_VALUE:
s->rndis = 1;
break;
default:
goto fail;
}
ret = 0;
break;
case DeviceRequest | USB_REQ_GET_INTERFACE:
case InterfaceRequest | USB_REQ_GET_INTERFACE:
data[0] = 0;
ret = 1;
break;
case DeviceOutRequest | USB_REQ_SET_INTERFACE:
case InterfaceOutRequest | USB_REQ_SET_INTERFACE:
ret = 0;
break;
default:
fail:
fprintf(stderr, "usbnet: failed control transaction: "
"request 0x%x value 0x%x index 0x%x length 0x%x\n",
request, value, index, length);
ret = USB_RET_STALL;
break;
}
return ret;
}
| 1threat
|
Shortcut key for commenting out lines of Python code in Spyder : <p>I recently changed from the Enthought Canopy Python distribution to Anaconda, which includes the Spyder IDE.</p>
<p>In Canopy's code editor, it was possible to comment and uncomment lines of code by pressing the "Cntrl+/" shortcut key sequence. In Spyder I was unable to find an equivalent shortcut key in the introductory tutorial.</p>
<p>Is there a shortcut key for commenting and uncommenting code in Spyder?</p>
| 0debug
|
Can someone explain what this code? : lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position,long id) {
try {text.delete(position, position);
String item = strArr.get(position);
strArr.remove(item);
adapter = new ArrayAdapter<String (getApplicationContext(), android.R.layout.simple_list_item_1, strArr);
lv.setAdapter(adapter);
return true;
}
catch (Exception e) {
e.getMessage();
}
return true;
}
}
);
}
| 0debug
|
void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
VirtIOBlockDataPlane **dataplane,
Error **errp)
{
VirtIOBlockDataPlane *s;
Error *local_err = NULL;
*dataplane = NULL;
if (!blk->data_plane) {
return;
}
if (blk->scsi) {
error_setg(errp,
"device is incompatible with x-data-plane, use scsi=off");
return;
}
if (blk->config_wce) {
error_setg(errp, "device is incompatible with x-data-plane, "
"use config-wce=off");
return;
}
if (bdrv_op_is_blocked(blk->conf.bs, BLOCK_OP_TYPE_DATAPLANE, &local_err)) {
error_report("cannot start dataplane thread: %s",
error_get_pretty(local_err));
error_free(local_err);
return;
}
s = g_new0(VirtIOBlockDataPlane, 1);
s->vdev = vdev;
s->blk = blk;
if (blk->iothread) {
s->iothread = blk->iothread;
object_ref(OBJECT(s->iothread));
} else {
object_initialize(&s->internal_iothread_obj,
sizeof(s->internal_iothread_obj),
TYPE_IOTHREAD);
user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);
s->iothread = &s->internal_iothread_obj;
}
s->ctx = iothread_get_aio_context(s->iothread);
error_setg(&s->blocker, "block device is in use by data plane");
bdrv_op_block_all(blk->conf.bs, s->blocker);
*dataplane = s;
}
| 1threat
|
void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
MemoryRegion *address_space_io, bool init_vga_ports)
{
MemoryRegion *vga_io_memory;
const MemoryRegionPortio *vga_ports, *vbe_ports;
PortioList *vga_port_list = g_new(PortioList, 1);
PortioList *vbe_port_list = g_new(PortioList, 1);
qemu_register_reset(vga_reset, s);
s->bank_offset = 0;
s->legacy_address_space = address_space;
vga_io_memory = vga_init_io(s, obj, &vga_ports, &vbe_ports);
memory_region_add_subregion_overlap(address_space,
isa_mem_base + 0x000a0000,
vga_io_memory,
1);
memory_region_set_coalescing(vga_io_memory);
if (init_vga_ports) {
portio_list_init(vga_port_list, obj, vga_ports, s, "vga");
portio_list_set_flush_coalesced(vga_port_list);
portio_list_add(vga_port_list, address_space_io, 0x3b0);
}
if (vbe_ports) {
portio_list_init(vbe_port_list, obj, vbe_ports, s, "vbe");
portio_list_add(vbe_port_list, address_space_io, 0x1ce);
}
}
| 1threat
|
Please help me with making my array size to get increased, each time there is an input from a user : I am writing data from user's input into a text file in c#, using array.
I have tried using array and ArrayList, yet it didn't work.
FileStream fs = new FileStream("FirstName.txt", FileMode.Append, FileAccess.Write);
StreamWriter w = new StreamWriter(fs);
Console.WriteLine("Enter a string");
string str = Console.ReadLine();
string[] thearray = new string[1];
thearray[0] = str;
w.WriteLine(thearray[0]);
w.Flush();
fs.Close();
It should insert the user's values to the array, and from the array to the text file.
| 0debug
|
how to write store procedure in asp.net : [enter image description here][1]
> the stored procedure which is there below need to be added in this code where i have written query
if (ddlFormat.SelectedIndex != 0)
{
String strConnString = ConfigurationManager.ConnectionStrings["CallcenterConnectionString"].ConnectionString;
SqlConnection con1 = new SqlConnection(strConnString);
con1.Open();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter sda = new SqlDataAdapter();
DataSet dsDisp = new DataSet();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select DISTINCT Disposition from CallCenter..Loy_DispMstr where CallType=@CallType and SUBFormat=@Format";
cmd.Parameters.AddWithValue("@CallType", ddlCalltype.SelectedValue);
cmd.Parameters.AddWithValue("@Format", ddlFormat.SelectedItem.Text);
cmd.Connection = con1;
cmd.ExecuteNonQuery();
sda.SelectCommand = cmd;
sda.Fill(dsDisp);
ddlDisp.DataTextField = "Disposition";
ddlDisp.DataValueField = "Disposition";
ddlDisp.DataSource = dsDisp.Tables[0];
ddlDisp.DataBind();
ddlDisp.Items.Insert(0, "<----Select---->");
ddlDisp.Focus();
}
}
protected void ddlDisp_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlDisp.SelectedIndex != 0)
{
String strConnString = ConfigurationManager.ConnectionStrings["CallcenterConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd=new SqlCommand();
SqlDataAdapter sda = new SqlDataAdapter();
DataSet dsSubDisp = new DataSet();
using (cmd = new SqlCommand("Select distinct CallType,Disposition,SubDisposition,Format from Loy_DispMstr where CallType=@CallType and SUBFormat=@Format and Disposition = @disposition", con))
{
cmd.Parameters.AddWithValue("@CallType",ddlCalltype.SelectedValue);
cmd.Parameters.AddWithValue("@Format", ddlFormat.SelectedValue);
cmd.Parameters.AddWithValue("@disposition", ddlDisp.SelectedValue);
con.Open();
cmd.ExecuteNonQuery();
}
sda.SelectCommand = cmd;
sda.Fill(dsSubDisp);
{
ddlSubdisp.DataTextField = "SubDisposition";
ddlSubdisp.DataValueField = "SubDisposition";
ddlSubdisp.DataSource = dsSubDisp.Tables[0];
ddlSubdisp.DataBind();
ddlSubdisp.Items.Insert(0, "<----Select---->");
ddlSubdisp.SelectedIndex = 0;
ddlSubdisp.Focus();
ddlDisp.Items.Insert(1, "ADD NEW VALUE");
ddlDisp.SelectedIndex = 1;
ddlDisp.Focus();
}
}
if (ddlDisp.SelectedItem.Text == "ADD NEW VALUE" )
{
TextBox1.Visible = true;
TextBox2.Visible = true;
}
}
protected void ddlSubdisp_SelectedIndexChanged(object sender, EventArgs e)
{
String strConnString = ConfigurationManager.ConnectionStrings["CallcenterConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
DataSet dsOut = new DataSet();
SqlCommand cmd = new SqlCommand("select PID,Memberstatus,calltype,format,disposition,subdisposition, man_data,creation_date,createdby,updation_date,updatedby from Loy_SubPlaceholder");
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(dsOut);
ddlDisp.DataSource = dsOut.Tables[0];
ddlDisp.DataValueField = "subdisposition";
ddlDisp.DataTextField = "subdisposition";
ddlDisp.DataBind();
con.Open();
cmd.ExecuteNonQuery();
- store procedure
if @flag = '1'
begin
Select Formatid,Formatdetail,dispformat From loy_Formatdetail with (nolock)
Where isactive='1' and memberstatus = 'Member' order by FormatDetail
end
if @flag = '2'
begin
Select DISTINCT Disposition from CallCenter..Loy_DispMstr
where CallType=@CallType and SUBFormat=@Format
end
if @flag = '3'
begin
Select distinct CallType,Disposition,SubDisposition,Format from Loy_DispMstr
where CallType=@CallType and SUBFormat=@Format and Disposition = @disposition
end
| 0debug
|
Error multiple definition when compiling using headers : <p>I am having a lot of trouble with my header files and the compilation. I have everything linked with header guards but for some reason I am still getting a lot of multiple definition errors. I'm also look for help on better way to organize code. Whatever help is appreciated! </p>
<p>This is the out output of my console when I do the g++ call: </p>
<pre><code>g++ main.cpp close.cpp init.cpp load_media.cpp texture.cpp -w -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -o run
/tmp/cc3oNgPs.o:(.bss+0x0): multiple definition of `g_font'
/tmp/ccg0hCKW.o:(.bss+0x0): first defined here
/tmp/cc3oNgPs.o:(.bss+0x8): multiple definition of `g_window'
/tmp/ccg0hCKW.o:(.bss+0x8): first defined here
/tmp/cc3oNgPs.o:(.bss+0x10): multiple definition of `g_renderer'
/tmp/ccg0hCKW.o:(.bss+0x10): first defined here
/tmp/cc3oNgPs.o:(.bss+0x20): multiple definition of `g_text_texture'
/tmp/ccg0hCKW.o:(.bss+0x20): first defined here
/tmp/ccIgzhbZ.o:(.bss+0x0): multiple definition of `g_font'
/tmp/ccg0hCKW.o:(.bss+0x0): first defined here
/tmp/ccIgzhbZ.o:(.bss+0x8): multiple definition of `g_window'
/tmp/ccg0hCKW.o:(.bss+0x8): first defined here
/tmp/ccIgzhbZ.o:(.bss+0x10): multiple definition of `g_renderer'
/tmp/ccg0hCKW.o:(.bss+0x10): first defined here
/tmp/ccIgzhbZ.o:(.bss+0x20): multiple definition of `g_text_texture'
/tmp/ccg0hCKW.o:(.bss+0x20): first defined here
/tmp/ccQs9gPv.o:(.bss+0x0): multiple definition of `g_font'
/tmp/ccg0hCKW.o:(.bss+0x0): first defined here
/tmp/ccQs9gPv.o:(.bss+0x8): multiple definition of `g_window'
/tmp/ccg0hCKW.o:(.bss+0x8): first defined here
/tmp/ccQs9gPv.o:(.bss+0x10): multiple definition of `g_renderer'
/tmp/ccg0hCKW.o:(.bss+0x10): first defined here
/tmp/ccQs9gPv.o:(.bss+0x20): multiple definition of `g_text_texture'
/tmp/ccg0hCKW.o:(.bss+0x20): first defined here
/tmp/ccxzUgM2.o:(.bss+0x0): multiple definition of `g_font'
/tmp/ccg0hCKW.o:(.bss+0x0): first defined here
/tmp/ccxzUgM2.o:(.bss+0x8): multiple definition of `g_window'
/tmp/ccg0hCKW.o:(.bss+0x8): first defined here
/tmp/ccxzUgM2.o:(.bss+0x10): multiple definition of `g_renderer'
/tmp/ccg0hCKW.o:(.bss+0x10): first defined here
/tmp/ccxzUgM2.o:(.bss+0x20): multiple definition of `g_text_texture'
/tmp/ccg0hCKW.o:(.bss+0x20): first defined here
collect2: error: ld returned 1 exit status
</code></pre>
<p>here are my 2 header files:</p>
<p>isolation.h</p>
<pre><code>//include //include guard
#ifndef ISOLATION_H
#define ISOLATION_H
//include dependencies
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <stdio.h>
#include <string>
//include headers
#include "texture.h"
//Screen dimension constants
const int SCREEN_WIDTH = 1280;
const int SCREEN_HEIGHT = 800;
//forward delcarlation
//class Texture;
//start up SDL create window
bool init();
//load all media
bool load_media();
//free all and shut down SDL
void close();
//load global front
TTF_Font* g_font = NULL;
//window
SDL_Window* g_window = NULL;
//renderer
SDL_Renderer* g_renderer = NULL;
//load jpeg + font
//Texture background_texture;
//rendered font texture
Texture g_text_texture;
#endif
</code></pre>
<p>texture.h</p>
<pre><code>//include guard
#ifndef TEXTURE_H
#define TEXTURE_H
//include dependencies
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <stdio.h>
#include <string>
//include headers
//#include "isolation.h"
class Texture {
public:
//initializes variables
Texture();
//deallocates memory
~Texture();
//load image from path
bool load_from_file( std::string path );
//create image from font string
bool load_from_rendered_text( std::string textureText, SDL_Color text_color );
//deallocates texture
void free();
//set color modulation
void set_color( Uint8 red, Uint8 green, Uint8 blue );
//set blend mode
void set_blend_mode( SDL_BlendMode blending );
//set alpha
void set_alpha( Uint8 alpha );
//render texture at point
void render( int x, int y, SDL_Rect* clip = NULL, double angle = 0.0, SDL_Point* center = NULL, SDL_RendererFlip flip = SDL_FLIP_NONE ) const;
//get image dimensions
int get_width() const;
int get_height() const;
private:
//texture pointer
SDL_Texture* m_texture;
//dimensions
int m_width;
int m_height;
};
#endif
</code></pre>
<p>init.cpp</p>
<pre><code>#include "isolation.h"
//#include "texture.h"
bool init() {
//initialization flag
bool success = true;
//initialize SDL
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
printf( "SDL could not initialized. SDL Error: %s\n", SDL_GetError() );
success = false;
}
else {
//set texture filtering linear
if ( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) ) {
printf( "Warning: Linear filtering not enabled\n" );
}
//create window
g_window = SDL_CreateWindow( "Isolation", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
if ( g_window == NULL ) {
printf( "Window could not be created. SDL Error: %s\n", SDL_GetError() );
success = false;
}
else {
//create vsynced renderer
g_renderer = SDL_CreateRenderer( g_window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC );
if ( g_renderer == NULL ) {
printf( "Renderer could not be created. SDL Error: %s\n", SDL_GetError() );
success = false;
}
else {
//initialize renderer color
SDL_SetRenderDrawColor (g_renderer, 0xFF, 0xFF, 0xFF, 0xFF );
//initialize JPEG loading
int img_flags = IMG_INIT_JPG;
if ( !( IMG_Init( img_flags ) & img_flags ) ) {
printf( "SDL_image could not be initialize. SDL_image Error: %s\n", IMG_GetError() );
success = false;
}
//initialize SDL_ttf
if (TTF_Init() == -1 ) {
printf( "SDL_ttf could not be initialize. SDL_ttf Error: %s\n", TTF_GetError() );
}
}
}
}
return success;
}
</code></pre>
<p>load_media.cpp</p>
<pre><code>#include "isolation.h"
//s#include "texture.h"
bool load_media() {
bool success = true;
//load background img
//if( !background_texture.load_from_file( "img/vancouver.jpg" ) ) {
// printf( "Failed to load background texture!\n" );
// success = false;
//}
//open font
g_font = TTF_OpenFont( "lazy.ttf", 28 );
if ( g_font == NULL ) {
printf( "Failed to load lazy font. SDL_ttf Error: %s\n", TTF_GetError() );
success = false;
}
else {
//render texture
SDL_Color text_color = { 0, 0, 0 };
if ( !g_text_texture.load_from_rendered_text( "hello from the other side ", text_color ) ) {
printf( "Failed to render text texture\n" );
success = false;
}
}
return success;
}
</code></pre>
<p>close.cpp</p>
<pre><code>#include "isolation.h"
//#include "texture.h"
void close() {
//free loaded text
g_text_texture.free();
//free font
TTF_CloseFont( g_font );
g_font = NULL;
//destroy window
SDL_DestroyWindow( g_window );
SDL_DestroyRenderer( g_renderer );
g_window = NULL;
g_renderer = NULL;
//quit SDL subsystems
TTF_Quit();
IMG_Quit();
SDL_Quit();
}
</code></pre>
<p>main.cpp</p>
<pre><code>#include "isolation.h"
//#include "texture.h"
int main( int argc, char* args[] ) {
//start up SDL
if ( !init() ) {
printf( "Failed to initialize.\n" );
}
else {
//load media
if ( !load_media() ) {
printf( "Failed to load media.\n" );
}
else{
//main loop flag
bool quit = false;
//event handler
SDL_Event e;
//while running
while ( !quit ) {
//handle events on queue
while ( SDL_PollEvent( &e ) != 0 ) {
//user quit
if ( e.type == SDL_QUIT ) {
quit = true;
}
}
//clear screen
SDL_SetRenderDrawColor( g_renderer, 0xFF, 0xFF, 0xFF, 0xFF );
SDL_RenderClear( g_renderer );
//render frame
g_text_texture.render( ( SCREEN_WIDTH - g_text_texture.get_width() ) / 2, ( SCREEN_HEIGHT - g_text_texture.get_height() ) / 2 );
//update screen
SDL_RenderPresent( g_renderer );
}
}
}
//free memory and close SDL
close();
return 0;
}
</code></pre>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
static int find_pte64(CPUPPCState *env, struct mmu_ctx_hash64 *ctx,
target_ulong eaddr, int h, int rwx, int target_page_bits)
{
hwaddr pteg_off;
target_ulong pte0, pte1;
int i, good = -1;
int ret;
ret = -1;
pteg_off = (ctx->hash[h] * HASH_PTEG_SIZE_64) & env->htab_mask;
for (i = 0; i < HPTES_PER_GROUP; i++) {
pte0 = ppc_hash64_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_64);
pte1 = ppc_hash64_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_64);
LOG_MMU("Load pte from %016" HWADDR_PRIx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_off + (i * 16), pte0, pte1, !!(pte0 & HPTE64_V_VALID),
h, !!(pte0 & HPTE64_V_SECONDARY), ctx->ptem);
if (pte64_match(pte0, pte1, h, ctx->ptem)) {
good = i;
break;
}
}
if (good != -1) {
ret = pte64_check(ctx, pte0, pte1, rwx);
LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n",
ctx->raddr, ctx->prot, ret);
pte1 = ctx->raddr;
if (ppc_hash64_pte_update_flags(ctx, &pte1, ret, rwx) == 1) {
ppc_hash64_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_64, pte1);
}
}
if (target_page_bits != TARGET_PAGE_BITS) {
ctx->raddr |= (eaddr & ((1 << target_page_bits) - 1))
& TARGET_PAGE_MASK;
}
return ret;
}
| 1threat
|
documentation for Kaggle API *within* python? : <p>I want to write a <code>python</code> script that downloads a public dataset from Kaggle.com. </p>
<p>The Kaggle API is written in python, but almost all of the documentation and resources that I can find are on how to use the API in command line, and very little on how to use the <code>kaggle</code> library within <code>python</code>. </p>
<p>Some users seem to know how to do this, see for example <a href="https://stackoverflow.com/questions/52681196/kaggle-datasets-into-jupyter-notebook/52909923#52909923">several answers to this question</a>, but the hints are not enough to resolve my specific issue. </p>
<p>Namely, I have a script that looks like this: </p>
<pre><code>from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi('content of my json metadata file')
file = api.datasets_download_file(
owner_slug='the-owner-slug',
dataset_slug='the-dataset-slug',
file_name='the-file-name.csv',
)
</code></pre>
<p>I have come up with this by looking at the method's signature:<br>
<code>api.datasets_download_file(owner_slug, dataset_slug, file_name, **kwargs)</code></p>
<p>I get the following error: </p>
<p><code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 12: invalid start byte</code> </p>
<p>Beyond the solution to this specific problem, I would be really happy to know how to go about troubleshooting errors with the Kaggle library, other than going through the code itself. In fact, perhaps the issue has nothing to do with utf-encoding, but I don't know how to figure this out. What if it is just that the filename is wrong, or something as silly as this? </p>
<p>The <code>csv</code> file is nothing special: three columns, first is timestamp, the other two are integers.</p>
| 0debug
|
Angular paramMap vs queryParamMap? : <p>What are the different paramMap and queryParamMap?</p>
<p>Angular website says
paramMap - An Observable that contains a map of the required and optional parameters specific to the route. The map supports retrieving single and multiple values from the same parameter.</p>
<p>queryParamMap - An Observable that contains a map of the query parameters available to all routes. The map supports retrieving single and multiple values from the query parameter.</p>
<p>I would like to know when I have to use with examples. </p>
<p>Thanks</p>
| 0debug
|
void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb)
{
ChscReq *req;
ChscResp *res;
uint64_t addr;
int reg;
uint16_t len;
uint16_t command;
CPUS390XState *env = &cpu->env;
uint8_t buf[TARGET_PAGE_SIZE];
trace_ioinst("chsc");
reg = (ipb >> 20) & 0x00f;
addr = env->regs[reg];
if (addr & 0xfff) {
program_interrupt(env, PGM_SPECIFICATION, 2);
return;
}
if (s390_cpu_virt_mem_read(cpu, addr, reg, buf, sizeof(ChscReq))) {
return;
}
req = (ChscReq *)buf;
len = be16_to_cpu(req->len);
if ((len < 16) || (len > 4088) || (len & 7)) {
program_interrupt(env, PGM_OPERAND, 2);
return;
}
memset((char *)req + len, 0, TARGET_PAGE_SIZE - len);
res = (void *)((char *)req + len);
command = be16_to_cpu(req->command);
trace_ioinst_chsc_cmd(command, len);
switch (command) {
case CHSC_SCSC:
ioinst_handle_chsc_scsc(req, res);
break;
case CHSC_SCPD:
ioinst_handle_chsc_scpd(req, res);
break;
case CHSC_SDA:
ioinst_handle_chsc_sda(req, res);
break;
case CHSC_SEI:
ioinst_handle_chsc_sei(req, res);
break;
default:
ioinst_handle_chsc_unimplemented(res);
break;
}
if (!s390_cpu_virt_mem_write(cpu, addr + len, reg, res,
be16_to_cpu(res->len))) {
setcc(cpu, 0);
}
}
| 1threat
|
static void v9fs_synth_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
{
V9fsSynthOpenState *synth_open = fs->private;
synth_open->offset = off;
}
| 1threat
|
static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
{
int vo_ver_id;
if(s->max_b_frames || s->quarter_sample){
vo_ver_id= 5;
s->vo_type= ADV_SIMPLE_VO_TYPE;
}else{
vo_ver_id= 1;
s->vo_type= SIMPLE_VO_TYPE;
}
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x100 + vo_number);
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x120 + vol_number);
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 8, s->vo_type);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 4, vo_ver_id);
put_bits(&s->pb, 3, 1);
aspect_to_info(s, s->avctx->sample_aspect_ratio);
put_bits(&s->pb, 4, s->aspect_ratio_info);
if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){
put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num);
put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
}
if(s->low_delay){
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 2, 1);
put_bits(&s->pb, 1, s->low_delay);
put_bits(&s->pb, 1, 0);
}else{
put_bits(&s->pb, 1, 0);
}
put_bits(&s->pb, 2, RECT_SHAPE);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 16, s->time_increment_resolution);
if (s->time_increment_bits < 1)
s->time_increment_bits = 1;
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 13, s->width);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 13, s->height);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 1, s->progressive_sequence ? 0 : 1);
put_bits(&s->pb, 1, 1);
if (vo_ver_id == 1) {
put_bits(&s->pb, 1, s->vol_sprite_usage=0);
}else{
put_bits(&s->pb, 2, s->vol_sprite_usage=0);
}
s->quant_precision=5;
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 1, s->mpeg_quant);
if(s->mpeg_quant){
ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
}
if (vo_ver_id != 1)
put_bits(&s->pb, 1, s->quarter_sample);
put_bits(&s->pb, 1, 1);
s->resync_marker= s->rtp_mode;
put_bits(&s->pb, 1, s->resync_marker ? 0 : 1);
put_bits(&s->pb, 1, s->data_partitioning ? 1 : 0);
if(s->data_partitioning){
put_bits(&s->pb, 1, 0);
}
if (vo_ver_id != 1){
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 1, 0);
}
put_bits(&s->pb, 1, 0);
ff_mpeg4_stuffing(&s->pb);
if(!(s->flags & CODEC_FLAG_BITEXACT)){
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1B2);
put_string(&s->pb, LIBAVCODEC_IDENT);
ff_mpeg4_stuffing(&s->pb);
}
}
| 1threat
|
static void handle_port_status_write(EHCIState *s, int port, uint32_t val)
{
uint32_t *portsc = &s->portsc[port];
USBDevice *dev = s->ports[port].dev;
*portsc &= ~(val & PORTSC_RWC_MASK);
*portsc &= val | ~PORTSC_PED;
handle_port_owner_write(s, port, val);
val &= PORTSC_RO_MASK;
if ((val & PORTSC_PRESET) && !(*portsc & PORTSC_PRESET)) {
trace_usb_ehci_port_reset(port, 1);
}
if (!(val & PORTSC_PRESET) &&(*portsc & PORTSC_PRESET)) {
trace_usb_ehci_port_reset(port, 0);
if (dev && dev->attached) {
usb_port_reset(&s->ports[port]);
*portsc &= ~PORTSC_CSC;
}
if (dev && dev->attached && (dev->speedmask & USB_SPEED_MASK_HIGH)) {
val |= PORTSC_PED;
}
}
*portsc &= ~PORTSC_RO_MASK;
*portsc |= val;
}
| 1threat
|
How to get text from edit text in android studio : Okay.. I have 2 classes :-
1. Apple.class
2. Banana.class
And 2 .XML file:-
1. Ear.xml
2. Nose.xml
Now, I want to add a edit text box in apple.class
But I want to print that text that user input in banana.class
| 0debug
|
figsize in matplotlib is not changing the figure size? : <p>As you can see the code produces a barplot that is not as clear and I want to make the figure larger so the values can be seen better. This doesn't do it. What is the correct way?
x is a dataframe and <code>x['user']</code> is the x axis in the plot and <code>x['number']</code> is the y.</p>
<pre><code>import matplotlib.pyplot as plt
%matplotlib inline
plt.bar(x['user'], x['number'], color="blue")
plt.figure(figsize=(20,10))
</code></pre>
<p>The line with the plt.figure doesn't change the initial dimensions.</p>
| 0debug
|
static ExitStatus trans_fop_wed_0c(DisasContext *ctx, uint32_t insn,
const DisasInsn *di)
{
unsigned rt = extract32(insn, 0, 5);
unsigned ra = extract32(insn, 21, 5);
return do_fop_wed(ctx, rt, ra, di->f_wed);
}
| 1threat
|
static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven;
int8 roundIncrement, roundBits;
flag isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
roundIncrement = 0x40;
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
roundIncrement = 0;
}
else {
roundIncrement = 0x7F;
if ( zSign ) {
if ( roundingMode == float_round_up ) roundIncrement = 0;
}
else {
if ( roundingMode == float_round_down ) roundIncrement = 0;
}
}
}
roundBits = zSig & 0x7F;
if ( 0xFD <= (bits16) zExp ) {
if ( ( 0xFD < zExp )
|| ( ( zExp == 0xFD )
&& ( (sbits32) ( zSig + roundIncrement ) < 0 ) )
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 );
}
if ( zExp < 0 ) {
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ( zSig + roundIncrement < 0x80000000 );
shift32RightJamming( zSig, - zExp, &zSig );
zExp = 0;
roundBits = zSig & 0x7F;
if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);
}
}
if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
zSig = ( zSig + roundIncrement )>>7;
zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
return packFloat32( zSign, zExp, zSig );
}
| 1threat
|
static void br(DisasContext *dc, uint32_t code, uint32_t flags)
{
I_TYPE(instr, code);
gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16s & -4));
dc->is_jmp = DISAS_TB_JUMP;
}
| 1threat
|
How to change id value using javascript? : <p><strong>I want to change and revert element id while onclick button.</strong></p>
<p><strong>Html</strong> : <code><p id="tprice">Price Total: $<span id="order_total">0</span></p></code></p>
<p>Want to change and revert this id="order_total" to this id="rsorder_total" after click on this button:-</p>
<pre><code><input type="button" value="USD" id="myButton"></input>
</code></pre>
| 0debug
|
Handling oauth2 redirect from electron (or other desktop platforms) : <p>This is mostly a lack of understanding of oauth2 and probably not specific to electron, however I'm trying to wrap my head around how someone would handle an oauth2 redirect url from a desktop platform, like electron?</p>
<p>Assuming there is no webservice setup as part of the app, how would a desktop application prompt a user for credentials against a third party oauth2 service, and then authenticate them correctly?</p>
| 0debug
|
Spring Webflux Async PostgreSQL Publisher Stops After First Result : <p>I am trying to replace a PostgreSQL database poller with the reactive asynchronous <a href="https://github.com/alaisi/postgres-async-driver" rel="noreferrer">postgres-async-driver</a> and stream newly inserted rows to a Spring 5 Webflux Reactive websocket client like <a href="https://stackoverflow.com/users/607357/josh-long">Josh Long</a>'s awesome example demoed <a href="https://stackoverflow.com/questions/48763126/reactive-websockets-with-spring-5-how-to-get-initial-message">here</a> and based on <a href="https://stackoverflow.com/users/1092077/s%C3%A9bastien-deleuze">Sébastien Deleuze's</a> <a href="https://github.com/joshlong/spring-reactive-playground/blob/master/src/main/java/playground/postgres/PostgresPersonRepository.java" rel="noreferrer">spring-reactive-playground</a>.</p>
<p>My <code>Publisher</code> obtains the first <code>row</code>, but then does not return subsequent rows.
Is the problem with my <code>Observable</code>, my <code>Publisher</code>, or with how I am using the postgres-async-driver <code>Db</code>?</p>
<pre><code>public Observable<WebSocketMessage> getObservableWSM(WebSocketSession session){
return
// com.github.pgasync.Db
db.queryRows(sql)
// ~RowMapper method
.map(row -> mapRowToDto(row))
// serialize dto to String for websocket
.map(dto -> { return objectMapper.writeValueAsString(dto); })
// finally, write to websocket session
.map(str -> { return session.textMessage((String) str);
});
}
</code></pre>
<p>Then, I wire the <code>Observable</code> into my <code>WebSocketHandler</code> using a <code>RxReactiveStream.toPublisher</code> converter:</p>
<pre><code>@Bean
WebSocketHandler dbWebSocketHandler() {
return session -> {
Observable<WebSocketMessage> o = getObservableWSM(session);
return session.send(Flux.from(RxReactiveStreams.toPublisher(o)));
};
}
</code></pre>
<p>That will grab the first <code>row</code> from my <code>sql</code> statement, but no additional rows. How do I continue to stream additional rows? </p>
<p>Ideally, I think I want the PostgreSQL equivalent of a MongoDB <a href="https://stackoverflow.com/a/47456820/237225">Tailable cursor</a>.</p>
| 0debug
|
I am getting "Notice: Undefined property: stdClass::$id i in mentioned bold italic line when i call below function : public function userlogin()
{
$sql = 'select id, username from login_user where email="'.$this->email.'"and password="'.$this->password.'"';
$result = mysqli_query($this->cn,$sql);
$numrows = mysqli_num_rows($result);
if($numrows == 1)
{
$data = mysqli_fetch_field($result);
***$uid = $data->id;
$uname = $data->username;***
$_SESSION['login'] = 1;
$_SESSION['uid'] = $uid;
$_SESSION['uname'] = $uname;
$_SESSION['login_msg'] = 'Login Successfully...';
}
}
| 0debug
|
What is the best way for copy specific Data from an external VM : <p>I have to copy some specific data out from a external VM (eVM) from an other firm i don't work.</p>
<p>I have an other VM (aVM) that is analysing data.
So the path of the data should be eVM -> My_PC -> aVM. aVM have no access to eVM. But the whole process should be controlled on aVM.</p>
<p>The collection of the data should happened every day and it should be only for data with '_CPU2' in it. After that aVM will parse (with a parser i implemented in java) the data and send it to other programs.</p>
<p>What is the fastest and the most performant way to implement this process? I do not want to collect not necessary data from eVM and i do not want to leave garbage on this PCs.</p>
<p>My primary languages are Java and python. Also I know the basics from c/c++. I have no big experience. Maybe there are some good classes or functions for it, you can advise me.</p>
<p>Is there maybe a way to do it through batch-files? I want to do it fast, because I will not have much time tomorrow for implementing it. </p>
| 0debug
|
how to connect means with line in two way CI plot..? : <p>how to connect means with line in the above two way CI plot..?? for below
link example.</p>
<p><a href="https://stackoverflow.com/questions/17039886/plot-with-two-y-axes-confidence-intervals">Plot with two Y axes : confidence intervals</a></p>
| 0debug
|
static void apic_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{
}
| 1threat
|
static int virtio_blk_init_pci(PCIDevice *pci_dev)
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
VirtIODevice *vdev;
if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
proxy->class_code != PCI_CLASS_STORAGE_OTHER)
proxy->class_code = PCI_CLASS_STORAGE_SCSI;
if (!proxy->block.bs) {
error_report("virtio-blk-pci: drive property not set");
vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
vdev->nvectors = proxy->nvectors;
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_BLOCK,
proxy->class_code, 0x00);
proxy->nvectors = vdev->nvectors;
return 0;
| 1threat
|
static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVVdiState *s = bs->opaque;
VdiHeader header;
size_t bmap_size;
int ret;
logout("\n");
ret = bdrv_read(bs->file, 0, (uint8_t *)&header, 1);
if (ret < 0) {
goto fail;
}
vdi_header_to_cpu(&header);
#if defined(CONFIG_VDI_DEBUG)
vdi_header_print(&header);
#endif
if (header.disk_size % SECTOR_SIZE != 0) {
logout("odd disk size %" PRIu64 " B, round up\n", header.disk_size);
header.disk_size += SECTOR_SIZE - 1;
header.disk_size &= ~(SECTOR_SIZE - 1);
}
if (header.signature != VDI_SIGNATURE) {
logout("bad vdi signature %08x\n", header.signature);
ret = -EMEDIUMTYPE;
goto fail;
} else if (header.version != VDI_VERSION_1_1) {
logout("unsupported version %u.%u\n",
header.version >> 16, header.version & 0xffff);
ret = -ENOTSUP;
goto fail;
} else if (header.offset_bmap % SECTOR_SIZE != 0) {
logout("unsupported block map offset 0x%x B\n", header.offset_bmap);
ret = -ENOTSUP;
goto fail;
} else if (header.offset_data % SECTOR_SIZE != 0) {
logout("unsupported data offset 0x%x B\n", header.offset_data);
ret = -ENOTSUP;
goto fail;
} else if (header.sector_size != SECTOR_SIZE) {
logout("unsupported sector size %u B\n", header.sector_size);
ret = -ENOTSUP;
goto fail;
} else if (header.block_size != 1 * MiB) {
logout("unsupported block size %u B\n", header.block_size);
ret = -ENOTSUP;
goto fail;
} else if (header.disk_size >
(uint64_t)header.blocks_in_image * header.block_size) {
logout("unsupported disk size %" PRIu64 " B\n", header.disk_size);
ret = -ENOTSUP;
goto fail;
} else if (!uuid_is_null(header.uuid_link)) {
logout("link uuid != 0, unsupported\n");
ret = -ENOTSUP;
goto fail;
} else if (!uuid_is_null(header.uuid_parent)) {
logout("parent uuid != 0, unsupported\n");
ret = -ENOTSUP;
goto fail;
}
bs->total_sectors = header.disk_size / SECTOR_SIZE;
s->block_size = header.block_size;
s->block_sectors = header.block_size / SECTOR_SIZE;
s->bmap_sector = header.offset_bmap / SECTOR_SIZE;
s->header = header;
bmap_size = header.blocks_in_image * sizeof(uint32_t);
bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE;
s->bmap = g_malloc(bmap_size * SECTOR_SIZE);
ret = bdrv_read(bs->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size);
if (ret < 0) {
goto fail_free_bmap;
}
error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
"vdi", bs->device_name, "live migration");
migrate_add_blocker(s->migration_blocker);
return 0;
fail_free_bmap:
g_free(s->bmap);
fail:
return ret;
}
| 1threat
|
static void info_mice_iter(QObject *data, void *opaque)
{
QDict *mouse;
Monitor *mon = opaque;
mouse = qobject_to_qdict(data);
monitor_printf(mon, "%c Mouse #%" PRId64 ": %s\n",
(qdict_get_bool(mouse, "current") ? '*' : ' '),
qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name"));
}
| 1threat
|
How can I get A radar chart like this by chart.js : <p><a href="https://i.stack.imgur.com/4AZR3.png" rel="nofollow noreferrer">radar chart</a></p>
<p>The y axis is vertical default, How can I rotate the y axis!</p>
| 0debug
|
How to return 403 response in JSON format in Laravel 5.2? : <p>I am trying to develop a RESTful API with Laravel 5.2. I am stumbled on how to return failed authorization in JSON format. Currently, it is throwing the 403 page error instead of JSON.</p>
<p>Controller: <code>TenantController.php</code></p>
<pre><code>class TenantController extends Controller
{
public function show($id)
{
$tenant = Tenant::find($id);
if($tenant == null) return response()->json(['error' => "Invalid tenant ID."],400);
$this->authorize('show',$tenant);
return $tenant;
}
}
</code></pre>
<p>Policy: <code>TenantPolicy.php</code></p>
<pre><code>class TenantPolicy
{
use HandlesAuthorization;
public function show(User $user, Tenant $tenant)
{
$users = $tenant->users();
return $tenant->users->contains($user->id);
}
}
</code></pre>
<p>The authorization is currently working fine but it is showing up a 403 forbidden page instead of returning json error. Is it possible to return it as JSON for the 403? And, is it possible to make it global for all failed authorizations (not just in this controller)?</p>
| 0debug
|
Notification error: APN invalid token : <p>I stopped receiving the push notifications after the certificate got expired and new certificate has been created. I've updated the p12 certificate on the server.</p>
<p>I'm using Pusher application to debug the issue further and I tried importing the p12 certificate with the device token. It says "APN invalid token".</p>
<p>Same method works for my other application.</p>
<p><a href="https://i.stack.imgur.com/qJHlc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qJHlc.png" alt="Notification Error: APN invalid token"></a>
Please help me with this I'm not an expert, I tried searching the solution in SO but couldn't find the exact problem.</p>
<p>Any tips will also be appreciated. Thanks in advance!</p>
| 0debug
|
What kubectl command can I use to get events sorted by specific fields and print only specific details of events? : <p>I need to print only specific fields of Kubernetes Events, sorted by a specific field. </p>
<p>This is to help me gather telemetry and analytics about my namespace </p>
<p>How could I do that?</p>
| 0debug
|
telnet don't works between two vm ine the same virtual network Azure : I have à new account in azure (it's my first time) for test i have two vms with ip adress 10.0.0.4/5
the ping is ok between the two VM but the telnet don't works
when i do from vm 1
telnet 10.0.0.5
Trying 10.0.0.5...
telnet: Unable to connect to remote host: Connection refused
it works juste with port 22 but it don't with othen port
can you help me how can i open the connection between my vms
| 0debug
|
static void get_sub_picture(CinepakEncContext *s, int x, int y, AVPicture *in, AVPicture *out)
{
out->data[0] = in->data[0] + x + y * in->linesize[0];
out->linesize[0] = in->linesize[0];
if(s->pix_fmt == AV_PIX_FMT_YUV420P) {
out->data[1] = in->data[1] + (x >> 1) + (y >> 1) * in->linesize[1];
out->linesize[1] = in->linesize[1];
out->data[2] = in->data[2] + (x >> 1) + (y >> 1) * in->linesize[2];
out->linesize[2] = in->linesize[2];
}
}
| 1threat
|
Developing spring boot application with lower footprint : <p>In an attempt to keep our microservices, developed in spring-boot to run on Cloud Foundry, smaller in footprint, we are looking for best approach to achieve the same.</p>
<p>Any inputs or pointers in this direction will be most welcomed.</p>
<p>It's surely the best that one always builds the application upwards starting from bare minimum dependencies, and the add any more only when required. Is there more of good practices to follow to further keep the application smaller in size?</p>
| 0debug
|
Python create xml from xsd : <p>I am new with python and need to implement an interface to an accounting tool. I received some XSD Files which describes the interface. </p>
<p>What is the easiest way to generate the XML according to the XSD?
Is there any module I can use?</p>
<p>Do I have to create the XML all by myself and I can use the XSD just to verify it?
How do I best proceed? </p>
| 0debug
|
How can i swap between two images on click : How can i swap between two images on click forever ( not once ) using JS or jQeury
$("button").click(function(){
$("img").attr("src","The New SRC");
});
This code works but just once
| 0debug
|
python None object : <p>could you please explain what do I get in python with this lines? What does this code creates?</p>
<pre><code> NP = 2
NB = 2
ND = 2
N = NP*NB*ND
M = 2*N + NP*NB
res = [[None] * 3] * (M)
</code></pre>
<p>Thanks in advance!</p>
| 0debug
|
Javascript beginner : I Got easy code here and can't get it to work.
I just started javascript, please help me!
<p id="p">
Test
</p>
<script>
var p_tag = document.getElementById("p");
document.p_tag.innerHTML = "Hey";
</script>
| 0debug
|
static inline void clear_float_exceptions(CPUSPARCState *env)
{
set_float_exception_flags(0, &env->fp_status);
}
| 1threat
|
How can to make programatically AppStore kind of bar? : I have read a lot of similar answers but I'm still not able to get the white translucent navigation bar in iOS 10 and Objective C?
[![AppStore Translucent white nav bar][1]][1]
[1]: https://i.stack.imgur.com/0ZX3L.jpg
| 0debug
|
void init_vlc_rl(RLTable *rl)
{
int i, q;
init_vlc(&rl->vlc, 9, rl->n + 1,
&rl->table_vlc[0][1], 4, 2,
&rl->table_vlc[0][0], 4, 2);
for(q=0; q<32; q++){
int qmul= q*2;
int qadd= (q-1)|1;
if(q==0){
qmul=1;
qadd=0;
}
rl->rl_vlc[q]= av_malloc(rl->vlc.table_size*sizeof(RL_VLC_ELEM));
for(i=0; i<rl->vlc.table_size; i++){
int code= rl->vlc.table[i][0];
int len = rl->vlc.table[i][1];
int level, run;
if(len==0){
run= 66;
level= MAX_LEVEL;
}else if(len<0){
run= 0;
level= code;
}else{
if(code==rl->n){
run= 66;
level= 0;
}else{
run= rl->table_run [code] + 1;
level= rl->table_level[code] * qmul + qadd;
if(code >= rl->last) run+=192;
}
}
rl->rl_vlc[q][i].len= len;
rl->rl_vlc[q][i].level= level;
rl->rl_vlc[q][i].run= run;
}
}
}
| 1threat
|
non standard characters cause program to end : I learning python for data mining and I have a text file that contains a list of world cities and their coordinates. In my code, I am trying to find the coordinates of a list of cities. All works well until there is a name with non-standard characters. I was expecting that the program will skip that city name and move to the next, but it terminates. How to make the program skip names that it cannot find and continue to the next?
lst = ['Paris', 'London', 'Helsinki', 'Amsterdam', 'Sant Julià de Lòria', 'New York', 'Dublin']
source = 'world.txt'
fh = open(source)
n = 0
for line in fh:
line.rstrip()
if lst[n] not in line:
continue
else:
co = line.split(',')
print lst[n], 'Lat: ', co[5], 'Long: ', co[6]
if n < (len(lst)-1):
n = n + 1
else:
break
The outcome of this run is:
>>>
Paris Lat: 33.180704 Long: 67.470836
London Lat: -11.758217 Long: 17.084013
Helsinki Lat: 60.175556 Long: 24.934167
Amsterdam Lat: 6.25 Long: -57.5166667
>>>
| 0debug
|
What is [Cycle Detected] with memory leak? : <p>Visual Studio 2017 Community Edition</p>
<p>I am trying to understand/use the Performance Profiler's Memory Usage in what I feel must be a memory leak in my application (MVVM with custom controls). Three snapshots were taken:</p>
<ol>
<li>Before opening my suspect user control, NewProgressNoteView.xaml.</li>
<li>At the time of running the user control, and </li>
<li>After exiting the NewProgressNoteView.xaml.</li>
</ol>
<p>I then compared snapshot #3 to snapshot #1. In the resulting table, I imposed a filter of "NewProgressNoteView". The below is the results of expanding the instance of the top Doctor_Desk.Views.NewProgressNoteView. Of note is '[Cycle Detected]' which feels suspicious, but I do not know what it means exactly or how to use this information to fix the memory leak(s)? What do I do next?</p>
<p>Any help would be most appreciated.</p>
<p>TIA.</p>
<p><a href="https://i.stack.imgur.com/lQlzg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lQlzg.png" alt="enter image description here"></a></p>
| 0debug
|
Php Download File Not Working : I have wrote a script which download output of text box. This script works fine on local server, it download the file successfully but when i put script on live server, the download file does not work. When "download output" button is clicked, instead of downloading file the output of page is shown on next page. See live script here.. http://www.globalitsoft.net/scripts/test.php
Here is the code of script.
<?php
error_reporting(0);
$mytext = "";
$txt = preg_replace('/\n+/', "\n", trim($_POST['inputtext']));
$text = explode("\n", $txt);
$output = array();
if(isset($_POST["submit"]) || isset($_POST["download"]) ) {
for($i=0;$i<count($text);$i++) {
$output[] .= trim($text[$i]) . ' AAAAA'.PHP_EOL;
}
}
if(isset($_POST["download"]) ) {
ob_clean();
$filename = "file-name-" .date('mdY-His'). '.txt';
$handle = fopen('php://output', "w");
fwrite($handle, implode($output));
fclose($handle);
header('Content-Description: File Transfer');
header("Content-type: application/force-download");
header("Content-Type: application/octet-stream charset=utf-8");
header('Content-Disposition: attachment; filename="'.basename($filename).'"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: public');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen(implode($output)));
readfile($filename);
exit();
}
?>
<form method="POST" action="test.php">
<textarea name="inputtext" rows="10" cols="100" placeholder="Enter Any Text!" required><?php if(!empty($_POST["inputtext"])) { echo $_POST["inputtext"]; } ?></textarea>
<br><br>
<input type="submit" name="submit" value="Do it!">
<br><br>
<p>Output goes here. </p>
<textarea name="oputputtext" rows="10" cols="100" ><?php echo implode($output);?></textarea>
<input type="submit" name="download" value="Download Output">
</form>
| 0debug
|
SAML Signing Certificate - Which SSL Certificate Type? : <p>We're currently developing an SSL solution using SAML 2.0, and until now, have been using self signed certificates for signing the XML requests.</p>
<p>However, as we move to production, we want to use a certificate from a certificate authority. But I'm not really sure what type of certificate to purchase as they are all website centric. For example, single domain, wildcard domain, etc.</p>
<p>For example, have been looking at these:
<a href="https://www.123-reg.co.uk/ssl-certificates/" rel="noreferrer">https://www.123-reg.co.uk/ssl-certificates/</a></p>
<p>I'm fairly knowledgeable when it comes to purchasing SSL certificates for a website. However, as the certificate is just going to be use for signing SAML requests, does it matter which type is purchased? Surely whether it supports a single domain or wildcard domain is irrelevant?</p>
| 0debug
|
hollow rectangle with 3 methods : this is my code
int width;
int height;
put("Enter the width of the rectangle: ");
width = input.nextInt();
put("Enter the height of the rectangle: ");
height = input.nextInt();
rectangle( height, width );
}
public static void put(String text){
System.out.print( text );
}
public static void put(String text, int Number){
int plus;
for ( plus = Number ; plus >= 1; plus-- ){
System.out.print( text);
}
}
public static void rectangle(int height, int width){
int coloum;
int row;
for ( row = 1; row <= height; row++){
put("*", width);
put("\n");
}
}
i want to create a hollow rectangle, and i have to modify only by the rectangle () method
******
* *
* *
******
it should be something like this ^
any idea ?
| 0debug
|
AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address,
uint8_t len, uint8_t *data)
{
AUXReply ret = AUX_NACK;
I2CBus *i2c_bus = aux_get_i2c_bus(bus);
size_t i;
bool is_write = false;
DPRINTF("request at address 0x%" PRIX32 ", command %u, len %u\n", address,
cmd, len);
switch (cmd) {
case WRITE_AUX:
case READ_AUX:
is_write = cmd == READ_AUX ? false : true;
for (i = 0; i < len; i++) {
if (!address_space_rw(&bus->aux_addr_space, address++,
MEMTXATTRS_UNSPECIFIED, data++, 1,
is_write)) {
ret = AUX_I2C_ACK;
} else {
ret = AUX_NACK;
break;
}
}
break;
case READ_I2C:
case WRITE_I2C:
is_write = cmd == READ_I2C ? false : true;
if (i2c_bus_busy(i2c_bus)) {
i2c_end_transfer(i2c_bus);
}
if (i2c_start_transfer(i2c_bus, address, is_write)) {
ret = AUX_I2C_NACK;
break;
}
ret = AUX_I2C_ACK;
while (len > 0) {
if (i2c_send_recv(i2c_bus, data++, is_write) < 0) {
ret = AUX_I2C_NACK;
break;
}
len--;
}
i2c_end_transfer(i2c_bus);
break;
case WRITE_I2C_MOT:
case READ_I2C_MOT:
is_write = cmd == READ_I2C_MOT ? false : true;
ret = AUX_I2C_NACK;
if (!i2c_bus_busy(i2c_bus)) {
if (i2c_start_transfer(i2c_bus, address, is_write)) {
break;
}
} else if ((address != bus->last_i2c_address) ||
(bus->last_transaction != cmd)) {
i2c_end_transfer(i2c_bus);
if (i2c_start_transfer(i2c_bus, address, is_write)) {
break;
}
}
bus->last_transaction = cmd;
bus->last_i2c_address = address;
while (len > 0) {
if (i2c_send_recv(i2c_bus, data++, is_write) < 0) {
i2c_end_transfer(i2c_bus);
break;
}
len--;
}
if (len == 0) {
ret = AUX_I2C_ACK;
}
break;
default:
DPRINTF("Not implemented!\n");
return AUX_NACK;
}
DPRINTF("reply: %u\n", ret);
return ret;
}
| 1threat
|
Take all input of array at a time : p=5
a=[]
for in range(p):
a[i]=int(input().split())
I want to give input like
1 2 3 4 5
at these all input take at a time in an array 'a'
what do I do?
| 0debug
|
JS Extremely new to code and just want to find out why this code is the way it is? : I've only been coding for like 3 days and I've acquired a lot of knowledge on coding in discord.js because i'm currently working on a project that allows me to create a bot using the voice application discord. I've been following some code for a command handler and I know this probably is ludicrous to a lot of people but what does the 'i' and 'f' mean in this code? and how is it defined + how does the code know that its the file name and amount of files? extremely sorry for wasting anyone time but i genuinely couldn't find the answer to this due to it being quite a specific request. All answers are highly appreciated.
| 0debug
|
Pass variable to html template in nodemailer : <p>I want to send email with nodemailer using html template. In that template I need to inject some dynamically some variables and I really can't do that. My code:</p>
<pre><code>var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
smtpTransport = nodemailer.createTransport(smtpTransport({
host: mailConfig.host,
secure: mailConfig.secure,
port: mailConfig.port,
auth: {
user: mailConfig.auth.user,
pass: mailConfig.auth.pass
}
}));
var mailOptions = {
from: 'my@email.com',
to : 'some@email.com',
subject : 'test subject',
html : { path: 'app/public/pages/emailWithPDF.html' }
};
smtpTransport.sendMail(mailOptions, function (error, response) {
if (error) {
console.log(error);
callback(error);
}
});
</code></pre>
<p>Let's say I want in emailWithPDF.html something like this:</p>
<pre><code>Hello {{username}}!
</code></pre>
<p>I've found some examples, where was smth like this:</p>
<pre><code>...
html: '<p>Hello {{username}}</p>'
...
</code></pre>
<p>but I want it in separate html file. Is it possible?</p>
| 0debug
|
static void *vring_map(MemoryRegion **mr, hwaddr phys, hwaddr len,
bool is_write)
{
MemoryRegionSection section = memory_region_find(get_system_memory(), phys, len);
if (!section.mr || int128_get64(section.size) < len) {
goto out;
}
if (is_write && section.readonly) {
goto out;
}
if (!memory_region_is_ram(section.mr)) {
goto out;
}
if (memory_region_is_logging(section.mr)) {
goto out;
}
*mr = section.mr;
return memory_region_get_ram_ptr(section.mr) + section.offset_within_region;
out:
memory_region_unref(section.mr);
*mr = NULL;
return NULL;
}
| 1threat
|
Need suggestion in optimizing the below code : <p>I need some guidance as how can I optimize the below code. As one can see , i am creating a new object everytime to set each value. How can I do it in a better way</p>
<pre><code>Balance[] balance = new Balance[3];
CurAmt curAmt = new CurAmt();
Balance bal = new Balance();
bal.setBalType("currentBalance");
curAmt.setCurCode(entry.getValue().get(0).getAs("CURRENT_BALANCE_CURRENCY_CODE"));
curAmt.setContent(entry.getValue().get(0).getAs("CURRENT_BALANCE"));
bal.setCurAmt(curAmt);
balance[0] = bal;
CurAmt curAmt1 = new CurAmt();
Balance bal1 = new Balance();
bal1.setBalType("availableBalance");
curAmt1.setCurCode(entry.getValue().get(0).getAs("AVAILABLE_BALANCE_CURRENCY_CODE"));
curAmt1.setContent(entry.getValue().get(0).getAs("AVAILABLE_BALANCE"));
bal1.setCurAmt(curAmt1);
balance[1] = bal1;
CurAmt curAmt2 = new CurAmt();
Balance bal2 = new Balance();
bal2.setBalType("interestEarnedYtd");
curAmt2.setCurCode(entry.getValue().get(0).getAs("YTD_CURRENCY_CODE"));
curAmt2.setContent(entry.getValue().get(0).getAs("TD_AMOUNT"));
bal2.setCurAmt(curAmt2);
balance[2] = bal2;
Obj.setBalance(balance);
</code></pre>
| 0debug
|
Can someone help me understand cookies? : I apologize if this belongs outside of stackoverflow but I am at wits-end trying to understand internet cookies.
I have read and completed the tutorials at the following sites:[Whatsmyipadress][1],[w3schools][2],[tutorialspoint][3],[how stuff works][4].
From what I understand - and someone please tell me if I am messed-up, cookies work like:
> client visits site ,
> site requests cookie,
> if cookie does not exist, site creates cookie,
I found this [example][5] and tried to use but everyone has the same name and value:
When I ran tests with different users, everyone returned the same combo `name:bob`
Am I supposed to randomly assign a value? The first link says that users would need to complete a registration-type page and then server would use the info to create an id. This is similar to the tutorial on schools (except their example uses a popup). Is this what I need to do as well?
How are cookies made unique ? From my experience, i wouldn’t be able to personalize any experience b/c everyone would have the same name/value pair.
[1]: https://whatismyipaddress.com/cookie
[2]: https://www.w3schools.com/js/js_cookies.asp
[3]: https://www.tutorialspoint.com/javascript/javascript_cookies.htm
[4]: https://electronics.howstuffworks.com/how-to-tech/how-to-surf-the-web-anonymously1.htm
[5]: https://stackoverflow.com/questions/32353680/how-to-access-browser-session-cookies-from-within-shiny-app
| 0debug
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
QPContext *s = ctx->priv;
AVBufferRef *out_qp_table_buf;
AVFrame *out;
const int8_t *in_qp_table;
int type, stride, ret;
if (!s->qp_expr_str || ctx->is_disabled)
return ff_filter_frame(outlink, in);
out_qp_table_buf = av_buffer_alloc(s->h * s->qstride);
if (!out_qp_table_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
out = av_frame_clone(in);
if (!out) {
ret = AVERROR(ENOMEM);
goto fail;
}
in_qp_table = av_frame_get_qp_table(in, &stride, &type);
av_frame_set_qp_table(out, out_qp_table_buf, s->qstride, type);
if (in_qp_table) {
int y, x;
for (y = 0; y < s->h; y++)
for (x = 0; x < s->qstride; x++)
out_qp_table_buf->data[x + s->qstride * y] = s->lut[129 +
((int8_t)in_qp_table[x + stride * y])];
} else {
int y, x, qp = s->lut[0];
for (y = 0; y < s->h; y++)
for (x = 0; x < s->qstride; x++)
out_qp_table_buf->data[x + s->qstride * y] = qp;
}
ret = ff_filter_frame(outlink, out);
fail:
av_frame_free(&in);
return ret;
}
| 1threat
|
Why are preload link not working for JSON requests ? : <p>The JavaScript on my website loads several JSON to initialize itself.</p>
<p>I would like to preload them so, when the JavaScript will launch an Ajax request on it, they will be loaded instantaneously.</p>
<p>A new <a href="https://w3c.github.io/preload/" rel="noreferrer"><code>link</code></a> tag exists for that.</p>
<p>I tried to use it to load a JSON like that :</p>
<pre><code><link rel="preload" href="/test.json">
</code></pre>
<p>However, Chrome seems to load it twice and present a warning in the console : </p>
<p><em>The resources test.json was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.</em></p>
<p>So it seems that preload doesn’t work for JSON.
Indeed, I haven’t found reference to JSON in <a href="https://w3c.github.io/preload/#link-element-interface-extensions" rel="noreferrer">the specification</a>.</p>
<p>Is that correct or am I doing it wrong ?</p>
| 0debug
|
AWS S3 Object Expiration Less Than 24 Hours : <p>The built in Object Expiration is 1 day (plus the time to next midnight UTC). Is there a mechanism to do this at a more frequent basis? Given it appears that AWS does this across the board at midnight UTC then it's likely there would need to be another mechanism to delete objects sooner. We're looking for something in the 6-8 hour time frame. What other options if any would there be?</p>
<p>Thank you</p>
| 0debug
|
static int net_slirp_init(VLANState *vlan, const char *model, const char *name)
{
if (!slirp_inited) {
slirp_inited = 1;
slirp_init(slirp_restrict, slirp_ip);
}
slirp_vc = qemu_new_vlan_client(vlan, model, name,
slirp_receive, NULL, NULL);
slirp_vc->info_str[0] = '\0';
return 0;
}
| 1threat
|
Merging results from model.predict() with original pandas DataFrame? : <p>I am trying to merge the results of a <code>predict</code> method back with the original data in a <code>pandas.DataFrame</code> object.</p>
<pre><code>from sklearn.datasets import load_iris
from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
import pandas as pd
import numpy as np
data = load_iris()
# bear with me for the next few steps... I'm trying to walk you through
# how my data object landscape looks... i.e. how I get from raw data
# to matrices with the actual data I have, not the iris dataset
# put feature matrix into columnar format in dataframe
df = pd.DataFrame(data = data.data)
# add outcome variable
df['class'] = data.target
X = np.matrix(df.loc[:, [0, 1, 2, 3]])
y = np.array(df['class'])
# finally, split into train-test
X_train, X_test, y_train, y_test = train_test_split(X, y, train_size = 0.8)
model = DecisionTreeClassifier()
model.fit(X_train, y_train)
# I've got my predictions now
y_hats = model.predict(X_test)
</code></pre>
<p>To merge these predictions back with the original <code>df</code>, I try this:</p>
<pre><code>df['y_hats'] = y_hats
</code></pre>
<p>But that raises:</p>
<blockquote>
<p>ValueError: Length of values does not match length of index</p>
</blockquote>
<p>I know I could split the <code>df</code> into <code>train_df</code> and <code>test_df</code> and this problem would be solved, but in reality I need to follow the path above to create the matrices <code>X</code> and <code>y</code> (my actual problem is a text classification problem in which I normalize the <em>entire</em> feature matrix before splitting into train and test). How can I align these predicted values with the appropriate rows in my <code>df</code>, since the <code>y_hats</code> array is zero-indexed and seemingly all information about <em>which</em> rows were included in the <code>X_test</code> and <code>y_test</code> is lost? Or will I be relegated to splitting dataframes into train-test first, and then building feature matrices? I'd like to just fill the rows included in <code>train</code> with <code>np.nan</code> values in the dataframe.</p>
| 0debug
|
C# Calculating Slots hit with AOE in a 4x3 Array : I'm not exactly what terminology to even use to look this up, and I figure the best way to explain it is with an example image.
I have a game field made up of 12 (numbered 1-12) slots, 4 wide and 3 deep, I need to be able to take the main slot number hit and get the numbers of it's neighboring slots for an Area of Effect system.
I'm using c#
[Example Image: AoE on 4x3 array of Slots][1]
[1]: https://i.stack.imgur.com/O02Ae.png
Any help is appreciated.
| 0debug
|
How to use method created when creating an object? : May I know how can I use/call the age method?
Student gg = new Student() {
public void age() {
System.out.println("9");
};
}
| 0debug
|
What is the best way to locally store and quickest way to retrieve app user settings/preferences? : <p>I am new to Xamarin.</p>
<p>In my Xamarin Forms app I only want to notify the user with a push notification if a condition is met(even if the app is in the background). The condition is chosen by user when the user registers.</p>
<p>At the moment I store that choice locally on the phone, using SQL Lite.</p>
<p>In my app the speed to which I notify the user is crucial. On Notification Received I have to check against that condition, so I pull the user's choice out of the local database to see whether to notifiy them or not, but that can cost seconds.</p>
<p>Is there a faster way to retrieve that choice/condition, an alternative faster way than just storing it in a local db file?
These preferences have to be available app wide, in the PCL as well as Android and iOS projects.</p>
<p>Thank you in advance.</p>
| 0debug
|
static void stellaris_enet_cleanup(NetClientState *nc)
{
stellaris_enet_state *s = qemu_get_nic_opaque(nc);
s->nic = NULL;
}
| 1threat
|
bubble sorting problem function not working code running but function not working : function is not working....i mean that array is not sorted it just prints the way i insert integers!
#include <iostream>
using namespace std;
main()
{
int n;
cout << "Enter size of array"<<endl;
cin >> n;
int A[n];
for(int i = 0; i < n; i++)
{
cout << "enter integer"<<endl;
cin >> A[i];
}
for (int i = 0; i < n; i++)
{
cout<<"Sorted Array: ";
cout<<A[i]<<" ";
}
void bubblesort(int A[],int n);
}
void bubbleSort(int A[] , int n)
{
for(int i = 0; i < n; i++)
{
for (int j = 0; j < n -i-1; j++)
{
if(A[j] > A[j+1])
{
int swap = A[j];
A[j] = A[j+1];
A[j+1] = swap;
}
}
}
}
this is my code......the array is not able to be sorted i think my function is not working correctly so please can someone help?!
i often visit
www.geekforgeeks.com
| 0debug
|
mongoDB query for count : I have a mongoDB question on count.
I want to count the number of fields with the name 'appId' by month day year.
I know in SQL you could do this by
"SELECT COUNT(appID)
FROM stats
GROUP BY YEAR(record_date), MONTH(record_date)"
How does that translate to mongodb?
{ $group : {
_id: {
month : { $month : "$date" },
day : { $dayOfMonth : "$date" },
year : { $year : "$date" },
},
count: { $sum: * } *all the fields?
}
}
Also how would I could the number of 'appId' whos 'criticalThreshold' is greater than 'critical'
| 0debug
|
get_field (const unsigned char *data, enum floatformat_byteorders order,
unsigned int total_len, unsigned int start, unsigned int len)
{
unsigned long result;
unsigned int cur_byte;
int cur_bitshift;
cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT;
if (order == floatformat_little)
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1;
cur_bitshift =
((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
result = *(data + cur_byte) >> (-cur_bitshift);
cur_bitshift += FLOATFORMAT_CHAR_BIT;
if (order == floatformat_little)
++cur_byte;
else
--cur_byte;
while ((unsigned int) cur_bitshift < len)
{
if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
result |=
(*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1))
<< cur_bitshift;
else
result |= *(data + cur_byte) << cur_bitshift;
cur_bitshift += FLOATFORMAT_CHAR_BIT;
if (order == floatformat_little)
++cur_byte;
else
--cur_byte;
}
return result;
}
| 1threat
|
void check_file_unfixed_eof_mmaps(void)
{
char *cp;
unsigned int *p1;
uintptr_t p;
int i;
fprintf (stderr, "%s", __func__);
for (i = 0; i < 0x10; i++)
{
p1 = mmap(NULL, pagesize, PROT_READ,
MAP_PRIVATE,
test_fd,
(test_fsize - sizeof *p1) & ~pagemask);
fail_unless (p1 != MAP_FAILED);
p = (uintptr_t) p1;
fail_unless ((p & pagemask) == 0);
fail_unless (p1[(test_fsize & pagemask) / sizeof *p1 - 1]
== ((test_fsize - sizeof *p1) / sizeof *p1));
cp = (void *) p1;
fail_unless (cp[pagesize - 4] == 0);
munmap (p1, pagesize);
}
fprintf (stderr, " passed\n");
}
| 1threat
|
static void test_io_channel_tls(const void *opaque)
{
struct QIOChannelTLSTestData *data =
(struct QIOChannelTLSTestData *)opaque;
QCryptoTLSCreds *clientCreds;
QCryptoTLSCreds *serverCreds;
QIOChannelTLS *clientChanTLS;
QIOChannelTLS *serverChanTLS;
QIOChannelSocket *clientChanSock;
QIOChannelSocket *serverChanSock;
qemu_acl *acl;
const char * const *wildcards;
int channel[2];
struct QIOChannelTLSHandshakeData clientHandshake = { false, false };
struct QIOChannelTLSHandshakeData serverHandshake = { false, false };
Error *err = NULL;
QIOChannelTest *test;
GMainContext *mainloop;
g_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
#define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
#define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
mkdir(CLIENT_CERT_DIR, 0700);
mkdir(SERVER_CERT_DIR, 0700);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
g_assert(link(data->servercacrt,
SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
g_assert(link(data->servercrt,
SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT) == 0);
g_assert(link(KEYFILE,
SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
g_assert(link(data->clientcacrt,
CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
g_assert(link(data->clientcrt,
CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT) == 0);
g_assert(link(KEYFILE,
CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
clientCreds = test_tls_creds_create(
QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT,
CLIENT_CERT_DIR,
&err);
g_assert(clientCreds != NULL);
serverCreds = test_tls_creds_create(
QCRYPTO_TLS_CREDS_ENDPOINT_SERVER,
SERVER_CERT_DIR,
&err);
g_assert(serverCreds != NULL);
acl = qemu_acl_init("channeltlsacl");
qemu_acl_reset(acl);
wildcards = data->wildcards;
while (wildcards && *wildcards) {
qemu_acl_append(acl, 0, *wildcards);
wildcards++;
}
clientChanSock = qio_channel_socket_new_fd(
channel[0], &err);
g_assert(clientChanSock != NULL);
serverChanSock = qio_channel_socket_new_fd(
channel[1], &err);
g_assert(serverChanSock != NULL);
qio_channel_set_blocking(QIO_CHANNEL(clientChanSock), false, NULL);
qio_channel_set_blocking(QIO_CHANNEL(serverChanSock), false, NULL);
clientChanTLS = qio_channel_tls_new_client(
QIO_CHANNEL(clientChanSock), clientCreds,
data->hostname, &err);
g_assert(clientChanTLS != NULL);
serverChanTLS = qio_channel_tls_new_server(
QIO_CHANNEL(serverChanSock), serverCreds,
"channeltlsacl", &err);
g_assert(serverChanTLS != NULL);
qio_channel_tls_handshake(clientChanTLS,
test_tls_handshake_done,
&clientHandshake,
NULL);
qio_channel_tls_handshake(serverChanTLS,
test_tls_handshake_done,
&serverHandshake,
NULL);
mainloop = g_main_context_default();
do {
g_main_context_iteration(mainloop, TRUE);
} while (!clientHandshake.finished &&
!serverHandshake.finished);
g_assert(clientHandshake.failed == data->expectClientFail);
g_assert(serverHandshake.failed == data->expectServerFail);
test = qio_channel_test_new();
qio_channel_test_run_threads(test, false,
QIO_CHANNEL(clientChanTLS),
QIO_CHANNEL(serverChanTLS));
qio_channel_test_validate(test);
test = qio_channel_test_new();
qio_channel_test_run_threads(test, true,
QIO_CHANNEL(clientChanTLS),
QIO_CHANNEL(serverChanTLS));
qio_channel_test_validate(test);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
rmdir(CLIENT_CERT_DIR);
rmdir(SERVER_CERT_DIR);
object_unparent(OBJECT(serverCreds));
object_unparent(OBJECT(clientCreds));
object_unref(OBJECT(serverChanTLS));
object_unref(OBJECT(clientChanTLS));
object_unref(OBJECT(serverChanSock));
object_unref(OBJECT(clientChanSock));
close(channel[0]);
close(channel[1]);
}
| 1threat
|
static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_cue)
{
MatroskaMuxContext *mkv = s->priv_data;
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
int duration = pkt->duration;
int ret;
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
int64_t relative_packet_pos;
int dash_tracknum = mkv->is_dash ? mkv->dash_track_number : pkt->stream_index + 1;
if (ts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_ERROR, "Can't write packet with unknown timestamp\n");
return AVERROR(EINVAL);
}
ts += mkv->tracks[pkt->stream_index].ts_offset;
if (mkv->cluster_pos != -1) {
int64_t cluster_time = ts - mkv->cluster_pts + mkv->tracks[pkt->stream_index].ts_offset;
if ((int16_t)cluster_time != cluster_time) {
av_log(s, AV_LOG_WARNING, "Starting new cluster due to timestamp\n");
mkv_start_new_cluster(s, pkt);
}
}
if (mkv->cluster_pos == -1) {
mkv->cluster_pos = avio_tell(s->pb);
ret = start_ebml_master_crc32(s->pb, &mkv->dyn_bc, &mkv->cluster, MATROSKA_ID_CLUSTER, 0);
if (ret < 0)
return ret;
put_ebml_uint(mkv->dyn_bc, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
mkv->cluster_pts = FFMAX(0, ts);
}
pb = mkv->dyn_bc;
relative_packet_pos = avio_tell(s->pb) - mkv->cluster.pos + avio_tell(pb);
if (par->codec_type != AVMEDIA_TYPE_SUBTITLE) {
mkv_write_block(s, pb, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe);
if (s->pb->seekable && (par->codec_type == AVMEDIA_TYPE_VIDEO && keyframe || add_cue)) {
ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, dash_tracknum, ts, mkv->cluster_pos, relative_packet_pos, -1);
if (ret < 0) return ret;
}
} else {
if (par->codec_id == AV_CODEC_ID_WEBVTT) {
duration = mkv_write_vtt_blocks(s, pb, pkt);
} else {
ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP,
mkv_blockgroup_size(pkt->size));
#if FF_API_CONVERGENCE_DURATION
FF_DISABLE_DEPRECATION_WARNINGS
if (pkt->convergence_duration > 0) {
duration = pkt->convergence_duration;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 1);
put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
end_ebml_master(pb, blockgroup);
}
if (s->pb->seekable) {
ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, dash_tracknum, ts,
mkv->cluster_pos, relative_packet_pos, duration);
if (ret < 0)
return ret;
}
}
mkv->duration = FFMAX(mkv->duration, ts + duration);
if (mkv->stream_durations)
mkv->stream_durations[pkt->stream_index] =
FFMAX(mkv->stream_durations[pkt->stream_index], ts + duration);
return 0;
}
| 1threat
|
How to Grab stdClass Object Result : <p>can i ask ? . I have class cURL POST into a website ( API Integration ) , and if i post with class. The result is (i use print_r) :</p>
<pre><code>stdClass Object
(
[order] => 200029
)
1
</code></pre>
<p>How to grab [order] value?</p>
| 0debug
|
void mips_r4k_init(MachineState *machine)
{
ram_addr_t ram_size = machine->ram_size;
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
char *filename;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *bios;
MemoryRegion *iomem = g_new(MemoryRegion, 1);
MemoryRegion *isa_io = g_new(MemoryRegion, 1);
MemoryRegion *isa_mem = g_new(MemoryRegion, 1);
int bios_size;
MIPSCPU *cpu;
CPUMIPSState *env;
ResetData *reset_info;
int i;
qemu_irq *i8259;
ISABus *isa_bus;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
DriveInfo *dinfo;
int be;
if (cpu_model == NULL) {
#ifdef TARGET_MIPS64
cpu_model = "R4000";
#else
cpu_model = "24Kf";
#endif
}
cpu = cpu_mips_init(cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
reset_info->cpu = cpu;
reset_info->vector = env->active_tc.PC;
qemu_register_reset(main_cpu_reset, reset_info);
if (ram_size > (256 << 20)) {
fprintf(stderr,
"qemu: Too much memory for this machine: %d MB, maximum 256 MB\n",
((unsigned int)ram_size / (1 << 20)));
exit(1);
}
memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size);
memory_region_add_subregion(address_space_mem, 0, ram);
memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu", 0x10000);
memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem);
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;
}
#ifdef TARGET_WORDS_BIGENDIAN
be = 1;
#else
be = 0;
#endif
if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
bios = g_new(MemoryRegion, 1);
memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
&error_fatal);
memory_region_set_readonly(bios, true);
memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);
load_image_targphys(filename, 0x1fc00000, BIOS_SIZE);
} else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) {
uint32_t mips_rom = 0x00400000;
if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom,
blk_by_legacy_dinfo(dinfo),
sector_len, mips_rom / sector_len,
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
}
} else if (!qtest_enabled()) {
fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n",
bios_name);
}
g_free(filename);
if (kernel_filename) {
loaderparams.ram_size = ram_size;
loaderparams.kernel_filename = kernel_filename;
loaderparams.kernel_cmdline = kernel_cmdline;
loaderparams.initrd_filename = initrd_filename;
reset_info->vector = load_kernel();
}
cpu_mips_irq_init_cpu(cpu);
cpu_mips_clock_init(cpu);
memory_region_init_alias(isa_io, NULL, "isa-io",
get_system_io(), 0, 0x00010000);
memory_region_init(isa_mem, NULL, "isa-mem", 0x01000000);
memory_region_add_subregion(get_system_memory(), 0x14000000, isa_io);
memory_region_add_subregion(get_system_memory(), 0x10000000, isa_mem);
isa_bus = isa_bus_new(NULL, isa_mem, get_system_io(), &error_abort);
i8259 = i8259_init(isa_bus, env->irq[2]);
isa_bus_irqs(isa_bus, i8259);
rtc_init(isa_bus, 2000, NULL);
pit = pit_init(isa_bus, 0x40, 0, NULL);
serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
isa_vga_init(isa_bus);
if (nd_table[0].used)
isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);
ide_drive_get(hd, ARRAY_SIZE(hd));
for(i = 0; i < MAX_IDE_BUS; i++)
isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i],
hd[MAX_IDE_DEVS * i],
hd[MAX_IDE_DEVS * i + 1]);
isa_create_simple(isa_bus, "i8042");
}
| 1threat
|
alert('Hello ' + user_input);
| 1threat
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.