problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
static void gen_abs(DisasContext *ctx)
{
int l1 = gen_new_label();
int l2 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l1);
tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
tcg_gen_br(l2);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
gen_set_label(l2);
if (unlikely(Rc(ctx->opcode) != 0))
gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]);
}
| 1threat
|
Display marathi font (Indian rgional labguage) in android app : I have been trying to show marathi font using this [link][1] in my app. But some how its not working for me. It gives no error but does not show any font in text view. I came to know about internationalization concept when I first tried to do this. Can any one please tell me where to look for this for proper guidelines or if any one has an example of same for android, please direct me.
Thanks in advance...!!
[1]: http://stackoverflow.com/questions/9940199/marathi-font-support-for-textview-in-android
| 0debug
|
Using boto to invoke lambda functions how do I do so asynchronously? : <p>SO I'm using boto to invoke my lambda functions and test my backend. I want to invoke them asynchronously. I have noted that "invoke_async" is deprecated and should not be used. Instead you should use "invoke" with an InvocationType of "Event" to do the function asynchronously. </p>
<p>I can't seem to figure out how to get the responses from the functions when they return though. I have tried the following: </p>
<pre><code>payload3=b"""{
"latitude": 39.5732160891,
"longitude": -119.672918997,
"radius": 100
}"""
client = boto3.client('lambda')
for x in range (0, 5):
response = client.invoke(
FunctionName="loadSpotsAroundPoint",
InvocationType='Event',
Payload=payload3
)
time.sleep(15)
print(json.loads(response['Payload'].read()))
print("\n")
</code></pre>
<p>Even though I tell the code to sleep for 15 seconds, the response variable is still empty when I try and print it. If I change the invokation InvokationType to "RequestResponse" it all works fine and response variable prints, but this is synchronous. Am I missing something easy? How do i execute some code, for example print out the result, when the async invokation returns??</p>
<p>Thanks.</p>
| 0debug
|
How to sort object of array values based on property values length : expected result should have keys & values of object ,but when sort with sortBy function, the result will be only values of object. Any help would be appreciated.
------------------------------------------------------------------------
[1]: https://jsfiddle.net/eswar786/k46a7vjq/3/
| 0debug
|
Fatal Exception. App crashes on start : <p>please I am new to android development.I am working on the flag quiz app on ditel's android 6 for programmers. Although I followed the source code meticulously, I don't seem to be able to run the app successfully, as it crashes almost immediately after coming up. This is the exception I am getting. I would appreciate any help that will solve this problem. </p>
<pre><code> FATAL EXCEPTION: main
Process: com.example.israel.flagquiz, PID: 4644
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.israel.flagquiz/com.example.israel.flagquiz.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.example.israel.flagquiz.MainActivityFragment.updateGuessRows(android.content.SharedPreferences)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2521)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.example.israel.flagquiz.MainActivityFragment.updateGuessRows(android.content.SharedPreferences)' on a null object reference
at com.example.israel.flagquiz.MainActivity.onStart(MainActivity.java:62)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1244)
at android.app.Activity.performStart(Activity.java:6140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2478)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
</code></pre>
<p>pertinent code in MainActivity</p>
<pre><code>@Override
protected void onStart(){
super.onStart();
if (preferencesChanged){
MainActivityFragment quizFragment = (MainActivityFragment)
getSupportFragmentManager().findFragmentById(R.id.quizFragment);
quizFragment.updateGuessRows(
PreferenceManager.getDefaultSharedPreferences(this));
quizFragment.updateRegions(
PreferenceManager.getDefaultSharedPreferences(this));
quizFragment.resetQuiz();
preferencesChanged = false;
}
</code></pre>
<p>pertinent code in Main Activity Fragment</p>
<pre><code> public void updateGuessRows(SharedPreferences sharedPreferences){
String choices = new String();
choices = sharedPreferences.getString(MainActivity.CHOICES, null);
guessRows = Integer.parseInt(choices) / 2;
for (LinearLayout layout: guessLinearLayouts)
layout.setVisibility(View.GONE);
for (int row = 0; row < guessRows; row++)
guessLinearLayouts[row].setVisibility(View.VISIBLE);
}
</code></pre>
| 0debug
|
hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *env = &cpu->env;
mmu_ctx_t ctx;
switch (env->mmu_model) {
#if defined(TARGET_PPC64)
case POWERPC_MMU_64B:
case POWERPC_MMU_2_03:
case POWERPC_MMU_2_06:
case POWERPC_MMU_2_07:
return ppc_hash64_get_phys_page_debug(env, addr);
#endif
case POWERPC_MMU_32B:
case POWERPC_MMU_601:
return ppc_hash32_get_phys_page_debug(env, addr);
default:
;
}
if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT) != 0)) {
if (unlikely(get_physical_address(env, &ctx, addr, 0,
ACCESS_CODE) != 0)) {
return -1;
}
}
return ctx.raddr & TARGET_PAGE_MASK;
}
| 1threat
|
Sklearn: ROC for multiclass classification : <p>I'm doing different text classification experiments. Now I need to calculate the AUC-ROC for each task. For the binary classifications, I already made it work with this code:</p>
<pre><code>scaler = StandardScaler(with_mean=False)
enc = LabelEncoder()
y = enc.fit_transform(labels)
feat_sel = SelectKBest(mutual_info_classif, k=200)
clf = linear_model.LogisticRegression()
pipe = Pipeline([('vectorizer', DictVectorizer()),
('scaler', StandardScaler(with_mean=False)),
('mutual_info', feat_sel),
('logistregress', clf)])
y_pred = model_selection.cross_val_predict(pipe, instances, y, cv=10)
# instances is a list of dictionaries
#visualisation ROC-AUC
fpr, tpr, thresholds = roc_curve(y, y_pred)
auc = auc(fpr, tpr)
print('auc =', auc)
plt.figure()
plt.title('Receiver Operating Characteristic')
plt.plot(fpr, tpr, 'b',
label='AUC = %0.2f'% auc)
plt.legend(loc='lower right')
plt.plot([0,1],[0,1],'r--')
plt.xlim([-0.1,1.2])
plt.ylim([-0.1,1.2])
plt.ylabel('True Positive Rate')
plt.xlabel('False Positive Rate')
plt.show()
</code></pre>
<p>But now I need to do it for the multiclass classification task. I read somewhere that I need to binarize the labels, but I really don't get how to calculate ROC for multiclass classification. Tips?</p>
| 0debug
|
Program output is different from manual calculation why is this happening? C language : <pre><code>#include <stdio.h>
#define s scanf
#define p printf
void main (){
int P,I,A;
float T,R;
clrscr();
p("PRINCIPAL: ");
s("%i",&P);
p("RATE: ");
s("%f",&R);
p("TERM: ");
s("%f",&T);
R = R/100;
I = P*R*T;
A = P+I;
p("I: %i\nMA: %i",I,A);
getch();
}
</code></pre>
<p>This really bugs me, if i put PRINCIPAL: 1200 RATE: 3 TERM:1 I: 35 MA: 1235 but if you compute in manually the answer should be I: 36 MA: 1236 the number is decreasing by 1. Why is it happening? why does the answer differ from computer and manual computing?</p>
| 0debug
|
CSS3 - Flipping Cards Issue : I have an issue with the flipping cards, the RotationY causes a white space - sometimes - while resizing the browser.
I am stuck for a couple of days searching but I couldn't find a real pure solution for that.
Please keep in mind that I must keep using percentage for the parent div, I mean the same grid style showing in the Fiddle below.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/OU6TW.png
<div id="card" class="flipped">
<figure class="front">Front</figure>
<figure class="back">Back</figure>
</div>
https://jsfiddle.net/z6znny1q/
| 0debug
|
only show background color when run : when run my first app only show the background color in emulator ;
can you help me please?
Please use simple words because I don't speak good English
08/18 11:05:40: Launching app
$ adb shell am start -n "com.example.myapplicationh81first/com.example.myapplicationh81first.view.activity.BoticActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 21093 on device samsung-sm_a510f-33006d9a1314a263
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
E/Zygote: v2
I/libpersona: KNOX_SDCARD checking this for 10176
KNOX_SDCARD not a persona
E/Zygote: accessInfo : 0
W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0007, [-1 -1 -1 -1 0 1]
I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.example.myapplicationh81first
I/art: Late-enabling -Xcheck:jni
D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
W/ActivityThread: Application com.example.myapplicationh81first can be debugged on port 8100...
W/System: ClassLoader referenced unknown path: /data/app/com.example.myapplicationh81first-1/lib/arm
I/InstantRun: starting instant run server: is main process
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2559)
at void androidx.appcompat.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:63)
at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:794)
at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:739)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:649)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:542)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161)
at void com.example.myapplicationh81first.view.activity.BoticActivity.onCreate(android.os.Bundle) (BoticActivity.java:17)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.myapplicationh81first-1/base.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.myapplicationh81first-1/split_
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2559)
at void androidx.appcompat.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:63)
at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:794)
at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:739)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:649)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:542)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161)
at void com.example.myapplicationh81first.view.activity.BoticActivity.onCreate(android.os.Bundle) (BoticActivity.java:17)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
I/art: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
D/Choreographer: init sf_choreo_doframe debug_Level : 0x4f4cdebug_game_running : false
D/ViewRootImpl@9596aae[BoticActivity]: ThreadedRenderer.create() translucent=false
D/InputTransport: Input channel constructed: fd=70
D/ViewRootImpl@9596aae[BoticActivity]: setView = DecorView@a27a04f[BoticActivity] touchMode=true
D/ViewRootImpl@9596aae[BoticActivity]: dispatchAttachedToWindow
D/ViewRootImpl@9596aae[BoticActivity]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][1080,1920] result=0x27 surface={isValid=true -572297216} surfaceGenerationChanged=true
D/ViewRootImpl@9596aae[BoticActivity]: mHardwareRenderer.initialize() mSurface={isValid=true -572297216} hwInitialized=true
D/libEGL: loaded /vendor/lib/egl/libGLES_mali.so
W/art: Before Android 4.1, method int androidx.appcompat.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
D/ViewRootImpl@9596aae[BoticActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 1920) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 846) or=1
MSG_WINDOW_FOCUS_CHANGED 1
mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true -572297216}
V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@3327c99 nm : com.example.myapplicationh81first ic=null
I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: fd=75
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [1080x1920]-format:1
V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@5cbdb5e nm : com.example.myapplicationh81first ic=null
D/ViewRootImpl@9596aae[BoticActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 1920) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D/ViewRootImpl@9596aae[BoticActivity]: MSG_WINDOW_FOCUS_CHANGED 0
D/ViewRootImpl@9596aae[BoticActivity]: mHardwareRenderer.destroy()#1
D/ViewRootImpl@9596aae[BoticActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
D/InputTransport: Input channel destroyed: fd=75
| 0debug
|
JedisConnectionFactory setHostName is deprecated : <p>This will be my first time connecting Spring to Redis. The documentation for jedis connection factory: <a href="http://www.baeldung.com/spring-data-redis-tutorial" rel="noreferrer">http://www.baeldung.com/spring-data-redis-tutorial</a> </p>
<p>Offers the following code:</p>
<pre><code>@Bean
JedisConnectionFactory jedisConnectionFactory() {
JedisConnectionFactory jedisConFactory
= new JedisConnectionFactory();
jedisConFactory.setHostName("localhost");
jedisConFactory.setPort(6379);
return jedisConFactory;
}
</code></pre>
<p>Looks great, but my IDE is telling me that the setHostName and setPort methods have been deprecated (even though I'm using the versions from the tutorial).</p>
<p>I was wondering if anyone had a simple "get spring data connected to redis" example that uses the non-deprecated API calls?</p>
| 0debug
|
Elasticsearch show all results using scroll in node js : <p>I am basically trying to show all records of an index type. Now, if you use match_all() in query elasticsearch shows 10 results by default. One can show all results using scroll. I am trying to implement scroll api, but can't get it to work. It is showing only 10 results, my code:</p>
<pre><code>module.exports.searchAll = function (searchData, callback) {
client.search({
index: 'test',
type: 'records',
scroll: '10s',
//search_type: 'scan', //if I use search_type then it requires size otherwise it shows 0 result
body: {
query: {
"match_all": {}
}
}
}, function (err, resp) {
client.scroll({
scrollId: resp._scroll_id,
scroll: '10s'
}, callback(resp.hits.hits));
});
}
</code></pre>
<p>Can anyone help, please?</p>
| 0debug
|
A regex to match anything 2 digits and above : <p>The title is self explanatory. I need help with getting a regex that will match anything 2 digits and above thanks </p>
| 0debug
|
static int send_sub_rect_solid(VncState *vs, int x, int y, int w, int h)
{
vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_TIGHT);
vnc_tight_start(vs);
vnc_raw_send_framebuffer_update(vs, x, y, w, h);
vnc_tight_stop(vs);
return send_solid_rect(vs);
}
| 1threat
|
How to get proper url rewriting with proper ReWriting Rule in localhost? : **My .htaccess file as below,**
DirectoryIndex routing.php
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+Milan_Practice/Milan_Mvc/routing\.php[\s?] [NC]
RewriteRule ^ Milan_Practice/Milan_Mvc/ [L,R=302]
RewriteRule ^Milan_Mvc/?$ Milan_Mvc/routing.php [L,NC]
**By Appling above code I got url like below,**
http://localhost/Milan_Practice/Milan_Mvc/?name=about
**in above,there after "?",data is not in valid format as I want like this,**
http://localhost/Milan_Practice/Milan_Mvc/about/
**So please give your suggestion with proper ReWriting Rule for above code**
*ThankYou in Advance !!!*
| 0debug
|
static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf,
size_t len)
{
SCLPConsole *scon = SCLP_CONSOLE(event);
if (!scon->chr) {
return len;
}
return qemu_chr_fe_write_all(scon->chr, buf, len);
}
| 1threat
|
void migration_fd_process_incoming(QEMUFile *f)
{
Coroutine *co = qemu_coroutine_create(process_incoming_migration_co);
migrate_decompress_threads_create();
qemu_file_set_blocking(f, false);
qemu_coroutine_enter(co, f);
}
| 1threat
|
static void hScale_altivec_real(SwsContext *c, int16_t *dst, int dstW,
const uint8_t *src, const int16_t *filter,
const int16_t *filterPos, int filterSize)
{
register int i;
DECLARE_ALIGNED(16, int, tempo)[4];
if (filterSize % 4) {
for (i = 0; i < dstW; i++) {
register int j;
register int srcPos = filterPos[i];
register int val = 0;
for (j = 0; j < filterSize; j++)
val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
dst[i] = FFMIN(val >> 7, (1 << 15) - 1);
}
} else
switch (filterSize) {
case 4:
for (i = 0; i < dstW; i++) {
register int srcPos = filterPos[i];
vector unsigned char src_v0 = vec_ld(srcPos, src);
vector unsigned char src_v1, src_vF;
vector signed short src_v, filter_v;
vector signed int val_vEven, val_s;
if ((((uintptr_t)src + srcPos) % 16) > 12) {
src_v1 = vec_ld(srcPos + 16, src);
}
src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
src_v =
(vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
src_v = vec_mergeh(src_v, (vector signed short)vzero);
filter_v = vec_ld(i << 3, filter);
if ((i << 3) % 16)
filter_v = vec_mergel(filter_v, (vector signed short)vzero);
else
filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
val_vEven = vec_mule(src_v, filter_v);
val_s = vec_sums(val_vEven, vzero);
vec_st(val_s, 0, tempo);
dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
}
break;
case 8:
for (i = 0; i < dstW; i++) {
register int srcPos = filterPos[i];
vector unsigned char src_v0 = vec_ld(srcPos, src);
vector unsigned char src_v1, src_vF;
vector signed short src_v, filter_v;
vector signed int val_v, val_s;
if ((((uintptr_t)src + srcPos) % 16) > 8) {
src_v1 = vec_ld(srcPos + 16, src);
}
src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
src_v =
(vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
filter_v = vec_ld(i << 4, filter);
val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo);
dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
}
break;
case 16:
for (i = 0; i < dstW; i++) {
register int srcPos = filterPos[i];
vector unsigned char src_v0 = vec_ld(srcPos, src);
vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
vector signed short src_vA =
(vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
vector signed short src_vB =
(vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
vector signed short filter_v0 = vec_ld(i << 5, filter);
vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
vector signed int val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo);
dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
}
break;
default:
for (i = 0; i < dstW; i++) {
register int j;
register int srcPos = filterPos[i];
vector signed int val_s, val_v = (vector signed int)vzero;
vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
vector unsigned char src_v0 = vec_ld(srcPos, src);
vector unsigned char permS = vec_lvsl(srcPos, src);
for (j = 0; j < filterSize - 15; j += 16) {
vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
vector signed short src_vA =
(vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
vector signed short src_vB =
(vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF);
vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF);
vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
val_v = vec_msums(src_vB, filter_v1, val_acc);
filter_v0R = filter_v2R;
src_v0 = src_v1;
}
if (j < filterSize - 7) {
vector unsigned char src_v1, src_vF;
vector signed short src_v, filter_v1R, filter_v;
if ((((uintptr_t)src + srcPos) % 16) > 8) {
src_v1 = vec_ld(srcPos + j + 16, src);
}
src_vF = vec_perm(src_v0, src_v1, permS);
src_v =
(vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
filter_v = vec_perm(filter_v0R, filter_v1R, permF);
val_v = vec_msums(src_v, filter_v, val_v);
}
val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo);
dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
}
}
}
| 1threat
|
Cannot install uwsgi on Alpine : <p>I'm trying to install uwsgi using <code>pip install uwsgi</code> in my Alpine docker image but unfortunately it keeps failing weird no real error message to me:</p>
<pre><code>Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mEZegv/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c7XA_e-record/install-record.txt --single-version-externally-managed --compile:
running install
using profile: buildconf/default.ini
detected include path: ['/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
Patching "bin_name" to properly install_scripts dir
detected CPU cores: 1
configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION="\"2.0.12\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="12" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"core/utils.c: In function 'uwsgi_as_root':
core/utils.c:344:7: error: implicit declaration of function 'unshare' [-Werror=implicit-function-declaration]
if (unshare(uwsgi.unshare)) {
^
core/utils.c:564:5: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
sigfillset(&smask);
^
core/utils.c:565:5: error: implicit declaration of function 'sigprocmask' [-Werror=implicit-function-declaration]
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: error: 'SIG_BLOCK' undeclared (first use in this function)
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: note: each undeclared identifier is reported only once for each function it appears in
core/utils.c:586:7: error: implicit declaration of function 'chroot' [-Werror=implicit-function-declaration]
if (chroot(uwsgi.chroot)) {
^
core/utils.c:791:5: error: unknown type name 'ushort'
ushort *array;
^
core/utils.c:833:8: error: implicit declaration of function 'setgroups' [-Werror=implicit-function-declaration]
if (setgroups(0, NULL)) {
^
core/utils.c:848:8: error: implicit declaration of function 'initgroups' [-Werror=implicit-function-declaration]
if (initgroups(uidname, uwsgi.gid)) {
^
core/utils.c: In function 'uwsgi_close_request':
core/utils.c:1145:18: error: 'WAIT_ANY' undeclared (first use in this function)
while (waitpid(WAIT_ANY, &waitpid_status, WNOHANG) > 0);
^
core/utils.c: In function 'uwsgi_resolve_ip':
core/utils.c:1802:7: error: implicit declaration of function 'gethostbyname' [-Werror=implicit-function-declaration]
he = gethostbyname(domain);
^
core/utils.c:1802:5: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
he = gethostbyname(domain);
^
core/utils.c: In function 'uwsgi_unix_signal':
core/utils.c:1936:19: error: storage size of 'sa' isn't known
struct sigaction sa;
^
core/utils.c:1938:24: error: invalid application of 'sizeof' to incomplete type 'struct sigaction'
memset(&sa, 0, sizeof(struct sigaction));
^
core/utils.c:1942:2: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
sigemptyset(&sa.sa_mask);
^
core/utils.c:1944:6: error: implicit declaration of function 'sigaction' [-Werror=implicit-function-declaration]
if (sigaction(signum, &sa, NULL) < 0) {
^
core/utils.c:1936:19: error: unused variable 'sa' [-Werror=unused-variable]
struct sigaction sa;
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_list_has_num':
./uwsgi.h:140:47: error: implicit declaration of function 'strtok_r' [-Werror=implicit-function-declaration]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_list_has_str':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
core/utils.c:1969:8: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]
if (!strcasecmp(p, str)) {
^
core/utils.c: In function 'uwsgi_sig_pause':
core/utils.c:2361:2: error: implicit declaration of function 'sigsuspend' [-Werror=implicit-function-declaration]
sigsuspend(&mask);
^
core/utils.c: In function 'uwsgi_run_command_putenv_and_wait':
core/utils.c:2453:7: error: implicit declaration of function 'putenv' [-Werror=implicit-function-declaration]
if (putenv(envs[i])) {
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_build_unshare':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_tmpfd':
core/utils.c:3533:7: error: implicit declaration of function 'mkstemp' [-Werror=implicit-function-declaration]
fd = mkstemp(template);
^
core/utils.c: In function 'uwsgi_expand_path':
core/utils.c:3615:7: error: implicit declaration of function 'realpath' [-Werror=implicit-function-declaration]
if (!realpath(src, dst)) {
^
core/utils.c: In function 'uwsgi_set_cpu_affinity':
core/utils.c:3641:3: error: unknown type name 'cpu_set_t'
cpu_set_t cpuset;
^
core/utils.c:3646:3: error: implicit declaration of function 'CPU_ZERO' [-Werror=implicit-function-declaration]
CPU_ZERO(&cpuset);
^
core/utils.c:3651:4: error: implicit declaration of function 'CPU_SET' [-Werror=implicit-function-declaration]
CPU_SET(base_cpu, &cpuset);
^
core/utils.c:3662:7: error: implicit declaration of function 'sched_setaffinity' [-Werror=implicit-function-declaration]
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c:3662:35: error: 'cpu_set_t' undeclared (first use in this function)
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c: In function 'uwsgi_thread_run':
core/utils.c:3782:2: error: implicit declaration of function 'pthread_sigmask' [-Werror=implicit-function-declaration]
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:3782:18: error: 'SIG_BLOCK' undeclared (first use in this function)
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c: In function 'uwsgi_envdir':
core/utils.c:4349:8: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
if (unsetenv(de->d_name)) {
^
core/utils.c:4380:7: error: implicit declaration of function 'setenv' [-Werror=implicit-function-declaration]
if (setenv(de->d_name, content, 1)) {
^
cc1: all warnings being treated as errors
*** uWSGI compiling server core ***
</code></pre>
<p>Any idea what could cause this? I'm installing the following dependencies beforehand:</p>
<pre><code>RUN apk --update add \
bash \
python \
python-dev \
py-pip \
gcc \
zlib-dev \
git \
linux-headers \
build-base \
musl \
musl-dev \
memcached \
libmemcached-dev
</code></pre>
| 0debug
|
document.getElementById('input').innerHTML = user_input;
| 1threat
|
Python - Copy dimension of array in another dimension of the same array (from 2D array to 3D array) : <p>I have a numpy array in the following format</p>
<pre><code>(1440, 40)
</code></pre>
<p>How can I copy the first dimension in the second transforming it in the following 3D array?</p>
<pre><code>(1440, 1440, 40)
</code></pre>
| 0debug
|
Read all Parquet files saved in a folder via Spark : <p>I have a folder containing Parquet files. Something like this:</p>
<pre><code>scala> val df = sc.parallelize(List(1,2,3,4)).toDF()
df: org.apache.spark.sql.DataFrame = [value: int]
scala> df.write.parquet("/tmp/test/df/1.parquet")
scala> val df = sc.parallelize(List(5,6,7,8)).toDF()
df: org.apache.spark.sql.DataFrame = [value: int]
scala> df.write.parquet("/tmp/test/df/2.parquet")
</code></pre>
<p>After saving dataframes when I go to read all parquet files in <code>df</code> folder, it gives me error.</p>
<pre><code>scala> val read = spark.read.parquet("/tmp/test/df")
org.apache.spark.sql.AnalysisException: Unable to infer schema for Parquet. It must be specified manually.;
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$8.apply(DataSource.scala:189)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$8.apply(DataSource.scala:189)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.sql.execution.datasources.DataSource.org$apache$spark$sql$execution$datasources$DataSource$$getOrInferFileFormatSchema(DataSource.scala:188)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:387)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:152)
at org.apache.spark.sql.DataFrameReader.parquet(DataFrameReader.scala:441)
at org.apache.spark.sql.DataFrameReader.parquet(DataFrameReader.scala:425)
... 48 elided
</code></pre>
<p>I know I can read Parquet files by giving full path, but it would be better if there is a way to read all parquet files in a folder.</p>
| 0debug
|
bool hpet_find(void)
{
return object_resolve_path_type("", TYPE_HPET, NULL);
}
| 1threat
|
QEMUClock *qemu_clock_ptr(QEMUClockType type)
{
return &qemu_clocks[type];
}
| 1threat
|
Using Cordova and XCode 8, how can I run iOS build with Push Notification capabilities? : <p>I'm using Ionic/Cordova to build an Android and iOS app. Before deployments, I use Jenkins to run 'ionic build ios --device' to create a final IPA file for QA to test against. Unfortunately, using xCode 8 you now have to manually enable the Push Notification capability in the XCode project capabilities settings.</p>
<p>Is there a way to pass capabilities to <code>ionic build</code> or <code>cordova build</code> so that push notifications will be enabled when building via CLI?</p>
| 0debug
|
static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
int *got_frame_ptr, GetBitContext *gb, AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
ChannelElement *che = NULL, *che_prev = NULL;
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
int err, elem_id;
int samples = 0, multiplier, audio_found = 0, pce_found = 0;
int is_dmono, sce_count = 0;
ac->frame = data;
if (show_bits(gb, 12) == 0xfff) {
if (parse_adts_frame_header(ac, gb) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
err = -1;
goto fail;
}
if (ac->oc[1].m4ac.sampling_index > 12) {
av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index);
err = -1;
goto fail;
}
}
if (frame_configure_elements(avctx) < 0) {
err = -1;
goto fail;
}
ac->tags_mapped = 0;
while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
elem_id = get_bits(gb, 4);
if (elem_type < TYPE_DSE) {
if (!(che=get_che(ac, elem_type, elem_id))) {
av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
elem_type, elem_id);
err = -1;
goto fail;
}
samples = 1024;
}
switch (elem_type) {
case TYPE_SCE:
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
audio_found = 1;
sce_count++;
break;
case TYPE_CPE:
err = decode_cpe(ac, gb, che);
audio_found = 1;
break;
case TYPE_CCE:
err = decode_cce(ac, gb, che);
break;
case TYPE_LFE:
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
audio_found = 1;
break;
case TYPE_DSE:
err = skip_data_stream_element(ac, gb);
break;
case TYPE_PCE: {
uint8_t layout_map[MAX_ELEM_ID*4][3];
int tags;
push_output_configuration(ac);
tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb);
if (tags < 0) {
err = tags;
break;
}
if (pce_found) {
av_log(avctx, AV_LOG_ERROR,
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
pop_output_configuration(ac);
} else {
err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE, 1);
if (!err)
ac->oc[1].m4ac.chan_config = 0;
pce_found = 1;
}
break;
}
case TYPE_FIL:
if (elem_id == 15)
elem_id += get_bits(gb, 8) - 1;
if (get_bits_left(gb) < 8 * elem_id) {
av_log(avctx, AV_LOG_ERROR, "TYPE_FIL: "overread_err);
err = -1;
goto fail;
}
while (elem_id > 0)
elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev);
err = 0;
break;
default:
err = -1;
break;
}
che_prev = che;
elem_type_prev = elem_type;
if (err)
goto fail;
if (get_bits_left(gb) < 3) {
av_log(avctx, AV_LOG_ERROR, overread_err);
err = -1;
goto fail;
}
}
spectral_to_sample(ac);
multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
samples <<= multiplier;
is_dmono = ac->dmono_mode && sce_count == 2 &&
ac->oc[1].channel_layout == (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT);
if (samples)
ac->frame->nb_samples = samples;
*got_frame_ptr = !!samples;
if (is_dmono) {
if (ac->dmono_mode == 1)
((AVFrame *)data)->data[1] =((AVFrame *)data)->data[0];
else if (ac->dmono_mode == 2)
((AVFrame *)data)->data[0] =((AVFrame *)data)->data[1];
}
if (ac->oc[1].status && audio_found) {
avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
avctx->frame_size = samples;
ac->oc[1].status = OC_LOCKED;
}
if (multiplier) {
int side_size;
uint32_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
if (side && side_size>=4)
AV_WL32(side, 2*AV_RL32(side));
}
return 0;
fail:
pop_output_configuration(ac);
return err;
}
| 1threat
|
START_TEST(unterminated_array_comma)
{
QObject *obj = qobject_from_json("[32,");
fail_unless(obj == NULL);
}
| 1threat
|
issue in declaring variable for parameter : in my sql vesrion community-8.0.11.0:
getting error when declaring the variable in this below code.Could anyone help me please.
use `mydb`;
Delimiter //
declare V_id char(30);
set V_id = 'AM-439';
select * from tableA
where TableID= V_id;
Delimiter;
| 0debug
|
How can i transplant from activity to fragment? : Now i'm trying to transparent opensource expandable layout but the problem is that source made by activity but i want to apply my fragment layout
what should i do?
When i try to Transplant it's occured error...
****This is what i want to try transparent****
package com.expandablelistdemo;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ExpandableListView;
import com.expandablelistdemo.Model.DataItem;
import com.expandablelistdemo.Model.SubCategoryItem;
import java.util.ArrayList;
import java.util.HashMap;
public class MainActivity extends AppCompatActivity {
private Button btn;
private ExpandableListView lvCategory;
private ArrayList<DataItem> arCategory;
private ArrayList<SubCategoryItem> arSubCategory;
private ArrayList<ArrayList<SubCategoryItem>> arSubCategoryFinal;
private ArrayList<HashMap<String, String>> parentItems;
private ArrayList<ArrayList<HashMap<String, String>>> childItems;
private MyCategoriesExpandableListAdapter myCategoriesExpandableListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,CheckedActivity.class);
startActivity(intent);
}
});
setupReferences();
}
private void setupReferences() {
lvCategory = findViewById(R.id.lvCategory);
arCategory = new ArrayList<>();
arSubCategory = new ArrayList<>();
parentItems = new ArrayList<>();
childItems = new ArrayList<>();
DataItem dataItem = new DataItem();
dataItem.setCategoryId("1");
dataItem.setCategoryName("Adventure");
arSubCategory = new ArrayList<>();
for(int i = 1; i < 6; i++) {
SubCategoryItem subCategoryItem = new SubCategoryItem();
subCategoryItem.setCategoryId(String.valueOf(i));
subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE);
subCategoryItem.setSubCategoryName("Adventure: "+i);
arSubCategory.add(subCategoryItem);
}
dataItem.setSubCategory(arSubCategory);
arCategory.add(dataItem);
dataItem = new DataItem();
dataItem.setCategoryId("2");
dataItem.setCategoryName("Art");
arSubCategory = new ArrayList<>();
for(int j = 1; j < 6; j++) {
SubCategoryItem subCategoryItem = new SubCategoryItem();
subCategoryItem.setCategoryId(String.valueOf(j));
subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE);
subCategoryItem.setSubCategoryName("Art: "+j);
arSubCategory.add(subCategoryItem);
}
dataItem.setSubCategory(arSubCategory);
arCategory.add(dataItem);
dataItem = new DataItem();
dataItem.setCategoryId("3");
dataItem.setCategoryName("Cooking");
arSubCategory = new ArrayList<>();
for(int k = 1; k < 6; k++) {
SubCategoryItem subCategoryItem = new SubCategoryItem();
subCategoryItem.setCategoryId(String.valueOf(k));
subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE);
subCategoryItem.setSubCategoryName("Cooking: "+k);
arSubCategory.add(subCategoryItem);
}
dataItem.setSubCategory(arSubCategory);
arCategory.add(dataItem);
Log.d("TAG", "setupReferences: "+arCategory.size());
for(DataItem data : arCategory){
// Log.i("Item id",item.id);
ArrayList<HashMap<String, String>> childArrayList =new ArrayList<HashMap<String, String>>();
HashMap<String, String> mapParent = new HashMap<String, String>();
mapParent.put(ConstantManager.Parameter.CATEGORY_ID,data.getCategoryId());
mapParent.put(ConstantManager.Parameter.CATEGORY_NAME,data.getCategoryName());
int countIsChecked = 0;
for(SubCategoryItem subCategoryItem : data.getSubCategory()) {
HashMap<String, String> mapChild = new HashMap<String, String>();
mapChild.put(ConstantManager.Parameter.SUB_ID,subCategoryItem.getSubId());
mapChild.put(ConstantManager.Parameter.SUB_CATEGORY_NAME,subCategoryItem.getSubCategoryName());
mapChild.put(ConstantManager.Parameter.CATEGORY_ID,subCategoryItem.getCategoryId());
mapChild.put(ConstantManager.Parameter.IS_CHECKED,subCategoryItem.getIsChecked());
if(subCategoryItem.getIsChecked().equalsIgnoreCase(ConstantManager.CHECK_BOX_CHECKED_TRUE)) {
countIsChecked++;
}
childArrayList.add(mapChild);
}
if(countIsChecked == data.getSubCategory().size()) {
data.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_TRUE);
}else {
data.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE);
}
mapParent.put(ConstantManager.Parameter.IS_CHECKED,data.getIsChecked());
childItems.add(childArrayList);
parentItems.add(mapParent);
}
ConstantManager.parentItems = parentItems;
ConstantManager.childItems = childItems;
myCategoriesExpandableListAdapter = new MyCategoriesExpandableListAdapter(this,parentItems,childItems,false);
lvCategory.setAdapter(myCategoriesExpandableListAdapter);
}
}
**** This is my Fragment Activity ****
public class TabFragment1 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.tab_fragment_1, container, false);
}
}
I'm trying to several days but i can't find how to do...
| 0debug
|
convert hours into minutes in jquery : I want to convert the hours into minutes
example : hour is 2:18 then i want the output as 138minutes
<script>
m = diff % 60;
h = (diff-m)/60;
mins= h.toString() + ":" + (m<10?"0":"") + m.toString();
alert(mins)
</script>
| 0debug
|
static inline void menelaus_rtc_start(MenelausState *s)
{
s->rtc.next += qemu_get_clock(rt_clock);
qemu_mod_timer(s->rtc.hz_tm, s->rtc.next);
}
| 1threat
|
C#, using a delegate function in a dictionary, code optimization public vs protected : Hi there I'm currrently trying to optimize some code. As I'm still new to coding I try to use this oppurtunity to learn new "complicated" features. So now I'm stuck with delegate functions and lambda operators and don't know how to use them properly. My goal is to have a class which has one static Dictionary in which all values for different types of enemies I want for my game are stored. My current code probably works(didn't test it yet) but I don't fully understand it...
public class EnemyTypes {
private class TypeValues
{
public delegate void Func(Transform Entity);//just used for handing over values on initialization, somehow has to be public
private string Name; //the Name of an EnemyType, NOT the name of a specific entity
private float BaseSpeed; //actual speed of each enemy is randomly set within (BaseSpeed +/- SpeedTolerance) everytime it respawns
private float SpeedTolerance;
private Func Animate;
public TypeValues(string Name, float BaseSpeed, float SpeedTolerance, Func Animate) //constructor apparently needs to be public too?
{
this.Name = Name;
this.BaseSpeed = BaseSpeed;
this.SpeedTolerance = SpeedTolerance;
this.Animate = Animate;
}
}
[SerializeField]
private static Dictionary<int, TypeValues> Types = new Dictionary<int, TypeValues>
{
{1, new TypeValues("Standard", 1f, 0.5f, Entity => Entity.Rotate(new Vector3(0, 5, 0)))}
};
}
As you can read form the comments I don't understand why the delegate and the constructor have to have the same access modifier. And why can't it be protected? Also is there a way to get rid of Func and define the delegate directly when creating the ANimate variable?
I feel kinda dumb...please help ^^
Also excuse my bad english and some capital letters that may have found their way into my question...
| 0debug
|
How to reset Observable.interval : <p>How can I construct an observable which emits at some predetermined interval, but also can be made to emit when a second observable emits, at which point the interval will be "reset" to start emitting again at the original interval starting from the point of the second ping?</p>
<p>For example, let's say the interval is 10 minutes. The observable would emit at 10, 20, 30, etc. But let's say the second observable at emits at time 15. Then the overall observable should ping at 10, 15, 25, 35, etc.</p>
| 0debug
|
Use cases for functor/applicative/monad instances for functions : <p>Haskell has <code>Functor</code>, <code>Applicative</code> and <code>Monad</code> instances defined for functions (specifically the partially applied type <code>(->) a</code>) in the standard library, built around function composition.</p>
<p>Understanding these instances is a nice mind-bender exercise, but my question here is about the practical uses of these instances. I'd be happy to hear about realistic scenarios where folks used these for some practical code.</p>
| 0debug
|
How to convert build file .exe format in .scr? : <p>I have a build output in .exe format How can I save more and .scr?
Many times I saw people collected in their assemblies .bat format .scr, e.t.c</p>
| 0debug
|
How to write an SQL query to update a table based of a result in another table : I have 2 different tables in my datbase and cant find any refrence on how to use a reuslt to update a part of a table.
Here is my scenario
Table: MenuItems
╔════╦══════════════╦
║ id ║ Name ║
╠════╬══════════════╬
║ 1 ║ test ║
║ 2 ║ test2 ║
╚════╩══════════════╩
Table: MenuItemPrices
╔════╦══════════════╦
║ id ║ Price ║
╠════╬══════════════╬
║ 1 ║ 3.50 ║
║ 2 ║ 4.50 ║
╚════╩══════════════╩
Say I want to update test2 price to 5.00, what would be the query I need?
| 0debug
|
Can't access protected int variable of the pointer Parent class : <p>I have a question about protected variables. Maybe i didn't really understand them but isnt the reason to use them, that child classes can use them? Overall i want to decrease the lifepoints.</p>
<p>Here is my code:
Header file</p>
<pre><code>class Fighter {
protected:
int offensePoints;
int defensePoints;
int lifepoints;
std::string name;
public:
Fighter(const std::string n);
virtual ~Fighter();
virtual void attackFighter(Fighter * f);
int randomval(int min, int max);
bool isalive();
void isattacked(Fighter * at, int dmg);
};
class Warrior : public Fighter
{
public:
Warrior(const std::string n);
virtual ~Warrior();
void attackFighter(Fighter * f);
int randomval(int min, int max);
bool isalive();
void isattacked(Fighter * at, int dmg);
};
</code></pre>
<p>Class Fighter:</p>
<pre><code>void Fighter::attackFighter(Fighter * f)
{
if (isalive())
{
f->lifepoints -= randomval(0, offensePoints);
}
}
</code></pre>
<p>Class Warrior</p>
<pre><code>void Warrior::attackFighter(Fighter * f)
{
if (isalive())
{
f->lifepoints -= randomval(0, offensePoints);
}
}
</code></pre>
| 0debug
|
How to program an <ul> image gallery, where the hover effect impacts more than 1 element? : <p>I'd like to program an image gallery, which looks like this one:
<a href="http://www.volkswagen.de/de.html" rel="nofollow">http://www.volkswagen.de/de.html</a>
By default, all buttons have the same size. </p>
<p>When the user hovers over the button, its size increases, meanwhile, all other buttons (aside from the one on the left and right of the button which the user hovers overs) are shrunk.</p>
<p>I assume that it's a mix of CSS and Javascript, but I can't figure out how it works, especially given how the buttons move left and right depending on what's being hovered over.</p>
<p>Could someone please help me?</p>
| 0debug
|
How to Trace CMakeLists.txt : <p>Is there a way to examine what <code>cmake</code> is doing in a failing run? For example, I have a program depending on libbacktrace, which I can link to by <code>gcc foo.c -lbacktrace</code>. But when I write a <code>CMakeLists.txt</code> like</p>
<pre><code>cmake_minimum_required(VERSION 2.8)
find_library (BACKTRACE_LIBRARY backtrace)
message (BACKTRACE_LIBRARY=${BACKTRACE_LIBRARY})
</code></pre>
<p>and type <code>cmake <path></code>, it prints out <code>BACKTRACE_LIBRARY=BACKTRACE_LIBRARY-NOTFOUND</code>.</p>
<p>How do I go about figuring out where the problem is? What commands is <code>cmake</code> executing before giving up on finding libbacktrace? Is it executing anything at all? In autoconf, the commands are all recorded in <code>config.log</code>, but <code>CMakeOutput.log</code> in this case is blank. Likewise, <code>cmake --trace</code> only echoes the contents of <code>CMakeLists.txt</code> after a bunch of system cmake files, which is useless in this case.</p>
<p>Please note that I'm not looking for a way to make this particular invocation of <code>find_library</code> work - that's just an example. My question is: I have a CMakeLists.txt that isn't working as expected; what tools exist to help me figure out where and why it's failing?</p>
| 0debug
|
static int xmv_read_header(AVFormatContext *s)
{
XMVDemuxContext *xmv = s->priv_data;
AVIOContext *pb = s->pb;
AVStream *vst = NULL;
uint32_t file_version;
uint32_t this_packet_size;
uint16_t audio_track;
int ret;
avio_skip(pb, 4);
this_packet_size = avio_rl32(pb);
avio_skip(pb, 4);
avio_skip(pb, 4);
file_version = avio_rl32(pb);
if ((file_version != 4) && (file_version != 2))
avpriv_request_sample(s, "Uncommon version %d", file_version);
vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
avpriv_set_pts_info(vst, 32, 1, 1000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = AV_CODEC_ID_WMV2;
vst->codec->codec_tag = MKBETAG('W', 'M', 'V', '2');
vst->codec->width = avio_rl32(pb);
vst->codec->height = avio_rl32(pb);
vst->duration = avio_rl32(pb);
xmv->video.stream_index = vst->index;
xmv->audio_track_count = avio_rl16(pb);
avio_skip(pb, 2);
xmv->audio_tracks = av_malloc(xmv->audio_track_count * sizeof(XMVAudioTrack));
if (!xmv->audio_tracks)
return AVERROR(ENOMEM);
xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket));
if (!xmv->audio)
return AVERROR(ENOMEM);
for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
XMVAudioTrack *track = &xmv->audio_tracks[audio_track];
XMVAudioPacket *packet = &xmv->audio [audio_track];
AVStream *ast = NULL;
track->compression = avio_rl16(pb);
track->channels = avio_rl16(pb);
track->sample_rate = avio_rl32(pb);
track->bits_per_sample = avio_rl16(pb);
track->flags = avio_rl16(pb);
track->bit_rate = track->bits_per_sample *
track->sample_rate *
track->channels;
track->block_align = 36 * track->channels;
track->block_samples = 64;
track->codec_id = ff_wav_codec_get_id(track->compression,
track->bits_per_sample);
packet->track = track;
packet->stream_index = -1;
packet->frame_size = 0;
packet->block_count = 0;
if (track->flags & XMV_AUDIO_ADPCM51)
av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
"(0x%04X)\n", track->flags);
if (!track->channels || !track->sample_rate) {
av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %d.\n",
audio_track);
ret = AVERROR_INVALIDDATA;
goto fail;
}
ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = track->codec_id;
ast->codec->codec_tag = track->compression;
ast->codec->channels = track->channels;
ast->codec->sample_rate = track->sample_rate;
ast->codec->bits_per_coded_sample = track->bits_per_sample;
ast->codec->bit_rate = track->bit_rate;
ast->codec->block_align = 36 * track->channels;
avpriv_set_pts_info(ast, 32, track->block_samples, track->sample_rate);
packet->stream_index = ast->index;
ast->duration = vst->duration;
}
xmv->next_packet_offset = avio_tell(pb);
xmv->next_packet_size = this_packet_size - xmv->next_packet_offset;
xmv->stream_count = xmv->audio_track_count + 1;
return 0;
fail:
xmv_read_close(s);
return ret;
}
| 1threat
|
static int flashsv2_prime(FlashSVContext *s, uint8_t *src,
int size, int unp_size)
{
z_stream zs;
int zret;
zs.zalloc = NULL;
zs.zfree = NULL;
zs.opaque = NULL;
s->zstream.next_in = src;
s->zstream.avail_in = size;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
inflate(&s->zstream, Z_SYNC_FLUSH);
deflateInit(&zs, 0);
zs.next_in = s->tmpblock;
zs.avail_in = s->block_size * 3 - s->zstream.avail_out;
zs.next_out = s->deflate_block;
zs.avail_out = s->deflate_block_size;
deflate(&zs, Z_SYNC_FLUSH);
deflateEnd(&zs);
if ((zret = inflateReset(&s->zstream)) != Z_OK) {
av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
return AVERROR_UNKNOWN;
}
s->zstream.next_in = s->deflate_block;
s->zstream.avail_in = s->deflate_block_size - zs.avail_out;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
inflate(&s->zstream, Z_SYNC_FLUSH);
return 0;
}
| 1threat
|
How make Licence Key for Mac Address to protect my php application : <p>I am developing hotspot system using php language ,
and now I want to sell this system but how can I protect my system from be re selling by the buyer and I want to make sure that the license key is used by the right machine with right mac address ,that mean the license key can not be used more than one time.
how can I do that , I don't have any idea </p>
| 0debug
|
What's the difference between pm2 and pm2-runtime? : <p>I've been transferring some projects that have been executing on the same machine to individual dockers each. I've tried to use <code>pm2</code> on one of these docker projects to make sure the service would restart if something go wrong (it's a volatile project) and some of the examples demands the Dockerfile to use <code>pm2-runtime</code> instead of <code>pm2</code>. I've been searching for the differences of these two but I couldn't find something specific, could someone help?</p>
| 0debug
|
How does stackdriver logging assert the severity of an entry? : <p>I recently started using stackdriver logging on my Kubernetes cluster. The service are logging json payloads. In stackdriver logging I see the json payload parsed correctly, but everything has severity "ERROR".
This is not intended. Most of these logs aren't errors. They also do not contain error fields or similar fields.
Is there a way to tell stackdriver how to determine the severity of a log entry received from the log agent in kubernetes? Or do I need to modify my structured log output in some way to make stackdriver understand it better?</p>
<p>Thanks in advance.</p>
| 0debug
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
Lodash group by multiple properties if property value is true : <p>I have an array of vehicles that need to be grouped by make and model, only if the 'selected' property is true. The resulting object should contain properties for make model and count. Using lodash, how can I organize the vehicle objects into the desired result objects. I'm able to get the vehicle objects grouped by makeCode but I'm not sure how to group by more than one property.</p>
<p><strong><em>group by make code works</em></strong></p>
<pre><code> var vehicles = _.groupBy(response.vehicleTypes, function(item)
{
return item.makeCode; // how to group by model code as well
});
</code></pre>
<p><strong><em>initial vehicles</em></strong></p>
<pre><code>{
id: 1,
selected: true,
makeCode: "Make-A",
modelCode: "Model-a",
trimCode: "trim-a",
yearCode: "2012"
},
{
id: 2,
selected: false,
makeCode: "Make-A",
modelCode: "Model-a",
trimCode: "trim-a",
yearCode: "2013"
},
{
id: 3,
selected: true,
makeCode: "Make-B",
modelCode: "Model-c",
trimCode: "trim-a",
yearCode: "2014"
},
{
id: 25,
selected: true,
makeCode: "Make-C",
modelCode: "Model-b",
trimCode: "trim-b",
yearCode: "2012"
},
{
id: 26,
selected: true,
makeCode: "Make-C",
modelCode: "Model-b",
trimCode: "trim-a",
yearCode: "2013"
}
</code></pre>
<p><strong><em>result object</em></strong></p>
<pre><code>{
Make-A: {
Model-a: {
count: 1
}
}
},
{
Make-B: {
Model-c: {
count: 1
}
}
},
{
Make-C: {
Model-b: {
count: 2
}
}
}
</code></pre>
| 0debug
|
My simple c++ calculator is not working as it should be : <p>This is a suppposed to be simple calculator which can plus, minus, mulyiply or divide two numbers that are input into the console (int a, b).
The problem is probably with my if / else statemnts. Even though I input "Minus" , "Multiply" or "Divide" into the console, the operator (std::string operator) is always set to "plus", thus adding the two numbers even though that was not my desired operator.</p>
<p>Ive tried removing the [int plus();] function alltogether to see the result, then the default and fixed operator changed to minus.</p>
<pre><code>#include <iostream>
// the problem is probably at [void core();]
std::string operation;
int a;
int b;
class common {
public:
void print() {
std::cout << "a: ";
std::cin >> a;
std::cout << "b: ";
std::cin >> b;
}
};
int plus() {
common plus1;
plus1.print();
int ans = a + b;
std::cout << "ANS: " << ans << "\n";
return a + b;
}
int minus() {
common minus1;
minus1.print();
int ans = a - b;
std::cout << "ANS: " << ans << "\n";
return a - b;
}
int multiply() {
common multiply1;
multiply1.print();
int ans = a * b;
std::cout << "ANS: " << ans << "\n";
return a * b;
}
int divide() {
common divide1;
divide1.print();
int ans = a / b;
std::cout << "ANS: " << ans << "\n";
return a / b;
}
void core() {
std::cout << "\nplus / minus / multiply / divide\n"
<< "operation: ";
std::cin >> operation;
if (operation == "plus" or "Plus") {
plus();
}
else if (operation == "minus" or "Minus") {
minus();
}
else if (operation == "multiply" or "Multiply") {
multiply();
}
else if (operation == "divide" or "Divide") {
divide();
}
else {
std::cout << "Invalid Operation!\n";
}
}
int main() {
for (int i = 0; i < 99; i++) {
core();
}
}
</code></pre>
<p>When i set [std::string operation] as "multiply" through
[std::cin >> operation], i expected the [multiply();]
function to be called but instead, [plus();] function is called no matter what operator i set.</p>
| 0debug
|
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
{
int level, pred;
if(s->msmpeg4_version<=2){
if (n < 4) {
level = get_vlc2(&s->gb, v2_dc_lum_vlc.table, DC_VLC_BITS, 3);
} else {
level = get_vlc2(&s->gb, v2_dc_chroma_vlc.table, DC_VLC_BITS, 3);
}
if (level < 0)
return -1;
level-=256;
}else{
if (n < 4) {
level = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} else {
level = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1;
}
if (level == DC_MAX) {
level = get_bits(&s->gb, 8);
if (get_bits1(&s->gb))
level = -level;
} else if (level != 0) {
if (get_bits1(&s->gb))
level = -level;
}
}
if(s->msmpeg4_version==1){
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(s, n, &dc_val);
level += pred;
*dc_val= level;
}else{
int16_t *dc_val;
pred = ff_msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
level += pred;
if (n < 4) {
*dc_val = level * s->y_dc_scale;
} else {
*dc_val = level * s->c_dc_scale;
}
}
return level;
}
| 1threat
|
static void chassis_control(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
uint8_t *rsp, unsigned int *rsp_len,
unsigned int max_rsp_len)
{
IPMIInterface *s = ibs->parent.intf;
IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);
IPMI_CHECK_CMD_LEN(3);
switch (cmd[2] & 0xf) {
case 0:
rsp[2] = k->do_hw_op(s, IPMI_POWEROFF_CHASSIS, 0);
break;
case 1:
rsp[2] = k->do_hw_op(s, IPMI_POWERON_CHASSIS, 0);
break;
case 2:
rsp[2] = k->do_hw_op(s, IPMI_POWERCYCLE_CHASSIS, 0);
break;
case 3:
rsp[2] = k->do_hw_op(s, IPMI_RESET_CHASSIS, 0);
break;
case 4:
rsp[2] = k->do_hw_op(s, IPMI_PULSE_DIAG_IRQ, 0);
break;
case 5:
rsp[2] = k->do_hw_op(s,
IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP, 0);
break;
default:
rsp[2] = IPMI_CC_INVALID_DATA_FIELD;
return;
}
}
| 1threat
|
Why free() in C isn't work? : <pre><code>int main()
{
char* in = (char *)malloc(sizeof(char)*100);
in = "Sort of Input String with LITERALS AND NUMBERS\0";
free(in);
return 0;
}
</code></pre>
<p>Why this code isn't working with this error?</p>
<pre><code>pointers(10144,0x7fff78a82000) malloc: *** error for object 0x10ba18f88: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
bash: line 1: 10144 Abort trap: 6 '/Users/.../Documents/term2_sr/pointers'
[Finished in 0.1s with exit code 134]
</code></pre>
| 0debug
|
recyclerview android in loop : how get data from arraylist to recyclerview ?? please help :(
ModelCoba modelCoba = response.body();
for (int i = 0;i<modelCoba.getAcara_daftar().size();i++){
judul[i] = response.body().getAcara_daftar().get(i).getJudul();
pemateri[i] = response.body().getAcara_daftar().get(i).getPemateri();
tanggal[i] = response.body().getAcara_daftar().get(i).getTgl();
}
ArrayAdapter arrayAdapter = new ArrayAdapter<String>(AcaraAdapter.this,android.R.layout.activity_list_item,);
| 0debug
|
How to declare array of pointers to a pointer (C) : I have a task to create an array of pointers to struckture. I need to use just void functions and "malloc". I have no idea how to do it, could you help me?
[1]: https://i.stack.imgur.com/tsFNw.png
[2]: https://i.stack.imgur.com/EsLKk.png
| 0debug
|
Right Outer Join Significance : <p>Though we can achieve the same result when we put right table in left and use left outer join. Then what is the significance of Right Outer Join?</p>
| 0debug
|
static void scsi_block_realize(SCSIDevice *dev, Error **errp)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
int sg_version;
int rc;
if (!s->qdev.conf.bs) {
error_setg(errp, "drive property not set");
return;
}
rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
if (rc < 0) {
error_setg(errp, "cannot get SG_IO version number: %s. "
"Is this a SCSI device?",
strerror(-rc));
return;
}
if (sg_version < 30000) {
error_setg(errp, "scsi generic interface too old");
return;
}
rc = get_device_type(s);
if (rc < 0) {
error_setg(errp, "INQUIRY failed");
return;
}
if (s->qdev.type == TYPE_ROM || s->qdev.type == TYPE_WORM) {
s->qdev.blocksize = 2048;
} else {
s->qdev.blocksize = 512;
}
s->features |= (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS);
scsi_realize(&s->qdev, errp);
}
| 1threat
|
setValue and postValue on MutableLiveData in UnitTest : <p>I try to test some methods on my Application but I get an error when calling mutablelivedata.postValue. Here is a snippet and the error message:</p>
<pre><code>@Test
public void callStartScreenRepository(){
Observer<User> userObserver = mock(Observer.class);
startScreenViewModel.returnUser().observeForever(userObserver);
maennlich = new User();
maennlich.setVorname("Christian");
MutableLiveData<User> userTest = new MutableLiveData<>();
userTest.postValue(maennlich);
when(startScreenRepository.userWebService("testUser")).thenReturn(userTest);
verify(userObserver).onChanged(maennlich);
}
</code></pre>
<p>java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked. See <a href="http://g.co/androidstudio/not-mocked" rel="noreferrer">http://g.co/androidstudio/not-mocked</a> for details.</p>
<pre><code>at android.os.Looper.getMainLooper(Looper.java)
at android.arch.core.executor.DefaultTaskExecutor.postToMainThread(DefaultTaskExecutor.java:48)
at android.arch.core.executor.AppToolkitTaskExecutor.postToMainThread(AppToolkitTaskExecutor.java:100)
at android.arch.lifecycle.LiveData.postValue(LiveData.java:277)
at android.arch.lifecycle.MutableLiveData.postValue(MutableLiveData.java:28)
at com.example.cfrindt.foodtracking.ViewModels.StartScreenViewModelTest.callStartScreenRepository(StartScreenViewModelTest.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
</code></pre>
<p>I receive this error no matter if I am using setValue() or postValue().
How can I make it work?</p>
| 0debug
|
OCI runtime create failed: container_linux.go:296 - no such file or directory : <p>End of my Dockerfile:</p>
<pre><code>ENTRYPOINT ["ls /etc"]
</code></pre>
<p>Terminal:</p>
<pre><code>...Rest of the building above is fine
Step 8/8 : ENTRYPOINT ["ls /etc"]
---> Using cache
---> ea1f33b8ab22
Successfully built ea1f33b8ab22
Successfully tagged redis:latest
k@Karls ~/dev/docker_redis (master) $ docker run -d -p 6379:6379 --name red redis
71d75058b94f088ef872b08a115bc12cece288b53fe26d67960fe139953ed5c4
docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"ls /etc\": stat ls /etc: no such file or directory": unknown.
</code></pre>
<p>For some reason, it won't find the directory <code>/etc</code>. I did a <code>pwd</code> and the current working directory is <code>/</code>. I also did a <code>ls /</code> on the entrypoint and that displayed the <code>/etc</code> directory fine.</p>
| 0debug
|
How to change access modifier without hiding class base variable? : <p>I'm trying to extend the Process class a bit, to add access control of Process.Exited delegates and limit them to one. So far, I have this result:</p>
<pre><code>public class ProcessWithData : Process
{
public EventHandler CurrentEventHandler { get; private set; }
public new bool EnableRaisingEvents = true;
private new EventHandler Exited;
public void SetHandler(EventHandler eventHandler)
{
if (CurrentEventHandler != null) Exited -= CurrentEventHandler;
CurrentEventHandler = eventHandler;
Exited += CurrentEventHandler;
}
}
</code></pre>
<p>However, the line</p>
<pre><code>private new EventHandler Exited;
</code></pre>
<p>overwrites existing EventHandler of Process class being the base. Therefore</p>
<pre><code>var proc = Process.Start("foo.exe");
ProcessWithData procwithdata = (ProcessWithData)proc;
</code></pre>
<p>should destroy Exited event handler upon cast.</p>
<p>How could I set <code>private</code> modifier to it without redefining(and destroying) existing instance inside Process class?</p>
| 0debug
|
Unicodes in google play console : Can someone tell me how to add HTML unicodes to my Application title, such ass "NULL" HTML unicode or anything. because I kept trying that for days now and nothing worked for me
| 0debug
|
Summing few columns of a data frame : <p>This is my data</p>
<pre><code>> df<- as.data.frame(matrix(rnorm(15), 3))
> df
V1 V2 V3 V4 V5
1 0.8757347 1.5984067 1.0295143 0.08161545 1.6208651
2 -0.4039117 -0.9497641 -0.1747716 0.01544082 0.4639266
3 -0.9055205 -0.9686378 0.9451551 -0.05030505 -1.4510613
</code></pre>
<p>How can I add a column at the end that will sum only the last two column? </p>
| 0debug
|
PROTO4(_pack_2ch_)
PROTO4(_pack_6ch_)
PROTO4(_pack_8ch_)
PROTO4(_unpack_2ch_)
PROTO4(_unpack_6ch_)
av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,
enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels){
int mm_flags = av_get_cpu_flags();
ac->simd_f= NULL;
#define MULTI_CAPS_FUNC(flag, cap) \
if (EXTERNAL_##flag(mm_flags)) {\
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\
ac->simd_f = ff_int16_to_int32_a_ ## cap;\
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\
ac->simd_f = ff_int32_to_int16_a_ ## cap;\
}
MULTI_CAPS_FUNC(MMX, mmx)
MULTI_CAPS_FUNC(SSE2, sse2)
if(EXTERNAL_MMX(mm_flags)) {
if(channels == 6) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_6ch_float_to_float_a_mmx;
}
}
if(EXTERNAL_SSE(mm_flags)) {
if(channels == 6) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_6ch_float_to_float_a_sse;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_6ch_float_to_float_a_sse;
}
}
if(EXTERNAL_SSE2(mm_flags)) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P)
ac->simd_f = ff_int16_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_float_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_float_to_int16_a_sse2;
if(channels == 2) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P)
ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P)
ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P)
ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT)
ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2;
}
if(channels == 6) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_6ch_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_6ch_float_to_int32_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
ac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2;
}
if(channels == 8) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_8ch_float_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_8ch_int32_to_float_a_sse2;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_8ch_float_to_int32_a_sse2;
}
}
if(EXTERNAL_SSSE3(mm_flags)) {
if(channels == 2) {
if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3;
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)
ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3;
}
}
if(EXTERNAL_AVX(mm_flags)) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_int32_to_float_a_avx;
if(channels == 6) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_6ch_float_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_6ch_int32_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_6ch_float_to_int32_a_avx;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_6ch_float_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)
ac->simd_f = ff_unpack_6ch_int32_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)
ac->simd_f = ff_unpack_6ch_float_to_int32_a_avx;
}
if(channels == 8) {
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_8ch_float_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)
ac->simd_f = ff_pack_8ch_int32_to_float_a_avx;
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_pack_8ch_float_to_int32_a_avx;
}
}
if(EXTERNAL_AVX2(mm_flags)) {
if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = ff_float_to_int32_a_avx2;
}
}
| 1threat
|
static int dxva2_create_decoder(AVCodecContext *s)
{
InputStream *ist = s->opaque;
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
DXVA2Context *ctx = ist->hwaccel_ctx;
struct dxva_context *dxva_ctx = s->hwaccel_context;
GUID *guid_list = NULL;
unsigned guid_count = 0, i, j;
GUID device_guid = GUID_NULL;
const D3DFORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2');
D3DFORMAT target_format = 0;
DXVA2_VideoDesc desc = { 0 };
DXVA2_ConfigPictureDecode config;
HRESULT hr;
int surface_alignment, num_surfaces;
int ret;
AVDXVA2FramesContext *frames_hwctx;
AVHWFramesContext *frames_ctx;
hr = IDirectXVideoDecoderService_GetDecoderDeviceGuids(ctx->decoder_service, &guid_count, &guid_list);
if (FAILED(hr)) {
av_log(NULL, loglevel, "Failed to retrieve decoder device GUIDs\n");
goto fail;
}
for (i = 0; dxva2_modes[i].guid; i++) {
D3DFORMAT *target_list = NULL;
unsigned target_count = 0;
const dxva2_mode *mode = &dxva2_modes[i];
if (mode->codec != s->codec_id)
continue;
for (j = 0; j < guid_count; j++) {
if (IsEqualGUID(mode->guid, &guid_list[j]))
break;
}
if (j == guid_count)
continue;
hr = IDirectXVideoDecoderService_GetDecoderRenderTargets(ctx->decoder_service, mode->guid, &target_count, &target_list);
if (FAILED(hr)) {
continue;
}
for (j = 0; j < target_count; j++) {
const D3DFORMAT format = target_list[j];
if (format == surface_format) {
target_format = format;
break;
}
}
CoTaskMemFree(target_list);
if (target_format) {
device_guid = *mode->guid;
break;
}
}
CoTaskMemFree(guid_list);
if (IsEqualGUID(&device_guid, &GUID_NULL)) {
av_log(NULL, loglevel, "No decoder device for codec found\n");
goto fail;
}
desc.SampleWidth = s->coded_width;
desc.SampleHeight = s->coded_height;
desc.Format = target_format;
ret = dxva2_get_decoder_configuration(s, &device_guid, &desc, &config);
if (ret < 0) {
goto fail;
}
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO)
surface_alignment = 32;
else if (s->codec_id == AV_CODEC_ID_HEVC)
surface_alignment = 128;
else
surface_alignment = 16;
num_surfaces = 4;
if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
num_surfaces += 16;
else if (s->codec_id == AV_CODEC_ID_VP9)
num_surfaces += 8;
else
num_surfaces += 2;
if (s->active_thread_type & FF_THREAD_FRAME)
num_surfaces += s->thread_count;
ctx->hw_frames_ctx = av_hwframe_ctx_alloc(ctx->hw_device_ctx);
if (!ctx->hw_frames_ctx)
goto fail;
frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
frames_hwctx = frames_ctx->hwctx;
frames_ctx->format = AV_PIX_FMT_DXVA2_VLD;
frames_ctx->sw_format = (target_format == MKTAG('P','0','1','0') ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12);
frames_ctx->width = FFALIGN(s->coded_width, surface_alignment);
frames_ctx->height = FFALIGN(s->coded_height, surface_alignment);
frames_ctx->initial_pool_size = num_surfaces;
frames_hwctx->surface_type = DXVA2_VideoDecoderRenderTarget;
ret = av_hwframe_ctx_init(ctx->hw_frames_ctx);
if (ret < 0) {
av_log(NULL, loglevel, "Failed to initialize the HW frames context\n");
goto fail;
}
hr = IDirectXVideoDecoderService_CreateVideoDecoder(ctx->decoder_service, &device_guid,
&desc, &config, frames_hwctx->surfaces,
frames_hwctx->nb_surfaces, &frames_hwctx->decoder_to_release);
if (FAILED(hr)) {
av_log(NULL, loglevel, "Failed to create DXVA2 video decoder\n");
goto fail;
}
ctx->decoder_guid = device_guid;
ctx->decoder_config = config;
dxva_ctx->cfg = &ctx->decoder_config;
dxva_ctx->decoder = frames_hwctx->decoder_to_release;
dxva_ctx->surface = frames_hwctx->surfaces;
dxva_ctx->surface_count = frames_hwctx->nb_surfaces;
if (IsEqualGUID(&ctx->decoder_guid, &DXVADDI_Intel_ModeH264_E))
dxva_ctx->workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
return 0;
fail:
av_buffer_unref(&ctx->hw_frames_ctx);
return AVERROR(EINVAL);
}
| 1threat
|
Android Recycleview App crash(Please helpp!) :
Hey i'm trying to make a recycle view and i'm also using tab layout in my app.i followed a tutorial step by step but i don't know why it crashes.Here's the code
i guess there's a problem with this part:
@Override
public int getItemCount() {
return herosList.size();
}
whenever i chane return to 0 the app will run but nothing will appear in the recycleview
public class Heros {
public String name;
public int img;
}
RecycleAdapter.java
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.HerosViewHolder> {
ArrayList<Heros> herosList;
public RecycleAdapter(ArrayList<Heros> heross){
herosList=heross;
}
@Override
public HerosViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.eachrow,parent,false);
return new HerosViewHolder(view);
}
@Override
public void onBindViewHolder(HerosViewHolder holder, int position) {
Heros heros=herosList.get(position);
holder.txtName.setText(heros.name);
}
@Override
public int getItemCount() {
return herosList.size();
}
public class HerosViewHolder extends RecyclerView.ViewHolder{
public ImageView herosImg;
public TextView txtName;
public HerosViewHolder(View itemView) {
super(itemView);
herosImg=(ImageView) itemView.findViewById(R.id.imgg);
txtName=(TextView)itemView.findViewById(R.id.txtHerosName);
}
}
}
public class PageFragment extends Fragment {
public static final String ARG_PAGE = "ARG_PAGE";
private int mPage;
RecyclerView recyclerView;
LinearLayoutManager manager;
String[] names={"abs","vline","chest"};
ArrayList<Heros> passName;
public static PageFragment newInstance(int page) {
Bundle args = new Bundle();
args.putInt(ARG_PAGE, page);
PageFragment fragment = new PageFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPage = getArguments().getInt(ARG_PAGE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
passName=new ArrayList<>();
View view = inflater.inflate(R.layout.fragment_page, container,
false);
recyclerView=(RecyclerView)view.findViewById(R.id.rec);
manager=new LinearLayoutManager(G.context);
recyclerView.setLayoutManager(manager);
recyclerView.setHasFixedSize(true);
for (int i=0;i<3;i++){
Heros heros=new Heros();
heros.name=names[i];
passName.add(heros);
}
recyclerView.setAdapter(new RecycleAdapter(passName));
return view;
}
}
| 0debug
|
static struct vm_area_struct *vma_first(const struct mm_struct *mm)
{
return (TAILQ_FIRST(&mm->mm_mmap));
}
| 1threat
|
What is the difference between windowMinWidthMajor and android:windowMinWidthMajor : <p>I want to set up a proper style for my ProgressDialog.
I like the default one but I want to customize it. I've tried to use AppCompat dialogs but they all setup some <strong>weird width and height for my Dialog.</strong></p>
<p>I found that extending from MaterialDialog do the trick, so this code works:</p>
<pre><code><style name="ProgressDialogTheme" parent="MaterialBaseTheme.AlertDialog" >
</style>
</code></pre>
<p>This is because MeterialDialog itself setup custom width</p>
<pre><code><style name="MaterialBaseTheme.AlertDialog" parent="MaterialBaseTheme.Dialog">
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
</code></pre>
<p>And I found that there is AppCompat dialog that set up the same custom width, here it is:</p>
<pre><code><style name="Base.Theme.AppCompat.Light.Dialog.Alert">
<item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
</style>
</code></pre>
<p><strong>but it do not work</strong></p>
<p>The only difference is a <strong>andorid namespace</strong> at the beginning of MeterialDialog attribute. </p>
<p>Can someone explain why <code>android:windowMinWidthMajor</code>
do the trick?</p>
| 0debug
|
python trying to get domain names of the companies : Here i am trying to get domain names of the companies and the company names are stored in new.csv
**The code i have used**
import pandas as pd
import clearbit
import json
clearbit.key = 'sk_1915de5d2d7b6e245d6613e3d2188368'
df = pd.read_csv("/home/vipul/Desktop/new.csv", sep=',', encoding="utf-8")
saved_column = df['Company'].dropna()
print(saved_column)
i=0
res = []
for data in saved_column:
n = saved_column[i]
i = i+1
data = clearbit.NameToDomain.find(name=n)
if data is None null() res.append(data['domain'])
print(res)
df['domain'] = res
df.to_csv("/home/vipul/Desktop/new.csv",index = False, skipinitialspace=False)
print("File saved to desktop as new.csv")
**output of the code**
python ts.py
0 Accenture
1 AND Digital
2 Accenture
3 Kite Consulting Group
4 Capgemini
5 Accenture UK
Name: Company, dtype: object
['accenture.com']
['accenture.com', 'and.digital']
['accenture.com', 'and.digital', 'accenture.com']
Traceback (most recent call last):
File "ts.py", line 15, in <module>
res.append(data['domain'])
TypeError: 'NoneType' object is not subscriptable
How to give some default value where NoneType encounters and store it with the corresponding company names which is in new.csv
**Expected output to be saved in new.csv**
Company domain
Accenture accenture.com
AND Digital and.digital
Accenture accenture.com
Kite Consulting Group None
Capgemini capgemini.com
Accenture UK None
| 0debug
|
static int qcow2_create2(const char *filename, int64_t total_size,
const char *backing_file, const char *backing_format,
int flags, size_t cluster_size, int prealloc,
QEMUOptionParameter *options)
{
int cluster_bits;
cluster_bits = ffs(cluster_size) - 1;
if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS ||
(1 << cluster_bits) != cluster_size)
{
error_report(
"Cluster size must be a power of two between %d and %dk",
1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
return -EINVAL;
}
BlockDriverState* bs;
QCowHeader header;
uint8_t* refcount_table;
int ret;
ret = bdrv_create_file(filename, options);
if (ret < 0) {
return ret;
}
ret = bdrv_file_open(&bs, filename, BDRV_O_RDWR);
if (ret < 0) {
return ret;
}
memset(&header, 0, sizeof(header));
header.magic = cpu_to_be32(QCOW_MAGIC);
header.version = cpu_to_be32(QCOW_VERSION);
header.cluster_bits = cpu_to_be32(cluster_bits);
header.size = cpu_to_be64(0);
header.l1_table_offset = cpu_to_be64(0);
header.l1_size = cpu_to_be32(0);
header.refcount_table_offset = cpu_to_be64(cluster_size);
header.refcount_table_clusters = cpu_to_be32(1);
if (flags & BLOCK_FLAG_ENCRYPT) {
header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES);
} else {
header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
}
ret = bdrv_pwrite(bs, 0, &header, sizeof(header));
if (ret < 0) {
goto out;
}
refcount_table = g_malloc0(cluster_size);
ret = bdrv_pwrite(bs, cluster_size, refcount_table, cluster_size);
g_free(refcount_table);
if (ret < 0) {
goto out;
}
bdrv_close(bs);
BlockDriver* drv = bdrv_find_format("qcow2");
assert(drv != NULL);
ret = bdrv_open(bs, filename,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, drv);
if (ret < 0) {
goto out;
}
ret = qcow2_alloc_clusters(bs, 2 * cluster_size);
if (ret < 0) {
goto out;
} else if (ret != 0) {
error_report("Huh, first cluster in empty image is already in use?");
abort();
}
ret = bdrv_truncate(bs, total_size * BDRV_SECTOR_SIZE);
if (ret < 0) {
goto out;
}
if (backing_file) {
ret = bdrv_change_backing_file(bs, backing_file, backing_format);
if (ret < 0) {
goto out;
}
}
if (prealloc) {
ret = preallocate(bs);
if (ret < 0) {
goto out;
}
}
ret = 0;
out:
bdrv_delete(bs);
return ret;
}
| 1threat
|
Method to display all numbers between 2 whole provided android : <p>android code to display all numbers between 2 input from edittext</p>
<p>first edittext has starting number(min) and other has end number(max)..</p>
<p>Conditions.. Each multiple of 3, you need to display "H" instead of the number,
.. each multiple of 5, you must display "S" instead of the number.
and other numbers are display as it is...</p>
<p>please help
thank you in advance..</p>
| 0debug
|
Different design for mobile and desktop : <p>I have two different design for mobile and desktop. When I tried to restore the chrome then the mobile version looks good but when I check on the phone it didn't show me at all. The desktop version is all clear. </p>
<p>I have tried display function none and block in css. </p>
<p>HTML</p>
<pre><code><body>
<div class="row" >
<div class="column">
<img src="logo.png" style="position: absolute; padding-top: 15%;">
</div>
<div class="column1">
<img src="new.png" style="position: fixed;z-index: -1">
<div class="links">
<h1><a href="http://okdateme.com" target="_blank">FIND A PARTNER</a></h1>
<h1><a href="https://stayaunty.com" target="_blank">BOOK A ROOM</a></h1>
<h1><a href="https://www.thatspersonal.com/" target="_blank">EXPLORE YOUR FANTASIES</a></h1>
</div>
</div>
</div>
<div class="mobile">
<img src="logo.png" style="width: 100%;">
<div>
<img src="new.png" style="width: 100%; position: absolute; z-index: -1; margin-top: -25px;">
<h2><a href="http://okdateme.com">FIND A PARTNER</a></h2>
<h2><a href="https://stayaunty.com">BOOK A ROOM</a></h2>
<h2><a href="https://www.thatspersonal.com/">EXPLORE YOUR FANTASIES</a></h2>
</div>
</div>
</code></pre>
<p>CSS</p>
<pre><code>body
{
width: 100%;
height: 100%;
margin: 0;
background-color: #000;
}
.row:after{
clear:both;
background-color: #000;
}
.column {
width: 33.33%;
float: left;
}
.column1 {
width: 66.66%;
float: right;
position: relative;
}
.links{
font-family: Comic Sans MS;
margin-top: 30%;
}
a{
text-decoration: none;
color: #cc3366;
z-index: 9999;
position: relative;
background-color: #000;
}
@media(min-width: 768px){
.mobile{
display: none;
}
}
@media(max-width: 767px) {
.row:after, .column, .row{
display: none;
}
}
@media (max-width: 767px) {
div.row, .column, .column1{
display: none;
}
.mobile{
display: all;
}
a{
color: #fff;
background-color: #999900;
font-family: Comic Sans MS;
}
}
</code></pre>
<p>My desktop version is looking good but the desktop version is also coming to mobile. But I have tried a different mobile design and hide the desktop on the mobile.</p>
| 0debug
|
Creating a matrix with random generated variables in R : <p>I want to create a matrix with 100 rows and 5 columns. Values for the first column are 1 or 2. Values for the second column are integers from 1 to 5. Values for the third column are integers from 10 to 50. Values for the fourth column are integers from 1 to 3. And values for the fifth column are integers from 1 to 5. How do randomly assign these generated values for each row in this matrix? Thanks,</p>
| 0debug
|
What is Angular2 way of creating global keyboard shortcuts (a.k.a. hotkeys)? : <p>What would be proper way of creating global keyboard shortcuts (a.k.a. hotkeys) in Angular2 application? </p>
<p>Let's say good starting point would be to get working: "?" for cheat-sheet and "Alt+s" for submitting form.</p>
<p>Should I map "?" somehow to main component and then develop attribute directive that would be applied to those components which should respond on particular hotkeys, but then - how do I prevent input fields from responding to "?".</p>
| 0debug
|
static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
unsigned int arraylen = 0, timeslen = 0, fileposlen = 0, i;
double num_val;
char str_val[256];
int64_t *times = NULL;
int64_t *filepositions = NULL;
int ret = AVERROR(ENOSYS);
int64_t initial_pos = avio_tell(ioc);
AVDictionaryEntry *creator = av_dict_get(s->metadata, "metadatacreator",
NULL, 0);
if (creator && !strcmp(creator->value, "MEGA")) {
return 0;
}
while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
int64_t* current_array;
if (avio_r8(ioc) != AMF_DATA_TYPE_ARRAY)
break;
arraylen = avio_rb32(ioc);
if (!strcmp(KEYFRAMES_TIMESTAMP_TAG, str_val) && !times) {
if (!(times = av_mallocz(sizeof(*times) * arraylen))) {
ret = AVERROR(ENOMEM);
goto finish;
}
timeslen = arraylen;
current_array = times;
} else if (!strcmp(KEYFRAMES_BYTEOFFSET_TAG, str_val) && !filepositions) {
if (!(filepositions = av_mallocz(sizeof(*filepositions) * arraylen))) {
ret = AVERROR(ENOMEM);
goto finish;
}
fileposlen = arraylen;
current_array = filepositions;
} else
break;
for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
goto finish;
num_val = av_int2dbl(avio_rb64(ioc));
current_array[i] = num_val;
}
if (times && filepositions) {
ret = 0;
break;
}
}
if (timeslen == fileposlen)
for(i = 0; i < arraylen; i++)
av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
else
av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
finish:
av_freep(×);
av_freep(&filepositions);
if (ret < 0 && avio_seek(ioc, initial_pos, SEEK_SET) > 0)
return 0;
return ret;
}
| 1threat
|
Javascript input.value not working : <p>I'm using the Domready.js library as an alternative to the jQuery <code>document.ready()</code> function and inside the ready function I have this code:</p>
<pre><code>DomReady.ready( function() {
/*
DOM elements
*/
var tel_input = document.getElementsByClassName( 'tel-input' );
/*
When .tel-input is focused, `06` should be added automatically
*/
tel_input.onfocus = function() {
tel_input.value = '06';
};
});
</code></pre>
<p>This code doesn't do anything and the console doesn't throw an error. When putting an alert in the <code>tel_input.onfocus = function() {</code> it works, but inserting a value when the input is focused doesn't do anything.</p>
| 0debug
|
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
int size, int64_t pos, uint64_t cluster_time,
uint64_t block_duration, int is_keyframe,
uint8_t *additional, uint64_t additional_id, int additional_size,
int64_t cluster_pos)
{
uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track;
int res = 0;
AVStream *st;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
return n;
}
data += n;
size -= n;
track = matroska_find_track_by_num(matroska, num);
if (!track || !track->stream) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64" or size %u\n", num, size);
return AVERROR_INVALIDDATA;
} else if (size <= 3)
return 0;
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return res;
av_assert1(block_duration != AV_NOPTS_VALUE);
block_time = AV_RB16(data);
data += 2;
flags = *data++;
size -= 3;
if (is_keyframe == -1)
is_keyframe = flags & 0x80 ? AV_PKT_FLAG_KEY : 0;
if (cluster_time != (uint64_t)-1
&& (block_time >= 0 || cluster_time >= -block_time)) {
timecode = cluster_time + block_time;
if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE
&& timecode < track->end_timecode)
is_keyframe = 0;
if (is_keyframe)
av_add_index_entry(st, cluster_pos, timecode, 0,0,AVINDEX_KEYFRAME);
}
if (matroska->skip_to_keyframe && track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
if (timecode < matroska->skip_to_timecode)
return res;
if (!st->skip_to_keyframe) {
av_log(matroska->ctx, AV_LOG_ERROR, "File is broken, keyframes not correctly marked!\n");
matroska->skip_to_keyframe = 0;
}
if (is_keyframe)
matroska->skip_to_keyframe = 0;
}
res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1,
&lace_size, &laces);
if (res)
goto end;
if (!block_duration)
block_duration = track->default_duration * laces / matroska->time_scale;
if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
track->end_timecode =
FFMAX(track->end_timecode, timecode + block_duration);
for (n = 0; n < laces; n++) {
int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
if (lace_size[n] > size) {
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
break;
}
if ((st->codec->codec_id == AV_CODEC_ID_RA_288 ||
st->codec->codec_id == AV_CODEC_ID_COOK ||
st->codec->codec_id == AV_CODEC_ID_SIPR ||
st->codec->codec_id == AV_CODEC_ID_ATRAC3) &&
st->codec->block_align && track->audio.sub_packet_size) {
res = matroska_parse_rm_audio(matroska, track, st, data, size,
timecode, pos);
if (res)
goto end;
} else {
res = matroska_parse_frame(matroska, track, st, data, lace_size[n],
timecode, lace_duration,
pos, !n? is_keyframe : 0,
additional, additional_id, additional_size);
if (res)
goto end;
}
if (timecode != AV_NOPTS_VALUE)
timecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE;
data += lace_size[n];
size -= lace_size[n];
}
end:
av_free(lace_size);
return res;
}
| 1threat
|
How do I use jq to convert number to string? : <p>Given the following jq command and Json:</p>
<pre><code>jq '.[]|[.string,.number]|join(": ")' <<< '
[
{
"number": 3,
"string": "threee"
},
{
"number": 7,
"string": "seven"
}
]
'
</code></pre>
<p>I'm trying to format the output as:</p>
<pre><code>three: 3
seven: 7
</code></pre>
<p>Unfortunately, my attempt is resulting in the following error:</p>
<blockquote>
<p>jq: error: string and number cannot be added</p>
</blockquote>
<p>How do I convert the number to string so both can be joined?</p>
| 0debug
|
Angular-CLI & ThreeJS : <p>I have been trying to add the proper npm dependencies to add THREE to my Angular-CLI project. With CLI changing so rapidly in the past few months, I haven't been able to find working source.</p>
<h2> Here are a few ideas... </h2>
<ul>
<li><h3>Piggyback with scripts</h3>
<p>This was my first attempt, to simply add <code><script src="three.js"></script></code> to the index.html file. However I'm having trouble working with the javascript in the typescript interface.</p></li>
<li><h3>Webpack</h3>
<p>This was my second attempt, but I ran into several documentation problems. Angular-cli doesn't seem to have a consistent way of using webpacks. There are four different ways of implementing webpacks. I wasn't able to get any working with THREE.</p></li>
<li><h3>Bundles</h3>
<p>This seems like a hack, and a poor/lengthy one. It would be to add bundles to the THREE library so that it can be interpreted angular 2.</p></li>
</ul>
<p>I'm still currently working on making a Angluar-CLI + THREE.js project. If I don't see progress in the next week, I may drop angular-cli. Any advice/sources would be greatly appreciated.</p>
| 0debug
|
document.getElementById('input').innerHTML = user_input;
| 1threat
|
static void test_butterflies_float(const float *src0, const float *src1)
{
LOCAL_ALIGNED_16(float, cdst, [LEN]);
LOCAL_ALIGNED_16(float, odst, [LEN]);
LOCAL_ALIGNED_16(float, cdst1, [LEN]);
LOCAL_ALIGNED_16(float, odst1, [LEN]);
int i;
declare_func(void, float *av_restrict src0, float *av_restrict src1,
int len);
memcpy(cdst, src0, LEN * sizeof(*src0));
memcpy(cdst1, src1, LEN * sizeof(*src1));
memcpy(odst, src0, LEN * sizeof(*src0));
memcpy(odst1, src1, LEN * sizeof(*src1));
call_ref(cdst, cdst1, LEN);
call_new(odst, odst1, LEN);
for (i = 0; i < LEN; i++) {
if (!float_near_abs_eps(cdst[i], odst[i], FLT_EPSILON)) {
fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n",
i, cdst[i], odst[i], cdst[i] - odst[i]);
fail();
break;
}
}
memcpy(odst, src0, LEN * sizeof(*src0));
memcpy(odst1, src1, LEN * sizeof(*src1));
bench_new(odst, odst1, LEN);
}
| 1threat
|
Xamarin Android linking cannot access file : <p>I have a Xamarin Android project that I am trying to use Sdk and User Assembly linking with.</p>
<p>If I set the Android project to Sdk Assembly Linking only, the APK is created and deployed successfully and works.</p>
<p>However, when I set Sdk and User Assembly linking, with no other changes, I get the following error <em>only</em> when I deploy. The solution builds succesfully.</p>
<pre><code>The "LinkAssemblies" task failed unexpectedly.
System.IO.IOException: The process cannot access the file '<path-to-project>\AppName\AppName.Android\obj\Release\android\assets\AppName.Core.dll' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
</code></pre>
<p><code>AppName.Core.dll</code> is another library project in my solution that is set to build as NetStandard 2.0.</p>
<p>I have looked through many other bug reports and forum posts regarding a similar issue to this, but most seem related to an earlier bug with Visual Studio 15.5.1 that has since been fixed.</p>
<ul>
<li>The main Xamarin bug report is: <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=56275" rel="noreferrer">https://bugzilla.xamarin.com/show_bug.cgi?id=56275</a> but was resolved in VS 15.2.</li>
<li>A forum topic (<a href="https://forums.xamarin.com/discussion/32976/updating-xamarin-broke-the-build-process-the-process-cannot-access-the-file-appname-dll-mdb" rel="noreferrer">https://forums.xamarin.com/discussion/32976/updating-xamarin-broke-the-build-process-the-process-cannot-access-the-file-appname-dll-mdb</a>) also talks about a similar issue being resolved in VS 15.5.1.</li>
<li>Other SO questions refer to older Xamarin or VS versions, or have unacceptable solutions (such as just turning off linking):
<ul>
<li><a href="https://stackoverflow.com/questions/44796380/the-link-assemblies-tasks-failed-unexpectedly-xamarin-forms">The Link Assemblies tasks failed unexpectedly Xamarin Forms</a></li>
</ul></li>
</ul>
<p>Regardless, I have tried just about every solution suggested in those links including:</p>
<ul>
<li>closing and reopening Visual Studio</li>
<li>deleting /bin and /obj folders</li>
<li>opening Visual Studio as Administrator</li>
<li>running MsBuild from a command prompt with VS closed</li>
</ul>
<p>As well as various combinations of the above.</p>
<p><a href="https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker" rel="noreferrer">My custom linker.xml</a> contains an exception for my library project:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<linker>
...
<assembly fullname="AppName.Core" ></assembly>
...
</linker>
</code></pre>
<p>As this point I seem to have exhausted all available options and am no closer to a workable solution. Suggestions on solutions, workarounds, or other debugging paths to follow would be most appreciated.</p>
<p>My Android Options config:</p>
<p><a href="https://i.stack.imgur.com/q6G6F.png" rel="noreferrer"><img src="https://i.stack.imgur.com/q6G6F.png" alt="Android Options"></a></p>
<p>Version Information:</p>
<ul>
<li>Visual Studio Version: 15.5.6</li>
<li>Xamarin Forms Version: 2.5.0.280555</li>
<li>Xamarin Version: 26.1.0.1</li>
</ul>
| 0debug
|
how can one function in JavaScript be "defined" two times in a different way? : <p>This is an example from "Eloquent JavaScript" book (I think you know the book):</p>
<pre><code>function groupBy(array, groupOf) {
var groups = {};
array.forEach(function(element) {
var groupName = groupOf(element);
if (groupName in groups)
groups[groupName].push(element);
else
groups[groupName] = [element];
});
return groups;
}
var byCentury = groupBy(ancestry, function(person) {
return Math.ceil(person.died / 100);
});
</code></pre>
<p>What the code does is not very important. </p>
<p>The question is: the <code>groupBy</code> function has two different 'bodies', i.e. it does completely different things, as far as I can see. In the first instance, it does a lot of logic, but the second time it, first, has a different second argument (<code>function(person)</code> instead of <code>groupOf</code>, and, second, it just divides an array element property (which is the date of death of a person in an array of 39 people) by 100.</p>
<p>How can it be that the same function does different things? I do understand that<br>
these two instances of the same function somehow cooperate, but what is the general principle of such cooperation? </p>
<p>Thank you! </p>
| 0debug
|
Android PDF Viewer libray for eclipse : I want to include the an,droid pdf library to an android project using eclipse and I found this solution that seems to be a good one and it is based on Pdfium an Apache licenced project.
The main problem I am facing now is that the project is under Gradle/Maven dependecy controls and I want to download a jar or library project to include it to the project, is there any solution to convert a gradle dependency to jar library or something in this way ?
The link of the library : https://github.com/barteksc/AndroidPdfViewer
Thank you
| 0debug
|
Best Data Structure for mini map : <p>I want to develop a mini map for a specific location (e.g. New York), based on any type of Data Structure.
Features of that mini map:</p>
<ol>
<li>Shortest path from source to destination</li>
<li>The calculation of distance covered</li>
</ol>
<p>I need suggestions in deciding the Data Structure.</p>
| 0debug
|
Where can I find documentation for the NuGet v3 API? : <p>I'm interested in writing a client library around the NuGet v3 API in a non-.NET language. Where can I find documentation/resources on it that would tell me e.g. what URLs to make requests to and what responses it would return?</p>
<p>I tried doing a quick Google search, but the only thing that turns up is <a href="https://github.com/NuGet/NuGetGallery/wiki/API-v3-Specification" rel="noreferrer">this</a>, which was last updated 3 years ago. Does a spec exist?</p>
| 0debug
|
DNS - Firebase connect to Namecheap still says Needs setup? : <p>Ok, it has been less than 24 hrs but more than 10, and I find it odd that I am still getting a status of Needs setup in Firebase just trying to redirect to a custom domain, bought with Namecheap. I don't know what Im doing wrong but I still get the "insecure connection" error trying to access my site.</p>
<p>Here are the records specified in Firebase to be added to my Namecheap records:</p>
<p><a href="https://i.stack.imgur.com/8VTZd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8VTZd.png" alt="enter image description here"></a></p>
<p>Namecheap is in accordance:</p>
<p><a href="https://i.stack.imgur.com/VL8y9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VL8y9.png" alt="enter image description here"></a></p>
<p>I used @ for the same host as specified by Namecheap - is something wrong? How long should this take if not?</p>
| 0debug
|
Using AWS EFS with Docker : <p>I am using the new Elastic File System provided by amazon, on my single container EB deploy. I can't figure out why the mounted EFS cannot be mapped into the container. </p>
<p>The EFS mount is successfully performed on the host at /efs-mount-point. </p>
<p>Provided to the Dockerrun.aws.json is </p>
<pre><code>{
"AWSEBDockerrunVersion": "1"
"Volumes": [
{
"HostDirectory": "/efs-mount-point",
"ContainerDirectory": "/efs-mount-point"
}
]
}
</code></pre>
<p>The volume is then created in the container once it starts running. However it has mapped the hosts directory /efs-mount-point, not the actual EFS mount point. I can't figure out how to get Docker to map in the EFS volume mounted at /efs-mount-point instead of the host's directory. </p>
<p>Do NFS volumes play nice with Docker?</p>
| 0debug
|
Cesium: View from the front of the tracked entity : <p>I need to achieve a front view for the tracking entity, which will change according to the entities movements.</p>
<p>When I assign a value to <code>viewer.trackedEntity</code> property, the camera assumes a certain position. Is it possible to change this position so that the camera is directly in front of the tracking entity?</p>
<p>How can I do this for this example?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox: false,
selectionIndicator: false,
shouldAnimate: true,
terrainProvider: Cesium.createWorldTerrain()
});
var start = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16));
var stop = Cesium.JulianDate.addSeconds(start, 360, new Cesium.JulianDate());
viewer.clock.startTime = start.clone();
viewer.clock.stopTime = stop.clone();
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
viewer.clock.multiplier = 10;
viewer.timeline.zoomTo(start, stop);
var position = new Cesium.SampledPositionProperty();
position.addSample(start, Cesium.Cartesian3.fromDegrees(-118.243683, 34.052235, 500000));
position.addSample(Cesium.JulianDate.addSeconds(start, 250, new Cesium.JulianDate()), Cesium.Cartesian3.fromDegrees(-110, 35.5, 500000));
position.addSample(Cesium.JulianDate.addSeconds(start, 500, new Cesium.JulianDate()), Cesium.Cartesian3.fromDegrees(-86.134903, 40.267193, 500000));
var entity = viewer.entities.add({
availability : new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
start : start,
stop : stop
})]),
position : position,
orientation : new Cesium.VelocityOrientationProperty(position),
model : {
uri : 'https://cesiumjs.org/Cesium/Apps/SampleData/models/CesiumAir/Cesium_Air.gltf',
minimumPixelSize : 64
},
path : {
resolution : 1,
material : new Cesium.PolylineGlowMaterialProperty({
glowPower : 0.1,
color : Cesium.Color.YELLOW
}),
width : 10
}
});
viewer.trackedEntity = entity;</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet"/>
<script src="https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js"></script>
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<div id="interpolationMenu"></div>
</div></code></pre>
</div>
</div>
</p>
| 0debug
|
static void pc_init1(MachineState *machine,
const char *host_type, const char *pci_type)
{
PCMachineState *pcms = PC_MACHINE(machine);
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *system_io = get_system_io();
int i;
PCIBus *pci_bus;
ISABus *isa_bus;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *gsi;
qemu_irq *i8259;
qemu_irq smi_irq;
GSIState *gsi_state;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BusState *idebus[MAX_IDE_BUS];
ISADevice *rtc_state;
MemoryRegion *ram_memory;
MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
ram_addr_t lowmem;
if (xen_enabled()) {
xen_hvm_init(pcms, &ram_memory);
} else {
if (!pcms->max_ram_below_4g) {
pcms->max_ram_below_4g = 0xe0000000;
}
lowmem = pcms->max_ram_below_4g;
if (machine->ram_size >= pcms->max_ram_below_4g) {
if (pcmc->gigabyte_align) {
if (lowmem > 0xc0000000) {
lowmem = 0xc0000000;
}
if (lowmem & ((1ULL << 30) - 1)) {
error_report("Warning: Large machine and max_ram_below_4g "
"(%" PRIu64 ") not a multiple of 1G; "
"possible bad performance.",
pcms->max_ram_below_4g);
}
}
}
if (machine->ram_size >= lowmem) {
pcms->above_4g_mem_size = machine->ram_size - lowmem;
pcms->below_4g_mem_size = lowmem;
} else {
pcms->above_4g_mem_size = 0;
pcms->below_4g_mem_size = machine->ram_size;
}
}
pc_cpus_init(pcms);
if (kvm_enabled() && pcmc->kvmclock_enabled) {
kvmclock_create();
}
if (pcmc->pci_enabled) {
pci_memory = g_new(MemoryRegion, 1);
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
rom_memory = pci_memory;
} else {
pci_memory = NULL;
rom_memory = system_memory;
}
pc_guest_info_init(pcms);
if (pcmc->smbios_defaults) {
MachineClass *mc = MACHINE_GET_CLASS(machine);
smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
mc->name, pcmc->smbios_legacy_mode,
pcmc->smbios_uuid_encoded,
SMBIOS_ENTRY_POINT_21);
}
if (!xen_enabled()) {
pc_memory_init(pcms, system_memory,
rom_memory, &ram_memory);
} else if (machine->kernel_filename != NULL) {
xen_load_linux(pcms);
}
gsi_state = g_malloc0(sizeof(*gsi_state));
if (kvm_ioapic_in_kernel()) {
kvm_pc_setup_irq_routing(pcmc->pci_enabled);
gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
GSI_NUM_PINS);
} else {
gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}
if (pcmc->pci_enabled) {
pci_bus = i440fx_init(host_type,
pci_type,
&i440fx_state, &piix3_devfn, &isa_bus, gsi,
system_memory, system_io, machine->ram_size,
pcms->below_4g_mem_size,
pcms->above_4g_mem_size,
pci_memory, ram_memory);
pcms->bus = pci_bus;
} else {
pci_bus = NULL;
i440fx_state = NULL;
isa_bus = isa_bus_new(NULL, get_system_memory(), system_io,
&error_abort);
no_hpet = 1;
}
isa_bus_irqs(isa_bus, gsi);
if (kvm_pic_in_kernel()) {
i8259 = kvm_i8259_init(isa_bus);
} else if (xen_enabled()) {
i8259 = xen_interrupt_controller_init();
} else {
i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
}
for (i = 0; i < ISA_NUM_IRQS; i++) {
gsi_state->i8259_irq[i] = i8259[i];
}
g_free(i8259);
if (pcmc->pci_enabled) {
ioapic_init_gsi(gsi_state, "i440fx");
}
pc_register_ferr_irq(gsi[13]);
pc_vga_init(isa_bus, pcmc->pci_enabled ? pci_bus : NULL);
assert(pcms->vmport != ON_OFF_AUTO__MAX);
if (pcms->vmport == ON_OFF_AUTO_AUTO) {
pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
}
pc_basic_device_init(isa_bus, gsi, &rtc_state, true,
(pcms->vmport != ON_OFF_AUTO_ON), 0x4);
pc_nic_init(isa_bus, pci_bus);
ide_drive_get(hd, ARRAY_SIZE(hd));
if (pcmc->pci_enabled) {
PCIDevice *dev;
if (xen_enabled()) {
dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
} else {
dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
}
idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
} else {
for(i = 0; i < MAX_IDE_BUS; i++) {
ISADevice *dev;
char busname[] = "ide.0";
dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
ide_irq[i],
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
busname[4] = '0' + i;
idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
}
}
pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
if (pcmc->pci_enabled && machine_usb(machine)) {
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
}
if (pcmc->pci_enabled && acpi_enabled) {
DeviceState *piix4_pm;
I2CBus *smbus;
smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
gsi[9], smi_irq,
pc_machine_is_smm_enabled(pcms),
&piix4_pm);
smbus_eeprom_init(smbus, 8, NULL, 0);
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
(Object **)&pcms->acpi_dev,
object_property_allow_set_link,
OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
}
if (pcmc->pci_enabled) {
pc_pci_device_init(pci_bus);
}
if (pcms->acpi_nvdimm_state.is_enabled) {
nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
pcms->fw_cfg, OBJECT(pcms));
}
}
| 1threat
|
Weird HashSet behavior with larger values : <p>I found a (for me) inexplicable behavior with an implemented HashSet in Java. I implemented the HashSet like this and filled it with the values of a list.</p>
<pre><code>HashSet<Integer> set = new HashSet<Integer>(list);
</code></pre>
<p>I first used a list containing numbers reaching fom 0 to 9 to fill the HashSet:</p>
<p>Example: <code>{1,0,5,9,6,7,3,1,3,6,1,5,1,3,4,9,9,7}</code><br>
Output: <code>[0, 1, 3, 4, 5, 6, 7, 9]</code></p>
<p>Since HashSets normally give back values in an ascending sorted order until now everything worked fine. But as soon as I started using a list containing bigger vaues it starts giving back the values in a weird way:</p>
<p>Example: <code>{67,1,122,19,456,42,144,42,3,34,5,5,42}</code><br>
Output: <code>[1, 34, 67, 3, 5, 456, 42, 144, 19, 122]</code></p>
<p>I read something about that this depends on the internal hashing algorithm here: <a href="https://stackoverflow.com/questions/16737229/java-hashset-shows-list-in-weird-order-always-starting-with-3][1]">Java HashSet shows list in weird order, always starting with 3</a> but that is even more confusing since I used the exact same HashSet just with different values.</p>
<p>Could please somebody explain me why this is happening?</p>
| 0debug
|
static void ide_issue_trim_cb(void *opaque, int ret)
{
TrimAIOCB *iocb = opaque;
if (ret >= 0) {
while (iocb->j < iocb->qiov->niov) {
int j = iocb->j;
while (++iocb->i < iocb->qiov->iov[j].iov_len / 8) {
int i = iocb->i;
uint64_t *buffer = iocb->qiov->iov[j].iov_base;
uint64_t entry = le64_to_cpu(buffer[i]);
uint64_t sector = entry & 0x0000ffffffffffffULL;
uint16_t count = entry >> 48;
if (count == 0) {
continue;
}
iocb->aiocb = blk_aio_pdiscard(iocb->blk,
sector << BDRV_SECTOR_BITS,
count << BDRV_SECTOR_BITS,
ide_issue_trim_cb, opaque);
return;
}
iocb->j++;
iocb->i = -1;
}
} else {
iocb->ret = ret;
}
iocb->aiocb = NULL;
if (iocb->bh) {
qemu_bh_schedule(iocb->bh);
}
}
| 1threat
|
asp.net textbox empty on postback : I am trying to create a login page, however whenever i click on login button username textbox's text becomes empty.<br>
I have tried :<br>
1. Using Updatepanel didnt work<br>
2. OnClientClick- it doesnt fires OnClick event<br>
3. I tried getting value by string usrnm=Page.Request.Form["username"].ToString();
but it gave null value<br>
4.I tried putting AutoPstBack="true" on textbox <br>
Heres by markUp:
<label for="username">Username</label>
<%--<input type="text" name="Uname" id="username"/>--%>
<asp:TextBox ID="txtusrnm" runat="server" AutoPostBack="true"/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="Pname" id="password">
</div>
<div class="form-group"><a href="#">Forgot password?</a></div>
<hr class="hr-sm hr-stroke" />
<div class="form-group">
<%--<input id="btnlogin" type="button" class="btn btn-primary btn-wide" value="Login" runat="server" onserverclick="btnlogin_ServerClick" >--%>
<asp:Button ID="btnLogin" runat="server" Text="Login" class="btn btn-primary btn-wide" OnClick="btnLogin_Click" UseSubmitBehavior="false" EnableViewState="true" />
| 0debug
|
Unit test Angular with Jasmine and Karma, Error:Can't bind to 'xxx' since it isn't a known property of 'xxxxxx'. : <p>I have a problem with an unit test in angular 5 with Jasmine and Karma.</p>
<p>The error is: "Can't bind to 'fruits' since it isn't a known property of 'my-component2'".</p>
<p>The unit test code is:</p>
<p>src/app/components/my-component1/my-component1.component.spec.ts:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { TestBed, inject, ComponentFixture, async} from '@angular/core/testing';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import { Post } from '../../models/post.model';
import { MyComponent1Component } from './my-component1.component';
import { MyService1Service } from '../../services/my-service1.service';
import { HttpClientModule, HttpClient,HttpHandler } from '@angular/common/http';
import {fruit} from '../../Models/fruit';
fdescribe('MyComponent1Component', () => {
let component: MyComponent1Component;
let fixture: ComponentFixture<MyComponent1Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MyComponent1Component ],
imports: [],
providers: [MyService1Service, HttpClient, HttpHandler, HttpTestingController]
})
.compileComponents();
}));
beforeEach(async(() => {
fixture = TestBed.createComponent(MyComponent1Component);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});</code></pre>
</div>
</div>
</p>
<p>And these are the code of my components:</p>
<p>src/app/components/my-component1/my-component1.component.ts:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { Component, OnInit } from '@angular/core';
import { MyService1Service} from '../../services/my-service1.service';
import {fruit} from '../../Models/fruit';
@Component({
selector: 'my-component1',
templateUrl: './my-component1.component.html',
styleUrls: ['./my-component1.component.css']
})
export class MyComponent1Component implements OnInit {
constructor(private _MyService1Service: MyService1Service) { }
public fruit= new fruit();
public fruits: fruit[];
ngOnInit() {
this._MyService1Service.getPost().subscribe(
result => {
console.log(result);
},
error => {
console.log(<any>error);
}
);
this.fruit.name = 'apple';
this.fruits.push(this.fruit);
}
}</code></pre>
</div>
</div>
</p>
<p>src/app/components/my-component1/my-component1.component.html:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> <p>
my-component1 works!
</p>
<my-component2 [fruits]=fruits></my-component2></code></pre>
</div>
</div>
</p>
<p>src/app/components/my-component2/my-component2.component.ts:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { Component, OnInit, Input } from '@angular/core';
import {fruit} from '../../Models/fruit';
@Component({
selector: 'my-component2',
templateUrl: './my-component2.component.html',
styleUrls: ['./my-component2.component.css']
})
export class MyComponent2Component implements OnInit {
@Input() fruits: fruit[];
constructor() { }
ngOnInit() {
}
}</code></pre>
</div>
</div>
</p>
<p>src/app/components/my-component2/my-component2.component.html:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><p>
my-component2 works!
</p></code></pre>
</div>
</div>
</p>
<p>It is a dummy project, can anybody help me?</p>
<p>Thanks :)</p>
| 0debug
|
Can TypeScript's `readonly` fully replace Immutable.js? : <p>I have worked on a couple of projects using React.js. Some of them have used Flux, some Redux and some were just plain React apps utilizing Context. </p>
<p>I really like the way how Redux is using functional patterns. However, there is a strong chance that developers unintentionally mutate the state. When searching for a solution, there is basically just one answer - Immutable.js. To be honest, I hate this library. It totally changes the way you use JavaScript. Moreover, it has to be implemented throughout the whole application, otherwise you end up having weird errors when some objects are plain JS and some are Immutable structures. Or you start using <code>.toJS()</code>, which is - again - very very bad.</p>
<p>Recently, a colleague of mine has suggested using TypeScript. Aside from the type safety, it has one interesting feature - you can define your own data structures, which have all their fields labeled as <code>readonly</code>. Such a structure would be essentially immutable. </p>
<p>I am not an expert on either Immutable.js or TypeScript. However, the promise of having immutable data structures inside Redux store and without using Immutable.js seems too good to be true. Is TypeScript's <code>readonly</code> a suitable replacement for Immutable.js? Or are there any hidden issues?</p>
| 0debug
|
static gnutls_certificate_credentials_t vnc_tls_initialize_x509_cred(VncState *vs)
{
gnutls_certificate_credentials_t x509_cred;
int ret;
if (!vs->vd->x509cacert) {
VNC_DEBUG("No CA x509 certificate specified\n");
return NULL;
}
if (!vs->vd->x509cert) {
VNC_DEBUG("No server x509 certificate specified\n");
return NULL;
}
if (!vs->vd->x509key) {
VNC_DEBUG("No server private key specified\n");
return NULL;
}
if ((ret = gnutls_certificate_allocate_credentials(&x509_cred)) < 0) {
VNC_DEBUG("Cannot allocate credentials %s\n", gnutls_strerror(ret));
return NULL;
}
if ((ret = gnutls_certificate_set_x509_trust_file(x509_cred,
vs->vd->x509cacert,
GNUTLS_X509_FMT_PEM)) < 0) {
VNC_DEBUG("Cannot load CA certificate %s\n", gnutls_strerror(ret));
gnutls_certificate_free_credentials(x509_cred);
return NULL;
}
if ((ret = gnutls_certificate_set_x509_key_file (x509_cred,
vs->vd->x509cert,
vs->vd->x509key,
GNUTLS_X509_FMT_PEM)) < 0) {
VNC_DEBUG("Cannot load certificate & key %s\n", gnutls_strerror(ret));
gnutls_certificate_free_credentials(x509_cred);
return NULL;
}
if (vs->vd->x509cacrl) {
if ((ret = gnutls_certificate_set_x509_crl_file(x509_cred,
vs->vd->x509cacrl,
GNUTLS_X509_FMT_PEM)) < 0) {
VNC_DEBUG("Cannot load CRL %s\n", gnutls_strerror(ret));
gnutls_certificate_free_credentials(x509_cred);
return NULL;
}
}
gnutls_certificate_set_dh_params (x509_cred, dh_params);
return x509_cred;
}
| 1threat
|
php imagick convert pdf to jpg not working : please i need help on this ASAP, i've been on it for the past 3days now. i installed imagick and ghostscript on my windows OS. i want to convert a pdf file to an image. The imagick is installed and displaying in the phpinfo but the pdf won't be converted to an image.
i've tried using the 'magick' keyword instead of convert.
i also installed legacy utilities and used the 'convert' function all to no avail.
here are my xampp and pc specs
arch: x86, vc14, ts enabled, win. 8, gswin32
` if(move_uploaded_file($_FILES['pdf']['tmp_name'], $pdfDirectory.$filename)) {
//the path to the PDF file
$pdfWithPath = $pdfDirectory.$filename;
//add the desired extension to the thumbnail
$thumb = $thumb.".jpg";
//execute imageMagick's 'convert', setting the color space to RGB and size to 200px wide
exec("convert \"{$pdfWithPath}[0]\" -colorspace RGB -geometry 100 $thumbDirectory$thumb");
//show the image
$thumbnail = "<p><a href=\"$pdfWithPath\"><img src=\"pdfimage/$thumb\" alt=\"\" /></a></p>";
$filename1 = "<p><a href=\"$pdfWithPath\"> FILE </a></p>";
//echo "$thumbnail";
//echo "$filename";
}
$query = "INSERT INTO files (thumb, department, title, author, publisher, date_published, isbn) VALUES ('$thumbnail' , '$dept', '$filename', '$author', '$publisher', '$datepublished', '$isbn')";
$run = mysqli_query($conn, $query);`
| 0debug
|
VBScript Needed Plz : I have the below SQL query that return dates, I need to evaluate the dates and result only dates older than today by one day only. Appreciate your Help
SELECT Address,max(Date+ ' ' + time)as last_Trans_time FROM AxA_Transactions where address is not null GROUP BY Address
Thanks in Advance
| 0debug
|
DISAS_INSN(divl)
{
TCGv num;
TCGv den;
TCGv reg;
uint16_t ext;
ext = read_im16(env, s);
if (ext & 0x87f8) {
gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);
return;
}
num = DREG(ext, 12);
reg = DREG(ext, 0);
tcg_gen_mov_i32(QREG_DIV1, num);
SRC_EA(env, den, OS_LONG, 0, NULL);
tcg_gen_mov_i32(QREG_DIV2, den);
if (ext & 0x0800) {
gen_helper_divs(cpu_env, tcg_const_i32(0));
} else {
gen_helper_divu(cpu_env, tcg_const_i32(0));
}
if ((ext & 7) == ((ext >> 12) & 7)) {
tcg_gen_mov_i32 (reg, QREG_DIV1);
} else {
tcg_gen_mov_i32 (reg, QREG_DIV2);
}
set_cc_op(s, CC_OP_FLAGS);
}
| 1threat
|
MySql SQL_CALC_FOUND_ROWS disabling the order by clause. : I am using MySql and SQL_CALC_FOUND_ROWS. It seems to be disabling the order by clause.
MySql
Server version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)
SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS * FROM (
disables the ORDER BY clause
I see it was supposed to be fixed.
Anyone have an ideal on how I can fix this issue?
Thanks
Phil
http://www.michikono.com/2007/08/07/the-secret-of-sql_calc_found_rows/
Posted by Wade Bowmer on May 14 2006 11:40pm
Be aware that using SQL_CALC_FOUND_ROWS and FOUND_ROWS() disables ORDER BY … LIMIT optimizations (see bugs http://bugs.mysql.com/bug.php?id=18454 and http://bugs.mysql.com/bug.php?id=19553). Until it’s fixed, you should run your own benchmarks with and without it.
https://bugs.mysql.com/bug.php?id=18454
| 0debug
|
Why is the answer not in demand? : I need your help, I would like the question: "how tall are you?"
the answer goes down under each question, example:
"how tall are you?"
question1: 1.50m?
answer1: ok
question2: 1.80m?
answer2: ok
question3: 2m?
answer3: ok
instead now it works like this:
question1: 1.5m?
question2: 1.8m?
question3: 2?
answer1: ok
enter code here
<script>
let questions = [
{ id: "q1", terminal: false, yes: "q2", no: "q4" },
{ id: "q2", terminal: false, yes: "q3", no: "q4" },
{ id: "q3", terminal: false, yes: "q4", no: "q4" , boh:"q4" }
];
// Runs the processResult function when the user clicks on the page
document.addEventListener("click", processResponse);
function processResponse(event) { // `event` is the click that
triggered the function
// Makes sure a box was clicked before proceeding
if(event.target.classList.contains("box")){
// Identifies HTML elements (and the 'response' data attribute)
const
box = event.target,
question = box.parentElement,
response = box.dataset.response,
boxAndSibling = question.querySelectorAll(".box"),
sibling = response == "no" ? boxAndSibling[0] : boxAndSibling[1],
resultDisplay = document.getElementById("result");
// Makes sure the other box is not already checked before proceeding
if(!sibling.classList.contains("check-box")){
box.classList.toggle("check-box");
// Finds the question in the array
for(let quest of questions){
if(quest.id == question.id){
// Shows the result for terminal questions
if(quest.terminal){
result = quest[response];
resultDisplay.innerHTML = "";
}
// Or otherwise shows the next question
else{
const next = document.getElementById(quest[response]);
next.classList.toggle("active");
}
}
}
}
}
}
</script>
<style>
ul { list-style-type: none; }
#myUL { margin: 0; padding: 0; }
.box {
cursor: pointer; -webkit-user-select: none; -moz-user-
select: none;
-ms-user-select: none; user-select: none;
}
.box::before { content: "\2610"; color: black; display: inline- block; margin-right: 6px; }
.check-box::before { content: "\2611"; color: dodgerblue; }
.nested { display: none; }
.active { display: block; }
#result{ font-size: 2em; }
</style>
<div id="q1">
are you a man?</span><br />
<span class="box" data-response="yes">Yes</span>
<span class="box" data-response="no">No</span><br />
</div>
<div id="q2" class="nested">
<span>you are tall?</span><br />
<span class="box" data-response="yes">Yes</span>
<span class="box" data-response="no">No</span><br />
</div>
<div id="q3" class="nested">
<span>how tall are you?</span><br />
<span class="box" data-response="yes">1.50 m?</span><br />
<span class="box" data-response="no">1.80 m?</span><br />
<span class="box" data-response="boh">2 m?</span><br />
</div>
<div id="q4" class="nested">
<span>ok</span><br />
</div>
| 0debug
|
In pgadmin3 do i get U I as in Mysql workbench : Am very new to postgres Sql. I got PgAdmin3 to work with database of postgresql. Am not so good with writing queries in Sql. As in Mysql workbench there is EER UI diagram representation which help us to draw new table easily. Do we have graphical representation of EER Diagram? If it is there, please help me anyone how to write draw new table.
| 0debug
|
How to add bulk number of white spaces in C# code? : <p>i have a count to add white spaces to the text file.
For Example:
12 as count means need to add 12 spaces in the existing text file.
is there any possible way?</p>
| 0debug
|
google play services 8.4.0 - classes.jar not found - android studio : <p>I am getting this error when I Run or Debug the app but when I build or clean my project there are no errors. It sounds strange but I've wasted my 4-5 hours searching for this but nothing was helpful.
Error:</p>
<pre><code>Error:Execution failed for task ':app:compileDebugJavaWithJavac'.> java.io.FileNotFoundException: C:\Users\Saeed Jassani\Downloads\AppName\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)
</code></pre>
<p>build.gradle file:</p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
</code></pre>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.