INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Where are Multiplayer Profiles Stored?
Are multiplayer profiles stored locally with my gamer tag on my console? Or are they stored on the games host server?
For example if I recovered my gamer tag on another console to play Crysis 2 or Halo will I have to start from scratch again or will my multiplayer profile be transferred over?
|
This is completely dependent on the game.
For popular games developed primarily for multiplayer it will almost always be stored on the server for both convenience and security. Examples being Call of Duty and Halo which store ranking server side.
For games that share a leveling system between online multiplayer and system-link, split-screen, or singleplayer it will be stored on the console and you will need to transfer the save game data between consoles using a memory card. Example being Red Dead Redemption which shares online multiplayer leveling with system-link (you can even go into it alone without an internet connection or a second console but it is separate from singleplayer).
|
stackexchange-gaming
|
{
"answer_score": 1,
"question_score": 0,
"tags": "xbox 360, xbox live"
}
|
Apache/Tomcat Redirect
We have a Tomcat application from a vendor running with Apache in front of it, but we don't have access to the application code. We have our own single sign on wrapped around the application, so if a user clicks "Log Out" in the application, the user is taken to an unused "Login" screen. We would like to redirect that Login screen to the default Tomcat page, but I can't seem to get the syntax right.
I've tried a number of adjustments with no luck (escaping the /'s, etc). Does anyone have any ideas? I already have an HTTP to HTTPS redirect working (included in the directives below).
The "Logout" link goes through a few redirects, ultimately ending on: <
To keep things simple, we'd like to redirect _any_ request for the login page to: <
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^(.*)$ [R=301,L]
RewriteRule ^/abc/login$ / [L]
</VirtualHost>
|
Figured it out - turns out I was including the redirect directives under the wrong VirtualHost declaration.
In the example above, we have the redirect rule directly following the port 80 virtual host, whose only purpose is to redirect users to HTTPS. Our second rewrite rule would never be run once the user was over on VirtualHost *443.
Copying the above rewrite rule into our *443 declaration worked immediately.
|
stackexchange-serverfault
|
{
"answer_score": 1,
"question_score": 1,
"tags": "apache 2.2, tomcat, mod rewrite, redirect"
}
|
$G$ soluble and Unique minimal normal subgroup
Let $G$ be a soluble group and $N$ is only minimal normal subgroup of $G$. Is this $N=C_{G}(N)$ true?
|
By The Fitting subgroup centralizes minimal normal subgroups in finite groups we know this is generally wrong, since $C_G(N) \geq \operatorname{Fit}(N)$.
In particular, every non-simple $p$-group gives a counterexample, since a minimal normal subgroup is contained in the center, and so its centralizer is the whole group. For example, if $N=2\mathbb{Z}/4\mathbb{Z} \unlhd G = \mathbb{Z}/4\mathbb{Z}$, then $N$ is minimal normal but $C_G(N)=G$ is bigger than $N$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 2,
"tags": "group theory, finite groups"
}
|
First-order model checking on general graphs is intractable
I read that the first-order model checking problem is intractable on general graphs.
How is this shown? Would be happy about some reference!
Thanks in advance
|
You can represent classical NP-complete problems as model checking of first-order formulas in the language of graphs, for example subgraph isomorphism, dominating set, clique, vertex cover, and so on.
|
stackexchange-cs
|
{
"answer_score": 0,
"question_score": 1,
"tags": "graphs, model checking, parameterized complexity"
}
|
How to track down app name for query in query plan cache?
I found a query in the plan cache that needs parameterizing. Not sure which app created this query. Is there a good way in SQL to track down the app that put a given query in cache?
sql2014
|
No, information about what sent the query to the server (user, application, IP, etc.) isn't stored in the plan cache or Query Store, or associated views.
You can catch that information while a query is running using sp_WhoIsActive, or logging it to a table.
If you have a good monitoring tool, it may have gathered that information. If you have a bad one, it probably didn't.
|
stackexchange-dba
|
{
"answer_score": 4,
"question_score": 1,
"tags": "sql server, sql server 2014, plan cache"
}
|
Operation with the same result every time
I'm trying to do this operation
`y = (float) ((-1/1300)*(xsec))+40;`
where xsec is x to the second.
With this function `double xsec = Math.pow((double)x, 2.0);`
and after customized float in this way `xsec = (float) xsec;` and y is float.
So when i do the first operation the result is every time 40.0! I checked that xsec change, but even if xsec change the result is the same, 40.0! I suppose that 1/1300 is an operation with too many decimal digits.
How can this happen?
|
-1/1300 produces 0 under integer division. Use -1.0/1300.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 0,
"tags": "java, android"
}
|
Solution of the differential equation $\ddot{x}=e^{-x}$
I would like to know how to get the solution of the following differential equation:
$$\frac{d^2x}{dt^2}(t)=e^{-x(t)}$$
A differential equation of similar form appears in a paper (Rapp & Kassal 1968) that I'm studying. The authors show us its solution (it involves an hyperbolic secant function), but don't tell us how did they get it. So, at least I know that this differential equation has an analytical solution.
|
We have $$\ddot x=e^{-x}\\\\\dot x\ddot x=\dot x e^{-x}$$Integrate both sides with respect to $t$.
$$\frac12 \dot x^2=C_1-e^{-x}\\\\\int\frac{\mathrm dx}{\sqrt{2(C_1-e^{-x})}}=\int\mathrm dt$$ This can then be integrated using the substitution $u=e^{-x}$.
**Edit:** On second thoughts, the substitution $u=\sqrt{C_1-e^{-x}}$ works pretty well, giving $$\frac1{\sqrt2}\int\frac{\mathrm du}{C_1-u^2}=\frac1{\sqrt{2C_1}}\tanh^{-1}\left(\frac{u}{\sqrt{C_1}}\right)=\frac1{\sqrt{2C_1}}\tanh^{-1}\left({\sqrt{1-\frac{1}{C_1e^x}}}\right)$$
|
stackexchange-math
|
{
"answer_score": 10,
"question_score": 2,
"tags": "ordinary differential equations"
}
|
Как построить распределенную БД MySQL с автономной работой узлов?
Дано: 3 сервера MySQL в 3 разных городах. Нужно настроить синхронизацию данных между ними (мультимастер). Но при этом, при отключении узла от сети он должен продолжать работать для локальных клиентов на чтение и запись, а после появления связи синхронизироваться с остальными. Каким может быть решение в подобном случае и есть ли оно?
|
Нашел решение для асинхронной репликации - < Symmetric DS позволяет настроить репликацию таким образом, чтобы при потере связи узлы работали автономно, а при появлении - синхронизировались. Возможные конфликты ключей нужно разруливать самостоятельно (например, offset'ами)
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "mysql, база данных, кластер"
}
|
How to prevent birds from entering a dryer vent?
Both of my neighbors have had issues with birds nesting in the vents in each of their houses. Securing the bathroom exhaust vents against birds seems straightforward to me: simply replace the vent hood with one that has a mesh around it (something like this).
However, this seems like the wrong thing to use with a dryer vent. I'm concerned about lint getting caught up in the mesh of the vent, ultimately causing the ventilation of said vent to be lowered dramatically.
Are there any clever means of securing a dryer vent against nesting birds, while keeping it relatively open to allow small bits of lint to escape? My dryer vent is unfortunately on the second floor of my house, making my job that much more difficult.
|
I have installed a vent screen that looks almost exactly like the one you linked to. Mine had a plastic frame piece that screwed to the wall around the vent assembly. Then the screen part just snaps onto the sides of the frame with a snap.
It can be easily removed for cleaning out accumulated lint by inserting a flat blade screw driver into a notch on either side.
Yes the screen does catch some lint but I have rarely had to clean it more than once in 4 to 6 months. It really does depend upon several factors as to how often cleaning is required.
1. How often you run a load of laundry through the dryer
2. What types of things are being dryed
3. Whether you have a good lint screen in the dryer
4. Whether you make sure to clean the dryer screen each load
5. If there is any possible lint that falls off the dryer screen into the dryer innards whenever you pull it out for cleaning.
|
stackexchange-diy
|
{
"answer_score": 3,
"question_score": 2,
"tags": "vent, exhaust vent"
}
|
Remove specific criteria from Varien_Db_Select join
I have `Varien_Db_Select` object with some joins and I need to change condition in one of them. How can I do this?
update: I found that condition in "from" part and then in "joinCondition" part. I can loop through, but I can't put them back
|
So this is what I came up with:
$fromAndJoins = $select->getPart(Zend_Db_Select::FROM);
foreach($fromAndJoins as $key=>$joins){
if(strpos($joins['joinCondition'],$attribute->getAttributeCode().'_idx.attribute_id')!==false){
$newcondition = //change $joins['joinCondition'] as you want
$fromAndJoins[$key]['joinCondition']=$newcondition;
}
}
$select->reset(Zend_Db_Select::FROM);
$select->setPart(Zend_Db_Select::FROM,$fromAndJoins);
|
stackexchange-magento
|
{
"answer_score": 8,
"question_score": 4,
"tags": "magento 1.9, database, ce 1.9.1.0, varien, select"
}
|
iPhone Settings app and keyboard control?
So I'm putting my app's preference settings into the Settings app. One of the settings is an edit text field (PSTextFieldSpecifier). When touched, the keyboard dutifully appears, I can make the edits, but when I press Return....nothing. Well, the editing is completed, but the keyboard remains. I see no way to make the keyboard go away.
I also notice this same behavior in other Settings panes, including those from Apple. Do I assume correctly that this is just standard behavior and I need to just accept the fact that my Settings table has now been reduced to half size, and just deal?
Furthermore, I gather there is no approved way to have a "rich" child pane display, such as that seen in Settings->General->About->Legal? Or a way to do what appears to be a -presentModalViewController, a la Settings->General->Passcode Lock?
|
Unfortunately you have to deal with it. And there's nothing you can do in code, at least for now.
That's a bug that hasn't been fixed for a while. You should fill out a bug report.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "iphone, cocoa touch, settings"
}
|
Как бороться с одновременными запросами?
К примеру есть код:
$q = $db->query("SELECT ...");
$n = $db->num($q);
if($n >= 1) {
$db->insert("...");
}
Если послать к примеру 8 одновременных запросов, то условие $n >= 1 игнорируется и плодиться много данных(insert). Слышал, что можно исправить какими-то защитами от ddos на nginx, но этот геморой мне не подходит, учитывая то, что у меня ещё сайт на хостинге.
Можно ли как-то другими способами решить? Пробывал ставить и проверять куки, но всё равно, всё обходится.
Тип таблиц - **MyISAM**
|
@Yura Ivanov, Я решил этот вопрос созданием поля в таблице с уникальным ключем.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "mysql"
}
|
Inkscape encountered an internal error and will close now
I am using Loki 0.4.1. Whenever I am opening svg file, I am getting this error and Inkscape is crashing
.
What exactly is affected by choosing a pair of characters with this icon? Also, is it possible to change these relationships through the course of game?
|
According to this wiki, it merely indicates which characters have a good relationship, triggering duo-specific lines during battles:
> Character quotes between the two characters will change in battle based on their affinity rating and relationship with one another in this entry's canon; these traits are distinguished by the face icon present over each character's portrait during selection.
It isn't clear whether it changes anything else, though it may give an initial hint as to which duo is likely to have duo-specific objectives. This hint, though, pales in comparison to simply checking out the objectives list after a single attempt.
|
stackexchange-gaming
|
{
"answer_score": 1,
"question_score": 3,
"tags": "samurai warriors 4"
}
|
How to convert UIColor RGB Color to uint32_t Value
How to convert UIColor object to uint32_t value. Please let me know if any one aware of this?
Here is the code:
const CGFloat *components = CGColorGetComponents([UIColor redColor].CGColor);
CGFloat r = components[0];
CGFloat g = components[1];
CGFloat b = components[2];
const uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b);
How to pass 0xFFFFFFFF value in uint32_t?
const uint32_t white = 0xFFFFFFFF, black = 0xFF000000, transp = 0x00FFFFFF;
|
If you want to convert hex-string to integer value, you should try this:
unsigned int outVal;
NSScanner* scanner = [NSScanner scannerWithString:@"0xFF000000"];
[scanner scanHexInt:&outVal];
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "ios, uicolor, uint32 t"
}
|
Why PayPal redirects to home page instead of payment page?
I got a huge problem with my PayPal e-commerce payment system. The users cannot proceed to payment, because they are redirected to the PayPal home page instead of the payment page.
I can reproduce the problem easily, by typing the payment url twice in the browser, for instance this one (valide for 3 hours)
The first time, the payment page can appears, and the second time it will be the home page. The home page can appears the first time too. It looks like random.
Does someone know something about that problem?
 in the URL to a question mark (`?`) -- so that it's ` instead.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "paypal, paypal adaptive payments"
}
|
Update query using JPA and Google App Engine
I'm trying to update my entity class, but I am getting :
javax.persistence.PersistenceException: Only select and delete statements are supported.
this exact code worked fine when i wasn't using Google app engine. My code is:
em.getTransaction().begin();
Query query =
em.createQuery("UPDATE Profile p" +
"SET p.age = 1 " +
"WHERE p.email = :email" );
query.setParameter("newPoint", point);
query.setParameter("email", email);
int updateCount = query.executeUpdate();
em.getTransaction().commit();
So I'm asking how can I update the entity query?
|
Since the GAE datastore doesn't support a query that updates fields in the datastore directly, then you similarly cannot do that via the JPA API. Since JPA was never designed for other types of datastores then you will see features that are inapplicable.
Retrieve the objects via query, and update them manually.
When GAE provides full map-reduce out-of-the-box then something like that would be viable to support
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "google app engine, jpa"
}
|
Doctrine 2 DQL CASE WHEN in Count
I have this Query in native MySQL Code
SELECT *
FROM `turn`
LEFT JOIN (
poi
) ON ( turn.id = poi.turn_id )
GROUP BY turn.id
ORDER BY count( case when poi.image = 1 then 1 else null end) DESC;
I need to rebuild this in Doctrine 2 DQL
My attempt so far is this:
SELECT t, COUNT((CASE WHEN Bundle\Entity\Poi p.image = 1 then 1 ELSE NULL END)) AS num
FROM Bundle\Entity\Turn t
JOIN t.pois p
GROUP BY t.id
ORDER BY num DESC
And im getting this error:
`An exception has been thrown during the rendering of a template ("[Syntax Error] line 0, col 99: Error: Expected end of string, got '.'") in Bundle:Admin:showTurnsFiltered.html.twig at line 75.`
What am i doing wrong?
|
I found it by myself after hours of trying and searching, it's working with this `DQL`:
$dql = 'SELECT t,
SUM(CASE WHEN p.image = 1 THEN 1 ELSE 0 END) AS numImage
FROM Bundle\Entity\Turn t
JOIN t.pois p
GROUP BY t.id
ORDER BY numImage DESC';
Important that you need to use `SUM` instead of `COUNT`
|
stackexchange-stackoverflow
|
{
"answer_score": 19,
"question_score": 12,
"tags": "mysql, symfony, doctrine orm, dql"
}
|
Разделить массив с объектами на несколько
От БД получаю массив с объектами.
Каждый объект в массиве имеет ключ `id` и `groupwith`, `id` \- это порядковый номер, `groupwith` \- это номер `id` с которым текущий элемент нужно сгруппировать.
Eсли `groupwith == 0`, группировать не нужно, просто перенести в массив с не группируемыми значениями.
Необходимо разделить данный массив на `n` массивов, в котором `n` \- это число уникальных массивов с одинаковым `groupwith`.
Или все массивы в массив с различными ключами.
|
Возможно, Вы имели ввиду это?
let db = [{id: 1, groupwith: 2}, {id: 2, groupwith: 2}, {id: 3, groupwith: 4}, {id: 4, groupwith: 2}, {id: 5, groupwith: 0}, {id: 6, groupwith: 2}, {id: 7, groupwith: 4}];
console.info(Object.values(db.reduce((acc, c) => (c.groupwith in acc ? acc[c.groupwith].push(c) : acc[c.groupwith] = [c], acc), {})));
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript"
}
|
VS2015 using the Nightlies
I have VS2015RC. I was looking to plug it into the nightly nuget feed. If i configure the normal way i don't get the intellisense from the nightly feed in project.json
i.e Nuget Package manager Settings !Nuget Package manager Settings
Also in the "Nuget Package Manager for Solution" if I change the package source to nightlies, nothing is listed, and it doesn't seem possible to check the "include prerelease" checkbox.
Are there any docs to show how to use the Nightlies with ASP.Net5 ?
|
The feed link you are setting is incorrect. The correct one is: `
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net, asp.net core, visual studio 2015"
}
|
Iterador Java | Incrementar dentro de uma sentinela
public void actionPerformed(ActionEvent e) {
i++;
ImageIcon icon = new ImageIcon(files[i].getAbsolutePath());
imagem.setIcon(icon);
frame.add(imagem, BorderLayout.CENTER);
}
});
Tenho um array de imagens, e o objetivo é sempre que carregar no botão (evento), o iterador i incrementa o seu valor em uma unidade e mudo de imagem.
Mas quando chego ao final do array (quando não existir imagens), ele dá me erro e bloqueia o programa. Sei que tenho de fazer um if(files.lenght) mas não sei bem onde o meter. Alguém me pode ajudar? Obrigado
|
Apenas verifique se o indíce existe antes de tentar acessá-lo.
public void actionPerformed(ActionEvent e) {
i++;
if(i < files.length()){
ImageIcon icon = new ImageIcon(files[i].getAbsolutePath());
imagem.setIcon(icon);
frame.add(imagem, BorderLayout.CENTER);
} else {
//fazer alguma coisa
}
}});
Obs.: Não dá pra entender muito bem o que você quer fazer. Isso vai funcionar, mas talvez não devesse ser feito assim, se você der mais detalhes posso melhorar a resposta.
|
stackexchange-pt_stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "java, listener"
}
|
Best way of linking to a page in Django
I managed to create a URL tag for my index. But right now I'm confused how to add links to other pages.
I put this on my **urls.py**
url(r'^$', 'index', name='index'),
The next thing I put this tag into the href:
{% url 'index' %}
But what if I wanted to create a new page and would be linking to it. How would I do it the best way?
|
So next you would extend your `urls.py` to look something like this:
url(r'^$', 'index', name='index'),
url(r'^blog$', 'blog', name='blog'),
Then in your html you can use either one:
<a href="{% url 'index' %}">Home</a>
<a href="{% url 'blog' %}">Blog</a>
You can of course use the template tage `{% url 'index' %}` as many times as you need in any template.
|
stackexchange-stackoverflow
|
{
"answer_score": 31,
"question_score": 16,
"tags": "python, django"
}
|
What changes with Kerberos authentication in IPv6 when everyone has a public IPv6 Address?
How should Kerberos authentication be set up with IPv6?
What implications are there when client devices each use a public, globally routeable IPv6 IP address?
What changes when setup this way instead of using a NAT as was the norm with IPv4?
|
1. The same way as with IPv4, but with AAAA records instead of A records. Use `IP6.ARPA` instead of `in-addr.arpa` if rDNS is part of your setup.
2. If you were port forwarding before, you don't have to do that. If you were relying on a lack of port forwarding to shield your services from the internet, setup a firewall ( iptables / router ACLs ) instead.
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 0,
"tags": "ipv6, kerberos, mitkerberos"
}
|
Composite functions and one to one
I am stuck with a question,
> Let $f: A\rightarrow B$ and $g:B\rightarrow C$ show that if $g\circ f$ is one to one then $f$ is one to one. Can anyone please help me out. I have no idea where to start with and how end it up.
Thanks
|
Suppose $x,y\in A$ such that $f(x)=f(y)$. Then $g(f(x)) = g(f(y))$. But this is the same as $(g\circ f)(x) = (g\circ f)(y)$ and $g\circ f$ being injective $\implies x=y$. This shows that $f$ is injective.
|
stackexchange-math
|
{
"answer_score": 6,
"question_score": 6,
"tags": "functions"
}
|
How to handle space within string in YAML?
I created YAML for CI/CD pipeline but the pipeline because of space in between the parameters name.
Here is the example of the parameters:
override parameters '
-gbna-archive-trigger_properties_Kroger Manual File Archive_parameters_triggeringFile $(Funding_parameters_triggeringFile)
-nesco_archive_trigger_properties_nesco Manual File Archive_parameters_triggeringFile $(Funding_parameters_triggeringFile)
-gh-nesco-competitor-funding_properties_Competitor Funding_parameters_triggeringFile $(Funding_parameters_triggeringFile) '
Note: The template files are ARM templates but I am overriding the parameters in the YAML file.
|
The name of the parameter must be a valid JavaScript identifier. So your parameter name can't contain space. You can replace the space with _ or remove the space. The document about parameter: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "azure devops, yaml, azure resource manager, cicd"
}
|
Log4J copy a log file while application is logging
I have to add a method to a Java application to send to assistance its logs. To send logs I mean to compress and send by email the log folder used by Log4J. Sometimes this method fails due to a file lock, maybe because I want to compress something that log4j is writing. Is there something to unlock that file or stop log4j writing for a few?
Thanks
|
File lock issues will occur if you open some file in write mode though there is lock already hold. Opening the file in read mode only shall be safe. So you can copy the file elsewhere (to memory) and compress it to different location and then post it to helpdesk.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, log4j"
}
|
Is there a automatic solution for the room seperator function?
Currently I am working on a project to transform a BIM file of a building into 3D spaces of rooms. Unfortunately, it is not working out as planned. The doors and windows which are in this IFC file are missing the checkbox "Room Bounding". Because of this I am not able to create rooms for the reason that windows and doors are seen as holes. How do I add the option "Room bounding checkbox" to the Doors and windows?
|
In Revit, doors and windows are hosted by walls and form part of the walls they are hosted by. Therefore, wherever you have a door or window, you also have a wall hosting it, and thus a room separator. So where is the problem?
Anyway, if there is a problem with any of this, you can always add room separator lines in addition to the walls, doors and windows, can't you?
Cf. the Revit online help About Room Separation Lines.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "revit"
}
|
Publish Web Service - Web API 2 on IIS
I want to publish a Web Service created with Web Api 2 MVC5(this is my first time), in IIS 7. Following this tutorial, after doing "Publish..." in Visual Studio for my web service, this is my publish folder: Publish folder image
Then I tried to Add a Web Site in the IIS Express exactly as it is done in the tutorial, and after that when I Browse it, I got a HTTP 403 Error.
Also, I test with Fiddler a POST method and I get 404 `HttpNotFound`.
**Update:** Additionally, I follow step by step this tutorial and when I tried to test the route mapping, I get 404 `HttpNotFound`.
What am I missing? Thanks in advance for any help
|
## Requisites
Also verify that you have installed _HTTP Platform Handler version 1.2_. You can download it here
## Publishing
When publishing your site be sure to point into _wwwroot folder_ (check this post)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "web services, iis 7, asp.net web api2, publish"
}
|
Offset the text wrap of a textarea so text isn't obscured by icon
I'm working on a chat application in HTML. To type a message, the user types in a `<textarea>`. To help indicate the purpose of the textarea and improve usability, there is a button that sends the message on top of the `<textarea>`. However, when the user types a longer message, the text reaches the end of the line and is partially covered up by the icon. Although there are CSS properties that control the behavior of text-wrapping, I can't find anything that would 'offset' the text wrap so that new text would go to a new line once it reached the icon. Is there a CSS property or JS workaround that would accomplish this?
|
`padding-right` seems like the way to go. Something like this?
.wrapper {
position: relative;
display: inline-block;
}
textarea {
padding-right: 20px;
}
button {
position: absolute;
top: 0;
right: 0;
}
<div class="wrapper">
<textarea rows="7" cols="40"></textarea>
<button>B</button>
</div>
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "html, css, textarea, word wrap"
}
|
What's so wrong with my SQL query?
select * from `a2_posts` where `reply_to` = -1 order by `updated_at` desc offset 4;
and I'm getting this message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'offset 4' at line 1
I'm no sql expert but I really cant figure out what's so wrong with offset.
btw this query was generated by the Eloquent ORM, from this code:
Post::whereReplyTo($request->input('reply_to'))
->orderBy('updated_at', 'desc')
->offset(Config::PAGE_SIZE * Config::MAX_PAGES)
->get();
I just punched the resulting query into PHPMyAdmin to check what was going on and thats what I've got
Do you guys know what's wrong? the PHPMyAdmin highlighter didnt even highlight the offset keyword.
Thanks in advance
|
MySQL syntax requires `LIMIT x` before `OFFSET x`.
Syntax:
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
It needs to be something like this:
select * from `a2_posts` where `reply_to` = -1
order by `updated_at` desc
limit 2 offset 4;
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "mysql, sql, laravel, orm, eloquent"
}
|
Кодировка из ansi в utf8 в парсере новостей
Взял исходник и переделал под новости, но после этого вместо русских букв начали отображаться иероглифы, мне посоветовали поменять кодировку из ansi в utf8, но я не знаю как. Вот проект: Проект.
|
вобще есть стандартная функция **AnsiToUTF8** и обратная ей **utf8ToAnsi**
в вашем проекте нужно заменить всего 1 строку
было
...
ProgressBar1.Position:=ProgressBar1.Position+1;
Label1.Caption:=q;
ProgressBar1.Position:=ProgressBar1.Position+1;
...
станет
ProgressBar1.Position:=ProgressBar1.Position+1;
Label1.Caption:=AnsiToUTF8(q);
ProgressBar1.Position:=ProgressBar1.Position+1;
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "кодировка, delphi 7, парсер"
}
|
How to aggregate points with same value into polygons from a shapefile using GDAL or any other opensource solution
I have a shapefile with around 19,000 points. Its basically export from a raster. Now i need to extract polygons, by aggregating the points which have same value.The field who's value i am going to use for aggregation is dynamically calculated each time using the elevation of points. NOw i need to spit out polygons. How can I do that using GDAL? is there a utility to do it. Any other opensource solutions are welcome. I have ArcGIS which has a toolbox called 'Aggregate Points' but somehow licence for it is missing.
|
Here are some possibilities:
You can write a program using GDAL (actually OGR) in C++ or Python (or any other language for which GDAL/OGR provides bindings) and construct Polygon objects from the selection (sub-sets) of your points. Then you can serialise those polygons in to Shapefile or anyother storage supported by OGR.
Alternatively, forget about GDAL/OGR and load your data into PostgreSQL database enabled with PostGIS. Then use PostGIS functionality to construct Polygons
There is example of polygon construction from points based on bruteforce string manipulation and use of geometry constructor posted as postgis-users thread Making a Polygon from Points
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "gis, shapefile, gdal"
}
|
Make a face from a mesh with a hole
How can I create a face for extrusion with a hole inside in edit mode? In my case I want to extrude only the "C" from a mesh marked in blue and not the filled innside part.
. When you have finished with the flat mesh, select all and extrude up (`E`). Is it what you want?
Edit: And oh yes, as Duarte explains, if you have the same amount of vertices on the internal and external edges, you can simply select them and press `W` > _Bridge Edge Loops_. If they don't have the same amount, create enough vertices to make the count equal. You can play with the bridge parameters on the bottom of the Tools panel, on the left of the 3D View.

I am trying to cancel when a process calls wait(), read(), recvfrom() or similar, because if I use ptrace on it, after the PTRACE_ATTACH and later PTRACE_CONT, my tracer becomes blocked until the function in the tracee returns. Also I think it happens the same with sleep().
Would be possible to cancel the call, or reproduce a fake return?
Thanks.
|
Yes, you should send a `PTRACE_INTERRUPT`. This will trigger the syscall to exit.
To do this, you need not to `waitpid` on your tracee, because that would block you (the tracer) too.
You can either have multiple threads: one that will block on the tracee, one that will "decide" to cancel the blocking syscall - e.g. a GUI thread that the user will press "cancel" (like a normal debugger, e.g. GDB).
Or you can use `PTRACE_SYSCALL` to manually diagnose every syscall the program is doing and then decide preemptively if you wish to execute that syscall. This way you can decide to not run `wait` at all, or perhaps mock them by having your return value instead.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "system calls, nonblocking, ptrace"
}
|
How can I multiply elements in one list while providing a range in another
I have two lists that I will later use do determine on how many pages of a document I'm looking at. The first list (l_name) contains the name of the document. The second list (l_depth) contains the number of pages I will look at, always starting from the first one.
The original lists look like this:
l_name = ['Doc_1', 'Doc_2', 'Doc_3']
l_depth = [1, 3, 2]
As I want to use a for loop to indicate each page I will be looking at
for d,p in zip(l_doc, l_page):
open doc(d) on page(p)
do stuff
I need the new lists to look like this:
l_doc = ['Doc_1', 'Doc_2', 'Doc_2', 'Doc_2', 'Doc_3', 'Doc_3']
l_page = [1, 1, 2, 3, 1, 2]
How can I multiply the names (l_name --> l_doc) based on the required depth and provide the range (l_depth --> l_page) also based on the depth?
|
Try this :
l_name = ['Doc_1', 'Doc_2', 'Doc_3']
l_depth = [1, 3, 2]
l_doc = []
for i,j in zip(l_name, l_depth):
l_doc += [i]*j
# ['Doc_1', 'Doc_2', 'Doc_2', 'Doc_2', 'Doc_3', 'Doc_3']
l_page = [k for _,j in zip(l_name, l_depth) for k in range(1,j+1)]
# [1, 1, 2, 3, 1, 2]
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 4,
"tags": "python, list"
}
|
Are Verb 1 and Verb 2 interchangeable? verb1+te verb2 vs. verb2+te verb1
For example, is there a difference between these two sentences?
*
*
|
The short answer is "No".
The te-form has various functions, and in this example, it expresses Verb 2 happens after Verb 1 happens. Swapping them will change the essential meaning of the sentence.
1.
The wind, after night fell, ceased.
2.
Night fell and (then) the wind ceased.
3.
The wind ceased and (then) night fell.
4.
The wind, night, ceased and (then) fell.
Here, Sentences 1 and 2 share the same meaning because the verb order is preserved. However, Sentences 2 and 3 have different meanings. Besides, in your example, corresponds to , and corresponds to . You cannot construct a sentence like Sentence 4, in which a modifier and the modified word do not have a clean _nested_ relationship.
Sometimes the te-form can simply join two verbs in a way the order is not important. For example, "to eat and drink" and "to drink and eat" are usually interchangeable because which to do first is normally unimportant. Such cases are not very common, though.
|
stackexchange-japanese
|
{
"answer_score": 3,
"question_score": 1,
"tags": "verbs, て form"
}
|
Can osgi run multiple instances of the same bundle
What I’m looking to do is to run multiple Clojure environments that start in a pristine mode on the same JVM. It has to be such a way that their namespaces and the generated classes don’t clobber each other.
looking at this question: osgi - multiple instances of a service, I need clarification whether running multiple instances of the same service will solve the namespace clobbering issue.
|
Yes, apparently you can, if starting the framework with the property `org.osgi.framework.bsnversion=multiple`.
I never tried using that, don't know if would work.
If you want **to isolate** the ClassLoaders, it would be better to just **create a child ClassLoader** for each instance.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "osgi, osgi bundle"
}
|
First page with QueryString
How to load index page with QueryString in asp.net? I know that we can redirect to a particular page with QueryString, but what I want is to load first page with some querystring.
|
If you are setting start action in Property pages of your application then you can follow following steps
1) right click on your project in solution explores
2) Go to Property pages
3) Set start action to 'Specific Page' and `value = "index.aspx?a=22"`
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "c#, asp.net, visual studio"
}
|
SSH into multiple remote machines through ssh tunnel
I am new to ssh-tunneling.
Basically I want to be able to get ssh access to servers in a remote lab (say subnet 1.2.3.X).
I can log into a machine that is visible say 11.22.33.44
I want to be able to log into machines in 1.2.3.X subnet through ssh tunneling, but I am not sure what exactly needs to be done.
Logging into the machines through the machine I can already log into is an option, but I have my development files on my local pc. So I wanted to use the ssh-tunneling.
|
Transparent Multi-hop SSH
If i understand your question correctly you're looking for a solution to ssh transparently into your lab server through the machine that's visible from the outside (let's call it gate).
As lbutlr mentioned first thing that comes to mind is to ssh into gate first and from there to ssh into your lab server. This works but it's not very convenient and you can't scp files directly between you and the server.
Much better solution: Check out this article on using ssh's `ProxyCommand` feature. With this you can instruct gate to act as a proxy so you just type `ssh lab_server` and it all works (even scp !).
|
stackexchange-unix
|
{
"answer_score": 3,
"question_score": 3,
"tags": "ssh, ssh tunneling"
}
|
Without page refresh views exposed filters have to work (without AJAX)
I want to create the Gallery like Example gallery link. Taxonomy filed in views exposed filters. Anyone guide to me?
|
You might wanted to check
1. Masonry Views
> This modules defines a masonry grid view style using Masonry API module.
1. Isotope.js
> Isotope.js provides David DeSandro's Isotope jQuery plugin to Drupal as a library. Isotope is a display plugin that comes with several unique layout modes for content, including the ever-popular "masonry" layout. In addition, the plugin also provides several methods for responding to user events like window resizing and real-time sorting/filtering.
Here is a good tutorial on Building a Dynamic Image Display with Drupal & Isotope
|
stackexchange-drupal
|
{
"answer_score": 1,
"question_score": 0,
"tags": "taxonomy terms, views, media"
}
|
Calculating Service Area for each feature in feature class using ArcGIS Network Analyst?
I am trying to implement a python script that creates in a first step a Network Dataset and that in a second step gets a point feature class for which the tool should create for each feature in the feature class a service area. The first step is no problem, but the second...
My first idea was to use the cursors in python which should run through the whole attribute table. For each feature a temporary feature class should be created which should be used as input for the service area.
Is this the right direction or is there an more easy way to calculate for each feature individually a service area?
|
You can use the Make Service Area Layer, Add Locations, Solve, and Save to layer file geoprocessing tools to generate service areas for multiple input features (e.g. a point layer with geocoded addresses). This is analagous to the workflow using the ArcMap GUI described in the Service area analysis help topic.
!enter image description here
!enter image description here
|
stackexchange-gis
|
{
"answer_score": 5,
"question_score": 5,
"tags": "arcgis desktop, python, network analyst"
}
|
How can I update the loadUrl of a WebView from another class
I've create a WebView in the main class of an activity, then I've a new class but I can't modify any property of the webView created in the main class, what are the steps for the proper update?
Thanks.
|
In this situation i would probably create an interface. Then in the class that extends WebView or whatnot, you could call loadUrl from the interface. Then from another class you could call the interface method inside of the class that extends WebView. If you need an example let me know and i can provide one.
More on interfaces:
Oracle Documentation on Interfaces
Oracle Documentation on how to implement intefaces
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "java, android, webview"
}
|
Twilio get international calls for current month
Is there a way to query only international calls from Twilio REST API? <
Right now my best option seems to query all calls and then parse each one of them to get country code and then filter calls where `countryTo != countryFrom`. Any better way?
|
Twilio developer evangelist here.
No, you cannot filter by international calls via the API. Your method of filtering your list yourself is your best bet.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "node.js, twilio, twilio api"
}
|
Change UISearchBar Shap
I used UISearchBar in the project, but I can't change the view of it. I want to set border around the search bar.
Can I change UIsearchbar as the same as this image?
 as! UITextField
// set Search Bar texfield corder radius
txfSearchField.layer.cornerRadius = 8.0
// set Search Bar texfield border colour and width
txfSearchField.layer.borderWidth = 2.0
txfSearchField.layer.borderColor = UIColor.lightGray.cgColor
// set Search Bar tintColor.
Searchbar.barTintColor = UIColor.white
// Change the search bar placeholder text color
let placeholderlabels = txfSearchField.value(forKey: "_placeholderLabel") as! UILabel
placeholderlabels.textColor = UIColor.lightGray
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ios, swift"
}
|
Outlook api choice for c# web application integration?
I am building a c# web application which will interact with Microsoft Outlook. When the user creates a Task in the web application i want it to also create a task in outlook.
The server i am hosting the web application on will not have outlook installed.
Which API should i use to create tasks in the users outlook?
|
If you have an Exchange Server or Office365 connected inbox i suggest the EWS library:
Get started with EWS Managed API client applications
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "c#, outlook"
}
|
Protractor Internet Explorer Slowness
I've been trying to get Internet Explorer 11 to run under Protractor to complete a suite of tests I have for an new AngularJS project.
I'm running under Windows 7 - 64 Bit and have downloaded and installed the Selenium IEDriverServer.exe for 64 Bit.
When I go to launch Protractor and run the scenarios, Internet Explorer comes up and navigates to the page just fine, but when the scenario sends keys to an input field it is extremely slow, like about 15 seconds between each key press. And Selenium is not showing any type of exception being thrown.
Has anyone seen this behavior before and found a solution?
Thanks
|
It's a known bug or "issue" ( _not_ a bug within the IEDriver however):
< (references IE10 but the point & solution is the same fundamentally)
It is explained in the Selenium issue tracker, but the workaround will be to use the 32bit version of the driver. Realistically you don't get "much" from using the explicit 64bit version.
I'd also say you may have further problems with IE11. Selenium doesn't support IE11 fully yet.
< (among other issues)
You are probably, long term, better off downgrading to IE10 and using the 32bit driver.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 6,
"tags": "angularjs, internet explorer, selenium webdriver, protractor"
}
|
Finding sum of coefficients of composite polynomials
Given that
$$f(x) = 5x^2 -3x + 7$$ and
$$f(g(x)) = 40 -11x^2-8x^4$$
find all possible values for the sum of the coefficients in the polynomial function $g(x)$.
Typically when two functions are provided in such an arranged method, it would be common to divide the two to get another function that is multiplied to provide the resulting function, however it to appears not be possible when dealing with composite functions. Moreover, I was under the impression that it would not be possible to have multiple possibilities for coefficients to provide a single resultant polynomial. Thus, if anyone would be able to provide some suggestions as what to do next, you would have my thanks.
|
Remember that if $g(x) = ax^n+...+bx^3+cx^2+dx+e$ then $g(1) =a+...+b+c+d$ is the sum of all coefficients.
Let $t= g(1)$, then we have $$5t^2-3t+7=f(t)= f(g(1))= 40-11-8$$
So we get $$ 5t^2-3t-14 =0$$
Now solve this equation and you will get an answer.
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 0,
"tags": "algebra precalculus, polynomials"
}
|
Most secure but feasible encryption running on WWII technology
Imagine you are _transported_ back to ~1940. What is the best (i.e. most secure, but technologically feasible) encryption you can think of for widespread (i.e. military) use? How would you implement it?
|
I'd suggest SIGABA. I don't know about the original poster's knowledge, but my knowledge includes the demonstrated fact that one person, working alone, is highly likely to overlook attacks and produce a weak cipher. So if I'm the only one going back in time, I'm going to pick a well-proven system rather than anything I invent myself.
If I could bring a large team back, making it possible to properly test a new system, I'd be sure to bring electronics experts with me who know how to test the signal coming out of the machine for artifacts emitted by the machine which can be used to break the cipher. (These artifacts would not be part of the mathematical description of the cipher, but would be emitted nonetheless.)
|
stackexchange-crypto
|
{
"answer_score": 2,
"question_score": 3,
"tags": "classical cipher, cryptographic hardware, history"
}
|
How to connect Eris to different accounts to start a chain?
I wanted to start a blockchain on my computer. For this, I am using Eris. I activated different accounts like root, validator, and participant account using `eris chains start <ChainName> --init-dir <DIR> --publish` this created different accounts on different ports on my machine. But now I have no idea how to connect them so that the chain is running and creating blocks. I thought of using `eris chains ls -a` to get the mapped ports but then what next?
|
To connect the chains, you need to fill in the `seeds` field in the `config.toml` file. That field takes a string and the format of the field should be: `seedIP1:seedPort1,seedIP2:seedPort2`. So if you had three validators running on standard ports with the IPs of `111.111.111.111`, `222.222.222.222` and `333.333.333.333` then your seeds field would look like this:
`seeds = "111.111.111.111:46656,222.222.222.222:46656,333.333.333.333:46656"`
One gotcha is to not have spaces within the string field.
|
stackexchange-ethereum
|
{
"answer_score": 2,
"question_score": 2,
"tags": "blockchain, contract deployment, eris industries"
}
|
Wrapping an h264 stream with ts (transport stream)
Suppose I have an incoming stream of H264 data wrapped in RTP. After I strip the RTP header, how can I re-wrap it into a TS header (transport stream) for playing on the web browser? I know Ffmpeg can do it, but am not on a windows or linux platform. So I need to manually do it. I would need a simple library in c or c++.
|
I'd give < a try. There are a number of sample applications that are similar to your needs. Check out testH264VideoToTransportStream.
Note: There may be more to it than swapping headers. Sometimes SPS/PPS (metadata) are not repeated in the H.264 stream. So you have harvest SPS/PPS through RTSP and then inject SPS/SPS into the MPEG-2 transport stream.
Live555 builds on a large variety of platform but if you are bare metal you may have to do some code adjustments.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "ffmpeg, h.264"
}
|
Trouble with docker pull in ec2 instance
I've successfully pushed a Docker image to Amazon ECR. From my EC2 instance, I can see that image too. Now, I would like to pull that image. I did the following and the output is:
$ docker pull my_ecr_account_id/my_ecr_repository
Using default tag: latest
Pulling repository my_ecr_account_id/my_ecr_repository
unauthorized: authentication required
Prior to running `docker pull` command, I've logged in from the output of this command:
aws ecr get-login --region us-east-1
|
The issue seems to be with Docker version. I realize the version wa about 6 months old. After updating the Docker to the latest (17.03.1-ce), it started working fine.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "amazon web services, docker, amazon ec2, amazon ecs"
}
|
How to add bottom padding in span
Got a link that got a span, inside that span I will from jquery add a number of news. But I want it to be smaller and with a bit of padding so it looks like a notification on a app?
This is the code I got:
<a id="menyNavOptions" href="nyheter.php" >Nyheter<span style="margin-bottom: 30px; font-size: 0.8em;font-weight:bolder ; color: #ff0000!important; line-height:0.3em;" id="outPost"></span></a>
So the look I am going for is a Link with a number on the top right corner
Thanks
|
`display:block` won't help, because it will have the full width (100%). Use `display:inline-block;`
<
But I'm not sure if Padding bottom will do what you want.
**I think you want to do this:
** <
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "javascript, jquery, css, html"
}
|
Angular expansion panel click anywhere on expanded mode, invokes mat-expansion click event
I am facing problem with mat expansion panel. See stackblitz
<
I added a console log for click of Section 2.
Steps: Click On section 2 to expand and click on the paragraph text, the click event gets invoked. we can see this in console logs This is a big problem for me, as my real time applications hits DB
Question: How to stop this unwanted triggering of event.
|
Instead of listen on `click` event, you can listen to `opened` and `closed` events.
<mat-expansion-panel #panel2 [hideToggle]="hideToggle" [disabled]="disabled" (opened)="print($event);" (closed)="print($event);">
In this way you can avoid click event to be triggered from panel's children elements.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "angular, angular material"
}
|
Grouping with Nulls T-SQL
I have this problem with a SQL query (SQL Server 2008)
SELECT id, client, SUM(debt), date
FROM Table GROUP BY id, client, date
Returned from the query is
id client debt date
1 jim x 500 05/05/2012
2 jack a 900 06/06/2012
2 jack a 500 null
Is there a way to add in this scenario Jack a's debt (1400) and display the non null date i.e. 06/06/2012.
A person can only have 2 records max and 1 record is always date null so is there a way to do the sum and use the date that is not null?
Thanks
|
To group by client you have to remove `id` and `date` from your GROUP BY:
SELECT
MAX(id) AS newest_id, -- or MIN(id) if you prefer
client,
SUM(debt) AS total_debt,
MAX(date) AS most_recent -- or MIN(date) if you prefer
FROM YourTable
GROUP BY client
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "sql server 2008, tsql, grouping"
}
|
Using Python to Automatically Login to a Website with a JavaScript Form
I'm attempting to write a particular script that logs into a website. This specific website contains a Javascript form so I had little to no luck by making use of "mechanize".
I'm curious if there exist other solutions that I may be unaware of that would help me in my situation. If this particular question or some related variant has been asked here before, please excuse me, and I would prefer the link to this particular query. Otherwise, what are some common techniques/approaches for dealing with this issue?
Thanks.
|
I've recently been using PhantomJS for this kind of work - it's a command-line tool that allows you to run Javascript in a browser environment (based on Webkit). This allows you to do scraping and online interactions that require Javascript-enabled interfaces. There's a Python-based implementation here that's fully compatible with the API of the C++ version, or you could run either version in Python via `subprocess`.
Depending on what you're trying to do, another good option might be to use Selenium, which has client driver implementation in Python - it's meant for integration testing, but can do a lot of automation as long as you're okay running the Java-based Selenium Server and having the automation happen in an open browser rather than as a background process.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, python, mechanize"
}
|
Error unknown time zone America/Los_Angeles in time.LoadLocation
even through CoreOS shows America/Los_Angeles when timedatectl list-timezones, why does Docker throw error **unknown time zone America/Los_Angeles** ?
Is there something else need to be done when LoadLocation called running inside a container or anything that can be added to Docker file so it can point to zoneinfo ?
from godoc
> The time zone database needed by LoadLocation may not be present on all systems, especially non-Unix systems. LoadLocation looks in the directory or uncompressed zip file named by the ZONEINFO environment variable, if any, then looks in known installation locations on Unix systems, and finally looks in $GOROOT/lib/time/zoneinfo.zip.
|
For anyone looking for an answer, this helped me.
adding these two line to docker file , (final if it's a 2 stage build)
ADD /zoneinfo.zip
ENV ZONEINFO /zoneinfo.zip
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 6,
"tags": "docker, go, time, dockerfile"
}
|
Does a Scanned Map have to be georeferenced in the projection of the original Source?
I have a historic paper map for the Indian Sub-continent which has been scanned. The Map is in Albers Equal Area Conical projection, and has the latitude and longitude grid on it.
I was trying to georeference in the projection of the source, but I do not have all the required parameters for this projection. Only the two standard parallels are noted on the map. I don't know the Central Meridian or the Latitude of origin, or the datum for that matter.
What should be done in this kind of situation? Since this is a map which spans 4000km by 4000km, I don't really think it is possible to get any kind of high accuracy output. I was thinking of georeferencing it in wgs84 Geographic coordinate system.
Is this a good idea? Or is there something else which you would suggest?
|
When viewing anything in a geographic coordinate system in GIS software, **it is not unprojected**. It still has to be displayed on your 2-dimensional computer screen. Usually this uses a latitude/longitude grid in a type of equirectangular projection known as plate carrée. This would produce a very strange result in your georeferencing, since your source map is a conic projection and the GIS software would be a cylindrical projection.
I would recommend making your best guess of the projection parameters. There's an Albers projection for India on SpatialReference.org that has some parameters you might want to try.
|
stackexchange-gis
|
{
"answer_score": 4,
"question_score": 10,
"tags": "georeferencing"
}
|
Java Sort with Comparable
I have an `ArrayList` of `Person` objects. A `Person` has `name`, `age` and `height`. My goal is to sort this `ArrayList<Person>`. I have implemented `Comparable<Person>` and have defined `compareTo()` but when I try to sort it, it give me this error:
> The method sort(Comparator) in the type ArrayList is not applicable for the argument ()"
The way I understand is that if you implement Comparable and then define `compareTo` everything else is magically done for you.
Can some one explain how to this works and why I am getting this error?
|
Either you use a structure which uses the `Comparable` interface to order its elements when you add a new element inside it :
TreeSet<Person> persons = new TreeSet<>();
Person personOne = ...
Person personTwo = ...
persons.add(personOne);
persons.add(personTwo);
Either you use a `List` and the `Collections.sort(List<T> list)` method which takes as argument the list you want to sort (there is an overload of this method but it is not relevant in your case):
List<Person> persons = new ArrayList<>();
Person personOne = ...
Person personTwo = ...
persons.add(personOne);
persons.add(personTwo);
Collections.sort(persons);
With the `TreeSet`, the elements are sorted as soon as added and with the `List`, the elements are not sorted when you add them.
Only, the call to the `Collections.sort()` method sorts the list.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 5,
"tags": "java, inheritance, arraylist, comparable"
}
|
Copy only files between two times
I'm trying to copy pictures taken between two times, from one directory to another.
I’ve managed to list them using this command `find /mnt -type f -name "*.jpg" -newermt "2014-12-14 01:00:00" ! -newermt "2014-12-14 02:00:00"`
But when I added `-exec cp -pf {} /home/pi/box/pictures/ \;` to the end, my system locked up;
e.g. `find /mnt -type f -name "*.jpg" -newermt "2014-12-14 01:00:00" ! -newermt "2014-12-14 02:00:00 -exec cp -pf {} /home/pi/box/pictures/ \;"`
What have I done wrong?
|
You put the `-exec` between the quotes that were around the end time, that is not what you want. You should do:
`find /mnt -type f -name "*.jpg" -newermt "2014-12-14 01:00:00" ! -newermt "2014-12-14 02:00:00" -exec cp -pf {} /home/pi/box/pictures/ \;`
(all on one line)
|
stackexchange-unix
|
{
"answer_score": 2,
"question_score": 1,
"tags": "find"
}
|
Why can't I display attachment_image_src with Custom Size?
I'm trying to display an attachment with a custom size that I created with `add_image_size` called "custom-size-01"
What the code returns is the word "Array"
I've looked at the wordpress reference and been trying the `wp_get_attachment_image_src` reference and tried the example code it gives but i haven't been able to make it work.
I haven't figured out what I'm doing wrong and could use any input to show me where I'm making a mistake.
if($imageid){
echo "<img src=\"";
echo wp_get_attachment_image_src( $imageid, 'custom-size-01', false);
echo "\" width=\"100%\" >";
}
|
With wp_get_attachment_image_src you get a array with values corresponding to the (0) url, (1) width, (2) height, and (3) scale of an image attachment (from the wordpress doc).
you code can be:
if($imageid){
$image_attributes = wp_get_attachment_image_src( $imageid, 'custom-size-01', false);
echo "<img src=\"";
echo $image_attributes[0];
echo "\" width=\"100%\" >";
}
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 0,
"tags": "shortcode, images"
}
|
Hyperbolic distance of a point from center in Klein-Beltrami disk model
According to the Wikipedia entry about Klein Beltrami disk, I found that the hyperbolic distance between two points P and Q is determined by the following formula :
$$d(P, Q) = \frac{1}{2} \ln \frac{|AQ||PB|}{|AP||QB|}$$
Where A and B are on the euclidian line $(PQ)$ and on the unit Circle. $|AQ| > |AP|$ and $|PB| > |QB|$
Now, I want to know the hyperbolic distance between O the center of unit disk and a point P.
$$d(O, Q) = \frac{1}{2} \ln \frac{|AQ||OB|}{|AO||QB|}$$ Now I think $|OB| = |AO| = 1$ $$d(O, Q) = \frac{1}{2} \ln \frac{|AQ|}{|QB|}$$ Since A, Q and B are aligned and A et B belong to the unit circle :
$|AB| = |AQ| + |QB| = 2$
and $|AQ| = |AO| + |OQ|$
and $|QB| = |OB| - |OQ|$
Considering $|OQ| = r$ I conclude : $$d(O, Q) = \frac{1}{2} \ln \frac{1+r}{1-r}$$ $$d^{-1}(O, Q) = \frac{e^{2r} - 1}{e^{2r}+1}$$
Am I correct ?
|
All correct (I think I wrote that on wikipedia) $$d(O, Q) = \frac{1}{2} \ln \frac{1+r}{1-r} = \operatorname{artanh} r$$
see also the formulas for tanh and artanh at en.wikipedia.org/wiki/Hyperbolic_function
I have added it to the wikipedia page
ps related:
For the Poincare disk model he hyperbolic distance between O the center of unit disk and a point P an Euclidean distance r away is $d(O, P) = \ln \frac{1+r}{1-r} = 2 \operatorname{artanh} r $.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "metric spaces, hyperbolic geometry"
}
|
Trouble with the sudo dd command
I've been having trouble writing an image to my usb, heres the thing i tried: `/home/josho/Downloads# sudo dd if=antergos-minimal-2016.11.20-x86_64.iso of=dev/sdb bs=1M dd: failed to open 'dev/sdb': No such file or directory `can anyone tell me what's wrong? would be appreciated <3
|
You are missing a / before dev in your command
sudo dd if=antergos-minimal-2016.11.20-x86_64.iso of=/dev/sdb bs=1M
The command you posted tries to write to /home/josho/Downloads/dev/sdb which does not exist.
|
stackexchange-askubuntu
|
{
"answer_score": 5,
"question_score": 0,
"tags": "command line, sudo, iso"
}
|
What counts as a ground move?
When a card boosts damage while on the ground, does this include moves that hover just above the ground such as Ryu's Tatsumaki? Does my feet have to be in contact with the ground to gain the bonus?
|
A ground move is any move that is initiated while standing on the ground (as opposed to an aerial- or air- move, which is initiated, you guessed it, in the air).
|
stackexchange-gaming
|
{
"answer_score": 1,
"question_score": 1,
"tags": "ultimate mvc3"
}
|
If I accept a meeting invitation more than once, will I send an email more than once?
I'm very confused by outlook calendar, to say the least.
I've received an email with an appointment.
I see an info icon in the email, saying "please respond"
And I see the options to accept, reject or postpone the appointment.
However, I don't remember if I've already accepted the appointment. If I click again, will I send out another email?
I tried to click on "send the response now", but the email is still marked with "please respond".
However I do see that in my sent email there is an email sent out with "I have accepted the meeting"
|
Usually after accepting the reply is sent, it's added to your calendar, & the email invite is deleted. If I remember right even opening it in your Deleted Items it won't let you respond a second time
_**\--Edit--**_ I skimmed your question, apologies. If it's already in your sent email then I think Outlook may be glitching so I'd close it & re-open. It's also possible two meeting invites were sent...
|
stackexchange-superuser
|
{
"answer_score": 1,
"question_score": 0,
"tags": "microsoft outlook"
}
|
ByteArrayBody cannot be resolved to a type
I was trying to send byte array image to server
and I used :
MultipartEntity entity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
//Set Data and Content-type header for the image
entity.addPart("file", new ByteArrayBody(ba, "image/jpeg", "file"));
postRequest.setEntity(entity);
and I have this error
"ByteArrayBody cannot be resolved to a type"
and I imported to my project all httpmime, httpclient and httpcore jars !!
I don't know what else to do thanks in advance.
|
If you are using `httpmime 4.0 jar` then it shows error `ByteArrayBody cannot be resolved to a type.`
Need to replace with `httpmime 4.1 or later versions` then it works fine.
`ByteArrayBody` is introduced from `httpmime 4.1.jar onwards`.
for more refer httpmime 4.0 and 4.1
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "java, android"
}
|
Using Google places Api in rails app
I am making a new rails app and I need to use Google places API but I don't know the steps to do that or the best way to use this API. I have tried to search in developers.google.com I found the places API but I couldn't find how to use it in a rails app.
|
You just had to google it. You could have have found tons of stuff. Anyways here are a few gems that could help you
1. Google Places
2. Google Places Autocomplete
3. Gmaps
Also refer this rails cast. It would get you started.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "ruby on rails"
}
|
Do I need to know AspectJ and annotations for Spring Roo?
I have read the Spring books and know the basics about AOP. I want to learn Spring Roo but I don't know AspectJ and annotations.
Do I need to learn those to get started with Spring Roo?
|
You don't have to, as Roo manages all the AspectJ artifacts for you - the generated .aj files. However, knowing the underlying AspectJ concepts will help with what Spring Roo/Spring in general, is doing under the covers - Spring Roo Critical Technologies: AspectJ.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "java, spring roo"
}
|
запустить программу в планировщике от имени администратора
можно ли как то под администратором создать задачу в планировщике, чтобы любой пользователь при входе в windows 7 получал приложение запущенное с правами администратора. Планировщик позволяет создать такую задачу, но на практике не работает.
|
Windows 7 под рукой нет. На Windows 10 это выглядит так:
Имеется учётная запись admin, имеющая права администратора (не встроенный администратор!). Имеется учётная запись test, имеющая права обычного пользователя.
Создаю в папке C:\tmp батч-файл с именем test.bat следующего содержания:
cd /d %ProgramFiles%
md test
copy c:\tmp\test.bat .\test\*.*
Создаю с планировщике задание со следующими параметрами:
* При выполнении использовать учётную запись: admin
* Выполнять: для всех пользователей
* Триггер: При входе в систему - любого пользователя
* Действия: Запуск программы c:\tmp\test.bat
Сохраняю задание (при этом запрашивается ввод пароля учётной записи admin - ввожу). Выполняю вход пользователем test. Наблюдаю появление в каталоге C:\Program Files подкаталога tmp с файлом test.bat.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "windows 7"
}
|
Collecting data from all tasks executed on monix Scheduler
I'm using Monix Scheduler to execute some tasks periodically. But I don't know how to not just execute them, but also to collect result from them to some collection... Lets say I have a scheduled task that returns a random number every time:
val task = Task { Math.random() }
implicit val io: SchedulerService = Scheduler.io()
task.map(_ + 2).map(println).executeOn(io).delayExecution(1.seconds).loopForever.runAsyncAndForget
Theoretically speaking, I can create **_mutable and concurrent_** list before task execution, and in `task.map` I can put a result in that list... But I've heard that using mutable, shared between threads, collections isn't the best practice at all... Is there any nice way to collect all scheduled Task results? What instrument should I use to achieve this goal in a proper, scala idiomatic way, avoiding mutable collections?
|
The idiomatic way to collect repeated results using Monix would be to use an Observable instead of a `Task`. It has many methods such as `zipMap` to combine results with another `Observable`, and many methods such as `foldLeft` to combine results with previous results of the same `Observable`.
Note this generally requires collecting all your `Observables` into one method instead of the fire and forget method in your example. Ideally, you have exactly one `runAsync` in your entire program, in your `main` function.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "scala, scala cats, monix, cats effect"
}
|
Kotlin: Interface ... does not have constructors
I am converting some of my Java code to Kotlin and I do not quite understand how to instantiate interfaces that are defined in Kotlin code. As an example, I have an interface (defined in Java code):
public interface MyInterface {
void onLocationMeasured(Location location);
}
And then further in my Kotlin code I instantiate this interface:
val myObj = new MyInterface { Log.d("...", "...") }
and it works fine. However, when I convert MyInterface to Kotlin:
interface MyInterface {
fun onLocationMeasured(location: Location)
}
I get an error message: `Interface MyListener does not have constructors` when I try to instantiate it - though it seems to me that nothing has changed except syntax. Do I misunderstand how interfaces work in Kotlin?
|
Your Java code relies on SAM conversion - an automatic conversion of a lambda into an interface with a single abstract method. SAM conversion is currently not supported for interfaces defined in Kotlin. Instead, you need to define an anonymous object implementing the interface:
val obj = object : MyInterface {
override fun onLocationMeasured(location: Location) { ... }
}
|
stackexchange-stackoverflow
|
{
"answer_score": 275,
"question_score": 179,
"tags": "java, kotlin"
}
|
How A330-200 or 243 would be much safer under the ETOPS terms?
I am flying this week to France in an Airbus A330-200. I have a phobia of flying I have several questions here on the aviation forum. The plane is A330-200 is the one we're going with and I am reading about it. It works under the term ETOPS.
I read this part and now I am scared more than ever and I didn't understand it correctly:
> In aviation vernacular, the colloquial backronym is "Engines Turn Or Passengers Swim", referring to the inevitable emergency water landing of a twin engine aircraft after a double engine failure over water outside gliding range of land. But ETOPS operation has no direct correlation to water or distance over water. It refers to flight times between diversion airports, regardless as to whether such fields are separated by water or land.
The company I am flying with, its fleet has an average age of 5.6 years in 2016, making MEA one of the youngest fleets in the world.
|
ETOPS ( _Extended Twin Operations_ \- at least that’s what it used to be called) is a set of rules comprising of flight planning, flight operations, aircraft maintenance, flight training and administrative procedures which are geared towards making aircraft operations safe in those regions where diversion airfields are not easily found, e.g. when crossing large oceans.
When these rules are obeyed (i.e. when operating under ETOPS), that should make flying very safe.
|
stackexchange-aviation
|
{
"answer_score": 3,
"question_score": 0,
"tags": "airliner, etops, airbus a330"
}
|
Import and export datetime object
I have a list of datetime objects and numbers, say

`?slidify` should lead to the function documentation and `slidify?package` should lead to the package documentation, and both help pages should have a link to the other (in the seealso section, for example)
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "r"
}
|
Pick 3 random elements from an array. And not get the same elements twice
I am trying to get this function to print out three random names without using the same name twice. I started trying with an If inside the for-loop, but have no idea if that is correct. Appriciate all help as i feel kinda stuck at this point in learning Javascript.
var name = ["Kai", "Lars", "Anders", "Ole", "Petter", "Mikael", "Cos", "Sin"];
var randName = [];
function randomNavn(){
document.getElementById("utskrift").innerHTML = "";
for( i = 0; i < 3; i++){
randName.push(name.splice(Math.floor(Math.random() * name.length), 1));
if(name[i] === randName[i]){
}
}
document.getElementById("utskrift").innerHTML = randName.join(" , ");
}
|
You can use `do..while` loop. Note also `[0]` at close of `.splice()` to return value of array instead of array.
var names = ["Kai", "Lars", "Anders", "Ole"
, "Petter", "Mikael", "Cos", "Sin"];
var randName = [];
do {
randName[randName.length] = names.splice(
Math.floor(Math.random() * names.length)
, 1)[0];
} while (randName.length < 3);
console.log(randName);
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "javascript"
}
|
How do I kill a remote process without being on the administrator group using wmi?
What is the least level of privilege required for remotely killing a process on a Windows machine using wmi from c#?
Currently, I am using an account in the administrators group on the target machine to kill the processes and stop/start windows services but this is causing issues because being in the administrator group also allows users to log on to the target machine via Remote Desktop and I don't want that. What are my options here?
Can you have a windows group with all the administrator privileges without the Remote Desktop privilege?
|
To the first part of your question: to kill a process (whether locally or remotely) you need to either be the owner of the process (i.e. the account that originally executed it) or an administrator or SYSTEM.
As for the last question regarding Remote Desktop privileges, this is controlled by Group Policy and/or Local Security Policy. Look under **Computer Configuration\Security Settings\Local Policy\User Rights Assignment** for **"Allow log on through Remote Desktop Services"** , which by default contains the local Administrators and Remote Desktop Users groups. (There's also a "Deny log on through Remote Desktop Services" options as well.)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "windows, wmi, remote desktop, kill process"
}
|
How to disable selenium from taking physical mouse on Chrome on user's machine on a different monitor screen?
My issue is related to this question Disable physical mouse and keyboard in selenium but I didn't see an answer for this question.
tests are being ran by Java + Selenium + Chrome on the same user's machine (we don't have server to run the automation tests on, due to employer cost reasons). I have dual monitors so I ran the automation on one of the monitors, and tried to do something else on the other monitor but selenium kept taking away my physical mouse.
Any help/guidance or info on how to resolve this issue is appreciated.
|
Selenium does not "take mouse from you" it can however switch focus to a browser window if certain conditions happens (usually when new tab opens). To avoid this i suggest you run your tests in `headless` mode. To run your tests in this mode you need to set chrome options as following:
chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
Of course this means you will not see the actual test being run in a browser window, instead a command line window will open, which you can minimize and continue your work.
|
stackexchange-sqa
|
{
"answer_score": 2,
"question_score": 1,
"tags": "selenium webdriver, java, browser automation, chromedriver, chrome"
}
|
CSS Animate SVG stroke stop at last frame
CodePen
In the above codepen there is an SVG that the stroke animates into view, but at the end it just disappears.
Is there a way to keep it into view once its loaded?
.path {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
animation: dash 5s linear alternate;
}
@keyframes dash {
from {
stroke-dashoffset: 1000;
}
to {
stroke-dashoffset: 0;
}
}
|
add these two properties to your `.path`
animation-fill-mode: forwards; // Stay on the last frame
animation-iteration-count: 1;// Run only once
Css will be:
.path {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
animation: dash 5s linear alternate;
animation-fill-mode: forwards; // Stay on the last frame
animation-iteration-count: 1;
}
Codepen is Here,its working fine.
|
stackexchange-stackoverflow
|
{
"answer_score": 8,
"question_score": 7,
"tags": "css, svg"
}
|
I am trying to when i open the popup view then my webview is paused
 {
let width = mywebview.frame.width
let height = mywebview.frame.height
let frame = 0
mywebview.allowsInlineMediaPlayback = true
mywebview.scrollView.bounces=false
let videoUrl = "
let htmlUrl = "<html><body><iframe width=\(width) height=\(height) src=\(videoUrl) allowfullscreen></iframe></body></html>"
mywebview.loadHTMLString(htmlUrl, baseURL: Bundle.main.bundleURL)
}
I am using above function for playing video in uiwebview
In this image popup is open but previous video is playing.please tell me solution
|
Add these line of codes when you show & hide the Pop Up message respectively:
**To Pause:**
mywebview.stringByEvaluatingJavaScriptFromString("document.querySelector('video').pause()")
**To Play:**
mywebview.stringByEvaluatingJavaScriptFromString("document.querySelector('video').play()")
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -4,
"tags": "ios, swift"
}
|
How to test that invalid arguments raise an ArgumentError exception using RSpec?
I'm writing a RubyGem that can raise an `ArgumentError` if the arguments supplied to its single method are invalid. How can I write a test for this using RSpec?
The example below shows the sort of implementation I have in mind. The `bar` method expects a single boolean argument (`:baz`), the type of which is checked to make sure that it actually is a boolean:
module Foo
def self.bar(options = {})
baz = options.fetch(:baz, true)
validate_arguments(baz)
end
private
def self.validate_arguments(baz)
raise(ArgumentError, ":baz must be a boolean") unless valid_baz?(baz)
end
def self.valid_baz?(baz)
baz.is_a?(TrueClass) || baz.is_a?(FalseClass)
end
end
|
I use something similar to what JHurra posted:
it "should raise ArgumentError for arguments that are not boolean" do
expect{ Foo.validate_arguments(nil) }.to raise_error(ArgumentError)
end
No need to alias (rspec 1.3).
|
stackexchange-stackoverflow
|
{
"answer_score": 30,
"question_score": 16,
"tags": "ruby, rspec"
}
|
Search a file in sub folders
When i try to search the zip file in sub-folders of "Input_Files", the command is not running after "\172.24.191.117\data1\NEW-ENDORSEMENTS\Backlog_checked\%J%\CLIENT-SUPPLIED\Backlog". I think the space is problem to get the path. Kindly check and clear.
@echo off
echo.
set /p J=Enter Journal ID :
set /p A=Enter Article ID :
set "BaseDir=\\172.24.191.117\data1\NEW-ENDORSEMENTS\Backlog_checked\%J%\CLIENT-SUPPLIED\Backlog Transfer\Non EV articles\%J%%A%"
For /f "delims=" %%A in ('
Dir /B/S/A-D "%BaseDir%\*.zip" ^| Findstr /I "\\Input_Files\\[^\\]*\.zip$"
') Do start %%A
pause
|
Replace `start %%A` by `start "" "%%A"`.
**DIR** outputs the found file matching the pattern with full qualified file name (file path + file name + file extension) never enclosed in double quotes. So it is necessary to reference the file with embedding it in double quotes as done here with `"%%A"`.
The first double quoted string is interpreted by command **START** as optional title. For that reason a title must be explicitly specified to avoid interpreting the full qualified file name in `"` as title string. As the started application for opening the *.zip file is most likely a GUI application, an empty title string can be used with `""` because no command process with a console window is opened in this case.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "batch file"
}
|
the value of category_id is empty
I'm having an issue with Magento. I'm trying to get the category id of a configurable product but when I call the method getCategoryId, nothing is returned, even if I've attached this configurable product to a category. Here is the code I wrote from the Mage_Checkout_Block_Cart class :
$cart = Mage::getModel('checkout/cart')->getQuote();
foreach ( $cart->getAllVisibleItems() as $item ) {
$prd = $item->getProduct();
if ( ! $prd->do_not_use_category_id )
$catId = $prd->getCategoryId();
else
$catId = 4;
break;
}
Besides, there is a boolean named "do_not_use_category_id" that is true for these products. How can I get the category id from this product ? Thanks
|
Just from the top of my head - since I don't have a Magento environment around right now - shouldn't it be:
$prd->getCategoryIds(); //Note the "s" after "Id".
A product can be part of multiple categories, so it would make sense. Let me know if this worked or not.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "magento"
}
|
How to install Perl packages automatically in FreeBSD using a Perl script without any prompt?
I want to install Perl packages automatically using a Perl script. The code I am using is
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use CPAN;
eval "use JSON"
or do {
CPAN::install("JSON");
};
eval "use Net::Address::IP::Local"
or do {
CPAN::install("Net::Address::IP::Local");
};
eval "use Net::OpenSSH"
or do {
CPAN::install("Net::OpenSSH");
};
eval "use Net::SCP::Expect"
or do {
CPAN::install("Net::SCP::Expect");
};
During the script runs, it asks for prompt like yes or no, passwords, etc. How to handle these prompt automatically? I have to deploy it on many servers so I had to automate it.
|
I got a solution for this that when there is a prompt in between installation of any package either it is automated or manual the prompt got timed out automatically after 15secs, and further installation continues as usual. and also we can give yes in pipe (`|`) if there is prompt for "yes" only.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 4,
"tags": "perl, automation, package, freebsd, cpan"
}
|
Subcategory that is not an abelian subcategory?
Weibel defines an abelian subcategory of an abelian category $A$ to be a subcategory $B$, which is an abelian category, such that a sequence of two maps in $B$ of is short exact iff it is short exact in $A$.
Does someone know of a concrete example of 2 abelian categories, one a subcategory of the other, but not an abelian subcategory?
Thanks.
|
Take $A$ to be the category of presheaves of abelian groups on some space, and take $B$ to be the subcategory of sheaves of abelian groups. The inclusion functor $B \to A$ is a right adjoint, so preserves limits, but it generally does not preserve colimits, such as cokernels, and in fact it is not exact. Hence most short exact sequences of sheaves fail to be short exact sequences of presheaves.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "homological algebra"
}
|
Keep oversized background image centered
I am building a single page site constructed of 4 divs, one on top of the other and each one with its own fixed background image. The images are much wider than the screen as I want to site to keep its look across a large range of screen sizes, however does anyone know how to truely center a background image. So in a small monitor they would be viewing the center of the image, and in a larger monitor they would see the same place of the image, just with more around it. Just like this site has
<
When the window is resized the background image moves accordingly.
Many Thanks.
|
If you check the css from your link you see the solution:
#images #bg_1 {
background-image: url(images/bg/1.jpg);
background-position: 50% 0;
}
And the div:
<div class="bg_block" id="bg_1" style="height: 1200px; width: 1055px;"></div>
By JavaScript they change the width of #bg_1 on every resize.
window.onresize = function(event) {
$("#bg_1").css("width", $(window).width());
}
|
stackexchange-stackoverflow
|
{
"answer_score": 18,
"question_score": 3,
"tags": "css, html, parallax"
}
|
Method to handle "killed" Java jobs?
Our server web app will handle jobs that are requested by REST API requests.
Ideally if the server dies during a job (ie: plug pulled), the job should resume or restart at startup.
A very convenient way to process these jobs is in a separate thread using some of the concurrent utility classes in Java 5. The only issue is, given a failure, you need to have written down the job details and create a process that reads these details at startup and resumes the jobs. This seems like a pain to do.
An alternate approach is to use a queue where user makes request, we write to queue, then read from queue and perform job and only remove the message when the job is complete. This makes it easy to resume the job on startup as the server will just read from the queue on startup and resume the process.
Are there any better approaches to this scenario?
|
Given that you've specified REST, you obviously have clients that make requests and require results. Why not put the onus of determining if they've completed on the _clients themselves_.
e.g. a client makes a request. If it gets a result back, all well and good. If, however, the client detects the server has gone done (via a premature disconnection on the HTTP connection), then it can back off and retry later. If you wish, you can implement various retry strategies (e.g. retry on a different host, give up after 'n' retries etc.).
This way the clients maintain knowledge of what they require (as they must do anyway, presumably) and your servers are stateless, which is a lot easier to manage.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "java, rest, concurrency, jobs"
}
|
Azure devops page conflict
2 developers are updating the same file in the same project. the last update gives an error. Because the first updated codes are not found in the file that the 2nd developer is trying to update. Migrate error. This way, the first updated user's codes are deleted. How can I solve this problem?
Azure devops Repos style.css
a{}b{}
1. Developer's style.css (First updater)
`a{}b{}c{}d{}`
2.Developer's style.css
a{}b{}e{}
updated Azure devops repos style.css
a{}b{}e{}
c{} and d{} disappeared
|
Your team needs to select and adhere to a version control workflow that meets your needs and that is supported by Git (the distributed source control you have **_apparently_** chosen). I suggest starting here: Azure Repos Git tutorial.
You might even question whether Git is the appropriate source control choice given your needs. See Choosing the right version control for your project
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "azure devops"
}
|
Is it possible to translate the 'and' separator in references using BibTeX?
I'm using the standard _plain_ style for my bibliography. My document is written in Dutch, so I'm using the `babel` package, but the _and_ separator before the last author isn't translated to the Dutch alternative _en_.
\documentclass{article}
\usepackage[dutch]{babel}
\begin{document}
\nocite{*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
After reading this answer, I know how to create a custom style _myplain_ , where _and_ is changed to _en_ , but I was wondering whether it is truly necessary to create a new style for this.
Aren't `babel` and some other trick sufficient? If not, does one have to create a new style for every language (e.g. in French, _and_ is _et_ )?
|
You can use `babelbib`:
\begin{filecontents*}{\jobname.bib}
@article{ur,
author={A. Uthor and W. Riter},
title={Title},
journal={Journal},
year={2016},
}
@book{x,
editor={E. Ditor},
title={Collection},
year={2016},
}
\end{filecontents*}
\documentclass{article}
\usepackage[dutch]{babel}
\usepackage{babelbib}
\begin{document}
\cite{ur}, \cite{x}
\bibliographystyle{babplain}
\bibliography{\jobname}
\end{document}
 for searchtext field, you will receive two results without street number and with two different postal codes.
But if you type "włókniarzy 89, łódź" or "włókniarzy 95, łódź" which dont exist as well, the response will be correct "Włókniarzy 52" - closest existing address.
Is there a way to receive only results with closest address and be sure to not receive address without street number in geocode endpoint?
Thank you
|
There is no switch that would do that, but if you know what the street name and HNR are in your address, then use the qualified search by specifying the address parts individually, e.g.
street=w%C5%82%C3%B3kniarzy
housenumber=91&
city=%C5%82%C3%B3d%C5%BA&
country=pol&
This will return 'aleja Włókniarzy, 91-073 Łódź, Polska'
In the initial query the Geocoder does not know what 91 is. As there is no house number (HNR) 91, the best match is the postal code. Once token "91" has been consumed it will not be used again to match a HNR, so the result is a street level match.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "here api"
}
|
Incurs_seek_penalty column of sys.dm_os_volume_stats
A new column, `incurs_seek_penalty`, was introduced in the SQL Server 2019 `sys.dm_os_volume_stats` DMF. This tinyint column is not currently documented.
Does anyone have information about the enumerated values returned in this column? I've seen values of 0 (bare metal server) and 2 (VM). I'm curious as to what these values mean and what other values might be returned. My internet search hasn't turned up anything.
|
This is now officially documented, with the following values:
> Indicates the type of storage supporting this volume. Possible values are:
>
> 0: No seek penalty on this volume, typically when the storage device is PMM or SSD
>
> 1: Seek penalty on this volume, typically when the storage device is HDD
>
> 2: The storage type can't be determined when the volume is on a UNC path or mounted shares
>
> NULL: The storage type can't be determined on Linux operating system
>
> **Applies to:** SQL Server (starting with SQL Server 2019 (15.x))
It looks like this is related to the low level `DEVICE_SEEK_PENALTY_DESCRIPTOR` structure (thanks, LowlyDBA!) - possibly in an attempt to **check if a drive is an SSD or not** (that approach is also discussed on Stack Overflow).
It would still be interesting to know if this information about the storage is (or will be) used by SQL Server (e.g., for updated I/O cost estimates, or performance optimizations inside the storage engine).
|
stackexchange-dba
|
{
"answer_score": 6,
"question_score": 6,
"tags": "sql server, sql server 2019"
}
|
is io_service_.stop() only required when io_service_.run() previously called
I implement a tcp client using boost asio and synchronous socket.
I'm wondering if I have to call io_service_.stop() after (or before?) shutdown/closed my socket?
|
It will stop itself when there is no work to do, which should be the case once all the sockets etc. have been closed (unless you use a `work` object to keep it alive). Only call `stop` if you want it to stop while asynchronous operations are still pending.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "c++, sockets, boost asio"
}
|
Pointers in c++ and runtime errors
What is the issue with this code? It gives the output as expected, but there is a runtime error, and I don't know what it is.
Can somebody explain the concept behind it?
int main()
{
int *a = new int(7);//assume the heap memory has address 4F
int *p;
p = a;
cout << a << endl;
cout << p << endl;
cout << *a << endl;
cout << *p << endl;
*p = 10;
cout << *a << endl;
delete p;
delete a;
return 0;
}
|
You reassigned `*p = 10` but `a` and `p` are still the same address in memory. As already mentioned, you are trying to delete the same memory space twice, which can explain the runtime error.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "c++"
}
|
Getting value of unknown number of inputs
I have a site generated mainly in PHP. On one page PHP generates a number of dropdowns, the number of which is depending on items in my DB.
The number of dropdowns can change but I want to be able to count them and get the values for each of them in JS/jQuery.
At the moment the dropdowns all have the same class name but I think I'm going to have to try give them all individual IDs.
I know I could the amount of items like this:
var ammount = $(".myclass").length;
I just need some way of looping through these to get the individual values like this, without just picking up the first value of that class each time:
var input =$(".myclass").value;
I think I'm going to have to go with individual IDs being generated by the PHP but was just wondering if there was another way to do it.
|
$(".myclass").each(function(i,e) {
console.log(e); //e gives you current item in loop
});
or
$(".myclass").each(function() {
console.log($(this).value);
});
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "javascript, jquery, html, input"
}
|
Appcelerator. Detect click on navbar title
I am developing an iOS app in Appcelerator. How can I detect when the user taps the title of the window (the title in the navbar)?
Thankful for all input!
|
I would place a transparent view over the navBar title... that is the easiest solution if you are not using a title control.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "javascript, appcelerator"
}
|
Why would increasing troop production prolong the war?
I'm watching Star Wars: The Clone Wars (Season 2, Episode 15), and I just heard something that just doesn't make much sense to me.
> Senator Padmé Amidala, recognizing that more troops will only prolong the fighting, works tirelessly with her allies to introduce a bill to cut down military spending and stop the creation of more clone troopers…
I don't understand her position. Why would increasing production draw out the war? I mean, I can accept that stopping production would mean the war would effectively end -- with the Good Guys losing. But how is decreasing production a sound military strategy?
|
Padmé's position is made eminently clear in the Revenge of the Sith, she despises the war and doesn't trust the Chancellor any farther than she can throw him;
> **PADME:** _What if the democracy we thought we were serving no longer exists, and the Republic has become the very evil we have been fighting to destroy?_
>
> **ANAKIN:** _I don't believe that. And you're sounding like a Separatist!_
>
> **PADME:** _**Anakin, this war represents a failure to listen . . . Now, you're closer to the Chancellor than anyone. Please, please ask him to stop the fighting and let diplomacy resume._**
In her opinion, producing more clones will simply result in the Federation producing more battle droids which will in turn lead to billions more civilian casualties **on both sides**.
|
stackexchange-scifi
|
{
"answer_score": 4,
"question_score": 5,
"tags": "star wars, the clone wars"
}
|
Why precondition strengtening is sound in Hoare logic
I have problem with understanding why precondition strengthening is sound rule in Hoare logic. The rule is:
$$ {P \implies Q, \\{Q\\} C \\{X\\} } \over {\\{P\\} C \\{X\\}} $$
I really do not understand why precondition in consequence goes in reverse direction that implication works (modus ponens).
I can understand why post-condition weakening works because it follows modus ponens rule but I am no able to understand precondition strengthening.
|
The triple $\\{Q\\}C\\{X\\}$ states that if $Q$ holds, then after executing $C$, the condition $X$ holds. Now suppose that $\\{Q\\}C\\{X\\}$ and that $P \Longrightarrow Q$. We will prove that $\\{P\\}C\\{X\\}$. Indeed, suppose that $P$ holds. Since $P \Longrightarrow Q$, also $Q$ holds. Hence if we execute $C$, then $X$ will hold. Altogether, we see that $\\{P\\}C\\{X\\}$ is valid.
An example can also be helpful. If we know that $\\{x=1\\}x\gets x+1\\{x=2\\}$ then we certainly know that $\\{x=y=1\\}x\gets x+1\\{x=2\\}$.
|
stackexchange-cs
|
{
"answer_score": 3,
"question_score": 3,
"tags": "logic, program correctness, imperative programming, hoare logic"
}
|
Usage of "such that" in logical statements
I have a simple question about the usage of "such that" in logical statements.
Let the statement S be: "For every $x \in A, f (x) > 5$."
In the negation of S:
There is an $x \in A$ such that $f (x) ≤ 5$.
The comma in S is converted to "such that" in the negation of S.
Can somebody clarify on the "such that" came in the negation of S.
|
Rubik is right: There is an implied "such that" in the first statement as well.
For every $x\in A$, $f(x)>5$ means $\forall\,x$ such that $x\in A$, $f(x)>5$, which in turn can be translated to $\forall\,x\quad x\in A\implies f(x)>5$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "logic, predicate logic"
}
|
Inequality, prove for all natural numbers $n \geq 2$, possibly induction
Prove that for every natural number $n \geq2$ there is inequality $$1\cdot\sqrt{\binom{n}{1}}+2\cdot\sqrt{\binom{n}{2}}+3\cdot\sqrt{\binom{n}{3}}+...+n\cdot\sqrt{\binom{n}{n}}<\sqrt{2^{n-1}\cdot n^3}$$ I'm interested in various ways this problem can be solved. I guess it should be solvable by induction because there was in the content of the problem prove for all natural $n>2$ . Hints on various solutions are welcome. Also I tried normal induction and it's too difficult to solve (unless there exists a way to simplify it somehow). And I tried to use QM-AM and then induction on it and that's difficult too.
EDIT: I could have made mistake with this QM-AM induction.
|
Using Cauchy-Schwartz we have \begin{equation} \bigg(1\cdot\sqrt{\binom{n}{1}}+2\cdot\sqrt{\binom{n}{2}}+3\cdot\sqrt{\binom{n}{3}}+...+n\cdot\sqrt{\binom{n}{n}}\bigg)^2\leq (1^2+2^2+...+n^2)2^n. \end{equation} Since \begin{equation} 1^2+2^2+\dots+n^2 = \frac{1}{6}n(n+1)(2n+1)<n^3/2. \end{equation} for $n>3$. I think we are done.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "inequality, induction"
}
|
How to drop the first digit in phone number in php
I want to drop the first digit in phone number in php (for laravel framework). For example, if the user enter 05030123456, I want to get +2335030123456 into the database. That is, if my phone column in the database is phone_number, I will normally have the code in the controller look like this:
`$user->phone_number = $request->phone`
So, how can I treat `$request->phone` so it send +2335030123456 to the database for `$user->phone_number` instead of 05030123456.
|
If you want predefined '+233' then below code will be help you.
$user->phone_number = '+233'.substr($request->phone, 1);
So, your output will be : +2335030123456.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "php, laravel"
}
|
Start android app after bluetooth connection
Is it possible to start an app in case of an bluetooth connection to a specific device? Maybe the application have to run in background. In this case i want to open a specific view or activity after the bluetooth connection!?
|
Write a braodcast receiver which listens to bluetooth connection and in `onReceive` check if connection is with the device you need. If so, then open your app from the broadcast using the intent.
action in manifest for your receiver
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
<action android:name="android.bluetooth.device.action.UUID" />
<action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
permissions to be given
<uses-permission android:name="android.permission.BLUETOOTH" />
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "android, bluetooth, startup"
}
|
CSS transition for a background-image on hover?
I am working on webpage where I want to use background image on hover effect, however I have some issue. Image is display on hover with tranisiton but when I move back my mouse then transition is not working and it is not looking good - there is no hover out effect, I hope it is clear. I would like to also use scall effect for hover but I don't have additional wrapar as content is generated by additional module in joomla.
I tried also implement solution with opacity but then I am loosing my border as I don't have additional wrapper.
So far this is my code on website test3.reksio.net
div.zsm_block_news > div.zsm_block_content > div:nth-child(1) > div:nth-child(1):hover
{
background-image: url("
transition: all 0.7s ease-in;
background-position: center;
background-size: cover;
}
|
Is this what you want to achieve?
div{
width: 500px;
height: 500px;
}
div:before{
content:'';
transition: all 0.7s;
position: absolute;
width: 500px;
height: 500px;
background-image: url("
background-position: center;
background-size: cover;
opacity: 1;
}
div:hover:before{
opacity: 0;
}
div:hover span{
opacity: 1;
}
<div>
<span>1111</span>
</div>
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "html, css, joomla, css transitions"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.