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 |
|---|---|---|---|---|---|
66fbf7b1968561a264f14c351633b7c88d369dfdc5d31bfdf776ebe88588a28a | ['094026b7d33f4b3f8aac0eaf8d85f72f'] | public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {
Arrays.sort(num);
ArrayList<ArrayList<Integer>> res=new ArrayList<ArrayList<Integer>>();
int i=0;
while(i<num.length-3){
int j=i+1;
while(j<num.length-2){
int left=j+1, right=num.length-1;
while(left<right){
if(num[left]+num[right]==target-num[i]-num[j]){
ArrayList<Integer> t=new ArrayList<Integer>();
t.add(num[i]);
t.add(num[j]);
t.add(num[left]);
t.add(num[right]);
res.add(t);
left++;
right--;
while(left<right && num[left]==num[left-1])
left++;
while(left<right && num[right]==num[right+1])
right--;
}else if(num[left]+num[right]>target-num[i]-num[j])
right--;
else
left++;
}
j++;
while(j<num.length-2 && num[j]==num[j-1])
j++;
}
i++;
while(i<num.length-3 && num[i]==num[i-1])
i++;
}
return res;
}
| c5bbc5c2d83073b74919a49afafdeba6a464e753e32f1fd5f367268022de8dda | ['094026b7d33f4b3f8aac0eaf8d85f72f'] | You will get the result in O(lg n)
public static void PrintIndicesForValue(int[] numbers, int target) {
if (numbers == null)
return;
int low = 0, high = numbers.length - 1;
// get the start index of target number
int startIndex = -1;
while (low <= high) {
int mid = (high - low) / 2 + low;
if (numbers[mid] > target) {
high = mid - 1;
} else if (numbers[mid] == target) {
startIndex = mid;
high = mid - 1;
} else
low = mid + 1;
}
// get the end index of target number
int endIndex = -1;
low = 0;
high = numbers.length - 1;
while (low <= high) {
int mid = (high - low) / 2 + low;
if (numbers[mid] > target) {
high = mid - 1;
} else if (numbers[mid] == target) {
endIndex = mid;
low = mid + 1;
} else
low = mid + 1;
}
if (startIndex != -1 && endIndex != -1){
for(int i=0; i+startIndex<=endIndex;i++){
if(i>0)
System.out.print(',');
System.out.print(i+startIndex);
}
}
}
|
3fb6d3cf45c937a03af9b37daab688a1ad583eacbaaf573780fcaad74725652d | ['094a3a90ab4f419bb5251f4dd0c84f3e'] | I'm doing it like described in this great article http://robots.thoughtbot.com/iteration-as-an-anti-pattern#build-a-hash-from-an-array
array = ["apples", "bananas", "coconuts", "watermelons"]
hash = array.inject({}) { |h,fruit| h.merge(fruit => f(fruit)) }
More info about inject method: http://ruby-doc.org/core-2.0.0/Enumerable.html#method-i-inject
| 9fa12cdbd7c81f0bb22317205e3557723e7a6653ef9ddb9070d40d343b8e4fb2 | ['094a3a90ab4f419bb5251f4dd0c84f3e'] | Have you checked your url in Facebook Debugger?
http://developers.facebook.com/tools/debug
From error message you got it looks like you should set og:type to namespace:object and to get custom image you should set og:image to http://your.domain.com/path/to/user/generated/image
|
455dfb8cb76c1d272f24b2e651d0864ad83cf59dce7f7f149c8dcc002304f739 | ['0975cbffe04c40cbbe5083a15756d01b'] | asdf version manager uses Java, by default, as a runtime build dependency, which you may disable by setting the following environment variable in your shell session prior to issuing the asdf install command:
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
If you accept the default, to require Java for the asdf install command usage, you MUST ensure that the following variables are correctly set:
export JDK_HOME=/usr/bin/java
export JAVA_HOME=${JDK_HOME}
export PATH=$PATH:${JAVA_HOME}/bin
Additionally, you SHOULD only use the update-alternatives --config java command to switch between Java versions (to ensure correct symlinking to takes affect) so that the above variable settings are always correct.
Once you have satisfied these requirements, you can safely go ahead and re-process the asdf Erlang installation successfully with the following syntax:
asdf install erlang <version>
Note: In my particular case I switched from Java version 8 to Open JDK Java version 11 as I suspected that the description of the Java version I was using (ver. 8) featured the word 'sun' in the description. This change of versions eradicated the original warning message I had encountered.
| 63dd07c43b2c8f9453559fcd962be0319ac7b55550538b78c6e343ce9ec3cd44 | ['0975cbffe04c40cbbe5083a15756d01b'] | I've recently written a javascript RegExp to cleanse my data at the front end, I now need to do exactly the same for my PHP back end but not having worked in PHP for a while I'm having trouble. Below is the javascript RegExp, can someone please help me convert this to PHP?
var illegalChars = /[\(\)\<\>\,\;\:\.\~\@\#\$\!\%\^\&\*\'\?\(\)\+\=\{\}\`\\\/\"\[\]]/gi;
var siteSuggest = $(this).val().toUpperCase().split(' ').join('').replace(new RegExp(illegalChars), "");
So, in summary, I want to remove all of the illegal characters globally, remove spaces & capitalize the variable as the variable will be used to create a database or table in sql.
|
82cb98794a113a38035d6459745c3e0a095071a6e4a9fcdd486579836b94d6df | ['0983bddbcef142cc87030d9f9a7832d9'] | I'm developing a BlackBerry 10 mobile application using the Momentics IDE (native SDK).
I have listview that get its data from an XML file using XmlDataModel. The problem is when I try to change an item data, I change the data inside xml file but the problem is that the list in not refreshed with the new data unless I re-enter the page where the list is.
Can any one help me on this ? I will be very thankfull .
| 53805603aa4f0f3ff0f7308cda24e88e818d44b1a3f95c45fc09119ef6eb4bc3 | ['0983bddbcef142cc87030d9f9a7832d9'] | I'm developing a BlackBerry 10 mobile application using the Momentics IDE (native SDK).
I want to display a map using the mapview qml element which seems that it belongs to the blackberry team (it's not a google map). [ Blackberry 10 mapview ]
All I want is to configure the zoom level like google do, but it looks like the blackberry map doesn't have any attribute which can guarantee that except the "altitude" element which can assign some sort of zoom .
Any one can help on this ?
|
a80a58203ae83669eaaeb57853d77e75e769ad58bdde7d9542106be8738ded30 | ['098c7a7b62b443a285f041074e03d617'] | чувак я прошу что бы мне показали почему не работает код?что то может дописать надо?а ты мне куча всего не по делу накидал,посмотри как мне отвечали на мои вопросы другие вот они рил мне помогли,а то что ты мне накидал и на учебе достаточно накидывают...сори без обид) | 56c845b98fdacc0cd01c97ea27b58520eda9fedd5cd19f24ed0874eadc3a3cb4 | ['098c7a7b62b443a285f041074e03d617'] | got a problem with installing drivers in Windows since I have replaced faulty BIOS chip. Unfortunately chip seller sent me a chip from another notebook. But PC is running and I was able to install integrated (intel) graphic card. But not the dedicated (AMD) on board one. Because of driver package not beeing matched by HW identificator.
Any1 how suggestion what to do? It was the only web I found exactly same chip (at least according to description -_-) as my notebook is. HP Pavilion dv6-6155ec, but I get HP Casablanca H510 instead read in BIOS setup.
Thanks for answers.
|
9b930ada73396281ba64a4863c7ed0986894b9a1565133822391adea02af41b1 | ['0995ee7d0960408aa4b320adb8af07cb'] | With LINQ, you have to watch out for deferred execution. Basically, queries are not executed until the data from the query is consumed. If you want a query to execute immediately, use the ToList() method.
var sortedRows = EmpInfoDS.EmpInfo.OrderBy(e => e.EmpID).ToList();
Next, the code is straight forward:
var employees = EmpInfoDS.EmpInfo;
employees.Clear();
foreach (var sortedRow in sortedRows)
employees.Add(sortedRow);
EmpInfoDS.SaveChanges();
| afec581449c45a38ea069f40eee390f043c2afc7539037f2344b1c7489dacbb4 | ['0995ee7d0960408aa4b320adb8af07cb'] | I'm writing an database app in C# using SQL Server CR E 3.5 and would like to implement a Repository Pattern. I've done several searches both on Google and SO; however, I cannot find an implementation that matches my needs so I will ask the SO community directly.
The key business objects in my app are: video, actor, tag category and tag. The basic business rules are as follows:
Every tag belongs to a tag category.
A video may or may have not multiple actors and tags associated with it.
Actors and tags may or may not have multiple videos associated with them.
Here is where things get fuzzy for me:
Should I implement a video repository that includes actors, tag categories, and tags or should each of these business objects have their own repositories? Given these objects can exist independently, I'm inclined to create a repository for each one.
If each object should have its own repository, how do I relate them? For example, should the video repository include a property that queries the tag repository for matches?
I'm looking for some guidelines or best practices for setting this up. I understand the basics of the repository pattern, but I need some advice as to how to connect them together.
|
d4a4d6aa010c09a421cbdd2820a03e5b7e96251cb78686b0853551b6aae82a38 | ['09bd5135d32d44298bfad7d0cd8e7471'] | Your private static FusionAuthClient INSTANCE = null is unnecessary. By default, beans are scoped as singletons. @see: Bean Scopes
Since you're using @Configuration, all you need to do is change your FusionAuthClientConfigto the following and you will be able to reference it elsewhere in your application as an @Autowired property.
@Configuration
public class FusionAuthClientConfig {
@Value("${fusionAuth.apiKey}")
private String apiKey;
@Value("${fusionAuth.baseUrl}")
private String baseUrl;
@Bean
public FusionAuthClient fusionAuthClient() {
return new FusionAuthClient(apiKey, baseUrl);
}
}
Now your fusionAuthClient bean can be referenced elsewhere like this:
@Service
//or @Component etc
public class MyService {
private final FusionAuthClient fusionAuthClient;
public MyService(FusionAuthClient fusionAuthClient) {
this.fusionAuthClient = fusionAuthClient;
}
public void doTheThing() {
// use this.fusionAuthClient
}
}
| ebe66f61999657ef962687983056e5d9344dd9dc74b332f310f00a1e3e254b42 | ['09bd5135d32d44298bfad7d0cd8e7471'] | Sorry to resurrect this thread but the mechanism I've been using for ages to accomplish this same thing without the cumbersome use of stacktraces.
class ClassloaderUtil {
public static Class getCallingClass() {
return CallerResolver.getCallerClass(2);
}
private static final class CallerResolver extends SecurityManager {
private static final CallerResolver CALLER_RESOLVER = new CallerResolver();
private static final int CALL_CONTEXT_OFFSET = 3; // may need to change if this class is redesigned
protected Class[] getClassContext() {
return super.getClassContext();
}
/*
* Indexes into the current method call context with a given
* offset.
*/
private static Class getCallerClass(int callerOffset) {
return CALLER_RESOLVER.getClassContext()[CALL_CONTEXT_OFFSET + callerOffset];
}
private static int getContextSize() {
return CALLER_RESOLVER.getClassContext().length - CALL_CONTEXT_OFFSET;
}
}
}
Then using it is as simple as this:
public class ClassloaderUtilTest {
@Test
public void test() {
Class c = ClassloaderUtil.getCallingClass();
Assert.assertNotNull(c);
c = foo();
Assert.assertNotNull(c);
}
private Class foo() {
return ClassloaderUtil.getCallingClass();
}
}
The first class will be some junit framework class whereas foo() will return ClassloaderUtilTest as the class.
It is definitely not perfect. However, it does have its random uses. I agree with the folks that have already answered this question in that this is incredibly expensive.
|
08b2c0f4b88ccd55b364d07294e215653ad5e7ab7902a29a09fc01e48d995412 | ['09c92c31b3cb448c86c59b933a5314b8'] | can you make sure npm is in your global npm/bin?
you can try ls $HOME/.npm_global and verify?
if you want to move npm there, you can install npm again by npm install npm -g, this will use the global npm folder and then after that, it will be picked up (try closing session and open new tab)
| e61990ab7c6986621f497811221ff4ca96efaed239b201391abfd3e4f2ce5f0e | ['09c92c31b3cb448c86c59b933a5314b8'] | The easier way to do would be using HTMLRewriter. See docs here: https://developers.cloudflare.com/workers/reference/apis/html-rewriter/
Eg:
class ElementHandler {
element(element) {
// An incoming element, such as `div`
console.log(`Incoming element: ${element.tagName}`)
}
comments(comment) {
// An incoming comment
}
text(text) {
// An incoming piece of text
}
}
async function handleRequest(req) {
const res = await fetch(req)
return new HTMLRewriter().on('div', new ElementHandler()).transform(res)
}
So in your case, you need a create new Rewriter instance and watch on event of a element. Call setAttribute of that element to modify its href.
|
fffc18e12a9bd013dbc770ed163797dad5c9f2f9ec24e02b7f98f6fd7df1098a | ['09cad1039a7a4f03b81233083f97df4b'] | It probably depends on your db backend.
But I'd say you would need a CHECK function like for the Class column.
My guess (untested as I don't have an SQL db handy right now) would be something like this:
CREATE TABLE Article
(
ArCode CHAR(5) PRIMARY KEY CHECK (ArCode LIKE 'A%'),
ArName VARCHAR2(30) NOT NULL,
Rate NUMBER(8, 2),
Quantity NUMBER(4) DEFAULT 0 CHECK (Quantity >= 0),
Class CHAR(1) CHECK(Class IN('A', 'B', 'C'))
);
| f03ee6a510191e9b8b79ffd6f2b406c8ff4787eb349870645e9c543aed8d2d8f | ['09cad1039a7a4f03b81233083f97df4b'] | This looks like homework.
I'll give some pointers.
Once you have the input chars converted to an actual int or long (or long long in your case), do NOT muck around with digits - especially in base 10. If you're going to do anything like that then you may as well leave it in char array form. This bit is not needed:
while (digits1 != 0)
{
digits1 = x/10;
cnt++;
}
You have uninitialised values. Don't assume that everything is automatically initialised to zero. Sometimes you get lucky... but often you won't.
This looks good:
for(int j = 1; j <= cnt; j++)
{
rem = x % N[j]; //not quite right N is ASCII
if (rem == 0)
{
digits2++;
}
}
|
aeeac8563dbfa59e01fcd114b3985d7867186bd28b288dbe3e2f066d26744db9 | ['09f280d8e20c45159ba6407befb9cf55'] | I should query a MongoDB and find all elements of a collection called location and store the results in a variable.
I have three scripts: location.js (in models/location), fetcher.js (in fetch/fetcher) and test.js;
location.js
const mongoose = require('mongoose')
var Schema = mongoose.Schema
var locationSchema = new Schema({
latitude: String,
longitude: String
})
module.exports = mongoose.model('location', locationSchema)
fetcher.js
const mongoose = require('mongoose')
const Location = require('../models/location')
// set Promise provider to bluebird
mongoose.Promise = require('bluebird')
mongoose.connect('mongodb://localhost:27017/mydb')
exports.findAll = async () => {
let query = await Location.find()
return query
}
test.js
const Location = require('./models/location')
const fetcher = require('./fetch/fetcher')
let items= await fetcher.findAll()
console.log(items[0].latitude)
When calling node test.js I receive this message:
let items = await fetcher.findAll();
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3`
If I remove the await keyword the error doens't appear anymore, but the result is Promise { <pending> }.
I'm new in javascript and Node.js, and I don't master the asynchronus calls. Could you tell me where I wrong and how to solve this problem?
Note: I have the version Node v8.1.2
| ab5d2bf748fb03680570d7effc8cb9245e37fbf7b9e98d5e77f5fb510448c6dd | ['09f280d8e20c45159ba6407befb9cf55'] | If you want to train on dataframe df_train and test on dataframe df_test, why are you taking the features of df_train and the target column of df_test and pass them to the train_test_split function?
You can simply do the following:
get_train_data = 'select * from train;'
get_test_data = 'select * from test;'
df_train = pd.read_sql_query(get_train_data, con=connection)
df_test = pd.read_sql_query(get_test_data, con=connection)
X_train = df_train[:, 2:30]
y_train = df_train.y # assuming y is the name of your target variable in df_train
X_test = df_test[:, i:j] # change i to j with the number that allow you to take the same columns as X_train
y_test = df_test.y # assuming y is the name of your target variable in df_test
model.fit(X_train, y_train)
predictions = model.predict(X_test)
# Do something with predictions, e.g.
mean(predictions == y_test)
|
a7eccfd26897d1c19966354e86135f118c225d45ede409a7486b087fef923d41 | ['09ff1b20d3974770953d593762fcee7b'] | Funnily enough, I came across a framework that implemented this earlier this week. Give LNPopupController a look. It implements the behavior you're looking for (showing a mini bar, then tapping or dragging to present a view controller). If it doesn't quite fit your needs, maybe it can at least provide a starting point for you to implement your own thing.
| ea0e762d81e1ab8a21761a438b367ac10ce4ac79dd174556af478d5304b8e86d | ['09ff1b20d3974770953d593762fcee7b'] | You can pull this off by specifying the direct path to the extension's bundle. It looks like app extensions live in the PlugIns/ folder in your app's main bundle. You can create an instance of NSBundle by using -initWithPath:. For example:
- (NSBundle *)appExtensionBundle {
NSString *plugInsPath = [NSBundle mainBundle].builtInPlugInsPath;
NSString *appExtensionPath = [plugInsPath stringByAppendingPathComponent:@"MyTodayExtension.appex"];
return [[NSBundle alloc] initWithPath:appExtensionPath];
}
NOTE: This code was tested only with a Today extension. You should test to make sure it works correctly if you have other types of extensions.
|
c7506b4d37fd8088632257563ed321925cbd89cb80e31fc99fa302370b768a76 | ['0a0084e187d043fcb57db25327bea873'] | my code as follows, i followed the example on the qt doc but nothing is being drawn on my widget, any one knows whats wrong? Thanks!
ui.axWidget_X->installEventFilter(this);
bool qtTest<IP_ADDRESS>eventFilter(QObject * obj, QEvent * event)
{
if((QAxWidget *)obj == ui.axWidget_X && ((QMouseEvent*)event)->button() == Qt<IP_ADDRESS>LeftButton)
{
if(event->type()== QEvent<IP_ADDRESS>MouseButtonPress)
{
origin = ((QMouseEvent*)event)->Pos();
if (!rubberBand)
rubberBand = new QRubberBand(QRubberBand<IP_ADDRESS>Rectangle, this);
rubberBand->setGeometry(QRect(origin, QSize()));
rubberBand->show();
return true;
}else if(event->type()== QEvent<IP_ADDRESS>MouseButtonRelease)
{
rubberBand->hide();
//
return true;
}else if(event->type() == QEvent<IP_ADDRESS>MouseMove)
{
rubberBand->setGeometry(QRect(origin, ((QMouseEvent*)event)>Pos()).normalized());
return true;
}
}
}
| df900c8c8471d0735bdc2d20a713183a0620fd70195e75034484770316cc02a9 | ['0a0084e187d043fcb57db25327bea873'] | currently im using
system("\"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe\"");
to open up the virtual keyboard
and system("TASKKILL /IM TabTip.exe /F"); to kill it
its seems working but there is always a console window poping up
how can i get rid of that? thanks!
|
58db0943ed48779fa4be810b9feade54444b50afd76b11c4a638353ef2021e15 | ['0a03aa3116d248a490a0b4f9f26a4594'] | i am trying to code an application system with youtube login. but i have an issue After i get required authorisation with oauth 2.0 i want to get choosen youtube channel id in a string but i could not do it can somebody please help me.
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->setApplicationName("BYTNETWORK");
$client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/yt-analytics.readonly'
));
if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
$client->setAccessToken($_SESSION['access_token']);
} else {
$authUrl = $client->createAuthUrl();
}
so after this i want a string like
$channelid = "xxxxx"; to use it in code below
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/$channelid?alt=json');
$data = json_decode($data, true);
$stats_data = $data['entry']['yt$statistics'];
$medya = $data['entry']['media$thumbnail'];
//yt$username kısmından kanal adı parse edilir
/**********************************************************/
echo "<img src='$medya[url]'></img><br>";
echo "Subscribers: $stats_data[subscriberCount]<br>";
echo "Views: $stats_data[totalUploadViews]<br>";
| 5a66dafe3905f1f9a7b5870cb31b65f4a682e261bbdd0c3ae416f73c203e1842 | ['0a03aa3116d248a490a0b4f9f26a4594'] | i am developing a Facebook application using PHP SDK. According to FB Developer docs, notifications can be send with this metdod;
POST /{recipient_userid}/notifications?access_token= … &template= … &href= …
but This <PERSON> let me send notification to user with "{recipient_userid}" value. But i am trying to send all users a notification. How can i do it?
By finding all members who is using Application and in a loop one by one Notification sending?
thank you for your Help.
|
0e3509e81e54250b52cb5885b5028e7228e0bfb611126ee50676ec96fe3b38a1 | ['0a0add39c55d4705ba343bf1a6474048'] | I have an input string of the following format:
Message:id1:[label1:label2....:labelN]:id2:[label1:label2....:labelM]:id3:[label1:label2....:labelK]...
It is basically ids associated with sets of labels. There can be an arbitrary number of ids and labels associated with those ids.
I want to be able to parse this string and generate a HashMap of the form id->labels for quick look up later.
I was wondering what would be the most efficient way of parsing this message in java?
| a3f2b5cc08d826973b485e88f43977e65dd7af4f1b55370fe1a4fc0bd449b29a | ['0a0add39c55d4705ba343bf1a6474048'] | This was resolved. I'll just post my own solution. Apparently running the server like this works: java -Djava.rmi.server.hostname=<IP_ADDRESS> Server.The problem was that when the client calls the server and gets back a stub, this stub contains this property and java sets this property to localhost by default, even if you bind the server to an ip when creating a registry. That is why it seems even though your client is connecting to a remote host, it crashes saying connection refused on localhost because the stub it has contains localhost.
|
7b5bdbf917fb3855b23cf928844d5116239f79b0cd539589122dd763d10c9aa8 | ['0a0f96d954bd4032b724c44f8454e779'] | I have a email address field and 3 radio buttons. You must click one radio button and it will redirect you to another page. I am testing here If I can get the value of radio button (Category.val).
Here is my code:
<aui:script>
AUI().use(
'aui-modal','liferay-portlet-url','aui-io-request','aui-base',
function(A) {
$('a.btn-resetpass').click(function() {
var validator = $(".pwdLength"),
Category = $(".1");
if (validator.val().length != 0) {
alert(Category.val());
if (Category.val() == 1) {
}
else if (Category.val() == 2) {
}
else if (Category.val() == 3) {
}
//$('.resetForm').submit();
}
else {
alert ("Please input a valid email");
}
$('.resetForm').submit();
});
});
</aui:script>
Please help.
Thank you in advance!
| e1649bf59b9152749018f267ce3d2526d380a92b3997bd6801bca8f09309a722 | ['0a0f96d954bd4032b724c44f8454e779'] | I want to have a SELECT ALL function in my Search Container like this:
This is my code of Search container :
<liferay-ui:search-container delta="5">
<%-- <c:choose>
<c:when test="">
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose> --%>
<liferay-ui:search-container-results
results="<%= RegUserAccountLocalServiceUtil.getRegUserAccounts(searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%= RegUserAccountLocalServiceUtil.getRegUserAccountsCount() %>"
/>
<liferay-ui:search-container-row
className="com.pmti.bir.triu.model.RegUserAccount"
keyProperty="acctId"
modelVar="aRegUserAccount" >
<liferay-ui:search-container-column-text>
<input name="rowChecker" type="checkbox" value="<%=aRegUserAccount.getAcctId()%>" />
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text
property="acctStatusFlag" name="STATUS"
orderable="<%=true %>"/>
<liferay-ui:search-container-column-text property="acctFirstName"
name="FULL NAME" orderable="<%= true %>"/>
<liferay-ui:search-container-column-text property="acctEmailAdd"
name="USERNAME" orderable="<%= true %>"/>
<liferay-ui:search-container-column-text property="acctBusinessName" name="POSITION" orderable="<%= true %>"
orderableProperty="acctLevelStatus"/>
<liferay-ui:search-container-column-text property="createdBy"
name="DIVISION" orderable="<%=true %>"/>
<liferay-ui:search-container-column-text property="acctUsername" name="USER TYPE" orderable="<%= true %>"
orderableProperty="acctUsername"/>
<liferay-ui:search-container-column-jsp
align="right"
path="/html/viewuseraccount/view_user_actions.jsp"
/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
And this is what it looks like:
How will I achieve to have a Select all inside my Search container? I don't know how. Please help me. Thank you very much in advance! Good day!
|
1ad089d85102daf0db24d586f88b58ca1afdb41cb0154208a8155d1886d3ab46 | ['0a101dc19a2d415babf8792e5a4ac40f'] | You must include the method names from bs4 and not the whole library. bs4 is the module name for BeautifulSoup4 library. We usually import its method BeautifulSoup and not the library name BeautifulSoup4. Also, there is a spelling mistake in your import statement.
The following statements would work fine.
from bs4 import BeautifulSoup
And
from bs4 import *
| 9eddb1665cfdb89a4c332182c3a983d53cf9c44218ce0dbaf7e482dac5d6b8ed | ['0a101dc19a2d415babf8792e5a4ac40f'] | I have an implementation of a dual-camera activity as an Android Kotlin project. I want to use the same dual-camera in flutter as flutter doesn't have any libraries to for dual-camera functionality.
I have tried doing it with platform channels, but as it turns out the platform channels are just for message-passing between flutter and native platform. I don't just want to pass messages, I want an android project's fragment/activity to include as a flutter widget which I can use wherever I want.
Basically, there is an Android activity, which has some Kotlin code associated with it. I want all of it to be working in flutter and communicate with it, both the XML front-end and the Kotlin backend. I am attaching my xml file here for reference. The code file just populates the xml components.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<SurfaceView
android:id="@+id/surfaceView2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2" />
<SurfaceView
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-65dp"
android:layout_weight="1" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxHeight="30dp"
android:src="@drawable/ic_inclinedline"/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
|
9e5a2dd9cf914a590a284ac7a458debc9ac7318d44a161129451e927a697e835 | ['0a23730337b94004838c9f6c158ac86a'] | I filtered my report based on a certain expression. Those that do not meet the criteria that I put in my IFF expression are then filtered and those that do meet it, are shown in my report. My report is multiple pages, so when the filtering happens, some records are left alone on a page, and are not moved up. This leaves a lot of whitespace, and I would like to get rid of that.
On page 1, there will be 2 images/records, with space for one more
On page 2, there will be only 1 image/record that would fit on page one, but doesn't move up
on page 3, there will be only 1 image/record that would fit on page 2 but stays on page 1 etc...
my Keeptogether value is set to true, however this does not help. I have been trying to find something that will keep these records together when filter happens, so that the number of pages is minimal.
If someone could help, I'd really appreciate it.
Regards
<PERSON> | 902a8287849cc32625cd5bd2cb5b28988d662b630926ef084b019438b6192b4e | ['0a23730337b94004838c9f6c158ac86a'] | I am new to Wix. I am using WiX 3.10.
The problem is that when I install a new .msi that I made, everything runs fine. However, when I re-install the same exact version (nothing changed), it goes straight to the "Finish" Screen.
What we would like to do is tell the user that he/she has the version already installed, or make a maintenance/repair/uninstall dialog appear instead when executing the same exact installer on their computer.
I have been able to prevent downgrades using the MajorUpgrade element in WiX, I just need to be able to tell the user that the version of the software is already installed in their computer or make a maintenance/repair/uninstall dialog appear
currently all I have is :
Using this code, when i click to install the second time, the screen goes directly to the "Finish" screen.
I have not found any discussion like this on the Wix Forums here nor in the Wix Users QA site.
Any help would be greatly appreciated.
Regards
<PERSON> |
eb6f25244ca2739a5b9d4776c53e10d81719f6068e90a2e1fffda4d57ee2cc07 | ['0a2726bd58944902bbb4d9f59cca724d'] | One obvious solution would be to convince other humans of their intelligence. I mean, I like a juicy steak as much as the next omnivore, but I would swap it for processed mycoprotein in a second if cows started pawing (hoofing?) in the sawdust and writing messages asking to be spared.
In this case, it isn't so much taking over the world, but joining humanity in their technological march into the future.
| 426cd48b3ed0dd2df75fcbd9a1391dcbac51eed539a3b10b6b46f143f2d38721 | ['0a2726bd58944902bbb4d9f59cca724d'] | Eu fiz uma tabela onde cada linha tem um select e um botão atualizar. O problema é que quando eu clico no atualizar de determinada linha eu quero atualizar apenas aquela linha e, portanto, preciso receber pelo jQuery apenas o número que está no select daquela linha. Da forma que eu fiz eu recebo os números que estão no select de todas as linhas.
HTML:
<table border="0">
<tr>
<td class="td">
Número
</td>
</tr>
<?
for($i = 0; $i < 10; $i++){
?>
<tr class="tr">
<td class="td">
<select id="num">
<?php
for($k = 1; $k < 5; $k++){
echo "<option> $k </option>";
}
?>
</select>
</td>
<td class="td">
<form id="formulario" action="javascript:func()" method="post">
<input type="submit" value="Atualizar" />
</form>
</td>
</tr>
<?
}
?>
</table>
jQuery:
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("form").submit(function(){
var num = $("#num option:selected").text();
alert(num);
});
});
</script>
Resultado:
Gostaria que aparecesse apenas 1 ou 4 ou 3... dependendo da linha que estiver o "Atualizar".
|
38c7b877ab782645a0bbccf3691b60cb619a58c5f1b55b682f55f7c85875f0e1 | ['0a3acf28aa154532b5c7774ff832d4f3'] | Ahhh okay I see, thanks! If I'm understanding correctly - When I was doing the |x|<4 I was always using the less than sign, it could not have been equal to 4. Same goes with the other inequalities I reached that way, and so in the end when I combine them all there can be no possibility of equality either... | 2a0a210a2042c5cf8017234690cc7d1977eb8304b4da100ecdfdd6683c02ea2e | ['0a3acf28aa154532b5c7774ff832d4f3'] | Take the reasons why OO is good, and see if they apply to the chosen approach. Using std<IP_ADDRESS>function or template parameter is better than raw function pointer IMO, since it works for any type that 'implements' the 'callable' interface (eg an object with operator(), or a raw func pointer, or std<IP_ADDRESS>function...). A raw func pointer would not allow calling a class member function without workarounds, for instance. |
b71c1146a462140643b23256a3871db5ecda93e99067bdff5ab7d06a4d44d776 | ['0a3c5ecea7da4ad7a4564fd37df59c95'] | You will need to set the user authentication lifetime to match that of your access token. If using OpenIdConnect you can do that with the following code:
.AddOpenIdConnect(option =>
{
...
option.Events.OnTicketReceived = async context =>
{
// Set the expiry time to match the token
if (context?.Properties?.Items != null && context.Properties.Items.TryGetValue(".Token.expires_at", out var expiryDateTimeString))
{
if(DateTime.TryParse(expiryDateTimeString, out var expiryDateTime))
{
context.Properties.ExpiresUtc = expiryDateTime.ToUniversalTime();
}
}
};
});
I assume you are using cookie authentication? If so you may have to switch off Sliding Expiration. Sliding Expiration will automatically refresh the cookie any time it processes a request which was more than halfway through the expiration window. However the access token won't be refreshed as part of this. Therefore you should let the user authentication lifetime run until the end, at which point it will expire and a new access token will be automatically retrieved using the refresh token.
.AddCookie(options =>
{
// Do not re-issue a new cookie with a new expiration time.
// We need to let it expire to ensure we get a fresh JWT within the token lifetime.
options.SlidingExpiration = false;
})
| bf52e2b9b5c0d5a8c7a07a64f68ece2548fe3e5b83d23080d312207204f830cc | ['0a3c5ecea7da4ad7a4564fd37df59c95'] | Building on from <PERSON>'s answer here is an example using Moq:
private void MockHttpContextGetToken(
Mock<IHttpContextAccessor> httpContextAccessorMock,
string tokenName, string tokenValue, string scheme = null)
{
var authenticationServiceMock = new Mock<IAuthenticationService>();
httpContextAccessorMock
.Setup(x => x.HttpContext.RequestServices.GetService(typeof(IAuthenticationService)))
.Returns(authenticationServiceMock.Object);
var authResult = AuthenticateResult.Success(
new AuthenticationTicket(new ClaimsPrincipal(), scheme));
authResult.Properties.StoreTokens(new[]
{
new AuthenticationToken { Name = tokenName, Value = tokenValue }
});
authenticationServiceMock
.Setup(x => x.AuthenticateAsync(httpContextAccessorMock.Object.HttpContext, scheme))
.ReturnsAsync(authResult);
}
|
6492b61e62d9f8b7c44842c65bf680df56c9a236276f08d6efe7ac021be2b0c1 | ['0a40766da1194768b53f3545c239eb7e'] | Are you
A vitamin pill?
I put a smile on your face with my frothing stampede
When you put it in a glass of water it starts frothing, and you feel better after taking it
I walk inside you, walk in circles and lines
The vitamins circulate in your blood circle, where some of the arteries are in a line, like from elbow to hand
My legs can be straight or ankled, arranged in different designs
This refers to the look of the molecules, which can have straight, or ankled connections, depending on the molecule
I trample rosy flesh and hardest bones
Vitamins are good for your bones and flesh
But in every household, you'll find my clones
Everyone has vitamin pills at home
| 7a5af725c95b6c117bd01e35095dd52b8a75c011c582313c69eb4d7842afe956 | ['0a40766da1194768b53f3545c239eb7e'] | My mother used to tell me:
"There's a difference between hearing and listening.
If you're just using your ears, you're hearing the person, but not what they're saying. If you're listening: then you're hearing them, but also paying attention to what they have to say. So to be a good conversationalist, you should also be a good listener."
A really valuable distinction.
A really valuable lesson.
|
e1d47f2e293a40ed750283f4adbe1f5101475c7c8337bb93015ff4de100d7a10 | ['0a46e33abc0d43c09f9d4ec667c50c8a'] | I'm running my angularjs application using Nginx on Vagrant. And facing the similar kind of issue.
On reloading the browser with any url, it gives me a 404 page.
I have enabled the html5mode in main js file. When you have html5Mode enabled, the # character will no longer be used in your urls. The # symbol is useful because it requires no server side configuration. Without #, the url looks much nicer, but it also requires server side changes.
Here are some changes to do:
Open nginx configuration file (nginx.conf) in /etc/nginx/sites-enabled folder (path will vary based on your nginx installation directory).
Find try_files $uri $uri/ =404; and replace it with try_files $uri $uri/ /index.html;
Save the nginx configuration file
Restart the nginx sudo service nginx restart
And I have tried to reload the page after doing above changes. It works as expected.
| e16f8a19efee500396bac73ea9ca8f33d0f55ba6cec1fd9978630548fc6c5d43 | ['0a46e33abc0d43c09f9d4ec667c50c8a'] | I have added below line in my Gemfile and run bundle install
gem "mongoid-paperclip", :require => "mongoid_paperclip"
And add this in your model has_mongoid_attached_file :image
In addition to this, if you want to save different versions for the uploaded image then probably you will need to do the below steps
Add rmagick to your Gemfile gem 'rmagick'
In your model
has_mongoid_attached_file :image, :styles => { :thumb => '100x100', :big_thumb => '120x120', :medium => '247x173'}
This works for me.
|
1e01da4433c07466fbfdda3543a3761e369d789890282ec02da338dfc1479058 | ['0a540b1086664aa69eec3efa6589578c'] | I need to use the camera for my application with a countdown timer. That is, when called, the camera should open with an automatic 3-second timer via intent.
So far, I am able to open the system camera, take a picture and save it. But now how to set an automatic timer?
My code:
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (cameraIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
Log.i(TAG, "IOException");
}
// Continue only if the File was successfully created
if (photoFile != null) {
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(cameraIntent, REQUEST_IMAGE_CAPTURE);
}
}
| c0e49c5a2ae4335a61ecbe35db7d7906a066b7ec6cad0abd1e174ded9f3bc8dd | ['0a540b1086664aa69eec3efa6589578c'] | I am trying Google Cloud's Text-to-Speech using REST.
It works fine while using Google's API explorer.
But when I try to make a post call, it returns the following error (The API key I'm using has no restrictions):
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"{\r\n \"audioConfig\": {\r\n \"audioEncoding\": \"MP3\"\r\n },\r\n \"input\": {\r\n \"text\": \"This is a text to speak\"\r\n },\r\n \"voice\": {\r\n \"languageCode\": \"en-US\",\r\n \"name\": \"en-US-Standard-B\"\r\n }\r\n}\": Cannot bind query parameter. Field '{\r\n \"audioConfig\": {\r\n \"audioEncoding\": \"MP3\"\r\n },\r\n \"input\": {\r\n \"text\": \"This is a text to speak\"\r\n },\r\n \"voice\": {\r\n \"languageCode\": \"en-US\",\r\n \"name\": \"en-US-Standard-B\"\r\n }\r\n}' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"{\r\n \"audioConfig\": {\r\n \"audioEncoding\": \"MP3\"\r\n },\r\n \"input\": {\r\n \"text\": \"This is a text to speak\"\r\n },\r\n \"voice\": {\r\n \"languageCode\": \"en-US\",\r\n \"name\": \"en-US-Standard-B\"\r\n }\r\n}\": Cannot bind query parameter. Field '{\r\n \"audioConfig\": {\r\n \"audioEncoding\": \"MP3\"\r\n },\r\n \"input\": {\r\n \"text\": \"This is a text to speak\"\r\n },\r\n \"voice\": {\r\n \"languageCode\": \"en-US\",\r\n \"name\": \"en-US-Standard-B\"\r\n }\r\n}' could not be found in request message."
}
]
}
]
}
}
Request body:
{
"audioConfig": {
"audioEncoding": "MP3"
},
"input": {
"text": "This is a text to speak"
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Standard-B"
}
}
Post link: https://texttospeech.googleapis.com/v1beta1/text:synthesize?fields=audioContent&key={MY_API_KEY}
|
b4dfbd2821dc683769259d589f4bfe0d20228d37b8f98f6ff24d62400c0a8a7b | ['0a55a9f6c89e49ff8b7603dafe2b57d6'] | In case anyone else ever has this sort of problem, here's what happened:
The National Passport Center in Portsmouth managed to produce a passport for my kid in less than 24 hours, I could pick it up the next day. They were also the friendliest government bureaucracy people I have ever dealt with anywhere. I asked them if they would have sent it to the consulate in Frankfurt if it wouldn't have been fast enough, but they said they don't do that.
| 74e540f3c55fc12f8164e501be02205c50b9b217d2ccff44d69f8318a65c886f | ['0a55a9f6c89e49ff8b7603dafe2b57d6'] | Destiny can be played in one of two ways, story mode which yields vanguard marks, or pvp which yields crucible marks. It's possible to use either of those currencies to buy related gear. Is there any significant different between the gear that costs crucible marks or the kind that costs vanguard marks? Is the crucible gear somehow better for pvp?
|
82e8310bae874bd320da746681e41951601f31845b089faa33c483bd4681ab82 | ['0a8b1cf982224cb4b645222cde55da00'] | I am trying to use the selenium webdriver to click the go back button on the page. Sometimes, it might fail on the first time due to loading, so I put the code in a while try except block to make it retry after failing:
while True:
try:
driver.find_element_by_class_name("back_button")
driver.click()
except:
time.sleep(1)
print("Unable to go back")
continue
break
Ideally, the code is supposed to move on when the piece in the try block gets successfully executed, but I found sometimes it still attempts to click the go back button when it has already been on the previous page. It then gets stuck in the while loop forever because there is no go back button on that page. What could be the potential reason for that?
| 50db350abad393c1878479d8e5c982be907d30ee2b997ac870137090284b7755 | ['0a8b1cf982224cb4b645222cde55da00'] | Let's say df1 looks like:
id x
a 1
b 2
b 3
c 4
and df2 looks like:
id y
b 9
b 8
How do I merge them so that the output is:
id x y
b 2 9
b 3 8
I've tried pd.merge(df1, df2, on='id') but it is giving me:
id x y
b 2 9
b 2 8
b 3 9
b 3 8
which is not what I want.
|
a04ca37c21f8ca16d876b4366a98e1481e5821f0054e50b5ecf5a6c61890e6cd | ['0a9004c7241f42129b82c8b4aacafb67'] | These questions are related and i suppose that with some luck they could be answered all in one paragraph. I remember having looked up the term in different places, including the Dragon Book, and found no formal non-circular and meaningful definition. This is from Wikipedia: "abstract syntax of data is its structure described as a data type". There are no clear references to the origin of the term. | ef77528c43bb2fb3d8e6907e455f18e3bffee6257b8a3d2df12e005ebbd02065 | ['0a9004c7241f42129b82c8b4aacafb67'] | This does not look like a special term with a specific meaning. Of course a tree is a tree, and if it consists of self-avoiding walks, it is a tree of self-avoiding walks, or self-avoiding walk tree. I've found out that *The Handbook of Artificial Intelligence* by <PERSON> and <PERSON> also uses *search tree* term, so i will probably stick with *search tree*. |
dc187f072ceb96db825189de48dd33439fa3d664e64c803babce789a3edd80fa | ['0a94c5ff354c4c15b965b2abdbea46f0'] | My device system is in English.
In my AndroidManifest.xml, I defined my activity to check configuration changes:
<activity
...
android:configChanges="locale" >
In my Activity, I add the function :
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Locale.setDefault(newConfig.locale);
Log.v("*Locale is*", newConfig.locale.toString());
getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
}
In my Activity onResume(), I called the above function:
@Override
public void onResume() {
super.onResume();
// I explicitely force my app to display in Finnish
Configuration newConfig = new Configuration();
newConfig.locale = new Locale("fi");
onConfigurationChanged(newConfig);
}
(My Activity hosts fragments, Each screen view is a Fragment.)
With above code, I suppose my app will show in Finnish when launched. It works fine on Android 4.1.1.
But when I run my app on Android 2.3.3 device, the following thing happens:
Scenario 1: Launch the app from desktop ==> the app is showing in Finnish, No problem
Scenario 2: Login to my app, ==> then close the app ==> then, launch the app again from desktop ==> the app is showing in English!! Why???
(the log message Log.v("*Locale is*", newConfig.locale.toString()); shows me "fi" always!)
I verified that in Scenario 2, app always show the system default Locale when launch it again from desktop. Why?
I have no idea why in my Scenario 2, my app is showing in system locale English....any one could help?
| 51792f835698e512bb236277a86e6f24cd657e2b0dd81c728444758ee3571d40 | ['0a94c5ff354c4c15b965b2abdbea46f0'] | My Android client get server JSON response as follows:
{"students":[{"id":1,"name":"John","age":12},
{"id":2,"name":"Thmas","age":13}
{"id":3,"name":"Merit","age":10}
...]}
My Android client code parses the JSON response to Java object by using gson.
My corresponding Java classes:
public class StudentList{
private List<Student> students;
public List<Student> getStudents(){
return students;
}
}
public class Student{
private long id;
private String name;
private int age;
public long getId() {
return id;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
}
Everything works fine for me at this point, I can successfully parse JSON data to my Java objects, like following:
//'jsonData' is the server responsed json data
StudentList students = gson.fromJson(jsonData, StudentList.class)
Then, I would like to modify a bit to get the students (from json data) in an alphabetic order, sorted by student's name. I tried the following way: (I changed the Student class to implement the Comparable<> interface):
public class <PERSON> implements Comparable<Student>{
private long id;
private String name;
private int age;
public long getId() {
return id;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
// Override compareTo(), sort by 'name'
@Override
public int compareTo(Student obj) {
return this.getName().compareToIgnoreCase(obj.Name());
}
}
With above modified Student class, I tried to parse the json data again :
//'jsonData' is the server responsed json data
StudentList students = gson.fromJson(jsonData, StudentList.class)
But the resulted students are still the same as before the sorting. My sorting solution does not work at all. Why?? Where am I wrong??
|
3e50e9104856476b0eb81a64bac4bb36a84490cef482c824d6ecab7c5f137ccb | ['0a953c9696f4437ca996e619ee73576e'] | For me, this works:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
| dc5b2fc8087012ce21f6468cd6f5b1d1437158d8befb5157f092f4e30124969e | ['0a953c9696f4437ca996e619ee73576e'] |
hd0@HappyUbuntu:/usr/local/hadoop$ bin/hadoop jobtracker
You probably will view an error about credentials. Type:
sudo chown -R hd0 /usr/local/hadoop
Now, type "jps" and check JobTracker is running
Later, perhaps you need type "bin/hadoop dfsadmin -safemode leave" if you obtains "org.apache.hadoop.mapred.SafeModeException: JobTracker is in safe mode"
|
343da85b6660a387bfe47d5c981298e367e741c6f728afe1323a1e9771ee6fa8 | ['0a99ea3ab992411b870cfb1629ffb9bb'] | I am trying to query a MySQL table to get a specific user type depending on their email
import pymysql
conn= pymysql.connect(host='<ip>',user='<user>',password=<pass>',db='<db>')
a = conn.cursor()
a.execute("SELECT `type` FROM `users` WHERE `email` LIKE '<email>';")
data = a.fetchone()
print(data)
The output is ('user',), how can I get the output to be just user
| 160a8b02211beafc632773615c234f57b70014991695492492fb71dfae3aebad | ['0a99ea3ab992411b870cfb1629ffb9bb'] | I am trying to use ssh-copy-id to copy a ssh key but I get asked for a password after I type this command ssh-copy-id -i deploy_rsa.pub <EMAIL_ADDRESS>.
I am not sure why its asking for a password seeing as I did not set a password for the key.
|
f5e541c50e82b221e14668fa3bcd3d6687475723296077730be17590509cda90 | ['0a9b8ef5b4ba4e229e67ec6c40e660a3'] | I have only 1 year experience in Android Development. But my senior who has 10+years of experience, "for convenience sake at that time" took a Boolean value true, converted it to string "true" and did value.equals("true") for an if condition. I cant reject that pull request since I am a Junior, but I raised it to him personally, and he said, its a convenience factor and will not affect my part of the program. | 6657dfcec4860850f6b79f4f928f48eedf8623069f9294357ca039596f15318a | ['0a9b8ef5b4ba4e229e67ec6c40e660a3'] | I have a perl CGI script doing the Facebook authorization flow as described at http://developers.facebook.com/docs/authentication/. When I go to my Facebook app page in a browser my script receives the initial query from Facebook, authenticates the signed_request, and then sends a redirect to the following url:
https://graph.facebook.com/oauth/authorize?client_id=NNN&scope=[...]&display=page&redirect_uri=http%3A%2F%2Fmydomain.com%3A8080%2Fperl%2Fdev%2Ffb.pl%3Fcallback%3D1
The redirect_uri is what I have defined as my Web Site in the app config, and it gets accepted just fine. But what the browser then shows is a big Facebook logo image and a link below it, both of which go to:
http://www.facebook.com/connect/uiserver.php?display=page&next=https%3A%2F%2Fgraph.facebook.com%2Foauth%2Fauthorize_success%3Fredirect_uri%3D[...]
When I click on that I get what I want, the "Request for Permission" page asking the user to authorize the app. Everything proceeds normally from there.
So why am I getting that initial FB logo page instead of going directly to the authorization page?
|
392c9639bd03f776f43589ec70fc00b18d31de8dca373e1de3674c990112972b | ['0aa77feaaf1047688fab59d972d0a061'] | I'm designing a wesite and came up with some problems on this. The font i'm using is Raleway and there are variations of the font like Raleway, Raleway Thin etc.
The design i need
in this design above one (Come Find Me ) is in Raleway and below one (Swatry's like a Melody) is in Raleway Thin. therefore i came up with below css.
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), local('Raleway-Regular'), url(https://fonts.gstatic.com/s/raleway/v11/yQiAaD56cjx1AooMTSghGfY6323mHUZFJMgTvxaG2iE.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), local('Raleway-Regular'), url(https://fonts.gstatic.com/s/raleway/v11/0dTEPzkLWceF7z0koJaX1A.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
@font-face {
font-family: 'RalewayLight';
font-style: normal;
font-weight: 100;
src: local('Raleway Thin'), local('Raleway-Thin'),local('RalewayLight'), url(https://fonts.gstatic.com/s/raleway/v11/rr0ijB5_2nAJsAoZ6vECXRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'RalewayLight';
font-style: normal;
font-weight: 100;
src: local('Raleway Thin'),local('RalewayLight'), local('Raleway-Thin'), url(https://fonts.gstatic.com/s/raleway/v11/RJMlAoFXXQEzZoMSUteGWFtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
in css, classes are like this.
.topPageTitle{
font-family: "Raleway","sans-serif";
color: #159c96;
font-size: 5vw;
}
.topPageSubtitle{
font-family: "RalewayLight","sans-serif";
color: #ffffff;
font-size: 2.5vw;
}
And Html is this.
<span class="topPageTitle">Come Find Me </span>
<span class="topPageSubtitle">Swatry's like a Melody</span>
this works fine for me, on windows and fedora. but in mac, this doesn't work properly and for the below text it's rendering Arial font.
what is the solution for this? is there any other proper way to use both Raleway and Raleway Thin in one webpage?
| a246083df6fdf6490822225795bb3db40681bc8e8ff13caa36bcdfef377377a3 | ['0aa77feaaf1047688fab59d972d0a061'] | Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
Graph stores are used to store information about networks of data, such as social connections. Graph stores include Neo4J and Giraph.
Key-value stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or 'key'), together with its value. Examples of key-value stores are Riak and Berkeley DB. Some key-value stores, such as Redis, allow each value to have a type, such as 'integer', which adds functionality.
Wide-column stores such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.
for more, follow this link on MongoDB
|
b736600a3d98be0f57bd39c61495c837fa77259a0323a490b17a55b212468b6f | ['0aaa8a84a0414f1aad77dcc0b8ea3c02'] | It took me a while to understand this, unlike other languages and environments in network standards URIs (URLs) do not use quotes or some escape characters to hide special characters.
Instead, a URL needs to be properly encoded by encoding each individual parameter separately in order to build the complete URL. In JavaScript encoding/decoding of the parameters is done with encodeURIComponent() and decodeURIComponent() respectively.
For example, the following:
http://example.com/?p1=hello=hi&p2=three=3
should be encoded using encodeURIComponent() on each parameters to build the following:
http://example.com/?p1=hello%3Dhi&p2=three%3D3
Note that the equal sign used for parameters p1= ... p2= remain as is.
Do not try encode/decode the whole URL, it won't work. :)
Do not be fooled by what is displayed on a browser address bar/field, that is only the human friendly string, the moment you copy it to the clipboard the browser will encoded it.
Hope this helps someone.
| 81ff333053106c1b82d3df39a0c8114be009c978b4475cb80b73bd11b1683d3b | ['0aaa8a84a0414f1aad77dcc0b8ea3c02'] | See these registry entries for adding a context menu. I was able to rename the folder as well as iexplorer_OFF.exe on Windows 7.
You can probably shell/execute the same from your code.
https://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/
|
488554280dff6b84eb85b3215be261376dcc50c4f8032d33913732fc22991ba0 | ['0abc3038d502425f9982b29712f5ebc4'] | I use one of my website as a test for various TLS techniques. Recently I added OCSP Must-Staple to this domain. After a week I got a complaint from a user they were unable to visit the website. They got the error from Opera, Edge and Chrome. The Chrome error was the clearest: ERR_SSL_VERSION_OR_CIPHER_MISMATCH.
After some testing I found out their BitDefender doing SSL intercepting was the culprit. Now, I don't want a discussion about whether companies should be doing such a thing. I presume ERR_SSL_VERSION_OR_CIPHER_MISMATCH is just BitDefender saying: "I am unable to do anything with this, let's just block the user from visiting by negotiating no valid SSL version / ciphers with the browser". But I don't understand how the Must-Staple in the certificate caused this.
Maybe it wasn't actually the Must-Staple, or maybe it was in combination with some other header. I have HPKP headers which would be the next possible candidate, but I have had those for almost a year now. I am not that well versed in VM's and WireShark to do much investigating. Could someone help determine the actual cause to satisfy my curiosity?
SSL labs report
| 237fbb436ed4bc3907c4f8cb6b99dd96d916a89efc12d0dc30aed2c4b264f554 | ['0abc3038d502425f9982b29712f5ebc4'] | You've actually asked a very relevant question. Simplification and standardisation is indeed what everyone wants, but when the Asch effect tends to institutionalise everyone into a state of learned helplessness, the prevalent opinion will tend to stick to tradition. Moreover, we have a mandatory xkcd for standardisation.
To answer your question, some of the downsides of a casual style would be:
The lack of consistency could confuse readers. For example, lawyers
use the phrase "suo-moto" even though it's not English, for the sake
of not creating any ambiguity when referring to an action that
someone took on their own cognisance.
Authors could end up unknowingly use an inconsistent style in the
same document.
Without a standard set of rules, the reviewers will have some
ambiguity on whether certain styles could be allowed or not.
When published along with other papers, there would an aesthetic
issue with one paper looking different from another paper.
Apart from these (and a few points others have mentioned in the comments), I don't see any other problems with following a casual style. Scientific research is presented in a certain format for a logical reason. The title and abstract make it easy for people to identify the work and quickly decide if it's worth reading. The introduction presents the gist of the topic and work. The related work section ensures that the author compares the work with other literature. The results and discussion sections ensure the results are articulated well and the conclusion helps summarise the importance of the work. As long as work is presented neatly and scientific ideas are communicated well, there really is nothing wrong with allowing a more casual format which only requires the author to follow some simple logical rules.
In the words of <PERSON>:
At the heart of science is an essential tension between two seemingly
contradictory attitudes -- an openness to new ideas, no matter how
bizarre or counterintuitive they may be, and the most ruthless
skeptical scrutiny of all ideas, old and new. This is how deep truths
are winnowed from deep nonsense.
This quote is as relevant to research work as it is relevant to the art of presenting research work. It takes courage to question existing practices and it's common to be ridiculed for it. I completely agree that the rules and standards currently created (although for good reason), are indeed cumbersome to researchers worldwide. I've read many such complaints on the internet for many years. I do hope change happens, and I'm glad you asked this question. You aren't the only one who has wondered why research publication couldn't be simpler than this.
|
3f35400b16cd7706c6a1a47590322c79667e1a13cf6aa67097397342676be34d | ['0ad0084eb60c484ea9cb6d4aa242ddde'] | I would like to create a function that can be called multiple times within an HTML page so I can display multiple stacked bar graphs. They can't all be in the same chart because I need a bunch of other content between them.
My first thought was to just write the function and pass data to it as I need to create the bars. I tried the below but for some reason is gives me an error of No plot target specified.
I am also not sure if this would be the best or most efficient way to accomplish this.
Thanks to anyone taking a look at this!
I thought each time I needed a bar I would just insert the below in the HTML
<script>
var id ='bar_one'; //I also tried document.getElementById('bar_one');
var data1 = [[12, 1]];
var data2 = [[5, 1]];
var data3 = [[3, 1]];
barBuilder(id, data1, data2, data3);
</script>
<div id='bar_one' style="height:75px;width:500px; "></div>
External JavaScript file
function barBuilder(id, data1, data2, data3){
var options = {
animate: true,
animateReplot: true,
stackSeries: true,
seriesColors:['#007f00', '#00b200', '#00ff00'],
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: {show: true,location: 'w'},
rendererOptions: {
barMargin: 13,
barDirection: 'horizontal'},
},
axesDefaults:{
tickOptions: {textColor: 'black'}
},
axes:{
yaxis:{renderer: $.jqplot.CategoryAxisRenderer,
showTicks: false,
tickOptions: {showGridline:false, showMark:false}
},
xaxis:{showTicks:false,
show: false,
tickOptions:{showGridline: false},
rendererOptions:{drawBaseline:false}
}
},
grid:{
background:'transparent',
drawBorder: false,
shadow: false}
};
$.jqplot(id, [data1,data2,data2],options);
}
| c5eeae1350013923af648ef86c9380844e1be0b0f86f22a2121f96b53a9fdfc2 | ['0ad0084eb60c484ea9cb6d4aa242ddde'] | A while back I started playing around with Android developing on my PC and used my Samsung Galaxy s4 as the test device and it worked fine. Once school started I mainly used my laptop and was also able to use my phone on it as well, and still am able to do so.
For some reason, my PC will no longer sees my phone as a running Android device and I cannot figure out why. I even tried reinstalling the driver to no avail. Does anyone have any idea as to why this is or any suggestions that I can do to make it be seen again?
Thanks to anyone looking at this!
|
53879d92aeb7fa99c4096bb953b8727311764b14e7e2f3cba0ec0fde2aa75ec5 | ['0ad60017af7147b49c9a2909938f0c57'] | The certificate is necessary for the communication to be secure. See Wikipedia: Public Key Certificate for more detail. If you don't want to pay for one, you could create a self signed certificate (the process varies depending on the web server you are using) but that would require the user to explicitly accept the certificate (each browser has it's own method of doing this).
That may be ok being that this is an admin section and not publicly accessible, but I would still recommend that you buy a certificate. The hassle of creating a self signed one, along with requiring the users to accept it is not worth the few dollars an ssl certificate costs.
I really don’t see the point of getting a certificate because if
someone, despite all technical difficulties, succeed at putting in
place a man-in-the-middle attack between one of my user and my web
server, in my perception, it does not seem so much added effort to put
in place the same attack between my user and the certificate
authority.
That's not quite how SSL works. Over HTTPS, all communication is encrypted when the browser sends it so even if someone were to sniff it, it would be useless.
| 7835daebd466ea0b947733ab3718daad3c7853041319c37787706e832d026b3f | ['0ad60017af7147b49c9a2909938f0c57'] | A self signed certificate is functionally equivalent to a signed one (assuming the same key length). The inherent security is the same. However, that's not to say that it provides the same level of security to the end user since they have no way of knowing who signed the certificate or if it should be trusted.
It's no easier for the ISP (or any one) to read communication sent with a self signed as it is with a certificate authority signed one.
|
cdf5c1ec1ff2928a925a2d9100f3501b646e4b37a830171de3ae77719a014ba6 | ['0af7bbba733649f6a73451e247cf986e'] | I'm not sure it will reply to your question, but rather than assigning percentage to a clip path my alternative solution would be to use viewBox attribute of the svg tag.
Here a simple example:
<svg viewBox='0 0 100 8' style="width: 100%;">
<defs>
<clipPath id="clippy">
<rect x="${normalizedValue}" y="0" width="2" height="8" />
</clipPath>
</defs>
<rect x="0" y="0" width="100" height="8" fill="red" clip-path="url(#clippy)" />
</svg>
Using css (width: 100%) I defined an svg which has a bar as wide as the main container, meanwhile using viewBox I defined it to be a rectangle which internally will be sized 100x8.
As you can notice, inside the svg everything is drawn relatively to the viewBox. ${normalizedValue} is a variable which in my case contains a number between 1 and 100 (no 'px' or '%', just a number), therefore I don't have to take care of sizing.
Maybe this approach could help you, you just create many svg(s) with the same size (using css) and using a viewbox you easily keep the same proportions.
| 8040cdde1f55e50cc89ad46d00bad942efd0d95896c3679231ef4f018630edbc | ['0af7bbba733649f6a73451e247cf986e'] | TL;DR
Without exporting a namespace, but only declaring it, I want to access an enum within it. Once transpiled, the namespace is not accessible (it's an undefined object), therefore the enum fail to be accessed (with an error on the namespace).
Explanation
I'm setting up a project in TypesScript, and I'd like to avoid importing all the definitions specific to this project. In this snippet, I created a namespace where I'm putting the local definitions for my redux logic.
An extract of the redux declarations (redux.d.ts):
declare namespace Redux {
namespace Actions {
enum TypeKeys {
REDUX_INIT = '@@redux/INIT',
BOOTSTRAP = 'BOOTSTRAP',
CORPUS_LOADED = 'CORPUS_LOADED',
...
}
...
interface Definition {
doSomething(): void;
...
}
...
}
namespace Store {
interface Definition { ... }
...
}
}
Which allows me to avoid importing the definitions in all my code (e.g. in const mapStateToProps = (state: Redux.Store.Definition) => state; in my top level component, I don't have to import any Redux namespace).
Moving to the problem, I wrote this reducer (corpusReducer.ts extract):
// Note: no need to import Redux!
export default (state: Redux.Store.CorpusManagement, action: Redux.Actions.ActionTypes): Redux.Store.CorpusManagement => {
switch (action.type) {
case Redux.Actions.TypeKeys.CORPUS_LOADED:
return { corpus: action.payload };
default:
return state === undefined ? { corpus: { documents: [] } } : state;
}
};
Once transpiled, I'm getting the error ReferenceError: Redux is not defined for the line case Redux.Actions.TypeKeys.CORPUS_LOADED.
My suspect is that Redux is not available at runtime because, since a namespace, belongs to the TypeScript world. TypeKeys, on the other hand, it's an enum, which should have a mapping in JavaScript, therefore my expected behaviour would be that the enum would still be accessible once transpiled.
If I add an export (changing the line into declare namespace Redux), the file is "promoted" to be a module, but then I need to import it everywhere in my code.
Question
How can I access the enum avoiding the export clause (and therefore to explicitly import the module everywhere)? Is there any good practice I'm not following?
|
07c5181580034caa03dc2d58ff5315f6eab68b4db69088ca54d21817f7313cde | ['0b086b071037426c855131d8f8f32272'] | Maybe humdity but it should have just enhanced a temporary capacitor value drift, right?
Funny fact: i have just put it back in place the "failure capacitor", and it works now fine.. maybe the soldering was not all when the failure happens? On the next failure board i ll get (if i have), i will make a good observation about this capacitor and its soldering | cc5220fbd840f4b7f5f6c5d486c56860f3b9009d6e75307ce81bc7d77ae4b920 | ['0b086b071037426c855131d8f8f32272'] | Thanks for your reply.
So you think it's a simulation configuration issue ?
I have tried to disable waveform compression to avoid any rounding leading to approximation. Nothing changed.
I have also tried alternate solver, and it changes the rms value for the 5V simulation from 20 to 18mV (but not the 2,5V simulation)..
I will try now current source and will work on tripdv and tripdt to know what it is. |
afafb4401220b5df097ee05a2ccddd90f11a5b8a1ff0ed5bf65875fe65af3928 | ['0b0f650ab8154faf965bfc793aadef69'] | My video is working just fine - I want to mix audio from all of the 7 videos into the output
[a0][a1][a2][a3][a4][a5][a6]amix[aout] <-- command I think has to be implemented somewhere
so far my command looks like this
ffmpeg \
-i /Users/Malthe/test//1.mkv \
-i /Users/Malthe/test//2.mkv \
-i /Users/Malthe/test//3.mkv \
-i /Users/Malthe/test//4.mkv \
-i /Users/Malthe/test//5.mkv \
-i /Users/Malthe/test//8.mkv \
-i /Users/Malthe/test//9.mkv \
-filter_complex " \
[0:v] setpts=PTS-STARTPTS, scale=wuxga [a0]; \
[1:v] setpts=PTS-STARTPTS, scale=wuxga[a1]; \
[2:v] setpts=PTS-STARTPTS, scale=wuxga [a2]; \
[3:v] setpts=PTS-STARTPTS, scale=wuxga[a3]; \
[4:v] setpts=PTS-STARTPTS, scale=wuxga[a4]; \
[5:v] setpts=PTS-STARTPTS, scale=wuxga[a5]; \
[6:v] setpts=PTS-STARTPTS, scale=wuxga [a6]; \
[a0][a1][a2][a3][a4][a5][a6]xstack=inputs=7:layout=0_0|w0_0|w0+w1_0|0_h0|w0_h0|w0+w1_h0|0_h0+h1[out] \
" \
-map "[out]" \
-c:v libx264 -preset slow -crf 0 -level:4 -profile:high -b:v 2500k -c:a copy output.mov
| c54e8186253bf2f38ab5f7b9c954de7aa2f9e225248640af7b637809cf60dcf3 | ['0b0f650ab8154faf965bfc793aadef69'] | I made a mosaic from 4 different videos.
And it looks somewhat fine not the best quality, what do I edit in the command for a better quality of video ?
And how do I take the audio from all of the videos, and mix it into the final mosaic video ( just in one channel )
Below is the command I used
ffmpeg -i 1.mkv -i 2.mkv -i 3.mkv -i 4.mkv -filter_complex "nullsrc=size=640x480 [base]; [0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=320 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=320:y=240" -c:v libx264 outpu2t.mkv
|
a41ba95593a62c0b6df0e41d2753c9cf118754e4f66bb3efac70ef41b92e81c2 | ['0b0f7165604f463c9cc87470d6b894c4'] | My idea is that the server will generate some key using some user details + time component + salt. Browser will then use it will while trying to connect to LocalServer. This will be forwarded by the LocalServer (Plugin) to WebServer. Once the WebServer Authenticates. Then only requests from the browser will considered. | 03fb9489fdf67807d35ba1ccecb82ef6520b71e40b39e43d9fe2aa5be0569b53 | ['0b0f7165604f463c9cc87470d6b894c4'] | <PERSON> I must say that compensation was the part of the datasheet I least understood talking about poles, zeros and crossover frequencies. I tried to come up with values based off my calculations as per the datasheet and they almost matched what's recommended in there. Should I just try different values and see what works? |
bcd7e64e4c9d14879e4e267be538d1cf62b0a94d5c0bcd5219199cabd0b7f195 | ['0b113125aafc41ffbd4bc4e8b1a44cf6'] | You can use a thin single core wire (which you can easily form into any shape) and solder it directly to the smt resistor from where the trace begins. Strip the wire slightly and make a loop where you want the pad, and complete the trace by soldering it to the via on the right. Choose a thickness of the wire that you can insert into the via. Not sure about your soldering skills, but shouldn't be much difficult.
| dbf687230136723b7fb262f9ee1b2eb0ff0e42fb20d9727cad8c380b6fb5ff90 | ['0b113125aafc41ffbd4bc4e8b1a44cf6'] | См. Устранение проблем с отображением сайта при просмотре в режиме совместимости в Internet Explorer 11.
В моём случае помогло пойти от противного и без правки кода сделать так:
Откройте Internet Explorer, нажмите кнопку Сервис и выберите пункт Параметры просмотра в режиме совместимости.
Снимите птичку Отображать сайты интрасети в режиме совместимости
|
eab4fe85be230e5f6bbf3501821d68ebbb21247382a5be57e1b9a1b53c3bdb4a | ['0b15736ffb1f4f1fa3eb70184ab30b83'] | I am trying to have a series of inline-block div elements inside a parent block div element all sit at the same height. Some of the divs have text in them and others do not. The text in the divs needs to be vertically centered but not horizontally. I used line-height to center the text, but the div with no text does not align with the others. Here is my code:
<div class='line'>
<div class='someText'>text 1</div>
<div class='someText'>text 2</div>
<div class='noText'></div>
<div class='someText'>text 3</div>
<div class='someText'>text 4</div>
</div>
.line{
display: block;
height: 50px;
max-height: 50px;
}
.someText{
display: inline-block;
line-height: 50px;
background-color: RED;
padding: 10px;
}
.noText {
display: inline-block;
height: 50px;
width:50px;
background-color: BLUE;
padding: 10px;
}
Could anyone explain to me why this is happening and/or give a possible solution? I would like to avoid using tables if possible.
Thanks!
Also here is a jsfiddle showing the problem. https://jsfiddle.net/n1LbcLr1/
| beb6dbb80c5ffeb1a81db32e9de9c6fee33dda2b60aa7b9afce08a4cdbc7efbd | ['0b15736ffb1f4f1fa3eb70184ab30b83'] | I am using a scanner to scan input from the command prompt, and I need to keep track of what line a particular word is on. If I enter through the command prompt this input:
"First line
Now second line
Finally last line"
I want it to print out:
"Word: First line: 1
Word: line line: 1
Word: Now line: 2
Word: second line: 2
Word: line line: 2
Word Finally line: 3
Word last line: 3
Word line line: 3"
Here is my code:
public static void main (String [] args){
Scanner scan = new Scanner(System.in);
int lineNum = 1;
while(scan.hasNext())
{
if(scan.next().matches("[\\n]")
lineNum++;
System.out.println("Word: " + scan.next() + " line: " + lineNum);
}
}
I have tried many different regex patters, but none I have tried seem to do the trick. I've tried some other methods to increment the counter such as increment for scan.hasNextLine, but no success and I feel there has to be a pretty simple way to do this I'm just not finding it.
|
6499f1d981cd0836f20e012330031c34308bd0562d7f63d1d6593b8c078e04ba | ['0b16a49ceadd4592857d46c15639dc9c'] | I would really appreciate if someone checked out my thoughts on this topic and corrected them where they are wrong. I hope that this type of "please check my thoughts" doesn't go too much against the rules of the site, and my question is more of an attempt at an answer on how a certain topic works from someone who doesn't really understand the topic. Hopefully it could be valuable/insightful to someone who is a beginner like me and might want to see a high-level but very basic description of what's going on.
Here's my approach to understanding the topic of IEnumerable, IEnumerator and yield return.
The way IEnumerable and IEnumerator interact is quite clear and natural - we have two objects, one that holds the collection, one that has the cursor.
For the moment, let's ignore the connection between yield return and the two interfaces, and just consider the following concept/problem - suppose we have code that has an expression/computation of some integer on each line, and we would like to create a function f that executes and returns these integers in sequence, i.e. the first time we call f() it will return the integer that is computed on the first line, the second time we call it it will return the second integer, etc. The natural way to do this is to create some sort of helper class/object that will contain the mentioned code, but in addition to that it will also store the position of where we are in the code. Using goto this can be done. To achieve this, we designate a keyword of yield return to do this - the compiler recognizes that if we have some sort of block of code with yield returns inside, it will create a helper/controller class for it. Notice that how this helper class acts on the block of code is already very similar to how an IEnumerator acts on IEnumerable - it stores "where" we are in some sense.
Next we will use this concept and define it so that it agrees with the existing functionality of IEnumerator and IEnumerable interfaces. The basic functionality that we will be aiming for is that of foreach - when used with an object that implements the IEnumerable interface, it returns the cursor implemented in IEnumerator via IEnumerable.GetEnumerator and then uses methods of MoveNext and current to move along the collection and returns the object pointed to respectively.
So the first way we could use the concept is to only define the GetEnumerator - we simply put the block of code that we want to be executed sequentially in the body of GetEnumerator. For this to work, the compiler recognizes that if the body of the GetEnumerator contains yield return, it will create a helper object (and it will return this object to the call of GetEnumerator in the end), and this helper class will also implement the methods MoveNext and Current as "execute the next line, and save to _current (some field of the helper class) and "return _current" respectively. Essentially, GetEnumerator will return the helper object mentioned two paragraphs above, and in addition the compiler will create the needed MoveNext and Current methods in this helper object, so that they move along the block of code, return the value, respectively.
The other way we could use the concept is to directly "define" the collection and go through it. So this time, we're not just returning an IEnumerator / helper class, instead we're returning an IEnumerable. But for our purposes, we're really just interested in being able to use this object with foreach. So one way we can do this is to just do almost the same thing as above - we implement the helper object as an IEnumerable as well as IEnumerator - so we can return it as an IEnumerable in some foreach statement, and we implement the GetEnumerator to just return this. So the effect is very similar to the above.
Does the above make sense? One thing that I'm not clear on is whether for example foreach could somehow be used with IEnumerator directly - i.e. whether we could do (foreach element in Enumerator()) where Enumerator() is a function that returns IEnumerator only, and not IEnumerable. It doesn't make sense, but I'm not sure whether the compiler can't figure these things out - especially since it's capable of determing to do such drastically different things if it sees yield return in the body, it then creates a helper object etc, like I've mentioned, so I'm not sure just how much other syntactic sugar there could be besides this.
| 649246bb4720577cfa1cc5d08a5fdf634feaee6f5d869fc688fd45d301174fc2 | ['0b16a49ceadd4592857d46c15639dc9c'] | I've been learning about git and I'm quite confused by the terminology.
Do I understand it properly that a "tree object" is really something like a "folder object"? It keeps information of things inside it (blobs) and other trees (sub-folders). It keeps information about the "actual data" of the project we are working on.
At the same time, the structure of commits/versions has a tree like structure (directed acyclic graph really, with merges, but that's just a detail), and paths to a leaf in this tree could be called branches. "Branches" in git however, are actually just pointers to commits though.
Do I understand this right? Is it just me or is "tree objects" a pretty misleading name, given the already existing tree structure of the "version tree structure" ? Even if you wanted to use the word tree, it would make more sense to call it "tree node object" or something - since a tree object in git doesn't seem to contain a whole tree, just some blobs and a pointer to other trees. The name branches also seems misleading, for similar reasons.
|
87bef609a1bb385ead52e6bbc421ee711445d56be98a8989c023f9a471f82ffc | ['0b1e4ad6ee2148a89f91261fe8964a06'] |
I have some questions regarding this system that is supposed to take in an input signal and move the load according to this signal. The current load position is feedback to the CT, which compares the current position to the desired position and produces an error signal that is amplified by the amplifier. I understand the processes involving the CT being connected with the CX and comparing it to produce an error signal but am unsure about other things. CX is a control transmitter and CT is a control transformer
1.What type of feedback inductive position sensor component is used and how does it work? Or is the CT THE feedback component
How exactly does the amplifier amplify the error signal that makes the load move to the correct position. Quite unclear about this
Any help is appreciated thanks
| fc30fe9ce8cf589e317ccc7c04b6900d8f48a64e977dea7aed8ae80be7b7f81a | ['0b1e4ad6ee2148a89f91261fe8964a06'] | So ive been doing some research on how overshoot can be reduced in an AC servo position system. I found out that tacho generators are used connected from the load to the motor that drives this load. However I found out that it may cause velocity lag and error. I found out this can be overcome by replacing the tachogenerator with an RC network error rate damping but im not too sure about its operation, can someone explain it to me?
|
90c8ca55ceeb6a0c8bbfc28584fa0bafbb2a82fb310f43757147738eaf6efc1a | ['0b2480fd4a3d4dadb3b0c221e0e3ae12'] | I want to do something really simple with ajax. I have a folder in my mac with 2 documents : index.html and text.txt.
index.html :
<p>
<input type="button" onclick="loadDoc()" value="CLICK" />
</p>
<p id="fileContent"></p>
<script>
function loadDoc() {
var xhr = new XMLHttpRequest();
xhr.open('GET', "text.txt", true);
xhr.onreadystatechange = function() {
document.getElementById('fileContent').innerHTML = xhr.responseText;
}
xhr.send(null);
}
</script>
text.txt :
hello
When the user click on the button CLICK, I want the content of text.txt 'hello' appear bellow the button CLICK.
It's doesnt work with my mac locally. Do you know why?
Thank you!
| e1d63b657d3f17f568e10092b6232e2905795011e7572dd9faafc58b16205f96 | ['0b2480fd4a3d4dadb3b0c221e0e3ae12'] | I am creating an ios app with swift. I have an UIViewController and an "UserManager" class which inherits from NSObject. Basically, when the user opens the app, the code within UIViewController is executed. UIViewController calls a function in UserManager. When this function has finished, I want that a segue be performed (a segue called "connectSegue" in my code). I am a beginner...
What I have done (and didn't work!) :
Here is my ViewController :
import UIKit
var profileUser = UserManager()
class ViewController : UIViewController{
override func viewDidLoad() {login()}
func login()->Void {profileUser.createUser()}
func handleSegue()->Void {self.performSegueWithIdentifier("connectSegue",sender: self)}
}
Here is my UserManager class :
import Foundation
class UserManager: NSObject {
//Some properties
func createUser()->Void {
//Some code
var segueHandler = ViewController()
segueHandler.handleSegue()
}
}
How can I do that?
Thank you
|
3e9c00e6bec102966c831dfe93fa4dbb30e7d09cf9dafbcbd954aafca4e86152 | ['0b34cf74a7f6452ab3c161ed386ab914'] | i'm working project for webcam scanning project in linux ,, when i run program i found this type of exception:
Native code library failed to load.
java.lang.UnsatisfiedLinkError: Can't load library: /tmp/BridJExtractedLibraries978435834650156898/OpenIMAJGrabber.so
while i have added this line
System.load("/tmp/BridJExtractedLibraries978435834650156898/OpenIMAJGrabber.so");
when i reach in /tmp folder there is no any OpenIMAJGrabber.so
where is my OpenIMAJGrabber.so in linux
| 4fdc4b09653379ab3c27986cb1c99fe6113b8aa1f83583286ffd7ec8068855cb | ['0b34cf74a7f6452ab3c161ed386ab914'] | i want to auto execution GUI based jar file after raspberry start up using cron job , i got exception such like
Exception in thread "main" java.awt.HeadlessException at
java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
at java.awt.Window.(Window.java:536) at
java.awt.Frame.(Frame.java:420) at
java.awt.Frame.(Frame.java:385) at
javax.swing.JFrame.(JFrame.java:189) at
com.mycompany.gui.FirstSwingExample.main(FirstSwingExample.java:43)
my crontab command is
@reboot /usr/bin/java -jar /home/pi/Desktop/GUI-1.0-SNAPSHOT.jar > /home/pi/Desktop/log.txt 2>&1
i also passed JVM argument -Djava.awt.headless=true
please help me
|
b140c99a1eb86d2332b105f1fb58de0880a5c42464e9d2093775cea69afa0a59 | ['0b49d53dc75f43e3866a83c8a39ff5c0'] | I am trying to store the characters ♯ and ♭ in a mySQL database, but ♯ gets stored as A♯ and ♭ as Bâ™
In the HTML, I have used ♯ and ♯ and both render fine in the browser, but neither is being stored correctly.
I have tried UTF-8 and UTF-16 character sets for both the PHP page and for the field where the values are being stored and I get the same result.
I'm not very familiar with character sets, so maybe I should be using something other that UTF-8 or -16 or maybe I'm missing something else entirely?
| d38d65870719cdb2fc2c8e836e2729f2c3580a8f9a2abdb224209f6ddbdcbea8 | ['0b49d53dc75f43e3866a83c8a39ff5c0'] | I have a table that tracks a customer's status as stored in a third party database. My table should only be updated when I can successfully update the other database via an API call.
When using Doctrine, is it a bad practice to add the API call into the setter method in my entity class? For example:
public function setCustomerStatus( $cusotmerStatus )
{
$api = new externalApi();
if( $api->updateStatus( $customerStatus ) )
{
$this->customerStatus = $customerStatus;
}
else
{
return 'Could not update customer status';
}
}
|
00792be0bb4f7de30859f6f3deee974ff94a25cfa8a404c6c7c730f5aa0a3a3b | ['0b4c00db7a454cd18a11500d902ba4a8'] | The situation is: i want to send live RTMP, 4k60fps 80Mb/s stream from my computer to Live Azure Encoder and later stream to YouTube/Facebook etc. In specs i found, that Live Azure Encoder can receive up to FHD30fps. Is there any possibility to send stream with my parameters mentioned above?
If no, can I achieve my goal using different Azure components?
Greetings,
<PERSON>
| cc32079d7fcb839c83de3b3864aae24811d7cb5301a1bb9c241a8900ca569cc3 | ['0b4c00db7a454cd18a11500d902ba4a8'] | I coded example from https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/custom-video-effects
Part of the code:
public void ProcessFrame(ProcessVideoFrameContext context)
{
using (CanvasBitmap inputBitmap = CanvasBitmap.CreateFromDirect3D11Surface(canvasDevice, context.InputFrame.Direct3DSurface))
using (CanvasRenderTarget renderTarget = CanvasRenderTarget.CreateFromDirect3D11Surface(canvasDevice, context.OutputFrame.Direct3DSurface))
using (CanvasDrawingSession ds = renderTarget.CreateDrawingSession())
{
var gaussianBlurEffect = new GaussianBlurEffect
{
Source = inputBitmap,
BlurAmount = (float)BlurAmount,
Optimization = EffectOptimization.Speed
};
ds.DrawImage(gaussianBlurEffect);
}
}
The problem is: i want to draw points (bitmaps) on frames but i have no idea how to pass specific coord to ProcessFrame function. On input i have x and y coords for every frame where to draw point and on the output i want to have video with added points for every frame.
Thanks for help.
|
8c8c5b332c21ba03fd228325c190dc21d6c29816c289177a1b44661301c5be5e | ['0b501ad376e34867a94d2a0c5e2875dd'] | The problem is that .jumbotron has padding: 30px; which combined with the width: 750px; of .container adds up to 810px. Which is apparently bit too wide for the iPad.
A workaround would be to add a rule like this to your CSS:
.jumbotron .container{
max-width:750px;
width: auto;
}
Edit: Turns out there is already a bug report about this on Github: https://github.com/twbs/bootstrap/issues/11390 – For the meanwhile the code above should fix it.
| 33325e18607faf146d8cb87402eeac3d0d5aa36f6d510c3f9d427d27400f3739 | ['0b501ad376e34867a94d2a0c5e2875dd'] | Your problem is, that you didn't connect the callback to the return. As the geocode() function itself is already asynchronous, the return doesn't have any effect there. Instead you have to pass the values you are returning here directly to the callback-function. Like this:
function getLocationData(position, callback) {
geocoder = new google.maps.Geocoder();
var location = 'Billings,MT';
if( geocoder ) {
geocoder.geocode({ 'address': location }, function (results, status) {
if( status == google.maps.GeocoderStatus.OK ) {
callback(results[0]);
}
});
}
}
|
1699b4bafb3267fadc27dce2b5b550c4da458507922e1026b333be18882c0e2e | ['0b5460aa5ed941f7961702afb2245eea'] | I'm using gcovr to generate code coverage for cobertura.
Everything was working fine with xcode 4.6. Now I updated to xcode5 and everything I get is 0% coverage...
my setup:
gcovr 3.0
Xcode 5 (Apple LLVM 5)
'Generate Test Coverage Files' is set to YES
'Instrument Program Flow' is set to YES
and to command I use:
gcovr -r . --object-directory Build/Intermediates/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386 --exclude '.*Tests.*' --exclude '.*KiwiUnitTest' --exclude '.*main.*' --xml > reports/coverage.xml
is someone having the same issue or better, have a solution? :)
| 5f2c9680647dfb52415034a49462ba8d9f1dae4a366a3b3ac430a42a51aa00d4 | ['0b5460aa5ed941f7961702afb2245eea'] | I'm trying to change the dataSource (NSFetchedResultsController) of a collectionView on the fly.
I have a var currentFetchesResultsController which I can change. After that I call reloadData on the collectionView. So far so good, but the cells are not animated...
I also tried:
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadData];
} completion:^(BOOL finished) {}];
then I get the following error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (4) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).'
What's the best way to solve this?
Thanks in advance for your help.
|
4c148535edc678349fa59609a16b5890aa6ad57c4074c83248c94a5f8d55e2b8 | ['0b6143902fac4a4eabe5ec478b67d04b'] | Each node is given an index (starting at 0). In this case, Node 1 has index 0, Node 2 has index 1, and Node 3 has index 2. To find the weight between a Node with index i, and a Node with index j, look at G[i][j].
For example, to find the weight between Node 1 and Node 3, you look at the matrix entry G[0][2], which is 2.
Because it is an undirected graph, it doesn't matter which node is the start and which is the end, so the top half of the matrix is the same as the bottom half.
| bfb0c21e4a48c3e7ade84a50c1383c6f702f85918c3835d7bae2082cdc3df692 | ['0b6143902fac4a4eabe5ec478b67d04b'] | In your code you are generating <option> elements and appending them to a <select>. This will create a drop-down menu.
If you want it to output a list with checkboxes... then you just need to change the HTML that you are inserting in the page.
http://jsfiddle.net/wKbXx/5/
Here I changed it so that instead of a <select> under question 2, there is a <ul>, and the jquery code generates and inserts <li> elements dynamically as you select items in question 1. Is this what you want? Compare this to your original code and you'll see it's basically the same, but with <li> instead of <option>.
EDIT:
http://jsfiddle.net/wKbXx/6/
Here is a version with a radio button selection instead of checkbox selection.
|
f5fa31139457aa0c7f43c7fbefe7664c7ff8554806f1e14247d2b047f6d6dfe6 | ['0b6bd77837ff410d85eecf9132f4dd32'] | I put a Scrollview inside of a tab on a tabLayout. There is a textview inside the scrollview, but when I try to scroll down, the page cuts short and I can't see all of the scrollview. How do I fix this?
This is my XML for the scrollview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end">
<TextView
android:padding="@dimen/welcome_text_padding"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="@dimen/welcome_text_size"
android:id="@+id/intro_text"/>
</ScrollView>
</LinearLayout>
I know that LinearLayout here is redundant, but that isn't the problem is it?
This is the fragment class
package com.example.lucas.guide;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class WelcomeMOBA extends Fragment{
public WelcomeMOBA() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View myInflatedView = inflater.inflate(R.layout.fragment_welcome_moba, container,false);
final TextView introText = (TextView) myInflatedView.findViewById(R.id.intro_text);
introText.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "HelveticaNeueLight.otf"));
introText.setText("this is text and it exceeds the screenspace");
return myInflatedView;
}
}
Also, here is the XML of the class which contains the above fragment.
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
And finally, here's an image of my problem:The greyed out area scrolls fine, but when I get to the blue part, the scrolling stops and wont let me go further. There is text beyond the screen.
| e53e080dd4d1ed4643544567561fcd693b67af3f698d8824845b7de2b8940e1c | ['0b6bd77837ff410d85eecf9132f4dd32'] | I've looked around for a while and cant find the answer. How do you make a screen transition so that the background stays in place while the elements displayed move? Basically, Im trying to emulate the look for sliding through pages of apps on an iphone or android phone. Any way to do this? Do i have to use fragments? This question has kind of bad wording, ask me to clarify if you're confused on anything.
|
fedae8b68fd63c335e0a1fa2d4df0859ccfe908c47a08ba811f373a6ad7e8fc3 | ['0b6c9df485734b7f96dfa2ecc1337927'] | There is an easy way to do this in TikZ, with the \foreach statement. Like this:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\noindent
\begin{tikzpicture}
\path[draw, thick, ->] (-.3,0) -- (6.3,0);
\foreach \x in {0,...,6}{
\path[draw, thick] (\x,0) -- ++(0,-.15) node [below] {\x};
}
\foreach \x/\name in {0/A,.6/B,1/C,1.5/D,2/E,2.3/F,3/G,3.3/H,4/I,4.6/J,5/K,5.5/L}{
\path[draw, fill=blue] (\x,0) circle[radius=2pt] node [above=2 mm, blue] {\name};
}
\end{tikzpicture}
\end{document}
You could automate the labeling and make the drawing of the line automated dependent on the coordinates that you enter. This is the basic method though, the result looks like this:
| 76f89f049c267585f4c639ad03b3ee8e8a94f55cda78c9c4b6df477145606ef5 | ['0b6c9df485734b7f96dfa2ecc1337927'] | <PERSON>: I see, That is very similar indeed. I am not sure why he leaves out the `every join` style on the edge, since that is a nice way to get some default behaviour on the edges. I don't know enough about when which command was introduced to be able to comment on whether or not it could have been a version issue. Perhaps the key management interface was less advanced in older versions. |
fe4163f10ebf5d7736c9d6d8f80c21461f76d583855580f14852518745300159 | ['0b8019a1ee714357b91909397582a9ac'] | Context:
I'm using Titan v1.0.0, on AWS infrastructure and want to support failover/fault tolerance. AWS will take care of DynamoDb storage backend but it seems necessary to have several titan instances serviced by an (ELB) load balancer. (Feel free to correct this assertion)
I'm using a nodeJs library to get to gremlin, and gremlin to access Titan.
Question
I'd like to receive updates in the nodeJs app when someone adds/updates/removes a vertex/edge/their properties covered by a certain query. This is equivalent to the observer pattern or continuous query functionality in some DBs/caches.
Anyone know if this is possible? Looking at the transaction log stuff it may be possible but I'm not sure. EventStrategy/EventGraph both seem to only work for the local instance transaction.
An illustration of the problem (assume instances 'A' and 'B' have a pinned session). If NodeJsA makes an update via TitanA, I want TitanB to pick that up and notify NodeJsB.
[NodeJsA]\ /[TitanA]\
\ / \
[ELB (AWS)] [DynamoDb (AWS)]
/ \ /
[NodeJsB]/ \[TitanB]/
Polling is a fall back option but I'd rather not go there.
| 667dd67c0ad0aa157e1ce9020fe5aec5c9fb5ad60f6ce75a75815483f808faf2 | ['0b8019a1ee714357b91909397582a9ac'] | Looking at the website some jiggery-pokery seems to be going on. From experience, I would suggest:
General:
Don't screen scrape information from 3rd party websites. If they change the website your code will break - perhaps contact the site to see if they have an API?
Always use the PageObject pattern as it'll keep your code DRY (think components rather than 'pages').
Specific:
Try selecting a parent element first and then work down to the element you want. This often leads you to the problem.
If you don't have any automatic retry configured in selenium you could be running that code before the element is made visible. As you can see from the error message, the element is there it's just not visible (I've got selenium experience but very little python so can't help you there :-( ).
|
a0c755ed5d52a7d0f1cd8962e9c7d05cb04d1f9e8e9bca890f19e86a02d27444 | ['0b8e1be945b448debab727b633b58fb0'] | I'm trying add a new value to the RememberMe token.
My system will block the user in case of idle time.
I tried to use this
$token = $this->securityContext->getToken();
$token->setAttribute('UserBlocked',TRUE);
But when I close the browser and open the page again, the attribute is dissapear and just the RememberMe persist.
How can change the specific RememberMe token and persist that information?
For a while I'm creating a cookie that holds the information at the same time of the RememberMe, but I think that is not a good solution, isn't?
Thank you guys!
| 9e9db44111a160121689e5acc9c5be17918b9f374ee3d704bb5e0556324ecc6b | ['0b8e1be945b448debab727b633b58fb0'] | I would like to know if can I SELECT some columns without use any ModelView or Pre-defined object.
Something like this
List<Iden_User> users = new List<Iden_User>();
users = DB.Users.Select(r => new { r.UserName.... })
.Skip(skip).Take(pageSize).ToList();
Today I'm doing it
List<Iden_User> users = new List<Iden_User>();
users = DB.Users.OrderBy(r => r.UserName).Skip(skip).Take(pageSize).ToList();
var userObject = users.Select(r => new { r.UserName,r.user_Status });
Thank :)
|
74b847f94aaf7ffc6ada5493a12be70723769c41b699a7235f888f0155fb9bcf | ['0b9cfc9b42e7454da5573da24fa2a8f1'] | OK - so I'm working in ASP 2.x (not my choice...but hey who's bitching?).
None of the initialize Dictionary examples would work. Then I came across this:
http://kozmic.pl/archive/2008/03/13/framework-tips-viii-initializing-dictionaries-and-collections.aspx
...which hipped me to the fact that one can't use collections initialization in ASP 2.x.
| 874a30329170715150def63b811c1a574d64773df49fba3b4278d60e4df2e6fc | ['0b9cfc9b42e7454da5573da24fa2a8f1'] | I need to know how to print in the printer not screen a tinker graphic. I created a tinker algorithm but then could not figure out how to print on the printer a copy of the tinker screen. I went looking for a tutorial or doc but can not find any thing I can understand or really makes sense.
I suspect I need to make a file and then send it to my usb printer and get it to print. Where do I find that kind of information?
|
58068b8e9ac16b2c9ea4cd16f2758f28752ebebfa690c120bf61891425aeb37b | ['0b9ecb1310fe44d6a8ee5411d2512243'] | I am working on odoo v8 and I am trying to modify the access rights view in users form. I want to modify the form so that when I select a role for each module's category it will call the onchange method and update the checkboxes below (Technical Settings, Usability and Other). Currently changes made will only appear after I saved the form. But I want to make it update onfly for administrator to verify before saving into the database. But it seems when I return a dict from the onchange method the system is not aware the existence of the field (eg virtual fields like in_group_1, in_group_2 etc). Is there anyway to do this?
@api.v7
def check_acl(self, cr, uid, ids, my_field, context=None):
return {'value': {'in_group_1': True}}
| 9de9a176e0478557ab17cd2fe9dcde99c69af61a89e10d9d823d757771fd0ae0 | ['0b9ecb1310fe44d6a8ee5411d2512243'] | I am using Odoo v8 and spotted a interesting behavior.
When I declare a Float with digits:
pension_unit_rate = fields.Float(digits=(16,4))
and put
<field name="pension_unit_rate" widget="progressbar"/>
in its view definition and input data 0.06 into the record and save, data is stored correctly as 0.06 in the postgresql database.
But when I click Edit button, the data read back from database is 0.060000000000000005.
I verified that data in database is correct (0.06) using pgAdmin and with simple inspection of code:
instance.web.form.FieldProgressBar = instance.web.form.AbstractField.extend({
template: 'FieldProgressBar',
render_value: function() {
this.$el.progressbar({
value: this.get('value') || 0,
disabled: this.get("effective_readonly")
});
**console.log(this.get('value'))**
var formatted_value = instance.web.format_value(this.get('value') || 0, { type : 'float' });
this.$('span').html(formatted_value + '%');
}});
It seems like the data stored in 'value' is 0.060000000000000005 which is inconsistent with data existing in database.
Is this caused by numeric data type when using digits option? Is there a workaround or fix?
Thanks in advance~
|
84ed8d815cbb61bbf8c9e714f3461de5a3642e514725c227358daea8212b1b51 | ['0ba4d33ab8d943b18492e5305beeb9b3'] | The compatibility view isn't completely equal to the real browser, but serves to see serious errors.
In Microsoft page can download IE6 and IE7, but you need a virtual machine (and image of Windows XP) for install that.
http://www.microsoft.com/en-us/download/details.aspx?id=2
| 564f2b41f44ed4761e7b7dffdb8e8cad71c18175685e91989a75193424299de6 | ['0ba4d33ab8d943b18492e5305beeb9b3'] | Added:
data[i] = new Array();
Modified:
data[i][j] = Math.floor(100*Math.random());
function randomizeHandler(evt)
{
var n = 10;
var data = new Array();
for (i=0; i<n; i++)
{
data[i] = new Array();
for (j=0; j<n; j++)
{
data[i][j] = Math.floor(100*Math.random());
$("p").text(data);
}
$("br").text(data);
}
}
I don't understand this lines:
$("p").text(data);
$("br").text(data);
If you want access to cell in table, use data[i][j].
|
51d885910f623cf910eeb4ba93019492aa26921774f2449a60f6a513b686cb83 | ['0ba66080009843f88974787a9d31f283'] | I see your issue is resolved but this might help someone else :D
The following piece of code might work for you, but it's not that we can't call count() on the array.
count($project->tasks)
Instead of this
h2>{{{ $project->name }}}</h2>
@if ( !$project->tasks->count()) // tasks is plural -> wrong.
There are no tasks for this project.
@else
<ul>
@foreach( $project->tasks as $task) // here too!
<li><a href="{{ route('projects.tasks.show', [$project->slug, $task->slug]) }}">{{ $task->name }}</a></li>
@endforeach
</ul>
@endif
Try doing this
h2>{{{ $project->name }}}</h2>
@if ( !$project->task->count())
There are no tasks for this project.
@else
<ul>
@foreach( $project->task as $task)
<li><a href="{{ route('projects.tasks.show', [$project->slug, $task->slug]) }}">{{ $task->name }}</a></li>
@endforeach
</ul>
@endif
| 431c91975a8419f9934eb40a870d32a8b347fd0d1d2ae1970583d519e98f916a | ['0ba66080009843f88974787a9d31f283'] | The following code in tinker returns a null value while it should return the project to which the first task is linked.
App\Task<IP_ADDRESS>first()->projects;
Already tried renaming the method names, column names in migrations, tried exiting tinker and logging back in
Project Migration
public function up()
{
Schema<IP_ADDRESS>create('projects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('title');
$table->string('description');
$table->timestamps();
});
}
Task Migration
public function up()
{
Schema<IP_ADDRESS>create('tasks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('project_id');
$table->string('description');
$table->boolean('completed')->default(false);
$table->timestamps();
});
}
Project.php
use App\Task;
class Project extends Model
{
protected $fillable = ['title','description'];
public function tasks(){
return $this->hasMany(Task<IP_ADDRESS>class);
}
}
Task.php
use App\Project;
class Task extends Model
{
protected $fillable = [
'completed'
];
public function projects(){
return $this->belongsTo(Project<IP_ADDRESS>class);
}
}
If anyone could just review this piece of code and let me know where I have made any conventional\idiotic mistakes (since Im new to route model binding) it would be of great help!
|
3828e949cf292dabf49728a19f7a1389462719652d7e28ed6b64b945900222bb | ['0bac3842716241ac90a48b55cf0e12c4'] | I want to replace aws-node cni to calico. I've removed aws-node daemonset and installed calico. Network between pods works great, but when I'm using mutation webhooks, kube-api-server couldn't connect to the target service, because there are no routes from it to pods:
E0304 15:41:<PHONE_NUMBER> 1 dispatcher.go:71] failed calling webhook "secrets.vault.admission.banzaicloud.com": Post https://vault-secrets-webhook.vault.svc:443/secrets?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
The service has endpoinds and it's available from pods. If I'm using default cni, connection from kube-api-server to webhook's service works, because main vpc route table has necessary routes.
Is it possible to solve this problem?
| e12585bcb930232317f22e02cb6a3156da0e0faabd054a90ba2208da3d349e6b | ['0bac3842716241ac90a48b55cf0e12c4'] | I'm trying to setup nginx to separate client_max_body_size in one location per http method, but client_max_body_size isn't working with "if" and "limit_except":
1) Config:
location /test {
limit_except POST {
client_max_body_size 1g;
}
proxy_pass ...
}
nginx -s reload:
nginx: [emerg] "client_max_body_size" directive is not allowed here
2) Config:
location /test {
if ($request_method !~* POST) {
client_max_body_size 1g;
}
proxy_pass ...
}
I get the same message on reload.
How can I set client_max_body_size per http method?
|
0647a595e63573ea14467635d73b34a5c1c0f64b61cd0448ccce60579614f514 | ['0bbe0db0cdfa44e48d55a3f9be6a0a5b'] | I am collecting information for bug reports for Mac OS 10.13 (High Sierra) betas and want to include core dumps with the reports. I have set up core dump server to catch the core dumps using the information in TN2118 on Apple's developer site (you need a developer account to view this tech note). I can generate a core dump file on the server if the test Mac encounters a kernel panic but not if I trigger it with an NMI (Non-Maskable Interrupt).
When I trigger the Mac with an NMI, I can connect to the test Mac using lldb on a second Mac but can't get the test Mac to send a core dump to the core dump server.
How do I get the NMI to generate the core dump and send it to the core dump server? Is there a lldb command I can use to instruct the test Mac to send a core dump to the server?
Note: Your core dump server needs to be running the same version of Mac OS as the test Mac. I tried for many hours to collect core dumps from Mac OS 10.13 with a server running Mac OS 10.11 and it failed every time.
| f248768a7d6f181e7831566ab5e7ffdac50dff1a7ba42d33b917a3e16de617d1 | ['0bbe0db0cdfa44e48d55a3f9be6a0a5b'] | I have set the boot-args properties in nvram so that IOKit logging is turned on. For instance to log driver matching, start and probe calls, I set nvram as follows:
nvram boot-args="io=0x16"
(Remember to turn off SIP or you won't be able to set nvram values.)
I see the log messages rolling by when I am booting in verbose mode but can't find them after the Mac is booted up.
Where are these messages written and how do I view them?
Here are the values for the IOKit logging:
enum {
// loggage
kIOLogAttach = 0x00000001ULL,
kIOLogProbe = 0x00000002ULL,
kIOLogStart = 0x00000004ULL,
kIOLogRegister = 0x00000008ULL,
kIOLogMatch = 0x00000010ULL,
kIOLogConfig = 0x00000020ULL,
kIOLogYield = 0x00000040ULL,
kIOLogPower = 0x00000080ULL,
kIOLogMapping = 0x00000100ULL,
kIOLogCatalogue = 0x00000200ULL,
kIOLogTracePower = 0x00000400ULL,
kIOLogServiceTree = 0x00001000ULL,
kIOLogDTree = 0x00002000ULL,
kIOLogMemory = 0x00004000ULL,
// available = 0x00008000ULL,
kOSLogRegistryMods = 0x00010000ULL, // Log attempts to modify registry collections
// debug aids - change behaviour
kIONoFreeObjects = 0x00100000ULL,
kIOLogSynchronous = 0x00200000ULL, // IOLog completes synchrounsly
};
|
49f08b8b9b18e5b202d854384638b6078c90568e6b4455eaeb7fac5c3bf6c643 | ['0bbeaf776fb94baca804ca9e94fc9115'] | I would like to derive a relationship expressing an integral over a region $\Omega \subset \mathbb{R}^2$ as an integral over $\partial \Omega$.
To be more specific, define the div operator in two dimensions on $p=(p_1,p_2)$ as $$\nabla \cdot p=\partial_xp_1+\partial_yp_2$$I would like to express
$$\iint_\Omega \nabla \cdot p \quad dxdy \tag{1}$$
where p is a function of $x$ and $y$, as an integral of $p$ over the boundary of $\Omega$. I would also like to do this using differential forms. Here is my attempt;
First we start by expressing the integrand of $(1)$ as a two form;
$$\iint_\Omega \nabla \cdot p \quad dx \wedge dy =\iint_\Omega \star d \star p \quad dx \wedge dy \tag{2}$$
By expressing the divergence operator in terms of the hodge dual and the exterior derivative.
I'd like to now use stokes theorem $$\int_\Omega d \omega =\int_{\partial\Omega}\omega $$ But i am unable to do so because of the left-most Hodge dual in $(2)$.
Does anyone have any suggestions / can show me how to proceed?
| 4146317ad62b32be82853d3e9ca2042c059c3f1269f99c34ba05c1e14bceb20e | ['0bbeaf776fb94baca804ca9e94fc9115'] | Take the definition of a connected topological space to be one that has no clopen sets other than the space itself or the empty set.
I claim to prove that if $f: X \to Y$ is a continuous function between topological spaces and that if $X$ is connected then the image $f(X)$ is connected also.
proof:
Assume for a contradiction that $X$ is connected and $f(X)$ is disconnected.
Then $\exists U \subset f(X)$ such that $U$ is clopen under the subset topology of $f(X)$ and $ U \neq \emptyset$, $U \neq f(X)$.
Since $f$ is continuous, $f^{-1}(U)$ is both open and closed since $U$ is clopen. Hence $f^{-1}(U)$ is a clopen set in $X$, all that is left to do is to show that it is non trivial.
Since by assumption $U \neq \emptyset$ and $U \subset f(X)$; $f^{-1}(U) \neq \emptyset$.
Furthermore $U \neq f(X)$ so $\exists a \in f(X)\backslash U$
$\therefore f^{-1}\{a\} \in X \backslash f^{-1}(U)$
$\therefore f^{-1}(U) \neq X$
So $f^{-1}(U)$ is a non trivial clopen subset of $X$ and $X$ is disconnected contradictory to what was assumed. Therefore $f(X)$ must be connected also. $\square$
Is this proof correct? It is different from the one I have seen in my topology class and I am dubious of its simplicity.
|
131314ee07fa2d6365e82979229164e4e6b7596ce67c33048ec9704570212af6 | ['0bd72064b6da4ec9bcd27348efcaaf7a'] | you can create your own pallette for ggplot
pallette_yellow_green <- c("#ffff00", "#d4e100", "#bfd300", "#95b500", "#80a600", "#6a9700", "#558800", "#2b6b00", "#155c00", "#003400")
and then
ggplot()+scale_fill_manual(values = pallette_yellow_green)
how to find color codes? use for example http://www.colorhexa.com/ (go for gradient generator)
that settles the issue for discrete variable
for continuous variables scale_fill_continuous or scale_fill_gradient should set you up: http://docs.ggplot2.org/<IP_ADDRESS>/scale_gradient.html
| 132a63a7683560c5462ee9459828dc036f930c471fe3c1771f42eee640f7972b | ['0bd72064b6da4ec9bcd27348efcaaf7a'] | is it possible to use concatenation inside excel formulas, similar as it is possible to concatenate variables with strings in vba?
suppose I have some values calculated
A1 = 1
A2 = A1 + 120 (equals 121)
now i need something like:
A3 = SUM("A" & A2) (i want "=SUM(A1:A121)" )
it obviously works in VBA, is there a way to make it work in plain excel as well?
|
644798fadeb0b6adedfa7a3ac4df975c37b57329acd3e442d5eaf4b8d3a583d7 | ['0bd7933d52f94d488ec8065a303b0573'] | To use Keycloak in build Electron You must add server listener in your main.js:
const Keycloak = http.createServer((request, response) => {
response.writeHeader(200, {"Content-Type": "text/html"});
var readSream = fs.createReadStream(__static + '/index.html','utf8')
readSream.pipe(response);
});
Keycloak.listen(3000);
Next add file index.html to folder __static. In this file add JS script like in this instruction.
And you must add ipcRenderer and send token to main.js:
keycloak.init({ onLoad: 'login-required', redirectUri: 'http://localhost:3000' }).success(function(authenticated) {
if (authenticated) {
ipcRenderer.send('keycloak-token', keycloak.token);
}
}).error(function() {
console.log('error');
});
Remember to add http://localhost:3000 in Keycloak setting in redirectUri.
Next in main.js you can send token to check autorization:
ipcMain.on('keycloak-token', (event, token) => {
const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080?token=${token}`
: `file://${__dirname}/index.html?token=${token}`
mainWindow.loadURL(winURL);
});
| 5013af4eb972758ca56d218af1366c7dee37fab3c6aad9c716ab9757de079265 | ['0bd7933d52f94d488ec8065a303b0573'] | Hello I have a method to added text on picture:
class Generate
{
public function image($name, $surname, $city){
if (empty($_GET['name'])) {
return header("Location: https://wsaib.pl/index.php?error=name&surname=$surname&city=$city");
//exit();
} elseif(strlen(mb_strlen($_GET['name'])) > 20){
return header("Location: index.php?error=longname&surname=$surname&city=$city");
//exit();
} elseif($_GET['surname'] === null) {
return header("Location: index.php?error=surname&name=$name&city=$city");
//exit();
} elseif (strlen(mb_strlen($_GET['surname'])) > 20){
return header("Location: index.php?error=longsurname&name=$name&city=$city");
//exit();
} elseif($_GET['city'] === null) {
return header("Location: index.php?error=city&name=$name&surname=$surname");
//exit();
} elseif (strlen(mb_strlen($_GET['city'])) > 15){
return header("Location: index.php?error=longcity&name=$name&surname=$surname");
//exit();
} else {
if ((isset($_GET['send']) && $_GET['send'] == 'card') && (isset($_GET['name']) && $_GET['name'] == $name) && (isset($_GET['surname']) && $_GET['surname'] == $surname) && (isset($_GET['city']) && $_GET['city'] == $city)) {
$getName = $name;
$getSurname = $surname;
$getCity = $city;
//$getWishes = "";
$today = date("d.m.Y");
$text_length = 38;
//$textName = wordwrap($getName, $text_length, "<br />", true);
$textSurname= wordwrap($getSurname, 18, "-<br />", true);
$textCity = wordwrap($getCity, 11, "-<br />", true);
//$textN = str_replace('<br />', "\n", $textName);
$textS = str_replace('<br />', "\n", $textSurname);
$textC = str_replace('<br />', "\n", $textCity);
$picture = imagecreatefrompng("merry-christmas.png");
//$black = imagecolorallocate($picture, 0, 0, 0);
$white = imagecolorallocate($picture, 0xFF, 0xFF, 0xFF);
// zyczenia
//imagettftext($picture, 18, 2, 20, 60, $white, 'fonts/Courgette/Courgette-Regular.ttf', trim(ucfirst($textW)));
// imie i nazwisko
if (strlen($getName) >= 15 ) {
imagettftext($picture, 35, 5, 280, 540, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($getName)));
imagettftext($picture, 35, 5, 280, 590, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($textS)));
} else {
imagettftext($picture, 35, 5, 280, 540, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($getName . " " . $textS)));
}
// data
imagettftext($picture, 20, 0, 530, 710, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($textC.", ".$today)));
header("Content-type: image/png");
$generateImage = imagepng($picture, "kartka_swiateczna_wsaib.png");
//imagedestroy($picture, "kartka_swiateczna_wsaib.png");
}
}
}
public function location($getName, $getSurname, $getCity){
return header("Location: index.php?query=done&name=$getName&surname=$getSurname&city=$getCity");
}
And file form:
<?php
require_once "generator.php";
?>
<!DOCTYPE html>
<html>
<head>
<title><PERSON>>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="Stylesheet" type="text/css" href="style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="./bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="./bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body style="background-color: #c13213">
<div class="container">
<div class="row">
<div class="col-md-8">
<?php
@$getName = $_GET['name'];
@$getSurname = $_GET['surname'];
@$getCity = $_GET['city'];
if ( (isset($_GET['send']) && $_GET['send'] === 'card') && (isset($_GET['name']) && $_GET['name'] === $getName) && (isset($_GET['surname']) && $_GET['surname'] === $getSurname) && (isset($_GET['city']) && $_GET['city'] === $getCity)) {
$image = new Generate();
$image->image($getName, $getSurname, $getCity); // <PERSON> !!!!!!!
$image->location($getName, $getSurname, $getCity); // <PERSON> !!!!!!!
} if (isset($_GET['query']) && $_GET['query'] === 'done'){
$saveFile = "kartka_swiateczna_wsaib.png";
echo '<img src="' . $saveFile . '" id="kartka-photo" width="100%" height="100%"/>'; ?>
<p><a class="btn btn-success" href="kartka_swiateczna_wsaib.png" download="kartka_swiateczna_wsaib.png">Pobierz kartkę</a></p>
<?php } else { ?>
<img src="merry-christmas.png" id="kartka-photo" width="100%" height="100%">
<?php }
?>
</div>
<div class="col-md-4">
<p id="title">Zaprojektuj kartkę</p>
<form action="index.php" method="get">
<input type="text" class="form-control" placeholder="Podaj imię" id="name" name="name" value="<?php echo $getName; ?>"><div id="counterName"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'name') { ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <PERSON>>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longname'){ ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> <PERSON> imienia to 20 znaków.</strong>
</div>
<?php } ?>
<input type="text" class="form-control" placeholder="Podaj nazwisko" id="surname" name="surname" value="<?php echo $getSurname; ?>"><div id="counterSurname"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'surname') { ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <PERSON>>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longsurname'){ ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> <PERSON> nazwiska to 20 znaków.</strong>
</div>
<?php } ?>
<input type="text" class="form-control" placeholder="Podaj miasto" id="city" name="city" value="<?php echo $getCity; ?>"><div id="counterCity"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'city') { ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <PERSON> miasta.</strong>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longcity'){ ?>
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> <PERSON> miasta to 15 znaków.</strong>
</div>
<?php } ?>
<button type="submit" class="btn btn-info" name="send" id="send" value="card" style="margin-bottom: 20px;">Generuj</button>
<a href="/index.php" class="btn btn-default" role="button" style="margin: 0px 0px 20px 5px;">Odśwież</a>
<?php
if (isset($_GET['query']) && $_GET['query'] === 'done') { ?>
<div class="alert alert-success fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <PERSON> wygenerowana poprawnie, możesz ją <PERSON> kikając na przycisk <i><a href="kartka_swiateczna_wsaib.png" download="kartka_swiateczna_wsaib.png" class="download">Pobierz kartkę</a></i>.</strong>
</div>
<?php } ?>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var minName = 20;
document.querySelector('#name').onkeyup = function(e){
document.querySelector('#counterName').innerHTML =
this.value.length <= minName
? 'Pozostało '+(minName - this.value.length)+' znaków.'
: 'Imię zbyt długie!';
}
var <PERSON> = 20;
document.querySelector('#surname').onkeyup = function(e){
document.querySelector('#counterSurname').innerHTML =
this.value.length <= minSurname
? 'Pozostało '+(minSurname - this.value.length)+' znaków.'
: 'Nazwisko zbyt długie!';
}
var minCity = 15;
document.querySelector('#city').onkeyup = function(e){
document.querySelector('#counterCity').innerHTML =
this.value.length <= minCity
? 'Pozostało '+(minCity - this.value.length)+' znaków.'
: 'Nazwa miasta zbyt długa!';
}
</script>
The problem is with function Header Location:
return header("Location: index.php?error=longcity&name=$name&surname=$surname");
In GET (in url) I have ONLY name=$name&surname=$surname but function header not returned error=longcity. Where is the problem ? When I added to url for example ?query=done script work ok. I don't know were is the error.
|
95896aa8a78610c4a31afd8002713026ab9e4119c8a6eb2f8c095ca3d54e634b | ['0be4a6b119784a2d9148a49a6fbf16cb'] | I'm new to use astyanax connecting to cassandra(1.2.8).
I downloaded astyanax from [https://github.com/Netflix/astyanax] and cassandra from [http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.8/apache-cassandra-1.2.8-bin.tar.gz]. Everything is installed/built based on instruction and keep default settings(like conf/cassandra.yaml). Now I try to run the sample code [https://github.com/Netflix/astyanax/blob/master/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java], and a disgusting error keeps bothering me(showed at eclipse):
Caused by: com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException: PoolTimeoutException: [host=<IP_ADDRESS>(<IP_ADDRESS>):9160, latency=5021(5021), attempts=1]Timed out waiting for connection
As I enable cassandra debug mode, the below is showed on the terminal:
DEBUG 17:06:48,968 Thrift transport error occurred during processing of message.
org.apache.thrift.transport.TTransportException: Cannot read. Remote side has closed. Tried to read 4 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:22)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Just to emphasize, I don't change anything in cassandra.yaml(actually I don't know what they mean); all the libs from astyanax and from cassandra-1.2.8 are all imported to the java project.
I guess the problem is due to that connections will shut down when I try to flush through frame transform... I'm a noob to database. I do appreciate to all the helps!
ps. I'm waiting on stackoverflow. If any logs you need to check(please also give me the directory to find it. I'm noob>_<), just say and I'll fetch it. Thanks a lot!!
| 91aa0cd5bb7523569b51cafae411032f8ed858563cb6ecd7a57343bddc804591 | ['0be4a6b119784a2d9148a49a6fbf16cb'] | My internship needs me get familiar with cassandra. I downloaded astyanax cassandra from:
https://github.com/Netflix/astyanax
After building astyanax from source via the commands:
git clone <EMAIL_ADDRESS>:Netflix/astyanax.git
cd astyanax
./gradlew build
I created a new java project and copy+paste the sample code from here:
https://github.com/Netflix/astyanax/blob/master/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java
Now the problems arose. I did fix the path configuration, which is importing all .jar files generated from the gradlew build. But one (long)line of code is highlighted by red dash:
context = new AstyanaxContext.Builder()
.forCluster("Test Cluster")
.forKeyspace("test1")
.withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
.setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
)
.withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
.setPort(9160)
.setMaxConnsPerHost(1)
.setSeeds("<IP_ADDRESS>:9160")
)
.withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
.setCqlVersion("3.0.0")
.setTargetCassandraVersion("1.2"))
.withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
.buildKeyspace(ThriftFamilyFactory.getInstance());
The warning message is:
The type org.apache.cassandra.thrift.Cassandra$Client cannot be resolved. It is indirectly referenced from required .class files
I need experts help. Thanks a lot!!!
|
e9f84ca981d9f4e1a4459233983a71a28df598c811abffdbcb7c36464079c663 | ['0be87b0d19624208bfad6651ed7518e0'] | The problem comes from trying to target the parent selector label:before with input:checked. CSS doesn't allow you to 'climb up the DOM' in this manner. Instead you may want to try with the following markup :
<ul class="acf-checkbox-list checkbox vertical">
<li><input id="acf-field-interested_in" type="checkbox" class="checkbox" name="interested_in" value="permanent" checked="yes"/><label>Permanent</label></li>
<li><input id="acf-field-interested_in-Temporary" type="checkbox" class="checkbox" name="interested_in" value="Temporary" checked="yes"/><label>Temporary</label></li>
<li><input id="acf-field-interested_in-Interim" type="checkbox" class="checkbox" name="interested_in" value="Interim" checked="yes"/><label>Interim</label></li>
</ul>
Don't forget to close your input tags as per the HTML specs!
| 6528c82d1f2be24d3fb14708ae4cf565588e8d275a3db5ba9b8aaa182d81e31b | ['0be87b0d19624208bfad6651ed7518e0'] | The default behaviour of most browsers is to exclude an element's border-width from the calculation of its width. This means your td's total width (width + border) will be 2in + 2 * 1px. To fix this you can set box-sizing: border-box;
More info here : https://css-tricks.com/box-sizing/
|
c9a8b6473fa23356abe311fa99bd9455dc751d1635f9379874a8899d7e775ba1 | ['0bf134b9b38544f1b0b6d99581583b13'] | I have many custom Views. I want to show a specific custom view on Layout. I am using a View and trying to initialize it with custom view. its not working any help please?
View custom=(View)findViewById(R.id.animation_View);
custom=new CustomeView(this, null);
setContentView(R.layout.activity_animation);
Activity_XMl
<View
android:id="@+id/animation_View"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
</View>
| ac88a7c8380dcb0ade01bf6e08a2ead7bfaf4324f717ab48c583692f13e53400 | ['0bf134b9b38544f1b0b6d99581583b13'] | Can we rotate a bitmap image around a center. i am crruntly using a code but it rotates around it self
public Bitmap rotateCar(Bitmap carImage,float degrees)
{
Matrix matrix = new Matrix();
matrix.postRotate(degrees);
Bitmap rotatedCarImage=Bitmap.createBitmap(carImage,0,0, carImage.getWidth(), carImage.getHeight(),matrix, true);
return rotatedCarImage;
}//end of rotate car
|
3ce5572c2e62463d37b7a7424189033d8b87ee0e6f862cfc43f80bc4e432be5f | ['0bfa0c124e86437a8ced7b89ca6d11f2'] | you can add condition in performFiltering(CharSequence constraint) method like below
ListAdapter implements Filterable{
@Override
public Filter getFilter() {
if (valueFilter == null) {
valueFilter = new ValueFilter();
}
return valueFilter;
}
private class ValueFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
if (constraint != null && constraint.length() > 0) {
List<DrugsListPojo> filterList = new ArrayList<>();
for (int i = 0; i < mdataListFilterList.size(); i++) {
if ((mdataListFilterList.get(i).getName().toUpperCase()).contains(constraint.toString().toUpperCase())) {
filterList.add(mdataListFilterList.get(i));
}else if ((mdataListFilterList.get(i).getDrugTypeName().toUpperCase()).contains(constraint.toString().toUpperCase())) {
filterList.add(mdataListFilterList.get(i));
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = mdataListFilterList.size();
results.values = mdataListFilterList;
}
return results;
}
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
dataList = (List<DrugsListPojo>) results.values;
notifyDataSetChanged();
}
}
| d13f780fe62bde05c025379708f7d18cd7dc1973ef80d12889157764de00340a | ['0bfa0c124e86437a8ced7b89ca6d11f2'] | yes i solve my problem by using fallowing changes in code
search = (SearchView) rootView.findViewById(R.id.search);
// search.setQueryHint("search");
searchEditText = (EditText)search.findViewById(android.support.v7.appcompat.R.id.search_src_text);
searchEditText.setTextColor(getResources().getColor(R.color.colorPrimary));
searchEditText.setHintTextColor(getResources().getColor(R.color.colorPrimary));
searchEditText.setHint("search here for quick access");
I comment search.setQueryHint("search"); method. and I access EditText of the searchview, and call the searchEditText.setHint("search here for quick access");
|
3710d261efdc1afe604cf54113f3974c0d200d67ca3d614731225b32898cfcd2 | ['0bfaf2f80f4840ea897f0a755f5d1be5'] | Ask the prof or TA for assistance. You would never try to do HTTPS over netcat in the real world (openssl s_client would be my first-line tool of choice, but there are other options) so the chances of finding the "right" answer that the prof wants by asking people in the real world is low. I'd probably go over all the slides/notes from the lectures; typically these sorts of "impossible" questions are actually answered in the lectures, and asked just to see who is actually paying attention in class.
| 80cc971ad3d93e89ea8632730b726cc4a8b00bd18fc0e5757a648dd1182aed9f | ['0bfaf2f80f4840ea897f0a755f5d1be5'] | Yes, EC2 seems like a good fit for what you're trying to do. As far as how to do it exactly, I'm not familiar with celery and RabbitMQ, but I assume it's just a matter of writing some code that processes the jobs in celery as required -- this might involve retrieving the data from your webserver to do the job (out of the database using a web services API) and send the results back (again, via a web services API you define).
|
8eab0200a4eee001baddc262f324c293a2c9ba16ab67572fc6bc9d2e4d319fa1 | ['0c0ba3863ca54ae089e3327f3eae2004'] |
Hi all, how much TCP packets should come at 100/1000mbit network card (not an embedded Realtek's home solution) before the Linux kernel will become unable to process the NIC's buffer resulting in packet drop?
If all processing is in two iptables rules, we can expect performance 100 MBps and 0.3~0.4 MPps.
Intel PCI-E NIC good choice for this purpose, they are well performance tuning. Dual-core Xeon not the best choice. Core 2 Duo/Qaud >= 3 Ghz or Core i3/i5/i6 faster.
| fa1c78565fb1db74fac4c41febd311e1b1ae726a588f0bb6ed4a9102465531a6 | ['0c0ba3863ca54ae089e3327f3eae2004'] | Not sure, but the wikipedia page here has some interesting, if not totally clarifying info: https://en.wikipedia.org/wiki/Christmas_carol .... considered a subset of "christmas music" and typically based on medieval chord "patterns." Also, songs a often sun by one or two people most often, but carols tend to be sun by a group together, right? Obviously a song a be song by multiple people, but is it common to think of a carol as being sung by one person?
|
e5eabb17ab437575a00f713c87b9600684ad3bd010f40e496f8c10f8f88525ac | ['0c27285d3862479c872b7a2f770c0fa4'] | I have an ordered set of data, X, that I want to split into a 10 random groups to do 10-fold cross validation. The data set is very simple with one feature per row. I am wondering if it is random/accepted practice in Machine Learning to split the data into the ten groups by iterating over the data placing the data into the groups every ten entries. So, for example, I start at X[0] and that would go into a group called "group0", X[1] would go into "group1". Once I reach X[10], I would place that in "group0" again. I would repeat this until all data is in one of the ten groups. First of all is this random? Secondly, if it isn't random, does it matter? Will the averaging of the ten folds counteract any "non-randomness" with a sufficiently large data-set?
| 264cad2061445c01b32a624ff652c4c345de2abbe15f0e046b2847ad0ca045ce | ['0c27285d3862479c872b7a2f770c0fa4'] | The answer is good. I've configured my virtual lab in host-only network and configured Debian 9.0 as DHCP server in this network by installing isc-dhcp-server program. The other client virtual host get their ip from my debian dhcp server. There is no problem in there. I'll make some effort with yersinia. |
eabf2a2b3179367d60d9f1f23166b891ca9a4ffb38941bbff97bc300508b27ec | ['0c28dd0029b14410b609cf0ae41b8692'] | I'm trying to change to color of a Div element on my page, using Jquery and Jquery color plugin. Can you please explain what am I doing wrong here? I'm trying to change to colors to red, yellow,lime and blue...
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://code.jquery.com/color/jquery.color.plus-names-2.1.2.js"></script>
<script>
$(document).ready(function () {
$("button").click(function () {
var div = $("div");
div.animate({ height: '300px', opacity: '0.4',color:'red' }, 1000);
div.animate({ width: '300px', opacity: '0.8',color:'yellow' }, 1200);
div.animate({ height: '100px', opacity: '0.4',color:'lime' }, 1230);
div.animate({ width: '100px', opacity: '0.8',color:'blue' }, 1234);
});
});
</script>
</head>
<body>
<button>Start Animation</button>
<div style="background:#123456;height:100px;width:100px;position:absolute;">
</div>
</body>
</html>
| 230ec8363e83434502ef7efacb1d02f9a018bba1d94849881c0f2fd842a21d6b | ['0c28dd0029b14410b609cf0ae41b8692'] | I have an array of 25 random integers between -100 and 100.
For example my array can look like this:
-10, 23, 19, -11, 3, -9, -8, 4, 10, 20, 30, 40, 50, -6, -2, 1, -9, 8, -6, 20, -21, -3, -2, -4, -7
I wish to write a method that receive my array as a parameter, and prints out the following: the first index, the last index, and the sum of the successive elements between them, that will give the possible maximum sum.
For my example the output will be: first index: 1 (value: 23), last index: 19 (value:20), total sum: 177
I don't know how I should deal with this problem. I wrote a code, but it's very complex and unefficient because I used a list to store all the possible sums.
Can you please show a Pseudo-code for this problem, or code in c#?
|
61247cf9c6453b228fac7602f7d1ef01954f73948a772344fce9bdc12de3b913 | ['0c2beb3a4b644ee6b9b973eb0e95f548'] | You can work around by understanding this code.
HTML
<input type="text" name="value" id='value' />
<input type="button" value="submit" onclick="createDiv()" />
</p>
JS:
function createDiv() {
var divName = document.getElementById('value').value; //getting value for div name
var iDiv = document.createElement('div'); //creating div element
iDiv.name = divName;
document.getElementsByTagName('body')[0].appendChild(iDiv) //adding it in DOM tree
}
| a7df245c48e2ad089158ebb9efcaf183a440c7fa832e59ad3f8a5b17f59d450f | ['0c2beb3a4b644ee6b9b973eb0e95f548'] | I'm writing custom validator attribute in asp.net mvc, Its working fine for server side validation. Here's demo code
public class CustomEmailValidator : ValidationAttribute,IClientValidatable
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (value != null)
{
string email = value.ToString();
if (Regex.IsMatch(email, @"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", RegexOptions.IgnoreCase))
{
return ValidationResult.Success;
}
else
{
return new ValidationResult(ErrorMessage);//"Please Enter a Valid Email.");
}
}
else
{
return new ValidationResult("" + validationContext.DisplayName + " is required");
}
}
//new method
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
{
var rule = new ModelClientValidationRule();
rule.ErrorMessage = FormatErrorMessage(metadata.GetDisplayName());
rule.ValidationType = "emailvalidate";
yield return rule;
}
}
Now for client side validation, I'm unable to add adapter to obstrusive.js.
$.validator.unobtrusive.adapters.add("emailvalidate", function (options) {
options.messages['emailvalidate'] = options.message;
});
$.validator.addMethod("emailvalidate", function (value, element) {
{
console.log("inside emailValidate function");
if (value=="test") {
return true;
}
else {
return false;
}
}
});
I'm not fluent in adding adapters so I'm sure that there's issue in adding adapter to obstrusive.js. kindly point out the issue. Thanks.
|
202509ad0fd1441bb121a971496ac8326f246a22864f2e7b6617a579ee0be8ed | ['0c339c78186c41b387e34f24e21e0c50'] | I have now done so; the module still doesn't load post-reboot. One thing I noticed when reading through was that <PERSON> answer appears to assume than neither `bcmwl-kernel-source` nor `firmware-b43-installer` is installed by default, which was not the case for me; `bcmwl-kernel-source` was already installed on a clean install of 16.04.3. | 7769fa27f7591035c9def27df31cb9e449abbb0ad6a02380350d762b8072620a | ['0c339c78186c41b387e34f24e21e0c50'] | I have one repository with read-only access on remote server. On my computer I have just working copy of that repository which I'm working on and I need to commit whole working copy to my own Repository with full access. Simply it looks like: Update WC, add/edit some code, commit it on my own repository.
Is it possible because I can't figure out how to do this in Eclipse (with Subclipse plugin) or TortoiseSVN.
|
d59bbe4bf020dac8ba6d01360bf8296f8961d0da89c20fe5dab51004c5919558 | ['0c3f3805b520429c835830f2bef5d2c9'] | Suppose my AutoMapper configuration knows how to map from type T1 to type T2 and from T2 to type T3. I then have the following. It works:
public static class MapperExtensions
{
public static T3 MapVia<T1, T2, T3>(this IMapper mapper, T1 t1) {
var t2 = mapper.Map<T2>(t1);
var t3 = mapper.Map<T3>(t2);
return t3;
}
/// <summary> The calling code needs to ensure that t1 is of a type that the mapper knows how to map to type T2.</summary>
public static T3 MapVia<T2, T3>(this IMapper mapper, object t1) {
var t2 = mapper.Map<T2>(t1);
var t3 = mapper.Map<T3>(t2);
return t3;
}
}
My question is whether it is possible to bypass the middle type? I would love to be able to do something in my configuration to tell it "Generate a map from T1 to T3 that is the composition of your map from T1 to T2 and your map from T2 to T3." Then I could just map from T1 to T3 normally.
There are times when T2 is large, which may make this a performance issue. There are also cases where T2 is not particularly large.
| 6dc33478d6b03c1159bf69d8da5eef80f0bbeef3d4cf7e74072adbbe9681837e | ['0c3f3805b520429c835830f2bef5d2c9'] | I have the following classes:
public class OneToManySource {
public OneToManySource SourceChild { get;set; } // will sometimes be null
public int Value { get; set; }
}
public interface IDestination
{
}
public class ChildlessDestination: IDestination
{
public int DestValue { get; set; }
}
public class ChildedDestination: IDestination
{
public int DestValue { get; set; }
public IDestination DestinationChild { get; set; } // Never null. If it would be null, use a ChildlessDestination instead.
}
I want to map these back and forth in the sensible way. If a source has a child, it goes to a ChildedDestination. Otherwise, it goes to a ChildlessDestination.
I have the following, which works, but it's ugly. I'm wondering if it can be cleaned up. In particular, the "ConstructUsing" gets the job done, but it also seems to be (understandably) opaque to AutoMapper's internal smarts. So ReverseMap() there doesn't work. Instead of that, we are stuck with two other ReverseMap() calls, and also the last CreateMap().
For example, would I be better off starting with the reverse map?
public MapperConfigurationExpression Configure(MapperConfigurationExpression expression) {
expression.CreateMap<OneToManySource, ChildedDestination>()
.ForMember(d => d.DestValue, cfg => cfg.MapFrom(s => s.Value))
.ForMember(d => d.DestinationChild, opt => opt.MapFrom(s => s.SourceChild))
.ReverseMap();
expression.CreateMap<OneToManySource, ChildlessDestination>()
.ForMember(d => d.DestValue, cfg => cfg.MapFrom(s => s.Value))
.ReverseMap();
expression.CreateMap<OneToManySource, IDestination>()
.ConstructUsing((source, context) =>
{
if (source.SourceChild == null) {
return context.Mapper.Map<ChildlessDestination>(source);
}
return context.Mapper.Map<ChildedDestination>(source);
});
expression.CreateMap<IDestination, OneToManySource>()
.ConstructUsing((source, context) =>
{
return context.Mapper.Map<OneToManySource>(source);
});
return expression;
}
|
4e460bb66e25a7b59d880c3b642ee1a5cdc22c46198c36cc374d0f2e46e07f94 | ['0c5adf596f6f47a09c0ac15c77db1c1e'] | I am trying to modeling mcmc by using mhadaptive package in R. But one error appear. What should I do?
#importing data from excel
q<-as.matrix(dataset1) #input data from spread price
F1<-as.matrix(F_1_) #input data from F
li_reg<-function(pars,data) #defining function
{
a01<-pars[1] #defining parameters
a11<-pars[2]
epsilon<-pars[3]
b11<-pars[4]
a02<-pars[5]
a12<-pars[6]
b12<-pars[7]
v<-pars[8]
pred<-((a01+a11*epsilon^2+b11)+F1[,2]*(a02+a12*epsilon^2+b12)) #parametes which exist here should be optimize by cinsidering this formula
log_likelihood<-sum(dnorm(data[,2],pred,log = TRUE))
prior<-prior_reg(pars)
return(log_likelihood+prior)
}
prior_reg<-function(pars) #here there is prior values
{
epsilon<-pars[3]
v<-pars[8]
prior_epsilon<-pt(0.85,5,lower.tail = TRUE,log.p = FALSE)
}
mcmc_r<-Metro_Hastings(li_func = li_reg,pars =NULL,prop_sigma = NULL,par_names = c('a01','a11','epsilon','b11','a02','a12','b12'),data=q,iterations = 2000,burn_in = 1000,adapt_par = c(100,20,0.5,0.75),quiet = FALSE)
mcmc_r<-mcmc_thin(mcmc_r)
I used mhadaptive package for calculating optimized parameters.
But this error eppear
Error in optim(pars, li_func, control = list(fnscale = -1), hessian = TRUE, :
function cannot be evaluated at initial parameters
| 3a9d168a82b0b5bace26c75b2bf600677ab771e8f5c4c4538b757b6a73cc21d4 | ['0c5adf596f6f47a09c0ac15c77db1c1e'] | I'm trying to write this for loop code in R, but this error occur.
Error in h(i - 1) : could not find function "h"
What should I do?
F1<-as.matrix(F_1_) #importing data
a01=0.1 #importing parameters
a11=0.1
b11=0.1
epsilon=0.5
a02=0.1
a12=0.1
b12=0
h(0) <- 0.3208 #starting value for h(i)
for(i in 1:2377)
{
h(i)<- ((a01+a11*h(i-1)*(epsilon^2)*h(i-1)*b11)+F1[,2]*(a02+a12*h(i-1)*(epsilon^2)+h(i-1)*b12))
}
return(h(i)) #getting output from h(i), h(i) depend on h(i-1) and other parameters
|
eb27395e937753db63caae0c65ae3c488a41b351bb1f03846a7c4f91b3f1f5ad | ['0c5b09eb7e3743449e6bee4b095d7558'] | Thanks again. I've actually read that article (review) you posted, and saw that mainly, in terms of finding an estimate for the eigenvalues my best option is with inverse iteration. One more question though, do you think this will still work if my norm is not Euclidean? The measure with which y(x) is integrated is actually weighed by "x", so it's not a question of simply summing y-tuples. | 33261fa5dedcad8a9fa6af8ad639ccb66372936d5e899477d392013139dbb270 | ['0c5b09eb7e3743449e6bee4b095d7558'] | Yes, it does match the PCB. I have also compared this, but looking at several images in the soldering manual it seems like they used different PCBs. This schematic being wrong isn't more than an educated guess but I don't see any other possibilities for a 50V range. |
0b56ab8b3689761714c69d4038540cf841c83c36d478dc2e57acb4c1c99fcfb5 | ['0c7861711e124a27b31a604f98dbad3d'] | Please check the web.xml file --the following .. is correct or not
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
from the above if we do not write proper param name .. then the same error will come and if we do not give proper param value means that exact path and exact name of the file .. then we will get the same error.
| 796fee155a6e1b3e923f03566c9d67062a4bef24431a9e881ba74723c6f590c9 | ['0c7861711e124a27b31a604f98dbad3d'] | The following code will answer your problem. If it does not work , please let me know I will think in another way.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Large Modal</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Large Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>This is a large modal.</p>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal2">ClickForAnotherModel</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal2" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Another Modal</h4>
</div>
<div class="modal-body">
<p>This is Another Modal on Modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
|
d7fd7022e4b64a294df985ec78e1ccedf572a98a7abb1f6698d6c25d6151b669 | ['0caade65504a4443a3982140142f5512'] | I want to add markers on a Google map in angular using agm module. I've found an implementation of how to do it using the map mapClick event. But I can't import MouseEvent from @agm/core. VsCode says the module doesn't have such exported member. Searched for issues l'île that here on stack and Google but I'm kinda surprised no one raised such an issue before.
Please help !
thanks in advance
Here is the code
mapClicked($event: MouseEvent) {
this.markers.push({
lat: $event.coords.lat,
lng: $event.coords.lng,
draggable: true
});
}
| 323139151754a6936fba56049a08ffedf318c6b50ccb34ec254a140064771f36 | ['0caade65504a4443a3982140142f5512'] | I'm a beginner webdev using linux. I installed Xamp in my ubuntu 18.04 LTS. But when i make **sudo /opt/lampp/lampp start** so as to start apache, apache doesn't start. I tried to see if another webserver is running on the port 80 by tapping **telnet localhost 80** and remarked that another webserver is running. But i don't know how to stop it and get apache running in lieu of it. Of course i did a google search but i'm not getting a helping answer to my question. Does anybody know how i can fix my problem and get apache running ? thanks for helping
|
f188fa7970f237964f2fa95132b6e62c99c37362a52cbbbb8fba402434ac4428 | ['0cb923a4c5774990acc912de61243892'] | There is an unwanted gap between the left side of my div and the actual content inside of it (text, images). I have margin and padding both set to 0px for the class. The div is also right next to my nav bar, which may be somehow affecting the spacing.
body
{
background-color: #f5f5f7;
background-image: url("../img/powder.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: right bottom;
font-family: '<PERSON>', serif;
padding: 0px;
}
.main /* the extra space is occuring in this class */
{
position: relative;
left: 200px;
width: 800px;
height: 400px;
text-align: left;
border-radius: 10px;
padding-left: 0px;
margin: 0px;
background-color: rgba(207, 207, 207, 0.5);
}
nav ul
{
background: #efefef;
background: linear-gradient(to right, #d3c965 0%, #89822a 100%);
background: -moz-linear-gradient(left, #d3c965 0%, #89822a 100%);
background: -webkit-linear-gradient(left, #d3c965 0%,#89822a 100%);
background: -o-linear-gradient(left, #d3c965 0%, #89822a 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0px 20px;
border-radius: 10px;
list-style: none;
/* display: inline-table;*/
margin: 0px;
}
nav ul li:hover
{
background: linear-gradient(to right, #993300, #4C1A00); /*Standard syntax */
background: -moz-linear-gradient(left, #993300, #4C1A00);/* For Firefox 3.6 to 15 */
background: -webkit-linear-gradient(left, #993300, #4C1A00);/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(left, #993300, #4C1A00); /* For Opera 11.1 to 12.0 */
}
nav ul li:hover a
{
color: #fff;
}
nav ul li a
{
display: block;
padding: 25px 40px;
color: #4C4C4C;
text-decoration: none;
margin: 0px;
}
The live version of this is available at msu.edu/~bridsonc/henna
| 552cd6fa8d0ca1f61f8526ddae71a47fc2a39fb74933e3b192ad8ba5013bacba | ['0cb923a4c5774990acc912de61243892'] | Try using a function like this. You can replace with
private object GetFormData<T>(MultipartFormDataStreamProvider result)
{
if (result.FormData.HasKeys())
{
var unescapedFormData = Uri.UnescapeDataString(result.FormData
.GetValues(0).FirstOrDefault() ?? String.Empty);
if (!String.IsNullOrEmpty(unescapedFormData))
return JsonConvert.DeserializeObject<T>(unescapedFormData);
}
return null;
}
Use it like this
File file = GetFormData(result);
The main line of code you want is:
JsonConvert.DeserializeObject<File>(result.FormData.GetValues(0).FirstOrDefault());
|
5fd049875ca9f9583da3416681912ab1db84ad2690cf3135bca7b56cdce22544 | ['0cbb5ef6749e4a4dbb0310db22f94bf3'] | I wasn't able to get Global VPN Client working, but...There is a SonicWall client built into Windows 8.1 and it works for me. There are some directions here.
http://en.community.dell.com/dell-blogs/dellsolves/b/weblog/archive/2013/09/05/mobility-for-business-built-in-to-windows-8-1.aspx
| ce2050c91d8026cebeb79f0f67818f54f47afefbc1e9c6c634fbba676a35af8d | ['0cbb5ef6749e4a4dbb0310db22f94bf3'] | I am working on my PhD thesis and trying to align the numbers in the table of content .
I can see these lines in the content.tex, but as you can see numbers are not aligned. Build with pdflatex, texmaker and bibtext
\pagestyle{scrheadings}
%\phantomsection
\pdfbookmark[1]{\contentsname}{Table of contents}
\setcounter{tocdepth}{2} % <-- 2 includes up to subsections in the ToC
\setcounter{secnumdepth}{3} % <-- 3 numbers up to subsubsections
\manualmark
\markboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}
\tableofcontents
\automark[section]{chapter}
\renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection}\enspace\spacedlowsmallcaps{#1}}}
|
7a1f750104a12b5e6ff93c249a0878e040346d83ef6771ce78435ae9418deba2 | ['0cda1eae54804ca499699d48f6c5ca13'] | If this question still persists: the only way I have found to be able to do this is simply run the Windows version through Wine on Mac. It seems to be fairly stable. The interesting part is that once schematic is updated device current OP data label using the Wine version, it will still work in the native Mac version.
| d937e8fd3115114dbdc102d41b843d3ecdd06a7e31a396bc268fb016fcbf4cfd | ['0cda1eae54804ca499699d48f6c5ca13'] | Now I found a solution for my problem! I had to remount /local/Storage with ACL feature and set the default permission for my group.
I modified the /etc/fstab as follows (added acl):
/dev/xvdd /local/Storage ext3 defaults,acl 1 2
If you want to test it without rebooting, you can also use mount -o remount,acl /dev/xvdd. Then I changed the permissions of my repositories and set the ACL default permissions for the group.
$> find /local/Storage/svn/myproject-src.rep -type d -exec chmod 2770 {} \;
$> find /local/Storage/svn/myproject-src.rep -type f -exec chmod 660 {} \;
$> setfacl -R -d -m group<IP_ADDRESS>rwx /local/Storage/svn/myproject-src.rep
$> chgrp -R mygroup /local/Storage/svn/myproject-src.rep
|
203be7e2f4857a85e5f3bbb60bc590b932e3e80dbcf8575c3b74365a0e673237 | ['0ce9b3362ac34c3d94dd9fb1d570e55b'] | You can set a shadow to the navigationBar layer, assuming you are using one.
self.navigationController.navigationBar.layer.shadowColor = [[UIColor blackColor] CGColor];
self.navigationController.navigationBar.layer.shadowOffset = CGSizeMake(0.0f,0.0f);
self.navigationController.navigationBar.layer.shadowOpacity = 1.0f;
self.navigationController.navigationBar.layer.shadowRadius = 4.0f;
If you are not using a navigation controller, then you can apply this same type of shadow to a UIView's layer.
| 24fc6f6a3bfd0a6f480cf3d67172d36d7ab2fccf86cb0e25cda44e1f3e6580be | ['0ce9b3362ac34c3d94dd9fb1d570e55b'] | I was working on my game last night in XCode and wanted to remove a couple of old files from my Development folder. I Multi-Selected them, and deleted permanently. Come to find out seconds after, that I also had the main source file for my game also selected, and deleted.
I've tried to recover the file any other way I know how, (not in trash bin, data recovery tools) etc.
The only other thing I could think of to try is to try and somehow get the code from the debug test app I have on my iphone. I'm pretty sure it's not possible, but figured I'd ask anyway, or if anyone else had a potential solution, because I lost a lot of work -- but I have no one to blame but myself :(
|
b1c5f953b500635a0b2e9a70bdf1af86bcfe210605e21bbfe06a8ac27d0a88d5 | ['0cede606ad1e4dca863c538d33d54502'] | Finally i have succeeded by the below query which i have developed. Thanks for you all. If you want You can copy the below query and execute in SSMS.
begin tran
Create table #temp (userid int, username varchar(50), groupname varchar(50))
insert into #temp(userid , username , groupname)
select 1, '<PERSON>', 'GROUPLG'
union all
select 1, '<PERSON>', 'GROUPLS'
union all
select 1, '<PERSON>', 'GROUPNG'
<PERSON> all
select 1, '<PERSON>', 'GROUPNS'
<PERSON> all
select 2, '<PERSON>', 'HYDRSPMLG'
<PERSON> all
select 2, '<PERSON>', 'HYDRSPMLS'
<PERSON> all
select 3, '<PERSON>', 'AADSCLS'
<PERSON> all
select 4, '<PERSON>', 'RREDFTLS'
<PERSON> all
select 4, '<PERSON>', 'RREDFTNG'
<PERSON> all
select 5, '<PERSON>', '1234567'
<PERSON> all
select 5, '<PERSON>', 'ABCDESLS'
<PERSON> all
select 5, '<PERSON>', 'ABCDESLG'
<PERSON> all
select 6, '<PERSON>', 'GGGGRASCDW_RV'
<PERSON> all
select 6, '<PERSON>', 'CDW_RV'
<PERSON> all
select 6, '<PERSON>', 'GFNG'
<PERSON> all
select 6, '<PERSON>', 'GFNS'
union all
select 7, '<PERSON>', '184518451845'
select * from #temp
select tp.userid , tp.username, groupname + CASE WHEN tp.flag = 1 THEN CASE WHEN ct.cnt > 1 then ' (' else '' end +
ISNULL(pt.grouptype1,'')+case when grouptype2 is not null
and grouptype1 is not null then ',' else '' end +
ISNULL(pt.grouptype2,'')+case when grouptype3 is not null
and (grouptype1 is not null
or grouptype2 is not null ) then ',' else '' end +
ISNULL(pt.grouptype3,'')+case when grouptype4 is not null
and (grouptype1 is not null
or grouptype2 is not null
or grouptype3 is not null) then ',' else '' end +
ISNULL(pt.grouptype4,'') + case when ct.cnt > 1 then ')' else '' end
ELSE ''
END as Permission
from (SELECT distinct userid , username, CASE WHEN RIGHT(groupname,2) IN ('LG','LS','NG','NS') THEN Substring(groupname,1,len(groupname)-2)
ELSE groupname END as groupname ,
CASE WHEN RIGHT(groupname,2) IN ('LG','LS','NG','NS') THEN 1
ELSE 0 END as flag from #temp ) tp
--WHERE Substring(groupname,1,len(groupname)-2) IN ('LG','LS','NG','NS')
join (select userid , [LG] as grouptype1 , [LS] as grouptype2 , [NG] as grouptype3 ,
[NS] as grouptype4
FROM (SELECT userid , RIGHT(groupname,2) as grouptype FROM #temp) as Sourcetable
PIVOT (MAX(grouptype)
for grouptype in ([LG],[LS],[NG],[NS])) As Pivottable) pt
ON tp.userid = pt.userid
join (select userid, count(*) as cnt from #temp group by userid ) ct
on ct.userid = tp.userid
DROP TABLE #temp
-- Expected Output
-- 1 Sankar GROUP(LG,LS,NG,NS)
-- 2 Srini HYDRSPM(LG,LS)
-- 3 <PERSON> AADSCLS
-- 4 Arun RREDFT(LS,NG)
-- 5 Raja 1234567
-- 5 Raja ABCDESLG(LG,LS)
-- 6 dhilip GGGGRASCDW_RV
rollback
| d2dc6ef308310bb534c7e8e8c73f0e2a3c1122a0dfbe67c4a9a2daadefcc449d | ['0cede606ad1e4dca863c538d33d54502'] | In SSIS
In a folder there are many flat files and by using for each loop container we are processing it one by one. If any new file is placed in the folder and it is still in copying mode. Then, We should not take it for continue process. We should process Only fully copied file alone to our next process.
How can we achieve this? Please give your suggestions.
|
21c0488f5e63fbfb460c4f9b0aa2fd2d21b5b7cfe970ca1c409d9ad953cb786b | ['0cf96eb324a842ccb8fe0f0afb699efb'] | Did you instantiate the xmlHttp object.
var foo = "foo",
bar = "bar",
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "update.php?foo=" + foo + "&bar=" + bar, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
Alternately I would suggest using JQuery to get around the fact that IE and others use different object constructions.
$.get('/update.php', {foo:foo,bar:bar}, function(result) {
console.log(result);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
| e26e90f9a8c4f3a5f13f0bd87ee56d1210dd3387a8fd319acf819acb669c5257 | ['0cf96eb324a842ccb8fe0f0afb699efb'] | Well it looks like you need a client id in your code. You also need a redirect url. I'm not sure what is expected with that necessarily but I would try feeding it a random page for now because there doesn't seem to be anything special about their example page.
|
04cfbe65c65c893dd4d37ae14db5fed758b81032bacd16ede7149c3f48fde786 | ['0cff646c465f474db2755ee756fac594'] | I have deployed a new resource group and kubernetes cluster using the acs-engine to extract articles and release via these ARM templates in VSTS. The kubernetes cluster is created however when you ssh into the master docker-engine has not been installed. Running
`systemctl status kubelet`
shows that the service is dead and when you try to run it says the docker.service is dead. This cannot start because the docker engine is not there.
Reading package lists...
May 4 17:32:27 ubuntu cloud-init[2488]: W: GPG error:
https://apt.dockerproject.org/repo ubuntu-xenial InRelease: The
following signatures couldn't be verified because the public key is not
available: NO_PUBKEY F76221572C52609D
May 4 17:32:27 ubuntu cloud-init[2488]: W: The repository
'https://apt.dockerproject.org/repo ubuntu-xenial InRelease' is not
signed.
May 4 17:32:27 ubuntu cloud-init[2488]: Reading package lists...
May 4 17:32:27 ubuntu cloud-init[2488]: Building dependency tree...
May 4 17:32:27 ubuntu cloud-init[2488]: Reading state information...
May 4 17:32:27 ubuntu cloud-init[2488]: The following additional
packages will be installed:
May 4 17:32:27 ubuntu cloud-init[2488]: aufs-tools cgroupfs-mount
libltdl7
May 4 17:32:27 ubuntu cloud-init[2488]: Suggested packages:
May 4 17:32:27 ubuntu cloud-init[2488]: mountall
May 4 17:32:27 ubuntu cloud-init[2488]: The following NEW packages
will be installed:
May 4 17:32:27 ubuntu cloud-init[2488]: aufs-tools cgroupfs-mount
docker-engine libltdl7
May 4 17:32:27 ubuntu cloud-init[2488]: 0 upgraded, 4 newly installed,
0 to remove and 176 not upgraded.
May 4 17:32:27 ubuntu cloud-init[2488]: Need to get 19.4 MB/19.5 MB of
archives.
May 4 17:32:27 ubuntu cloud-init[2488]: After this operation, 102 MB
of additional disk space will be used.
May 4 17:32:27 ubuntu cloud-init[2488]: WARNING: The following
packages cannot be authenticated!
May 4 17:32:27 ubuntu cloud-init[2488]: docker-engine
May 4 17:32:27 ubuntu cloud-init[2488]: E: There were unauthenticated
packages and -y was used without --allow-unauthenticated
May 4 17:32:27 ubuntu cloud-init[2488]: Failed to restart
docker.service: Unit docker.service not found.
May 4 17:32:28 ubuntu cloud-init[2488]: usermod: group 'docker' does
not exist
When you try to run an
apt-get install docker-engine
it fails as you can see above.
Running
sudo apt-get install -y --allow-unauthenticated docker-engine
allow you to install the docker engine and start the kubelet service. You can then access the cluster from the master.
However, there is no .kube/config created so you cannot access this from an external source. I could create the .kube/config from the master and am investigating this now.
This needs to be fixed as I am automating environment deployment.
| 6d78884af8c81ba685398b13f09a3e17ede3987bf93e6e15c1d412813e0e64de | ['0cff646c465f474db2755ee756fac594'] | I have found service bus explorer a windows application which will allow me to connect to the Azure Service Bus and look at my topics and subscription and the messages on the subscriptions. I need to be able to do this from my mac as I am developing connectivity to the service bus and need to be able to look at the messages on the subscription to see why they are not being processed etc.
I would have thought that the az cli would be useful to do this but I cannot see any az service bus options as of yet. If anyone knows of a service bus explorer equivalent for the mac that would be greatly appreciative otherwise if anyone has any other ways of me be able to look at the actual message on the subscription that would be great.
|
4d7676095aa7fe761dc25e7890c0f323251e810a796e5b3ab31915f68b0bda8f | ['0d0cbe888dd64e33970e8fae9e9cc258'] | I created table like you have and test. <PERSON> had good idea but made few mistakes!
WITH max_id_with_note AS
(
SELECT MAX(ID) AS max_id
FROM fuel_table
WHERE Note <> ''
)
, previous_max_id_with_note AS
(
SELECT max(ID) as max_id
FROM fuel_table
WHERE Note <> ''
AND ID < (SELECT max_id FROM max_id_with_note)
)
SELECT SUM(Quantity)
FROM fuel_table
WHERE (SELECT max_id FROM previous_max_id_with_note)
< id and id <= (SELECT max_id FROM max_id_with_note)
| 6775d27f353e18d33b60effe6b887c49b6ed155ec9f656017495d180e5c5c15b | ['0d0cbe888dd64e33970e8fae9e9cc258'] | For first, it's bad idea to use JQuery and Angular inside one JS App.
Second, what .(); in the end of code in appRoute.js ?
Third, do you have code with call in appRoute.js (function () { ?
So try this code for appRoute.js
'use strict';
var app = angular.module('app', ['ngRoute']);
app.config(function ($routeProvider)
{
$routeProvider
.when('/create', {
templateUrl: '../create/create.php',
controller: 'CreateController'
})
.when('/posts', {
templateUrl: '../viewPost/view_post.php',
controller: 'ViewPostController'
}
)
.otherwise({
redirectTo: '/create'
})
});
app.controller('CreateController', function ($scope) {
});
app.controller('ViewPostController', function ($scope) {
});
|
16726a96f97f64c346c568c6ba6c0ce1e92a29873e87ea34caf0f723bb19fb06 | ['0d1f7177f3cd4008bdb503715153a608'] | In <PERSON>'s paper:
https://arxiv.org/pdf/<PHONE_NUMBER>.pdf
He writes "consider a density matrix ρ, written as a polynomial of the 2N Majoranas cj in such a way that each cj occurs to the power 0 or 1 in each term."
How exactly does one do this? Say for example that I was dealing with a very simple example, the Kitaev chain with just one fermion, and the Hamiltonian in terms of majorana operators $c_j$ looked like:
$H_0 = i c_1 c_2$.
And we define the fermion operators to be $a_n = (1/2)(c_{2n} + i c_{cn-1})$, $a_n^+ = (1/2)(c_{2n} - i c_{cn-1})$.
Then the ground state in terms of the original fermions is the site being unoccupied. Lets call this $ |0$>. How do I write the density matrix $|0$><$0|$ as a polynomial in c_1, c_2?
| 43ac336ff9b4ad6858fa21bea56d6a17c7b1377faa6d4844855c06dc6cc23a58 | ['0d1f7177f3cd4008bdb503715153a608'] | Не понял, зачем делить на 2? Если это о `having count(*) = 2`, то неверно поняли суть этой фильтрации, советую почитать о [having](http://www.postgresql.org/docs/current/static/sql-select.html#SQL-HAVING). В data на каждое значение интервала имеется от одной до 2-х записей. having count(*) = 2 выбрасывает значения с одной записью и выдает только с 2-мя, т.е. с данными по датчикам обоих типов (отгруз и расход). Для получения данных на каждую минуту просто уберите вычитаение единицы для нечетных, т.е. `- (extract('minutes' from f_time)<IP_ADDRESS>integer % 2) * '1 minute'<IP_ADDRESS>interval as tstamp ` |
a27dccb150be008e2291ea49ef47978eab97b5d8d5b339c40964d75e9cc301fa | ['0d20505864114e15b9c0081482273216'] | I'm trying to figure out the best approach to validate a date. I am constructing this date by using objects.
public Appointment(String description , AppointmentDate appointmentDate)
{
this.description = description;
this.appointmentDate = appointmentDate;
}
This is just a simple constructor which is using the information from appointmentDate to create an appointment.
public AppointmentDate(Date startTime,Date endTime,Date appDate){
this.startTime = startTime;
this.endTime = endTime;
this.appDate = appDate;
}
This is then the appointmentDate constructor which is passed in the parameter of the appointment constructor.
I am leaning towards the isLenient() method to check if the user input is a valid date but I'm curious that there could be an easier way of doing this
public void add(Appointment a)
{
try
{
a.setLenient(false);
appointmentCalender.add(a);
}
catch(Exception ex)
{
System.out.println("Invalid Date");
}
}
| a266a613c9841df869b40c65dd2c3df71cca40df08c41329e26bfb6f7b8ebc10 | ['0d20505864114e15b9c0081482273216'] | so I am stuck with this part. I am trying to change the initial calendar year from 2020 to 1965 so only people of the age of 55 or higher can sign up. I am confident that this change occurs in the HTML file, any advice ?
I also have the dates disabled from 1965 on wards so users cant sign up unless you're 55.
Here is part of my HTML code. Calendar in HTML file
<div>
<nz-form-label class="form-label"
[nzNoColon]="true">date of birth*</nz-form-label>
<nz-date-picker nzPlaceholder="Select a date"
nzFormat="dd/MM/yyyy"
[nzDisabledDate]="disabledDate"
formControlName="age"
></nz-date-picker>
</div>
|
818fcff3f1e473dc99f5c748b27fc7af76f2e2773c60f10fd1d2a6e12782ac25 | ['0d29e5b1b1bd4e3d8311e5ceace8b50c'] | I am working on toy problems to help me assimilate the idea of pattern matching in Mathematica. The following code does not behave as I expected, and I could not figure out what is wrong with my understanding of PatternTest.
MatchQ[{2, 1, 2, 5}, {x__?(FromDigits[{#}] > 3 &), y__}]
I expected this piece of code to check if the list {2,1,2,5} can be written as two consecutive (non-empty) sequences such that the integer we get from the first sequence is greater than 3. Since {Sequence[2,1],Sequence[2,5]} is one way to rewrite the list such that FromDigits[{2,1}] > 3 holds, I expected that code to return the value True. However, that is not the case.
What is wrong with my interpretation of the code?
| 665e6f9991ac751c727f1655eaf6efa951728e929ea4087c8496c7708df80e1e | ['0d29e5b1b1bd4e3d8311e5ceace8b50c'] | Exercise 42 from the second edition of How to Design Programs explains that DrRacket highlights the last two cond clauses in the code below because the test cases do not cover all possible cases.
; TrafficLight -> TrafficLight
; given state s, determine the next state of the traffic light
(check-expect (traffic-light-next "red") "green")
(define (traffic-light-next s)
(cond
[(string=? "red" s) "green"]
[(string=? "green" s) "yellow"]
[(string=? "yellow" s) "red"]))
My understanding is that an else clause at the end should cover the remaining cases, so I tried replacing the last expressions:
(define (traffic-light-next s)
(cond
[(string=? "red" s) "green"]
[(string=? "green" s) "yellow"]
[(string=? "yellow" s) "red"]
[else "green"]))
This does not solve the highlighting problem. What is going on here?
|
dc70af47c0bde131806aa13040759f722f61052739a1e9be853df3908d611bda | ['0d2d2ba726584f3da0abdf4221c131f2'] | Требования:
Программа не должна выводить текст на экран.
Программа не должна считывать значения с клавиатуры.
Метод createMap() должен создавать и возвращать словарь Map с типом элементов String, String состоящих из 10 записей по принципу «Фамилия» - «Имя».
Метод getCountTheSameFirstName() должен возвращать число людей у которых совпадает имя.
Метод getCountTheSameLastName() должен возвращать число людей у которых совпадает фамилия.
| 670601b7b311eea18e4cabf7e26831387d362afc6c80da43063b5b798c9255d5 | ['0d2d2ba726584f3da0abdf4221c131f2'] | This may be a duplicate qn, but i couldnt get a proper answer to this scenario. I have the following table structure:
public class File
{
public int FileId { get; set; } //PK
public int VersionID { get; set; }
public virtual ICollection<FileLocal> FileLLocalCollection { get; set; }
}
public class FileLocal
{
public int FileId { get; set; } //PK, FK
public int LangID { get; set; } //PK,FK
public string FileName { get; set; }
}
I have not included the third table here(Its basically LangID (PK) & LangCode )
How do i specify this mapping in fluent Api so that i can load "FileLLocalCollection" with every File objects?
|
d7cbe71479f3aab132dc9ada7553a49b9fcce1a6b649071fb8da4110ed369698 | ['0d31eb4e82b340ca95acfc6b99e2d290'] | The mobo is a Maximus Formula: https://www.asus.com/Motherboards/MAXIMUS_FORMULA/
My plan for this unit is to serve as an in home NAS as well as possibly an in home web server, haven't decided yet. I've heard good things of the mdadm. If I go that route, and decide I want to remove a drive to use it elsewhere, will I run into issues? | b63df9b2e4a46bc877ebe3b86c46259ce5e15832722e8f83f5b1b4bf0c7c5476 | ['0d31eb4e82b340ca95acfc6b99e2d290'] | Thank you for this. I had not thought to formulate the question in terms of non-isomorphic graphs on $n$ vertices, although it seems so obvious now. Of course, for $n\ge2$, this number is out by one from the figure I'm looking for because the empty graph is the same as the complete graph for my purposes. |
c2ed31fc489d4be3999d12a4ca6afaa1b772fbbde7303e4dc1fddcef667c1cb3 | ['0d483a19ba1943cfaf929f506698c567'] | Im using PrinterJob object in order to print my Bufferedimage, I have a BufferedImage which I proccess and send it to Printer job with Paper Format etc, and I cant make it fittable to my card printer. when i save it to my hard-disk and print via windows printing manager it printing very good on my card printer but with PrinterJob it came out too big and not fittable for a card
the size of the card is 86X54mm and the size of my buffered image is 1300x816px
The Code :
PrinterJob printjob = PrinterJob.getPrinterJob();
printjob.setJobName("CardPrint");
Printable printable = new Printable() {
public int print(Graphics pg, PageFormat pf, int pageNum) {
if (pageNum > 0) {
return Printable.NO_SUCH_PAGE;
}
JLayeredPane j1 = new JLayeredPane();
Dimension size = j1.getSize();
j1.print(bi.getGraphics());
Graphics2D g2 = (Graphics2D) pg;
g2.translate(pf.getImageableX(), pf.getImageableY());
g2.drawImage(bi, 0, 0, (int) pf.getWidth(), (int) pf.getHeight(), null);
return Printable.PAGE_EXISTS;
}
};
Paper paper = new Paper();
paper.setImageableArea(0, 0, 0, 0);
paper.setSize(1.15, 0.72);
PageFormat format = new PageFormat();
format.setPaper(paper);
printjob.setPrintable(printable, format);
try {
printjob.printDialog();
printjob.print();
} catch (Exception eee){
System.out.println("NO PAGE FOUND."+eee.toString());
}
I found out that
paper.setSize(1.15, 0.7);
is in inch (http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/print/Paper.html)
paper.setImageableArea(0, 0, 0, 0);
and i dont know about this setImageableArea.
does any one has clue about the current sizes, do i made a mistake calculating ?
thanks.
| 568bcf4f7f24f4353acedc356dbb4ee89e911431c1ddec461de033d69e6ff360 | ['0d483a19ba1943cfaf929f506698c567'] | I was looking for a way to rearrange several arguments recived as strings and one byte[] image and put them all togther as one image (jpg for example) ready to be printed (immidiatly).
example:
public static void printCard(String name, String LName, Image MainImage)
Basicly this function will be a simple card printer.
I was looking for an idea or some one who can guide me, this could be very easy if some one will guide me a bit.
|
3dea3500401cf4d2cd032c94fd10fa6bd6c87082a108b973eeac6e4c91d18eb2 | ['0d4969aa408a4c849caa46ff3b31e3ff'] | Its possible the fan is just running at the default speed for the power its getting if the bios has no setting for fan speed control? software issue?
seems their are many other people with your same issue
please refer here
the issue is still yet to be resolved with out having my hands on an B590 its hard for me to help you further. I think it most likely is a driver or bios issue.
| 64861a4ee64d3e7b6b889a2f8ad2cccd811e916aaa1f94facd97904eef9a83d7 | ['0d4969aa408a4c849caa46ff3b31e3ff'] | You would need a third party soulution as suggested in the comments. Their are a few like MultiMon and the best of which i think Display Fusion.
There are many settings in Display Fusion that you are talking about, unfortunately these settings are not available in Windows natively without some third party application.
Hope this helps,
MORBiD
|
25be2d083ecfa0fb837614595623813dadc9812803ba4823b384e8a904a938c3 | ['0d5110b7d8d6493d968592ba426f13e8'] | I had a 3 flowfiles which are coming from the same processor.
FF1 -> {a:1,b:2,c:'name'}
FF2 -> {a:1,b:5,c:'fruit'}
FF3 -> {a:2,b:3,c:'abc'}
By using MergeContent Processor I'm able to merge all the flow files, but my requirement is to merge flow files on Key.
Expected output if I join with Key 'a':
FF1 -> [{a:1,b:2,c:'name'},{a:1,b:5,c:'fruit'}]
FF2 -> [{a:2,b:3,c:'abc'}]
| b8c152f78af63ab3a20c2946dfd1dbc5ab75e84bd1e90c42c02f4c1f5c15ccbe | ['0d5110b7d8d6493d968592ba426f13e8'] | I'm trying to migrate mysql table data into cassandra using nifi. Attaching screenshot of what I have tried in nifi as I stuck at putCassandraQl command as it is throwing the error which is mentioned in attached screenshot. Please help me on this as i need to add more steps.
|
61610bd1357e896d0ab883da6a086a2b0dff3c9487f22403781c0acf316c7d4c | ['0d5bf4b292d844b7a5f0a57b54dc195b'] | I am dynamically creating a html table based on the JSON response from an ajax call as shown below. I want to associate clickable event with some rows which would allow me to do some post processing on those json objects. However, I am not able to pass the json object through the function call as it is not picking it up. Could you please help me here. If I pass a property of the json object, I am able to achieve this but I want the whole object to be passed.
$.get(url, { param: ID},
function(data){
$.each(data, function(index, product) {
$('<tr>').appendTo($body)
.append($('<td>').text(product.ID))
.append($('<td>').text(product.firstName))
.append($('<td>').text(product.lastName))
.append($('<td>').text(product.email))
.append($('<td>')
.append($('<a href=\"javascript:deleteProduct(' + product.ID + ');\">')
.append($('<img src=\"/images/delete.png\">'))))
.append($('<td>')
.append($('<a href=\"javascript:editProduct(' + product + ');\">')
.append($('<img src=\"/images/edit.png\">'))));
});
I am not able to invoke the editProduct(product) func call here however, deleteProduct(id) works.
Thanks.
| 02de79145a9a0c058fa277345c6513ddad6d2228c67aede265ea6524fee63da3 | ['0d5bf4b292d844b7a5f0a57b54dc195b'] | Thanks for the responses. Going by the requirements I had that I didn't wish to change my pojo class member variables, ibatis version that I was using wasn't working as expected. When I upgraded my version to 2.3.4 from 2.3.0 , the issue was resolved and same code worked seamlessly. I assume with this upgrade, they factored in the java beans convention of generating isActive() and setIsActive() accessors if property of type boolean primitive is defined as isActive. Thanks !
|
64e9a0e221235f8b7daa648616abd7556592b609426d6ecbbd8dfab70b2bda68 | ['0d68888045b341edb5fdb994827f83d3'] | You can use just focus-in instead of both focus-in and focus-out. So when you click on input focus-in event trigger and set _focused to true. Then, in action selectOpt you set value and after that set property _focused to false.
<div class="dropdown">
{{input value=value class='form-control' focus-in='focused' }}
{{#if _focused}}
<ul class='dropdown-menu'>
{{#each options as |opt|}}
<li>
<a href="#" {{action "selectOpt" opt}}>{{opt}}</a>
</li>
{{/each}}
</ul>
{{/if}}
input-autocomplete.js
actions: {
focused() {
this.set('_focused', true);
},
selectOpt(opt) {
console.log(opt);
this.set('value', opt);
this.set('_focused', false);
}
}
I didn't include all code for input-autocomplete it's the same as before exxept actions. Also I used options array insted your filter because didn't get any results when clicked on input.
| 41344d21179f7b74818d372f7861e0488814c477d38ad2294f7c9e8e8d88de9e | ['0d68888045b341edb5fdb994827f83d3'] | Well it's not cross browser compatible. -webkit-appearance and -moz-appearance are not standard and should not be used, also they behave differently in different browsers.
My suggestion is to use combination of input and label, where you will hide checkbox input and use background images for checkbox. Also be sure not to hide input with display:none because of accessibility.
Example: https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Advanced_styling_for_HTML_forms
|
35f6350afcdc7ef6d23a51d64c87f864b7d7c3224d701c55b259af37d7919488 | ['0d754184abbe410fb56f6dddeb94c66e'] | This is similar to what I have just done for my project. I prefer to write some common methods in order to reuse it in other places.
package com.practice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
public class XMLHelper {
public static void main(String[] args) {
parseContext();
}
public static Document createDocumentFromFile() {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document document = null;
try {
dbf.setValidating(false);
DocumentBuilder db = dbf.newDocumentBuilder();
document = db.parse("xmltest.txt");
} catch (Exception e) {
e.printStackTrace();
}
return document;
}
public static Element converDocumentToElement(Document document) {
Element rootElement = null;
if (document != null) {
document.getDocumentElement().normalize();
rootElement = document.getDocumentElement();
}
return rootElement;
}
public static List<Element> getElementsByName(Element elem, String name) {
List<Element> elements = null;
if (elem == null) return elements;
NodeList nodeList = elem.getElementsByTagName(name);
if (nodeList == null || nodeList.getLength() == 0) return elements;
elements = new ArrayList<Element>();
for (int i=0; i<nodeList.getLength(); i++) {
Element element = (Element) nodeList.item(i);
elements.add(element);
}
return elements;
}
public static void parseContext() {
Document document = createDocumentFromFile();
Element rootElement = converDocumentToElement(document);
List<Element> outsideConElements = getElementsByName(rootElement, "con");
if (outsideConElements == null) {
System.out.println("no <con> is found!");
} else {
for (Element outsideConElement : outsideConElements) {
List<Element> insideConElements = getElementsByName(outsideConElement, "con");
if (insideConElements != null && !insideConElements.isEmpty()) {
Element insideConElement = insideConElements.get(0);
if (insideConElement != null)
System.out.println(insideConElement.getAttribute("idref"));
}
}
}
}
}
| 037c2b1c3744bafc3cb02994d9932b352ace6560d22e7cd360c758ae03acb9df | ['0d754184abbe410fb56f6dddeb94c66e'] | I made it look a little more alike bootstrap style this way:
<md-input-container class="md-block">
<label for="discount">Discount</label>
<input style="text-align: right; padding-right: 15px;" type="text" id="discount" ng-model="discount" ng-change="updateDiscount()">
<span style="margin-top: 5px; position: absolute; right: 0;">%</span>
</md-input-container>
Screenshot for your review:
|
a7e0ea658916556993a105cfdabbe657b903c645d36330015fcb56e18166b2c8 | ['0d8058ddd307445f84a0c5025993d8d0'] | I think ModuleID that you mention relates to dependency management, not sub projects.
For taking sub project setting/task keys project scope can be used:
(generate in A).value
(generate in B).value
More comprehensive example:
name := "A"
version := "1.0"
scalaVersion := "2.12.5"
val generate = TaskKey[String]("generate")
val myBuild = TaskKey[String]("myBuild")
val a = (project in file(".")).settings(Seq(
generate := "A_generate"
))
val b = (project in file("proj_b")).settings(Seq(
generate := "B_generate",
myBuild := (generate in a).value + "_" + generate.value
)).dependsOn(a)
Sbt console output:
sbt:A> show b/myBuild
[info] A_generate_B_generate
| 542f4c7e7c8b6d92997a5009a42a38aad4da776932ebd0226af473dfb69db588 | ['0d8058ddd307445f84a0c5025993d8d0'] | You need to define your own MergeStrategy(in project directory) that will rename files to application.conf and then redefine assemblyMergeStrategy in assembly to discard original application.conf and apply MyMergeStrategy to assembly.conf:
import java.io.File
import sbtassembly.MergeStrategy
class MyMergeStrategy extends MergeStrategy{
override def name: String = "Rename to application.conf"
override def apply(tempDir: File, path: String, files: Seq[File]): Either[String, Seq[(File, String)]] = {
Right(files.map(_ -> "application.conf"))
}
}
And then use in build.sbt:
val root = (project in file(".")).settings(Seq(
assemblyMergeStrategy in assembly := {
case PathList("application.conf") => MergeStrategy.discard
case PathList("assembly.conf") => new MyMergeStrategy()
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
))
This will do just for your case but for more complicated cases I would read how they do it in sbt-native-packager:
https://www.scala-sbt.org/sbt-native-packager/recipes/package_configuration.html
|
9629960d4f05d86f86f4422562fa79e3ca5d2c2893a14f7ec4e69527918e7357 | ['0d8357d6390d4b7c9d4e1cd122bb66c2'] | basic HTTP Authentication, HTTP Authentication with PHP, php requires and includes, secure login script php, user authentication php, php simple login script, login authentication with sql and php.
Here's a few helpful sites:
http://www.developerdrive.com/2013/05/adding-a-simple-authentication-using-php-require-and-includes/
http://php.net/manual/en/features.http-auth.php
http://blackbe.lt/php-secure-sessions/
http://docstore.mik.ua/orelly/webprog/pcook/ch08_10.htm
| 3895586899c3322f12e95524c29c2025027f7649cf06e97eee73740065c19161 | ['0d8357d6390d4b7c9d4e1cd122bb66c2'] | If you mean that you have an HTML file stored on your computer, the only way that you can compile it is with your browser. Just enter the absolute file path in your browser's url input. If I misunderstood your question, leave a comment and I'll correct my answer.
|
099c24637972829521de3388d042222fb8319c2f3fa5300e84c089fdd7e590af | ['0d9b9295d94942bfafca002e76830485'] | I am working on a predictive modeling exercise using a categorical output (pass/fail: binary 1 or 0) and about 200 features. I have about 350K training examples for this, but I can increase the size of my dataset if needed. Here are a few issues that I running into:
1- I am dealing with severely imbalanced classes. Out of those 350K examples, only 2K are labelled as “fail” (i.e. categorical output = 1). How do I account for this? I know there are several techniques, such as up-sampling with bootstrap;
2- Most of my features (~ 95%) are categorical (e.g. city, language, etc.) with less than 5-6 levels each. Do I need to transform them into binary data for each level of a feature? For instance if the feature “city” has 3 levels with New York, Paris, and Barcelona, then I can transform it into 3 binary features: city_New_york, city_Paris, and city_Barcelona;
3 - Picking the model itself: I am thinking about a few such as SVM, K-neighbors, Decision tree, Random Forest, Logistic Regression, but my guess is that Random Forest will be appropriate for this because of the large number of categorical features. Any suggestions there?
4 - If I use Random Forest, do I need to (a) do feature scaling for the continuous variables (I am guessing not), (b) change my continuous variables to binary, as explained in question 2 above (I am guessing not), (c) account for my severe imbalanced classes, (d) remove missing values.
Thanks in advance for your answers!
| 9b37f22b0430d95d27168e2f499708c3c2855e63392f4c135dffea6bf12267c6 | ['0d9b9295d94942bfafca002e76830485'] | My function outputs a list, for instance when I type:
My_function('TV', 'TV_Screen')
it outputs the following:
['TV', 1, 'TV_Screen', 0.04, 'True']
Now, my TV is made of several parts, such as speaker, transformer, etc., I can keep running my function for each part, and for instance change 'TV_Screen' for 'TV_Speaker', or 'TV_transformer', etc.
The alternative is to create a list with all the part, such as:
TV_parts = ['TV_Screen', 'TV_Speaker', 'TV_transformer']
What I am trying to get is a pandas data frame with 5 columns (because my function outputs 5 variables, see above the section "it outputs the following:") and in this case 3 rows (one of each for 'TV_Screen', 'TV_Speaker', and 'TV_transformer'). Basically, I want the following to be in a data frame:
['TV', 1, 'TV_Screen', 0.04, 'True']
['TV', 9, 'TV_Speaker', 0.56, 'True']
['TV', 3, 'TV_transformer', 0.80, 'False']
I know I need a for loop somewhere, but I am not sure how to create this data frame. Could you please help? (I can change the output of my function to be a pd.Series or something else that would work better).
Thanks!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.