INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Two of the same value in a set
so as I understand it sets are just supposed to be able to store unique values, but I manage to add two of the same values - {1, 2, 3, 4, 5, '1', '4', '2', '5', '3'}
How is this possible?
|
1 and '1' are not the same value. 1 is a integer, and '1' is a string. So your set does only contain unique values
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -2,
"tags": "python, set"
}
|
How to print rounded corner with curses/ncurses?
I printed my first `curses` program.
I suddenly get curious whether the round corners are possible in Curses UI. Is it possible to draw round corners? If it supports Unicode, and if it's possible to print some character like;
> ** ** (U+256D~2570)
it would be possible. Should I change the source code...? Or is there some API to change that characters?
!enter image description here
|
ncurses uses a table (from terminfo/termcap) which tells ncurses how to map the "alternate" character set to the terminal's set of graphic characters.
If you want to change this you will need to alter the terminfo/termcap entry for your terminal.
See the terminfo man page for details of the terminfo file format. In particular look at the "Line Graphics" section.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "ncurses, curses"
}
|
iPad (4.2.1 is overriding Base SDK to 4.3)
I am trying to run my App on the device but when i was selecting the device it showed me this message "iPad (4.2.1 is overriding Base SDK to 4.3)". Then i setted my Base SDK to 3.2 as there are only two options available (3.2 and 4.3) and also setted my deployment target to 4.2. But when i build this application it showed me error: Code Sign error: Provisioning profile (String) can't be found
thanks in advance
|
Something is wrong with your installed provisioning profile. It doesn't have anything to do with your SDK settings.
Either you don't have a correct profile installed, or it's expired, or the device you're trying to use isn't associated with it.
You should read through this and make sure you've followed the steps.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "objective c, ios4, xcode4, ipad"
}
|
Disable a microsoft update item via command line
We have 5000+ servers and need to hide the 2008R2 SP1 so that our users don't accidentally install the service pack. I can use PSEXEC, powershell, ect. Is there a way to do this from command line so that we don't have to use the gui on each of the 5000+ machines?
|
Microsoft released a tool for that purpose: Windows Service Pack Blocker Tool Kit.
Microsoft text: "A blocking tool is available for organizations that would like to temporarily prevent installation of Service Pack updates through Windows Update.
This tool can be used with: Windows 7 Service Pack 1 (valid through 2/22/2012) Windows Server 2008 R2 Service Pack 1 (valid through 2/22/2012)
This toolkit contains three components. All of them function primarily to set or clear a specific registry key that is used to detect and block download of Service Packs from Windows Update. You only need to use the component which best serves your organization’s computer management infrastructure. 1\. A Microsoft-signed executable 2\. A script 3\. An ADM template "
Hope this helps, Cheers
|
stackexchange-serverfault
|
{
"answer_score": 4,
"question_score": 0,
"tags": "windows server 2008, command line interface, windows update"
}
|
What's the appropriate way to calculate an effect size when there is an interaction?
I have a regression model with two significant main effects and a significant interaction. I'd like to calculate an effect size for one of the main effects.
I'm using the package `compute.es` in R. I'm not sure whether I should use the empirical means and standard deviations or the t-value from the regression model to calculate the effect size.
|
You cannot do this. At least, not ONE effect size for all cases. That's what an interaction means.
That is, an interaction means that the effect of one IV is different at different levels of the other variable.
So, you could calculate the effect of one variable at any particular level of the other.
|
stackexchange-stats
|
{
"answer_score": 3,
"question_score": 2,
"tags": "regression, interaction, effect size"
}
|
How to display an error message when the quantity for a product is more than 3 in woocommerce?
I have a product added through woocommerce for my client's website.
Now, I want to show "ADD TO CART" only if the product's qty is 3 or below. If the Qty is more than 3, then the "ADD TO CART" button should be disabled and another button called "CONTACT" should be enabled.(Or, it is fine if it displays some error message if the user choose more than 3 quantities).
Simply says, For Quantities 3 or below - we can add to cart
For Quantities more than 3 - display error msg (or) CONTACT button
|
You can try something like this:
add_action( 'woocommerce_add_to_cart_validation', 'wc_add_to_cart_validation', 11, 3 );
function wc_add_to_cart_validation( $passed, $product_id, $quantity ) {
if ( $quantity > 3 ){
wc_add_notice( __( 'Only 3 or less quantities allowed, please contact us.', 'woocommerce' ), 'error' );
$passed = false;
}
return $passed;
}
this will check up quantity on add to cart validation.
code goes to your current active theme's functions.php
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "woocommerce"
}
|
how do LED controllers work
I’m trying to find out if a device only draws the watts it needs to run or if it takes all available
For example
I have led light that’s says max 0,75 watts and the led controller says output 144 watts will the device received 144 watts or will it only take 0,75
So I’m wanting this < to work with the rgb one of this <
|
That LED controller is not a constant current source, just a triple PWM switch. As long as the controller is rated at a higher max current than the sum of all the attached LEDs the pair will work properly.
Those LED modules have series resistors which limit the current to the LED devices as long as they are operated at the rated voltage. Use a 12V power supply and you are all set.
|
stackexchange-electronics
|
{
"answer_score": 0,
"question_score": 0,
"tags": "watts, power consumption"
}
|
setRetainInstance(true) with Activity in the Background
if I have an `Activity` which hosts a Fragment with `setRetainInstance(true)` what will happen if this Activity is killed when it is in the background i.e another `Activity` is in the top of it . does the `Fragment` get destroyed also when the Activity is killed ????
|
Yes All Activity retained Fragment will be destroyed , retain feature helps you retain Fragment object only for configuration change like Activity rotation ,not when the os kills the Activity when it needs to reclaim memory .
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "android, android fragments, android activity"
}
|
How to know the JVM path in a Linux system?
I want to copy some files in the subdirectories of the JVM path , java is already installed. How to know the JVM's path ?
|
locate java
This will give you the location of java installation in your system.
Most probably it would be:
/usr/lib/java/
|
stackexchange-superuser
|
{
"answer_score": 8,
"question_score": 8,
"tags": "linux, java"
}
|
Didn't find class "androidx.core.widget.DrawerLayout"
After migrating to Androidx packages using Android Studio menu option Refactor -> Refactor to Androidx...
my build.gradle looks like
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
During run the app, I run into this:
Didn't find class "androidx.core.widget.DrawerLayout"
It seems the migration tool has same issues
|
I was able to solve it by Just replace
androidx.core.widget.DrawerLayout
with
androidx.drawerlayout.widget.DrawerLayout
in every place where it appears.
|
stackexchange-stackoverflow
|
{
"answer_score": 70,
"question_score": 22,
"tags": "android, androidx"
}
|
Deploy Typo3 database changes
I wonder if there is a good way of deploying database changes made on a typo3 website (on dev) to a live website?
In Magento for example there are folders containg sql install statements (for the structure, new tables etc.) and data install scripts (inserting data into the tables). These scripts are automatically executed when deployed to live.
Good ways of getting rid of manual database adaptions are welcome.
Thanks!
|
**cweiske** explained it well, for common admin it's enough to know that Install Tool has **_Database Analyser > Compare_** functionality, which is dedicated for handling DB schema differences.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, database, deployment, typo3"
}
|
How to force www in htaccess?
I need to force www for my site, my site is build with codeigniter framework.
This is my htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|js|plugins|Scripts|pirobox|applications-assets|user-assets|robots\.txt)
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) [R=301,L]
RewriteRule ^(.*)$ /index.php?/administrator/$1 [L]
But it is not working can you tell me what is wrong here?
|
Try Something like
RewriteEngine On
#This rewrites your host name to include www
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)$ [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "apache, .htaccess, mod rewrite, codeigniter 2"
}
|
JPA commit() after persist() : Required or Not
I am working an a JPA 2.0 project, where I am saving my `Entity` class objects like :-
InitialContext ctx = new InitialContext();
UserTransaction userTrans = (UserTransaction)
ctx.lookup("java:comp/UserTransaction");
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_NAME);
EntityManager em = emf.createEntityManager();
User user = new User("ankit","nigam",25);
em.persist(user); // persisted in db after this executes
userTrans.commit(); // whether it is required OR not.
So whether I am using `userTrans.commit()` or not, my `user` object is getting saved in Db, after `persist()` executes. But some of my colleagues say, as a standard we should `commit()` the transaction.
What should be the approach which I follow and whats the logic behind `commit()` and `persist()`. Please throw some lights.
|
Is autocommit ON in your DB? If it is then that is the reason why the changes get permanently stored in your DB irrespective of whether or not you commit the transaction from your application. In production the autocommit is generally set OFF because it hampers the performance/response time of the DB, that is why developers are generally encouraged to control the commit or rollback of a transaction from their application. The link details the command to handle autocommit in db2: <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "java, jpa, transactions"
}
|
What is the hexadecimal code of the "blue" background color of Facebook?
I want to color my mobile phone application with a background color like Facebook's blue background color. So what is the hexadecimal code of it ?
|
The colour of the main blue banner is _#3b5999_ , and the lighter blue colour used for the backgrounds of comments is _#eeeff4_. A way to figure this stuff out is grab a screenshot and open it in image editing software that has a colour picker tool (e.g GIMP)
|
stackexchange-stackoverflow
|
{
"answer_score": 17,
"question_score": 12,
"tags": "facebook graph api, colors, facebook"
}
|
Importing Salesforce .xlsx into Power BI
if I import an .xlsx file from Salesforce into Power BI, there are instances where there are merged rows (number may vary) for a particular record.
Essentially there are merged rows that appear as one row and when one tries to import this data, the field will show it as 'Blank' when in fact it is non-empty.
Here is an example:
<
How would I write the DAX query for this? Is this the best route?
Thanks for your help.
|
Edit the query using Power Query, and use `Table.FillDown` to fill the blanks.
For example:
let
Source = Excel.Workbook(File.Contents("C:\Temp\Salesforce.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Filled Down" = Table.FillDown(#"Promoted Headers",{"Vendor", "Shipping City"})
in
#"Filled Down"
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "salesforce, powerbi, dax"
}
|
TextArea wordWrap for mail
I'm using phpMailer in my project , and passing the message/body via a CHtml textArea.
However , long mails are not being send (or when I used just mail() , the message was empty)
Now , when I write a message in the code , with \n all is fine.
So fom that I conclude that the textArea is not breaking the lines (gets over 70) , I tried using word-wrap but it seems like not working.
Here's pat of my mailer:
$mail->WordWrap = 50;
$mail->Subject = ($_GET['subject']);
$mail->MsgHTML($_GET['message']);
$mail->AddAddress(Person::model()->findByPk($id)->email);
$mail->Send();
and here is the textArea:
<?php echo CHtml::textArea('message','message. . . ',array('id'=>'message','style'=>'text-align: right','cols'=>75)); ?>
Does anyone know where is the problem?
Thanks , Mark.
|
The message is not being passed _via_ but from the `textarea` and via an HTTP GET request which probably is one of the problems since the total length of a GET request body is limited to 1024 characters.
The `WordWrap` addribut tells the mailer to break the body text at every nth character with a newline so you don't have to worry about that. Just make it a POST.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, email, yii"
}
|
Find the most repeated sequence in a file
I have a file with some binary sequence [010101...], and I would like to get the most generated sequence of 5 bits in the file.
Example of my file:
00010111000100100100100100100101110101010100011001010111011100010
I've started by generating all the possible sequences, means if I take the first 7 bits, I will get the following sequences:
00010 00101 01011
Now I'm looking for a way the count the occurrence of each sequence in the file.
Any help, please?
|
If you're using perl, you could go for something like this:
use strict;
use warnings;
my $str = '00010111000100100100100100100101110101010100011001010111011100010';
# create list of all substrings of length 5
my @sequences = map { substr $str, $_, 5 } 0..length($str) - 5;
# build hash of counts for each substring
my %counts;
++$counts{$_} for @sequences;
# take key corresponding to the maximum value in counts
my ($max) = sort { $counts{$b} <=> $counts{$a} } keys %counts;
print "$max\n";
Output:
10010
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "awk, grep"
}
|
kafka console consumer pretty print json
How to print response from Kafka console consumer to JSON pretty. I have tried this but it's not working.
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic indexing-v1
--from-beginning | python -m json.tool
|
Using jq was able to view pretty JSON. Thanks.
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic indexing-v1
--from-beginning | jq
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 4,
"tags": "json, apache kafka, kafka consumer api, pretty print"
}
|
Help with is_page() and calling css for specific pages in a Child Theme
I'm building a child theme of Newspaper 7, and I'm trying to call a specific stylesheet for certain pages, however is_page() isn't working for me. What should I change in my code to be able to do what I'm trying to do?
Here is my code:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1001);
function theme_enqueue_styles() {
wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.css', '', TD_THEME_VERSION . 'c' , 'all' );
wp_enqueue_style('td-theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme'), TD_THEME_VERSION . 'c', 'all' );
if( is_page( array( 'about-me', 'contact', 'social-media'))) {
wp_enqueue_style( 'td-theme-child', get_stylesheet_directory_uri().'/style2.css'. 'c', 'all' );
}
}
|
The first parameter of `wp_enqueue_style` and `wp_register_style` is used to register the stylesheet for later use. So, you can register it early and later call it just specifying it's first parameter.
In this case you are registering and enqueueing the stylesheet `td-theme-child`, which file is `style.css`. After that, if the conditional passes, you are registering and enqueueing the stylesheet `td-theme-child`, which file is `style2.css`... but, WP already sent the `td-theme-child`, so the `style2.css` will never hit the browser.
So, in short, just change the first parameter of your style2.css enqueue line:
wp_enqueue_style( 'td-theme-child2', get_stylesheet_directory_uri().'/style2.css'. 'c', 'all' );
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "functions, css, child theme"
}
|
How do I place the cursor at a certain point after sending an AutoHotkey script?
I thought I'd ask this question here instead of the AutoHotkey forums since this one seems more active and knowledgeable.
I am using AHK for a very basic purpose at the time, and that is to implement a typing color and style, as shown below:
^|::
Send, [b][color={#}4F6377][/color][/b]x
Return
It is BBCode that makes the color a bold dark blue. What I am trying to is make the cursor (x) go from the first position to the one shown below.
^|::
Send, [b][color={#}4F6377]x[/color][/b]
Return
Thank you in advance.
|
This should do:
^|::
SendInput, [b][color={#}4F6377][/color][/b]
SendInput, {Left 12}
return
It's using `SendInput` instead of `Send` as it's faster.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "autohotkey"
}
|
using farword slash in sql where condition
I'm trying to search an element which starts with `/` below is the query.
I've already tried...
Select id,url from myindex where url='[/]%' ;
Select id,url from myindex where url='/%';
but didn't work.
any suggestions to fix this?
|
You don't want `=`. You want `like`. The second is the way to go in MySQL:
Select id, url
from myindex
where url like '/%';
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "mysql, sql, where in"
}
|
messages bundle with dynamic key in struts2
I have a problem with displaying a message from messages bundle with key passed as a tag argument. Since version 2.3, struts tags don't allow runtime expressions.
I have a custom tag with `fieldName` parameter and I want to retrieve a message with use of this parameter, like in previous versions of the framework: `<s:text name="${fieldName}"/>`
Neither `<s:text>` nor `<s:property>` work for me.
I tried every solution found in web, but nothing works.
|
Use OGNL or use `<s:set>` tag
<s:set name="fname">
${fieldName}
</s:set>
<s:text name="%{#fname}"/>
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "struts2, ognl"
}
|
View-based NSOutlineView with custom selection style
I'm implementing a tool very similar to the built-in plist editor in Xcode. The only thing missing is the custom highlighting when a row is selected (see attached image). What's the proper way achieving this?
!enter image description here
|
Finally, I've subclassed `NSOutlineView` \+ `NSTableRowView` and provided a custom implementation in `drawSelectionInRect:`.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "objective c, cocoa, nsoutlineview, nstablecellview"
}
|
how to code breadcrumbs (php kohana framework)?
is this good way to code breadcrumbs?
1. create table "categories" using mysql
2. create after neccessary columns "parent_id" column
3. if parent_id column have null value it means that this category is parent and if else this columns parent is a column with id which marked in "parent_id" column
4. recursively query to "parent_id" column starting at current column and print category name.
|
Breadcrumbs are easier if you use other methods of storing hierarchical data.
See my presentation Models for Hierarchical Data with SQL and PHP for examples of alternatives:
* Path Enumeration
* Nested Sets
* Closure Table
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "php, kohana, hierarchical data"
}
|
In chef remove a node from policy group
I have set the node policy groups
knife node policy set nodename 'xxxx' 'xxxx'
If I want to remove the node from policy groups, how can I do that?
|
I think you can just use empty strings for the policy group and name:
knife node policy set nodename '' ''
If that does not work, you can edit the node and set `policy_name` and `policy_group` values to empty strings.
knide node edit nodename
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "set, chef infra, policy"
}
|
How to set Rails config.time_zone to GMT +6?
When I pop open the rails application.config to set the timezone, I come across an example like this:
config.time_zone = 'Central Time (US & Canada)'
But I would like to try to set my time to something like `GMT+6` unfortunately if I try to use that value I get a Invalid Time Zone error. So what name do I have to use to get GMT+6? I tried looking up the name on TimeandDate.com but that gave me the same error when I tried to put `Kyrgyzstan Time`
Where exactly is the list of time zones rails uses? Or do I have to use some other format like `+0600` (which doesn't work by the way)
Thanks,
|
If you run
rake time:zones:all OFFSET=+6
you will get a list of cities
* UTC +06:00 *
Almaty
Astana
Dhaka
Ekaterinburg
of which the names can be directly used, like
config.time_zone = 'Astana'
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 4,
"tags": "ruby on rails, timezone, utc"
}
|
How come state isn't reset when component is rerendered?
Suppose I have the following inside a functional component:
`const [addComment, setAddComment] = useState(false);`
I do not understand this... Prior to the rerender, the state of addComment has being changed to True instead of False, a rerender of the component does not change it to False again. I thought everything is reran in functional components and thus useState(false) would be called again with addComment being reset to False.
Thank you
|
That's the way useState is designed: The value you pass into useState determines the **initial** value of the state. So on every render after the first, the value you pass in is ignored.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "javascript, reactjs, use state"
}
|
python3 --version - выводит python 3.8.5, при этом я уже установил 3.9
уважаемое сообщество! Собственно, проблема, с которой я столкнулся описана в заголовке. Установил через sudo apt install python 3.9, до этого стояла версия 3.8.5. При этом, насколько я понял, старая версия не удалена и у меня на данный момент две версии python. В pycharm выбрал новый интерпретатор, проект с учетом этого обновился. Но в консоле ubuntu, при просмотре версии python, я вижу только старую. ) AND FAX_PHONE_NUMBER = :FAX_PHONE_NUMBER FETCH FIRST 1 ROW ONLY) AS REGION
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, db2"
}
|
Зачем нужны шаблонизаторы (компонент view в MVC)?
Сейчас делаю небольшой проект с использованием `MVC` фреймворка `Django` на `python`. В любом `MVC` `view` представляется в виде какого-нибудь шаблонизатора. Например, в `java` это `jsp`, `freemarker` и т.д.
Не очень понимаю зачем это надо. Ведь бычно данные подтягиваются `ajax`-запросами, а генерировать страницу на сервере дорого по времени. Обмен между фронтендом и бекэндом происходит через json'ы. Зачем тогда нужен шаблонизатор ?
В смысле, не легче было бы отдавать статику каким-нибудь `nginx` или `apache`, а все данные с сервера получать `json`'ами ?
|
Паттерн MVC впервые был описан работником компании Xerox, SmallTalk программистом Трюгве Ринскаугом в 1978 году. Паттерн относится не только к веб приложениям!.
JSP если я не ошибаюсь был принят в 2002 году.
AJAX - 2005 Год
> VIEW(представление) - это наглядное отображение содержащихся в модели данных. Подмножество модели содержится в отдельном представлении, таким образом, представление действует в качестве фильтра для данных модели. Пользователь взаимодействует с данными модели с помощью предлагаемого представлением наглядного отображения и обращается к бизнес-логике, которая, в свою очередь, воздействует на данные модели
Исходя и вышесказанного view может быть все что угодно, что предоставляет наглядное отображение для взаимодействия с пользователем, будь то сотня jsp страниц или же SAP на ajax'е. Что лучше выбрать для реализовывать представление - это уже вопрос к спецификациям самого проекта.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 3,
"question_score": 4,
"tags": "java, c#, python, любой язык"
}
|
Why is $\{ x: \|x\|=1\}$ compact?
Let $K$ be either $\mathbb{R}$ or $\mathbb{C}$. Let $\mathcal{X}$ be a finite-dimensional normed vector space on $K$. More specifically, let $e_1,\cdots,e_n$ be a basis of $\mathcal{X}$. The norm is defined as $\|\sum a_j e_j\| := \sum |a_j|$.
I would like to show that $S = \\{x\in\mathcal{X}:\|x\|=1\\}$ is compact. I have managed to show that $S$ is sequentially compact, but I'm not sure how to show that it is compact. I know Heine–Borel theorem but I thought it only works in $\mathbb{R}^n$.
Some solutions online use the fact that all norms are equivalent in finitely-dimensional normed space. But ultimately I want to prove that claim, and I suppose showing $S$ is compact is part of the proof.
|
Sequential compactness is equivalent to compactness in metric (so also normed) spaces. So you were actually done already.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "general topology, functional analysis, analysis"
}
|
Linear grammar, derive a word
Assuming a right-linear grammar is given how would you show the steps to derive a word? For example if I had the grammer:
S -> aA
A -> bA
A -> aB
B -> cB
B -> a
And I wanted to constuct the word abbbacca. How would I show my step derivertation? Would it be:
S => A => A => A => A => B => B => B
or somethiong more akin to:
aA => abA => abbA => abbbA => abbbaB => abbbacB => abbbaccB => abbbacca
|
Converting comments to an answer so the question can disappear from the unanswered lists ...
The form
S => aA => abA => abbA => abbbA => abbbaB => abbbacB => abbbaccB => abbbacca
is the more usual, and preferable, way to show the derivation. For extra credit, especially so with larger grammars, it may also be useful to show the label of the rule applied on the derivation arrow, something like
S =(1)=> aA
Of course, for this to be really useful the rules have to have labels !
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "grammar, regular language"
}
|
Laravel PHP app chown privileges
PHP Composer does not want to be run as root. PHP-FPM runs as www-data.
When I create a new laravel app using composer, do I want to create a new user for the app, and then chown the public directory as www-data? Or do I want to sudo as www-data to create the app using composer?
Is sudo running as root, or a super admin? If I create a directory with sudo, it is owned by root. Assuming the OS I use runs super admin tasks as root..? I have much to learn, please offer guidance.
|
Assuming you are in Linux, after you create the project as `root`, you can `chown` your project folder to `www-data:www-data` and don't forget to also `chmod` them.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php, linux, laravel, composer php"
}
|
Cosa significa "convogliare" in questa frase?
Nel libro autobiografico _Un grande avvenire dietro le spalle_ di Vittorio Gassman ho letto:
> Il fatto è che mio padre, Enrico Gassman, **convogliava** l'idea del gigantesco in tutto, statura, voce, collere, romantici abbandoni, tenerezze.
La mia domanda è sul verbo "convogliare" in questo brano. Ho letto tutte le accezioni di "convogliare" nel vocabolario Treccani ma non sembrano avere senso in questo contesto. Per questa ragione vi chiedo: sapreste spiegarmi il significato del verbo "convogliare" nel brano precedente?
|
La terza accezione menzionata nel vocabolario Treccani si avvicina al significato di "convogliare" nella citazione di Gassman:
> 3. Trascinare con sé (riferito a corsi d’acqua): i torrenti convogliano materiali d’ogni specie.
>
Così come un torrente trascina con sé materiali d'ogni specie, Enrico Gassman "trascinava", in senso figurativo, l'idea del gigantesco in ogni suo gesto, atteggiamento, parola.
|
stackexchange-italian
|
{
"answer_score": 6,
"question_score": 3,
"tags": "word meaning, verbs"
}
|
"c'est" or "il est" for use with adjective
> Je ne joue pas au tennis parce **que c'est** trop difficile pour moi.
>
> Je ne joue pas au tennis parce **qu'il** est trop difficile pour moi.
Which one is correct, or both? If both are correct, is there a difference in meaning?
Similarly,
> J'ai une table. Elle est grande.
>
> J'ai une table. C'est grand.
>
> J'ai une table. C'est grande.
|
In the first series, the second one does not work. Only the first one is possible. That is probably because _ce_ refers to the whole _jouer au tennis_ , to which cannot really be assigned an _il_ or _elle_. It's more of an "abstract" thing than required for _il_ or _elle_.
In the second series, only the first one is possible. The other two are broken. It's the reverse here: _table_ is pretty clearly a feminine noun for a concrete thing. So _elle_ not only works, but is even required.
Let's try this:
> Je monte sur la table. Elle est grande.
>
> Je monte sur la table. Ça me fait du bien.
Both are possible. In the first example, _elle_ clearly refers to the table. In the second example, _ça_ on the other hand refers to the action of _monter sur la table_.
|
stackexchange-french
|
{
"answer_score": 6,
"question_score": 4,
"tags": "grammaire, pronoms"
}
|
UITableView - transparent background in iOS 7
I am checking my app with ios 7 beta. I have set background color of `UITableView` to clear color. Its still showing white background. Is there any other way around to make it transparant?
|
Setting tableview backgroundColor to clear color working absolutely fine in iOS 7 chk !this
screenshot see those separator lines for the table cells while the tableview is transparent.
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 24,
"tags": "uitableview, ios7"
}
|
How can I check if code is executed in the IPython notebook?
I have some Python code example I'd like to share that should do something different if executed in the terminal Python / IPython or in the IPython notebook.
How can I check from my Python code if it's running in the IPython notebook?
|
The question is what do you want execute differently.
We do our best in IPython prevent the kernel from knowing to which kind of frontend is connected, and actually you can even have a kernel connected to many differents frontends at the same time. Even if you can take a peek at the type of `stderr/out` to know wether you are in a ZMQ kernel or not, it does not guaranties you of what you have on the other side. You could even have no frontends at all.
You should probably write your code in a frontend independent manner, but if you want to display different things, you can use the rich display system (link pinned to version 4.x of IPython) to display different things depending on the frontend, but the frontend will choose, not the library.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 137,
"tags": "python, ipython, jupyter notebook"
}
|
Android project with Java and Kotlin files, kapt or annotationProcessor?
I would like to know if in an **Android** project mixing **Java** and **Kotlin** files we must use annotationProcessor or kapt, or both ?
In my understanding **annotationProcessor** must be used for **Java** files using annotations for code generation, and **kapt** must be used for **Kotlin** files using annotations for code generation.
I have a project mixing both languages, and I just have replaced all the annotationProcessor dependencies in the build.gradle by kapt. Surprisingly it builds and seems to run correctly but I do not understand why kapt works well even with Java files...
Can someone explain to me ?
Thank you
|
First of all, the Kotlin Annotation processing tool (kapt) uses the Java compiler to run annotation processors. If your project contains any Java classes, kapt takes care of them by design. Kotlinlang recommends using `kapt` incase you used `annotationProcessor` from the Android Support before.
JetBrains has a nice article about how kapt works in more detail, its from 2015 but UP-TO-DATE.
|
stackexchange-stackoverflow
|
{
"answer_score": 38,
"question_score": 37,
"tags": "java, gradle, kotlin, apt, kapt"
}
|
Is there a managed code replacement for Sqlite3 in MonoTouch?
I don't trust the native Sqlite3 in MonoTouch anymore. I keep getting random crashes and although I cannot prove it, I claim that it is not my fault. To verify this I would like to use a managed replacement of Sqlite3. Is there a project that is syntax compatible with the native version? And more important: does somebody have experience with it?
|
Look at the Xamarin cross-platform MWC sample.
While it use the **native** libsqlite on iOS and Android versions it does use a fully managed port of SQLite for the Windows phone version (where SQLite is not available and where it's not possible to add native code).
However that won't tell you what's wrong with your application. If you're using other native libraries in your project I suggest you to remove them (one by one) and try to duplicate the sqlite crash again.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "sqlite, xamarin.ios"
}
|
What type of tree is this? (found in a Tokyo Park)
I'm curious which species of tree this is found in Igusa Mori Park.
\text{ for all $n \geq 1$} \end{equation}
I need to write a recursive definition for it. Here's what I have so far:
\begin{equation} sum(n)=\begin{cases} n, & \text{if $n<1$}.\\\ recurse, & \text{otherwise}. \end{cases} \end{equation}
I'm not entirely sure what the recursive step would be or if the return for a value less than 1 should be n. Can anybody help me out? Thanks!
|
$$\begin{align} sum(0)&=0\\\ sum(n\geq1)&=2^n\sum_{i=2}^{n+1}i \\\ &=2\cdot\left(2^{n-1}\sum_{i=2}^{n}i\right)+2^n\cdot(n+1)\\\ &=2\cdot sum(n-1)+2^n\cdot(n+1) \end{align}$$
Or, \begin{equation} sum(n)=\begin{cases} n, & \text{if $n<1$}.\\\ 2\cdot sum(n-1)+2^n\cdot(n+1), & \text{otherwise}. \end{cases} \end{equation}
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "summation, recursion, recursive algorithms"
}
|
Strange behaviour of Android Studio after BSoD
I was working on my android project in Android Studio ver 0.4.0. Suddenly I've got a BSoD (Windows 7 x86) and after rebooting and launching IDE it has become behave very unusual: all android.* and com.myproj.* imports became unused and all classes became unresolved. I've tried to sync project with gradle files but it hasn't affected. Maybe it's problem around project settings (.gradle or .iml files) but I have no idea what's the problem
|
Upgrade to Android Studio 0.4.3. Those problems have been fixed in this version.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "import, android studio, project, bsod"
}
|
Is there a free 'Helvetica Neue' alternative?
Does anyone know any other fonts similar to Helvetica Neue (free for commercial use)?
I'm working on a big website project where 'Helvetica Neue' is used heavily. I need a font that looks almost the same, is free for personal and commercial use, and looks good even when used with copytext (e.g. fontsize for copytext = 11px, for headlines = 16px).
Also there should be a condensed-font style included (if possible).
|
I still think that **for web** , the best free option out there is Liberation Sans. It renders perfectly with @font-face.
!enter image description here
But you can get Helvetica Neue for web from Fonts.com for web use for a fair price too. I would probably use **font-family:"Helvetica Neue, Helvetica, Liberation Sans, Arial, sans-serif";** so those pcs with the font installed can see it, and those who don't have it can see a replacement.
|
stackexchange-graphicdesign
|
{
"answer_score": 82,
"question_score": 108,
"tags": "website design, web fonts, web safe, font recommendation"
}
|
Displaying <a> in Text-box value
I am trying to display in a textbox value but it not displaying properly.
I am fetching following code from database
<a href=" target="_blank">Click Me</a>
When i am displaying value in textbox it displays like
<input type="text" target="_blank" www.test.com"="" http:="" value="<a href=" id="action_url" name="action_url">
|
Some characters in HTML have special meaning, at least in some context. `"` for example means "start an attribute value" or "end an attribute value".
You have `"` in your data, so it will end the `value` attribute's value when encountered.
If you want to have `"` meaning "A quote mark as data" instead of "End of an attribute value" then you need to express it with the character reference `"`.
The PHP function `htmlspecialchars($string)` will convert most characters with special meaning in HTML to their equivalent character references. (The second argument to that function will modify which characters are converted, so you can specify that all characters with special meaning will be changed).
Any time you have some text that you are inserting into an HTML document, you must run `htmlspecialchars` over it first.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "php"
}
|
Geometry solve for $x$
!triangle
Since the last angle is $77^\circ,$ can I solve this by using law of sines? This would lead us to:
$$\frac{519}{\sin\left(77^\circ\right)}=\frac{190+x}{\sin \left( 60^\circ \right)}$$
And the answer would be $\sim271,29$ meters
|
Make $x$ the _subject_ of your equation. $$x+190=519\times\frac{\sin{60^\circ}}{\sin{77^\circ}}$$ $$x=519\times\frac{\sin{60^\circ}}{\sin{77^\circ}}-190\approx 271.29$$
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "geometry, trigonometry"
}
|
"Maybe IRB bug!"
What exactly does this mean -- "Maybe IRB bug!"? What does that tell me about the potential root cause of an exception?
!enter image description here
Note that the text "Maybe IRB bug!!" was printed after the stack trace as part of the exception output.
|
This message means that IRB detected the cause of the stack trace being inside IRB's own code, not in the code you entered to be executed. And depending on what you did before that, it is thus likely that you triggered a bug in IRB.
A stack trace or segfault of a tool itself (as opposed to an error in user-code) is considered a bug almost all of the time. A tool should never die on user data, but always fail gracefully and with meaningful error messages. The one you see here is an attempt for one of those :)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "ruby on rails, irb"
}
|
Inserting Registered Trademark Symbol/Copyright Symbol into MySQL with PHP
I am having a hard time understanding how to insert the registered trademark sybol and copyright symbol to my mySQL database using php.
When I insert the normal character of the reistered trademark symbol, it returns some random values when I try to retrieve it.
|
You can look into converting the copyright/trademark symbol from and into an HTMLEntity in order to ease data transfer to the database.
**Reference** : <
**Reference** : <
© Copyright Symbol: `©`;
™ Trademark Symbol: `™`;
|
stackexchange-stackoverflow
|
{
"answer_score": 18,
"question_score": 9,
"tags": "php, html, mysql, sql, database"
}
|
Best option for DFS deployment
Initially, we placed the DFS function on the 2 domain controllers but the login times are getting longer/slower and the CPU/memory resources on the 2 domain controllers are almost flatline during peak hours where a lot of users are reading and writing files on the servers. To mitigate this, we plan to deploy 2 new domain controllers, demote the 2 old domain controllers and leave the DFS function on the old servers.
I know that a domain namespace is highly dependent on Active Directory -- is there going to be a performance issue if we split the DFS function from the domain controllers? Is our plan the best approach or is there a better one?
|
Are the domain controllers hosting the DFS namespace and the shared folders? If they're only hosting the DFS namespace then the user activity should have no bearing on the performance of the domain controllers. My recommendation before you go and build new domain controllers would be to run performance monitor on the domain controllers and see what's really causing the problem. You can do this very easily with PerfWiz and PAL.
<
<
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 0,
"tags": "windows server 2008, dfs"
}
|
jQuery UI Date Picker
I am showing the birthday option and have used the jquery ui date picker. The problem is that I want show past dates for example **_starting from 1950 till 2000_** but I don't know how to do that, i tried this but it did not work:
$('#dob').datepicker({
showOn: 'button',
buttonImage: 'images/calendar.gif',
buttonImageOnly: true,
dateFormat: 'mm/dd/yy',
changeYear: true,
minDate: '-20Y',
maxDate: '+1M +10D'
});
Ref:
<
**Update:**
Here is what, I am doing, you could fix that by updating the code there:
<
Thanks
|
$('#dob').datepicker({
showOn: 'button',
buttonImage: 'images/calendar.gif',
buttonImageOnly: true,
dateFormat: 'mm/dd/yy',
changeYear: true,
minDate: new Date(1950, 0, 1) ,
maxDate: new Date(2000, 11, 31),
defaultDate: new Date(1950, 0, 1),
yearRange: '1950:2000'
});
Working Demo is here:
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "jquery, jquery ui"
}
|
Set the default value of an optional 'List(Of t)' parameter to an empty list?
In this example, I can't figure out how to set the optional parameter `c` to an empty `List(Of thing)`:
Sub abcd(a as something, b as something, optional c as List(Of thing) = ?? )
' *stuff*
End Sub
I considered setting `c` to `null`, but that seems like a bad thing to do.
|
You can't. Optional values have to be compile-time constants. The only compile-time constant you can assign to `List(Of T)` is `Nothing`.
What you _can_ do is overload that method with one that omits the `List(Of T)`parameter. This overload can then pass an empty `List(Of T)` to the original method:
Sub abcd(a as something, b as something)
abcd(a, b, New List(Of T)())
End Sub
Sub abcd(a as something, b as something, c as list(of thing))
doStuff()
End Sub
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 5,
"tags": "vb.net, optional parameters, empty list"
}
|
value of $a$ for which $25^x+(a+2)5^x-(a+3)<0$for at least one real $x$
> Find the values of $a$ for which the inequality is satisfied for $25^x+(a+2)5^x-(a+3)<0$
>
> for at least one real value of $x$
$\bf{My\; Try::}$ We can write it as $a(5^x-1)<-\left[25^x+2\cdot 5^x-3\right]$
So $$a < -\left(\frac{25^x-5^x+3\cdot 5^x-3}{5^x-1}\right) = -\frac{(5^x+3)(5^x-1)}{5^x-1} = -(5^x+3)$$
Now how can i solve after that help required, Thanks
|
$$(5^x)^2+(a+2)5^x-(a+3)=(5^x+a+3)(5^x-1)<0$$
If $5^x-1>0,1<5^x<-(a+3)$ which is possible if $1<-(a+3)\iff a<-4$
If $5^x-1<0,-(a+3)<5^x<1$ which is possible if $1>-(a+3)\iff a>-4$
So, we need $a\ne4$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "algebra precalculus"
}
|
How to change the default message text of OTP message sent by twilio verify
I am using Twillio API in my laravel application to send users an OTP, when they try to login through their mobile number. It is working fine, it is sending a message like "Your verification code is XXXXXX". My question is, is there any way so that I can customize the message text?? I want to greet my users when they try to login through the phone. I want to add the greeting line with the default line of verifying the message. Any suggestion is appreciable. Thanks in Advance.
|
Twilio developer evangelist here.
By default you cannot customise the message. As Alan points out, the application name can be set as the service friendly name, which inserts the name in the message
> Your {Service Friendly Name} verification code is: {code}
But this does not allow you to directly customize the text on a per user basis.
There are customization options available but you need to talk to Twilio sales to enable them.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "laravel, twilio, twilio api, twilio twiml"
}
|
Impose character between repeated characters
Given a string of characters `,,a,,,b,,,,` I want to impose the character `-` at the beginning, if no character is preceded comma, and between every comma that has no character. Meaning the result is `-,-,a,-,-,b,-,-,-,-`. Now, I already tried:
echo ",,a,,,b,,,," | sed 's/,/,-/g' | sed 's/-\([^,]\)/\1/g' | sed 's/^,/-&/g'
resulting in: `-,-,a,-,-,b,-,-,-,-`
But the problem is, invoking sed 3 times is inefficient in _very long iterations_. Is there a way to do this with sed, probably using **regex** , or any other tool **invoking it once**?
|
_One_ way to do it in `sed` would be to use a loop:
$ echo ",,a,,,b,,,," | sed ':a; s/\(^\|,\)\(,\|$\)/\1-\2/; ta'
-,-,a,-,-,b,-,-,-,-
If your version supports extended regular expressions you can simplify it to a more readable
sed -E ':a; s/(^|,)(,|$)/\1-\2/; ta'
* * *
An alternate way to do it in `perl`, splitting into comma-separated fields and then mapping empty fields to hyphens:
perl -anle 'print join ",", map { $_ ? $_ : "-" } split(",", $_, -1)'
(The additional `-1` argument to the `split` forces trailing empty fields to be included).
|
stackexchange-unix
|
{
"answer_score": 1,
"question_score": 1,
"tags": "linux, text processing, awk, sed, patterns"
}
|
IAP_CLIENT_ID on GCP
I try to perform a programmatic authentication for authenticating from a desktop app (Link to the tutorial).
I got stuck at the point where the IAP_CLIENT_ID is needed.
> Use the code below where REFRESH_TOKEN is the token from the sign-in flow, IAP_CLIENT_ID is the primary client ID used to access your application, and DESKTOP_CLIENT_ID and DESKTOP_CLIENT_SECRET are the client
How can I generate this IAP_CLIENT_ID? Where can I find it?
|
You need to go to the console:
* API & Services -> Credentials
* Here you have a table `OAuth2 Client ID`
* Find the line with the name `IAP-App-Engine-app`
* Copy the Client ID on the right of the line
;
Note: For version 1.9 and later the method was moved to a plugin.
If you just want another name for jQuery, and not a separate copy, you can just copy the reference:
var copyjq = jQuery;
You can also isolate the name inside a function expression:
(function(copyjq){
...
}(jQuery));
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "jquery"
}
|
Terminal shows black screen Ubuntu 14.04
When I open the terminal in my Ubuntu 14.04 LTS, it shows a black window with no buttons. Nothing's visible, not even the minimise or close button. However all the commands that I type, work perfectly. If I click at the position where the close button should be, it closes. Without the terminal, I cant run any of the command line programs.
This problem has been there ever since I ran the janitor from inside ubuntu-tweak. I deleted cache for chromium and firefox and some other files that I don't remember now. I had removed Unity a year back and have Gnome desktop environment installed. Please help.
|
Janitor seems to purge a lot of packages according to this answer:
How safe is Ubuntu tweak's Janitor?
Post #6 from this link could be helpful:
To list all packages that were removed you can use this command (quoted from link mentioned above):
`grep 'remove' /var/log/dpkg.log`
To install those packages automatically you could use a tool like `sed` to transform the output of given command to a suitable format for installing it with `apt-get`.
Or use `cut` and `xargs` like:
`grep 'remove' /var/log/dpkg.log | cut -d " " -f 4 | xargs -I {} apt-get install {}`
To avoid prompts you could use this:
export DEBIAN_FRONTEND=noninteractive
grep 'remove' /var/log/dpkg.log | cut -d " " -f 4 | xargs -I {} apt-get -y install {}
Of course if you want to see the commands you are typing you could as a temporary solution use a virtual console `Ctrl`+`Alt`+`F1` through `Ctrl`+`Alt`+`F6`.
|
stackexchange-askubuntu
|
{
"answer_score": 0,
"question_score": 0,
"tags": "14.04, bash, gnome terminal, dash shell"
}
|
Connect to https:// webservice in asp.net app
I have an ASP.NET website that is contacting a webservice. Everything works fine connecting via http but when I try https:// it can't connect. I don't seem to get any error from the website and the webservice logs show nothing, meaning nothing has connected to it.
I can connect to my https:// webservice from a site like soapclient.com and request information, so the webservice and ports are working.
Is there anything special I should be doing in order to connect to a https:// webservice over a normal http:// one in .NET? All I am doing at the moment is changing the URL it is connecting to to my secure one instead.
I am using ASP.NET 2, IIS7
Thanks in advance.
EDIT: Just found the actual error message: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel - Which in my eyes tells me I haven't added my self signed certificate to the installed certs on the server ... but I have ...
|
You need to add your self-signed certificate under Trusted Root Certificate Authorities in the Local Computer store of the server running the ASP.NET website.
Export the certificate from the webservice server as a .cer file, and copy it to the server running the ASP.NET website. Then, on that server:
1. Double-click the .cer file and Install Certificate
2. In the wizard, choose the store as the Local Computer folder under Trusted Root Certificate Authorities.
3. You might have to restart IIS, or the server
There are some good instructions towards the bottom of this page, under "Installing the self-signed certificate on client computers": <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "asp.net, iis 7, web services"
}
|
Struts - Using multiple submit buttons for one form? (How to know which was clicked)
I have 3 buttons for a form I would like to submit. I'm new to struts and I was wondering, is there a way to find which button was clicked? In my html I have this
<html:form action="myAction.jspa">
<div align="right">
<html:submit value="back" />
<html:submit value="continue Later" />
<html:submit value="submit" />
</div>
</html:form>
And in my Java `Action` class in the `execute()` method, I attempt using `request.getParameter("back")` to check if the back button has been pressed but it doesn't work. How does one handle multiple submit buttons in struts?
Thanks for help in advance :)
|
Use the `property` attribute on your `<html:submit>` tag to specify the name of the request parameter that you'll check in your action.
JSP
<html:submit property="back">back</html:submit>
Action
if(request.getParameter("back") != null) {
// back button was clicked
}
You can, alternatively, give all of your submit buttons the **same** property, then check the value of the parameter in your action. However, that adds additional internationalization concerns (you'd need to check for non-English translations of the same string).
For more information, see the Struts API.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 2,
"tags": "java, struts"
}
|
Changing Text of HTML Button Using Outside JS Variable
In my main HTML file, I create a variable using this script:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
//Creation of answerjson not shown
var choiceOne = answerjson[0].choice;
});
Later in my HTML, I create a button within a div using this code:
<div id= "one"><button class="button" id = "b1"></button></div>
How can I display the value of choiceOne as the label on button b1? I've searched online, but only found answers to this problem when the button is not in a div.
|
var choiceOne = "Some Text";
// jQuery
$("#b1").text(choiceOne);
// Regular JavaScript
document.getElementById("b2").innerHTML = choiceOne;
<script src="
<div id="one"><button class="button" id="b1"></button></div>
<div id="two"><button class="button" id="b2"></button></div>
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -1,
"tags": "javascript, jquery, html"
}
|
Can someone guide me through these two convergence & divergence problems?
1. $A_n = \cos(\frac{n\pi}{2})$
2. $A_n = \frac{\ln(3n)}{\ln(n)}$
* * *
So, for the first one, it looks like I'll have to use the squeeze theorem.
$ -1\le \cos(\frac{n\pi}{2}) \le 1$
I'm slightly confused, am I able to take the limit of $-\frac{n}{2}$ and the limit of $\frac{n}{2}$ These would come up with different limits though.
* * *
For the second one, it comes out as infinity/infinity so I'll have to use L'Hospital's rule and take the derivative.
My derivative, using the quotient rule, comes out as:
$\frac{ \ln(n)*\frac{1}{n} - \ln(3n)(\frac{1}{n})} {(\frac{1}{n})^2}$
This leaves me with $\frac{\infty - \infty} {0} $
The top is an indeterminate form, but the bottom is 0. Do I take the derivative again, or is the answer 0?
|
I presume you mean the limit of the sequence where $a_n$ defines the $n$th term of the sequence...
$\cos(n\pi/2)=\\{0,-1,0,1,0,\dots\\}$ so $\displaystyle\lim_{n\to\infty} \cos(n\pi/2)$ does not exist.
$\displaystyle\lim_{n\to\infty}{\ln(3n)\over \ln(n)}=\lim_{n\to\infty} {{3\over 3n}\over {1\over n}}=1$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "calculus, sequences and series, limits, convergence divergence"
}
|
Who tips off the MacManuses about the Russian mafia meeting?
When the MacManuses leave the police station, one of them calls a number from a phone in the station and is informed of a location, presumably that of the Russian mafia meeting. Who is the informant? What was his motive?
|
It's been a while since I've seen the movie but they are informed through a pager with the info.
They got the pager from the Russian mobsters who tried to kill them at their flat (after the bar fight). After the interrogation with the FBI agent, where we learned that they speak a wide variation of languages fluently (Russian included), they get a phone number paged on the russian pager.
One of the MacManuses calls the number and they get the adress and the hour of the meeting etc.
As it is stated on Wikipedia
> Connor learns of a meeting of Russian syndicate bosses at a hotel from a pager taken from one of the dead Russian mobsters.
|
stackexchange-movies
|
{
"answer_score": 1,
"question_score": 1,
"tags": "plot explanation, boondock saints"
}
|
Prevent an instance of NSView from receiving mouse events
I have an NSView in a window with core animation layer turned on. I use this view to display images with animation from time to time. I need the entire view to be the back layer not only the images. Behind this view which I call AnimationBaseView are other views which the user interacts to.
Everything is ok except the AnimationBaseView prevents the other views from getting rightMouseDown events.
I've tried the following:
* returning NO to acceptsFirstResponder to AnimationBaseView
* Hiding and unhiding the AnimationBaseView as needed, but produces a nasty flicker.
Thank you for your help, Jose.
|
Override `- (NSView *)hitTest:(NSPoint)aPoint` to return either `nil` or the view that should handle the mouse events
|
stackexchange-stackoverflow
|
{
"answer_score": 15,
"question_score": 2,
"tags": "cocoa, macos, nsview, nsviewanimation"
}
|
How to build electron application with assets folder by Electron-builder
I have built an application with electron-builder. There was a video in `media` folder in the development area. But when I built the application I figure out the video folder replaced with `asar` file in a resource folder in C://Programs.
I want videos to have in `media` folder in production. How can I do that
|
You may want to try with `asar: false` in your `package.json` file. But, this is not the recommended way to do it.
The best you can do is to add the resources you want to keep outside the asar file with the `extraResources` directive:
"build": {
"extraResources": [
{
"from": "../media",
"to": "media",
"filter": [
"**/*",
"!*.mp3",
]
}
],
"asar": false,
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 4,
"tags": "electron, electron builder"
}
|
How to save image on Google map in iPhone
I have map application in which I have a button. On clicking that button the user can capture image through iPhone and the image that is captured by the user should be save on the map at the particular location where he has captured the image.
|
If you know where you want to display image on map then you have two ways to display particular image on map.
1\. You can add image as a overlay on map. Below link contains code in question: code link
2\. Add image as a annoation. (<
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "iphone, objective c, image, camera, mapkit"
}
|
How much does C help you in other languages?
How much does learning C to moderate level help you as a programmer. For example, does being competent in C make it easier to pick up languages as time goes on and get a better understanding of them?
|
Learning C will only help you in learning languages which are very much like C. But then, what do you gain from you learning them? The further away from C the language you want to learn is, the less learning C will help you.
In particular, C is missing a lot of concepts, paradigms and ideas that are present in more modern languages: first-class procedures, Objects, Algebraic Data Types, parametric polymorphism, ad-hoc polymorphism, inclusion polymorphism, subtyping, inheritance, delegation, concurrency, parallelism, asynchrony, modularity, first-class control flow (e.g. continuations), static compile-time metaprogramming, dynamic metaprogramming, higher-kinded types, rank-n types, dependent types, type inference, dynamic typing, EDSLs, … (those are just a few that spring to my mind).
|
stackexchange-softwareengineering
|
{
"answer_score": 3,
"question_score": 1,
"tags": "programming languages, c"
}
|
Folder in root greyed out in Finder but accessible in Terminal
I've just migrated from an old MBP to a new one. I had a folder `Transmachina` in the root in which I keep a large SVN working copy. I just copied this over with `cp -R` but on the new machine this folder is greyed out in Finder, and I can't navigate into it.
In terminal, I can access it fine as my user (no `sudo`) and the permissions are:
drwxr-xr-x 56 nic wheel Transmachina
which are the same as on the old machine. Both are running 10.8.2, but the old machine was 10.5 when originally purchased and configured.
Update: `xattr -l Transmachina` doesn't show anything at all.
Any ideas on how I can fix this?
|
I found my answer here: <
Use a command like this on the folder:
`SetFile -d 06/13/2011 PATH/`
|
stackexchange-apple
|
{
"answer_score": 8,
"question_score": 5,
"tags": "finder, permission"
}
|
How to add class attribute to ModelForm
I have model:
class TestPolja(models.Model):
class Meta:
verbose_name = 'Test polja'
integerPolje1 = models.IntegerField('integerPolje1')
charPolje1 = models.CharField('charPolje1',max_length = 1024)
bigint1 = models.BigIntegerField('bigint1',default = 67573737)
date = models.DateField('date')
and modelForm:
class TestPoljaForm(ModelForm):
class Meta:
model = TestPolja
How to change `TestPoljaForm` to add `class` attribute to `<input>` tag?
How to add widget?
|
You can do it in `__init__` form method:
class TestPoljaForm(ModelForm):
class Meta:
model = TestPolja
def __init__(self, *args, **kwargs):
super(TestPoljaForm, self).__init__(*args, **kwargs)
# for example change class for integerPolje1
self.fields['integerPolje1'].widget.attrs['class'] = 'SOMECLASS'
# you can iterate all fields here
for fname, f in self.fields.items():
f.widget.attrs['class'] = 'SOMECLASS'
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "django, django forms"
}
|
Log Transformation Instead of Z-Score Normalizatrion For Machine Learning
I almost always used Numpy's StandardScaler to normalize my data for machine learning. I noticed however that simply taking the log of the variables that I wanted to normalize often resulted in better accuracy compared to when I used the StandardScaler method.
To give some more context, I built several binary classifiers for different purposes both with ANNs and XGboost and I noticed that log-normalizing the data always leads to better accuracy.
I'm a little puzzled by this as nobody ever mentions log-normalization as a valid normalization technique. Everyone talks about min-max normalization and Z-score/Numpy's StandardScaler but no one even mentions log-normalization.
How is that possible? Am I doing something wrong?
|
It is quite often to use the log transformation on your data, if your data are always positive (e.g. the price of something) and their scales varies drastically.
A simple criterion of whether you should use log transformation is whether you want to use a linear or log scale for your x-axis when you are plotting the histogram of your data.
This is likely to make your ANN work better if your data indeed look that way, because of one reason: Remember the motivation of batch normalization - ANN likes to have a standard normal distribution. You can make your distribution zero-centered with unit variance, but that does not make your distribution into a normal distribution, but your distribution might look more like a normal distribution if you use log transformation. You can check whether this is true from the histogram or the Kurtosis of your distribution.
|
stackexchange-stats
|
{
"answer_score": 4,
"question_score": 5,
"tags": "machine learning, python, data transformation, normalization, numpy"
}
|
Работа с Picasso(Android), загрузка в ресурсы
Подскажите, как можно загрузить изображение не в ImageView а в папку с ресурсами либо установить загруженное изображение сразу в качестве фона Activity/Fragment'а
|
Загрузить что-то в ресурсы в момент исполнения программы невозможно - ресурсы упаковываются в `apk` файл в момент компиляции.
Отобразить загруженную картинку в виде фона просто. Для этого загрузите картинку и в колбэке окончания назначьте фон нужному элементу разметки так:
Picasso.with(getActivity()).load(R.drawable.table_background).into(new Target(){
@Override
public void onBitmapLoaded(Bitmap bitmap, LoadedFrom from) {
mainLayout.setBackground(new BitmapDrawable(context.getResources(), bitmap));
}
@Override
public void onBitmapFailed(final Drawable errorDrawable) {
Log.d("TAG", "FAILED");
}
@Override
public void onPrepareLoad(final Drawable placeHolderDrawable) {
Log.d("TAG", "Prepare Load");
}
});
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "java, android, picasso"
}
|
How to count number of values in the randomly generated list?
I have created a random list by below command:
import random
a=[random.randrange(0,100) for i in xrange(50)]
print a
Now, what could be the command for counting the number of values that are between 0 and 9, 10 and 19, 20 and 29, and so on.
I can print them as below:
import random
a = [random.randrange(0,100) for i in xrange(50)]
for b in a:
if b<10:
print b
But, I don't know how to write a command to count the number of the values after printing b. Thanks for your comments.
|
Just make a dictionary, enumerate and count.
>>> import random
>>> a = [random.randrange(0,100) for i in xrange(50)]
>>> a
[88, 48, 7, 92, 22, 13, 66, 38, 72, 34, 8, 18, 13, 29, 48, 63, 23, 30, 91, 40, 96, 89, 27, 8, 92, 26, 98, 83, 31, 45, 81, 4, 55, 4, 42, 94, 64, 35, 19, 64, 18, 96, 26, 12, 1, 54, 89, 67, 82, 62]
>>> counts = {}
>>> for i in a:
t = counts.setdefault(i/10,0)
counts[i/10] = t + 1
>>> counts
{0: 6, 1: 6, 2: 6, 3: 5, 4: 5, 5: 2, 6: 6, 7: 1, 8: 6, 9: 7}
# Means: 0-9=> 6 numbers, 10-19=> 6 numbers etc.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, random, count"
}
|
Asp.Net - Is there a way to set attribute to all controls of the application?
I have a system and I had a problem today, when the user double-click on button control and the system process the operation twice. I found a solution with this code on the button:
OnClientClick = "this.disabled = true; this.value = 'submiting ...';" UseSubmitBehavior = "false"
However, I have several pages in the system, with several buttons ... is there any way to set these attributes to all the buttons of the application? Thank you!
|
What about using a **clientSide approach** by using JQuery and **disabling all Submit controls** (jsfiddle)
$(document).ready(function () {
$(' :submit').click(function (event) {
$(this).attr("disabled","true");
});
});
I am quite new to JQuery so if there are any better solutions or I am completly wrong, pls let me know!
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net, button, double click"
}
|
PHP Use thread safe or not
I am building a web server install for a production server on a windows 2008 R2 64 bit server
I have installed Apache 2.4 64 bit and that is working fine
Next step, PHP
I have read about the differences between thread safe and not but just cant seem to grasp which I should be using (and why).
Can anybody confirm which PHP Install I should use with my current setup?
|
You should look at the PHP docs:
> Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each thread, so that the data won't collide with another thread.
>
> So what do I choose? If you choose to run PHP as a CGI binary, then you won't need thread safety, because the binary is invoked at each request. For multithreaded webservers, such as IIS5 and IIS6, you should use the threaded version of PHP.
So for example, if you use `FastCGI` with Apache, go for the non-thread safe, and if you use LoadModule, go for the thread-safe version.
|
stackexchange-stackoverflow
|
{
"answer_score": 17,
"question_score": 12,
"tags": "php, windows, multithreading"
}
|
How to create a Speech bubble in cocoa-Touch
How can I create a speech-bubble like context menu like in the Safari-Browser on the iPhone/iPad.
I would like to create a kind of context help.
Thanks in advance,
Stefan
|
That "speech-bubble like context menu like in the Safari-Browser" is a UIPopoverController. It is only available on iPad. See
* Using Popovers to Display Content
A UIActionSheet can also be shown as popover style with `-showFromBarButtonItem:animated:` or `-showFromRect:inView:animated:` on the iPad.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "iphone, cocoa touch, uikit"
}
|
Did the old-west style duels (as depicted in movies) actually occur?
Not sure whether this is better off here or on movies.se
It's a well-known movie cliché where two gunslingers stand in the middle of the street (possibly at high noon), staring intently at each other, hands hovering over the holsters - suddenly the villain goes for his gun. However, the hero, being "quickest on the draw" is too fast for him, draws his gun and shoots the villain first.
Did these types of gunfights really occur? It seems a bit unbelievable that they would wait for each other like that, rather than shooting their enemy as soon as they saw him. Would there have been an advantage in waiting for the other guy to go for his weapon first before you go for yours? I would think that even if you were quicker than him, you'd still draw as soon as possible rather than wait to react to him...
|
Not all were that ordered, and it may have been the exception rather then the rule, but it did happen:
> Both men faced each other sideways in the dueling position and hesitated briefly. Then Tutt reached for his pistol. Hickok drew his gun and steadied it on his opposite forearm. The two men fired a single shot each at essentially the same time, according to the reports.[4] Tutt missed, but Hickok's bullet struck Tutt in the left side between the fifth and seventh ribs. Tutt called out, "Boys, I'm killed," ran onto the porch of the local courthouse and back to the street, where he collapsed and died.
The Wild Bill Hickok – Davis Tutt shootout
Note that from the sideways stance this resembled the classic style duel from earlier times.
For a list see this: List of Old West Gunfights. (Not just street gunfights, but many have their 'Hollywood' style reproductions as well.)
|
stackexchange-history
|
{
"answer_score": 13,
"question_score": 7,
"tags": "old west, movies"
}
|
How to add zero to single digit in a string
I need to to append zero in my below string whenever I get date with single digit without changing Quantity digit ( _below string is system generated in my application not created by user_ ),
> Data Added Quantity:1 on Dec **9** 2015 modified on Jun **7** 2016
I need to change this string just like below,
> Data Added Quantity:125 on Dec **09** 2015 modified on Jun **07** 2016
So far I have tried the below regular expression, but not getting desired output.
str = "Data Added Quantity:1 on Dec 9 2015 modified on Jun 7 2016"
Set oReg = New RegExp
oReg.Pattern = "\s\d{1}\s"
Set obj = oReg.Execute(str)
For i = 0 To obj.Count-1
mD = obj.Item(i).Value
oReg.Replace(str, "0" & mD)
Next
How we can achieve this using VBScript?
|
If you adjust the pattern a little and set the `Global` option to `True` you can simply use the `Replace` method. No need to `Excecute` and loop.
Set re = New RegExp
re.Pattern = "\s(\d)\s"
re.Global = True
str = re.Replace(str, " 0$1 ")
`\d` without a modifier already matches exactly one digit, so `\d{1}` is redundant. The parentheses around the `\d` define a capturing group that allows you to use the matched substring in the replacement (`$1`).
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "vbscript, qtp, hp uft"
}
|
Argument Exception
Exception:
> The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
Method where exception happened:
/// <summary>
/// Initializes a new DSAplcEntities object using the connection string found in the 'DSAplcEntities' section of the application configuration file.
/// </summary>
public DSAplcEntities() : base("name=DSAplcEntities", "DSAplcEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
What exactly does this exception mean and how can I fix it?
|
Found the solution. The problem was that I was using WCF Services in my project and I did not copy the connection string to the App.Config inside the service solution.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "entity framework, entity, argumentexception"
}
|
How to find the numbers that sum up to a given number?
I have a list of numbers, finite, about 50 and I want to know which permutations with subsets of that set sum up to a given number. I found a formula for the number of ways but I don't know how to find the actual numbers. Can you help me?
|
I assume you mean you want to find the subsets of your list whose sum is a given number $S$. You can do it with dynamic programming. Suppose your numbers $x_1, \ldots, x_n$ are positive integers and the target sum is $s$. If $A_{k,m}$ for $1 \le k \le n$, $0 \le m \le s$, is the number of subsets of $\\{x_1, \ldots, x_k\\}$ whose sum is $m$, we have $A_{1,0} = A_{1,x_1} = 1$, $A_{1,m} = 0$ otherwise, and for $k \ge 2$, $A_{k,m} = A_{k-1,m} + A_{k-1,m-x_k}$ if $m \ge x_k$, $A_{k-1,m}$ if $m < x_k$.
Now if $A_{k,m} > 0$ we enumerate the subsets of $\\{x_1,\ldots,x_k\\}$ with sum $m$ recursively as follows: if $A_{k-1,m} > 0$, first enumerate the subsets of $\\{x_1,\ldots,x_{k-1}\\}$ with sum $m$; then if $m \ge x_k$ and $A_{k-1,m-x_k} > 0$ enumerate the subsets of $\\{x_1,\ldots,x_{k-1}\\}$ with sum $m-x_k$ and adjoin $x_k$ to each.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 1,
"tags": "combinatorics, binomial coefficients"
}
|
Powershell Array replace value
This is probably a very simple question but I am new to powershell arrays.
I have a multidimensional array in powershell which is populated from a CSV file. eg:
$data = Import-CSV \\filelocation\file.csv
$data
company emailaddress
------- ------------
company1 emailaddress1
company2 emailaddress2
I can view a specific value in the array with the following:
write-host $data.emailaddress{1]
which will output: "company2".
I want to be able to replace a string in the array but if I use the following:
$data.emailaddress[1] = "NEWemailaddress"
and
write-host $data.emailaddress{1]
then the data is still the same.
How do I get the value to overwrite?
Thanks
|
I think what you have is an array of objects not a multi dimensional array. Try this:
$data[1].emailaddress = "NEWemailaddress"
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "arrays, csv, powershell, multidimensional array"
}
|
C/C++/Java interpreter
Why has no one ever made a C/C++/Java interpreter which requires no compilation to run? It can't be that hard to make something akin to IDLE for Python.
The same goes for other languages such as FORTRAN, Pascal and others. Is there some kind of code based reason for this or is it just that people prefer to compile their code.
|
C and C++ are languages designed to be compiled and generate fast and efficient code.
Interpreters, by the definition that they "interpret" the code, are generally slow (or at least slower than the same compiled language, assuming a good compiler).
However, there are combinations of clang and llvm-jit that could be (and has been) built into an "interpreted version of C or C++". I think there are some limitations, and I've never actually used it.
There is no great technical reason NOT to do this, it's just that it's about the same amount of work, if not more than, the work to write a compiler, and the end result of writing a compiler is "better".
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -1,
"tags": "java, c++, c, interpreter"
}
|
surprising compilation error getting the array class of a class
Lately I've been doing a lot with reflection and implemented this little utility method. I was surprised to find that the first version does not compile, but the latter does.
Does not compile:
public static <T> Class<T[]> getArrayClassOfType(Class<T> componentType) {
return Array.newInstance(componentType, 0).getClass();
}
Compiles and works just fine:
public static <T> Class<T[]> getArrayClassOfType(Class<T> componentType) {
Class c = Array.newInstance(componentType, 0).getClass();
return c;
}
Two questions: what's wrong with it? is there a better way of doing this?
Here's the compilation error from the first:
TypeUtils.java:[12,60] incompatible types: java.lang.Class<capture#1 of ? extends java.lang.Object> cannot be converted to java.lang.Class<T[]>
|
The return type of `getClass()` is `Class<?>`.
In your example, you are assigning `Class<?>` to `Class<T[]>` (in the return statement), which is wrong, you need a cast.
This will compile fine:
@SuppressWarnings("unchecked") // added to suppress compiler warning
public static <T> Class<T[]> getArrayClassOfType(Class<T> componentType)
{
return (Class<T[]>) Array.newInstance(componentType, 0).getClass();
}
With your second example, you use raw type `Class`, which works OK - casting raw type seems to be implicit. However, you will get a compiler warning, since this is a discouraged technique.
If you properly parametrize it as `Class<?>`, you will need the cast too.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 8,
"tags": "java, generics, reflection"
}
|
how did Detective Keith Frazier & Detective Bill interrogate hostages?
How did Detective Keith Frazier & Detective Bill interrogate hostages face to face in _Inside Man_ , if they are under captive of Dalton?
Dalton released that heart patient guy at the start of the movie, that's all. But in this image these two guys interrogating **old woman** , how?
.
Wikipedia explains:
> Nonlinear narrative, disjointed narrative or disrupted narrative is a narrative technique, sometimes used in literature, film, hypertext websites and other narratives, where **events are portrayed, for example out of chronological order,** or in other ways where the narrative does not follow the direct causality pattern of the events featured, such as parallel distinctive plot lines, dream immersions or narrating another story inside the main plot-line. It is often used to mimic the structure and recall of human memory, but has been applied for other reasons as well.
|
stackexchange-movies
|
{
"answer_score": 3,
"question_score": -1,
"tags": "plot explanation, inside man"
}
|
SDL_Events with no SDL window
I want to use SDL to handle my events but I'm using OpenGL for graphics. Is there a way to use the event handleing of SDL even though I don't actually have any active SDL window?
|
If you're using OpenGL for graphics, you must have a window somewhere to contain the OpenGL canvas. I very much doubt that you will be able to get any input from SDL's API's unless SDL is managing the window. At least on Win32 systems, all input comes through the window message callback, so unless SDL is tied into that, it won't see any input messages at all.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 0,
"tags": "c++, opengl, sdl"
}
|
How to align elements properly using CSS
My site layout is very simple. I want it to look something like this:
* One row of text that spans the width of the page.
* Four separate columns of text below that.
* Two columns below that where:
* The column on the left is thinner and spans the remaining height of the page.
* The column on the right has one short row of text and then another row of text below it that spans the remaining height of the page.
. It's up to the designer/developer to divide this to independent groups (like sidebar, headers, footers, content etc.)
Learning the fundamentals is quite important. this site has pretty decent intuitive tutorial HTML
Also checkout
* Designing a HTML5 layout from scratch
* Semantic HTML5 layout
Also take cues from the websites you bump into with the help of developer tools packed with browsers.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "css"
}
|
Conditional Formatting for rows
How do you drag the conditional formatting across the row? For example I have color red for not equal to and green for equal to, but how can you apply the conditional formatting across the row "Due" for the other dates? enter image description here
|
Your conditional formatting rules seem to be wrong.
That should do it:
1. Erase your current "Conditional formatting" rules.
2. Select the desired cells in row 10, starting from `F10`.
3. Click _Conditional formatting_ / _New rule_ / _Formula_.
4. Enter `=F$10=F$11`, click "format" and choose green fill color. Confirm with "OK" twice.
5. Repeat step 2 and 3.
6. Enter `=F$10<>F$11`, click "format" and choose red fill color. Confirm with "OK" twice.
**Note** : The formula is always based on the active cell (the one you choose first in your selection, here `F10`).
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "excel, conditional formatting"
}
|
Using setCentralWidget on a subclass of QWidget?
Not sure if I'm even asking this question correctly because I'm new to C++ and Qt. But, say I have a subclass of QWidget:
class childofqwidget : public QWidget
Can I pass a pointer to an object of subclass to the setCentralWidget member function of QMainWindow? Something like this:
mainlayout = new childofqwidget;
setCentralWidget(mainlayout);
The reason I'm asking is because I've made a subclass of QWidget which has a layout with a textbox and some buttons. I'd like to insert this as the central widget of the QMainWindow object. Is this possible? If not is there a better way I should do this?
|
Yes that's perfectly fine, and that's the usual way to do it.
(Call a variable `layout` when it's a `widget` is a bit unusual/confusing though, but that's just naming.)
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 2,
"tags": "c++, qt, qmainwindow"
}
|
Can I accelerate swap by using multiple harddrives?
I still have two old ATA drives (one is only 8GB, one is somewhat defect) and I've been thinking about putting them into my PC and activating swap on them, too. What will be effect of this? Will my system spread data across the drives evenly so that swapping becomes faster?
|
Firstly, using a slow or defective hard drive for swap is not a good idea. It's like having really slow or buggy memory in a way.
How your system spreads data across your swap partitions depends on the priority you give them in your `/etc/fstab`
As an example,
/dev/hda5 none swap sw,pri=2 0 0
/dev/hdb5 none swap sw,pri=1 0 0
/dev/hdc6 none swap sw,pri=3 0 0
Your system will use the partition with the highest priority first (in this case `/dev/hdc6`). Priorities go from 0 to 32767. You can assign the same priority to the different partitions and that will make your system use them equally (or spread the load across different drives). The main reason for this is that you want to use a faster (or less used but still fast) drive first, as it can have a major impact on your system.
You can change your system's tendency to write to swap by setting `swappiness`. More info here.
|
stackexchange-unix
|
{
"answer_score": 8,
"question_score": 7,
"tags": "linux, swap"
}
|
Compare strings with numeric values
I have searched many hours how to compare this two strings ( and have str1 equal str2 == YES):
This string is given by a user input in my interface (search bar)
NSString *str1 = @"11,2";
This string is a property of my model object
NSString *str2 = @"11.2";
i have tested this but it's not working
if ([str1 rangeOfString:str2 options:options range:NSMakeRange(0, [str1 length]) locale:[NSLocale currentLocale]].location == NSNotFound
Witch is the best solution to compare the two NSStrings and have `str1` equal `str2` that returns YES ?
Edit :
I know that i can do it simply by replacing the "," by "." and the do the comparaison, but i am searching an elegant solution that take the fact that 11.2 and 11,2 are the same in different locales ( using `NSDecimalNumber` for example).
|
You've just essentially answered your own question - use `NSDecimalNumber` to parse the user's input according to the current locale. Parse your string using your locale (or better yet keep it as a floating point value. That should solve your problem apart from the standard issue that comparing floating point values for exact equality is not advised, though `NSDecimalNumber` may help you address that. HTH
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "objective c"
}
|
What (electrical) property does $\alpha$ represent with units of $\textrm{K}^{-1}$?
What property does $\alpha$ represent in the following passage?
> . . . A block (made of material of $ρ_o = 0.5 \, Ω·m$ and $α=0.004\,\textrm{K}^{-1}$) with dimensions ℓ = 8 cm, w = 3 cm, and h = 6 cm is maintained (by external means) at room temperature (20 $ ^{\circ}$C) . . .
|
Presumably it is the linear temperature coefficient of resistivity (or of resistance as they come down to the same thing).
|
stackexchange-physics
|
{
"answer_score": 1,
"question_score": 0,
"tags": "electricity, electrical resistance"
}
|
Background color change shown in debugger, but not on screen
I am trying to change the `background color` of an element. The debugger in Chrome tells me I have done so, but the color does not show up on screen.
This particular element has `!important` for the `background color`.
If I try to do the same thing on an element without `!important` it works.
It does not seem to matter if I do the changes from javascript only, jQuery or the debugger.
I am quite a bit confused at the moment, but perhaps I can guess rather safely assume that there is a bug in either Chrome or its debugger, or?
Maybe it matters that this is in a bookmarklet. (And this prevents me at the moment to even test it in Firefox)
Any ideas are welcome!
|
Since no code was added, this is just an educated guess... well... 2 guesses:
1. The element has display: inline. Try adding display: block !important (might kill your layout, but is just a test)
2. It has somewhere else, no background with important also, with higher priority.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, css, debugging, google chrome, bookmarklet"
}
|
Expanding menu on click
I have a basic menu looking something like this.
<ul id="menu">
<li id="auctions">Auctions</li>
<li class="submenu">Submenu 1</li>
<li class="submenu">Submenu 2</li>
<li class="submenu">Submenu 3</li>
</ul>
I want the three submenus to be hidden until the text "Auctions" is clicked. Then they're supposed to appear, and become hidden again when "Auctions" is clicked a second time and so on. Ive tried something like this.
$(function() {
$('#auctions').click(function() {
$('#menu').animate({'height': '200'});
$('#submenu').animate({opacity : 'toggle'});
}, function () {
$('#menu').stop().animate({'height': '100'});
$('#submenu').animate({opacity : 'toggle'});
});
});
In all honesty I suck at jquery. How do I approach this?
|
Use jQuery's `.slideToggle()`, also make sure `.submenu` is not visible:
JAVASCRIPT:
$(function() {
$('#auctions').click(function(){
$('.submenu').slideToggle();
});
});
CSS:
.submenu{display:none;}
DEMO: <
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 1,
"tags": "javascript, jquery, html, css"
}
|
How to iterate hashmap in JSP using strut tag
I can print value of a key of HashMap as below
<%
HashMap<String,String> students = new HashMap<String,String>();
students.put("1","Amit");
students.put("2","Amit");
students.put("3","Anil");
students.put("4","Amit");
session.setAttribute( "students", students );
%>
<bean:write name="students" property="1" />
<bean:write name="students" property="3" />
How can i print key and its value iteratively?
|
Well!! I dint get this answer anywhere after googling. But somehow, hitting the ground, I done it without using EL or scriptlets.
<logic:iterate name="students" id="nameObj" scope="session">
<bean:write name="nameObj" property="key"/>
<bean:write name="nameObj" property="value"/>
</logic:iterate>
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "jsp, struts, hashmap"
}
|
How to connect contour lines from two different sources?
How to connect contour lines from two different sources (LiDAR & Photogarametry) in order to obtain continuous and uniform contour lines layer ? how can i interpolate them together ? How can i Snap lines only if they have the same Height value ?
!contours from 2 sources
|
Since the distance between the lines in your two data sources can vary greatly (at least it looks like this on the picture), you might need to do some manual work. However, I'd suggest trying the Extend line GP tool (Editing toolbox) or Snap tool (same toolbox).
> This tool extends line segments to the first intersecting feature within a specified distance. If no intersecting feature is within the specified distance, the line segment will not be extended.
You might also test to use the Load Objects to load features from one source to another and set snapping settings. I use it quite often when "merging" road datasets from different sources and it reduces amount of manual work that will be needed to get done anyway.
There is a great blog post from Esri, where you can get more tips on data processing for such cases. They mention also using Integrate tool, Trim line and some other custom GP tools the Esri Editing team has published.
|
stackexchange-gis
|
{
"answer_score": 2,
"question_score": 3,
"tags": "arcgis desktop, interpolation, lidar, contour"
}
|
How to acess a fragment function in the activity? Android
I have an activity with several fragments. In that activity I want to be able to access a function created in a fragment.
Fragment:
public class RandomFragment extends Fragment {
public void randomfuntion (){
}
}
Activity:
public class Main extends FragmentActivity{
Fragment randomname;
public void anotherrandomfuntion (){
randomname. // I want to have access to randomfuntion
}
}
Help?
|
`(RandomFragment)randomname.randomfuntion()` should work
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, android fragments"
}
|
Cannot find the requested object in Moon_Apns
I am doing apple push notification using Moon-Apns library but i am stuck with an error "Cannot find the requested object".
!enter image description here
!enter image description here
What i am missing here? please help me.
|
Have you placed the .p12 file in respective location of server.. i think that may be the cause of this error and let me know the problem exactly...
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": ".net, push notification, apple push notifications, x509certificate, moonapns"
}
|
Map from a manifold to $[0,1]$
I am looking through a practice exam to prepare for an upcoming final and I am having through with this question.
**Question:** Let $M$ be a manifold, $p \in M$, and $U \subset M$ an open set containing $p$. Show there is a continuous function $f : M \to [0, 1]$ such that $f(p) = 1$ and $\overline{f^{-1}((0, 1])}$ is a subset of $U$.
The bar is the closure of the set.
**My Ideas:** Around $p$ there is an open set $V$ which is homeomorphic to the unit ball in $\mathbb{R}^n$ for some $n$. Let $g : V \to B_1(0)$ witness this. I am not sure if there is a way to extend $g$ so that its domain is all of $M$. But even if I did get this I am not sure how to make $f(p) = 1$. If I am not mistaken once I can map to the ball I can project onto $[0, 1]$ to get a continuous map there.
Thanks for any help.
|
You can use Urysohn's lemma to get such a continuous function.
If you want your function to be smooth as well, then look up mollifiers and/or partitions of unit.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "general topology, manifolds"
}
|
Linux: Add Virtual Interface for KVM
On a CentOS server, `ifconfig` shows several vnetX interfaces (vent1, vent2, vent100), how can I add some more?
(I'd like to add a couple of virtual machines, so I need to add some more virtual interfaces that I can assign to the virtual machines).
Also, from what I understand, these vnetX interface are internal, between the host and virtual guest, is this correct?
|
these are set up on the VM level, you assign NICs to a VM, and it starts with them, creating vnetX NICs in the process.
As for how the networking is set up, just search for "libvirt bridge" and "libvirt NAT"
|
stackexchange-serverfault
|
{
"answer_score": 1,
"question_score": 0,
"tags": "virtualization, kvm virtualization"
}
|
TSQL: Values of all field in a row into one string
i need to put all, not null, values of single row into one string, like
table:
CustomerName Address Zip
Alex Moscow 1234
to result:
CustomerName: Alex
Address: Moscow
Zip: 1234
Important note - i don't know field names/types, so it should go through all fields and all not null values add to list.
Looks like it can do this using xquery, but can't find right syntax. Any hints?
Thanks!
|
select T2.N.value('local-name(.)', 'nvarchar(128)')+': '+
T2.N.value('.', 'nvarchar(max)')
from (select *
from YourTable
for xml path(''), type) as T1(X)
cross apply T1.X.nodes('/*') as T2(N)
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "sql, tsql"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.