problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
MatroskaTrack *track,
AVStream *st,
uint8_t *data, int size,
uint64_t timecode,
int64_t pos)
{
int a = st->codec->block_align;
int sps = track->audio.sub_packet_size;
int cfs = track->audio.coded_framesize;
int h = track->audio.sub_packet_h;
int y = track->audio.sub_packet_cnt;
int w = track->audio.frame_size;
int x;
if (!track->audio.pkt_cnt) {
if (track->audio.sub_packet_cnt == 0)
track->audio.buf_timecode = timecode;
if (st->codec->codec_id == AV_CODEC_ID_RA_288) {
if (size < cfs * h / 2) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt int4 RM-style audio packet size\n");
return AVERROR_INVALIDDATA;
}
for (x=0; x<h/2; x++)
memcpy(track->audio.buf+x*2*w+y*cfs,
data+x*cfs, cfs);
} else if (st->codec->codec_id == AV_CODEC_ID_SIPR) {
if (size < w) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt sipr RM-style audio packet size\n");
return AVERROR_INVALIDDATA;
}
memcpy(track->audio.buf + y*w, data, w);
} else {
if (size < sps * w / sps) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt generic RM-style audio packet size\n");
return AVERROR_INVALIDDATA;
}
for (x=0; x<w/sps; x++)
memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
}
if (++track->audio.sub_packet_cnt >= h) {
if (st->codec->codec_id == AV_CODEC_ID_SIPR)
ff_rm_reorder_sipr_data(track->audio.buf, h, w);
track->audio.sub_packet_cnt = 0;
track->audio.pkt_cnt = h*w / a;
}
}
while (track->audio.pkt_cnt) {
AVPacket *pkt = NULL;
if (!(pkt = av_mallocz(sizeof(AVPacket))) || av_new_packet(pkt, a) < 0){
av_free(pkt);
return AVERROR(ENOMEM);
}
memcpy(pkt->data, track->audio.buf
+ a * (h*w / a - track->audio.pkt_cnt--), a);
pkt->pts = track->audio.buf_timecode;
track->audio.buf_timecode = AV_NOPTS_VALUE;
pkt->pos = pos;
pkt->stream_index = st->index;
dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
}
return 0;
}
| 1threat |
uint32_t HELPER(neon_abd_f32)(uint32_t a, uint32_t b)
{
float32 f0 = make_float32(a);
float32 f1 = make_float32(b);
return float32_val((float32_compare_quiet(f0, f1, NFS) == 1)
? float32_sub(f0, f1, NFS)
: float32_sub(f1, f0, NFS));
}
| 1threat |
Xcode 11 beta swift ui preview not showing : <p>Just playing with Swift UI basic app and the preview canvas is not showing even though I'm in canvas mode. App runs, and I have this little snippet what am I missing?</p>
<pre><code>#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
</code></pre>
| 0debug |
How to concatinate multiple graphs on the same x y axis in matlab? : <p>I have for loop that plots multiple graphs, whereby each graph has own window.
I would like to concatenate these graphs using only one graph and x y axis. </p>
<p>Could someone give an example?</p>
| 0debug |
how do i make the below ORDER BY clause to work : try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/kabumbu?autoReconnect=true&useSSL=false", "root", "****");
String q = "select player_id, sum(number_of_goals) as 'Number of Goals',school_name "
+ "from goal_scorers g , schools s "
+ "where g.school_id = s.school_id "
+ "group by g.player_id "
+ "ORDER BY number_of_goals DESC";
PreparedStatement pstm = conn.prepareStatement(q);
ResultSet rs = null;
rs = pstm.executeQuery();
jTable2.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
} | 0debug |
R - delete records from data frame : <p>I have a file with 120k records and the key is the username. I want to delete records for some username.
Delete all records for username in "ABC","dd","EEE" etc.
I am using R language</p>
| 0debug |
How is the output of this simple java code 6 and not 4? : How is the output of this simple java code 6 and not 4? Also since int x = 10 and int y = 15, how come they are able to declare int x and int y again to be 5 and x-2? I thought you can only declare the value of an int once? thanks, sorry I'm new to java.
here's the code:
public class shortq
{
public static void main (String args[])
{
int x = 10 , y =15;
x = 5;
y = x-2;
System.out.println(x+1);
}
} | 0debug |
why ckeditor not save character ' : The ckeditor not saves the single inverted comma in the database all other character and special characters all saving except the single inverted comma.[enter image description here][1]
[1]: https://i.stack.imgur.com/xpzcC.png | 0debug |
Should I learn Angularjs first or Laravel? : <p>I'm a beginner web developer, I decided to learn my first framework so it's my first time to use a framework and I decided to learn Angularjs & Laravel. which one should I start with ?</p>
<p>PS: I code in PHP and I know PHP OOP, also I'm kinda good at JS </p>
| 0debug |
static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1,
uint8_t *src2, ptrdiff_t stride, int h)
{
LOCAL_ALIGNED_16(int16_t, temp, [64]);
int sum = 0, i;
av_assert2(h == 8);
s->pdsp.diff_pixels(temp, src1, src2, stride);
s->fdsp.fdct(temp);
for (i = 0; i < 64; i++)
sum = FFMAX(sum, FFABS(temp[i]));
return sum;
}
| 1threat |
Android: Calling a function inside a function? : Is it possible to call a function from another class inside a function?
like
public void function(Integer x){
((NextActivity)getContext()).function2(x);
} | 0debug |
How to check if docker daemon is running? : <p>I am trying to create a bash utility script to check if a docker daemon is running in my server.
Is there a better way of checking if the docker daemon is running in my server other than running a code like this?</p>
<pre><code>ps -ef | grep docker
root 1250 1 0 13:28 ? 00:00:04 /usr/bin/dockerd --selinux-enabled
root 1598 1250 0 13:28 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
root 10997 10916 0 19:47 pts/0 00:00:00 grep --color=auto docker
</code></pre>
<p>I would like to create a bash shell script that will check if my docker daemon is running. If it is running then do nothing but if it is not then have the docker daemon started.</p>
<p>My pseudocode is something like this. I am thinking of parsing the output of my ps -ef but I just would like to know if there is a more efficient way of doing my pseudocode.</p>
<blockquote>
<p>if(docker is not running)</p>
<pre><code> run docker
</code></pre>
<p>end</p>
</blockquote>
<p>P.S.
I am no linux expert and I just need to do this utility on my own environment.</p>
| 0debug |
Slick carousel full width with center mode not working : <p>I am trying to create a full width page slider with one slide to be centered and 2 slides will be partially visible at both sides.</p>
<p>But for some reason there is a big white gap visible. I tried with giving img width 100% but the image resolution is distorting.</p>
<p>Jquery code:</p>
<pre><code>$('.slider').slick({
centerMode: true,
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
infinite: true,
cssEase: 'linear'
});
</code></pre>
<p>Demo -- <a href="https://jsfiddle.net/squidraj/hn7xsa4y/" rel="noreferrer">https://jsfiddle.net/squidraj/hn7xsa4y/</a></p>
<p>Any help is highly appreciated.</p>
| 0debug |
React Native Failed to capture snapshot of input files for task 'bundleReleaseJsAndAssets' during up-to-date check : <p>I am trying to generate a signed apk file for my react native app (via running ./gradlew assembleRelease), however I am running into the following error:</p>
<pre><code>FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of input files for task 'bundleReleaseJsAndAssets' during up-to-date check.
> java.io.FileNotFoundException: /home/mohammad/superexnews/metro-bundler-symbolicate117830-24506-1aaqyox.dr9.sock (No such device or address)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
</code></pre>
<p>Here is it with the stacktrace option: </p>
<pre><code>Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee130Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore130Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0484Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:mergeReleaseShaders UP-TO-DATE
:app:compileReleaseShaders UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:bundleReleaseJsAndAssets
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of input files for task 'bundleReleaseJsAndAssets' during up-to-date check.
> java.io.FileNotFoundException: /home/mohammad/superexnews/metro-bundler-symbolicate117830-24506-1aaqyox.dr9.sock (No such device or address)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task 'bundleReleaseJsAndAssets' during up-to-date check.
at org.gradle.api.internal.changedetection.rules.AbstractFileSnapshotTaskStateChanges.createSnapshot(AbstractFileSnapshotTaskStateChanges.java:57)
at org.gradle.api.internal.changedetection.rules.InputFilesTaskStateChanges.getCurrent(InputFilesTaskStateChanges.java:52)
at org.gradle.api.internal.changedetection.rules.AbstractFileSnapshotTaskStateChanges.getChanges(AbstractFileSnapshotTaskStateChanges.java:42)
at org.gradle.api.internal.changedetection.rules.AbstractFileSnapshotTaskStateChanges$1.<init>(AbstractFileSnapshotTaskStateChanges.java:71)
at org.gradle.api.internal.changedetection.rules.AbstractFileSnapshotTaskStateChanges.iterator(AbstractFileSnapshotTaskStateChanges.java:70)
at org.gradle.api.internal.changedetection.rules.InputFilesTaskStateChanges.iterator(InputFilesTaskStateChanges.java:68)
at org.gradle.api.internal.changedetection.rules.CachingTaskStateChanges.reset(CachingTaskStateChanges.java:79)
at org.gradle.api.internal.changedetection.rules.CachingTaskStateChanges.iterator(CachingTaskStateChanges.java:44)
at org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges.firstDirtyIterator(SummaryTaskStateChanges.java:63)
at org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges.access$000(SummaryTaskStateChanges.java:25)
at org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges$1.computeNext(SummaryTaskStateChanges.java:49)
at org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges$1.computeNext(SummaryTaskStateChanges.java:42)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.collectChangedMessages(DefaultTaskArtifactStateRepository.java:83)
at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:74)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /home/mohammad/superexnews/metro-bundler-symbolicate117830-24506-1aaqyox.dr9.sock (No such device or address)
at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:39)
at org.gradle.api.internal.hash.DefaultHasher.hash(DefaultHasher.java:25)
at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:82)
at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:71)
at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:34)
at org.gradle.api.internal.changedetection.state.DefaultVisitedTree$1.transform(DefaultVisitedTree.java:112)
at org.gradle.api.internal.changedetection.state.DefaultVisitedTree$1.transform(DefaultVisitedTree.java:104)
at org.gradle.util.CollectionUtils.collect(CollectionUtils.java:188)
at org.gradle.util.CollectionUtils.collect(CollectionUtils.java:183)
at org.gradle.api.internal.changedetection.state.DefaultVisitedTree.createTreeSnapshot(DefaultVisitedTree.java:104)
at org.gradle.api.internal.changedetection.state.DefaultVisitedTree.maybeCreateSnapshot(DefaultVisitedTree.java:97)
at org.gradle.api.internal.changedetection.state.AbstractFileCollectionSnapshotter$1.run(AbstractFileCollectionSnapshotter.java:71)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60)
at org.gradle.api.internal.changedetection.state.AbstractFileCollectionSnapshotter.snapshot(AbstractFileCollectionSnapshotter.java:59)
at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:30)
at org.gradle.api.internal.changedetection.rules.AbstractFileSnapshotTaskStateChanges.createSnapshot(AbstractFileSnapshotTaskStateChanges.java:55)
... 73 more
Caused by: java.io.FileNotFoundException: /home/mohammad/superexnews/metro-bundler-symbolicate117830-24506-1aaqyox.dr9.sock (No such device or address)
at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:34)
... 93 more
BUILD FAILED
Total time: 8.509 secs
</code></pre>
<p>I'm not sure how to fix this, so can anyone tell me what is going wrong/ how to fix this?</p>
<p>Let me know if you need more information as well</p>
| 0debug |
create version.txt file in project dir via build.gradle task : <p>Apologies in advance for my ignorance. I'm very new to gradle.</p>
<p>My is goal is to have some task in my build.gradle file, wherein a file 'version.txt' is created in my project directory whenever I run the <code>gradle</code> terminal command in my project root. This 'version.txt' file needs to contain version metadata of the build, such as:</p>
<p><code>Version: 1.0
Revision: 1z7g30jFHYjl42L9fh0pqzmsQkF
Buildtime: 2016-06-14 07:16:37 EST
Application-name: foobarbaz app</code></p>
<p>(^Revision would be the git commit hash of the HEAD)</p>
<p>I've tried to reuse snippets from the following resources, but to no avail, possibly because these resources are out of date:
<a href="http://mrhaki.blogspot.com/2015/04/gradle-goodness-use-git-commit-id-in.html" rel="noreferrer">http://mrhaki.blogspot.com/2015/04/gradle-goodness-use-git-commit-id-in.html</a>
<a href="http://mrhaki.blogspot.com/2010/10/gradle-goodness-add-incremental-build.html" rel="noreferrer">http://mrhaki.blogspot.com/2010/10/gradle-goodness-add-incremental-build.html</a></p>
<p>I'm using gradle version 2.14 (which is the latest version).</p>
<p>Any help and/or insight would be very much appreciated. Thanks!</p>
| 0debug |
static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){
int i;
int dc0, dc1;
pixel4 dc0splat, dc1splat;
pixel *src = (pixel*)_src;
stride /= sizeof(pixel);
dc0=dc1=0;
for(i=0;i<4; i++){
dc0+= src[i-stride];
dc1+= src[4+i-stride];
}
dc0splat = PIXEL_SPLAT_X4((dc0 + 2)>>2);
dc1splat = PIXEL_SPLAT_X4((dc1 + 2)>>2);
for(i=0; i<4; i++){
((pixel4*)(src+i*stride))[0]= dc0splat;
((pixel4*)(src+i*stride))[1]= dc1splat;
}
for(i=4; i<8; i++){
((pixel4*)(src+i*stride))[0]= dc0splat;
((pixel4*)(src+i*stride))[1]= dc1splat;
}
}
| 1threat |
is is used uninitialized in this function : I have completed the program, but I'm getting one error. it says total,min,hours,sec is used uninitialized in this function. I tried using different variables, and I initialized the variable but it still didn't work. Can someone help me figure out what did I do wrong. I put time( total, hours, mins, secs);
my program - #include <iostream>
using namespace std;
void time(int, int, int, int);
int main()
{
int total;
int hours;
int mins;
int seconds;
int secs;
cout << "Enter the number of seconds: ";
cin >> seconds;
time( total, hours, mins, secs);
cout << "The number of hours is: " << hours << endl;
cout << "The number of minutes is: " << mins << endl;
cout << "The number of seconds is: " << secs << endl;
return 0;
}
void time(int total, int &hours, int &min, int &sec)
{
int rem1;
hours = total / 3600;
rem1 = total % 3600;
min = rem1 / 60;
sec = rem1 % 60;
return ;
}
output - 15:38: warning: 'total' is used uninitialized in this function [-Wuninitialized]
15:38: warning: 'hours' is used uninitialized in this function [-Wuninitialized]
15:38: warning: 'mins' is used uninitialized in this function [-Wuninitialized]
15:38: warning: 'secs' is used uninitialized in this function [-Wuninitialized]
I have completed the program, but I'm getting one error. it says total,min,hours,sec is used uninitialized in this function. I tried using different variables, and I initialized the variable but it still didn't work. Can someone help me figure out what did I do wrong. I put time( total, hours, mins, secs);
| 0debug |
static void v9fs_read(void *opaque)
{
int32_t fid;
int64_t off;
ssize_t err = 0;
int32_t count = 0;
size_t offset = 7;
int32_t max_count;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_count);
fidp = get_fid(pdu, fid);
if (fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
if (fidp->fid_type == P9_FID_DIR) {
if (off == 0) {
v9fs_co_rewinddir(pdu, fidp);
}
count = v9fs_do_readdir_with_stat(pdu, fidp, max_count);
if (count < 0) {
err = count;
goto out;
}
err = offset;
err += pdu_marshal(pdu, offset, "d", count);
err += count;
} else if (fidp->fid_type == P9_FID_FILE) {
int32_t cnt;
int32_t len;
struct iovec *sg;
struct iovec iov[128];
sg = iov;
pdu_marshal(pdu, offset + 4, "v", sg, &cnt);
sg = cap_sg(sg, max_count, &cnt);
do {
if (0) {
print_sg(sg, cnt);
}
do {
len = v9fs_co_preadv(pdu, fidp, sg, cnt, off);
if (len >= 0) {
off += len;
count += len;
}
} while (len == -EINTR && !pdu->cancelled);
if (len < 0) {
err = len;
goto out;
}
sg = adjust_sg(sg, len, &cnt);
} while (count < max_count && len > 0);
err = offset;
err += pdu_marshal(pdu, offset, "d", count);
err += count;
} else if (fidp->fid_type == P9_FID_XATTR) {
err = v9fs_xattr_read(s, pdu, fidp, off, max_count);
} else {
err = -EINVAL;
}
out:
put_fid(pdu, fidp);
out_nofid:
trace_v9fs_read_return(pdu->tag, pdu->id, count, err);
complete_pdu(s, pdu, err);
} | 1threat |
BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs,
QEMUWin32AIOState *aio, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type)
{
struct QEMUWin32AIOCB *waiocb;
uint64_t offset = sector_num * 512;
DWORD rc;
waiocb = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque);
waiocb->nbytes = nb_sectors * 512;
waiocb->qiov = qiov;
waiocb->is_read = (type == QEMU_AIO_READ);
if (qiov->niov > 1) {
waiocb->buf = qemu_blockalign(bs, qiov->size);
if (type & QEMU_AIO_WRITE) {
iov_to_buf(qiov->iov, qiov->niov, 0, waiocb->buf, qiov->size);
}
waiocb->is_linear = false;
} else {
waiocb->buf = qiov->iov[0].iov_base;
waiocb->is_linear = true;
}
memset(&waiocb->ov, 0, sizeof(waiocb->ov));
waiocb->ov.Offset = (DWORD)offset;
waiocb->ov.OffsetHigh = (DWORD)(offset >> 32);
waiocb->ov.hEvent = event_notifier_get_handle(&aio->e);
aio->count++;
if (type & QEMU_AIO_READ) {
rc = ReadFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);
} else {
rc = WriteFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);
}
if(rc == 0 && GetLastError() != ERROR_IO_PENDING) {
goto out_dec_count;
}
return &waiocb->common;
out_dec_count:
aio->count--;
qemu_aio_release(waiocb);
return NULL;
}
| 1threat |
Button does not work when cloned using jQuery : <p>I have problem here with a button. So I want to clone items from one list to another one. I also want to add a button when passed to the other list. The problem appears when I click the button. Nothing happens. Item does not get removed. Do you have any idea why that's happening?</p>
<p><strong>jQuery:</strong></p>
<pre><code> $( function() {
$( "#sortable1").sortable({
connectWith: ".connectedSortable",
items: "li:not(.ui-state-disabled)",
remove: function(event, ui) {
ui.item.clone().append( "<button class='cancelBut'>Cancel</button>" ).appendTo('#sortable13');
$(this).sortable('cancel');
}
}).disableSelection();
$( "#sortable13").sortable({
connectWith: ".connectedSortable",
items: "li:not(.ui-state-disabled)"
}).disableSelection();
$( ".cancelBut" ).click(function() {
//$(this).parent().remove();
alert("It works");
});
});
</code></pre>
<p><strong>HTML:</strong></p>
<pre><code> <div id="items" style="display: none">
<ul id="sortable1" class="connectedSortable">
<li class="ui-state-default ui-state-disabled">Items</li>
<li class="ui-state-default"><p>Item 1</p></li>
</ul>
</div>
<ul id="sortable13" class="connectedSortable">
<li class="ui-state-default ui-state-disabled">Drag Here</li>
</ul>
</code></pre>
<p>Im new to jQuery so sorry if the answer is obvious and thanks for help :)</p>
| 0debug |
How to sst background using intent. set as lock screen, set as background etc? : I am setting image as background, lock screen is it possible? like an app which is uploaded on play store called black wallpaper | 0debug |
ORACLE PLSQL TRIGGERS : Why we can NOT perform Commit in Pl_SQL triggers? If triggers are auto commit why we need PRAGMA autonomous transaction used for commit?Please explain .. am fully confused about this.Thanks in advance. | 0debug |
How to convert RealmResults<Object> to List<Object> : <p>I have RealmResults that I receive from <code>Realm</code> like</p>
<pre><code>RealmResults<StepEntry> stepEntryResults = realm.where(StepEntry.class).findAll();
</code></pre>
<p>Now I want convert <code>RealmResults<StepEntry></code> to <code>ArrayList<StepEntry></code></p>
<p>I have try </p>
<pre><code> ArrayList<StepEntry> stepEntryArray = new ArrayList<StepEntry>(stepEntryResults));
</code></pre>
<p>but the item in my <code>ArrayList</code> is not my <code>StepEntry</code> object, it is <code>StepEntryRealmProxy</code>
<a href="https://i.stack.imgur.com/70Zox.png" rel="noreferrer"><img src="https://i.stack.imgur.com/70Zox.png" alt="enter image description here"></a></p>
<p>How can I convert it?
Any help or suggestion would be great appreciated.</p>
| 0debug |
static void omap_sti_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
struct omap_sti_s *s = (struct omap_sti_s *) opaque;
if (size != 4) {
return omap_badwidth_write32(opaque, addr, value);
}
switch (addr) {
case 0x00:
case 0x14:
OMAP_RO_REG(addr);
return;
case 0x10:
if (value & (1 << 1))
omap_sti_reset(s);
s->sysconfig = value & 0xfe;
break;
case 0x18:
s->irqst &= ~value;
omap_sti_interrupt_update(s);
break;
case 0x1c:
s->irqen = value & 0xffff;
omap_sti_interrupt_update(s);
break;
case 0x2c:
s->clkcontrol = value & 0xff;
break;
case 0x30:
s->serial_config = value & 0xff;
break;
case 0x24:
case 0x28:
return;
default:
OMAP_BAD_REG(addr);
return;
}
}
| 1threat |
static int fetch_active_ports_list(QEMUFile *f,
VirtIOSerial *s, uint32_t nr_active_ports)
{
uint32_t i;
s->post_load = g_malloc0(sizeof(*s->post_load));
s->post_load->nr_active_ports = nr_active_ports;
s->post_load->connected =
g_malloc0(sizeof(*s->post_load->connected) * nr_active_ports);
s->post_load->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
virtio_serial_post_load_timer_cb,
s);
for (i = 0; i < nr_active_ports; i++) {
VirtIOSerialPort *port;
uint32_t elem_popped;
uint32_t id;
id = qemu_get_be32(f);
port = find_port_by_id(s, id);
if (!port) {
return -EINVAL;
}
port->guest_connected = qemu_get_byte(f);
s->post_load->connected[i].port = port;
s->post_load->connected[i].host_connected = qemu_get_byte(f);
qemu_get_be32s(f, &elem_popped);
if (elem_popped) {
qemu_get_be32s(f, &port->iov_idx);
qemu_get_be64s(f, &port->iov_offset);
port->elem =
qemu_get_virtqueue_element(f, sizeof(VirtQueueElement));
virtio_serial_throttle_port(port, false);
}
}
timer_mod(s->post_load->timer, 1);
return 0;
}
| 1threat |
String method not giving the right output : <p>So I was solving a question from a coding website that required me to replace ? with an a or b provided there are no two consecutive a... I have tried a lot and this is the code that i have written. although the code seems correct to my knowledge, whenever I run this code the output is same as the input itself. No changes are made to it.</p>
<p>Example case:
<strong>input</strong>: ?ababa?b?
<strong>output</strong>: babababba</p>
<p><strong>input</strong>: ababb?b
<strong>output</strong>:ababbab</p>
<p>The input has to be wither a,b or ?
The output must be such that it has the highest precedence in dictionary.</p>
<p>However whatever input i give i get the same output. If I give ?ab as input I get the same as output please help me</p>
<pre><code> package Beginner;
import java.util.Scanner;
public class ExplRuin {
public static void main(String args[]){
String s;
Scanner in = new Scanner(System.in);
s = in.nextLine();
if(s.length()==1){
if(s.equals("?"))
s.replace("?", "a");
} else
{
if(s.toString().startsWith("?")){
if(s.contains("?b"))
s.replace("?b","ab");
else
if(s.contains("?a"))
- s.replace("?a", "ba");
}
if(s.endsWith("?")){
if(s.contains("a?"))
s.replace("a?", "ab");
else
if(s.contains("b?"))
s.replace("b?","ba");
}
if(s.contains("?a")||s.contains("a?")){
s.replace("?", "a");
}
else{
s.replace("?", "a");
}
}
System.out.print(s);
}
}
</code></pre>
| 0debug |
static void vty_receive(void *opaque, const uint8_t *buf, int size)
{
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)opaque;
int i;
if ((dev->in == dev->out) && size) {
qemu_irq_pulse(dev->sdev.qirq);
}
for (i = 0; i < size; i++) {
assert((dev->in - dev->out) < VTERM_BUFSIZE);
dev->buf[dev->in++ % VTERM_BUFSIZE] = buf[i];
}
}
| 1threat |
How to use "if-else" in RX java chain? : <p>I am a newer on RXJava/RXAndroid. I want to implement this case: chose different way based on some condition in RXJava.
For example, first, I fetch user info from network and if this is a VIP user, I will go on to fetch more info from network or just show some info in main thread (break the chain.) Here the flow chart: <a href="https://i.stack.imgur.com/0hztR.png" rel="noreferrer">https://i.stack.imgur.com/0hztR.png</a></p>
<p>I do some search on this and only find "switchIfEmpty" may help.
I write the following code:</p>
<pre><code>getUserFromNetwork("userId")
.flatMap(new Function<User, ObservableSource<User>>() {
@Override
public ObservableSource<User> apply(User user) throws Exception {
if(!user.isVip){
//show user info on MainThread!
return Observable.empty();
}else{
return getVipUserFromNetwork("userId");
}
}
}).switchIfEmpty(new ObservableSource<User>() {
@Override
public void subscribe(Observer<? super User> observer) {
//show user info in main thread
//just break the chain for normal user
observer.onComplete();
}
}).doOnNext(new Consumer<User>() {
@Override
public void accept(User user) throws Exception {
//show vip user info in main thread
}
}).subscribe();
</code></pre>
<p>Is there more simple way to achieve this?</p>
<p>Thanks!</p>
| 0debug |
Include global functions in Vue.js : <p>In my Vue.js application I want to have some global functions. For example a <code>callApi()</code> function which I can call every time I need access to my data.</p>
<p>What is the best way to include these functions so I can access it in all my components?</p>
<ul>
<li>Should I create a file functions.js and include it in my main.js?</li>
<li>Should I create a Mixin and include it in my main.js?</li>
<li>Is there a better option?</li>
</ul>
| 0debug |
Angular 2 change event - model changes : <p>How can I get the values after a model has changed? The <code>(change)</code> event does fire before the model change. I do not want to use <code>event.target.value</code></p>
<pre><code><input type="checkbox" (change)="mychange(event)" [(ngModel)]="mymodel">
public mychange(event)
{
console.log(mymodel); // mymodel has the value before the change
}
</code></pre>
| 0debug |
static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
unsigned int op0, unsigned int op1, unsigned int op2,
unsigned int crn, unsigned int crm, unsigned int rt)
{
const ARMCPRegInfo *ri;
TCGv_i64 tcg_rt;
ri = get_arm_cp_reginfo(s->cp_regs,
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
crn, crm, op0, op1, op2));
if (!ri) {
if (!cp_access_ok(s->current_pl, ri, isread)) {
unallocated_encoding(s);
return;
switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {
case ARM_CP_NOP:
return;
case ARM_CP_NZCV:
tcg_rt = cpu_reg(s, rt);
if (isread) {
gen_get_nzcv(tcg_rt);
} else {
gen_set_nzcv(tcg_rt);
return;
default:
break;
if (use_icount && (ri->type & ARM_CP_IO)) {
gen_io_start();
tcg_rt = cpu_reg(s, rt);
if (isread) {
if (ri->type & ARM_CP_CONST) {
tcg_gen_movi_i64(tcg_rt, ri->resetvalue);
} else if (ri->readfn) {
gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr);
} else {
tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset);
} else {
if (ri->type & ARM_CP_CONST) {
return;
} else if (ri->writefn) {
gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);
} else {
tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset);
if (use_icount && (ri->type & ARM_CP_IO)) {
gen_io_end();
s->is_jmp = DISAS_UPDATE;
} else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
/* We default to ending the TB on a coprocessor register write,
* but allow this to be suppressed by the register definition
* (usually only necessary to work around guest bugs).
s->is_jmp = DISAS_UPDATE; | 1threat |
Android : How to do image blur on touch (Progressively) : Need your help on urgent basis.
I want to blur a portion of bitmap and set into image view.
But I am not getting any reference of the same.
| 0debug |
Tracking Android in-app subscription events with Firebase Analytics : <p>We're using Firebase Analytics to track our Android app.
We've connected it to our Google Play account in hopes to receive the automatic <code>in_app_purchase</code> events. What we later realized is that does not support in-app subscriptions: <a href="https://support.google.com/firebase/answer/6317485?hl=en">https://support.google.com/firebase/answer/6317485?hl=en</a></p>
<p>How do we track subscription revenue events?<br>
We thought about using the <code>ecommerce_purchase</code> event (<a href="https://support.google.com/firebase/answer/6317499?hl=en">https://support.google.com/firebase/answer/6317499?hl=en</a>) so we could track the ARPU, ARPPU and LTV of our users. </p>
<p>The problem we are facing is dealing with subscription recurrence. Should we manually send this event each month/year and stop sending once the subscription is cancelled? It seems like a error-prone hack ...</p>
<p>Any other ideas?</p>
<p>Thanks!</p>
| 0debug |
CORS issue on angular in ionic 3 and glassfish with javaEE6 on server side : <p>I have an issue with ionic3 framework when I run "ionic serve" and I make a request to a localhost server. The error I receive is:</p>
<pre><code>Access to XMLHttpRequest at 'http://localhost:8080/myrestapi/myendpoint' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
</code></pre>
<p>I have searched around and I have added the Access-Control-Allow both in my server and in angular. From the angular point of view I have the following:</p>
<pre><code>@Injectable()
export class Gateway {
private getBasicHttpOptions(): any {
let headers: HttpHeaders = new HttpHeaders();
headers = headers.append('Access-Control-Allow-Origin', '*');
headers = headers.append('Content-Type', 'application/json');
let httpOptions: any = {headers: headers};
return httpOptions;
}
public getData(myparam: string): Observable<any> {
let httpOptions: any = this.getBasicHttpOptions();
let body: any = {
'param': myparam
};
return this.http.post("http://localhost:8080/myrestapi/myendpoint", body, httpOptions);
}
}
</code></pre>
<p>And then on the server side I have the following (javeEE6, SDK 7, glassfish 3.1.2):</p>
<pre><code>@Path("/myrestapi")
@Stateless
public class Authentication {
@POST
@Path("/myendpoint")
@Consumes("application/json")
@Produces(MediaType.APPLICATION_JSON)
public Response myEndPoint(@HeaderParam("Content-Type") String contentType, String body){
return Response.status(200)
.header("Access-Control-Allow-Origin", "*")
.header("Access-Control-Allow-Credentials", "true")
.header("Access-Control-Allow-Headers", "origin, content-type, accept, authorization")
.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD")
.header("Access-Control-Max-Age", "1209600")
.type(MediaType.APPLICATION_JSON)
.entity("{ke1:'val1'}").type(MediaType.APPLICATION_JSON).build();
}
}
</code></pre>
<p>Whenever I call this.gateway.getData('aparam'); because I have in the debug mode my local server I cannot receive any request (from Postman it works fine). So it seems that it's from the client side that it doesnt send any request. </p>
<p>From Chrome from the network tools I have the following:</p>
<p><a href="https://i.stack.imgur.com/1597I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1597I.png" alt="enter image description here"></a></p>
<p>Any ideas?</p>
| 0debug |
Debug console not showing values for Swift + Objective-C : <p>My app uses Swift and a 3rd-party library in Objective-C. When my debugger steps into the Objective-C code, the debug console does not show the values of my Swift string correctly. Instead, it shows unable to read data. How can we resolve this issue?</p>
<p><a href="https://i.stack.imgur.com/I4C5V.png" rel="noreferrer"><img src="https://i.stack.imgur.com/I4C5V.png" alt="enter image description here"></a></p>
| 0debug |
Why function return undefined. : This a simple code for factorial, I have written the function and it loops through giving right output but at the end, it goes undefined. I don't know why.
`function factorial(n){
let value=1;
for(let i=1;i<=n;i++)
{ value = i*value; console.log(value); }
}` | 0debug |
I have a regex for only numbers allowed. But need one for floating o's als : I have a regex for to check if an input field has only numbers in it.
if (paymentAmount.match(/[^0-9\.,]/g)) ... show error
I need to also check for if there are any 0's before the value also.
for example. 0001.23 should throw and error. but 1.23 should be ok.
Is there a way to add this to the current regex check.
| 0debug |
How to manage server id and sqlite id column during syncing in android? : I have some confusion that how could we manage server id column and sqlite database table id column while we syncing data from sqlite to server or server to sqlite in android.
Any one who can explain syncing process better.
Thanks. | 0debug |
Convert objects inside one array, into multiple arrays : <p>How do i convert </p>
<pre><code>const peopleArray = [
{ id: 123, name: "dave", age: 23 },
{ id: 456, name: "chris", age: 23 },
{ id: 789, name: "bob", age: 23 },
{ id: 101, name: "tom", age: 23 },
{ id: 102, name: "tim", age: 23 }
]
</code></pre>
<p>to</p>
<pre><code>const peopleArray = [[{ id: 123, name: "dave", age: 23 }],
[{ id: 456, name: "chris", age: 23 }],
[{ id: 789, name: "bob", age: 23 }],
[{ id: 101, name: "tom", age: 23 }],
[{ id: 102, name: "tim", age: 23 }]]
</code></pre>
<p>I appreciate any help. Is there an ES6 method i could use. Do not want to use lodash or any other libraries.</p>
| 0debug |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
Python 2.7 : LookupError: unknown encoding: cp65001 : <p>I have installed python 2(64 bit), on windows 8.1 (64 bit) and wanted to know pip version and for that I fired <code>pip --version</code> but it is giving error.</p>
<pre><code> C:\Users\ADMIN>pip --version
Traceback (most recent call last):
File "c:\dev\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\dev\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\dev\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\dev\python27\lib\site-packages\pip\__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "c:\dev\python27\lib\site-packages\pip\vcs\mercurial.py", line 10, in <module>
from pip.download import path_to_url
File "c:\dev\python27\lib\site-packages\pip\download.py", line 35, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
File "c:\dev\python27\lib\site-packages\pip\utils\ui.py", line 51, in <module>
_BaseBar = _select_progress_class(IncrementalBar, Bar)
File "c:\dev\python27\lib\site-packages\pip\utils\ui.py", line 44, in _select_progress_class
six.text_type().join(characters).encode(encoding)
LookupError: unknown encoding: cp65001
</code></pre>
<p>Note : The same command works fine for python 3. I have uninstalled both and installed again but still no success.</p>
| 0debug |
START_TEST(unterminated_dict_comma)
{
QObject *obj = qobject_from_json("{'abc':32,");
fail_unless(obj == NULL);
}
| 1threat |
void qemu_system_shutdown_request(void)
{
trace_qemu_system_shutdown_request();
replay_shutdown_request();
shutdown_requested = 1;
qemu_notify_event();
}
| 1threat |
On page run one button(1) should be disable another should be clickable after click of button(2) enable the button(1) : hi guys i am new in JavaScript language question is on page run one button(1) should be disable another should be clickable after click of button(2) enable the button(1)
kindly help me please... | 0debug |
RecyclerView Changing Values on Scrolling : <p>I have recyclerview listing which have two buttons. Add to Cart or Go To Cart. One of them Visibility is gone.
When i click on add to cart button. It will hiding the add to cart button and show the go to cart button.its working fine.
But when i scroll the recyclerview list then it automatically change the button to Add to cart.
Please help me to sort out this problem
Thanks</p>
| 0debug |
Selecting all strings from database that starts with a lowercase letter : <p>I'm trying to select all strings in my database that starts with a lowercase letter with regexp, but for some reason it's selecting all the strings that starts with a uppercase letter too. What am I doing wrong?</p>
<pre><code>SELECT *
FROM `allData`
WHERE response REGEXP '^[a-z]'
LIMIT 0 , 30
</code></pre>
| 0debug |
How to click on list view item? : <p>I have successfully get json data and made a list view. But I'm unable to click on the list item and can't send extras to another activity. here is my adapter.</p>
<p>I want to send address string to new activity. (I'm new in android dev)</p>
<p>Here is my work. What wrong i did?
Lists are showing perfectly but no click is getting. :(</p>
<pre><code>private String TAG = MainActivity.class.getSimpleName();
private ListView lv;
private ListView listView;
ArrayList<HashMap<String, String>> channelList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.live_stream);
channelList = new ArrayList<>();
lv = (ListView) findViewById(R.id.list);
new GetChannel().execute();
}
private class GetChannel extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
Toast.makeText(LiveStreaming.this, "Streaming list is loading", Toast.LENGTH_LONG).show();
}
@Override
protected Void doInBackground(Void... arg0) {
HttpHandler sh = new HttpHandler();
// Making a request to url and getting response
String url = "http://ubpower.net/cricktv/tv.json";
String jsonStr = sh.makeServiceCall(url);
Log.e(TAG, "Response from url: " + jsonStr);
if (jsonStr != null) {
try {
JSONObject jsonObj = new JSONObject(jsonStr);
// Getting JSON Array node
JSONArray channel = jsonObj.getJSONArray("channel");
for (int i = 0; i < channel.length(); i++) {
JSONObject c = channel.getJSONObject(i);
String id = c.getString("id");
String name = c.getString("name");
String quality = c.getString("quality");
address = c.getString("address");
// tmp hash map for single contact
HashMap<String, String> channel_hash = new HashMap<>();
// adding each child node to HashMap key => value
channel_hash.put("id", id);
channel_hash.put("name", name);
channel_hash.put("quality", quality);
channel_hash.put("address", address);
// adding contact to contact list
channelList.add(channel_hash);
}
} catch (final JSONException e) {
Log.e(TAG, "Json parsing error: " + e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),
"Json parsing error: " + e.getMessage(),
Toast.LENGTH_LONG).show();
}
});
}
} else {
Log.e(TAG, "Couldn't get json from server.");
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),
"Couldn't get json from server. Check LogCat for possible errors!",
Toast.LENGTH_LONG).show();
}
});
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
ListAdapter adapter = new SimpleAdapter(LiveStreaming.this, channelList,
R.layout.stream_list, new String[]{ "name","quality","address"},
new int[]{R.id.channel_title, R.id.channel_quality, R.id.channel_address});
lv.setAdapter(adapter);
}
public AdapterView.OnItemClickListener mMessageClickedHandler = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
Intent intent = new Intent(context, video_view.class);
intent.putExtra("address", address);
startActivity(intent);
lv.setOnItemClickListener(mMessageClickedHandler);
}
};
}
</code></pre>
<p>}</p>
| 0debug |
Simulate external webservice for integration test : <p>I have to simulate external webservice, specially SOAP webservice, to run integration test in java.</p>
<p>Any suggestion?</p>
| 0debug |
“Illegal type synonym family application in instance” with functional dependency : <p>I have a multi-parameter typeclass with a functional dependency:</p>
<pre><code>class Multi a b | a -> b
</code></pre>
<p>I also have a simple, non-injective type synonym family:</p>
<pre><code>type family Fam a
</code></pre>
<p>I want to write an instance of <code>Multi</code> that uses <code>Fam</code> in the second parameter, like this:</p>
<pre><code>instance Multi (Maybe a) (Fam a)
</code></pre>
<p>However, this instance is not accepted. GHC complains with the following error message:</p>
<pre><code>error:
• Illegal type synonym family application in instance: Fam a
• In the instance declaration for ‘Multi (Maybe a) (Fam a)’
</code></pre>
<p>Fortunately, there is a workaround. I can perform a usual trick for moving a type out of the instance head and into an equality constraint:</p>
<pre><code>instance (b ~ Fam a) => Multi (Maybe a) b
</code></pre>
<p>This instance is accepted! However, I got to thinking, and I started to wonder why this transformation could not be applied to <em>all</em> instances of <code>Multi</code>. After all, doesn’t the functional dependency imply that there can only be one <code>b</code> per <code>a</code>, anyway? In this situation, it seems like there is no reason that GHC should reject my first instance.</p>
<p>I found <a href="https://ghc.haskell.org/trac/ghc/ticket/3485" rel="noreferrer">GHC Trac ticket #3485</a>, which describes a similar situation, but that typeclass did not involve a functional dependency, so the ticket was (rightfully) closed as invalid. In my situation, however, I think the functional dependency avoids the problem described in the ticket. Is there anything I’m overlooking, or is this really an oversight/missing feature in GHC?</p>
| 0debug |
New page for every user : <p>What i basically want to do is to log in a user and make a new page for every user with its own personal details.
So for example user A signs in, he would have a different view than user B.
I am using javascript ans firebase for back end.
How can i make that happen?
A rough idea would be enough. </p>
| 0debug |
static struct scoop_info_s *spitz_scoop_init(struct pxa2xx_state_s *cpu,
int count) {
int iomemtype;
struct scoop_info_s *s;
s = (struct scoop_info_s *)
qemu_mallocz(sizeof(struct scoop_info_s) * 2);
memset(s, 0, sizeof(struct scoop_info_s) * count);
s[0].target_base = 0x10800000;
s[1].target_base = 0x08800040;
s[0].status = 0x02;
s[1].status = 0x02;
iomemtype = cpu_register_io_memory(0, scoop_readfn,
scoop_writefn, &s[0]);
cpu_register_physical_memory(s[0].target_base, 0xfff, iomemtype);
register_savevm("scoop", 0, 0, scoop_save, scoop_load, &s[0]);
if (count < 2)
return s;
iomemtype = cpu_register_io_memory(0, scoop_readfn,
scoop_writefn, &s[1]);
cpu_register_physical_memory(s[1].target_base, 0xfff, iomemtype);
register_savevm("scoop", 1, 0, scoop_save, scoop_load, &s[1]);
return s;
}
| 1threat |
db.execute('SELECT * FROM products WHERE product_id = ' + product_input) | 1threat |
web crawling pages with JS events : <p>I am trying to get a list of singles released in 2018 from allmusic.com.</p>
<p>It is easy enough to go to their advanced search page and input those parameters, but then I would have to copy and paste the information by hand. All the information is in the html, but it has be generated by clicking the search button and the page navigation buttons. The url itself doesn't change. That puts it well out of my ability to crawl via my limited beautiful soup skills.</p>
<p>Does anyone know how to web crawl java script generated html?</p>
| 0debug |
static void uhci_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
{
UHCIState *s = opaque;
addr &= 0x1f;
#ifdef DEBUG
printf("uhci writel port=0x%04x val=0x%08x\n", addr, val);
#endif
switch(addr) {
case 0x08:
s->fl_base_addr = val & ~0xfff;
break;
}
}
| 1threat |
Know if there are pending request in axios : <p>I'm new in ReactJS and for my ajax call I tried to use <a href="https://github.com/mzabriskie/axios" rel="noreferrer">Axios</a> library. It is awesome, but now I would like know if there is a way for know if there are pending requests in axios interceptor because, I would like, show loading overlay every ajax call (if it is not yet visibile) and remove overlay when ALL promise are resolved.
For now I developed start with interceptor:</p>
<pre><code>axios.interceptors.request.use(function (config) {
//here logi of show loading
return config;
}, function (error) {
return Promise.reject(error);
});
</code></pre>
<p>And I would like add something like this:</p>
<pre><code>axios.interceptors.respose.use(function (config) {
//logic remove loading if it is last response
return config;
}, function (error) {
return Promise.reject(error);
});
</code></pre>
<p>So how, (if it is possibile) know if it's last response?
Before using ReactJs, I used Angular 1.x and in <code>$http service</code> there was</p>
<pre><code>$http.pendingRequests
</code></pre>
<p>There is in axios something like $http service?</p>
| 0debug |
QTestState *qtest_init(const char *extra_args)
{
QTestState *s;
int sock, qmpsock, i;
gchar *socket_path;
gchar *qmp_socket_path;
gchar *command;
const char *qemu_binary;
struct sigaction sigact;
qemu_binary = getenv("QTEST_QEMU_BINARY");
g_assert(qemu_binary != NULL);
s = g_malloc(sizeof(*s));
socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid());
sock = init_socket(socket_path);
qmpsock = init_socket(qmp_socket_path);
sigact = (struct sigaction){
.sa_handler = sigabrt_handler,
.sa_flags = SA_RESETHAND,
};
sigemptyset(&sigact.sa_mask);
sigaction(SIGABRT, &sigact, &s->sigact_old);
s->qemu_pid = fork();
if (s->qemu_pid == 0) {
command = g_strdup_printf("exec %s "
"-qtest unix:%s,nowait "
"-qtest-log /dev/null "
"-qmp unix:%s,nowait "
"-machine accel=qtest "
"-display none "
"%s", qemu_binary, socket_path,
qmp_socket_path,
extra_args ?: "");
execlp("/bin/sh", "sh", "-c", command, NULL);
exit(1);
}
s->fd = socket_accept(sock);
s->qmp_fd = socket_accept(qmpsock);
unlink(socket_path);
unlink(qmp_socket_path);
g_free(socket_path);
g_free(qmp_socket_path);
s->rx = g_string_new("");
for (i = 0; i < MAX_IRQ; i++) {
s->irq_level[i] = false;
}
qtest_qmp_discard_response(s, "");
qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
if (getenv("QTEST_STOP")) {
kill(s->qemu_pid, SIGSTOP);
}
return s;
}
| 1threat |
golang slack send notification with attashed file : I want to send slack notification with attashed file, this is my curent code :
package Message
import (
"fmt"
"os"
"github.com/ashwanthkumar/slack-go-webhook"
)
func Message(message string, cannalul string, attash bool) {
f, err := os.Open(filename)
if err != nil {
return false
}
defer f.Close()
_ = f
fullName := "myServer"
webhookUrl := "https://hooks.slack.com/services/......."
attachment1 := slack.Attachment {}
//attachment1.AddField(slack.Field { Title: "easySmtp", Value: "EasySmtp" }).AddField(slack.Field { Title: "Status", Value: "Completed" })
if attash {
attachment1.AddField(slack.Field { Title: "easySmtp", Value: fullName})
}
payload := slack.Payload {
Text: message,
Username: "worker",
Channel: cannalul,
IconEmoji: ":grin:",
Attachments: []slack.Attachment{attachment1},
}
err := slack.Send(webhookUrl, "", payload)
if len(err) > 0 {
fmt.Printf("error: %s\n", err)
}
}
My actual code works, but i dont know how i cand add attashed file in my curent code, how i can do this ? | 0debug |
Why 2^n and not n!: The Algorithm Design Manual: 1.2 Selecting the Right Job (page 10) : <p>land,</p>
<p>In the section (page 10), the author willingly used 2-power-n to try all possible combinations of sub-intervals to find the largest subset that contains the maximum number of non-overlapping jobs. I was thinking n! instead and hence couldn't get his logic to use rather 2-power-n. Kindly please help me right here.</p>
<p>Thanks.</p>
| 0debug |
struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
int size, int nbanks, qemu_irq **pins,
qemu_irq parent_irq, qemu_irq parent_fiq,
omap_clk fclk, omap_clk iclk)
{
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)
g_malloc0(sizeof(struct omap_intr_handler_s) +
sizeof(struct omap_intr_handler_bank_s) * nbanks);
s->parent_intr[0] = parent_irq;
s->parent_intr[1] = parent_fiq;
s->nbanks = nbanks;
s->level_only = 1;
s->pins = qemu_allocate_irqs(omap_set_intr_noedge, s, nbanks * 32);
if (pins)
*pins = s->pins;
memory_region_init_io(&s->mmio, &omap2_inth_mem_ops, s, "omap2-intc", size);
memory_region_add_subregion(get_system_memory(), base, &s->mmio);
omap_inth_reset(s);
return s;
}
| 1threat |
static void parse_drive(DeviceState *dev, const char *str, void **ptr,
const char *propname, Error **errp)
{
BlockBackend *blk;
blk = blk_by_name(str);
if (!blk) {
error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(OBJECT(dev)), propname, str);
return;
}
if (blk_attach_dev(blk, dev) < 0) {
DriveInfo *dinfo = blk_legacy_dinfo(blk);
if (dinfo && dinfo->type != IF_NONE) {
error_setg(errp, "Drive '%s' is already in use because "
"it has been automatically connected to another "
"device (did you need 'if=none' in the drive options?)",
str);
} else {
error_setg(errp, "Drive '%s' is already in use by another device",
str);
}
return;
}
*ptr = blk;
}
| 1threat |
static void RENAME(yuv2yuyv422_2)(SwsContext *c, const uint16_t *buf0,
const uint16_t *buf1, const uint16_t *ubuf0,
const uint16_t *ubuf1, const uint16_t *vbuf0,
const uint16_t *vbuf1, const uint16_t *abuf0,
const uint16_t *abuf1, uint8_t *dest,
int dstW, int yalpha, int uvalpha, int y)
{
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2PACKED(%%REGBP, %5)
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
| 1threat |
Avoiding MySQL deadlock when upgrading shared to exclusive lock : <p>I'm using MySQL 5.5. I've noticed a peculiar deadlock occurring in a concurrent scenario, and I don't think this deadlock should occur.</p>
<p>Reproduce like this, using two mysql client sessions running simultaneously:</p>
<p><strong>mysql session 1</strong>:</p>
<pre><code>create table parent (id int(11) primary key);
insert into parent values (1);
create table child (id int(11) primary key, parent_id int(11), foreign key (parent_id) references parent(id));
begin;
insert into child (id, parent_id) values (10, 1);
-- this will create shared lock on parent(1)
</code></pre>
<p><strong>mysql session 2</strong>:</p>
<pre><code>begin;
-- try and get exclusive lock on parent row
select id from parent where id = 1 for update;
-- this will block because of shared lock in session 1
</code></pre>
<p><strong>mysql session 1</strong>:</p>
<pre><code>-- try and get exclusive lock on parent row
select id from parent where id = 1 for update;
-- observe that mysql session 2 transaction has been rolled back
</code></pre>
<p><strong>mysql session 2</strong>:</p>
<pre><code>ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
</code></pre>
<p>The information reported from <code>show engine innodb status</code> is this:</p>
<pre><code>------------------------
LATEST DETECTED DEADLOCK
------------------------
161207 10:48:56
*** (1) TRANSACTION:
TRANSACTION 107E67, ACTIVE 43 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 13074, OS thread handle 0x7f68eccfe700, query id 5530424 localhost root statistics
select id from parent where id = 1 for update
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 3714 n bits 72 index `PRIMARY` of table `foo`.`parent` trx id 107E67 lock_mode X locks rec but not gap waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 000000107e65; asc ~e;;
2: len 7; hex 86000001320110; asc 2 ;;
*** (2) TRANSACTION:
TRANSACTION 107E66, ACTIVE 52 sec starting index read
mysql tables in use 1, locked 1
5 lock struct(s), heap size 1248, 2 row lock(s), undo log entries 1
MySQL thread id 12411, OS thread handle 0x7f68ecfac700, query id 5530425 localhost root statistics
select id from parent where id = 1 for update
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 0 page no 3714 n bits 72 index `PRIMARY` of table `foo`.`parent` trx id 107E66 lock mode S locks rec but not gap
Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 000000107e65; asc ~e;;
2: len 7; hex 86000001320110; asc 2 ;;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 3714 n bits 72 index `PRIMARY` of table `foo`.`parent` trx id 107E66 lock_mode X locks rec but not gap waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 000000107e65; asc ~e;;
2: len 7; hex 86000001320110; asc 2 ;;
*** WE ROLL BACK TRANSACTION (1)
</code></pre>
<p>You can see that transaction (1) doesn't show any S or X locks already acquired; it's just blocked trying to acquire an exclusive lock. Since there's no cycle, there shouldn't be a deadlock in this situation, as I understand it.</p>
<p>Is this a known MySQL bug? Have other people encountered it? What workarounds were used?</p>
<p>These are the possible steps forward we could take:</p>
<ul>
<li>Reduce our usage of foreign keys (in our production scenario, we only soft delete rows in the referenced table, but is icky)</li>
<li>Acquire exclusive locks up front rather than implicit shared locks (will reduce our concurrent throughput)</li>
<li>Change our logic so we no longer need an exclusive lock on parent in same transaction that adds child row (risky and hard)</li>
<li>Change our version of MySQL to one that doesn't exhibit this behaviour</li>
</ul>
<p>Are there other options we're not considering?</p>
| 0debug |
Trying to get property of non-object : <p>I'm getting "Trying to get property of non-object" while trying to this code.</p>
<pre><code><?php foreach($pages as $page=>$p): ?>
<h2 class="section-title text-center wow fadeInDown"><?php echo $page[0]->title; ?></h2>
<p class="text-center wow fadeInDown"><?php echo strip_tags(html_entity_decode($page[0]->description)); ?></p>
<?php endforeach; ?>
</code></pre>
| 0debug |
I need to make a function to print "=" under the user, but because variable was declared with main() the parameter isn't seen by the function : <p>I need to print "=" under the input taken from the user, I'm not sure whether to use a loop or printf(), but because string title is declared within main() my function doesn't see it as a parameter.</p>
<p><a href="https://i.stack.imgur.com/5pWmn.jpg" rel="nofollow noreferrer">Error Message</a></p>
<pre><code>//#include "stdafx.h" // Header File used VS.
#include <iostream>
//#include <iomanip> // Used to format the output.
#include <cstdlib> // Used for system().
#include <math.h> // Used for sqrt().
#include <stdio.h> /* printf, NULL */
#include <time.h> /* time */
using namespace std;// ?
#include <string> // Used to work with srings.
string print_title (title);
int main (){
string title;
cout << "Enter a title: " << endl;
cin >> title;
system("PAUSE"); // Pauses the program before termination.
return 0;
}
string print_title (title){
cout << title << endl;
int length = title.length();
printf("=", length);
/*for (int i=0; i<=length, i++){
cout << "=" << endl;
}*/
}
</code></pre>
| 0debug |
how to get css or xpath locator from a button class : Button class and class locator details are only there .It is not taking xpath or any locator value .pls suggest any way on how to use button class. | 0debug |
Copy/pass values in relation to a date (column) from sheet to another sheet with column of date : I´m new in VBA Excel. I´m trying to make a macro which is not difficult, but I´m so unexperienced.
I have sheet1 with column of dates (whole month), for each date there is different value. So column A is full of dates and column B is full of values (in relation with date). Sheet2/column A is also created by dates (whole month). I would like to create a macro, which copy the value from sheet1/column B and pass it to sheet2/column B according to date. In other words, the macro should find certain date (in sheet2/columnA) and pass specific value to sheet2/column B. I would appreciate any input on this. Thanks.
| 0debug |
Firebase 2.0 - how to deal with multiple flavors (environments) of an android app? : <p>I have multiple flavors of my app. How should I set this up server side? My package names are:</p>
<p><code>com.example.app</code> (production)
<code>com.example.app.staging</code> (staging)
<code>com.example.app.fake</code> (fake)</p>
<p>Should this be 3 separate projects in the firebase console?</p>
| 0debug |
Task not serializable error in scala spark : I have two variable bellow:
var rddPair1 : ```Array[(String, String)] = Array((0000003,杉山______ 26 F), (0000005,崎村______ 50 F), (0000007,梶川______ 42 F))```
and
var rddPair2 : ``` Array[(String, String)] = Array((0000005,82 79 16 21 80), (0000001,46 39 8 5 21), (0000004,58 71 20 10 6), (0000009,60 89 33 18 6), (0000003,30 50 71 36 30), (0000007,50 2 33 15 62)) ```
The code below use to full outer join 2 variables:
```scala
var emp =rddPair1.first._2.replaceAll("\\S", "*") //emp:String = ***** ** *
rddPair1.fullOuterJoin(rddPair2).map {
case (id, (left, right)) =>
(id,left.getOrElse(emp)+" "+ right)
}.collect()
```
And I get an error like the below:
<pre>
org.apache.spark.SparkException: Task not serializable
at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:403)
at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:393)
at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:162)
at org.apache.spark.SparkContext.clean(SparkContext.scala:2326)
at org.apache.spark.rdd.RDD$$anonfun$map$1.apply(RDD.scala:371)
at org.apache.spark.rdd.RDD$$anonfun$map$1.apply(RDD.scala:370)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)
at org.apache.spark.rdd.RDD.map(RDD.scala:370)
... 56 elided
Caused by: java.io.NotSerializableException: org.apache.spark.SparkContext
Serialization stack:
- object not serializable (class: org.apache.spark.SparkContext, value: org.apache.spark.SparkContext@4d87e7f3)
- field (class: $iw, name: spark, type: class org.apache.spark.SparkContext)
- object (class $iw, $iw@65af4162)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@7da837af)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@54d0724f)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@389ae8f1)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@55ecf961)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@428c9250)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@d931617)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@2625c1cc)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1231e446)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@27dbe9a3)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@63ad2a0f)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@203f41d7)
- field (class: $line19.$read, name: $iw, type: class $iw)
- object (class $line19.$read, $line19.$read@46a9af36)
- field (class: $iw, name: $line19$read, type: class $line19.$read)
- object (class $iw, $iw@19d118d5)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@5dac488d)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1bba5848)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4f1a6259)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@25712d03)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@750c242e)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@ad038f8)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4ba64e36)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@223f8c82)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@ba1f5d1)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4355f7b6)
- field (class: $line22.$read, name: $iw, type: class $iw)
- object (class $line22.$read, $line22.$read@44535df8)
- field (class: $iw, name: $line22$read, type: class $line22.$read)
- object (class $iw, $iw@32e14e55)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@5a78e7e3)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@28736857)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@16be6b36)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@211e1b51)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1cce2194)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@7b31281b)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@63c9017b)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@e343477)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@3a182eaf)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@131af11d)
- field (class: $line24.$read, name: $iw, type: class $iw)
- object (class $line24.$read, $line24.$read@7cb39309)
- field (class: $iw, name: $line24$read, type: class $line24.$read)
- object (class $iw, $iw@282afe91)
- field (class: $iw, name: $outer, type: class $iw)
- object (class $iw, $iw@33592b53)
- field (class: $anonfun$1, name: $outer, type: class $iw)
- object (class $anonfun$1, <function1>)
at org.apache.spark.serializer.SerializationDebugger$.improveException(SerializationDebugger.scala:40)
at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:46)
at org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:100)
at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:400)
... 65 more
</pre>
I am a newbie so my sentence is not good, so please understand and help me please | 0debug |
VBA - Copy multiple sheets to one single sheet based on the sheet's content : I have an excel workbook which contains more than 50 sheets. I need to copy every sheet that contains "Seasoned Passthrough OAS" and paste it to the sheet whose name is "BC-Summary". How can I achieve this by VBA? Urgent!! Thanks. | 0debug |
it's 2016, why do I still have to use P/Invoke? : <p>I've been out of the programming game for almost 20 years now but every once in a while I write a app with Visual Studio. </p>
<p>My question is, given .NET has been with us for about 13 years, why should I <strong><em>ever</em></strong> have to use the native API aka P/Invoke? Why hasn't everything been converted to official .NET managed assemblies?</p>
<p>Just recently I ran into a situation where I simply want to toggle my Wifi connection on and off without using the mouse. The keyboard is always faster (for me), yet there is no standard Windows keyboard shortcut for it. So great, a very simple C# program for me to write. Imagine my surprise when I found I would have to dip into the native API to this. I remember having to do this in the early days of .NET --sure, a new technology needs a few years to catch up, right? Well now it's 2016. </p>
<p>I suppose I just don't see the big picture. Someone please illuminate me.</p>
| 0debug |
static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len)
{
struct ccw1 ccw = {};
struct cmd_orb orb = {};
struct schib schib;
int r;
stsch_err(schid, &schib);
schib.scsw.ctrl = SCSW_FCTL_START_FUNC;
msch(schid, &schib);
orb.fmt = 1;
orb.cpa = (u32)(long)&ccw;
orb.lpm = 0x80;
ccw.cmd_code = cmd;
ccw.cda = (long)ptr;
ccw.count = len;
r = ssch(schid, &orb);
drain_irqs(schid);
return r;
}
| 1threat |
Calling a javascript function while coding in PHP : <p>I am trying to get a variable from my javascript function while I'm coding in PHP. </p>
<p>my javascript which is included in the page:</p>
<pre><code>function subAmt(empid, subid){
return 4;
}
</code></pre>
<p>my attempt to call that function:</p>
<pre><code>$amt = echo "subAmt(3,5);" ;
</code></pre>
| 0debug |
static int print_block_option_help(const char *filename, const char *fmt)
{
BlockDriver *drv, *proto_drv;
QEMUOptionParameter *create_options = NULL;
drv = bdrv_find_format(fmt);
if (!drv) {
error_report("Unknown file format '%s'", fmt);
return 1;
}
create_options = append_option_parameters(create_options,
drv->create_options);
if (filename) {
proto_drv = bdrv_find_protocol(filename, true);
if (!proto_drv) {
error_report("Unknown protocol '%s'", filename);
return 1;
}
create_options = append_option_parameters(create_options,
proto_drv->create_options);
}
print_option_help(create_options);
return 0;
} | 1threat |
static always_inline void gen_op_subfo (void)
{
gen_op_move_T2_T0();
gen_op_subf();
gen_op_check_subfo();
}
| 1threat |
Python says that elif statement is a Syntax Error : <p>I am new to python, and I have just started to learn from a book that I have recently bought.
I am at the if, elif and else chapter.
I have copied the code from the book, and I ran it.
Suddenly, it says about "elif", that is a Syntax Error.
Please help</p>
<pre class="lang-py prettyprint-override"><code>num = int(input('Please Enter A Number:'))
if num > 5:
print('Number Exceeds 5')
elif num < 5:
print('Number is Less than 5')
else:
print('Number is 5')
</code></pre>
| 0debug |
iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb,
void *opaque)
{
IscsiLun *iscsilun = bs->opaque;
IscsiAIOCB *acb;
acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
trace_iscsi_aio_readv(iscsilun->iscsi, sector_num, nb_sectors, opaque, acb);
acb->nb_sectors = nb_sectors;
acb->sector_num = sector_num;
acb->iscsilun = iscsilun;
acb->qiov = qiov;
acb->retries = ISCSI_CMD_RETRIES;
if (iscsi_aio_readv_acb(acb) != 0) {
qemu_aio_release(acb);
iscsi_set_events(iscsilun);
return &acb->common; | 1threat |
Fatal error running local project with Xampp : Warning: require(C:\app-isw\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\app-isw\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\app-isw\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\app-isw\bootstrap\autoload.php on line 17
Any solution ? , I've update composer and the problem presist. | 0debug |
When using bysort, difference between one or more variables in Stata : When I use the command bysort with just one variable and generate the mean of another variable, I get one set of values e.g. 42,43,39 etc.
Case 1.
bysort date: egen dailymean = mean(temperature)// Gives mean temp for each day
When I use the command bysort with two variables and generate a similar mean, I get a different value e.g. 49,48,51 etc. I want to understand what the values signifiy.
Case 2.
bysort date isCentralPark: egen cpdailymean = mean(temperature)
In the first case, I think I am getting the mean of the temperature by the variable sorted by, date in other words daily mean temperature.
In the second, am I getting the daily mean temperature in Central Park or something different?
| 0debug |
Forms in Angular 2 RC4 : <p>I am experimenting with forms in Angular 2 RC4.
It's all working fine but when I start the app the browser console gives me this message:</p>
<pre><code>*It looks like you're using the old forms module. This will be opt-in in the next RC, and will eventually be removed in favor of the new forms module.
</code></pre>
<p>The relevant part of my component looks like this:</p>
<pre><code>import {
FORM_DIRECTIVES,
REACTIVE_FORM_DIRECTIVES,
FormBuilder,
FormGroup
} from '@angular/forms';
import {Observable} from "rxjs/Rx";
@Component
({
selector: "hh-topbar",
moduleId: module.id,
templateUrl: "topBar.component.html",
directives: [HHPagerComponent, FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES]
})
export class HHTopBarComponent implements OnChanges, OnInit
{
...
private filterForm: FormGroup;
private title$: Observable<string>;
constructor(private formBuilder: FormBuilder)
{
}
public ngOnInit(): any
{
this.filterForm = this.formBuilder.group
({
"title": [this.info.filters.searchFileName]
});
this.title$ = this.filterForm.controls["title"].valueChanges;
this.title$.subscribe(val =>
{
this.info.filters.searchFileName = val;
this.filterChanged.emit(this.info.filters);
});
}
}
</code></pre>
<p>And the relevant part of my template looks like this:</p>
<pre><code><form [formGroup]="filterForm">
<div>
<label for="title">Title</label>
<input [formControl]="filterForm.controls['title']" id="title" />
</div>
</form>
</code></pre>
<p>Does anybody here know what is the new forms module the warning is talking about and which directives will change and to what?</p>
| 0debug |
How to test the availability of asm.js in a web browser? : <p>Imagine I have a asmjs script but before running the script, I'd like to test and see if the browser supports asm.js or not. If it is <code>false</code>, display a message indicating that the browser is old or something like that, otherwise, execute the script.</p>
<p>Can we utilize the idea of <code>"use asm"</code> somehow to detect if a web browser supports asm.js?</p>
<pre><code>function MyAsmModule() {
"use asm";
// module body
}
</code></pre>
| 0debug |
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib in VSCode Terminal : <p>For my case, i only get the error when opening accessing terminal (zsh) via VS Code. </p>
<p>Upon opening VS Code terminal OR running <code>node</code> command, i get this error:</p>
<pre><code>dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
[1] 4506 abort node
</code></pre>
<p>However, it runs fine when running via iTerm. Tried running <code>brew update</code> and <code>brew upgrade</code> and a few other recommended answers.</p>
<p>Anything am i missing?</p>
| 0debug |
bool desc_ring_set_size(DescRing *ring, uint32_t size)
{
int i;
if (size < 2 || size > 0x10000 || (size & (size - 1))) {
DPRINTF("ERROR: ring[%d] size (%d) not a power of 2 "
"or in range [2, 64K]\n", ring->index, size);
return false;
}
for (i = 0; i < ring->size; i++) {
if (ring->info[i].buf) {
g_free(ring->info[i].buf);
}
}
ring->size = size;
ring->head = ring->tail = 0;
ring->info = g_realloc(ring->info, size * sizeof(DescInfo));
if (!ring->info) {
return false;
}
memset(ring->info, 0, size * sizeof(DescInfo));
for (i = 0; i < size; i++) {
ring->info[i].ring = ring;
}
return true;
}
| 1threat |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
Index Seek vs Index Scan in SQL Server : <p>Please explain the difference between Index Scan and Index Seek in MS SQL server with an sample example, since it will be helpful to know, what's the real use of it. Thanks in advance. </p>
| 0debug |
JavaScript: Difference between Reflect.get() and obj['foo'] : <p>Can't understand why I should use <code>Reflect.get(obj, 'foo')</code> instead of <code>obj['foo']</code>, or why the first one is useful as we can do the same thing using the good and old object bracket notation. Can someone please elaborate?</p>
<pre><code>var obj = {foo: 'bar'};
obj['foo'];
Reflect.get(obj, 'foo');
</code></pre>
| 0debug |
static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry *next)
{
char *fact, *value;
av_dlog(NULL, "%s\n", mlsd);
while(fact = av_strtok(mlsd, ";", &mlsd)) {
if (fact[0] == ' ') {
next->name = av_strdup(&fact[1]);
continue;
}
fact = av_strtok(fact, "=", &value);
if (!av_strcasecmp(fact, "type")) {
if (!av_strcasecmp(value, "cdir") || !av_strcasecmp(value, "pdir"))
return 1;
if (!av_strcasecmp(value, "dir"))
next->type = AVIO_ENTRY_DIRECTORY;
else if (!av_strcasecmp(value, "file"))
next->type = AVIO_ENTRY_FILE;
else if (!av_strcasecmp(value, "OS.unix=slink:"))
next->type = AVIO_ENTRY_SYMBOLIC_LINK;
} else if (!av_strcasecmp(fact, "modify")) {
next->modification_timestamp = ftp_parse_date(value);
} else if (!av_strcasecmp(fact, "UNIX.mode")) {
next->filemode = strtoumax(value, NULL, 8);
} else if (!av_strcasecmp(fact, "UNIX.uid") || !av_strcasecmp(fact, "UNIX.owner"))
next->user_id = strtoumax(value, NULL, 10);
else if (!av_strcasecmp(fact, "UNIX.gid") || !av_strcasecmp(fact, "UNIX.group"))
next->group_id = strtoumax(value, NULL, 10);
else if (!av_strcasecmp(fact, "size") || !av_strcasecmp(fact, "sizd"))
next->size = strtoll(value, NULL, 10);
}
return 0;
}
| 1threat |
Level up in java game? How? : I am programming RPG game, and I want that that every time my character reaches 50 XP (50,100,150,200 etc.) he should level one up.
How can I do this?
Thanks for your help! | 0debug |
static int target_to_host_fcntl_cmd(int cmd)
{
switch(cmd) {
case TARGET_F_DUPFD:
case TARGET_F_GETFD:
case TARGET_F_SETFD:
case TARGET_F_GETFL:
case TARGET_F_SETFL:
return cmd;
case TARGET_F_GETLK:
return F_GETLK;
case TARGET_F_SETLK:
return F_SETLK;
case TARGET_F_SETLKW:
return F_SETLKW;
case TARGET_F_GETOWN:
return F_GETOWN;
case TARGET_F_SETOWN:
return F_SETOWN;
case TARGET_F_GETSIG:
return F_GETSIG;
case TARGET_F_SETSIG:
return F_SETSIG;
#if TARGET_ABI_BITS == 32
case TARGET_F_GETLK64:
return F_GETLK64;
case TARGET_F_SETLK64:
return F_SETLK64;
case TARGET_F_SETLKW64:
return F_SETLKW64;
#endif
case TARGET_F_SETLEASE:
return F_SETLEASE;
case TARGET_F_GETLEASE:
return F_GETLEASE;
#ifdef F_DUPFD_CLOEXEC
case TARGET_F_DUPFD_CLOEXEC:
return F_DUPFD_CLOEXEC;
#endif
case TARGET_F_NOTIFY:
return F_NOTIFY;
#ifdef F_GETOWN_EX
case TARGET_F_GETOWN_EX:
return F_GETOWN_EX;
#endif
#ifdef F_SETOWN_EX
case TARGET_F_SETOWN_EX:
return F_SETOWN_EX;
#endif
default:
return -TARGET_EINVAL;
}
return -TARGET_EINVAL;
}
| 1threat |
React-native <Picker /> on android crashes app after render : <p>Here the component:</p>
<pre><code><Picker
selectedValue={'item1'}
onValueChange={(value) => onDismiss(value)}>
<Picker.Item key={'item1'} label={'item1'} value={'item1'} />
<Picker.Item key={'item2'} label={'item2'} value={'item2'} />
<Picker.Item key={'item3'} label={'item3'} value={'item3'} />
</Picker>
</code></pre>
<p>nothing unusual, no additional libraries just RN^0.29.0
Works absolutely fine in debug mode, but if it being rendered in production, app crashes right after render (i see the rendered scene for a moment and then fatal crash).</p>
<p>I'm sure that was not happening some time ago, but rolling back doesn't help. I do not know what have cause this issue or when exactly it appeared.</p>
<p>I've tried to do <code>cd android && ./gradlew clean</code>, i've tried to remove some properties etc - nothing helps.</p>
<p>However, while i was building-rebuilding prod app (<code>react-native run-android --variant=release</code>) about 40 times, it actually worked few times: render ended up succesfully, then i'm leaving the scene with picker, and when i'm trying to get there again (render Picker again, it starts crashing). No idea what it is.
As you see, i've even hardcoded items there, but it doesn't help.</p>
<p>Any guesses? </p>
| 0debug |
how to make responsive screen resolution? : <p>can some one help , i want to make website like youtube for streaming video ,
but i have a problem , i want make 5 div in 1 rom in 1920x1080 , and auto reduced to 4 , 3,2,1 if the screen get smaller </p>
<p>this the picture example</p>
<p><a href="https://i.stack.imgur.com/tdPAl.jpg" rel="nofollow noreferrer">enter image description here</a></p>
<p><a href="https://i.stack.imgur.com/8Ke5R.jpg" rel="nofollow noreferrer">enter image description here</a></p>
<p><a href="https://i.stack.imgur.com/1pPkX.jpg" rel="nofollow noreferrer">enter image description here</a></p>
<p>hope you guys understand :D</p>
| 0debug |
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
MOVStreamContext *sc = st->priv_data;
int entries, i, j;
get_be32(pb);
entries = get_be32(pb);
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return -1;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
return AVERROR(ENOMEM);
sc->drefs_count = entries;
for (i = 0; i < sc->drefs_count; i++) {
MOVDref *dref = &sc->drefs[i];
uint32_t size = get_be32(pb);
int64_t next = url_ftell(pb) + size - 4;
dref->type = get_le32(pb);
get_be32(pb);
dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
if (dref->type == MKTAG('a','l','i','s') && size > 150) {
uint16_t volume_len, len;
char volume[28];
int16_t type;
url_fskip(pb, 10);
volume_len = get_byte(pb);
volume_len = FFMIN(volume_len, 27);
get_buffer(pb, volume, 27);
volume[volume_len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len);
url_fskip(pb, 112);
for (type = 0; type != -1 && url_ftell(pb) < next; ) {
type = get_be16(pb);
len = get_be16(pb);
av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
if (len&1)
len += 1;
if (type == 2) {
av_free(dref->path);
dref->path = av_mallocz(len+1);
if (!dref->path)
return AVERROR(ENOMEM);
get_buffer(pb, dref->path, len);
if (len > volume_len && !strncmp(dref->path, volume, volume_len)) {
len -= volume_len;
memmove(dref->path, dref->path+volume_len, len);
dref->path[len] = 0;
}
for (j = 0; j < len; j++)
if (dref->path[j] == ':')
dref->path[j] = '/';
av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path);
} else
url_fskip(pb, len);
}
}
url_fseek(pb, next, SEEK_SET);
}
return 0;
}
| 1threat |
custom nearbuy places using google places api : <p>I got this from internet. </p>
<pre><code>// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
var map;
var infowindow;
function initMap() {
var pyrmont = {lat: -33.867, lng: 151.195};
map = new google.maps.Map(document.getElementById('map'), {
center: pyrmont,
zoom: 15
});
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: pyrmont,
radius: 500,
type: ['store']
}, callback);
}
function callback(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
}
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
}
</code></pre>
<p>How can I search for custom locations like CVS pharmacies instead stores, withing 5 miles of radius? Also can you provide reference about full set of properties of nearby Search?</p>
| 0debug |
Syntax error in Python 3.6 using ,end"" : <p>My code reads: </p>
<pre><code>print("Please key in a word: ",end" ")
first=input()
print("And now key in another: ",end" ")
second=input()
print("You have typed: "+first+" "+second)
</code></pre>
<p>but I get the result "SyntaxError: invalid syntax" and the ^ pointing to the second " following end. I am using Python 3.6, so the end notation should be correct. I have tried with and without a space between the "" after end. Can anyone see where I'm going wrong?</p>
| 0debug |
How we can set missing data(NA) in R? : <p>I have two sets, training set and test set that there are some values that they are NA, I need a code or a guidance in R language that set values for NA.
Thank you....</p>
| 0debug |
Why doesn't "go get" install the package to GOPATH? : <p>When I use go get command:</p>
<pre><code>sudo go get -u github.com/golang/dep/cmd/dep
</code></pre>
<p>My GOPATH is:</p>
<pre><code>GOPATH="/home/hadoop/gopath"
</code></pre>
<p>and i found go get will create a new directory which named "go" in /home,and the dep package is in it, I want to know why not in GOPATH but to create a new directory?</p>
| 0debug |
How to connect two html elements avoiding other elements : <p>I've this html/css structure: <a href="https://codepen.io/Pestov/pen/BLpgm" rel="noreferrer">Codepen</a></p>
<p>I need to connect two html elements with line when I choose them (clicked on first element and then second element). </p>
<p>I've already tried to draw straight line between them and it's successful. But the problem is, this line should avoid other html elements</p>
<p>I'm choosing two elements like this:</p>
<pre class="lang-js prettyprint-override"><code>let selected;
let count = 0;
$('a').on('click', function(){
selected = $('.selected');
if (!$(this).hasClass('selected') && count !== 2){
count++;
$(this).addClass('selected count' + count);
} else {
$(this).removeClass();
count--;
}
if (count === 2) {
// Here I'll draw line
}
});
</code></pre>
| 0debug |
How to update an HTML table content without refreshing the page? : <p>I have an HTML table that is fetching some data from the database and also a button for deleting selected records .</p>
<p>The table looks like that:</p>
<pre><code>name phone links
john 6562 link1
link2
link3
________________
jim 7682 link1
________________
... ... ....
</code></pre>
<p>The code is something like that :</p>
<pre><code><form method="post" action="#">
<table>
<thead>
<tr>
<th><input type="checkbox"></th>
<th scope="col">Name</th>
<th scope="col">Phone</th>
<th scope="col">Links</th>
</tr>
</thead>
<tbody>
<?php
echo "<tr>";
echo "<th><input type='checkbox'></th>";
echo "<th>".$row['name']."</th>";
echo "<td>".$row['phone']."</td>";
echo "<td>";
echo '<a href=""></a><br/>';
echo "</td>";
echo "</tr>";
?>
</table>
<input type="submit" value="Delete Selected" name="delete"/>
</form>
</code></pre>
<p>Now when I delete any record of the table and the database , I have to refresh the page to see that it's deleted .
What I want is when I click the delete button , The record is deleted and the table is updated with a successful message at the top of the page, Is that possible ?</p>
| 0debug |
Ruby on Rails CRUD and Association example : <p>I am beginner on rails. I want to list Brands-Products list. Brands and products must be association. I dont know what to do. Please suggest me example like this. </p>
| 0debug |
def count_odd(array_nums):
count_odd = len(list(filter(lambda x: (x%2 != 0) , array_nums)))
return count_odd | 0debug |
static void gen_tlbia(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_tlbia(cpu_env);
#endif
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.