problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
React Native KeyboardAvoidingView covers last text input : <p>I'm using React Native's <a href="https://facebook.github.io/react-native/docs/keyboardavoidingview.html" rel="noreferrer">Keyboard Avoiding View</a> with the behavior set to padding (testing on Android). </p>
<p>I have multiple TextInputs on my screen. When I click the final TextInput, the keyboard covers it. I am now able to scroll down due to padding added from KeyboardAvoidingView, but it would be ideal to have it auto scroll on focus.</p>
<pre><code><Content>
<KeyboardAvoidingView behavior='padding'>
<TextInput placeholder='Example 1' />
<TextInput placeholder='Example 2' />
<TextInput placeholder='Example 3' />
<TextInput placeholder='Example 4' />
<TextInput placeholder='Example 5' />
<TextInput placeholder='Example 6' />
<TextInput placeholder='Example 7' />
</KeyboardAvoidingView>
</Content>
</code></pre>
| 0debug |
is it possible to populate a hash using a for loop? : I want a hash that holds keys which are ints from 1 to 18.
Essentially, at the start I want the hash to look like this:
myHash = Hash.new
myHash[1] = "free"
myHash[2] = "free"
...
myHash[18] = "free"
But I want to know if there's a nicer way to do this, such as using a for loop?
something like:
myHash = Hash.new
for i in 1..18
hash[i] = "free"
will this work or will it just create 18 keys called "i"? Sorry if this is obvious but I am a real beginner and haven't found any answer elsewhere
| 0debug |
Aspectj doesn't work with kotlin : <p>i want to use aspectj aop in kotlin,here is my code:</p>
<p>my annotation in annotation.lazy_list:</p>
<p>Kotlin:</p>
<pre><code> package anotation
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
annotation class lazy_list
</code></pre>
<p>my aspectj aop class:</p>
<pre><code>@Aspect
class ActiveListAop{
@Pointcut("execution(@annotation.lazy_list * *(..))")
fun profile() {
}
@Before("profile()")
fun testModeOnly(joinPoint: JoinPoint) {
println("123")
}
}
</code></pre>
<p>my usage:</p>
<pre><code> @lazy_list
fun all():List<T>{
return lazy_obj?.all() as List<T>
}
</code></pre>
<p>when i call all() function , no error,but wont't print "123", why?</p>
| 0debug |
Angular material design : We are using angular material mat radio button and it is selected. This radio button gets unchecked on opening angular modal pop up with another set of angular material radio button. | 0debug |
How can i check what is the biggest string in a list : <p>I want to check what is the biggest string in a list</p>
<p>Is there any function for this?
for example:</p>
<pre class="lang-py prettyprint-override"><code>lis = ['rafa', 'now', 'lucky']
</code></pre>
<p>And it returns 'lucky' or 5</p>
| 0debug |
static void tlb_info_pae32(Monitor *mon, CPUState *env)
{
int l1, l2, l3;
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
pdp_addr = env->cr[3] & ~0x1f;
for (l1 = 0; l1 < 4; l1++) {
cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8);
pde = le64_to_cpu(pde);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
print_pte(mon, (l1 << 30 ) + (l2 << 21), pde,
~((target_phys_addr_t)(1 << 20) - 1));
} else {
pt_addr = pde & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8);
pte = le64_to_cpu(pte);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, (l1 << 30 ) + (l2 << 21)
+ (l3 << 12),
pte & ~PG_PSE_MASK,
~(target_phys_addr_t)0xfff);
}
}
}
}
}
}
}
}
| 1threat |
int av_opencl_buffer_write(cl_mem dst_cl_buf, uint8_t *src_buf, size_t buf_size)
{
cl_int status;
void *mapped = clEnqueueMapBuffer(gpu_env.command_queue, dst_cl_buf,
CL_TRUE,CL_MAP_WRITE, 0, sizeof(uint8_t) * buf_size,
0, NULL, NULL, &status);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not map OpenCL buffer: %s\n", opencl_errstr(status));
return AVERROR_EXTERNAL;
}
memcpy(mapped, src_buf, buf_size);
status = clEnqueueUnmapMemObject(gpu_env.command_queue, dst_cl_buf, mapped, 0, NULL, NULL);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not unmap OpenCL buffer: %s\n", opencl_errstr(status));
return AVERROR_EXTERNAL;
}
return 0;
}
| 1threat |
Learning DOM. Not sure why my function works in the HTML file but not in JS file : I'm creating a web page that has a text area in it and the user can enter code and have it displayed underneath. If I place my function in the HTML file it works just fine but when I move it to the JS file it doesn't work. Any help, even pointing me in the direction of my issue would be appreciated.
Here is my HTML code with the function commented out......
<!DOCTYPE html>
<html>
<head>
<title>DOM TREE 2</title>
<link rel="stylesheet" href="css/Content.css">
<script type="text/javascript" src="JS/js01.js"></script>
</head>
<body style="background-color:lightgray" id="bd">
<div id="third">
<h1> DOM TREE <img src="Images/tree_logo.jpg" alt="Calc" id = "pic">
</h1>
<form id="DOMForm">
<textarea id="myTextarea" rows="4" cols="50"></textarea>
<p><button type="button" onclick="AddFunction()">Add Content</button>
<button type="button" onclick="Change()">Change Style</button>
<button type="button" onclick="Clear()">Clear Content</button>
</p>
<p id="demo"></p>
<!--<script>
function AddFunction() {
var x = document.getElementById("myTextarea").value;
document.getElementById("demo").innerHTML = x;
}
</script> -->
</body>
</html>
Here is the JS file with the function.....
function AddFunction()
{
var x = document.getElementById("myTextarea").value;
document.getElementById("demo").innerHTML = x;
}
function changestyle()
{
}
function clear()
{
document.getElementById("DomForm").reset();
} | 0debug |
void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
{
if (!s) {
return;
}
virtio_blk_data_plane_stop(s);
g_free(s->batch_notify_vqs);
qemu_bh_delete(s->bh);
object_unref(OBJECT(s->iothread));
g_free(s);
}
| 1threat |
static int vp56_size_changed(VP56Context *s)
{
AVCodecContext *avctx = s->avctx;
int stride = s->frames[VP56_FRAME_CURRENT]->linesize[0];
int i;
s->plane_width[0] = s->plane_width[3] = avctx->coded_width;
s->plane_width[1] = s->plane_width[2] = avctx->coded_width/2;
s->plane_height[0] = s->plane_height[3] = avctx->coded_height;
s->plane_height[1] = s->plane_height[2] = avctx->coded_height/2;
for (i=0; i<4; i++)
s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT]->linesize[i];
s->mb_width = (avctx->coded_width +15) / 16;
s->mb_height = (avctx->coded_height+15) / 16;
if (s->mb_width > 1000 || s->mb_height > 1000) {
ff_set_dimensions(avctx, 0, 0);
av_log(avctx, AV_LOG_ERROR, "picture too big\n");
return AVERROR_INVALIDDATA;
}
av_reallocp_array(&s->above_blocks, 4*s->mb_width+6,
sizeof(*s->above_blocks));
av_reallocp_array(&s->macroblocks, s->mb_width*s->mb_height,
sizeof(*s->macroblocks));
av_free(s->edge_emu_buffer_alloc);
s->edge_emu_buffer_alloc = av_malloc(16*stride);
s->edge_emu_buffer = s->edge_emu_buffer_alloc;
if (!s->above_blocks || !s->macroblocks || !s->edge_emu_buffer_alloc)
return AVERROR(ENOMEM);
if (s->flip < 0)
s->edge_emu_buffer += 15 * stride;
if (s->alpha_context)
return vp56_size_changed(s->alpha_context);
return 0;
} | 1threat |
What does batch, repeat, and shuffle do with TensorFlow Dataset? : <p>I'm currently learning TensorFlow but i come across a confusion within this code:</p>
<pre><code>dataset = dataset.shuffle(buffer_size = 10 * batch_size)
dataset = dataset.repeat(num_epochs).batch(batch_size)
return dataset.make_one_shot_iterator().get_next()
</code></pre>
<p>i know first the dataset will hold all the data but what shuffle(),repeat(), and batch() do to the dataset? please give me an explanation with an example</p>
| 0debug |
How to find the variance between two groups in python pandas? : <p>I have a dataframe like this,</p>
<pre><code>ID total_sec is_weekday
1 300 1
1 200 0
2 280 1
2 260 0
3 190 1
4 290 0
5 500 1
5 520 0
</code></pre>
<p>I want to find the ID with the largest variance between weekdays and weekends. If we missed the records for either weekdays or weekends, we calculate the variance as 0.
My expected output will be,</p>
<pre><code>ID variance
1 100
2 20
3 0
4 0
5 20
</code></pre>
| 0debug |
static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov,
AVFormatContext *s)
{
offset_t pos = url_ftell(pb);
int i;
put_be32(pb, 0);
put_tag(pb, "udta");
mov_write_meta_tag(pb, mov, s);
if(mov->mode == MODE_MOV){
for (i=0; i<MAX_STREAMS; i++) {
if(mov->tracks[i].entry <= 0) continue;
if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC ||
mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) {
mov_write_string_tag(pb, "\251req", "QuickTime 6.0 or greater", 0);
break;
}
}
mov_write_string_tag(pb, "\251nam", s->title , 0);
mov_write_string_tag(pb, "\251aut", s->author , 0);
mov_write_string_tag(pb, "\251alb", s->album , 0);
mov_write_day_tag(pb, s->year, 0);
if(mov->tracks[0].enc && !(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT))
mov_write_string_tag(pb, "\251enc", LIBAVFORMAT_IDENT, 0);
mov_write_string_tag(pb, "\251des", s->comment , 0);
mov_write_string_tag(pb, "\251gen", s->genre , 0);
}
return updateSize(pb, pos);
}
| 1threat |
Code executes when typed into console but not in script : <p>I have a javascript project i am running,and i have finished the first phase.The second phase requires for me to start by assigning a <code>variable</code> to a <code>dom</code> object.</p>
<p>I assigned the <code>variable</code> and it worked.Then i updated the <code>code</code> into my project <code>script</code>.Now,the problem is that whenever i run the <code>script</code> the <code>script</code> will execute but,the <code>variable</code> i assigned and updated into my <code>script</code> won't assign and the <code>code</code> line won't run.</p>
<pre><code> var element = document.getElementById('inputElement');
</code></pre>
<p>Every time i run that line in the <code>console</code> maybe by copy/paste or typing it personally it works but,the <code>code</code> won't execute when it is in a script.</p>
| 0debug |
RecyclerView (horizontal) nested in BottomSheet preventing vertical scrolling : <p>I have a <code>RecyclerView</code> using a <code>LinearLayoutManager</code> with <code>HORIZONTAL</code> orientation, nested inside a <code>FrameLayout</code> using the <code>BottomSheet</code> <code>Behavior</code>.</p>
<p>When attempting to drag vertically across the <code>RecyclerView</code>, the <code>BottomSheet</code> doesn't respond to the drag event. Presumably this is because vertical scrolling is disabled for a <code>LayoutManager</code> with horizontal orientation.</p>
<p>I've tried overriding <code>LinearLayoutManager.canScrollVertically()</code> and returning true. This <em>sort of</em> works.. If you drag vertically in a very careful manner, the <code>BottomSheet</code> will respond. As soon as any horizontal movement is involved however, the <code>BottomSheet</code> stops responding to vertical drag events.</p>
<p>I'm not sure if overriding <code>canScrollVertically()</code> is the right approach here - it certainly doesn't feel right from a UX point of view.</p>
<p>I've also noticed that if I use a <code>ViewPager</code> rather than a <code>RecyclerView</code> with a horizontally oriented <code>LayoutManager</code>, the <code>BottomSheet</code> responds to vertical swipe events as desired.</p>
<p>Is there some other method of <code>LayoutManager</code>, <code>RecyclerView</code>, <code>BottomSheet Behavior</code>, or something else altogether that can help propagate the vertical scroll events on to the <code>BottomSheet Behavior</code>?</p>
<p>There's an example of the problem here:</p>
<p><a href="https://github.com/timusus/bottomsheet-test" rel="noreferrer">https://github.com/timusus/bottomsheet-test</a>
(Problem can be reproduced with commit #f59a7031)</p>
<p>Just expand the first bottom sheet. </p>
| 0debug |
Display full background image : <p>I have the following inline css code:</p>
<pre><code><div class="home-hero" style="background-image: url(https://dummyimage.com/300); background-position: 100% center; background-repeat: no-repeat; background-size: cover; height: 100%; width: 100%;">
</code></pre>
<p></p>
<p><a href="https://jsfiddle.net/tty2pdb2/1/" rel="nofollow noreferrer">FiddleJs</a></p>
<p>I need the image to be full width and height.</p>
| 0debug |
UITableView compiling error in AppDelagate Swift : This is my viewcontroller:
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
let list = ["Facebook: 2000$", "Twitter: 10000$", "Vine: 23356$", "Uber: 35000", "Adobe Systems: 400900", "Agilent Tech: 456700", "Ebay: 98899"]
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return (list.count)
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
cell.textLabel?.text = list[indexPath.row]
return(cell)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
and my app delegate:
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) { etc..
Please help me out and tell me what im doing wrong, and help me stop being a total moron! The compiling error is on the fourth line in appdelegate.
| 0debug |
How to function for a null string input in c++? : In java, this can be used,
Scanner s = new Scanner (System.in);
String x = s.next();
if(x == null || x.length() == 0)
cout << "Please enter someting" ;
as a condition which says "Please enter something" if anyone hits the ENTER key typing nothing.
But how to do it by using codeblocks or visual studio using c++ ? | 0debug |
ERRO[0043] failed to dial gRPC: unable to upgrade to h2c, received 501 : <p>When I tried building my Dockerfile with <code>docker build -t myimage1 .</code> today I got this error:</p>
<pre><code>ERRO[0043] failed to dial gRPC: unable to upgrade to h2c, received 501
context canceled
</code></pre>
<p>I have successfully built this image before although it was a couple of weeks ago. I am not sure whether Docker has been updated in the meantime.</p>
<p>I found a similar error (although not the same - it is error 0044 while mine is 0043) at <a href="https://stackoverflow.com/questions/55308947/erro0044-failed-to-dial-grpc-cannot-connect-to-the-docker-daemon/58731161#58731161">ERRO[0044] failed to dial gRPC: cannot connect to the Docker daemon</a></p>
| 0debug |
from operator import eq
def count_same_pair(nums1, nums2):
result = sum(map(eq, nums1, nums2))
return result | 0debug |
restrict a textbox to only integers between 1 and 99 : I am trying to add a text box which accepts only integers between 1 and 99. I tried adding a number type element with min and max but that works only when changing the number using the ticker
<input type="number" min="1" max="99" />
**May I know a better way to achieve this?** | 0debug |
static int qcow2_truncate(BlockDriverState *bs, int64_t offset)
{
BDRVQcowState *s = bs->opaque;
int ret, new_l1_size;
if (offset & 511) {
return -EINVAL;
}
if (s->nb_snapshots) {
return -ENOTSUP;
}
if (offset < bs->total_sectors * 512) {
return -ENOTSUP;
}
new_l1_size = size_to_l1(s, offset);
ret = qcow2_grow_l1_table(bs, new_l1_size);
if (ret < 0) {
return ret;
}
offset = cpu_to_be64(offset);
ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, size),
&offset, sizeof(uint64_t));
if (ret < 0) {
return ret;
}
s->l1_vm_state_index = new_l1_size;
return 0;
}
| 1threat |
int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
{
struct addrinfo ai,*res,*e;
const char *addr;
char port[33];
char uaddr[INET6_ADDRSTRLEN+1];
char uport[33];
int slisten, rc, to, port_min, port_max, p;
memset(&ai,0, sizeof(ai));
ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
ai.ai_family = PF_UNSPEC;
ai.ai_socktype = SOCK_STREAM;
if ((qemu_opt_get(opts, "host") == NULL) ||
(qemu_opt_get(opts, "port") == NULL)) {
error_setg(errp, "host and/or port not specified");
return -1;
}
pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port"));
addr = qemu_opt_get(opts, "host");
to = qemu_opt_get_number(opts, "to", 0);
if (qemu_opt_get_bool(opts, "ipv4", 0))
ai.ai_family = PF_INET;
if (qemu_opt_get_bool(opts, "ipv6", 0))
ai.ai_family = PF_INET6;
if (port_offset) {
unsigned long long baseport;
if (parse_uint_full(port, &baseport, 10) < 0) {
error_setg(errp, "can't convert to a number: %s", port);
return -1;
}
if (baseport > 65535 ||
baseport + port_offset > 65535) {
error_setg(errp, "port %s out of range", port);
return -1;
}
snprintf(port, sizeof(port), "%d", (int)baseport + port_offset);
}
rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
if (rc != 0) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
gai_strerror(rc));
return -1;
}
for (e = res; e != NULL; e = e->ai_next) {
getnameinfo((struct sockaddr*)e->ai_addr,e->ai_addrlen,
uaddr,INET6_ADDRSTRLEN,uport,32,
NI_NUMERICHOST | NI_NUMERICSERV);
slisten = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol);
if (slisten < 0) {
if (!e->ai_next) {
error_setg_errno(errp, errno, "Failed to create socket");
}
continue;
}
socket_set_fast_reuse(slisten);
#ifdef IPV6_V6ONLY
if (e->ai_family == PF_INET6) {
const int off = 0;
qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &off,
sizeof(off));
}
#endif
port_min = inet_getport(e);
port_max = to ? to + port_offset : port_min;
for (p = port_min; p <= port_max; p++) {
inet_setport(e, p);
if (bind(slisten, e->ai_addr, e->ai_addrlen) == 0) {
goto listen;
}
if (p == port_max) {
if (!e->ai_next) {
error_setg_errno(errp, errno, "Failed to bind socket");
}
}
}
closesocket(slisten);
}
freeaddrinfo(res);
return -1;
listen:
if (listen(slisten,1) != 0) {
error_setg_errno(errp, errno, "Failed to listen on socket");
closesocket(slisten);
freeaddrinfo(res);
return -1;
}
qemu_opt_set(opts, "host", uaddr, &error_abort);
qemu_opt_set_number(opts, "port", inet_getport(e) - port_offset,
&error_abort);
qemu_opt_set_bool(opts, "ipv6", e->ai_family == PF_INET6,
&error_abort);
qemu_opt_set_bool(opts, "ipv4", e->ai_family != PF_INET6,
&error_abort);
freeaddrinfo(res);
return slisten;
}
| 1threat |
how to subtract more than 2 numbers in c# : i am trying to make simple calculation and taking input of my own choice to subtract using loop but result is not coming true..
Console.WriteLine("Enter how many numbers u want to perform operations?");
int b = int.Parse(Console.ReadLine());
for (int i = 1; i <= b; i++)
{
Console.WriteLine("Enter " + i + " Number");
c = int.Parse(Console.ReadLine());
int s=s-c;
}
Console.WriteLine("Result is={0}", s); | 0debug |
static void do_pci_unregister_device(PCIDevice *pci_dev)
{
pci_dev->bus->devices[pci_dev->devfn] = NULL;
pci_config_free(pci_dev);
if (memory_region_is_mapped(&pci_dev->bus_master_enable_region)) {
memory_region_del_subregion(&pci_dev->bus_master_container_region,
&pci_dev->bus_master_enable_region);
}
address_space_destroy(&pci_dev->bus_master_as);
}
| 1threat |
How to change all buttons' text using a function(without hardcoding)? : <p>How do i do this without hardcoding and without using setText for each button,How do i do it by using a function?
I have a dialog box, whenever "OK"(+ve button) is clicked I want all 10 buttons in Activity to change text and set it to some element in an array</p>
| 0debug |
i am new in PHP learning try to add some data in database ,all the solutions available in net is tried but can not solve my issue : // this is my php code starting and used connection type is pdo
//connection with server
$servername = "localhost";
$username = "root";
$password = "";
try {
$conn = new PDO("mysql:host=$servername;dbname=gujaratoil", $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
if(isset($_POST['submit'])){
//at the beginig null value is set
$name=$emailaddress="";
$sql="INSERT INTO
registration(name,emailaddress)VALUES('$_POST[name]','$_POST[emailaddre
ss]')"; }}
?>
haves try all the solutions available what should i do to solve this issue. have try pdo connection
please do suggest it is urgent | 0debug |
Check if celery beat is up and running : <p>In my Django project, I use Celery and Rabbitmq to run tasks in background.
I am using celery beat scheduler to run periodic tasks.
How can i check if celery beat is up and running, programmatically?</p>
| 0debug |
xCode10: What am I getting an unrecognized selector error? : This code:
override func viewDidLoad() {
super.viewDidLoad()
mqttDataClient.delegate = self
mqttDataClient.connect()
let tableRefresh = UIRefreshControl()
tableView.refreshControl = tableRefresh
tableRefresh.addTarget(tableView, action: #selector(updateTable), for: .valueChanged)
tableRefresh.endRefreshing()
}
@objc func updateTable(){
print("R")
mqttDataClient.publish("control", withString: "sendMovieList")
}
crashes with the following error:
> -[UITableView updateTable]: unrecognized selector sent to instance 0x106008a00
I am using xCode 10 on macOS 10.14. I think I have this set up correctly and I am wondering if it's an issue with the new xCode. I mean the selector is right there, right? | 0debug |
What is this techinique called? : <p>I come from C#. A small example with C# syntax:</p>
<pre><code>// using System.Linq;
int[] array = { 1, 2, 3, 5 };
int result = array.SingleOrDefault(x => x % 2 == 0);
</code></pre>
<p>I want to <code>convert</code> that syntax to javascript syntax:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Array.prototype.singleOrDefault = function (tsource) {
var $self = this
if ($self.length) {
for (let i = 0; i < $self.length; i++) {
if (tsource($self[i])) {
return $self[i]
}
}
return null
}
};
var test = function () {
var array = [1, 2, 3, 5];
var result = array.singleOrDefault(x => x % 2 === 0)
if (result !== null) {
alert(result)
}
};</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><button onclick="test()">Click me</button></code></pre>
</div>
</div>
</p>
<p>In C#: <code>.SingleOrDefault(TSource)</code> is called <code>Linq method</code> which referenced from <code>System.Linq</code> namespace.</p>
<p>So, my question is: what is <code>.singleOrDefault(x => x % 2 === 0)</code> called in this case (in javascript)?</p>
| 0debug |
How to use multiple values in when (Evaluate )? : I have the following code and as can be seen that in both the cases I'm using Section = A. But, is there a way to check both 1&2 in "When" so that to avoid more lines of code?
Evaluate INTERFACE
When "1"
SECTION = "A";
Break;
When "2"
SECTION = "A";
Break;
Any help is highly appreciated and please remember I'm still, learning. Thanks! :) | 0debug |
Docker-compose using host environment variable : <p>I'm trying to do the following in my docker-compose.yml</p>
<p>But I hit this warning?
<code>WARNING: The HOSTNAME variable is not set. Defaulting to a blank string</code></p>
<p><code>environment:
KAFKA_ADVERTISED_HOST_NAME: ${HOSTNAME}
</code></p>
<p>The HOSTNAME environment variable is obviously set on the host.</p>
| 0debug |
C CreateThread() to slow? : i have a following code for matrix-vector multiplication:
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
std::chrono::steady_clock::time_point start, end2;
void fillMatrixConditions(LPVOID lpv) {
end2 = std::chrono::steady_clock::now();
std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::microseconds>(end2 - start).count() << std::endl;
std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::nanoseconds> (end2 - start).count() << std::endl;
int i, j = horizontControl;
for (i = 0; i < horizontControl; i++, j++) {
b[i] = akcni - uMin;
b[j] = uMax - akcni;
}
j = 2 * horizontControl + N - N1 + 1;
int k = 0;
for (i = 2 * i; i < (2 * horizontControl + N - N1 + 1); i++, j++, k++) {
b[i] = MpDup[k] - yMin;
b[j] = yMax - MpDup[k];
};
RtPrintf("Thread");
}
int _tmain(int argc, _TCHAR * argv[])
{
HANDLE hThread;
DWORD id;
int k = 0;
double temp;
double g[50];
for (int j = 0; j < N - N1 + 1; j++)
{
temp = 0;
for (int m = 0; m < horizontPrediction - 1; m++, k++)
{
temp = temp + Mp[k] * dup[m];
}
MpDup[j] = temp;
tempMatrix[j] = setPoint - y - temp;
}
start = std::chrono::steady_clock::now();
hThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)fillMatrixConditions, NULL, NULL, &id);
k = 0;
for (int j = 0; j < horizontControl; j++)
{
temp = 0;
for (int m = 0; m < N - N1 + 1; m++, k++)
{
temp = temp + Mtranspose[k] * tempMatrix[m];
}
g[j] = -2 * temp;
}
RtPrintf("Point\n");
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
return 0;
}
<!-- end snippet -->
But CreateThread() is to slow, because this is output program:
Point
Time difference = 247
Time difference = 247261
I thought first will be write Time difference in thread and then "Point". Or is it normal? I must use CreateThread. I can't pthread etc. Matrix Mtranspose has 2025 cells.
Thanks for help :-) | 0debug |
void nbd_client_close(BlockDriverState *bs)
{
NbdClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = {
.type = NBD_CMD_DISC,
.from = 0,
.len = 0
};
if (client->ioc == NULL) {
return;
}
nbd_send_request(client->ioc, &request);
nbd_teardown_connection(bs);
}
| 1threat |
How Only get name easyImage Android? : <p><strong>Before</strong></p>
<p>[/data/user/0/com.example.hx_loom.evpa/cache/EasyImage/a85f8011-10d5-4050-89d2-1e575da55522.jpg,</p>
<p>/data/user/0/com.example.hx_loom.evpa/cache/EasyImage/4737a29f-7df2-4e1f-abe3-18b71293d76e.jpg]</p>
<p><strong>After</strong>
a85f8011-10d5-4050-89d2-1e575da55522.jpg,4737a29f-7df2-4e1f-abe3-18b71293d76e.jpg</p>
<p>please help me this algoritma</p>
| 0debug |
HTML with a Jquery btn : So I made a web site on WordPress in which I need to put an arrow that scroll down in the page, and it works but just one time and I need that buttom work the hole page.
This is the code:
'<script type="text/javascript">
''$(document).ready(function(){
''$('.ir-abajo').click(function(){
'''$('body, html').animate({
''scrollTop: '220px'
'}, 200);
'});
'});
'</script> | 0debug |
how to change bullet color of jquery slider : I want to change the default bullet(li) color of jquery slider into orange color.
If not selected then circle border orange. If selected then circle fill with orange color.
Please help. | 0debug |
static MemTxResult vtd_mem_ir_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size,
MemTxAttrs attrs)
{
int ret = 0;
MSIMessage from = {}, to = {};
from.address = (uint64_t) addr + VTD_INTERRUPT_ADDR_FIRST;
from.data = (uint32_t) value;
ret = vtd_interrupt_remap_msi(opaque, &from, &to);
if (ret) {
VTD_DPRINTF(GENERAL, "int remap fail for addr 0x%"PRIx64
" data 0x%"PRIx32, from.address, from.data);
return MEMTX_ERROR;
}
VTD_DPRINTF(IR, "delivering MSI 0x%"PRIx64":0x%"PRIx32
" for device sid 0x%04x",
to.address, to.data, sid);
if (dma_memory_write(&address_space_memory, to.address,
&to.data, size)) {
VTD_DPRINTF(GENERAL, "error: fail to write 0x%"PRIx64
" value 0x%"PRIx32, to.address, to.data);
}
return MEMTX_OK;
}
| 1threat |
static av_cold int read_specific_config(ALSDecContext *ctx)
{
GetBitContext gb;
uint64_t ht_size;
int i, config_offset;
MPEG4AudioConfig m4ac;
ALSSpecificConfig *sconf = &ctx->sconf;
AVCodecContext *avctx = ctx->avctx;
uint32_t als_id, header_size, trailer_size;
init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,
avctx->extradata_size * 8, 1);
if (config_offset < 0)
return -1;
skip_bits_long(&gb, config_offset);
if (get_bits_left(&gb) < (30 << 3))
return -1;
als_id = get_bits_long(&gb, 32);
avctx->sample_rate = m4ac.sample_rate;
skip_bits_long(&gb, 32);
sconf->samples = get_bits_long(&gb, 32);
avctx->channels = m4ac.channels;
skip_bits(&gb, 16);
skip_bits(&gb, 3);
sconf->resolution = get_bits(&gb, 3);
sconf->floating = get_bits1(&gb);
sconf->msb_first = get_bits1(&gb);
sconf->frame_length = get_bits(&gb, 16) + 1;
sconf->ra_distance = get_bits(&gb, 8);
sconf->ra_flag = get_bits(&gb, 2);
sconf->adapt_order = get_bits1(&gb);
sconf->coef_table = get_bits(&gb, 2);
sconf->long_term_prediction = get_bits1(&gb);
sconf->max_order = get_bits(&gb, 10);
sconf->block_switching = get_bits(&gb, 2);
sconf->bgmc = get_bits1(&gb);
sconf->sb_part = get_bits1(&gb);
sconf->joint_stereo = get_bits1(&gb);
sconf->mc_coding = get_bits1(&gb);
sconf->chan_config = get_bits1(&gb);
sconf->chan_sort = get_bits1(&gb);
sconf->crc_enabled = get_bits1(&gb);
sconf->rlslms = get_bits1(&gb);
skip_bits(&gb, 5);
skip_bits1(&gb);
if (als_id != MKBETAG('A','L','S','\0'))
return -1;
ctx->cur_frame_length = sconf->frame_length;
if (sconf->chan_config)
sconf->chan_config_info = get_bits(&gb, 16);
if (sconf->chan_sort && avctx->channels > 1) {
int chan_pos_bits = av_ceil_log2(avctx->channels);
int bits_needed = avctx->channels * chan_pos_bits + 7;
if (get_bits_left(&gb) < bits_needed)
return -1;
if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos))))
return AVERROR(ENOMEM);
ctx->cs_switch = 1;
for (i = 0; i < avctx->channels; i++) {
int idx;
idx = get_bits(&gb, chan_pos_bits);
if (idx >= avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
ctx->cs_switch = 0;
break;
}
sconf->chan_pos[idx] = i;
}
align_get_bits(&gb);
}
if (get_bits_left(&gb) < 64)
return -1;
header_size = get_bits_long(&gb, 32);
trailer_size = get_bits_long(&gb, 32);
if (header_size == 0xFFFFFFFF)
header_size = 0;
if (trailer_size == 0xFFFFFFFF)
trailer_size = 0;
ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3;
if (get_bits_left(&gb) < ht_size)
return -1;
if (ht_size > INT32_MAX)
return -1;
skip_bits_long(&gb, ht_size);
if (sconf->crc_enabled) {
if (get_bits_left(&gb) < 32)
return -1;
if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {
ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
ctx->crc = 0xFFFFFFFF;
ctx->crc_org = ~get_bits_long(&gb, 32);
} else
skip_bits_long(&gb, 32);
}
dprint_specific_config(ctx);
return 0;
}
| 1threat |
static uint32_t qvirtio_pci_get_features(QVirtioDevice *d)
{
QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES);
}
| 1threat |
Strange "!*" entry in LocalVariableTypeTable when compiling with eclipse compiler : <p>Let's compile the following code with ECJ compiler from Eclipse Mars.2 bundle:</p>
<pre><code>import java.util.stream.*;
public class Test {
String test(Stream<?> s) {
return s.collect(Collector.of(() -> "", (a, t) -> {}, (a1, a2) -> a1));
}
}
</code></pre>
<p>The compilation command is the following:</p>
<p><code>$ java -jar org.eclipse.jdt.core_3.11.2.v20160128-0629.jar -8 -g Test.java</code></p>
<p>After the successful compilation let's check the resulting class file with <code>javap -v -p Test.class</code>. The most interesting is the synthetic method generated for the <code>(a, t) -> {}</code> lambda:</p>
<pre><code> private static void lambda$1(java.lang.String, java.lang.Object);
descriptor: (Ljava/lang/String;Ljava/lang/Object;)V
flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=0, locals=2, args_size=2
0: return
LineNumberTable:
line 5: 0
LocalVariableTable:
Start Length Slot Name Signature
0 1 0 a Ljava/lang/String;
0 1 1 t Ljava/lang/Object;
LocalVariableTypeTable:
Start Length Slot Name Signature
0 1 1 t !*
</code></pre>
<p>I was quite surprised to see this <code>!*</code> entry in <code>LocalVariableTypeTable</code>. JVM specification <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.14" rel="noreferrer">covers</a> LocalVariableTypeTable attribute and says:</p>
<blockquote>
<p>The <code>constant_pool</code> entry at that index must contain a <code>CONSTANT_Utf8_info</code> structure (<a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7" rel="noreferrer">§4.4.7</a>) representing a field signature which encodes the type of a local variable in the source program (<a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1" rel="noreferrer">§4.7.9.1</a>). </p>
</blockquote>
<p><a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1" rel="noreferrer">§4.7.9.1</a> defines a grammar for field signatures which, if I understand correctly, does not cover anything similar to <code>!*</code>.</p>
<p>It should also be noted that neither javac compiler, nor older ECJ 3.10.x versions generate this <code>LocalVariableTypeTable</code> entry. Is <code>!*</code> some non-standard Eclipse extension or I'm missing something in JVM spec? Does this mean that ECJ does not conform to JVM spec? What <code>!*</code> actually mean and are there any other similar strings which could appear in <code>LocalVariableTypeTable</code> attribute?</p>
| 0debug |
iOS Logging: How to Formatting Log Messages(get time_t, timeval, errno) in swift : How to the use System log through Logging. I go throw this apple Document
> https://developer.apple.com/documentation/os/logging for logging.
But cant get the Formatting Log Messages.
Using this code
> os_log(OS_LOG_DEFAULT, "Time: %{time_t}d", time_t)
OS_LOG_DEFAULT is show an Error
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/CHXya.png
How to use this OS_LOG_DEFAULT, How to get a all Formatting Log Messages (time_t,timeval,timespec,errno,iec-bytes,bitrate,iec-bitrate,uuid_t)
Want to know how to use this Performing Logging
os_log("This is a log message.")
os_log("This is additional info that may be helpful for troubleshooting.", log: OSLog.default, type: .info)
let customLog = OSLog(subsystem: "com.your_company.your_subsystem_name.plist", category: "your_category_name")
os_log("This is info that may be helpful during development or debugging.", log: customLog, type: .debug)
How to Use this in my application, want to get Formatting Log Messages,Performing Logging Help me. Thanks advance.
| 0debug |
static inline int ohci_put_hcca(OHCIState *ohci,
uint32_t addr, struct ohci_hcca *hcca)
{
cpu_physical_memory_write(addr + ohci->localmem_base, hcca, sizeof(*hcca));
return 1;
}
| 1threat |
Unreachable code in the Eclipse editer : I have a problem with this code, it says "Unreachable code".
It says that the "EntityLivingBase entity = (EntityLivingBase) theObject;" is a unreachable code.
Please Help Me!
Here's my project:
@Override
public void onRender() {
if (!this.isToggled())
return;
for(Object theObject : mc.theWorld.loadedEntityList) {
if(!(theObject instanceof EntityLivingBase)) {
continue;
EntityLivingBase entity = (EntityLivingBase) theObject;
if(entity instanceof EntityPlayer) {
if(entity != mc.thePlayer)
player(entity);
continue;
}
if (entity instanceof EntityMob) {
mob(entity);
continue;
}
if (entity instanceof EntityAnimal) {
animal(entity);
continue;
}
passive(entity);
}
}
super.onRender();
}
If you could help me, I would be very happy! | 0debug |
how to get Id option selected on modal show using js : I tried to get the ID on the option selected when the modal was in show state.
This My Js
$("#modal-form").on('shown.bs.modal',function(e){
console.log("CHANGE");
var id = $("#customer option:selected").val();
console.log(id);
});
This My Html (This code on modal)
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div class="form-group">
<label for="customer" class="col-md-2 control-label">Customer</label>
<div class="col-md-9">
<select class="form-control" id="customer" name="customer" class="form-control">
<option value="John">John</option>
<option value="Alex">Alex</option>
</select>
<span class="help-block with-errors" </span>
</div>
</div>
<!-- end snippet -->
sorry my english bad
thankyou
| 0debug |
svg animation not display button click event : Im created some `svg` animation im added it my application , when i click the button after i want to display this animation same page move to top (like Facebook text delight animation ), next redirect next page(addacore) its cant do that , how can i correctly do that
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
svg{
background: transparent;
padding-top:-20px;
}
.conf0{fill:#FC6394;}
.conf1{fill:#EF3C8A;}
.conf2{fill:#5ADAEA;}
.conf3{fill:#974CBE;}
.conf4{fill:#3CBECD;}
.conf5{fill:#813BBE;}
.conf6{fill:#F9B732;}
.conf7{display:none;fill:none;stroke:#000000;stroke-miterlimit:10;}
.conf8{fill:none;stroke:#F9B732;stroke-width:9;stroke-linecap:round;stroke-miterlimit:10;}
.confetti-cone{
transform-origin: 200px 50px;
animation:confetti-cone1 1.2s ease infinite;
}
@keyframes confetti-cone1{
0%{
transform:translate(40px, 95px) rotate(45deg) scale(1, 1);
}
15%{
transform:translate(10px, 145px) rotate(45deg) scale(1.1, 0.85);
}
100%{
transform:translate(40px, 105px) rotate(45deg) scale(1, 1);
}
}
#yellow-strip {
fill:none;
stroke:#F9B732;
stroke-width:9;
stroke-linecap:round;
stroke-miterlimit:10;
animation: confdash 1.2s ease infinite;
}
@keyframes confdash {
0%{
stroke-dasharray:1000;
stroke-dashoffset:500;
transform:translate(-30px, 30px);
opacity:0;
}
2%{
stroke-dasharray:1000;
stroke-dashoffset:500;
transform:translate(-30px, 30px);
opacity:0;
}
35%{
stroke-dasharray:1000;
stroke-dashoffset:900;
transform:translate(-2px, 0px);
opacity:1;
}
85%{
stroke-dasharray:1000;
stroke-dashoffset:1000;
transform:translate(1px, -5px);
opacity:1;
}
90%{
stroke-dashoffset:1000;
stroke-dashoffset:1000;
transform:translate(2px, -8px);
opacity:0;
}
100%{
stroke-dashoffset:1000;
stroke-dashoffset:500;
transform:translate(2px, -8px);
opacity:0;
}
}
#conf-a{
transform-origin: center center;
animation: confa 1.2s ease-out infinite;
}
@keyframes confa {
0%{
opacity:0;
transform: translate(-30px, 20px) rotate(0);
}
15%{
opacity:1;
transform: translate(25px, -10px) rotate(60deg);
}
80%{
opacity:1;
transform: translate(33px, -18px) rotate(180deg);
}
100%{
opacity:0;
transform: translate(37px, -23px) scale(0.5)rotate(230deg);
}
}
#conf-b{
transform-origin: center center;
animation: confb 1.2s ease-out infinite;
}
@keyframes confb {
0%{
opacity:0;
transform: translate(-30px, 20px) rotate(0);
}
12%{
opacity:1;
transform: translate(25px, -10px) rotate(60deg);
}
76%{
opacity:1;
transform: translate(33px, -18px) rotate(180deg);
}
100%{
opacity:0;
transform: translate(37px, -23px) scale(0.5) rotate(240deg);
}
}
#conf-c{
transform-origin: center center;
animation: confc 1.2s ease-out infinite;
}
@keyframes confc {
0%{
opacity:0.7;
transform: translate(-30px, 20px) rotate(0);
}
18%{
opacity:1;
transform: translate(5px, -10px) rotate(60deg);
}
76%{
opacity:1;
transform: translate(13px, -18px) rotate(180deg);
}
100%{
opacity:0;
transform: translate(17px, -23px) scale(0.5) rotate(230deg);
}
}
#conf-d{
transform-origin: center center;
animation: confd 1.2s ease-out infinite;
}
@keyframes confd {
0%{
opacity:0.7;
transform: translate(-20px, 20px) rotate(0);
}
18%{
opacity:1;
transform: translate(-5px, -10px) rotate(60deg);
}
76%{
opacity:1;
transform: translate(-8px, -18px) rotate(180deg);
}
100%{
opacity:0;
transform: translate(-10px, -23px) scale(0.5) rotate(230deg);
}
}
<!-- language: lang-html -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<div class="footer-tab">
<!--button-->
<div class="crtnewgrp-btn">
<div class="d-flex flex-column">
<a href="addacore" style="text-decoration: none;"> <div class="p-2"><button type="button" class="btn btn-primary btn-lg btn-block" >Add score</button></div>
</a>
</div>
</div>
<!--/button-->
</div>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1200 800" style="enable-background:new 0 0 1200 800;" xml:space="preserve">
<g class="confetti-cone">
<path class="conf0" d="M131.5,172.6L196,343c2.3,6.1,11,6.1,13.4,0l65.5-170.7L131.5,172.6z"/>
<path class="conf1" d="M131.5,172.6L196,343c2.3,6.1,11,6.1,13.4,0l6.7-17.5l-53.6-152.9L131.5,172.6z"/>
<path class="conf2" d="M274.2,184.2c-1.8,1.8-4.2,2.9-7,2.9l-129.5,0.4c-5.4,0-9.8-4.4-9.8-9.8c0-5.4,4.4-9.8,9.9-9.9l129.5-0.4
c5.4,0,9.8,4.4,9.8,9.8C277,180,275.9,182.5,274.2,184.2z"/>
<polygon class="conf3" points="231.5,285.4 174.2,285.5 143.8,205.1 262.7,204.7 "/>
<path class="conf4" d="M166.3,187.4l-28.6,0.1c-5.4,0-9.8-4.4-9.8-9.8c0-5.4,4.4-9.8,9.9-9.9l24.1-0.1c0,0-2.6,5-1.3,10.6
C161.8,183.7,166.3,187.4,166.3,187.4z"/>
<ellipse transform="matrix(0.7071 -0.7071 0.7071 0.7071 -89.8523 231.0278)" class="conf2" cx="233.9" cy="224" rx="5.6" ry="5.6"/>
<path class="conf5" d="M143.8,205.1l5.4,14.3c6.8-2.1,14.4-0.5,19.7,4.8c7.7,7.7,7.6,20.1-0.1,27.8c-1.7,1.7-3.7,3-5.8,4l11.1,29.4
l27.7,0l-28-80.5L143.8,205.1z"/>
<path class="conf2" d="M169,224.2c-5.3-5.3-13-6.9-19.7-4.8l13.9,36.7c2.1-1,4.1-2.3,5.8-4C176.6,244.4,176.6,231.9,169,224.2z"/>
<ellipse transform="matrix(0.7071 -0.7071 0.7071 0.7071 -119.0946 221.1253)" class="conf6" cx="207.4" cy="254.3" rx="11.3" ry="11.2"/>
</g>
<rect x="113.7" y="135.7" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -99.5348 209.1582)" class="conf7" width="178" height="178"/>
<line class="conf7" x1="76.8" y1="224.7" x2="328.6" y2="224.7"/>
<polyline class="conf7" points="202.7,350.6 202.7,167.5 202.7,98.9 "/>
<!-- here comes the confettis-->
<circle class="conf2" id="conf-b" cx="195.2" cy="232.6" r="5.1"/>
<circle class="conf0" id="conf-b" cx="230.8" cy="219.8" r="5.4"/>
<circle class="conf0" id="conf-c" cx="178.9" cy="160.4" r="4.2"/>
<circle class="conf6" id="conf-d"cx="132.8" cy="123.6" r="5.4"/>
<circle class="conf0" id="conf-d" cx="151.9" cy="105.1" r="5.4"/>
<path class="conf0" id="conf-d" d="M129.9,176.1l-5.7,1.3c-1.6,0.4-2.2,2.3-1.1,3.5l3.8,4.2c1.1,1.2,3.1,0.8,3.6-0.7l1.9-5.5
C132.9,177.3,131.5,175.7,129.9,176.1z"/>
<path class="conf6" id="conf-b" d="M284.5,170.7l-5.4,1.2c-1.5,0.3-2.1,2.2-1,3.3l3.6,3.9c1,1.1,2.9,0.8,3.4-0.7l1.8-5.2
C287.4,171.9,286.1,170.4,284.5,170.7z"/>
<circle class="conf6" id="conf-c"cx="206.7" cy="144.4" r="4.5"/>
<path class="conf2" id="conf-c" d="M176.4,192.3h-3.2c-1.6,0-2.9-1.3-2.9-2.9v-3.2c0-1.6,1.3-2.9,2.9-2.9h3.2c1.6,0,2.9,1.3,2.9,2.9v3.2
C179.3,191,178,192.3,176.4,192.3z"/>
<path class="conf2" id="conf-b" d="M263.7,197.4h-3.2c-1.6,0-2.9-1.3-2.9-2.9v-3.2c0-1.6,1.3-2.9,2.9-2.9h3.2c1.6,0,2.9,1.3,2.9,2.9v3.2
C266.5,196.1,265.2,197.4,263.7,197.4z"/>
<!-- yellow-strip-1-->
<path id="yellow-strip" d="M179.7,102.4c0,0,6.6,15.3-2.3,25c-8.9,9.7-24.5,9.7-29.7,15.6c-5.2,5.9-0.7,18.6,3.7,28.2
c4.5,9.7,2.2,23-10.4,28.2"/>
<path class="conf8" id="yellow-strip" d="M252.2,156.1c0,0-16.9-3.5-28.8,2.4c-11.9,5.9-14.9,17.8-16.4,29c-1.5,11.1-4.3,28.8-31.5,33.4"/>
<path class="conf0" id="conf-a" d="M277.5,254.8h-3.2c-1.6,0-2.9-1.3-2.9-2.9v-3.2c0-1.6,1.3-2.9,2.9-2.9h3.2c1.6,0,2.9,1.3,2.9,2.9v3.2
C280.4,253.5,279.1,254.8,277.5,254.8z"/>
<path class="conf3" id="conf-c" d="M215.2,121.3L215.2,121.3c0.3,0.6,0.8,1,1.5,1.1l0,0c1.6,0.2,2.2,2.2,1.1,3.3l0,0c-0.5,0.4-0.7,1.1-0.6,1.7v0
c0.3,1.6-1.4,2.8-2.8,2l0,0c-0.6-0.3-1.2-0.3-1.8,0h0c-1.4,0.7-3.1-0.5-2.8-2v0c0.1-0.6-0.1-1.3-0.6-1.7l0,0
c-1.1-1.1-0.5-3.1,1.1-3.3l0,0c0.6-0.1,1.2-0.5,1.5-1.1v0C212.5,119.8,214.5,119.8,215.2,121.3z"/>
<path class="conf3" id="conf-b" d="M224.5,191.7L224.5,191.7c0.3,0.6,0.8,1,1.5,1.1l0,0c1.6,0.2,2.2,2.2,1.1,3.3v0c-0.5,0.4-0.7,1.1-0.6,1.7l0,0
c0.3,1.6-1.4,2.8-2.8,2h0c-0.6-0.3-1.2-0.3-1.8,0l0,0c-1.4,0.7-3.1-0.5-2.8-2l0,0c0.1-0.6-0.1-1.3-0.6-1.7v0
c-1.1-1.1-0.5-3.1,1.1-3.3l0,0c0.6-0.1,1.2-0.5,1.5-1.1l0,0C221.7,190.2,223.8,190.2,224.5,191.7z"/>
<path class="conf3" id="conf-a" d="M312.6,242.1L312.6,242.1c0.3,0.6,0.8,1,1.5,1.1l0,0c1.6,0.2,2.2,2.2,1.1,3.3l0,0c-0.5,0.4-0.7,1.1-0.6,1.7v0
c0.3,1.6-1.4,2.8-2.8,2l0,0c-0.6-0.3-1.2-0.3-1.8,0h0c-1.4,0.7-3.1-0.5-2.8-2v0c0.1-0.6-0.1-1.3-0.6-1.7l0,0
c-1.1-1.1-0.5-3.1,1.1-3.3l0,0c0.6-0.1,1.2-0.5,1.5-1.1v0C309.9,240.6,311.9,240.6,312.6,242.1z"/>
<path class="conf8" id="yellow-strip" d="M290.7,215.4c0,0-14.4-3.4-22.6,2.7c-8.2,6.2-8.2,23.3-17.1,29.4c-8.9,6.2-19.8-2.7-32.2-4.1
c-12.3-1.4-19.2,5.5-20.5,10.9"/>
</svg>
<!-- end snippet -->
Thanks | 0debug |
What code can I use to recreate the picture? : I need to recreate this photo, colors and all. Having trouble with positioning the turtle to stack the circles. Any help?
I've already tried setheading and position[enter image description here][1]
[1]: https://i.stack.imgur.com/qOZWS.png | 0debug |
Cant Run Android application on eclipse : i have problem with eclipse and i hope to help me to solve it !!
so, my problem is i cant run my android appliction on eclipse
when i click run it show to me this form and dont have android application choise !
this is a screenshot
[picture][1]
[1]: http://i.stack.imgur.com/exEmo.png
so, any idea to solve this problem ????
Hello ! i have problem with eclipse and i hope to help me to solve it !!
so, my problem is i cant run my android appliction on eclipse
when i click run it show to me this form and dont have android application choise !
this is a screenshot
[picture][1]
[1]: http://i.stack.imgur.com/exEmo.png
so, any idea to solve this problem ???? | 0debug |
static void taihu_405ep_init(ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model)
{
char *filename;
CPUPPCState *env;
qemu_irq *pic;
ram_addr_t bios_offset;
target_phys_addr_t ram_bases[2], ram_sizes[2];
target_ulong bios_size;
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot;
int fl_idx, fl_sectors;
DriveInfo *dinfo;
ram_bases[0] = qemu_ram_alloc(NULL, "taihu_405ep.ram-0", 0x04000000);
ram_sizes[0] = 0x04000000;
ram_bases[1] = qemu_ram_alloc(NULL, "taihu_405ep.ram-1", 0x04000000);
ram_sizes[1] = 0x04000000;
ram_size = 0x08000000;
#ifdef DEBUG_BOARD_INIT
printf("%s: register cpu\n", __func__);
#endif
env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
kernel_filename == NULL ? 0 : 1);
#ifdef DEBUG_BOARD_INIT
printf("%s: register BIOS\n", __func__);
#endif
fl_idx = 0;
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
fl_sectors = (bios_size + 65535) >> 16;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size);
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n",
fl_idx, bios_size, bios_offset, -bios_size,
bdrv_get_device_name(dinfo->bdrv), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size), bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
} else
#endif
{
#ifdef DEBUG_BOARD_INIT
printf("Load BIOS from file\n");
#endif
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", BIOS_SIZE);
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
} else {
bios_size = -1;
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
}
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
bios_size = 32 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s'\n",
fl_idx, bios_size, bios_offset, (target_ulong)0xfc000000,
bdrv_get_device_name(dinfo->bdrv));
#endif
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.flash", bios_size);
pflash_cfi02_register(0xfc000000, bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: register CPLD\n", __func__);
#endif
taihu_cpld_init(0x50100000);
linux_boot = (kernel_filename != NULL);
if (linux_boot) {
#ifdef DEBUG_BOARD_INIT
printf("%s: load kernel\n", __func__);
#endif
kernel_base = KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys(kernel_filename, kernel_base,
ram_size - kernel_base);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
kernel_filename);
exit(1);
}
if (initrd_filename) {
initrd_base = INITRD_LOAD_ADDR;
initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr,
"qemu: could not load initial ram disk '%s'\n",
initrd_filename);
exit(1);
}
} else {
initrd_base = 0;
initrd_size = 0;
}
} else {
kernel_base = 0;
kernel_size = 0;
initrd_base = 0;
initrd_size = 0;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: Done\n", __func__);
#endif
}
| 1threat |
form that saves information entered into a data.txt file php none of them works : <p>i'am looking for form that has index.html and process.php
In index you enter Your Name:
Your age: (but you dont enter it gives you option from 10 to 50) and you click submit
and that information saves in data.txt file on /var/www/html not on client side.
I've tried hundred of them none of them works</p>
<p>Also please don't link other forms i've tried hundred of them on stack, on google, look they are all outdated?
I'am using Ubuntu 18.04 lts server, with apache2 installed and php, PHP 7.0.33-0+deb9u6 (cli) (built: Oct 24 2019 18:50:20) ( NTS )
Server version: Apache/2.4.25 (Debian)
Server built: 2019-10-13T15:43:54</p>
| 0debug |
static gboolean nbd_accept(QIOChannel *ioc, GIOCondition condition,
gpointer opaque)
{
QIOChannelSocket *cioc;
if (!nbd_server) {
return FALSE;
}
cioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc),
NULL);
if (!cioc) {
return TRUE;
}
qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server");
nbd_client_new(NULL, cioc,
nbd_server->tlscreds, NULL,
nbd_client_put);
object_unref(OBJECT(cioc));
return TRUE;
}
| 1threat |
How to show image as product on other domain as advertising : <p>As we know when we visit e-commerce site like amazon and see some product,
after some time if we go to some other domain like Facebook, we should see same amazon product showing on Facebook.</p>
<p>Can you please tell me, how it achieve? </p>
| 0debug |
Does await guarantee execution order without assignment in JavaScript? : <p>Subject. Can I say that two pieces of code below are equal:</p>
<pre><code>await someFunc() // no assignment here
doSomethingAfterSomeFunc()
</code></pre>
<p>and:</p>
<pre><code>someFunc().then(() =>
doSomethingAfterSomeFunc()
)
</code></pre>
<p>I tried and it looks like they are equal but there is a doubt(e.g. some optimization)</p>
| 0debug |
Filter a value when using regex and grep : <p>I am reading memory usage for an android app named <code>mobile_cep</code> as follows</p>
<p><code>adb shell dumpsys meminfo | grep mobile_cep</code></p>
<p>But this command this output as </p>
<pre><code>amar@admin:~/Desktop/bash-andy$ adb shell dumpsys meminfo | grep mobile_cep
234,467K: org.carleton.iot.mobile_cep (pid 27060 / activities)
234,467K: org.carleton.iot.mobile_cep (pid 27060 / activities)
</code></pre>
<p>meaning that output is displayed twice. My goal is to find <code>234,467K</code> value multiple times so as to find the average value of memory usage. </p>
<p>The following script is used</p>
<pre><code>#!/bin/bash
counter=1
while [ $counter -le 10 ]
do
((counter++))
val1=$(adb shell dumpsys meminfo | grep mobile_cep | sed 's/:.*//')
echo $val1
done
echo done
</code></pre>
<p>It gives the result as </p>
<pre><code>234,675K 234,675K
234,678K 234,678K
234,679K 234,679K
234,678K 234,678K
234,679K 234,679K
234,682K 234,682K
</code></pre>
<p>But I just want first value.</p>
<hr>
<p>How to achieve this ?</p>
| 0debug |
static void chr_read(void *opaque, const void *buf, size_t size)
{
VirtIORNG *vrng = opaque;
size_t len;
int offset;
if (!is_guest_ready(vrng)) {
return;
}
offset = 0;
while (offset < size) {
if (!pop_an_elem(vrng)) {
break;
}
len = iov_from_buf(vrng->elem.in_sg, vrng->elem.in_num,
0, buf + offset, size - offset);
offset += len;
virtqueue_push(vrng->vq, &vrng->elem, len);
vrng->popped = false;
}
virtio_notify(&vrng->vdev, vrng->vq);
len = pop_an_elem(vrng);
if (len) {
rng_backend_request_entropy(vrng->rng, size, chr_read, vrng);
}
}
| 1threat |
static int usb_net_handle_datain(USBNetState *s, USBPacket *p)
{
int ret = USB_RET_NAK;
if (s->in_ptr > s->in_len) {
s->in_ptr = s->in_len = 0;
ret = USB_RET_NAK;
return ret;
}
if (!s->in_len) {
ret = USB_RET_NAK;
return ret;
}
ret = s->in_len - s->in_ptr;
if (ret > p->iov.size) {
ret = p->iov.size;
}
usb_packet_copy(p, &s->in_buf[s->in_ptr], ret);
s->in_ptr += ret;
if (s->in_ptr >= s->in_len &&
(is_rndis(s) || (s->in_len & (64 - 1)) || !ret)) {
s->in_ptr = s->in_len = 0;
}
#ifdef TRAFFIC_DEBUG
fprintf(stderr, "usbnet: data in len %zu return %d", p->iov.size, ret);
iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", ret);
#endif
return ret;
}
| 1threat |
Why is the CSS attribute ‘stroke’ named so? : <p>Why is the CSS attribute ‘stroke’ named so?</p>
<p>I find no dictionary meaning of stroke as border/outline, isn’t that what the attribute does, defining the properties of border/outline?</p>
<p>Shouldn’t the attribute have been named border/outline instead?</p>
| 0debug |
static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size)
{
const unsigned char *data_end = data + data_size;
GetBitContext gb;
int flags, i, j, x, y, op;
unsigned char c[3];
unsigned char *dst;
uint32_t *palette;
flags = *data++;
if (flags & 1) {
palette = (uint32_t *)seq->frame.data[1];
if (data_end - data < 256 * 3)
return AVERROR_INVALIDDATA;
for (i = 0; i < 256; i++) {
for (j = 0; j < 3; j++, data++)
c[j] = (*data << 2) | (*data >> 4);
palette[i] = 0xFF << 24 | AV_RB24(c);
}
seq->frame.palette_has_changed = 1;
}
if (flags & 2) {
if (data_end - data < 128)
return AVERROR_INVALIDDATA;
init_get_bits(&gb, data, 128 * 8); data += 128;
for (y = 0; y < 128; y += 8)
for (x = 0; x < 256; x += 8) {
dst = &seq->frame.data[0][y * seq->frame.linesize[0] + x];
op = get_bits(&gb, 2);
switch (op) {
case 1:
data = seq_decode_op1(seq, data, data_end, dst);
break;
case 2:
data = seq_decode_op2(seq, data, data_end, dst);
break;
case 3:
data = seq_decode_op3(seq, data, data_end, dst);
break;
}
if (!data)
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| 1threat |
Installing GD in Docker : <p>I am a complete Docker novice but am having to maintain an existing system. The Dockerfile I am using is as below:</p>
<pre><code>FROM php:5.6-apache
RUN docker-php-ext-install mysql mysqli
RUN apt-get update -y && apt-get install -y sendmail
RUN apt-get update && \
apt-get install -y \
zlib1g-dev
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install zip
RUN docker-php-ext-install gd
</code></pre>
<p>When I run 'docker build [sitename]' everything seems ok until I get the error:</p>
<pre><code>configure: error: png.h not found.
The command '/bin/sh -c docker-php-ext-install gd' returned a non-zero code: 1
</code></pre>
<p>What is the cause of this error?</p>
| 0debug |
static int raw_eject(BlockDriverState *bs, int eject_flag)
{
BDRVRawState *s = bs->opaque;
switch(s->type) {
case FTYPE_CD:
if (eject_flag) {
if (ioctl (s->fd, CDROMEJECT, NULL) < 0)
perror("CDROMEJECT");
} else {
if (ioctl (s->fd, CDROMCLOSETRAY, NULL) < 0)
perror("CDROMEJECT");
}
break;
case FTYPE_FD:
{
int fd;
if (s->fd >= 0) {
close(s->fd);
s->fd = -1;
raw_close_fd_pool(s);
}
fd = open(bs->filename, s->fd_open_flags | O_NONBLOCK);
if (fd >= 0) {
if (ioctl(fd, FDEJECT, 0) < 0)
perror("FDEJECT");
close(fd);
}
}
break;
default:
return -ENOTSUP;
}
return 0;
}
| 1threat |
Using npm with an MVC project : <p>I am getting a bit confused here.</p>
<p>I have an <code>MVC</code> 5 project, I want to use the <code>npm</code> for managing my javascript packages.</p>
<p>I installed <code>npm</code> from <code>nuget</code> and here i am stuck, I cant find the commandline console window or anything like that.</p>
<p>All the info i see online is about node projects.</p>
<p>Can someone direct me to a relevant tutorial. </p>
<p>Using visual studio 2013, MVC 5.</p>
| 0debug |
ListView OnItemClick Listner does not work? : Am trying to call the fragment from the fragment, on a list view OnItemClick Listner. But the click listner does not work for me.
I have set the list items by using the adapter.
Here is my code.
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
FragmentTransaction xfragmentTransaction = mFragmentManager.beginTransaction();
xfragmentTransaction.replace(R.id.containerView,new ProductFragment()).commit();
}
}); | 0debug |
Generating code for property initialisers from an object instance : Can we use Roslyn to generate the object initialisers only from an instance of object? Not trying to decompile the object as in this post : http://stackoverflow.com/questions/29567489/can-roslyn-generate-source-code-from-an-object-instance
Would it work with complex/nested objects? | 0debug |
How can I compare more than one string by using == in php? : How can I compare more than one string by using `==` in php:
if( $variables == "string-1" or "string-2"){
$variables='desired string';
}
Is there any better or more formal method for it? | 0debug |
Iterating and return elements using for loop in JSX : <p>I was trying to access my component by using loop to iterate and call my component. I encountered no syntax error, however I didn't get desired elements out of my loop. Here is a sample code which I tried.</p>
<pre><code> render() {
return (
<div>
{this.genThumbnail([{'src':'../../resources/images/p1.jpg', 'mode':'normal'},
{'src':'../../resources/images/p2.jpg', 'mode':'normal'},
{'src':'../../resources/images/p3.jpg', 'mode':'normal'},
{'src':'../../resources/images/p4.jpg', 'mode':'landscape'},
{'src':'../../resources/images/p5.jpg', 'mode':'portrait'},
{'src':'../../resources/images/p6.jpg', 'mode':'landscape'}])}
</div>
</div>
)
}
genThumbnail(nails) {
debugger;
let src, mode;
return(
<div>
{
nails.forEach(function (data,index){
return <ThumbNail imgsrc={data.src} mode={data.mode}/>
}
)
}
</div>
)
}
</code></pre>
<p>I had to use map() helper method to achieve this. Anyone please clarify the shortcoming as a result of forEach.</p>
| 0debug |
static bool object_create_initial(const char *type)
{
if (g_str_equal(type, "rng-egd")) {
return false;
}
if (g_str_equal(type, "filter-buffer") ||
g_str_equal(type, "filter-dump") ||
g_str_equal(type, "filter-mirror") ||
g_str_equal(type, "filter-redirector") ||
g_str_equal(type, "colo-compare") ||
g_str_equal(type, "filter-rewriter")) {
return false;
}
if (g_str_has_prefix(type, "memory-backend-")) {
return false;
}
return true;
}
| 1threat |
Gdal Installation error using pip : <p>Im trying to install GDAL latest version using pip, but im getting the following error, Failed building wheel for GDAL.
My python version is 2.7.9, Please help me. It is installing gdal 1.11.3 version if i specify the version but i need latest version or >=2.0</p>
| 0debug |
php mail sending multiple mails : <p>I am using php mail to send response to client after successfull submission. This works fine. I have a foreach loop that deals with comma seperated entries and what is happening is that mail sending an email for each item instead of 1 email showing entries like: item1,item2,item3 etc. I know that the foreach loop is doing it's job because I can echo the items to screen. </p>
<p>I have posted code on sandbox and include link here. Any help gratefully recieved. I have been struggling with this for 2 days and finally need to turn for help. Thanks</p>
<p><a href="http://sandbox.onlinephpfunctions.com/code/0076b85be7e86ba4c710366dc67d0a956542e6de" rel="nofollow noreferrer">http://sandbox.onlinephpfunctions.com/code/0076b85be7e86ba4c710366dc67d0a956542e6de</a></p>
| 0debug |
Mapbox GL js available icons : <p>I am rewriting a web application from Mapbox.js to Mapbox GL js.
Using the standard 'mapbox://styles/mapbox/streets-v8' style, where can I find a list of all working marker icons?</p>
<p>Here is my code:</p>
<pre><code>m.map.addSource("markers", {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": ["-75.532965", "35.248018"]
},
"properties": {
"title": "Start",
"marker-symbol": "entrance",
"marker-size": "small",
"marker-color": "#D90008"
}
}
}
});
m.map.addLayer({
"id": "markers",
"type": "symbol",
"source": "markers",
"layout": {
"icon-image": "{marker-symbol}-15", //but monument-15 works
"text-field": "{title}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, -1.6],
"text-anchor": "top"
}
});
</code></pre>
<p>I read that all Maki icons should be made available for styles that don't have icons as a default:
<a href="https://github.com/mapbox/mapbox-gl-styles/issues/241" rel="noreferrer">https://github.com/mapbox/mapbox-gl-styles/issues/241</a>
But most of them don't work.
Also there is the problem with the sizes - for Maki they were -small, -medium and -large, and now I see -11 and -15.</p>
<p>I just need to use some basic marker icons.</p>
| 0debug |
How to get the src attribute from a JSON object? : <p>This is one object of my JSON :</p>
<pre><code> {
"box": [
{
"htm": "<div style=\"float:left;margin:0 0 10px\"><img alt=\"BICYCLE GARAGE\" src=\"//cdn.membershipworks.com/u/5ceef04cf033bfad7c9d9c82_lgl.jpg?1565140260\" class=\"SFbizlgo\" onerror=\"SF.del(this)\"></div><div style=\"float:left\"><h1 style=\"display:block;margin:0;padding:0;\">BICYCLE GARAGE</h1><p style=\"margin:15px 0 0;\">&quot;For bicycling around the block or around the world&quot; Bloomington, Indiana</p></div><div style=\"clear:both;\"></div>"
}
],
"lbl": "About"
}
],
</code></pre>
<p>To get the box object I did
<code>const logoHtml = tpl[0].box[0].htm</code>
and in my console I'm getting <code><div style="float:left;margin:0 0 10px"><img alt="ALAMEDA BICYCLE" src="//cdn.membershipworks.com/u/5ceef04bf033bfad7c9d9c0a_lgl.jpg?1566946141" class="SFbizlgo" onerror="SF.del(this)"></div><div style="float:left"><h1 style="display:block;margin:0;padding:0;">ALAMEDA BICYCLE</h1><p style="margin:15px 0 0;"></p></div><div style="clear:both;"></div></code></p>
<p>Which is good! To get the src attribute I've been doing <code>const newLogo = document.getElementsByTagName('img').src</code></p>
<p>Now, how do I combine those two constants to get the src attribute from the img tag?</p>
| 0debug |
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
{
struct kvm_s390_vm_cpu_processor prop = {
.fac_list = { 0 },
};
struct kvm_device_attr attr = {
.group = KVM_S390_VM_CPU_MODEL,
.attr = KVM_S390_VM_CPU_PROCESSOR,
.addr = (uint64_t) &prop,
};
int rc;
if (!model) {
if (kvm_s390_cmma_available() && !mem_path) {
kvm_s390_enable_cmma();
}
return;
}
if (!kvm_s390_cpu_models_supported()) {
error_setg(errp, "KVM doesn't support CPU models");
return;
}
prop.cpuid = s390_cpuid_from_cpu_model(model);
prop.ibc = s390_ibc_from_cpu_model(model);
s390_fill_feat_block(model->features, S390_FEAT_TYPE_STFL,
(uint8_t *) prop.fac_list);
rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
if (rc) {
error_setg(errp, "KVM: Error configuring the CPU model: %d", rc);
return;
}
rc = configure_cpu_feat(model->features);
if (rc) {
error_setg(errp, "KVM: Error configuring CPU features: %d", rc);
return;
}
rc = configure_cpu_subfunc(model->features);
if (rc) {
error_setg(errp, "KVM: Error configuring CPU subfunctions: %d", rc);
return;
}
if (test_bit(S390_FEAT_CMM, model->features)) {
if (mem_path) {
error_report("Warning: CMM will not be enabled because it is not "
"compatible to hugetlbfs.");
} else {
kvm_s390_enable_cmma();
}
}
}
| 1threat |
Inject character between substring of a string in Java : <p>I have a list of words stored in a list, words.</p>
<p><code>private String[] words = new String[]{"world", "you"};</code></p>
<p>I then have a string, helloWorld</p>
<p><code>private String helloWorld = "Hello world how are you?";</code></p>
<p>I would like to create a function that will take a string (in this case, helloWorld) and it will look case-insensitively to see if any of the strings in the <code>words</code> list are present. If there is, it will put a <code>*</code> character in between each letter of the matching string.</p>
<p>E.g. the output would be</p>
<p><code>Hello w*o*r*l*d how are y*o*u?</code> since both <code>world</code> and <code>you</code> are in the list.</p>
<p>Passing <code>"Hello"</code> would simply return back the unmodified string <code>"Hello"</code> because there is nothing in the string that is inside <code>words</code>.</p>
<p>How would I go about doing this? I have tried hardcoding a .replaceAll() call on the string for each word, but then I lose the casing of the string. E.g. <code>"Hello world how are you?"</code> became <code>"hello w*o*r*l*d how are y*o*u?"</code></p>
| 0debug |
Going back and forth with methods in java : I built a tic tac toe game using java but I just have one issue. I want my code to bounce back and forth from the `validPlayerOneInput` and `validPlayerTwoInput` methods. As you can see in my main, I'm calling both methods procedurally which be incorrect as it just stops after the method is called. I want this to keep running until a winner is determined.
How do I do so? Thank you for taking the time to read.
import java.util.*;
public class tictactoe {
private static char board[][] = {{1,2,3}, {4,5,6}, {7,8,9}};
char p1Sym, p2Sym;
public tictactoe() {
p1Sym ='X';
p2Sym = 'O';
boardFill();
}
void boardFill() {
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
System.out.print(board[i][j]);
System.out.print(" | ");
}
System.out.println();
}
}
void validInputPlayerOne() {
boolean isSet = true;
int player1Input, player1CorrectedInput;
System.out.println("Player 1, enter a number between 1-9: ");
Scanner player1 = new Scanner(System.in);
player1Input = player1.nextInt();
Scanner correctedInput = new Scanner(System.in);
while(player1Input < 1 || player1Input >= 10) {
System.out.println("This isn't a number between 1-9, try again: ");
player1CorrectedInput = correctedInput.nextInt();
player1Input = player1CorrectedInput;
}
// or
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
if(board[i][j] == player1Input){
// set new value
board[i][j] = p1Sym;
// set
isSet = true;
}
}
}
if(!isSet){
System.out.println("not found");
}
}
void validInputPlayerTwo() {
boolean isSet = true;
int player2Input, player2CorrectedInput;
System.out.println("Player 2, enter a number between 1-9: ");
Scanner player2 = new Scanner(System.in);
player2Input = player2.nextInt();
Scanner correctedInput = new Scanner(System.in);
while(player2Input < 1 || player2Input >= 10) {
System.out.println("This isn't a number between 1-9, try again: ");
player2CorrectedInput = correctedInput.nextInt();
player2Input = player2CorrectedInput;
}
// or
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
if(board[i][j] == player2Input){
board[i][j] = p2Sym;
isSet = true;
}
}
}
if(!isSet){
System.out.println("not found");
}
}
public static void main(String[] args) {
tictactoe t = new tictactoe();
t.validInputPlayerOne();
t.boardFill();
t.validInputPlayerTwo();
t.boardFill();
}
} | 0debug |
GraphQL Java client library : <p>I am looking for a java <em>client</em> library for GraphQL.
This is to use for server-to-server communication, both in java.
No android, not javascript... just java.
Apollo is the nearest answer, and it seems like it is for Android only, not for plain-java applications.
Lots of examples about build server in java, nothing about client.
Any idea?
Thanks!</p>
| 0debug |
check not null for list in a list at specific index : <p>How do I access <code>list2</code> in <code>list1</code> below and check <code>IsnotNull</code> in an Assert </p>
<pre><code>List<Object> list1= new List<Object>();
List<int> list2= new List<int>();
list1.add(someValue);
list1.add(list2);
Assert.IsNotNull(list1[1]..??);
</code></pre>
| 0debug |
Android Studio - No option to Link C++ to Gradle : <p>I have been trying to access some CPP Libraries from android and have been following the instructions here:</p>
<p><a href="https://developer.android.com/studio/projects/add-native-code.html#link-gradle" rel="noreferrer">https://developer.android.com/studio/projects/add-native-code.html#link-gradle</a></p>
<p>The issue is that there doesn't seem to be an option to 'Link C++ Project with Gradle' when I right click on the app module. Has anyone else had this issue? Did you solve it?</p>
| 0debug |
How to insert a 3D Photo using only Html and Css : <p>I created a 3d photo and i want to upload it to my website, and by animation that photo will be always rotating like a 3D Photo, but the command <code><img src="example.glb" alt="3D Photo"></code> doesn't work so i am having trouble inserting the photo.</p>
<pre><code><div class="photo">
<img src="dino 3d.glb" alt="">
</div>
</code></pre>
| 0debug |
Disable autostart of docker-compose project : <p>I have a docker-compose project using Docker for Mac that autostarts when I boot the computer.</p>
<p>I usually start the project with <code>docker-compose up -d</code>, but even running <code>docker-compose stop</code> before shutting down autostarts it again on boot.</p>
<p>I am not aware of specifically enabling this. How can I disable it?</p>
| 0debug |
def max_run_uppercase(test_str):
cnt = 0
res = 0
for idx in range(0, len(test_str)):
if test_str[idx].isupper():
cnt += 1
else:
res = cnt
cnt = 0
if test_str[len(test_str) - 1].isupper():
res = cnt
return (res) | 0debug |
static int dx2_decode_slice_444(GetBitContext *gb, AVFrame *frame,
int line, int left,
uint8_t lru[3][8])
{
int x, y;
int width = frame->width;
int ystride = frame->linesize[0];
int ustride = frame->linesize[1];
int vstride = frame->linesize[2];
uint8_t *Y = frame->data[0] + ystride * line;
uint8_t *U = frame->data[1] + ustride * line;
uint8_t *V = frame->data[2] + vstride * line;
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
for (x = 0; x < width; x++) {
Y[x] = decode_sym(gb, lru[0]);
U[x] = decode_sym(gb, lru[1]) ^ 0x80;
V[x] = decode_sym(gb, lru[2]) ^ 0x80;
}
Y += ystride;
U += ustride;
V += vstride;
}
return y;
}
| 1threat |
Preventing users from creating unnamed instances of a class : <p>For many <strong>RAII "guard"</strong> classes, being instantiated as anonymous variables does not make sense at all:</p>
<pre><code>{
std::lock_guard<std::mutex>{some_mutex};
// Does not protect the scope!
// The unnamed instance is immediately destroyed.
}
</code></pre>
<p></p>
<pre><code>{
scope_guard{[]{ cleanup(); }};
// `cleanup()` is executed immediately!
// The unnamed instance is immediately destroyed.
}
</code></pre>
<p>From <a href="http://www.learncpp.com/cpp-tutorial/814-anonymous-variables-and-objects/" rel="noreferrer">this article</a>:</p>
<blockquote>
<p>Anonymous variables in C++ have “expression scope”, meaning they are destroyed at the end of the expression in which they are created.</p>
</blockquote>
<hr>
<p><strong>Is there any way to prevent the user from instantiating them without a name?</strong> <em>("Prevent" may be too strong - "making it very difficult" is also acceptable).</em></p>
<p>I can think of two possible workarounds, but they introduce syntactical overhead in the use of the class:</p>
<ol>
<li><p>Hide the class in a <code>detail</code> namespace and provide a macro. </p>
<pre><code>namespace detail
{
class my_guard { /* ... */ };
};
#define SOME_LIB_MY_GUARD(...) \
detail::my_guard MY_GUARD_UNIQUE_NAME(__LINE__) {__VA_ARGS__}
</code></pre>
<p>This works, but is <em>hackish</em>. </p></li>
<li><p>Only allow the user to use the guard through an higher-order function.</p>
<pre><code>template <typename TArgTuple, typename TF>
decltype(auto) with_guard(TArgTuple&& guardCtorArgs, TF&& f)
{
make_from_tuple<detail::my_guard>(std::forward<TArgTuple>(guardCtorArgs));
f();
}
</code></pre>
<p>Usage:</p>
<pre><code>with_guard(std::forward_as_tuple(some_mutex), [&]
{
// ...
});
</code></pre>
<p>This workaround does not work when the initialization of the guard class has "fluent" syntax:</p>
<pre><code>{
auto _ = guard_creator()
.some_setting(1)
.some_setting(2)
.create();
}
</code></pre></li>
</ol>
<p>Is there any better alternative? I have access to C++17 features.</p>
| 0debug |
Expand a string wich have '\t' to a specific lenght : Here I have a string wich have 3 '\t's and when I use the proper methods like:
string.padright(totalWidth);
Or
string.format("{0,width}",myText);
Or even a function from skrach, I get a problem with that '\t' escape in the string wich counts one but depend on string, its beatwin 0 to 8.
At the end if I have this string "blah\tblah\tblah" and I apply those methods to have a 20 lenght string I get this "blah blah blah " which lenght is 30.
Now I want a hero who say how can I count the space that '\t' fill after the string shows. | 0debug |
ogm_dshow_header(AVFormatContext *s, int idx)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
AVStream *st = s->streams[idx];
uint8_t *p = os->buf + os->pstart;
uint32_t t;
if(!(*p & 1))
return 0;
if(*p != 1)
return 1;
t = AV_RL32(p + 96);
if(t == 0x05589f80){
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, AV_RL32(p + 68));
avpriv_set_pts_info(st, 64, AV_RL64(p + 164), 10000000);
st->codec->width = AV_RL32(p + 176);
st->codec->height = AV_RL32(p + 180);
} else if(t == 0x05589f81){
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, AV_RL16(p + 124));
st->codec->channels = AV_RL16(p + 126);
st->codec->sample_rate = AV_RL32(p + 128);
st->codec->bit_rate = AV_RL32(p + 132) * 8;
}
return 1;
} | 1threat |
Apache Airflow DAG cannot import local module : <p>I do not seem to understand how to import modules into an apache airflow DAG definition file. I would want to do this to be able to create a library which makes declaring tasks with similar settings less verbose, for instance.</p>
<p>Here is the simplest example I can think of that replicates the issue: I modified the airflow tutorial (<a href="https://airflow.apache.org/tutorial.html#recap" rel="noreferrer">https://airflow.apache.org/tutorial.html#recap</a>) to simply import a module and run a definition from that module. Like so:</p>
<p>Directory structure:</p>
<pre><code>- dags/
-- __init__.py
-- lib.py
-- tutorial.py
</code></pre>
<p>tutorial.py:</p>
<pre><code>"""
Code that goes along with the Airflow located at:
http://airflow.readthedocs.org/en/latest/tutorial.html
"""
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
# Here is my added import
from lib import print_double
# And my usage of the imported def
print_double(2)
## -- snip, because this is just the tutorial code,
## i.e., some standard DAG defintion stuff --
</code></pre>
<p><code>print_double</code> is just a simple def which multiplies whatever input you give it by 2, and prints the result, but obviously that doesn't even matter because this is an import issue.</p>
<p>I am able to run <code>airflow test tutorial print_date 2015-06-01</code> as per the tutorial docs successfully - the dag runs, and moreover the print_double succeeds. <code>4</code> is printed to the console, as expected. All appears well.</p>
<p>Then I go the web UI, and am greeted by <code>Broken DAG: [/home/airflow/airflow/dags/tutorial.py] No module named 'lib'</code>. Unpausing the dag and attempting a manual run using the UI causes a "running" status, but it never succeeds or fails. It just sits on "running" forever. I can queue up as many as I'd like, but they'll all just sit on "running" status.</p>
<p>I've checked the airflow logs, and don't see any useful debug information there.</p>
<p>So what am I missing?</p>
| 0debug |
Error - Use of undeclared type 'Error' : <p>Im getting an error saying - Use of undeclared type 'Error' i cannot move on without solving this error, I have tried looking online numerous times, but it doesnt help, I am using swift 2, and xcode 7.3</p>
| 0debug |
static void rng_egd_free_requests(RngEgd *s)
{
GSList *i;
for (i = s->parent.requests; i; i = i->next) {
rng_egd_free_request(i->data);
}
g_slist_free(s->parent.requests);
s->parent.requests = NULL;
}
| 1threat |
static void spapr_vio_quiesce_one(VIOsPAPRDevice *dev)
{
dev->flags &= ~VIO_PAPR_FLAG_DMA_BYPASS;
if (dev->rtce_table) {
size_t size = (dev->rtce_window_size >> SPAPR_VIO_TCE_PAGE_SHIFT)
* sizeof(VIOsPAPR_RTCE);
memset(dev->rtce_table, 0, size);
}
dev->crq.qladdr = 0;
dev->crq.qsize = 0;
dev->crq.qnext = 0;
}
| 1threat |
How to generate random number that must contains predefined characters? : <p>In my application i need to generate random numbers that should contain certain character like capital letter, a number and of certain length.
It will be an honor if you guys help me out.</p>
| 0debug |
How do we see full commands in the output of docker history command? : <p>How do we see full commands in the third column (CREATED BY) in the output of docker history command?</p>
<pre><code>$ docker history docker.company.net/docker-base-images/image:1.0
IMAGE CREATED CREATED BY SIZE
c0bddf343fc6 7 days ago /bin/sh -c #(nop) LABEL com.company.build.r… 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG commit 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG date 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG repo 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG org 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG version 0B
<missing> 7 days ago /bin/sh -c #(nop) USER [company] 0B
<missing> 7 days ago /bin/sh -c apk --no-cache add openjdk8-jre-b… 72.2MB
<missing> 7 days ago /bin/sh -c #(nop) USER [root] 0B
<missing> 7 days ago /bin/sh -c #(nop) USER [company:company] 0B
<missing> 7 days ago |5 commit=d64d27b07439e6cfff7422acafe440a946… 3.92MB
<missing> 7 days ago /bin/sh -c #(nop) LABEL com.company.build.r… 0B
<missing> 7 days ago |5 commit=d64d27b07439e6cfff7422acafe440a946… 4.85kB
<missing> 7 days ago /bin/sh -c #(nop) ARG commit 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG date 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG repo 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG org 0B
<missing> 7 days ago /bin/sh -c #(nop) ARG version 0B
<missing> 5 weeks ago /bin/sh -c #(nop) CMD ["/bin/sh"] 0B
<missing> 5 weeks ago /bin/sh -c #(nop) ADD file:88875982b0512a9d0… 5.53MB
</code></pre>
<p>The third column (CREATED BY) is abbreviating the commands which makes it hard to reconstruct the original Dockerfile. Is it possible to get the full commands in the third column?</p>
<p>Thanks for reading.</p>
| 0debug |
I can t get enum class opertaors to work : I get an error as "FastOut<NMAX>::Flags FastOut<NMAX>::operator&(FastOut<NMAX>::Flags, FastOut<NMAX>::Flags)' must take either zero or one argument|
"
template<int NMAX>
class FastOut{
enum class Flags;
protected:
char buffer[NMAX];
std::map<Flags,bool>FM={(UP,0),(LOW,0),(BOOL,0)};
public:
friend Flags operator&(Flags a,Flags b);
FastOut();
FastOut(const char *);
FastOut(const std::string&);
FastOut & operator << (int);
FastOut & operator << (char);
FastOut & operator << (long long);
FastOut & operator << (float);
FastOut & operator << (double);
FastOut & operator << (char *);
FastOut & operator << (const std::string &);
FastOut & operator << (const FastOut&);
void open(const char*);
void open(const std::string&);
void flush();
void clear();
~FastOut();
};
template<int NMAX>
typename FastOut<NMAX>::Flags FastOut<NMAX>::operator&(Flags a,Flags b){
}
| 0debug |
Get console user input as typed, char by char : <p>I have a console application in Elixir. I need to interpret user’s input on by keypress basis. For instance, I need to treat “q” as a command to end the session, without user to explicitly press <kbd>⏎</kbd> a.k.a. “carriage return.”</p>
<p><a href="http://elixir-lang.org/docs/stable/elixir/IO.html#getn/2"><code>IO.getn/2</code></a> surprisingly waits for the <kbd>⏎</kbd> to be pressed, buffering an input (I am nearly sure, that this buffering is done by console itself, but <code>man stty</code> does not provide any help/flag to turn buffering off.)</p>
<p><code>Mix.Utils</code> <a href="https://github.com/hexpm/hex/blob/1523f44e8966d77a2c71738629912ad59627b870/lib/mix/hex/utils.ex#L32-L58">use the infinite loop</a> to hide user input (basically sending backspace control sequence to console every 1ms,) <code>IEx</code> code wraps calls to standard erlang’s <code>io</code>, that provides the only ability to set a callback on <kbd>Tab</kbd> (for autocompletion.)</p>
<p>My guess would be I have to use <a href="http://elixir-lang.org/docs/stable/elixir/Port.html#summary"><code>Port</code></a>, attach it to <code>:stdin</code> and spawn a process to listen to the input. Unfortunately, I am stuck with trying to implement the latter, since I need to attach to the currently running console, not create a new port to some other process (as it is <a href="http://www.theerlangelist.com/article/outside_elixir">perfectly described here</a>.)</p>
<p>Am I missing something obvious on how am I to attach a <code>Port</code> to the current process’ <code>:stdin</code> (which is btw listed in <code>Port.list/0</code>,) or should I’ve built the whole 3-piped architecture to redirect what’s typed to <code>:stdin</code> and whatever my program wants to <code>puts</code> to <code>:stdout</code>?</p>
| 0debug |
document.getElementById('input').innerHTML = user_input; | 1threat |
Is re-exporting modules harmful for tree-shaking? : <p>I've come into an argument with my co-workers for which we can't seem to find an answer from any official source (MDN, webpack documentation, ...). My research <a href="https://stackoverflow.com/questions/38077164/es6-export-from-import">hasn't yielded much</a> either. There seems to be doubt <a href="https://stackoverflow.com/questions/42051588/wildcard-or-asterisk-vs-named-or-selective-import-es6-javascript">even when it comes to importing</a> as well.</p>
<p>Our setup is Webpack, Babel, and a typical React / Redux app. Take this example:</p>
<pre class="lang-js prettyprint-override"><code>export * from './actions';
export * from './selectors';
export * from './reducer';
export { default } from './reducer';
</code></pre>
<p>This allows me to separate a Redux module into logical sections, making the code easier to read and maintain.</p>
<p>However, it is believed by some of my co-workers that <code>export * from</code> may, in fact, harm <code>webpack</code>'s tree-shaking capabilities, by tricking it into believing an export is used when it is in fact just being re-exported.</p>
<p>So my question is, are there any facts proving or disproving this?</p>
| 0debug |
How to create horizontal funnel like this? : <p>I wish there was a horizontal funnel plugin available in the market. I'm not a good js developer but I'm a designer with html/css skills in hand. I have designed similar funnel like below in psd but I couldn't find any plugin to plug in into the html. The funnel links should be dynamically adjusted too. Please suggest me how to build similar kind of funnel with steps title, conversion % on the second row in the funnel columns. I've also created this in css but css doesn't work because the funnel columns should be totally dynamic.</p>
<p><a href="https://i.stack.imgur.com/Eo9Qz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eo9Qz.png" alt="Hotjar funnel image"></a></p>
| 0debug |
Node JS Express - message is not defined - error.ejs : **
http://localhost:3000/buyersearch/buyersearch -> link I'm using
1. app.js
**
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var io = require('socket.io')(); // can provide parameter - alt. use default
var mongodb = require('mongodb');
var MongoClient = mongodb.MongoClient;
var index = require('./routes/index');
var users = require('./routes/users');
var orderSearch = require('./routes/orderSearch');
var buyerSearch = require('./routes/buyerSearch');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
app.use('/users', users);
app.use('/orderSearch', orderSearch);
app.use('/buyerSearch', buyerSearch);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
module.exports = app;
2. **buyerSearch.js**
var express = require('express');
var router = express.Router();
var mongodb = require('mongodb');
var MongoClient = mongodb.MongoClient;
var url = 'mongodb://localhost:27017/WishList';
//buyerIDSearch
router.get('/buyerSearch', function (req, res) {
var id = req.query.buyerID;
if (!id || !parseInt(id)) {
res.render('error', {error: "Please enter an Buyer Identification Number"});
} else {
mongoClient.connect(url, function (err, db) {
if (err) {
res.render('error', {error: "Failed to connect"});
} else {
var WishListDB = db.collection('orders');
WishListDB.find({"_buyerID": parseInt(id)}).toArray(function (err, result) {
if (err || !result || result.length == 0) {
res.render('error', {error: "No order found with that ID number"});
} else {
res.render('order', {order: result[0]})
}
});
}
})
}
});
module.exports = router;
3.buyerSearch.ejs
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1></h1>
<p>Welcome</p>
<li><%buyerSearch.buyerID %></li>
</body>
</html>
**The error**
[enter image description here][1]
[1]: https://i.stack.imgur.com/LJRRR.png | 0debug |
How do I display a div over a div then disappear after 10 seconds? : <p>I have a SWF file that I play on my website. But before this SWF plays, I want to play another SWF file before it. It's about 10 seconds. So I have a two DIVs: one containing the SWF file that I want to play before, and the other div to contain the SWF I want to present. I believe Jquery can be used to solve my problem. Can anyone help? I tried searching the internet but found no solution. Any help would be gladly appreciated! Thanks!</p>
| 0debug |
sql - trying to select a column with datetime with a condition of date only : <p>so i have this table: <a href="http://prntscr.com/it53pm" rel="nofollow noreferrer">http://prntscr.com/it53pm</a> (in this link).</p>
<p>what im trying to do is select schedule where schedule date = current date. </p>
| 0debug |
Beginner Needing Java Programming help! I can't figure out how to go about solving this without if statement : "Given an amount of change less than one dollar, find the coins required to make up this amount. Your program should find the minimum number of coins. For example, if the change was $0.56, you would need 2 quarters, 1 nickel and 1 penny for a total of 4 coins. Hint: Use integer division and remainder."
I have to write code for this on java for a school assignment. I can't use an if statement to write a solution to this problem. Can anybody help me with this?
| 0debug |
static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight,
int *pcwidth, int *pcheight)
{
int width, cwidth, height, cheight;
cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;
cwidth = 8;
if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {
cwidth = 9;
}
if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {
cwidth = 16;
}
width = (s->cr[VGA_CRTC_H_DISP] + 1);
if (s->cr[VGA_CRTC_V_TOTAL] == 100) {
height = 100;
} else {
height = s->cr[VGA_CRTC_V_DISP_END] |
((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |
((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);
height = (height + 1) / cheight;
}
*pwidth = width;
*pheight = height;
*pcwidth = cwidth;
*pcheight = cheight;
}
| 1threat |
Python Binary tree search : <pre><code># stack_depth is initialised to 0
def find_in_tree(node, find_condition, stack_depth):
assert (stack_depth < max_stack_depth), 'Deeper than max depth'
stack_depth += 1
result = []
if find_condition(node):
result += [node]
for child_node in node.children:
result.extend(find_in_tree(child_node, find_condition, stack_depth))
return result
</code></pre>
<p>I need help understanding this piece of code. The question i want to answer is </p>
<p><strong>The Python function above searches the contents of a balanced binary tree.
If an upper limit of 1,000,000 nodes is assumed what should the max_stack_depth constant be set to?</strong></p>
<p>From what I understand, this is a trick question. If you think about it, stack_depth is incremented every time the find_in_tree() function is called in the recursion. And we are trying to find a particular node in the tree. And in our case we are accessing every single node every time even if we find the correct node. Because there is no return condition when stops the algorithm when the correct node is found. Hence, max_stack_depth should 1,000,000? </p>
<p>Can someone please try to explain me their thought process.</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.