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 |
|---|---|---|---|---|---|
64e667a3a5258e891a0a638f423a94f3cf1b450a4cf3fe03df6e2d9ed089e1ae | ['b417086b50b84e3293783883d2d4b55a'] | import random
import time
from datetime import datetime
dates = []
def randomDate(start, end):
frmt = '%d-%m-%Y %H:%M:%S'
stime = time.mktime(time.strptime(start, frmt))
etime = time.mktime(time.strptime(end, frmt))
ptime = stime + random.random() * (etime - stime)
dt = datetime.fromtimestamp(time.mktime(time.localtime(ptime)))
return dt
for i in range(0 , 10)
dates.append(randomDate("20-01-2018 13:30:00", "23-01-2018 04:50:34"))
Your dates will have a list of 10 sample date :)
Good Luck
| 15506df01d8b97071a461618d45ba970c5b976be9a16d3800018e8c32276a5b5 | ['b417086b50b84e3293783883d2d4b55a'] | I am trying to make a watchlist for stocks for my website. The data i.e name of the Company and the stock price is already being displayed on the webpage. I want that the user should just click on a button on the same webpage and it adds the data to the watchlist of the user.
This is for a website for stock analysis. I dont know how to do this.
PS- I'm new to coding
Watchlist Model:
class WatchList(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
watchlist = models.CharField(max_length=300, default='')
price = models.IntegerField(default='')
html:
{% extends 'homepage/layout.html' %}
{% block content %}
{% load static %}
<head>
<title>Technical Analysis</title>
<link rel="stylesheet" href="{% static 'tech_analysis/tech_analysis.css' %}">
</head>
<div class="line"></div>
<div class="head">
Technical Analysis
</div>
<div class="coname">
<ul class="ticker_table">
<li class="ticker_name">{{ ticker }}-</li>
<li class="ticker_price">{{ price }}</li>
<li class="diff_green">{{ diff_green }}</li>
<li class="diff_red">{{ diff_red }}</li>
</ul>
<form action="{% url 'bsh_user:Userpage' %}" method="post">
{% csrf_token %}
<input class="watchlist" type="submit" value="Add To Watchlist +">
</form>
</div>
the information such as {{ticker}} and {{price}} is the data that is to be posted to the model and displayed to the user on a different html.
Expected outcome is to add a company and its price to the watchlist model with a click.
|
f0c3e6a286a620dfdb1c51da3e42fc591a677544a90389de1db72afc520dc5ab | ['b42c3e9575f141fcae3fe2c2f3902467'] | So if the clients are connecting to the AP in the same VLAN and getting DHCP from the switch, the AP is not actually communicating with the switch? I have tried Angry IP scanner to the block of IPs allotted to the WLAN's VLAN but did not see the Mac address anywhere. It's also possible that the AP is in a completely different network like 10.0... or 172.16... | 9b5445ec607eeef06d04bcceca2175560faeb29c2a107354a12e5357532c60fb | ['b42c3e9575f141fcae3fe2c2f3902467'] | Have you has a looked at the $locationChangeStart event? It will get called when ever the url get changed:
$rootScope.$on('$locationChangeStart',function(){
console.log('$locationChangeStart called');
})
It may not be a good solution since it gets called when ever the URL changes which probably isn't what you want but it may help.
|
0bdea53734e85d522a2cea3395ce049d293176c8461408d2e1bfb9136ce7504b | ['b431a369082543219a5d7e34a6e133ff'] | I know this has been asked last year but I have searched for several days now and I still cannot seem to be able to resolve the following issue:
txt_outputDataFile <- gedit(initial.msg="desired output file", container=row2)
generates the following error:
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
‘no_items’ is not a valid field or method name for reference class “Entry”
I am using RStudio version 0.98.507 and the following two lines in my code:
require("gWidgets")
options(guiToolkit="tcltk")
Can anyone please suggest how to resolve this error, or how I can access the value from this field in a different manner? Thank you.
| b8a0a52d7be5ef4b02e7862d535589c1a12b6f37618fc7b6e6d789d3efe2166d | ['b431a369082543219a5d7e34a6e133ff'] | Suppose I have the following custom attribute decorated class that implements a TypeConverter. I would like to create a combobox in the Wpf.PropertyGrid such that the values in the combobox are taken from the string array specified in the custom attribute. The issue I am having is that although I can iterate through all the properties with the custom attribute, I cannot figure out the actual property that invoked the TypeConverter as the context.PropertyGrid is null. Can such a combobox be created? If yes, how?
The class:
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Animals : INotifyPropertyChanged
{
// Constructor
public Animals()
{
foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(this))
{
DefaultValueAttribute attr = (DefaultValueAttribute)prop.Attributes[typeof(DefaultValueAttribute)];
if (attr != null)
prop.SetValue(this, attr.Value);
}
}
// Properties
private string _pets, _others;
// both properties have the same TypeConverter, but they use different custom attributes
[RefreshProperties(RefreshProperties.All)]
[TypeConverter(typeof(ListTypeConverter))]
[ListTypeConverterAttribute(new [] { "cat", "dog" })]
[ListTypeConverterAttribute(new [] { "cat1", "dog1" })]
[DefaultValue("cat")]
public string Pets
{
get { return _pets; }
set { SetField(ref _pets, value); }
}
[RefreshProperties(RefreshProperties.All)]
[ListTypeConverterAttribute(typeof(ListTypeConverter))]
[ListTypeConverterAttribute(new [] { "cow", "sheep" })]
[DefaultValue("sheep")]
public string Others
{
get { return _others; }
set { SetField(ref _others, value); }
}
// Methods
public override string ToString()
{
return string.Empty;
}
// ----- Implement INotifyPropertyChanged -----
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value))
return false;
field = value;
OnPropertyChanged(propertyName);
return true;
}
}
The custom attribute:
public sealed class ListTypeConverterAttribute : Attribute
{
public ListTypeConverterAttribute(params string[] list)
{
this.List = list;
}
public string[] List { get; set; }
public override object TypeId
{
get { return this; }
}
}
The TypeConverter:
public class ListTypeConverter : TypeConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
base.GetStandardValues(context);
List<string> list = new List<string>();
// HERE IS MY ISSUE ...
// How do I get the property invoking the TypeConverter so I can get its list?
// context.PropertyGrid == null
return new StandardValuesCollection(list);
}
}
|
74f32cd62b392556b0269eff2666e6c377d80f97ee3a691ece92672ae346aad3 | ['b438e2fb211249df8456029ebc5a3e67'] | In CSS, when a browser does not recognize part of a selector (or thinks there is an error in a selector), it completely ignores the entire rule.
Here's the section in the CSS3 spec outlining this behavior
The prelude of the qualified rule is parsed as a selector list. If this results in an invalid selector list, the entire style rule is invalid.
Here CSS2.1 talks about the special case of comma
CSS 2.1 gives a special meaning to the comma (,) in selectors. However, since it is not known if the comma may acquire other meanings in future updates of CSS, the whole statement should be ignored if there is an error anywhere in the selector, even though the rest of the selector may look reasonable in CSS 2.1.
Therefore when the other browsers try to parse the selectors, they find the _:-ms-lang(x) selector to be invalid and so ignore the entire rule (including .selector)
Also here is an excellent answer on why this behavior is desirable
| 9b3ad549489d4413f0ebbd3e86e35396097f46f765e300414859ce92f9b6ef73 | ['b438e2fb211249df8456029ebc5a3e67'] | You need to put the content which should be in front of the image in the same <div> where the background image is applied. Also, lose the position: absolute property and I have added display: flex to center the text vertically and horizontally.
html,
body {
height: 100%;
}
#parent-container {
height: 100%;
}
#home-main {
height: 100%;
width: 100%;
}
#home-bg-img {
display: flex;
min-height: 100%;
min-width: 100%;
background-image: url("https://placeholdit.imgix.net/~text?txtsize=63&bg=FF6347&txtclr=ffffff&txt=Image-1&w=350&h=250");
background-size: cover;
background-repeat: no-repeat;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<div id="parent-container">
<div id="home-bg-img">
<div class="col-md-12 landing text-center my-auto">
<h2 class="h2 text-light"><span class="purple">ProjectName</span></h2>
<h3 class="h3 cosmic-purple">An Intuitive, Secure and Reliable Project.</h3>
<a class="btn btn-primary btn-lg" href="#" role="button">Explore The Project</a>
</div>
</div>
</div>
<div id="home-main">
<div class="container col-md-12" id="home-body">
<div class="row">
<div class="col-md-12 text-center">
<h3 class="h3">
Just some text which should be beneath the image div wberjk vbetba jvntenb jtjrbsb teb jte hjkbtejknb jkbtseb gsdhjjds fhjvbjhebr hjvbdhj sbvhjds
</h3>
</div>
</div>
</div>
</div>
|
aa7f5a03d61da11dbb6f83c8427b66b2f6c7981701d4948ee7d96cb6f02cac95 | ['b44cedcd945f48c7a927564aaaf1276f'] | In sklearn.linear_model.LogisticRegression, there is a parameter C according to docs
Cfloat, default=1.0
Inverse of regularization strength; must be a positive float. Like in support vector machines, smaller values specify stronger regularization.
I can not understand it? What does this mean? Is it λ we multiply when penalizing weights?
| 8b9b3e6d35e95b7a66452d950dda32bb523fd97be7800621797e2859c5677172 | ['b44cedcd945f48c7a927564aaaf1276f'] | i mean i think that mg passes through the centre of mass of the object and so does its components,and even the normal reaction passes through the centre. so,none of them should produce a torque right. Theta is the angle based on which the components are taken. i'm sorry that i am unable to add an image. |
460529f212c90d5e7c41d0c698ffbe7cff443879b01ccc6259c29908e7c62d0f | ['b46fe1124cd24a9baf599eb6cd9d7331'] | I am trying estimates the space derivatives of solution of heat equation in infinity norm with bounded initial data in $\mathbb{R^3}$
Here is the equation
$u_t=\Delta u$ in $ B(0,1)\times (0,T) $
$u=0$ in $(0,T]\times \partial B(0,1)$
$u(x,0)=f$ in $B(0,1)$.
Where $f\in l^{\infty}(B(0,1))$ and $B(0,1)$ is unit sphere.
I tried to find the solution using the $C^{\infty}$ cut off function but could not quite get the solution in term of the initial data. I could not find any reference about it as well.I would be happy to get some reference that talks about the heat kernel or solution of heat equation for a bounded domain in $\mathbb{R^n}$.
| 1c5d93018e7a5b5f94da3404d59cdc3214dbad75a2358bc5ee64bdb3c1242ed0 | ['b46fe1124cd24a9baf599eb6cd9d7331'] | <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<button type="button" class="navbar-toggler" data-toggle="collapse"
data-target="#
navbar"
aria-controls="navbar"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
<div class="collapse navbar-collapse" id="navbar">
<form>
<input type="text" placeholder="Search...">
</form>
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" href="#">Dashboard <span
class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#settings">Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#profile">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#help">Help</a>
</li>
</ul>
</div>
</nav>
При разрешении меньше lg появляется кнопка , пытаюсь на неё нажать , но ничего не происходит
все link и script добавлены
|
99943f3eb3d5725146c8d8628d3214528a9fce7026e8eef1b7e3b36bc0e4938d | ['b471b28eb39b4d559c823ef897c3782e'] | I'm trying to type something a the 'Url' object that is described within the NodeJS definition. But the 'Url' object is described under the 'url' module. Because it's under the module its not recognised by the compiler as a valid type.
///<reference path='../../../Definitions/node.d.ts' />
///<reference path='../../../Definitions/node-webkit.d.ts' />
///<reference path='../../../Definitions/cheerio.d.ts' />
var NodeUrl = require('url');
function findLinks($cheerio:Cheerio, internalOnly?:boolean, rootUrl?:url.Url):string[] {
//url.Url is not recognised, neither is Url or NodeUrl.Url
}
The definition file is defining the following module (alongside the rest of NodeJS):
declare module "url" {
export interface Url {
href: string;
protocol: string;
auth: string;
hostname: string;
port: string;
host: string;
pathname: string;
search: string;
query: any; // string | Object
slashes: boolean;
hash?: string;
path?: string;
}
export interface UrlOptions {
protocol?: string;
auth?: string;
hostname?: string;
port?: string;
host?: string;
pathname?: string;
search?: string;
query?: any;
hash?: string;
path?: string;
}
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
export function format(url: UrlOptions): string;
export function resolve(from: string, to: string): string;
}
How do I reference the Url type correctly?
Thanks for any help.
| cbf106854015ee0440cc75f364ea716916122b6210b7936885e521c5fc9f2f36 | ['b471b28eb39b4d559c823ef897c3782e'] | I'm trying to dynamically add a style sheet to an Angular Element. I'm doing this by adding a to the template. This works fine if I do it through JavaScript. E.g.
newLinkElement.setAttribute('href', '//mystyles.css')
But if I try to do this with a binding:
<link rel="stylesheet" type="text/css" id="backgroundImageStyles" href="{{stylesUrl}}">
I get this error
ERROR in HostResourceResolver: could not resolve {{stylesUrl}}. If I just change the attribute I'm binding to then the error goes away. E.g. this works:
<link rel="stylesheet" type="text/css" id="backgroundImageStyles" lang="{{stylesUrl}}">
I've tried [attr.href] and [href] as well with no luck. Does Angular not allow binding to the href attribute of a link?
|
428c3d33badabd75f4ac790d90f26f5f54ceef05922cb44fbdf221254323c22f | ['b4750fbdbedd4380801765066beb2185'] | Try this
ALTER PROCEDURE [dbo].[sp_GDE_QA]
@oks_ids varchar(100),
@Operation varchar(50)
AS BEGIN
declare @Execute as varchar(100)
set @Execute = 'select oks_id, path from tb_gde_qc where status=''QC Completed'' and oks_id in '''+@oks_ids+'''';
sp_ExecuteSQL @Execute
END
sp_ExecuteSQL should be able to handle the passing of the string within the parameter.
Can I ask where does @Operation come into play?
| b69be2b8d2a3df18adae0db86ef0f1d23d353b32be569e3a8c134dfb226f590e | ['b4750fbdbedd4380801765066beb2185'] | You could try:
SELECT
Location,
SUM(CASE WHEN SaleDate = '2012-11-12' THEN DollarSales ELSE 0 END)'Sale on 11/12'
SUM(CASE WHEN SaleDate = '2012-11-19' THEN DollarSales ELSE 0 END)'Sale on 11/19'
FROM [TableName]
GROUP BY Location
ORDER BY Location
This would only work if columns were static, you would have to change this if the dates change.
|
34c2fea1bf3a71784a0e2519bd6b2971c9c7752bfd28e0ad2982f1cf8952fa67 | ['b4765eacec194df085a840da1f86c990'] | While I make write code with Typescript + React, I found some error.
When I make type/value in <a> tag attribute, I get compile Error.
<a value='Hello' type='button'>Search</a>
This code get occur error
TS2339:Property 'value' does not exist on type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.
How can I solve this compile problem? I search few hours but I cannot get solution :(
| f3f7f93775b024cb9341f7add2a4b6f68ff1512c931e37764daa6ef93ff7afd5 | ['b4765eacec194df085a840da1f86c990'] | I'm first in SwiftUI and IOS. I want to use SimpleCheckBox in my SwiftUI.
But I only get
Error:(14, 18) static method 'buildBlock' requires that 'Checkbox' conform to 'View'
This is my code.
var body: some View {
HStack {
Checkbox(frame: CGRect(x: 50, y: 50, width: 25, height: 25))
Text("HelloWorld!")
}
}
How can I use UIControl in SwiftUI?
|
f598d0903e46eda804449ea4ff76fbdb9b186b8a947409c866e143f1c38706ed | ['b4776ecc285f4074805d3a3bb31c5b2b'] | I can test on the simulators, but both my iPhone and iPad show old versions of my app. I've tried deleting derived data, deleting the apps from the devices, and cleaning the project. My phone is on 8.3 and my iPad is on 8.1.2, and I have the problem on both devices. Xcode is on 6.1.1. I'm running 10.10.2 Yosemite. Please help.
| af0f11a9f055ea8626af9bf5ee344a833a32ea3efd753f199f1ef18bf3c87368 | ['b4776ecc285f4074805d3a3bb31c5b2b'] | Are the paths in the apple-app-site-association file relative to the root or the directory that it's in. If my file is in the .well-known directory, should my path be ../mypath or just /mypath
Also, does it matter if I'm using teamID or appID if I'm trying to test it in the dev environment?
|
c23551a082561bc412bd3a68828ed824ea387c805957db9754c38e2bf0592885 | ['b47df05a23e0416d8c2b8c9bb7b67a03'] | I'm trying to make a Q3BSP map information debugger.
I'm stuck at texture debugger part, this is the code used in that part:
for( i = 0; i < nTextures; i++ ) {
printf( "Texture id %d\n", i );
printf( "\tTexture name %s\n", Texture[i].name );
printf( "\tTexture flags %d\n", Texture[i].flags );
printf( "\tTexture contents %d\n", Texture[i].contents );
}
But this kind error appears to show up:
error C2676: binary '[' : 'Q3BSPTexture' does not define this operator or a conversion to a type acceptable to the predefined operator
Here is the Q3BSPTexture structure:
typedef struct {
char name[64]; // Texture name.
int flags; // Surface flags.
int contents; // Surface contents
} Q3BSPTexture;
I'm suspecting that the structure hasn't the limit setted like char [32]
But I like to hear solution from professionals!
| 49eaec55c33c992f74979d3cd6180f7eb03fbe46430ebead6fab7c65a4ff81b5 | ['b47df05a23e0416d8c2b8c9bb7b67a03'] | Following webglacademy 5th tutorial at creating textures (http://www.webglacademy.com/#5), the point is to load the texture on the cube object which works, kinda.
Look at the result -
Can anyone tell me why the texture looks like this while it should be fit perfectly on cube side?
Demo here - http://kgpk.esy.es/WebGL/ (Hold mouse button and drag to move the cube; mousewheel to zoom in/out)
Texture used - http://kgpk.esy.es/WebGL/texture.png
Code - http://kgpk.esy.es/WebGL/WEBGL.js (Texture gets loaded in f_IniatializeTextures function [line 209] which uses f_GetTexture function [line 255] to load the texture and the texture is thrown into stream at f_Animate function [line 427]
Vertex and fragment can be found in function f_InitializeShaders [line 215]
base.m_ShaderVertex = [
"attribute vec3 position;", // The position of the point.
"uniform mat4 Pmatrix;", // Projection matrix.
"uniform mat4 Vmatrix;", // Movement matrix from object reference to view reference.
"uniform mat4 Mmatrix;", // Movement matrix.
"attribute vec2 uv;",
"varying vec2 vUV;",
"void main(void) {",
"gl_Position = Pmatrix * Vmatrix * Mmatrix * vec4(position, 1.0);",
"vUV = uv;", // Set color.
"}"
].join("\n");
base.m_ShaderFragment = [
"precision mediump float;",
"uniform sampler2D sampler;",
"varying vec2 vUV;",
"void main(void) {",
"gl_FragColor = texture2D(sampler, vUV);", // Assign the color to pixel with total opaque.
"}"
].join("\n");
Thanks.
|
0a3e9ea15b359e08b77ec1b17c147c93f866a5ab9c41f9bae52de87790948d46 | ['b47f927596494d2c8ac6ced3b0de1ccb'] | Unfortunately, there is no set answer - you have to try what works (start with whatever's easiest) for your given problem. What works can also vary by topic.
My favorite example of this <PERSON> 98
They are comparing algorithms and average across several feature solutions, but my point is if you look at Figure 2, Naive Bayes works really well for some topics and really poorly for others.
I generally start by taking the top 20% by TF-IDF across all classes, and use Naive Bayes to get a baseline of performance for each class. This is quick, and often all I need in my domain, insurance. Then you may want to dig deeper on any classes that perform poorly - like you said maybe do TF-IDF within the class and look at the terms that you can leverage.
Looking at the terms by class can really help - one time I noticed medical terms were important in one particular class - I downloaded a list of medical terms, turned it into a regular expression, and used it to set a flag on the documents which really improved classification on that class.
Obviously, this is very domain/topic specific, and also depends on your domain expertise. That's the way it goes with text classification in my experience - there is no standard answer for what will work for any given problem. You may have to try several solutions and you stop when performance is adequate.
| a78f5e6b567fcb74732b9a7374616b029e58058845fd3cdb67a7003e230c75de | ['b47f927596494d2c8ac6ced3b0de1ccb'] | I want to understand (and report the bug) which app is showing the "Network Error" toast notifications in the middle of the screen each time when I unlock the device. Any tips or ideas?
I'm a JS developer, so can utilise any developer tools if necessary.
Device is stock oneplus 5, Android 7.1.1 if that matters.
|
552c7be7746cd15d68586c349b4b9aaaf861b0341e11a9abb34b6c2a823fd69a | ['b48602d421784449909c375940427f19'] | You can use CSS Variables:
<svg id="plus" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 8H15" stroke="var(--icon-color, #fff)"/>
<path d="M8 1L8 15" stroke="var(--icon-color, #fff)"/>
</svg>
CSS:
.icon {
--icon-color: red;
}
Works with <mat-icon> and SVG icon sets
| b2aee041beb0332db626eb74875e163919cf82d98d858aa2ed93b64920a64007 | ['b48602d421784449909c375940427f19'] | I'm using Hazelcast (v3.5.4) Topics for a really simple chat application running on two Azure VMs (Standard D3).
When publishing messages sometimes it takes up to 15 seconds to be received by the other member.
I logged publish and onMessage methods to be clear that hazelcast is causing the delay.
There is no network delay and the applications and VMs are using nearly zero CPU resources.
What can cause such a delay?
For messaging Topics are used:
private ITopic<ChatMessage> eventTopic;
@PostConstruct
private void init() {
eventTopic = hazelcastInstance.getTopic("chat-messages");
eventTopic.addMessageListener(new ChatMessageListener());
}
public void publishMessage(final ChatMessage chatMessage) {
log.debug("Publish message: " + chatMessage.toString());
eventTopic.publish(chatMessage);
}
The two azure VMs are in the same region and the latency (Ping) between these two VMs is under 5ms.
Multicast join is disabled, static TcpJoin is used:
@Bean
public HazelcastInstance hazelcastInstance() {
final Config config = new Config();
NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.setPort(5701);
networkConfig.setPortAutoIncrement(true);
networkConfig.setPortCount(3);
networkConfig.getInterfaces()
.addInterface("10.0.0.*")
.setEnabled(true);
final JoinConfig join = networkConfig.getJoin();
join.getAwsConfig().setEnabled(false);
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().addMember("<IP_ADDRESS>-2").setEnabled(true);
return HazelcastInstanceFactory.newHazelcastInstance(config);
}
Spring Boot 1.3 is used with hazelcast-spring 3.5.4
|
11128a2b77fbcc14396d9a3c694503a9b9d3149d3e60b6e4b38df8525019065b | ['b493d9b4264348bf9679bf579c3e582f'] | You can use this;
@IBAction func downloadButton(_ sender: Any) {
let imageRepresentation = UIImagePNGRepresentation(photoView.image!)
let imageData = UIImage(data: imageRepresentation!)
UIImageWriteToSavedPhotosAlbum(imageData!, nil, nil, nil)
let alert = UIAlertController(title: "Completed", message: "Image has been saved!", preferredStyle: .alert)
let action = UIAlertAction(title: "Ok", style: .default, handler: nil)
alert.addAction(action)
self.present(alert, animated: true, completion: nil)
}
| e7eb3b3dcf55294046c282b89ab7005c69148aee40349efd14df81a9542c81f0 | ['b493d9b4264348bf9679bf579c3e582f'] | For Swift 3
func textFieldDidBeginEditing(_ textField: UITextField) { // became first responder
//move textfields up
let myScreenRect: CGRect = UIScreen.main.bounds
let keyboardHeight : CGFloat = 216
UIView.beginAnimations( "animateView", context: nil)
var movementDuration:TimeInterval = 0.35
var needToMove: CGFloat = 0
var frame : CGRect = self.view.frame
if (textField.frame.origin.y + textField.frame.size.height + UIApplication.shared.statusBarFrame.size.height > (myScreenRect.size.height - keyboardHeight - 30)) {
needToMove = (textField.frame.origin.y + textField.frame.size.height + UIApplication.shared.statusBarFrame.size.height) - (myScreenRect.size.height - keyboardHeight - 30);
}
frame.origin.y = -needToMove
self.view.frame = frame
UIView.commitAnimations()
}
func textFieldDidEndEditing(_ textField: UITextField) {
//move textfields back down
UIView.beginAnimations( "animateView", context: nil)
var movementDuration:TimeInterval = 0.35
var frame : CGRect = self.view.frame
frame.origin.y = 0
self.view.frame = frame
UIView.commitAnimations()
}
|
38b6a0832826259dcc19f740b314535dee0370e8e47db5473b6f85e5c0a78ae8 | ['b49e98c390074aefb4a3deb4b5716cd5'] | I solved the problem. Problem is in layoutinflater inside onClick method. So i put that layoutinflater codes to new method call getQuestion(). And call getQuestion() method in my getTextA() method. its solved.
I use layoutinflater because this method still in a fragment. Using a new fragment causes Nestedfragments. Thanks for your answers.
Here is the code
public void onClick(View v) {
getTextA();
}`
public void getTextA(){
//Method details.
getQuestion();
}
public void getQuestion(){
mFrameLayout.removeAllViews();
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = layoutInflater.inflate(R.layout.soru, null);
mFrameLayout.addView(v);
Button bt = new Button(this);
bt.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
mFrameLayout.addView(bt);
bt.setText(textA);
}
| bea9d84faa53c2aebf7c1d31b67d36f34e12b2d784fe16ae25c50b1784f88f74 | ['b49e98c390074aefb4a3deb4b5716cd5'] | i have 2 spinners one for Province and other for City. But they dependent to each other.if i select Gauteng in Province spinner the second spinner must show Johannesburg,Pretoria,Centurion and if i select KZN in province i want the second spinner to show Petermaritsburg,Durban,Ulundi.
Here is my code. i can populate spinner from my mysql db but i cant create dependencies the other
first spinners JSON data:
"Provinces": [
{
"provinceid": "1",
"provincename": "A"
},
{
"provinceid": "2",
"provincename": "B"
}
]}
second spinners JSON data: (İt related on provinces in my php and db.
//getting values for listing cities
$provinceid= $_POST['provinceid'];)
{
"Cities": [
{
"cityid": "1",
"cityname": "AA"
},
{
"cityid": "2",
"cityname": "BB"
}
]}
Here is my java code.
private ArrayList<String> province;
private ArrayList<String> city;
private JSONArray provinces;
String ilceid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
ilce = new ArrayList<String>();
//Initializing Spinner
spinner = (Spinner) findViewById(R.id.spinner);
spinner2 = (Spinner) findViewById(R.id.spinner2);
//Adding an Item Selected Listener to our Spinner
//As we have implemented the class Spinner.OnItemSelectedListener to this class iteself we are passing this to setOnItemSelectedListener
spinner.setOnItemSelectedListener(WelcomeActivity.this);
spinner2.setOnItemSelectedListener(WelcomeActivity.this);
getData();
}
private void getData(){
//Creating a string request
StringRequest stringRequest = new StringRequest(SharedPrefManager.DATA_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
JSONObject j = null;
try {
//Parsing the fetched Json String to JSON Object
j = new JSONObject(response);
//Storing the Array of JSON String to our JSON Array
provinces= j.getJSONArray(SharedPrefManager.JSON_ARRAY);
getProvinces(provinces);
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
//Creating a request queue
RequestQueue requestQueue = Volley.newRequestQueue(this);
//Adding request to the queue
requestQueue.add(stringRequest);
}
private void getProvinces(JSONArray j){
//Traversing through all the items in the json array
for(int i=0;i<j.length();i++){
try {
//Getting json object
JSONObject json = j.getJSONObject(i);
province.add(json.getString(SharedPrefManager.TAG_PROVINCENAME));
} catch (JSONException e) {
e.printStackTrace();
}
}
//Setting adapter to show the items in the spinner
spinner.setAdapter(new ArrayAdapter<String>(WelcomeActivity.this, android.R.layout.simple_spinner_dropdown_item, province));
}
private String getProvinceId(int position){
String provid="";
try {
JSONObject json = provinces.getJSONObject(position);
course = json.getString(SharedPrefManager.TAG_PROVINCEID);
} catch (JSONException e) {
e.printStackTrace();
}
return provid;
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}}
First spinner works in this case. But how do i populate spinner2 depending on first spinner ?
|
219dd7338495ed0299e00fb87f3f605ef647202e0c2aa7ed0f398e4f9bad004b | ['b4a7c858057a4b5c8855350554fe290d'] | By using subquery also we can achieve your expected output
SELECT DISTINCT
O.ID,
O.Ref,
O.[Type],
O.LogTime,
(SELECT TOP 1 I.LogTime FROM LoginLogout I
WHERE I.Ref = O.Ref
AND I.[Type] = 3
AND I.LogTime > O.LogTime) AS LogTime_Type3
FROM LoginLogout O
WHERE O.[Type] = 1
| c7718eaf0b5024bd71af8f4c2fdcc0098d19ffa0cfe2ea2e86c8ce71fb669565 | ['b4a7c858057a4b5c8855350554fe290d'] | We can achieve the using dynamically with PIVOT concept, but whatever [Type] field data should not actual field name, it should be different
CREATE TABLE PivotTable (Id INT,Value VARCHAR(100),[Type] VARCHAR(100))
INSERT INTO PivotTable VALUES
(1,'ABC Bank','Bank')
,(1,'User','Name')
,(1,'123','IDs')
,(1,'<EMAIL_ADDRESS>','Email')
,(1,'Banking','Reference')
SELECT * FROM PivotTable
DECLARE @Columns NVARCHAR(MAX),
@SQL NVARCHAR(MAX)
SET @Columns = STUFF((SELECT DISTINCT ','+[Type] FROM PivotTable FOR XML PATH('')),1,1,'')
SET @SQL = 'SELECT Id,'+@Columns+' FROM
(
SELECT Id,
Value,
[Type]
FROM PivotTable
) P
PIVOT
(
MAX(Value) FOR [Type] IN ('+@Columns+')
)pvt'
EXEC (@SQL)
|
052f2c05e8b3edcc3a8947027510cce6158254b7198dc3c5e1f3021afc7c715f | ['b4b19cbcf32142758d114cd8ae3e8e62'] | yes, [execute](https://github.com/paulirish/dotfiles/blob/master/symlink-setup.sh#L62) runs command and calls [print_result](https://github.com/paulirish/dotfiles/blob/master/symlink-setup.sh#L121). [execute](https://github.com/alrra/dotfiles/blob/dea7081cfbe0ce022185de2b95f696e3ef01e7b1/os/utils.sh#L40) from [utils.h](https://github.com/alrra/dotfiles/blob/dea7081cfbe0ce022185de2b95f696e3ef01e7b1/os/utils.sh) | 9e00a035f138619f4d9b175e1e9b0e6ed9340791f1a370b1e0ff96149c5eedc7 | ['b4b19cbcf32142758d114cd8ae3e8e62'] | thank you for this useful information. I thought about doing a search pattern like this, sadly this would be rather confusing as my AI will prioritize searching a house as soon as it finds one, and thus pausing the search algorithm, potentially putting it in a weird spot to continue that same pattern. Someone came up with the idea to spread breadcrumbs around the world, and picking x-amount of random positions, then evaluate how many breadcrumbs there are left in that area, and how close it is, taking that as the "search-goal". Ofcourse, as soon as my AI sees a crumb, it would get deleted. |
8e99f6c7aa46d2a5b38663ec365f3b6028ad06deb260d123160a0da04cdea852 | ['b4b2eb1f2c2f4fc1ac25c40f24d76c2b'] | I hope this is not ridiculous to ask (and I will try to focus on a question, rather than discussion) but have I missed something regarding the use of the word women to refer to a single person? I have noted of late in reading news articles on respectable sites (like bbc news of all places, where one might expect them to be good with English) increasing occurrences of the word "women" when the context suggests one person. Example here:
"[...] let out hearty cheers and one women jumped to her feet, clapping her hands. The feeling in the auditorium was friendly."
or
"Those allegations involving hitting; one women claimed she’d been choked in the stairwell."
As two relatively recent examples. Did I miss something in connotative usage? Or is this somehow just becoming a common mistake that I hadn't noticed so much before?
| 4be82ec3c82bf5cafd6c0a803b78da04191176563e9f43671e34c0f427a203ee | ['b4b2eb1f2c2f4fc1ac25c40f24d76c2b'] | I have a confirmed booking from A to C via B.
In airport A I am checked-in and my luggage is tagged all the way to C. But I get only one boarding pass for the flight from A to B. The staff in airport A confirms that I will get my 2nd boarding pass in airport B at the gate of the flight B to C.
When I arrive to airport B I am not allowed to board on the aircraft flying to C as it is overbooked.
Has the airline the right to do so? what are the passenger rights?
Because of missing flight B to C, I will miss a flight booked to depart from C to a final destination. So I book a new ticket from airport B to the final destination. As a result I lose the ticket C-final destination and incur additional cost to purchase ticket B-final destination. Can I claim the additional expenses/costs from the airline?
|
791ab9f59d72a5b91ef1e114057f6ea054b6fe3f6baf34f7dd76b6c04baa2573 | ['b4b83d1210f74b0797627dbaf2c602ac'] | I also needed to have different colored markers, and making separate series for each color really the way to go for me, so i made this pointRenderer:
$.jqplot.PointRenderer = function(){
$.jqplot.LineRenderer.call(this);
};
$.jqplot.PointRenderer.prototype = Object.create($.jqplot.LineRenderer.prototype);
$.jqplot.PointRenderer.prototype.constructor = $.jqplot.PointRenderer;
// called with scope of a series
$.jqplot.PointRenderer.prototype.init = function(options, plot) {
options = options || {};
this.renderer.markerOptionsEditor = false;
$.jqplot.LineRenderer.prototype.init.apply(this, arguments);
this._type = 'point';
}
// called within scope of series.
$.jqplot.PointRenderer.prototype.draw = function(ctx, gd, options, plot) {
var i;
// get a copy of the options, so we don't modify the original object.
var opts = $.extend(true, {}, options);
var markerOptions = opts.markerOptions;
ctx.save();
if (gd.length) {
// draw the markers
for (i=0; i<gd.length; i++) {
if (gd[i][0] != null && gd[i][1] != null) {
if (this.renderer.markerOptionsEditor) {
markerOptions = $.extend(true, {}, opts.markerOptions);
markerOptions = this.renderer.markerOptionsEditor.call(plot, this.data[i], markerOptions);
}
this.markerRenderer.draw(gd[i][0], gd[i][1], ctx, markerOptions);
}
}
}
ctx.restore();
};
The draw function is a stripped down version of the LineRenderer draw function, add the missing pieces from that function.
| f9d4b311bf534c3eec3188b784052646c64dcc376af667b9f059d44274b0fe2a | ['b4b83d1210f74b0797627dbaf2c602ac'] | There are at least 3 ways to do this.
With validation groups, you define which set of rules to use for the validation. So as default you want to use all the rules, but in this action you indicate that only the contact info should be validated.
Create a new FormType and use this as a parent class for the TeacherType. In this new base class you place all the contact fields and then use this class in this action.
Create a new FormType and use the remove method to remove the unwanted fields. This is error prone, when you change the parent formtype, you need to also change this type.
|
451e3481b49b257432fe846ddc885edf35f8bbfb3f1ac05b0b3f29e1bbc1a964 | ['b4bdbebd4c3f487893096a46db384bfd'] | What is the default value of count? if count = -1;
int count = -1;
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.next:
count++;
image1.setImageResource(firstArray[count]);
image2.setImageResource(secondArray[count]);
image3.setImageResource(thirdArray[count]);
first.setText(first_tv[count]);
if (count == 0){
// forward.setVisibility(View.GONE); // for Hide the button
forward.setEnabled(false); // for not clickable
}
if count = 0;
int count = 0;
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.next:
if (count == 0){
// forward.setVisibility(View.GONE); // for Hide the button
forward.setEnabled(false); // for not clickable
}
count++;
image1.setImageResource(firstArray[count]);
image2.setImageResource(secondArray[count]);
image3.setImageResource(thirdArray[count]);
first.setText(first_tv[count]);
| 7db41071db08e40ed76aaf7340b097749d13d5f9a63262d4e3da685a8437f911 | ['b4bdbebd4c3f487893096a46db384bfd'] | You can Make a Single String and write it. Also, use a different separator. You can use StringBuffer for it.
StringBuffer s=new StringBuffer();
s.append(editname.getText().toString());
s.append("##@@##@@##");
s.append(editmarque.getText().toString());
s.append("##@@##@@##");
s.append(editlongueur.getText().toString());
s.append("##@@##@@##");
s.append(editlargeur.getText().toString());
s.append("##@@##@@##");
s.append(edittirant.getText().toString());
s.append("##@@##@@##");
s.append(editPort.getText().toString());
s.append("##@@##@@##");
s.append(editContact.getText().toString());
s.append("##@@##@@##");
s.append(editPanne.getText().toString());
s.append("##@@##@@##");
s.append(editPoste.getText().toString());
s.append("##@@##@@##");
s.append(editPolice.getText().toString());
s.append("##@@##@@##");
s.append(editAssurance.getText().toString());
s.append("##@@##@@##");
FileOutputStream fileOutputStream = null;
try {
file = getFilesDir();
fileOutputStream = openFileOutput("Code.txt", Context.MODE_PRIVATE); //MODE PRIVATE
fileOutputStream.write(s.toString().getBytes());
Toast.makeText(this, "Saved \n" + "Path --" + file + "\tCode.txt", Toast.LENGTH_SHORT).show();
editname.setText("");
editmarque.setText("");
editlargeur.setText("");
editlongueur.setText("");
edittirant.setText("");
editImmatriculation.setText("");
editPort.setText("");
editContact.setText("");
editPanne.setText("");
editPoste.setText("");
editPolice.setText("");
editAssurance.setText("");
return;
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
When you get FileInputStream split the String with this "##@@##@@##" vlaue
|
e3846603994b4f7a11111d20ab1fc0cc52704ce64b081e6ef16e7f52ee3f58c5 | ['b4c1eff026a24147bd50da5d965bf067'] | I am getting "not null constraint failed" exception for password field in my custom user model while registering a user through the browser(ModelForm) but I can add that user through django shell successfully. I've tried deleting database and migrations and re-doing it. Any idea why this is happening? I'd be really thankful for the help!
| da9219b26c3e04853d28058f763f4eaa36b7486985c5fe6728c6ebd52419ee63 | ['b4c1eff026a24147bd50da5d965bf067'] | I have a one to many and many to many relationship in my models. I'm using wtforms_alchemy ModelForm to create the forms, but the ForeignKey field is not showing up as a drop down field, also it's showing the integers as values in them. I tried referencing similar questions and tried the answers, like, I put __str__() as well as __repr__() functions in them so that they return some readable and meaningful string in the drop down but that didn't happen. Does anyone have any idea of how else can I do it?
Models.py-
class Product(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(20), nullable=False)
location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
def __init__(self, name, location=None):
self.name = name
if location:
self.location_id = location.id
def __repr__(self):
warehouse = Location.query.filter_by(id = self.location_id).first()
qty = warehouse.get_product_quantity(self.name)
return '{0}-{1}-{2}'.format(self.name, warehouse.name, qty)
class Location(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(20), unique=True, nullable=False)
products = db.relationship('Product', backref='warehouse')
def __init__(self, name):
self.name = name
def __repr__(self):
return 'Location-{0}'.format(self.name)
class Movement(db.Model):
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
from_location_id = db.Column(db.Integer, db.ForeignKey("location.id"))
to_location_id = db.Column(db.Integer, db.ForeignKey("location.id"))
from_location = db.relationship(Location, lazy='joined', foreign_keys=[from_location_id], backref='from_location')
to_location = db.relationship(Location, lazy='joined', foreign_keys=[to_location_id], backref='to_location')
product_id = db.Column(db.Integer, db.ForeignKey('product.id'))
product = db.relationship(Product, backref='movements')
qty = db.Column(db.Integer)
forms.py -
class ProductForm(ModelForm, Form):
class Meta:
model = Product
include = ['name']
class LocationForm(ModelForm, Form):
class Meta:
model = Location
include = ['name']
class MovementForm(ModelForm, Form):
class Meta:
model = Movement
include = ['from_location_id', 'to_location_id', 'product_id', 'qty']
|
2ff73b8c5ee78ce225b6593748bc14fd39b3af9e622578c80e6434ee29248ee5 | ['b4d9cdc120dc4d14ad1486bb95ea18ff'] | Let's look this code:
class customException extends Exception{}
$a;
try{
if(!$a)
throw new customException("Variable not initialize");
echo $a;
}
catch(customException $e){
echo $e->getMessage();
}
Catch block work and we get the error text on the screen, but if i change this catch(customException $e) on catch(Exception $e) it will be work...why? We throwed exception on class customException, why it will be work?
Explain me pls
| 554cef97763826ebc3c63ac670f5ab932721d1cdd59894570cc124ce780dc516 | ['b4d9cdc120dc4d14ad1486bb95ea18ff'] | The problem is that the first element to which I want to set its base length (which conditionally should be 100px) is somehow reduced.
.main{
display:flex;
flex-flow:row nowrap;
}
.item1{
flex:1 1 100px;
background:#979797;
}
.item2{
flex:1 1 auto;
background:#373737;
}
<div class="main">
<div class="item1">not 100px</div>
<div class="item2">Some text here Some text here Some text here Some text here Some text here Some text here Some text here Some text here Some text here Some text here Some text here </div>
<div>
As I found out that the flex-shrink property was to blame, if you change from 1 to 0 (for item1), then the first element will not participate in compression and it will retain its length, which was originally written to it. The question is why flex-shrink affects the first element if auto is written to the second element?
|
92ee257e05c7854f9d960a5b1567d51cbf2ecb7c0894b30a71568c0675e7eef3 | ['b4da96e0d07c4dcfbc2ede8659c2e805'] | I was fretting over this particular question which I found answered in the following link : https://math.stackexchange.com/a/1628972/817522 However now I have this notion that any sequence $T(x_n)$ will have the convergent 0(zero) subsequence. Then by characterization of compact operators should T be compact?
| d394f1570186d062adab05e72d75cef63b3eaecdb14a77ba82dfb04cef8d3677 | ['b4da96e0d07c4dcfbc2ede8659c2e805'] | I'm using apache commons exec for creating an external java process, which returns an exit code 1 occasionally. When I looked into the code of commons exec the issues doesn't seem to be related to apache commons exec rather to do with Runtime exec on java.
Here, I'm running a multithreading program which creates these processes. And I have tested the code by passing an idfier to external process to identify if the process got created by failed during processing. But for those threads which are failing while invoking the exex command doesn't seems be invoking the external java process as I don't find the failed process idfier in the log.
Any suggestions on what could be the potential cause for this would be very much appreciated.
|
e556156929044688a4be68434ce0327328d93356546e33c1aea8afb575f5739d | ['b4dd61e0a01048aeade35d9a1e712012'] | Thanks <PERSON>: re-installing did the trick! Probably it was because I had accidentally installed the 32 Bit instead of the 64 Bit version? Anyway, now with the 64 Bit the shortcuts are back.
And since I had just installed the system some days ago, I did not try to re-install. | aaec650bf5db484b1549bdcfc53b74db15a1141f5bef7ea21de75f0cf4311e78 | ['b4dd61e0a01048aeade35d9a1e712012'] | Пытаюсь в ручную собрать строку подключения для контекста используя известный пример:
var Builder = new SqlConnectionStringBuilder();
// Set the properties for the data source.
Builder.DataSource = "localhost";
Builder.InitialCatalog = "CustomerManager";
Builder.IntegratedSecurity = true;
Builder.UserID = "root";
Builder.Password = "111111";
// Initialize the EntityConnectionStringBuilder.
var EntityStringBuilder = new EntityConnectionStringBuilder();
//Set the provider name.
EntityStringBuilder.Provider = "MySql.Data.MySqlClient";
// Set the provider-specific connection string.
EntityStringBuilder.ProviderConnectionString = Builder.ToString();
// Set the Metadata location.
// EntityStringBuilder.Metadata = "res://*/";
//return the string now
CustomerManagerContext = new CustomerManagerContext(EntityStringBuilder.ToString());
Получаю ArgumentException с сообщением: Ключевое слово не поддерживается "provider".
Если строка подключения передается в контекст не через конструктор, а через файл конфигурации, то тогда все нормально работает, но нужна возможность задавать строку подключения в программе в ручную. Помогите с этим разобраться, вот файл конфигурации:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider></providers>
</entityFramework>
<connectionStrings>
<add name="conn" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;UserId=root;Password=111111;database=CustomerManager;CharSet=utf8;Persist Security Info=True" />
</connectionStrings>
|
620c6f2e23c2e4a87ed6d44da14c92c3d70d6475faa425cbf66e2b699fb15d0c | ['b4f8bfed3fb34e20ab8b30fe79594acc'] | You just have to place the function on keyup event of your query box
$(function() {
function numHits(n, h) {
var c, re = new RegExp(n, "g");
c = (h.match(re) || []).length;
return c;
}
$("#keyword-input").keyup(function(e) {
e.preventDefault();
$("#keyword-count").html(numHits($("#keyword-input").val(), $("#my-txt-area").val()));
});
});
| 7cb69265757fce29662ca8c2ced777da3cd709f85bf5e6420bbbf52ec6ed2a3f | ['b4f8bfed3fb34e20ab8b30fe79594acc'] | If you are open to put in some code here is a link which can convert an image, in your case the marker to a desired colour.
Codepen Link
'use strict';
class Color {
constructor(r, g, b) {
this.set(r, g, b);
}
toString() {
return `rgb(${Math.round(this.r)}, ${Math.round(this.g)}, ${Math.round(this.b)})`;
}
set(r, g, b) {
this.r = this.clamp(r);
this.g = this.clamp(g);
this.b = this.clamp(b);
}
hueRotate(angle = 0) {
angle = angle / 180 * Math.PI;
const sin = Math.sin(angle);
const cos = Math.cos(angle);
this.multiply([
0.213 + cos * 0.787 - sin * 0.213,
0.715 - cos * 0.715 - sin * 0.715,
0.072 - cos * 0.072 + sin * 0.928,
0.213 - cos * 0.213 + sin * 0.143,
0.715 + cos * 0.285 + sin * 0.140,
0.072 - cos * 0.072 - sin * 0.283,
0.213 - cos * 0.213 - sin * 0.787,
0.715 - cos * 0.715 + sin * 0.715,
0.072 + cos * 0.928 + sin * 0.072,
]);
}
grayscale(value = 1) {
this.multiply([
0.2126 + 0.7874 * (1 - value),
<PHONE_NUMBER> * (1 - value),
0.0722 - 0.0722 * (1 - value),
<PHONE_NUMBER> * (1 - value),
0.7152 + 0.2848 * (1 - value),
0.0722 - 0.0722 * (1 - value),
<PHONE_NUMBER> * (1 - value),
<PHONE_NUMBER> * (1 - value),
0.0722 + 0.9278 * (1 - value),
]);
}
sepia(value = 1) {
this.multiply([
0.393 + 0.607 * (1 - value),
0.769 - 0.769 * (1 - value),
0.189 - 0.189 * (1 - value),
<PHONE_NUMBER> * (1 - value),
0.686 + 0.314 * (1 - value),
<PHONE_NUMBER> * (1 - value),
<PHONE_NUMBER> * (1 - value),
<PHONE_NUMBER> * (1 - value),
0.131 + 0.869 * (1 - value),
]);
}
saturate(value = 1) {
this.multiply([
0.213 + 0.787 * value,
<PHONE_NUMBER> * value,
0.072 - 0.072 * value,
<PHONE_NUMBER> * value,
0.715 + 0.285 * value,
0.072 - 0.072 * value,
<PHONE_NUMBER> * value,
<PHONE_NUMBER> * value,
0.072 + 0.928 * value,
]);
}
multiply(matrix) {
const newR = this.clamp(this.r * matrix[0] + this.g * matrix[1] + this.b * matrix[2]);
const newG = this.clamp(this.r * matrix[3] + this.g * matrix[4] + this.b * matrix[5]);
const newB = this.clamp(this.r * matrix[6] + this.g * matrix[7] + this.b * matrix[8]);
this.r = newR;
this.g = newG;
this.b = newB;
}
brightness(value = 1) {
this.linear(value);
}
contrast(value = 1) {
this.linear(value, -(0.5 * value) + 0.5);
}
linear(slope = 1, intercept = 0) {
this.r = this.clamp(this.r * slope + intercept * 255);
this.g = this.clamp(this.g * slope + intercept * 255);
this.b = this.clamp(this.b * slope + intercept * 255);
}
invert(value = 1) {
this.r = this.clamp((value + this.r / 255 * (1 - 2 * value)) * 255);
this.g = this.clamp((value + this.g / 255 * (1 - 2 * value)) * 255);
this.b = this.clamp((value + this.b / 255 * (1 - 2 * value)) * 255);
}
hsl() {
// Code taken from https://stackoverflow.com/a/9493060/2688027, licensed under CC BY-SA.
const r = this.r / 255;
const g = this.g / 255;
const b = this.b / 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
let h, s, l = (max + min) / 2;
if (max === min) {
h = s = 0;
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
return {
h: h * 100,
s: s * 100,
l: l * 100,
};
}
clamp(value) {
if (value > 255) {
value = 255;
} else if (value < 0) {
value = 0;
}
return value;
}
}
class Solver {
constructor(target, baseColor) {
this.target = target;
this.targetHSL = target.hsl();
this.reusedColor = new Color(0, 0, 0);
}
solve() {
const result = this.solveNarrow(this.solveWide());
return {
values: result.values,
loss: result.loss,
filter: this.css(result.values),
};
}
solveWide() {
const A = 5;
const c = 15;
const a = [60, 180, 18000, 600, 1.2, 1.2];
let best = { loss: Infinity };
for (let i = 0; best.loss > 25 && i < 3; i++) {
const initial = [50, 20, 3750, 50, 100, 100];
const result = this.spsa(A, a, c, initial, 1000);
if (result.loss < best.loss) {
best = result;
}
}
return best;
}
solveNarrow(wide) {
const A = wide.loss;
const c = 2;
const A1 = A + 1;
const a = [0.25 * A1, 0.25 * A1, A1, 0.25 * A1, 0.2 * A1, 0.2 * A1];
return this.spsa(A, a, c, wide.values, 500);
}
spsa(A, a, c, values, iters) {
const alpha = 1;
const gamma = 0.16666666666666666;
let best = null;
let bestLoss = Infinity;
const deltas = new Array(6);
const highArgs = new Array(6);
const lowArgs = new Array(6);
for (let k = 0; k < iters; k++) {
const ck = c / Math.pow(k + 1, gamma);
for (let i = 0; i < 6; i++) {
deltas[i] = Math.random() > 0.5 ? 1 : -1;
highArgs[i] = values[i] + ck * deltas[i];
lowArgs[i] = values[i] - ck * deltas[i];
}
const lossDiff = this.loss(highArgs) - this.loss(lowArgs);
for (let i = 0; i < 6; i++) {
const g = lossDiff / (2 * ck) * deltas[i];
const ak = a[i] / Math.pow(A + k + 1, alpha);
values[i] = fix(values[i] - ak * g, i);
}
const loss = this.loss(values);
if (loss < bestLoss) {
best = values.slice(0);
bestLoss = loss;
}
}
return { values: best, loss: bestLoss };
function fix(value, idx) {
let max = 100;
if (idx === 2 /* saturate */) {
max = 7500;
} else if (idx === 4 /* brightness */ || idx === 5 /* contrast */) {
max = 200;
}
if (idx === 3 /* hue-rotate */) {
if (value > max) {
value %= max;
} else if (value < 0) {
value = max + value % max;
}
} else if (value < 0) {
value = 0;
} else if (value > max) {
value = max;
}
return value;
}
}
loss(filters) {
// Argument is array of percentages.
const color = this.reusedColor;
color.set(0, 0, 0);
color.invert(filters[0] / 100);
color.sepia(filters[1] / 100);
color.saturate(filters[2] / 100);
color.hueRotate(filters[3] * 3.6);
color.brightness(filters[4] / 100);
color.contrast(filters[5] / 100);
const colorHSL = color.hsl();
return (
Math.abs(color.r - this.target.r) +
Math.abs(color.g - this.target.g) +
Math.abs(color.b - this.target.b) +
Math.abs(colorHSL.h - this.targetHSL.h) +
Math.abs(colorHSL.s - this.targetHSL.s) +
Math.abs(colorHSL.l - this.targetHSL.l)
);
}
css(filters) {
function fmt(idx, multiplier = 1) {
return Math.round(filters[idx] * multiplier);
}
return `filter: invert(${fmt(0)}%) sepia(${fmt(1)}%) saturate(${fmt(2)}%) hue-rotate(${fmt(3, 3.6)}deg) brightness(${fmt(4)}%) contrast(${fmt(5)}%);`;
}
}
function hexToRgb(hex) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
return r + r + g + g + b + b;
});
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
]
: null;
}
$(document).ready(() => {
$('button.execute').click(() => {
const rgb = hexToRgb($('input.target').val());
if (rgb.length !== 3) {
alert('Invalid format!');
return;
}
const color = new Color(rgb[0], rgb[1], rgb[2]);
const solver = new Solver(color);
const result = solver.solve();
let lossMsg;
if (result.loss < 1) {
lossMsg = 'This is a perfect result.';
} else if (result.loss < 5) {
lossMsg = 'The is close enough.';
} else if (result.loss < 15) {
lossMsg = 'The color is somewhat off. Consider running it again.';
} else {
lossMsg = 'The color is extremely off. Run it again!';
}
$('.realPixel').css('background-color', color.toString());
$('.filterPixel').attr('style', result.filter);
$('.filterDetail').text(result.filter);
$('.lossDetail').html(`Loss: ${result.loss.toFixed(1)}. <b>${lossMsg}</b>`);
});
});
You can then send this filter output to CSS of your marker and it will change the colour of the image
|
f7733380d57106ef36eb9f5a39b3260b8c49b7aa59e8b083afa9907dd042cc67 | ['b505166f841247178bdf5e6d958b83b9'] | As the start date is a DateTime object, yes it is a reference and modifying it will change the value of the highseason's start date as well (since they are the same object).
In order to do what you are asking for, you need to clone the DateTime object:
$tempDate = clone $HSDate;
and increment the new date object instead.
| 80c8a2a9dc4a406410c2bfbc8fd045b0cf61f0e139074e8566b47ede7e29afcc | ['b505166f841247178bdf5e6d958b83b9'] | You need to escape the single quotes around property-gallery.
If you add a slash before each quote, it should work. e.g. data-uk-lightbox="{group:\'property-gallery\'}"
You also have two double quotes at the end of the <a> tag, so you should remove one of those as well.
|
70b7009d107c55daf126fff6eaa44d6abeb84b725650e54fe8046b733e1dc6d7 | ['b5107af7b789440d990c8c1ceed8784b'] | Yeah I find that in BusyBox there is a "rpm" command kind of package manager.I get gcc files with "wget" command then rpm them but Actually problem is executable gcc doesnt compile.For example I tried to laod OpenSSH , "./configure" finds gcc but doesnt compile. If I can work with gcc I can easily install make command and openssl.
I try to cross-compile it thanks.
| 765b1f1bc009964a87be72fa68dcaaf6768cc746219013845697922f81ee8269 | ['b5107af7b789440d990c8c1ceed8784b'] | I am using Samsung ARM Cortex A9 Exynos4412 board.I boot "linux + Qt" img on the board. But there is no package manager on the board and no make , gcc commands.In /bin file there is file BusyBox I searched it they say swiss army knife of embedded linux but there is no opkg , apt-get , make, gcc or g++ commands on the board.How can I set these commands to my linux board.
Thank for your help.
|
9d8ea5a322ada199952ba492a04a7264137f2aba22ead9c72265848f9b707ad5 | ['b5233c68315e40dc9028dad237458b74'] | Actually counting an empty array does not raise any exception. I think the problem is here:
- (void)add {
if(![field.text isEqualToString:@""])
{
[messages addObject:field.text];
[tbl reloadData];
NSUInteger index = [messages count] - 1;
[tbl scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
field.text = @"";
}
}
As the "-1" index cannot exist. You can edit that line to
NSUInteger index = MAX(0, [messages count] - 1);
And it should work.
| d839b5b393a9c19649caf05c06086970f2de358ab58ec947e42a83318e84647c | ['b5233c68315e40dc9028dad237458b74'] | I would just make a block comment with the name of all possible constants, and follow it with a single define. Who wants to compile just writes what he wants. First time he will check the comment to see the list, then he will just write.
Or even better, keep this list in a comment (for reference) and use the -D option that most compilers have (-DMASTER to define master for example) and if your tool supports it, make a build configuration for each where you change the -D value. Using a different build configuration i guess you could also change the output file name, so that would kill two birds with a stone.
|
a435f3efe958b2402d5512eb047ba569c183a9a0a4619fb159d1f7b00ec3a913 | ['b524c5683b7e431da08972890e82b08f'] | I am building a android application with two Activities utilizing the Action Bar (https://github.com/johannilsson/android-actionbar as i am targeting Android 2.2).
It has a number of activities. There is a "Home" Activity, called Feed, and another activity called "Settings".
The problem i am having is that using the createIntent function that is given in the sample for the action bar i am using, the Activity still get destroyed rather than resumed when the user taps the home button to return to the Feed activity.
With a bit of debugging i found that it is getting destroyed, not when the Activity is first paused and stopped, but when the request for it to resume happens.
public static Intent createIntent(Context context)
{
Intent i = new Intent(context, Feed.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
return i;
}
This is a major annoyance, and considerably slows down the application as it has to reload its data for the feed (which is cached, but its not instant to get the data reloaded).
So how can i avoid this behavior? and why is this happening, as i believe the extra flag there should stop this behavior.
| a21eb09494b9a0adea39f373be9ecce95f8ef1230f18a25340c3b863ff54e211 | ['b524c5683b7e431da08972890e82b08f'] | I have a custom TabItem with a close button(denoted by X) on it so it can be closed easily. In this tab i want to put a Image or Border Item, that is centered with the close button in the top left corner
The Control Template for this is
<ControlTemplate TargetType="{x:Type local:CloseableTabItem}">
<Grid SnapsToDevicePixels="true">
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" >
<DockPanel x:Name="ContentPanel">
<Button x:Name="PART_Close" Panel.ZIndex="1" HorizontalAlignment="Right" Margin="0,1,1,0" VerticalAlignment="Top" Width="16" Height="16" DockPanel.Dock="Right" Style="{DynamicResource CloseableTabItemButtonStyle}" ToolTip="Close Tab">
<Path x:Name="Path" Stretch="Fill" StrokeThickness="0.5" Stroke="#FF333333" Fill="#FF969696" Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z " HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Button>
<ContentPresenter Panel.ZIndex="0" x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
</DockPanel>
</Border>
</Grid>
(the control triggers have been removed)
And to insert the Border/Image into that Tab Header i use the following
<TabControl Margin="0" TabStripPlacement="Left">
<local:CloseableTabItem>
<local:CloseableTabItem.Header>
<Border Height="50" Width="50" Background="Red" BorderThickness="1" BorderBrush="Black" Margin="5" />
</local:CloseableTabItem.Header>
</local:CloseableTabItem>
</TabControl>
Using this i get the following Result:
alt text http://lloydsparkes.co.uk/files/CloseTab.png
It Seems the Button is limiting the width of the Border element, so it does not reach its full width that i set (it is set to 50x50 so should be a square). I have tried to put them onto different Z levels but it doesnt seem have worked as i expected.
So the question is, how can i make the button overlay the border control without the button affecting the size of the border control?
|
4cde9c1c7d665534f66abf21f2b74c119058c05c53f2d93387152577f6f25861 | ['b5276a14b79b4de488d85fb7269e8f29'] | Write exponents in LHS of ${3}^{x} {8}^{\frac{x}{x+1}} = 36$ in terms of a common base:
$${3}^{x} {8}^{\frac{x}{x+1}} = {e}^{\ln{3^x}} e^{\ln{{8}^{\frac{x}{x+1}}}} = {e}^{x \ln{3}} {e}^{\frac{{x} \ln{8}}{x+1}} = {e}^{x \ln{3}+\frac{x \ln{8}}{x+1}} = 36$$
Taking the natural log of both sides gives $x\ln{3} + \frac{x\ln{8}}{x+1} = \ln{36}$, and writing the LHS as a single fraction gives $$\frac{x\ln{8}+{x}^{2}\ln{3}+x\ln{3}}{x+1} = \ln{36}$$
By clearing fractions and bringing together like terms we get a quadratic in $x$:$$(\ln{3}){x}^{2}+(\ln{3}+\ln{8}-\ln{36})x-\ln{36} = 0$$
And after applying the quadratic formula we get the roots
$$x = \frac{-\ln{3}-\ln{8}+\ln{36}\pm\sqrt{{(\ln{3}+\ln{8}-\ln{36})}^{2}+4\ln{3}\ln{36}}}{2\ln{3}}$$
Which, after drastic simplification, reduce to the trivial root $2$ and the irrational root $-\frac{\ln{2}+\ln{3}}{\ln{3}}$.
Since there is one irrational root, your answer is $\boxed{1}$.
I realize there is probably a more efficient way to solve this problem, but I don't feel like thinking of one as of the moment.
| 26e5fcccb1b0b7805fcf7c0c16beec2bb61c435507da89ee2e48cfb264b06698 | ['b5276a14b79b4de488d85fb7269e8f29'] | It looks like the entirely expected result of voltage transients to me which ultimately are entirely expected observations given the physics of electrical circuits with varying loads. A detailed discussion of why this is an intrinsic property of electrical circuits would be more suited to https://physics.stackexchange.com but ultimately the speed of light is finite and the circuit has finite dimensions. |
ff4f89e97994c4c110ad33388ba78bba5dec06a73b8f1b8bd5770bc14eddb5e9 | ['b53067e106db471693f42818e81c2df6'] | I am using MAX144 ADC and in the Datasheet there is no information given about the control register to read the ADC values. I am using STM32L452RE micro-controller and using SPI to get data from ADC. Datasheet of the ADC is:
https://datasheets.maximintegrated.com/en/ds/MAX144-MAX145.pdf
anyone who encountered the same problem please guide.
my idea is to create a buffer of 2 bytes for SPI RX and store values in it. but i don't know what control register address should be assigned to it.
| 5c8f205cc9bdcecea564e01afb1f000abe227d66904209cc0d6c51d3cde16f82 | ['b53067e106db471693f42818e81c2df6'] | I have designed a circuit in which I am using STM32L452RETx micro-Controller on PCB. This is basically a current sensor. I am using JTAG-20 connector for debugging. I am using Atollic TrueStudio IDE.
The issue is when I debugg program in TrueStudio by selecting JTAG option in debug configuration then it gives error saying failed to initialize the ST-Link and target not found but when I Select SWD then there is no error and it programs successfully. where as in STM32CubeMx I have set debug to JTAG 5 pin configuration as i am using JTAG 20 in hardware. (serial peripheral-> Sys -> Debug-> Jtag 5 pin). program is debugging without errors but no output at the serial terminal. serial terminal gives no hand shake error.
Can anybody tell is this right way of debugging ( SWD in TrueStudion and JTAG in STM32CubeMx) or I am making a mistake.
Regards,
|
0733265f39f904c2e848b3873bf2f1a466c1f38ff2734b632ae5aa14e5de7a0b | ['b536ddd18a244039a7d446c50276cb6b'] | I'm struggling with this query in where I want to get values from 3 tables
SELECT
table1.cedtra as <PERSON>,
table1.priape as <PERSON>,
table1.segape as <PERSON>,
table1.prinom as <PERSON>,
table1.segnom as <PERSON>,
table2.cedcon as <PERSON>,
table2.ben as <PERSON>,
table3.priape as <PERSON>,
table3.segape as <PERSON>,
table3.prinom as <PERSON>,
table3.segnom as <PERSON>,
table3.fecnac as <PERSON>,
count(table1.cedtra) as numero
FROM table2, table1, table3
WHERE table2.id = table1.id
and table2.ben = table3.ben
and table2.doc = '12345'
and table2.codcit = '12345'
group by table1.cedtra, table2.ben, table1.cedtra, table1.priape, table1.segape, table1.prinom, table1.segnom, table3.priape, table3.segape, table3.prinom, table3.segnom, table3.fecnac
having count(table1.cedtra) > 3
I'm grouping by the fields that I select less the count as numero but this is throwing me this error:
ORA-00979: is not a expression GROUP BY
I try with the aliases but I get the same result.
Any advice would be aprecciated!
| 587a5c335d48d0338203c2b3b7ba28c79a1214e3953ec24f4ec39055a46882c1 | ['b536ddd18a244039a7d446c50276cb6b'] | You should create the ErrorConsole and passing result in the constructor and not in the function, so that way you can print object attributes:
error: (result) => {
console.log(result) //===> there is object
const err = new ErrorConsole(result)
addNewMessage("error", "Error");
err.error()
console.error("fail responseText: " + result.responseText)
console.error("fail contentstatusText : " + result.statusText)
console.error("fail status TEST: " + result.status)
}
|
20b58843494b8024375026b25399b6b353684ab43752aafe882f0e43d1c247e0 | ['b540e42e27d94a0ba20c87f12f8b727d'] | It's definitely clearer and I think I have got the idea now. It's a really good answer and serves me like an appendix to the paper :p. To put everything together I have tried to make my own example based on one in the paper. It's just to re-think through what I have read and see if I'm still OK :) I have edited question to add an example and my explanation of it :) | c7450da98d87058605572cdda804bacfd16064cfb7756aab490d6c53bff88bb9 | ['b540e42e27d94a0ba20c87f12f8b727d'] | Si lo que dices que tienes en la vista es una lista de objetos para pintarlos por <PERSON> habrás usado un array.
Yo actualmente en mi aplicación lo que hago es volver a llamar al servicio y pintar los datos actualizados.
Para ello es necesario que primero establezcas la longitud del array en el que almacenas la respuesta a 0. Y después introduzcas dichos resultados de nuevo en él.
toastr.success("Usuario creado correctamente.", "Exito !", opts);
$rootScope.currentModal.close();
this.reloadView();
}, function myError(response){
reloadView(): void{
this.arrayVista.length = 0;
this.recuperarUsuarios();
}
Y dentro de la función recuperarUsuarios() imagino que ya tendrás algo similar a
this.arrayVista = res
Yo es la única forma que he encontrado de conseguir lo que tu pides. De momento son pocos registros los que recupero por lo que la carga y el consumo de recursos no es gran cosa. No obstante cuando esto sea un problema simplemente con preparar el back para que permita paginación lo tendrías solventado.
|
4d664d7008aa4d7bb2e66eaab36e19699a8d24dfaeae338e3f118a64ba589da8 | ['b5433ae10c874e9db19b5a83d7c8a9f2'] | I am working with Opengl es to create a stickman and this might seem like a stupid question but when using quaternions to represent rotation what should I do if want the rotation to be around another point than the origin and should I use a unit quaternion or not.
my guess is I can rotate and then translate too change the centre of rotation and I'm not going to use unit quaternions. Is this the right path?
| 8800905f6149b5ba7b1b8ad6dea936d25407280ed8e172e87dbf71abe6b11f65 | ['b5433ae10c874e9db19b5a83d7c8a9f2'] | Thanks for the answers everyone, I've just bought an external disk to move the files that are most important to me and for Christmas I'll get a new hard drive. I think it's the optimal choice for now, as I figured I should act quickly.
I chose this method over creating a backup because I feel like I didn't take proper care of what I was installing and then forgetting to delete, so it's cleaner to do it this way.
|
f26bd501174db463615c20771edfd4187588d66f5dd93dfafa1257fc6cc056e3 | ['b558f416dbc241a4a81c328921eeee17'] | just to give the non-re approach (which should be much faster):
a = """585
00:59:59,237 --> 01:00:01,105
- It's all right. - He saw us!
586
01:00:01,139 --> 01:00:03,408
I heard you the first time."""
for i, x in enumerate(a.split('\n')):
m = i % 4
if m == 0:
continue
elif m == 3:
continue
elif m == 1:
print x[:x.find(":", x.find(":") + 1)],
elif m == 2:
print x
| 55915fc0fd55a5eb306a14ca2cdfe9e2baabc98cd014daee933090cfef97bf76 | ['b558f416dbc241a4a81c328921eeee17'] | It's not the perfect solution, but I don't have time to refine it now- just wanted to get you started with easy approach:
s = "I can do waaaaaaaaaaaaay better :DDDD!!!! I am sooooooooo exicted about it :))) Good !!"
re.sub(r'(.)(\1{2,})',r'\1/LNG',s)
>> 'I can do wa/LNGy better :D/LNG!/LNG I am so/LNG exicted about it :)/LNG Good !!'
|
d4dc2f793e4216e6aac124e1841be5a44e3a78429b6a447495fcd1344612e779 | ['b55d40198c7a450f90a2038a407fa3ce'] | I agree with <PERSON>, shove a live ubuntu CD into the windows box and test the exact same file downloads. Do them several times and make sure you delete the cache each time so your not using a cached version. That way hardware is the same and only OS is different | 864f1dda0e3abe821b1a372dc9d23e10f89f9d8431a51d986a70fcfde1c74f31 | ['b55d40198c7a450f90a2038a407fa3ce'] | Found the article, thanks for the info mate, I'll up vote you, and for the person asking the question, in case u want to risk an upgrade right now here is the computerworld post I found thanks to <PERSON>: http://www.computerworld.com/article/2948999/microsoft-windows/windows-10-final-download-now-before-release-date-rtm-build-10240-itbwcw.html |
696090ca8baa7f488f84b59279654845ae74ff1f5fd3b34c971b2edf79a1611a | ['b5653efb155d41c8ae3e8a6639c176c1'] | I upgraded my phone to Android 9/Pie and I can't stand the 'new improved' recent apps list which takes ages to scroll through.
My phone is Motorola G6.
What is the easiest and surefire way to get the old style (or some other style, e.g grid) back?
From what I've searched, it seems pretty complicated.
Either uninstalling the stock launcher using ADB - but I'm not sure if this makes a difference on my phone (people report it works on OnePlus, Pixels and Samsungs).
The other option I found is this https://forum.xda-developers.com/apps/magisk/module-quickswitch-universal-quickstep-t3884797/ but I have no clue where to start with that, and it's clearly stated this method does not work with Nova Launcher which I'm using.
I'm not afraid to mod the phone safely but if it's gonna take me a week to learn what to do exactly, I'll rather just revert to Android 8.
Thanks.
| 556f56b35831a7f1b1d494d66086531befa3fa28c540b86c646d48bbdd4acb1e | ['b5653efb155d41c8ae3e8a6639c176c1'] | This seems to work. I am still, however, seeing a repeat of output start after the last ip address in the file. Somewhere in the mid of the file there is an ip address of <IP_ADDRESS>. The repeart starts with that ip address and goes to the bottom again. Weird. |
059007642ec22ef3d7aeafcedfa130c722bf0b5a23a091b6050c586320af1b88 | ['b587f576f8914e6aa4b269f7f203134e'] | I am new to the esp32 and LoRa messaging.
I am following the two examples in the heltect esp32 lora library.
The two modules I am using to send and receive data have an oled display... and I print their values to the serial monitor. The data values appear on the oled display but they are random characters in the serial monitor like this... "⸮⸮3⸮⸮JS⸮⸮⸮⸮⸮J)⸮⸮".
My question is how can I receive data from the sender in string/float/integer like form so I can perform logic on them. I am new to c++ and lora so any help is welcome.
I am pretty sure this(the first code block directly below this paragraph) is the piece of code responsible for printing the received message, but it is not printing in any type of format I can work with even when I change the "char" dtype to String.
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
Receiver Code
/*
Check the new incoming messages, and print via serialin 115200 baud rate.
by <PERSON><PERSON> from HelTec AutoMation, ChengDu, China
成都惠利特自动化科技有限公司
www.heltec.cn
this project also realess in GitHub:
https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
*/
#include "heltec.h"
#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6
void setup() {
//WIFI Kit series V1 not support Vext control
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
Sender Code
/*
Basic test program, send date at the BAND you seted.
by <PERSON><PERSON> from HelTec AutoMation, ChengDu, China
成都惠利特自动化科技有限公司
www.heltec.cn
this project also realess in GitHub:
https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
*/
#include "heltec.h"
#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6
int counter = 0;
void setup() {
//WIFI Kit series V1 not support Vext control
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
/*
* LoRa.setTxPower(txPower,RFOUT_pin);
* txPower -- 0 ~ 20
* RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
* - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
* - RF_PACONFIG_PASELECT_RFO -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
*/
LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
digitalWrite(25, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(25, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
| 327375d3f0bb1c1434bab9d833bc428571ee30d1857466e9812435d80df65718 | ['b587f576f8914e6aa4b269f7f203134e'] | I am new to react and am trying to update the state/context of a component from a child component.
From the AuthProvider() below I can access the user state across the entire application.
If user is null, I am shown an auth page. Here I can login and call loginUser() which logs a user in on the server and returns with a refresh and access token and a username... stores the token in local storage and returns a user. Here is that function...
auth-provider.js
export function handleUserResponse(user) {
window.localStorage.setItem(localStorageKey, user.refresh_token)
return user
}
function login({email, password}) {
return client('/login', {email, password}).then(handleUserResponse)
//the client() function accepts an endpoint and user login info.
}
I am trying to update the state in AuthProvider.js from the login function which is called from a login page, so that I am redirected to the protected page once I the token is received. I need to set the user to the new updated user. I am new to react and know this is a common scenario, but if anyone has encountered this before I more than appreciate any help.
So far... I have only been able to access the user variable and not change it from the login page.
AuthProvider.js
const AuthContext = React.createContext();
export const getUser = () => auth.getToken().then((user) => ({ username:user}));
export const loginUser = (data) => auth.login(data).then((user) => ({ username:user }));
function AuthProvider({ children }) {
const [state, setState] = React.useState({
status: "pending",
error: null,
user: null,
token: null,
});
React.useEffect(() => {
getUser().then(
(user) => setState({ status: "success", error: null, user }),
(error) => setState({ status: "error", error, user: null })
);
}, []);
return (
<AuthContext.Provider value={state}>
{state.status === "pending" ? (
"Loading..."
) : state.status === "error" ? (
<div>
Oh no
<div>
<pre>{state.error.message}</pre>
</div>
</div>
) : (
children
)}
</AuthContext.Provider>
);
}
export default { AuthProvider, AuthContext };
Home.js --where either the authenticated or unathenticated version of the app is rendered
import useAuthState from '../UseAuthState'
function Home() {
const { user } = useAuthState();
return user.username ? <AuthenticatedApp /> : <UnauthenticatedApp />;
}
export default Home;
UseAuthState.js --this returns state data
import React from 'react';
import AuthContext from './AuthProvider'
function useAuthState() {
const state = React.useContext(AuthContext.AuthContext);
const isPending = state.status === "pending";
const isError = state.status === "error";
const isSuccess = state.status === "success";
const isAuthenticated = state.user && isSuccess;
return {
...state,
isPending,
isError,
isSuccess,
isAuthenticated,
};
}
export default useAuthState;
|
928fff54320e91285ca8735597d3d4fcd27b4467abadd63be5ae48c51df51afd | ['b593cf3a1ef2446cac70e4daa40e16a7'] | Using the example route defined below how can a link be defined to /post/123/comments?
Router.map(function() {
this.route('post', { path: '/post/:post_id' }, function() {
this.route('edit');
this.route('comments', { resetNamespace: true }, function() {
this.route('new');
});
});
});
Since resetNamespace: true is set on comments, the route post.comments does not exist. Otherwise the following would work.
{{#link-to "post.comments" "123"}}Link{{/link-to}}
| 2637ec6fcc3a15b2c1c0b355f1aa20e75d896d8c70498113d7d506d59cef900f | ['b593cf3a1ef2446cac70e4daa40e16a7'] | Thanks to locks for pointing me in the direction. The specific issue is how to reuse as much of the route and template as possible for different paths.
router.js:
Router.map(function() {
this.route('post', { path: '/post/:post_id' }, function() {
this.route('edit');
this.route('comments', function() {
this.route('new');
});
});
this.route('comments');
});
routes/post/comments.js:
import Comments from '../comments';
export default Comments.extend({
renderTemplate() {
this.render('comments');
}
});
This will extend the existing comments route to reuse the model and actions defined in the base route. The renderTemplate is still necessary to load the comments template instead of the post.comments template.
|
e913903e8a6054cacb66a7e852e0358e1269f8ea692463b663741cf686669aa2 | ['b59810c8275d4846b6c4d5fb1e7b594d'] | Abre a janela de exceção apontando para o método db.SaveChanges(); Na ActionResult Create() , quando vou cadastrar os dados da classe Curso com a seguinte mensagem: DbUpdateException was unhandled by user codeAn exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code Additional information: An error occurred while updating the entries. See the inner exception for details | b543effe045f8927936e9483b3d9c2ca6d43540ba12d887da7011a3bd44a0ef6 | ['b59810c8275d4846b6c4d5fb1e7b594d'] | @SGR "By only having two, one to have power and one to crave it, the Sith would be stronger against the Jedi as they are **less vulnerable to being wiped out** " How so? If there are only two of them, they could be wiped out by a mundane engine malfunction while on the same ship, let alone a small group of competent jedi. |
19bc33359d8df2f42c71c925db6fbc4ecc5dbc66bbb7ae30d070103eb70685ba | ['b59b33602e3b43f0b6881e4cb6c9ab42'] | <PERSON> I am not an economist either but I know that this is not necesarily true. It depends on several factors. Two important ones are cost pr unit - Due to economy of scale this will tend to go up as volume goes down, and consumer response - while demand can be expected to go down with rising price this needs not be a linear relationship. | 87d2e75251e0426a979dc7800d126903d55d4461058a5fc6f3c3ff088083e968 | ['b59b33602e3b43f0b6881e4cb6c9ab42'] | @l0b0 "You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it." - This seems to contradict your claim regarding publication. |
e4481d34921d1284e53e19e1fd96761ecdbcf61e00c1c6f647fd7e022fcce695 | ['b5a1f1e17aca49a593839f68be84d395'] | You can load the class with the GroovyShell classloader:
GroovyShell gs = new GroovyShell()
gs.loader.loadClass('groovy.runtime.metaclass.java.lang.IntegerMetaClass')
gs.evaluate("10.minutes")
Note: I got a java.lang.IncompatibleClassChangeError when IntegerMetaClass was a groovy file but no issues when it was java. That could just be related to my environment setup
| 915074e5890387469e4f541f9526c5a3d1b43ee4895398a2ceac756eb6eddc9d | ['b5a1f1e17aca49a593839f68be84d395'] | There is a good example here that shows how to implement a custom user details mapper. I used that method on an LDAP login Grails 2.0 app successfully. Basically you have a CustomUserDetailsContextMapper that implements the UserDetailsContextMapper interface which you then use to override the default implementation by registering the bean in conf>spring>resources.groovy. Then inside your CustomUserDetailsContextMapper you check for a user(your domain class) with a matching username and if none exists you creates one using data from the ctx.originalAttrs which contains data from the ldap query results. You must then return a new org.springframework.security.core.userdetails.User. You can extend this class to add other fields that you want to be able to access directly from the principal object.
|
917bfbd3e34ff29069550e24ae9b474e9cbf6470025094a38739ece21d9e2c93 | ['b5b1c143ad1943908a58e44aee4046f5'] | I am currently trying to program a small app, now I am trying to use a Navigation Drawer in my app. This does not work with the reason that I get a NPE at drawer.addDrawerListener(toggle);. Everything else seems to be fine as far as I can say and the app worked correctly till adding the drawer. Thx in advance.
import android.content.Intent;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import de.nocompany.gotthold.gw2companion.Tools.GwApiAccess;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout drawer;
private Toolbar toolbar;
private ActionBarDrawerToggle toggle;
private NavigationView navigationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
toolbar = (Toolbar) findViewById(R.id.toolbar);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
setSupportActionBar(toolbar);
setContentView(R.layout.activity_main);
toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
//getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
//getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
drawer.addDrawerListener(toggle);
navigationView.setNavigationItemSelectedListener(this);
ConnectivityManager connMgr = (ConnectivityManager) this.getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
View navHeader = navigationView.getHeaderView(0);
if (networkInfo != null && networkInfo.isConnected()) {
TextView connectionStatus = (TextView) navHeader.findViewById(R.id.connection_status);
connectionStatus.setText(R.string.common_online);
} else {
TextView connectionStatus = (TextView) navHeader.findViewById(R.id.connection_status);
connectionStatus.setText(R.string.common_offline);
}
toggle.syncState();
GwApiAccess gwApiAccess = new GwApiAccess(this,"https://api.guildwars2.com/v2/items/30704?lang=de");
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
toggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
toggle.onConfigurationChanged(newConfig);
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// If the nav drawer is open, hide action items related to the content view
boolean drawerOpen = drawer.isDrawerOpen(GravityCompat.START);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
//int id = item.getItemId();
//noinspection SimplifiableIfStatement
//if (id == R.id.action_settings) {
// return true;
//}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_profile) {
Intent intent = new Intent(this,profile.class);
startActivity(intent);
} else if (id == R.id.nav_itemDB) {
Intent intent = new Intent(this,items.class);
startActivity(intent);
} else if (id == R.id.nav_guilds) {
Intent intent = new Intent(this,guilds.class);
startActivity(intent);
} else if (id == R.id.nav_maps) {
Intent intent = new Intent(this,map.class);
startActivity (intent);
} else if (id == R.id.settings) {
Intent intent = new Intent(this,SettingsActivity.class);
startActivity (intent);
}
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| 5e0090ef23dc6764730d5d0e998a65b06d02cf65cc41374920b04ca1f22e185e | ['b5b1c143ad1943908a58e44aee4046f5'] | I need an answer for work, so the software will not ever go into a public environment. It will be located in a seperate intranet without any access to the internet. I wrote this to address your security concerns.
I have a C# programm which has a custom protocol. This results in a clickable link on a website with this protocol. I have the task to supress the warning popups for launching external popups. Under the location in the headline you can place Key-Value pairs to do so. My problem is that I can't figure out how to generate the guid for the Subkey under which the Key-Value-Pairs are located. The Keys registry will be edited at installation, not in the C# programm. If it is needed, I could also edit the registry with the C# program, but that is not prefered.
Thanks for your efforts,
SchoolGuy
|
c7c452e55c0d95693bcabe9161ff3ef3444284ff58a5185d71af58a7e36af299 | ['b5c9b8510e4040ae929a01f00421b383'] |
Layout 0 shows how I can achieve this layout with a simplified view of the css.
I need help / suggestions / ideas on how to created layouts 1 and 2.
The blocks can be rendered in any order and they are fixed width (either 25% or 50% respectively - as in layout 0)...spanner in the works is they dont have a predefined height.
I would much prefer a css only solution each layout will have its own parent/container div so if positioning is best for one row and floating better for another then so be it.
Answers on a postcard... thanks all
P.S. can I avoid answers that refer me to js librarys like http://masonry.desandro.com/ for example...
| 297a98d75ac2e41c759b64c70d88bc4eeef0a7459ac379ff0066089a5db68814 | ['b5c9b8510e4040ae929a01f00421b383'] | If you are using "border-radius" - which is a css3 property, then you could also use "background-clip" which effectively sets the background clipping.
There are three available values for this property are:
border-box, content-box or padding-box
I think you will find the one you are looking to use content-box (as below).
#header {background-clipping:content-box}
There is a great article on css tricks take a look. Worth a bookmark too, it is a great source of information to help grow your css / html knowledge.
|
f9f1cbba4623ecfaa5636ebcd925d8d870413aa3a550d5f8056f866e7fc1aa15 | ['b5dd1740631e4122acbb16cc4c3f5fb9'] | Authentication problem are never fun...
First check which account the two failing jobb are running as. (SQL
Server Manager studio => SQL Server Agent => properties on the job
Backup BizTalk Server (BizTalkMgmtDb))
Verify that the credentials that the service account is using are correct.
If the service account is a domain account, verify that the SQL can
access the domain controller.
Verify that MSDTC are running (the job uses DTC transactions to
execute, and errors from MSDTC usually don’t say DTC problem, it
sometimes says Authentication error)
Check history on the failing job, and see if you can get some more information about the authentication error.
Check history on the failing job and see when it last run successfully. Then check the event log at this time, and see if there are any clues to what has changed.
| 9baa6454a4672d44ba472ea4e6cb52783cf591cf4273c4b80cc4e31cb71dd971 | ['b5dd1740631e4122acbb16cc4c3f5fb9'] | The easy way is to use the BizTalk WCF Service Consuming Wizard to generate schema and binding information for the port (that you asked for). This is done from a locally saved wsdl or directly if there is a MEX point exposed.
A guide can be found at:
http://msdn.microsoft.com/en-us/library/bb226552.aspx
For detailed information about the WCF adapters in 2010 can be found at:
http://msdn.microsoft.com/en-us/library/bb259952.aspx
|
06fc03b5aaeb1340671b966a55d1b3e7595bcd7761b8f330d86cdd5684b35c8d | ['b5fc4f1b75684e0fb9579f325b338a3b'] | Problem:
I'd like to create regular backups of a docker volume used by a running docker container.
Partial solutions:
If I shut down the container using the volume, I found these solutions:
Save to .tar like:
docker run --rm -v some_volume:/volume -v /tmp:/backup alpine tar -cjf
/backup/some_archive.tar.bz2 -C /volume ./
(Source: https://medium.com/@loomchild/backup-restore-docker-named-volumes-350397b8e362)
Stackoverflow solution:
How can I backup a Docker-container with its data-volumes?
Question:
Using either docker or also docker-compose, how do I backup a volume, without any downtime of the app container using the volume?
| 7891eda20965e25c736d0ebebc639753854572e1c2b072bea40e5d5f8ff7dea2 | ['b5fc4f1b75684e0fb9579f325b338a3b'] | I'm not quite sure if I understand your goal correctly.
If it's about merging the two data frames you can do something like:
df_one.merge(df_two, on=['name'], how='outer')
If it is about initiating an object by e.g. the name only you could pass that into def __init__(self, name): and then collect the rest from the existing data frames (e.g. some_row = df_one.loc[df_one['name'] == 'methane']).
|
abb0a667085290dacc7cd1f24c3657d2ea6a5aaf1446abb4b9a85d58655362b1 | ['b607a70efa8e42a0b810f7fa079c97a2'] | I have an overlay view to segregate content, I'm checking for authentication in viewWillAppear() and I have a Notification subscribed to my Auth method. If I authenticate before any of my other views appear the overlay does not show up, however it does on the first view and will not go away even after calling removeFromSuperView().
import UIKit
import FirebaseAuth
class ProtectedViewController: UIViewController, ForceSignInBannerDelegate,
SignUpViewControllerDelegate, LoginViewControllerDelegate{
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
NotificationCenter.default.addObserver(self, selector: #selector(checkAuthentication), name: .myNotification, object: nil)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
self.checkAuthentication()
}
func checkAuthentication() {
let bannerViewController = ForceSignInBanner.instanceFromNib() as! ForceSignInBanner
bannerViewController.delegate = self
if (!AuthenticationService.sharedInstance.isAuthenticated()) {
self.setView(view: bannerViewController, hidden: false)
print("Need to login")
} else if(AuthenticationService.sharedInstance.isAuthenticated()) {
self.setView(view: bannerViewController, hidden: true)
}
}
func setView(view: UIView, hidden: Bool) {
UIView.transition(with: view, duration: 0.5, options: .transitionCrossDissolve, animations: { _ in
view.isHidden = hidden
if hidden {
view.removeFromSuperview()
} else {
self.view.addSubview(view)
}
}, completion: nil)
}
| 0e54655db86dd4c4bb6a16827e1ade706efe218ffc13bb8dcd90f08f2818e824 | ['b607a70efa8e42a0b810f7fa079c97a2'] | I am pulling down a json stream? From a phant server I can pull the data down parse it and print it in xcode. I need to pull out specific values but the json does not have a title and I can not seem to figure it out.
My JSON Data
(
{
lat = "36.123450";
long = "-97.123459";
timestamp = "2017-04-26T05:55:15.106Z";
},
My Current Code in Swift
let url = URL(string: "https://data.sparkfun.com/output/5JDdvbVgx6urREAVgKOM.json")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
if error != nil {
print("error")
} else {
if let content = data {
do {
// JSONArray
let myJson = try JSONSerialization.jsonObject(with: content, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
print(myJson)
let Coordinates = myJson["lat"] as! [[String:Any]]
print(Coordinates)
} catch {
}
}
}
}
task.resume()
}
|
f2d6282988792b5af122fa59a30877aba67506244c7741af7f5926acb05141ea | ['b60ec4eb8ee143e3bbdf8134113c0690'] | I have setup my test Exchange server on Azure VM, but now I want to use it for my production and want to move it to a different Azure account.
I cannot generalize my VM as it contains Active Directory which doesn't support generalizing.(I have tried generalizing but VM didn't boot up).
So I migrated without generalizing and with this I was able to RDP into VM but Azure showing the following error.
"guest OS has not been properly prepared to be used as a VM image".
Can anyone please help me!
| 70c4732a5fec2c809a2eff876102424165c9277d4da446ff9b867d72de814911 | ['b60ec4eb8ee143e3bbdf8134113c0690'] | Following the below link, I was able to create an Azure VMSS with customs VHD which supported load balancing and autoscaling.
Updating VHD of Azure VM ScaleSet
But using the above link, I had to create a new VM in the same VNET in order to RDP into VM inside VMSS.
Are there any way where I can RDP into VM inside VMSS directly ?
|
caba0cdec05fffe400f941cee4406cd6644827dc3c3d52bef7abd67277a5ce80 | ['b6113bf88ae74ab6938fbffc54ebbcec'] | am working on a c# project in vs 2010 ultimate, that requires one to filter results of a report. My challange is getting a report to filter based on a value in a textbox or combobox on a form. And if the value is null or empty then the report should return all the results.
I have tried to use parameters but looks like am not getting results to show. On the form there is a report viewer, a combobox that selects a particular report and a textbox that a user enters a value to be filtered, as well there are two date-pickers From-Date and To-Date;
I have even added the parameters to the report, every thing seems to work but the report returns no results. Below is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
namespace clinicmis
{
public partial class AllReports : Form
{
//private string xSQL;
private string str = "";
private string FromDate;
private string ToDate;
private string rptName = "";
ReportDataSource dsClinic;
ReportParameter paramRegNo, paramFromDate, paramToDate;
ReportParameterInfoCollection paramInfo;
public AllReports()
{
InitializeComponent();
}
#region "Global Declaration"
String rptpath = Application.StartupPath;
#endregion
private void AllReports_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'clinicmisDataSet.qryRequisitions' table. You can move, or remove it, as needed.
this.qryRequisitionsTableAdapter.Fill(this.clinicmisDataSet.qryRequisitions);
// TODO: This line of code loads data into the 'clinicmisDataSet.suppliers' table. You can move, or remove it, as needed.
this.suppliersTableAdapter.Fill(this.clinicmisDataSet.suppliers);
// TODO: This line of code loads data into the 'clinicmisDataSet.qryAccountsPhReceipt' table. You can move, or remove it, as needed.
this.qryAccountsPhReceiptTableAdapter.Fill(this.clinicmisDataSet.qryAccountsPhReceipt);
// TODO: This line of code loads data into the 'clinicmisDataSet.patients' table. You can move, or remove it, as needed.
this.patientsTableAdapter.Fill(this.clinicmisDataSet.patients);
// TODO: This line of code loads data into the 'clinicmisDataSet.labtests' table. You can move, or remove it, as needed.
this.labtestsTableAdapter.Fill(this.clinicmisDataSet.labtests);
// TODO: This line of code loads data into the 'clinicmisDataSet.qryStock' table. You can move, or remove it, as needed.
this.qryStock.Fill(this.clinicmisDataSet.qryStock);
// TODO: This line of code loads data into the 'clinicmisDataSet.qryOrders' table. You can move, or remove it, as needed.
this.qryOrdersTableAdapter.Fill(this.clinicmisDataSet.qryOrders);
// TODO: This line of code loads data into the 'clinicmisDataSet.qryDeliveries' table. You can move, or remove it, as needed.
this.qryDeliveriesTableAdapter.Fill(this.clinicmisDataSet.qryDeliveries);
// TODO: This line of code loads data into the 'clinicmisDataSet.drugs' table. You can move, or remove it, as needed.
this.drugsTableAdapter.Fill(this.clinicmisDataSet.drugs);
// TODO: This line of code loads data into the 'clinicmisDataSet.qryPatientsLabTestResults' table. You can move, or remove it, as needed.
this.qryPatientsLabTestResultsTableAdapter.Fill(this.clinicmisDataSet.qryPatientsLabTestResults);
cboReports.Items.Add("Patients");
cboReports.Items.Add("Patients Results");
cboReports.Items.Add("Lab Tests");
cboReports.Items.Add("List Of Drugs");
cboReports.Items.Add("Drugs Stock");
cboReports.Items.Add("Drug Orders");
cboReports.Items.Add("Drug Deliveries");
cboReports.Items.Add("Drug Requisitions");
cboReports.Items.Add("List Of Suppliers");
reportViewer1.ProcessingMode = ProcessingMode.Local;
}
private void btnShow_Click(object sender, EventArgs e)
{
if (cboReports.Text == string.Empty)
{
MessageBox.Show("Please Select a Report you wish to Preview", "Select a Report");
}
else
{
//reportViewer1.LocalReport.DataSources.Clear();
List<ReportParameter> paramList = new List<ReportParameter>();
//paramList.Clear();
str = txtRegNo.Text;
FromDate = dtFrom.Text;
ToDate = dtTo.Text;
paramRegNo = new ReportParameter("RegFNo", str, false);
paramFromDate = new ReportParameter("FromDate", FromDate, false);
paramToDate = new ReportParameter("ToDate", ToDate, false);
switch (cboReports.SelectedIndex)
{
case 0:
paramList.Add(paramRegNo);
paramList.Add(paramFromDate);
paramList.Add(paramToDate);
rptName = rptpath + "\\" + "Report2.rdlc";
// TODO: This line of code loads data into the 'clinicmisDataSet.accountsfrontdeskreceipts' table. You can move, or remove it, as needed.
this.accountsfrontdeskreceiptsTableAdapter.Fill(this.clinicmisDataSet.accountsfrontdeskreceipts);
dsClinic = new ReportDataSource("ClinicDataSet", accountsfrontdeskreceiptsBindingSource);
break;
case 1:
paramList.Add(paramRegNo);
paramList.Add(paramFromDate);
paramList.Add(paramToDate);
rptName = rptpath + "\\" + "ReptPatientsLabResults.rdlc";
dsClinic = new ReportDataSource("DataSet1", qryPatientsLabTestResultsBindingSource);
break;
case 2:
dsClinic = new ReportDataSource("dsLabTests", labtestsBindingSource);
rptName = rptpath + "\\" + "ReptLabTests.rdlc";
break;
case 3:
dsClinic = new ReportDataSource("dsDrugs", drugsBindingSource);
rptName = rptpath + "\\" + "ReptDrugs.rdlc";
break;
case 4:
dsClinic = new ReportDataSource("dsDrugsStock", qryStockBindingSource);
rptName = rptpath + "\\" + "ReptDrugsStock.rdlc";
break;
case 5:
dsClinic = new ReportDataSource("dsDrugsOrders", qryOrdersBindingSource);
rptName = rptpath + "\\" + "ReptDrugsOrders.rdlc";
break;
case 6:
dsClinic = new ReportDataSource("dsDrugsDeliveries", qryDeliveriesBindingSource);
rptName = rptpath + "\\" + "ReptDrugsDeliveries.rdlc";
break;
case 7:
dsClinic = new ReportDataSource("dsDrugsRequisitions", qryRequisitionsBindingSource);
rptName = rptpath + "\\" + "ReptDrugsRequisitions.rdlc";
break;
case 8:
dsClinic = new ReportDataSource("dsSuppliers", suppliersBindingSource);
rptName = rptpath + "\\" + "ReptSuppliers.rdlc";
break;
}
reportViewer1.LocalReport.ReportPath = rptName;
paramInfo = reportViewer1.LocalReport.GetParameters();
if (paramList.Count == 0)
{
// Console.WriteLine("<No parameters are defined for this report>");
}
else
{
reportViewer1.LocalReport.SetParameters(paramList);
}
//reportViewer1.LocalReport.SetParameters(paramList);
reportViewer1.LocalReport.DataSources.Add(dsClinic);
this.reportViewer1.RefreshReport();
}
}
private void btnClose_Click(object sender, EventArgs e)
{
Close();
}
}
}
Any one have a solution this situation
| 25b1e2b17abbaa23835558d759e1743e5b3c2cc4d5c152b9f0dbb548dce5e827 | ['b6113bf88ae74ab6938fbffc54ebbcec'] | I had the same problem while using vs 2010 Professional. But I managed to find the answer to that problem. It's simple vs checks to which report to assign the parameter and finds none so it throws the error. what you need to do is to load the report and then set the parameters.
Use the order as follows;
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("parameterName1", Parameter1Value));
parameters.Add(new ReportParameter("parameterName2", Parameter2Value));
// Specify the report to load
ReportViewer1.LocalReport.ReportPath = YourReportPath;
// Set parameters to the specified report
ReportViewer1.LocalReport.SetParameters(parameters);
// Load the report
this.ReportViewer1.RefreshReport();
|
3218b0d59f56556a304f1629497ca6ba8666f0708bf70e1cf4f12ec55eb63fd2 | ['b6207d8c1ec84d748c7b7df24ca9c458'] | One question. Earth being massive barely moves under the gravitational influence of the particle. The field is radial and static. What if I have two identical particles? Their motion will be significant and we will have moving gravitational fields. For this isolated two-particle system, how will we go about calculating its potential energy? | f0fa672117d95cdc3d09894b9f3ba618b655364585736a3773d5cdc40b44656b | ['b6207d8c1ec84d748c7b7df24ca9c458'] | Let us consider the equation, $\vec{a} = \vec{v}\frac{d\vec{v}}{d\vec{x}} \tag{3}$. Here, why have you not considered any rules of vector multiplication between $\vec{v}$ and $\frac{d\vec{v}}{d\vec{x}} \tag{3}$? Also, the ratio of the two differentials suggests division of two vectors, does it not? |
7203096a9f5a620c8bc8239f0e1f1d84ba81233cf0b8ed8b811ac93fa8b012f9 | ['b665d3d8493e4692b37e5533660ee2e9'] | I am building a log-log least squares dummy variable model to estimate product demand elasticities based on a kMeans clustering mechanism (5 total clusters). The model also has other independent variables but aren't relevant to the question. The clusters are based on groups of similar prices. When I have worked with dummy variables previously, it was important to never include all n dummies, otherwise the model wasn't of full rank. In this case, I need coefficients for all cluster price terms (Ln.Price.Cluster1...n). Is there a way to get the full n coefficients using dummy variables?
| ec4eb9d6067f3d3750f223973b32011ddd42b242cb6994a9b54bc88c6055d02a | ['b665d3d8493e4692b37e5533660ee2e9'] | I'm trying to retrieve stock prices with the following code using quantmod. The code below allows me to retrieve what I need. However, when I export the CSV file, the date column (first column) appears only as a sequence of numbers. To be clear, it's fine in R when I open a data frame, but changes when exported.
from.dat <- as.Date("01/01/12", format="%m/%d/%y")
to.dat <- as.Date("12/31/17", format="%m/%d/%y")
getSymbols("GOOG", src="yahoo", from = from.dat, to = to.dat)
write.csv(GOOG, file = "Googletest.csv", row.names = TRUE)
Any ideas how to get the code to include a date? - <PERSON> |
c555abe213e658284e3137bb4c137456db84885cc8c3895464c92d18119ccf3b | ['b66c2fdfec5541c68e8f73b0bdd5d740'] | how to develop a crop selection control like photoshop's in c# 4.0 in widows form application.
I have a windows form application in c# 4.0 that can crop images. At first you have to draw a rectangle using mouse to select the cropped region.
private Point _pt;
private Point _pt2;
private void picBoxImageProcessing_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int ix = (int)(e.X / _zoom);
int iy = (int)(e.Y / _zoom);
//reset _pt2
_pt2 = new Point(0, 0);
_pt = new Point(ix, iy);
// pictureBox1.Invalidate();
picBoxImageProcessing.Invalidate();
}
}
private void picBoxImageProcessing_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && _selecting)
{
_selecting = false;
}
}
private void picBoxImageProcessing_Paint(object sender, PaintEventArgs e)
{
if (_selecting &&_pt.X >= 0 && _pt.Y >= 0 && _pt2.X >= 0 && _pt2.Y >= 0)
{
e.Graphics.DrawRectangle(pen, _pt.X * _zoom, _pt.Y * _zoom,
(_pt2.X - _pt.X) * _zoom, (_pt2.Y - _pt.Y) * _zoom);
}
}
private void picBoxImageProcessing_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
_selecting = true;
int ix = (int)(e.X / _zoom);
int iy = (int)(e.Y / _zoom);
_pt2 = new Point(ix, iy);
// pictureBox1.Invalidate();
picBoxImageProcessing.Invalidate();
}
}
there is no problem to draw the rectangle by mouse dragging. But if i want to change the height or width of the rectangle then I have to draw a new rectangle, that i don't want. I want to change the height and width of the rectangle by modifying the drawn rectangle instead of drawing a new rectangle.
I don’t want to know how to crop. I need to draw a resizable rectangle on the image as we can do in photoshop.
So I need a crop selection control like photoshop's crop control.
| 1e88bf506a24cf81d0dc4f127b5f7ad482e3afb9f3d382c70508290929f2a3b8 | ['b66c2fdfec5541c68e8f73b0bdd5d740'] | I want to save and show an image into blob field in oracle 10g using grails. If i use Long raw field in database then it works. But in case of blob field
it saves but doesn't show in the view page.
Here is the code:
//Domain
class Hotel{
byte [] pic_
static mapping={}
static constraints = {}
}
//Controller
Class contrl
{
def save() {
def hotelInstance = new Hotel(params)
if (!hotelInstance.save(flush: true)) {
render(view: "create", model: [hotelInstance: hotelInstance])
return
}
flash.message = message(code: 'default.created.message', args: [message(code: 'hotel.label', default: 'Hotel'), hotelInstance.id])
redirect(action: "show", id: hotelInstance.id)
}
}
def displayLogo () {
def sponsor = Hotel.get(params.id)
response.contentType = "image/jpg"
response.contentLength = sponsor?.pic_.length
response.outputStream.write(sponsor?.pic_)
response.outputStream.flush()
}
//View
<td><img src="${createLink(action:'displayLogo ', id:hotelInstance?.id)}" height="42" width="42" /> </td>
|
855643b1257fa26d6a97c7373c14d494015e3d04d850fead91f0f5d0e76652c7 | ['b67bf12c4f804f539c2b8c63c6a97eb5'] | class Player {
final String playerName;
final int playerValue;
Player({this.playerName, this.playerValue});
static List<Player> pairPlayers() {
final List<Player> playersList = [
Player(playerName: '<PERSON>', playerValue: 20),
Player(playerName: '<PERSON>', playerValue: 20),
Player(playerName: '<PERSON>', playerValue: 30),
Player(playerName: '<PERSON>', playerValue: 50),
Player(playerName: '<PERSON>', playerValue: 20),
];
playersList.shuffle();
var player1 = playersList.first;
var player2 = player1;
while (player1.playerValue == player2.playerValue) {
playersList.shuffle();
player2 = playersList.first;
}
return [player1, player2];
}
@override
String toString() {
return playerName;
}
}
So I'm using this class to provide me with two players. The problem is that it's still giving me players with the same value. Could anyone please help?
Here's the stateful widget I'm using it in:
import 'package:flutter/material.dart';
import './playerClass.dart';
class ComparisonInterface extends StatefulWidget {
@override
_ComparisonInterfaceState createState() => _ComparisonInterfaceState();
}
class _ComparisonInterfaceState extends State<ComparisonInterface> {
Player player1 = Player.pairPlayers().elementAt(0);
Player player2 = Player.pairPlayers().elementAt(1);
_ComparisonInterfaceState();
@override
Widget build(BuildContext context) {
void initState() {
Player.pairPlayers();
// TODO: implement initState
super.initState();
}
return Column(
children: <Widget>[
Text(
player1.playerName +
'is valued at ' +
player1.playerValue.toString() +
'\$, ' +
player2.playerName +
"'s value is " +
player2.playerValue.toString(),
style: TextStyle(fontSize: 20),
),
Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 20),
width: double.infinity,
child: FlatButton(
onPressed: null,
child: Text(
'Higher',
style: TextStyle(color: Colors.black, fontSize: 60),
)),
),
Container(
width: double.infinity,
child: FlatButton(
onPressed: null,
child: Text(
'Lower',
style: TextStyle(color: Colors.black, fontSize: 60),
)),
),
],
)
],
);
}
}
If you know how to fix it please provide me with some details to understand what's happening to use this way of thinking for future projects.
| 7349b621d21dbb16f35f4fb1ed9eb818dbff20377cfe1a1c33132019fc46507b | ['b67bf12c4f804f539c2b8c63c6a97eb5'] | class Player{
final String playerName;
final int playerValue;
Player({this.playerName,this.playerValue});
final List <Player> playersList = [
Player(playerName: 'player1', playerValue: 20),
Player(playerName: 'player2', playerValue: 20),
Player(playerName: 'player1', playerValue: 30),
Player(playerName: 'player3', playerValue: 50),
Player(playerName: 'player5', playerValue: 60),
];
player1 = (playersList..shuffle()).first;
player2 = (playersList..shuffle()).last;
while (player1.playerName == player2.playerName || player1.playerValue == player2.playerVaue) {
player2 = (playersList..shuffle()).last;
}
So this is what I'm trying to do: I want to manually create a list of Players as shown above and want to randomly assign one of those players to player1 and player2 just in case both of them turn out having the same value or name, I want to randomly select the player so that we can compare their values. I'm not really able to figure out how to formulate it in code.
Also, I want to send the playerName and playerValue to another class where I'll have them displayed in a stateful widget. As you can see I'm just starting out with Flutter so really any help would be greatly appreciated!
|
9945b7ac3cb6e15f04f0c52dbbc61a1658c44906cf892d8099811d6ceab636c9 | ['b6846900d51a4251b129ec471bcada78'] | I'm a robotics' student from Instituto Superior Técnico and I'm having trouble using an external library in my project.
I use a Robotics simulator called Simox http://simox.sourceforge.net/. This is a library that I have been working for a while. I have been using a cmake template file provided with the simulator (with few alterations) which lets me use Simox with my own code:
PROJECT ( myDemo )
FIND_PACKAGE(Simox REQUIRED)
IF(Simox_USE_COIN_VISUALIZATION)
include_directories(${PROJECT_SOURCE_DIR}/include)
FILE(GLOB SRCS ${PROJECT_SOURCE_DIR}/iCubSimulator.cpp ${PROJECT_SOURCE_DIR}/src/iCub.cpp ${PROJECT_SOURCE_DIR}/src/iCubHand.cpp ${PROJECT_SOURCE_DIR}/src/ApproachMovementSpace.cpp ${PROJECT_SOURCE_DIR}/src/OrientedBoundingBox.cpp ${PROJECT_SOURCE_DIR}/src/GraspOptimization.cpp ${PROJECT_SOURCE_DIR}/src/Window.cpp)
FILE(GLOB INCS ${PROJECT_SOURCE_DIR}/include/iCub.h ${PROJECT_SOURCE_DIR}/include/iCubHand.h ${PROJECT_SOURCE_DIR}/include/ApproachMovementSpace.h ${PROJECT_SOURCE_DIR}/include/OrientedBoundingBox.h ${PROJECT_SOURCE_DIR}/include/Window.h)
set(GUI_MOC_HDRS ${PROJECT_SOURCE_DIR}/include/GraspOptimization.h ${PROJECT_SOURCE_DIR}/include/Window.h)
set(GUI_UIS ${PROJECT_SOURCE_DIR}/ui/iCubSimulator.ui)
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -lpthread")
SimoxQtApplication(${PROJECT_NAME} "${SRCS}" "${INCS}" "${GUI_MOC_HDRS}" "${GUI_UIS}")
ENDIF()
Currently, I want to use an additional Bayesian Optimization Library called BayesOpt: http://rmcantin.bitbucket.org/html/. And I don't know how to correctly modify my cmake file to include this library.
I tried to do this own my own, with some help from google, tutorials and other asked questions, but with no success.
I'm hoping someone can help me with this problem.
Thanks in advance!
| 4bee25f85ad879e6bb93c5d34d4d3809b590241fe4ade2975dbfdf13103cb918 | ['b6846900d51a4251b129ec471bcada78'] | I'm currently running Bayesian Optimization, written in c++. I use a toolbox call Bayesopt from <PERSON> (http://rmcantin.bitbucket.org/html/). I'm doing my thesis about Bayesian Optimization (https://en.wikipedia.org/wiki/Bayesian_optimization).
I had previously experimented with this toolbox and I have noticed this week that the code is running a lot slower than I remembered. It's worth mentioning that I did write some code that works with this toolbox.
I decided to try to understand why this was happening and I did witness that the code was running much slower than it should.
To try to understand if it was my code's fault or otherwise, I tried an example that doesn't use any of my code.
Consider the following example:
#include <iostream>
#include <bayesopt.hpp>
class ExampleMichalewicz: public bayesopt::ContinuousModel
{
public:
ExampleMichalewicz(bopt_params par);
double evaluateSample(const vectord& x);
bool checkReachability(const vectord &query) {return true;};
void printOptimal();
private:
double mExp;
};
ExampleMichalewicz::ExampleMichalewicz(bopt_params par):
ContinuousModel(10,par)
{
mExp = 10;
}
double ExampleMichalewicz::evaluateSample(const vectord& x)
{
size_t dim = x.size();
double sum = 0.0;
for(size_t i = 0; i<dim; ++i)
{
double frac = x(i)*x(i)*(i+1);
frac /= M_PI;
sum += std::sin(x(i)) * std::pow(std::sin(frac),2*mExp);
}
return -sum;
}
void ExampleMichalewicz::printOptimal()
{
std::cout << "Solutions: " << std::endl;
std::cout << "f(x)=-1.8013 (n=2)"<< std::endl;
std::cout << "f(x)=-4.687658 (n=5)"<< std::endl;
std::cout << "f(x)=-9.66015 (n=10);" << std::endl;
}
int main(int nargs, char *args[])
{
bopt_params par = initialize_parameters_to_default();
par.n_iterations = 20;
par.n_init_samples = 30;
par.random_seed = 0;
par.verbose_level = 1;
par.noise = 1e-10;
par.kernel.name = "kMaternARD5";
par.crit_name = "cBEI";
par.crit_params[0] = 1;
par.crit_params[1] = 0.1;
par.n_crit_params = 2;
par.epsilon = 0.0;
par.force_jump = 0.000;
par.verbose_level = 1;
par.n_iter_relearn = 1; // Number of samples before relearn kernel
par.init_method = 1; // Sampling method for initial set 1-LHS, 2-Sobol (if available),
par.l_type = L_MCMC; // Type of learning for the kernel params
ExampleMichalewicz michalewicz(par);
vectord result(10);
michalewicz.optimize(result);
std::cout << "Result: " << result << "->"
<< michalewicz.evaluateSample(result) << std::endl;
michalewicz.printOptimal();
return 0;
}
If I compile this example alone, the run time is about 23 seconds.
With this cmake file
PROJECT ( myDemo )
ADD_EXECUTABLE(myDemo ./main.cpp)
find_package( Boost REQUIRED )
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else(Boost_FOUND)
find_library(Boost boost PATHS /opt/local/lib)
include_directories(${Boost_LIBRARY_PATH})
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories("../bayesopt/include")
include_directories("../bayesopt/utils")
set(CMAKE_CXX_FLAGS " -Wall -std=c++11 -lpthread -Wno-unused-local-typedefs -DNDEBUG -DBOOST_UBLAS_NDEBUG")
target_link_libraries(myDemo libbayesopt.a libnlopt.a)
Now consider the same main example, but where I add three additional files to my cmake project (without including them in main.cpp). These three files are subpart of all my code.
PROJECT ( myDemo )
ADD_EXECUTABLE(myDemo ./iCubSimulator.cpp ./src/DatasetDist.cpp ./src/MeanModelDist.cpp ./src/TGPNode.cpp)
find_package( Boost REQUIRED )
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else(Boost_FOUND)
find_library(Boost boost PATHS /opt/local/lib)
include_directories(${Boost_LIBRARY_PATH})
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories("../bayesopt/include")
include_directories("../bayesopt/utils")
set(CMAKE_CXX_FLAGS " -Wall -std=c++11 -lpthread -Wno-unused-local-typedefs -DNDEBUG -DBOOST_UBLAS_NDEBUG")
target_link_libraries(myDemo libbayesopt.a libnlopt.a)
This time, the run time is about 3 minutes. This is critical in my work since if I increase par.n_iterations it tends to get much worse.
I further arrived at the conclusion that if I comment a line in TGPNode.cpp
utils::cholesky_decompose(K,L); (NOTICE THAT THIS LINE IS NEVER CALLED).
I get the 23 seconds. This function belongs to a file: ublas_cholesky.hpp, from the bayesopt toolbox.
It is also important to note that the same function is also called within the toolbox code. This line is not commented and it runs during michalewicz.optimize(result);.
Does anyone have any ideia why this is happening? It would be a great help if anyone has some insight about the subject.
Greatly appreciated.
Kindly, <PERSON><IP_ADDRESS>ContinuousModel
{
public:
ExampleMichalewicz(bopt_params par);
double evaluateSample(const vectord& x);
bool checkReachability(const vectord &query) {return true;};
void printOptimal();
private:
double mExp;
};
ExampleMichalewicz<IP_ADDRESS>ExampleMichalewicz(bopt_params par):
ContinuousModel(10,par)
{
mExp = 10;
}
double ExampleMichalewicz<IP_ADDRESS>evaluateSample(const vectord& x)
{
size_t dim = x.size();
double sum = 0.0;
for(size_t i = 0; i<dim; ++i)
{
double frac = x(i)*x(i)*(i+1);
frac /= M_PI;
sum += std<IP_ADDRESS>sin(x(i)) * std<IP_ADDRESS>pow(std<IP_ADDRESS>sin(frac),2*mExp);
}
return -sum;
}
void ExampleMichalewicz<IP_ADDRESS>printOptimal()
{
std<IP_ADDRESS>cout << "Solutions: " << std<IP_ADDRESS>endl;
std<IP_ADDRESS>cout << "f(x)=-1.8013 (n=2)"<< std<IP_ADDRESS>endl;
std<IP_ADDRESS>cout << "f(x)=-4.687658 (n=5)"<< std<IP_ADDRESS>endl;
std<IP_ADDRESS>cout << "f(x)=-9.66015 (n=10);" << std<IP_ADDRESS>endl;
}
int main(int nargs, char *args[])
{
bopt_params par = initialize_parameters_to_default();
par.n_iterations = 20;
par.n_init_samples = 30;
par.random_seed = 0;
par.verbose_level = 1;
par.noise = 1e-10;
par.kernel.name = "kMaternARD5";
par.crit_name = "cBEI";
par.crit_params[0] = 1;
par.crit_params[1] = 0.1;
par.n_crit_params = 2;
par.epsilon = 0.0;
par.force_jump = 0.000;
par.verbose_level = 1;
par.n_iter_relearn = 1; // Number of samples before relearn kernel
par.init_method = 1; // Sampling method for initial set 1-LHS, 2-Sobol (if available),
par.l_type = L_MCMC; // Type of learning for the kernel params
ExampleMichalewicz michalewicz(par);
vectord result(10);
michalewicz.optimize(result);
std<IP_ADDRESS>cout << "Result: " << result << "->"
<< michalewicz.evaluateSample(result) << std<IP_ADDRESS>endl;
michalewicz.printOptimal();
return 0;
}
If I compile this example alone, the run time is about 23 seconds.
With this cmake file
PROJECT ( myDemo )
ADD_EXECUTABLE(myDemo ./main.cpp)
find_package( Boost REQUIRED )
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else(Boost_FOUND)
find_library(Boost boost PATHS /opt/local/lib)
include_directories(${Boost_LIBRARY_PATH})
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories("../bayesopt/include")
include_directories("../bayesopt/utils")
set(CMAKE_CXX_FLAGS " -Wall -std=c++11 -lpthread -Wno-unused-local-typedefs -DNDEBUG -DBOOST_UBLAS_NDEBUG")
target_link_libraries(myDemo libbayesopt.a libnlopt.a)
Now consider the same main example, but where I add three additional files to my cmake project (without including them in main.cpp). These three files are subpart of all my code.
PROJECT ( myDemo )
ADD_EXECUTABLE(myDemo ./iCubSimulator.cpp ./src/DatasetDist.cpp ./src/MeanModelDist.cpp ./src/TGPNode.cpp)
find_package( Boost REQUIRED )
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else(Boost_FOUND)
find_library(Boost boost PATHS /opt/local/lib)
include_directories(${Boost_LIBRARY_PATH})
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories("../bayesopt/include")
include_directories("../bayesopt/utils")
set(CMAKE_CXX_FLAGS " -Wall -std=c++11 -lpthread -Wno-unused-local-typedefs -DNDEBUG -DBOOST_UBLAS_NDEBUG")
target_link_libraries(myDemo libbayesopt.a libnlopt.a)
This time, the run time is about 3 minutes. This is critical in my work since if I increase par.n_iterations it tends to get much worse.
I further arrived at the conclusion that if I comment a line in TGPNode.cpp
utils<IP_ADDRESS>cholesky_decompose(K,L); (NOTICE THAT THIS LINE IS NEVER CALLED).
I get the 23 seconds. This function belongs to a file: ublas_cholesky.hpp, from the bayesopt toolbox.
It is also important to note that the same function is also called within the toolbox code. This line is not commented and it runs during michalewicz.optimize(result);.
Does anyone have any ideia why this is happening? It would be a great help if anyone has some insight about the subject.
Greatly appreciated.
Kindly, José Nogueira
|
c97fc0b2d901b90ebf986be4f468b6b33f7a9968e25393e356cca71a89d47fd4 | ['b6872da06c6c4d24ae0884b4f542ef2b'] | I've the follow documents:
{"id":1 , "user_id":1234, "tags":["b"]}
{"id":2 , "user_id":1234, "tags":["a"]}
{"id":3 , "user_id":1236, "tags":["b"]}
{"id":4 , "user_id":1237, "tags":["b"]}
{"id":5 , "user_id":1238, "tags":["a"]}
{"id":6 , "user_id":1239, "tags":["b"]}
And i want get all users_id that haven't "a" in "tags".
1236,(id =3 )
1237,(id =4 )
1239,(id =6 )
And i don't want to get 1234,(id=1), be cause he has "a" in "tags" in another document.
I tried to handle this with aggregations (searching and trying) but can't resolve.
Do you know how to resolve this?
Thank for read.
Best Regards!! :)
PS: I use java api to query my data, but you feel free to use DSL (json).
| f54160540f3bb81a6a47bdf8da0dfc34633d72d84c511e7f33e935ad77018207 | ['b6872da06c6c4d24ae0884b4f542ef2b'] | I'm a bit of newbie on MPI programming ( mpich2 fedora ).
I'm writing be cause, i got Dead lock when use MPI_Barrier with another comunicator different to MPI_COMM_WORLD.
I make 2 communicators like this:
MPI_Comm_split (MPI_COMM_WORLD, color, rank, &split_comm);
If i put a MPI_Barrier where all colors can pass, it'll be all right.
But if i put a MPI_Barrier where only color == 1 can pass, i got Dead lock.
How to use MPI_Barrier with another communicator ?
I was also using MPI_Bcast () (with another different communicator MPI_COMM_WORLD) but it wasn't blocked when nobody call MPI_Bcast too. Can one different communicator to MPI_COMM_WORLD synchronise your own processes?
|
7a7153e6c59f31df1dcefb6eb5fba5affd895e63301f516622cb050061fe650b | ['b69236da3ad448dba87c246e2dd1e233'] | with the commands
$>squeue -u mnyber004
I can visualize all the submitted jobs on my cluster account (slurm)
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
<PHONE_NUMBER> ada CPUeq6 mnyber00 R 1-01:26:17 1 srvcnthpc105
<PHONE_NUMBER> ada CPUeq4 mnyber00 R 1-01:26:20 1 srvcnthpc104
<PHONE_NUMBER> ada CPUeq2 mnyber00 R 1-01:26:31 1 srvcnthpc104
20126 ada CPUeq1 mnyber00 R 22:32:28 1 srvcnthpc103
22004 curie WRI_0015 mnyber00 R 16:11 1 srvcnthpc603
22002 curie WRI_0014 mnyber00 R 16:13 1 srvcnthpc603
22000 curie WRI_0013 mnyber00 R 16:14 1 srvcnthpc603
How to cancel all the jobs running on the partition ada?
| 7390665db46409564dbebd09851db04ff8be34570beff553a31068ba9fc73111 | ['b69236da3ad448dba87c246e2dd1e233'] | I am creating a 2D plot from several data files (snapshot_XXXX.dat) using the following snippet
set terminal pngcairo
n=1000 # Number of snapshots
load 'color.pal'
# cbrange[-6:-2]
unset key
set style fill solid
set ylabel "Snapshot/Time"
# set yrange [0.5:n+0.5]
# set ytics 1 # manage it well in order to avoid black lines at the
borders
set xrange[0:2021]
set yrange[0:8]
# This functions gives the name of the snapshot file
snapshot(i) = sprintf("snapshot_%04d.dat", i)
plot for [i=1:n] './snapshots/'. snapshot(n+1-i) using 1:2:3 with boxes
linecolor palette
where the result is: picture
The snapshots look like
snapshot_0001.dat snapshot_0002.dat snapshot_0003.dat
1 1.0 0.0 1 1.0 0.0 1 1.0 0.0
2 1.5 0.0 2 1.5 0.0 2 1.5 0.0
3 2.0 0.5 3 2.0 0.7 3 2.0 0.7
4 2.5 1.0 4 2.5 1.5 4 2.5 1.5
5 3.0 0.5 5 3.0 0.7 5 3.0 1.1
6 3.5 0.0 6 3.5 0.0 6 3.5 0.7
7 4.0 0.0 7 4.0 0.0 7 4.0 0.0
8 4.5 0.0 8 4.5 0.0 8 4.5 0.0
9 5.0 0.0 9 5.0 0.0 9 5.0 0.0
Of course these are fake data since the original files are too heavy to add to this post. I would like to add horizontal lines at particular times (axis labelled SnapShot/TIME).
Is someone can help me with this issue?
|
72b5fc072a298993b3c256f66d5ff0a9fb571851e64120f9b76dfe8596786d10 | ['b6979edf521e46568cc2de95737d4fc3'] | To use your term_run_time you can use File Trigger (FT) instead of FW.
Are you only getting 1 file a day or sometimes not at all, you can do term_run_time for 360 minutes which would terminate it 15:00 and then start over again next day at 9:00 and pick it up if file was recived later.
| 8175f6642cd66ccc7d08af75982649603f1435c91a41878fabaea8450ee54235 | ['b6979edf521e46568cc2de95737d4fc3'] | In Autosys there is no easy way through using autosys native cmd's
However you can get all this information from the DB it is in the WCC DB and the table is dbo.MON_JOB query would be to get you started:
SELECT [NAME]
,[NEXT_TIME]
FROM [CAAutosys11_3_5_WCC_PRD].[dbo].[MON_JOB]
WHERE [NEXT_TIME] > '1970'
ORDER BY [NEXT_TIME] ASC
Let me know if you need more clarification.
|
778f4a8e7ffe116646e96e8f95fb89ce71f24c2cd5a6097f3c2889d250cf7df8 | ['b698495cf0bf45ee9eb744023c152649'] | After having experienced the same issue (not being able to login to the Flickr app via iOS7 using my Google/Gmail account) I found that it is required to create a Yahoo account as mentioned.
Once I completed that, I was then provided with the additional sign-in options when launching the Flickr app (enabling me to sign-in using my Google account as desired all along).
I now have a Yahoo account I don't require for anything though (other than to support my use of the Flickr app with Google account sign-in).
| d8b21b5136227e1a858803f48ed2cb64980bd6fe8275989a3234c53d0a157a91 | ['b698495cf0bf45ee9eb744023c152649'] | I have a page with around 12 ListView Webparts.There is one Master ListView Webpart which provides filter connections to the other webparts, so that it displays the filtered results.
Keeping in mind for performance and to use best approach should this approach be continued or should i create a single content editor webpart and use multiple REST calls to achieve the same, or is there any other better approach.
Please Suggest.Also if any features i can consider in SP 2016
|
e13830720a0b04d99c34abc8644657ffdd4009c4c8c6b6b25cb9551087d97708 | ['b69ff7de328044e98f04adfa8de6ecb0'] | I am trying to add a new command to my own shell such as:
alarm 7.15 music.wav
I want to create a cron job so it can schedule alarm daily at given time.
So, I create a file for each call of alarm, named musicFile.txt
Here is my bash file to run: (musicFile.txt)
#!/bin/bash
15 7 * * * XDG_RUNTIME_DIR=/run/user/$(id -u) play -q /home/harun/Desktop/music.wav > alarmFile
crontab alarmFile
rm -f alarmFile
rm -f musicFile.txt
And I execute this comment with execvp:
bash musicFile.txt
However, nothing happens. How should I set an alarm with crontab?
| b958eb4398bb1fd5bc54d2ef4ea718aad614af63a78158a790c6f7ef66405cc8 | ['b69ff7de328044e98f04adfa8de6ecb0'] | You can easily sort out this problem.
In "CDVHandleOpenURL.m" file you need to change code as below
NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
To
NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");} else { window._savedOpenURL = \"%@\"; }", url, url];
this will work perfectly.
Best of luck
|
6cbfcdfb66deb8aa1f092426a3d63e6e41948a3e8ce873111083a28feb2d5c4a | ['b6a00743b452473585d34b73cef2bc80'] | I'm writing a simulation demo, using d3. I'd like to show the evolution of the solution state.
If I embed the d3 rendering in the simulation loop, then the browser doesn't show anything until the end. It's busy, I suppose.
What I'd like to achieve is to do some calculating, some d3 updating, and then wait for all the transitions to complete, within the main loop.
Since the transitions are asynchronous, I can't figure out a way to wait for them.
It works to use setInterval to run the main loop, kinda, but not well.
Is there a "usual" way to do achieve the goal of lock-stepping a calculation with d3 transitions?
| 9f0528701db8b031d40760604fe7e0cdfd772cded427e9cbdc93d8802ec8e21b | ['b6a00743b452473585d34b73cef2bc80'] | so I have this (VB, sorry) object:
Class Foo
Private ReadOnly foo as Integer
Public Overridable ReadOnly Property Foo() as Integer
Get
Return foo
End Get
End Property
Public Overridable Overloads Function Equals(ByVal other as Foo) as Boolean
Return Me.foo.Equals(other.foo)
End Function
Public Overloads Overrides Function Equals(ByVal obj as Object) as Boolean
... some boilerplate ...
Return Equals(DirectCast(obj, Foo))
End Function
End Class
the big mystery is, when I load an object from the database, in Equals(), other.foo is always zero, even though the value in Foo() is correct.
how could this be?
Another version of the Equals method was this:
Private Overloads Function Equals(ByVal other as Foo) as Boolean Implements IEquatable(Of Foo).Equals
Return Me.foo.Equals(other.foo)
End Function
And in this version, both Me.foo and other.foo are zero.
|
a04e48193caca0d0776cc45df3e4c2c243c418d383684a542e75fb2fd7aad2f1 | ['b6a2a1cc066e4f19904aefb97b9fca04'] | We are attempting to save a URL stored in a string to a text file, but we can't seem to get it to work. It will not save into the file, although our testing shows that the function is actually running when it should be.
The code for this is here:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<button onclick="instagramclick()">Login to instagram</button>
<button onclick="myFunction()">Test Button</button>
<script>
function myFunction() {
alert("Hello World");
}
function instagramclick(){
alert("button clicked");
window.location.href = "https://instagram.com/oauth/authorize/?client_id=8a612cd650344523808233c0468c80ed&redirect_uri=http://u-ahmed.github.io/HookedUp/instagram.html&response_type=token";
}
function WriteDemo(link)
{
var <PERSON>, f, r;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("database.txt", ForWriting, true);
f.Write(link);
f.Close();
r = f.ReadLine();
return(r);
}
window.onload = function writedamnyou(){
var token = window.location.href.substring(62);
if (token != ""){
// document.write(token);
var link = "https://api.instagram.com/v1/users/self/feed?access_token=" + token;
// w = window.open('database.txt')
WriteDemo(link);
// document.write(stuff);
}
};
</script>
<p id="no"></p>
</body>
</html>
Thanks in advance.
| 5bb34417f3e9882b390356f5e5a5cbb38c30dca61168bbab2001407aa5ca5d61 | ['b6a2a1cc066e4f19904aefb97b9fca04'] | We are attempting to pull a user's twitter feed using javascript as JSON, and currently are just trying to save the url containing the JSON data to local storage. However, the url gives us the following error each time we attempt to access it:
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
As far as we can tell from the documentation, the current way we are using the access token should work.
The code we are using is shown below:
<html>
<body>
<script>
var username = "FightMe123456"
var twitteraccesstoken = "3297223770-jC5411hhsODUXU6qbqTCbwFujaGliqVTtX9iwFK";
var twitterlink = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" + username + "?access_token=" + twitteraccesstoken;
localStorage.setItem("link",twitterlink);
localStorage.getItem("link");
</script>
</body>
</html>
We can't get it to work as intended.
Thanks in advance.
|
14b6f0196c119937e678dc96046716ee60eb45da3d6a452cc2255879d3e29fb5 | ['b6b03d6447bd401c947da9ec7305723d'] | I create an adapter and pass a class with an empty list:
@Provides
@Singleton
Posts providesItemsList() {
Posts posts = new Posts();
posts.items = new ArrayList<>();
return posts;
}
After this, I do some network work and call adapter's method:
public void setItems(Posts newPosts) {
Log.i("mytag", "NewPosts items number in the setItems method: " + Integer.toString(newPosts.items.size()));
posts.items.addAll(newPosts.items);
Log.i("mytag", "Posts items number in the setItems method: " + Integer.toString(posts.items.size()));
posts.profiles.addAll(newPosts.profiles);
posts.groups.addAll(newPosts.groups);
notifyDataSetChanged();
}
And this is how getItemCount looks like:
@Override
public int getItemCount() {
Log.i("mytag", "Posts items number in the getitemcount method: " + Integer.toString(posts.items.size()));
return posts.items.size();
}
In the logs:
07-15 18:57:41.967 7481-7481/com.ovchinnikovm.android.vktop I/mytag: Posts items number in the getitemcount method: 0
07-15 18:57:41.967 7481-7481/com.ovchinnikovm.android.vktop I/mytag: Posts items number in the getitemcount method: 0
07-15 18:57:42.005 7481-7481/com.ovchinnikovm.android.vktop I/mytag: Posts items number in the getitemcount method: 0
07-15 18:57:42.005 7481-7481/com.ovchinnikovm.android.vktop I/mytag: Posts items number in the getitemcount method: 0
07-15 18:57:42.118 7481-7481/com.ovchinnikovm.android.vktop I/mytag: NewPosts items number in the setItems method: 20
07-15 18:57:42.118 7481-7481/com.ovchinnikovm.android.vktop I/mytag: Posts items number in the setItems method: 20
How do I properly update my recyclerview?
| eccb97106be68d041691b38b334e94c2e1579509ca4bfa48976c2a8fd5694650 | ['b6b03d6447bd401c947da9ec7305723d'] | I have JSON response which looks like that:
{
"response":[
"Some number (for example 8091)",
{
"Bunch of primitives inside the first JSONObject"
},
{
"Bunch of primitives inside the second JSONObject"
},
{
"Bunch of primitives inside the third JSONObject"
},
... (and so on)
]
}
So it's an array with first integer element and other elements are JSONObject.
I don't need integer element to be parsed. So how do I handle it using GSON?
|
dcbe87aa33bca689590254ab485e5dae8da2cc54d4382757adc67a7cdd25843d | ['b6bd0e0b487840769afd6dabc9ba43dc'] | Using Xcode 8 new memory debugger I found out there was a ViewController in memory that shouldn't be there and the strong reference that was pointing to it was coming from this mysterious _statusBarTintColorLockingControllers array in UIApplication. Does anybody know where it comes from? And more importantly, how to take my VC out of it?
| 080db9342c984cd7a8ec16acbd0d4a7c88e1c6cd1bf34fbf61844aa6e6cbe60a | ['b6bd0e0b487840769afd6dabc9ba43dc'] | You have different types of event listeners. So if you observe with FIRDataEventType.value, you will be notified on every change that happens in the node specified (or its descendants) - in your example, it would be the 2nd and 3rd updates.
But you can choose to be notified only when a child is added, or when it is removed, for example.
You can check their documentation on the FIRDataEventType enum =D
|
b1db43e55a29beef3cd1b23acc758dcba4e46e00c9959ee4fd3c02b028718b32 | ['b6c89320814747389c191ca7c3ed715b'] | I understand that approximately 3,000 souls were added to [the church.] However, I am trying to prove whether it is correct to say that we do not know how many gladly received the word and were baptized. That we only know approximately that 3,000 of those were added to the church. I've found not one remark that directly addresses this matter. Everyone glosses over this as if the verse says that 3,000 gladly heard the word, were baptized and added. But, as far as I can tell, it does not say that. Hope that makes sense.\ | 5e1d4fb60a983381fe94c2e81f34c0e9363b15377386024e37881dab838ae644 | ['b6c89320814747389c191ca7c3ed715b'] | Here are the basics of getting i2c working under linux and python:
http://www.instructables.com/id/Raspberry-Pi-I2C-Python/
As far as your module, here is a post I saw about the i2c address:
http://forum.arduino.cc/index.php?topic=142255.0
Finally I think you can get away without a levelshifter, but it's not guaranteed to work. To prevent the i2c slave (at 5v) from writing back, never send a "read" command over i2c. only send a "write" command. The read/write command is usually controlled by most significant bit (first bit) of the i2c address. I can't find the datasheet for your lcd converter. But it would be very helpful if you could find and post it.
If you need a levelshifter, here is one: http://letsmakerobots.com/blog/unixguru/running-both-5v-and-33v-devices-i2c
|
757c61904c8014060bfc5801f3aaa1f416ffb6bf9f357a0bd3552ac95bde08e5 | ['b6e52ce7e5c24389b39e7c3c7313839f'] | I have to send a packet that has packet structure of:
1 byte padding (0x0)
2 byte (uint16) opcode
1 byte padding (0x0)
x bytes raw struct
So I need a way to put a uint16 into my byte array.
byte[] rawData = new byte[x+4];
rawData[0] = 0;
rawData[1] = (uint16-highbyte?) opcode;
rawData[2] = (uint16-lowbyte?) opcode;
| 0f428ce6a3e7517dcd97115ebda76cc5891f7f7d41a233a03d7dfc7e9df2b3ba | ['b6e52ce7e5c24389b39e7c3c7313839f'] | I'm writing a http server and I just had question about how to implement a PUT request.
I am reading a client socket one byte at a time, until I reach a CRLF "\r\n" new line, where I send the line to a parser to be tokenized. When I get two line breaks in a row, I send a response (as it is the http standard to symbolize that the request is finished).
This was fine for implementing GET/HEAD/DELETE. But now I see PUT has the double line break for the content.
PUT /index.html HTTP/1.0
Headers: stuff <--- not the real CRLF 1
<--- not the real CRLF 2
html content goes here <--- CRLF 1
<--- CRLF 2 ... done, send response
That is easy enough to account for. If the first line I parse is PUT, I will just say okay, don't send a request until we get the 2nd CRLF1+2.
But what if the content has line breaks too, then how can I know when the client is -really- done sending me stuff?
|
48bf880c409e47d2e89d62ca46bf9c5442a2f7a4aa6677fc71261f81cdecc90b | ['b712a5ec43674f41bbf60d2e9f55775f'] | I've setup a secondary project module to symlink from the source folder to a shared resources folder. This shared resource folder is where I store all of the content for several components.
I realize there is a built-in 'include folder' functionality that would make sense, but the linkages behave differently - specifically, they don't work.
The symbolic link solution works as I'd hoped it to, except that changes made to the resources folder aren't reflected when I recompile the secondary module (caching, I'm sure). I can resolve this by running the Rebuild Project command ahead of every compile. It would be nice to automate this step in to my compile configuration.
I've taken a look at the Run/Debug configurations menu, specifically the Before Launch menu. I wasn't able to figure out a way to do what I needed.
Any ideas? Also open to alternative solutions to clear publishing caches if you have something else in mind.
| 473bd886653901b50376390bc4d1973d151094263374077845a8283a8916c99d | ['b712a5ec43674f41bbf60d2e9f55775f'] | I know I'm not the first, but I'm an audio pack rat who keeps their collection meticulously organized. Having tried a range of tools, there are holes and time sucks that bug me. I've started in on the project to build the software that I wish existed.
My question centres around a feature that I hope will cut down on the time it takes to build play lists. Over time, I want to gradually attach generic keywords to my MP3's. For example, when I'm listening to an album suitable for programming, I'd like to attach keywords like "ambient" and "no lyrics" so that I can just search by those descriptions later. Unfortunately, I'm having troubles finding any established conventions for how people might already be doing this.
Are there dedicated ID3 tags for this purpose? (I found none in the spec)
Is there an alternative metadata strategy I should look at?
To be clear, my intention is to bake the keywords into the MP3 somehow.
I'll handle any searches through a database, but I want this info to move easily to other devices and pre populate easily if I change/upgrade the manager.
If this isn't something that people do already, I'll just roll my own solution into a custom/comment tag, but I'd really prefer to leverage any existing momentum. My pie in the sky hope is a central database of these keywords to save everyone the effort of tagging their collections.
Thanks for taking a look at this!
|
785a52fa84809313cc83e1d6b18ada554a9afe8f5451cd664f29e39a415a4c00 | ['b7161c22052c4719b6ff605fbde60c46'] | So I am attempting to write a program in Python that builds a list of students and eventually prints them out to the screen. For each student the user chooses to add, the input of first name, last name, and ID number are taken.
My issue is that although I am attempting to append each new person created onto a list called studentList[], when I print the list out at the end, I get an output of the correct number of student but all containing the same information as the last student I entered.
For example, if I add the students '<PERSON>', '<PERSON>', '<PERSON>', my output will read:
<PERSON>
<PERSON>
<PERSON>
I am not sure where my error is, be it in the list appending mechanism or in my for loop used to print out the objects. Any help is greatly appreciated.
class Student(object):
fname = ""
lname= ""
idNo = 0
def __init__(self, firstname, lastname, idnumber):
self.fname = firstname
self.lname = lastname
self.idNo = idnumber
def make_student(fname, lname, idNo):
student = Student(fname, lname, idNo)
return student
def main():
maxStudCount = 0
studentList = []
studQuery = raw_input("Would you like to add a student? (Type 'Yes' or 'No'): ")
while studQuery == 'Yes' and maxStudCount < 10:
fname = raw_input("Enter first name: ")
lname = raw_input("Enter last name: ")
idNo = raw_input("Enter ID No: ")
person = make_student(fname, lname, idNo)
studentList.append(person)
maxStudCount = maxStudCount + 1
studQuery = raw_input("Add another student? ('Yes' or 'No'): ")
for item in studentList:
print fname, lname, idNo
if __name__ =='__main__':
main()
| 2d63cf9d97586b52373730aa9e35e1aeb7b23a569c730db6daa6e462986c9691 | ['b7161c22052c4719b6ff605fbde60c46'] | I am trying to create an HTML/JavaScript program that reads external JSON files (via URL), and then outputs them to the webpage in a nice listed order.
I have been working on this for days, and I can't seem to get past an error that pops up in the console of Internet Explorer. The error is:
SEC7120: Origin (my azure webapp URL) not found in Access-Control-Allow-Origin header. (my program name)
SCRIPT7002: XMLHttpRequest: Network Error 0x80700013, Could not complete the operation due to error 80700013.
I am able to read the first URL and read in the console via 'console.log(data)', but only because it is in the same origin domain as my code. Both are inside my Azure webapp git directory. How can I also via the other external JSON files from URLs? I have to read all of my classmates from their own webapps. Any help is greatly appreciated, I am really suffering here. I have a feeling that I need to use JSONp, therefore use the $.ajax() rather than $.getJSON().? I am using JQUERY. My code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h1>Klump Test</h1>
<p><input onclick="AddStudent()" type="button" value="Add Student"/></p>
<script>
var urls = ["https://michael-pedzimaz-webapp.azurewebsites.net/my-information.json",
"https://jakeisalsoclueless.azurewebsites.net/myinformation.json",
"https://riotjuice.azurewebsites.net/my-information.json",
"https://softwareengjmh.azurewebsites.net/format.JSON",
"https://newtestdocument.azurewebsites.net/Format.json"];
function AddStudent(){
var person = prompt("Please enter your json url:", "");
//var _person = person + '?callback=?';
getJson(person);
}
</script>
<input onclick="getJson(urls[0])" type="button" value="Mike's JSON"/>
<input onclick="getJson(urls[1])" type="button" value="Jake's JSON"/>
<input onclick="getJson(urls[2])" type="button" value="Julian's JSON"/>
<input onclick="getJson(urls[3])" type="button" value="Jace's JSON"/>
<input onclick="getJson(urls[4])" type="button" value="Thad's JSON"/>
<div class="mypanel"></div>
<script>
function getJson(url){
$.getJSON(url, function(data){
console.log(data);
var info = 'First name: ${data.FirstName}<br> Last Name: ${data.LastName}<br> Preferred Name: ${data.PreferredName}<br> Team Name: ${data.TeamName}<br> Seat Location: ${data.SeatLocation}<br> Role: ${data.Role}<br>'
$(".mypanel").html(info);
});
}
</script>
</body>
</html>
How all of the JSON files are formatted:
{
"FirstName":"Michael",
"LastName":"Pedzimaz",
"PreferredName":"Mike",
"TeamName":"The Ocelots",
"SeatLocation":"1-2",
"Role":["UI Designer"]
}
Thanks for any help in advance.
|
3a43cf2b5363c53c606bc2931108cadcf8b9f6f2f2cfd62db918baeacfdddf13 | ['b7288ab1cb794282bfcb673b47d5ca4c'] | I am trying to create a program for my project in school, and I have come across a problem. I am using LinqPad premium and when I launch the program it starts fine. However, when I try and start it for the second or third time it throws the exception:
"ObjectDisposedException: Cannot access a disposed object."
"Object name: 'Form'."
Here is my code:
void Main()
{
MenuClass.Main();
}
class MenuClass
{
static public Form MenuWindow = new Form();
static public void Main()
{
MenuWindow.Height = 300;
MenuWindow.Width = 300;
MenuWindow.Text = "Menu";
Button btnPlay = new Button();
btnPlay.Left = 10;
btnPlay.Top = 290;
btnPlay.Text = "Reset";
//btnPlay.Click += btnReset_click;
Button btnTakeTurn = new Button();
btnTakeTurn.Left = 10;
btnTakeTurn.Top = 270;
btnTakeTurn.Text = "Take Turn";
//btnTakeTurn.Click += btnTakeTurn_click;
Graphics g = MenuWindow.CreateGraphics();
MenuWindow.Controls.Add(btnPlay);
MenuWindow.Controls.Add(btnTakeTurn);
//MenuWindow.Paint += f_Paint;
MenuWindow.Show();
}
}
The error occurs where it says "Graphics g = MenuWindow.CreateGraphics();"
and also when i take that out it does it on "MenuWindow.Show();"
Please help, as I am powerless in this situation.
| c32d53ee2c9f2fe568c040c7686d62cf706dd045976d56e947ec0aa8694b6303 | ['b7288ab1cb794282bfcb673b47d5ca4c'] | I have a piece of code that throws an exception and error after running for a second time. Here it is:
static Form Window = new Form();
static public void Configuration()
{
Window.Height = 800;
Window.Width = 800;
Window.Text = "Homework";
Window.Paint += Window_Paint;
Window.Show();
}
This code is inside a class and it throws an exception at "Window.Show();" saying that it:
ObjectDisposedException: Cannot access a disposed object.
Object name: 'Form'.
Please suggest a way that I can fix this so that it doesn't happen again.
|
39f8f4f98b32c8f62b08955ce496bd49800cd2a897917023b9a21c9788a6c865 | ['b7296cf25beb44fe9c254f39d7c036f8'] | I've two radio buttons, on active each radio buttton will span to two text boxes.
Now when I select first radio button, other radio buttion's two textboxes should be disabled and vice versa
can someone help me on this, I'm new to JS
Below is the HTML
<div class=radio_section>
<br></br>
<input type="radio" name="etime6.0" id="etime6.0-6.1" required>
<dev class="labelv">
<label for="etime6.0-dogs">ETIME source client 6.0 & 6.1 </label>
</dev>
<div class="reveal-if-active">
<label for="field1"><span class=text>Enter the Source DB Name<span class="required">*</span></span>
<input id="db" type="text" maxlength="8" pattern="(^((et.)|(Et.)|(ET.)).+)|(.{3}([eEtT]$))" title="Database Name starts with et (or) Ends with e or t minimum of 4 letters" class="input-field" name="database_name" value="" /></label>
<label for="field1"><span class=text>Enter Target Client name<span class="required">*</span></span>
<input id="client" type="text" class="input-field" maxlength="3" pattern=".{3,}" title="3 characters minimum" class="input-field" name="Client_name" value=""/></label>
</div>
</div>
<div class=radio_section>
<input type="radio" name="etime6.0" id="etime6.2">
<dev class="labelv">
<label for="etime6.0-cats">ETIME Source Client above 6.1</label>
</dev>
<div class="reveal-if-active">
<label for="which-cat"></label>
<label for="field1"><span class=text>Enter source client name<span class="required">*</span></span>
<input id="client1" type="text" class="input-field" maxlength="3" pattern=".{3,}" title="3 characters minimum" class="input-field" name="Client_name1" value=""/></label>
<label for="field1"><span class=text>Enter Target Client name<span class="required">*</span></span>
<input id="client" type="text" class="input-field" maxlength="3" pattern=".{3,}" title="3 characters minimum" class="input-field" name="Client_namei2" value=""/></label>
</div>
</div>
<dev class="submit">
<label><span> </span><input type="submit" value="Next" /><input type="reset" value="Reset"></label>
| 87c8c0b8a95294d894c01e4b6f61affbf625430fe6bf21ea8a645bc89e9a63e4 | ['b7296cf25beb44fe9c254f39d7c036f8'] | I'm trying to send a mail with from cgi web console using email input field but it fails with below error in apache logs
Traceback (most recent call last):
File "/opt/apache-dba/cgi-bin/main.py", line 132, in <module>
mail()
File "/opt/apache-dba/cgi-bin/main.py", line 129, in mail
s.sendmail(me, you, msg.as_string())
File "/usr/lib64/python2.7/smtplib.py", line 742, in sendmail
raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'<EMAIL_ADDRESS>/': (501, '5.1.3 Bad recipient address syntax')}
But I'm able to run the same code and able to receive the mail from python shell
Below is the code, this looks like when I run the code from cgi it is trying to convert mailid from '<EMAIL_ADDRESS>' to '<EMAIL_ADDRESS>/' resulting syntax error.
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
Emailid = <EMAIL_ADDRESS>
Link='http://google.com'
def mail():
me = "<EMAIL_ADDRESS>"
you = str(Emailid)
msg = MIMEMultipart('alternative')
msg['Subject'] = "Upgrade Status Link"
msg['From'] = me
msg['To'] = you
text = '%s' % str(Link)
part1 = MIMEText(text, 'plain')
msg.attach(part1)
s = smtplib.SMTP('localhost')
s.sendmail(me, you, msg.as_string())
s.quit()
mail()
any help will be greatly appreciated, Thank you
|
aa4c5efb3eb35e82154dbf717ea6f5f518656d04f44bd91a81fd754868d9b155 | ['b72f09bf05164d7095a517a502935021'] | I am having a problem with vlc on xubuntu 15.04, which is vlc sometimes does not exit after I pressed the close button on the window. Still after closing the window, the vlc icon is still on the toolbar and I have to enter task manager and kill it. Why is this happening and what can I do to fix it?
| b8e42bc6c9bc35e89781b753f59af1fcbee86013e5e34c2f9ecf770e4624794f | ['b72f09bf05164d7095a517a502935021'] | How do I get the source from a previous version like a release version at github, when the master is updated daily? Sometimes later versions contain bugs I can't solve and I want to testrun an earlier version instead. But I'm not sure how to get to it?
|
4867c6d3b7dc7db14da2bde129a4cd37ac27df994cc4c2d5a6bfcb4445dd5760 | ['b7347baca8c147f88eb0bb4fb9fb5c1f'] | Worklight <IP_ADDRESS> (Enterprise edition)
I have a Worklight hybrid app running on Android 4.4.2. It uses Adapter-based authentication for end-user login/logout and the user is subscribed to push notifications automatically after successful login and unsubscribed on successful logout. Additionally, I use the Worklight server timeout to timeout the user but I do not set a heartbeat interval. The server timeout is set to 3 minutes, for testing purposes.
Everything, including push notifications, works great until I follow these steps:
Launch app
Login as user (app subscribes user, succeeds)
Logout
Wait 4 minutes
Login as user again (app subscribes user, fails)
These steps produce the following error in Logcat when the subscription is attempted for the second time:
04-16 17:52:43.200: E/NONE(1493): [http://ipaddress:10080/Mobile/apps/services/api/Student/android/notifications] failure. state: 500, response: Notification token unknown, subscribe to Push.StudentPushAlerts failed.
The Worklight Development Server Console produces this error:
[ERROR ] FWLSE0020E: Ajax request exception: Notification token unknown, subscribe to Push.StudentPushAlerts failed. [project Mobile]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project Mobile]Notification token unknown, subscribe to Push.StudentPushAlerts failed., User Identity {wl_authenticityRealm=null, AdapterAuthRealm=(name:12345678, loginModule:NonValidatingLoginModule), wl_remoteDisableRealm=(name:null, loginModule:NullLoginModule), wl_antiXSRFRealm=(name:cq6d0it2a32h7r57a7ineiaku8, loginModule:WLAntiXSRFLoginModule), wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=(name:d26bdbbb-ffeb-3070-bd5c-cfd407fb89cb, loginModule:WLDeviceNoProvisioningLoginModule), myserver=(name:1122a30c-992d-464d-a46a-880d20d03eee, loginModule:WeakDummy), wl_anonymousUserRealm=(name:1122a30c-992d-464d-a46a-880d20d03eee, loginModule:WeakDummy)}. [project Mobile]
com.worklight.common.log.filters.ErrorFilter
After much trial and error, I cannot get passed the error on the second subscribe if I wait between logins for a duration slightly greater than the server-side timeout value. In this case the server timeout is 3 minutes and I wait four minutes to produce the error consistently.
I attempted to reproduce this behavior in the IBM PushNotifications project sample by making some minor adjustments to mimick my application's flow, I had to add the timeout and a heartbeat to make it work. I did reproduce the error but the scenario is only similar to mine, so I suspect I am not seeing the full picture. However, the error is the same.
The IBM sample I am working with can be found here: modified IBM sample (GCM id/key removed from provided sample)
I can reproduce the error in my modified IBM sample by using the following steps:
Launch app
Login as user (onReadyToSubscribe runs, succeeds, close alert)
Press the 'Subscribe' button (subscribe succeeds)
Logout
Wait 10 minutes
Login as user again
Press the 'Subscribe' button (subscribe fails)
Similarly to my project, these steps produce the following error in Logcat when the subscription is attempted for the second time:
04-16 15:54:06.952: E/NONE(7133): [http://ipaddress:10080/PushNotifications/apps/services/api/PushNotifications/android/notifications] failure. state: 500, response: Notification token unknown, subscribe to PushAdapter.PushEventSource failed.
The Worklight Development Server Console produces this error:
[ERROR ] FWLSE0020E: Ajax request exception: Notification token unknown, subscribe to PushAdapter.PushEventSource failed. [project PushNotifications]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project PushNotifications]Notification token unknown, subscribe to PushAdapter.PushEventSource failed., User Identity {wl_authenticityRealm=null, wl_remoteDisableRealm=(name:null, loginModule:NullLoginModule), wl_antiXSRFRealm=(name:u7kpkmov3r8259mvu8t0s0h6v6, loginModule:WLAntiXSRFLoginModule), PushAppRealm=(name:james, loginModule:PushAppLoginModule), wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=(name:0bd1dcc9-2d93-35a4-a216-1ff3b7ba908d, loginModule:WLDeviceNoProvisioningLoginModule), myserver=(name:james, loginModule:PushAppLoginModule), wl_anonymousUserRealm=null}. [project PushNotifications]
com.worklight.common.log.filters.ErrorFilter
If I don't wait between logins the subscriptions succeed everytime, even with switching users. My application's authenticationConfig.xml is:
<securityTests>
<mobileSecurityTest name="Authentication-securityTest">
<testDeviceId provisioningType="none"/>
<testUser realm="AdapterAuthRealm"/>
</mobileSecurityTest>
</securityTests>
<realms>
<realm loginModule="NonValidatingLoginModule" name="AdapterAuthRealm">
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="Authentication.onAuthRequired"/>
<parameter name="logout-function" value="Authentication.onLogout"/>
</realm>
</realms>
<loginModules>
<loginModule name="NonValidatingLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>
</loginModules>
| 42d534eeb865a98b58d2c131b3e528a3d0ff79d1a9dd314d476e170da2527d79 | ['b7347baca8c147f88eb0bb4fb9fb5c1f'] | In Eclipse I am receiving the following error when trying to check-in some local changes.
RTC - 4.0.6 (RTC Client Plugin for Eclipse)
Errors encountered during Check-in
Parent '/WLSample/apps/wlapp/ipad/css' has multiple children with the name 'main.css'.
Parent '/WLSample/apps/wlapp/ipad/css' has multiple children with the name 'main.css'.
The main/remote repository and my repository workspace already contain these files that are being checked-in. However, the Pending Changes view shows the files as being additions instead of being flagged as edited.
|
5d24ca7da665bba376702413b0f34f9fcfc169d04f814852d09a893dd516bc32 | ['b7526261026244c095cab1e1c012856d'] |
This is the case you are using Julia:
The analogue of IPython's %matplotlib in Julia is to use the PyPlot package, which gives a Julia interface to Matplotlib including inline plots in IJulia notebooks. (The equivalent of numpy is already loaded by default in Julia.)
Given PyPlot, the analogue of %matplotlib inline is using PyPlot, since PyPlot defaults to inline plots in IJulia.
| 2e5271ae2a1b92a2da0a0945ae451702f358c27da9678561e7b8afe29951548e | ['b7526261026244c095cab1e1c012856d'] | For a project, I need to extract multiple posts from specific subreddits using PRAW. The approach that I want to do requires having posts from multiple months
With the below, I only got all the mixed dates...
#! usr/bin/env python3
import praw
import pandas as pd
import datetime as dt
reddit = praw.Reddit(client_id='PERSONAL_USE_SCRIPT_14_CHARS', \
client_secret='SECRET_KEY_27_CHARS ', \
user_agent='YOUR_APP_NAME', \
username='YOUR_REDDIT_USER_NAME', \
password='YOUR_REDDIT_LOGIN_PASSWORD')
subreddit = reddit.subreddit('myTopic')
for submission in subreddit.top(limit=1):
print(submission.title, submission.id)
Now we are ready to start scraping the data from the Reddit API. We will iterate through our top_subreddit object and append the information to our dictionary.
for submission in top_subreddit:
topics_dict["title"].append(submission.title)
topics_dict["score"].append(submission.score)
topics_dict["id"].append(submission.id)
topics_dict["url"].append(submission.url)
topics_dict["comms_num"].append(submission.num_comments)
topics_dict["created"].append(submission.created)
topics_dict["body"].append(submission.selftext)
Exporting a CSV
topics_data.to_csv('dataFromReddit.csv', index=False)
As I mentioned above I would like to extract the data by month.
I checked in the official doc, there is something that I can use, but I don't know how to implement it on my code.
|
e7107cf6294cccd4acc71927ad1b1032d4eb87fc8243ed1197675107e1e15ede | ['b778a04851f44beaa49ac92b6f51aead'] | I have an example of a google search and display markers. I am trying to have google display a map of markers and then a search bar for the user to input city or zip and display that area long with the markers.
I followed, Store Locator in google maps, input zip code and display markers on map and sidebar
Everything works great, but when the map first loads it doesnt display any markers. Only when you search. I need these markers on all the time.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Store Locate</title>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false&libraries=places&key=AIzaSyDOorkShHO1xhw2zbjz-OZdSKP-xQ65AS0"></script>
<style>
#pac-input {
background-color: #fff;
font-family: Roboto;
font-size: 15px;
font-weight: 300;
margin-left: 12px;
padding: 0 11px 0 13px;
text-overflow: ellipsis;
width: 400px;
}
#pac-input:focus {
border-color: #4d90fe;
}
.pac-container {
font-family: <PERSON>;
}
#type-selector {
color: #fff;
background-color: #4d90fe;
padding: 5px 11px 0px 11px;
}
#type-selector label {
font-family: Roboto;
font-size: 13px;
font-weight: 300;
}
</style>
<script type="text/javascript">
var side_bar_html = "";
// arrays to hold copies of the markers and html used by the side_bar
var gmarkers = [];
var marker;
var map = null;
var t=1;
function initialize() {
// create the map
var myOptions = {
center: new google.maps.LatLng(35.467560, -97.516428),
zoom:6,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
initSearchBox(map, 'pac-input');
}//----------------INIT END--------------------
var infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50)
});
// This function picks up the click and opens the corresponding info window
function myclick(i) {
google.maps.event.trigger(gmarkers[i], "click");
}
function initSearchBox(map, controlId) {
// Create the search box and link it to the UI element.
var input = (document.getElementById(controlId));
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
var searchBox = new google.maps.places.SearchBox(input);
// [START region_getplaces]
// Listen for the event fired when the user selects an item from the
// pick list. Retrieve the matching places for that item.
google.maps.event.addListener(searchBox, 'places_changed', function () {
var places = searchBox.getPlaces();
if (places.length == 0) {
return;
}
//get first place
var place = places[0];
var infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50),
content : place.info
});
// Add markers to the map
// Set up the markers with info windows
// add the points
var point = new google.maps.LatLng(35.979088,-96.112985);
var marker = createMarker(point,"Firestone, Oklahoma City<br>211 411 2311")
var point = new google.maps.LatLng(38.0409333,23.7954601);
var marker = createMarker(point,"Nespresso S.A.","<b>Nespresso S.A.</b><br><PERSON> 27,15124,Marousi")
var point = new google.maps.LatLng(38.0473031,23.8053483);
var marker = createMarker(point,"Regency Entertainment","<b>Regency Entertainment</b><br><PERSON> 49,15124,Marousi <br>210 614 9800")
var point = new google.maps.LatLng(38.050986,23.8084322);
var marker = createMarker(point,"Just4U","<b>Just4U</b> <br><PERSON> 84, 15124, Marousi<br>210 614 1923")
var point = new google.maps.LatLng(38.0400533,23.8011982);
var marker = createMarker(point,"Ekka Cars S.A.","<b>Ekka</b> <br><PERSON><PHONE_NUMBER>,23.7954601);
var marker = createMarker(point,"Nespresso S.A.","<b>Nespresso S.A.</b><br>Agiou Thoma 27,15124,Marousi")
var point = new google.maps.LatLng(38.<PHONE_NUMBER>,23.8053483);
var marker = createMarker(point,"Regency Entertainment","<b>Regency Entertainment</b><br>Agiou Konstantinou 49,15124,Marousi <br><PHONE_NUMBER>")
var point = new google.maps.LatLng(38.050986,23.8084322);
var marker = createMarker(point,"Just4U","<b>Just4U</b> <br>Dimitriou Gounari 84, 15124, Marousi<br><PHONE_NUMBER>")
var point = new google.maps.LatLng(38.<PHONE_NUMBER>,23.8011982);
var marker = createMarker(point,"Ekka Cars S.A.","<b>Ekka</b> <br>Leoforos Kifisias 79,15124,Marousi<br><PHONE_NUMBER>")
// put the assembled side_bar_html contents into the side_bar div
document.getElementById("side_bar").innerHTML = side_bar_html;
t -=1;//This is so if you search again, it doesn't display again in sidebar
map.fitBounds(place.geometry.viewport);
});
}
// A function to create the marker and set up the event window function
function createMarker(latlng, name, html) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
map: map,
//zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
// save the info we need to use later for the side_bar
gmarkers.push(marker);
// add a line to the side_bar html
side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>';
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body style="margin:0px; padding:0px;" >
<input id="pac-input" class="controls" type="text" placeholder="City, State or Zip Code">
<div id="map_canvas" style="width: 550px; height: 450px"></div>
</body>
</html>
| d23c726ee4f375c90bc73ac07f3f028b3b11afe47ff407a70dd25761559470e9 | ['b778a04851f44beaa49ac92b6f51aead'] | Im trying a simple request to get data from a webserver, but running into an error on the console.
fetch('http://tcokchallenge.com/admin_cp/test2.json', {mode: 'no-cors'})
.then(function(response) {
return response.json();
})
.then(function(text) {
console.log('Request successful');
})
.catch(function(error) {
console.log('Request failed', error)
});
it returns
Request failed SyntaxError: Unexpected end of input
What gives?
|
4c19741288b67e2f1007701f5f7a1467bdcfece31e09927221834ac61cc109b7 | ['b78dc23bd24447a9a70d735a77be1d7c'] | Yes basically this is what virtualenv do , and this is what the activate command is for, from the doc here:
activate script
In a newly created virtualenv there
will be a bin/activate shell script,
or a Scripts/activate.bat batch file
on Windows.
This will change your $PATH to
point to the virtualenv bin/
directory. Unlike workingenv, this is
all it does; it's a convenience. But
if you use the complete path like
/path/to/env/bin/python script.py you
do not need to activate the
environment first. You have to use
source because it changes the
environment in-place. After activating
an environment you can use the
function deactivate to undo the
changes.
The activate script will also modify
your shell prompt to indicate which
environment is currently active.
so you should just use activate command which will do all that for you:
> \path\to\env\bin\activate.bat
| d27ebad34f91799f0b7fd7e7421df507e090902d58e0453db6837855b3a9d1ff | ['b78dc23bd24447a9a70d735a77be1d7c'] | You should change your form's action to your django view and in your view you can re-post to https://me.s3.amazonaws.com/:
In your template
<form action="http://mywebsite/upload" method="post" ...
In your view.py:
def upload(request):
# Your treatment here.
# Post the data to amazon S3.
urllib2.urlopen("https://me.s3.amazonaws.com/", your_data)
...
|
e7b88a99fcdb91ff96817ecba51289028be54869ca136e5ff27f88fd47b3a9fa | ['b7924e4de78e40bd8345f91f5280dff4'] | Currently my threads in mutt are sorted by descending order of date, but emails on the same date are sorted in ascending order of time.
This is what I have in my .muttrc:
set index_format="%4C %Z %{%b %d} %-15.15L (%4l) %s"'
set sort_aux = reverse-last-date-received # like gmail
set date_format = "%m/%d/%t"
Do you guys have any ideas for this? I tried searching, but I am not sure if anyone else found this problem.
Thanks!
| 921447eba8007d26bbc64c74625c57b35317c6a4ae593f3341d97535fe45664a | ['b7924e4de78e40bd8345f91f5280dff4'] | This works but it is clunky. First, to select all the messages requires scrolling through them 100 at a time. I tried moving only 600 of my spam from November and got an error message, though most were moved. I was able to search what I moved for specific keywords, but then I worried that all the moved messages had been reclassified as legitimate because Yahoo offered to classify them as spam. So I re-selected them (100 at a time) and classified them again as spam. But I received an error message and had to select spam again to get all the messages moved. |
318e68d83bef534eac6f6a95820ef843dfe296a8e5decbbf4f6d5714a26bc56b | ['b794f7b567974c5cbd32712d20ce91a2'] | It's possible the difference is in the CORS support, or misconfigured CORS support.
In WebSphere Liberty the support is configured in the server.xml using the cors tag.
In WebSphere Traditional 8.5 you may need some JAR file additions as described here along with the relevant app configuration.
| 7a487bf2b75f53673f97b4fafe9f98fb7a449f39cd9b67fcb5a635c1fa152ff7 | ['b794f7b567974c5cbd32712d20ce91a2'] | There are some resources for speeding up application deployment, but they don't revolve around parallel deployment. For many reasons, I don't see parallel deployment being advised. Deploying two EARs at the same time would likely make both take twice as long.
You could automate the deployment into a wsadmin script or look into some ways to speed deployment or if the applications being deployed are large and have lots of binaries or packages that do not have JEE annotations, you can look into annotation filtering which can reduce deployment time.
It wasn't specified, but if you are using WebSphere Liberty, then application deployment is inherently different, so you could specify all of the application configuration data in one place, the server.xml, and simply copy the EARs to deploy.
|
831897fb49cf7159f6fc46405ecbae69c9886553a0afb01576fc14d93442fc4b | ['b7965331655f42d282201bf82121a432'] | `iperf` shows 907 Mbit connection. I disabled `UAS` it was still the same, then I added a dedicated power supply to the adapter (it has a socket for it) and still I only get 32 MBytes/s. Not sure what is left. Btw its a HDD / Gen 1 SATA I believe not an SSD | 8cc68447b300347c73d861501c319713f0f0bee3b800910e9e10edd7bed26f62 | ['b7965331655f42d282201bf82121a432'] | I have a web app which can be accessed from http://example.com
I'm developing locally another web app which I want to access it from the same domain but different path. Let's say I want all traffic from http://example.com/my-local-app/* go to my web app served from localhost:8080. All other requests should go to remote http://example.com. How can I achieve that?
|
0280c269ebe0b2c3ddd93dd028608e13a144ca85004aacf3dfef9b7e52f24da2 | ['b7ad5611868c43bc85c7610a8c614040'] | You have asked to get photos from Facebook account.After searching many hours Facebook Developers pages,I got solution for your question, I have provided link to get Facebook user photos, follow that.
Link:
https://developers.facebook.com/docs/graph-api/reference/photo/#Reading
/* make the API call */
Bundle params = new Bundle();
bundle.putExtra("fields","images");
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/"+"USER ID"+"/photos",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
/* You can parse this response using Json */
}
}
).executeAsync();
| cfdda22e98988858472deb50775845f55af36260b10cb8cf71fe7fa007deca7a | ['b7ad5611868c43bc85c7610a8c614040'] | If you see your image URL, every time you update new Image, the server would provide same URL(having no changes),but it may be different.That means first upload one image and get first image URL next upload second image and then get second URL, just compare both URL's. If both were same , Picasso doesn't update it,instead it keep calm.So use Native method that is load bitmap and show it in ImageView,it definitely update it.
|
3e92725c4dfebf261a9af32353ba2c14983db3538b07733ffcf15c4586bd400f | ['b7ae3e2943bb4796afa28c9b3ebdec74'] | Adding to what <PERSON> answered :
you can use something like this also :
PreparedStatement pstmt = con.prepareStatement("INSERT INTO `table`
(pid,tid,rid,tspend,description) VALUE
(?,?,?,?,?)");
pstmt.setString(1, pid );
pstmt.setString(2, tid);
pstmt.setString(3, rid);
pstmt.setInt(4, tspent);
pstmt.setString(5,des );
pstmt.executeUpdate();
Kindly Note its benefits:
1."Query is rewritten and compiled by the database server"
If you don't use a prepared statement, the database server will have to parse, and compute an execution plan for the statement each time you run it. If you find that you'll run the same statement multiple times (with different parameters) then its worth preparing the statement once and reusing that prepared statement. If you are querying the database adhoc then there is probably little benefit to this.
2."Protected against SQL injection"
This is an advantage you almost always want hence a good reason to use a PreparedStatement everytime. Its a consequence of having to parameterize the query but it does make running it a lot safer. The only time I can think of that this would not be useful is if you were allowing adhoc database queries; You might simply use the Statement object if you were prototyping the application and its quicker for you, or if the query contains no parameters.
| aae9a12799a41d66901afdecd2d70412a88838f5fe98aa943ede86d4a3865e46 | ['b7ae3e2943bb4796afa28c9b3ebdec74'] | Today again after long I caught in this issue. Every-time I fix this problem and move on but this time I tried understanding the root cause and get it fixed and since the fix which worked for me is not in the answers to this question, thus adding part with details :
I am using EGit plugin in eclipse, and the problem was same as OP - eclipse compare tool was not highlighting the differences rather a whole block as if the whole file has changed.
Lets understand the issue first , since I was aware that this is related to CRLF vs LF eol , so went to check that first and enabled the visibility as :
Eclipse -> Preferences -> Text Editors -> Show whitespace characters
In the above click on configure visibility.
Now as you see highlighted in above image, select the check boxes under Trailing and against both Carrier Return (CR) and Line Feed (LF).
Apply - Save and Close. Now in my case , file looked like this :
and this evident that for me I had CRLF window like eol which further also confirms as I do not have core.autocrlf set to true and by default it is false thus Git actually didn't tried to do anything about my EOL delimiters (as expected in this case).
And until this stage, the compare tool was showing the whole file as changed.
Now, moving to fix which worked for me.
Since, I wanted to get this fix within IDE realm, thus I first converted the particular file to Unix delimiters as :
Then my file became with LF (Unix delimiter) eol :
And compare tool started highlighting the delta.
So the issue as it was assumed was because of CRLF (window style) eol and eclipse comparator was not able to highlight delta rather whole file.
Then, instead of changing each file or package to Unix delimiters .
I updated in Eclipse->Preferences -> Workspace
By this, eclipse takes care of line-endings for new files to Unix, so that text files are saved in a format that is not specific to the Windows OS and most easily shared across heterogeneous developer desktops. After all this compare tool worked happily ever.
Hope this helps.
|
1f6500cd407724ff59568bdd7e3e6c34ab221fe23e00c3cc9b7a025c008f3a16 | ['b7b1b17db581477abc77d2f5d5f4b785'] | I read this book. For graphics I installed FLTK on my compiler, MS visual studio 2012. The machine I'm using is MS Windows 7.
I have read that book until chapter 17 and I haven't studied any method for waiting. By waiting I mean executing a statement, making the system to wait for a while, and executing second statement.
In the following there is a simple example that draws two shapes on the window. The graphics libraries used for the book are here.
For example in this code I have two circles with two different positions and different radiuses.
I want to attach first circle (c1), than wait one second, detach the c1 and attach the c2 this time. What is simplest method for waiting for one second of time (or more) please?
#include <Windows.h>
#include <GUI.h>
using namespace Graph_lib;
//---------------------------------
class Test : public Window {
public:
Test(Point p, int w, int h, const string& title):
Window(p, w, h, title),
quit_button(Point(x_max()-90,20), 60, 20, "Quit", cb_quit),
c1(Point(100,100), 50),
c2(Point(300,200), 100) {
attach(quit_button);
attach(c1);
attach(c2);
}
private:
Circle c1, c2;
Button quit_button;
void quit() { hide(); }
static void cb_quit(Address, Address pw) {reference_to<Test>(pw).quit();}
};
//------------------
int main() {
Test ts(Point(300,250), 800, 600, "Test");
return gui_main();
}
| aada810a78aa9b78dcf26b0834faf8b201ee7eb4c1b697f9e77a9c7e98ca9f4a | ['b7b1b17db581477abc77d2f5d5f4b785'] | This is my simple code:
#include "C:\Users\Myname\Desktop\Documents\std_lib_facilities.h"
using namespace std;
//**************************************************
int main()
try {
ifstream ifs("C:\Users\Myname\Desktop\raw_temps.txt");
if(!ifs) error("can't open file raw_temps.txt");
keep_window_open("~~");
return 0;
}
//**************************************
catch(runtime_error& e) {
cerr<<e.what();
keep_window_open("~~");
return 1;
}
The .txt file is in address "C:\Users\Myname\Desktop\raw_temps.txt".
When I run that, only the error (" ... ") function operates and theifs can't open the raw_temps.txt file.
Why please?
|
5411aa3a02e65e78b323248fcb625aef9b764dd4cba9308b3178cd6b763bb59d | ['b7b33f9c1dbe47d492b61f193c196195'] | It's a tricky example, but the $S_N1$ process is favored because the solvent is protic and the resulting 6-member ring is more stable than a 5-member ring.
If ring expansion weren't possible, I believe your intuition is correct that the $S_N2$ mechanism would dominate. See this discussion. You're not alone!
| e802bc4f915dc25d7b28768a5da67f1863aba4288e6e87dba636e59ab4d263b4 | ['b7b33f9c1dbe47d492b61f193c196195'] | $\newcommand{\Ket}[1]{\left|#1\right>}$
$\newcommand{\Bra}[1]{\left<#1\right|}$
$\newcommand{\BraKet}[2] { {\left<#1} \left|#2 \right>}$
It turns out the trick is not a matter of exploiting symmetry or alternate derivations, but rather a simple bookkeeping trick!
$E^{(2)}= \sum_{ijab}^{SF}
\frac {\Bra{ij}\left.ab\right>^{2}
-\Bra{ij}\left.ab\right>\Bra{ij}\left.ba\right>
+\Bra{ij}\left.ba\right>^{2} } {\Delta _{ab}^{ij}}$ can be broken into three sums:
$E^{(2)}= \sum_{ijab}^{SF} \frac {\Bra{ij}\left.ab\right>^{2}} {\Delta _{ab}^{ij}} -\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ab\right>\Bra{ij}\left.ba\right> } {\Delta _{ab}^{ij}}
+\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ba\right>^{2} } {\Delta _{ab}^{ij}}$
The beauty is that the indices of each summation are independent of the indices of the other summations. As such, I am free to rename a as b and b as a in the third summation:
$\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ba\right>^{2} } {\Delta _{ab}^{ij}}= \sum_{ijba}^{SF} \frac{\Bra{ij}\left.ab\right>^{2} } {\Delta _{ba}^{ij}}$
Which, because a and b behave the same in the summation (both over unoccupied MOs) and in the denominator (both represent the energy of an unoccupied MO), can be rearranged as:
$\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ab\right>^{2} } {\Delta _{ab}^{ij}}$
(In pseudo math, $\sum_{ijba}^{SF} = \sum_{ijab}^{SF}$ and ${\Delta _{ab}^{ij}}= {\Delta _{ba}^{ij}}$). Putting it all together, we get
$E^{(2)}= \sum_{ijab}^{SF} \frac {\Bra{ij}\left.ab\right>^{2}} {\Delta _{ab}^{ij}} -\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ab\right>\Bra{ij}\left.ba\right> } {\Delta _{ab}^{ij}}
+\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ab\right>^{2} } {\Delta _{ab}^{ij}} = 2\sum_{ijab}^{SF} \frac {\Bra{ij}\left.ab\right>^{2}} {\Delta _{ab}^{ij}} -\sum_{ijab}^{SF} \frac{\Bra{ij}\left.ab\right>\Bra{ij}\left.ba\right> } {\Delta _{ab}^{ij}} = \sum_{ijab}^{SF} \frac{2\Bra{ij}{ab}\left.\right>^{2}-\Bra{ij}{ba}\left.\right>\Bra{ij}{ab}\left.\right>}{\Delta _{ab}^{ij}}$
Which proves the equality.
|
60c3176c26224a2425f004fdbe09d98800c89996057d081bc1d193d64d4e509b | ['b7c62fb3dfa9405ea753f98bc5a0c853'] | <div class="row align-middle">
<div class="small-4 columns">
<div></div>
</div>
<div class="small-4 columns">
<div></div>
</div>
<div class="small-4 columns">
<div>I want to be on the right edge of the parent .row</div>
</div>
</div>
I have the above.
I want the div that's in the third .columns div to be aligned to the right (so that it would look the same as if I put text-align: center on the third .columns div).
I know a way to do so - by putting another .row div inside that column and giving that .row another class of align-right and putting then another .columns inside of that row - but this would result in an unnecessary amount of HTML and I assume Foundation must have provided me a way (another CSS class that I can't find in the docs) of achieving my goal without further HTML than is above.
How do I do this? Or do I have to put another row and column inside that third column?
.columns doesn't have display: flex so I can't put align-right on the column - won't work. Or are .columns meant to have display:flex and I'm just experiencing a bug or otherwise an issue I've possibly created somewhere?
Thanks
| 42b14f9874e52c049edada0731a2ef4c8fc19f55f04720611512469b043e3f51 | ['b7c62fb3dfa9405ea753f98bc5a0c853'] | I have WordPress installed on example.com.
I am making a multi-lingual site, with English on the main root domain and french on a sub domain:
fr.example.com
The way i'm setting it up involves just the one WP installation (on the main domain), and have the sub domain point at the root of the main domain.
So, in cPanel, I have set up the sub domain's document root to be the same as the main domain (/public_html).
The problem is that I am getting redirected to example.com when I visit fr.example.com.
The hosting tech support told me I am doing it correctly in cPanel, so it must be the code of WP that is redirecting the visitor to the main domain.
I'm not sure if this is the .htaccess file or something with the PHP of WP.
Does anyone know what my problem is and how I can fix it?
Thanks!
|
545975e73a8af2b66702d11c595b9b86abca9a40228c342b3d424034094327f7 | ['b7d4fce16d8143879054fbc265875617'] | As far as I see, while loop does not enforce any restrictions. Well my suggestion would be something like this:
$i = 1;
$cssClass = 'item';
$columns = 4;
while ($row = @ mysql_fetch_array($results))
{
$class = $cssClass;
if (($i % $columns) == 0) {
$class .= ' clear';
}
print "<div id='{$class}'>" .
"<p>Product id " . $row["ProductID"] . "</p>" .
"<p><img src=" . $row[" Image"] . "></p>" .
"<p>£" . $row["Price"] . "</p>" .
"<p>" . $row["Description"] . "</p>" .
"</div>";
$i++;
}
And then in css define:
.clear { clear:both; }
| 3edd83982be0d8570a388c01a4e1a49a399fc92915669ce2ed9ee892ca6e6d12 | ['b7d4fce16d8143879054fbc265875617'] | First look at example of using php session-based flash messages http://mikeeverhart.net/php/session-based-flash-messages/
Usual flow:
User fills in the form
Presses submit
Your php script sendmail.php validates the form
If there were some validation errors [set error message]
If there were some mail sending errors [set error message]
If everything is ok [set success message]
Call from php redirect to the form display page.
[set error|success message] - using the link provided above how to set the message.
Now important part every time you render your form, you should check for set messages, if there are some messages - display them.
How do those messages work?
It simply sets the message to session ($_SESSION) array, and then when the message is displayed, the message is unset from session.
|
2be9ec056433e0df790988362604689802f3a4cda21424b1fb052c2c21862530 | ['b7f1c0cbc8e84d7391758e7bc463ce59'] | OK, the problem turns out to be 'azure' calling execve() with the string "/usr/bin/node\r".
A workaround is to do this:
% cd /usr/bin
% sudo ln -s ./nodejs ./node^V^M
Yes, sticking a DOS carriage return (that's Ctrl-V Ctrl-M) at the end of the filename gets you past this problem, but who knows what's going to crop up next. I was at least able to import my subscription info and 'azure' subcommands seems to be working so far.
| bbfd2aaad1ad5290363feff9b4a802cf11a5eab85c9b56081169ce5ba7a13228 | ['b7f1c0cbc8e84d7391758e7bc463ce59'] | Just installed node.JS so I could install the Azure cmd line tools on a CentOS 6.3 machine.
According to this, there's a problem with 'azure' invoking 'node' (per strace). Since MSFT doesn't support Azure at all, apparently, I'm wondering who gets bug reports like this, and does anyone else have a solution?
[murphstein@localhost ~]$ which node
/usr/bin/node
[murphstein@localhost ~]$ which azure
/usr/bin/azure
[murphstein@localhost ~]$ ls -l /usr/bin/{azure,node}
lrwxrwxrwx. 1 root root 35 Sep 8 13:57 /usr/bin/azure -> ../lib/node_modules/azure/bin/azure
lrwxrwxrwx. 1 root root 8 Sep 8 13:56 /usr/bin/node -> ./nodejs
[murphstein@localhost ~]$ strace /usr/bin/azure
execve("/usr/bin/azure", ["/usr/bin/azure"], [/* 38 vars */]) = 0
brk(0) = 0x1160000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5928bd9000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=49164, ...}) = 0
mmap(NULL, 49164, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5928bcc000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\355\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1912432, ...}) = 0
mmap(NULL, 3741864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5928629000
mprotect(0x7f59287b2000, 2093056, PROT_NONE) = 0
mmap(0x7f59289b1000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x188000) = 0x7f59289b1000
mmap(0x7f59289b6000, 18600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f59289b6000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5928bcb000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5928bca000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5928bc9000
arch_prctl(ARCH_SET_FS, 0x7f5928bca700) = 0
mprotect(0x7f59289b1000, 16384, PROT_READ) = 0
mprotect(0x7f5928bda000, 4096, PROT_READ) = 0
munmap(0x7f5928bcc000, 49164) = 0
brk(0) = 0x1160000
brk(0x1181000) = 0x1181000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99158576, ...}) = 0
mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5922798000
close(3) = 0
execve("/usr/local/bin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/bin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/sbin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/sbin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
execve("/home/murphstein/bin/node\r", ["node\r", "/usr/bin/azure"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
write(2, "/usr/bin/env: ", 14/usr/bin/env: ) = 14
) = 5e
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2512, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5928bd8000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2512
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f5928bd8000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(127) = ?
[murphstein@localhost ~]$
|
56826218103a470a0fbf50895a1af01980ae5db916339be06bace969c789c4ba | ['b7f61c0670a94c8184e2294c66607e40'] | I have a set of elements inside a container with menu items arranged alphabetically. I have set width of each element and floated them left, thus creating columns. My problem is that the alphabetically order then is set horizontal.
Can I break the row of divs in vertical columns somehow? It's bout 150 elements, and I want 25 in each so six columns.
My html:
<div class="treemenu">
<div class="clip"></div>
<div class="clip"></div>
<div class="clip"></div>
<div class="clip"></div>
<div class="clip"></div>
</div>
Jquery or css would be prefered solution.
| df4403e2c06d76430de105b46cefefa8f0c6a89605864443496078374fb3ef41 | ['b7f61c0670a94c8184e2294c66607e40'] | I have a string inside an div and I want to target this div if the number is 0 - and if its the only character. The currency symbol changes so I can't use that.
As soon as the string is €1, €10 etc and don't want to target it - only if its 0 and one number in the string.
I want to use a if variable or something similar since I need to append and add a class when the string is matched. Something like:
if( $code to match the string )
{
$( "em.headcartsum" ).addClass( "hide" );
}
<span><em id="headercartsum">€0</em></span>
|
8cba6585666591599405bc8403b8282ce1c8355f9f63d4993057b697e9aeb2c5 | ['b7fd5c9c9f6c4410806806b9e287676a'] | I have been searching online to find a simple basic chat application example, i find a lot of them with PHP (index.php) with mysql and ajax. However that is not what i need, i need a simple Peer to Peer and Peer to Group chat source or tutorial links using the below.. index.HTML, PHP on server side, authentication using MYSQL and ajax.
I am not asking for a complete code, may be a reference or any Idea would be great.a refference to any url that meets my requirements. I am particular about HTML is because this simple chat will be on phonegap and phonegap understands only HTML and jS.
It is a HTML chat application, using server side PHP.. a basic chat application example would do...
| 6f9b89ad838237e8e20d91fb858daf791741ce7ae113e2df9ac6ffa7b4504b84 | ['b7fd5c9c9f6c4410806806b9e287676a'] | I am trying to archive the below,
All the heading should be aligned Center
"The values of 1st Column=Align Left" and
"All Values of 2nd, 3rd, and 4th Column=Align Center"
how to archive this, when i have auto-incrementing values in my table
HTML:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
body > table > tbody > tr > td{
text-align: center;
}
body > table > tbody > tr > th
{
text-align: center;
}
</style>
</head>
<body>
<table>
<col width="55%">
<col width="15%">
<col width="15%">
<col width="15%">
<tr>
<th>Month</th>
<th>Savings</th>
<th>Money</th>
<th>Cars</th>
</tr>
<tr>
<td><PERSON>>
<td>$100</td>
<td>$100</td>
<td>$100</td>
</tr>
<tr>
<td><PERSON>>
<td>$80</td>
<td>$100</td>
<td>$100</td>
</tr>
</table>
</body>
</html>
|
217a9ab36997921974bc71ce991162a198535355ff97b02fd282ada68764db05 | ['b80c2f8f39ce4ab88ac087c7c96651ef'] | I know this is an old thread, but it was one of the first results I got on Google
"Kana" shows a special keyboard with hiragana characters instead of the English letters. The iPad keyboard will show a grid with all the characters. The iPhone keyboard groups them by consonant to have less on-screen keys, and sets a direction for each vowel. You can either hold and flick in a given direction or repeatedly tap to get the desired characters (just like old 2000 phones)
"Flick only" is an option that only on iPhones or iPhone apps running on an iPad (like Instagram) because that's the only way to show the iPhone keyboard on an iPad, and it deactivates the option to tap repeatedly, only allowing you to type characters by flicking
| e86b0ce3fc3584423b985d67cf94eb4c11fd03d2998704d8c5c6971057c9d185 | ['b80c2f8f39ce4ab88ac087c7c96651ef'] | I'm reading a book in Design Patterns, and below is some code example used by the author. The author tries to build a html builder as (code in C#):
public class HtmlElement
{
public string Name, Text;
public List<HtmlElement> Elements = new List<HtmlElement>();
public HtmlElement() { }
public HtmlElement(string name, string text)
{
Name = name;
Text = text;
}
// factory method
public static HtmlBuilder Create(string name)
{
return new HtmlBuilder(name);
}
}
//builder class
public class HtmlBuilder
{
protected readonly string rootName;
protected HtmlElement root = new HtmlElement();
public HtmlBuilder(string rootName)
{
this.rootName = rootName;
root.Name = rootName;
}
public HtmlBuilder AddChild(string childName, string childText)
{
var e = new HtmlElement(childName, childText);
root.Elements.Add(e);
return this; //fluent api
}
// to return a HtmlElement object
public static implicit operator HtmlElement(HtmlBuilder builder)
{
return builder.root;
}
public override string ToString() => root.ToString();
}
then the author says:
"To simply force users to use the Builder whenever they are constructing a HtmlElement object, we have hidden all constructors of HtmlElement class as":
public class HtmlElement
{
...
protected HtmlElement() { }
protected HtmlElement(string name, string text)
{
Name = name;
Text = text;
}
...
}
so users can go like
HtmlElement root = HtmlElement.Create("ul").AddChildFluent("li", "hello").AddChildFluent("li", "world");
Console.WriteLine(root);
here is what I don't understand, the author changed the access modifier of HtmlElement's constructors to protected, which means that HtmlBuilder class cannot access to the protected constructors like
protected HtmlElement root = new HtmlElement(); // not allowed
so does it mean that we need to let the HtmlBuilder inherit from HtmlElement? But they are no inheritance context at all, so how can I modify it?
|
6f8bb16ad233d9b31abff31f05b0b65c841198fbef4d27253d03b5b3a064c2ef | ['b813677f32b8415695cb82cf67a060a2'] | I'd like to have a script for npm that did the following:
Gets a list of files inside a folder (and subfolders)
Write it into a JS file, with the following format:
module.exports = [
"folder/filename.png",
"folder/subfolder/filename.png"
];
I'm currently doing it like this using the cli in Linux:
echo 'module.exports = [' | tee files.js && find . -name "*png" | sed s:"./":" '": | sed s:".png":".png',": | tee files.js --append && echo '];' | tee files.js --append
Which is a bit contrived and not really cross platform. Are there any npm packages that provide similar functionality? I'm kinda lost on it.
| 2377dfcc3fe23cccadf2ee4e6cd322a1b9889f6427cc6e39cf2f9385fb849093 | ['b813677f32b8415695cb82cf67a060a2'] | I'm a game developer and I have been trying different structures to see what would give me the best results but it seems that JavaScript is mostly unaffected by data locality, meaning that processing times are within margin of error and memory usage is mostly as expected.
Does data locality matter at all in JavaScript or am I just wasting my time trying to improve certain structures?
Is it due to the sandboxed nature of the execution environment (i.e. it would matter outside the browser)?
|
838e452f2ef59f6f3bfd321deaa2a45f23dd4a6e131e97a85e6f499b66307f20 | ['b8263fdc8d634892943b949f8ec111e6'] | If you are yielding as tuple then you should be using tuple as param in your sortBy and map as following:
def getIDsSortedByFinishDate()(implicit session: Session): List[String] = {
(for {
(p, t) <- Projects leftJoin ProjectData on (_.id === _.project_id)
} yield (p,t)).sortBy{ case(p, t) => t.project_finish_date }.map { case(p, t) => p.id}.list.distinct
}
| ae770b7dccd303ab5872f6c6525d7a0571b102b8e59717cabcfb44d0beed94d1 | ['b8263fdc8d634892943b949f8ec111e6'] | You can use simple boolean as a flag value to show alert. You may need to save your boolean flag somewhere, perhaps in Shared Preferences and upon init you can implement something like following
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences();
Boolean isShown = prefs.getBoolean("isShown", false);
// Check Boolean Flag
if(isShown) {
// Your Alert Snippet
}
// Inverse Flag Value
prefs.edit().putBoolean("isShown", !isShown).commit();
|
1b74735edda2222d8bdd65e776f21f014caaa89e4cc60bfedb94a63fc3bf8da5 | ['b82bc98478664a29b5ea0ee219f2e8c7'] | Challenge Not yet complete... here's what's wrong:
The '<PERSON>' contact role for 'Greendot Media' could not be found.
Relate a Contact to Multiple Accounts. Then add Yourself to an Account Team.
Your VP just connected you to a new contact, but the contact works with two different companies. To pass this challenge, relate the new contact to the two different accounts. Then, add yourself to the account team. In order to complete this challenge, you need to have Contacts to Multiple Accounts and Account Teams enabled. The Related Contacts and Account Teams related lists must be on the Account page layout. The Related Accounts related list must be on the Contact page layout.
Create an account with the Account Name 'Acme Corporation'.
Create an account with the Account Name 'Greendot Media'.
Create a contact with First Name = '<PERSON>', Last Name = '<PERSON>'. In the Account Name field, enter 'Acme Corporation'.
From the Greendot Media account record, use the Related Contacts related list to add a relationship with <PERSON>.
Add yourself to the account team for the 'Acme Corporation' account with the Team Role of 'Account Manager'.
| 425b5153502e16ef5ebf1d80414d3b1019aaa9343df9153e46d8e3128c6293f5 | ['b82bc98478664a29b5ea0ee219f2e8c7'] | Face recognition drones
You can already find some pretty crazy simulations of swarms of bird sized drones, air dropped, that will just run to your head and detonate a directional explosive charge. add some bigger drones for door or window breaking, and you get a perfectly plausible mass killing weapon. Crazy expensive, but with minimal structure and nature damage. You can even set it up to recognize facial patterns to target specific range of people (the ethical one would be to not kill children, the unethical that come to mind is focusing a special ethnicity or group of people), or even specific people, like politic opponents, registered criminals, or people still using facebook. Any database with faces will do.
the limits of the weapon will be bunkers or any better defended place, but you can still adapt with big mama drones and stuff like that. firearms will do very little against your drones if they have correct flying patterns. A helmet won't protect you from the explosive charge from the drone (a slug ammo will go right throught a helmet) but it can protect your face to be recognized, so it comes to a recognition warfare (full humanoid body detection counter the helmet), to defend against this recognition you'll try to get out of the pattern, etc.. Also some countering will happen with jamming comms between drones and the "motherships" that coordinate the attack, but it won't stop much.
All in all, you should evaluate the kill cost to 100 dollars per head (single use drones are quite cheap), maybe 2000 dollars for a door opening, adding maybe 1M$ for highly amoral software dev and you will also need some delivery system. But then you can kill 95% of a city population in a night.
That's f*cked up, by the way.
|
b2fb3d5881d1b2b479684197904323cb9b5ad5d55f80ac0ca4e1511e81d0fb88 | ['b85cc06239a04328b4943652be852553'] | My maths teacher at high school used to tell the class that he really would've wanted to become a dentist. He didn't say why, I suspect because it's better payed and because it was supposed to be a funny thing to say. Reality is that I agree that he should've become a dentist! | f97f87982e5bf14610eae1fe632defcbd29bf2cfcda25946230c88096fa56274 | ['b85cc06239a04328b4943652be852553'] | Closing this question goes against the grain of the desire to make Stack Overflow and the entire Stack Exchange network [a more welcoming place](https://stackoverflow.blog/2018/04/26/stack-overflow-isnt-very-welcoming-its-time-for-that-to-change/). Marking as a duplicate of a question asking for books is downright insulting. This question has a short and simple answer; it does not require a book. |
744ce2f3dfb011e595699b3639918612bf998ba682c3d061d100a5009a5d4c7a | ['b85f9b5ca6f143c3930fbe6ee3f1e402'] | I'm working out a solution to a complicated file copying workflow in a laboratory environment. One solution hinges on normal users (who must not have administrator privileges) running a script that will share a directory owned by them on the network. Is this possible?
(I don't have access to any Windows 7 machines - otherwise I'd test this).
For context, the workflow would go something like this:
User logs in
Script runs automatically, sharing a directory (eg, My Documents\MyData) on the network as "MyData", read/writable by anyone. (In reality, this network has only one other PC, immediately next to it physically, so there's no actual security risk.)
On the other PC, a script mounts the "MyData" shared directory.
The same physical user saves data to this shared MyData folder from the second PC.
User logs out of both PCs, script unmounts everything.
Hence, the directory that the user is saving to from PC 2 is dependent on which user is logged in on PC 1.
If the rest of that isn't possible as well, please say so :)
| b908372bbd57f463f1c52bc467abb9e51b86fc3ba10de1091710dd142fa51b3b | ['b85f9b5ca6f143c3930fbe6ee3f1e402'] | I frequently move my laptop (OSX) between different wifi areas, but my home base has an ethernet connection and relies on my organisation's proxy.pac file. When reconnecting after a stint on the road, I often get a problem where pages simply don't load in Chrome or Firefox. They just eventually time out. I think this is related to the fact that the proxy requires username and password - perhaps it just discards unauthenticated requests or something.
I discovered by trial and error that in FireFox, if I go to the proxy settings, and press "reload" on the proxy configuration, then the problem goes away. Eventually Chrome will pop up the proxy authentication dialog, but it can be hard to see (usually comes up in the wrong Spaces window, sometimes disappears straight away, can be buried under other application windows etc).
So my question is: how can I tell Chrome to reload the proxy.pac file, since that works for Firefox? (I thought I had solved the problem by saving the proxy.pac file locally, but apparently not).
|
19e4b73d0bfa937a4aa43ee09be02b41de840f00b3bc7fc263f98c61368d22c7 | ['b86bfba1c6ec4c58881527953930fade'] | Yes, this works - thank you for your time and showing a simpler path to the target! I am still not sure why the original worked when all the ids *were* present (regardless of the argument reference name) but raised an exception when there were ids that didn't exist in the target. | d1c984960a3a20cba598383d2c839a20247f4c932143152f216ee7d42f147582 | ['b86bfba1c6ec4c58881527953930fade'] | In earlier versions of Outlook, adding a signature to an email made that signature the default (a hihgly useful feature!) until it was changed by selecting a different signature. For example, on new emails I use a complete signature with name, phone, email, company, etc; on replies, only a three line, name, company and phone. Now I have to scroll through the list if I am adding a signature. Microsoft, why don't you ask people about such features before discarding them?
Anyone know how to implement this feature on outlook 2010 or to set one signature as the default?
|
483c8297cf7f77db92796d4cc623990a87dbd2b781522d2e31540a02b1a1ef61 | ['b876fe18116c4eeb934b589e6356acdf'] | I currently using this code:
!E::WinMove,A,,0,0,1920,1080
My current screen resolution is 1920x1080, and this script works just fine. But with this script it won't:
!<IP_ADDRESS><IP_ADDRESS>WinMove,A,,0,0,1920,1080
My current screen resolution is 1920x1080, and this script works just fine. But with this script it won't:
!E::WinMove,A,,0,0,1920,3000
The last argument - the Height of the window, if it's greater than my screen resolution's height, it won't work at all. Is there a way to work this out with autohotkey or changing any default windows's settings? Thank you very much.
| 0f3f66113be29fb38bbe1364f04f68ccdc9e9ec22ff1685cb0ff674e7ef55e48 | ['b876fe18116c4eeb934b589e6356acdf'] | To demonstrate my question, here's my version of HTML:
<body>
<a href="google.com">
<div>
<h2>Hello</h2>
<h4>Venus</h4>
</div>
</a>
</body>
Then I use 'onclick' for the body in Javascript:
document.body.onclick = function(event) {
console.log(event.path)
}
When I click on the 'h2' tag, the console will log only [window, html, body, a] and not the elements inside of the 'a' tag.
The result I want is when I click the 'h2' tag, event.path will return an array of [window, html, body, a, div, h2]
This problem also exists with the 'p' tag.
Is there a way for the 'event.path' to includes elements inside 'a' tags? Thank you very much.
|
57e4419edd5372eb2726c24300a44c7f4b921de2f9a36e16eeb96b08af7a0317 | ['b879b3f5716b44c99b6113f1f4169f5e'] | $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.example.com/api-api-ng/v1/function?lat=50&lon=8&radius=500&statement=2");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = array();
$headers[] = "Accept: application/json";
$headers[] = "Authorization: Bearer APIKEY";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
echo $result;
| f607fb9bb77038c8ae62021dd67a96156f1bebd4c8ade3e0a4b34e3d785fde9b | ['b879b3f5716b44c99b6113f1f4169f5e'] | I have two tables
Table 'Teams' has two columns
teamID,
teamName
Table 'Match' has three columns
matchID,
teamID_1,
teamID_2
... like in image bellow:
How would I construct a select statement which will pull through the Teams.teamName to both the Match.teamID_1 and the Match.teamID_2 based on their respective IDs?
I can do that only with one column or another, but not both:
SELECT Match.matchID, Teams.teamName
FROM Match
INNER JOIN Teams ON Match.teamID_1 = Teams.teamID
OR
SELECT Match.matchID, Teams.teamName
FROM Match
INNER JOIN Teams ON Match.teamID_2 = Teams.teamID
|
93a80b263bb6473f9dcfa7854a7c01eddcc94ff104083b64f01628aa2ed85e0d | ['b88b66373202433abfe9579b82dc61da'] | I am trying find solution to get direct video URL for youtube videos. But i am not able to find any solution.
I am currenlty using Youtubedownloader
.When i click on download video it generates link to video but its not actually recognized as download link in my web application. I am trying to upload remote video with this url but it says no video found in my web application.
currently its generating links like this.
https://r3---sn-25glen7y.googlevideo.com/videoplayback?mm=31&mn=sn-25glen7y&key=yt6&signature=51F3C4BA56C96FE593901AD0D28FBA8ED477B287.4A15A870692675DDFBC94819EAEB59C9D8DB4141&mt=1495042064&pcm2=yes&mv=m&ei=X4gcWfiiHJCMcJHqmIAO&pl=16&ms=au&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cusequic%2Cexpire&usequic=no&mime=video%2Fmp4&upn=ZMkz0gtqWNk&expire=1495063743&initcwndbps=11898750&ratebypass=yes&ipbits=0&lmt=1472845289256331&itag=22&requiressl=yes&ip=<IP_ADDRESS>&source=youtube&dur=243.623&id=o-APOPZz5wo1XWIE0Wyq_veLdgBGr1xgALdohBIGIJRggx&title=How-Does-it-Grow-Cauliflower
What i need to have links generated in "filename.mp4" or "filename.webem" format Is it possible?
| 80c7946b621e609ed8a7a8d6700506e17f17d5851cc0ba7af5279d13ae1b7717 | ['b88b66373202433abfe9579b82dc61da'] | Hey guys I'm new to coding. And I've made a blog. Now with help of online tutorials I'm able to create android webview app in Android studio. But issue is my blog has popups, so those same popups open on app as well, which is annoying as the back button and 50% of popups hangs app.
Is there any way to disable those external links except my original domain link on app? Anyway we can define to not open external domain links.
Pls help. Thank you all.
|
f839d31d0657cbdc7fb13327917dc677527d9270e7b0f7e90ffc6ebe20855242 | ['b895622a09204626a17f4e26bc921473'] | Create Class DataBindingAdapter
and paste
@BindingAdapter("android:onClick")
public static void setOnClickListener(View view, final Runnable runnable) {
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runnable.run();
}
});
}
<PERSON> go to your ViewModel class
and paste
public void onSubmitClicked() {
Log.e("onButtonSubmit", "onButtonSubmit");
notifyPropertyChanged(1);
}
public void onImageClicked() {
Log.e("onImageClicked", "onImageClicked");
notifyPropertyChanged(2);
}
<PERSON> go to your item.xml file and call
android:onClick="@{predictionVM::onSubmitClicked}"
in your Button,
and
android:onClick="@{predictionVM.onImageClicked}
in your imaggView,
<PERSON><IP_ADDRESS>onSubmitClicked}"
in your Button,
and
android:onClick="@{predictionVM.onImageClicked}
in your imaggView,
than go to your ItemAdapterClass
and inside onCreateViewHolder
predictionViewModel.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if (propertyId == 1) {
//do your stuff
}
else if (propertyId == 2) {
// do your stuff
}
| 6a0f88641448247d6cdbfc6c3ec9d24b2acb4f7ad34a3285f08e6387652271d8 | ['b895622a09204626a17f4e26bc921473'] | if you have lower version and getting problem importing project with high gradle version and want to run the project without updating gradle than
open your gradle file(Project) and do the small change
dependencies {
/*Higher Gradle version*/
// classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
/*Add this line and remove the Higher one*/
classpath 'com.android.tools.build:gradle:2.3.3'
}
[2.3.3 is stand for your gradle version]
in your case change version to 3.2 or 3.2.0 something like that
|
50d568fbd86d196dd2ea71ef42b71e4605d5c407fd44337d9d6d8e1b109d9ca3 | ['b8c541770e154f0e82b591f8efb9c920'] | Following <PERSON>'s hint I ended up using stack.gl which "is an open software ecosystem for WebGL, built on top of browserify and npm".
Its glslify provides a browserify transform which can be used in conjunction with gl-shader in order to load shaders. The Javascript would look something like this:
var glslify = require('glslify');
var loadShader = require('gl-shader');
var createContext = require('gl-context');
var canvas = document.createElement('canvas');
var gl = createContext(canvas);
var shader = loadShader(
gl,
glslify('./shader.vert'),
glslify('./shader.frag')
);
| 28e97c4875df174e2567036ff65d4cc6b763ff6f12b535c29c8fbffa58afec2e | ['b8c541770e154f0e82b591f8efb9c920'] | While working on a website I had a similar problem. The carousel contains an animation and some additional information as static slides. The duration of the animation exceeds by far the time needed to read the content of the other slides, so I wanted to set a different timeout for the animation.
The solution is somewhat hidden in the documentation on the code examles page for custom events in the section 'the configuration-event'.
You can access and edit the configuration object via
$('#carousel').triggerHandler('configuration')
and actually assign different timeoutDuration values depending on the item(s) to be shown, for example in the onBefore event handler of the scroll object:
...
scroll: {
onBefore: function(data){
if(data.items.visible[0].id == 'animation'){
t = 30000;
}
else {
t = 5000;
}
$('#carousel').triggerHandler('configuration').auto.timeoutDuration = t;
},
...
|
2d5cddb35f86042b459dfb3ed9797946548e22c56454ed56f7f9914c72f482e1 | ['b8c92f73ee4b41a2bfa5279506866cf5'] | My aim is to setup Matlab properly for distributed computing on many physical nodes.
What have I done?
I have installed Windows Server 2012 r2 on my local network server, installed Failover Cluster tools. Also I have installed Windows Server 2012 r2 on two connected computers in our local network. I have joined them into cluster using Failover Cluster Management.
It was fine, but then I installed Matlab on server and tried to find my own Cluster using Parallel Computing->Discover Clusters toolbox. So I recieved an error:
Could not contact any MJS lookup service. You may not have started
MJS, or multicast protocols may be failing on your network. If you are
certain that MJS is running, specify the host in your profile.
I have found nothing in the Web about how to properly setup cluster using Windows Server 2012 Failover Clustering tools and then use it in Matlab.
Could you help me please? What should I do?
P.S. Sorry for my English
| 3438fb801bf239b760afbe2ac6573fba3e3b85b8095cc96b236674eedc4e1954 | ['b8c92f73ee4b41a2bfa5279506866cf5'] | Altium is driving me crazy right now. I Annotate my schematic, but I do not know why Altium wants to always switch / exchange U109 sub-parts. RC4558 op-amp. I put them in one order and Altium changes it. WHY?
I have tried everything that comes to my mind. Many times removed the part, updated the PCB. Saved and closed Alitum and then put a new part in the same place. So why is this happening and only to U109, even if I change it to let's say U113, this only still happens to this op-amp and it's sub-parts? Is this a bug? What could I do to prevent this from happening? What is the reason and the problem?
|
563679c5be00ff50fafb79e69dff3a0ece2a5789c050e87c1c8f742d65508ee9 | ['b8da08ad697948b6a047db61b70413d2'] | I am using Ubuntu behind a (Windows) proxy. I would like to use the cabal utility.
jem@Respect:~$ cabal update
Config file path source is default config file.
Config file /home/jem/.cabal/config not found.
Writing default configuration to /home/jem/.cabal/config
Downloading the latest package list from hackage.haskell.org
Warning: invalid http proxy uri:
"http://domain\\user:pass@internetproxy:3128/"
Warning: proxy uri must be http with a hostname
Warning: ignoring http proxy, trying a direct connection
^C
The proxy URL has been read from the environment. My proxy requires authentication, but cabal wants the proxy URL to start with a hostname, so perhaps it will prompt me for credentials...
jem@Respect:~$ http_proxy=http://internetproxy:3128/ cabal update
Downloading the latest package list from hackage.haskell.org
No action for prompting/generating user+password credentials provided (use: setAuthorityGen); returning Nothing
cabal: Failed to download index 'ErrorMisc "Unsucessful HTTP code: (4,0,7)"'
What is setAuthorityGen and how do I use it? More importantly, can I enable access via the authenticating proxy? Will I need to tunnel?
| 03fb0de34fc7553f624a59426040d7f621ff02916fa594c4276bd8801fea558b | ['b8da08ad697948b6a047db61b70413d2'] | I think I figured a way to do it. The `Sort` function comes in handy to do `DeleteDuplicates[
Sort[Flatten[StringPosition[sentence, #] & /@ words, 1]]]`. This gives us the desired result `{{1, 3}, {5, 10}, {12, 14}, {16, 18}, {20, 21}, {23, 25}, {27,
29}, {31, 40}}`, where the position of each substring (i.e. word) within the string (i.e. sentence) is given. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.