problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to run build version using create-react-app? : <p>So, I developed a small React application using create-react-app. (I have always made applications from scratch.)</p>
<p>Then, after I was kind of happy with it, I decided to run <code>npm run build</code> to make an optimized production build. </p>
<p>Can someone please tell me how I can run the production build instead of the Dev build?</p>
| 0debug |
Clearing Tensorflow GPU memory after model execution : <p>I've trained 3 models and am now running code that loads each of the 3 checkpoints in sequence and runs predictions using them. I'm using the GPU.</p>
<p>When the first model is loaded it pre-allocates the entire GPU memory (which I want for working through the first batch of data). But it doesn't unload memory when it's finished. When the second model is loaded, using both <code>tf.reset_default_graph()</code> and <code>with tf.Graph().as_default()</code> the GPU memory still is fully consumed from the first model, and the second model is then starved of memory.</p>
<p>Is there a way to resolve this, other than using Python subprocesses or multiprocessing to work around the problem (the only solution I've found on via google searches)?</p>
| 0debug |
grep all lines after first match of particular word. Output should exclude the matching line : $cat data
123
ABC
DEF
GHI
ABC
EFG
Output should be
DEF
GHI
ABC
EFG
matching word will be "ABC". So it will detect for the first occurrence of the word "ABC" and will print from next n lines after matching line
| 0debug |
How can I convert a string so that the first character of each word is uppercase and the rest of the characters lowercase? : <p>So far I have this code that converts every character to uppercase:</p>
<pre><code> public string Header
{
get
{
var value = (string)GetValue(HeaderProperty);
return !string.IsNullOrEmpty(value) ? value.ToUpper() : value;
}
set
{
SetValue(HeaderProperty, value);
}
}
</code></pre>
<p>But I would like to just convert the first character of each word. Is there any function that would allow me to do this?</p>
| 0debug |
static QPCIDevice *get_device(void)
{
QPCIDevice *dev;
QPCIBus *pcibus;
pcibus = qpci_init_pc();
dev = NULL;
qpci_device_foreach(pcibus, 0x1af4, 0x1110, save_fn, &dev);
g_assert(dev != NULL);
return dev;
}
| 1threat |
sql matching strings with given all letters anyware : i want to match the words with given all characters and characters can be anywhere in the word but all of given characters should be include in the matching string
Ex :
1 BMW
4 LAND ROVER
6 VOLVO
9 IVECO
14 VOLKSWAGEN
20 CHEVROLET
given word is "VW" then result should be
14 VOLKSWAGEN | 0debug |
static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
int flags,
QDict *snapshot_options,
Error **errp)
{
char *tmp_filename = g_malloc0(PATH_MAX + 1);
int64_t total_size;
QemuOpts *opts = NULL;
BlockDriverState *bs_snapshot;
Error *local_err = NULL;
int ret;
total_size = bdrv_getlength(bs);
if (total_size < 0) {
error_setg_errno(errp, -total_size, "Could not get image size");
goto out;
}
ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not get temporary filename");
goto out;
}
opts = qemu_opts_create(bdrv_qcow2.create_opts, NULL, 0,
&error_abort);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_size, &error_abort);
ret = bdrv_create(&bdrv_qcow2, tmp_filename, opts, errp);
qemu_opts_del(opts);
if (ret < 0) {
error_prepend(errp, "Could not create temporary overlay '%s': ",
tmp_filename);
goto out;
}
qdict_put_str(snapshot_options, "file.driver", "file");
qdict_put_str(snapshot_options, "file.filename", tmp_filename);
qdict_put_str(snapshot_options, "driver", "qcow2");
bs_snapshot = bdrv_open(NULL, NULL, snapshot_options, flags, errp);
snapshot_options = NULL;
if (!bs_snapshot) {
ret = -EINVAL;
goto out;
}
bdrv_ref(bs_snapshot);
bdrv_append(bs_snapshot, bs, &local_err);
if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto out;
}
g_free(tmp_filename);
return bs_snapshot;
out:
QDECREF(snapshot_options);
g_free(tmp_filename);
return NULL;
}
| 1threat |
InDither deprecated in android N : <p>As the title implies the <code>inDither</code> field in <code>BitmapFactory.Options</code> is now deprecated. Android doc says "This field was deprecated in API level 24. As of N, this is ignored." Does anyone know why it has been deprecated and is there a alternative for this?</p>
| 0debug |
Who to check if From Hour and To Hour are overlapped in java : I have a requirement where i can create 3 shifts per day. The shift timings are
1) 06:00 - 14:00
2) 14:01 - 22:00
3) 22:01 - 05:59.
How can i check that shift timings are not overlapped. Your suggestions are appreciated. Please note that in the third case from hour is greater that to hour. | 0debug |
how to load image from sdcard into pager adapter? : <p>I am new to android development, i want to load image from either internal storage/pictures/forldername or sdcard/pictures/foldername with swipe feature as galley. All images should be displayed as swipes. Can I havae an example of some what.</p>
<p>Thanks in Advance</p>
| 0debug |
pls help me resize uilabel using content ,in autolayout ios i tried with cgrectmake not working : cell.msglabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 100, myLabel.frame.size.width, myLabel.frame.size.height)];
cell.msglabel.lineBreakMode = NSLineBreakByWordWrapping;
[cell.msglabel setFrame:CGRectMake(10, 10, myLabel.frame.size.width, myLabel.frame.size.height)];
cell.msglabel.text=text;
[cell.msglabel updateConstraints];
| 0debug |
ng:test no injector found for element argument to getTestability : <p>There other question on SO with same problem, but the solutions didnt worked for me.
Here my spec.js</p>
<pre><code>describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.driver.get('http://rent-front-static.s3-website-us-east-1.amazonaws.com/');
expect(browser.getTitle()).toEqual('How It Works');
});
});
</code></pre>
<p>And here my conf.js</p>
<pre><code>exports.config = {
framework: 'jasmine',
rootElement: 'body',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
</code></pre>
<p>So when i try to run my test im getting the error</p>
<pre><code> Message:
Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.0/ng/test"
Stack:
Error: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.0/ng/test"
at C:\Users\ShapeR\PycharmProjects\ratest\node_modules\jasminewd2\index.js:101:16
at Promise.invokeCallback_ (C:\Users\ShapeR\PycharmProjects\ratest\node_modules\selenium-webdriver\lib\promise.js:1329:14)
at TaskQueue.execute_ (C:\Users\ShapeR\PycharmProjects\ratest\node_modules\selenium-webdriver\lib\promise.js:2790:14)
at TaskQueue.executeNext_ (C:\Users\ShapeR\PycharmProjects\ratest\node_modules\selenium-webdriver\lib\promise.js:2773:21)
1 spec, 1 failure
</code></pre>
<p>I have a manual bootstrapping for body element and set the rootElement to body in config, but it didnt help. I even tried to remove manual boostraping and just add ng-app='rentapplicationApp' to body element, but it changes nothing, still same error.</p>
<p>So what is wrong?</p>
| 0debug |
Word transform to click in html : <p>I have a span; I want to change the word of the text in span when I click this word to English likewise translator. </p>
<p>Example:
var from = ['Hallo','Welt'];
var to = ['Hello','World];</p>
<p>This paragraph is a value of span.... Hello World</p>
| 0debug |
ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: : <p>I am developing an Universal app for Iphone and IPad using xamarin, and I am trying to deploy the app to app store using Xamarin Studio while deployment I am facing the error</p>
<blockquote>
<p>ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires
these orientations:
'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'.
Found
'UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'
in bundle "bundle_Name"</p>
</blockquote>
<p>I have spend lots of time on google but I did not get any solution for this how to resolve it using Xamarin Studio.</p>
| 0debug |
static int xbm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
AVFrame *p = data;
const uint8_t *end, *ptr = avpkt->data;
uint8_t *dst;
int ret, linesize, i, j;
end = avpkt->data + avpkt->size;
while (!avctx->width || !avctx->height) {
char name[256];
int number, len;
ptr += strcspn(ptr, "#");
if (sscanf(ptr, "#define %256s %u", name, &number) != 2) {
av_log(avctx, AV_LOG_ERROR, "Unexpected preprocessor directive\n");
return AVERROR_INVALIDDATA;
}
len = strlen(name);
if ((len > 6) && !avctx->height && !memcmp(name + len - 7, "_height", 7)) {
avctx->height = number;
} else if ((len > 5) && !avctx->width && !memcmp(name + len - 6, "_width", 6)) {
avctx->width = number;
} else {
av_log(avctx, AV_LOG_ERROR, "Unknown define '%s'\n", name);
return AVERROR_INVALIDDATA;
}
ptr += strcspn(ptr, "\n\r") + 1;
}
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
ptr += strcspn(ptr, "{") + 1;
linesize = (avctx->width + 7) / 8;
for (i = 0; i < avctx->height; i++) {
dst = p->data[0] + i * p->linesize[0];
for (j = 0; j < linesize; j++) {
uint8_t val;
ptr += strcspn(ptr, "x") + 1;
if (ptr < end && av_isxdigit(*ptr)) {
val = convert(*ptr);
ptr++;
if (av_isxdigit(*ptr))
val = (val << 4) + convert(*ptr);
*dst++ = ff_reverse[val];
} else {
av_log(avctx, AV_LOG_ERROR, "Unexpected data at '%.8s'\n", ptr);
return AVERROR_INVALIDDATA;
}
}
}
p->key_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;
return avpkt->size;
}
| 1threat |
Website Login/Logout time captured and record in excel : ***Is it possible to record time changes on website?
what i mean is, on our office, we have an intranet website that we use to login and logout. I want to record the changes on the website so that i can track the time that I'm logged in and logged out as it is the basis on how we could get paid. Once I gather the time data, i would be able to create a table that i will use to add the time that im logged in.
I appreciate your response excel masters. Thanks.strong text*** | 0debug |
How do Git LFS and git-annex differ? : <p><a href="https://git-annex.branchable.com/">git-annex</a> has been around for quite some time, but never really gained momentum.<br>
<a href="https://git-lfs.github.com/">Git LFS</a> is rather young and is already supported by GitHub, Bitbucket and GitLab.</p>
<p>Both tools handle binary files in git repositories. On the other hand, GitLab seems to have replaced <a href="https://about.gitlab.com/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/">git-annex</a> with <a href="https://about.gitlab.com/2015/11/23/announcing-git-lfs-support-in-gitlab/">Git LFS</a> within one year.</p>
<ul>
<li>What are the technical differences?</li>
<li>Do they solve the same problem?</li>
</ul>
| 0debug |
How to generate list based from inputs in Python : <p>I am looking for a solution. My requirement is to generate separate lists according to inputs in for loop.
Example: I am having a for loop range from 0 to i(i is user input). Each iteration is generating a list. I want the resulted list to be saved in separate lists. For instance the list resulted in 1st iteration should be saved in list A and list resulted in 2nd iteration should be saved in list separate list B and so on till ith iteration.</p>
| 0debug |
Read and Write file using vs code extension : <p>i am building an extension to parse json using vs code extension.
so my need is ,it should be able able to load .json file from a particular folder and iterate through content of the file.
Then it should allow user to select few keys from it make a new json file out of this and save it in any folder.</p>
<p>But i am not able to find any way to read and write files in "vs code extension".Could someone please help me.</p>
| 0debug |
Warning: preg_match(): Unknown modifier '/' in E:\xampp\htdocs\forum\hacker.php on line 76 : <p>Alright, I have now a problem on file hacker.php</p>
<p><code><?php</code></p>
<p>function post_security($copyright , $activate){</p>
<p>if($copyright == "razor_forum"){</p>
<p>if ($activate == true){</p>
<p>if ($_SERVER["REQUEST_METHOD"] == "POST"){</p>
<p>$y = explode("/",$GLOBALS["HTTP_REFERER"]);</p>
<p>$x = explode("/",$GLOBALS["HTTP_HOST"]);</p>
<p>if ($y[2] != $x[0]){</p>
<p>die("");</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>function xss_security($copyright , $activate){</p>
<p>if($copyright == "razor_forum"){</p>
<p>if ($activate == true){</p>
<p>foreach($_GET as $xss_get){</p>
<p>if ((preg_match("/<[^>]<em>script</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>object</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>iframe</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>applet</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>meta</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>style</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>form</em>\"?[^>]*>/", $xss_get)) or (preg_match("/<[^>]<em>img</em>\"?[^>]*>/", $xss_get))){</p>
<p>die("");</p>
<p>}</p>
<p>}</p>
<p>unset($xss_get);</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>function url_security($copyright , $activate){</p>
<p>if($copyright == "razor_forum"){</p>
<p>if ($activate == true){</p>
<p>foreach($_GET as $url){</p>
<p>if ((preg_match("/<[^>]<em>script</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>object</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>iframe</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>applet</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>meta</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>style</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>form</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>img</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>noscript</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>applet</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>vbscript</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>embed</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>frame</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>style</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>frameset</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>html</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>body</em>\"?[^>]<em>>/", $url)) or (preg_match("/<[^>]</em>!DOCTYPE*\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>form</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>link</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>title</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>bgsound</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>layer</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>XSS</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>background</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>mocha</em>\"?[^>]*>/", $url)) or (preg_match("/<[^>]<em>livescript</em>\"?[^>]<em>>/", $url)) or (preg_match("/([^>]</em>\"?[^)]*)/", $url)) or (preg_match("/javascript/", $url)) or (preg_match("/onmouseover/", $url)) or (preg_match("/onmouseout/", $url)) or (preg_match("/document.write/", $url)) or (preg_match("/.php/", $url)) or (preg_match("/.txt/", $url)) or (preg_match("/.cgi/", $url)) or (preg_match("/.xml/", $url)) or (preg_match("/cmd/", $url)) or (preg_match("/.js/", $url)) or (preg_match("/src=\"/", $url)) or (preg_match("/<a href="http:///" rel="nofollow noreferrer">http:///</a>", $url)) or (preg_match("/\"/", $url))){</p>
<p>exit(header("location: customavatars/.php"));</p>
<p>}</p>
<p>}</p>
<p>unset($url);</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>function sql_security($copyright , $activate){</p>
<p>if($copyright == "razor_forum"){</p>
<p>if ($activate == true){</p>
<p>foreach ($_GET as $Sql_get){</p>
<p>if ((preg_match("/select/", $Sql_get)) or (preg_match("/union/", $Sql_get)) or (preg_match("/%/", $Sql_get))){</p>
<p>die("");</p>
<p>}</p>
<p>}</p>
<p>unset($Sql_get);</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>function cracker_security($copyright , $activate){</p>
<p>if($copyright == "razor_forum"){</p>
<p>if ($activate == true){</p>
<p>$crack_Track = $_SERVER["QUERY_STRING"];</p>
<p>$ct_Rules = array('chr(', 'chr=', 'chr%20', '%20chr', 'wget%20', '%20wget', 'wget(','cmd=', '%20cmd', 'cmd%20', 'rush=', '%20rush', 'rush%20','union%20', '%20union', 'union(', 'union=', 'echr(', '%20echr', 'echr%20', 'echr=','esystem(', 'esystem%20', 'cp%20', '%20cp', 'cp(', 'mdir%20', '%20mdir', 'mdir(','mcd%20', 'mrd%20', 'rm%20', '%20mcd', '%20mrd', '%20rm','mcd(', 'mrd(', 'rm(', 'mcd=', 'mrd=', 'mv%20', 'rmdir%20', 'mv(', 'rmdir(','chmod(', 'chmod%20', '%20chmod', 'chmod(', 'chmod=', 'chown%20', 'chgrp%20', 'chown(', 'chgrp(','locate%20', 'grep%20', 'locate(', 'grep(', 'diff%20', 'kill%20', 'kill(', 'killall','passwd%20', '%20passwd', 'passwd(', 'telnet%20', 'vi(', 'vi%20','insert%20into', 'select%20', 'nigga(', '%20nigga', 'nigga%20', 'fopen', 'fwrite', '%20like', 'like%20','$_request', '$_get', '$request', '$get', '.system', 'HTTP_server1', '&aim', '%20getenv', 'getenv%20','new_password', '/etc/password','/etc/shadow', '/etc/groups', '/etc/gshadow','HTTP_USER_AGENT', 'HTTP_HOST', '/bin/ps', 'wget%20', 'uname\x20-a', '/usr/bin/id','/bin/print', '/bin/kill', '/bin/', '/chgrp', '/chown', '/usr/bin', 'g++', 'bin/python','bin/tclsh', 'bin/nasm', 'perl%20', 'traceroute%20', 'ping%20', '.pl', '/usr/X11R6/bin/xterm', 'lsof%20','/bin/mail', '.conf', 'motd%20', 'HTTP/1.', '.inc.php', 'config.php', 'cgi-', '.eml','file://', 'window.open', '', 'javascript://','img src', 'img%20src','.jsp','ftp.exe','xp_enumdsn', 'xp_availablemedia', 'xp_filelist', 'xp_cmdshell', 'nc.exe', '.htpasswd','servlet', '/etc/passwd', 'wwwacl', '~root', '~ftp', '.js', '.jsp', '.history','bash_history', '.bash_history', '~nobody', 'server-info', 'server-status', 'reboot%20', 'halt%20','powerdown%20', '/home/ftp', '/home/www', 'secure_site, ok', 'chunked', 'org.apache', '/servlet/con','', 'sql=','<em>global', 'global</em>', 'global[', '<em>server', 'server</em>', 'server[', 'phpadmin','root_path', '<em>globals', 'globals</em>', 'globals[', 'ISO-8859-1', '<a href="http://www.google.de/search" rel="nofollow noreferrer">http://www.google.de/search</a>', '?hl=','.txt', '.exe', 'union','google.de/search', 'yahoo.de', 'lycos.de', 'fireball.de', 'ISO-', 'document.cookie', 'Cscript', 'C/script' , '"' , "'");</p>
<p>$crack_Track = strtolower($crack_Track);</p>
<p>$checkworm = str_replace($ct_Rules, "*", $crack_Track);</p>
<p>if($crack_Track != $checkworm){</p>
<p>$temp = @$_SERVER["argv"];</p>
<p>$temp = @array_Pop($temp);</p>
<p>if($temp != ""){$_SERVER["PHP_SELF"] .= "?" . $temp;}</p>
<p>unset($temp); </p>
<p>unset($crack_Track , $ct_rules , $checkworm);</p>
<p>exit(header("location: error.php"));</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p><code>?></code></p>
| 0debug |
Doctrine Extensions Sortable not working correctly when changing position by more than 1 : <p>Im using Symfony 3.1 + Doctrine GEDMO extensions (via StofDoctrineExtensionsBundle). I've set my entity to have Sortable behavior:</p>
<pre><code><?php
namespace AppBundle\Entity\Manual;
use AppBundle\Entity\Identifier;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Table(name="manual_pages")
* @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
*/
class Manual
{
use Identifier;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank(message="Toto pole musí být vyplněno")
*/
private $title;
/**
* @ORM\Column(type="text")
* @Assert\NotBlank(message="Toto pole musí být vyplněno")
*/
private $content;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Manual\ManualImage", mappedBy="manual")
* @ORM\OrderBy({"position"="ASC"})
*/
private $images;
/**
* @Gedmo\SortablePosition
* @ORM\Column(type="integer", nullable=false)
*/
private $position;
/**
* @return mixed
*/
public function getPosition()
{
return $this->position;
}
/**
* @param mixed $position
*/
public function setPosition($position)
{
$this->position = $position;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param mixed $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return ManualImage[]
*/
public function getImages()
{
return $this->images;
}
/**
* @param ManualImage[] $images
*/
public function setImages($images)
{
$this->images = $images;
}
/**
* @return mixed
*/
public function getContent()
{
return $this->content;
}
/**
* @param mixed $content
*/
public function setContent($content)
{
$this->content = $content;
}
}
</code></pre>
<p>When i proceed to change position by one the sorting behavior is acting OK:</p>
<pre><code>$entity->setPosition($entity->getPosition() + 1);
// or
$entity->setPosition($entity->getPosition() - 1);
</code></pre>
<p>But when I've implemented JS drag&drop to change positions the whole thing gets weird. For example, having this table:</p>
<pre><code>id | position
1 | 0
2 | 1
3 | 2
4 | 3
5 | 4
6 | 5
</code></pre>
<p>when I do for row with id 6 this:</p>
<pre><code>$newPosition = $entity->getPosition() - 5; // = 0
$entity->setPosition($newPosition);
</code></pre>
<p>the table changes to this:</p>
<pre><code>id | position
1 | 2
2 | 3
3 | 4
4 | 5
5 | 5
6 | 0
</code></pre>
<p>There is nothing for position 1 but position 5 is occupied twice. Any ideas?</p>
| 0debug |
How to write integration tests with spring-cloud-netflix and feign : <p>I use Spring-Cloud-Netflix for communication between micro services. Let's say I have two services, Foo and Bar, and Foo consumes one of Bar's REST endpoints. I use an interface annotated with <code>@FeignClient</code>:</p>
<pre><code>@FeignClient
public interface BarClient {
@RequestMapping(value = "/some/url", method = "POST")
void bazzle(@RequestBody BazzleRequest);
}
</code></pre>
<p>Then I have a service class <code>SomeService</code> in Foo, which calls the <code>BarClient</code>.</p>
<pre><code>@Component
public class SomeService {
@Autowired
BarClient barClient;
public String doSomething() {
try {
barClient.bazzle(new BazzleRequest(...));
return "so bazzle my eyes dazzle";
} catch(FeignException e) {
return "Not bazzle today!";
}
}
}
</code></pre>
<p>Now, to make sure the communication between services works, I want to build a test that fires a real HTTP request against a fake Bar server, using something like WireMock. The test should make sure that feign correctly decodes the service response and reports it to <code>SomeService</code>.</p>
<pre><code>public class SomeServiceIntegrationTest {
@Autowired SomeService someService;
@Test
public void shouldSucceed() {
stubFor(get(urlEqualTo("/some/url"))
.willReturn(aResponse()
.withStatus(204);
String result = someService.doSomething();
assertThat(result, is("so bazzle my eyes dazzle"));
}
@Test
public void shouldFail() {
stubFor(get(urlEqualTo("/some/url"))
.willReturn(aResponse()
.withStatus(404);
String result = someService.doSomething();
assertThat(result, is("Not bazzle today!"));
}
}
</code></pre>
<p>How can I inject such a WireMock server into eureka, so that feign is able to find it and communicate with it? What kind of annotation magic do I need?</p>
| 0debug |
There's a favicon on my site and I don't know why? : So recently I bought a domain and set it up with Wordpress. I then uninstalled Wordpress because I just wanted a static landing page. However, for some reason there seems to be this favicon that I didn't add. So I delete all my files on the site and IT'S STILL THERE! I don't know what to do.[ Here is a screenshot of it.][1]
[1]: http://i.stack.imgur.com/uNN3k.jpg | 0debug |
How do I change an Iframe from a text form? : <p>I am trying to have an iframe in which you can change the url of it with a text box.</p>
<pre><code><form action="/action_page.php">
URL: <input type="text" name="firstname" value="test.com"> <input type="submit" value="Visit">
</form>
<iframe width="560" height="315" src="https://www.example.com"></iframe>
</code></pre>
<p>How would I go on doing this?</p>
| 0debug |
How to Remove Specific div using javascript : <p>can someone please tell me how to remove div element using javascript.
I'm on a Shopify theme edit.</p>
<p></p>
<p>I need to this to be or </p>
| 0debug |
static void test_nested_struct(gconstpointer opaque)
{
TestArgs *args = (TestArgs *) opaque;
const SerializeOps *ops = args->ops;
UserDefNested *udnp = nested_struct_create();
UserDefNested *udnp_copy = NULL;
Error *err = NULL;
void *serialize_data;
ops->serialize(udnp, &serialize_data, visit_nested_struct, &err);
ops->deserialize((void **)&udnp_copy, serialize_data, visit_nested_struct, &err);
g_assert(err == NULL);
nested_struct_compare(udnp, udnp_copy);
nested_struct_cleanup(udnp);
nested_struct_cleanup(udnp_copy);
ops->cleanup(serialize_data);
g_free(args);
}
| 1threat |
trying to create td with rowspan :
trying to create td with rowspan
i have to create a table with 6 columns from the second column the user has to set the rowspan
for example
column 2 row1 column3 row1
column 2 row2 column3 row1
column 2 row3 column3 row1
function addRow() {
var myName = document.getElementById("namez");
var age = document.getElementById("age");
var table = document.getElementById("myTableData");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
row.insertCell(0).innerHTML= '<input type="button" value = "Delete" onClick="Javacsript:deleteRow(this)">';
row.insertCell(1).innerHTML= '<input type="text" name="txtbox1[]" />';
row.insertCell(2).innerHTML= '<input type="text" name="txtbox2[]" />';
var td3 = row.insertCell(3).innerHTML= '<input type="text" name="txtbox3" />';
td3.setAttribute('rowSpan', '2'); | 0debug |
void ide_atapi_cmd_reply_end(IDEState *s)
{
int byte_count_limit, size, ret;
#ifdef DEBUG_IDE_ATAPI
printf("reply: tx_size=%d elem_tx_size=%d index=%d\n",
s->packet_transfer_size,
s->elementary_transfer_size,
s->io_buffer_index);
#endif
if (s->packet_transfer_size <= 0) {
ide_atapi_cmd_ok(s);
ide_set_irq(s->bus);
#ifdef DEBUG_IDE_ATAPI
printf("status=0x%x\n", s->status);
#endif
} else {
if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) {
ret = cd_read_sector(s, s->lba, s->io_buffer, s->cd_sector_size);
if (ret < 0) {
ide_atapi_io_error(s, ret);
return;
}
s->lba++;
s->io_buffer_index = 0;
}
if (s->elementary_transfer_size > 0) {
size = s->cd_sector_size - s->io_buffer_index;
if (size > s->elementary_transfer_size)
size = s->elementary_transfer_size;
s->packet_transfer_size -= size;
s->elementary_transfer_size -= size;
s->io_buffer_index += size;
ide_transfer_start(s, s->io_buffer + s->io_buffer_index - size,
size, ide_atapi_cmd_reply_end);
} else {
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;
byte_count_limit = atapi_byte_count_limit(s);
#ifdef DEBUG_IDE_ATAPI
printf("byte_count_limit=%d\n", byte_count_limit);
#endif
size = s->packet_transfer_size;
if (size > byte_count_limit) {
if (byte_count_limit & 1)
byte_count_limit--;
size = byte_count_limit;
}
s->lcyl = size;
s->hcyl = size >> 8;
s->elementary_transfer_size = size;
if (s->lba != -1) {
if (size > (s->cd_sector_size - s->io_buffer_index))
size = (s->cd_sector_size - s->io_buffer_index);
}
s->packet_transfer_size -= size;
s->elementary_transfer_size -= size;
s->io_buffer_index += size;
ide_transfer_start(s, s->io_buffer + s->io_buffer_index - size,
size, ide_atapi_cmd_reply_end);
ide_set_irq(s->bus);
#ifdef DEBUG_IDE_ATAPI
printf("status=0x%x\n", s->status);
#endif
}
}
}
| 1threat |
React Native XCode Project Product Archive Fails with duplicate symbols for architecture arm64 : <p><a href="https://i.stack.imgur.com/ceHku.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ceHku.png" alt="XCode Log"></a></p>
<p>Strangely, I can't seem to get Archive to work in XCode but the build succeeds without the errors on duplicate symbols if I do not attempt to Archive but simply build a release version. The project builds properly on devices as well.</p>
<p>I have searched up on this topic and tried disabling testability, and setting the 'No Common Blocks' in the project settings to NO as well but no luck so far.</p>
<p>The Project is a React Native 0.40 based project with CocoaPods installed as well. PodFile is this</p>
<pre><code># You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'StreetSmart' do
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
# when not using frameworks we can do this instead of including the source files in our project (1/4):
# pod 'react-native-maps', path: '../../'
# pod 'react-native-google-maps', path: '../../' # <~~ if you need GoogleMaps support on iOS
end
</code></pre>
<p>XCode Version is 8.2.1, and the project file is opened via .xcworkspace since pods are installed. </p>
<p>Would really appreciate any help or insight on this, been stuck at this for hours.</p>
| 0debug |
Running xCode 10 on device error , help meeee : So I am a Primary Teacher with no coding experience but I would like to develop a simple app to help teach phonics in my class.
However, I have been trying to get builds to run on my device (iphone 6s plus ios 12.2). The simple app I made up said build suceeded on simulator but not the device. :< I can't fix that :<
Copy Swift standard libraries into /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app
Showing All Messages
CopySwiftLibs /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app (in target: GonativeIO)
cd /Users/macbook/Desktop/ios\ 2
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
builtin-swiftStdLibTool --copy --verbose --sign 83FA19DF98CE2F83DBD4CABB58C1ADEE9F9E52CA --scan-executable /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/GonativeIO --scan-folder /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks --scan-folder /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/PlugIns --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Social.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Accounts.framework --scan-folder /Users/macbook/Desktop/ios\ 2/FBSDKShareKit.framework --scan-folder /Users/macbook/Desktop/ios\ 2/Bolts.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/SystemConfiguration.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Security.framework --scan-folder /Users/macbook/Desktop/ios\ 2/FBSDKLoginKit.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/QuartzCore.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreLocation.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CFNetwork.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AudioToolbox.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/MessageUI.framework --scan-folder /Users/macbook/Desktop/ios\ 2/FBSDKCoreKit.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreText.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/MediaAccessibility.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreGraphics.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/UIKit.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework --scan-folder /Users/macbook/Desktop/ios\ 2/OneSignal.framework --platform iphoneos --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --destination /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks --strip-bitcode --resource-destination /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app --resource-library libswiftRemoteMirror.dylib --strip-bitcode-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip --emit-dependency-info /Users/macbook/Desktop/Build/Intermediates.noindex/GoNativeIOS.build/Debug-iphoneos/GonativeIO.build/SwiftStdLibToolInputDependencies.dep
Requested Swift ABI version based on scanned binaries: unstable(7)
libswiftos.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib
libswiftDarwin.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftDarwin.dylib
libswiftCoreGraphics.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftCoreGraphics.dylib
libswiftObjectiveC.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftObjectiveC.dylib
libswiftUIKit.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftUIKit.dylib
libswiftMetal.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftMetal.dylib
libswiftSwiftOnoneSupport.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftSwiftOnoneSupport.dylib
libswiftFoundation.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftFoundation.dylib
libswiftDispatch.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftDispatch.dylib
libswiftCoreFoundation.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftCoreFoundation.dylib
libswiftCore.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftCore.dylib
libswiftCoreImage.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftCoreImage.dylib
libswiftQuartzCore.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftQuartzCore.dylib
libswiftRemoteMirror.dylib is up to date at /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/libswiftRemoteMirror.dylib
Probing signature of /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib
/usr/bin/codesign -r- --display /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib
/Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib: code object is not signed at all
Codesigning /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib
/usr/bin/codesign --force --sign 83FA19DF98CE2F83DBD4CABB58C1ADEE9F9E52CA --verbose /Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib
/Users/macbook/Desktop/Build/Products/Debug-iphoneos/GonativeIO.app/Frameworks/libswiftos.dylib: errSecInternalComponent
error: Failed with exit code 1 | 0debug |
Responsive web design in ASP.NET : I have developed my own introductory website (ASP.NET) and used Microsoft Azure for hosting.I have used only HTML and CSS as I am not good in website designing.But the website is not looking good on mobile phone browser.Can anybody suggest me how can I use/update the same code so that it looks fine in mobile phone browser also without using bootstrapping explicitly?
I have not used bootstrapping earlier!!!
[my website link][1]
[1]: http://kaushalportfolio.azurewebsites.net | 0debug |
Python - Create and name a new folder after entry widget input : I want the input, someone has put into the Entry widget (E1) of my Tkinter GUI, to be the name of the new folder, because every time someone inputs something, I need to have a new folder named after the input:
def create():
folder = E1.get()
newpath = r"C:\Users\Heinrich\Documents\Python\hope\folder"
if not os.path.exists(newpath):
os.makedirs(newpath)
This creates me a new folder, but it is named "folder" and not, how I want it, named after the numbers entred into the entry box (E1).
Making it
newpath = r"C:\Users\Heinrich\Documents\Python\hope\E1.get()"
gives me a folder called "E1.get()"
And secondly, but that hopefully comes with the answer to the first question, how do I get to see the input, without putting E1.get() into a variable?
So is there a way to see it directly and maybe use that as the name of my new folder?
Thanks for your help!
| 0debug |
flutter dart try catch, catch does not fire : <p>given the short code example below:</p>
<pre><code> ...
print("1 parsing stuff");
List<dynamic> subjectjson;
try {
subjectjson = json.decode(response.body);
} on Exception catch (_) {
print("throwing new error");
throw Exception("Error on server");
}
print("2 parsing stuff");
...
</code></pre>
<p>I would Expect the catch block to execute whenever the decoding fails. However, when a bad response returns, the terminal displays the exception and neither the catch not the continuation code fires.. </p>
<pre><code>flutter: 1 parsing stuff
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: type
'_InternalLinkedHashMap<String, dynamic>' is not a subtype of type
'List<dynamic>'
</code></pre>
<p>What am I missing here?</p>
<p>John.</p>
| 0debug |
c# implement generic method of interface : Please help me to make this code works.
Now it fails on row "x => x.Model" with "cannot convert lambda expression to intended delegate type..."
I don't have ideas.
Thank you.
interface IFetchStrategy<TEntity> where TEntity : class
{
Expression<Func<TEntity, TProperty>> Apply<TProperty>();
}
class ModelFetchStrategy : IFetchStrategy<UserCar>
{
public Expression<Func<UserCar, TProperty>> Apply<TProperty>()
{
return x => x.Model;
}
}
class Model { }
class UserCar
{
public Model Model { get; set; }
} | 0debug |
def find(n,m):
r = n%m
return (r) | 0debug |
static void put_audio_specific_config(AVCodecContext *avctx)
{
PutBitContext pb;
AACEncContext *s = avctx->priv_data;
init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
put_bits(&pb, 5, 2);
put_bits(&pb, 4, s->samplerate_index);
put_bits(&pb, 4, s->channels);
put_bits(&pb, 1, 0);
put_bits(&pb, 1, 0);
put_bits(&pb, 1, 0);
put_bits(&pb, 11, 0x2b7);
put_bits(&pb, 5, AOT_SBR);
put_bits(&pb, 1, 0);
flush_put_bits(&pb);
}
| 1threat |
Reload page after 2 seconds using JavaScript : <p>I'm reloading the page like this <code>window.location.reload();</code> is there a way to have it do the same thing but after 2 seconds?</p>
| 0debug |
document.location = 'http://evil.com?username=' + user_input; | 1threat |
How do I add a custom font from online to a TextView in an Android app, but using XML? : I want to add a custom Samsung font called SamsungOne to an Android app, I know you can link a font from online to put on a website, but how do you do this for an app, but using XML? Java is fine, but XML would be better. Can anyone help? | 0debug |
Run a fonction on every element of an array JS : I'm new to Javascript and I would like to run a function on every elements of an array.
To be more specific, in my code, i have an onclick function, and when i click on an element, I want 3 other elements to move. But, i only got 1 moving for each click.
var intersects = raycaster.intersectObjects(reel);
var intersects1 = raycaster.intersectObjects(rang1);
var intersects2 = raycaster.intersectObjects(rang2);
var intersects3 = raycaster.intersectObjects(rang3);
var intersects4 = raycaster.intersectObjects(rang4);
var inter1 = intersects1.join()
console.log(intersects2)
if (intersects.length > 0) {
//console.log(intersects1)
if (intersects[0].object.type === "Mesh") {
var objinter = intersects1[0].object;
//DEPLACEMENTS
new TWEEN.Tween(intersects1[0].object.position).to({
x: objinter.userData.x0,
y: objinter.userData.y0,
z: objinter.userData.z0
}, 1000)
.easing(TWEEN.Easing.Elastic.Out).start();
}
};
Here is my code. And i wanted to know if it is possible to call every element of my array "intersects1" at once.
Thank you. | 0debug |
How do I check if the value of an input is a number using jQuery : <p>I need to check if the value of the input consists of numbers(0-9). Thanks for helping.</p>
| 0debug |
HTML - Calling Javascript Function with variable? : <p>So I am trying to do a button and if you click on it then it calls a function called <code>order()</code>. So, If I'm trying to do something like this <code>order("+<script>blablabla</script>+")</code> then it shows me a error if I type into something between the <code>"+HERE+"</code> Why that? Is there any way around it?</p>
| 0debug |
iOS 10.3: NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString : <p>A strikethrough (single, double, ...) added as attribute to an instance of <code>NSMutableAttributedString</code> is not rendered if the apply range is not the whole string range. </p>
<p>This happens using <code>addAttribute(_ name: String, value: Any, range: NSRange)</code>, <code>insert(_ attrString: NSAttributedString, at loc: Int)</code>, <code>append(_ attrString: NSAttributedString)</code>, ...</p>
<p>Broken by Apple in early iOS 10.3 betas, and not fixed in 10.3 final.</p>
<p>Credit:
<a href="https://openradar.appspot.com/31034683" rel="noreferrer">https://openradar.appspot.com/31034683</a></p>
| 0debug |
import sys
def next_smallest_palindrome(num):
numstr = str(num)
for i in range(num+1,sys.maxsize):
if str(i) == str(i)[::-1]:
return i | 0debug |
int kvm_cpu_exec(CPUState *env)
{
struct kvm_run *run = env->kvm_run;
int ret;
dprintf("kvm_cpu_exec()\n");
do {
#ifndef CONFIG_IOTHREAD
if (env->exit_request) {
dprintf("interrupt exit requested\n");
ret = 0;
break;
}
#endif
if (env->kvm_vcpu_dirty) {
kvm_arch_put_registers(env);
env->kvm_vcpu_dirty = 0;
}
kvm_arch_pre_run(env, run);
qemu_mutex_unlock_iothread();
ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
qemu_mutex_lock_iothread();
kvm_arch_post_run(env, run);
if (ret == -EINTR || ret == -EAGAIN) {
cpu_exit(env);
dprintf("io window exit\n");
ret = 0;
break;
}
if (ret < 0) {
dprintf("kvm run failed %s\n", strerror(-ret));
abort();
}
kvm_flush_coalesced_mmio_buffer();
ret = 0;
switch (run->exit_reason) {
case KVM_EXIT_IO:
dprintf("handle_io\n");
ret = kvm_handle_io(run->io.port,
(uint8_t *)run + run->io.data_offset,
run->io.direction,
run->io.size,
run->io.count);
break;
case KVM_EXIT_MMIO:
dprintf("handle_mmio\n");
cpu_physical_memory_rw(run->mmio.phys_addr,
run->mmio.data,
run->mmio.len,
run->mmio.is_write);
ret = 1;
break;
case KVM_EXIT_IRQ_WINDOW_OPEN:
dprintf("irq_window_open\n");
break;
case KVM_EXIT_SHUTDOWN:
dprintf("shutdown\n");
qemu_system_reset_request();
ret = 1;
break;
case KVM_EXIT_UNKNOWN:
dprintf("kvm_exit_unknown\n");
break;
case KVM_EXIT_FAIL_ENTRY:
dprintf("kvm_exit_fail_entry\n");
break;
case KVM_EXIT_EXCEPTION:
dprintf("kvm_exit_exception\n");
break;
case KVM_EXIT_DEBUG:
dprintf("kvm_exit_debug\n");
#ifdef KVM_CAP_SET_GUEST_DEBUG
if (kvm_arch_debug(&run->debug.arch)) {
gdb_set_stop_cpu(env);
vm_stop(EXCP_DEBUG);
env->exception_index = EXCP_DEBUG;
return 0;
}
ret = 1;
#endif
break;
default:
dprintf("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(env, run);
break;
}
} while (ret > 0);
if (env->exit_request) {
env->exit_request = 0;
env->exception_index = EXCP_INTERRUPT;
}
return ret;
}
| 1threat |
static int dxva2_h264_decode_slice(AVCodecContext *avctx,
const uint8_t *buffer,
uint32_t size)
{
const H264Context *h = avctx->priv_data;
struct dxva_context *ctx = avctx->hwaccel_context;
const Picture *current_picture = h->cur_pic_ptr;
struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
unsigned position;
if (ctx_pic->slice_count >= MAX_SLICES)
return -1;
if (!ctx_pic->bitstream)
ctx_pic->bitstream = buffer;
ctx_pic->bitstream_size += size;
position = buffer - ctx_pic->bitstream;
if (is_slice_short(ctx))
fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count],
position, size);
else
fill_slice_long(avctx, &ctx_pic->slice_long[ctx_pic->slice_count],
position, size);
ctx_pic->slice_count++;
if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)
ctx_pic->pp.wBitFields &= ~(1 << 15);
return 0;
}
| 1threat |
Remove spaces between paragraphs with regex : <pre><code>some code here
some code here
</code></pre>
<p>to</p>
<pre><code>some code here
some code here
</code></pre>
<p>What is the regex to remove the spaces between each paragraph? I've been searching for a while but I couldn't find one. Some of the results would be:</p>
<pre><code>some code heresome code here
</code></pre>
<p>but it isn't the one i'm trying to find</p>
| 0debug |
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
{
struct kvm_create_spapr_tce args = {
.liobn = liobn,
.window_size = window_size,
};
long len;
int fd;
void *table;
*pfd = -1;
if (!cap_spapr_tce) {
return NULL;
}
fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);
if (fd < 0) {
fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",
liobn);
return NULL;
}
len = (window_size / SPAPR_VIO_TCE_PAGE_SIZE) * sizeof(VIOsPAPR_RTCE);
table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (table == MAP_FAILED) {
fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",
liobn);
close(fd);
return NULL;
}
*pfd = fd;
return table;
}
| 1threat |
target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
{
target_ulong arg1;
switch (reg) {
case 0:
arg1 = (int32_t)env->active_fpu.fcr0;
break;
case 25:
arg1 = ((env->active_fpu.fcr31 >> 24) & 0xfe) | ((env->active_fpu.fcr31 >> 23) & 0x1);
break;
case 26:
arg1 = env->active_fpu.fcr31 & 0x0003f07c;
break;
case 28:
arg1 = (env->active_fpu.fcr31 & 0x00000f83) | ((env->active_fpu.fcr31 >> 22) & 0x4);
break;
default:
arg1 = (int32_t)env->active_fpu.fcr31;
break;
}
return arg1;
}
| 1threat |
Cannot write in the Node.js command prompt using AngularJs after using ng serve --open --port 4300 : I'm just trying out Angular for the very first time and I'am stuck.
I couldn't use the port 4200 anymore, so did the following:
np serve --open --port 4200
It does its job but I can't type anything else into the console...
Idk whether its helpfull or not but here are the last few lines
Date: 2018-06-12T17:39:50.544Z - Hash: 63d507da2f6ad4d29150 - Time: 207ms
4 unchanged chunks
chunk {main} main.js, main.js.map (main) 10.8 kB [initial] [rendered]
i 「wdm」: Compiled successfully.
I guess its not.
The cursor is still blinking but nothing I tried did help...
| 0debug |
static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpace *as)
{
FlatView *view;
FlatRange *fr;
CoalescedMemoryRange *cmr;
AddrRange tmp;
MemoryRegionSection section;
view = as->current_map;
FOR_EACH_FLAT_RANGE(fr, view) {
if (fr->mr == mr) {
section = (MemoryRegionSection) {
.address_space = as,
.offset_within_address_space = int128_get64(fr->addr.start),
.size = fr->addr.size,
};
MEMORY_LISTENER_CALL(coalesced_mmio_del, Reverse, §ion,
int128_get64(fr->addr.start),
int128_get64(fr->addr.size));
QTAILQ_FOREACH(cmr, &mr->coalesced, link) {
tmp = addrrange_shift(cmr->addr,
int128_sub(fr->addr.start,
int128_make64(fr->offset_in_region)));
if (!addrrange_intersects(tmp, fr->addr)) {
continue;
}
tmp = addrrange_intersection(tmp, fr->addr);
MEMORY_LISTENER_CALL(coalesced_mmio_add, Forward, §ion,
int128_get64(tmp.start),
int128_get64(tmp.size));
}
}
}
}
| 1threat |
Check for multiple numbers in an array : <p>I need to create a function that checks all numbers in an array and print them out.
My idea was something similar to this:</p>
<pre><code> var array = [15,22,88,65,79,19,93,15,90,38,77,10,22,90,99];
var string = "";
var len = array.length;
</code></pre>
<p>After declaring the variables, i start to loop them:</p>
<pre><code> for (var i = 0; i < len; i ++) {
for (var j = 0; j < len; j ++) {
//console.log(array[i], array[j]);
}
}
</code></pre>
<p>Console prints me value in this order:</p>
<pre><code>3 3
3 6
3 67
. .
6 3
6 6
6 67
. .
</code></pre>
<p>I thought to create a if statement checking if array[i] is equal to array[j] then pushing the content in a new string.</p>
| 0debug |
static void set_dirty_bitmap(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int dirty)
{
int64_t start, end;
start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;
end = (sector_num + nb_sectors) / BDRV_SECTORS_PER_DIRTY_CHUNK;
for (; start <= end; start++) {
bs->dirty_bitmap[start] = dirty;
}
}
| 1threat |
Java - Passing a Symbolic Class Object to a Method : <p>I am writing a generic method that will set a specific object of a class. Say I have this:</p>
<pre><code>public class MyRecord {
public String name;
public String comment;
}
</code></pre>
<p>In my method I will pass an instance of MyRecord to the constructor and keep it:</p>
<pre><code>public class Processor {
private MyRecord rec;
public Processor(MyRecord rec_) {
rec=rec_;
}
.
.
.
public void doIt(Object object_) {
rec.object_=<Something>;
}
}
</code></pre>
<p>When I call doIt, I want to pass which object of MyRecord to set in the method. I know I can do a different method for each element but that is not my question. Is this or something similar possible and if so how? Maybe what I am looking for is a way to emulate pass by reference. TIA.</p>
| 0debug |
How to count emails according to said criterion from all folders and subfolders in outlook using VBA excel : How to count mails in outlook according to certain criterion based on subject, date, sender etc from all folders and subfolders using excel vba
| 0debug |
Order of execution in jQuery : <p>I have the following code in a website:</p>
<pre><code> alert('step 1');
// save token if app user:
if (tokenViaApp !== '' ) {
alert('step 2')
$.ajax({
type: "GET",
url: "/includes/notifications/",
data: {
t: tokenViaApp
},
success: function(msg) {
localStorage.token_origin = 'app';
alert('step 3')
}
});
}
alert('step 4')
</code></pre>
<p>If the <code>if()</code> passes, then i would think the alert should be in this order:</p>
<pre><code>step 1
step 2
step 3
step 4
</code></pre>
<p>but instead I get:</p>
<pre><code>step 1
step 2
step 4
step 3
</code></pre>
<p>Why is this the case? and how can this be changed to process correctly? </p>
| 0debug |
cannot install visual studio 2010 64 bit prerequites : <p>cannot able to install the visual studio 2010. Please refer the attached image.
<a href="https://i.stack.imgur.com/JbGfs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JbGfs.png" alt="enter image description here"></a></p>
| 0debug |
PathLib recursively remove directory? : <p>Is there any way to remove a directory and it’s contents in the PathLib module? With <code>path.unlink()</code> it only removes a file, with <code>path.rmdir()</code> the directory has to be empty. Is there no way to do it in one function call? </p>
| 0debug |
Run flow check continuously (flowtype) : <p>I was wondering if someone knew of a good way to continuously run the "flow check" command inside a given repo such that it will re-run anytime a file is updated?</p>
<p>Thanks!
Thomas</p>
| 0debug |
What is going on in this code (Python 2.7)? : <pre><code>import math
def is_prime(n):
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))
</code></pre>
<p>I received an assignment where I had to find the sum of all prime numbers up to 2 million and the code I wrote originally took way too long to run so the teacher gave me this algorithm to check if the number is prime. However, I don't quite seem to get what's going on in the return all statement and what it has to do with prime numbers</p>
| 0debug |
npm WARN: npm does not support Node.js v12.4.0 : <p>I've been getting the following warnings lately whenever I run any npm script:</p>
<pre><code>npm WARN npm npm does not support Node.js v12.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
</code></pre>
<p>It says that I should upgrade to a newer version, but v12.4 <em>is</em> the newest version. Even though the scripts run fine, I think there's no guarantee and something might break at any moment.</p>
<p>I've also tried updating <code>npm</code> in case there's a newer version using <code>npm install npm -g</code> but got the error:</p>
<pre><code>npm ERR! path /usr/local/Cellar/node/12.4.0/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'] {
npm ERR! stack: 'Error: EACCES: permission denied, access ' +
npm ERR! "'/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
</code></pre>
<p>Then I've seen that Homebrew version of <code>npm</code> can't be updated using npm itself, so I tried updating through <code>Homebrew</code> using <code>brew upgrade npm</code> but got this error:</p>
<p><code>Error: npm 12.4.0 already installed</code></p>
<p>For some reason Brew mixes up <code>node</code>s and <code>npm</code>s versions.</p>
<p>What am I doing wrong and how can I get rid of this warning?</p>
| 0debug |
static int dot_product(const int16_t *a, const int16_t *b, int length)
{
int i, sum = 0;
for (i = 0; i < length; i++) {
int64_t prod = av_clipl_int32(MUL64(a[i], b[i]) << 1);
sum = av_clipl_int32(sum + prod);
}
return sum;
}
| 1threat |
how to get data from state reactjs : <p>I have data and when I show with sintax <code>console.log(this.state.product)</code> the data show correctly, here the output in console:
<a href="https://i.stack.imgur.com/sO1Qy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sO1Qy.png" alt="enter image description here"></a></p>
<p>now I want to get harga produk from the output, I use this sintax <code>console.log(this.state.product.harga.produk)</code> but I get the error, how to do that? I want to get data that marked red line
<a href="https://i.stack.imgur.com/Izix0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Izix0.png" alt="enter image description here"></a></p>
| 0debug |
Not able to pip install pickle in python 3.6 : <p>I am trying to run the below code:-</p>
<pre><code>import bs4 as bs
import pickle
import requests
import lxml
def save_sp500_tickers():
resp = requests.get("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies")
soup = bs.BeautifulSoup(resp.text, "html5lib")
table = soup.find("table", { "class" : "wikitable sortable"})
# print(soup)
# print(soup.table)
tickers = []
for row in table.findAll("tr")[1:]:
ticker = row.findAll("td")[0].text
tickers.append(ticker)
with open("sp500tickers.pickle","wb") as f:
pickle.dump(tickers, f)
print(tickers)
# return tickers
# save_sp500_tickers()
</code></pre>
<p>it does not throws any error but i realized pickle module is not installed.
I went to install it via pip and getting below error:-</p>
<pre><code>D:\py_fin>pip install pickle
Collecting pickle
Could not find a version that satisfies the requirement pickle (from versions:
)
No matching distribution found for pickle
</code></pre>
<p>I tried google'd about it but did not get a solution. Please help.
How do we install pickle in python 3.6(32-bit)</p>
| 0debug |
Error: invalid use of 'void' (using vectors) : <p>I am trying to create a code using vectors and other c++11 utilities. The above mentioned(on the title) error occurs in my code and despite I looked for a solution to this error on the internet I did not find something that works into my code. I tried to make some type castings but did not work. I present you the contentious part of code below:</p>
<pre><code>#include <iostream>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <algorithm>
#include <list>
//#include <Winbase.h>
using namespace std;
// A struct describing a product.
typedef struct Products
{
string category;
string name;
float price;
} Product;
inline void scenario1(int num_cashiers)
{
vector<Product> products; // It is a vector(a pseudo-second dimension) of products which will be used for each customer
vector<vector<Product>> customers; // A vector containing all customers
vector<vector<vector<Product>>> cashiers(num_cashiers); // A vector describing the supermarket cashiers declaring a queue of customers for each cashier
double start = GetTickCount(); // It will be used for counting 10 secs until next update
vector<int> total_products(num_cashiers); // A vector keeping the total number of products of each queue
list<string> categories; // A list containing all the categories of the products
list<float> categories_prices(categories.unique().size()); // A list containing all category prices
//THE ABOVE LINE - THE LAST ONE IN THIS PART OF CODE - IS THE LINE I GET THE ERROR!!!
....
}
</code></pre>
<p>What is wrong with the code?</p>
<p>Thank you everyone in advance!</p>
| 0debug |
void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
{
int64_t value;
if (!error_is_set(errp)) {
if (v->type_int8) {
v->type_int8(v, obj, name, errp);
} else {
value = *obj;
v->type_int(v, &value, name, errp);
if (value < INT8_MIN || value > INT8_MAX) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
"int8_t");
return;
}
*obj = value;
}
}
}
| 1threat |
PHP start with <? - 500 Server error - T_OPEN_TAG : <p>I migrated a php website to a new server. </p>
<pre><code> Old PHP Version -> 5.2
New PHP Version -> 5.5
</code></pre>
<p>When a script contains the T_OPEN_TAG</p>
<pre><code><?
</code></pre>
<p>instead of</p>
<pre><code><?php
</code></pre>
<p>the server is sending a 500 Server error. How is it possible to allow that php could start with</p>
<pre><code><?
</code></pre>
<p>thank you</p>
| 0debug |
int ff_intel_h263_decode_picture_header(MpegEncContext *s)
{
int format;
if (get_bits_long(&s->gb, 22) != 0x20) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
s->picture_number = get_bits(&s->gb, 8);
if (get_bits1(&s->gb) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
return -1;
}
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
return -1;
}
skip_bits1(&s->gb);
skip_bits1(&s->gb);
skip_bits1(&s->gb);
format = get_bits(&s->gb, 3);
if (format == 0 || format == 6) {
av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
return -1;
}
s->h263_plus = 0;
s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
s->unrestricted_mv = get_bits1(&s->gb);
s->h263_long_vectors = s->unrestricted_mv;
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
return -1;
}
s->obmc= get_bits1(&s->gb);
s->pb_frame = get_bits1(&s->gb);
if (format < 6) {
s->width = ff_h263_format[format][0];
s->height = ff_h263_format[format][1];
s->avctx->sample_aspect_ratio.num = 12;
s->avctx->sample_aspect_ratio.den = 11;
} else {
format = get_bits(&s->gb, 3);
if(format == 0 || format == 7){
av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
return -1;
}
if(get_bits(&s->gb, 2))
av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
s->loop_filter = get_bits1(&s->gb);
if(get_bits1(&s->gb))
av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
if(get_bits1(&s->gb))
s->pb_frame = 2;
if(get_bits(&s->gb, 5))
av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
if(get_bits(&s->gb, 5) != 1)
av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n");
}
if(format == 6){
int ar = get_bits(&s->gb, 4);
skip_bits(&s->gb, 9);
skip_bits1(&s->gb);
skip_bits(&s->gb, 9);
if(ar == 15){
s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 8);
s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 8);
} else {
s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[ar];
}
if (s->avctx->sample_aspect_ratio.num == 0)
av_log(s->avctx, AV_LOG_ERROR, "Invalid aspect ratio.\n");
}
s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
skip_bits1(&s->gb);
if(s->pb_frame){
skip_bits(&s->gb, 3);
skip_bits(&s->gb, 2);
}
while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
s->f_code = 1;
s->y_dc_scale_table=
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
ff_h263_show_pict_info(s);
return 0;
}
| 1threat |
Why the go GC doesn't recycle the memory : I write a code like
package main
import (
"log"
)
func main() {
var c []int64
for i := 0; i < 100; i++ {
c = make([]int64, 10000000000)
log.Println(len(c))
}
}
In every iteration, "c" will be assigned to a new slice. So the before slice has no variable assigned. Why the GC doesn't collect the memory? | 0debug |
How do I resolve these tensorflow warnings? : <p>I just installed Tensorflow 1.0.0 using pip. When running, I get warnings like the one shown below.</p>
<p><code>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.</code></p>
<p>I get 5 more similar warning for SSE4.1, SSE4.2, AVX, AVX2, FMA.</p>
<p>Despite these warnings the program seems to run fine.</p>
| 0debug |
static int64_t ffm_read_write_index(int fd)
{
uint8_t buf[8];
lseek(fd, 8, SEEK_SET);
if (read(fd, buf, 8) != 8)
return AVERROR(EIO);
return AV_RB64(buf);
}
| 1threat |
Form submission weird behaviour : <pre><code><?php
require_once("./include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("index.php");
exit;
}
include 'header.php';
include './include/sql/connect.php';
if(isset($_POST['submit']))
{
$insert = "INSERT INTO `customers`(`bb_id`, `name`, `email`, `phone`, `circle`, `ssa`, `sdca`) VALUES (?,?,?,?,?,?,?)";
$stmt = mysqli_prepare($connect, $insert);
$stmt->bind_param('sssisss', $_POST['bb_id'],$_POST['name'],$_POST['email'],$_POST['phone'],$_POST['circle'],$_POST['ssa'],$_POST['sdca']);
$stmt->execute();
if (!$stmt)
{
printf("Error: %s\n", mysqli_error($connect));
exit();
}
}
$cust = "SELECT * FROM `customers`";
$qry = mysqli_query($connect,$cust);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customers</title>
<!--link rel="stylesheet" type="text/css" href="style/fg_membersite.css"-->
<link rel="stylesheet" type="text/css" href="style/tableview.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<br>
<div id='tableview'>
<div class='ext-box'>
<form action="" method="post">
<input type="text" name="bb_id" placeholder="Broadband ID">&nbsp;
<input type="text" name="name" placeholder="Name">&nbsp;
<input type="text" name="email" placeholder="Email">&nbsp;
<input type="text" name="phone" placeholder="Phone">&nbsp;
<input type="text" name="circle" placeholder="Circle">&nbsp;
<input type="text" name="ssa" placeholder="SSA">&nbsp;
<input type="text" name="sdca" placeholder="SDCA"><br><br>
<input type="submit" name="searchsubmit" value="Search Records">
<input type="submit" name="submit" value="Update Records">
</form>
</div>
<br><br><br>
</div>
<table class="blueTable">
<thead>
<tr>
<th>Broadband ID</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Circle</th>
<th>SSA</th>
<th>SDCA</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="7">
<div class="links"><a href="#">&laquo;</a> <a class="active" href="#">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a> <a href="#">&raquo;</a></div>
</td>
</tr>
</tfoot>
<tbody>
<?php while($row = mysqli_fetch_array($qry)):?>
<tr>
<td><?php echo $row['bb_id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['phone'];?></td>
<td><?php echo $row['circle'];?></td>
<td><?php echo $row['ssa'];?></td>
<td><?php echo $row['sdca'];?></td>
</tr>
<?php endwhile;?>
</tbody>
</table>
</body>
</html>
</code></pre>
<p>The above code is supposed to insert data filled in the form to a DB. And it does that, but what is weird is only sometimes.</p>
<p>Like I am trying to insert data since 2 hours using chrome but it would not do so. Suddenly I did the same thing with IE and it took the insert. I thought maybe browser compatibility, but when I tried again with IE it stopped inserting after doing it once.</p>
| 0debug |
Where are the VSCode error logs for extensions? : <p>When I get an extension error I have no way of knowing why the error happens.</p>
| 0debug |
Is there a way to expose folder outside Spring to be accessed over the Internet? : <p>I am building Spring application that has to expose images over the web.
I tried to store them at Maven's structure's resource directory in static folder,however,whenever an image is uploaded, in order for me to access it over the web I had to restart spring server. I assume this is because spring server is packed as one jar file. My question is, is it possible for me to expose such a folder outside spring so that whenever I upload an image, it would be visible without need to restart spring server?</p>
| 0debug |
static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
{
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
ssize_t ret;
ret = qemu_chr_write(vcon->chr, buf, len);
trace_virtio_console_flush_buf(port->id, len, ret);
return ret;
}
| 1threat |
static void disas_simd_mod_imm(DisasContext *s, uint32_t insn)
{
int rd = extract32(insn, 0, 5);
int cmode = extract32(insn, 12, 4);
int cmode_3_1 = extract32(cmode, 1, 3);
int cmode_0 = extract32(cmode, 0, 1);
int o2 = extract32(insn, 11, 1);
uint64_t abcdefgh = extract32(insn, 5, 5) | (extract32(insn, 16, 3) << 5);
bool is_neg = extract32(insn, 29, 1);
bool is_q = extract32(insn, 30, 1);
uint64_t imm = 0;
TCGv_i64 tcg_rd, tcg_imm;
int i;
if (o2 != 0 || ((cmode == 0xf) && is_neg && !is_q)) {
unallocated_encoding(s);
return;
}
if (!fp_access_check(s)) {
return;
}
switch (cmode_3_1) {
case 0:
case 1:
case 2:
case 3:
{
int shift = cmode_3_1 * 8;
imm = bitfield_replicate(abcdefgh << shift, 32);
break;
}
case 4:
case 5:
{
int shift = (cmode_3_1 & 0x1) * 8;
imm = bitfield_replicate(abcdefgh << shift, 16);
break;
}
case 6:
if (cmode_0) {
imm = (abcdefgh << 16) | 0xffff;
} else {
imm = (abcdefgh << 8) | 0xff;
}
imm = bitfield_replicate(imm, 32);
break;
case 7:
if (!cmode_0 && !is_neg) {
imm = bitfield_replicate(abcdefgh, 8);
} else if (!cmode_0 && is_neg) {
int i;
imm = 0;
for (i = 0; i < 8; i++) {
if ((abcdefgh) & (1 << i)) {
imm |= 0xffULL << (i * 8);
}
}
} else if (cmode_0) {
if (is_neg) {
imm = (abcdefgh & 0x3f) << 48;
if (abcdefgh & 0x80) {
imm |= 0x8000000000000000ULL;
}
if (abcdefgh & 0x40) {
imm |= 0x3fc0000000000000ULL;
} else {
imm |= 0x4000000000000000ULL;
}
} else {
imm = (abcdefgh & 0x3f) << 19;
if (abcdefgh & 0x80) {
imm |= 0x80000000;
}
if (abcdefgh & 0x40) {
imm |= 0x3e000000;
} else {
imm |= 0x40000000;
}
imm |= (imm << 32);
}
}
break;
}
if (cmode_3_1 != 7 && is_neg) {
imm = ~imm;
}
tcg_imm = tcg_const_i64(imm);
tcg_rd = new_tmp_a64(s);
for (i = 0; i < 2; i++) {
int foffs = i ? fp_reg_hi_offset(rd) : fp_reg_offset(rd, MO_64);
if (i == 1 && !is_q) {
tcg_gen_movi_i64(tcg_rd, 0);
} else if ((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9) {
tcg_gen_ld_i64(tcg_rd, cpu_env, foffs);
if (is_neg) {
tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm);
} else {
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm);
}
} else {
tcg_gen_mov_i64(tcg_rd, tcg_imm);
}
tcg_gen_st_i64(tcg_rd, cpu_env, foffs);
}
tcg_temp_free_i64(tcg_imm);
}
| 1threat |
I need assistance in python with small code in python for school. I havent coded in 2 months : i need help in python about making a code that will first ask a number for a starting number and then ask a number in which it will count spaces with that number until 0. for example: input -10 and then imput 2 and it will count from -10 to 0(0 not included) with 2 spaces: -10 -8 -6 -4 -2 | 0debug |
static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSCSI *s = (VirtIOSCSI *)vdev;
VirtIOSCSIReq *req, *next;
QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
if (s->ctx && !s->dataplane_started) {
virtio_scsi_dataplane_start(s);
return;
}
while ((req = virtio_scsi_pop_req(s, vq))) {
if (virtio_scsi_handle_cmd_req_prepare(s, req)) {
QTAILQ_INSERT_TAIL(&reqs, req, next);
}
}
QTAILQ_FOREACH_SAFE(req, &reqs, next, next) {
virtio_scsi_handle_cmd_req_submit(s, req);
}
}
| 1threat |
static void compare_pri_rs_finalize(SocketReadState *pri_rs)
{
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
if (packet_enqueue(s, PRIMARY_IN)) {
trace_colo_compare_main("primary: unsupported packet in");
compare_chr_send(s,
pri_rs->buf,
pri_rs->packet_len,
pri_rs->vnet_hdr_len);
} else {
g_queue_foreach(&s->conn_list, colo_compare_connection, s);
}
}
| 1threat |
char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
{
char *buf;
InetSocketAddress *inet;
char host_port[INET6_ADDRSTRLEN + 5 + 4];
switch (addr->type) {
case SOCKET_ADDRESS_KIND_INET:
inet = addr->u.inet.data;
if (strchr(inet->host, ':') == NULL) {
snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,
inet->port);
buf = g_strdup(host_port);
} else {
snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,
inet->port);
buf = g_strdup(host_port);
}
break;
case SOCKET_ADDRESS_KIND_UNIX:
buf = g_strdup(addr->u.q_unix.data->path);
break;
case SOCKET_ADDRESS_KIND_FD:
buf = g_strdup(addr->u.fd.data->str);
break;
case SOCKET_ADDRESS_KIND_VSOCK:
buf = g_strdup_printf("%s:%s",
addr->u.vsock.data->cid,
addr->u.vsock.data->port);
break;
default:
error_setg(errp, "socket family %d unsupported",
addr->type);
return NULL;
}
return buf;
}
| 1threat |
How to press windows key using pywinauto python : <p>Hello I want to write a program to automate windows 10 but to do so I need to open startmenu by pressing windows key using pywinauto plz help</p>
| 0debug |
CS1525 C# Invalid expression term 'string' : <p>I have this error and I have no ideo about what should I do</p>
<p>The aim is when I click to button, it should read the word in textbox and save it into the string variable by its new factor.I have the error oin the topic</p>
<pre><code> private void panel_button_kelimeekle_kaydet_Click(object sender, EventArgs e)
{
if(panel_checkbox_ing.Checked)
{
string (panel_textbox_kelimeekle_yab.Text) = Ingkelimeler[(Ingkelimeler.Length+1)];
}
}
</code></pre>
| 0debug |
Python, mock: raise exception : <p>I'm having issues raising an exception from a function in my test:</p>
<pre><code>### Implemetation
def MethodToTest():
myVar = StdObject()
try:
myVar.raiseError() # <--- here
return True
except Exception as e:
# ... code to test
return False
### Test file
@patch('stdLib.StdObject', autospec=True)
def test_MethodeToTest(self, mockedObjectConstructor):
mockedObj = mockedObjectConstructor.return_value
mockedObj.raiseError.side_effect = Exception('Test') # <--- do not work
ret = MethodToTest()
assert ret is False
</code></pre>
<p>I would like to <code>raiseError()</code> function to raise an error.</p>
<p>I found several examples on SO, but none that matched my need.</p>
| 0debug |
static int av_thread_message_queue_recv_locked(AVThreadMessageQueue *mq,
void *msg,
unsigned flags)
{
while (!mq->err_recv && av_fifo_size(mq->fifo) < mq->elsize) {
if ((flags & AV_THREAD_MESSAGE_NONBLOCK))
return AVERROR(EAGAIN);
pthread_cond_wait(&mq->cond, &mq->lock);
}
if (av_fifo_size(mq->fifo) < mq->elsize)
return mq->err_recv;
av_fifo_generic_read(mq->fifo, msg, mq->elsize, NULL);
pthread_cond_signal(&mq->cond);
return 0;
}
| 1threat |
My C# program is detected as a virus? : <p>I have created a C# program and I recently noticed that when I merge my referenced .dlls into one executable .exe file using IL Merge, my Anti Virus (Avast) immediately deletes it and says that it's a virus. I always make lots of back ups so I tested the same thing with a back up from 2 days ago and I didn't experience this problem.</p>
<p>So I deleted my recent code line by line and noticed what is triggering the program to be detected as a virus. I have a void where I check if a list of files exist in a specified path (in my apps folder located in %appdata%). The void has around 8 <code>File.Exists(path)</code> commands and removing these 8 lines my program is no longer detected as a virus.</p>
<p>So my question is , is there any solution to this problem ? Why is my program detected as a virus just because i'm using <code>File.Exists</code> ?</p>
| 0debug |
I want to convert this Cos to Tcl : can anyone tell me how can I convert this cos up -1 to TCL, due to in TCL
just work with normal cos, not like this cos up -1 as explain in the figure
[equation][1]
| 0debug |
BlockAIOCB *laio_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockCompletionFunc *cb, void *opaque, int type)
{
struct qemu_laiocb *laiocb;
struct iocb *iocbs;
off_t offset = sector_num * 512;
laiocb = qemu_aio_get(&laio_aiocb_info, bs, cb, opaque);
laiocb->nbytes = nb_sectors * 512;
laiocb->ctx = s;
laiocb->ret = -EINPROGRESS;
laiocb->is_read = (type == QEMU_AIO_READ);
laiocb->qiov = qiov;
iocbs = &laiocb->iocb;
switch (type) {
case QEMU_AIO_WRITE:
io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset);
break;
case QEMU_AIO_READ:
io_prep_preadv(iocbs, fd, qiov->iov, qiov->niov, offset);
break;
default:
fprintf(stderr, "%s: invalid AIO request type 0x%x.\n",
__func__, type);
goto out_free_aiocb;
}
io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e));
QSIMPLEQ_INSERT_TAIL(&s->io_q.pending, laiocb, next);
s->io_q.n++;
if (!s->io_q.blocked &&
(!s->io_q.plugged || s->io_q.n >= MAX_QUEUED_IO)) {
ioq_submit(s);
}
return &laiocb->common;
out_free_aiocb:
qemu_aio_unref(laiocb);
return NULL;
}
| 1threat |
please help me convert this query to laravel : <p>SELECT SUM( <code>srvce_volume</code> )
FROM work_order
WHERE DATE( <code>updated_at</code> ) >= '2018-01-18'
AND DATE( <code>updated_at</code> ) <= '2018-01-18'</p>
| 0debug |
How to input a list in list in Python? : <p>I want to create a list in Python. That list contains N lists. Here, N == int(input()). </p>
<p>Say, I want to create a list which again contains N list. N is the number of people and that sub_list will contain the people's name and age.</p>
<p>I want to keep the data in this format: Sub_list = [name, age]. I want this sub list to be a part of the main list. So, basically it should look like this: main_list = [[name, age], [name, age], [name, age]...N]. But, I want to input() the name and age and also keep the [name, age] as a sub-list being a part of main list. How do I do that?</p>
<p>I'm really sorry for asking such a silly question. I'm new to Python and programming as a whole. I tried to solve this problem on my own for while. But couldn't. So, I've decided to share this silly problem in StackOverflow. Sorry for inconvenience :'( </p>
| 0debug |
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
{
PerThreadContext *p;
atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;
if (!progress ||
atomic_load_explicit(&progress[field], memory_order_relaxed) >= n)
return;
p = f->owner[field]->internal->thread_ctx;
if (f->owner[field]->debug&FF_DEBUG_THREADS)
av_log(f->owner[field], AV_LOG_DEBUG,
"%p finished %d field %d\n", progress, n, field);
pthread_mutex_lock(&p->progress_mutex);
atomic_store_explicit(&progress[field], n, memory_order_release);
pthread_cond_broadcast(&p->progress_cond);
pthread_mutex_unlock(&p->progress_mutex);
}
| 1threat |
DynamoDB alternatives in terms of pricing? (Only pay per requests and storage) : I've been learning and modeling DynamoDB for the last couple of weeks, it's been an hell and each day I run into a new wall, doesn't support batch updates/deletes, doesn't give you any tools to help manage replicated data.
What are other cloud-based, serverless, managed databases that have a pricing system similar to DynamoDB? | 0debug |
Enable cURL on PHP7 windows10 64 bit Apache 2.4 : <p>I am using
Windows10 64 bit
Apache 2.4.25 (Win64)
PHP 7.1.0-Win32-VC14-x64</p>
<p>when i try calling curl_init() function, i get an error saying "Call to undefined function curl_init()"
tried following</p>
<ul>
<li>copying ssleay32.dll & libeay32.dll & php7ts.dll to apache/bin folder</li>
<li>setting path properly to include above files "C:/PHP;"</li>
</ul>
<p>Any help much appreciated. </p>
| 0debug |
Forcing R output to be scientific notation with at most two decimals : <p>I would like to have consistent output for a particular R script. In this case, I would like all numeric output to be in scientific notation with exactly two decimal places.</p>
<p>Examples:</p>
<pre><code>0.05 --> 5.00e-02
0.05671 --> 5.67e-02
0.000000027 --> 2.70e-08
</code></pre>
<p>I tried using the following options:</p>
<pre><code>options(scipen = 1)
options(digits = 2)
</code></pre>
<p>This gave me the results:</p>
<pre><code>0.05 --> 0.05
0.05671 --> 0.057
0.000000027 --> 2.7e-08
</code></pre>
<p>I obtained the same results when I tried:</p>
<pre><code>options(scipen = 0)
options(digits = 2)
</code></pre>
<p>Thank you for any advice.</p>
| 0debug |
Create DICOM file using java(without using any 3rd party library) : <p>I'm trying to create a sample that creates a new file in DICOM format without using any 3rd party library.
File is supposed to have following details:
1). Patient details(name, DOB, etc)
2). Image pixel data.</p>
<p>I have read a few articles on DICOM format but I still don't understand a lot of things(basically, from where to start and what standards to maintain while creating DICOM file).</p>
<p>Could any one give me an example or point me to a tutorial that shows how to create simple DICOM file using Java?</p>
| 0debug |
R - number of unique values in a column of data frame : <p>for a dataframe <code>df</code>, I need to find the unique values for <code>some_col</code>. Tried the following </p>
<p><code>length(unique(df["some_col"]))</code></p>
<p>but this is not giving the expected results. However <code>length(unique(some_vector))</code> works on a vector and gives the expected results. </p>
<p>Some preceding steps while the df is created</p>
<pre><code>df <- read.csv(file, header=T)
typeof(df) #=> "list"
typeof(unique(df["some_col"])) #=> "list"
length(unique(df["some_col"])) #=> 1
</code></pre>
| 0debug |
Javascript sorting string : <p>I have array <code>['A', 'B', 'A', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'A']</code>
and i want to sort into <code>['A', 'A', 'B', 'B', 'A', 'A', 'B', 'B', 'A', 'A', 'B', 'A', 'A']</code>.
how to solve it using javascript ?</p>
| 0debug |
static uint32_t memory_region_read_thunk_n(void *_mr,
target_phys_addr_t addr,
unsigned size)
{
MemoryRegion *mr = _mr;
uint64_t data = 0;
if (!memory_region_access_valid(mr, addr, size)) {
return -1U;
}
if (!mr->ops->read) {
return mr->ops->old_mmio.read[bitops_ffsl(size)](mr->opaque, addr);
}
access_with_adjusted_size(addr + mr->offset, &data, size,
mr->ops->impl.min_access_size,
mr->ops->impl.max_access_size,
memory_region_read_accessor, mr);
return data;
}
| 1threat |
Configure multiple Firebase projects with Unity : <p>Is it possible to <a href="https://firebase.google.com/d" rel="noreferrer">configure multiple Firebase projects</a> for my Unity application without diving into the Android or iOS code? I tried simply switching out the google-services.json file, but this failed to point my Unity app to the correct Firebase app. Ideally I'd like to be able to do something like this: </p>
<pre><code> void Awake()
{
if (environment == Environment.Development)
{
SetDevelopmentEnvironment();
}
FirebaseApp.CheckDependencies();
FirebaseApp.FixDependenciesAsync();
auth = FirebaseAuth.DefaultInstance;
}
public void SetDevelopmentEnvironment()
{
AppOptions firebaseDevelopmentAppOptions = new AppOptions();
firebaseDevelopmentAppOptions.ProjectId = "test";
firebaseDevelopmentAppOptions.StorageBucket = "test.appspot.com";
firebaseDevelopmentAppOptions.AppId = "1:12345:android: xyz";
firebaseDevelopmentAppOptions.ApiKey = "123Key";
firebaseDevelopmentAppOptions.MessageSenderId = "123SenderID";
System.Uri dbURL = new System.Uri("https://test.firebaseio.com");
firebaseDevelopmentAppOptions.DatabaseUrl = dbURL;
FirebaseApp.Create(firebaseDevelopmentAppOptions);
}
</code></pre>
<p>Or better yet, simply pass the appropriate google-services.json from the Resources folder. </p>
| 0debug |
static void machine_cpu_reset(MicroBlazeCPU *cpu)
{
CPUMBState *env = &cpu->env;
env->pvr.regs[10] = 0x0e000000;
env->pvr.regs[0] |= (0x14 << 8);
env->pvr.regs[4] = 0xc56b8000;
env->pvr.regs[5] = 0xc56be000;
}
| 1threat |
static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
x264_nal_t *nals, int nnal, int skip_sei)
{
X264Context *x4 = ctx->priv_data;
uint8_t *p = buf;
int i;
if (x4->sei_size > 0 && nnal > 0) {
if (x4->sei_size > size) {
return -1;
memcpy(p, x4->sei, x4->sei_size);
p += x4->sei_size;
x4->sei_size = 0;
for (i = 0; i < nnal; i++){
if (skip_sei && nals[i].i_type == NAL_SEI) {
x4->sei_size = nals[i].i_payload;
x4->sei = av_malloc(x4->sei_size);
memcpy(x4->sei, nals[i].p_payload, nals[i].i_payload);
continue;
memcpy(p, nals[i].p_payload, nals[i].i_payload);
p += nals[i].i_payload;
return p - buf;
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.