INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Function bound to a key in Fish shell requires me to press enter, how to avoid that?
I have the following fish shell function
# gohome.fish
function gohome
cd ~
end
When I bind it with `bind \eg gohome` and press Alt+G I still have to press enter to invoke it. Is it possible to execute gohome immediately upon pressing Alt+G?
|
> When I bind it with bind \eg gohome and press Alt+G I still have to press enter to invoke it.
You don't. The function is executed as soon as you press the key.
What happens is that your prompt isn't repainted to update the current directory, and pressing enter triggers that.
Do `commandline -f repaint` either in
bind \eg 'gohome; commandline -f repaint'
or in the function.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "fish"
}
|
What does "回る" mean in this sentence?
>
Quoted from an NHK news article, which might not be accessible weeks after being published.
Or to put my question in another way, how do I translate "" into English properly?
I did some searching of the word "" in Japanese dictionaries, but there are so many meanings/usages for different cases that I am not sure which one is applicable in the aforementioned sentence.
|
I think it's definition 7 from (highlighting mine)
> **** ――
That is to say that the did not originally approve of the referendum. But because their position **changed** to approving the referendum, there are now enough votes in the to do the referendum.
|
stackexchange-japanese
|
{
"answer_score": 5,
"question_score": 4,
"tags": "translation, meaning, words"
}
|
Is it possible to test app on the device without developer program? [Xcode 9.4 - Code Signing Error]
I don't register 'Apple Developer Program', but I want to test the iOS application on my devices.
Is it possible to test the iOS app on my device without registering 'developer program'?
I tried to build the app on my device, but 'code signing error' occurs.

|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "xcode, xcode9.4"
}
|
Eclipse keeps crashing after installation of JBoss
Since installing JBoss eclipse keeps crashing when developing a new project. This is the information I get when it crashes. I have increased the memory available to it also but it doesn't seem to have made any difference, anyone got any ideas?? thanks. !eclipse_crash_image
|
I would assume a problem with memory allocation.
First, it's strange having memory setting twice in the eclipse configuration (you have the switches -Xms and -Xmx two times). Second, -Xms2048m and -Xmx3548m seems really too much. I never used so much memory. Additionally, you might try to increase the perm size to 256m. Give it a try.
In your eclipse.ini file, you have a line with "--launcher.XXMaxPermSize". Directly beneath that, you type in the max perm size. That way, you do not need a swith with "-XX:MaxPermSize" in the vmargs section.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "java, eclipse, jboss, crash"
}
|
Open files using For-loop (Python 3)
Sorry I'm new to Python 3 and I already kept looking for an answer here in SO but I can't find the specific answer to my question rather I may not asking the right question.
I have a file named test5.txt where I have written the file names of the files that I want to open/read using Python namely, (test2.txt, test3.txt and test4.txt) these txt documents have random words on it.
Here is my code:
with open("test5.txt") as x:
my_file = x.readlines()
for each_record in my_file:
with open(each_record) as y:
read_files = y.read()
print(read_files)
But sadly I'm getting error: `"OSError: [Errno 22] Invalid argument: 'test2.txt\n'"`
|
It seems like `each_record` contains a newline `\n` character. You can try to strip the filename string before open it as a file.
with open("test5.txt") as x:
my_file = x.readlines()
for each_record in my_file:
with open(each_record.strip()) as y:
read_files = y.read()
print(read_files)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python, python 3.x"
}
|
MongoDB group by values in an array field
I have my asset documents in the below format.
db.asset.find({}).limit(1).pretty()
{
"_id" : ObjectId("54e650a10364a65f62c0df4a"),
"_class" : "com.model.core.Asset",
"displayName" : "Bingo Rhymes For Children + More 3D Animation Nursery Rhymes & Kids' Songs",
"assetType" : "VIDEO",
"active" : true,
"originalUrl" : "
"groupIds" : [ ],
"folderIds" : [
"54e6507b0364a65f62c0df47",
"54e6507b0364a65f62c0df48"
]
}
As you can see each asset can have a collection of folderId to which it is associated with. If I want to find the folderIds along with the associated assets how does the mongo aggregate query will look like? Essentially I want to group the assets by folderId.
|
You first need to unwind by the `folderIds` field, than group by `_id` and push the asset `_id` into a list `assets_id`.
db.asset.aggregate([{$unwind:"$folderIds"}, {$group:{_id: "$folderIds",assets:{$push: {assets_id:"$_id"}}}}])
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 5,
"tags": "mongodb, aggregation framework"
}
|
join two tables when one has null values
!enter image description here
I want to list employees along with their jobs from job tables(use job_id key) but some employees have null as their job id and when i use join null values dont show up. i want the employees with no job ids to have null as their job designation. how do i do it?
Here is what i have tried
select EMP_ID,MANAGER_EMP_ID,FNAME||' '||LNAME as EMP_FULL_NAME,
HIRE_DATE as EMP_JOINING,salary as EMP_SALARY,function as
EMP_DESIGNATION from employee e join job j on e.job_id=j.job_id
|
just change `join` to `left join`...
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 1,
"tags": "sql, oracle, join, null"
}
|
DynamoDB scan table with filter expression
I'm trying to scan a table and return all entries which match my filter expression. I've got an API Gateway which accepts a GET-Request that contains a starting time and a end time. (Format: [dd.mm.yyyy hh:mm:ss] The database im scanning has an attribute called "timestamp" in the same format. I've tried it with the filter
Timestamp BETWEEN :date1 and :date2
date1 and date2 represent the starting and ending time from the API. Timestamp is the field in my Database. Unfortunately the scan doesnt return any values.
Thanks a lot.
|
Your date format has to be in ISO 8601 string format for you to be able to scan on it. You can see this in the documentation here, under the "String" category.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "javascript, amazon web services, amazon dynamodb"
}
|
How can i generate domain model diagrams, and documentation
I imported my project files into Enterprise Architect, under the Domain Model section. The program imported the files correctly, but it did not create domain model diagrams, so i can generate documentation about it, but it is empty.
If i imported the project files under the Class model section, class diagrams creates, and i able to generate documentation correctly. But i need the Domain Model.
So, how can i generate domain model diagrams, and a correct documentation with them?
|
There's no point in having EA generate diagrams for you (although that is possible as well). The only thing that will do is create huge, unreadable "wallpaper" diagrams.
You better create the diagrams yourself.
Just add a diagram in a package and start dropping classes onto it.
Once you have usable diagrams you can generate your documentation.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "import, documentation, enterprise architect, domain model, generated"
}
|
Is there a graphical tool for Mac to assist in positioning CCNode objects on a Layer?
If my designer gives me a 960x640px image of what the screen should look like, as well as all of the individual elements as images or text, is there a way to lay out the images and text on the iPhone/iPad screen without doing it manually through code? The way I'm doing it now is a series of trial and error, trying to guess the position of each element.
By the way, the types of layouts I'm trying to do are simple static layouts for stuff like Menus and High Scores lists, etc.
|
You should try one of the editing tools: LevelHelper, CocoShop and CocosBuilder. The problem will be the output format, make sure that not only the editing part works to your specification but that you can actually use just the snippet of code you need to plug it into your code.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 4,
"tags": "ios, cocos2d iphone"
}
|
Apply opacity to a SVG
There are the fill-opacity and stroke-opacity properties but both transparencies overlap and thus the opacity of my stroke is more important. How delete this overlap (with different opacity)?
mysvg
.attr('fill', 'rgba(150, 150, 150, 0.3)')
.attr('stroke-width', '30px')
.attr('stroke', 'rgba(150, 150, 150, 0.6)');
I haven't 10 reputation... See the result here
|
There are a few ways to do what I _think_ you want. The easiest is to just draw two shapes - a solid shape shrunk by the stroke width, and then a zero-fill shape with the stroke on top.
However, since you're using the same color for both, it's easy to use a filter to get what you want.
<filter id="opacityceiling">
<feComponentTransfer>
<feFuncA type="discrete" tableValues="0.3 0.6"/>
</feComponentTransfer>
</filter>
This clamps any opacity between 0 and .5 to 0.3, and any opacity between 0.5 and 1.0 to 0.6. A more general way for different colors would be to use an feFlood and an feComposite.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "svg, opacity"
}
|
Create HTML table from JSON array
I've been trying for hours to create a simple table with data from a JSON array.
Below is an example. I don't know why this code doesn't work. The error is:
> "Trying to get property of non-object".
$json_string = file_get_contents("
$array = json_decode($json_string);
?>
<table><tr><th>
<?php foreach($array as $o): ?>
<tr>
<td><?php $o->result->TimeStamp ?></td>
</tr>
<?php endforeach; ?>
</table>
Please look at the URL for json_string for formating.
|
Alternatively, you could add a second parameter to `json_decode($json_string, true)` to make it an array instead of an object. Consider this example:
<?php
$json_string = file_get_contents("
$array = json_decode($json_string, true);
?>
<table border="1" cellpadding="10">
<thead><tr><th>Timestamp</th></tr></thead>
<tbody>
<?php foreach($array['result'] as $key => $value): ?>
<tr>
<td><?php echo $value['TimeStamp']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "php, html, json, html table"
}
|
Can object detection api do video analysis
I am looking for a video analysis tool. I would like to know can tensorflow object detection API tell me how many T-shirts appear in a movie? If not, what tool can do it?
Thanks
|
Videos are a just a sequence of images. You can use a number of libraries to extract the individual frames: OpenCV, FFMPEG (command line), and others. Note that Tensorflow itself doesn't provide an object detection API, I think what you mean to say is to use an Object Detection API that was built using Tensorflow. Most of those APIs will be expecting one, or a batch, of images and it will be up to you to extract the frames, run them through, and rebuild the video at the end.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "tensorflow"
}
|
exit from a do while when a key is pressed (c#)
I'm making a code where a series of characters are shown on the display. And I want that when a key is pressed (Any key) the program exits from the do while.
do{
Console.SetCursorPosition(Console.WindowWidth/2-2,3);
switch(fotograma++%4)
{
case 0 :
Console.Write("|");
break;
case 1 :
Console.Write("/");
break;
case 2 :
Console.Write("-");
break;
case 3 :
Console.Write("\\");
break;
}
System.Threading.Thread.Sleep(50);
}while(true);
|
I believe you can use Console.KeyAvailable.aspx) to handle this scenario. To make it work, change your while loop to look like this:
do{
Console.SetCursorPosition(Console.WindowWidth/2-2,3);
switch(fotograma++%4)
{
case 0 :
Console.Write("|");
break;
case 1 :
Console.Write("/");
break;
case 2 :
Console.Write("-");
break;
case 3 :
Console.Write("\\");
break;
}
System.Threading.Thread.Sleep(50);
}while(!Console.KeyAvailable);
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "c#"
}
|
How do I create a new txt file from another file which is a list?
I'm trying to create a second config file from a file with a list of domains.
File1 (file1.txt) contents
example.com
example.org
example.net
.
.
.
I want to automatically create this second file (file2.txt) with the contents like this.
blahblahblah /something/example.com /something/exmaple.org /something/example.net......
Seems simple enough but I can't figure it out. I'm able to make a list of domains (file1.txt) and I just need to create this second file which I'll be using as part of a config file.
|
With sed
sed -n '
s,^,/something/,
1s/^/blahblahblah /
H
${g;s/\n/ /gp}
' file1.txt > file2.txt
with bash
( printf "blahblahblah"
mapfile -t lines < file1.txt
printf " /something/%s" "${lines[@]}"
echo
) > file2.txt
or
{ printf "blahblahblah"
while IFS= read -r line; do printf " /something/%s" "$line"; done < file1.txt
echo
} > file2.txt
|
stackexchange-unix
|
{
"answer_score": 0,
"question_score": -2,
"tags": "sed, cat"
}
|
Is it possible for PayPal IPN POST to be sometimes missing the "payment_status" field?
The subject. When tested manually, the payment_status field was always present in the request. But there are a few entries in the log which indicate that, after
payment_status = request.form.get('payment_status')
payment_status was None.
Is such an occurrance possible - or am I missing something?
|
After re-reading the docs, I see that this field is not mandatory for all transaction types.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python, paypal, flask, paypal ipn"
}
|
How to make a button scroll down page in HTML?
Couldn't find a tutorial for this anywhere or just didn't use the right keywords. I'm making a one-paged website, and I'd like the navigation bar buttons to scroll the page up/down to the right part. Would this be possible in just HTML and CSS?
I'm not so experienced with JavaScript.
Similar to ''Scroll to the top'' but that I could decide to where it scrolls the page, like middle, top, bottom etc. .
|
**Update:** There is now a better way to use this, using the HTML `id` attribute:
Set the destination id: `<h1 id="section1">Section 1</h1>`
And create a link to that destination using the anchor tag: `<a href="#section1">Go to section 1</a>`
The benefit of this new method is that the `id` attribute can be set on any HTML element. You don't have to wrap superfluous anchor tags around destination links anymore!
**Original answer:**
You can look at using the HTML anchor tag.
`<a name="section1">Section 1</a>`
alongside
`<a href="#section1">Go to section 1</a>`
When the user clicks on "Go to section 1", they will be sent to the section of the page where the "Section 1" text is displayed.
|
stackexchange-stackoverflow
|
{
"answer_score": 15,
"question_score": 15,
"tags": "javascript, html, css, scroll"
}
|
Get an event hook to Console.WriteLine
In a c# console application, is there a way to get a notification whenever text is written to the console via `Console.WriteLine` and `Console.Write`?
Whenever this event fires, it should be possible to do things like change the text before it is written, redirect it to a file, or change the current Console.ForegroundColor.
I know that a simple way to accomplish this is to never call `Console.WriteLine` directly, but instead always call my own custom wrapper method.
Another even better approach is to write a custom `ConsoleTraceListener`, and output all text via `trace.TraceInformation()`. I have done that and it works just fine.
However this does not work if the Console.WriteLine call is inside another assembly which should remain unchanged.
So is there any way to react to `Console.WriteLine` calls without modifying the code that makes those calls?
|
You can use Console.SetOut to set a custom Writer class. In this class you can make your own write function.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 5,
"tags": "c#, windows, console, console.writeline, tracelistener"
}
|
jquery date range datepicker format
I am having trouble figuring out how to set the format for the date range. I am new to jquery and I learned how to set the single datepicker, I am just having trouble with the date range. Here is the function
$(function() {
var dates = $( "#from, #to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
|
Here's my setup function for the datapicker - I found that it was hard work setting dates that were a long way from the current date but the control allows you to turn both the month and year into dropdowns so it's much easier to select a wide range of dates. You can set the forward and backward range of the year combo with the yearRange parameter.
$(document).ready(function () {
Date.format = 'dd/mm/yyyy';
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: '-90:+5'
});
});
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "jquery, uidatepicker"
}
|
Можно ли сделать исполняемый файл приложения, написанного на java с расширением не jar, а exe?
Я создал приложение на языке java, но проблема в том, что после создания исполняемого jar файла, я могу его запустить только со специальным программным обеспечением, соответственно если кто-то попытается его запустить с другого компьютера, у него ничего не выйдет. Как сделать исполняемый файл с расширением exe?
|
Для того, чтобы преобразовать jar в exe, нужно скачать Launch4j, установить путь к начальному файлу и конечному результату (с нужным расширением) ;
popover.css('top', event.pageY+ 'px')
On the right extremes the popover disappers (I have removed the text wrap and scroll for page). I thought setting the `right` instead of `left` would fix this problem on the right edges alone.
popover.css('right', event.pageX + 'px');
popover.css('top', event.pageY+ 'px');
But this is not working. Can anyone help with it. If my idea is wrong, is there any better way to do that?
|
When setting position of `left` just make sure you do not exceed page limits.
popover.css({
left: event.pageX + popover.outerWidth() + 10 < $(window).width()
? event.pageX
: $(window).width() - popover.outerWidth() - 10
});
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, twitter bootstrap, css, popover"
}
|
Let $x'=x \ln(1+x^2)$ with $x(0)=1$. why the maximal solutions are defined in whole line?
Let $x'=x \ln(1+x^2)$ with $x(0)=1$. Why the maximal solutions are defined in whole line?
**Comment:** Any idea is welcome. The existence theorem guarantees the solution, however why is it defined in $\mathbb{R}$? The function seems to be monotone increasing and positive.
|
Here's a hint: The solution is given implicitly by $$ \int_1^{x(t)} \frac{dx}{x \ln(1+x^2)} = t . $$ Can you show that $\int_1^0 (\cdots) = -\infty$ and $\int_1^\infty (\cdots) = +\infty$?
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 1,
"tags": "ordinary differential equations"
}
|
IOS 13 Dark Mode Accent Colour
In macOS 10.14 the user can select between light and dark mode and can also select from a choice of 8 accent/highlight colours.
In IOS 13 the user can select between light and dark mode but the accent/highlight colour is either mode appears to me to be fixed to blue (or at least I haven't so far worked out how to change it).
Does anyone know if the accent/highlight colour on IOS is likely to change in the future to a user choice as in macOS, because I would like to be able to use this colour in my app.
Is the (currently fixed blue) accent/highlight colour for IOS 13 accessible and is so how do I get access to it as a colour, from Objective C?
|
The blue you are seeing is iOS' default `tintColor`. You can set that on a view basis or, if you want to override it app-wide, set it on your `UIWindow`. If a view doesn't have a `tintColor` explicitly set, it uses the `tintColor` of its superview—all the way up to the window.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "ios darkmode"
}
|
System Settings > Keyboard > Shortcuts [ <fn> shortcut not working ]
I am currently using elementary OS 0.4 Loki (64-bit) and I accidentally changed volume down (default: _< fn>F12_). Now I can't change it back. Then I noticed that all shortcuts with _< fn>_ are set/lebeled with which is not true. All other shortcuts are working fine.
Now the question is how to reset it or change it back.
Thanks a lot.
|
You need **xbindkeys** and **dconf-editor**. Here's your solution.
|
stackexchange-elementaryos
|
{
"answer_score": 0,
"question_score": 1,
"tags": "release loki, settings, keyboard shortcuts"
}
|
How to remove an event listener via Chrome extension
I need to remove the following event listeners with my Chrome extension, after the page loaded.
Page content:
<input type="password" size="15" value="" autocomplete="off"
onkeyup="javascript:vaciar(this)"
onkeypress="javascript:vaciar(this)"
onkeydown="javascript:vaciar(this)" name="password"
id="contrasena" />
The code in my content script is:
var password_field = document.getElementById("contrasena");
password_field.removeAttribute("onkeypress");
password_field.removeAttribute("onkeydown");
password_field.removeAttribute("onkeyup");
password_field.onkeypress = null;
password_field.onkeydown = null;
password_field.onkeyup = null;
For some reason, the event listeners keep active, but when I copy and execute the code in the console it works.
|
This fails because of the isolated context that context scripts live in.
To affect handlers set by the page's context, you need to inject the above code into the page.
See this question for a canonical explanation and examples.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "javascript, google chrome extension"
}
|
Number of NOPS for a branch instruction in MIPS
We recently discussed NOPs in our circuits class when talking about single cycle and pipeline processors. If we have the following code:
add $t1, $t2, $t3
sub $t4, $t1, $t0
There is a data hazard because of the `$t1`. In a pipeline processor, with out a data hazard detection unit, before the updated value of `$t1` is written back into the register, the sub instruction uses the old value - thus a data hazard. If we add 2 NOPS then we can solve this issue or, if there is a data hazard detection unit, we can forward the result fo `$t1` after the execution phase.
However what if we have a branch instruction? For example:
add $t1, $t2, $t3
beq $t0, $t1, Label
Do we also add 2 NOPS here, if we can't use forwarding?
|
In the standard pipelined MIPS processor without branch prediction, the equality test of the `beq` is performed in the ALU, i.e. in the EX stage -- which means that it is subject to the same ALU -> ALU hazard and the same bypass would mitigate that hazard.
(This speaks nothing to stalls for pipeline refill that might happen after the branch instruction, from taken or mispredicted branches, but just to the delay for the data dependency you're showing.)
In the case of a theoretical processor that was pipelined but did not have hazard protection (of bypass or delays), the same 2 nops would be required as for your first scenario.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "assembly, process, mips, cpu architecture"
}
|
Can you transitition from a semantic symbol back to a syntax tree node using Roslyn?
If I have a semantic symbol lets say a parameter coming in to a method, Can I some how go back to the syntax node of this symbol?
In the below code lets say I have a handle on the "param" Identifier in the syntax tree from the `param = "TEST"`, I swap over to the semantic model to determine the OriginalDefinition of param which takes me to the `string param` in the method declaration. I now want to swap back to the syntax tree and goto the original definition node.
I was able to do this with what I would consider a hack `var token = tree.Root.FindToken(origNode.Locations[0].SourceSpan.Start).Parent;`
Is there a better way to do this? Perhaps something similar to the `GetSemanticInfo()` but for the Syntax tree?
private void DoSomething(string param)
{
param = "TEST";
}
|
There isn't anything better in the current CTP, but this is feedback that we have heard, and we have a plan to address it in the future.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 5,
"tags": ".net, roslyn"
}
|
How are a Tesla's batteries charged below 0degC
According to this link, charging a lithium ion battery below freezing temperature can damage it. How does Tesla manage this problem? I assume they have a solution since they sell their cars in countries that experience severe winters.
|
When a Model 3 battery is cold, a snowflake icon will appear on the console, and the Tesla will disable regenerative charging on downhills and when braking (etc.).
If you navigate a Model 3 to a Tesla Supercharger, it uses the distance from the Supercharger to know to warm up the battery en route, before it gets there. This preheating may take up to 45 minutes or more. See Tesla's official Winter "Charging Tips" here: <
When plugged in (at home at night, etc.), it seems to draw power from the outlet to keep the car warm before scheduled charging or scheduled departures.
|
stackexchange-electronics
|
{
"answer_score": 1,
"question_score": 0,
"tags": "batteries, battery charging, lithium ion"
}
|
Is it possible to create Form Components programmatically in Install4j 7
I am trying to create a form that requires quite a large amount of components but I do not want to create them all manually. Is there a way to create these components using a Form's Pre-activation script or some other script?
|
As of install4j 7, form components have to be configured statically in the IDE, there is no way to create them at runtime.
You can develop your own form component with the API that exiibits dynamic behavior, see the `samples/customCode` project for an example on how to get started.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "install4j"
}
|
Windows 7 add network printer with .vbs scrpits
I want to add a network printer with the vbs scripts from the directory C:\Windows\System32\Printing_Admin_Scripts.
The first line works:
cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_192.168.55.110 -h 192.168.55.110 -o raw -n 9100
but the next line:
cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m "Xerox GPD PCL6 V4.1.585.13.0" -i .\driver\x3UNIVX.inf -h .\driver
throws an error: Cannot add printer. Xerox GPD PCL6 V4.1.585.13.0. Win32-Errorcode 87.
What do I wrong? Is there a better solution do add a printer and install the driver with cmd or VB scripts.
|
The path must be in quotes and you need double backslashs.
cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m "Xerox GPD PCL6 V4.1.585.13.0" -i "driver'\x3UNIVX.inf" -h "driver\\"
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "windows, printing"
}
|
Netbeans doesn't start
Hi everyone I just downloaded Netbeans IDE from the appcenter and it doesn't open. The start up screen shows up as if it was trying to load and then it shuts itself up. Anyone who might know why?
When I open it on the console it shows the next message
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:/usr/share/netbeans/platform18/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
|
There's a known problem between Netbeans version and the JDK version
<
<
* * *
## Solution
Just **remove** Netbeans (and keep reading to install it)
`sudo apt autoremove netbeans`
* * *
## Installing Netbeans the Flatpak Way (current version 9.0)
**Add** the Oficial PPA repo (1)
`sudo add-apt-repository ppa:alexlarsson/flatpak`
**Update**
`sudo apt update`
**Install** Flatpak
`sudo apt install flatpak`
**Add** flathub repo to flatpak
`sudo flatpak remote-add --if-not-exists flathub
**Install** Netbeans
`sudo flatpak install flathub org.apache.netbeans`
To **run** Netbeans use the command:
`flatpak run org.apache.netbeans`
or use the icon in the menu
ref: <
<
* * *
## Notes
(1): If you get command not found on `add-apt-repository`
**Install** : `sudo apt install software-properties-common`
* * *
## Flatpak Q&A
<
|
stackexchange-elementaryos
|
{
"answer_score": 0,
"question_score": 0,
"tags": "release juno, appcenter"
}
|
JQuery UI Datepicker as multiple date display
I've used the JQuery UI DatePicker in the past and am pretty happy with it. I'm looking for a way to display to the user multiple dates into the future. I don't want the user to be able to choose the dates, I just want to make them fixed them at runtime.
Is there any easy way to make this possible?
|
You can do that with the `beforeShowDay` event.
// list of dates to highlight
var dates = [
[2011, 8, 1],
[2011, 8, 9],
[2011, 8, 25]
];
$('#datepicker').datepicker({
beforeShowDay: function (date){
var year = date.getFullYear(), month = date.getMonth(), day = date.getDate();
// see if the current date should be highlighted
for (var i=0; i < dates.length; ++i)
if (year == dates[i][0] && month == dates[i][1] - 1 && day == dates[i][2])
return [false, 'ui-state-highlight ui-state-active'];
return [false];
}
});
See example: <
|
stackexchange-stackoverflow
|
{
"answer_score": 12,
"question_score": 4,
"tags": "jquery, jquery ui, datepicker"
}
|
Add offset to pointer without casting to UINT
If have written the following code to learn a bit about pointers and pointer arithmetic, meaning going from offset to offset to read something from a struct. I have the following code
DWORD * x = (DWORD*)((UINT)ptr1 + sizeof(int) + sizeof(float));
float f = *(float*)x;
This Code works as it should. However I struggled a lot to get it working as at the beginning I was not casting `ptr1` to `UINT` and therefore was getting a different address as I wanted to have.
Now it works. However can someone explain to me why I cannot add the offset (`sizeof...`) to the `ptr1` directly which is of type `DWORD *` ?
DWORD * x = (DWORD*)(ptr1 + sizeof(int) + sizeof(float));
float f = *(float*)x;
|
Adding a number `n` to a `T *` pointer will move the pointer `sizeof(T)*n` bytes (not `n` bytes).
For your example, if we suppose that both `sizeof(int)` and `sizeof(DWORD)` are 4, adding `sizeof(int)` to `ptr1` will move `ptr1` 16 bytes (instead of 4, which you likely intended).
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -1,
"tags": "c++, pointers"
}
|
Load HTML content synchronously
I need to load HTML in a div.
$("#content").load("content.html");
$("#myText").html("Prasath");
After that I need to update some text in a `div(id='myText')` which is available in "content.html". "content.html" contains huge data, so it takes some time to load. Before that this line is executed:
$("#myText").html("Prasath");
How to load HTML content synchronously from JavaScript/jQuery ? I don't want to do this from call back option in load.
|
$("#content").load("content.html", function(data){
// this will execute after load is fired.
});
Use a callback.
EDIT: If you really want to make synchronous request, you can use the following code. However, you'll get a warning in console as I mentioned in the comment earlier:
var data = $.ajax({
type: "GET",
url: "content.html",
async: false
}).responseText;
// this code waits for the above ajax request.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "javascript, jquery, html, asynchronous"
}
|
How do you switch between files when using prelude's projectile?
Imagine you have these files in your project:
a/b/first.png
a/first.png
If I trigger projectile with `C-c p f` and write first.png, and I write first.png , it will show me both files. Is there a way to select the next file?
Example: !enter image description here
In the image below, the first file in the list is .document. Without writing any other letter, is it possible to switch through the list provided by projectile? Is there a combination that will cycle through those file names, like , press some key combination and then .gitignore is selected?
|
If I correctly understand, the projectile uses the ido package for file name completions, and other things. The ido (and many other packages) uses the `C-s` to switch to next file name, and `C-r` to switch to previous file. See "Using IDO" section in previous link
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "emacs, projectile, emacs prelude"
}
|
Is it possible to read the ID of a post and then insert it into the html of the post?
If possible I want to insert the ID of a post(from a custom post type) into the html of the post itself when its loaded in the viewport.
The scenario is that the content of the custom post type is surrounded by a `<div>`. I want to append an 'id' to the `<div>` that includes the ID of the post. For example if the custom post type is glossary and the post ID is 351 then the resulting html would be:
`<div id="glossary351"> Post content </div>`
I looked at the conditional statements and googled on the subject but found that
1. A lot of applications of finding the Post ID were to do with showing the ID on the page, as opposed to inserting it into the html.
2. My almost non existent PHP skills were not up to fathoming out how to use the conditionals to get the result I need.
I'd appreciate any pointers regarding:
* Is this possible
* Any examples of how to approach the problem
Thanks
|
Try:
<div id="<?php the_title(); ?>-<?php the_ID(); ?>">
This should give you a result of:
<div id="Post Title-PostID">
Giving you a unique wrapper for each post.
|
stackexchange-wordpress
|
{
"answer_score": -1,
"question_score": 0,
"tags": "html, custom post types"
}
|
obj.constructor returns top most constructor instead of the immediate parent constructor
just ran into this little confusion while playing around with javascript inheritance.
function A() {}
function B() {}
B.prototype = new A();
function C() {}
C.prototype = new B();
var x = new C();
x.construction // -> returns A in chrome console.
I was expecting x.constructor to be C (or even B maybe) but not all the way to A (why even stop at A and not show Object then)
|
When you replace the `prototype` object entirely, the original `constructor` reference is removed with the original `prototype` object and is instead inherited from the `new A()`, etc.
function B() {}
console.log(B.prototype.constructor === B); // true
B.prototype = new A();
console.log(B.prototype.constructor === B); // false
console.log(B.prototype.constructor === A); // true
So, you'll have to reset the `constructor` after setting the `prototype`:
function A() {}
function B() {}
B.prototype = new A();
B.prototype.constructor = B;
function C() {}
C.prototype = new B();
C.prototype.constructor = C;
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "javascript, prototypal inheritance"
}
|
PHP: Is it bad design to serialize objects and stick them in the database for later?
I am planning and researching my switch from MySQL to MongoDB right now and I just had an interesting thought... I have a bunch of hierarchical objects that I need to store in the database. My current method is to have a bunch of embedded documents in a collection. They will never need to be searched for. Would it possibly make sense just to serialize the PHP objects, stick them in the DB, and then unserialize them back into PHP objects when I want to use them? The alternative is using Doctrine as my ORM.
My programming intuition tells me that this is bad design and is limiting, but I feel like serializing and unserializing would be very fast and eliminate the need for an ORM.
What's your opinion? Good design or bad design?
|
In many cases this would be considered bad design, but it could work if all of the following apply:
1. You don't need to search on them
2. You can accept (potentially) limited ability to query on them
3. You don't need relational integrity or other constraints enforced by the RDBMS
4. You know you'll never need to read them in a different language
5. You're confident that you'll know how to deserialize, version, and migrate them properly when you update your class definition
6. You're confident that the PHP serialization format will be stable across releases (or you are willing to write migration code, or it's a short-term project and you don't care)
7. You're willing to accept a minor performance penalty (`SELECT` \+ `deserialize()` will be slower than just `SELECT`)
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 4,
"tags": "php, orm, mongodb, doctrine orm, mongodb php"
}
|
AO bake not working! just black image
I'm trying to bake the AO for my model, but when I bake it, the result is just a black image.
Any help would be appreciated, thanks in advance
Here's the .blend file: <
|
The baking process works for me when I `select` the desired bake `image node`. In this case, the image: `Untitled.002`.
 Leuten vor den Kopf zu stoßen
I'm not sure what case to use here.
|
Laut < heißt es
> * jemanden vor den Kopf stoßen (umgangssprachlich; jemanden in plumper Weise kränken, verletzen)
>
somit müsste "einige" richtig sein.
|
stackexchange-german
|
{
"answer_score": 4,
"question_score": 4,
"tags": "grammar, idiom, grammatical case"
}
|
iOS: SocketRocket Mach-o Linker Error
I'm trying to use SocketRocket for an iOS project, I'm developing... I've been going by the instructions on Socket Rocket - Installing iOS and using the provided chat example as a guide, but when I use:
_webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://localhost:9000/chat"]]];
It throws two Mach-O Linker error:
1: "_OBJC_CLASS_$_SRWebSocket", referenced from: Objc-class-ref in HTViewController.o Symbol(s) not found for architecture i386
2: Linker command failed with exit code 1 (use -v to see invocation)
As far as I can tell, I've included the correct frameworks/dylibs (as mentioned on the GitHub) and I've added -ObjC to the "other linker flags" option... Any ideas what I might be missing?
|
You must build the `SRWebSocket` library with i386 architecture.
You can avoid these kind of erros by using package manager like `Cocoapods` for XCode. They also have `SRWebSocket` library in `SocketRocket` package.
**EDIT:**
If that version is not what you want, you can fork the `Cocoapods Specs` repository and upgrade the Pod to latest `SocketRocket` version.
Then you can also add your forked repo to your local Cocoapods installation using `pod repo` command.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ios, linker errors, socketrocket"
}
|
Did a refund just give me a bonus to my credit score?
I check credit karma notifications and I got one that my credit score just went up 3 points. Funny because the only transaction I had this month so far was an accident.
I was on a free trial subscription service that ended, so it automatically billed me 279 dollars for the year. I contacted support and they refunded me. Two days after that, I get a notification from credit karma that my score went up by 3 points and I didn't do anything.
Is it a coincidence or did somehow that refund consider me as "paying off" my credit card?
|
I'm sure it's due to something other than the $279 refund. Two days is not enough time for that to take effect. Perhaps your credit balances have changed or something else in your profile crossed some threshold. It's hard to say for sure.
But a 3 pt. change is also fairly insignificant. A credit score can move by quite a bit, +/- 10 or more, just due to normal monthly credit card usage.
|
stackexchange-money
|
{
"answer_score": 4,
"question_score": 0,
"tags": "credit card, credit"
}
|
I want to disable Roo scaffolding
Because I have manually tuned my entities and controllers and view, I would like roo to change none of them. Nevertheless I would like roo to keep on scaffolding all new entities. How could I do that
|
You can modify the @RooWebScaffold annotation in your entity by adding **update=false** attribute for it.
@RooWebScaffold(path = "<yourpath>", formBackingObject = <YourClass>.class, update=false)
This tells Roo not to scaffold and update views for the generated entity.
Cheers!!!
|
stackexchange-stackoverflow
|
{
"answer_score": 8,
"question_score": 7,
"tags": "spring roo"
}
|
Simulating separation forces amount n bodies
I'm writing a simulation for little creatures that walk around the screen. One issue I'm having is that they'll get too close sometimes - I figure that one way to solve this is to have a certain threshold distance, and when any two creatures get closer than this distance, a force will push them apart.
Before I implement this, however, I was wondering if there are any known algorithms for this _besides_ the brute force !enter image description here solution.
I've been researching a few different algorithms, and one of note was the Barnes-Hut algorithm, which runs in !enter image description here time - however, I'm not sure if this would work for this problem.
Any help is appreciated
|
Barnes-Hut and variations are the common way to do this, but I would not implement the full algorithm for your use case because it seems overkill. I would probably just divide the plane into a square grid, say 20 x 20, and maintain a set for each cell with all the creatures currently located within the cell. Then for each creature just look into its cell and the 8 (or 5 at the sides or 3 in the corners) neighboring cells and use a force that drops to zero within the length of one cell.
There is an obvious trade-off - a finer grid means less pairs of creatures to consider but you will then have to move them from cell to cell more often. A cell length smaller than the range of the force is useless because you will not only have to consider the 8 neighbors but cells beyond them that are within the range of the force.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 4,
"tags": "performance, algorithm, simulation, physics"
}
|
Firefox extensions: are cross-domain JSON calls allowed?
Can a Firefox extension/add-on make a cross-domain JSON request? Normally for in-page javascript this is not allowed, forcing a JSONP work-around.
Thanks Richard.
|
Yes. A Firefox add-on can do pretty much anything.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "json, firefox"
}
|
Composition of functions, notation and order confusion.
I thought composition of functions was something that I learned long ago and had down.
However, recently I've been terribly confused by the following.
We are dealing with permutations and my professor writes (for example):
$1 \xrightarrow{\sigma} 2 \xrightarrow{\tau} 8$, and calls this $\sigma \circ \tau$.
$\therefore (\sigma \circ \tau)(1) = 8$.
This can also be written as $\tau (\sigma(x))$. This makes sense to me following the arrow notation, but initially I tried:
$\sigma(\tau(x))$ which gave the incorrect results, this is because I have historically been taught that: $(f \circ g)(x) = f(g(x))$.
For example: $f(x) = x^2$ and $g(x) = x + 1$, then $(f \circ g)(x) =(x+1)^2$.
Where is the confusion coming in?
Thanks
|
The notation of your professor is indeed **inconsistent** as $\sigma\circ\tau$ usually should mean $x\mapsto\sigma(\tau(x))$.
However, specifically for permutations one may prefer the dual operation that reads the composition from left to right, but to distinguish it's usually denoted by some other symbol like $\sigma;\tau:=\tau\circ\sigma$ or $\sigma\cdot\tau$ or simply $\sigma\tau$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "functions, permutations, function and relation composition, permutation cycles"
}
|
jQuery closest() after siblings return 0
How can I check to make sure the siblings don't contain the class I am looking for before I start traveling up the DOM with `closest()`? I could do it with the `closest()` and `siblings()` functions but I am wondering if there is a jquery function that already exists that would take care of this.
|
`closest()` looks up the DOM, `siblings()` looks to either side; I don't believe there's any jQuery method that does both. You'll have to start with `siblings()` (possibly with `.andSelf()`) and then test the `length` to see if you need to check `closest()` instead.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "jquery"
}
|
appcelerator facebook get username
How can I gett the facebook username of a user via appcelerator facebook login
var fb = require('facebook');
fb.appid = "153xx364563xxxx";
fb.permissions = ['publish_stream']; // Permissions your app needs
fb.forceDialogAuth = true;
fb.addEventListener('login', function(e) {
if (e.success) {
Ti.API.info("Success " + JSON.stringify(e));
alert('Logged In');
} else if (e.error) {
alert(e.error);
} else if (e.cancelled) {
alert("Canceled");
}
});
all I get is the id and name
Success {"success":true,"code":0,"data":"{\"name\":\"John Smith\",\"id\":\"10111182454657222\"}","uid":"10111182454657222","cancelled":false,"bubbles":true,"type":"login","source":{"id":"facebook","appid":"153xx364563xxxx","forceDialogAuth":true},"cancelBubble":false}
|
The `publish_stream` permission is deprecated since many years, and there is no way to get the `username` anymore. The replacement for `publish_stream` would be `publish_actions`, but you only need that permission to post to the user wall.
Changelog for v2.0:
> /me/username is no longer available.
Source: <
You do not need the username anyway, just use the (App Scoped) ID to identify returning users.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "facebook, facebook graph api, appcelerator titanium"
}
|
Шаблонизатор сделай сам
Как сделать шаблон сайта? НЕ прописывать же каждую страницу в ручную. Просто сделать скелет на дивах, или нужно что то еще ?
|
Ну, как правило, header, footer, т.е. шапка и подвал, их верстаешь и потом просто подключаешь с помощью include() во все файлы.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": -1,
"question_score": 0,
"tags": "php, html, javascript"
}
|
How do I calculate the 2nd term of continued fraction for the power tower ${^5}e=e^{e^{e^{e^{e}}}}$
I need to find the 2nd term of continued fraction for the power tower ${^5}e=e^{e^{e^{e^{e}}}}$ ( i.e. $\lfloor\\{e^{e^{e^{e^{e}}}}\\}^{-1}\rfloor$), or even higher towers. The number is too big to process in reasonable time with numerical libraries or algorithms known to me — the 1st term of the continued fraction has more than $10^{10^6}$ decimal digits. Is there a trick that allows to do such calculations faster?
UPDATE: I created a sequence A225053 in OEIS for 2nd terms of continued fractions for power towers $e,\,e^e,\,e^{e^e},\,\dots$ Please feel free to extend it if you find a way to calculate further terms.
|
It might be not a direct answer to your question, but it is possible that there is **no 2nd term** of the continued fraction in question.
I believe it is a long-standing open problem if $\,{^5 e}\in\mathbb{N}$, and, in general, for every integer $n \ge 5$, if $\,{^n e}\in\mathbb{N}$ (and also, for every integer $n \ge 4$, if $\,{^n \pi}\in\mathbb{N}$).
It is mentioned multiple times in Wikipedia, e.g. in Russian Wikipedia article Открытые математические проблемы (Open mathematical problems) and on some mailing lists. Similar questions were discussed here on Math.SE: $e^{e^{e^{79}}}$ and ultrafinitism, How to show $e^{e^{e^{79}}}$ is not an integer. Currently these questions look very far from being resolved and it is completely unclear how to approach them.
|
stackexchange-math
|
{
"answer_score": 17,
"question_score": 34,
"tags": "numerical methods, exponentiation, continued fractions, tetration, big numbers"
}
|
How to use sequential relations
In my application, I have 3 tables: `state`, `city`, `district`, Each state has many cities in it, and each city contains many districts. I already defined those relations in `state` and `city` models.
Now I need to retrieve a list of all `state`, `city`, and `district` in to a multidimensional array that reflexes those relations. An example will look like this:
[
'A state' => [
['AA city' => ['AA1 district', 'AA2 district']],
['AB city'] => ['AB1 district']
]
]
Is it possible to use `Model` that leverages relations that I define to get the job done effectively?
|
Yes, you can.
You can fetch the data with the relations like this:
$states = State::model()->with('cities.districts')->findAll();
Where `State` should be you state model name. `cities` is the name of the relation as defined in the relations array in `State`. And `districts` is the name of the relation as defined in the relations array in `City`.
You can loop through the states and access the de cities and districts with a simple `->`
foreach($states as $state) {
var_dump($state->cities); // will probably be an array of cities
foreach($state->cities as $city) {
var_dump($city->districts); // will probably be an array of districts
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "activerecord, yii"
}
|
Oracle get day name returns wrong name
I am using this to get the name of a given date, so the following gives me MONDAY:
Select to_char(to_date('01/04/2013','dd/mm/yyyy'), 'DAY') from dual
However if I apply the same thing to a table and extract dates with their names I am getting a wrong day name, in the case of '01/April/2013' it gives me SATURDAY.
Select to_char(to_date(myDateColumn,'dd/mm/yyyy'), 'DAY'), myDateColumn
From myTable WHERE myDateColumn = to_date('01/04/2013','dd/mm/yyyy')
This is how I would have done on MS SQL, but I need to do this for Oracle 10g database, is this the right way?
Thanks
|
Since your date column is a date:
Select to_char(myDateColumn, 'DAY'), myDateColumn
From myTable
WHERE myDateColumn = to_date('01/04/2013','dd/mm/yyyy')
should suffice
(this should be a comment, not an answer but it wouldn't be readable)
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "sql, oracle, oracle10g"
}
|
The base of the product topology
Let $(E_i, \mathcal{T_i})$ a family of topological spaces and $E=\prod_{i \in I} E_i$. The product topology is the smallest topology on $E$ such that all projection maps are continuous. the base of this topology is given by : $\mathcal B=\\{ \prod_{i\in I} U_i : \text{ $U_i$ open in $E_i$ for all $i\in I$, and $U_i =E_i$ for all but finitely many $i\in I$}\\}$.
* * *
The problem is why we define the base of the product topology like that and didn't define it as in the finite case : $\mathcal B=\\{ \prod_{i\in I} U_i : \text{ $U_i$ open in $E_i$ for all $i\in I$} \\}$. I know that $\mathcal B$ in this case is the base of the box topology but I didn't understand yet. Thank you in advance.
|
**Hint**
If you have a collection of set $\mathcal A=\\{A_i\\}_{i\in\mathcal I}$, the coarse topology that contains $\mathcal A$ is the topology of basis $$\mathcal B=\left\\{\bigcap_{j\in J}A_j\mid |\mathcal J|<\infty ,A_j\in \mathcal A\right\\}.$$
* * *
In your case, denote $\pi_k: \prod_{\ell\in \mathcal K}E_\ell\to E_k$ defined by $$\pi_k((x_\ell)_{\ell\in\mathcal K})=x_k.$$ In particular, $\pi_k$ is continuous if and only if $$\pi_{k}^{-1}(U)=E_1\times ...\times E_{k-1}\times U\times E_{k+1}\times ...$$ is open in $\prod_{\ell\in \mathcal K}E_\ell$ for all $U$ open in $E_k$. So, in you case, $\mathcal A$ is a collection of sets of the form $\prod_{\ell\in \mathcal K}V_\ell$, where $V_\ell$ are open in $E_\ell$ and $V_\ell=E_\ell$ for all $\ell\in \mathcal K$, but one. Then $\mathcal B$ is the collection of sets of the form $\prod_{\ell\in\mathcal K}V_\ell$ where $V_\ell$ are open, and $V_\ell=E_\ell$ for all $\ell$, but finitely many $\ell$'s.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "general topology"
}
|
How to implement SSO in heterogenous system (Java and web application)
Assuming there are two heterogenous applications (Java rich client and a web application). It shall be possible that the user signs in once to the Java rich client, from there opens a link to the web appication (which opens in the browser) and is automatically authenticated without the need to enter his username/password again.
The first idea was to set up an SSO server using Kerberos. But how can the kerberos ticket be passed to the web application? Is this even possible? Is there any other approach to achieve SSO?
Even better, is it possible to to let the user register at the SSO server when logging into the OS (Windows or Linux) and pass the login information to the Java rich client and from there to the web application?
|
Your first idea is great, you'll have to install Kerberos on your server and, if you are on linux, integrate Kerberos into your PAM Auth or into your Open-LDAP Auth.
It needs to create REALMs on the Kerberos, which are the realms for your users.
Later, when everything is working fine, you'll login on your OS and with the successful login you'll get a "ticket" in the Kerbers Ticket Granting Server.
So, now a user comes and log into the os, he has no ticket yet, so the answer of the successful login comes from the AUTH System of the OS, the ticket is created (initial auth request) and the user is logged in.
Your WebApp on the Applicationserver could be in another realm, but if there is a relationship between those two realms the user can browse to the WebApp and will be logged in automatically by Kerberos, because he is logged in currently and has a ticket in TGS.
Great, log in only once and use all applications around.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 3,
"tags": "java, authentication, single sign on, kerberos"
}
|
Unbounded entire function - Little Picard Theorem and Identity theorem - contradiction?
Assume we have an entire unbounded function $f(z)$.
My problem is the following contradiction I obtain:
We can conclude from Little Picard Theorem that the real part of $f(z)$ takes all real values (up to one). From the fact that the function is holomorphic everywhere I would conclude that the set $\\{z\\}$, where the $\Re f(z)$ is greater than zero is an open set, the same for the negative values. I also would think that at the boundary between the two $\Re f(z)=0$. But shouldn't then from identity theorem follow that $\Re f(z)=0$ everywhere (and accordingly our function is bounded)?
|
$\Re f$ is never holomorphic (unless $f$ is constant), therefore the fact that it vanishes on a non-discrete closed set means nothing: the essential fact is that it shouldn't vanish on any open set.
In fact, the set $(\Re f)^{-1}(0)$ is ideally a nice "curve" in $\Bbb R^2$; the set $(\Im f)^{-1}(0)$ is, likewise, another nice curve. And sice _their itersection_ $f^{-1}(0)$ is very likely to be a discrete set, the identity theorem will stay put and behave.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "complex analysis"
}
|
Loop for, strange outcome
I'm learning Java with the book "Java: A Beginner's Guide". The book shows this example of the for loop:
// Loop until an S is typed
class ForTest {
public static void main (String args[]) throws java.io.IOException {
int i;
System.out.println ("Press S to stop.");
for (i=0; (char) System.in.read() != 'S'; i++)
System.out.println ("Pass #" + i);
}
}
And the output is:
Press S to stop.
s
Pass #0
Pass #1
Pass #2
d
Pass #3
Pass #4
Pass #5
S
I do not understand why it writes three times Pass # each time I press a different keyboard key to S. I think it should write Pass # only once. Thank you.
|
You pressed `s` and then return. That "return" generated two more characters - `\r` and `\n` (I assume you're on Windows). Those are then returned by `System.in.read()`.
Here's an example which makes that clearer:
class ForTest {
public static void main (String args[]) throws java.io.IOException {
int i;
System.out.println ("Press S to stop.");
char c;
for (i = 0; (c = (char) System.in.read()) != 'S'; i++) {
System.out.println ("Pass #" + i + "; c=" + (int) c);
}
}
}
Output:
Press S to stop.
a
Pass #0; c=97
Pass #1; c=13
Pass #2; c=10
b
Pass #3; c=98
Pass #4; c=13
Pass #5; c=10
S
`\r` is Unicode character 13, and `\n` is 10.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 1,
"tags": "java"
}
|
Spotfire expression - get the minimum of the next indicator per id
for every id, I am trying to get the minimum date of the next indicator next to the previous indicator. it is similar to lead in sql. the wished result is in the column target.
 OVER (Intersect(Next([Indicator]),[ID]))
**Here is the final result table:**
.
As of 10.12.3, there is a bug. If that checkbox didn't appear, restart your computer will make it appear.
|
stackexchange-apple
|
{
"answer_score": 3,
"question_score": 3,
"tags": "macbook pro, macos, touch bar"
}
|
When do 0-preserving isometries have to be linear?
Let $\langle \mathbf{V},+,\cdot,||.|| \rangle$ be a normed vector space over $\mathbb{R}$.
Let $f : \mathbf{V} \to \mathbf{V}$ be an isometry that satisfies $f(\mathbf{0}) = \mathbf{0}$ .
What conditions on the vector space would or would not force $f$ to be linear?
examples: finite dimensional, complete, norm induced by an inner product, strictly convex
|
If you assume $f$ to be surjective then $f$ has to be linear without any assumptions on $V$ by the Mazur-Ulam theorem. Wikipedia doesn't offer much more information than a link to the beautiful recent proof by J. Vaisala.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 14,
"question_score": 6,
"tags": "vector spaces, norms, isometries"
}
|
Update binding after server response / How do I selectively update bindings?
I'm trying to prevent the value of a model from updating in a form.
For example :
I have a payment details form that lists the user's saved information (name, address etc) along with the form that is used to edit the same information.
I've been experimenting using the :: for one time binding as I don't want the displayed information to changed when input controls are changed (but I obviously want the models updated values so i can send them to the server for processing).
How do I update the displayed model values after the server responds that the changes have been saved, are ok etc? I can't seem to find a way to update the one time binding (as I'm guessing this is fully the intended functionality).
So I guess my question boils down to :
How do I selectively update bindings on some controls but not others?
|
Actually you just want to display different vars.
You should try with a temporary model object (that is a copy of your object like "editedObject") and when you validate you will update the original object.
See it working in this plunker
The editing space :
<input ng-model="editCopy.value"> <button ng-click="validateChange()">Change</button>
The ng-repeat :
<td ng-repeat="item in items" ng-click="editItem(item)">
<a href="">{{item.value}}</a>
</td>
The functions :
$scope.editItem = function(item){
$scope.editCopy = angular.copy(item);
$scope.editingItem = item;
}
$scope.validateChange = function(){
$http.get('index.html').success(function(){
$scope.editingItem.value = $scope.editCopy.value;
});
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "angularjs, angularjs digest"
}
|
Regular expressions documentation while using grep
I am trying to find some comprehensive documentation on character classes in regular expressions that could be used while using grep. I tried
info grep
man grep
man 7 regex
but could not find all the characters classes listed down in the documentation.
I am looking for some comprehensive documentation on regex that grep uses. Is there such a documentation available?
|
grep has three options for regex `-E or --extended-regexp` `-G or --basic-regexp` and `-P or --perl-regexp`.
Extended / Basic Regex Classes: Follow POSIX Classes
Perl Regex Classes: Follow Perl Classes
* * *
From the command line POSIX regex information can be accessed via `man 7 regex` where as Perl regex data can be accessed via `perldoc perlre`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "regex, linux, bash, grep"
}
|
How to disable UIPickerView (Objective-C)?
Is there a way to make the UIPickerView read-only? This means that the user cannot flip through the options.
PS. This is not the same as not passing anything in the `didSelectRow` method because I only want the user to see that the picker is there and not to touch it.
|
Set the picker's `userInteractionEnabled` to NO.
|
stackexchange-stackoverflow
|
{
"answer_score": 37,
"question_score": 20,
"tags": "ios, objective c, uipickerview"
}
|
Ehcache and Java
I am using ehCache to store larges amount of data. This cache is accessed about 3 times every second and must be kept up to date. I have a thread that runs which retrieves all the data i need for the cache from the database every minute into a different cache(different cachemanager also). What i want to do is copy the contents of the data from the new cache into the cache which is being accessed every second in a quick, reliable and synchronized manner. (e.g. call a replace method passing in the existing cache, and the new cache and update the new cache quickly and safely)
Is there any way off hand to do this in ehCache?
Any help is greatly appreciated.
Thanks Damien
|
It sounds like you are looking for a complicated solution to a problem ehcache solves out-of-the-box.
You only need one cache manager. Configure it to flush once a minute. If need be, do this by creating a thread that flushes the cache once a minute.
When you try to retrieve something from the cache and it is not there load the data again. Put this cache retrieval bit in a synchronized method or block if you want to be sure that the populating the cache blocks progress.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 1,
"tags": "java, ehcache"
}
|
Symfony Form Component. What are all available options as 3rd argument of FormBuilderInterface::add() method
How do I know what **all** options are available as 3rd argument of `FormBuilderInterface::add()` in Symfony Form Component.
|
It depends on what type of form field you're adding. Full list of default fields is here < and then all available options are listed in the documentation for each form field.
For example `TextType` has just a few basic ones <
On the other hand `EntityType` has it's own extra options and then inherits all options from its parents <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "php, symfony, symfony forms"
}
|
Meaning of Guns and ghee
I just read an article from Economist Sep24th, 2016 titled Guns and ghee, the article was discussing india's armed forces. I don't quite understand what does the title imply?
> ghee: Ghee is a class of clarified butter that originated in ancient India and is commonly used in South Asian, Iranian and Arabic cuisines, traditional medicine, and religious rituals - wikipedia
Was the author trying to tweak "bread and butter" and replace "bread" with "Guns" and "butter" with "Indian butter - ghee" or what? What does the ghee means here? domestic economy or...
|
It's the Economist's humorous attempt to "India-ize" the American expression _guns and butter_. It refers to the political tensions that occur when a nation builds up its military, presumably to the detriment of its civilian social needs. See the the relevant Wikipedia artice, particularly the section called _Origin of the term_.
Specifically, "guns versus butter" describes the tension between the government's need to spend money on the military ("guns") to defend its national interests and the domestic need for ordinary things like food ("butter"). Since this is the "guns versus butter" conflict in India, the trade-off could be described as "guns and _ghee_ ".
|
stackexchange-english
|
{
"answer_score": 25,
"question_score": 5,
"tags": "meaning, meaning in context"
}
|
NtQueryObject function returns length as -8
I'm using `NtQueryObject(handle, OBJECT_INFORMATION_CLASS.ObjectTypeInformation, IntPtr.Zero, 0, out length);` in my program, but this executes returning length as -8...which is weird; I don't see how a buffer size can be negative.
Does anyone know why this happens and how I may correct it?
Thanks!
**NB:**
I imported the NtQueryObject using:
[DllImport("ntdll.dll")]
internal static extern NT_STATUS NtQueryObject(
[In] IntPtr Handle,
[In] OBJECT_INFORMATION_CLASS ObjectInformationClass,
[In] IntPtr ObjectInformation,
[In] int ObjectInformationLength,
[Out] out uint ReturnLength);
|
I guess I should have changed the `out` to `ref` like this.
[DllImport("ntdll.dll")]
public static extern int NtQueryObject(IntPtr ObjectHandle, int ObjectInformationClass, IntPtr ObjectInformation, int ObjectInformationLength, ref int returnLength);
The problems seemed to have been from how I was making the call however. The correct way is:
NtQueryObject(pHandle, (int)ObjectInformationClass.ObjectBasicInformation, pBasic, Marshal.SizeOf(objBasic), ref Length);
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c#, winapi, memory"
}
|
Service Fabric doesn't run a docker pull on deployment
I've setup VSTS to deploy an Service Fabric app with a Docker guest container. All goes well but Service Fabric doesn't download the latest version of my image, a docker pull doesn't seem to be performed.
I've added the 'Service Fabric PowerShell script' with a 'docker pull' command but this is then only run on one of the nodes.
Is there a way to run a powershell script/command during deployment, either in VSTS or Service Fabric, to run a command across all the nodes to do a docker pull?
|
1. Please use an explicit version tag. Don't rely on 'latest'. An easy way to do this in VSTS, in the task 'Push Services' add `$(Build.BuildId)` in the field `Additional Image Tags` to tag your image.
2. Next, you can use a tokenizer to replace the ServiceManifest.xml image tag value in your release pipeline. One of my favorites is this one.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "powershell, azure devops, azure service fabric"
}
|
vector bold instead of arrow
I was trying to change the standard result for the command `$\vec{}$` instead of the arrow above I would like to have it bold and not in italic.
For instance: **x**
The solutions I found did not work well (and I do not want to define a new command) how could I do?
|
You could change the definition of `vec` in your preamble:
\let\vec\mathbf
|
stackexchange-tex
|
{
"answer_score": 15,
"question_score": 7,
"tags": "vector"
}
|
response.getWriter(); what is the task of this method?
I know this question has been asked before several times. But the answers are not satisfactory. I know getWriter method returns an object of PrintWriter class.Everyone has answered what it returns but I want to know what is used for?
|
When ever you request something from Client to Server it must maintain a format. Now in J2EE we bind the request information into an object and send it to server. That's why we need a HttpServletRequest reference in Service class. Now the server has the raw data which should be modify/calcuated/ whatever the code is that is to send back again to client and the result is kept in an object of response type.Thats why needed HttpServletResponse reference. Now in HttpServletResponse there is a method named getWriter() which binds the result into object and returns an object of PrintWriter class. Hope this helped you.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "servlets"
}
|
How do I schedule a post in Drupal?
I was just wondering how one should go about scheduling a post in Drupal so that it posts at a point in time later then when you are posting? Is it as simple as changing the post time on the author information to a future point in time or is it more difficult then that?
|
Yes as simple as changing the post time at the point time that you would like to released that post
|
stackexchange-drupal
|
{
"answer_score": 1,
"question_score": 1,
"tags": "nodes"
}
|
How do I undo my committed and pushed changes to some of the tracking files in Git?
I am a newbie in Git. I did a mistake and now need to undo the same mistake. I cloned from a remote repository and that brought down fileA and fileB in my working directory. I made a commit and in that commit, I modified fileA and fileB from what is on the server. (These changes shouldn't go to production).
I also pushed the commit to a remote branch of the origin server.
Now I need to do two things:
1. In my next commit, I need to bring those two files to their original state.
2. Push that commit again to the remote branch of the origin.
How do I do this? Any help will be highly appreciated.
|
If you need to undo the last commit and keep the changes then do `reset`.
$ git checkout <your-branch>
$ git reset --soft HEAD~1 # undo last commits, and you've changes that you done.
now do change/fix
$ git commit -am 'new-message' # add & commit your changes
$ git push -f origin HEAD # force push to master
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "git"
}
|
Pass variable into an input
I made an html file called test.html then I navigated to it as "< but the textbox stayed blank. Why is this?
Super simple code
<html>
<head>
<title>Test</title>
</head>
<body >
<input type=text name="test1">
</body>
</html>
|
The file should be a PHP file, so test.php.
Then maybe something like this:
<html>
<head>
<title>Test</title>
</head>
<body>
<input type="text" name="test1" value="<?php echo htmlspecialchars($_GET['test1'], ENT_QUOTES); ?>">
</body>
</html>
The reason it stays blank in your example is because there is no PHP code to put the value into the field. It isn't automatic. Also, on most servers (but not always), a file with an .html extension will not be parsed by PHP.
Also, passing it to the htmlspecialchars function will help prevent cross-site scripting.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "php, html"
}
|
Cases vs Select, Pattern vs Pure function
What is the difference between having `Cases` with selection condition presented by pattern and `a` with pure function as condition? What are the internal implementational reasons to have them separate?
As a side question: How can I select from a list of integers those that have a difference with their neighbor ( left or right, or both) unity?
|
Any `criteria` (used for `Select`) can be written as the pattern _?(criteria) (used for `Cases` or `DeleteCases`). For single argument functions, the pure function can be abbreviated
list = Range[20];
Select[list, EvenQ[#] &] ==
Select[list, EvenQ] ==
Cases[list, _?(EvenQ[#] &)] ==
Cases[list, _?EvenQ] ==
DeleteCases[list, _?(! EvenQ[#] &)] ==
DeleteCases[list, _?(OddQ[#] &)] ==
DeleteCases[list, _?OddQ] ==
Pick[list, EvenQ[list]] ==
Range[2, 20, 2]
> True
|
stackexchange-mathematica
|
{
"answer_score": 9,
"question_score": 5,
"tags": "list manipulation, pattern matching, pure function"
}
|
Backup folder using batch or powershell script
I am learning C# AND Java and I often create small projects and programs in these languages. Usually my source code is at C:......\Visual Studio 2010\Projects\MyProject or C:......\Eclipse\Projects\MyProject.
I often get to a point where the code is partially working and while trying to add a new feature I end up breaking the working code. It is frustrating to fix all the changes and get back to the old state and takes a long time just to go back to where I came from.
I was wondering if you could help me write a batch (or Win PowerShell?) script to back up my source folders to a D:\Backup\SourceCode\CSharp\MyProject and D:\Backup\SourceCode\Java\MyProject. And place the script on my desktop so that i can run it time to time whne i have good working code.
Or if there are any other solutions to this problem that you might be using are also welcome.
|
A real version control system is far better. I would recommend GIT
Here is a batch example to do what you want:
REM Delete backup directory
if exist D:\Backup\Code\*.* rd D:\Backup\Code /s /q
REM Create/recreate backup directory
mkdir D:\Backup\Code
REM Copy files/folders
xcopy "C:\SourceCodeFolder" /e /i /y D:\Backup\Code
cls
exit
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "windows, powershell, batch file"
}
|
Meteor linkedin accounts , redirect_uri error
I have registered application in linkedin and gave oauth2 redirect_url as `
Then, I have added accounts-linkedin service and added it's depenencies `accounts-base,accounts-oauth,linkedin`
I added loginButtons template and gave my id and secret in the fields
Now, when I try to login to the app I'm getting the following error
Invalid redirect_uri. This value must match a URL registered with the API Key.
Is there anything I've missed?
|
Use < as your oauth redirect URL.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 9,
"tags": "meteor, linkedin, meteorite"
}
|
JMeter: What is difference between Loop Count in Thread Group and Loop Controller in Logic Controller
I would like to know in what scenario I can use: 1\. Loop Count in Thread Group and 2\. Loop Controller in Logic Controller
|
With Loop count, it will loop all the requests in the thread group where as using the loop controller you can loop specific requests inside the thread group.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "multithreading, loops, controller, logic, jmeter"
}
|
net::ERR_INSECURE_RESPONSE in Electron
I am trying to connect to the localhost via https. Since on production it will be replaced with a proper IP with a valid SSL, but on localhost it is throwing Error on electron.
;
//second alternative
app.commandLine.appendSwitch('ignore-certificate-errors');
|
stackexchange-stackoverflow
|
{
"answer_score": 13,
"question_score": 2,
"tags": "ssl, windows 10, ssl certificate, electron"
}
|
Html/Css Force wrap number displayed in Chrome
I want to force wrap text even number fit to the width I defined.
<tr style="font-size:22px" id="id_step">
<td valign="top" style="width: 1190px">
<img src="file://#step_image" width="140" style="float: right"/>
<strong>#step_no</strong>
#step_text
</td>
</tr>
When I replace **#step_text** by **111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000444444444444444444444444444444444444444444444444444444444444444444444444444444444499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999**
It can't be wrappep. Can you help me, please?
|
Write:
td{word-break:break-word;}
DEMO here.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "javascript, html, css"
}
|
Why does arm-linux-gcc only reserve r0-r4 when entering IRQ mode
I'm using S5PV210 which is based on ARM cortex-A8
When i declare a interrupt routine like this:
void isr_routine(void) __attribute__ ((interrupt ("IRQ")));
And compile like this
arm-linux-gcc -c -march=armv7-a -fpie -fno-builtin $< -o $@
I know that gcc will switch context for me by push some registers.Before i know this, i did it manually.So i'm curious about how gcc do it. After disassembling, I found codes like below
PUSH {r0-r4,r11,r12,lr}
It goes against my conception about how to switch context. In Arm cortex-A8 official document, it's explicit that r0-r12 is shared by user mode and IRQ mode.However lr in user mode is independent from IRQ mode.So, I used to switch context like this
PUSH {r0-r12}
Is it OK? Why does gcc push lr register and why doesn't gcc push r5-r10 rigsters?
|
r4-r11 are preserved across function calls as part of the ARM ABI, so the interrupt routine does not need to save them unless _the function itself_ is going to clobber them. If another function the interrupt routine calls wants to modify these registers, it's already obligated to save and restore them as part of the normal ABI. It seems that among this set, the compiler only wanted to use r4 and r11 (r5-r10 are not used).
While non-authoritative, the Wikipedia article is easy to read and may be helpful: <
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 5,
"tags": "c, gcc, assembly, arm, cortex a8"
}
|
Is there an alternative to gitlab-runner?
I would like to know if there is an alternative to gitlab runners compatible with bitbucket.
The main functionnalities i'm searching for is to install an executor on my server and use it to run some commands on the server where it is installed.
I've tried circle-ci, bitbucket pipelines and travis but all of those require to be connect to my server over ssh.
|
If you like the gitlab ci you can use it as a CI for bitbucket.
Just mirror your bitbucket repo on gitlab and your will be able to use all of gitlab ci features.
"The following are some possible use cases for repository mirroring:
You migrated to GitLab but still need to keep your project in another source. In that case, you can simply set it up to mirror to GitLab (pull) and all the essential history of commits, tags, and branches will be available in your GitLab instance."
It works on gitlab.com and also on gitlab self hosted (CE or Enterprise)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "continuous integration, continuous delivery"
}
|
Are records unique in a trigger?
I'm writing a trigger to update another object's field. I know a trigger can fire on multiple records. My question is if the records are unique? E.g. A trigger is called with 5 records. Does SF guarantee that each of the 5 records are different or could the same record be in the list twice? I want to use a Map and thought to use the object's ID as the key.
The first example [in this link] (< implies a record can appear more than once as it uses a set to guarantee uniqueness.
Thanks, Scott
|
Yes, the records are unique. In fact, in an ApexTrigger or the context of a trigger specifically, you can use Trigger.newMap (which is populated on after insert, but not before insert) and also Trigger.oldMap in place of creating your own map.
Here's a link to the Trigger Context Variable documentation for more info on the maps and when they are available: <
|
stackexchange-salesforce
|
{
"answer_score": 9,
"question_score": 6,
"tags": "trigger"
}
|
What is the order of this pole at $\pi/2$?
Consider: $$f(z)=\frac{\cos(z)}{(z-\pi/2)^4}$$ at $z = \pi/2$.
What is the order of the pole? How can I see this? I keep getting $2$, but my textbook says that the answer is $3$.
|
$$ \frac{\cos z}{(z-\pi/2)^4}=\frac{-(z-\pi/2)+\frac1{3!}(z-\pi/2)^3+O((z-\pi/2)^5)}{(z-\pi/2)^4}=\\\\-\frac1{(z-\pi/2)^3}+\frac1{3!}\,\frac1{z-\pi/2}+O(z-\pi/2) $$
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 2,
"tags": "complex analysis"
}
|
What's the correct way to unsubscribe from Single
I want to do something after short delay:
public void notifyMe() {
Single
.timer(500, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.subscribe(ignore -> service.notifyMe()));
}
Now I have a warning: `"The result of subscribe is not used"`. How can I fix it?
|
A Single will only call once. Upon calling either method, the Single terminates and the subscription to it ends.
Link can be referred for more information.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, rx java, rx java2"
}
|
Typescript interface problem: how to get the type like t when we have a const like list
const list = [
{
label: "phone",
defaultValue: "1203981209",
},
{
label: "isMan",
defaultValue: false,
},
{
label: "age",
defaultValue: 22,
},
];
type t = {
phone: string;
isMan: boolean;
age: number;
};
We have list.And how to get t in Typescript. I tried to write something like `type t = {[k in typeof list[number]["label"]]: typeof list[number]["defaultValue"];};`,but that does not work.
|
The original object needs to be typed well for this to work - since you want the literal `label` values for the keys in the new object, they need to be `as const` so they don't get widened to `string`. (I don't see a nice way to use `as const` over the whole object, because then the _values_ don't get widened - if you went that route, you'd have to have a helper type to turn, eg, `"1203981209"` into `string` and so on).
const l = [
{
label: "phone" as const,
defaultValue: "1203981209",
},
{
label: "isMan" as const,
defaultValue: false,
},
{
label: "age" as const,
defaultValue: 22,
},
];
type T = {
[Prop in typeof l[number] as Prop["label"]]: Prop["defaultValue"];
};
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "typescript, typeof, keyof"
}
|
Dependency Injection in windows phone 8
Does anyone know of decent Dependency Injection framework for windows phone 8? I'm creating a project following mvvm which shares code with a windows store project. I was using Unity for the windows store app, but I can't get it to work with windows phone. Has anyone had similar problems?
|
I was able to download the source from unity and I got it to compile with minimal problems.
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 6,
"tags": "c#, windows runtime, windows phone, windows store apps, windows phone 8"
}
|
How to get Windows batch date stamp that is locale independent?
In a Windows batch file, is it possible to get the text of date in some location independent form to get the location independent date stamp as a string? To make the question clear... In the Czech Windows, the wanted code looks like this:
d:\>date /t
čt 16. 05. 2019
d:\>echo %DATE:~-4%%DATE:~-8,2%%DATE:~-12,2%
20190516
However, in the English Windows the same code returns bad results for obvious reasons:
d:\>date /t
Thu 05/16/2019
d:\>echo %DATE:~-4%%DATE:~-8,2%%DATE:~-12,2%
2019/1u
If the code is tuned for the English Windows, then it does not work in the Czech environment. How it should be implemented?
|
Here is a method you can manipulate the output of `wmic os get LocalDateTime /VALUE`
@echo off
for /f "tokens=1,2 delims==" %%i in ('wmic os get LocalDateTime /VALUE 2^>nul') do (
if ".%%i."==".LocalDateTime." set mydate=%%j
)
set mydate=%mydate:~0,4%/%mydate:~4,2%/%mydate:~6,2% %mydate:~8,2%:%mydate:~10,2%:%mydate:~12,6%
echo %mydate%
and in the specific format you seem to want it `YYYYMMDD` and excluding time:
@echo off
for /f "tokens=1,2 delims==" %%i in ('wmic os get LocalDateTime /VALUE 2^>nul') do (
if ".%%i."==".LocalDateTime." set mydate=%%j
)
set mydate=%mydate:~0,4%%mydate:~4,2%%mydate:~6,2%
echo %mydate%
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "windows, date, batch file, cmd"
}
|
Output only certain fields
Been looking for a way to output a certain field in a line, and only the next field after it.
So say I have file with the contents " _blue, green, purple, orange, black, white,_ ", how would I search for the word " _purple,_ ", and print to screen only " _purple, orange,_ ".
I need to omit the " _black, white,_ " from the output.
cat filename | sed -n -e 's/^.*\(purple\)/\1/p'
purple, orange, black, white,
|
$ grep -o 'purple, [^,]*' input
purple, orange
The `-o` switch prints **o** nly the string matching the pattern.
The pattern is the string `purple,`, followed by zero or more characters which are anything other than a comma.
|
stackexchange-unix
|
{
"answer_score": 4,
"question_score": 0,
"tags": "text processing, awk, sed"
}
|
Eclipse keeps finding wrong version of plugin dependency
I'm trying to add a plugin dependency to org.eclipse.emf.ecore, because I'm using Ecore to do some modeling for my plugin. The only problem is that when I try to add it, the only version that matches is 2.4 and I can't find that 2.4 jar anywhere on my system, so I have no idea why Eclipse can only find this version and where Eclipse finds it.
In Eclipse's own plugins directory, I have version 2.9, so why can't it find this version? I want to use v 2.9, but no clue how can get Eclipse to match that version.
Any help is welcome, this has me perplexed!
|
Eclipse resolves dependencies against the currently set _target platform_. Make sure you have the right taget platform set, that includes `org.eclipse.emf.ecore` v. 2.9.
If you have not worked with the target platform before, take a look at this tutorial from Lars Vogel.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "eclipse, maven, plugins, eclipse plugin, dependencies"
}
|
MongoDB Query: How can I aggregate an array of objects as a string
I have an array of objects where I want to make a string concatenating all of the same attributes from the array. Example:
{
_id: 123,
example_document: true,
people: [
{
name: "John",
age: 18
}, {
name: "Clint",
age: 20
}
]
}
And I wanna make a **query** where my result would be:
{
_id: 123,
example_document: true,
people: [
{
name: "John",
age: 18
}, {
name: "Clint",
age: 20
}
],
concat_names: "John, Clint"
}
I think aggregate is the path I should take, but I'm not being able to find a way of getting a string out of this, only concat array elements into another array. Anyone could help?
|
You can use `$concat` combined with `$reduce` to achieve this, like so:
db.collection.aggregate([
{
$addFields: {
concat_names: {
$reduce: {
input: "$people",
initialValue: "",
in: {
$concat: [
"$$value",
{
$cond: [
{
$eq: [
{
"$strLenCP": "$$value"
},
0
]
},
"",
", "
]
},
"$$this.name"
]
}
}
}
}
}
])
Mongo Playground
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "mongodb, mongodb query"
}
|
Scala: filtering out tuples where specific properties are None
I have a `Summary` case class:
case class Summary(
title: String,
desc: String,
image: Option[String],
path: String,
timestamp: Int
)
I attempt to retrieve a Summary for each ID I have:
val rawSummaryList = nids.map {
_ match {
case Some(id) => (id, Node.nodeSumByNid(id))
case None => (-1, None)
}
}
This returns a value of type `List[(Int, Option[drupalslick.data.Summary])]` and each Summary may, or may not, contain an image.
How do I:
1. Drop `(Int, Option[Summary])` pairs where either `Summary` or `Summary.image` is None?
2. Convert `(Int, Option[Summary])` to `(Int, Summary)`?
|
val rawSummaryList: List[(Int, Option[Summary])] = ???
val filtered: List[(Int, Summary)] = rawSummaryList collect {
case (id, Some(summary)) if summary.image.isDefined => (id, summary)
}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "scala, filter"
}
|
Use if statement update table
I am trying to use this command to update `saving.balance` using IF statement:
UPDATE TABLE saving s, time t
SET s.balance = IF(t.currency_TYPE = ‘RMB’, s.balance + t.balance * t.interest)
WHERE t.ID = 'input'
AND s.User = t.User;
However, MySQL gives me `ERROR 1064`, what's wrong and how to correct it?
|
you forgot the 3th argument in your the IF function and other syntax stuff :-)
why you make you script not with where? like this:
UPDATE saving s
INNER JOIN time t
ON t.ID = 'input'
AND t.User = s.User
SET s.balance = s.balance + t.balance * t.interest
WHERE t.currency_TYPE = 'RMB';
you will update just records with currency_type rmb!
OR
UPDATE saving s
INNER JOIN time t
ON t.ID = 'input'
AND t.User = s.User
SET s.balance = (t.currency_TYPE = 'RMB', s.balance + t.balance * t.interest, 0);
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "mysql"
}
|
Ipad image size and resolutions?
Hi which are the image size and resolutions needed for an ipad, iphone retina and non retina launch icons and tab navigation icons? is there a guide of icons size and resolution???
|
I found a web site that looks useful: iOS Resolution Quick Reference
There is also this comprehensive table in the Human Interface Guidelines.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ios, iphone, ipad"
}
|
Solutions to $\frac1{\lfloor x\rfloor}+\frac1{\lfloor 2x\rfloor}=\{x\}+\frac13$
> Find all solutions to $$\dfrac{1}{\lfloor x\rfloor}+\dfrac{1}{\lfloor 2x\rfloor}=\\{x\\}+\dfrac{1}{3}$$
$$$$ Unfortunately I have no idea as to how to go about this. On rearranging, I got $$3\lfloor 2x\rfloor = 3\lfloor x\rfloor\\{x\\}-2\lfloor x\rfloor$$ I'm not sure about what to do with the $3\lfloor 2x\rfloor $ term; I'd prefer to resolve it in terms of $\lfloor x\rfloor $ but am not able to. All that struck me was using the identity for $\lfloor nx\rfloor, n\in \Bbb Z$. However on first glance, it did not strike me as particularly useful.$$$$ I would be grateful for any help. Many thanks!
|
$$\dfrac{1}{\lfloor x\rfloor}+\dfrac{1}{\lfloor 2x\rfloor}=\\{x\\}+\dfrac{1}{3}\tag1$$
We have $\lfloor x\rfloor$ and $\lfloor 2x\rfloor$, so one way is to separate it into two cases :
Case 1 : $x=n+\alpha$ where $n\not=0\in\mathbb Z,0\le\alpha\lt 1/2$
Case 2 : $x=n+\alpha$ where $n\not=0\in\mathbb Z,1/2\le\alpha\lt 1$
For case 1, $$\begin{align}(1)&\implies \frac 1n+\frac{1}{2n}=\alpha+\frac 13\\\&\implies \alpha=\frac{9-2n}{6n}\\\&\implies0\le \frac{9-2n}{6n}\lt \frac 12\\\&\implies (n,\alpha)=(2,5/12),(3,1/6),(4,1/24)\end{align}$$
I think that you can do for case 2 similarly.
|
stackexchange-math
|
{
"answer_score": 9,
"question_score": 8,
"tags": "calculus, number theory, functions, ceiling and floor functions"
}
|
Microsoft Graph set unified group default notebook
I have a scenario where I'm trying to provision a group and pre-populate the one note with template pages. Doing posts to ` and subsequent endpoints I'm able to create everything.
However whenever the user goes to outlook, and clicks on the `OneNotes` button, it creates a brand new notebook which is empty.
The question is: **how can I set my notebook to be the default of the group?**
Thanks!  which can range from a couple of milliseconds to minutes so **your code should plan for that** as well.
Finally, after being created, **the notebook can take additional time to appear in the UI** (like when adding a tab in Microsoft Teams)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "microsoft graph api"
}
|
SharePoint 2013 and SQL Server 2012 Service Pack 3
Our DBA wants to apply Service Pack 3 on SQL Server 2012, has anyone installed SQL Server 2012 SP3 on a SharePoint 2013 farm?
Any catch outs?
Any articles that show it is supported?
|
As per the requirement, SharePoint 2013 with SP1 is fully supported with Sql Server 2012 SP3.
If you are using the PowerPivot then this SP will give you more flexibility.
If you apply upgrade in a planned way then no issue at all.
* Schedule the Downtime for you SharePoint
* Start from lower farm and test it.
* Perform a full backup of you SQL database( in case of corruption you can recover it)
* I would stop the SharePoint during the SQL upgrade process( to avoid any connection to SQL from SharePoint which cause corruption.). When i did last year we shut down the SharePoint for couple of hours.
|
stackexchange-sharepoint
|
{
"answer_score": 1,
"question_score": 0,
"tags": "2013, sharepoint server, sql server 2012, service pack"
}
|
For loop with if statement
I'm a MATLAB user and only just new to R, I've created a for loop with an if statement included. The variable "score10" is a set of random numbers between 0 to 10. group is the empty set group <\- c(). Essentially i want to dicotamise the scores. When I run the code below the variable group gives me a 1 then a series of NA and a 0 at the 1279th entry. Where am I going wrong? Thanks in advance
group <- c()
for(i in 1:1279) {
if (score10[i] <= 4) {
group[i] = 0
} else {
group[i] = 1
}
}
|
Building on Ananda Mahto's answer, you can also use `ifelse` for this.
> score <-sample(10, 20, TRUE)
> score
## [1] 10 4 6 3 9 8 1 5 1 10 9 5 2 6 10 2 7 10 5 9
> ifelse(score <= 4, 0, 1)
## [1] 1 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "r"
}
|
Is there a common convension to put new methods(on top or on bottom)?
If we omit visibility modifiers(let's say all methods are public), is there any common convension to put new methods in class? I mean if I put them on bottom it's logically correct, because methods are sorted by date. If I put them on top, it's easy to see and compare what methods are added if the class is very long.
|
Just depends on what you and your team are comfortable with. I usually have method at the top of my class followed by fields. If there are many method that do different thing you are better off organizing them in a new class. Now without seeing any code I'm simply guessing.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "coding style"
}
|
profile name not valid when creating SQL server 2014 availability group
I tried creating an availability group but keep encountering this error during the validation checks
> Create failed for Database 'HADR Seeding Test 2d074a6f-c035-4046-ae4e-045436ca56c5'.
>
> An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
>
> profile name is not valid (Microsoft SQL Server, Error: 14607)
|
As @Nic rightly suggested, the secondary replica had a trigger to send emails on CREATE DATABASE statements which was set to use an incorrect profile name. I corrected that and validation checks completed successfully.
|
stackexchange-dba
|
{
"answer_score": 1,
"question_score": 1,
"tags": "sql server, sql server 2014, availability groups"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.