problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Who can i show an icon in xamarin? : I´m developing an app in xamarin forms and i want to know how show an icon in a menu, the image of this icon is in the resource folder (drawable). The menu is in a Inavigation page in the same proyect.
I´m trying this with the next code, but it doesn´t work:
`*var iconlogin = new ToolbarItem
{
Icon = "login.png"};*`
`*new Sample("Login", typeof(LoginPage), SampleData.DashboardImagesList[0], iconlogin.Icon, false, false)*`
Thanks!! | 0debug |
Can't bind to 'ngForOf' since it isn't a known property of 'tr' (final release) : <p>I'm using Angular2 Final release (2.1.0). When I want to display a list of companies, I got this error.</p>
<p>in <code>file.component.ts</code> : </p>
<pre><code>public companies: any[] = [
{ "id": 0, "name": "Available" },
{ "id": 1, "name": "Ready" },
{ "id": 2, "name": "Started" }
];
</code></pre>
<p>in <code>file.component.html</code> : </p>
<pre><code><tbody>
<tr *ngFor="let item of companies; let i =index">
<td>{{i}}</td>
<td>{{item.name}}</td>
</tr>
</tbody>
</code></pre>
| 0debug |
void ppc_translate_init(void)
{
int i;
char* p;
size_t cpu_reg_names_size;
static int done_init = 0;
if (done_init)
return;
cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
p = cpu_reg_names;
cpu_reg_names_size = sizeof(cpu_reg_names);
for (i = 0; i < 8; i++) {
snprintf(p, cpu_reg_names_size, "crf%d", i);
cpu_crf[i] = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, crf[i]), p);
p += 5;
cpu_reg_names_size -= 5;
}
for (i = 0; i < 32; i++) {
snprintf(p, cpu_reg_names_size, "r%d", i);
cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, gpr[i]), p);
p += (i < 10) ? 3 : 4;
cpu_reg_names_size -= (i < 10) ? 3 : 4;
#if !defined(TARGET_PPC64)
snprintf(p, cpu_reg_names_size, "r%dH", i);
cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, gprh[i]), p);
p += (i < 10) ? 4 : 5;
cpu_reg_names_size -= (i < 10) ? 4 : 5;
snprintf(p, cpu_reg_names_size, "fp%d", i);
cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, fpr[i]), p);
p += (i < 10) ? 4 : 5;
cpu_reg_names_size -= (i < 10) ? 4 : 5;
snprintf(p, cpu_reg_names_size, "avr%dH", i);
#ifdef HOST_WORDS_BIGENDIAN
cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[0]), p);
#else
cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[1]), p);
p += (i < 10) ? 6 : 7;
cpu_reg_names_size -= (i < 10) ? 6 : 7;
snprintf(p, cpu_reg_names_size, "avr%dL", i);
#ifdef HOST_WORDS_BIGENDIAN
cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[1]), p);
#else
cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[0]), p);
p += (i < 10) ? 6 : 7;
cpu_reg_names_size -= (i < 10) ? 6 : 7;
}
cpu_nip = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, nip), "nip");
cpu_msr = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, msr), "msr");
cpu_ctr = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, ctr), "ctr");
cpu_lr = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, lr), "lr");
cpu_xer = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, xer), "xer");
cpu_reserve = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, reserve_addr),
"reserve_addr");
cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, fpscr), "fpscr");
cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, access_type), "access_type");
#define GEN_HELPER 2
#include "helper.h"
done_init = 1;
} | 1threat |
How do I connect to an sql database server that IS NOT on localhost? : The database I'm trying to connect to is on an AWS server and I'm trying to write a C# script that will pull data from the database. The only tutorials I can find are using localhost. | 0debug |
My program is stopping : <p>This is my class,and my problem is when I call the constructor </p>
<blockquote>
<p>Eveniment e1(1,m1);</p>
</blockquote>
<p>with parameters in main method, my program is stopping and I don't know why. M1 is an object of IntrareCAlendar.</p>
<pre><code>class Eveniment{
private:
const int id;
IntrareCalendar data;
char* detalii;
int static nrIntrari;
public:
Eveniment(int nr,IntrareCalendar ic) :id(nr){
this->data = ic;
nrIntrari++;
}
~Eveniment(){
if (this->detalii != NULL)
delete[]this->detalii;
}
};
</code></pre>
<p>What should I do? thanks a lot!</p>
| 0debug |
TicTacToe 5x5 in Java console : <p>I'm writing a game of noughts and crosses with a 5x5 console sales.
Faced with the following problems:</p>
<p>1) For some reason, game can be finished after the first stroke and the second, depending on what type of cell chosen. For example, when i choosing 0 and 6 cells, X already a winner. Or if you choose the 22nd, the game also ends.</p>
<p>2) A beautiful cell borders. It turns out to make nice or for single-digit or double-digit for. How to make a beautiful table??
Code:</p>
<pre><code>package game;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class GameField {
static int [] canvas = {0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0};
public static void main(String[] args){
boolean b;
boolean isCurrentX = false;
do {
isCurrentX = !isCurrentX;
drawCanvas();
System.out.println("Ходит " + (isCurrentX ? "X" : "O"));
int n = getNumber();
canvas[n] = isCurrentX ? 1 : 2;
b = !isGameOver(n);
if (isDraw()){
System.out.println("Draw");
return;
}
} while (b);
drawCanvas();
System.out.println();
System.out.println("ПОбедитель: " + (isCurrentX ? "X" : "O") + "!");
}
static int getNumber(){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true){
try {
int n = Integer.parseInt(reader.readLine());
if (n >= 0 && n < canvas.length && canvas[n]==0){
return n;
}
System.out.println("Выберите свободное поле и введите его порядковый номер");
} catch (NumberFormatException e) {
System.out.println("Пожалуйста, введите порядковый номер клетки");
} catch (IOException e) {
}
}
}
static boolean isGameOver(int n){
//
// 0 1 2 3 4
// 5 6 7 8 9
// 10 11 12 13 14
// 15 16 17 18 19
// 20 21 22 23 24
int row = n-n%5;
if (canvas[row]==canvas[row+1] &&
canvas[row]==canvas[row+2] &&
canvas[row]==canvas[row+3] &&
canvas[row]==canvas[row+4]) return true;
int column = n%5;
if (canvas[column]==canvas[column+5])
if (canvas[column]==canvas[column+10])
if (canvas[column]==canvas[column+15])
if (canvas[column]==canvas[column+20])return true;
if (n%2!=0) return false;
if (n%4==0){
if (canvas[0] == canvas[6] &&
canvas[0] == canvas[12] &&
canvas[0] == canvas[18] &&
canvas[0] == canvas[24]) return true;
if (n!=4) return false;
}
return canvas[2] == canvas[4] &&
canvas[2] == canvas[8]&&
canvas[2] == canvas[12]&&
canvas[2] == canvas[16]&&
canvas[2] == canvas[20];
}
static void drawCanvas(){
System.out.println(" | | ");
for (int i = 0; i < canvas.length; i++) {
if (i!=0){
if (i%5==0) {
System.out.println();
System.out.println("_____|_____|_____");
System.out.println(" | | ");
}
else
System.out.print("|");
}
if (canvas[i]==0) System.out.print(" " + i + " ");
if (canvas[i]==1) System.out.print(" X ");
if (canvas[i]==2) System.out.print(" O ");
}
System.out.println();
System.out.println(" | | ");
}
public static boolean isDraw() {
for (int n : canvas) if (n==0) return false;
return true;
}
}
</code></pre>
| 0debug |
Check response header's value in Postman tests : <p>I would like to check the value from a concrete response header ("Location") as Test Results in Postman.
In the Postman's documentation I found examples of how to check the existance of headers with</p>
<pre><code>pm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
</code></pre>
<p>But what I'm looking for is something like</p>
<pre><code>pm.test("Location value is correct", function () {
CODE HERE THAT CHECKS "Location" HEADER EQUALS TO SOMETHING;
});
</code></pre>
| 0debug |
void helper_retry(void)
{
env->pc = env->tsptr->tpc;
env->npc = env->tsptr->tnpc;
PUT_CCR(env, env->tsptr->tstate >> 32);
env->asi = (env->tsptr->tstate >> 24) & 0xff;
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
PUT_CWP64(env, env->tsptr->tstate & 0xff);
env->tl--;
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
}
| 1threat |
Animate image on different screen in kivy : <p>I am trying to automatically animate an Image that is placed in another class when the caroussel is switched. With the button it works without problems but not automatically. I tried different things with "id" but I am relatively new to this so maybe there is a general mistake.
Usually there are 2 Screens in the screenmanager and the second screen leads to the caroussel. Due to simplicity I let the first screen out.
Also I am planning to play a movie in Screen1 and want to stop it when the user switches to Screen2.
I think the main question is how can I control functions in a different class.</p>
<pre><code>from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.carousel import Carousel
from kivy.uix.label import Label
from kivy.animation import Animation
from kivy.uix.image import Image
Builder.load_string('''
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
<Screen1>:
name: "screen1"
Image:
id: image1
source: './img/somearrowup.png'
pos: 205, 145
Label:
text: 'Screen down'
BoxLayout:
size_hint: .85,.15
Button:
text: 'Anim1'
on_release: root.anim1()
<Screen2>:
name: "screen2"
Image:
id: image2
source: 'somearrowdown.png'
pos: 205, 55
Label:
text: 'Screen Up'
BoxLayout:
size_hint: .85,.15
Button:
text: 'Anim2'
on_release: root.anim2()
<Carou>:
Screen:
Carousel:
id: carousel
on_index: root.on_index(*args)
direction: 'top'
Screen1:
Screen2:
''')
class Screen1(Screen):
def anim1(self):
self.ids.image1.pos = 205, 155
animation = Animation(pos=(205, 145),t='out_elastic')
animation.start(self.ids.image1)
class Screen2(Screen):
def anim2(self):
self.ids.image2.pos = 205, 55
animation = Animation(pos=(205, 45),t='out_elastic')
animation.start(self.ids.image2)
class Carou(BoxLayout):
def on_index(self, instance, value):
if instance.current_slide.name == 'screen2':
print ("here an animation in Screen2")
screen = Screen2() #doesn't work
screen.anim2() #doesn't work
else:
print ("here an animation in Screen1")
#...
class StartMenu(App):
def build(self):
sm = ScreenManager()
screen = Screen()
screen.add_widget(Carou())
screen.name = 'carousel'
sm.add_widget(screen)
return sm
</code></pre>
<p>I would appreciate your help.</p>
| 0debug |
Why can I assign a value of different type to a variable? : <p>In the book "Go in Action", the author wrote "Values of two different types can’t be assigned to each other, even if they’re compatible".</p>
<p>For example, we can't assign <code>Duration</code> to <code>int64</code> or <code>int64</code> to <code>Duration</code>.</p>
<p>But this is not always true, the following assignment would work like the <code>X</code> value is converted back to <code>[]int</code> automatically:</p>
<pre><code>type X []int
var v []int = X([]int{1, 2, 3})
</code></pre>
<p>What's the difference between these two situations?</p>
| 0debug |
Python how to return the most common items in a list that are closely related in value : Suppose i have a list:
lst = [2.2, 2.23, 2.24, 3, 4, 5, 3.8]
I would like to know if there is a function out there that figures out that my most common and related numbers are:
most_common = [2.2, 2.23, 2.24]
From there i can return the smallest of the list or do whatever other operation i want.
This is the function i am using so far and i am not pleased with the results
max(set(lst), key=lst.count)
Thanks in advance. | 0debug |
def concatenate_tuple(test_tup):
delim = "-"
res = ''.join([str(ele) + delim for ele in test_tup])
res = res[ : len(res) - len(delim)]
return (str(res)) | 0debug |
static void booke_update_fixed_timer(CPUPPCState *env,
uint8_t target_bit,
uint64_t *next,
struct QEMUTimer *timer)
{
ppc_tb_t *tb_env = env->tb_env;
uint64_t lapse;
uint64_t tb;
uint64_t period = 1 << (target_bit + 1);
uint64_t now;
now = qemu_get_clock_ns(vm_clock);
tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset);
lapse = period - ((tb - (1 << target_bit)) & (period - 1));
*next = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq);
if (*next == now) {
(*next)++;
}
qemu_mod_timer(timer, *next);
}
| 1threat |
static void test_qemu_strtoull_max(void)
{
const char *str = g_strdup_printf("%llu", ULLONG_MAX);
char f = 'X';
const char *endptr = &f;
uint64_t res = 999;
int err;
err = qemu_strtoull(str, &endptr, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, ULLONG_MAX);
g_assert(endptr == str + strlen(str));
}
| 1threat |
The declared package "" does not match the expected package "jdbc" :
import java.sql.*; //The declared package "" does not match the expected package "jdbc"
class Oraclecon{
public static void main(String args[]){
try{
//step1 load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","system");
//step3 create the statement object
Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select * from JNTURESULTS");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
//step5 close the connection object
con.close();
}
catch(Exception e){ System.out.println(e);}
}
} | 0debug |
Laravel 5 : Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) : <p>On my Local server everything was good was using mailtrap mail server as smtp server. but when my website is on live server and when I trying to reset password (forgot password ) getting following error screenshot is attached.I am using hostgators cpanels inbuilt smtp.
any more details I will provide if needed.<a href="https://i.stack.imgur.com/WV0QO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WV0QO.png" alt="enter image description here"></a></p>
| 0debug |
How to match all strings that has only one dot using regular expression : <p>I need to capture strings containing only one dot. String will mostly contains domain names like </p>
<p>test.com, fun.test.com, lesh.test.com.</p>
<p>I need to check only the first one and to ignore the string that has more than one dots.</p>
<p>How can I do this using regex?</p>
| 0debug |
Understanding Stacks and Queues in python : <p>So i was given this question. Consider the Stack and the Queue class with standard set of operations. Using the Stack and Queue class, what items are contained in them just before the mysteryFunction is called AND just after the mysteryFunction is called?</p>
<p>Here is the code:</p>
<pre><code>def mysteryFunction(s, q):
q.enqueue('csc148')
q.enqueue(True)
q.enqueue(q.front())
q.enqueue('abstract data type')
for i in range(q.size()):
s.push(q.dequeue())
while not s.is_empty():
q.enqueue(s.pop())
if __name__ == '__main__':
s=Stack()
q=Queue()
#About to call mysteryFunction
#What are contents of s and q at this point?
mysteryFunction(s, q)
#mysteryFunction has been called.
#What are contents of s and q at this point?
</code></pre>
<p>I'm having trouble understanding object oriented programming as i'm new to this topic. Is there any link that breaks down Stacks and Queues and what they do?</p>
| 0debug |
static void apic_bus_deliver(const uint32_t *deliver_bitmask,
uint8_t delivery_mode,
uint8_t vector_num, uint8_t polarity,
uint8_t trigger_mode)
{
APICState *apic_iter;
switch (delivery_mode) {
case APIC_DM_LOWPRI:
{
int i, d;
d = -1;
for(i = 0; i < MAX_APIC_WORDS; i++) {
if (deliver_bitmask[i]) {
d = i * 32 + ffs_bit(deliver_bitmask[i]);
break;
}
}
if (d >= 0) {
apic_iter = local_apics[d];
if (apic_iter) {
apic_set_irq(apic_iter, vector_num, trigger_mode);
}
}
}
return;
case APIC_DM_FIXED:
break;
case APIC_DM_SMI:
foreach_apic(apic_iter, deliver_bitmask,
cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) );
return;
case APIC_DM_NMI:
foreach_apic(apic_iter, deliver_bitmask,
cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) );
return;
case APIC_DM_INIT:
foreach_apic(apic_iter, deliver_bitmask,
apic_init_ipi(apic_iter) );
return;
case APIC_DM_EXTINT:
break;
default:
return;
}
foreach_apic(apic_iter, deliver_bitmask,
apic_set_irq(apic_iter, vector_num, trigger_mode) );
}
| 1threat |
Code Organization Standard : <p>I am required to manually hand code all GUI's for my school assignments. I am working with Java and using GridBagLayout. I read that it is not a good idea to reuse the same GridBagConstraint instance and instead for each component to have it's own GridBagConstraint instance. So if each component gets its own and I specify fill, position, and insets for each one that leads to a lot of lines of code just for the GUI.</p>
<p>This particular assignment I will have a main pane in BorderLayout and 2 other panes that will sit inside that. One will be another BorderLayout that is just a display area for output information, the other will be the labels, text fields and buttons for a user to select multiple files to be used for input. I have broken it down and placed all code for each pane in its own JComponent instance(not sure if that is the correct term). So code looks like:</p>
<pre><code>protected JComponent inputPaneComponent() {
all code for the inputPane goes here
}
</code></pre>
<p>But like I described above using multiple GridBagConstraints and specifics for each component leads to a long group of code. Should I break it apart with empty lines between each component maybe put a comment line above each one stating which component I am working with? Or just a long stack of lines?</p>
<p>This is just a sample I haven't finished coding it all yet. Something like this:</p>
<pre><code>protected JComponent inputPaneComponent() {
JPanel inputPane = new JPanel();
inputPane.setLayout(new GridBagLayout());
inputPane.setBorder(BorderFactory.createTitledBorder("Input Files:"));
GridBagConstraints c0 = new GridBagConstraints();
c0.fill = GridBagConstraints.HORIZONTAL;
c0.gridx = 0;
c0.gridy = 0;
c0.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameLabel, c0);
GridBagConstraints c1 = new GridBagConstraints();
c1.fill = GridBagConstraints.HORIZONTAL;
c1.gridx = 1;
c1.gridy = 0;
c1.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameFileTextField, c1);
GridBagConstraints c2 = new GridBagConstraints();
c2.fill = GridBagConstraints.HORIZONTAL;
c2.gridx = 2;
c2.gridy = 0;
c2.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameFileButton, c2);
return inputPane;
}
</code></pre>
<p>or This:</p>
<pre><code>protected JComponent inputPaneComponent() {
// Set title, layout, and exit condition.
JPanel inputPane = new JPanel();
inputPane.setLayout(new GridBagLayout());
inputPane.setBorder(BorderFactory.createTitledBorder("Input Files:"));
// Create and configure name label.
JLabel nameLabel = new JLabel("Names File:");
GridBagConstraints c0 = new GridBagConstraints();
c0.fill = GridBagConstraints.HORIZONTAL;
c0.gridx = 0;
c0.gridy = 0;
c0.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameLabel, c0);
// Create and configure name file textfield.
JTextField nameFileTextField = new JTextField(60);
GridBagConstraints c1 = new GridBagConstraints();
c1.fill = GridBagConstraints.HORIZONTAL;
c1.gridx = 1;
c1.gridy = 0;
c1.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameFileTextField, c1);
// Create and configure name file button.
JButton nameFileButton = new JButton("Browse");
GridBagConstraints c2 = new GridBagConstraints();
c2.fill = GridBagConstraints.HORIZONTAL;
c2.gridx = 2;
c2.gridy = 0;
c2.insets = new Insets(10, 10, 0, 0);
inputPane.add(nameFileButton, c2);
return inputPane;
}
</code></pre>
<p>I prefer the latter, as to me it is easier to read, but it does add to the length and I'm not that experienced and would like to know what the standard might be.</p>
<p>Thanks for your help, and I hope I'm within the rules for this forum, this is my first post here.</p>
<p>Matt</p>
| 0debug |
Codeignitor 404 Page Not Found in Signup form : Hi everyone I just created my sign up form with email verification but it's giving me error "`404 Page Not Found`" when I click on Sign up button?
Here is my view named as sign_up:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Registeration</title>
<!-- CSS -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
<link rel="stylesheet" href="<?php echo base_url();?>assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/form-elements.css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/style.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Favicon and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo base_url();?>assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo base_url();?>assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo base_url();?>assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="<?php echo base_url();?>assets/ico/apple-touch-icon-57-precomposed.png">
</head>
<body>
<!-- Top menu -->
<nav class="navbar navbar-inverse navbar-no-bg" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--<a class="navbar-brand" href="index.html">Bootstrap Registration Form Template</a>-->
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="top-navbar-1">
<ul class="nav navbar-nav navbar-right">
<li>
<span class="li-text">
Put some information
</span>
<!--<a href="#"><strong>links</strong></a> -->
<span class="li-text">
here to get access:
</span>
<span class="li-social">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-envelope"></i></a>
<a href="#"><i class="fa fa-skype"></i></a>
</span>
</li>
</ul>
</div>
</div>
</nav>
<!-- Top content -->
<div class="top-content">
<div class="inner-bg">
<div class="container">
<div class="row">
<div class="col-sm-7 text">
<h1><strong>Register</strong> Here</h1>
<div class="description">
<div class="row">
</div>
</div>
<div class="top-big-link">
<!--<a class="btn btn-link-1" href="#">Button 1</a>
<a class="btn btn-link-2" href="#">Button 2</a>-->
</div>
</div>
<div class="col-sm-5 form-box">
<div class="form-top">
<div class="form-top-left">
<h3>Sign up now</h3>
<p>Fill in the form below to get instant access:</p>
</div>
<div class="form-top-right">
<i class="fa fa-pencil"></i>
</div>
</div>
<div class="form-bottom">
<?php $attributes = array("name" => "registrationform");
echo form_open("Register/reg", $attributes);?>
<form role="form" action="" method="post" class="registration-form">
<div class="form-group">
<label class="sr-only" for="form-first-name">Full Name</label>
<input type="text" name="name" value="<?php echo set_value('name'); ?>" placeholder="Full Name..." class="form-first-name form-control" id="name" required>
<?php echo form_error('name'); ?></span>
</div>
<div class="form-group">
<label class="sr-only" for="form-email">Email</label>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" placeholder="Email..." class="form-email form-control" id="email" required>
<span class="text-danger">
<span class="text-danger"><?php echo form_error('email'); ?></span>
</div>
<div class="form-group">
<label class="sr-only" for="form-last-name">Password</label>
<input type="password" name="password" placeholder="Password..." class="form-last-name form-control" id="password" required>
<span class="text-danger"><?php echo form_error('password'); ?></span>
</div>
<div class="form-group">
<label class="sr-only" for="form-last-name">Confirm Password</label>
<input type="password" name="password" placeholder="Confirm Password..." class="form-last-name form-control" id="cpassword" required>
<span class="text-danger"><?php echo form_error('cpassword'); ?></span>
</div>
<button type="submit" class="btn">Sign me up!</button>
<button type="reset" class="btn">Cancel!</button>
<?php echo form_close(); ?>
<?php echo $this->session->flashdata('msg'); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Javascript -->
<script src="<?php echo base_url();?>assets/js/jquery-1.11.1.min.js"></script>
<script src="<?php echo base_url();?>assets/bootstrap/js/bootstrap.min.js"></script>
<script src="<?php echo base_url();?>assets/js/jquery.backstretch.min.js"></script>
<script src="<?php echo base_url();?>assets/js/retina-1.1.0.min.js"></script>
<script src="<?php echo base_url();?>assets/js/scripts.js"></script>
<!--[if lt IE 10]>
<script src="assets/js/placeholder.js"></script>
<![endif]-->
</body>
</html>
here is controller named as Register:
<?php
class Register extends CI_Controller
{
function index()
{
$this->reg();
}
function reg()
{
//set validation rules
$this->form_validation->set_rules('name', 'Full Name', 'trim|required|alpha|min_length[3]|max_length[30]|xss_clean');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[cpassword]|md5');
$this->form_validation->set_rules('cpassword', 'Confirm Password', 'trim|required');
$this->load->view('Seller/login');
//validate form input
if ($this->form_validation->run() == FALSE)
{
// fails
$this->load->view('sign_up');
}
else
{
//insert the user registration details into database
$data = array(
'name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'password' => $this->input->post('password')
);
// insert form data into database
if ($this->Seller_model->insertUser($data))
{
// send email
if ($this->Seller_model->sendEmail($this->input->post('email')))
{
// successfully sent mail
$this->session->set_flashdata('msg','<div class="alert alert-success text-center">You are Successfully Registered! Please confirm the mail sent to your Email-ID!!!</div>');
redirect('Register/reg');
}
else
{
// error
$this->session->set_flashdata('msg','<div class="alert alert-danger text-center">Oops! Error. Please try again later!!!</div>');
redirect('Register/reg');
}
}
else
{
// error
$this->session->set_flashdata('msg','<div class="alert alert-danger text-center">Oops! Error. Please try again later!!!</div>');
redirect('Register/reg');
}
}
}
function verify($hash=NULL)
{
if ($this->Seller_model->verifyEmailID($hash))
{
$this->session->set_flashdata('verify_msg','<div class="alert alert-success text-center">Your Email Address is successfully verified! Please login to access your account!</div>');
redirect('Register/reg');
}
else
{
$this->session->set_flashdata('verify_msg','<div class="alert alert-danger text-center">Sorry! There is error verifying your Email Address!</div>');
redirect('Register/reg');
}
}
}
?>
here is model named Seller_model:
<?php
class Admin_model extends CI_Model{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
//insert into user table
function insertUser($data)
{
return $this->db->insert('users', $data);
}
//send verification email to user's email id
function sendEmail($to_email)
{
$from_email = 'team@abc.com'; //change this to yours
$subject = 'Verify Your Email Address';
$message = 'Dear User,<br /><br />Please click on the below activation link to verify your email address.<br /><br /> anywebsite/user/verify/' . md5($to_email) . '<br /><br /><br />Thanks<br />` `Mydomain Team';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.mydomain.com'; //smtp host name
$config['smtp_port'] = '465'; //smtp port number
$config['smtp_user'] = $from_email;
$config['smtp_pass'] = '********'; //$from_email password
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
$this->email->initialize($config);
//send mail
$this->email->from($from_email, 'Mydomain');
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
return $this->email->send();
}
//activate user account
function verifyEmailID($key)
{
$data = array('status' => 1);
$this->db->where('md5(email)', $key);
return $this->db->update('user', $data);
}
}?>
| 0debug |
MySQL & PHP | Update doesnt work , delete working perfect : <?php
> Blockquote
>
> Blockquote
$connect=mysqli_connect('localhost','root','samagulf','wordpress');
$input=filter_input_array(INPUT_POST);
$country=mysqli_real_escape_string($connect,$input["country"]);
$city=mysqli_real_escape_string($connect,$input["city"]);
$for=mysqli_real_escape_string($connect,$input["for"]);
$title=mysqli_real_escape_string($connect,$input["title"]);
$details=mysqli_real_escape_string($connect,$input["details"]);
$price=mysqli_real_escape_string($connect,$input["price"]);
$email=mysqli_real_escape_string($connect,$input["email"]);
$phone=mysqli_real_escape_string($connect,$input["phone"]);
$photo=mysqli_real_escape_string($connect,$input["photo"]);
if($input["action"]==='edit')
{
> Blockquote
$query="UPDATE wp_wpdatatable_1
> Blockquote
SET country=' ".$country." ',city=' ".$city." ',for=' ".$for." ',title='
".$title." ',details=' ".$details." ',price=' ".$price." ',email='
".$email."
',phone=' ".$phone." ',photo=' ".$photo." '
> Blockquote
where wdt_ID=' ".$input["wdt_ID"]." ' ";
> Blockquote
mysqli_query($connect,$query);
}
> Blockquote
if($input["action"]==='delete')
{
> Blockquote
$query="DELETE FROM wp_wpdatatable_1
> Blockquote
where wdt_ID=' ".$input["wdt_ID"]." ' ";
> Blockquote
mysqli_query($connect,$query);
}
> Blockquote
echo json_encode($input);
> Blockquote
?>
| 0debug |
cursor.execute('SELECT * FROM users WHERE username = ' + user_input) | 1threat |
static int rtp_write_header(AVFormatContext *s1)
{
RTPDemuxContext *s = s1->priv_data;
int payload_type, max_packet_size, n;
AVStream *st;
if (s1->nb_streams != 1)
return -1;
st = s1->streams[0];
payload_type = rtp_get_payload_type(st->codec);
if (payload_type < 0)
payload_type = RTP_PT_PRIVATE;
s->payload_type = payload_type;
s->base_timestamp = random();
s->timestamp = s->base_timestamp;
s->ssrc = random();
s->first_packet = 1;
max_packet_size = url_fget_max_packet_size(&s1->pb);
if (max_packet_size <= 12)
return AVERROR_IO;
s->max_payload_size = max_packet_size - 12;
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
case CODEC_ID_MP3:
s->buf_ptr = s->buf + 4;
s->cur_timestamp = 0;
break;
case CODEC_ID_MPEG1VIDEO:
s->cur_timestamp = 0;
break;
case CODEC_ID_MPEG2TS:
n = s->max_payload_size / TS_PACKET_SIZE;
if (n < 1)
n = 1;
s->max_payload_size = n * TS_PACKET_SIZE;
s->buf_ptr = s->buf;
break;
default:
s->buf_ptr = s->buf;
break;
}
return 0;
}
| 1threat |
static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
{
TAKDemuxContext *tc = s->priv_data;
int ret;
if (tc->mlast_frame) {
AVIOContext *pb = s->pb;
int64_t size, left;
left = tc->data_end - avio_tell(s->pb);
size = FFMIN(left, 1024);
if (size <= 0)
return AVERROR_EOF;
ret = av_get_packet(pb, pkt, size);
if (ret < 0)
return ret;
pkt->stream_index = 0;
} else {
ret = ff_raw_read_partial_packet(s, pkt);
}
return ret;
}
| 1threat |
static void mxf_write_system_item(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
AVIOContext *pb = s->pb;
unsigned frame;
uint32_t time_code;
frame = mxf->last_indexed_edit_unit + mxf->edit_units_count;
avio_write(pb, system_metadata_pack_key, 16);
klv_encode_ber4_length(pb, 57);
avio_w8(pb, 0x5c);
avio_w8(pb, 0x04);
avio_w8(pb, 0x00);
avio_wb16(pb, 0x00);
avio_wb16(pb, mxf->tc.start + frame);
if (mxf->essence_container_count > 1)
avio_write(pb, multiple_desc_ul, 16);
else {
MXFStreamContext *sc = s->streams[0]->priv_data;
avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
}
avio_w8(pb, 0);
avio_wb64(pb, 0);
avio_wb64(pb, 0);
avio_w8(pb, 0x81);
time_code = av_timecode_get_smpte_from_framenum(&mxf->tc, frame);
avio_wb32(pb, time_code);
avio_wb32(pb, 0);
avio_wb64(pb, 0);
age set
avio_write(pb, system_metadata_package_set_key, 16);
klv_encode_ber4_length(pb, 35);
avio_w8(pb, 0x83);
avio_wb16(pb, 0x20);
mxf_write_umid(s, 1);
}
| 1threat |
static int flic_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
FlicDemuxContext *flic = s->priv_data;
ByteIOContext *pb = &s->pb;
unsigned char header[FLIC_HEADER_SIZE];
AVStream *st;
int speed;
int magic_number;
flic->pts = 0;
if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
return AVERROR(EIO);
magic_number = AV_RL16(&header[4]);
speed = AV_RL32(&header[0x10]);
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
flic->video_stream_index = st->index;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_FLIC;
st->codec->codec_tag = 0;
st->codec->width = AV_RL16(&header[0x08]);
st->codec->height = AV_RL16(&header[0x0A]);
if (!st->codec->width || !st->codec->height)
return AVERROR_INVALIDDATA;
st->codec->extradata_size = FLIC_HEADER_SIZE;
st->codec->extradata = av_malloc(FLIC_HEADER_SIZE);
memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
av_set_pts_info(st, 33, 1, 90000);
if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) {
flic->frame_pts_inc = FLIC_MC_PTS_INC;
url_fseek(pb, 12, SEEK_SET);
av_free(st->codec->extradata);
st->codec->extradata_size = 12;
st->codec->extradata = av_malloc(12);
memcpy(st->codec->extradata, header, 12);
} else if (magic_number == FLIC_FILE_MAGIC_1) {
flic->frame_pts_inc = speed * 1285.7;
} else if ((magic_number == FLIC_FILE_MAGIC_2) ||
(magic_number == FLIC_FILE_MAGIC_3)) {
flic->frame_pts_inc = speed * 90;
} else {
av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n");
return AVERROR_INVALIDDATA;
}
if (flic->frame_pts_inc == 0)
flic->frame_pts_inc = FLIC_DEFAULT_PTS_INC;
return 0;
}
| 1threat |
static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy,
int n, bool assign, bool set_handler)
{
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtQueue *vq = virtio_get_queue(vdev, n);
EventNotifier *notifier = virtio_queue_get_host_notifier(vq);
int r = 0;
if (assign) {
r = event_notifier_init(notifier, 1);
if (r < 0) {
error_report("%s: unable to init event notifier: %d",
__func__, r);
return r;
}
virtio_queue_set_host_notifier_fd_handler(vq, true, set_handler);
memory_region_add_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2,
true, n, notifier);
} else {
memory_region_del_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2,
true, n, notifier);
virtio_queue_set_host_notifier_fd_handler(vq, false, false);
event_notifier_cleanup(notifier);
}
return r;
}
| 1threat |
"Project jdk is not defined" in an IntelliJ's 2016.3 JavaScript Project : <p>After update to IntelliJ IDEA 2016.3 I get the warning: "project jdk is not defined" in a JavaScript/Node/React project. Have I overseen something? How to solve it? Under "Setup JDK" link I cannot find any notes that fit.</p>
| 0debug |
style attribute '@android:attr/windowEnterAnimation' not found : <p>I opened the android project, i got this error, how do i fix it?</p>
<p>Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Warning:The <code>android.dexOptions.incremental</code> property is deprecated and it has no effect on the build process.
/Users/Ren/Desktop/17live/app/src/main/res/values/styles.xml
Error:(515, 5) style attribute '@android:attr/windowEnterAnimation' not found
Error:(515, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:(577, 5) style attribute '@android:attr/windowEnterAnimation' not found
Error:(577, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:/Users/Ren/Desktop/17live/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:3534 style attribute '@android:attr/windowEnterAnimation' not found
Error:/Users/Ren/Desktop/17live/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:3796 style attribute '@android:attr/windowEnterAnimation' not found
Error:failed linking references
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':app:processDebugResources'.</p>
<blockquote>
<p>Failed to execute aapt
Information:BUILD FAILED in 13s
Information:10 errors
Information:1 warning
Information:See complete output in console</p>
</blockquote>
| 0debug |
How to filter English letters in String? : <p>How to filter English letters in String using Swift like this:</p>
<p><code>
2017-08-23T13:00:00+08:00
</code></p>
<p>Delete the 'T' in time string:</p>
<p><code>
2017-08-23 13:00:00 +08:00
</code></p>
| 0debug |
C3JS - Cannot read property 'category10' of undefined : <p>I tried this c3.js code from jsfiddle (<a href="https://jsfiddle.net/varunoberoi/mcd6ucge">https://jsfiddle.net/varunoberoi/mcd6ucge</a>) but it doesn't seem to work in my localhost.</p>
<p>I'm using uniserver as my server. I copy-paste everything but it's not working. </p>
<pre><code><html>
<head>
<!-- CSS -->
<link href="css/c3.css" rel="stylesheet" type="text/css" />
<!-- JAVASCRIPT -->
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/c3.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload=function(){
var chart = c3.generate({
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 0],
['data2', 130, 100, 140, 200, 150, 50]
],
types: {
data1: 'area',
data2: 'area-spline'
}
},
axis: {
y: {
padding: {bottom: 0},
min: 0
},
x: {
padding: {left: 0},
min: 0,
show: false
}
}
});
}
</script>
</head>
<body>
<div id="chart"></div>
</body>
</html>
</code></pre>
<p>What I got when I check the Developer Tools' console is this:</p>
<pre><code>c3.js:5783 Uncaught TypeError: Cannot read property 'category10' of undefined
</code></pre>
<p>I tried different versions of c3.js but nothing. It's weird because it's working in jsfiddle and not in my local.</p>
| 0debug |
Android Studio Map and Cardview Activitys : [example Image][1]
[1]: https://i.stack.imgur.com/99PN2.jpg
Is there a way I can have a **RecyclerView/Cardview** overlaying a maps activity like the example picture I have linked here, been searching everywhere on google for an answer or tutorial?
Thanks in advanced guys. | 0debug |
Regular expression to match "verb" but not the "verb" in "adverb" : <p>How might I specify a regular expression in Python 3 such that it matches occurences of the word "verb" only outside of words that contain it?</p>
<p>For example in the sentence: "The man ADVERB VERB and VERB until he was ready."</p>
<p>The regular expression would match the two occurences of the pure word "VERB", but not the occurence of "VERB" in the word "ADVERB".</p>
| 0debug |
How to search for command line arguments in C? : <p>I have compiled and run a C code (a lot of files) but I need to understand the physical meaning of the command line arguments.I run code like this</p>
<pre><code>./testmt signal1 3 5 1 1
</code></pre>
<p>where
signal1 is the input file</p>
<p>How to search multiple .c files in order to find command line arguments(hopefully with commented lines)?</p>
| 0debug |
How to find the nearest neighbors for latitude and longitude point on python? : <p><strong>Input:</strong></p>
<pre><code>point = (lat, long)
places = [(lat1, long1), (lat2, long2), ..., (latN, longN)]
count = L
</code></pre>
<p><strong>Output:</strong>
<code>neighbors</code> = subset of <code>places</code> close to the <code>point</code>. (<code>len(neighbors)=L</code>)</p>
<p><strong>Question:</strong>
Can I use kd-tree for quick nearest-neighbor<strong>s</strong> lookup for points with latitude and longitude? (For example, implementation in <em>scipy</em>)</p>
<p>Is it necessary to transform the geographical coordinates (latitude and longitude) of the point in the coordinates x,y?</p>
<p>Is it the best way to solve this?</p>
| 0debug |
Hello, I'm suppose to convert some c code to java code. : I was giving some c code to convert to java code. implement three different methods of generating all N!
permutations of N elements in Java. The code I provided is my converted c code to java, I was successful up until this line of code, swap((n & 0x01) ? 1 : i, n);...in the permute3 method, Im not entirely sure what it is doing or means and i need to know how to write the equivalent in java.
public class Permute {
public static final long MILLION = 1000000L;
static int N;
static char p[];
static int[][] table = { {0}, {0, 1}, {0, 1, 1}, {0, 1, 2, 3},
{0, 3, 1, 3, 1},
{0, 3, 4, 3, 2, 3},
{0, 5, 3, 1, 5, 3, 1},
{0, 5, 2, 7, 2, 1, 2, 3},
{0, 7, 1, 5, 5, 3, 3, 7, 1},
{0, 7, 8, 1, 6, 5, 4, 9, 2, 3},
{0, 9, 7, 5, 3, 1, 9, 7, 5, 3, 1},
{0, 9, 6, 3, 10, 9, 4, 3, 8, 9, 2, 3}};
public static void init()
{
p = new char[27];
p[0] = '*';
for(int i = 0; i < 26; i++)
{
p[i + 1] = (char) ('A'+i);
}
}
public static void swap(int i, int j)
{
char c;
c = p[i];
p[i] = p[j];
p[j] = c;
}
static void printIt()
{
long count = 0;
//to compare performance, comment out from here
for (int i = 1; i <= N; i++)
System.out.printf("%c", p[i]);
System.out.printf("\n");
//to here
count++;
}
static void permute1(int n)
{
if(n == 1)
{
printIt();
}
for(int i = 1; i <= n; i++)
{
swap(i, n);
permute1(n-1);
swap(i, n);
}
}
static void permute2(int n)
{
if(n == 1)
{
printIt();
return;
}
for(int i = 1; i <= n; i++)
{
permute2(n-1);
swap(table[n][i], n);
}
}
static void permute3(int n)
{
if(n == 1)
{
printIt();
return;
}
for(int i = 1; i <= n; i++)
{
permute3(n - 1);
swap((n & 0x01) ? 1 : i, n);
}
}
public static void main(String[] args) {
/*N = Integer.parseInt(args[0]);
int alg = Integer.parseInt(args[1]);*/
if(args.length <= 0)
{
N = 4;
int alg = 1;
init();
long startTime = System.nanoTime();
permute1(N);
long endTime = System.nanoTime();
float duration = ((endTime - startTime)/ MILLION);
System.out.printf("permute%1d, N = %d, %f\n",alg, N, duration);
}
else
{
N = Integer.parseInt(args[0]);
int alg = Integer.parseInt(args[1]);
switch(alg)
{
case 1:
init();
long startTime = System.nanoTime();
permute1(N);
long endTime = System.nanoTime();
float duration = ((endTime - startTime)/ MILLION);
System.out.printf("permute%1d, N = %d, %f\n",alg, N, duration);
break;
case 2:
init();
long startTime2 = System.nanoTime();
permute2(N);
long endTime2 = System.nanoTime();
float duration2 = (endTime2 - startTime2) / MILLION;
System.out.printf("permute%1d, N = %d, %f\n",alg, N, duration2);
break;
case 3:
init();
long startTime3 = System.nanoTime();
permute3(N);
long endTime3 = System.nanoTime();
float duration3 = (endTime3 - startTime3)/ MILLION;
System.out.printf("permute%1d, N = %d, %f\n",alg, N, duration3);
break;
default:
}
}
}
} | 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
static void qdict_setup(void)
{
tests_dict = qdict_new();
fail_unless(tests_dict != NULL);
}
| 1threat |
Am I able to add a member-wise initializer to a Codable-conforming object? : <p>I currently have a class that conforms to Codable and has an initializer like so</p>
<pre><code>public class A: Codable {
var aString: String?
public init(input: String?) {
self.aString = input
}
}
</code></pre>
<p>When I try to create an instance of it, I get an error</p>
<pre><code>let myA = A(input: "Goodbye world")
</code></pre>
<blockquote>
<p>Incorrect argument label in call (have 'input:', expected 'from:')</p>
</blockquote>
<p>Am I restricted to only the <code>init(from decoder: Decoder) throws</code> initializer for Codable classes?</p>
| 0debug |
Why set a React Component's state outside of the constructor? : <p>So I just downloaded source code from a React framework, and I'm getting this error in Terminal:</p>
<pre><code> ERROR in ./src/components/TextEditor.js
Module build failed: SyntaxError: Unexpected token (24:8)
22 |
23 | // Set the initial state when the app is first constructed.
> 24 | state = {
| ^
25 | state: initialState
26 | }
27 |
</code></pre>
<p>My question is, why do people set a React Component's state like this? What's the benefit if it'll error for some people? Also, is there a Babel preset or plugin I can get to prevent this error?</p>
<p>This is how I usually set a component's state, and from what I've seen, this is conventional:</p>
<pre><code>constructor() {
super();
this.state = {
state: initialState
};
}
</code></pre>
<p>For the record, this is the entire document:</p>
<pre><code>// Import React!
import React from 'react'
import {Editor, Raw} from 'slate'
const initialState = Raw.deserialize({
nodes: [
{
kind: 'block',
type: 'paragraph',
nodes: [
{
kind: 'text',
text: 'A line of text in a paragraph.'
}
]
}
]
}, { terse: true })
// Define our app...
export default class TextEditor extends React.Component {
// Set the initial state when the app is first constructed.
state = {
state: initialState
}
// On change, update the app's React state with the new editor state.
render() {
return (
<Editor
state={this.state.state}
onChange={state => this.setState({ state })}
/>
)
}
}
</code></pre>
| 0debug |
static void handle_buffered_io(void *opaque)
{
XenIOState *state = opaque;
if (handle_buffered_iopage(state)) {
timer_mod(state->buffered_io_timer,
BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
} else {
timer_del(state->buffered_io_timer);
xc_evtchn_unmask(state->xce_handle, state->bufioreq_local_port);
}
}
| 1threat |
static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd,
const char **p, int line_num)
{
int val;
char arg[1024];
if (!av_strcasecmp(cmd, "Port") || !av_strcasecmp(cmd, "HTTPPort")) {
if (!av_strcasecmp(cmd, "Port"))
WARNING("Port option is deprecated, use HTTPPort instead\n");
ffserver_get_arg(arg, sizeof(arg), p);
val = atoi(arg);
if (val < 1 || val > 65536)
ERROR("Invalid port: %s\n", arg);
if (val < 1024)
WARNING("Trying to use IETF assigned system port: %d\n", val);
config->http_addr.sin_port = htons(val);
} else if (!av_strcasecmp(cmd, "HTTPBindAddress") || !av_strcasecmp(cmd, "BindAddress")) {
if (!av_strcasecmp(cmd, "BindAddress"))
WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n");
ffserver_get_arg(arg, sizeof(arg), p);
if (resolve_host(&config->http_addr.sin_addr, arg) != 0)
ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
} else if (!av_strcasecmp(cmd, "NoDaemon")) {
WARNING("NoDaemon option has no effect, you should remove it\n");
} else if (!av_strcasecmp(cmd, "RTSPPort")) {
ffserver_get_arg(arg, sizeof(arg), p);
val = atoi(arg);
if (val < 1 || val > 65536)
ERROR("%s:%d: Invalid port: %s\n", arg);
config->rtsp_addr.sin_port = htons(atoi(arg));
} else if (!av_strcasecmp(cmd, "RTSPBindAddress")) {
ffserver_get_arg(arg, sizeof(arg), p);
if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0)
ERROR("Invalid host/IP address: %s\n", arg);
} else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) {
ffserver_get_arg(arg, sizeof(arg), p);
val = atoi(arg);
if (val < 1 || val > 65536)
ERROR("Invalid MaxHTTPConnections: %s\n", arg);
config->nb_max_http_connections = val;
} else if (!av_strcasecmp(cmd, "MaxClients")) {
ffserver_get_arg(arg, sizeof(arg), p);
val = atoi(arg);
if (val < 1 || val > config->nb_max_http_connections)
ERROR("Invalid MaxClients: %s\n", arg);
else
config->nb_max_connections = val;
} else if (!av_strcasecmp(cmd, "MaxBandwidth")) {
int64_t llval;
ffserver_get_arg(arg, sizeof(arg), p);
llval = strtoll(arg, NULL, 10);
if (llval < 10 || llval > 10000000)
ERROR("Invalid MaxBandwidth: %s\n", arg);
else
config->max_bandwidth = llval;
} else if (!av_strcasecmp(cmd, "CustomLog")) {
if (!config->debug)
ffserver_get_arg(config->logfilename, sizeof(config->logfilename), p);
} else if (!av_strcasecmp(cmd, "LoadModule")) {
ERROR("Loadable modules no longer supported\n");
} else
ERROR("Incorrect keyword: '%s'\n", cmd);
return 0;
}
| 1threat |
HTML CSS layout pushing elements down the page : <p>I have this HTML </p>
<pre><code><div class="container">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
<div class="four"></div>
<div>
</code></pre>
<p>and I'm trying to create this layout</p>
<p><a href="https://i.stack.imgur.com/18DNo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/18DNo.png" alt="enter image description here"></a></p>
<p>1, 3 and 3 are set to display block and width of 33%.
4 is set to inline-block and width of 60%</p>
<p>The layout appears as I want it to but as I add content to 4, it pushes 1, 2 and 3 down the page so it's not top aligned.</p>
<p>Any help is much appreciated</p>
| 0debug |
Can make an abstract final class in java ? : <p>I tried making an abstract class and final but i cant make a abstract final class in JAVA </p>
<blockquote>
<p>Abstract final class A{
Constructor()
Body
} </p>
</blockquote>
| 0debug |
static int qio_channel_socket_connect_worker(QIOTask *task,
Error **errp,
gpointer opaque)
{
QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));
SocketAddress *addr = opaque;
int ret;
ret = qio_channel_socket_connect_sync(ioc,
addr,
errp);
object_unref(OBJECT(ioc));
return ret;
}
| 1threat |
def min_Swaps(str1,str2) :
count = 0
for i in range(len(str1)) :
if str1[i] != str2[i] :
count += 1
if count % 2 == 0 :
return (count // 2)
else :
return ("Not Possible") | 0debug |
Am I using the ternary operator? : <p>Here is my code:</p>
<pre><code>echo "<option value=".$crew_rank_id.".(($crew_rank_id == $crew_rank) ? "selected" : "").>".$crew_rank_table."</option>";
</code></pre>
<p>what im trying to do is echo out the selected value from the database in <code>echo</code> </p>
| 0debug |
Can i handle back button within methods in vuejs 2 : <p>I need some help in vuejs 2. I want to detect back button pressed event. I did some research and found this,</p>
<pre><code>document.addEventListener("backbutton", yourCallBackFunction, false");
</code></pre>
<p>I think it is global event. I need something local, within a method. where i can use some logic.</p>
<pre><code>methods: {
backButtonPressed() {
}
}
</code></pre>
<p>Or can i bind the global one to local function? Can anyone help me with that? TIA</p>
| 0debug |
I'm having issues with my PHP script that sends info submitted from html form : <p>so i'm writing this script to make uploading into my table significantly quicker. I'm not quite sure what's wrong but no matter what I do, I get a "query failed" echo rather than having the content get to the table. Any help is greatly appreciated.</p>
<pre><code><?php
session_start();
$singer_name = ($_POST['singer_name']);
$song_name = ($_POST['song_name']);
$ctg_name = ($_POST['ctg_name']);
$mp3 = ($_POST['mp3']);
$album_cover = ($_POST['album_cover']);
$link = mysqli_connect("example.com", "user", "pass", "example");
$sql = "INSERT INTO song (singer_name, song_name, ctg_name, mp3, album_cover)
VALUES ('$insertsinger_name, $insertsong_name, $insertctg_name, $insertmp3, $insertalbum_cover')";
if(mysqli_query($link, $sql)){
mysqli_close($link);
session_write_close();
header("location: songadmin.php");
exit();
} else{
die("Query Failed");
}
?>
</code></pre>
| 0debug |
static int usb_host_scan(void *opaque, USBScanFunc *func)
{
Monitor *mon = cur_mon;
FILE *f = NULL;
DIR *dir = NULL;
int ret = 0;
const char *fs_type[] = {"unknown", "proc", "dev", "sys"};
char devpath[PATH_MAX];
if (!usb_fs_type) {
dir = opendir(USBSYSBUS_PATH "/devices");
if (dir) {
strcpy(devpath, USBDEVBUS_PATH);
usb_fs_type = USB_FS_SYS;
closedir(dir);
dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH);
goto found_devices;
}
f = fopen(USBPROCBUS_PATH "/devices", "r");
if (f) {
strcpy(devpath, USBPROCBUS_PATH);
usb_fs_type = USB_FS_PROC;
fclose(f);
dprintf(USBDBG_DEVOPENED, USBPROCBUS_PATH);
goto found_devices;
}
f = fopen(USBDEVBUS_PATH "/devices", "r");
if (f) {
strcpy(devpath, USBDEVBUS_PATH);
usb_fs_type = USB_FS_DEV;
fclose(f);
dprintf(USBDBG_DEVOPENED, USBDEVBUS_PATH);
goto found_devices;
}
found_devices:
if (!usb_fs_type) {
monitor_printf(mon, "husb: unable to access USB devices\n");
return -ENOENT;
}
usb_host_device_path = qemu_mallocz(strlen(devpath)+1);
strcpy(usb_host_device_path, devpath);
monitor_printf(mon, "husb: using %s file-system with %s\n",
fs_type[usb_fs_type], usb_host_device_path);
}
switch (usb_fs_type) {
case USB_FS_PROC:
case USB_FS_DEV:
ret = usb_host_scan_dev(opaque, func);
break;
case USB_FS_SYS:
ret = usb_host_scan_sys(opaque, func);
break;
default:
ret = -EINVAL;
break;
}
return ret;
}
| 1threat |
Mi subconsulta solo me muestra un registro y agrego mas y ya no los muestra me manda error,la estoy haciendo en SQL Server 2014 : SELECT ListaMaestra.id_ListaMaestra,ListaMaestra.Clave,ListaMaestra.Nombre_P,ListaMaestra.Modulo_P,ListaMaestra.Caracteristicas,ListaMaestra.Tipo_Formato,
ListaMaestra.Fecha_Emision,ListaMaestra.Fecha_Revision,ListaMaestra.Revision,ListaMaestra.Norma,empleado.nombre,cargo.nombre_cargo,
(select empleado.nombre from ListaMaestra,empleado WHERE ListaMaestra.Nombre_Reviso = empleado.id_empleado) AS Nombre_Elaboro,
(select cargo.nombre_cargo from ListaMaestra,cargo WHERE ListaMaestra.Cargo_Reviso = cargo.id_cargo) AS Cargo_Elaboro,ListaMaestra.Estatus,ListaMaestra.Ruta_PDF
FROM ListaMaestra,empleado,cargo
WHERE ListaMaestra.Nombre_Elaboro = empleado.id_empleado AND ListaMaestra.Cargo_Elaboro = cargo.id_cargo | 0debug |
Webpack error, Loading chunk failed : <p>Stack: Webpack 4.16.0, Node8, Vuejs2</p>
<p>I am seeing the below error, whilst serving my Vuejs application.</p>
<pre><code>Error: Loading chunk 4 failed.
(missing: https://myapp.com/ui.chunk.bundle.js)
at HTMLScriptElement.s (demo:1)
</code></pre>
<p>This error is consistent across builds, the actual file itself is accesible via the URL.</p>
<p>I am using code splitting via <code>import()</code> and the initial app loads fine, but then the flow will break when another chunk is loaded, it can also vary between <code>ui.chunk.bundle.js</code> & <code>vendors~ui.chunk.bundle.js</code>.</p>
<p>When building for production, a new error is shown, but it seems related as also linked to loading modules:</p>
<pre><code>demo:1 TypeError: Cannot read property 'call' of undefined
at o (demo:1)
at Object.349 (ui.chunk.bundle.js:1)
at o (demo:1)
at o.t (demo:1)
</code></pre>
<p>I have tried upgrading webpack and babel, but am at a loss as to what this could be down to as it was working perfectly fine before.</p>
<p>When running the application on my local machine and not Google App Engine, everything seems fine.</p>
<p><strong>How the app is loaded:</strong>
It is loaded into other website via a script tag, so <code>domainA.com</code> runs the script tag which calls <code>myapp.com/js</code> and the flow begins, i.e the app loads various chunks based on some logic.</p>
<p>When accessing the webpack generated index page bundle at myapp.com everything loads correctly.</p>
<p>Please help!</p>
| 0debug |
static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
{
ALSSpecificConfig *sconf = &ctx->sconf;
AVCodecContext *avctx = ctx->avctx;
GetBitContext *gb = &ctx->gb;
*bd->raw_samples = 0;
*bd->const_block = get_bits1(gb);
bd->js_blocks = get_bits1(gb);
skip_bits(gb, 5);
if (*bd->const_block) {
unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample;
*bd->raw_samples = get_sbits_long(gb, const_val_bits);
}
*bd->const_block = 1;
}
| 1threat |
Generate Every Possible 2 Character Combination : <p>How can I generate a string that contains a every 2 character combination of input ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</p>
<p>Output would be formatted like this:</p>
<pre><code>00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
...
2g
2h
2i
2j
2k
2l
2m
2n
2o
2p
2q
2r
2s
2t
2u
2v
2w
2x
2y
2z
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
</code></pre>
<p>The total length of the output would be 3844 lines.</p>
| 0debug |
static void pool_release_buffer(void *opaque, uint8_t *data)
{
BufferPoolEntry *buf = opaque;
AVBufferPool *pool = buf->pool;
add_to_pool(buf);
if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
buffer_pool_free(pool);
}
| 1threat |
How to solve this i don't add data using by $_Post Method, but without $_POST method showing undefine variable? : if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['age'])){
//Getting values
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$age = $_POST['age'];
//Creating an sql query
$sql = "INSERT INTO info (firstname,lastname,age) VALUES ('$firstname','$lastname','$age')";
//Importing our db connection script
require_once('connect.php');
//Executing query to database
if(mysqli_query($con,$sql)){
echo 'Employee Added Successfully';
}else{
echo 'Could Not Add Employee';
}
//Closing the database
mysqli_close($con);
} | 0debug |
i need to display folder contents in gridview & add 3 fields which will be updated or deleted : here is my code for displaying folder contents:
DataTable table = new DataTable();
table.Columns.Add("File Name");
table.Columns.Add("Sequence");
for (int i = 0; i < files.Length; i++)
{
FileInfo file = new FileInfo(files[i]);
table.Rows.Add(file.Name);
}
dataGridView1.DataSource = table; | 0debug |
How to read doc file in editorpane : I am trying to view word file in my editor pane
I tried these lines
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.File;
import java.io.FileInputStream;
import javax.swing.JEditorPane;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
public class editorpane extends JEditorPane
{
public editorpane(File file)
{
try
{
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
HWPFDocument hwpfd = new HWPFDocument(fis);
WordExtractor we = new WordExtractor(hwpfd);
String[] array = we.getParagraphText();
for (int i = 0; i < array.length; i++)
{
this.setPage(array[i]);
}
} catch (Exception e)
{
e.printStackTrace();
}
but gives me
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:131)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:138)
at org.apache.poi.hwpf.HWPFDocumentCore.verifyAndBuildPOIFS(HWPFDocumentCore.java:106)
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:174)
at frame1.editorpane.<init>(editorpane.java:24)
in this line
HWPFDocument hwpfd = new HWPFDocument(fis);
how can I solve that ??
beside I am not sure about these lines
for (int i = 0; i < array.length; i++)
{
this.setPage(array[i]);
}
can I get them confirmed ??
| 0debug |
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
{
AVFilterContext *ctx = inlink->dst;
ASyncContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
int nb_channels = av_get_channel_layout_nb_channels(buf->audio->channel_layout);
int64_t pts = (buf->pts == AV_NOPTS_VALUE) ? buf->pts :
av_rescale_q(buf->pts, inlink->time_base, outlink->time_base);
int out_size, ret;
int64_t delta;
if (s->pts == AV_NOPTS_VALUE) {
if (pts != AV_NOPTS_VALUE) {
s->pts = pts - get_delay(s);
}
return write_to_fifo(s, buf);
}
if (pts == AV_NOPTS_VALUE) {
return write_to_fifo(s, buf);
}
delta = pts - s->pts - get_delay(s);
out_size = avresample_available(s->avr);
if (labs(delta) > s->min_delta) {
av_log(ctx, AV_LOG_VERBOSE, "Discontinuity - %"PRId64" samples.\n", delta);
out_size = av_clipl_int32((int64_t)out_size + delta);
} else {
if (s->resample) {
int comp = av_clip(delta, -s->max_comp, s->max_comp);
av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp);
avresample_set_compensation(s->avr, delta, inlink->sample_rate);
}
delta = 0;
}
if (out_size > 0) {
AVFilterBufferRef *buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
out_size);
if (!buf_out) {
ret = AVERROR(ENOMEM);
goto fail;
}
avresample_read(s->avr, buf_out->extended_data, out_size);
buf_out->pts = s->pts;
if (delta > 0) {
av_samples_set_silence(buf_out->extended_data, out_size - delta,
delta, nb_channels, buf->format);
}
ret = ff_filter_frame(outlink, buf_out);
if (ret < 0)
goto fail;
s->got_output = 1;
} else {
av_log(ctx, AV_LOG_WARNING, "Non-monotonous timestamps, dropping "
"whole buffer.\n");
}
avresample_read(s->avr, NULL, avresample_available(s->avr));
s->pts = pts - avresample_get_delay(s->avr);
ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data,
buf->linesize[0], buf->audio->nb_samples);
fail:
avfilter_unref_buffer(buf);
return ret;
}
| 1threat |
Converting to manipulatable datetime format : <p>I have a date value <code>20130312</code> and I would like to convert it into a format like <code>2013-03-12</code> or a similar format</p>
<p>I've tried looking into the <code>datetime</code> library but could not find a solution.</p>
<p>Thanks in advance</p>
| 0debug |
static void active_parameter_sets(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc->gb;
int num_sps_ids_minus1;
int i;
get_bits(gb, 4);
get_bits(gb, 1);
get_bits(gb, 1);
num_sps_ids_minus1 = get_ue_golomb_long(gb);
s->active_seq_parameter_set_id = get_ue_golomb_long(gb);
for (i = 1; i <= num_sps_ids_minus1; i++)
get_ue_golomb_long(gb);
}
| 1threat |
Can I reference a specific function overload? : <p>Given the following code</p>
<pre><code>fun example() {}
fun example(name: String) {}
</code></pre>
<p>How can I reference a specific function? I.e. <code>example()</code> or <code>example(String)</code>?</p>
<p>Using <code>[example]</code> I can't specify which exactly function I want.</p>
| 0debug |
void av_force_cpu_flags(int arg){
if ( (arg & ( AV_CPU_FLAG_3DNOW |
AV_CPU_FLAG_3DNOWEXT |
AV_CPU_FLAG_MMXEXT |
AV_CPU_FLAG_SSE |
AV_CPU_FLAG_SSE2 |
AV_CPU_FLAG_SSE2SLOW |
AV_CPU_FLAG_SSE3 |
AV_CPU_FLAG_SSE3SLOW |
AV_CPU_FLAG_SSSE3 |
AV_CPU_FLAG_SSE4 |
AV_CPU_FLAG_SSE42 |
AV_CPU_FLAG_AVX |
AV_CPU_FLAG_AVXSLOW |
AV_CPU_FLAG_XOP |
AV_CPU_FLAG_FMA3 |
AV_CPU_FLAG_FMA4 |
AV_CPU_FLAG_AVX2 ))
&& !(arg & AV_CPU_FLAG_MMX)) {
av_log(NULL, AV_LOG_WARNING, "MMX implied by specified flags\n");
arg |= AV_CPU_FLAG_MMX;
}
flags = arg;
checked = arg != -1;
}
| 1threat |
static uint64_t get_cluster_offset(BlockDriverState *bs,
uint64_t offset, int *num)
{
BDRVQcowState *s = bs->opaque;
int l1_index, l2_index;
uint64_t l2_offset, *l2_table, cluster_offset;
int l1_bits, c;
int index_in_cluster, nb_available, nb_needed, nb_clusters;
index_in_cluster = (offset >> 9) & (s->cluster_sectors - 1);
nb_needed = *num + index_in_cluster;
l1_bits = s->l2_bits + s->cluster_bits;
nb_available = (1 << l1_bits) - (offset & ((1 << l1_bits) - 1));
nb_available = (nb_available >> 9) + index_in_cluster;
cluster_offset = 0;
l1_index = offset >> l1_bits;
if (l1_index >= s->l1_size)
goto out;
l2_offset = s->l1_table[l1_index];
if (!l2_offset)
goto out;
l2_offset &= ~QCOW_OFLAG_COPIED;
l2_table = l2_load(bs, l2_offset);
if (l2_table == NULL)
return 0;
l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1);
cluster_offset = be64_to_cpu(l2_table[l2_index]);
nb_clusters = size_to_clusters(s, nb_needed << 9);
if (!cluster_offset) {
c = count_contiguous_free_clusters(nb_clusters, &l2_table[l2_index]);
} else {
c = count_contiguous_clusters(nb_clusters, s->cluster_size,
&l2_table[l2_index], QCOW_OFLAG_COPIED);
}
nb_available = (c * s->cluster_sectors);
out:
if (nb_available > nb_needed)
nb_available = nb_needed;
*num = nb_available - index_in_cluster;
return cluster_offset & ~QCOW_OFLAG_COPIED;
}
| 1threat |
Pandas: timestamp to datetime : <p>I have dataframe and column with dates looks like</p>
<pre><code> date
1476329529
1476329530
1476329803
1476329805
1476329805
1476329805
</code></pre>
<p>I use <code>df['date'] = pd.to_datetime(df.date, format='%Y-%m-%d %H:%M:%S')</code>
to convert that, but I'm get strange result</p>
<pre><code> date
1970-01-01 00:00:01.476329529
1970-01-01 00:00:01.476329530
1970-01-01 00:00:01.476329803
1970-01-01 00:00:01.476329805
1970-01-01 00:00:01.476329805
1970-01-01 00:00:01.476329805
</code></pre>
<p>Maybe I did anything wrong</p>
| 0debug |
what is the diff between singleton object and base class object : <p>I am working on my app and i confuse in between singleton class
object and object from my base class, both provide that single<br>
instance use again and again. what is actually difference and
advantage of singleton?<br>
and which approach is best.</p>
| 0debug |
static int qcow_create(const char *filename, QEMUOptionParameter *options)
{
const char *backing_file = NULL;
const char *backing_fmt = NULL;
uint64_t sectors = 0;
int flags = 0;
size_t cluster_size = 65536;
int prealloc = 0;
while (options && options->name) {
if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
sectors = options->value.n / 512;
} else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) {
backing_file = options->value.s;
} else if (!strcmp(options->name, BLOCK_OPT_BACKING_FMT)) {
backing_fmt = options->value.s;
} else if (!strcmp(options->name, BLOCK_OPT_ENCRYPT)) {
flags |= options->value.n ? BLOCK_FLAG_ENCRYPT : 0;
} else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) {
if (options->value.n) {
cluster_size = options->value.n;
}
} else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) {
if (!options->value.s || !strcmp(options->value.s, "off")) {
prealloc = 0;
} else if (!strcmp(options->value.s, "metadata")) {
prealloc = 1;
} else {
fprintf(stderr, "Invalid preallocation mode: '%s'\n",
options->value.s);
return -EINVAL;
}
}
options++;
}
if (backing_file && prealloc) {
fprintf(stderr, "Backing file and preallocation cannot be used at "
"the same time\n");
return -EINVAL;
}
return qcow_create2(filename, sectors, backing_file, backing_fmt, flags,
cluster_size, prealloc);
}
| 1threat |
Java random number generation : <p>How generate random number according to some statics table .like need number between 1 to 6. Chances of getting 1 is 30%, chances of getting 2 is 25% and chances of getting 6 is 10% etc..</p>
| 0debug |
static bool vhost_section(MemoryRegionSection *section)
{
return memory_region_is_ram(section->mr);
}
| 1threat |
static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;
VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);
char *id;
if (dev->reg != -1) {
VIOsPAPRDevice *other = reg_conflict(dev);
if (other) {
error_setg(errp, "%s and %s devices conflict at address %#x",
object_get_typename(OBJECT(qdev)),
object_get_typename(OBJECT(&other->qdev)),
dev->reg);
return;
}
} else {
VIOsPAPRBus *bus = SPAPR_VIO_BUS(dev->qdev.parent_bus);
do {
dev->reg = bus->next_reg++;
} while (reg_conflict(dev));
}
if (!dev->qdev.id) {
id = spapr_vio_get_dev_name(DEVICE(dev));
dev->qdev.id = id;
}
dev->irq = xics_alloc(spapr->icp, 0, dev->irq, false);
if (!dev->irq) {
error_setg(errp, "can't allocate IRQ");
return;
}
if (pc->rtce_window_size) {
uint32_t liobn = SPAPR_VIO_LIOBN(dev->reg);
memory_region_init(&dev->mrroot, OBJECT(dev), "iommu-spapr-root",
ram_size);
memory_region_init_alias(&dev->mrbypass, OBJECT(dev),
"iommu-spapr-bypass", get_system_memory(),
0, ram_size);
memory_region_add_subregion_overlap(&dev->mrroot, 0, &dev->mrbypass, 1);
address_space_init(&dev->as, &dev->mrroot, qdev->id);
dev->tcet = spapr_tce_new_table(qdev, liobn,
0,
SPAPR_TCE_PAGE_SHIFT,
pc->rtce_window_size >>
SPAPR_TCE_PAGE_SHIFT, false);
dev->tcet->vdev = dev;
memory_region_add_subregion_overlap(&dev->mrroot, 0,
spapr_tce_get_iommu(dev->tcet), 2);
}
pc->realize(dev, errp);
}
| 1threat |
Cant find table 0 : The code works great on other tables.
The code return true if he found on the table the thing he get and false he hi did not find it.
Error Translation: cant find table 0
public bool Found(long num)
{
DataSet ds = new DataSet();
string str = string.Format("select * from Customers where Customer_Id={0} ", num);
ds = ReturnDS(str);
if (ds.Tables[0].Rows.Count == 0)
return false;
else
return true;
}
[The Error&Code][1]
[1]: https://i.stack.imgur.com/6nxgk.png | 0debug |
Jquery replace tags in string : <p>I have string such a:</p>
<pre><code>"<p>Some text <em>Italic string</em> ... </p><em>Second str</em>"
</code></pre>
<p>How can I replace all em tags to i tags ? </p>
<p>In result I need:</p>
<pre><code> "<p>Some text <i>Italic string</i> ... </p><i>Second str</i>"
</code></pre>
| 0debug |
ionic 2: How to make text selectable? : <p>I want users to be able to select text content (in ionic 2) so that they can copy it and paste it elsewhere, but it seems that text selection has been disabled. Users can select text that is in an input or a textarea, but I want them to be able to select even regular content text. Is there a way to re-enable text selection?</p>
| 0debug |
BIG DATA | Database and Architecture : <p>First of the all I want to say:
I checked the similar posts in internet, and I saw similar question on stack overflow like:</p>
<ul>
<li><p><a href="https://dba.stackexchange.com/questions/188667/best-database-and-table-design-for-billions-of-rows-of-data">https://dba.stackexchange.com/questions/188667/best-database-and-table-design-for-billions-of-rows-of-data</a></p>
<p><a href="https://stackoverflow.com/questions/2794736/best-data-store-for-billions-of-rows">Best data store for billions of rows</a></p>
<p><a href="https://stackoverflow.com/questions/9815234/how-to-store-7-3-billion-rows-of-market-data-optimized-to-be-read">How to store 7.3 billion rows of market data (optimized to be read)?</a></p></li>
</ul>
<p>But I want to open my question for double check.</p>
<p>So...I on the start to write my [BIG PROJECT] and right now I'm write all documentations etc...</p>
<p>While check the "things" I see that in 1 of my general USE CASES of application I will need handle...</p>
<p><strong>[!!!ATTENTIONS!!!]</strong> About BILLIONS Requests per DAY!</p>
<p>Yep. Billions per day!</p>
<p>I cannot say what is this requests and etc, but I can say:</p>
<p>1) The data inside request is has pretty good structure
2) I will need work with this data a lot. I mean many-many queries to this data.</p>
<p>Today I did fast test for calculate in <em>MS SQL Server 2017 (14.0.100)</em>:</p>
<p><strong><em>50M of this records = 10GB</em></strong></p>
<p>===> <strong>1B ==> 200GB</strong></p>
<p>So <strong>200GB</strong> is <strong><em>DAILY</em></strong> SIZE!!!</p>
<p><strong>200Gb</strong> * 30 = <strong>6TB</strong> - <strong>Monthly</strong></p>
<p><strong>6TB</strong> * 12 ===> <strong>72TB</strong> - <strong><em>1 Year size</em></strong></p>
<p>And Queries (Store procedure) not was so fast.</p>
<p>Because I'm only on the Documentation, Technical Design step..I want to take time and check the best way to handle this data.</p>
<p>If I look in 1-3-5 year forward...</p>
<p>(Don't want after 2 years start change how migrate data etc..)</p>
<hr>
<p>The second question is <strong>Architecture</strong>...</p>
<p>This Big data flow very similar to <strong><em>Google Analytics</em></strong>.
But I have send ID of request in response .</p>
<p>I'm in generally <strong>.NET DEVELOPER</strong> and will develop this project on <strong>.NET CORE and Microservices architecture</strong></p>
<p>And now I see big power in <strong><em>.NET CORE under linux, ngnix</em></strong> etc...</p>
<p>So my Question is :
What is <strong>best practices/ architecture template</strong> to write this microservice.
How <strong><em>Google analytics</em></strong> handle this <em>millions</em> and <em>billions</em> requests per <strong>day</strong>.</p>
<p>I check about DB of Google analytics - this is <strong>BigTable</strong>.</p>
<p>The best alternative I found is: <strong>HBase</strong></p>
<p>If the <strong>HBase</strong> is my <strong><em>HERO</em></strong>??</p>
<hr>
<p>And 1 more question is:</p>
<p>What is the best choice:</p>
<ul>
<li>Use cloud database solution (like in AWS EMR/Dynamo/etc..) </li>
<li>Launch EC2 instanse and run own database on this instance</li>
</ul>
<p>Thank you guys for help, and sorry for my English grammar.</p>
| 0debug |
static inline int decode_vui_parameters(H264Context *h, SPS *sps){
MpegEncContext * const s = &h->s;
int aspect_ratio_info_present_flag;
unsigned int aspect_ratio_idc;
aspect_ratio_info_present_flag= get_bits1(&s->gb);
if( aspect_ratio_info_present_flag ) {
aspect_ratio_idc= get_bits(&s->gb, 8);
if( aspect_ratio_idc == EXTENDED_SAR ) {
sps->sar.num= get_bits(&s->gb, 16);
sps->sar.den= get_bits(&s->gb, 16);
}else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
sps->sar= pixel_aspect[aspect_ratio_idc];
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1;
}
}else{
sps->sar.num=
sps->sar.den= 0;
}
if(get_bits1(&s->gb)){
get_bits1(&s->gb);
}
sps->video_signal_type_present_flag = get_bits1(&s->gb);
if(sps->video_signal_type_present_flag){
get_bits(&s->gb, 3);
sps->full_range = get_bits1(&s->gb);
sps->colour_description_present_flag = get_bits1(&s->gb);
if(sps->colour_description_present_flag){
sps->color_primaries = get_bits(&s->gb, 8);
sps->color_trc = get_bits(&s->gb, 8);
sps->colorspace = get_bits(&s->gb, 8);
if (sps->color_primaries >= AVCOL_PRI_NB)
sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
if (sps->color_trc >= AVCOL_TRC_NB)
sps->color_trc = AVCOL_TRC_UNSPECIFIED;
if (sps->colorspace >= AVCOL_SPC_NB)
sps->colorspace = AVCOL_SPC_UNSPECIFIED;
}
}
if(get_bits1(&s->gb)){
s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1;
get_ue_golomb(&s->gb);
}
sps->timing_info_present_flag = get_bits1(&s->gb);
if(sps->timing_info_present_flag){
sps->num_units_in_tick = get_bits_long(&s->gb, 32);
sps->time_scale = get_bits_long(&s->gb, 32);
if(!sps->num_units_in_tick || !sps->time_scale){
av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
return -1;
}
sps->fixed_frame_rate_flag = get_bits1(&s->gb);
}
sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->nal_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
sps->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->vcl_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
get_bits1(&s->gb);
sps->pic_struct_present_flag = get_bits1(&s->gb);
sps->bitstream_restriction_flag = get_bits1(&s->gb);
if(sps->bitstream_restriction_flag){
get_bits1(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
sps->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
if (get_bits_left(&s->gb) < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb));
sps->num_reorder_frames=0;
sps->bitstream_restriction_flag= 0;
}
if(sps->num_reorder_frames > 16U ){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
return -1;
}
}
return 0;
}
| 1threat |
How can ı use "stdafx.h" in c++? : <p>I have a problem about my c++ code. When ı write in my code include "stdafx.h" ı have errors. Why is the reason? I have 2 pics to better explain my problem. Can anyone help me ?</p>
<p><a href="https://imgur.com/yfHsKD6" rel="nofollow noreferrer">https://imgur.com/yfHsKD6</a></p>
<p><a href="https://imgur.com/T6Jd3pV" rel="nofollow noreferrer">https://imgur.com/T6Jd3pV</a></p>
<p>There is my code:</p>
<pre><code>#include <iostream>
#include "stdafx.h"
using namespace std;
int main()
{
int x, y,toplam=0;
cout << "1. Sayiyi Giriniz:";
cin >> x;
cout << "2. Sayiyi Giriniz:";
cin >> y;
toplam = x + y;
cout << "Sayilarin toplami:" << toplam << endl;
system("PAUSE");
return 0;
}
</code></pre>
<p>Error C1083 Unable to open include file: 'stdafx.h': No such file or directory </p>
<p>Error (active) E1696 Source file "stdafx.h" cant open</p>
| 0debug |
static bool vring_notify(VirtIODevice *vdev, VirtQueue *vq)
{
uint16_t old, new;
bool v;
smp_mb();
if (virtio_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) &&
!vq->inuse && vring_avail_idx(vq) == vq->last_avail_idx) {
return true;
}
if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
return !(vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT);
}
v = vq->signalled_used_valid;
vq->signalled_used_valid = true;
old = vq->signalled_used;
new = vq->signalled_used = vring_used_idx(vq);
return !v || vring_need_event(vring_get_used_event(vq), new, old);
}
| 1threat |
Pylint in Visual studio complains about import sh module : Need a help that I am having issue of using Pylint in visual studio code and not sure how to solve it.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/987JT.png
The red line complains that
```
[pylint] E1101:Module 'sh' has no 'helm' member
self: Helm
``` | 0debug |
cloud 9.io css google chome error : I have been getting an error from Google chrome saying
: Failed to load resource: the server responded with a status 404 error.
I linked the path to the correct folder in cloud 9 project, but there is another project with the same format as my current one and it works fine. I am also using Semantic ui does that have anything to do with it? | 0debug |
Laravel 5.4 sometimes validation rules not working : <p>I am trying to validate a date field only if it is present. It was working fine before I upgraded from Laravel 5.2 to 5.4</p>
<p>In Laravel 5.2 this rules works fine:</p>
<pre><code>public function rules()
{
return [
'available_from' => 'date',
];
}
</code></pre>
<p>In 5.4 it returns validation error <code>The available from is not a valid date.</code> I tried this new rules</p>
<pre><code>public function rules()
{
return [
'available_from' => 'sometimes|date',
];
}
</code></pre>
<p>Still got the same error and seems the <code>sometimes</code> rules not affecting the validation at all. How can I get rid of this error?</p>
<p>I don't understand why Laravel changed something that was working before!!!</p>
| 0debug |
Multivariate Regression Neural Network Loss Function : <p>I am doing multivariate regression with a fully connected multilayer neural network in Tensorflow. The network predicts 2 continuous float variables <code>(y1,y2)</code> given an input vector <code>(x1,x2,...xN)</code>, i.e. the network has 2 output nodes. With 2 outputs the network does not seem to converge. My loss function is essentially the L2 distance between the prediction and truth vectors (each contains 2 scalars): </p>
<pre><code>loss = tf.nn.l2_loss(tf.sub(prediction, truthValues_placeholder)) + L2regularizationLoss
</code></pre>
<p>I am using L2 regularization, dropout regularization, and my activation functions are tanh.</p>
<p><strong>My questions</strong>: Is L2 distance the proper way to calculate loss for a multivariate network output? Are there some tricks needed to get multivariate regression networks to converge (as opposed to single-variable networks and classifiers)?</p>
| 0debug |
int float64_lt( float64 a, float64 b STATUS_PARAM )
{
flag aSign, bSign;
if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
|| ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
) {
float_raise( float_flag_invalid STATUS_VAR);
return 0;
}
aSign = extractFloat64Sign( a );
bSign = extractFloat64Sign( b );
if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
return ( a != b ) && ( aSign ^ ( a < b ) );
}
| 1threat |
global time.sleep() leads to invalid syntax : def imports():
import time
global time.sleep()
def title_screen():
print("Welcome to Text RPG")
print("Created by: Nick Giesler")
print("")
input("Press ENTER to Begin:")
print("Loading...")
time.sleep(1)
imports()
title_screen()
when ran, this returns invalid syntax pointing to "global time.sleep()"
Traceback (most recent call last):
File "python", line 3
global time.sleep()
^
SyntaxError: invalid syntax
| 0debug |
eslint resolve error on imports using with path mapping configured jsconfig.json : <p>Here's my project structure:</p>
<pre><code>-src
--assets
--components
--constants
--helpers
--pages
--routes
eslintrc.json
jsconfig.json
App.js
index.js
</code></pre>
<p>I was tired of:</p>
<p><code>import SomeComponent from '../../../../../components/SomeComponent';</code></p>
<p>And I wanted to do:</p>
<p><code>import SomeComponent from '@components/SomeComponent';</code></p>
<p>So I saw this question here on SO:</p>
<p><a href="https://stackoverflow.com/questions/47181037/vscode-intellisense-does-not-work-with-webpack-alias">VSCode Intellisense does not work with webpack + alias</a></p>
<p>And I got it to work with:</p>
<p><strong>jsconfig.json</strong></p>
<pre><code>{
"compilerOptions": {
"baseUrl": ".",
"target": "es6",
"module": "commonjs",
"paths": {
"@components/*": ["./src/components/*"]
}
}
}
</code></pre>
<p>But eslint now it's complaining that it's unresolved, even though it compiles just fine.</p>
<p><strong>eslint error:</strong></p>
<blockquote>
<p>Unable to resolve path to module '@components/SocialMedia'.eslint(import/no-unresolved)</p>
</blockquote>
<p><strong>NOTE:</strong> </p>
<p>I don't want to disable eslint. I want to make it understand this kind of path too.</p>
| 0debug |
Anaconda Python installation error : <p>I get the following error during Python 2.7 64-bit windows installation. I previously installed python 3.5 64-bit and it worked fine. But during python 2.7 installation i get this error:</p>
<pre><code>Traceback (most recent call last):
File "C:\Anaconda2\Lib\_nsis.py", line 164, in <module> main()
File "C:\Anaconda2\Lib\_nsis.py", line 150, in main
mk_menus(remove=False)
File "C:\Anaconda2\Lib\_nsis.py", line 94, in mk_menus
err("Traceback:\n%s\n" % traceback.format_exc(20))
IOError: [Errno 9] Bad file descriptor
</code></pre>
<p>Kindly help me out.</p>
| 0debug |
Sort List<List<T>> C# : I have a requirement to sort a `List<List<T>>` say #myList. T has the properties QuestionName and Response.
I need to sort the #mylist based on response to a particular question. Here's my code:
Class T
{
string QuestionName {get; set;)
string Response {get; set;)
}
List<List<T>> myList = new List<List<T>>();
List<T> tList = new List<T>();
tList.add({QuestionName = "FirstName", Response = "BBB"});
tList.add({QuestionName = "LastName", Response = "BBBLastName"});
myList.add(tList);
tList = new List<T>();
tList.add({QuestionName = "FirstName", Response = "AAA"});
tList.add({QuestionName = "LastName", Response = "AAACLastName"});
myList.add(tList);
tList = new List<T>();
tList.add({QuestionName = "FirstName", Response = "CCC"});
tList.add({QuestionName = "LastName", Response = "CCCLastName"});
myList.add(tList);
This basically corresponds to a table - where each cell is T and `List<t>` is a row. `List<List<T>>` is the table.
I need to sort rows of the table (`List<t>`) based on the response to the FirstName question.
I searched web, but did not find a single post about sorting `List<List<T>>`. Is it even possible ?
| 0debug |
static int set_dirty_tracking(void)
{
BlkMigDevState *bmds;
int ret;
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE,
NULL);
if (!bmds->dirty_bitmap) {
ret = -errno;
goto fail;
}
}
return 0;
fail:
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
if (bmds->dirty_bitmap) {
bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);
}
}
return ret;
}
| 1threat |
Understanding combineReducers : <p>New to react and redux so playing around with some very simple code to see how it all works.
When I try passing in a combineReducers method to a redux store then I get an error. If I remove the combinedReducers and pass the reducer in directly to the store all works fine. </p>
<pre><code>let store = createStore(rootReducer);
</code></pre>
<p>Error </p>
<blockquote>
<p>Uncaught Error: Objects are not valid as a React child (found: object
with keys {reducer}). If you meant to render a collection of children,
use an array instead or wrap the object using createFragment(object)
from the React add-ons. Check the render method of App.</p>
</blockquote>
<p>Why do I get an error when I use combineReducers ? What if I wanted to add more reducers I presume thats what combineReducers is there for ? </p>
<p><strong>main.js</strong></p>
<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, combineReducers } from 'redux';
import App from './components/app';
let reducer = (state=0, action) => {
switch (action.type) {
case 'INCREASE':
return state+1
case 'DECREASE':
return state-1
default: return state
}
}
const rootReducer = combineReducers({
reducer:reducer
});
let store = createStore(rootReducer);
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>
, document.querySelector('.container'));
</code></pre>
<p><strong>//app.js</strong></p>
<pre><code>import React, { Component } from 'react';
import {connect} from 'react-redux';
class App extends Component {
render() {
let {number, increase, decrease} = this.props
return(
<div>
<div>{number}</div>
<button onClick={e=>increase()}>+</button>
<button onClick={e=>decrease()}> - </button>
</div>
);
}
}
let mapStateToProps = state => ({
number: state
})
let mapDispatchToProps = dispatch => ({
increase: () => dispatch({type: 'INCREASE'}),
decrease: () => dispatch({type: 'DECREASE'})
});
export default connect(mapStateToProps, mapDispatchToProps)(App);
</code></pre>
| 0debug |
void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
{
SysBusDevice *s = sysbus_from_qdev(dev);
int i;
for (i = 0; i < s->num_mmio; i++) {
monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
indent, "", s->mmio[i].addr, s->mmio[i].size);
}
}
| 1threat |
IN SQL 2008, How to convert string '00011001010010000000000000000000' to '0x98120000' : use sql 2008:
I convert '0x98120000' to string '00011001010010000000000000000000'.
How to convert reverse.
Please help me. Thanks. | 0debug |
Read a excel file in c++ using visual studio : <p>I have a project where I must read from an excel file into a c++ program. I must then be able to use this data to carry out calculations, sorting, searching, etc. In the excel file, there are about 20 lines of information that is necessary not necessary for the calculations. after, there are are about 100 lines of raw data to spanning several columns. My question is how to read the first 20 lines and store them, but not use them, and how to read the other 100 lines and columns into a structure, so that I can access their data.</p>
| 0debug |
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
{
OptionsContext *o = optctx;
char buf[128];
int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
struct tm time = *gmtime((time_t*)&recording_timestamp);
strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
parse_option(o, "metadata", buf, options);
av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
"tag instead.\n", opt);
return 0;
}
| 1threat |
text shadow using CSS : [Text Effect][1]
[1]: https://i.stack.imgur.com/4jyoi.png
Hey, I am trying to achieve the text styling using box shadow but couldn't get even close. Can you guid me on which approach I should use. Here is what I tried so far:
.head{
text-shadow:0 1px 0 #766d36, 0 2px 0 #766d36, 0px 0px 50px #928848, 0 0px 0px #928848, 0 -1px 0 #574f1b, 0 0px 10px rgba(232, 217, 119, 0.1), 0 0 12px rgba(232, 217, 119, 0.1), 0 -3px 15px rgba(232, 217, 119, 0.3), 0 0px 73px rgba(232, 217, 119, 1), 0 4px 29px rgba(232, 217, 119, 0.25), 0 3px 1px rgba(232, 217, 119, 1), 0 15px 20px rgba(232, 217, 119, 0.15);
color: #aea254; } | 0debug |
Fetching VB Variables to insert with SQL Query : <p>Hello everybody hope you are well.</p>
<p>I have a place on a project im working on that im struggling to get past. I'm basically gathering meta data of a song and assigning them to variables in VB.</p>
<p>I'm next trying to save this data to a SQL database with tables i have created in visual studio and im having trouble doing this. The problem lies within trying to link the VB variables into a SQL query. Any Ideas?</p>
| 0debug |
How do I make a python game switch to different .py files? : <p>I'm making a crappy python game. I want to have separate files for each snake in the game. How do I make each snake have their own file? Also how can I make it create save files and load them? Here's the link to the code on trinket: <a href="https://trinket.io/python/47ae4b66c7" rel="nofollow noreferrer">https://trinket.io/python/47ae4b66c7</a></p>
| 0debug |
def add_list(nums1,nums2):
result = map(lambda x, y: x + y, nums1, nums2)
return list(result) | 0debug |
Please tell me is it possible to make edittext to some text in one color and the other part another color : Please tell me is it possible to make **edittext** to some text in one color and the other part another color. | 0debug |
Function of main() in c programming : I am working in the C programming language. can I Know about what is the function of main(). What is void main() and int main() why they are Build. | 0debug |
static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *bguf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
const int16_t *buf1= buf0;
if (uvalpha < 2048) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2PACKED1(%%REGBP, %5)
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2PACKED1b(%%REGBP, %5)
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.