query_id stringlengths 4 64 | query_authorID stringlengths 6 40 | query_text stringlengths 66 72.1k | candidate_id stringlengths 5 64 | candidate_authorID stringlengths 6 40 | candidate_text stringlengths 9 101k |
|---|---|---|---|---|---|
215e5080f52791c470d8fbfbcf78192ffe841859b9a2460a204eea69db8fddb6 | ['7399dc24a69c4ecd8b2e38cb73dbc6e1'] | This issue happens when you reference a .NET Standard project from a .NET 4.x project: none of the .NET Standard project's nuget package references are brought in as dependencies.
I resolved by add System.Runtime 4.3 and NETStandard.Library package and !!important!! I use refactor tool to look up the System.Runtime.dll version, It is <IP_ADDRESS> not 4.3 and then add an bindingRedirect in .config
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="<IP_ADDRESS>-<IP_ADDRESS>" newVersion="<IP_ADDRESS>" />
</dependentAssembly>
| 5fb758667ad2e66d9bdbc3e9ae0c5d36a75157e8c1866bd980dd2ad1f68f9428 | ['7399dc24a69c4ecd8b2e38cb73dbc6e1'] | For a dynamic component type,I do like this, it works on Angular 9.
export class FromItemComponentBase {
constructor(private hostElement: ElementRef) {
hostElement.nativeElement.__component=this;
}
}
@Component({
selector: 'input-error',
templateUrl: 'component.html'
})
export class FromItemErrorComponent extends FromItemComponentBase {
constructor(private hostElement: ElementRef) {
super(hostElement);
}
}
@Component({
selector: 'input-password',
templateUrl: 'component.html'
})
export class FromItemPasswordComponent extends FromItemComponentBase {
constructor(private hostElement: ElementRef) {
super(hostElement);
}
}
@Directive({selector: 'input-error,input-password,input-text'})
export class FormInputDirective {
component:FromItemComponentBase;
constructor(private hostElement: ElementRef) {
this.component=hostElement.nativeElement.__component;
}
}
|
74c8812b78dde60f14ebacad88c9af06fcb6afcc99359e42fca191ebb3916b79 | ['73a54db134c64392a12a0b0b4436cf21'] | I found that if I moved the Virtual Box VM Launcher on to the secondary monitor, and THEN pressed "Start" I was able to resize the window that appeared to fit onto my secondary monitor. If I started it from my primary monitor, I could not resize it any larger than my primary monitor.
| 985f1ba72ddfc39c716ab8958c4fc97b800a4e4cb1e1238f1b141c6efcde971c | ['73a54db134c64392a12a0b0b4436cf21'] | label DRBL Live
MENU DEFAULT
# MENU HIDE
MENU LABEL DRBL Live (Default settings)
# MENU PASSWD
kernel drbl/live/vmlinuz
append initrd=drbl/live/initrd.img boot=live config nomodeset vga=785 ip=dhcp nosplash netboot=nfs nfsroot=<IP_ADDRESS>:/var/lib/tftpboot/drbl i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.blacklist=yes
|
fea30f441af3a44a4e6b6dcb7f7ae3e7048a1482dee5ccc1930b776bfbabeac7 | ['73c38b6fefa14ced8991dc272e1014e5'] | var vis = new pv.Panel().canvas('grphLangSpeakers').height(langCount*(barWidth+barGap)).width(canvasWidth)
.add(pv.Bar)
.data(popCountArray)
.bottom(0).width(function(d){ return d})
.height(barWidth)
.top(function() {return this.index * (barGap+barWidth)});
vis.render();
I'm using above code to generate a Bar Chart using Protovis. How to change this chart to Logarithmic Scale?
| bc97335c5a2a08d0ec913933dfd867e0b9c63c2b4bbb773dfbf15617deaeb164 | ['73c38b6fefa14ced8991dc272e1014e5'] | The following code provides the desired graphs:
% extract coordinates
data = December; % suppose the coordinates are stored in the variable December
longitude_E = getcolumn(data(1:size(data),:),1);
latitude_N = getcolumn(data(1:size(data),:),2);
% load boundry data
load coast
m_proj('mercator','long',[135 240],'lat',[-40 0]);
axesm('MapProjection','mercator','MapLatLimit',[-40 0],'MapLonLimit',[135 240]);
framem
m_coast('patch',[0.7 0.7 0.7]);
m_grid('box','fancy','tickdir','in');
h=plotm(latitude_N,longitude_E,'.b','MarkerSize',5');
% display boundry information
hp = plotm(lat,long,'k');
set(hp,'LineWidth',2.0);
The figure obtained is
|
d5f0d9d0d15f6ebadab18bd9924eb7729cc5d2432631a17a9c23f5c1ed53cece | ['73c4f28ea6ef4a888843aae6dbc7c22f'] | Bienvenido.
Siguiendo la documentación que proporciona firebase que la puedes consultar aqui, podemos usar el método set(), por ejemplo:
db.collection("cities").doc("new-city-id").set(data);
donde "cities" es tu colección y "new-city-id" será el id que quieras que tenga el documento a crear y 'data' los datos que quieras guardar
PD: para que se muestren en orden en tu tabla deberás de empezar a guardar desde 01.
Saludos!!!
| b99ef2578b75b31e932f05287ecedc746fe4b152d4bf2abbfa60eb32c34416ef | ['73c4f28ea6ef4a888843aae6dbc7c22f'] | @Davor that's not too uncommon in language. It even happens in the modern day. Just look at the word cosplay in English which is from Japanese which took it from English "costume play". After the word comes back into the language second-hand it probably has picked up some different nuance the original word or phrase didn't have. |
ff3a38bb0abe97cdad5707dcee2047d145785c3853504e1ea8829f97d739e042 | ['73ead18b1a18465faf1c470c5cf3e2e8'] | So I am currently employed at an Information Technology/ Help Desk internship through my school's work study program, and in order to make my transition out as smooth as possible, my boss has asked me to train my replacement for (ideally) a month. I have no real problem doing this, as I am not located far from either work or school and the person I had in mind to replace me is a friend of mine.
However, the process of actually transitioning out is a little more complicated. I do not have another job secured per se, but I can continue to tutor at the school at the same hours and pay until I graduate. Since I'd rather not be without the money, I'm thinking the best way to do this is leave the internship early, help train the replacement, and tutor until I can find a job.
This seems to be the safest back-up option to me, but I would like to start interviewing ASAP. So my question then is this: Suppose I interview well and manage to get an offer in the same week as I begin training my replacement. Would I be unreasonable in proposing a start date a month out?
| 12ca64757f49ef41574498997729dfe781adfc1567a3af363a6d3eeb7794598d | ['73ead18b1a18465faf1c470c5cf3e2e8'] | I recently watched the Airbus videos on making the first PAL and Air China A350s. PAL’s vertical stabilizer was painted before being installed, as explained in 'Why are the tails always painted, but not the fuselage, in test and delivery flights?'.
But Air China’s (MSN 167) was painted with the fuselage (after installation). This confused me because I have been told that painting the vertical stabilizer is for balancing the rudder.
What factors affect when the rudder is painted?
A photo for MSN 167 confirming what was seen in the video. (flickr.com)
|
8d08a649e864d9245ac0a457df56de1810f567937618fb57fc8b7fadbf22fdff | ['73f76c68cb2e440987a333081e0be2ea'] | As example relation between past purchase count and future revenue have a positive correlation. Let's assume we have two bins - [1,2] and [3,4] with mean revenue of the bins as $50 and $54. Even though average/mean is different between bins the distribution of the data/variance is high in these two bins(overlapping confidence interval/inter quartiles) so that it make sense to have these grouped as a single bin. Trying to achieve this. There is no limit on the numbers or width of the bins. | f3d9edef013a57e934ae91d4c8b33e2ae88fb312782446eac10d625a32c8945c | ['73f76c68cb2e440987a333081e0be2ea'] | <PERSON> I use CreditWise, they show all 3 reporting agencies and FICO. They provide a level of detail which I am accustomed to and they show if loans have been paid off, whether they are open, active, closed, etc and they show if any payments were ever delinquent. Also, it is free for Capital One customers. |
3dd90865e98f0565eb7935583efc47f6ef5c05e57d7fd58e775a3245bc164cd6 | ['742366042777463789f4e8a857d37be4'] | I have been working on a new version of my company's website using Polymer and Google App Engine. The design looks great on my local development server, but as it gets deployed polymer elements' styles are completely messed up.
This is what it looks like when deployed to the app engine:
http://data-buckeye-590.appspot.com/HTL
Any clues what might be causing it?
| 3decd711543e3133034247095017355cd5aa88fe0ad090e0479273862cbde674 | ['742366042777463789f4e8a857d37be4'] | Thanks for the support <PERSON>. Got a tweet from @robdodson yesterday that solved the problem. Turns out that Google App Engine mod_pagespeed was messing up the internal styling of my polymer elements.
After turning off pagespeed on the application settings console the app is running as it should. But there is a catch!!!
It was impossible to find the pagespeed (enable/disable) checkbox on the new Developers Console https://console.developers.google.com
In order to turn pagespeed off it is best one visits the old application settings console at https://appengine.google.com/settings
|
9f2e94ce94998ae5cd5ad836f0077a55d8d7c199f95600df66a3d2412fbde7a1 | ['7439737b572a404a9258771e02a6b79c'] | I have troubles installing plugins I got with a Theme I purchased on ThemeForest. The plugins with the Theme aren't zipped as usual. They all come like this
nameoftheplugin > (many folders like "assets", "css", "js", ...)
I tried to move the folder in the wp-content/plugins directory but nothing happens. Is there a way I can install theses plugins ? Usually I install WP plugins by uploading a .zip file so I'm lost here...
Thank you guys !
| 652778eb4693f486ab8668abf03ad6e355c3647590e4b472c4cc91d7612e4939 | ['7439737b572a404a9258771e02a6b79c'] | I recently started a new project using Angular Seed Project (https://github.com/angular/angular-seed/) and I noticed something strange. I'm quite new to Angular but in all the tutorials I did the routing part was always in the "main" JS file (usually named app.js). However here, in this "seed project" the only route definition in app.js is :
config(['$routeProvider', function($routeProvider) { $routeProvider.otherwise({redirectTo: '/view1'});}]);
The other routing definitions are in each partials Js file (within the controller) by example file view1/view1.js :
angular.module('myApp.view1', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'
});
}])
and view2/view2.js :
angular.module('myApp.view2', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view2', {
templateUrl: 'view2/view2.html',
controller: 'View2Ctrl'
});
}])
So I understand that since all the Js files are properly included the result is the same as if all the routing was done in app.js but I wonder why it is structured like this. The angular seed is meant to be a "best practices" starter for Angular. So here is my question, is it considered a good practice to split the routing definitions in every partial JS file instead of defining everything in app.js ? Why ?
Thank you guys ! :)
|
356ee4ad33cf6b2c847462e4f4e0f48d13b7b891529b98d067ae151be6470037 | ['7448ac64f93341d0a15700d5c0a99895'] | so thanks to this
System-wide mutex in Python on Linux
i got from it is what i am asking for is a system wide mutex, and you can achive it by using ilock, and this is my example
file 1
from ilock import ILock
print("start this process first")
lock = ILock("VoidLock")
with lock:
print("now this process inside, run the other procsses")
input("enter anything so the other procsses can get inside the lock")
print("the lock is relased")
input()
file 2
from ilock import ILock
lock = ILock("VoidLock")
print("now this process is witting")
with lock:
print("now this process is inside ")
input()
input()
| ad04ec882c0cf48bb0d0fdc6dd94758686c0d9c1d3d2c054757b728f3dc908d8 | ['7448ac64f93341d0a15700d5c0a99895'] | hello i'm novice at programing and i was playing with classes to get used to it, but i found that when ever i use loop with an array in my class i get this error
Unhandled exception thrown: write access violation. bunnies_array was 0x5CB3CBA.
bunny.h
#pragma once
#include <iostream>
class <PERSON> {
public:
int change(int(&bunnies_array)[100]);
};
bunny.cpp
#include "bunny.h"
int bunny<IP_ADDRESS>change( int(&array)[100])
{
for ( int i = 0; i < 100; i++)
{
array[i] = 1;
}
return 0;
}
main.cpp
#include "bunny.h"
int main()
{
int bunnies_array[100];
bunny trail;
trail.change((&bunnies_array)[100]);
std<IP_ADDRESS>cout << bunnies_array[0];
return 0;
}
|
3bc738ed5d4c5b0792c522f8349ba7c987b4c1fcb9d960d85c740bc6e26eae61 | ['7454a28df23c465cb2d70bc630923c9b'] | 1 10.00
2 11.23
3 12.32
4 23.55
5 15.33
6 12.23
7 22
8 10.33
9 8.9
10 5.89
I have a dat file with above values. I want to subtract line 1 of column 2 with line 2,3,4...10 of column 2, then line 2 of column 2 with line 3,4,5...10, then 3 with 4,5..10 and so on until line 9 with 10. Also I would like to print the values and which line number subtracted by which? How can I do that in python? Could you please help me? I tried with numpy but could not figure out solve it with my conditions.
I will really appreciate your help. Thanks
| 1eee3500da1ef9d19760426b72fca76d5122113356f7dd56d60da4d976788ba4 | ['7454a28df23c465cb2d70bc630923c9b'] | My friend installed an apache2 in my computer from his computer. When I look at the net-stat of my machine for apache2, it shows the following information in the picture. How can I make my machine listen to port 80? Is it appropriate to install apache2 this way? I am new to this, please suggest me what does the information in the picture carry any security issue with this?
Thank you
|
f9dcd4f9ec466ef3094f9f69b59b01572ef56f5242a7288ff0e2ed268247b68c | ['746fcc26e753415db804323582dfca6d'] | why do i still get an error after using carefully the above points. I have used option -crlf and then connected with wikipedia.org site : openssl.exe s_client -connect -crlf www.wikipedia.org:443 -servername www.wikipedia.org
and when i try to get HEAD request : "HEAD / HTTP/1.1\r\nHost: www.wikipedia.org\r\n\r\n" - but getting an error "HTTP/1.0 400 Invalid HTTP Request" . can someone help me out | 34da8a66d0b5d76de99f772397ceeed971a4fdb5bc1bdbce3dfe7a8242ee1323 | ['746fcc26e753415db804323582dfca6d'] | I want to close ports on my windows computer without using any firewall or similar software? Also i only want to open them when i use an explicit command. I didnt tried anything because i have no idea how to do this. i searched SU but only found questions about doing it with a firewall software but i dont want a 3rd party software again.
i hope what i try to do is possible and i will get an answer here. thank you
|
ac1bc3663a747840373a19b69bbbbed2dcfefa96ca4a1b03b17c3e3de4983d78 | ['74810856d22a435ca160e30114dbcb1a'] | What is the right / most popular way to utilize the Singleton Pattern.
Limit the no. of calls to getInstance(), preferably call it only once, and pass the object around to other classes during their instantiation?
class SingletonClass {
// Implementataion
}
class MainClass {
private SingletonClass singletonClassObject;
public MainClass() {
singletonClassObject = SingletonClass.getInstance();
new SomeClass(singletonClassObject).doSomething();
new SomeOtherClass(singletonClassObject).doSomethingElse();
}
}
class SomeClass {
private SingletonClass singletonClassObject;
public SomeClass(SingletonClass singletonClassObject) {
this.singletonClassObject = singletonClassObject;
}
public void doSomething() {
System.out.println(singletonClassObject.getStuff());
}
}
class SomeOtherClass {
private SingletonClass singletonClassObject;
public SomeOtherClass(SingletonClass singletonClassObject) {
this.singletonClassObject = singletonClassObject;
}
public void doSomethingElse() {
System.out.println(singletonClassObject.getStuff());
}
}
Don't pass the singleton object around. Rather call get the object reference in each class and save the reference as an instance variable and use it wherever required.
class SingletonClass {
// Implementataion
}
class MainClass {
public MainClass() {
new SomeClass().doSomething();
new SomeOtherClass().doSomethingElse();
}
}
class SomeClass {
private SingletonClass singletonClassObject;
public SomeClass() {
singletonClassObject = SingletonClass.getInstance();
}
public void doSomething() {
System.out.println(singletonClassObject.getStuff());
}
}
class SomeOtherClass {
private SingletonClass singletonClassObject;
public SomeOtherClass() {
singletonClassObject = SingletonClass.getInstance();
}
public void doSomethingElse() {
System.out.println(singletonClassObject.getStuff());
}
}
Don't even save the reference as an instance variable, rather use SingletonClass.getInstance() everywhere you need the object.
class SingletonClass {
// Implementataion
}
class MainClass {
public MainClass() {
new SomeClass().doSomething();
new SomeOtherClass().doSomethingElse();
}
}
class SomeClass {
public SomeClass() {
}
public void doSomething() {
System.out.println(SingletonClass.getInstance().getStuff());
}
}
class SomeOtherClass {
public SomeOtherClass() {
}
public void doSomethingElse() {
System.out.println(SingletonClass.getInstance().getStuff());
}
}
How do these approaches compare with each other w.r.t. better design, testability etc? Which is better and why?
| 35e634da9cc0b149f2b5ca5bf82d890587c60f614bc4035ca9a5ec9e71823c35 | ['74810856d22a435ca160e30114dbcb1a'] | I've been reading that in most cases (like gcc) the compiler reads the source code in a high level language and spits out the corresponding machine code. Now, machine code by definition is the code that a processor can understand directly. So, machine code should be only machine (processor) dependent and OS independent. But this is not the case. Even if 2 different operating systems are running on the same processor, I can not run the same compiled file (.exe for Windows or .out for Linux) on both the Operating Systems.
So, what am I missing? Is the output of a gcc compiler (and most compilers) not Machine Code? Or is Machine Code not the lowest level of code and the OS translated it further to a set of instructions that the processor can execute?
|
77cc68c811f55e7f7bdf74ca802363aed8e9cc2fe9e7766f2e956d7f5ea8db8e | ['7484cf17166741408409e82236dfd0e0'] | So I have been reading other posts about Dense layers and the input shape and unfortunately am just not really grasping how to adjust the input shape. I am trying to replicate a model that is here:
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
import tensorflow as tf
model = Sequential()
model.add(tf.keras.Input(shape=input_shape))
model.add(Dense(64,
activation='tanh'))
model.add(Dense(64,
activation='tanh'))
model.add(Dropout(0.15))
model.compile(loss=root_mean_squared_error,
optimizer=tf.keras.optimizers.Adam(learning_rate))
My inputs have been in batches of 168 elements with 3 features each. To my understanding (which is very limited, I've been learning what I can as I go), this would leave me with an input shape of (168,3). When I input that the error code that comes out is
ValueError: Dimensions must be equal, but are 64 and 3 for '{{node root_mean_squared_error/sub}} =
Sub[T=DT_FLOAT](sequential/dropout/dropout/Mul_1, Cast)' with input shapes: [?,168,64], [?,1,3].
Is there something I am missing? When I do the same thing with an LSTM model I just put the 'input_shape' variable as a parameter in the first LSTM layer. Thank you in advance for helping me and maybe pointing me in the right direction.
| d44cbfe3c23642b54c3bdac2092d490ec315ff15b776701f4c5364e2e4dd8cfe | ['7484cf17166741408409e82236dfd0e0'] | Experience is the short answer for this.
A more detailed explanation is understanding the scope of your needs. If you believe that the problem you are faced with is a common one, chances are that someone has come up with a solution for it and put it into a module. You become aware of modules by running into a challenge and then searching up how others have solved it. You will most likely run into others who have come across the same thing and have used others modules to solve it.
The more specific your problem is the less likely there will be a module already made for it. For example, plotting data is a widely common need, which is why the Matplotlib module is known by most python programmers. Searching the PyPi website will show you a lot of modules that can come in handy later.
Good Luck and have fun looking at all the oddly specific modules out there!
|
d4539b86642c60dd3306c546faf40ae9980f1b23efe5ac77c02f23120b59096b | ['74868e996fce4fa2ba3eb0fcba0a150c'] | I don't have good knowledge about AWS as per your output of the playbook and the playbook you posted.
"invocation": {
"module_args": {
"assign_public_ip": false,
"aws_access_key": null,
"aws_secret_key": null,
"count": 3,
"count_tag": null,
"ebs_optimized": false,
"ec2_url": null,
"exact_count": null,
"group": [
"mayassar-es-external",
"elasticsearch-mayassar-production",
"Test_nishant"
],
Here the count is 3, so it creates three instances in both the regions
a and b
If you want to traverse output you can use the following method
http://docs.ansible.com/ansible/latest/playbooks_loops.html#looping-over-subelements
| ae98b9475ddc0a96b26f663987f351f4d977f092020c85e421d00c238a042d93 | ['74868e996fce4fa2ba3eb0fcba0a150c'] | which kubernetes version are you using?
If you are using kubenetes 1.6.x you need to define RBAC rules for the controller to access the default-http-backend service and other required components.
Please refer to this issue
https://github.com/kubernetes/ingress/issues/575
The manifest file in the first comment worked fine for me.
|
e16f87ef385f9403cb50050fcd27405b80409240cb1fea26642a269bd0bcc689 | ['748dc0fe38134809bb8dc927feae705d'] | Im pretty new to VB.NET and was wondering how I'd fix this error im getting.
CODE
Dim sql As String = "SELECT (USER) FROM USER_CONSTANT"
Dim conn As New SqlConnection(strConn)
Dim objDR As SqlDataReader
Dim Cmd As New SqlCommand(sql, conn)
conn.Open()
objDR = Cmd.ExecuteScalar(CommandBehavior.CloseConnection)
While objDR.Read()
Label7.Text = objDR("USER")
| 61f16ee01e022d14aeba1aea54b1cfe4d28a54a65958336282f1dde3f6cfc88f | ['748dc0fe38134809bb8dc927feae705d'] | I have created a simple Username and Password login form in visual studio using c# which works great I then coded it so that whatever Username and Password was entered into the two textboxes was saved as a string... Now I want to pass those strings as parameters and store them into an SQL query... Any idea how I would go about doing this?
|
721c1b64af8b5219115f51f89b6ff32a63fea476ab788b9854d7c53d3f28e794 | ['748f4fdc85f44914bdef2ac68d092653'] | After looking into it some more, I discovered that the IWizard interface is not even called until after the folder structure for the solution (not the projects) has already been created. Since I need to make progress, I've decided to go ahead and switch it to an Add-In to Visual Studio instead of a purely templated process.
I've already had much more luck creating the solution programmatically then adding in the templated projects to my solution. I was able to get around the problem. I've snipped some code but this gives the basic idea.
System.Type vsType = System.Type.GetTypeFromProgID("VisualStudio.DTE.9.0");
DTE2 vs = (DTE2)System.Activator.CreateInstance(vsType, true);
soln = (Solution2)vs.Solution;
soln.Create(PathProjectRoot, SolutionName);
soln.SaveAs(SolutionName);
Thanks everyone for the suggestions.
| 11cf148e21d293f26c554e408769cbd79a5d73ce8bd88879644c4512d6f8527c | ['748f4fdc85f44914bdef2ac68d092653'] | @Wyatt8740 I studied this more and read the documentation, I believe `ServerAliveCountMax=3` has a different meaning. If there is a failure, it will try reconnecting 3 more times and then give up. At some point retrying is futile, but that depends on the application. Then again, I think the man page could be more specific, there's different ways to interpret the way it's worded IMO. FWIW my specific problem went away after switching to ProtonVPN. I think it's also worth checking ssh configuration on the client and the server, they have separate options, so all you really need is `-o reconnect` |
8f5297dda71a7600b463a6b012bf4927a7b0005429b24df5e2e813e2402522f0 | ['7498233de02f46b8b587f859b85f497b'] | I don't like the idea to manipulate the data itself for the purpose of reporting. If you change the NULL values to 99 to just to make your reporting easier then the I consider that data as corrupted. What if there are other consumer apart from reporting which need genuine data?
I would rather write an intelligent query for the report. For example, if you use ISNULL(columnname, 99), it would return 99 whenever the column value is NULL.
| b5206a345a6792f365733e903e0aebe1435fe891c9c27dae6d702f1fdf7a82b5 | ['7498233de02f46b8b587f859b85f497b'] | We are talking about Application resources here (as opposed to provisioning resources) and they should be deployed to {SharePointRoot}\CONFIG\Resources folder. Make sure the resources files used by your application pages are deployed to that folder when your WSP is deployed.
When a new web application is created, the resources are initially copied to the App_GlobalResources folder, you are fine here.
But when web application is already created (which is your case), you need the resources to be copied to existing web applications. You can do this manually with this command
stsadm –o copyappbincontent
Or you can automate (which is what you want) this by including the following in your FeatureActivated event in your feature receiver. For Central Administration resources and site maps, call
SPWebService.AdministrationService.ApplyApplicationContentToLocalServer();
For regular application page resources and site maps,
SPFarm.Local.Services.GetValue().ApplyApplicationContentToLocalServer();
|
6da49589f7e31dce15f86f296162bea1cebdce11c01a6612b1536bb15e94faf9 | ['749e03b276b84a968cff6483aafb3450'] | This is simple case of overfitting.
To improve accuracy, I would suggest to do the following changes:
Since your 'x' variable are sentences, you can try to use Sequential model with one Embedding Layer and one LSTM layer:
from tensorflow.keras.layers import Dense, Embedding, LSTM
from tensorflow.keras.models import Sequential
model = Sequential()
model.add(Embedding(max_features, 32))
model.add(LSTM(32)
Add the last layer as Dense Layer, and the loss function as binary_crossentropy:
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])
Fit the model and store the history variable to find the optimal epochs:
history = model.fit(x_train, y_train, epochs=20, batch_size=128, validation_split=0.2)
Plot the following 2 curves:
i) Validation loss vs epochs
ii) Validation accuracy vs epochs
# Plotting Results
import matplotlib.pyplot as plt
acc = history.history['accuracy']
val_acc = history.history['val_accuracy']
loss = history.history['loss']
val_loss = history.history['val_loss']
epochs = range(1, len(acc) + 1)
plt.plot(epochs, acc, 'b', label='Training acc')
plt.plot(epochs, val_acc, 'g', label='Validation acc')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.title('Training and validation accuracy')
plt.legend()
fig = plt.figure()
fig.savefig('acc.png')
plt.plot(epochs, loss, 'b', label='Training loss')
plt.plot(epochs, val_loss, 'g', label='Validation loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.title('Training and validation loss')
plt.legend()
plt.show()
After which you will get a graph something like these:
For this specific case, we see that the optimal epochs is occurring at 12, So we need to again train with 12 epochs and test on test data.
model.fit(x_train, y_train, epochs=12, batch_size=128)
model.evaluate(x_test, y_test)
| 16f36df293994a75e2da2138731cb727e820b9939cb161fd4a7f0e7ff8dd4cf4 | ['749e03b276b84a968cff6483aafb3450'] | Well, I had a very long night and managed to knock out the whole character sheet with help of an IRC channel and getting a bit obsessive over the items.
The end stats were:
STR 6 DEX 14 CON 6 INT 12 WIS 7 CHA 18
HP 4, AC 14, Init 2, FORT 4, REF 2, WILL 0
She's got a fancy pink scythe for coup de gracing since she focuses more on spells for damage - specifically she's got one of each type of elemental damage via her Kobold bloodline.
Electrical: Trap runes, 8 times per day thanks to the effective +2 to charisma for sorceror abilities
Fire: Spark (cantrip) and Grease (level 1)
Ice: Ray of Frost (cantrip)
Acid: Acid Splash (cantrip)
She's also got Message for her last cantrip and Mage Armour for her other level 1 spell; Stealth, Bluff and Craft (Trapmaking) are her skills she took ranks in partly due to racial buffs.
Her traits are Day Raider to remove her light sensitivity and Dragon Affinity for the effective +2 to charisma for sorceror abilities/spells.
Her feat is Kobold Confidence, which gives her charisma bonus to Fort saves and lets her survive up to her charisma in negatives before dying, keeping with the glass cannon idea I had for her.
She has a billow cape for pit traps, wears glasses and smoked goggles to fake being light sensitive (why not be underestimated?), has an armoured kilt, and dramatically flings away her cape and backpack when combat looms (which just barely gets her under her light load).
She's also so frail that she's afraid of water due to her swim penalty and as such bought a collapsible bath, along with a hanging tent and folding chair that are carried by a pack capybara (that sleeps in her tent with her cause she's a huge softie) due to her horrible strength score.
I'm also going with a backstory of her being raised by dwarves in a 'prodigal daughter returns' type deal (a la Captain <PERSON>), and she's got predominately white scales but has enough scales on her limbs that come from different draconic bloodlines, explaining why she's got enough kobold bloodline to gain the benefits of the Bloodline.
I think that's about everything, thank you all again for all the help, I greatly appreciate it!
|
8040d4db40be37f0e91ec8dcb10d010e0a1f8a27f8f77f6634acdd2f7a7a5323 | ['74a1cc0a135045bd9bc27c0d67a6804c'] | I would like to display 2 items on differnt nodes at the same time. Here's my xml file:
<applications>
<application name="CAFC">
<infos>
<info>Apple</info>
<info>Banana</info>
<info>Orange</info>
<info>Pear</info>
</infos>
<getstates>
<getstate>111</getstate>
<getstate>222</getstate>
<getstate>333</getstate>
<getstate>444</getstate>
</getstates>
</application>
</applications>
Here's my php code. It works great but it can only display 1 element in the node at a time. I was thinking of wrapping the second loop it in a for loop but I don't know how to go about doing it.
$applications = simplexml_load_file($file);
foreach ($applications as $application) {
getXML($application, "info");
}
function getXML($application, $info){
$infos = $info . "s";
foreach($application->$infos->$info as $info){
echo $info <br>";
}
echo "<br/>";
}
I would like to be able to output "Apple 111", "Banana 222", "Orange 333", etc. How would I go about doing this?
| e50dd3a95c16ec6ed38ddcb59a621ac0a7e97b5156297579e590235ff3a1cc82 | ['74a1cc0a135045bd9bc27c0d67a6804c'] | I have 2 buttons. One button is to submit a certain task to be executed but for simplicity of this question I chose to, echo a text to a screen and the other button is to open the module. Both works fine. Is it possible to have my submit do both, so it will perform a certain task, in this example, echo to a screen and also open a module??
I don't know how to go about doing this.
Here's my code
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["submit"])) {
echo "Echo from Submit Button"
}
}
?>
<!-- Button trigger modal -->
<button type='submit' name="submit" value="Submit" class="btn btn-primary btn-block"
data-toggle="modal" data-target="#exampleModal"> Submit </button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
|
372659ab170d9f90954af434ae5b62703cd468b48d7598c247389f3cd83c5537 | ['74a20f94aa4f4b0c9b92b99035fed060'] | When we say $a \propto t$ (directly proportional) , it means a = constant*t. By convention, the constant is called K but it could be anything else; it could be D OR Y or anything. Thus when we say a = 6Kt, the new constant is 6K which can be renamed to another constant D. So if we say D= 6K, then a = Dt and as D is a constant a is still directly proportional to t.
| 88dda446f475d64141825c7b66b1d54b3b6ba89791eed4785f8340a64e0c099e | ['74a20f94aa4f4b0c9b92b99035fed060'] | Functions are like input output machines and composite functions are a combination of them. Thus when you consider f(g(x)), the domain cannot be greater than the domain of g(x) because if g(x) cannot process a x value then how can f(g(x))?
It does not do to just simplify composite functions because if f(g(x)) = x then can't we just make another function named h(x) =x but we don't. Why? so that the function f(g(x)) depends on the domain of the functions f(x) and g(x).
|
fcc278e3a5b8e3828a663eae090a7d113659e5099b142b39802520fdcbf3cc55 | ['74a261fbd6674668a66c51dd6e77f09f'] | This can now be done as long as the child actor is explicitly named using the ActorService decorator. In your example this would translate to updating the MyActor class like this...
[ActorService(Name = "MyActor")] // Child actors need this decorator
public class MyActor : CommonActor
{
public void override DoStuff()
{
//Stuff
}
}
More information is also available in the Service Fabric documentation.
| d380c1062a2b4020fd8658a67831dbf755fbca63a88667575c92872c23b793d3 | ['74a261fbd6674668a66c51dd6e77f09f'] | The generic type on your xlist and ylist must be the same. For example this works.
void Main() {
var foo = new List<List<Foo>>();
var foo2 = new List<List<Foo>>();
method("sdf", "sdf", foo, foo2);
}
class Foo{}
But in order to pass two lists of different types you would have to change your method signature to public void method<T,U>(string name, string sheet, List<List<T>> xList, List<List<U>> yList). Then something like this...
void Main() {
var foo = new List<List<Foo>>();
var bar = new List<List<Bar>>();
method("sdf", "sdf", foo, bar);
}
class Foo{}
class Bar{}
Would be possible.
|
decd13214631734c9176a164eb34355a66a90a1fe790c582be396d50ad76b356 | ['74a804f678b3497cb998a619ca60499b'] | Hi you can make a list of question and use a v-for
<template>
<el-checkbox-group
v-model="questionCheck"
:min="1"
:max="3">
<el-checkbox v-for="(question,key) in questions" :label="question" :key="key">
{{question}}
</el-checkbox>
</el-checkbox-group>
</template>
<script>
export default {
data() {
return {
questionCheck: ['question one', 'question two'],
questions: ['question one', 'question two','question tree']
};
}
};
</script>
| 355235db742d1275b7f4807f1f2a29a1c4e72f28203bdd737601b811e27e5c25 | ['74a804f678b3497cb998a619ca60499b'] | you can make it like this
$subJoin =
author_book<IP_ADDRESS>select('author_book.book_id',<IP_ADDRESS>raw('GROUP_CONCAT(authors.name ORDER BY
authors.name SEPARATOR ', ') as names'))
->leftJoin('authors','author_book.author_id','=','authors.id')
->groupBy(author_book.book_id)
->get();
$query = descriptions<IP_ADDRESS>leftJoin('books','books.id','=','descriptions.book_id')
->joinSub($subJoin,'temp',function ($join) {
$join->on('temp.book_id', '=', 'books.id');
})->orderBy('temp.names', 'books.title')
->get();
|
85ff51014ef19851a32d9c174018f5135d19452668866a4b1d7c86b9b973f88b | ['74b27e5f05824aafb299d074b705c59b'] | How does one make a for loop that creates a certain number of class objects with names that add in numerical order.
example struct:
struct Point{
int x, y;
Point(int inputx, int inputy){
x = inputx;
y = inputy;
}
};
How would I implement a for loop to create Point Point1(x,y), Point Point2(x,y), Point Point3(x,y), etc.
| dbd63962debb4b1f3bd82b4d1c788d0c1904095c4259c0d8dde9e5eac8a3f1e6 | ['74b27e5f05824aafb299d074b705c59b'] | Program's purpose: This program's purpose it to create a basic 2d game using only the consol. The program currently only creates a moveable box with the keys "wasd". I'm planning to incorperate bullets, enemy NPC's, barriers, and much more.
Problem:
Hello, for some reason my bullet constructor class in my "Bullet.cpp" file is showing up with the error "error C2512: 'BoxClass': no appropriate default constructor available". In "Bullet.h" I have "class Bullet : protected BoxClass". Why am I getting this error?
Other Question(s):
Also how should I group my headers? They're getting to become a large cluster.
Comments:
I also realize my game loops shouldn't be in the "BoxClass.cpp". I'm going to fix that after I get my bullet class working. If I'm structuring anything else wrong or if you see an easier way of writing some of the same code just let me know.
This is my first graphical game in c++!
ConsolApplication1.cpp:
#include "stdafx.h"
#include <windows.h>
#include "BoxClass.h"
#include "ConsolWindow.h"
#include "Bullet.h"
#include <iostream>
using namespace std;
#define W_KEY 0x57
#define S_KEY 0x53
#define A_KEY 0x41
#define D_KEY 0x44
#define R_KEY 0x52
int main() {
//variable declaration/definition
int right_Wall, speed_Var;
//Consol Size/Position
int half_screen_Size = (GetSystemMetrics(SM_CXSCREEN)/2);
Set_Consol_Size(half_screen_Size, GetSystemMetrics(SM_CYSCREEN));
Position_Consol(-6, 0);
while (1) {
cout << "Enter speed of rectangle/box\nSpeed = ";
cin >> speed_Var;
BoxClass box1(4, 3);
box1.Print_Solid_Rectangle();
cout << "\n\nMove the rectangle with wasd\n\n";
//Rectangle Movement
box1.Rectangle_Movement(speed_Var);
}
//exit
return 0;
}
BoxClass.cpp:
#include "stdafx.h"
#include "BoxClass.h"
#include "ConsolWindow.h"
#include <iostream>
#include <math.h>
#include <Windows.h>
using namespace std;
#define W_KEY 0x57
#define S_KEY 0x53
#define A_KEY 0x41
#define D_KEY 0x44
#define R_KEY 0x52
#define _NOT_MOVING 0
#define _MOVING 1
//Non Moving Rectangle
void BoxClass<IP_ADDRESS>Print_Solid_Rectangle() {
//calc
boxSpacesWidth = (3 * recWidth) - 4;
//draw top of box
for (width = 1; width < recWidth; width += 1) {
cout << "...";
}
cout << "\n";
//draw sides
for (height = 1; height < recHeight; height += 1) {
cout << ":";
height_Count++;
for (width = 1; width < boxSpacesWidth; width += 1) {
cout << " ";
}
cout << ":\n";
}
//draw bottom
cout << ":";
for (width = 1; width < boxSpacesWidth; width += 1) {
cout << ".";
}
cout << ":\n";
}
//Moving Rectangle
void BoxClass<IP_ADDRESS>Print_Rectangle_Moving(int x, int y, int horizontalSpaces, int verticleSpaces) {
//calc
boxSpacesWidth = (3 * x) - 4;
rightWall = ((x-1)*3) + horizontalSpaces;
retrieveX = (ceil((((x-1)*3)/2))+1)+horizontalSpaces;
retrieveY = verticleSpaces;
cout << retrieveY<<endl;
//New Line
for (i = 1; i <= verticleSpaces; i += 1) {
cout << "\n";
}
//draw top of box
for (width = 1; width <= horizontalSpaces; width+=1) {
cout << " ";
}
for (width = 1; width < x; width += 1) {
cout << "...";
}
cout << "\n";
//draw sides
for (height = 1; height < y; height += 1) {
for (width = 1; width <= horizontalSpaces; width += 1) {
cout << " ";
}
cout << ":";
height_Count++;
for (width = 1; width < boxSpacesWidth; width += 1) {
cout << " ";
}
cout << ":\n";
}
//draw bottom
for (width = 1; width <= horizontalSpaces; width += 1) {
cout << " ";
}
cout << ":";
for (width = 1; width < boxSpacesWidth; width += 1) {
cout << ".";
}
cout << ":\n";
}
void BoxClass<IP_ADDRESS>Rectangle_Movement(int speed) {
speed_Var = speed;
//Rectangle Movement
while (GetAsyncKeyState(VK_ESCAPE) == false) {
if (GetAsyncKeyState(R_KEY)) {
system("CLS");
break;
}
if (GetAsyncKeyState(W_KEY)) {
if (verticleCount > 0) {
system("CLS");
verticleCount = verticleCount - speed_Var;
Print_Rectangle_Moving(recWidth, recHeight, horizontalCount, verticleCount);
}
}
if (GetAsyncKeyState(S_KEY)) {
system("CLS");
verticleCount = verticleCount + speed_Var;
Print_Rectangle_Moving(recWidth, recHeight, horizontalCount, verticleCount);
}
if (GetAsyncKeyState(A_KEY)) {
if (horizontalCount > 0) {
system("CLS");
horizontalCount = horizontalCount - (speed_Var*2);
Print_Rectangle_Moving(recWidth, recHeight, horizontalCount, verticleCount);
}
}
if (GetAsyncKeyState(D_KEY)) {
if (rightWall < 113) {
system("CLS");
horizontalCount = horizontalCount + (speed_Var*2);
Print_Rectangle_Moving(recWidth, recHeight, horizontalCount, verticleCount);
}
}
if (GetAsyncKeyState(VK_SPACE)) {
}
}
}
// constructor
BoxClass<IP_ADDRESS>BoxClass(int x, int y) {
//variable definition
height_Count = 1;
speed_Var = 1;
horizontalCount = 0;
verticleCount = 0;
recWidth = x;
recHeight = y;
};
BoxClass.h:
#ifndef BOXCLASS_H
#define BOXCLASS_H
class BoxClass {
unsigned short int width;
int height, i, recWidth, recHeight, rightWall;
float boxSpacesWidth, height_Count;
int width_Var, height_Var, position_Var;
int speed_Var = 1;
unsigned short int horizontalCount = 0, verticleCount = 0;
protected:
//retrieve values for bullet spawn location
int retrieveX, retrieveY;
public:
void Print_Rectangle_Moving(int x, int y, int horizontalSpaces, int verticleSpaces);
void Print_Solid_Rectangle();
void Rectangle_Movement(int speed);
// constructor
BoxClass(int x, int y);
};
#endif
Bullet.cpp:
#include "stdafx.h"
#include "Bullet.h"
#include <iostream>
#include <Windows.h>
using namespace std;
void Bullet<IP_ADDRESS>Bullet_Draw_Collision() {
for (int height = 1; height <= 2; height+=1) {
cout << "|\n";
}
}
Bullet<IP_ADDRESS>Bullet() {
}
Bullet.h:
#ifndef BULLET_H
#define BULLET_H
#include "BoxClass.h"
class Bullet : public BoxClass {
public:
void Bullet_Draw_Collision();
//constructor
Bullet();
};
#endif
ConsolWindow.cpp:
#include "stdafx.h"
#include "ConsolWindow.h"
#include <iostream>
#include <Windows.h>
using namespace std;
int Find_Consol_Size() {
CONSOLE_SCREEN_BUFFER_INFO csbi;
int columns, rows;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
return columns;
}
void Set_Consol_Size(int x, int y) {
HWND console = GetConsoleWindow();
RECT r;
GetWindowRect(console, &r);
MoveWindow(console, r.left, r.top, x, y, TRUE);
}
void Position_Consol(int x, int y) {
HWND consoleWindow = GetConsoleWindow();
SetWindowPos(consoleWindow, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
ConsolWindow.h:
#ifndef CONSOLWINDOW_H
#define CONSOLWINDOW_H
int Find_Consol_Size();
void Set_Consol_Size(int x, int y);
void Position_Consol(int x, int y);
#endif
|
fc47ced6c434f62073a00c75797f5029b79e129f11c15c6944977024c6d166c8 | ['74b5fc03d68e486f8630d7c3376681dc'] | You can use the VpnService object in the Android SDK to connect your application to an existing VPN service provider. Once you are connected, all network traffic goes through the VPN; and when the user hangup the call, you can disconnect the VPN. You can do all this programmably. The only problem with this approach is that while the call going on, all traffic goes through the VPN.
| b0d262b821e80df20467479a6fdeebd27ea1f03b06e93a2233b9ef97b82f7f1a | ['74b5fc03d68e486f8630d7c3376681dc'] | I messed around with CaptureRequest.SENSOR_SENSITIVITY and it worked great on my Samsung s3, s7 and s8 phones.
You can get the CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE
sensitivity_range = chars.get(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE);
On my s7, the range is from mid 50s to more than 3000. I then set it to 1500 as follows.
mCaptureRequest.set(CaptureRequest.SENSOR_SENSITIVITY, 1500);
It brightened the preview a few factors.
|
fb4034c2ce145f625fc46e939ea4608814d50617340a953426ff4a3fbe1a6b98 | ['74c1c2d8fd26436f97ea602dbe30b854'] | In my app, I want to load data if it is offline or online for my user. If it is offline, it should pull recent data from indexed Db and if it is online it should fetch from server URL. How can we achieve this fallback mechanism?
I am looking for an approach where I will load grid using cached data from indexed DB and then overwrite it with server side data. so I will have some data for the user always irrespective of it whether online/offline.
Is this approach possible to design?
Please suggest.
thanks in advance
| ddf2f83e5eace2fb7f1f106ff8895f83c89220e7f2db9253d8eab47e1bc0e5c9 | ['74c1c2d8fd26436f97ea602dbe30b854'] | I created below function to get worldCoordinates back, but it gives different values on two occasions.
While clicking a dbId, I get dbid cordinates and I pass it to below function which give me world coordinates, but you can see while I save that dbId selection to DB and reloading page next time to see it back, it gives me different coordinates.
Why it happen so?
saving dbid phase
dbid coordinates
x: -26.277027130126953
y: 18.102033615112305
z: -7.173819303512573
getWorldCoordinates
x: 256.76347287180107
y: 306.8180434914181
z: 0
relaoding page phase
dbid coordinates
x: -26.277027130126953
y: 18.102033615112305
z: -7.173819303512573
getWorldCoordinates
x: 422.50000131979897
y: 249.<PHONE_NUMBER>
z: 0
function getWorldCoordinates(position){
var screenpoint = viewer.worldToClient(
new THREE.Vector3(position.x,
position.y,
position.z,));
return screenpoint
}
function getObjPosition(dbId) {
function getObjPosition(dbId) {
const model = viewer.model;
const instanceTree = model.getData().instanceTree;
const fragList = model.getFragmentList();
let bounds = new THREE.Box3();
instanceTree.enumNodeFragments( dbId, ( fragId ) => {
let box = new THREE.Box3();
fragList.getWorldBounds( fragId, box );
bounds.union( box );
}, true );
const position = bounds.center();
return position;
}
|
eb6dea7e4daf9644eb88ca7d5119ef7837726c224255a342134633918b4bf13d | ['74d42769efb74034a177d0e484c56778'] | I'm playing a bit with an iPhone6 and my Arduino with NFC board.
I need to know the ISO7816 Application Identifier to send in the SELECT AID command. I'm trying some well known AIDs, Apple Pay show up perfectly, I use TouchID to authorise the payment, but then the iPhone NFC controller replies with 6A 82 (File Not Found).
I have configured a MasterCard Debit card in PassBook.
Thanks!
<PERSON>
| d250e12e58503356449c3f2be53dd29591ee6af64f691daab90c43da7ee732f0 | ['74d42769efb74034a177d0e484c56778'] | Probably, JUnit uses Eclipse's embedded JRE, while your application may use a specific JRE installed in your system. Check that you use the same JRE both for executing your application and JUnit test cases.
Then, I had the same exception in my project, in my case the problem was that I wrote the web service url within "..." in my configuration file.
Hope it helps,
<PERSON>
|
3cc6d8dd9e546456ff9d234dd6bc9f13311370da302321f2c87a63428658e237 | ['74de23fadadf4257b4a99388cf90dd95'] | Hello World!
so here is the deal,developing a yii2 application for finding jobs and hiring people, so in the showjob action i am trying to pass the link in the controller like this
/**
* @param $link
* @return string
*/
public function actionShowjob($link)
{
$data['model'] = Job<IP_ADDRESS>find()->where(['link'=> $link ])->one();
return $this->render('showjob',compact(['data']));
}
where is the problem ? why it's not showing me that the page is not found?
| 9af4d70ee2804597343fde47e5a5fa61fd24b1532ffcfb73c818166978b9311c | ['74de23fadadf4257b4a99388cf90dd95'] | Hello World!
i am trying to add the DateTimePicker widget to my active form but i am getting null every time in the database in that field, i don't know why i tried to change the format but it's not working any thoughts please?
View
<?php echo DateTimePicker<IP_ADDRESS>widget(
[
'model' => $data['model'],
'attribute' => 'expire_date',
'options' => ['placeholder' => 'Select operating time ...'],
'convertFormat' => true,
'pluginOptions' => [
'format' => 'y-m-d h:m:s',
// 'startDate' => '01-Mar-2014 12:00 AM',
'todayHighlight' => true
]
]
)?>
Controller
public function actionAddjob()
{
if(!Yii<IP_ADDRESS>$app->user->isGuest){
$data['model'] = new Job();
return $this->render('addjob', compact('data'));
} else {
$this->goHome();
}
}
|
f8b3ac355be6867b204aeeee221d160338a8a8a9ac7221100cbd371af12735bd | ['74e1de50e27a49e09d275f1548e06237'] | The problem is in your image.
You could open your image in Preview.app, then show the Inspector (⌘I) and look at More Info tab. Wrong image will show you the following info:
and will result a black screen on the device (but will be ok in the Simulator).
And the right one shood look like that:
I can't say how to fix wrong images in Photoshop. I found quite an ugly solution:
open wrong png in PS;
find and open correct png in another tab (make sure the canvas is of right size);
select the whole image in the wrong png and copy it;
paste the copied image into correct png file;
perform Save As... command and replace your wrong image with the new one.
| beba4bb2eac66f623c0c09d0e7f92dee308ba721397d2f5bfae0efd9a5cf0993 | ['74e1de50e27a49e09d275f1548e06237'] | You're trying to do things the most complicated way :)
Why not just prepare the small image before pushing the view controller and pass it to them? Look at this code:
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *fullImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImage *smallImage = [fullImage imageScaledToSize:self.view.bounds];
// Push a view controller and give it BOTH images
}
// And in your pushed view controller
- (void)viewDidLoad
{
_imageView.image = self.smallImage;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
_imageView.image = self.fullImage;
}
The main thing is that viewDidAppear: will be called right after the animation is done so you can switch images here without any worries.
|
fbebe0f21c9b8174d9d52069715a14bdf68fa357d3f24991d4470445e2881f29 | ['74e249727bb044ceacd022ecbc811fc7'] | <PERSON>: I can try to split the question in two parts.. which part would you delete here? If you want you can also mark it with and I will edit. Thanks a lot for the help. I'm also a bit scared by deleting all that long part because developers are often strongly self biased.. I fear they will simply think: "this guy is stupid, my ideas are perfect". This was the reason of the premise. | a7286062f1dc2e40e68ab43e92bade48f8e62e2d0b3f51bfc6d71339d8c9d37b | ['74e249727bb044ceacd022ecbc811fc7'] | "The fact itself that you could not even realize the influence on cognitive bias on moderation is a good proof of what I think".. This is my opinion, but at the same time, you probably don't share it. It's another example of cognitive bias on my side. It's really hard to consider facts objectively and from the other's side point of view. - marketing and communication expert plays to avoid this kind of errors.. I hope this discussion was a bit useful to give a seed to think of. |
f919193c006b8b4ba25c9a9c3fdcd64f8a42c0cd4ac900a00e51037f74f2692d | ['7508a4ac58c7442ab39b5a5d302df236'] | There is bit of a jargon confusion here, MVC by itself is not UI or WebApi. Think of MVC as a methodology of how you organize/design your code/solution.
You can use jquery to call webapi directly. But where will the jquery be hosted, you would need a page for it, who would serve the page, it would be the server code. You would be do a lot more heavy lifting serving pages and those pages calling webapi.
You would go the route of webapi if you have apps on android/ios trying to interact with the backend, you would also have web pages call webapi when you want to load content async.
All this said, this is how I have organized my code:
1. Leverage MVC to serve both pages and web api.
2. Make web api and web page controllers call common underlying EF/infra code
3. Browser users use pages, apps use web apis
4. Browser pages also call web api for specific async content to load (for e.g, populating a drop down,...)
| 36d06e108890bb5ec58596f478980d0450afd06dd83c5de045106afa85258cf0 | ['7508a4ac58c7442ab39b5a5d302df236'] | You can absolutely do this. Implement a webapi using MVC hosting it on Azure websites (there is a free version). Make rest calls from your android app into the webapi passing the user's longitude and latitude info. Your webapi can calculate the distance using google api and send it back.
Info on Webapis: http://www.asp.net/web-api
azure websites: http://azure.microsoft.com/en-us/solutions/web/
|
2362728efb19882b5a292502b092fca26d2ea66d5b7b22f96ad11b521ce3c540 | ['7513e5e63f944ca2bfa1d5f3502fa06c'] | Is there any way to enable javascript code using java?
Suppose I am developing one web application on which I am using javascript or jquery.If client disable javascript from his browser then my whole javascript code is not working .I want if client disable javascript from browser then he load my application at the loading time my javacode run and enable the javascript.
So please tell me if there is any process which can I do through java to enable javascript in browser.
thanks & regards,
<PERSON>
| 9c9e81d04d5da42cab1c7d88e3c3e3d745b43faeb6caf226bb692d9a420d97be | ['7513e5e63f944ca2bfa1d5f3502fa06c'] | I am using quartz Scheduler .I want to stop currently running job.
I am using this one in a web application .When I click on start button then job execution is started but when I want to stop this executing job using stop button .
But I am not able to stop.
Please give me an idea how can I stop currently running job?
I am giving my code.
//when i click on start button then this class will call.
@WebServlet("/ScheduleController")
public class AscentScheduleController extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String RANDOM = "random";
Scheduler schedulerRecon;
Scheduler schedulerPos;
Scheduler schedulerFile;
Scheduler schedulerEtl;
Trigger triggerIris;
JobKey jobKey;
JobDetail job;
String key;
int time;
/**
* @see HttpServlet#HttpServlet()
*/
public AscentScheduleController() {
super();
}
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
HttpSession session = request.getSession();
try {
String id = request.getParameter("id");
System.out.println("hello in controller");
System.out.println(id);
System.out.println(Thread.currentThread().getName());
schedulerRecon = new StdSchedulerFactory()
.getScheduler();
schedulerRecon.start();
session.setAttribute(id,schedulerRecon );
System.out.println();// SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever()).build();
System.out.println();
System.out.println();
System.out.println("controller schedil "+schedulerRecon);
System.out.println(Thread.currentThread().getName());
jobKey = new JobKey("jobKeyIris", "group1");
job = JobBuilder.newJob(DemoTrgger.class).withIdentity("jobKey").build();
triggerIris = TriggerBuilder.newTrigger().withIdentity("triggerIris", "group1").startNow()
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(60).// repeatForever()).build();
withRepeatCount(0)).build();
session.setAttribute("job", jobKey);
System.out.println();// SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever()).build();
System.out.println();
System.out.println();
System.out.println("controller job key "+jobKey);
// temp=temp+temp;
schedulerRecon.scheduleJob(job, triggerIris);
// scheduler.scheduleJob(jobQCB, triggerQCB);
System.out.println("fire job");
}
}
//and my job class which implement Job is below
public class DemoTrgger implements Job {
public static Thread th;
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
System.out.println();
System.out.println("demo trigger "+Thread.currentThread().getName()+"thread obj "+Thread.currentThread());
th = Thread.currentThread();
System.out.println();
for(long i=0l;i<2000000;i++){
System.out.println("i--------- "+i);
}
for(long i=0l;i<2000000l;i++){
System.out.println("j--- "+i);
}
}
}
when I click on stop button the below class will call.Here I get the Scheduler reference which I use in start using session and I want stop respectively running job.
@WebServlet("/SchedulerStopController")
public class SchedulerStopController extends HttpServlet implements InterruptableJob {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public SchedulerStopController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String id=request.getParameter("id");
System.out.println(id);
HttpSession session=request.getSession();
Scheduler schedular=(Scheduler) session.getAttribute(id);
System.out.println();// SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever()).build();
System.out.println();
System.out.println();
System.out.println("stop schedular "+schedular);
try {
SchedulerMetaData metaData = schedular.getMetaData();
} catch (SchedulerException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
/*Runtime.getRuntime().addShutdownHook(new Thread()
{
public void run()
{
System.out.println(Thread.currentThread().getName());
// this will get called on shutdown
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("------- My own shutdown hook -----------------");
}
});
*/
try {
JobKey jobKey=(JobKey) session.getAttribute("job");
System.out.println();// SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10).repeatForever()).build();
System.out.println();
System.out.println("stop controller "+Thread.currentThread().getName());
System.out.println();
System.out.println("stop job "+jobKey);
schedular.deleteJob(jobKey);
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
thanks.
|
0e3a87b86e5632b6cb550838136294f7997ec50aff65b83d2bad1bd72e3f00d2 | ['7514417342db4fa0a1505daa177908b0'] | Hey guys I'm trying to do a simple if statement in Python and I get an error any time I try to do a comparison between a queryset that is empty.
What's the best way to write this code so that it doesn't give me an error if there's no fields in the check variable?
If check comes up empty, then I get an error when I run the if(check[0].username == None) statement.
Thanks!
Here's my code:
def upvote(request):
postID = request.POST.get("postID")
currentUser = request.POST.get("currentUser")
username = request.POST.get("username")
query = NewPost.objects.get(id = postID)
check = Vote.objects.filter(postID = postID) & Vote.objects.filter(username = currentUser)
if(check[0].username == None):
query.rating = query.rating +1
query.save()
query2 = User.objects.get(username = username)
query2.userRanking = query2.userRanking +1
query2.save()
new = Vote.objects.create(postID = postID, username = currentUser)
new.save()
pyautogui.hotkey('f5')
return render(request)
else:
pyautogui.hotkey('f5')
return render(request)
| 80aa5370dce732ea915f59198d4a194afad4bd596a162c4c669355461bf029f7 | ['7514417342db4fa0a1505daa177908b0'] | I am creating an email app that sends messages to other people. Currently, I have it working except for the recipients column. Right now, I hard-coded an email into the recipients column to get it working. The reason is, is the recipients field is supposed to be an array.
What's the best way of passing a value from a user form (multiple addresses separated by commas) into JSON format?
Below is how I have it now.
Thanks!
const element = document.getElementById('sendEmail');
element.addEventListener('click', function() {
fetch('/emails', {
method: 'POST',
body: JSON.stringify({
recipients: '<EMAIL_ADDRESS>',
subject: document.querySelector('#compose-subject').value,
body: document.querySelector('#compose-body').value
})
})
.then(response => response.json())
.then(result => {
// Print result
console.log(result);
});
});
}
|
bad0cc665f8e6995d9d583bfcb9acfebe112e6094f9598207947eaa373293b28 | ['7516b3b215c6420b868807cfcb06afaf'] | I want to process the http request in thread, the code as follow where the problem is that OutputStream (as noted in codes) can not be writen. When I put this process in main thread, it's no problem. Can you give me any advice?
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var server = new HttpServer();
try
{
server.EndPoint = new IPEndPoint(<IP_ADDRESS>, 80); //set webServer para
server.Start(); //start webServer
server.RequestReceived += server_RequestReceived; //register the event
}
catch (Exception ex)
{
return;
}
}
private void server_RequestReceived(object sender, HttpRequestEventArgs e)
{
var dataProcess = new Action<HttpRequestEventArgs>(DataProcess);
Dispatcher.BeginInvoke(dataProcess,e); //start thread
}
private void DataProcess(HttpRequestEventArgs e)
{
StreamReader sr = new StreamReader(@"c:\test.txt");
string text = sr.ReadToEnd();
using (var writer = new StreamWriter(e.Response.OutputStream)) //**Cannot write stream**
{
writer.Write(text);
}
sr.Close();
}
}
| 85a200a14efeae25568aa793ef001e79ab80702e3c07408f512079a383d4f9db | ['7516b3b215c6420b868807cfcb06afaf'] | I have a MainViewModel and a OtherViewModel in my wpf Mvvm project.
In the MainWindow.Xaml, I set the MainViewModel as the Grid's DataContext. However, I want to set the OhterViewModel as the TextBox control's DataContext, which is in the Grid. How can I implement it? The xaml code as fallows.
<Window.Resources>
<viewModels:MainWindowViewModel x:Key="Windows1ViewModel" />
</Window.Resources>
<Grid DataContext="{StaticResource Windows1ViewModel}">
.....
<TextBox "require to bind OtherVeiwModel here"/>
.....
</Grid>
|
798f943416de0413c961a2d8b4658d5d2e48ef89fc4f68b4df887e71955e13b9 | ['751b11978d0f43268c93454b1d27a355'] | I encountered the same problem and I fixed it by moving the [span class="z-decorator"] added by the breeze data-z-validate directive after compilation to the parent element.
// Angular directive [spaField] responsible for generating grid cell controls.
spa.app.directive('spaField', ['$compile', function ($compile)
{
var directive = {
restrict: 'A', /* Restrict this directive to attributes. */
replace: true, /* The given element will be replaced in the link function. */
link: function ($scope, element, attrs) {
// The data-z-validate directive will append a [<span class="z-decorator"] to the following [input] element, by using the jquery "append" function.
var html = '<input type="text" data-ng-model="firstName" data-z-validate>'>;
var compiled = $compile(html)($scope);
// Get the [<span class="z-decorator"] appended to the input element by the z-validate directive.
var span = compiled[0].parentNode.children[1];
// The following 2 lines will only add the input element to the DOM and not the [<span class="z-decorator"], that is added by the z-validate directive.
element.replaceWith(compiled);
element = compiled;
// Add the [<span class="z-decorator"] to the current parent element of the input element.
element.parent().append(span);
}
};
return directive;
}]);
| 6c5613c89d79c8699ea7d5e241d770f9abb1a93b34d8a1b10dac1e7bc31d80b1 | ['751b11978d0f43268c93454b1d27a355'] | In the following example the edited FirstName, will not be shown after it's updated.
But when I remove the FirstName field from the dataSource.schema.model the changes are shown.
Before edit
Edit
After edit
In the Google Chrome Developer extension for Kendo UI, I can see the firstName is removed from the model and a property "model" is added to the record instead of the firstName property:
data: Array[7]
0: Object{3}
Id: 1
LastName: "ln_1"
models: Array[1]
0: Object{3}
Id: 1
FirstName: "fn_1_changed_to_something_else"
LastName: "ln_1"
1: Object{3}
Id: 2
FirstName: "fn_2"
LastName: "ln_2"
....
What am I doing wrong?
Example html page
<!doctype html>
<html ng-app="demoApp">
<head>
<meta charset="utf-8">
<title>Kendo UI directives for AngularJS</title>
<link href="//cdn.kendostatic.com/2014.1.318/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="//cdn.kendostatic.com/2014.1.318/styles/kendo.silver.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="//cdn.kendostatic.com/2014.1.318/js/kendo.all.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-sanitize.js"></script>
<script src="/Scripts/angular-kendo.js"></script>
<script>
var demoApp = angular.module("demoApp", ["kendo.directives"]);
demoApp.controller('demoCtrl', function($scope) {
$scope.employees = [
{ Id: 1, FirstName: "fn_1", LastName: "ln_1" },
{ Id: 2, FirstName: "fn_2", LastName: "ln_2" },
{ Id: 3, FirstName: "fn_3", LastName: "ln_3" },
{ Id: 4, FirstName: "fn_4", LastName: "ln_4" },
{ Id: 5, FirstName: "fn_5", LastName: "ln_5" },
{ Id: 6, FirstName: "fn_6", LastName: "ln_6" },
{ Id: 7, FirstName: "fn_7", LastName: "ln_7" }
];
$scope.mainGridOptions = {
dataSource: {
data: $scope.employees,
batch: true,
pageSize: 5,
schema: {
model: {
id: "Id",
fields: {
FirstName: { type: "string", validation: { required: true } }
//LastName: { editable: true }
}
}
}
},
editable: "popup",
sortable: true,
pageable: true,
columns: [{
field: "FirstName",
title: "First Name",
width: "120px"
}, {
field: "LastName",
title: "Last Name",
width: "120px"
},
{
command: [{
name: "edit",
text: { edit: "Custom edit", cancel: "Custom cancel", update: "Custom update" }
}
, { name: "destroy", text: "Remove" }
]
}]
};
});
</script>
</head>
<body ng-controller="demoCtrl">
<div>
<div kendo-grid k-options="mainGridOptions"></div>
</div>
</body>
</html>
|
f418f4a0fa7b5675b3808188024a81598cc219eb8ab95d028c05da823e347591 | ['751bce1b3d29453e84bc969290eeba58'] | I have a mapreduce job, which takes a bunch of files on HDFS as input and generates some statistics. It runs well with no problem. However, when I set the jvm reuse properties "mapred.job.reuse.jvm.num.tasks" to "-1" or a small integer,e.g., 5, many mappers failed with the error message below
ENOENT: No such file or directory
at org.apache.hadoop.io.nativeio.NativeIO.open(Native Method)
at org.apache.hadoop.io.SecureIOUtils.createForWrite(SecureIOUtils.java:161)
at org.apache.hadoop.mapred.TaskLog.writeToIndexFile(TaskLog.java:296)
at org.apache.hadoop.mapred.TaskLog.syncLogs(TaskLog.java:369)
at org.apache.hadoop.mapred.Child.main(Child.java:229)
Could anyone give me some hints about why it happened and how to fix this.
Thanks,
| d8dad5617cd97f5ae16c7c7b28c803a42a569e1023ad2efcca970e3bda6c69d7 | ['751bce1b3d29453e84bc969290eeba58'] | I know we can set the property "mapred.job.reuse.jvm.num.tasks" to re-use JVM. My questions are:
(1) how to decide the number of tasks to be set here, -1 or some other positive integers?
(2) is it a good idea to already reuse JVMs and set this property to the value of -1 in mapreduce jobs?
Thank you very much!
|
dbd5a605f6a000a0a90ed2d8e015fb85a545cbf4793565e97e13b92a07f0e9de | ['7532bae835e44e96b6c52725aa9a0627'] |
I found my mistake
for string in IF must use equal , not ==
if (savedInstanceState != null) {
String str =savedInstanceState.getString("key");
if ( str.equals("test")){
TextView txtarr_1=(TextView) findViewById(R.id.test_array_1);
txtarr_1.setText("if == test{" + str+"}");
}
else if (!str.equals("test")){
TextView txtarr_3=(TextView) findViewById(R.id.test_array_3);
txtarr_3.setText("if != test{" + str+"}");
}
}else{
TextView txtarr_5=(TextView) findViewById(R.id.test_array_5);
txtarr_5.setText("elseif (savedInstanceState != null)");
}
| 50c9814d5f8210fc7504a8698286f565b35781f37f5f44f735a358cc98db91d9 | ['7532bae835e44e96b6c52725aa9a0627'] | i change code to <IP_ADDRESS> instead store a string -->store a integer
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null) {
int val=savedInstanceState.getInt("key");
if (val==123){
TextView txtarr_1=(TextView) findViewById(R.id.test_array_1);
txtarr_1.setText("if == 123{" + savedInstanceState.getInt("key")+"}");
}
else if (val!=123) {
TextView txtarr_3=(TextView) findViewById(R.id.test_array_3);
txtarr_3.setText( savedInstanceState.getString("key"));
}
}else{
TextView txtarr_5=(TextView) findViewById(R.id.test_array_5);
txtarr_5.setText("elseif (savedInstanceState != null)");
}}
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putInt("key", putInt);
super.onSaveInstanceState(savedInstanceState);
}
In this case the problem can be solved
that's mean :
Was detected I store 123 and orders Equal to 123 Was conducted
but if i store 123 to form of string
run orders not equal 123 execute
in call a new activity To a stored form
and in restore The stored value is different
But when I show exactly the same text??????
why?????
|
26dadf6869f4eac1b9fedadc824e8ccb420df903a1aa5e3d6df8495336568a94 | ['753430d913524c8482812c762a1aedf9'] | Please feel free to point me in the correct direction if this has been answered elsewhere, but I can't find it via here, or Google. Maybe I just don't know this correct name for this thing?
I am currently working with React-navigation (for react-native) and I wonder if it is possible to make one icon in the center of the tab bar larger than the others, in particular with transparency behind it when the page scrolls.
Mock up here for an example:
Larger icon in middle overlaying scrollable area of screen
Does anybody if this is possible with this library, and how it might be achieved?
I was also thinking to try out the Wix library react-native-navigation once they have actually released a version which isn't broken, buggy, actually comes with accurate documentation, and isn't broken with the current version of react-native. (it's a bit of a disaster area there right now, but it looks very good so I'm keen to try it once it actually works again), so is it possible with their library and I'll just have to wait to try it out?
| 9f13098f720f5d9500a707e69bf4d9842039117bd4c396b3ff7f704de78374fc | ['753430d913524c8482812c762a1aedf9'] | I am very new to all things Angular and have been experimenting with some stuff.
Been playing with UI-Router and with Angular Animations.
So far everything is going to plan, except one thing.
During the transition between pages (my top-most states) the footer area collapses up under the main content and against the navigation.
(I'm also fairly new to css transitions, so my knowledge is limited, but growing)
Is there anything that can be done to prevent this from happening? Maybe have it snag on to the height of whichever state is the tallest? (IE, the one leaving, or the one entering)
(I've tried searching everywhere, but whatever I search for I come up dry. Maybe I'm searching the wrong keywords.)
I have included a plnkr link
Thanks in advanced.
|
7610fcaf4c2f249199e66b450c7fcde34799687d3732353f5ec39e6acd80d620 | ['7534a738feba4b3bb6b6fdbbceb19b06'] | I have an issue with a DataGridView control. During certain operations, the grid is covered by a semi-transparent dialog (to indicate to users of the operation and prevent users from pressing buttons, etc.). The grid updates at about 1Hz during this time. Under Windows XP, the DataGridView control occasionally "flickers" above the masking dialog for a second - not enough time to actually do anything, but a bit of an eyesore nonetheless. I've also noticed that on my development machine, which runs Window 7, the problem doesn't show up. I'm using .NET v3.5. Any help would be appreciated.
| 2bd361440ced5282abe6f4e8ad99df7efd9098842e4f97ffbece884a60becaa4 | ['7534a738feba4b3bb6b6fdbbceb19b06'] | I'm using the alpha version of the android app on the first generation nexus 7 tablet.
The font size is a little bit small for my liking and I'm not able to pinch zoom to increase the font size.
Is this a feature that is planned in the release?
|
a9222eb145dcf2c64c497c0342b855914c70cce165a938baa3c30e8f51531c9c | ['75351cdc99f948cf90f4ed5fab9aaa95'] | With callbacks, you have to write your code in the callback passed to getMostRecent, so
// Note: awaiting this takes no effect unless getMostRecent returns a promise.
getMostRecent(pathtocheck, function (err, recent) {
if (err) console.error(err);
console.log(recent);
var lastdownloadedimage = recent;
// Or just directly use `recent`
});
Or,
Async-await and Promise can also solve your issue, though I'm not sure how much you're familiar with them.
You can use Promisified version of file system API in Node.js v10 or above, by require('fs').promises instead of require('fs') (Documentation here)
Decalration of the functions like this:
// Also it's a good practice to use `const` or `let`, instead of `var`
const pathtocheck = "C:\Users\user1\Downloads";
const path = require('path');
const fs = require('fs');
const fsp = require('fs').promises;
// Decalre the function with `async` to use `await` in it
const getMostRecent = async function (dir) {
dir = path.resolve(dir);
const files = await fsp.readdir(dir)
const sorted = files.map(function(v) {
const filepath = path.resolve(dir, v);
return {
name:v,
time:fs.statSync(filepath).mtime.getTime()
// maybe you can use fsPromises.stat here
};
})
.sort(function(a, b) { return b.time - a.time; })
.map(function(v) { return v.name; });
if (sorted.length > 0) {
return sorted[0];
} else {
// Now you have no callbacks, so there are two options to return the error state.
// 1. Throw an Error with an error message
// 2. Return a special value such as `null` or `false`, which you can track it.
}
}; // <-- perhaps you need place a semicolon here.
And you call the function in async IIFE, wrapping anonymous async function to use await
(async function() {
const lastdownloadedimage = await getMostRecent(pathtocheck);
console.log(lastdownloadedimage)
})();
Or use Promise.then:
getMostRecent(pathtocheck).then(function(recent) {
var lastdownloadedimage = recent;
// Again, you can just directly use `recent`
})
| 88cffe4e0b6467dbc728fbbd2dea335891e810200529d8a88850a0c18cba72bf | ['75351cdc99f948cf90f4ed5fab9aaa95'] | For the members getting banned, you can track them with guildBanAdd event, and Guild.fetchBan(user) returns BanInfo including the reason they banned.
However for the kicked member, there seems to be no other way than checking Guild's Audit logs. As far as I read the documentation, unfortunately, Discord.js has no events that tracks the Audit logs, so you have to call Guild.fetchAuditLogs([options]) in guildMemberRemove event like this.
|
f99ca656795bc04724474b418055ac308da13899b0ff24ea7037e89fce5fa737 | ['753bda55a47f4ca7ad911c15b6bb9ccb'] | There are several parts to make this work. First the JSON data will appear as a VARCHAR, so you first need to run json_parse on it to convert it to a JSON type in the engine. Then you can cast JSON types to normal SQL structural types, and in your case this is an array of rows (see cast from JSON). Finally, you do a cross join to the array of rows (which is effectively a nested table). This query fill give you the results you want
WITH your_table AS (
SELECT
112 AS dep_id
, '[{"emp_id": 8291828, "name": "<PERSON>"}, {"emp_id": 8291823, "name": "<PERSON>"}]' AS data
)
SELECT
dep_id
, r.emp_id
, r.name
FROM your_table
CROSS JOIN
UNNEST(cast(json_parse(data) as array(row (emp_id bigint, name varchar)))) nested_data(r)
| ed181498f0052dac9661fab4f77023868ea11a7437fa460809f8c9019babe1bb | ['753bda55a47f4ca7ad911c15b6bb9ccb'] | The Presto engine will pushdown simple WHERE clauses like this to a connector (you can see this in the Hive connector), so the question is, why does the Cassandra connector not take advantage of this. To see why, we'll have to look at the code.
The pushdown system first interacts with connectors in the ConnectorSplitManager.getPartitions(ConnectorTableHandle, TupleDomain) method, so looking at the CassandraSplitManager, I see it is delegating the logic to getPartitionKeysSet. This method looks for a range constraint (e.g., x=33 or x BETWEEN 1 AND 10) for every column in the primary key, so in your case, you would need to add a constraint on event_time.
I don't know why the code insists on having a constraint on every column in the primary key, but I'd guess that it is a bug. It should be easy to tweak this code to remove that constraint.
|
9e72712b0cf80186570bdd492bc9916ce8c69a19784bdc59705920b77c4b8ecc | ['7545926ff20f48cbb55fd0ecc6c49a56'] | Provide full details about data through HTTP but you can call an API to get data and then display it in the fullcalendar.io
You can fulfill all this using fullcalendar.io.
This post covers the discussion about how to open Model . I have add it in the following example.
Following example gives you an idea to show popup when you click on an event as well as Day Box.
Fiddle to view it runtime https://jsfiddle.net/alifaraze/mr53d7nz/27/
<div id="calendar"></div>
<div id="calendarModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only">close</span></button>
<h4 id="modalTitle" class="modal-title"></h4>
</div>
<div id="modalBody" class="modal-body"> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
$(document).ready(function() {
$('#calendar').fullCalendar({
events: [{
id: 1,
title: 'Full Day Event - Click Me',
start: '2019-01-02',
end: '2019-01-03',
description: 'Full day event description'
},
{
id: 2,
title: 'Whole Week Event - Click Me',
start: '2019-01-06',
end: '2019-01-10',
description: 'Whole week event description'
}
// more events here
],
eventRender: function(event, element) {
$(element).popover({
title: function() {
return "<B>" + event.title + "</B>";
},
placement: 'auto',
html: true,
trigger: 'click',
animation: 'false',
content: function() {
return "<h3>"+ event.description +"</h3>"
},
container: 'body'
}).popover('show');
},
dayClick: function(date, jsEvent, view) {
$('#modalTitle').html(date.format());
$('#modalBody').html('Clicked on: ' + date.format()
+'<br/>Current view: ' + view.name
+'<br/>Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
$('#calendarModal').modal();
}
});
})
| c4087f62a44442a32f88d780dc940657a2599cd51a615a7cd8818ba33ab82cbb | ['7545926ff20f48cbb55fd0ecc6c49a56'] | A running example based on <PERSON>'s answer. I have also covered popover example for a quick start.
.popover works this way $(element).popover and doesn't work using element.popover
Running example: https://jsfiddle.net/alifaraze/mr53d7nz/8/
HTML
<div id="calendar"></div>
Script
$(document).ready(function() {
var unnep_napok = [
"2019-01-23",
"2019-01-25"
];
$('#calendar').fullCalendar({
events: [{
id: 1,
title: 'Full Day Event',
start: '2019-01-02',
end: '2019-01-03',
description: 'A full day event description'
},
{
id: 2,
title: 'Whole Week Event',
start: '2019-01-06',
end: '2019-01-10',
description: 'Whole week event description'
}
// more events here
],
eventRender: function(event, element) {
$(element).popover({
title: function() {
return "<B>" + event.title + "</B>";
},
placement: 'auto',
html: true,
trigger: 'click',
animation: 'false',
content: function() {
return "<h4>"+ event.description+"</h4>"
},
container: 'body'
});
},
dayRender: function(date, cell) {
for (i = 0; i < unnep_napok.length; i++) {
if (date.format('YYYY-MM-DD') == unnep_napok[i]) {
cell.css("background-color", "red");
}
}
}
});
})
|
50cc4b7386aef226a198573fe2a64505dfa026bf35d0b42d320008b623959765 | ['75479f5d10a9471d8e5f354391260e95'] | Python 3.6, Pandas 0.22.0:
I have imported a .csv file called Data.csv. It contains weather data with columns "NAME" "DATE" "SNOW" that references the location name, the date in MM/DD/YYYY format, and the amount of snowfall on that day. I want to group all rows by "NAME", then calculate monthly averages of "SNOW" so the output displays one row for "NAME", "DATE" (as a single, monthly entry), and "SNOW" with the average for the month. My "DATE" column is in datetime format. These entries are over years 2016 and 2017. After everything is grouped by monthly snowfall average, I need to make two new .csv files for each year - 2016, 2017. Here is what I have so far:
import pandas as pd
import numpy as np
df = pd.read_csv('Data.csv', sep = ',')
df1 = df.loc[:, ["NAME","DATE","SNOW"]]
df1["DATE"] = pd.to_datetime(df1.DATE)
date['DATE'] = df1.groupby(pd.Grouper(key='DATE', freq="M")).mean()
df1.to_csv('meansnow2017.csv', sep = ',', header=True)
The "DATE" column was originally an object. I cannot figure out how to layer these groupby statements in a way that makes sense. This gives me the desired column headers, but does not group my "DATE" by month or calculate my averages. Any help is appreciated!
| 3b96480cdfca9aab82ff721d456788e967083acd6d0b537227f4bc1b0b870fe6 | ['75479f5d10a9471d8e5f354391260e95'] | I have a .csv file that contains columns: NAME, DATE, INFO, STATS, MORE_INFO
I want to import the .csv file (either with Python 3.6 code, or Pandas)
Then I need to filter the columns: NAME, DATE, INFO
Here's where I am having trouble, I need to take the 'DATE' column of my .csv file which lists a date as 1/16/2016 and separate it so I can select only the MONTH for my filtered .csv output file.
My final columns to read like NAME, MONTH, INFO
The entire 'DATE' column is split by two years - 2016 and 2017. I need to take the NAME, MONTH, INFO for 2016 and save it to a new .csv file, and the same thing for 2017 so each year is separated by grouped months.
averageData = pd.read_csv('Data.csv', sep = ',', parse_dates=True)
df1 = averageData.loc[:, ["DATE", "NAME", "INFO"]]
df1["DATE"] = pd.to_datetime(df1["DATE"])
stripdate = datetime.datetime.strptime(['01-01-2016'], '%Y-%m-%d')
The variable stripdate where datetime.datetime.strptime() is supposed to rearrange the date in the right format is where I am misunderstanding something. How do I just group everything by MONTH of the dates listed under the 'DATE' column from my .csv file. Then further group them by year in new .csv files?
|
2a29d9504710f2c769c904ed82c34d520e5d8c72514dbefdc5f72bcf490d1d3a | ['754d42e128f64431a5fc52d52e79c260'] | I have two numpy arrays of the same length that contain binary values
import numpy as np
a=np.array([1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0])
b=np.array([1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1])
I want to compute the hamming distance between them as fast as possible since I have millions of such distance computations to make.
A simple but slow option is this (taken from wikipedia):
%timeit sum(ch1 != ch2 for ch1, ch2 in zip(a, b))
10000 loops, best of 3: 79 us per loop
I have come up with faster options, inspired by some answers here on stack overflow.
%timeit np.sum(np.bitwise_xor(a,b))
100000 loops, best of 3: 6.94 us per loop
%timeit len(np.bitwise_xor(a,b).nonzero()[0])
100000 loops, best of 3: 2.43 us per loop
I'm wondering if there are even faster ways to compute this, possibly using cython?
| a99b9b6afc65bf22ed15d5ae55f83a08edc7c73cbd0c6104e05e1093264873ec | ['754d42e128f64431a5fc52d52e79c260'] | I think you need to restate your question. If you want an equation g(x)=something to be true, but find the x as low as it can possibly be, then you are talking about minimizing x, constrained to the function g(x)=something. So what you have here is a constrained optimization problem. You want to minimise the function f(x)=x under some condition, e.g. g(x)<=5, x>=0. Check if this problem is convex and use something like
http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html
|
040ddb619af7ed52918776e5fa9c567c11e0721e91f2388c11066a6e282f9ae5 | ['75590a6d77f7497faf5d55cc3ee12750'] | The tool is right. There is a XSS-Vulnerability on the site, but the proof of concept (PoC) code is wrong. The content of a <textarea> can only contain character data (see <textarea> description on MDN). So your <script>alert("test")</script> is interpreted as text and not as HTML code. But you can close the <textarea> tag and insert the javascript code after that.
Here is the working PoC URL:
https://www.babyland.nl/service-contact/</textarea><script>alert("test")</script>
which is rendered as:
<textarea rows="" cols="" id="comment" name="comment"></textarea<script>alert("test")</script></textarea>
A little note to testing for XSS injection: Chrome/Chromium has a XSS protection. So this code doesn't exploit in this browser. For manual testing you can use Firefox or run Chrome with: --disable-web-security (see this StackOverflow Question and this for more information).
| 487f60a51078771597d7284950f02fb4cae9acd79cf6ebfb0381e59da3bc5660 | ['75590a6d77f7497faf5d55cc3ee12750'] |
I've an foswiki installation which is really slow (~ 60 seconds for a uncached page). I've tried to profile the installation with NYTProf, according to http://foswiki.org/Support/NYTProfDebugging with the following command:
> sudo -u www-data NYTPROF="file=/tmp/nytprof.out:addpid=1:endatexit=1" perl -wTd:NYTProf view -topic Some.Topic -username MyUsername
The script fails with an exit code 141 when I run it with profiler. If I run it without profiler (remote d:NYTProf) it exits successful and producing output.
After the profiling I've gotten a bunch of profile files in my /tmp directory:
nytprof.out.[841-1860]
But when I try to merge these files, I've get an error for the first file:
> nytprofmerge nytprof.out.*
Profile data incomplete, inflate error -5 ((null)) at end of input file, perhaps the process didn't exit cleanly or the file has been truncated (refer to TROUBLESHOOTING in the documentation)
I can merge the files without the first file, but the results are useless and shows only 87 calls to Foswiki<IP_ADDRESS>Sandbox<IP_ADDRESS>CORE:open and that's it.
Do I have any chance got get an valid profiling result? Or is there an other tool, that I can use in this case?
|
0054cc4295c4fca29dbe7e24530c4d69bb6a28f187946c64f60d38523b1b13cf | ['75599fe1878f4e18ba2d59f59293b41d'] | ok i restart sidekiq and the queue is ok;
now i change this code :
class RegistrationsWorker
include Sidekiq<IP_ADDRESS>Worker
def perform p_id
Rails.logger.info '--------------------------------------------------'
Rails.logger.info p_id
Rails.logger.info '--------------------------------------------------'
end
end
in:
class RegistrationsWorker
include Sidekiq<IP_ADDRESS>Worker
def perform p_id
@post = Post.new();
@post.save(:validate => false)
end
end
but nor write in mongoDB databases;
the message in console is all start and done;
| cb99daa05795a4cd5ca23ba35abcf5ce13c1504fc19adb5c5653be73b75b4531 | ['75599fe1878f4e18ba2d59f59293b41d'] | Hy all i have an error:
Blocked loading resource from url not allowed by $sceDelegate policy
i use angularjs + rails
this is a template:
I'm sorry; your browser doesn't support HTML5 video in WebM with VP8 or MP4 with H.264.
post.source is https://fbcdn-video-a.akamaihd.net/hvideo-ak-xaf1/v/t42.1790-2/1038699_10202931983969896_170894113_n.mp4
this my app conf angularjs:
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'....',
'....',
'....',
'....',
'https://fbcdn-video-a.akamaihd.net/hvideo-ak-xaf1/v/t42.1790-2/1038699_10202931983969896_170894113_n.mp4'
]);
$sceDelegateProvider.resourceUrlBlacklist([
'http://myapp.example.com/clickThru**']);
it's possible disabled controll angular URL ??
thanks
|
0ae9c788f9e2cdb8b3c7d78c40f15a6243e48ab64d1f9c169514710238263400 | ['755c0f27cfc64b0394ae500415818bcc'] | You have to use the Google Maps JavaScript API
https://developers.google.com/maps/documentation/javascript/reference?hl=es
You have to attach a google.maps.KmlLayer to a Map.
Put the API script in the <head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
Create a div like:
<div id="google-map" class="google-map"></div>
Then, use this JS code before </body>. Set your latitude, longitude and path to KML file.
<script>
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(YOUR_LAT,YOUR_LNG), //Set your latitude, longitude
zoom: 19,
mapTypeId: google.maps.MapTypeId.SATELLITE,
scrollwheel: false
}
var map = new google.maps.Map(document.getElementById('google-map'), mapOptions); // get the div by id
var ctaLayer = new google.maps.KmlLayer({
url: 'PATH/TO/FILE.kml' // Set the KML file
});
// attach the layer to the map
ctaLayer.setMap(map);
}
// load the map
google.maps.event.addDomListener(window, 'load', initialize);
</script>
| 32821de309f9efe735c70befaceff52e2934bb3e9a8a91c6539a4150bf4eef89 | ['755c0f27cfc64b0394ae500415818bcc'] | You don't need JS.
div.statusBar will take the height from child elements. If form or button don't have a fixed height, it won't work. Using height:5%; is taking height from body or html, which may be undefined.
Try adding a fixed height to div.statusBar
div.statusBar {
height: 60px;
}
Also, add display: block; to the button to apply width and height properties correctly.
|
8fd3e05a407a5f76903fdc6b964ca4bde3931ba75e7614571113333332b495aa | ['755d8bdf159c4fa0b6645b279d94c943'] | For hosting a simple web API (that you can scale according to usage, etc.) you'll want to use Websites. Assuming you're not looking for more complex / heavy-weight features (network configuration, more complex architectures e.g. offloading background processing different instances via queueing mechanisms, RDP into the host machine, etc.), then Websites are becoming the de-facto way to host websites on Azure.
The following page from the Azure documentation will give you a full feature comparison between the two:
http://azure.microsoft.com/en-us/documentation/articles/choose-web-site-cloud-service-vm/, but in short, if you simply have a web API project in VS that you want to host in Azure without worrying about the underlying infrastructure, then use Websites.
| 1844231aeb5045d8c328d9d47009b0076f3e5374f7daf8d1371b5c1a4d3d84a9 | ['755d8bdf159c4fa0b6645b279d94c943'] | I've recently set up RAID 0 with two disks. I've done that via my Asus Prime X370 Pro's UEFI.
Today I stumbled upon the terms "Software RAID", "Hardware RAID" and "Fake RAID". Most of the sources stated, that actual Hardware RAID from onboard controllers is really uncommon these days, and mostly Fake RAID is being used.
For one, I'm somewhat interested in what I'm using.
Also, I've been stumbling upon that stuff for a reason; I was planning to install ubuntu with dualboot alongside my windows installation; And every text I've read clearly recommended not to do this when using an actual Hardware RAID, because it likely causes a lot of trouble.
I've browsed the Asus Website and tried to look it up on google, but I couldn't figure out if my RAID system was Hardware or Fake.
Is there any way in general to determine which one it is, other than having a chat with the Asus customer service?
|
b385a66bf8691a4ac4fb34a9b395403b17743a07e61565054572d38a2aef4591 | ['75696bbefbc646db8ea081b11e2195d5'] | Is it even possible to poll let's say 10,000 URL's every second? I do keep threading in mind with the following code:
for (int i = 0; i < 10000; i++) {
Executors.newScheduledThreadPool(10).scheduleWithFixedDelay(new Runnable() {
@Override public void run() {
// Poll URL here
}
}, i, 1000, TimeUnit.MILLISECONDS);
}
I do open a connection to the URL this way (I do close it later on after reading):
HttpURLConnection connection = (HttpURLConnection) new URL("https://stackoverflow.com").openConnection();
connection.connect();
Then, I read the data of the outputstream:
InputStream inputStream = connection.getInputStream();
Then, I read the inputstream and close the HttpURLConnection.
When polling 200 URL's every second, everything works just fine. When polling 400+ url's, everything chokes. Connecting to a url takes 20-30 seconds.
I do test it on Tomcat with Eclipse on my own computer (not a server). When the connections take long to make, I can't even open webpages in the browser. The script uses about 20-30 Mbps while my internet has a maximum of 90 Mbps on the computer.
If you have any suggestions I would really like to hear them and try them.
| 805c6cf0722333ae54f9cd9899a0b92c56fb4eaeed404ff4eca5f3f7becf5a22 | ['75696bbefbc646db8ea081b11e2195d5'] | I'm in the initial stages of setting up a project and wanted to structure my sass files appropriately.
This is my structure:
/css
style.scss
/partials
_colors.scss
In style.scss
@import 'partials/_colors';
body {
background-color: $mainBgColor;
}
In _colors.scss
$mainBgColor: #eee;
When I attempt save style.scss, I get error on save... check file for syntax or something to that effect.
In fact, each of these @import directives produce errors:
@import 'partials/_colors.scss';
@import '_colors.scss';
@import '_colors';
@import _colors;
What am I doing wrong?
|
acb71b30a1022198eccea4c985125c1ec023949ba2ffb6753323d8324b2accc0 | ['756e16db6a9440508133af5779dde445'] | i am useing persistentContainer
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
// let container = NSPersistentContainer(name:"YiuPai")
let container = NSPersistentContainer(name:"YiuPai")
let storeUrl = self.applicationDocumentsDirectory.appendingPathComponent("YiuPai.sqlite")
print(storeUrl)
let description = NSPersistentStoreDescription(url: storeUrl)
description.shouldInferMappingModelAutomatically = true
description.shouldMigrateStoreAutomatically = true
container.persistentStoreDescriptions = [NSPersistentStoreDescription(url: storeUrl)]
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
error i am geting
2017-08-24 16:37:43.912800+0530 YiuPai<PHONE_NUMBER>:496051] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/YiuPai.sqlite options:{
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
} ... returned error Error Domain=NSCocoaErrorDomain Code=134110 "An error occurred during persistent store migration." UserInfo={sourceURL=file:///var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/YiuPai.sqlite, reason=Can't copy source store to destination store path, destinationURL=file:///var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/.YiuPai.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3, NSUnderlyingError=0x170851460 {Error Domain=NSSQLiteErrorDomain Code=5 "(null)" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/.YiuPai.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3, Source database Path=/var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/YiuPai.sqlite, reason=Failed to replace destination database}}} with userInfo dictionary {
NSUnderlyingError = "Error Domain=NSSQLiteErrorDomain Code=5 \"(null)\" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/.YiuPai.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3, Source database Path=/var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/YiuPai.sqlite, reason=Failed to replace destination database}";
destinationURL = "file:///var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/.YiuPai.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3";
reason = "Can't copy source store to destination store path";
sourceURL = "file:///var/mobile/Containers/Data/Application/81EC85D8-5C35-4090-8F2E-5229775F2D43/Documents/YiuPai.sqlite";
}
How can I resolve this?
| 0bdf07a4a6909fb30467252bd3584cdc519d8ec6c3cbddbbb4a1ab5f1cbbc3d8 | ['756e16db6a9440508133af5779dde445'] |
tableview.layer.borderWidth=2.0;
tableview.layer.borderColor=[[UIColor blackColor].CGColor];
you need to take IBoutlet of hight Constraint of your Table View
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *TblHeightConstraint;
set table height with
TblHeightConstraint.constant = yourCellHight * [NumberofCells];
it will set your table hight daynamically.so Your border will show according to number of cell.
|
20b6f9e6095a83227fa6b01446ccdb3e8b4c3124ec3f888a74126e51cbbe4b51 | ['7582b64ee9d74519870fd0c5cbbbb1a7'] | Some electronic switches power themselves by running a trickle current through the light, but that doesn't work well with modern efficient bulbs.
Others, such as the one you got, require a neutral connection -- which is standard in new construction but isn't present in many older houses.
Sorry, but unless you run a neutral to that box you can't use this switch there.
| ed63ef927f38e6d79bc0d34468b31d3f8637a147957703e76f5500280a62b3a2 | ['7582b64ee9d74519870fd0c5cbbbb1a7'] | I would like to create sulfur hexafluoride and test floating things in it but I am a "chemistry noob" and from what I've read it's non-toxic and generally quite safe but first of all I do not know how to make it (other than that it involves sulfur and fluoride which are both definitely not safe) and the precautions for doing this. Basically: Safe way to make sulfur hexafluoride and how safe is sulfur hexafluoride?
|
17a1d92a50d1bbf66f222ee236c769e00bc132514e8fde3d3e20d34dc24d9e71 | ['7585bfc2682a4f32a4fbc41d82f33a01'] | I see. I am still interested in a solution that shows how something of the form $\sqrt{f(x)+\mathcal{O}(g(x)}=\sqrt{f(x)}+\mathcal{O}(\sqrt{g(x)})$ can be derived, as well as some of the other questions in my post, but your answer does help my understanding. | b3908d03875d309433d14ae954f8910ac98b998e716321e74369ca6695d5a982 | ['7585bfc2682a4f32a4fbc41d82f33a01'] | So is it just a matter of knowing that $\mathcal{O}(x^{3/2})\subset\mathcal{O}(x^2)$? I do think it's useful later in the paper based on the form of other equations, but I guess I'm just a bit disappointed that there's no explicit proof for the $\mathcal{O}(x^{3/2})$ term. Thanks for your answer. It's the most helpful input I've gotten so far, so I will accept it as an answer. |
f449533105cdfcd0f6e6c09efb304dad44fa71c26bd56423702d345ca74c36e1 | ['758c57f19294434f811b1b543769c69c'] | Use a [Flags] enum.
[Flags]
public enum Status
{
Setting1Enabled = 1,
Setting2Enabled = 2,
Setting3Enabled = 4
}
That way you can parse your int to an enum that supports bitwise comparisons.
To convert an Integer to that enum use Enum.Parse()
Status status = Enum.Parse(typeof(Status), value);
And to check a certain value you can just compare it against the respective enum value.
| e78807a6ffa6b124386d52c149807d97ebb189b45e5cb1e9e3bf8bf5b98dbfd8 | ['758c57f19294434f811b1b543769c69c'] | The return type of any input of the ROUND() function is depending on the input data type as you can see on MSDN.
This causes your ROUND() to return a data type with a decimal point (in this calculation a float) that you will have to truncate after the conversion to nvarchar (or cast it to an int before).
|
70c00d677acc42de14527a8f0d99ec157c8e94e56fd3063d7e9091c11a548f6e | ['758c79d3f69f46bdb39cfa6f24184fc5'] | Just use, display:inline-block . Example:
<form style ='display:inline-block;'>
<input type = 'submit'/>
</form>
<form style ='display:inline-block;'>
<input type = 'submit'/>
</form>
And you may also use HTML Table to do this forcefully. Example:
<table>
<tr>
<td>
<form>
<input type="submit" />
</form>
</td>
<td>
<form>
<input type="submit" />
</form>
</td>
</tr>
</table>
| 809b869cf156b64049c15d0d1bd7143d11422346a5c90ac650e7ef2915621915 | ['758c79d3f69f46bdb39cfa6f24184fc5'] | The image is resizing according to your screen size because you've used percentage for your image. If you don't want your image resizing, just use a fixed height and width for your image. Example:
.course__header img {
width: 200px;
height: 200px;
width: 30%;
display: block;
vertical-align: middle;
padding-right: 5%;
}
|
555dfed9f4ef5946913ae5d9b8102d981dc1f04a87102042d4c49e6706a06e86 | ['758f6954d0ed4a538e49fd1b209bbd05'] | Here is a way to do it. First create the countup flag, and then perform a cumsum. Then correct it with the NaN values.
import pandas as pd
import numpy as np
df = pd.DataFrame({'Signal_1' : [0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,1,1,1,1]})
# Only count up when the previous sample = 0, and the current sample = 1
df["shift"] = df["Signal_1"].shift(1)
df["countup"] = np.where((df["Signal_1"] == 1) & (df["shift"] == 0),1,0)
# Cumsum the countup flag and set to NaN when sample = 0
df["result"] = df["countup"].cumsum()
df["result"] = np.where(df["Signal_1"] == 0, np.NaN, df["result"] )
| be6f0d5ef41abefa4309ba12e724a0f94e38a07098b732df6d6c42a4210734de | ['758f6954d0ed4a538e49fd1b209bbd05'] | You could read in a large .csv with the 'chunk' iterator, and then perform the calculation on the chunk instead of the the entire .csv file. The chunksize defines the number of rows in a single chunk. That way, you have a good handle to control the memory usage. The downside will be that you will have to add some logic that will merge the results of the chunks.
import pandas as pd
df_chunk = pd.read_csv('file.csv', chunksize=1000)
for chunk in df_chunk:
print(chunk)
|
3eaeb9543e3208d308a10d2f1b4b0a975aa13ae89e2dd3b9208c8246ea039685 | ['758fc30a41e649b9b469e755515f980b'] | Create below procedure which will convert table result into html format
create proc [dbo].[Proc_QueryToHtmlTable] (
@query NVARCHAR(MAX)
,--A query to turn into HTML format. It should not include an ORDER BY clause.
@orderBy NVARCHAR(MAX) = NULL
,--An optional ORDER BY clause. It should contain the words 'ORDER BY'.
@html NVARCHAR(MAX) = NULL OUTPUT --The HTML output of the procedure.
)
AS
BEGIN
SET NOCOUNT ON;
IF @orderBy IS NULL
BEGIN
SET @orderBy = ''
END
SET @orderBy = REPLACE(@orderBy, '''', '''''');
DECLARE @realQuery NVARCHAR(MAX) = '
DECLARE @headerRow nvarchar(MAX);
DECLARE @cols nvarchar(MAX);
SELECT * INTO #dynSql FROM (' + @query + ') sub;
SELECT @cols = COALESCE(@cols + '', '''''''', '', '''') + ''['' + name + ''] AS ''''td''''''
FROM tempdb.sys.columns
WHERE object_id = object_id(''tempdb..#dynSql'')
ORDER BY column_id;
SET @cols = ''SET @html = CAST(( SELECT '' + @cols + '' FROM #dynSql ' + @orderBy + ' FOR XML PATH(''''tr''''), ELEMENTS XSINIL) AS nvarchar(max))''
EXEC sys.sp_executesql @cols, N''@html nvarchar(MAX) OUTPUT'', @html=@html OUTPUT
SELECT @headerRow = COALESCE(@headerRow + '''', '''') + ''<th>'' + name + ''</th>''
FROM tempdb.sys.columns
WHERE object_id = object_id(''tempdb..#dynSql'')
ORDER BY column_id;
SET @headerRow = ''<tr>'' + @headerRow + ''</tr>'';
SET @html = ''<table border="1">'' + @headerRow + @html + ''</table>'';
';
EXEC sys.sp_executesql @realQuery
,N'@html nvarchar(MAX) OUTPUT'
,@html = @html OUTPUT
END
and then test as below
declare @html NVARCHAR(MAX)=''
exec Proc_QueryToHtmlTable '
SELECT 1 as id, 2 as name ',' name' ,@html OUTPUT
print @html
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'profile_name'
,@execute_query_database = 'Db NAME'
,@body = @html
,@body_format = 'HTML'
,@recipients = '***@gmail.com;**@gmail.com'
,@subject = 'test Report'
| 0196ec303986fc7af74b1c39fe18d4f341ae366433c42b5f942c939131cd1bb9 | ['758fc30a41e649b9b469e755515f980b'] | if ((tcpClient.Connected == true))
{
int clientCount = Interlocked.Increment(ref clients);
NetworkStream clientStream = tcpClient.GetStream();
ASCIIEncoding encoder = new ASCIIEncoding();
//Console.WriteLine("Client connected. ({0} connected)", clientCount);
StringBuilder myCompleteMessage = new StringBuilder();
if (clientStream.CanRead)
{
byte[] myReadBuffer = new byte[1024];
int numberOfBytesRead = 0;
// Incoming message may be larger than the buffer size.
try
{
do
{
System.Threading.Thread.Sleep(1000);
numberOfBytesRead = clientStream.Read(myReadBuffer, 0, myReadBuffer.Length);
myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
}
while (clientStream.DataAvailable);
}
catch (Exception ex)
{
tcpClient.Close();
}
}
}
I am working on vehicle Tracking System. I did this code as listner
I try to read data from vehicle tracking device i get data when i send through client(local machine/PC) but it cant read data from device
Thanks
|
e9f0af80ee2ae9fdc1bb2a693fbdc86d7ee3b89291a40b79ca462ba4f947f552 | ['75a5dc63ee734333a57519934c0f313e'] | How can I write a C program that reads your first and last names and than converts them to upper-case and lower-case letters...I know how upper and lower letters but dk how to do for first and last names..any sugegstion?...
#include<iostream>
#include<string.h>
using namespace std;
int i;
char s[255];
int main()
{
cin.get(s,255,'\n');
int l=strlen(s);
for(i=0;i<l;i++)
......................................
cout<<s; cin.get();
cin.get();
return 0;
}
| 03dd44cb9adcd37f2c13deac567a9dbebfeb0d77f22ad655bf4110d978af7380 | ['75a5dc63ee734333a57519934c0f313e'] | I have 3 files:
mainOperations.cpp
operations.c
operations.h
(does some functions, is not importat what is in, for what I am looking)
I was trying to run from cmd with gcc like this:
"gcc -o C:...\ mainOperations.cpp operations.c operations.h" but it say "No such file or directory" for all of them.
So, my question is what to do to run with gcc from cmd? (Windows 7)Thx!
|
033f0a918f0f3fefe7bca466148200d135defd925dda0737a71c3be36f2d81ed | ['75c7ddbab0ee4d52bd5ad4989c621c29'] | The path here is the path used in the browser address bar, e.g. a user would access "http://yoursite.com/#/nodes/extensions/phones" to see this page on your site.
If instead you want to configure the endpoint that the Ember app accesses to retrieve the json, e.g. "http://yoursite.com/api/nodes/extensions/phones" then that needs to be configured in your ember-data adapter or in your model's data retrieval functions.
| aaaaf4d89cf259c829d58c67e758b00b80b47c3b6f31aaea4348ac6900a09f6c | ['75c7ddbab0ee4d52bd5ad4989c621c29'] | I'm developing an app using Heroku but they don't have the plpgsql language loaded for Postgres which is causing an issue when trying to run the following:
CREATE FUNCTION profiles_search_trigger() RETURNS trigger AS $$
begin
new.search_vector :=
setweight(to_tsvector('pg_catalog.english', coalesce(new.display_name,'')), 'A') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.about,'')), 'B') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.music_education,'')), 'D') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.other_experience,'')), 'D') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.favourite_artists,'')), 'D');
return new;
end
$$ LANGUAGE plpgsql;
How could I rewrite this using standard SQL rather than plpgsql?
|
0117bc729d55d88acae6b6bf1934f85c83b9e74c884ac4ca0132bdf09096804e | ['75c8f4b5f5cb45019b1e9f9441b53c08'] | I want to replace 3, 4 and 5th columns of lines from 20 to 100 of file a.com with 6, 7 , 8th columns of lines from 50 to 130 of file b.com. I know the command
awk 'NR==FNR {fld6[NR]=$6; fld7[NR]=$7; fld8[NR]=$8; next}
FNR>19 && FNR<101 {$3=fld6[FNR]; $4=fld7[FNR]; $5=fld8[FNR]}1' b.com a.com
-will work if the line numbers were same (20 to 100) for a.com b.com, but here they are not (20 to 100 for a.com and 50 to 130 for b.com). So I how to replace column of files with different line numbers using awk?
| b8499d1cbbd0ea533f040e560b010bee43e4bd188f44183091b797a6d0345cfb | ['75c8f4b5f5cb45019b1e9f9441b53c08'] | I am importing data to spark from MYSQL through JDBC and one of the column has time type (SQL type TIME and JDBC type java.sql.Time) with large hour value (Eg: 168:03:01). Spark convert them to timestamp format and causing error while reading three digit hour.How to deal with Time type in Spark
|
d0f2951ed3fad4135c184b9310817b30435e60d9b2025b3d749aec95feab6152 | ['75ca9c7bdb684c84921cdbad5c471ee4'] | Oi,
Eu estou gerando campos dinamicamente usando Jquery, e pra cada campo eu adiciono no fim do id um contador. Eu queria saber como eu poderia fazer para remover a div que engloba o botão e os campos.
isto é o meu form:
$contador = '';
foreach ($programas as $key => $formu){ $contador += 1;?>
<div id="campos_<?php echo $contador; ?>" name="campos[]" class="campos col-md-12" >
<input id="tbprogramacao_tv_hora_inicio_<?php echo $contador; ?>" class="form-control hora" type="text" value="<?php echo $formu->getHoraInicio(); ?>" name="tbprogramacao_tv[hora_inicio][]" maxlength="8">
<br><div class='btn btn-primary' style="border:solid 1px;" id="rmv" onclick="remover()"><span class="fa fa-minus"></span></div>
</div>
esta é a função que eu estou criando para remover:
function remover()
{
$('.campos').remove();
}
mas não funciona. Alguém que já passou por isso pode me ajudar?
| 2602d6d0d89d0ae7f2a9b6779277d8712502392a843f47161707d3e676bc3b80 | ['75ca9c7bdb684c84921cdbad5c471ee4'] | I solved this by changing the coordinate space. It now starts without a offset in the first row and for that I found a working example which I was able to adjust a bit.
hWidth = this.tileset.tileSize.width / 2;
hHeight = this.tileset.tileSize.height / 2;
pX = point.x - halfWidth;
pY = point.y - halfHeight;
x = Math.floor((pX + (pY - hHeight) * 2) / this.tileset.tileSize.width);
y = Math.floor((pY - (pX - hWidth) * 0.5) / this.tileset.tileSize.height);
tx = Math.floor((x - y) / 2) + 1 + this.camera.x;
ty = y + x + 2 + this.camera.y;
|
8641a04c2ea042cb3a597e6f9124af9f0157be6b62a3f28259bc4182fccb21a6 | ['75cb96f1c25f479695b3bc70a6341d13'] | I'm new to machine learning and program.
Now I'm trying to develop YOLACT AI using my own data.
However, when I run train.py, I get the following error and cannot learn.
What can I do to overcome this error?`
(yolact) tmori@tmori-Lenovo-Legion-Y740-15IRHg:~/yolact$ python train.py --config=can_config --save_interval=2000
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
Initializing weights...
Begin training!
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
[ 0] 0 || B: 4.840 | C: 16.249 | M: 4.682 | S: 2.749 | T: 28.521 || ETA: 9:18:44 || timer: 3.352
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
[ 1] 10 || B: 4.535 | C: 9.228 | M: 4.379 | S: 1.867 | T: 20.008 || ETA: 3:25:24 || timer: 0.864
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
/home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
mode = random.choice(self.sample_options)
Computing validation mAP (this may take a while)...
Traceback (most recent call last):
File "train.py", line 504, in <module>
train()
File "train.py", line 371, in train
compute_validation_map(epoch, iteration, yolact_net, val_dataset, log if args.log else None)
File "train.py", line 492, in compute_validation_map
val_info = eval_script.evaluate(yolact_net, dataset, train_mode=True)
File "/home/tmori/yolact/eval.py", line 956, in evaluate
prep_metrics(ap_data, preds, img, gt, gt_masks, h, w, num_crowd, dataset.ids[image_idx], detections)
File "/home/tmori/yolact/eval.py", line 427, in prep_metrics
detections.add_bbox(image_id, classes[i], boxes[i,:], box_scores[i])
File "/home/tmori/yolact/eval.py", line 315, in add_bbox
'category_id': get_coco_cat(int(category_id)),
File "/home/tmori/yolact/eval.py", line 293, in get_coco_cat
return coco_cats[transformed_cat_id]
KeyError: 0
I'm trying to develop an AI that finds cans and segments them.
First I annotated only one item of "can" with labelme, and then created a COCO format json file with labelme2coco.py.
After that, I modified config.py according to "Custom Datasets" on YOLACT's GitHub and ran train.py.
My development environment is as follows.
OS:Ubuntu20.04LTS
Anaconda:4.8.3
Python: 3.6.12
Pytorch: 1.4.0
CUDA Toolkit: 10.1
cuDNN: 7.6.5
| ef7303b6b128d47161ee0580b5eec184dbeae03b0c4dffb803000d344a419fc8 | ['75cb96f1c25f479695b3bc70a6341d13'] | Is there any way to save the detected categories, their number, MASK area, etc. to a TXT file or CSV file when performing instance segmentation using YOLACT?
I’m using YOLACT (https://github.com/dbolya/yolact) to challenge instance segmentation.
I was able to use eval.py to do an instance segmentation of my own data and save that image or video.
However, what I really need is the class names and their numbers detected and classified by YOLACT's AI, and the area of MASK.
If we can output this information to a txt file or csv file, we can use YOLACT even more advanced.
If I can achieve that by adding an option in eval.py or modifying the code, please teach me.
Thank you.
|
68b5310a0cabd6230b96448f51a742d2919c15c8f4d828ead935f9b94e36a188 | ['75d93d3cc3e646f18a67b68f32e52622'] | So what you're saying is after the submit button you're getting send to the backend page actually? what i would do is ( in the backend page) when the code has executed, simple place a php statement :
location:('index.html');
this way you'll instantly get put back to the page you submitted your form on
| 339403aeb67b30aa691e9b1fd3a8e57839d0fdcf37c7528a8c2d8c360db75e66 | ['75d93d3cc3e646f18a67b68f32e52622'] | i am currently making a cms and want to make a option where you can duplicate posts. how i do this is like following: on the archive page( where i fetch all the posts and display them in a table) i add a checkbox with the id of the post (post_id). then i have a select wrapper in a < form > with the option to duplicate, i then send it to my functions map where i check the select value in a switch.
if switchStatement == duplicate i make a query
"SELECT * FROM posts WHERE post_id = :value"
:value is in this case post_id.
in the other function where i want to do the duping i have the following code:
function duplicateBulk($bulkQuery, $connection, $data){
$statusNumber = 0;
$duplicateStmnt = $connection->prepare($bulkQuery);
$duplicateStmnt->execute($data);
while($bulkResult = $duplicateStmnt->fetch(PDO<IP_ADDRESS>FETCH_ASSOC)):
$post_title = $bulkResult['post_title'];
$post_subtitle = $bulkResult['post_subtitle'];
$post_author = $bulkResult['post_author'];
$post_tag = $bulkResult['post_tags'];
$post_date = date('d-m-y');
$post_content = $bulkResult['post_content'];
$post_id = $bulkResult['post_id'];
$post_img= $bulkResult['post_img'];
$post_thumb = $bulkResult['post_thumb'];
$post_category_id = $bulkResult['post_category_id'];
echo $post_title;
$dataCl = [
'post_id' => $post_id,
'post_author' => $post_author,
'post_title' => $post_title,
'post_subtitle' => $post_subtitle,
'post_tag' => $post_tag,
'post_date' => $post_date,
'post_content' => $post_content,
'post_img' => $post_img,
'post_thumb' => $post_thumb,
'post_category_id' => $post_category_id,
'post_status' => $statusNumber
];
$cloneQuery = "INSERT IGNORE INTO posts ( post_id, post_author, post_status,
post_tags, post_date, post_title, post_subtitle, post_content, post_category_id, post_img,
post_thumb ) VALUES ( :post_id, :post_author,:post_status, :post_tag, :post_date,
:post_title, :post_subtitle, :post_content, :post_category_id, :post_img, :post_thumb )";
$cloneStmnt = $connection->prepare($cloneQuery);
$cloneStmnt->execute($dataCl);
endwhile;
header('location: ./../posts_archive.php');
}
i have tried to echo the title etc. everywhere in the code and it does work. all the database values are correct also. i really am on a dead end to why it does not fetch the data and then insert it again to duplicate it.
this is the code before the external function: ( the switch case ):
include('./../../../configs/db-config.php');
//here i link to the database connection
bulkOperation($connection);
function bulkOperation($connection){
if(isset($_POST['bulkPosts'])):
if(!isset($_POST['checkboxItem']) ||
empty($_POST['checkboxItem'])):
header('location: ./../posts_archive.php');
die();
endif;
$checkboxItem = $_POST['checkboxItem'];
foreach($checkboxItem as $value):
$bulkValue = $_POST['bulkPosts'];
$data = [
'value' => $value,
];
switch($bulkValue):
case 'archive':
$bulkQuery = "UPDATE posts SET post_status = 0 WHERE post_id = :value";
$connection->prepare($bulkQuery)->execute($data);
header('location: ./../posts_archive.php');
break;
case 'publish':
$bulkQuery = "UPDATE posts SET post_status = 1 WHERE post_id = :value";
$connection->prepare($bulkQuery)->execute($data);
header('location: ./../posts_archive.php');
break;
case 'highlight':
$bulkQuery = "UPDATE posts SET post_status = 2 WHERE post_id = :value";
$connection->prepare($bulkQuery)->execute($data);
header('location: ./../posts_archive.php');
break;
case 'delete':
$bulkQuery = "DELETE FROM posts WHERE post_id = :value";
$connection->prepare($bulkQuery)-
>execute($data);
header('location: ./../posts_archive.php');
break;
case 'duplicate':
$bulkQuery = "SELECT * FROM posts WHERE post_id
= :value";
duplicateBulk($bulkQuery, $connection, $data);
break;
default:
#redirect back to archive_posts
break;
endswitch;
endforeach;
endif;
}
so this is the situation i have explained short:
fetch data in page1. page1 add option to send post_id to page2 , in page2 check if select == duplicate, if select == duplicate, make a query and start a new function in page2 also.
in the new function, which is out of the foreach loop and switch , fetch the data , and try to insert it again. ( this happens outside of the foreach loop where i loop through all post_id's (:value) , but inside the foreach loop i call the function so this shouldnt be a problem i think.
if someone knows what i do wrong, please tell me i really am on a dead end and do not know what to do...
thanks in advance.
|
0c4e9db141017a623418c09b167aaf3edb054b207cd4bc5712297fa8421c03cf | ['75e7d8c453134689911ce79a9918804d'] | Try change to:
if ($mode == 'EDIT'){
$k=1;
for($i=1;$i<=10;$i++){
for($j=1;$j<=10;$j++){ ?>
<?php foreach($seat_data as $seats){
if($seats->iSeatNumber == $k){
$style="min-height:25px;min-width:25px;background-color:#12B22F;float:left;margin:0 0 5px 10px;cursor:pointer;";
}
else{
$style='min-height:25px;min-width:25px;background-color:#969696;float:left;margin:0 0 5px 10px;cursor:pointer;';
}
}
?>
<div id='<?php echo $k ;?>' class="seat_selection" style="<?php echo $style; ?>">
<?php echo $k;?>
</div>
<?php $k++;
} ?>
<br /><br />
<?php
}
}
| 9f2491964630f013dad97002d0dd3c9833b1d14dbe5679d4587b2ceca961fc00 | ['75e7d8c453134689911ce79a9918804d'] | I set charset utf-8; at http tag, but error.log given:
2012/08/22 10:47:33 [error] 6588#1560: *1 no "charset_map" between the charsets "GB2312" and "utf-8" while reading response header from upstream, client: <IP_ADDRESS>, server: localhost, request: "GET /index2.php HTTP/1.1", upstream: "fastcgi://<IP_ADDRESS>:9000"....
Any idea? I want set default language to utf-8 only.
|
5b200ae4be14aaa5a6d51ddc178d0a279386270d0c09a15b7dee909ba636f065 | ['75ffae12dae8414ca17114e19517dda6'] | DIFFERENCES - USES (when and why)
A field is a variable that is declared directly in a class or struct. A class or struct may have instance fields or static fields or both. Generally, you should use fields only for variables that have private or protected accessibility. Data that your class exposes to client code should be provided through methods, properties and indexers. By using these constructs for indirect access to internal fields, you can guard against invalid input values.
A property is a member that provides a flexible mechanism to read, write, or compute the value of a private field. Properties can be used as if they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily and still helps promote the safety and flexibility of methods.
Properties enable a class to expose a public way of getting and setting values, while hiding implementation or verification code. A get property accessor is used to return the property value, and a set accessor is used to assign a new value.
| d0c6289d22dfe9c5fe814f19a4a66455a5df9631844ae60a8f36a7979b96000b | ['75ffae12dae8414ca17114e19517dda6'] |
Is the first code providing any encapsulation at all?
NO (at least the particular code you wrote).
The 2 pieces of code are almost the same. The first one doesn't provide any useful difference compare to the second one (as the code is written).
When using getters and setters, you can restrict access to the private variables. This could be a form of Encapsulation.
i.e.
private int x
public int getInt(String password){
if(password == 'RealPassword'){
return x
}
}
|
48560caf68654fa8e694a4a826ed97bfc6210608979e74dab6bce5b1a926793f | ['7610155e0215435ba7a632ed4860c242'] | I've just discovered the library sqltap (https://github.com/inconshreveable/sqltap). It produces nicely styled HTML pages that help with inspecting and profiling SQL queries that are generated by SQLAlchemy.
An example usage:
profiler = sqltap.start()
run_some_queries()
statistics = profiler.collect()
sqltap.report(statistics, "report.html")
The library hasn't been updated in 2 years, however, it seemed to be working just fine when I tested it with my application earlier today.
| 80877c3ea6e14caaa900fab67b4fa5f1b22104eff68fdbd593963934f948b0f7 | ['7610155e0215435ba7a632ed4860c242'] | Assuming equal force is used, which one would be more efficient when it comes to generating current through electromagnetic induction: to use 100% of available force to move the permanent magnet only or the coil only? Or to use 50% to move the magnet and 50% to move the coil? My thinking is that speed plays an important role so I thought by moving both it will improve the efficiency by increasing the cutting speed of the magnetic flux. Thank you.
|
12c3d6b6ce1208005b4fa4fd85ae441ba26bb32eb891f72998eef3d4d28c5547 | ['761924db727a4c0582c64d5e112f2697'] |
By default MongoDB writes are fire and forget, so if something goes wrong there is a possibility of data loss. You can use SafeMode which gives you a response if the write was successful or not, then handle it any way you want. Having said that I've not experienced any lost data myself. Multiple servers would be replication which is used for failover, if one node goes down another can automatically be promoted to as the master.
If you want full text search then you can't really do it with Mongo. You could tokenize each word in a post and store each word in an embedded array on the document which would be indexed you could query for each of those words. The problem with that is then you have no relevancy. You could build in some relevancy logic with Map Reduce, but this would slow down your query. If you really want fast full text search you should look at SOLR or Elastic Search.
Personally I wouldn't store status updates in a embedded document, I'd put them all in a separate collection with a user identifier. There are no joins in Mongo so you'd have to do two queries, one to get the IDs of your friends, another to get the status updates. Depending on the size of your collection, with the right indexes in place this would be extremely fast even though it is two queries.
I don't think you can use an auto-incrementing integer for an ID at Mongo level. You could handle it yourself in the application as you can use any field for the identifier. When adding a new document you'd have to query the collection to get the highest ID and increment it. The Mongo Object ID is made up of Machine ID, Process ID, TimeStamp and some randomness to create an unique key.
I'm not familiar with Mongoose.
| ebf9394967cd1f79d673fe7c0a4d9456b5fb15bc9d52245e260a82f32b4d44d9 | ['761924db727a4c0582c64d5e112f2697'] | It wont use index only because you'll be retrieving other fields via that query that aren't indexed.
Do all your documents have an EndDate in the past? As you're using LTE with the current date, it will still scan all index items previous to the current date. It's only scanning the index which is quicker than scanning the full document.
If you queried for a date range you'd see the number of scanned objects go down.
|
d876eb0b64604c4f9d48ce79d49eabd68bd188b57d5c0ec7ef211e86412cc672 | ['7620c9282fae4ff481a71d495fca288c'] | мучает вопрос, какой смысл в именно такой вот спецификации как OpenGl которой пользуются наверно почти все UI-фреймворки где нет возможности задать отрисовку нативных контролов средствами ОС? почему все рисуют их сами, задавая все до мелочей, а именно анимация при наведении на контрол, цвет выделения текста (который еще меняется с настройками в операционке), подстройка под тему ОС? Логичнее было бы имхо для кроссплатформенности придумать стандарт рисования 2d/3d графики и в комплекте каких то часто используемых базовых контролов, или я что то путаю и все работает вообще иначе?
| d5ffc56f8a0fba5f0bd32a7760fd2f2f4ff239a9736f26d173f14b735e2c94cb | ['7620c9282fae4ff481a71d495fca288c'] | окей, ну а допустим у меня динамический массив объектов где у объекта есть какая нибудь переменная, как после компиляции можно будет различить адрес переменной в объекте при наличии нескольких его экземпляров? у нас то даже особо названия экземпляра класса явного нет, экземпляров при выполнении мы можем создать сколько угодно, по каким признакам их различать? правда видимо я уже подкрался в полиморфизму |
1289405a8c6a9ae9122707963982fec9dc45da2116fece8199ee5d12ce995368 | ['76269bbd80fc48a88cdbea0dac12ab87'] | I have a logstash (6.8.1) configuration file like this:
input {
elasticsearch {
hosts => [ "<IP_ADDRESS>:9200" ]
index => "myindex"
codec => "json"
docinfo => true
}
}
filter {
mutate {
remove_field => ["@timestamp", "@version"]
}
}
output {
elasticsearch {
hosts => [ "<IP_ADDRESS>:9300" ]
index => "%{[@metadata][_index]}"
document_type => "%{[@metadata][_type]}"
document_id => "%{[@metadata][_id]}"
}
}
However, the es in port 9200 is 5.x, and the es in port 9300 is 6.x.
Moreover, the es in port 9200 has multiple "types".
Since es 6.x has only one "type", I need something like this:
input {
elasticsearch {
hosts => [ "<IP_ADDRESS>:9200" ]
user => ""
password => ""
index => "myindex"
document_type => "mytype" <--- like this
codec => "json"
docinfo => true
}
}
How can I realize this?
Thanks a lot for your help.
| 47734bbaca8fecd1363c62603a51ac2cc1f93b45fdcad3c1c539ba075357e4fe | ['76269bbd80fc48a88cdbea0dac12ab87'] | Finally, I use elasticsearch-dump to realize this operation:
docker run --net=host --rm -it docker.io/taskrabbit/elasticsearch-dump \
--input=http://user:password@input-es:9200 \
--input-index=my-user-index/my-user-type \
--output=http://user:password@output-es:9200 \
--output-index=my-user-index \
--type=mapping
PS: to migrate data, use option --type=data
|
ddccc8f32ac1b5a5048a3f74aa279b6f3bc8f6fe4978504740780a126ac4b2a9 | ['762872a63a254a6a9b5087831a338315'] | I am having a situation in which I have to fill Combo Box with data available in a file. Mine approach is
self.cmbBusListBox.addItem("Select ..")
lines = [line.rstrip('\n') for line in open('i2coutput.cfg')]
for line in lines:
self.cmbBusListBox.addItem(line)
self.cmbBusListBox.currentIndexChanged.connect(self.selectBusChange)
This process giving me error:
Traceback (most recent call last):
File "I2CMain.py", line 3, in <module>
from Py4 import QtGui, QtCore
ImportError: No module named Py4
In any file handling process for data populating from file in Combo Box giving same error.
Please guide me. Thanks in advance.
| fbe20ee47c0d9eefacc97afe8410163d0b51bfeaab5226cd1d40aa0063ee1533 | ['762872a63a254a6a9b5087831a338315'] | I want to embed a XML into WPF project in way that on requirement I can update the any attribute in the XML. Sample XML is
<Auth uid="" tid="" ac="" sa="" ver="" txn="" lk="">
<Uses pi="" pa="" pfa="" bio="" bt="" pin="" otp=""/>
<Tkn type="" value=""/>
<Meta udc="" fdc="" idc="" pip="" lot="G|P" lov=""/>
<Skey ci="" ki="">encrypted and encoded session key</Skey>
<Data type="X|P">encrypted PID block</Data>
<Hmac>SHA-256 Hash of Pid block, encrypted and then encoded</Hmac>
<Signature>Digital signature of AUA</Signature>
</Auth>
Process to become a XML as embedded resource, and how can I access any attribute of XML and update it.
Thanks in Advance.
|
8970d6073941182c5a01f756074a93c193d7c57dd5cb7651d77c19b6050d11ed | ['763350ceab2c467887e6912c2aee392a'] | I want to create a custom calendar in python, still maintains 365 days but has six months. What I want to achieve a program in which the user inputs a date, for example 01/15/2020 and the program would output the date from the custom calendar created. So far I created the custom calendar as a list of tuples like the following:
Calendar = [("Leo", range(1, 61)),
("Gemini", range(1, 62)),
("Pegasus", range(1, 62)),
("Orion", range(1, 62)),
("Scorpius", range(1, 62)),
("Taurus", range(1, 62))]
Following the example, the first custom month would be "Leo" and it would have 60 days. But I am running into problems iterating through the days for each month. How can I get a specific day of a specific month from this list of tuples? And then how can I relate this to the Gregorian calendar format (ex: January 15th).
I am very new to programming so any help would be grateful! Thanks in advance
| 1ed914c3ae8b19e3291c754ce531249624f6c6f54473490ee4139141877fee2d | ['763350ceab2c467887e6912c2aee392a'] | I have an array of build ids that are in order from the latest build (first element of the array is the latest). I want to compare it with another list that has a list of build ids as well but I want to see what is the latest build id (so go through the first list in order).
List1 has the build ids in order from the latest build (so list1[0] is the latest)
list1 = [009n1, 009d5, 006d4, 001s5, 008n3]
List2 has the build ids that have been executed.
list2 = [006d4, 001s5, 008n3, 006j1, 004k1]
So I want to compare the two lists and return the latest build that has been executed so when comparing list1 and list2, I want it to return 006d4
|
525cbf56d03a44258876b2ec5f782f05a3aa7bd53d96951413b9ca625dae65a5 | ['7637411870814040bb476769c5edf3ce'] | Lacking a better Answer ...
From what I've seen so far on HTC-Dev and XDA:
HTC-Dev provides an online tool. You 'normally' can register an account there (with an e-mail address). The registration process had problems. Maybe they were resolved, or identified. Maybe you need to get help by moaning at them on their Twitter account.
Failing that, you might be able to get someone on the XDA forums to do it for you. They (3rd parties / XDA folk) are still using the HTC site, just with an account that works.
There is a 10 step process. Presumably, they guide you through using things like ADB and Fastboot to extract a "token", submit that token to HTC's online widget, and receive a "code".
The code is not something you enter, it's a binary that you .. put somewhere on the phone. It then gets run by ... some kinda process, I guess. Then some magic happens.
The "code" is derived from the "token". The "token" has a relation to the phone's ... model number and IMEI. Maybe it is simply a concatenation of the two, maybe not. Each "code" is unique to a "token", which is theoretically unique to a phone. Submitting a token will register it (and hence the constituent IMEI and .. [phone-hardware-ID]) to your account.The HTC-Dev widget will generate invalid codes if you give it bad info. That might not break your phone. (All of this jeopardizes/voids your warranty, of course)
There might be phones that need an (OTA/stock/signed'sealed'delivered) update before they can do any of this. They are pre-magic phones, locked with anti-magic bootloaders, lo.
| 8ae3d1f0a4c11bfb753abca5d1431cebbac68ac9ad186c20123c2925e7942e2d | ['7637411870814040bb476769c5edf3ce'] | Im trying to use two Pi's as a bridge to trigger a garage doors button from an automation system that uses its own GPIO. My thoughts where give them each a static address and script one to ssh into the other and than have a script that says triggers sets pin 1 high when pin 1 goes low on the other. Is there a better way or possibly a similar project that I could modify?
|
7cd10cecb1b3c76bafced72f83bab953231ce8e10367bf689b978a5eb84970d0 | ['763b1d36100447faa406d68e7748f80d'] | I am a theoretically-inclined undergraduate intending to do a PhD. I am beginning to see a little bit more theory (coming from many different perspectives) trying to explain the "practical" success of deep learning, so I wanted to know what advanced courses may give further interesting frameworks to think within as a future researcher. (Even if the link is more speculative, I'm curious to know.) | c0a6a439d9feb04b5b861e2ed57f983b9501a310fd6bac996bf050d691af5d98 | ['763b1d36100447faa406d68e7748f80d'] | Data connections from Chinese SIM cards are routed through China. I confirmed this by my own experience and it has been common knowledge among Chinese travellers for quite some time now. A few years ago this apparently wasn't the case because I remember reading news articles about the change.
Likewise (though not confirmed) using a foreign SIM card in China should give you unrestricted access.
|
4b3d3fafc0f958e86d0963026eb658156416e4f6690dbd40582c2728d9758958 | ['763f00925fd64b80956424a56a2ab301'] | try {
String text = "Hello, Admin sir";// Replace with your message.
String toNumber = "xxxxxxxxxxxx"; // Replace with mobile phone number without +Sign or leading zeros, but with country code
//Suppose your country is India and your phone number is “xxxxxxxxxx”, then you need to send “91xxxxxxxxxx”.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://api.whatsapp.com/send?phone=" + toNumber + "&text=" + text));
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.whatsapp")));
}
| c431c32b14089ad40ca08cf6fe02f597fba1efc6c17f66512f6caa684351a247 | ['763f00925fd64b80956424a56a2ab301'] | I want to make App Like Uber But I Don't know how to make full screen notification,When Driver receiver new Request a new Screen Pop up that will show timer ,accept , reject button. even when driver app is in background ,
I am newbiew
here is a video link what i want to do
https://drive.google.com/file/d/1dhqSDexUKYY---ARHjWcg3bM0tYWRmLo/view?usp=sharing
Sorry for English
I have tried to use heads up notification with full screen but it didn't work well ;
I have tried to make background service to but i am not good in it so that also did not go well;
I am working on Oreo ;
|
00b504270476a5ede60eeb970fac1deed6797cb4c30cd7690b9799146ea1c31a | ['7643758bc9fb4352867ecb418a23aa50'] | Pass a Context to a constructor of this AsyncTask. An AsyncTask does not extend Context itself so you cannot use getApplicationContext()
class phpconnect extends AsyncTask<String, String, String>{
private final Context mContext;
public phpconnect(final Context context) {
mContext = context;
}
[...]
protected void onPostExecute(String result) {
[...]
Toast.makeText( mContext,"...",Toast.LENGTH_SHORT ).show();
[...]
}
Edit: Also add a NullPointer guard to your if-clause. Something like:
if(result != null && result.equalsIgnoreCase("1")){
| 855eca28da6581ffa6f5246375a3586302a0d6d396cc58e31ab30fc93ba6126d | ['7643758bc9fb4352867ecb418a23aa50'] | You cannot Toast from a background thread, which an Async Task's onBackground method is. http://developer.android.com/reference/android/os/AsyncTask.html#doInBackground(Params...).
You could for instance override
protected void onPostExecute (Result result)
or
protected void onProgressUpdate (Progress... values)
and Toast from there as they are running on the UI thread.
|
3d4ac8fba1974876e31d411601cb9aff03b684beab9c502123d091eed5f59b48 | ['7668c069e80d47a482f7d5fa8e20c741'] | To anyone still reading this:
I solved a similar problem with spring events - as suggested by <PERSON> in option 3.
Here's the basic idea (scenario is fictional):
Whenever I perform external operations that need to be rolled back together with the transaction, I publish an event inside my @Transactional method using support from spring (org.springframework.context.ApplicationEventPublisher):
@Transactional
public String placeOrder(Order order) {
String orderId = orderServiceGateway.createOrder(order);
applicationEventPublisher.publishEvent(new OrderCreatedEvent(orderId));
workflowService.startWorkflow(orderId);
return orderId;
}
The event itself can be any object - I created a POJO with details about the remote entity to be deleted.
Then I registered a special event listener that is bound to a transaction phase - in my case to the rollback:
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void rollBackOrder(OrderCreatedEvent orderCreatedEvent) {
String orderId = orderCreatedEvent.getOrderId();
orderServiceGateway.deleteOrder(orderId);
}
Of course, it's recommended to catch & log the exception from rollback operation, not to lose the original exception from the placeOrder() method.
By default these events are synchronous, but they can be made async by additional configuration.
Here's a very good article on this mechanism, including detailed configuration and pitfalls: Transaction Synchronization and Spring Application Events (DZone)
While I don't like the solution 100% because it clutters the business logic with event publishing stuff and binds to spring, it definitely does what I expect it to do and makes it possible to pass context from the transactional method to the rollback method - which is not available through a traditional try/catch block outside of the transactional method (unless you put your context in the exception itself, which is not very nice).
| 76f27462cd8216125d1782dde3052442e267a0dc25f5d46a67dbf171e4fffff4 | ['7668c069e80d47a482f7d5fa8e20c741'] | I had the same problem and it took me a day to find the solution to it. You can use Expressions.list() to specify more than one column for the in clause.
So here's what you should have in your where() clause:
Expressions.list(t1.col1, t1.col2).in(
JPAExpressions.select(t2.col1, t2.col2)
.from(t2)
.where(...)
)
Hope it helps someone.
|
6d1ffcdfbb16fdc826cb223e1a6fa1ddd351d1e70c09b4b439653acb12dff9cc | ['766e0f44b27f4ff9b6e55b7ade9bf82d'] | When I run gradle test on my machine it works fine, but when i run it on our FreeBSD build server it fails with this exception:
:alerting:testPicked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
org.gradle.messaging.remote.internal.ConnectException: Could not connect to server [4ddcef47-2985-48dd-b83e-9eab161fe8a3 port:12526, addresses:[/<IP_ADDRESS>, /<IP_ADDRESS>]]. Tried addresses: [/<IP_ADDRESS>, /127.0.0
at org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:68)
at org.gradle.messaging.remote.internal.hub.MessageHubBackedClient.getConnection(MessageHubBackedClient.java:35)
at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:58)
at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:37)
at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:87)
at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:41)
at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:49)
at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:33)
at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:69)
at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.net.SocketTimeoutException
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:118)
at org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector.tryConnect(TcpOutgoingConnector.java:82)
at org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:55)
... 9 more
FAILED
I thought that the problem is blocked loopback by firewall (we are running in a jail), but I can ping it and connect to other services running locally through loopback.
Do you have any idea how to fix this?
Thanks
| 1c4bfa3718abe35a038999f30336950737e8ececff569e9fd3051f46f50fdc64 | ['766e0f44b27f4ff9b6e55b7ade9bf82d'] | I have auto-props in working copy like this
c:\TestRepos>svn pg svn:auto-props --verbose
Properties on '.':
svn:auto-props
'*=svn:needs-lock=*'
but when I add a new file with
c:\TestRepos>svn add test/test.txt
and commit it
c:\TestRepos>svn commit -m "Msg" test/test.txt
the needs-lock property wasn't set on the file
c:\TestRepos>svn proplist heh\heh.txt
c:\TestRepos>
and obviously Read-only attribute wasn't set.
Why don't auto-props work in my case?
Thanks
|
1cce120500a0bcf27283b8018e2ee50d687a10ebc7d92077b1019a2305110cb2 | ['76735520e141441c9f78ad2a90056ffc'] | I have a Rails App perfectly working in development and well tested. When deployed on heroku there is no problem reported, but the app won't work anyway. Opening it in the browser only delivers:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information."
In the log I see a pg expression which works on my variable/table "countries" although I am not too familiar with the meaning:
app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
app[web.1]: WHERE a.attrelid = '"countries"'::regclass
app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]: ORDER BY a.attnum
app[web.1]: app/controllers/application_controller.rb:15:in `default_or_selected_country'
app[web.1]:
heroku[router]: at=info method=GET path="/" host=evening-refuge-96756.herokuapp.com request_id=a240125e-4115-40d4-bfb0-ade1b8c909d6 fwd="<IP_ADDRESS><IP_ADDRESS>regclass
app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]: ORDER BY a.attnum
app[web.1]: app/controllers/application_controller.rb:15:in `default_or_selected_country'
app[web.1]:
heroku[router]: at=info method=GET path="/" host=evening-refuge-96756.herokuapp.com request_id=a240125e-4115-40d4-bfb0-ade1b8c909d6 fwd="178.165.130.180" dyno=web.1 connect=1ms service=204ms status=500 bytes=1714
I see that my method `default_or_selected_country' is involved. The respective code is unproblematic in development and test mode:
def default_or_selected_country
session[:country_id] ||= Country.find_by(abbreviation: "AT").id
@default_or_selected_country = Country.find(session[:country_id]).name
end
While I am writing this post more similar pg expressions are logged, always containing the "countries" table and also pointing to the same method as above.
Where is my problem and how can I solve it? Thanks!
| 34dcc126f4024682626bfd4a4b0677c9651a4978c21bcf4f00bf921669118137 | ['76735520e141441c9f78ad2a90056ffc'] | I finally found the solution: there is a slight difference between unit tests and integration tests. While in unit tests you can refer to the referenced model by item: items(:one) in integration tests you must be precise like item_id: items(:one).id, which is the exact name of the data field in the model and database.
The exact details behind the scenes I do not know - maybe someone can comment and further enlighten me.
|
7e24101b1e3645eef73220cce519cf1af0e579b290d8b3669e49872e2cfffa17 | ['7673ff0f4d4e46fb85e7f83248ffcf63'] | Instead of commenting both approaches separately, I post an answer (for future readers):
I managed to find an real world example, where both approaches fail.
I am sorry that I was not able to find an shorter example:
x and y are unique. Therefore, the result of setdiff() should be unique. Approach one (cx_setdiff) does not change x. Approach 2 (setdiffComplexVectorsC) is not unique. Both results are different in comparison to R's setdiff().
> length(unique(setdiff(x,y)))
[1] 46
> length((setdiff(x,y)))
[1] 46
> length(unique(setdiffComplexVectorsC(x,y)))
[1] 41
length(setdiffComplexVectorsC(x,y))
[1] 46
> length(unique(cx_setdiff(x,y)))
[1] 52
all(cx_setdiff(x,y)==x)
[1] TRUE
x=c(16+35i, 16+36i, 16+47i, 16+48i, 17+33i, 17+51i, 18+30i, 18+53i,
19+29i, 19+55i, 20+27i, 20+56i, 22+25i, 22+58i, 24+23i, 24+60i,
25+23i, 25+61i, 32+19i, 32+64i, 33+19i, 33+65i, 36+18i, 36+65i,
38+18i, 38+65i, 40+18i, 40+65i, 42+18i, 42+65i, 45+19i, 45+65i,
46+19i, 46+64i, 3+23i, 3+61i, 4+23i, 4+60i, 6+25i, 6+58i, 8+27i,
8+56i, 9+29i, 9+55i, 10+30i, 10+53i, 11+33i, 11+51i, 12+35i,
12+36i, 12+47i, 12+48i)
length(unique(x))
[1] 52
> length(x)
[1] 52
y=c(25+76i, 15+39i, 48+31i, 14+13i, 8+70i, 22+34i, 39+31i, 38+66i,
30+8i, 50+72i, 46+55i, 21+47i, 45+44i, 38+77i, 1+77i, 22+13i,
2+3i, 38+24i, 49+1i, 42+19i, 45+58i, 14+64i, 40+77i, 50+4i, 10+20i,
34+76i, 4+79i, 17+26i, 30+41i, 10+30i, 6+20i, 7+65i, 19+13i,
13+14i, 6+30i, 25+4i, 32+75i, 26+33i, 3+16i, 41+57i, 17+52i,
14+58i, 4+23i, 36+79i, 24+41i, 37+64i, 3+23i, 37+69i, 43+32i,
25+63i, 1+34i, 44+68i, 0+0i, 24+44i, 20+70i, 2+17i, 32+78i, 44+8i,
9+21i, 38+54i, 2+60i, 27+80i, 16+17i, 13+6i, 23+15i, 33+73i,
24+1i, 18+57i, 9+49i, 4+32i, 25+5i, 35+21i, 36+33i, 14+29i, 11+74i,
43+48i, 36+44i, 11+61i, 18+3i, 26+2i, 31+71i, 46+73i, 28+1i,
28+57i, 23+52i, 25+79i, 10+56i, 50+43i, 25+46i, 32+76i, 6+77i,
48+12i, 28+62i, 16+12i, 33+74i, 34+72i, 45+27i, 47+26i, 48+4i,
45+68i, 14+59i, 47+2i, 29+69i, 2+46i, 9+34i, 7+36i, 28+28i, 42+44i,
33+28i, 9+8i, 18+21i, 43+69i, 46+7i, 2+80i, 33+7i, 15+38i, 48+78i,
47+57i, 50+53i, 14+42i, 44+17i, 26+25i, 50+5i, 33+18i, 6+28i,
28+2i, 26+55i, 3+56i, 32+28i, 5+69i, 47+31i, 30+28i, 40+43i,
41+67i, 2+2i, 36+18i, 26+27i, 10+65i, 37+27i, 32+42i, 37+72i,
44+9i, 22+15i, 42+75i, 42+27i, 42+29i, 35+38i, 32+12i, 20+62i,
28+52i, 13+58i, 40+22i, 6+3i, 9+75i, 6+55i, 18+73i, 35+32i, 35+59i,
32+39i, 28+63i, 18+51i, 22+36i, 29+54i, 23+56i, 19+1i, 5+38i,
25+64i, 50+46i, 48+59i, 8+58i, 10+40i, 12+40i, 19+72i, 12+8i,
17+50i, 15+30i, 17+6i, 32+73i, 47+11i, 21+5i, 11+63i, 35+42i,
31+13i, 33+51i, 29+68i, 9+9i, 13+59i, 44+40i, 20+73i, 21+41i,
36+37i, 32+64i, 42+46i, 17+25i, 46+25i, 24+30i, 7+10i, 24+27i,
11+73i, 27+27i, 15+12i, 2+9i, 16+36i, 6+61i, 48+20i, 27+15i,
14+49i, 40+44i, 35+44i, 30+66i, 46+71i, 38+58i)
length(unique(y))
[1] 212
length(y)
[1] 212
Thank you for trying. Now I know for sure, that I need a self-made implementation for this problem. If I find a fix for one of the above approaches, I will post it here. Maybe even someone else sees the problem immediately.
| 4d06ab80ea9dc8d8b95ced52b121115c6a2f23178960260630d2c2e2d583a6eb | ['7673ff0f4d4e46fb85e7f83248ffcf63'] | Im trying to check my own package with
Rcmd.exe check dbt.ORA_1.0.tar.gz.
despite of adding "Depends: shiny in the Description file,
I get alot of warnings like this:
...
dbtORA: no visible global function definition for 'runApp'
dbtORA: no visible global function definition for 'fluidPage'
dbtORA: no visibleglobal function definition for 'titlePanel'
dbtORA: no visible global function definition for 'sidebarLayout'
dbtORA: no visible global function definition for 'sidebarPanel'
dbtORA: no visible global function definition for 'selectInput'
dbtORA: no visible global function definition for 'checkboxInput'
dbtORA: no visible global function definition for 'conditionalPanel'
dbtORA: no visible global function definition for 'numericInput'
dbtORA: no visible global function definition for 'actionButton'
dbtORA: no visible global function definition for 'mainPanel'
dbtORA: no visible global function definition for 'textOutput'
dbtORA: no visible global function definition for 'uiOutput'
...
the function dbtORA is very long, the source code is like this:
dbtORA <-function(){
...
outputApp=runApp(list(
ui = fluidPage(
...
),
server = function(input, output, session){
...
}
))
...
return(outputApp=NamedORAResults)}
I have in this context also a second question:
How do I declare functions, which are only locally defined, e.g. in
dbtORA <-function(){
...
matlabmin=function(...){...}
...}
gives the warning:
dbtORA: no visible global function definition for 'matlabmin'
|
37f82a0b679ab5e65781364152ed16bc8702bfc11121951a405ffd9779870fc9 | ['76742e67e8ad4facb36ba66416c503a4'] | I have a set of routes on express which are brands.
Id like to serve 2 asset directories to each of these brands.
One public/static for all brand routes and then everything thats under public/brands/brandName.
Is this possible ? I have something like this which seems to work but only for the first /brandName i request.
var express = require('express');
var app = express();
var path = require('path');
app.get('/brands/:brand', function (req, res) {
app.use(express.static(path.join(__dirname, 'public/brands/' + req.params.brand)));
res.sendFile(__dirname + '/public/static/index.html');
});
app.listen(process.env.PORT || 3000, function () {
console.log('listening on port 3000!');
});
app.use(express.static(path.join(__dirname, 'public/static')));
module.exports = app;
| e341b8de5938d32987fa5fcf1d10ea67b6dbfcdce654efbd19a7888b4621085c | ['76742e67e8ad4facb36ba66416c503a4'] | Ran into this today took me a few hours to figure it out. SSZipArchive returns false when it cant find the zip file. This is probably happening because the url you are returning is a [NSURL absoluteString]; which has file:// at the beginning. Just call [NSURL path]; on the url and it should work
|
ea8d340716858650f0771699243f4c8ebb381e7c963bef2269328f2a8cbeaa3e | ['767b1ee5872f4603863c38b7264dacbc'] | I simply wanted to see whether someone has actually been turned away under these circumstances or could re-enter after finishing J1, exiting US and seeking to return as a tourist for 2 months with return tickets and travel itinerary etc. what do you base your 93% odds on if I may ask? | 8485b3ada3fdba4edbac8741a7b8d365532c4bbbd627ac8b51c054a6eecbb88f | ['767b1ee5872f4603863c38b7264dacbc'] | I was wondering if there was a time limit to the "persistence" of bits on a hard drive, a classical SATA for example.
If I'm correct, bits are written by a magnetizing head in some cells on the hard drive. Depending on the magnetization, It will be a 0 or a 1.
But my question is, for how long (possibly a very long time) will the bit keep its value?
Does this magnetization not loose his strength after a while (possibly from the other bits influences or simply external factors)? Is there some sort of battery that allows the re-magnetization of the "oldest" bits?
|
7a775443572908958815c6b8c518a7d3bab0f0028f57ed9043d8b31ad53f8853 | ['76911f58265a4e10a158797d1307f34f'] | the usemin task in your Gruntfile.js will look for
<!-- build:{{type}} {{path/fileName}} -->
and
<!-- endbuild -->
and will concatenate all the files listed between these two into one single file and minify that. this single minified file will be written at the path mentioned by you in {{path/fileName}}
...so if I'm understanding it well then your Gruntfile is perfectly fine and you are probably missing usemin comment blocks in your index.html
put all your link and script tags betweeen usemin blocks
for example for your bower components you can use something like this
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/ng-table/ng-table.css">
<link rel="stylesheet" href="bower_components/angular-growl-v2/build/angular-growl.css">
<link rel="stylesheet" href="bower_components/nya-bootstrap-select/dist/css/nya-bs-select.css">
<!-- endbower -->
<!-- endbuild -->
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-aria/angular-aria.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<!-- endbower -->
<!-- endbuild -->
NOTE: all your bower component css files will go in vendor.css in styles directory i.e. dist/styles/vendor.css and similarly bower component js files will go in vendor.js in scripts directory i.e. dist/scripts/vendor.js
...and for your own js and css files you can use something like this
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/css1.css">
<link rel="stylesheet" href="styles/css2.css">
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/about.js"></script>
<!-- endbuild -->
NOTE: here all your css files will go in main.css in styles directory i.e. dist/styles/main.css and similarly js files will go in main.js in scripts directory i.e. dist/scripts/main.js
...hope it helps :)
| 3d6597c4e2270bb9a9d53703d76cf46b826c2c620401e4b5b114d0b6f1e32712 | ['76911f58265a4e10a158797d1307f34f'] | here is a piece of code that should work perfectly as per my knowledge, but is crashing the server
note: I'm using ES6 with babel
const getDataFromCouchBase = function (siteId) {
return new Promise((resolve, reject) => {
const cluster = new couchbase.Cluster('<IP_ADDRESS>:8091'),
bucket = cluster.openBucket(bucketName, (err) => {
console.log("err: ", err);
if (err) {
throw err;
//reject(err);
}
// Retrieve a document
bucket.get(`site<IP_ADDRESS>${siteId}`, (err, result) => {
console.log("err: ", err);
console.log("result: ", result);
if (err) {
throw err;
//reject(err);
}
resolve(result.value);
});
});
});
}
and here is i'm calling this function with then and catch
getDataFromCouchBase(siteId).then((site) => {
console.log(site);
}).catch((err) => {
console.log(err);
});
in case of wrong bucketName or the document not available in the bucket it crashes the server instead of thrown error being handled by the catch block
|
ef693afc8107ad4d493e41e755421295678b971e1a90bb1eb6c09e4257a694ad | ['76916d8d425644bdb97f401dcc0eebf2'] | public class Manager {
private static url = SomeService.get();
public void method() {
....
}
}
@RunWith(MockitoJUnitRunner.class)
public class ManagerTest {
@InjectMocks
Manager manager = new Manager();
@Test
public void testMethod(){
manager.method();
}
}
When I tried to InjectMock Manager class, I found the static variable url is null and it not initialized in testMethod(). Anyone let me know where I did it wrong?
| e90888faa3f21497f707b01814ac696b758ee7c40406177b90f126b8a1ad4bce | ['76916d8d425644bdb97f401dcc0eebf2'] | I tried to delete lines in redis, I first search keys to make sure my expression is right.
get keys that start with sess: :
keys sess:* //I get return as I expect
get keys that not start with sess: :
keys ^(sess:)* //I get empty list, not as expect
keys [^sess:]* //I get list that not start with s or e or :, not as expect
get key that not start with sess: and brand:
keys [^(sess:|brand:)]* //I get list that not start with s or e or : or b and so on, not as expect
Could any one help me with the list that I did not get the right return as I expect?
|
6e2e5eceb470d4f172b1a5243a063d88ddd236467f8843fbfa556991c3f903c4 | ['76967ce5a1bd4ee6b06af16a8f48f711'] | This code is working but I want to check that it's robust/good practice/idiomatic.
Background: I'm following <PERSON> rails tutorial and I'm working on 8.5 (exercises for chapter 8), decoupling the tests from the implementation.
In user_pages_spec.rb I didn't like the code
expect { click_button submit }.not_to change(User, :count)
Since change(User, :count) looks like a bit of a hack. So in spec/support/utilities.rb I wrote:
def create_user
change(User, :count)
end
And I replaced the line in user_pages_spec.rb with
expect { click_button submit }.not_to create_user
Was this sensible?
| 6cca9b6d59c4ac2e8653b1f6b0e4623dce013138bdffaecc205affb640723c1f | ['76967ce5a1bd4ee6b06af16a8f48f711'] | I'm trying to create a three column layout in CSS only with fixed left and right columns and a fluid central column. I have searched online but nothing has worked when I implement it. I don't know whether this is particularly relevant but my central column is (or contains, I've tried both) an iframe. This seems to be contributing to the complication.
|
101cb6012f9240c4171a00c8e4ed38d18090b1f9621e5ebb31c2cd6c9bcfcbcd | ['769d0668950347998abd3da8fcac3f9a'] | With help from a friend, I found a code which worked as I wanted.
Here is the code that I used:
S1<-seq(1,121920,4)
S2<-seq(4,121920,4)
D<-matrix(0,length(S1),7)
for (i in 1:length(S1)) {
D[i,1]<-noquote(paste(data[S2[i],1]))
D[i,2]<-noquote(paste(data[S2[i],2]))
D[i,3]<-noquote(paste(data[S2[i],3]))
D[i,4]<-noquote(paste(data[S2[i],4]))
D[i,5]<-noquote(paste(data[S2[i],5]))
D[i,6]<-noquote(paste(data[S2[i],6]))
D[i,7]<-noquote(paste(data[S2[i],7]))
}
This kept every 4th row of my original data frame and gave me a new matrix.
Thanks.
| 21b1a2faa90a1a5bacc898ab92b234d349b1b77ba524f19f8ef5a9403062365b | ['769d0668950347998abd3da8fcac3f9a'] | I would simply add a new column to the data frame with the name I want and get the data for it from the existing column. like this:
dataf$value=dataf$Article1Order
then I remove the old column! like this:
dataf$Article1Order<-NULL
This code might seem silly! But it works perfectly...
|
f2b6c39a80a99039532719910d9a8abb569bd864db41eb1b90f890c321253571 | ['76a0dd5aa61d41bdb807e188992b4b4e'] | First, you're kind of mixing up compiler barriers and memory barriers. Compiler barriers prevent the compiler from moving instructions across that barrier in the final assembly. OTOH, memory barriers instruct the hardware to obey a certain ordering. Since you're already presenting assembly code, your question is really about hardware memory barriers and there is no compiler involved here.
The reason why you need a (read) memory barrier in Core B is that the core may reorder the message reading instruction wherever it wants, since
no, there is no data dependency between the reading of the flag and the reading of the message, at least not in the code above: the only information needed for reading Msg is its address and this is known at each point in time. You might want to argue that there is a control dependency. However, control dependencies do not impose any ordering constraints on memory reads.
| 833f10c6c5bee7731a968e37a9fecc30b15d41d29649ce4acd36144ee93ef587 | ['76a0dd5aa61d41bdb807e188992b4b4e'] | Posix Threads are the simplest and canonical way to do this.
Wikipedia has got a nice example already.
Basically, you create thread instances by means of pthread_create() and join them thereafter or "wait for them to finish" via pthread_join().
Note that the Wikipedia entry also says something about compilation using gcc. The -pthread or -lpthread is strictly necessary there, otherwise you'll get undefined references.
|
df2892324845789f7f315f927e0cdb1beba274db576f7a62e5a8d979a25936b1 | ['76a7e71ba0fd4f41ab3ec94301a75778'] | I'm trying to understand the peer discovery process, especially for a private network with majority of the nodes having dynamic IP addresses and behind typical wifi router firewall. If I run a Geth node with --nodiscovery flag, the node will only call out/connect to other peers, not accept calls from peers, correct? Isn't my firewall already doing that? And those peers my node calls out to must have port 30303 open, and they must be in discovery mode, correct? If my node is in NOdiscovery mode, I need a bootnode list or manually add (via file or CLI) static nodes in a private network, correct?
Basically, if a new private network was created, some of the nodes would have to be in discovery mode and/or have port 30303 open on the WAN side, or the network would fail, correct?
And does a private network have to supply a bootnode list everytime I restart Geth?
| eab6e05ed091a8306f41f3949ab20347d35d90fb0432cba7dc29957d13ed6adf | ['76a7e71ba0fd4f41ab3ec94301a75778'] | It might be the temperature. We put it outside to get some sun, only for 5 hours maybe. But the temperature was lower then 15 °C. We only did it once, and almost two days later, she got sick. Do you mean cuttings from the leaves or from the body? can you please explane? or provide any links? |
235b3156193964756ad5912554c1bfdcc6803b3c38c6473faba3eb1d98439d40 | ['76a8dab09f1d45c0a4df1d68072b448e'] | A few weeks ago, my ISP installed an SSL certficiate on my website. To force all URL's (www and non-www, http and https) to the same URL (https://domain.com/), I used the following .htaccess code:
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Now, this works just fine for redirecting URL's correctly. However, sometimes, images won't load correctly and spit out "Failed to load resource: net<IP_ADDRESS>ERR_TOO_MANY_REDIRECTS" in Chrome's console. Other browsers fail to load the images too.
A temp fix is to rename the images on my server and try to load them again. The error seems to be occurring at random. The images could have been loading correctly for days and then suddenly refuse being loaded at all.
Anyone have any idea why this could be happening?
| 99c53bfcc929bb006a0db74bd2c76863e6718a916b5906f3bf7a4c11f10c50c3 | ['76a8dab09f1d45c0a4df1d68072b448e'] | I'm trying to calculate the maximum number of characters allowed in an SQL field.
For example, I create a table like this:
CREATE TABLE bla (
TEST TEXT,
SHORTER TEXT(30),
NUMBER INT,
SHNUMBER INT(30)
)
Using the PHP function mysqli_fetch_fields, like this:
$finfo = mysqli_fetch_fields($res);
foreach($finfo as $value) {
printf("Name: %s\n", $value->name);
printf("max. Len: %d\n", $value->length);
printf("Type: %d\n\n", $value->type);
}
I get the following output:
Name: TEST max.Len: 65535 Type: 252
Name: SHORTER max.Len: 255 Type: 252
Name: NUMBER max.Len: 11 Type: 3
Name: SHNUMBER max.Len: 30 Type: 3
My question is: how can I convert this max lenght (represented as number of bytes) back to a number of decimals, characters, ...?
|
dcac0ab2ee6bd4f9379b751a106c738348302bbcbf009eaf47dfb666e70b508d | ['76aff904b12c4a4da6c168cbb4adc383'] | you can see the rssi value using hcidump [-a] command but make sure to keep Bluetooth on in background , so u can just start scanning like you usually do in Bluetoothctl and then Scan on ,leave that in background and on a new command line use the hcidump command This might help you.See this also : http://www.linuxcommand.org/man_pages/hcidump8.html
| f28746a6009c128e2101fb6279b60a19cbe594656228265eb3651bcfb92d782e | ['76aff904b12c4a4da6c168cbb4adc383'] | i have been trying to find a way to get MAC address and device name from a string containing other useless data , i managed to remove the unnecessary data off that string but as the string contains more than one device name and MAC address i found it difficult get Device name and its MAC address in two different string or list.The string has data like:
' Device XX:XX:XX:XX:XX Device_name1
Device XX:XX:XX:XX:XX Device_name2
Device XX:XX:XX:XX:XX Device_name3
'
I used this Code:
t= e.splitlines(True)
print(len(t),t)
I also use Split('\n')
All i get is this:
226
(16, [' \r\n', ' \r', ' \r', ' Device
C4:XX:XX:XX:XX:XX name\r\n', ' \r', ' \r', ' Device
55:XX:XX:XX:XX:XX name\r\n', ' \r', ' \r', ' Device
XX:XX:XX:XX:XX:XX Name _XYXY\r\n', ' \r\n', ' \r\n', ' \r\n', ' \r', '
\r', ' '])
After this i found it difficult to get Device name and MAC address into different string.
Using below code i was able to get MAC address form every Element of the list.
p = re.compile('(?:[0-9a-fA-F]:?){12}')
red = str(t)
ting = re.findall(p, red)
print(ting)
But i am still trying to figure out a way to get Device name.i want get the name and MAC address of each device in different string as String1="Device name MAC address" string2="Device name MAC address".
Please do share your suggestion Thank you.
|
6628ce7fc94927c81988fcd34ae4ada03e07f7deef622646e6438707dc640f4a | ['76b3725c23f34c7cae438f03a21093d1'] | Gulp-typescript has two different ways to compile your files. The default method compiles the whole project and does type checking. This is implemented in ProjectCompiler in lib/compiler.ts. The other compiles each file separate, and is activated when you set isolatedModules: true. That method is implemented in FileCompiler in lib/compiler.ts.
The FileCompiler only needs to compile the files which are changed. Unchanged files are cached, like <PERSON> described in his answer.
Most users however use the ProjectCompiler, as type checking is probably the reason that they are using TypeScript. I think that your question regards this ProjectCompiler. Incremental compilation is handled by the call to ts.createProgram, which the TypeScript API exports. By passing the old program, the TypeScript API would reuse some of the information of the previous compilation. You can find the source code here:
https://github.com/ivogabe/gulp-typescript/blob/ea22fb7fe4295979e32a9d07b007e3f7473be8b5/lib/compiler.ts#L80
That used to be enough to get incremental compilation, but that has changed in newer versions of TypeScript. We will need to switch to a new API, probably using one of the APIs you mentioned, but I'm not familiar with those.
In your question you mentioned the FileCache. This is used to store all files that are passed in the input stream. The gulp API namely gives all files in a stream, whereas the TypeScript API is synchronous. We thus need to wait until we have all input files. Furthermore, we use the FileCache in the FileCompiler to detect whether a file has changed and thus whether we need to recompile it.
| 738ddd8df1dd22c82a629a51e3fa32bfe75df526e725fae5713f70a24b7908b5 | ['76b3725c23f34c7cae438f03a21093d1'] | This appears to be not an issue with Angular, nor TypeScript, but the module bundler Small had a bug. A file a/b could be compiled twice (under conditions), namely as a/b and a\b. This only happened on Windows. This broke some functionality of Angular. Can you try to update to small@0.2.8?
|
01720e4e783eefbfa32cce3e7b5e4bad78fa9bb9575171bae98038ddb99166f9 | ['76bcea15f29f45449223ecc0ef2b35a1'] | I have figured out a fix, I hope it helps.
For my React Routes, I'm using dynamic loading with import statements, without the CommonChunks plugin.
I was getting the same error (or "Chunk 1", "Chunk 2", etc) depending on the route I was loading. I finally realized that my asset bundles were actually being outputted into the current directory that my html was in, even though my output.path was pointing to the assets folder.
To fix this, I just set my output.chunkFilename to '../../../assets/js/com/[name].bundle.js', which then output it to the correct folder.
From then on, my app was able to find my bundles and it worked great!
Hope it helps,
<PERSON>
| 2edc453eb5e0370b1da3f96459275883be8e49a24c4a77500e2f0f34f56ef7d8 | ['76bcea15f29f45449223ecc0ef2b35a1'] | Not sure if this is what you're asking, but you can pass in the item to a function along with an event variable like this:
<div *ngFor="let item in items">
<span (click)="functionCall($event, item)"> <span>
</div>
And then grab that item in your class like this:
functionCall(event, item): void {
console.log('item clicked:", item)
}
|
3f4fa69ef1e97120297785c47b319ac9e0bdfb98e1f582b6e391b82f2c413261 | ['76c78d91235948869c97d5a6e412f6c4'] | I have table as below:
CREATE TABLE TEST_P (
ID VARCHAR(64),
F_NAME int NOT NULL,
L_NAME VARCHAR(64),
CREATETS DATETIME NOT NULL,
PRIMARY KEY(DATA_TRACE_ID,CREATETS)
)
PARTITION BY RANGE(DAY(CREATETS))(
PARTITION day1 VALUES LESS THAN (2),
PARTITION day2 VALUES LESS THAN (3),
PARTITION day3 VALUES LESS THAN (4),
PARTITION day4 VALUES LESS THAN (5),
PARTITION day5 VALUES LESS THAN (6),
PARTITION day6 VALUES LESS THAN (7),
PARTITION day7 VALUES LESS THAN (8),
PARTITION day8 VALUES LESS THAN (9),
PARTITION day9 VALUES LESS THAN (10),
PARTITION day10 VALUES LESS THAN (11),
PARTITION day11 VALUES LESS THAN (12),
PARTITION day12 VALUES LESS THAN (13),
PARTITION day13 VALUES LESS THAN (14),
PARTITION day14 VALUES LESS THAN (15),
PARTITION day15 VALUES LESS THAN (16),
PARTITION day16 VALUES LESS THAN (17),
PARTITION day17 VALUES LESS THAN (18),
PARTITION day18 VALUES LESS THAN (19),
PARTITION day19 VALUES LESS THAN (20),
PARTITION day20 VALUES LESS THAN (21),
PARTITION day21 VALUES LESS THAN (22),
PARTITION day22 VALUES LESS THAN (23),
PARTITION day23 VALUES LESS THAN (24),
PARTITION day24 VALUES LESS THAN (25),
PARTITION day25 VALUES LESS THAN (26),
PARTITION day26 VALUES LESS THAN (27),
PARTITION day27 VALUES LESS THAN (28),
PARTITION day28 VALUES LESS THAN (29),
PARTITION day29 VALUES LESS THAN (30),
PARTITION day30 VALUES LESS THAN (31),
PARTITION day31 VALUES LESS THAN MAXVALUE
);
I want to write a Script that drops the Partition for today+1 day and create a new partition for with the same partitioning condition.
for example:
I want to drop partition day5 as I want to delete the data in this table.
I am doing this:
ALTER TABLE TEST_P REORGANIZE PARTITION day5 into
(PARTITION day5 VALUES LESS THAN (5),
PARTITION day6 VALUES LESS THAN (6),
PARTITION day7 VALUES LESS THAN (7),
PARTITION day8 VALUES LESS THAN (8),
PARTITION day9 VALUES LESS THAN (9),
PARTITION day10 VALUES LESS THAN (10),
PARTITION day11 VALUES LESS THAN (11),
PARTITION day12 VALUES LESS THAN (12),
PARTITION day13 VALUES LESS THAN (13),
PARTITION day14 VALUES LESS THAN (14),
PARTITION day15 VALUES LESS THAN (15),
PARTITION day16 VALUES LESS THAN (16),
PARTITION day17 VALUES LESS THAN (17),
PARTITION day18 VALUES LESS THAN (18),
PARTITION day19 VALUES LESS THAN (19),
PARTITION day20 VALUES LESS THAN (20),
PARTITION day21 VALUES LESS THAN (21),
PARTITION day22 VALUES LESS THAN (22),
PARTITION day23 VALUES LESS THAN (23),
PARTITION day24 VALUES LESS THAN (24),
PARTITION day25 VALUES LESS THAN (25),
PARTITION day26 VALUES LESS THAN (26),
PARTITION day27 VALUES LESS THAN (27),
PARTITION day28 VALUES LESS THAN (28),
PARTITION day29 VALUES LESS THAN (29),
PARTITION day30 VALUES LESS THAN (30),
PARTITION day31 VALUES LESS THAN (31),
PARTITION p_default VALUES LESS THAN MAXVALUE)
But I get
Error in list of partitions to REORGANIZE
This table grows very large very fast, so I want to delete a month old data in this and not affect the performance of the table.
| 1400182502ba04e819e116de25d864ec35a707145b35543f6f4190017fe6c2fa | ['76c78d91235948869c97d5a6e412f6c4'] | I am seeing an issue in my Kafka Consumer, where I see that the throughput of the Consumer is affected when there is a high load from the producer. I see that the throughput goes upto 600K per min when the Producer load is low, but the throughput decreases to around 350K when the Producer load is high, which is causing high Lags in Kafka topic. Is this a discrepancy and Is there anything I can do in the Consumer Implementation? Below is the Consumer config
I have implemented Kafka Consumer using Spring-Kafka
key.deserializer : StringDeserializer
value.deserializer : [CUSTOM DESERIALIZER]
enable.auto.commit : false
max.poll.records : 5
group.id : [MY GROUP]
partition.assignment.strategy : StickyAssignor
max.partition.fetch.bytes : 1048576
bootstrap.servers : [SERVERS]
auto.commit.interval.ms : 3000
auto.offset.reset : latest
factory.setConcurrency(3);
@KafkaListener(topics = "#{kafkaTopicConfig.getStoreSupply()}", containerFactory = EI_LISTNER_FACTORY)
//EI_LISTNER_FACTORY is a Bean..
@Bean(EI_LISTNER_FACTORY)
public ConcurrentKafkaListenerContainerFactory<String, AggQuantityByPrimeValue> eiKafkaListenerContainerFactory() {
Boolean eiCnsumerStartup = [START_UP From Configuration]
Integer concurrentThreadCount = 3;
Map<String, Object> config = [properties from ABOVE]
ConcurrentKafkaListenerContainerFactory<String, AggQuantityByPrimeValue> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(new DefaultKafkaConsumerFactory<>(config));
factory.setAutoStartup(eiConsumerStartup);
if (config.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG).equals("false")) {
factory.getContainerProperties().setAckMode(AckMode.MANUAL_IMMEDIATE);
factory.setConcurrency(concurrentThreadCount);
}
return factory;
}
|
c434709edd59c9f518068a76ba1c4d3ada6bbbd610fe5bfeef0f7fba83ddb393 | ['76d11d7b1c574e4694e38b7c512ae16b'] | Both the green top and the white bulb are edible, so once you've discarded any dirty or yellow bits, it's up to you, but here are some suggestions.
If it's something like a stir fry, use all of it. Generally if it's going to be cooked in with other ingredients this works, but you might have to chop very finely is some cases. I sometimes use spring onions in place of bulb onions as I grow them, and then of course use all of them.
If it's used as a garnish, or added raw to something like a salad, just use the green bits, as the flavour is milder. This is true even if stirred into hot food but not cooked further (like mashed potato, or some sauces). Raw (bulb) onion is added to salads, but it's very much an acquired taste.
In between is a grey area - I would use all of it in an omelette, for example, a chef probably wouldn't.
It also depends just how bulbous the bulb is. If the whole onion is about the same thickness, less than that of a pencil, you can use the (small) white part more readily than if you've got a sphere on the bottom.
| 31d06d23e396e9a74240568b9309bc4e28653bcb394097253eb1c6cee214e944 | ['76d11d7b1c574e4694e38b7c512ae16b'] | Apart from in America, "cordial" is often a term for something based on sugar and fruit. It's more commonly called "squash" in the UK (but one old brand is Rose's lime cordial); in other languages the name often translats to "syrup". Many are brightly coloured, whether artificially or using various plant extracts in addition to the juice that contributes to the flavour. This has changed a bit in recent years as sugar-free varieties have become more common, and less awful.
In the meantime there's been a growth in clear flavoured water ready to drink in bottles.
The various concentrated flavourings for water that are now available aim at a slightly different market to cordial/squash/similar products, closer to the target for flavoured water but without the same plastic waste concerns. The typically sell on the hydrating benefits of the water, and any healthy claims they can imply about plant ingredients. There are even tea bags meant for adding to your (cold) water bottle. While the brands might be owned by the same multinationals, these new products tend to use the names of mineral water or tea companies.
Overall, though often very similar as you've identified, these products aim to be more upmarket and aimed at health-conscious adults (at least here in the UK, the equivalent to Australian cordial is seen as a bit of a children's drink, though widely consumed by adults).
|
2175b99b22b7fd6af4dba7429a8742923c18079d97888c0f2f5a571a00a51b6a | ['76d3a92d93af42e1847d9cae87f6c337'] | I currently have a boost<IP_ADDRESS>mutex code section in my application that looks something like this
{//Lock
boost<IP_ADDRESS>unique_lock<boost<IP_ADDRESS>mutex> lock(some_mutex);
while(container.empty())
{
condition_var.wait(lock);
}/*Block if empty - for spurious wakeup*/
......
,,,,,,
}//Unlock
Now some_mutex is of type boost<IP_ADDRESS>mutex
and condition_var is of type boost<IP_ADDRESS>condition_variable
Now condition_var is triggered with condition_var.notifyone() method unfortunately this method takes boost<IP_ADDRESS>mutex to function.
I am planning on removing the boost<IP_ADDRESS>mutex and using windows provided CRITICAL_SECTION. However I believe the boost condition does not work with windows CRITICAL_SECTION
any suggestion on what my options might be to replace the boost<IP_ADDRESS>mutex with CRITICAL_SECTION with minimum change in the above code ?
| 1c405248cd74a0118b29ae5cc7fcdb35136f32ae93b35d5fe9e2783fdd3fbed0 | ['76d3a92d93af42e1847d9cae87f6c337'] | I wanted to know what happens when three threads in one application call a static method from DLL (almost) simultaneously. Are there 3 instances of the DLL loaded for each thread or does the other threads only get access to the DLL once the first thread is done with the DLL static method (i.e) each thread gets access to the dll once its turn comes up ?
|
1b4149be5a3cf20f33ccffa1b6c859bef03d54851958151efb383118939a9b93 | ['76d7af6577a649dd8dd4aaff6b82570b'] | I have a code that works well for sending multiple files via ajax with FormData and XMLHttpRequest;
for (var i=0, j=this.files.length; i<j; i++) {
file = this.files[i];
var formdata = new FormData();
formdata.append("images[]", file);
var xhr = new XMLHttpRequest(),
upload = xhr.upload,
id = Math.floor((Math.random() * 100000));
upload.addEventListener("loadstart", function(e){
showUploadedItem(file, this.id);
});
upload.id = id;
upload.onprogress = function(e) {
var done = e.position || e.loaded, total = e.totalSize || e.total;
)
};
upload.onload = function(e) {
if (this.status == 200) {
console.log('');
}
};
xhr.onreadystatechange = function(e) {
if ( 4 == this.readyState ) {
console.log('');
}
};
xhr.open('post', '<?php echo Yii<IP_ADDRESS>app()->createUrl('url') ?>', true);
xhr.send(formdata);
}
I am sending each file as a new XMLHttpRequest object inside the loop, so I do not know when I'm getting all requests ending.
Can anyone help?
| 2c85e50de437a887c8b2925db7bb0aa56a176c4cc2015c2282a3b67d70c1b7d6 | ['76d7af6577a649dd8dd4aaff6b82570b'] | I tried this way:
$this->addDecorator('FormElements')
->addDecorator('HtmlTag', array('tag' => 'ul'))
->addDecorator('Form');
$this->setElementDecorators( array(
'ViewHelper',
'Label',
'Errors',
new Zend_Form_Decorator_HtmlTag(array('tag' => 'li'))
));
$this->setDisplayGroupDecorators( array(
'FormElements',
'Fieldset',
'FormErrors',
new Zend_Form_Decorator_HtmlTag(array('tag' => 'li')),
));
The problem is that I need to float the label and text elements, so I tried to use a list.
This was the only way I could.
|
ac4606505f8c3b1f238c66651e71ae0a0bee3379edff6bec035159499d98e6bd | ['76f50217cf4a485a9688ad950c2b9e25'] | Choosing between JSON and a column, should be a more high level decision than just performance. I assume when someone decides to use JSON they have to use it because the classic columns were too much of hassle.
Postgres is a relational database after all so other than performance there are lots of limitations when using jsonb or hstore (think about joins and foreign keys)
Postgres's JSON is not the same as MongoDB's the later is not relational at all.
Back to your question,I didn't have a chance to actually do the test, but I can say the JSON's index performance in Postgres is at most as good as the columns.
Edit:
Also read this.
| f085668b463c00de0337a1f916692c0db37329ceebbabc29917985d4e2faaced | ['76f50217cf4a485a9688ad950c2b9e25'] | Looks like you have the following options:
Convert your binary column to a none binary text column, using a temp column because binary columns cannot be case in-sensitive
Use the Convert function as the link you mentioned
Use the Lower or Upper methods
If you really want the column be always case in-sensitive, I'd say go for option 1.
|
7c973beb115fc51f069dbe67403d8760b90b23af9159c13039a7aeabe54bf6d4 | ['76faa242fdae4e8d9c216da5e5c03636'] | I populate a jQuery Mobile listView, like that, adding a .click callback function for each row:
//callback function when user clicks in a contact
function startChatWithContact(event, contact) {
//set user that is talking to
chatWithUser.ID = contact.ID;
chatWithUser.Name = contact.Name;
chatWithUser.Patent = contact.Patent;
//remove notifications case there is any and update pendingNotifications
pendingNotifications -= parseInt(event.currentTarget.childNodes[2].textContent);
event.currentTarget.childNodes[2].textContent = 0;
event.currentTarget.childNodes[2].style.display = 'none';
//set back to total notification with new value
if (pendingNotifications == 0)
$('#custom-back-notification').css('display', 'none');
else
$('#custom-back-notification').css('display', 'inline');
$('#custom-back-notification').text(pendingNotifications);
//set user info in the chat page
if (chatWithUser.ID % 2 == 0) {
$('#custom-message-status').removeClass('status-offline');
$('#custom-message-status').addClass('status-online');
}
else {
$('#custom-message-status').removeClass('status-online');
$('#custom-message-status').addClass('status-offline');
}
$('#custom-message-name').text(contact.Name);
$('#custom-message-patent').text(contact.Patent);
//get message from contact in server and add it
$.post("api/Chat/GetMessageList", { myID: currentUser.ID, toID: chatWithUser.ID }, function (result) {
if (result) {
$('#custom-messages-listview').empty();
$.each(result, function (key, item) {
addMessageToList(item);
});
}
}, 'json');
}
//function to add contact in contactList
function addContactToList(contact) {
$('#custom-contacts-listview')
.append($('<li/>', {})
.append($('<a/>', {
'href': '#custom-messages-page',
'class': 'list-cell',
'data-transition': 'slide'
})
.click(function (event) {
startChatWithContact(event, contact);
})
.append($('<div>', {
'class': contact.ID % 2 == 0 ? 'status-online' : 'status-offline'
}))
.append($('<div>', {
'class': 'contact-description'
})
.append($('<h2>', {
'text': contact.Name
}))
.append($('<p>', {
'text': contact.Patent
}))
.append($('<div>', {
'text': contact.ID,
'style': 'display: none'
})))
.append($('<div>', {
'class': 'notification',
'style': 'display: none',
'text': '0'
}))));
$('#custom-contacts-listview').listview('refresh');
}
This is working perfectly! But now, I want to order the listView, alphabetically because there is no way the server can send me it in the right order. So I did the sortList function that I call in the end when stop populating.
function sortList(ul, firstID) {
if (typeof ul == "string")
ul = document.getElementById(ul);
// Idiot-proof, remove if you want
if (!ul) {
return;
}
// Get the list items and setup an array for sorting
var lis = ul.getElementsByTagName("li");
var vals = [];
// Populate the array
for (var i = 0, l = lis.length; i < l; i++) {
vals[lis[i].childNodes[0].childNodes[1].childNodes[0].textContent] = lis[i].innerHTML;
}
// Sort it
var keys = [];
for(var key in vals){
if(vals.hasOwnProperty(key)){
keys.push(key);
}
}
// sort keys
keys.sort();
// Change the list on the page
$.each(keys, function (i, key) {
lis[i].innerHTML = vals[key];
});
}
But because I add the click listener with $(...).click method of jQuery, after I sort the list, I´m loosing the .click callback. How can i fix that?
Thanks in regards,
| 6da15ff4aeff1213faec98e290af43ad51aa66757359148019fc7f7faf5af4e4 | ['76faa242fdae4e8d9c216da5e5c03636'] | Well, this code is working fine. That's how it should be done.
My problem was when passing the bytes to the view inside the bundle. I was trying accomplish this with:
UTF8Encoding.UTF8.GetString (imageBytes)
and this:
UTF8Encoding.UTF8.GetBytes (navigation.imageBytes);
But this way, does not work. I realized that because the length of the bytes were not the same. So, I changed to this (that is working now):
Convert.ToBase64String (image.Data)
and
Convert.FromBase64String (navigation.imageBytes)
|
269de3d62962d2c5b6c84364097e4abf25bfc978eb9379d19238d0a9c8bfe3f2 | ['76fed1a32d184f2a9105c4ec50171aee'] | I have a collectiton "A" with this document:
{
"InsuranceCompany" : {
"fieldlabel" : "InsuranceCompany",
"fieldname" : "InsuranceCompany",
"fieldtype" : "dropdown",
"required" : "1",
"default_value" : "",
"placeholder" : "InsuranceCompany",
"order_no" : "3",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
},
"PolicyNumber" : {
"fieldlabel" : "PolicyNumber",
"fieldname" : "PolicyNumber",
"fieldtype" : "text",
"required" : "1",
"default_value" : "",
"placeholder" : "Policy Number",
"order_no" : "1",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
},
"NoOfYear" : {
"fieldlabel" : "NoOfYear",
"fieldname" : "NoOfYear",
"fieldtype" : "text",
"required" : "1",
"default_value" : "",
"placeholder" : "No Of Year",
"order_no" : "2",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
}
}
i want to sort it on the basis of order_no that is my result should be:
{
"PolicyNumber" : {
"fieldlabel" : "PolicyNumber",
"fieldname" : "PolicyNumber",
"fieldtype" : "text",
"required" : "1",
"default_value" : "",
"placeholder" : "Policy Number",
"order_no" : "1",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
},
"NoOfYear" : {
"fieldlabel" : "NoOfYear",
"fieldname" : "NoOfYear",
"fieldtype" : "text",
"required" : "1",
"default_value" : "",
"placeholder" : "No Of Year",
"order_no" : "2",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
},
"InsuranceCompany" : {
"fieldlabel" : "InsuranceCompany",
"fieldname" : "InsuranceCompany",
"fieldtype" : "dropdown",
"required" : "1",
"default_value" : "",
"placeholder" : "InsuranceCompany",
"order_no" : "3",
"formgroup" : "policyDetails",
"can_delete" : "1",
"status" : "1"
}
}
I have tried this query:
db.A.aggregate([
{ $sort : { order_no : -1 } }
]).pretty()
But it didn't work for me as it is returning the same sequence.
| b3285c3c886f9cd63762f25e88a21f5a24d3efee54991bb202bb349f05be34cd | ['76fed1a32d184f2a9105c4ec50171aee'] | I am sending parameter from my <PERSON>
a(href="/service-labourJobcardnumber=#{Jobcardnumber}") add labour
but it is not treating it as a parameter.How to send the parameter with <PERSON> and how can i access it in my index.js routes.
This is my index.js code
router.get('/service-labour/:Jobcardnumber', function(req, res) {
var db = req.db;
var locals = {};
console.log(req.params); return;
locals.Jobcardnumber = req.body.Jobcardnumber;
res.render('service-labour', locals);
});
But its not working.
|
2399574562e2e6740ad759cd8f8b73ff244b218c3f73b3bae9521f40293e8b8b | ['77272deccc574377b1b744d4c3f64e1d'] | You try to insert a row already in your table.
So for example in your table you have
GAME_ID Name
1 Texas Holdem
You try to insert into your table this line, but the game_id 1 is already there
So if you want to insert this, you need to create a new line like this in order to generate a new game_id for this game name :
INSERT INTO GAME(Name) VALUES ('Texas Holdem')
| 74134263ac48f043e2d8bbe61ba60a85beba6ddfd98d83abff2017cdda84a29d | ['77272deccc574377b1b744d4c3f64e1d'] | You can do this by recording a macro in Excel, it give me something like that and sort dates in the format of "MMM-DD-YYYY"
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("A1:C1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décemb re" _
, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("A1:C1")
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
|
9330d882690ef7426397e432be75cc5fcbe1cc2c386c70bced523f39cd463118 | ['772f7d20893c473d98035002839793e6'] | I can't figure out what passing by reference and passing by value looks like (I know what they mean in theory). Can you tell me whether the below function is passing arguments by value ore reference? BTW this is my first post :)
var number_1 = 32;
var number_2 = 43;
function addition(num1,num2) {
alert (num1*num2) ;
}
addition(number_1,number_2); /*is this passing by reference?*/
| bf6d5421b3895db3653993d2c4a1a541b88cfc9e5d0c5ca4617180f10ff92642 | ['772f7d20893c473d98035002839793e6'] | I have two excel sheets, Player_Records and Match_Records, with one common column named Match_ID in both.
The Player_Records sheet contain career records of multiple players. The Player_ID column identifies the player but not uniquely since there are multiple records (each record has details regarding the results of a particular match) for each player. The Match_ID column identifies the match but also not uniquely since many players have an entry for the same match.
Player_Records sheet
The Match_Records sheet contain records of every match played and the Match_ID column uniquely identifies each match.
Match_Records sheet
What I want to achieve:
Append each (unique) player from the Player_Records file as a column into the Match_Records file so that a record in the Match_Records file has a column for each player (regardless of whether they played in that match).
When this is done, the Match_Records file will have a column for each player and the cell value of those columns can be boolean to indicate whether that player was part of that particular match.
How can I do this?
|
0e77857d13c90b379e7320339306a7bc2997bd2d70332276a1e04cda152a8d82 | ['77395dca126640bfbdf77b54a516c025'] | Not sure... it's the same output chain in both cases, so it should be the same volume, i.e. the source must be outputting a different signal level to the card.
Exporting from Pro Tools doesn't go via the interface, but direct from the DAW to disk. So, it must be either the level of playback into the card (what are you comparing it with when you audition the wav?), or maybe your export has an accidental plug in in there?
| 14529aa5572eb90bcf40a456679f898844f411be3e60bfe8d55f063127085b9c | ['77395dca126640bfbdf77b54a516c025'] | This should be a comment on <PERSON> answer but not enough repo: also consider the path: kpsewhich -var-value=TEXMFLOCAL which on ubuntu 13.04 is: /usr/local/share/texmf/ if you want to install a .sty for all users. As mentioned in that answer, you still need to keep the correct subdir structure here. |
63ac8b64d284927b7323fd7d7b1c593bd6a7ffaf46ad638802be9bd1d85ac4a9 | ['773e3401fe8b46e3b0342d1ea004ebf4'] | I am using Yii2 Advanced Template. I have created user module inside /frontend/modules/ directory. without theme integration, views are called from /modules/user/views/ directory.
Currently, I have created three different themes inside /frontend directory. So I would like to access views from theme directory for User Module. How it would be possible?
It is possible to set layout for module by
$this->layoutPath = \Yii<IP_ADDRESS>getAlias('/themes/classic/views/layouts/');
$this->layout = 'userLayout';
But How views can be accessed from theme directory for module?
Please suggest possible solutions..
| 4ae7ad1f3359c4ba83c233bcc6c979cfa392b156d3c2f763396a4628e7d7a11f | ['773e3401fe8b46e3b0342d1ea004ebf4'] | I found solution to my question. I have implemented following way.
Added Layout path in Module.php after init() method.
public function init()
{
parent<IP_ADDRESS>init();
$this->layoutPath = \Yii<IP_ADDRESS>getAlias('@app/themes/classic/views/layouts/');
$this->layout = 'userLayout';
}
and
added theme configuration with module views in main.php config file
'view' => [
'theme' => [
'pathMap' => [
'@app/views' =>'@app/themes/classic/views/',
'@app/modules'=>'@app/themes/classic/modules',
'@app/widgets'=>'@app/themes/classic/widgets'
],
'baseUrl'=>"/themes/classic",
],
],
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.