qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
sequence
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
30,336,337
I'm a bit confused about the different between **Events** and **Listeners**. I understood how you can create your events under `Events` then register them and implement the Handlers in `Handlers\Events`. So here I have events and the handling of events. They work after I define them in `Providers\EventServiceProvider.php` ``` protected $listen = [ UserHasSignedUp::class => [ SendWelcomeEmail::class, SendAdminEmail::class ] ]; ``` So what are **Listeners**? To me they seem exactly the same thing as **Event Handlers**?
2015/05/19
[ "https://Stackoverflow.com/questions/30336337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391986/" ]
The only difference between them seems to be is, `handler:event` is from Laravel 5.0's folder structure, and `make:listener` is the **new & current** folder structure. **Functionally, they are the same**! - [Upgrade Guide to Laravel 5.1](https://laravel.com/docs/5.1/upgrade#upgrade-5.1.0) > > **Commands & Handlers** > > > The app/Commands directory has been renamed to > app/Jobs. However, you are not required to move all of your commands > to the new location, and you may continue using the make:command and > handler:command Artisan commands to generate your classes. > > > Likewise, ***the app/Handlers directory has been renamed to app/Listeners*** > and now only contains event listeners. However, you are not required > to move or rename your existing command and event handlers, and you > may continue to use the handler:event command to generate event > handlers. > > > By providing backwards compatibility for the Laravel 5.0 folder > structure, you may upgrade your applications to Laravel 5.1 and slowly > upgrade your events and commands to their new locations when it is > convenient for you or your team. > > > It's just the backward compatibility provided in Laravel 5.1. In other words, earlier, Jobs/Commands/Listeners were **not self-handling**, now **they are**. **Note that**, `handler:event` is not available **after Laravel 5.1**.
There's not too much information on this out there, so this might just be speculation. I took a look at [this video](https://www.youtube.com/watch?v=WNYb1r4eMio) and saw that you can use handlers with commands. I think if you're using commands, that makes sense to have all your handlers in one spot. However if you're not, then having a `App\Handlers\Events\Whatever` might not be as desirable as `App\Listeners\Whatever`.
30,336,337
I'm a bit confused about the different between **Events** and **Listeners**. I understood how you can create your events under `Events` then register them and implement the Handlers in `Handlers\Events`. So here I have events and the handling of events. They work after I define them in `Providers\EventServiceProvider.php` ``` protected $listen = [ UserHasSignedUp::class => [ SendWelcomeEmail::class, SendAdminEmail::class ] ]; ``` So what are **Listeners**? To me they seem exactly the same thing as **Event Handlers**?
2015/05/19
[ "https://Stackoverflow.com/questions/30336337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391986/" ]
The only difference between them seems to be is, `handler:event` is from Laravel 5.0's folder structure, and `make:listener` is the **new & current** folder structure. **Functionally, they are the same**! - [Upgrade Guide to Laravel 5.1](https://laravel.com/docs/5.1/upgrade#upgrade-5.1.0) > > **Commands & Handlers** > > > The app/Commands directory has been renamed to > app/Jobs. However, you are not required to move all of your commands > to the new location, and you may continue using the make:command and > handler:command Artisan commands to generate your classes. > > > Likewise, ***the app/Handlers directory has been renamed to app/Listeners*** > and now only contains event listeners. However, you are not required > to move or rename your existing command and event handlers, and you > may continue to use the handler:event command to generate event > handlers. > > > By providing backwards compatibility for the Laravel 5.0 folder > structure, you may upgrade your applications to Laravel 5.1 and slowly > upgrade your events and commands to their new locations when it is > convenient for you or your team. > > > It's just the backward compatibility provided in Laravel 5.1. In other words, earlier, Jobs/Commands/Listeners were **not self-handling**, now **they are**. **Note that**, `handler:event` is not available **after Laravel 5.1**.
Listeners vs. Handlers : A listener `listen` for a specific event to be fired. xxxxCreatedListener will only listen for xxxx A handler can handle multiple events to be fired. For exemple, let's say you use performing CRUD operations, your handler could wait for the xxxxCreatedEvent, xxxxDeletedEvent, xxxxUpdatedEvent.
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
I think the problem lies in the use of `top` which is SQL Server and not Oracle. Use `rank` instead to get the salary in the decent order and get the first 10 of them: ``` select v.first_name, v.salary from ( select first_name, salary, rank() over (order by salary desc) r from employees) v where v.r <= 10 ```
This will work ``` select emp_id, salary from orders order by salary desc limit 10; ```
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Top-N query is typically performed this way in Oracle: ``` select * from ( select first_name, salary from employees order by salary desc ) where rownum <= 10 ``` This one gets you top 10 salaries.
I think the problem lies in the use of `top` which is SQL Server and not Oracle. Use `rank` instead to get the salary in the decent order and get the first 10 of them: ``` select v.first_name, v.salary from ( select first_name, salary, rank() over (order by salary desc) r from employees) v where v.r <= 10 ```
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Top-N query is typically performed this way in Oracle: ``` select * from ( select first_name, salary from employees order by salary desc ) where rownum <= 10 ``` This one gets you top 10 salaries.
Try this === SELECT first\_name, salary FROM employees WHERE salary IN (SELECT salary FROM employees GROUP BY salary ORDER BY salary DESC LIMIT 10);
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Top-N query is typically performed this way in Oracle: ``` select * from ( select first_name, salary from employees order by salary desc ) where rownum <= 10 ``` This one gets you top 10 salaries.
Try - ``` SELECT first_name, salary ( select first_name, salary from employees order by salary Desc) where rownum <= 10 ```
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Try - ``` SELECT first_name, salary ( select first_name, salary from employees order by salary Desc) where rownum <= 10 ```
The below Query works in Oracle. select \* from (select \* from emp order by sal desc) where rownum<=10;
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Try - ``` SELECT first_name, salary ( select first_name, salary from employees order by salary Desc) where rownum <= 10 ```
This will work ``` select emp_id, salary from orders order by salary desc limit 10; ```
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Top-N query is typically performed this way in Oracle: ``` select * from ( select first_name, salary from employees order by salary desc ) where rownum <= 10 ``` This one gets you top 10 salaries.
The below Query works in Oracle. select \* from (select \* from emp order by sal desc) where rownum<=10;
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
I think the problem lies in the use of `top` which is SQL Server and not Oracle. Use `rank` instead to get the salary in the decent order and get the first 10 of them: ``` select v.first_name, v.salary from ( select first_name, salary, rank() over (order by salary desc) r from employees) v where v.r <= 10 ```
Try this === SELECT first\_name, salary FROM employees WHERE salary IN (SELECT salary FROM employees GROUP BY salary ORDER BY salary DESC LIMIT 10);
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
The below Query works in Oracle. select \* from (select \* from emp order by sal desc) where rownum<=10;
Try this === SELECT first\_name, salary FROM employees WHERE salary IN (SELECT salary FROM employees GROUP BY salary ORDER BY salary DESC LIMIT 10);
24,767,679
I wrote this sql query: ``` select first_name, salary from employees where salary in( select distinct top(10) salary from employees order by salary disc ); ``` When I ran it, I got this error: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" What could have caused the error?
2014/07/15
[ "https://Stackoverflow.com/questions/24767679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
I think the problem lies in the use of `top` which is SQL Server and not Oracle. Use `rank` instead to get the salary in the decent order and get the first 10 of them: ``` select v.first_name, v.salary from ( select first_name, salary, rank() over (order by salary desc) r from employees) v where v.r <= 10 ```
The below Query works in Oracle. select \* from (select \* from emp order by sal desc) where rownum<=10;
123,439
Recently, I learned about the concept of the [51% attack](https://www.investopedia.com/terms/1/51-attack.asp) which a malicious actor could perform on a cryptocurrency. Essentially, if you can control >50% of the hashing power for a given cryptocurrency, you can control the blockchain which allows you to do all sorts of devious things like [double-spending](https://www.investopedia.com/terms/d/doublespending.asp) the cryptocurrency. There's even a website, [crypto51.app](https://www.crypto51.app/), which keeps track of the theoretical costs of performing such an attack. This cost seems to come from the money one would spend in gaining that >50% control for an hour - usually in terms of renting computing time. Clearly, the more computing power the cryptocurrency community is putting into mining, for a given cryptocurrency, the harder and more expensive it is to perform a 51% attack. So crypocurrencies like Bitcoin are reasonably safe from an attack like this. However, newer, less mined crypocurrencies are *much* more likely susceptible to the 51% attack. So my question is, how can new cryptocurrencies even form? It seems like people are forming their own cryptocurrencies left and right, even as jokes (see , e.g., [dogecoin](https://dogecoin.com/)). How can new currencies get off the ground and gain enough critical mass to be reasonably safeguarded against a 51% attack? Why don't most new cryptocurrencies get killed off nearly immediately by an attack like this?
2020/04/03
[ "https://money.stackexchange.com/questions/123439", "https://money.stackexchange.com", "https://money.stackexchange.com/users/44939/" ]
Generally new cryptocurrencies are protected either by a complete lack of incentive to attack them, or by amassing support leading up to their eventual "launch." Older ones are somewhat protected by people being vigilant and communities occasionally agreeing on hard forks to ignore transactions on "compromised" chains; 51% attacks -- which don't actually need 51% of the network to pull off -- are still a threat even for well established blockchains. Double spending relies on there being someone who wants the cryptocurrency you have that you can dupe, and the amounts being transacted being high enough to offset hardware costs, time investments, opportunity costs, or other costs related to the attack. Very new cryptocurrencies will typically have almost nobody to transact with in the first place; and will have a very low "market cap", which severely limits the returns. There is generally no financial incentive to attack a new blockchain. There are some cyrptocurrenices that are "launched" with substantial support, where individuals creating the cryptocurrency will offer "ICOs" and other means of generating interest. While this would make for a much more lucrative target compared to another new crypto that has no such interest, it also means that the costs for the attack are much greater, and there will be more interest in forking away from "compromised" chains among the userbase. Futher, successfully attacking a blockchain like this is relatively easy to detect, and will erode confidence or interest in a cryptocurrency, of which most new cryptos have little to spare. Even if your attack is not "reversed" by the majority with a fork, you will crater the value of any amount you gain through double spends.
Many cryptocurrencies are launched with the intent to fleece people by giving you money for worthless cryptocurrency. So all you need is a great launch and lots of initial sales. Since the intent was never for the victims / suckers to make any profit, who cares about a 51% attack? The people who launched the cryptocurrency got lots of money for worthless cryptocurrency, they don't care if others can use a 51% attack to steal more of that cryptocurrency.
21,147,988
I'm a junior .NET developer and our company has a ton of code in their main application. All of our css for the web application is using bootstrap 2.3. I've been assigned the task to migrate from 2.3 to the new 3.0. This update has a ton of major changes. I'm looking for any and all suggestions on how I can make this work efficiently without having to go into each file and change the class. Container fluid and row fluid are now just container and fluid. These classes are probably on every single html page in our application. Please help me :)
2014/01/15
[ "https://Stackoverflow.com/questions/21147988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2859933/" ]
Bootstrap 3 is a major upgrade. You will have to "manually" update the classes in each file, and in some cases change the structure of your markup. There are some tools that can help.. See: [Updating Bootstrap to version 3 - what do I have to do?](https://stackoverflow.com/questions/17974998/updating-bootstrap-to-version-3-what-do-i-have-to-do) <http://upgrade-bootstrap.bootply.com>
Use the find and replace for entire solution.
16,069,799
To get a MapView, I would have to extend my class with MapActivity. When I try to do this, I get an error "Create MapActivity Class". If I do not extend it with MapActivity and use Activity instead, I get the following Exception. ``` java.lang.RuntimeException: Unable to start activity ComponentInfo{com.strive.gostrive/com.strive.gostrive.EventDetailActivity}: android.view.InflateException: Binary XML file line #168: Error inflating class com.google.android.maps.MapView ``` I have made the required changes in the xml file, android manifest file. I have also included the google play services lib in my project. The target for both google play services and my app is the same. Need Help!! Here is my xml file ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".EventDetailActivity" > <ImageView android:id="@+id/eventDImg" android:layout_width="fill_parent" android:layout_height="200dp" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/innershadow" /> <TextView android:id="@+id/textView2D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDateTV" android:layout_alignBottom="@+id/eventDDateTV" android:layout_toRightOf="@+id/eventDDateTV" android:text="-" /> <TextView android:id="@+id/eventDEndDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2D" android:layout_toRightOf="@+id/textView2D" android:maxLength="10" android:text="End Date" /> <TextView android:id="@+id/eventDStartAge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignLeft="@+id/textView3D" android:layout_marginLeft="39dp" android:maxLength="2" android:text="frm" /> <TextView android:id="@+id/textView4D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/eventDStartAge" android:text="-" /> <TextView android:id="@+id/eventDAgeTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/textView4D" android:maxLength="2" android:text="to" /> <TextView android:id="@+id/eventDTitleTV" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="48dp" android:maxLines="2" android:text="Event Title" android:textSize="20dp" /> <TextView android:id="@+id/eventDDateTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/eventDTitleTV" android:layout_centerVertical="true" android:maxLength="10" android:text="Strt Date" /> <TextView android:id="@+id/textView1D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDTitleTV" android:layout_marginLeft="180dp" android:layout_toLeftOf="@+id/eventDPriceTV" android:text="$" android:textSize="20dp" /> <TextView android:id="@+id/textView3D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/eventDDayTV" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_marginLeft="23dp" android:layout_toRightOf="@+id/eventDTitleTV" android:text="Ages:" /> <TextView android:id="@+id/eventDPriceTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1D" android:layout_alignBottom="@+id/textView1D" android:layout_alignLeft="@+id/textView3D" android:text="Event Fee" android:textSize="20dp" /> <TextView android:id="@+id/eventDStrtTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/eventDDayTV" android:layout_marginTop="16dp" android:text="Strt Tym" /> <TextView android:id="@+id/eventDEndTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDStrtTime" android:layout_alignLeft="@+id/eventDEndDate" android:layout_marginLeft="26dp" android:text="End tym" /> <TextView android:id="@+id/eventDVenueTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndTime" android:layout_alignLeft="@+id/eventDGender" android:text="Venue" /> <TextView android:id="@+id/eventDDayTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eventDImg" android:layout_below="@+id/eventDDateTV" android:layout_marginTop="31dp" android:text="M Tu W" /> <TextView android:id="@+id/eventDGender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDayTV" android:layout_alignBottom="@+id/eventDDayTV" android:layout_toRightOf="@+id/textView1D" android:text="gender" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="150dp" android:layout_alignLeft="@+id/eventDImg" android:layout_alignRight="@+id/eventDImg" android:layout_below="@+id/eventDImg" android:layout_marginTop="16dp" android:orientation="vertical" > <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="***************************" android:clickable="true" /> </LinearLayout> ``` Here is the activity ``` import com.google.android.gms.maps.MapView; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class EventDetailActivity extends Activity{ MapView map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_detail); Bundle bundle = getIntent().getExtras(); int position = bundle.getInt("position"); map = (MapView) findViewById(R.id.mapview); TextView txtEventName = (TextView)findViewById(R.id.eventDTitleTV); TextView txtEventFee = (TextView)findViewById(R.id.eventDPriceTV); TextView txtStartDate = (TextView)findViewById(R.id.eventDDateTV); TextView txtEndDate = (TextView)findViewById(R.id.eventDEndDate); TextView txtStartAge = (TextView)findViewById(R.id.eventDStartAge); TextView txtEndAge = (TextView)findViewById(R.id.eventDAgeTV); TextView txtDaysWeek = (TextView)findViewById(R.id.eventDDayTV); TextView txtEventGender = (TextView)findViewById(R.id.eventDGender); txtEventName.setText(EventModel.PREF_EVENTNAME); txtEventFee.setText(EventModel.PREF_EVENTFEE); txtStartAge.setText(EventModel.PREF_EVENTSATRTAGE); txtEndAge.setText(EventModel.PREF_EVENTENDAGE); txtStartDate.setText(EventModel.PREF_EVENTSTARTDATE); txtEndDate.setText(EventModel.PREF_EVENTENDDATE); txtDaysWeek.setText(EventModel.PREF_EVENTDAYSWEEK); txtEventGender.setText(EventModel.PREF_EVENTGENDER); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.event_detail, menu); return true; } } ```
2013/04/17
[ "https://Stackoverflow.com/questions/16069799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2208748/" ]
I'm the lead developer and maintainer of Open source project [RioFS](https://github.com/skoobe/riofs): a userspace filesystem to mount Amazon S3 buckets. Our project is an alternative to “s3fs” project, main advantages comparing to “s3fs” are: simplicity, the speed of operations and bugs-free code. Currently [the project](https://github.com/skoobe/riofs) is in the “beta” state, but it's been running on several high-loaded fileservers for quite some time. We are seeking for more people to join our project and help with the testing. From our side we offer quick bugs fix and will listen to your requests to add new features. Regarding your issue: if'd you use [RioFS](https://github.com/skoobe/riofs), you could mount a bucket and have a write access to it using the following command (assuming you have installed [RioFS](https://github.com/skoobe/riofs) and have exported AWSACCESSKEYID and AWSSECRETACCESSKEY environment variables): ``` riofs -o allow_other http://s3.amazonaws.com bucket_name /mnt/static.example.com ``` (please refer to project description for command line arguments) Please note that the project is still in the development, there are could be still a number of bugs left. If you find that something doesn't work as expected: please fill a issue report on the [project's GitHub page](https://github.com/skoobe/riofs/issues?state=open). Hope it helps and we are looking forward to seeing you joined our community !
Try this method using S3Backer: ``` mountpoint/ file # (e.g., can be used as a virtual loopback) stats # human readable statistics ``` Read more about it hurr: <http://www.turnkeylinux.org/blog/exploring-s3-based-filesystems-s3fs-and-s3backer>
16,069,799
To get a MapView, I would have to extend my class with MapActivity. When I try to do this, I get an error "Create MapActivity Class". If I do not extend it with MapActivity and use Activity instead, I get the following Exception. ``` java.lang.RuntimeException: Unable to start activity ComponentInfo{com.strive.gostrive/com.strive.gostrive.EventDetailActivity}: android.view.InflateException: Binary XML file line #168: Error inflating class com.google.android.maps.MapView ``` I have made the required changes in the xml file, android manifest file. I have also included the google play services lib in my project. The target for both google play services and my app is the same. Need Help!! Here is my xml file ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".EventDetailActivity" > <ImageView android:id="@+id/eventDImg" android:layout_width="fill_parent" android:layout_height="200dp" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/innershadow" /> <TextView android:id="@+id/textView2D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDateTV" android:layout_alignBottom="@+id/eventDDateTV" android:layout_toRightOf="@+id/eventDDateTV" android:text="-" /> <TextView android:id="@+id/eventDEndDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2D" android:layout_toRightOf="@+id/textView2D" android:maxLength="10" android:text="End Date" /> <TextView android:id="@+id/eventDStartAge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignLeft="@+id/textView3D" android:layout_marginLeft="39dp" android:maxLength="2" android:text="frm" /> <TextView android:id="@+id/textView4D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/eventDStartAge" android:text="-" /> <TextView android:id="@+id/eventDAgeTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/textView4D" android:maxLength="2" android:text="to" /> <TextView android:id="@+id/eventDTitleTV" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="48dp" android:maxLines="2" android:text="Event Title" android:textSize="20dp" /> <TextView android:id="@+id/eventDDateTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/eventDTitleTV" android:layout_centerVertical="true" android:maxLength="10" android:text="Strt Date" /> <TextView android:id="@+id/textView1D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDTitleTV" android:layout_marginLeft="180dp" android:layout_toLeftOf="@+id/eventDPriceTV" android:text="$" android:textSize="20dp" /> <TextView android:id="@+id/textView3D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/eventDDayTV" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_marginLeft="23dp" android:layout_toRightOf="@+id/eventDTitleTV" android:text="Ages:" /> <TextView android:id="@+id/eventDPriceTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1D" android:layout_alignBottom="@+id/textView1D" android:layout_alignLeft="@+id/textView3D" android:text="Event Fee" android:textSize="20dp" /> <TextView android:id="@+id/eventDStrtTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/eventDDayTV" android:layout_marginTop="16dp" android:text="Strt Tym" /> <TextView android:id="@+id/eventDEndTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDStrtTime" android:layout_alignLeft="@+id/eventDEndDate" android:layout_marginLeft="26dp" android:text="End tym" /> <TextView android:id="@+id/eventDVenueTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndTime" android:layout_alignLeft="@+id/eventDGender" android:text="Venue" /> <TextView android:id="@+id/eventDDayTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eventDImg" android:layout_below="@+id/eventDDateTV" android:layout_marginTop="31dp" android:text="M Tu W" /> <TextView android:id="@+id/eventDGender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDayTV" android:layout_alignBottom="@+id/eventDDayTV" android:layout_toRightOf="@+id/textView1D" android:text="gender" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="150dp" android:layout_alignLeft="@+id/eventDImg" android:layout_alignRight="@+id/eventDImg" android:layout_below="@+id/eventDImg" android:layout_marginTop="16dp" android:orientation="vertical" > <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="***************************" android:clickable="true" /> </LinearLayout> ``` Here is the activity ``` import com.google.android.gms.maps.MapView; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class EventDetailActivity extends Activity{ MapView map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_detail); Bundle bundle = getIntent().getExtras(); int position = bundle.getInt("position"); map = (MapView) findViewById(R.id.mapview); TextView txtEventName = (TextView)findViewById(R.id.eventDTitleTV); TextView txtEventFee = (TextView)findViewById(R.id.eventDPriceTV); TextView txtStartDate = (TextView)findViewById(R.id.eventDDateTV); TextView txtEndDate = (TextView)findViewById(R.id.eventDEndDate); TextView txtStartAge = (TextView)findViewById(R.id.eventDStartAge); TextView txtEndAge = (TextView)findViewById(R.id.eventDAgeTV); TextView txtDaysWeek = (TextView)findViewById(R.id.eventDDayTV); TextView txtEventGender = (TextView)findViewById(R.id.eventDGender); txtEventName.setText(EventModel.PREF_EVENTNAME); txtEventFee.setText(EventModel.PREF_EVENTFEE); txtStartAge.setText(EventModel.PREF_EVENTSATRTAGE); txtEndAge.setText(EventModel.PREF_EVENTENDAGE); txtStartDate.setText(EventModel.PREF_EVENTSTARTDATE); txtEndDate.setText(EventModel.PREF_EVENTENDDATE); txtDaysWeek.setText(EventModel.PREF_EVENTDAYSWEEK); txtEventGender.setText(EventModel.PREF_EVENTGENDER); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.event_detail, menu); return true; } } ```
2013/04/17
[ "https://Stackoverflow.com/questions/16069799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2208748/" ]
This works for me: ``` sudo s3fs bucketname /mnt/folder -o allow_other,nosuid,use_cache=/mnt/foldercache ``` If you need to debug, just add `,f2 -f -d`: ``` sudo s3fs bucketname /mnt/folder -o allow_other,nosuid,use_cache=/mnt/foldercache,f2 -f -d ```
Try this method using S3Backer: ``` mountpoint/ file # (e.g., can be used as a virtual loopback) stats # human readable statistics ``` Read more about it hurr: <http://www.turnkeylinux.org/blog/exploring-s3-based-filesystems-s3fs-and-s3backer>
16,069,799
To get a MapView, I would have to extend my class with MapActivity. When I try to do this, I get an error "Create MapActivity Class". If I do not extend it with MapActivity and use Activity instead, I get the following Exception. ``` java.lang.RuntimeException: Unable to start activity ComponentInfo{com.strive.gostrive/com.strive.gostrive.EventDetailActivity}: android.view.InflateException: Binary XML file line #168: Error inflating class com.google.android.maps.MapView ``` I have made the required changes in the xml file, android manifest file. I have also included the google play services lib in my project. The target for both google play services and my app is the same. Need Help!! Here is my xml file ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".EventDetailActivity" > <ImageView android:id="@+id/eventDImg" android:layout_width="fill_parent" android:layout_height="200dp" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/innershadow" /> <TextView android:id="@+id/textView2D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDateTV" android:layout_alignBottom="@+id/eventDDateTV" android:layout_toRightOf="@+id/eventDDateTV" android:text="-" /> <TextView android:id="@+id/eventDEndDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2D" android:layout_toRightOf="@+id/textView2D" android:maxLength="10" android:text="End Date" /> <TextView android:id="@+id/eventDStartAge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_alignLeft="@+id/textView3D" android:layout_marginLeft="39dp" android:maxLength="2" android:text="frm" /> <TextView android:id="@+id/textView4D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/eventDStartAge" android:text="-" /> <TextView android:id="@+id/eventDAgeTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_toRightOf="@+id/textView4D" android:maxLength="2" android:text="to" /> <TextView android:id="@+id/eventDTitleTV" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="48dp" android:maxLines="2" android:text="Event Title" android:textSize="20dp" /> <TextView android:id="@+id/eventDDateTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/eventDTitleTV" android:layout_centerVertical="true" android:maxLength="10" android:text="Strt Date" /> <TextView android:id="@+id/textView1D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDTitleTV" android:layout_marginLeft="180dp" android:layout_toLeftOf="@+id/eventDPriceTV" android:text="$" android:textSize="20dp" /> <TextView android:id="@+id/textView3D" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/eventDDayTV" android:layout_alignBaseline="@+id/eventDEndDate" android:layout_marginLeft="23dp" android:layout_toRightOf="@+id/eventDTitleTV" android:text="Ages:" /> <TextView android:id="@+id/eventDPriceTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1D" android:layout_alignBottom="@+id/textView1D" android:layout_alignLeft="@+id/textView3D" android:text="Event Fee" android:textSize="20dp" /> <TextView android:id="@+id/eventDStrtTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/eventDDayTV" android:layout_marginTop="16dp" android:text="Strt Tym" /> <TextView android:id="@+id/eventDEndTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDStrtTime" android:layout_alignLeft="@+id/eventDEndDate" android:layout_marginLeft="26dp" android:text="End tym" /> <TextView android:id="@+id/eventDVenueTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDEndTime" android:layout_alignLeft="@+id/eventDGender" android:text="Venue" /> <TextView android:id="@+id/eventDDayTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eventDImg" android:layout_below="@+id/eventDDateTV" android:layout_marginTop="31dp" android:text="M Tu W" /> <TextView android:id="@+id/eventDGender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/eventDDayTV" android:layout_alignBottom="@+id/eventDDayTV" android:layout_toRightOf="@+id/textView1D" android:text="gender" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="150dp" android:layout_alignLeft="@+id/eventDImg" android:layout_alignRight="@+id/eventDImg" android:layout_below="@+id/eventDImg" android:layout_marginTop="16dp" android:orientation="vertical" > <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="***************************" android:clickable="true" /> </LinearLayout> ``` Here is the activity ``` import com.google.android.gms.maps.MapView; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class EventDetailActivity extends Activity{ MapView map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_detail); Bundle bundle = getIntent().getExtras(); int position = bundle.getInt("position"); map = (MapView) findViewById(R.id.mapview); TextView txtEventName = (TextView)findViewById(R.id.eventDTitleTV); TextView txtEventFee = (TextView)findViewById(R.id.eventDPriceTV); TextView txtStartDate = (TextView)findViewById(R.id.eventDDateTV); TextView txtEndDate = (TextView)findViewById(R.id.eventDEndDate); TextView txtStartAge = (TextView)findViewById(R.id.eventDStartAge); TextView txtEndAge = (TextView)findViewById(R.id.eventDAgeTV); TextView txtDaysWeek = (TextView)findViewById(R.id.eventDDayTV); TextView txtEventGender = (TextView)findViewById(R.id.eventDGender); txtEventName.setText(EventModel.PREF_EVENTNAME); txtEventFee.setText(EventModel.PREF_EVENTFEE); txtStartAge.setText(EventModel.PREF_EVENTSATRTAGE); txtEndAge.setText(EventModel.PREF_EVENTENDAGE); txtStartDate.setText(EventModel.PREF_EVENTSTARTDATE); txtEndDate.setText(EventModel.PREF_EVENTENDDATE); txtDaysWeek.setText(EventModel.PREF_EVENTDAYSWEEK); txtEventGender.setText(EventModel.PREF_EVENTGENDER); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.event_detail, menu); return true; } } ```
2013/04/17
[ "https://Stackoverflow.com/questions/16069799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2208748/" ]
I'm the lead developer and maintainer of Open source project [RioFS](https://github.com/skoobe/riofs): a userspace filesystem to mount Amazon S3 buckets. Our project is an alternative to “s3fs” project, main advantages comparing to “s3fs” are: simplicity, the speed of operations and bugs-free code. Currently [the project](https://github.com/skoobe/riofs) is in the “beta” state, but it's been running on several high-loaded fileservers for quite some time. We are seeking for more people to join our project and help with the testing. From our side we offer quick bugs fix and will listen to your requests to add new features. Regarding your issue: if'd you use [RioFS](https://github.com/skoobe/riofs), you could mount a bucket and have a write access to it using the following command (assuming you have installed [RioFS](https://github.com/skoobe/riofs) and have exported AWSACCESSKEYID and AWSSECRETACCESSKEY environment variables): ``` riofs -o allow_other http://s3.amazonaws.com bucket_name /mnt/static.example.com ``` (please refer to project description for command line arguments) Please note that the project is still in the development, there are could be still a number of bugs left. If you find that something doesn't work as expected: please fill a issue report on the [project's GitHub page](https://github.com/skoobe/riofs/issues?state=open). Hope it helps and we are looking forward to seeing you joined our community !
This works for me: ``` sudo s3fs bucketname /mnt/folder -o allow_other,nosuid,use_cache=/mnt/foldercache ``` If you need to debug, just add `,f2 -f -d`: ``` sudo s3fs bucketname /mnt/folder -o allow_other,nosuid,use_cache=/mnt/foldercache,f2 -f -d ```
3,856
I've recently signed up for Google Apps because of the email support. I only use the web based gmail client for all my mail. I'd like to have a professional email signature for each email that I send that includes a small image which is the Logo of my company. How can include such an signature with Gmail?
2010/07/16
[ "https://webapps.stackexchange.com/questions/3856", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/1208/" ]
Google recently [announced](http://gmailblog.blogspot.com/2010/07/rich-text-signatures.html) support for rich text in signatures. That means you can now configure the font family, size and color, as well as insert images into the signature. Just go to your gmail settings and you'll find it right there, no need to enable as a lab feature or anything! It's possible it hasn't been expanded to Google Apps for your domain yet, in which case it should be coming pretty soon. [![alt text](https://i.stack.imgur.com/Ce09S.png)](https://i.stack.imgur.com/Ce09S.png) (source: [blogspot.com](https://4.bp.blogspot.com/_JE4qNpFW6Yk/TDYhaX9aJCI/AAAAAAAAAok/SUZMdB9N7sI/s1600/rich_text_signatures1.png))
Just to add to that if you have multiple accounts (and hence want multiple signatures) Gmail can now handle this too (I used to have to use 'labs' canned responses to do this). So if you also set up Gmail to automatically respond to the e-mail account the message was originally sent to it means you automatically get the correct signature on your reply. Very nice.
682,123
I have an OpenVPN client on a Windows 7, that connects to an OpenVPN server with tap. The tunnel establishes correctly. AFAIK, tap means that my virtual adapter is 'virtually' connected to the remote LAN, gets a remote LAN ip and participate in the LAN broadcast domani and so on. When the tunnel is established, **my virtual adapter gets the correct IP.** **But I cannot ping the other hosts in the remote network.** It might be a problem on the sererver side, but before checking there i've noticed something strange on the client side, in the way Windows handles the virtual interface. Let's begin. When the tunnel is up, the virtual interface is up too. In my routing table i can see my phisical network 192.168.2.0, infact my local IP is 192.168.2.134. Then I can see the remote network 172.16.1.0, directly attached to my interface 172.16.1.40. So far so good. (i've removed loopback entries) ``` 0.0.0.0 0.0.0.0 192.168.2.1 192.168.2.134 25 172.16.1.0 255.255.255.0 On-link 172.16.1.40 276 172.16.1.40 255.255.255.255 On-link 172.16.1.40 276 172.16.1.255 255.255.255.255 On-link 172.16.1.40 276 192.168.2.0 255.255.255.0 On-link 192.168.2.134 281 192.168.2.134 255.255.255.255 On-link 192.168.2.134 281 192.168.2.255 255.255.255.255 On-link 192.168.2.134 281 224.0.0.0 240.0.0.0 On-link 172.16.1.40 276 224.0.0.0 240.0.0.0 On-link 192.168.2.134 281 255.255.255.255 255.255.255.255 On-link 172.16.1.40 276 255.255.255.255 255.255.255.255 On-link 192.168.2.134 281 ``` Thus, clients on the remote network shouldn't be reached via gateway, but through direct routing via the virtual interface provided by openvpn. But when i trace the route to an host on the remote network (that my PC should see as local) my client routes it on the gateway, and obviously, get lost. ``` C:\Users\agostinox>tracert 172.16.1.17 1 1 ms 1 ms 1 ms 192.168.2.1 2 14 ms 96 ms 101 ms 192.168.1.1 3 * * * Richiesta scaduta. 4 24 ms 12 ms 12 ms 172.17.129.137 5 * * * Richiesta scaduta. ``` And here it seems that the system routes packages **straight to the gateway** as it didn't see the directly attached network adapter. Why does this happen? Edit 1 - details on my OpenVPN client config ============================================ ``` C:\Users\agostinox>openvpn --version OpenVPN 2.3.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Mar 19 2015 library versions: OpenSSL 1.0.1m 19 Mar 2015, LZO 2.08 ``` And my client config: ``` remote xxx.xxx.xxx.xxx cipher AES-128-CBC port 1194 proto tcp-client dev tap ifconfig 172.16.1.40 255.255.255.0 dev-node "Connessione alla rete locale (LAN) 3" secret a_file_containing_my_preshared_key.key ping 10 comp-lzo verb 4 mute 10 ``` Edit 2, details on my server configuration ========================================== Here is the "backup" of my (pfsense) server configuration. As you can see the configuration is at the minimum possible. ``` <openvpn> <openvpn-server> <vpnid>2</vpnid> <mode>p2p_shared_key</mode> <protocol>TCP</protocol> <dev_mode>tap</dev_mode> <ipaddr /> <interface>wan</interface> <local_port>1194</local_port> <description><![CDATA[ test tap OpenVPN server]]> </description> <custom_options /> <shared_key>... my shared key, omitted ...</shared_key> <crypto>AES-128-CBC</crypto> <engine>none</engine> <tunnel_network /> <tunnel_networkv6 /> <remote_network /> <remote_networkv6 /> <gwredir /> <local_network /> <local_networkv6 /> <maxclients /> <compression>yes</compression> <passtos /> <client2client /> <dynamic_ip /> <pool_enable>yes</pool_enable> <topology_subnet /> <serverbridge_dhcp /> <serverbridge_interface /> <serverbridge_dhcp_start /> <serverbridge_dhcp_end /> <netbios_enable /> <netbios_ntype>0</netbios_ntype> <netbios_scope /> </openvpn-server> </openvpn> ``` Edit 3, output of ipconfig /all =============================== When the tunnel is up, this is the output of ``` ipconfig /all ``` ``` Scheda Ethernet TAP-Interface: Suffisso DNS specifico per connessione: Descrizione . . . . . . . . . . . . . : TAP-Windows Adapter V9 Indirizzo fisico. . . . . . . . . . . : 00-FF-7B-FB-32-C0 DHCP abilitato. . . . . . . . . . . . : Sì Configurazione automatica abilitata : Sì Indirizzo IPv6 locale rispetto al collegamento . : fe80::3838:3c0c:c3c6:fcca%35(Preferenziale) Indirizzo IPv4. . . . . . . . . . . . : 172.16.1.40(Preferenziale) Subnet mask . . . . . . . . . . . . . : 255.255.255.0 Lease ottenuto. . . . . . . . . . . . : giovedì 16 aprile 2015 09:57:32 Scadenza lease . . . . . . . . . . . : venerdì 15 aprile 2016 09:57:32 Gateway predefinito . . . . . . . . . : fe80::20c:29ff:fe92:2272%35 Server DHCP . . . . . . . . . . . . . : 172.16.1.0 IAID DHCPv6 . . . . . . . . . . . : 1107361659 DUID Client DHCPv6. . . . . . . . : 00-01-00-01-14-AE-89-EA-F0-4D-A2-63-11-97 Server DNS . . . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS su TCP/IP . . . . . . . . . . : Attivato ```
2015/04/12
[ "https://serverfault.com/questions/682123", "https://serverfault.com", "https://serverfault.com/users/87002/" ]
Not being too Windows savvy wrt. OpenVPN, FWIW, here is my bid on what the culprit might be here: * Looking at the output from your Windows route command, it seems you are missing a gateway entry for the OpenVPN network. True, you have an address on the VPN net (the 172.16.1.40 address), but no gw is defined for that net. On my box, I have access to several networks, each with its own GW like so: ``` 0.0.0.0 0.0.0.0 172.20.68.2 172.20.69.3 20 10.0.3.0 255.255.255.0 172.20.68.5 172.20.69.3 21 ``` To fix this, open your openvpn server config and add a line like this: ``` push "route 172.16.1.0 255.255.255.0" ``` to it. This ensures that a proper route is pushed to the client whenever the connection to the server is up. * You may also be missing the return route - sometimes (not always for reasons I don't quite get) you need to add an `iroute` to the config entry you have for a given client in the server `ccd` directory (`/etc/openvpn/ccd/<vpn>/<client-id>`). This brings up the reverse route when a client connects to the server. the contents of one of my `ccd` files looks like this: ``` iroute 192.168.87.0 255.255.255.0 ``` This ensures the OpenVPN server can correctly route stuff back to the client * I think you can also just add `iroute`s to the main server config, but then they will be defined even if the client is not connected. That would look like this: ``` route 192.168.87.0 255.255.255.0 192.168.11.1 ``` * **EDIT:** Also note that running OpenVPN clients on Windows requires administrative privileges. Otherwise, OpenVPN will not be able to add routes and such (as noted in the comments to your question). Best thing is to run it as a service so connections come up automatically on boot. At least, that works out really well in my scenarios. I think that might get you going again. OpenVPN is really great and I have used it successfully for both business and gaming purposes for some time now :-)
I have a feeling you are not pushing your routes correctly from the server. I noticed that your gateway for the VPN is an IPv6 address. Try using the `push` option in server.conf to push your routes. You might also want to add the `server` directive so you can reserve the client subnet. If you're on linux you will need to have `net.ipv4.ip_forward = 1` on the VPN server set up with `sysctl` as well. Best, -Iulian
682,123
I have an OpenVPN client on a Windows 7, that connects to an OpenVPN server with tap. The tunnel establishes correctly. AFAIK, tap means that my virtual adapter is 'virtually' connected to the remote LAN, gets a remote LAN ip and participate in the LAN broadcast domani and so on. When the tunnel is established, **my virtual adapter gets the correct IP.** **But I cannot ping the other hosts in the remote network.** It might be a problem on the sererver side, but before checking there i've noticed something strange on the client side, in the way Windows handles the virtual interface. Let's begin. When the tunnel is up, the virtual interface is up too. In my routing table i can see my phisical network 192.168.2.0, infact my local IP is 192.168.2.134. Then I can see the remote network 172.16.1.0, directly attached to my interface 172.16.1.40. So far so good. (i've removed loopback entries) ``` 0.0.0.0 0.0.0.0 192.168.2.1 192.168.2.134 25 172.16.1.0 255.255.255.0 On-link 172.16.1.40 276 172.16.1.40 255.255.255.255 On-link 172.16.1.40 276 172.16.1.255 255.255.255.255 On-link 172.16.1.40 276 192.168.2.0 255.255.255.0 On-link 192.168.2.134 281 192.168.2.134 255.255.255.255 On-link 192.168.2.134 281 192.168.2.255 255.255.255.255 On-link 192.168.2.134 281 224.0.0.0 240.0.0.0 On-link 172.16.1.40 276 224.0.0.0 240.0.0.0 On-link 192.168.2.134 281 255.255.255.255 255.255.255.255 On-link 172.16.1.40 276 255.255.255.255 255.255.255.255 On-link 192.168.2.134 281 ``` Thus, clients on the remote network shouldn't be reached via gateway, but through direct routing via the virtual interface provided by openvpn. But when i trace the route to an host on the remote network (that my PC should see as local) my client routes it on the gateway, and obviously, get lost. ``` C:\Users\agostinox>tracert 172.16.1.17 1 1 ms 1 ms 1 ms 192.168.2.1 2 14 ms 96 ms 101 ms 192.168.1.1 3 * * * Richiesta scaduta. 4 24 ms 12 ms 12 ms 172.17.129.137 5 * * * Richiesta scaduta. ``` And here it seems that the system routes packages **straight to the gateway** as it didn't see the directly attached network adapter. Why does this happen? Edit 1 - details on my OpenVPN client config ============================================ ``` C:\Users\agostinox>openvpn --version OpenVPN 2.3.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Mar 19 2015 library versions: OpenSSL 1.0.1m 19 Mar 2015, LZO 2.08 ``` And my client config: ``` remote xxx.xxx.xxx.xxx cipher AES-128-CBC port 1194 proto tcp-client dev tap ifconfig 172.16.1.40 255.255.255.0 dev-node "Connessione alla rete locale (LAN) 3" secret a_file_containing_my_preshared_key.key ping 10 comp-lzo verb 4 mute 10 ``` Edit 2, details on my server configuration ========================================== Here is the "backup" of my (pfsense) server configuration. As you can see the configuration is at the minimum possible. ``` <openvpn> <openvpn-server> <vpnid>2</vpnid> <mode>p2p_shared_key</mode> <protocol>TCP</protocol> <dev_mode>tap</dev_mode> <ipaddr /> <interface>wan</interface> <local_port>1194</local_port> <description><![CDATA[ test tap OpenVPN server]]> </description> <custom_options /> <shared_key>... my shared key, omitted ...</shared_key> <crypto>AES-128-CBC</crypto> <engine>none</engine> <tunnel_network /> <tunnel_networkv6 /> <remote_network /> <remote_networkv6 /> <gwredir /> <local_network /> <local_networkv6 /> <maxclients /> <compression>yes</compression> <passtos /> <client2client /> <dynamic_ip /> <pool_enable>yes</pool_enable> <topology_subnet /> <serverbridge_dhcp /> <serverbridge_interface /> <serverbridge_dhcp_start /> <serverbridge_dhcp_end /> <netbios_enable /> <netbios_ntype>0</netbios_ntype> <netbios_scope /> </openvpn-server> </openvpn> ``` Edit 3, output of ipconfig /all =============================== When the tunnel is up, this is the output of ``` ipconfig /all ``` ``` Scheda Ethernet TAP-Interface: Suffisso DNS specifico per connessione: Descrizione . . . . . . . . . . . . . : TAP-Windows Adapter V9 Indirizzo fisico. . . . . . . . . . . : 00-FF-7B-FB-32-C0 DHCP abilitato. . . . . . . . . . . . : Sì Configurazione automatica abilitata : Sì Indirizzo IPv6 locale rispetto al collegamento . : fe80::3838:3c0c:c3c6:fcca%35(Preferenziale) Indirizzo IPv4. . . . . . . . . . . . : 172.16.1.40(Preferenziale) Subnet mask . . . . . . . . . . . . . : 255.255.255.0 Lease ottenuto. . . . . . . . . . . . : giovedì 16 aprile 2015 09:57:32 Scadenza lease . . . . . . . . . . . : venerdì 15 aprile 2016 09:57:32 Gateway predefinito . . . . . . . . . : fe80::20c:29ff:fe92:2272%35 Server DHCP . . . . . . . . . . . . . : 172.16.1.0 IAID DHCPv6 . . . . . . . . . . . : 1107361659 DUID Client DHCPv6. . . . . . . . : 00-01-00-01-14-AE-89-EA-F0-4D-A2-63-11-97 Server DNS . . . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS su TCP/IP . . . . . . . . . . : Attivato ```
2015/04/12
[ "https://serverfault.com/questions/682123", "https://serverfault.com", "https://serverfault.com/users/87002/" ]
Locate the OpenVPNgui.exe, openvpn.exe and openvpnserver.exe files in the bin folder of your open vpn install. Right-click the executables, select properties and then the compatibility tab. Click the "Run this program as an administrator" check box, and close the properties panel. Completely close out of OpenVPN (use task manager to confirm none of the executables are still running). Launch OpenVPN again and give it another try.
I have a feeling you are not pushing your routes correctly from the server. I noticed that your gateway for the VPN is an IPv6 address. Try using the `push` option in server.conf to push your routes. You might also want to add the `server` directive so you can reserve the client subnet. If you're on linux you will need to have `net.ipv4.ip_forward = 1` on the VPN server set up with `sysctl` as well. Best, -Iulian
1,273
I can get the link to a **question** by hovering the cursor over its title. What's the smart way to get a direct link to one of the **answers**? The only way I know is to go to the user's page and hunt for it there. So I am clearly missing something.
2019/05/09
[ "https://space.meta.stackexchange.com/questions/1273", "https://space.meta.stackexchange.com", "https://space.meta.stackexchange.com/users/6944/" ]
All posts (questions and answers) have a "share" link beneath them, in the same area where the "edit" link is. This brings up a pop-up with a short URL that links directly to the question or answer.
This is a test of `https://space.meta.stackexchange.com/q/1273/58` [What's the easiest way to get a link directly to an answer?](https://space.meta.stackexchange.com/q/1273/58) Testing `https://space.meta.stackexchange.com/a/1274/58` <https://space.meta.stackexchange.com/a/1274/58>
1,273
I can get the link to a **question** by hovering the cursor over its title. What's the smart way to get a direct link to one of the **answers**? The only way I know is to go to the user's page and hunt for it there. So I am clearly missing something.
2019/05/09
[ "https://space.meta.stackexchange.com/questions/1273", "https://space.meta.stackexchange.com", "https://space.meta.stackexchange.com/users/6944/" ]
All posts (questions and answers) have a "share" link beneath them, in the same area where the "edit" link is. This brings up a pop-up with a short URL that links directly to the question or answer.
It does work, even with long titles. However, this is *display feature* (appearance only) and is subject to change. It's not the same as button that creats a real text string of the form: `[title](url)` which you can copy/paste anywhere without depending on the page to regenerate the appearance of the title. Also, ~~I'm not sure what happens to the title generation/appearance~~ if the original post is deleted the displayed text reverts back to the bare url (per comments below, thanks folks!). Testing `https://space.meta.stackexchange.com/q/1128/12102` [Slightly nonstandard questions from new users frequently getting the silent, drive-by insta-close votes, can something be done?](https://space.meta.stackexchange.com/q/1128/12102) Testing `https://space.meta.stackexchange.com/q/1112/12102` [Is voting to close a question for "primarily opinion-based answers" while answering with fact exercising faulty logic, or even gamesmanship?](https://space.meta.stackexchange.com/q/1112/12102) --- However it doesn't seem to work for questions from another site: <https://aviation.stackexchange.com/questions/22022/did-the-space-shuttle-boat-tail-used-in-the-transport-configuration-save-fuel> so [here](https://space.stackexchange.com/q/36319/12102) I've done it manually again. Here's how it looked before my edit (after I re-pasted the url just to make sure): > > ![enter image description here](https://i.stack.imgur.com/GAcSU.png) > > >
58,262,036
I'm trying to add columns (or delete them if the number is reduced) between where "ID" and "Total" are based on the cell value in B1. ![Text](https://i.imgur.com/Gi6II06.png) How could this be done automatically every time the cell is updated? Code I have so far ``` Private Sub Worksheet_Change(ByVal Target As Range) Dim KeyCells As Range Set KeyCells = Range("B1") If Not Application.Intersect(KeyCells, Range(Target.Address)) _ Is Nothing Then Dim i As Integer For i = 1 To Range("B1").Value Columns("C:C").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Next i End If End Sub ```
2019/10/06
[ "https://Stackoverflow.com/questions/58262036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3573760/" ]
There's a setting in interface builder for estimated size - set it to None. [![enter image description here](https://i.stack.imgur.com/LvYQx.png)](https://i.stack.imgur.com/LvYQx.png) Change to None: [![enter image description here](https://i.stack.imgur.com/4kMTf.png)](https://i.stack.imgur.com/4kMTf.png)
I actually have never worked with XIBs or flow layouts, but I am currently working on some custom collection views: from what I know, in the most general case, it's not the collection view itself who's "choosing self-sizing", it's the layout object. Collection view on itself or it's delegate do not have any methods that ask cells for their preferred sizes. On the other hand, the flow layout does. [It is known](https://github.com/airbnb/MagazineLayout/blob/64cef3100328f22a093405635946adbc1ca6ad23/MagazineLayout/Public/Views/MagazineLayoutCollectionViewCell.swift#L34-L39) that flow layout checks internally if a cell uses auto layout, and, if the cell does, it ignores the information supplied by the delegate. One can opt out of that behavior by subclassing the layout and returning false in `shouldInvalidateLayout(forPreferredLayoutAttributes:, withOriginalAttributes:)`.
12,531,333
I'm looking for a way to send a user a regular file (mp3s or pictures), and keeping count of how many times this file was accessed **without going through an HTML/PHP page**. For example, the user will point his browser to bla.com/file.mp3 and start downloading it, while a server-side script will do something like saving data to a database. Any idea where should I get started? Thanks!
2012/09/21
[ "https://Stackoverflow.com/questions/12531333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688892/" ]
You will need to go through a php script, what you could do is rewrite the extensions you want to track, preferably at the folder level, to a php script which then does the calculations you need and serves the file to the user. For Example: If you want to track the /downloads/ folder you would create a rewrite on your webserver to rewrite all or just specific extensions to a php file we'll call proxy.php for this example. An example uri would be proxy.php?file=file.mp3 the proxy.php script sanitizes the file parameter, checks if the user has permission to download if applicable, checks if the file exists, serves the file to the client and perform any operations needed on the backend like database updates etc..
Do you mean that you don't want your users to be presented with a specific page and interrupt their flow? If you do, you can still use a PHP page using the following steps. (I'm not up to date with PHP so it'll be pseudo-code, but you'll get the idea) * Provide links to your file as (for example) <http://example.com/trackedDownloader.php?id=someUniqueIdentifer> * In the tracedDownloader.php file, determine the real location on the server that relates to the unique id (e.g. 12345 could map to /uploadedFiles/AnExample.mp3) * Set an appropriate content type header in your output. * Log the request to your database. * Return the contents of the file directly as page output.
12,531,333
I'm looking for a way to send a user a regular file (mp3s or pictures), and keeping count of how many times this file was accessed **without going through an HTML/PHP page**. For example, the user will point his browser to bla.com/file.mp3 and start downloading it, while a server-side script will do something like saving data to a database. Any idea where should I get started? Thanks!
2012/09/21
[ "https://Stackoverflow.com/questions/12531333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688892/" ]
You will need to go through a php script, what you could do is rewrite the extensions you want to track, preferably at the folder level, to a php script which then does the calculations you need and serves the file to the user. For Example: If you want to track the /downloads/ folder you would create a rewrite on your webserver to rewrite all or just specific extensions to a php file we'll call proxy.php for this example. An example uri would be proxy.php?file=file.mp3 the proxy.php script sanitizes the file parameter, checks if the user has permission to download if applicable, checks if the file exists, serves the file to the client and perform any operations needed on the backend like database updates etc..
You would need to scan log files. Regardless you most likely would want to store counters in a database? There is a great solution in serving static files using PHP: <https://tn123.org/mod_xsendfile/>
38,449,255
I thought I knew a thing or two... then I met RegEx. So what I am trying to do is a multistring negative look-ahead? Is that a thing? Basically I want to find when a 3rd string exists BUT two precursory strings do NOT. ``` (?i:<!((yellow thing)\s(w+\s+){0,20}(blue thing))\s(\w+\s+){0,100}(green thing)) ``` Target String: * Here we have a yellow thing. Here we have a blue thing. Clearly the green thing is best though. (Should NOT match) * You wanna buy some death sticks? I have a green thing. (MATCH) * We are on a yellow thing submarine? Look at that green thing over there! (MATCH)
2016/07/19
[ "https://Stackoverflow.com/questions/38449255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1040450/" ]
The error message is misleading. The problem is that the compiler has no information what type the values `.Zero`, `.NotZero` refer to. The problem is also unrelated to managed objects or the `valueForKey` method, you would get the same error message for ``` func foo(value: Int) { let eltType = value == 0 ? .Zero : .NotZero // Ambiguous reference to member '==' // ... } ``` The problem can be solved by specifying a fully typed value ``` let eltType = value == 0 ? MyEnum.Zero : .NotZero ``` or by providing a context from which the compiler can infer the type: ``` let eltType: MyEnum = value == 0 ? .Zero : .NotZero ```
Remove the bracelet seems to works : `let eltType = (object.valueForKey("type")! as! Int) == 0 ? .Zero : .NotZero`
375,793
I am studying mathematical modeling of a battery in simulink and for this it is necessary to determine some parameters. I'm stuck in the part where I need to determine an alpha parameter, which would be the relation between capacity and temperature. Not all battery manufacturers provide this parameter and would like to know with the author or how I could get to the value of it to proceed with the study of the model. Below the discussion that deals with the subject and attached the paper about it. [![enter image description here](https://i.stack.imgur.com/hLorS.png)](https://i.stack.imgur.com/hLorS.png) Paper: <https://drive.google.com/file/d/1u__5DWaSZtZ60xpXi2b1eJa0bVuv8yyt/view?usp=sharing> **UPDATE** Looking for some manufactures data I found a data sheet with some informations I think can help me. So, with this specifications what is the value of alpha ? [![enter image description here](https://i.stack.imgur.com/OEpSm.png)](https://i.stack.imgur.com/OEpSm.png)
2018/05/22
[ "https://electronics.stackexchange.com/questions/375793", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/186980/" ]
Working with Li-ion or LiPo cells, I never heard of an *alpha* parameter in datasheets. But, usually you can easily find the discharge curves at various temperatures i.e. you can estimate a correlation coefficient between temperature and total capacity.
IEC 61215 standard requires this measurement for Li-ion and I believe the manufacturer must make the results of the testing available to the public. I have found the report for some batteries in the past. All I remember is I don't want to do that again. You can measure it. Follow the IEC 61215 testing methods. See: [*Temperature Coefficients Measured pre-post Thermal Stress Testing and Comparison of Four Measurement Procedures*](https://www.nrel.gov/pv/assets/pdfs/2014_pvmrw_65_riedel.pdf) This may not help but it may. Li-ion batteries have a thermistor for safety. You can access and use the thermistor to measure the temperature. > > If at all possible, connect the thermistor during charging and > discharging to protect the battery against possible overheating. Use > an ohmmeter to locate the internal thermistor. The most common > thermistors are 10 Kilo Ohm NTC, which reads 10kΩ at 20°C (68°F). NTC > stands for negative temperature coefficient, meaning that the > resistance decreases with rising temperature. In comparison, a > positive temperature coefficient (PTC) causes the resistance to > increase. Warming the battery with your hand is sufficient to detect a > small change in resistor value when looking for the correct terminal > on the battery. > > > Source: [*Battery University, How to Repair a Laptop Battery*](http://batteryuniversity.com/learn/article/how_to_repair_a_laptop_battery) See also: [*Battery University, Making Lithium-ion Safe*](http://batteryuniversity.com/learn/article/bu_304b_making_lithium_ion_safe)
32,292,130
So I know what the `apply()` function does in javascript, but if you were to implement it on your own, how would you do that? Preferably don't use bind, since that's pretty dependent on apply. NOTE: I'm asking out of curiosity, I don't want to actually do this.
2015/08/30
[ "https://Stackoverflow.com/questions/32292130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3082194/" ]
You're basically asking how to apply different transformations to an array depending on the index of the specific item. With Ruby you can chain `with_index` onto enumerators and then use the index inside your enumerator block as you loop through each array item. In order to transform an array into a new one, you will need to use `map`. ``` transformed_tests = tests.map.with_index do |test, index| if index.even? test.upcase else test.downcase end end ``` or, a more compact version: ``` transformed_tests = tests.map.with_index do |test, index| test.send(index.even? ? :upcase : :downcase) end ``` If you want to make the transform whilst collecting the input: ``` tests = 5.times.map do |index| input = gets.chomp input.send index.even? ? :upcase : :downcase end ```
You want a simple way? ``` n = 5 test = [] (n/2).times.with_object([]) do test << gets.chomp.upcase test << gets.chomp end test << gets.chomp.upcase if n.even? ``` More Rubylike: ``` n.times.with_object([]) do |i,test| str = gets.chomp str.upcase! if i.odd? test << str end ```
63,779,680
I am implementing a library following a template method design pattern. It involves creating costly IO connection. To avoid any resource leaks, i want to enforce singleton instance on abstract class level. client just need to override the method which involves logic. how can i do with kotlin? ``` abstract class SingletonConnection{ fun start(){ /* code */ } fun connect(){ /* code */ } abstract fun clientLogic() } ``` If class A extends this, it should be singleton class. not allowed to initialise multiple times. how to do in kotlin?
2020/09/07
[ "https://Stackoverflow.com/questions/63779680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1554241/" ]
Unfortunately, there is no way to enforce that only objects (singletons in Kotlin) can inherit from a certain abstract/open class or interface in Kotlin. `object` declaration is just syntactic sugar for a regular class with a Singleton pattern. I know it's not much, but I guess you can achieve this to a certain degree by adding documentation, asking users to implement this class by Singletons alone. By the way, I would use an interface instead of an abstract class for this purpose.
Instead of creating abstract class just change the code like this:- ``` object SingletonConnection{ fun start(){ /* code */ } fun connect(){ /* code */ } fun clientLogic() } ``` It will provide the same implementation which you want to achieve using abstract class. Also get the method using this code:- ``` SingletonConnection.start() ```
3,686,846
I have to solve this integral but I don't understand which substitution I have to use. I've tried with $\sqrt{v^2+w^2}=t$, $v^2+w^2=t$, adding and subtracting $1$ in the numerator, adding and subtracting $2w$ under square root, but no dice.
2020/05/22
[ "https://math.stackexchange.com/questions/3686846", "https://math.stackexchange.com", "https://math.stackexchange.com/users/518653/" ]
For convergence, we require $0 < |v| \leq 1$, and then without loss of generatlity we can take $v > 0$. The trick here is to let $w = v \sinh x$, so that \begin{aligned} v^2+w^2 &= v^2 (1 + \sinh^2 x) = v^2 \cosh^2 x, \\ dw &= v \cosh x \; dx, \\ x &= \sinh^{-1} \frac{w}{v} \end{aligned} Our integral then becomes $$\int\_0^{\sinh^{-1} \sqrt{v^{-2}-1}} \frac{v \cosh x}{\sqrt{v^2 \cosh^2 x}} \; dx = \sinh^{-1} \sqrt{\frac{1}{v^2}-1}$$ since the integrand simplifies to become trivial.
Hint: recall that $$ \int \frac{1}{\sqrt{1+w^2}} dw = \sinh^{-1}(w) +C $$ where $\sinh^{-1}$ indicates the inverse of the hyperbolic sine function. Consider the substitution $w=tv$ and proceed.
3,686,846
I have to solve this integral but I don't understand which substitution I have to use. I've tried with $\sqrt{v^2+w^2}=t$, $v^2+w^2=t$, adding and subtracting $1$ in the numerator, adding and subtracting $2w$ under square root, but no dice.
2020/05/22
[ "https://math.stackexchange.com/questions/3686846", "https://math.stackexchange.com", "https://math.stackexchange.com/users/518653/" ]
we have: $$I=\int\_0^{\sqrt{1-v^2}}\frac 1{\sqrt{v^2+w^2}}dw=\frac 1v\int\_0^{\sqrt{1-v^2}}\frac 1{\sqrt{1+(w/v)^2}}dw$$ now if we let $x=\frac wv\Rightarrow dw=vdx$ and so: $$I=\int\_0^{\frac{\sqrt{1-v^2}}{v}}\frac 1{\sqrt{1+x^2}}dx$$ which is now a standard integral that can be computed by letting $x=\sinh(y)$ and remembering that $$\cosh^2y-\sinh^2y=1$$
Hint: recall that $$ \int \frac{1}{\sqrt{1+w^2}} dw = \sinh^{-1}(w) +C $$ where $\sinh^{-1}$ indicates the inverse of the hyperbolic sine function. Consider the substitution $w=tv$ and proceed.
3,686,846
I have to solve this integral but I don't understand which substitution I have to use. I've tried with $\sqrt{v^2+w^2}=t$, $v^2+w^2=t$, adding and subtracting $1$ in the numerator, adding and subtracting $2w$ under square root, but no dice.
2020/05/22
[ "https://math.stackexchange.com/questions/3686846", "https://math.stackexchange.com", "https://math.stackexchange.com/users/518653/" ]
we have: $$I=\int\_0^{\sqrt{1-v^2}}\frac 1{\sqrt{v^2+w^2}}dw=\frac 1v\int\_0^{\sqrt{1-v^2}}\frac 1{\sqrt{1+(w/v)^2}}dw$$ now if we let $x=\frac wv\Rightarrow dw=vdx$ and so: $$I=\int\_0^{\frac{\sqrt{1-v^2}}{v}}\frac 1{\sqrt{1+x^2}}dx$$ which is now a standard integral that can be computed by letting $x=\sinh(y)$ and remembering that $$\cosh^2y-\sinh^2y=1$$
For convergence, we require $0 < |v| \leq 1$, and then without loss of generatlity we can take $v > 0$. The trick here is to let $w = v \sinh x$, so that \begin{aligned} v^2+w^2 &= v^2 (1 + \sinh^2 x) = v^2 \cosh^2 x, \\ dw &= v \cosh x \; dx, \\ x &= \sinh^{-1} \frac{w}{v} \end{aligned} Our integral then becomes $$\int\_0^{\sinh^{-1} \sqrt{v^{-2}-1}} \frac{v \cosh x}{\sqrt{v^2 \cosh^2 x}} \; dx = \sinh^{-1} \sqrt{\frac{1}{v^2}-1}$$ since the integrand simplifies to become trivial.
14,112,927
I've got an installation of Plone 4.2.1 running nicely, but visitors to the site can click on the Users tab in the main menu and go straight to a search of all my registered users. Certainly, anonymous visitors are unable to actually list anyone, but I don't want this functionality at all. What's the Plone way of: * removing the Users tab from the main menu? * stopping the URL /Members returning anything except 404? Are there other effects of this functionality I should be aware of?
2013/01/01
[ "https://Stackoverflow.com/questions/14112927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/520763/" ]
The `Users` tab is only shown because there is a `Members` folder (with the title `Users`) in the root that is publicly visibile. You have three options to deal with the default; make the `Members` folder private, delete it altogether, or remove the `index_html` default view. Unpublish --------- You can 'unpublish', retract, the folder workflow to make it private, and anonymous users are then redirected to the login form instead of seeing the user search form: ![how to retract the Users folder](https://i.stack.imgur.com/3X2w3.jpg) Simply go to the folder, click on the workflow state (`Published`) and choose `Retract`. Delete ------ If you do not need to have per-user folders, you can remove the `Members` folder altogether. You do need to make sure that user folder creation is not enabled first. Go to the Control Panel (click on your username, top right, select `Site Setup`): ![Control Panel link](https://i.stack.imgur.com/SkHAp.jpg) select `Security`: ![Security entry in the CP](https://i.stack.imgur.com/DvM5a.jpg) and make sure that `Enable User Folders` is not checked. If it is, uncheck it and save the settings. Now just delete the `Members` folder; click `Users`, find the `Actions` menu on the right, then select `Delete`: ![Users deletion](https://i.stack.imgur.com/fiEjl.jpg) then confirm the deletion in the popup: ![Users deletion confirmation](https://i.stack.imgur.com/I20Yf.jpg) Deletion means *all* users will get a 404 when visiting `/Members` in your site. Delete the default view ----------------------- The `Members` folder contains a `index_html` object that provides the user form search. If all you want to get rid of is this view, you can delete it. If your `Members` folder is still public, visitors *can* see any userfolders that have been created though. Deleting this view requires going to the ZMI, the Zope Management Interface, navigating to the `Members` folder and deleting the `index_html` object there. Since this is not really the recommended course of action I'm leaving out the screenshots for this part.
You can just delete the Users folder.
11,820,142
> > **Possible Duplicate:** > > [Android - How to determine the Absolute path for specific file from Assets?](https://stackoverflow.com/questions/4744169/android-how-to-determine-the-absolute-path-for-specific-file-from-assets) > > > I am trying to pass a file to File(String path) class. Is there a way to find absolute path of the file in assets folder and pass it to File(). I tried `file:///android_asset/myfoldername/myfilename` as path string but it didnt work. Any idea?
2012/08/05
[ "https://Stackoverflow.com/questions/11820142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/875708/" ]
AFAIK, you can't create a `File` from an assets file because these are stored in the apk, that means there is no path to an assets folder. But, you can try to create that `File` using a buffer and the [`AssetManager`](http://developer.android.com/reference/android/content/res/AssetManager.html) (it provides access to an application's raw asset files). Try to do something like: ```java AssetManager am = getAssets(); InputStream inputStream = am.open("myfoldername/myfilename"); File file = createFileFromInputStream(inputStream); private File createFileFromInputStream(InputStream inputStream) { try{ File f = new File(my_file_name); OutputStream outputStream = new FileOutputStream(f); byte buffer[] = new byte[1024]; int length = 0; while((length=inputStream.read(buffer)) > 0) { outputStream.write(buffer,0,length); } outputStream.close(); inputStream.close(); return f; }catch (IOException e) { //Logging exception } return null; } ``` Let me know about your progress.
Unless you unpack them, assets remain inside the apk. Accordingly, there isn't a path you can feed into a File. The path you've given in your question will work with/in a WebView, but I think that's a special case for WebView. You'll need to unpack the file or use it directly. If you have a Context, you can use `context.getAssets().open("myfoldername/myfilename");` to open an InputStream on the file. With the InputStream you can use it directly, or write it out somewhere (after which you can use it with File).
39,576,750
I have the following project structure `settings.gradle`: ``` include 'B' include 'C' rootProject.name = 'A' ``` How add gradle to subproject root project as dependency?
2016/09/19
[ "https://Stackoverflow.com/questions/39576750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6464377/" ]
As far as the `project` method is concerned, the root project has no name. So this is the syntax in project B's build.gradle: ``` dependencies { compile project(':') } ``` However, it is rarely a good idea to do this. It is too easy to end up with circular dependencies. Most multi-module projects have a separate "main" projects (called something like "main", "core" or "base"), and other modules can easily depend on that using `compile project(':core')` or whatever.
I assume the question being asked is: **"How to add a Gradle root project as dependency to a subproject?"** The following worked for me, when I added this in my subproject's build.gradle. ``` dependencies { //Add the root/parent project as a dependency compile project(":") } //Without this, my subproject's tests would not compile or run sourceSets { test{ compileClasspath += project(":").sourceSets.main.output.classesDirs runtimeClasspath += project(":").sourceSets.main.output.classesDirs } } ``` Note: I am using gradle version 5.6.4.
47,636,430
I'm struggling to setup nginx inside a docker container. I basically have two containers: * a php:7-apache container that serves a dynamic website, including its static contents. * a nginx container, with a volume mounted inside it as a **/home/www-data/static-content** folder (I do this in my docker-compose.yml), to try to serve a static website (unrelated to the one served by the apache container). I want to use the domain **dynamic.localhost** to serve my dynamic website, and **static.localhost** to serve my static website only made up of static files. I have the following Dockerfile for my nginx container: ``` ########## BASE ######### FROM nginx:stable ########## CONFIGURATION ########## ARG DEBIAN_FRONTEND=noninteractive ENV user www-data COPY ./nginx.conf /etc/nginx/nginx.conf COPY ./site.conf /etc/nginx/conf.d/default.conf RUN touch /var/run/nginx.pid && \ chown -R ${user}:${user} /var/run/nginx.pid && \ chown -R www-data:www-data /var/cache/nginx RUN chown -R ${user} /home/${user}/ && \ chgrp -R ${user} /home/${user}/ USER ${user} ``` As you see I'm using two configuration files for nginx: nginx.conf and site.conf. Here is nginx.conf (it's not important because there is nothing special in it but if I'm doing something wrong just let me know): ``` worker_processes auto; error_log /var/log/nginx/error.log debug; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; } ``` And here is the file site.conf that I have been failing miserably at writing correctly for days now: ``` server { listen 8080; server_name static.localhost; root /home/www-data/static-content; location / { try_files $uri =404; } } server { listen 8080; server_name dynamic.localhost; location / { proxy_pass http://dynamic; proxy_redirect off; proxy_set_header Host $host:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Port 8080; proxy_set_header X-Forwarded-Host $host:8080; } } ``` (<http://dynamic> passes the request to the apache container that I name "dynamic"). So basically I keep getting 404 for whatever file I try to access in my static-content directory. E.g.: * static.localhost:8080/index.html should serve /home/www-data/static-content/index.html but I get 404 instead. * static.localhost:8080/css/style.css should serve /home/www-data/static-content/css/style.css but I get 404 too. I tried various things, like writing *try\_files /home/www-data/static-content/$uri*, but I didn't get any result. I read some parts of nginx documentation and searched on Stack Overflow but nothing that I found helped me. If I made a stupid mistake I apologize, but the only thing that I care about now is to get this to work, and to understand what I'm doing wrong. Thanks
2017/12/04
[ "https://Stackoverflow.com/questions/47636430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It looks like you'd do well to take advantage of ImageMagick's "-gravity" setting here. This might not be exactly what you're looking for, but notice how "-gravity" works to locate the overlay image with "-composite", and the text is located with "-annotate" using a command like this... ``` convert foo.png -resize 572x572 \ -size 612x792 xc:white +swap -gravity center -composite \ -gravity north -pointsize 24 -annotate +0+100 "Title Text" laid-out.png ``` That starts by reading in "foo.png" and resizing it. Then it sets the size of the desired canvas, creates a white canvas of that size, sets the gravity to center, swaps the overlay image with the canvas to get them in the correct order, and composites "foo.png" centered on the canvas. Then it changes the gravity setting to north, sets the pointsize of the text, and annotates the image with the text located "+0+100". That's zero pixels from center left to right, and 100 pixels down from the top. A couple experiments should help you find settings to suit your need.
Here is an alternate way to do it in ImageMagick using montage. logo.jpg [![enter image description here](https://i.stack.imgur.com/9CtME.jpg)](https://i.stack.imgur.com/9CtME.jpg) ``` montage -title "Testing" logo.jpg -geometry 160x120+25+25 -tile 1x1 -frame 0 -background white logo_title.jpg ``` [![enter image description here](https://i.stack.imgur.com/5Fboi.jpg)](https://i.stack.imgur.com/5Fboi.jpg) The geometry argument 160x120 resizes to that dimension and the +25+25 adds a border of that size. Note that this gives somewhat less flexibility in positioning the title than GeeMack's solution.
2,917,916
I was trying to use generating functions to get a closed form for the sum of first $n$ positive integers. So far I got to $G(x) = \frac{1}{(1-x)^3}$ but I don't know how to convert this back to the coefficient on power series.
2018/09/15
[ "https://math.stackexchange.com/questions/2917916", "https://math.stackexchange.com", "https://math.stackexchange.com/users/525966/" ]
You can use $\frac 1{1-x}=\sum\_{i=0}^\infty x^i$ and take two derivatives $$\frac {d^2}{dx^2}\frac 1{1-x}=\frac 2{(1-x)^3}=\frac {d^2}{dx^2}\sum\_{i=0}^\infty x^i=\sum\_{i=0}^\infty(i+2)(i+1)x^i\\=1+3x+6x^2+10x^3+\ldots$$ which is off by $1$ in the index.
Using [Binomial series](https://en.wikipedia.org/wiki/Binomial_series), for $|-x|<1,$ $$(1-x)^{-3}=\sum\_{r=0}^\infty\dfrac{(-3)(-2)\cdots\{-3-(r-1)\}}{r!}(-x)^r$$ Now $\dfrac{(-3)(-3-1)\cdots\{-3-(r-1)\}}{r!}=(-1)^r\dfrac{(r+2)(r+1)\cdots3}{r!}=(-1)^r\dfrac{(r+1)(r+2)}2$
2,917,916
I was trying to use generating functions to get a closed form for the sum of first $n$ positive integers. So far I got to $G(x) = \frac{1}{(1-x)^3}$ but I don't know how to convert this back to the coefficient on power series.
2018/09/15
[ "https://math.stackexchange.com/questions/2917916", "https://math.stackexchange.com", "https://math.stackexchange.com/users/525966/" ]
You can use $\frac 1{1-x}=\sum\_{i=0}^\infty x^i$ and take two derivatives $$\frac {d^2}{dx^2}\frac 1{1-x}=\frac 2{(1-x)^3}=\frac {d^2}{dx^2}\sum\_{i=0}^\infty x^i=\sum\_{i=0}^\infty(i+2)(i+1)x^i\\=1+3x+6x^2+10x^3+\ldots$$ which is off by $1$ in the index.
Since $\frac{1}{1-x}=1+x+x^2+x^3+\ldots$ for any $x\in(-1,1)$, we have $$ [x^n]\frac{1}{(1-x)^k} = \begin{array}{c}\small\text{number of ways for writing }n\\\small\text{as a sum of }k\small\text{ natural numbers}\end{array} $$ and the RHS is given by [stars and bars](https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics)). In general we have $$ \frac{1}{(1+x)^{m+1}} = \sum\_{n\geq 0}\binom{m+n}{n}x^n.$$
2,917,916
I was trying to use generating functions to get a closed form for the sum of first $n$ positive integers. So far I got to $G(x) = \frac{1}{(1-x)^3}$ but I don't know how to convert this back to the coefficient on power series.
2018/09/15
[ "https://math.stackexchange.com/questions/2917916", "https://math.stackexchange.com", "https://math.stackexchange.com/users/525966/" ]
You can use $\frac 1{1-x}=\sum\_{i=0}^\infty x^i$ and take two derivatives $$\frac {d^2}{dx^2}\frac 1{1-x}=\frac 2{(1-x)^3}=\frac {d^2}{dx^2}\sum\_{i=0}^\infty x^i=\sum\_{i=0}^\infty(i+2)(i+1)x^i\\=1+3x+6x^2+10x^3+\ldots$$ which is off by $1$ in the index.
Let $\frac{1}{(1-x)^3}=\sum\_{i=0}^{\infty}a\_ix^i$, then $$1=(1-3x+3x^2-x^3)\sum\_{i=0}^{\infty}a\_ix^i=\sum\_{i=0}^{\infty}a\_ix^i-\sum\_{i=0}^{\infty}3a\_ix^{i+1}+\sum\_{i=0}^{\infty}3a\_ix^{i+2}-\sum\_{i=0}^{\infty}a\_ix^{i+3}$$ From this we get (by comparing LHS and RHS): * $1=a\_0$ * $0=a\_1-3a\_0\Rightarrow a\_1=3$ * $0=a\_2-3a\_1+3a\_0\Rightarrow a\_2=6$ * $0=a\_{n+3}-3a\_{n+2}+3a\_{n+1}-a\_n$, for $n\geq 0$ Now, consider the difference between each coefficient $$a\_0,a\_1,a\_2,a\_3,a\_4,a\_5,\dots\\a\_1-a\_0,a\_2-a\_1,a\_3-a\_2,a\_4-a\_3,a\_5-a\_4,\dots\\a\_2-2a\_1+a\_0,a\_3-2a\_2+a\_1,a\_4-2a\_3+a\_2,a\_5-2a\_4+a\_3,\dots\\0,0,0,0,0,\dots$$ The last line is $0$, since $0=a\_{n+3}-3a\_{n+2}+3a\_{n+1}-a\_n$. This means that $a\_n$ is a polynomial of degree $2$, so that $$a\_n=c\_2n^2+c\_1n+c\_0$$ To find $c\_2,c\_1,c\_0$ note: * $a\_0=1\Rightarrow c\_0=1$ * $a\_1=3\Rightarrow 2=c\_2+c\_1$ * $a\_2=6\Rightarrow5=4c\_2+2c\_1$ This gives: * $c\_0=1$ * $c\_1=\frac{3}{2}$ * $c\_2=\frac{1}{2}$ So: $$a\_n=\frac{n^2}{2}+\frac{3n}{2}+1=\frac{(n+1)(n+2)}{2}$$
25,826,293
Why two different strings of literals can't be replaced with = operator? i thought maybe it's because that they are an array of literals and two different arrays cant be replaced wondered if there is another reason and if what i said is nonsense example: ``` char s1[] = "ABCDEFG"; char s2[] = "XYZ"; s1=s2; ERROR ``` i know how to replace them but don't know why cant be replaced in that way
2014/09/13
[ "https://Stackoverflow.com/questions/25826293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783574/" ]
Arrays have no the assignment operator and may not be used as initializers for other arrays because they are converted to pointers to their first elements when are used in expressions. Use standard C function `strcpy` declared in header `<cstring>` if you want "to assign" one character array to other that contain strings. For example ``` #include <cstring> //... char s1[] = "ABCDEFG"; char s2[] = "XYZ"; //... std::strcpy( s1, s2 ); ``` Take into account that in general case s1 must be large enough to accomodate all characters of s2 including the treminating zero.
If you're using C++, and apparently you're not very familiar with pointers....using std::string could be easier for you: ``` #include <string> std::string s1 = "ABCDEFG"; std::string s2 = "XYZ"; s1=s2; // No ERROR! ```
33,900,657
I am interested to know if anyone has built a javascript websocket listener for a browser. Basically the server side of a websocket that runs in a client. This would allow messages to be sent to the client directly. Why? Because instead of having a Node.js, python, java, etc, server process sitting on or near the client/browser, I can just use a thread in the browser as a listening server thread. I don't think that any browsers support this currently. I've run across answers like this: <https://news.ycombinator.com/item?id=2316132> Just curious if anyone has done this. I believe that the current Websockets spec does not support listeners on the browser. It would make the deployment of various peer-to-peer applications a bit easier to deploy.
2015/11/24
[ "https://Stackoverflow.com/questions/33900657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3426462/" ]
[WebRTC](https://webrtc.org/getting-started/overview) allows for peer-to-peer connections to be made between browsers. You would still need a server in order for individual users to discover each other but then they could connect directly to each other rather than having to pass all their traffic via a central server.
The idea. You can use a simple **echo server** written in any language. Your script can send the data to the server then get it back, handle it on the same page with different functions/classes emulating the real server. An example: <http://www.websocket.org/echo.html> Then, you can think about different formats of packets to/from server to diffirentiate them inside one script.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
Try to remove > > android:fitsSystemWindows="true" > > > on your CollapsingToolbarLayout.
Try to put ``` <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> </android.support.design.widget.CoordinatorLayout> ``` as the root of all the other fragments you are loading from the BottomNavigationView.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
Try to remove > > android:fitsSystemWindows="true" > > > on your CollapsingToolbarLayout.
If you use a custom toolbar in the profile fragment,you put this code to `onCreateView` method: ``` ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); ``` I had the same problem and this was solved.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
Try to remove > > android:fitsSystemWindows="true" > > > on your CollapsingToolbarLayout.
Remove `android:fitsSystemWindows="true"` from root `CoordinatorLayout`.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
try ``` getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when you switch to tab with collapsing toolbar and ``` getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when switch to another
Try to put ``` <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> </android.support.design.widget.CoordinatorLayout> ``` as the root of all the other fragments you are loading from the BottomNavigationView.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
try ``` getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when you switch to tab with collapsing toolbar and ``` getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when switch to another
If you use a custom toolbar in the profile fragment,you put this code to `onCreateView` method: ``` ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); ``` I had the same problem and this was solved.
45,267,955
``` from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'http://www.csgoanalyst.win' uClient = uReq(my_url) page_html = uClient.read() uClient.close() page_soup = soup(page_html, "html.parser") page_soup.body ``` I am trying to scrape hltv.org in order to find out what maps each team bans and picks. However, I keep getting the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/anaconda/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/anaconda/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden >>> page_html = uClient.read() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined >>> uClient.close() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'uClient' is not defined ``` I tried the script on another website so I know it works. I assume hltv has blocked bots or whatever from doing this and I know I shouldn't particularly be doing it if they don't want people to but I would love to get the data. Any help will be super helpful. Thank you.
2017/07/23
[ "https://Stackoverflow.com/questions/45267955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8353998/" ]
try ``` getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when you switch to tab with collapsing toolbar and ``` getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ``` when switch to another
Remove `android:fitsSystemWindows="true"` from root `CoordinatorLayout`.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
Make sure that the mods' load order is correct (as explained in an [answer by DouglasLeeder](https://gaming.stackexchange.com/a/138952/4797)). If you're unsure on how to do this, just let [BOSS](https://github.com/boss-developers/boss/releases/) take care of the mods' load order. BOSS has a database of mods and their proper load order, and can automatically decide optimal load order of mods, provided they are listed in that database. Also, see the troubleshooting steps for the 'cannot absorb dragon souls' issue listed at the [Unofficial Dragonborn Patch Nexus forums sticky post by Arthmoor](http://forums.nexusmods.com/index.php?/topic/907274-unofficial-dragonborn-patch/page-169#entry8357442), one of the UDGP developers: > > Check for: `dragonactorscript.pex` and/or `mqkilldragonscript.pex`. Remove them if present. They are from dragon mods that came as loose files. > > > DSAMG - Dragon Soul Absorb More Glorious, and Diversified Dragons are known to cause this. Those mods need to be updated with a Dragonborn patch that incorporates the fixes from the UDBP. > > > [Skyrim Unbound](http://steamcommunity.com/sharedfiles/filedetails/?id=16937212) will cause this as well due to the script being unaware of the changes for Dragonborn. > > > Others may be a factor as well. > > > Note too that the offending mod may have the script packaged inside a BSA. That will need to be handled by that mod's author. > > > If you are using Mod Organizer and are here to report issues with dragon souls, sorry, but you're on your own as we do not support issues caused by incorrectly letting that program modify the BSA load order system the game has. Your post is likely to just be ignored. We don't have time to keep fending off false bug reports caused by people who insist on unpacking their BSA files using the program and thus subverting the entire system the game relies on for proper behavior. > > > --- > > ...scripts are baked into saves (right?), so in theory I have to (cringes) restart the game to be absolutely sure... > > > Yes, scripts are baked into saves. However, there is a way to remove scripts left by uninstalled mods in savefiles. You need to configure [Skyrim Script Extender (SKSE)](http://skse.silverlock.org/) to use its `ClearInvalidRegistrations` console command. It removes invalid scripts left running by uninstalled mods. This feature was introduced in [v1.6.7 of SKSE](http://skse.silverlock.org/skse_whatsnew.txt): > > add console command `ClearInvalidRegistrations` to remove invalid > OnUpdate() registrations > > > This prevents orphaned OnUpdate() events and > the resulting bloated/broken saves when removing certain mods. When > applied to an already bloated save, it will stop growing further and > instead shrink over time as the game processes all queued events. This > may take hours depending on the amount of bloat. > > > To execute automatically after each reload, add this to `\Data\SKSE\skse.ini`: > > > `[General]` > > `ClearInvalidRegistrations=1` > > > Use the skse.ini method to automatically remove invalid scripts left by uninstalled mods. > > I read somewhere that No Spinning Death overwrites a script related to dragon death. It might be mucking up things some, but I can't tell. > > > After configuring SKSE to use the `ClearInvalidRegistrations` command, try uninstalling the 'No Spinning Death' mod and then see if the issue is fixed. Otherwise, you'll have to disable half your mods and then test again. Rinse and repeat until you find the offending mod.
If that is your load order I see one problem: You have the skyrim patch after the DLC patches - it needs to go first. The correct order is given at: <http://skyrim.nexusmods.com/mods/19/> > > * Skyrim.esm > * Update.esm > * Unofficial Skyrim Patch.esp > * Dawnguard.esm > * Unofficial Dawnguard Patch.esp > * Hearthfires.esm > * Unofficial Hearthfire Patch.esp > * Dragonborn.esm > * Unofficial Dragonborn Patch.esp > * HighResTexturePack01.esp > * HighResTexturePack02.esp > * HighResTexturePack03.esp > * Unofficial High Resolution Patch.esp > > > The patches should be interleaved with the actual DLC.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
If that is your load order I see one problem: You have the skyrim patch after the DLC patches - it needs to go first. The correct order is given at: <http://skyrim.nexusmods.com/mods/19/> > > * Skyrim.esm > * Update.esm > * Unofficial Skyrim Patch.esp > * Dawnguard.esm > * Unofficial Dawnguard Patch.esp > * Hearthfires.esm > * Unofficial Hearthfire Patch.esp > * Dragonborn.esm > * Unofficial Dragonborn Patch.esp > * HighResTexturePack01.esp > * HighResTexturePack02.esp > * HighResTexturePack03.esp > * Unofficial High Resolution Patch.esp > > > The patches should be interleaved with the actual DLC.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
If that is your load order I see one problem: You have the skyrim patch after the DLC patches - it needs to go first. The correct order is given at: <http://skyrim.nexusmods.com/mods/19/> > > * Skyrim.esm > * Update.esm > * Unofficial Skyrim Patch.esp > * Dawnguard.esm > * Unofficial Dawnguard Patch.esp > * Hearthfires.esm > * Unofficial Hearthfire Patch.esp > * Dragonborn.esm > * Unofficial Dragonborn Patch.esp > * HighResTexturePack01.esp > * HighResTexturePack02.esp > * HighResTexturePack03.esp > * Unofficial High Resolution Patch.esp > > > The patches should be interleaved with the actual DLC.
I had the same issue. However when I disabled all the unofficial patches I was still having this problem. I ended up taking the script extender off and it worked. Then slowly started uploading my mods back on that didn't need the script extender. I wanna put it back on there so I can have my immersion mods back that made the game more pretty but idk. We will have to wait and see.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
If that is your load order I see one problem: You have the skyrim patch after the DLC patches - it needs to go first. The correct order is given at: <http://skyrim.nexusmods.com/mods/19/> > > * Skyrim.esm > * Update.esm > * Unofficial Skyrim Patch.esp > * Dawnguard.esm > * Unofficial Dawnguard Patch.esp > * Hearthfires.esm > * Unofficial Hearthfire Patch.esp > * Dragonborn.esm > * Unofficial Dragonborn Patch.esp > * HighResTexturePack01.esp > * HighResTexturePack02.esp > * HighResTexturePack03.esp > * Unofficial High Resolution Patch.esp > > > The patches should be interleaved with the actual DLC.
I also used Nexus 31685, but I had to extract the mqkilldragonscript.pex from UDBP (Nexus 31083) which I added to the scripts folder for Nexus 31685. My SMPC (Nexus 23833) was overwriting the updated mqkilldragonscript.pex and keeping the dragon soul from absorbing properly. I used BSA Unpacker (Nexus 4804) to get the file I needed out of the UDBP bsa file.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
Make sure that the mods' load order is correct (as explained in an [answer by DouglasLeeder](https://gaming.stackexchange.com/a/138952/4797)). If you're unsure on how to do this, just let [BOSS](https://github.com/boss-developers/boss/releases/) take care of the mods' load order. BOSS has a database of mods and their proper load order, and can automatically decide optimal load order of mods, provided they are listed in that database. Also, see the troubleshooting steps for the 'cannot absorb dragon souls' issue listed at the [Unofficial Dragonborn Patch Nexus forums sticky post by Arthmoor](http://forums.nexusmods.com/index.php?/topic/907274-unofficial-dragonborn-patch/page-169#entry8357442), one of the UDGP developers: > > Check for: `dragonactorscript.pex` and/or `mqkilldragonscript.pex`. Remove them if present. They are from dragon mods that came as loose files. > > > DSAMG - Dragon Soul Absorb More Glorious, and Diversified Dragons are known to cause this. Those mods need to be updated with a Dragonborn patch that incorporates the fixes from the UDBP. > > > [Skyrim Unbound](http://steamcommunity.com/sharedfiles/filedetails/?id=16937212) will cause this as well due to the script being unaware of the changes for Dragonborn. > > > Others may be a factor as well. > > > Note too that the offending mod may have the script packaged inside a BSA. That will need to be handled by that mod's author. > > > If you are using Mod Organizer and are here to report issues with dragon souls, sorry, but you're on your own as we do not support issues caused by incorrectly letting that program modify the BSA load order system the game has. Your post is likely to just be ignored. We don't have time to keep fending off false bug reports caused by people who insist on unpacking their BSA files using the program and thus subverting the entire system the game relies on for proper behavior. > > > --- > > ...scripts are baked into saves (right?), so in theory I have to (cringes) restart the game to be absolutely sure... > > > Yes, scripts are baked into saves. However, there is a way to remove scripts left by uninstalled mods in savefiles. You need to configure [Skyrim Script Extender (SKSE)](http://skse.silverlock.org/) to use its `ClearInvalidRegistrations` console command. It removes invalid scripts left running by uninstalled mods. This feature was introduced in [v1.6.7 of SKSE](http://skse.silverlock.org/skse_whatsnew.txt): > > add console command `ClearInvalidRegistrations` to remove invalid > OnUpdate() registrations > > > This prevents orphaned OnUpdate() events and > the resulting bloated/broken saves when removing certain mods. When > applied to an already bloated save, it will stop growing further and > instead shrink over time as the game processes all queued events. This > may take hours depending on the amount of bloat. > > > To execute automatically after each reload, add this to `\Data\SKSE\skse.ini`: > > > `[General]` > > `ClearInvalidRegistrations=1` > > > Use the skse.ini method to automatically remove invalid scripts left by uninstalled mods. > > I read somewhere that No Spinning Death overwrites a script related to dragon death. It might be mucking up things some, but I can't tell. > > > After configuring SKSE to use the `ClearInvalidRegistrations` command, try uninstalling the 'No Spinning Death' mod and then see if the issue is fixed. Otherwise, you'll have to disable half your mods and then test again. Rinse and repeat until you find the offending mod.
I had the same issue. However when I disabled all the unofficial patches I was still having this problem. I ended up taking the script extender off and it worked. Then slowly started uploading my mods back on that didn't need the script extender. I wanna put it back on there so I can have my immersion mods back that made the game more pretty but idk. We will have to wait and see.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
Make sure that the mods' load order is correct (as explained in an [answer by DouglasLeeder](https://gaming.stackexchange.com/a/138952/4797)). If you're unsure on how to do this, just let [BOSS](https://github.com/boss-developers/boss/releases/) take care of the mods' load order. BOSS has a database of mods and their proper load order, and can automatically decide optimal load order of mods, provided they are listed in that database. Also, see the troubleshooting steps for the 'cannot absorb dragon souls' issue listed at the [Unofficial Dragonborn Patch Nexus forums sticky post by Arthmoor](http://forums.nexusmods.com/index.php?/topic/907274-unofficial-dragonborn-patch/page-169#entry8357442), one of the UDGP developers: > > Check for: `dragonactorscript.pex` and/or `mqkilldragonscript.pex`. Remove them if present. They are from dragon mods that came as loose files. > > > DSAMG - Dragon Soul Absorb More Glorious, and Diversified Dragons are known to cause this. Those mods need to be updated with a Dragonborn patch that incorporates the fixes from the UDBP. > > > [Skyrim Unbound](http://steamcommunity.com/sharedfiles/filedetails/?id=16937212) will cause this as well due to the script being unaware of the changes for Dragonborn. > > > Others may be a factor as well. > > > Note too that the offending mod may have the script packaged inside a BSA. That will need to be handled by that mod's author. > > > If you are using Mod Organizer and are here to report issues with dragon souls, sorry, but you're on your own as we do not support issues caused by incorrectly letting that program modify the BSA load order system the game has. Your post is likely to just be ignored. We don't have time to keep fending off false bug reports caused by people who insist on unpacking their BSA files using the program and thus subverting the entire system the game relies on for proper behavior. > > > --- > > ...scripts are baked into saves (right?), so in theory I have to (cringes) restart the game to be absolutely sure... > > > Yes, scripts are baked into saves. However, there is a way to remove scripts left by uninstalled mods in savefiles. You need to configure [Skyrim Script Extender (SKSE)](http://skse.silverlock.org/) to use its `ClearInvalidRegistrations` console command. It removes invalid scripts left running by uninstalled mods. This feature was introduced in [v1.6.7 of SKSE](http://skse.silverlock.org/skse_whatsnew.txt): > > add console command `ClearInvalidRegistrations` to remove invalid > OnUpdate() registrations > > > This prevents orphaned OnUpdate() events and > the resulting bloated/broken saves when removing certain mods. When > applied to an already bloated save, it will stop growing further and > instead shrink over time as the game processes all queued events. This > may take hours depending on the amount of bloat. > > > To execute automatically after each reload, add this to `\Data\SKSE\skse.ini`: > > > `[General]` > > `ClearInvalidRegistrations=1` > > > Use the skse.ini method to automatically remove invalid scripts left by uninstalled mods. > > I read somewhere that No Spinning Death overwrites a script related to dragon death. It might be mucking up things some, but I can't tell. > > > After configuring SKSE to use the `ClearInvalidRegistrations` command, try uninstalling the 'No Spinning Death' mod and then see if the issue is fixed. Otherwise, you'll have to disable half your mods and then test again. Rinse and repeat until you find the offending mod.
I also used Nexus 31685, but I had to extract the mqkilldragonscript.pex from UDBP (Nexus 31083) which I added to the scripts folder for Nexus 31685. My SMPC (Nexus 23833) was overwriting the updated mqkilldragonscript.pex and keeping the dragon soul from absorbing properly. I used BSA Unpacker (Nexus 4804) to get the file I needed out of the UDBP bsa file.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
I had the same issue. However when I disabled all the unofficial patches I was still having this problem. I ended up taking the script extender off and it worked. Then slowly started uploading my mods back on that didn't need the script extender. I wanna put it back on there so I can have my immersion mods back that made the game more pretty but idk. We will have to wait and see.
138,924
Anyone around coy with being Mr. Fixit? (Ms. Fixit would be even better, but either will do nicely.) I can't absorb dragon souls, and yes, I've been through almost every thread there is here on the answer. (So please, do not duplicate me. Pretty please?) Mind you, I got a *TRUCKLOAD* of mods installed... *(ducks in preparation for the coming brick)* Odd thing is, I was playing with a very similar list before installing Dragon Combat Overhaul and Succubus Race, but deactivating either won't get me anywhere. Done some digging on the Nexus and Steam forums... I read somewhere that No Spinning Death overwrites a script related to dragon death. It *might* be mucking up things some, but I can't tell. Disabling that mod didn't get me anywhere, but scripts are baked into saves (right?), so in theory I have to *(cringes)* restart the game to be absolutely sure... Other bits worth (?) knowing: * Running SKSE * Running ENB * Using ModOrganizer UPDATE: There is something seriously broken with my game itself. Tried the following: * Disabled ALL the mods, save for Alternate Start for quicker starts (and yes, this includes USKP, UDGP and UDBP) * Started a new game, created a vanilla Nord character * Toggled godmode on * Given the PC Lightning Storm * Spawned Mirmulnir * Turned the overgrown lizard into charred meat And STILL I'm not absorbing its soul! UPDATE 2: Verifying the game cache integrity turned up 3 corrupted files. Wish I knew which those were, but I had cleaned my master files using TES5Edit, so I thought I had screwed up something there. Created a new barebones game, and at last, I'm having some dragon spirit chow. Then, created a new fully modded game, and no soul chow for me... For a moment I wanted to pin the blame on TES5Edit but now I know that's not the cause. The culprit's still at large. UPDATE 3: After having no luck with a fully modded game, started to gradually activate mods again... eventually I realized that the truckload of mods I had activated on my previous attempt broke something **again** on my vanilla installation, for even another barebones try was plagued with this issue. Re-check integrity, and bam, another file -a very small one, not even 1k in size- was corrupted. (Again, I wish there was a way to know which!) UPDATE 4: Tried a new game with just these on: * USKP * UDGP * UDBP * Alternate Start Guess what. AGAIN the corrupted file issue. Tried again with only Alternate Start active, and still cannot absorb dragon souls. Even while today I could on a similar setup. (I don't understand anything anymore here...) Anyone knows of a way to skip the intro without installing this mod? (Could it be that ModOrganizer is somehow mucking things up?) UPDATE 5: *Probably* ModOrganizer has something to do with this. However insane it sounds. Instead of manually disabling ESPs, I right-clicked on the mod list, selected 'Disable all visible mods', manually re-activated Alternate Start, and *this time* I could dine on dragon essence. Read again: a near-completely barebones setup, without even the unofficial patches. UPDATE 6: Disregard what I said about MO screwing up things. One of the unofficial patches is misbehaving. Even with a truckload of mods on, I can still eat dragonstuff--right until activating all three of them. Which one is to blame I don't yet know. **UPDATE 7 AND FINAL:** Finally, finally figured what's going on. USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
2013/11/06
[ "https://gaming.stackexchange.com/questions/138924", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/59017/" ]
USKP has a problem with the dragonactorscript.pex file. Found and installed a fix available here: <http://www.nexusmods.com/skyrim/mods/31685> Personally, I went and overwrote the file from USKP itself instead of treating this fix as a separate mod, keeping a backup available just in case.
I also used Nexus 31685, but I had to extract the mqkilldragonscript.pex from UDBP (Nexus 31083) which I added to the scripts folder for Nexus 31685. My SMPC (Nexus 23833) was overwriting the updated mqkilldragonscript.pex and keeping the dragon soul from absorbing properly. I used BSA Unpacker (Nexus 4804) to get the file I needed out of the UDBP bsa file.
58,197,804
I have recently started using Ant Deisgn and really enjoyed working with it. However I seem to have stumble upon an issue that I am having a hard time solving. Using react-testing-library for tests, I am having troubles with testing some Ant Design component. One of the reason is that for some unknown reason some components (e.g. Menu, Menu.Item, Dropdown, etc) do not render the custom attribute `data-testid` thus making impossible to target a specific element of the DOM. This makes the tests less performant and accurate. Did some else stumble upon the same issue ? How did you go about solving this ? Is there something that can be done by the Ant Design team about this issue ?
2019/10/02
[ "https://Stackoverflow.com/questions/58197804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/909822/" ]
The `data-testid` attribute is configurable to whatever attribute you want. <https://testing-library.com/docs/dom-testing-library/api-configuration> Also, as long as the library you choose, has ID attribute, you çan do following : ```js const {container} = render(<Foo />) ; const button = container.querySelector('#idValue'); // returns react element fireEvent.click(button); ``` P. S: mobile edit. Pls ignore formats
Today, I had the same issue with testing a label of an Ant Design Desciptions.Item with the react-testing-library. I figured out that the label was in a `<span>` element, so I moved it into a `<div>` element which solved my problem. Before: ``` <Descriptions.Item data-testid='test-label-of-descriptions-item-failed' label={'some label'} labelStyle={{ ...FONT_SMALL }} contentStyle={{ ...FONT_SMALL }} style={{ ...DESC_ITEM }}> ``` After: ``` <Descriptions.Item label={ <div style={{ display: 'inline-block' }} data-testid='test-label-of-descriptions-item-worked' >'some label' </div> } labelStyle={{ ...FONT_SMALL }} contentStyle={{ ...FONT_SMALL }} style={{ ...DESC_ITEM }}> ```
71,841,110
I created my page routing with react-router v5 and everything works well. If I click on the link, it takes me to the page, but when I reload the page I get a "404 | Page Not Found" error on the page. ``` import React, { useEffect, useState } from 'react' import Home from './dexpages/Home' import { BrowserRouter, Routes, Route } from "react-router-dom"; import Dashboard from './dexpages/dashboard'; import Swapping from './dexpages/swapping' import Send from './dexpages/send'; import Airdrops from './dexpages/airdrops' function Main() { const [mounted, setMounted] = useState(false) useEffect(() => { if (typeof window !== "undefined") { setMounted(true) } }, []) return ( <> {mounted && <BrowserRouter> <div className="min-h-screen" style={{ overflowX: 'hidden' }}> <Routes> <Route path="/airdrops" element={<Airdrops />} /> <Route path="/send" element={<Send />} /> <Route path="/swap" element={<Swapping />} /> <Route path="/dashboard" element={<Dashboard />} /> <Route path="/" element={<Home />} /> </Routes> </div> </BrowserRouter> } </> ) } export default Main; ``` This is my Main Component where I create all the routing. [This is the error I'm getting when I reload the page](https://i.stack.imgur.com/zGX9p.png)
2022/04/12
[ "https://Stackoverflow.com/questions/71841110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11185816/" ]
Don't use React Router with next.js. [Next.js has its own routing mechanism](https://nextjs.org/docs/basic-features/pages) which is used for both client-side routing and server-side routing. By using React Router, you're bypassing that with your own client-side routing so when you request the page directly (and depend on server-side routing) you get a 404 Not Found. Next.js has [a migration guide](https://nextjs.org/docs/migrating/from-react-router).
Your paths need to be adjusted. For the home page it is fine to be routed to `/` however for the other pages there is no need for a backslash, remove the backslash from the Airdrops, Send, Swapping, and Dashboard paths respectively and you should be fine. Try this below for each of the routes. `<Route path="airdrops" element={<Airdrops />} />` `<Route path="send" element={<Send />} />` `<Route path="swap" element={<Swapping />} />` `<Route path="dashboard" element={<Dashboard />} />` `<Route path="/" element={<Home />} />`
54,244,797
I am trying to perform a CountIfs function where two criteria are met. First a line is "Approved" and second the Appv Date is within the reporting month. The CountIfs works find when only the first criteria exists but when I add the second I get a Type Mismatch error and I am not sure why. Code: ``` ' Declarations Dim sRoutine As String 'Routine’s Name Dim lngStatus As Long Dim lngLastRow As Long Dim intRptMnth As Integer Dim intRptYr As Integer Dim lngAppvDate As Long ' Initialize Variables lngLastRow = FindLastRow(strPSR_File, strCCL, 1) lngStatus = Worksheets(strCCL).Range(FindLoc(strPSR_File, strCCL,"status")).Column lngAppvDate = Worksheets(strCCL).Range(FindLoc(strPSR_File, strCCL,"Approved Date")).Column intRptMnth = CInt(CalcRptMnthNum) intRptYr = CalcRptYr ' Procedure With Worksheets(strCCL) CalcPCR_MTD_Cnt = Application.WorksheetFunction.CountIfs( _ Worksheets(strCCL).Range(Cells(2, lngStatus), Cells(lngLastRow, lngStatus)), _ "=Approved", _ '********ERRORS HERE***** Month(Worksheets(strCCL).Range("n2:n3")), _ intRptMnth) '************************ End With ```
2019/01/17
[ "https://Stackoverflow.com/questions/54244797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10344640/" ]
You can grab the selected item using `lb2.SelectedItem` and split it as you are doing, then take the rest of the items (filtering out the item with an index of `lb2.SelectedIndex` by using a `Where` clause) and then do a `SelectMany` on the results, splitting each on a space character: ``` var nonSelected = lb2.Items.OfType<string>() .Where((item, index) => index != lb2.SelectedIndex); var first = lb2.SelectedItem.ToString().Split(' '); var rest = nonSelected.SelectMany(others => others.Split(' ')).ToArray(); ```
* Verify that there's at least one selected item, to avoid exceptions. * Insert in the first array the content of the currently selected ListBox item, splitting it using [String.Split()](https://learn.microsoft.com/en-us/dotnet/api/system.string.split?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.String.Split);k(TargetFrameworkMoniker-.NETFramework&view=netframework-4.7.2) (since we're splitting on a white space, no need to specify a separator: it's the default). * Take all the non-selected Items ([`.Where`](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.where?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.Linq.Enumerable.Where%60%601);k(TargetFrameworkMoniker-.NETFramework&view=netframework-4.7.2) the Item index is not the current) and use [`SelectMany`](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.selectmany?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.Linq.Enumerable.SelectMany%60%602);k(TargetFrameworkMoniker-.NETFramework&view=netframework-4.7.2) to flatten the arrays generated by splitting the content of each Item. --- ``` int currentIndex = listBox1.SelectedIndex; if (currentIndex < 0) return; string[] firstArray = listBox1.GetItemText(listBox1.Items[currentIndex]).Split(); string[] secondArray = listBox1.Items.OfType<string>().Where((item, idx) => idx != currentIndex) .SelectMany(item => item.Split()).ToArray(); ```
69,113,035
I have the following data: ``` data_list = ["\"TOTO TITI TATA,TAGADA\"", "\"\"\"TUTU,ROOT\"\"\""] ``` It is transformed into a pandas dataframe: ``` df = pandas.DataFrame(data_list) print(df) 0 0 "TOTO TITI TATA,TAGADA" 1 """TUTU,ROOT"" ``` When writing the dataframe as a csv, without any quoting configuration, I get the following result: ``` with open("test_quote_normal", "w") as w: df.to_csv(w, index=False, header=False) ``` -> result output ``` """TOTO TITI TATA,TAGADA""" """""""TUTU,ROOT""""""" ``` Every quotes have been quoted, which is not something I want. So i tried to prevent this with the following configuration: ``` with open("test_quote_none", "w") as w: df.to_csv(w, index=False, header=False, quoting=csv.QUOTE_NONE, escapechar=',') ``` -> result output ``` "TOTO TITI TATA,,TAGADA" """TUTU,,ROOT""" ``` The quotes are correct, but for a reason I do not understand, the escape char has been inserted in the data itself. Specifying the sep value has no effect: ``` with open("test_quote_none", "w") as w: df.to_csv(w, index=False, header=False, quoting=csv.QUOTE_NONE, escapechar=',', sep= ",") ``` Why does pandas inserts the escape char in the data ?
2021/09/09
[ "https://Stackoverflow.com/questions/69113035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6213883/" ]
`"` and `,` are both special characters by default in csv format `"` is used when `,` is there between a data. That time the data is escaped by quotes to tell that it should be a single data. whereas, `,` is the default seperator for distinguishing between data. Since you are using both of them in your data, that's why you are having such a hard time debugging it **First snippet** ``` with open("test_quote_normal", "w") as w: df.to_csv(w, index=False, header=False) ``` If the data still has `"`, as per csv conventions, it should also be escaped which was causing multiple `"` in your first scenario **Second snippet** ``` with open("test_quote_none", "w") as w: df.to_csv(w, index=False, header=False, quoting=csv.QUOTE_NONE, escapechar=',') ``` Using the `quoting` parameter, you are telling that you don't indent quotes to protect the `,` character. So the `,` inside your data is being treated as a separator causing the escape character to come between them For more clarity, you can see the output of these snippets ``` with open("temp.csv", "w") as w: ...: df.to_csv(w, index=False, header=False, quotechar='@') ``` Output ``` @"TOTO TITI TATA,TAGADA"@ @"""TUTU,ROOT"""@ ``` In this, we are changing the `quotechar` to become `@`, that's why, instead of using `"` for protecting `,`, this time `@` is being used to escape data with `,` inside them ``` with open("temp.csv", "w") as w: ...: df.to_csv(w, index=False, header=False, escapechar='@', doublequote=False) ``` Output ``` "@"TOTO TITI TATA,TAGADA@"" "@"@"@"TUTU,ROOT@"@"@"" ``` In this, the quotechar is still the same, but for escaping them, we are changing it to `@` for clarity, this time you can see the difference on `quotechar` and `escapechar` I hope this helps your question
Is it what you expect? ``` print(df.to_csv(index=False, header=False, quoting=csv.QUOTE_NONE, sep= "@")) "TOTO TITI TATA,TAGADA" """TUTU,ROOT""" ```
50,917,419
I'd like to send request using python and requests library. I have checked this request in web browser inspector and form data looks like that: ``` data[foo]: bar data[numbers][]: 1 data[numbers][]: 2 data[numbers][]: 3 data[numbers][]: 4 data[numbers][]: 5 csrf_hash: 12345 ``` This is my code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', payload) ``` It doesn't work. I'm getting error because of invalid post data
2018/06/18
[ "https://Stackoverflow.com/questions/50917419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369663/" ]
The problem realise in the way that you are trying to send the data to <https://www.foo.com/bar/> instead of sending it using `data`I would recommend you to try `json` instead so your final code should look something like this ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', json=payload) ``` Hope this helps.
Can you try to do this: ``` import json url = 'https://www.foo.com/bar/' payload = {'some': 'data'} r = requests.post(url, data=json.dumps(payload)) ```
50,917,419
I'd like to send request using python and requests library. I have checked this request in web browser inspector and form data looks like that: ``` data[foo]: bar data[numbers][]: 1 data[numbers][]: 2 data[numbers][]: 3 data[numbers][]: 4 data[numbers][]: 5 csrf_hash: 12345 ``` This is my code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', payload) ``` It doesn't work. I'm getting error because of invalid post data
2018/06/18
[ "https://Stackoverflow.com/questions/50917419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369663/" ]
I resolve problem with this code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers][0]': 1, 'data[numbers][1]': 2, 'data[numbers][2]': 3, 'data[numbers][3]': 4, 'data[numbers][4]': 5} r = s.post('https://www.foo.com/bar/', payload) ``` It's not very beautiful, but works.
Can you try to do this: ``` import json url = 'https://www.foo.com/bar/' payload = {'some': 'data'} r = requests.post(url, data=json.dumps(payload)) ```
50,917,419
I'd like to send request using python and requests library. I have checked this request in web browser inspector and form data looks like that: ``` data[foo]: bar data[numbers][]: 1 data[numbers][]: 2 data[numbers][]: 3 data[numbers][]: 4 data[numbers][]: 5 csrf_hash: 12345 ``` This is my code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', payload) ``` It doesn't work. I'm getting error because of invalid post data
2018/06/18
[ "https://Stackoverflow.com/questions/50917419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369663/" ]
I needed a way to deal with it in a more dynamic / adaptable way. What I came up with was this: ``` def multi_dict_to_php_dict(md): result = {} for key in md.keys(): if '[]' in key: # Key is an array, we need to make the array keys unique. keyformat = '[%d]'.join(key.split('[]')) for idx, val in enumerate(md.getlist(key)): result[keyformat % idx] = val else: # Key is just a value, include it in the new result. result[key] = md[key] return result ``` This supports things like `number[]`, as well as `group[][name]` (what I was encountering) or `item[children][]`. It wouldn't (in its current form) handle `arrayofarrays[][]`, but it could probably be made to with some minor adaptation.
Can you try to do this: ``` import json url = 'https://www.foo.com/bar/' payload = {'some': 'data'} r = requests.post(url, data=json.dumps(payload)) ```
50,917,419
I'd like to send request using python and requests library. I have checked this request in web browser inspector and form data looks like that: ``` data[foo]: bar data[numbers][]: 1 data[numbers][]: 2 data[numbers][]: 3 data[numbers][]: 4 data[numbers][]: 5 csrf_hash: 12345 ``` This is my code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', payload) ``` It doesn't work. I'm getting error because of invalid post data
2018/06/18
[ "https://Stackoverflow.com/questions/50917419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369663/" ]
I resolve problem with this code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers][0]': 1, 'data[numbers][1]': 2, 'data[numbers][2]': 3, 'data[numbers][3]': 4, 'data[numbers][4]': 5} r = s.post('https://www.foo.com/bar/', payload) ``` It's not very beautiful, but works.
The problem realise in the way that you are trying to send the data to <https://www.foo.com/bar/> instead of sending it using `data`I would recommend you to try `json` instead so your final code should look something like this ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', json=payload) ``` Hope this helps.
50,917,419
I'd like to send request using python and requests library. I have checked this request in web browser inspector and form data looks like that: ``` data[foo]: bar data[numbers][]: 1 data[numbers][]: 2 data[numbers][]: 3 data[numbers][]: 4 data[numbers][]: 5 csrf_hash: 12345 ``` This is my code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers]': [1, 2, 3, 4, 5]} r = s.post('https://www.foo.com/bar/', payload) ``` It doesn't work. I'm getting error because of invalid post data
2018/06/18
[ "https://Stackoverflow.com/questions/50917419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369663/" ]
I resolve problem with this code: ``` payload = {'data[foo]': 'bar', 'csrf_hash': 12345, 'data[numbers][0]': 1, 'data[numbers][1]': 2, 'data[numbers][2]': 3, 'data[numbers][3]': 4, 'data[numbers][4]': 5} r = s.post('https://www.foo.com/bar/', payload) ``` It's not very beautiful, but works.
I needed a way to deal with it in a more dynamic / adaptable way. What I came up with was this: ``` def multi_dict_to_php_dict(md): result = {} for key in md.keys(): if '[]' in key: # Key is an array, we need to make the array keys unique. keyformat = '[%d]'.join(key.split('[]')) for idx, val in enumerate(md.getlist(key)): result[keyformat % idx] = val else: # Key is just a value, include it in the new result. result[key] = md[key] return result ``` This supports things like `number[]`, as well as `group[][name]` (what I was encountering) or `item[children][]`. It wouldn't (in its current form) handle `arrayofarrays[][]`, but it could probably be made to with some minor adaptation.
6,024,494
So I'd like to have a gradient that fills 100% of the background of a webpage. For browsers that can't handle it, a solid color is fine. here is my current css: ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background: #afb1b4; /* Old browsers */ background: -moz-linear-gradient(top, #afb1b4 0%, #696a6d 100%) no-repeat; /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#afb1b4), color-stop(100%,#696a6d)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Opera11.10+ */ background: -ms-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AFB1B4', endColorstr='#696A6D',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* W3C */ } ``` It seemed to work out while the page had little content, but as I've filled out the page with more content, navigation, etcetera, there is now some white at the bottom. maybe 100px or so. Am I doing this wrong? Do I need to be offsetting some padding somewhere?
2011/05/16
[ "https://Stackoverflow.com/questions/6024494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412485/" ]
Get rid of your `height: 100%` declarations. It seems like setting the height to 100% just sets it to 100% of the viewport, not actually 100% of the page itself.
I also found that adding 'fixed' to the end seemed to do the trick: ``` body { margin: 0; padding: 0; background-repeat: no-repeat; background: #afb1b4; /* Old browsers */ background: -moz-linear-gradient(top, #afb1b4 0%, #696a6d 100%) fixed no-repeat; /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#afb1b4), color-stop(100%,#696a6d)) fixed; /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* Opera11.10+ */ background: -ms-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AFB1B4', endColorstr='#696A6D',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* W3C */ } ```
6,024,494
So I'd like to have a gradient that fills 100% of the background of a webpage. For browsers that can't handle it, a solid color is fine. here is my current css: ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background: #afb1b4; /* Old browsers */ background: -moz-linear-gradient(top, #afb1b4 0%, #696a6d 100%) no-repeat; /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#afb1b4), color-stop(100%,#696a6d)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Opera11.10+ */ background: -ms-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AFB1B4', endColorstr='#696A6D',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* W3C */ } ``` It seemed to work out while the page had little content, but as I've filled out the page with more content, navigation, etcetera, there is now some white at the bottom. maybe 100px or so. Am I doing this wrong? Do I need to be offsetting some padding somewhere?
2011/05/16
[ "https://Stackoverflow.com/questions/6024494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412485/" ]
Get rid of your `height: 100%` declarations. It seems like setting the height to 100% just sets it to 100% of the viewport, not actually 100% of the page itself.
Here's an expansion of my comment to use SVG instead of vendor prefix and proprietary extensions. This reduces the size of the CSS and, with the employment of some ingenius tactics, can allow you to use a single SVG file as a sprite pack for gradients (reducing the total number of HTTP requests). First create your SVG file and gradient (per your question specs): ``` <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="1" height="500" version="1.1" xmlns="http://www.w3.org/2000/svg"> <g> <defs> <linearGradient id="ui-bg-grad" x1="0%" x2="0%" y1="0%" y2="100%"> <stop offset="0%" stop-color="#afb1b4" /> <stop offset="100%" stop-color="#696a6d" /> </linearGradient> </defs> <rect fill="url(#ui-bg-grad)" x="0" y="0" width="100%" height="500"/> </g> </svg> ``` Next, here's your new declaration: ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Old browsers: anything not listed below */ background-image: url("grad.svg"); /** Browsers that support SVG: IE9+, FF4+, Safari 4+(maybe 5), Opera 10+ } ``` Now, if you want to support older browsers with png image, you can with one little change. Since any property that uses `url()` does not support hinting (like `@font-face`'s `src` property), you have to alter the rule a little. ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Image fails to load, or FF3.5 */ background-image: url("grad.png"); /* Old browsers: anything not listed below or above */ } body:not(foo) { /* most browsers that support :not() support SVG in url(), except FF3.5 */ background-image: url("grad.svg"); /* Browsers that support SVG: IE9+, FF4+, Safari 4+(maybe 5), Opera 10+ */ } ``` If you want to get stupid crazy, you could base64encode the SVG file so that you don't have to download another file from the server then add it as a class to be reused (prevent repasting the base64 in multiple place). ``` .svg-sprite:not(foo) { background-size: 100% 100%; background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSI1MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Zz48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9InVpLWJnLWdyYWQiIHgxPSIwJSIgeDI9IjAlIiB5MT0iMCUiIHkyPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjYWZiMWI0IiAvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzY5NmE2ZCIgLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCBmaWxsPSJ1cmwoI3VpLWJnLWdyYWQpIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSI1MDAiLz48L2c+PC9zdmc+"); } html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Image fails to load, or FF3.5 */ background-image: url("grad.png"); /* Old browsers: anything not listed below or above */ } ``` Then update your `body` tag to include the `.svg-sprite` class.
6,024,494
So I'd like to have a gradient that fills 100% of the background of a webpage. For browsers that can't handle it, a solid color is fine. here is my current css: ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background: #afb1b4; /* Old browsers */ background: -moz-linear-gradient(top, #afb1b4 0%, #696a6d 100%) no-repeat; /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#afb1b4), color-stop(100%,#696a6d)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* Opera11.10+ */ background: -ms-linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AFB1B4', endColorstr='#696A6D',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #afb1b4 0%,#696a6d 100%); /* W3C */ } ``` It seemed to work out while the page had little content, but as I've filled out the page with more content, navigation, etcetera, there is now some white at the bottom. maybe 100px or so. Am I doing this wrong? Do I need to be offsetting some padding somewhere?
2011/05/16
[ "https://Stackoverflow.com/questions/6024494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412485/" ]
Here's an expansion of my comment to use SVG instead of vendor prefix and proprietary extensions. This reduces the size of the CSS and, with the employment of some ingenius tactics, can allow you to use a single SVG file as a sprite pack for gradients (reducing the total number of HTTP requests). First create your SVG file and gradient (per your question specs): ``` <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="1" height="500" version="1.1" xmlns="http://www.w3.org/2000/svg"> <g> <defs> <linearGradient id="ui-bg-grad" x1="0%" x2="0%" y1="0%" y2="100%"> <stop offset="0%" stop-color="#afb1b4" /> <stop offset="100%" stop-color="#696a6d" /> </linearGradient> </defs> <rect fill="url(#ui-bg-grad)" x="0" y="0" width="100%" height="500"/> </g> </svg> ``` Next, here's your new declaration: ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Old browsers: anything not listed below */ background-image: url("grad.svg"); /** Browsers that support SVG: IE9+, FF4+, Safari 4+(maybe 5), Opera 10+ } ``` Now, if you want to support older browsers with png image, you can with one little change. Since any property that uses `url()` does not support hinting (like `@font-face`'s `src` property), you have to alter the rule a little. ``` html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Image fails to load, or FF3.5 */ background-image: url("grad.png"); /* Old browsers: anything not listed below or above */ } body:not(foo) { /* most browsers that support :not() support SVG in url(), except FF3.5 */ background-image: url("grad.svg"); /* Browsers that support SVG: IE9+, FF4+, Safari 4+(maybe 5), Opera 10+ */ } ``` If you want to get stupid crazy, you could base64encode the SVG file so that you don't have to download another file from the server then add it as a class to be reused (prevent repasting the base64 in multiple place). ``` .svg-sprite:not(foo) { background-size: 100% 100%; background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSI1MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Zz48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9InVpLWJnLWdyYWQiIHgxPSIwJSIgeDI9IjAlIiB5MT0iMCUiIHkyPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjYWZiMWI0IiAvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzY5NmE2ZCIgLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCBmaWxsPSJ1cmwoI3VpLWJnLWdyYWQpIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSI1MDAiLz48L2c+PC9zdmc+"); } html { height: 100%; } body { height: 100%; margin: 0; padding: 0; background-repeat: no-repeat; background-color: #afb1b4; /* Image fails to load, or FF3.5 */ background-image: url("grad.png"); /* Old browsers: anything not listed below or above */ } ``` Then update your `body` tag to include the `.svg-sprite` class.
I also found that adding 'fixed' to the end seemed to do the trick: ``` body { margin: 0; padding: 0; background-repeat: no-repeat; background: #afb1b4; /* Old browsers */ background: -moz-linear-gradient(top, #afb1b4 0%, #696a6d 100%) fixed no-repeat; /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#afb1b4), color-stop(100%,#696a6d)) fixed; /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* Opera11.10+ */ background: -ms-linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AFB1B4', endColorstr='#696A6D',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #afb1b4 0%,#696a6d 100%) fixed; /* W3C */ } ```
56,447,602
I have a batch file and I want to call a powershell script that returns several values to the batch file. I've tried to do it by setting environment variables, but that does not work. This is the batch file: ``` ::C:\temp\TestPScall.bat @echo off powershell -executionpolicy Bypass -file "c:\temp\PStest.ps1" @echo [%psreturncode%] @echo [%uservar%] @echo [%processvar%] ``` This is the powershell script: ``` # c:\temp\PStest.ps1 $env:psreturncode = "9990" [Environment]::SetEnvironmentVariable("UserVar", "Test value.", "User") [Environment]::SetEnvironmentVariable("ProcessVar", "Test value.", "Process") ``` WHen I run it, the environment variables are not populated. How can I get this to work?
2019/06/04
[ "https://Stackoverflow.com/questions/56447602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161783/" ]
You don't need an else on the statement. check to see if your variable is false and if it is it will return if not the rest of your function will run automatically. ``` function function1() { function2(); // call function2 // after called function (here I need true or false, to decide if the function should stop or continue) } function function2() { if (condition === false) { return; } ``` }
If function2 is synchronous you can just return: ``` function function1() { if(!function2()){ return }; // call function2 // after called function (here I need true or false, to decide if the function should stop or continue) } function function2() { if (condition === value) { return true; } else { return false; } } ``` If function 2 does something asynchronous and expects a callback (one of the tags in your question) then it may be easier to write a function that will use function2 and returns a promise. ```js function function1(condition) { console.log('calling function 2'); function2AsPromise(condition).then(function( function2Result ) { if (!function2Result) { console.log('function 2 result is false'); return; } console.log('function 2 result is true'); }); console.log('exiting function 2'); } function function2(condition, callback) { setTimeout(function() { if (condition) { callback(true); } else { callback(false); } }, 2000); } function function2AsPromise(condition) { return new Promise(function(resolve) { function2(condition, resolve); }); } function1(false); ```
56,447,602
I have a batch file and I want to call a powershell script that returns several values to the batch file. I've tried to do it by setting environment variables, but that does not work. This is the batch file: ``` ::C:\temp\TestPScall.bat @echo off powershell -executionpolicy Bypass -file "c:\temp\PStest.ps1" @echo [%psreturncode%] @echo [%uservar%] @echo [%processvar%] ``` This is the powershell script: ``` # c:\temp\PStest.ps1 $env:psreturncode = "9990" [Environment]::SetEnvironmentVariable("UserVar", "Test value.", "User") [Environment]::SetEnvironmentVariable("ProcessVar", "Test value.", "Process") ``` WHen I run it, the environment variables are not populated. How can I get this to work?
2019/06/04
[ "https://Stackoverflow.com/questions/56447602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161783/" ]
You don't need an else on the statement. check to see if your variable is false and if it is it will return if not the rest of your function will run automatically. ``` function function1() { function2(); // call function2 // after called function (here I need true or false, to decide if the function should stop or continue) } function function2() { if (condition === false) { return; } ``` }
``` const function1 = check => { if (check === false) { return; } else { console.log("back from function2"); } }; function1(false) // console.log doesn't run function1(true) // console.log runs ``` make sure that you pass in a Boolean value.
6,403,038
I have an array called followers and I would like to know how I could get the objectAtIndex $a of the array in PHP. My current code is this, but it doesn't work: ``` $followers = anArray.... $returns = array(); for ($a = 1; $a <= $numberOfFollowers; $a++) { $follower = $followers[$a]; echo $follower; $query = mysql_query("query...."); if (!$query) {} while ($row = mysql_fetch_assoc($query)) { } } ``` edit--- This is how I get the followers: ``` $followers = array(); while ($row = mysql_fetch_array($querys)) { $followers[] = $row['followingUserID']; } $numberOfFollowers = count($followers); ```
2011/06/19
[ "https://Stackoverflow.com/questions/6403038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/804782/" ]
Why not do a `foreach()`, like this? ``` $followers = array(); $returns = array(); foreach($followers as $index => $follower){ echo $follower; $query = mysql_query("query...."); if (!$query) {} while ($row = mysql_fetch_assoc($query)) { } } ``` I don't know what you are cooking with this, but to me, this is a huge cannon shooting towards the DB. Try to optimize your queries into a single one. Don't ever imagine DB fetches with a loop in your mind.
It looks like every element of `$followers` is a value returned from `mysql_fetch_assoc()`. Each element will be an associative array, and when you echo it I would expect to see it echoed as the string `'Array'`, since that is PHP's usual behaviour. One point to observe is that when you create an empty array using `array()` and then populate it using assignments of the form `$myarray[] = ...`, the resulting array will be zero-indexed. That is, the keys of the array will start at 0, not at 1. So instead of `for ($a = 1; $a <= $numberOfFollowers; $a++) {`, you need to use `for ($a = 0; $a < $numberOfFollowers; $a++) {`, or go for the solution suggested by @Shef and use `foreach`. Your problem might arise because `$followers` contains only one element, and because of the off-by-one error, you are not seeing any output. Turn on error reporting by adding this line at the start of your script: ``` error_reporting(E_ALL & ~E_STRICT); ``` If I am right then with your current code, you should see a `Notice: Undefined index: 1 ...`
71,332,057
I'm new to react native and I'm not able to consume this api, when I start this app in the browser, it works fine, but when I go to the expo app it doesn't display the pokemon image, could someone help me? ```tsx import { StatusBar } from 'expo-status-bar'; import React, { useEffect, useState } from 'react'; import { StyleSheet, Text, View, Button, Alert, TextInput, Image } from 'react-native'; interface PokeInterface { sprites : { back_default : string; } } export default function App() { const [text, setText] = useState<string>("") const [response, setResponse] = useState<PokeInterface | any>() const [image, setImage] = useState<string>() const handleText = (text : string) => { setText(text) } const searchApi = (pokemonName : string) => { fetch(`https://pokeapi.co/api/v2/pokemon/${pokemonName}/`, { method: 'GET'}) .then((response) => response.json()) .then((response) => setResponse(response)) } useEffect(() => { if(text){ searchApi(text) } if(response){ const {sprites} = response setImage(sprites.front_default) } return () => { if(image){ setImage("") } } },[text, response]) return ( <View style={styles.container}> <View style={styles.topbar}> <Text style={styles.title}>Pokedex Mobile</Text> <TextInput style={styles.input} onChangeText={(value: any) => handleText(value)} value={text} placeholder="Search Pokemon" keyboardType="default" /> <Text style={styles.text}>{text}</Text> </View> {image && ( <Image style={styles.logo} source={{uri : `${image}`}} /> )} </View> ); } const styles = StyleSheet.create({ text : { fontSize: 30, color : "red" }, input: { height: 40, margin: 12, borderWidth: 1, padding: 10, }, container : { flex: 1, alignItems: 'center', justifyContent: 'center' }, title: { fontSize: 30, color: '#000' }, topbar: { }, logo : { width: 200, height: 200 } }); ```
2022/03/03
[ "https://Stackoverflow.com/questions/71332057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13966942/" ]
On MySQL, you could use aggregation: ```sql SELECT id FROM yourTable GROUP BY id HAVING SUM(name = 'Gaurav') = COUNT(*); ``` On all databases: ```sql SELECT id FROM yourTable GROUP BY id HAVING COUNT(CASE WHEN name = 'Gaurav' THEN 1 END) = COUNT(*); ```
You can try this as well. Bit hardcoded. You can use 0 instead of null and remove where clause as well if you want. ``` SELECT Case When Name ='Gaurav' Then ID else NULL END AS ID FROM Yourtable where name ='Gaurav' ```
22,198,001
I'm using Qt Creator running with the mingw C++ compiler to compile some C sources I obtained from an institution known as the NBIS. I'm trying to extract just the code that will allow me to decode images encoded in the WSQ image format. Unfortunately I'm getting messages that I have "multiple definitions" of certain functions which is contradicted by a grep search, as well as complaints of undefined functions which are indeed defined in a single C file in each case. I looked at the include files and these functions do have the word extern before them in the declarations. As for the error messages of "multiple definitions" the linker says "first defined here" and only gives one object file in each case. All C files have a C extension. I should add that I'm getting strange messages when I look at the compiler outout like this: Makefile.Debug:427: warning: overriding recipe for target 'debug/huff.o' (it is true that I have two files called huff.c,but in different directories)
2014/03/05
[ "https://Stackoverflow.com/questions/22198001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1741137/" ]
There's no automatic function that I know, but it can be easily done manually. 1. Remove `Pods` folder near your `Podfile` 2. Remove next files: `Podfile` and `Podfile.lock` 3. Remove generated `<Project_Name>.workspace` file 4. Open your `xcodeproj` file and in `Xcode`: * Remove reference to `Pods-<YOUR_TARGET>.xcconfig` file at the end of root folder ![enter image description here](https://i.stack.imgur.com/YVPmF.png) * Open project setting and choose `Build Phases` tab in your target setting: Remove here two phases: `Check Pods Manifest.lock` and `Copy Pods Resources`![enter image description here](https://i.stack.imgur.com/5nBQM.png)![enter image description here](https://i.stack.imgur.com/iy7UJ.png) * Open 'Build Phases' - > `Link Binary With Libraries` and remove all links that starts from `libPods...` ![enter image description here](https://i.stack.imgur.com/U4y8h.png) * Switch to project settings and deselect (must be `None` everywhere if you haven't created before) configuration sets if there are any at `Info` tab.![enter image description here](https://i.stack.imgur.com/mCuSi.png)
### Self Answer While the answer by @Ossir works properly, I have found one library called [cocoapods-deintegrate](https://github.com/kylef/cocoapods-deintegrate) that takes charge of all the work that deintegrate CocoaPods from your project. In order to use it, you first install it by `gem install cocoapods-deintegrate` (*sudo* might be required) and then just `pod deintegrate` from your project root. It still leaves *Podfile*, *Podfile.lock*, and *.xcworkspace/*.
206,579
Bits Back coding is a scheme to transmit an observation $x$. You can read about it [here](http://www.cs.toronto.edu/~fritz/absps/freybitsback.pdf)[1]. To my understanding, it works like this: 1. The encoder samples a message $z$ from a distribution $Q(z|x)$ that it computed. 2. The encoder sends $z$ to decoder, using a code based on $P(z)$, known to both. 3. The decoder recovers $z$ and computes $P(x|z)$. 4. The encoder sends $x$ to the decoder using a code based on $P(x|z)$. 5. The decoder recovers $x$. In reality, the messages in steps 2 and 4 can be combined. Naively, the cost of this protocol would be the expected number of bits in these messages. However, the trick is that once the decoder recovered $x$, it can compute $Q(z|x)$ using the same algorithm the encoder used, and then recover all the auxiliary bits it had to use internally in order to sample $z$ from $Q$. The expected number of these bits is then subtracted from the total cost. Those are "the bits you get back". What I don't understand is what is the decoder going to do with these bits? How does knowing these bits reduces the overall transmission cost? Yes, the decoder is now aware of some bits that the encoder withdrew from a random-stream of bits, but how is this knowledge going to help in compressing the next observations? [1]: [Frey and Hinton. Efficient Stochastic Source Coding and an Application to a Bayesian Network Source Model](http://www.cs.toronto.edu/~fritz/absps/freybitsback.pdf)
2015/05/14
[ "https://mathoverflow.net/questions/206579", "https://mathoverflow.net", "https://mathoverflow.net/users/2873/" ]
I was wondering the same! But this is the answer I came up with (although I am not entirely sure if this reasoning is correct). Since after the decoding process the decoder knows the distribution $Q(z|x)$ AND $P(x)$, he could then come up with an encoding that follows the distribution $P(z)/Q(z|x)$ and thus, represents each sample value $z$ with $-log\_2(P(z)/Q(z|x))$ bits. Apparently, this representation of the sample values (and thus, of the model) would lead to maximal compression of the data values if the approximate variational posterior equals the actual posterior, thus $Q(z|x) = P(z|x)$.
I think that the key to understand bits-back coding is that sampling from the distribution $Q(z|x)$ is equal to decoding some "random bits" with $Q(z|x)$. And these random bits are the things that receiver can get automatically after receiving $z$ and $x$. Considering a sequential image transmission scenario, if we use the encoding results of previous image as the random seed for current image to sample from the $Q(z|x)$ in the sender part, these bits can then be subtracted from the total cost. By the way, if the "random bits" used for sampling is not truly random there will be negative effects on your bits-back coding scheme.
35,048,571
Hey all I am trying to get the previous button so that I can change its text to something else once someone selects a value from a select box. ``` <div class="input-group"> <div class="input-group-btn search-panel"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span id="search_concept">Type</span> <span class="caret"></span> </button> <ul class="dropdown-menu" id="dd1" role="menu"> <li><a href="#" data-info="blah1">For Sale</a></li> <li><a href="#" data-info="blah1">Wanted</a></li> </ul> </div> <div class="input-group-btn search-panel"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span id="search_concept">Location</span> <span class="caret"></span> </button> <ul class="dropdown-menu" id="dd2" role="menu"> <li><a href="#" data-info="somewhere">Somewhere</a></li> <li><a href="#" data-info="elsewhere">Elsewhere</a></li> </ul> </div> <input type="text" class="form-control" name="x" placeholder="Search term..."> </div> $('.search-panel #dd1, .search-panel #dd2').find('a').click(function(e) { e.preventDefault(); var param = $(this).data("info"); $(this).prev().find('#search_concept').text($(this).text()); }); ``` So the click event starts from **THIS** which is the **a href="#" data-info="blah1">[value here]< /a>** tag. So I am trying to go back to the **< button>** tag so that I can change the text **Type** to whatever was selected. I've tried: ``` $(this).prev().find('#search_concept').text($(this).text()); and $(this).prev().prev().find('#search_concept').text($(this).text()); and $(this).prev().prev().children().find('#search_concept').text($(this).text()); and $(this).prev().children().find('#search_concept').text($(this).text()); ``` And I can't seem to find it.... **fixed** ``` $('.search-panel #dd1, .search-panel #dd2').find('a').click(function(e) { e.preventDefault(); var param = $(this).data("info"); $(this).parents('.search-panel').find('button').html($(this).text() + ' <span class="caret"></span>'); }); ```
2016/01/27
[ "https://Stackoverflow.com/questions/35048571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277480/" ]
After installing the latest preview release, v0.6.5.0 as of writing this, I ran into the same issue. It appears that Xamarin Android Player is expecting VirtualBox to be registered with the `%PATH%` environment variable, but it doesn't happen during the install process by default. In this case, you just add `C:\Program Files\Oracle\VirtualBox` to PATH and you should be able to restart the Android Player just fine to begin downloading emulator images. Here is a command-line approach to append this location to the existing PATH variable. ``` setx PATH "%PATH%;C:\Program Files\Oracle\VirtualBox" ``` You can also do the same edit through the Environment Variables screen found under the System Properties screen.
Just run as admin (Right hand click)
308,895
I'm trying to plot the Wien and Rayleigh-Jeans laws in a graph of `$I \times \nu$`. ``` Wien Law: \[ I=\frac{2h\nu^3}{c^2}e^{-\textstyle\frac{h\nu}{kT}}\] Rayleigh-Jeans Law: \[I=\frac{2k\nu^2T}{c^2}\] ``` But PGFPlot always crashes because the constants (in SI units) are way too small! Whats the best way to do this? Thanks! Edit: My actual code with just Wien's Law is: ``` \begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = $\nu$, ylabel = {$I(\nu,T)$ em $T=8.10^{-3}K$}, ] \addplot [ domain=0:10, samples=100, color=red, ] {(1.48*10^(-50))*(x^3)*exp((-6*10^(-9))x)}; \addlegendentry{Lei de Wien} \end{axis} \end{tikzpicture} ``` I don't know what the best domain is.
2016/05/10
[ "https://tex.stackexchange.com/questions/308895", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/102658/" ]
``` \documentclass{article} \newcounter{emphlevel} \renewcommand\emph[1]{\stepcounter{emphlevel}% \ifnum\value{emphlevel}=1`#1'\else \ifnum\value{emphlevel}=2\textsc{#1}\else \ifnum\value{emphlevel}=3\textit{#1}\else \fi\fi\fi\addtocounter{emphlevel}{-1}% } \begin{document} \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}. \end{document} ``` [![enter image description here](https://i.stack.imgur.com/it5wB.jpg)](https://i.stack.imgur.com/it5wB.jpg) The above ORIGINAL answer truncates levels beyond the third. This below variation repeats the cycles repeatedly through the specified emphases. ``` \documentclass{article} \newcounter{emphlevel} \renewcommand\emph[1]{\stepcounter{emphlevel}% \ifnum\value{emphlevel}=1\textup{`#1'}\else \ifnum\value{emphlevel}=2\textsc{#1}\else \ifnum\value{emphlevel}=3\textit{#1}\else \addtocounter{emphlevel}{-4}\emph{#1}\addtocounter{emphlevel}{4}% \fi\fi\fi\addtocounter{emphlevel}{-1}% } \begin{document} \emph{Single quotes within \emph{Small Caps within \emph{more italics within \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}} and} so on}. \emph{Aa \emph{Bb \emph{Cc \emph{Dd \emph{Ee \emph{Ff \emph{Gg}}}}}}} \end{document} ``` [![enter image description here](https://i.stack.imgur.com/yl5Ai.jpg)](https://i.stack.imgur.com/yl5Ai.jpg)
I decided to use another command name, but the nesting can be controlled with a counter and `\ifcase...\fi` conditional. The 4th level will provide an usual `\@ctrerr`, but this could be shifted to basically any level. ``` \documentclass{article} \newcounter{smartlevel} \makeatletter \newcommand{\smartcmd}[1]{% \stepcounter{smartlevel}% \ifcase\c@smartlevel \or'#1'\addtocounter{smartlevel}{-1}% \or\textsc{#1}\addtocounter{smartlevel}{-1}% \or\textit{#1}\addtocounter{smartlevel}{-1}% \else \@ctrerr% Too deeply nested \fi } \makeatother \begin{document} \smartcmd{First \smartcmd{Foo \smartcmd{inner} \smartcmd{inner again}}} \smartcmd{First \smartcmd{Foo} \smartcmd{Foo level \smartcmd{inner again}}} \end{document} ``` [![enter image description here](https://i.stack.imgur.com/U1kAh.png)](https://i.stack.imgur.com/U1kAh.png)
308,895
I'm trying to plot the Wien and Rayleigh-Jeans laws in a graph of `$I \times \nu$`. ``` Wien Law: \[ I=\frac{2h\nu^3}{c^2}e^{-\textstyle\frac{h\nu}{kT}}\] Rayleigh-Jeans Law: \[I=\frac{2k\nu^2T}{c^2}\] ``` But PGFPlot always crashes because the constants (in SI units) are way too small! Whats the best way to do this? Thanks! Edit: My actual code with just Wien's Law is: ``` \begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = $\nu$, ylabel = {$I(\nu,T)$ em $T=8.10^{-3}K$}, ] \addplot [ domain=0:10, samples=100, color=red, ] {(1.48*10^(-50))*(x^3)*exp((-6*10^(-9))x)}; \addlegendentry{Lei de Wien} \end{axis} \end{tikzpicture} ``` I don't know what the best domain is.
2016/05/10
[ "https://tex.stackexchange.com/questions/308895", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/102658/" ]
``` \documentclass{article} \newcounter{emphlevel} \renewcommand\emph[1]{\stepcounter{emphlevel}% \ifnum\value{emphlevel}=1`#1'\else \ifnum\value{emphlevel}=2\textsc{#1}\else \ifnum\value{emphlevel}=3\textit{#1}\else \fi\fi\fi\addtocounter{emphlevel}{-1}% } \begin{document} \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}. \end{document} ``` [![enter image description here](https://i.stack.imgur.com/it5wB.jpg)](https://i.stack.imgur.com/it5wB.jpg) The above ORIGINAL answer truncates levels beyond the third. This below variation repeats the cycles repeatedly through the specified emphases. ``` \documentclass{article} \newcounter{emphlevel} \renewcommand\emph[1]{\stepcounter{emphlevel}% \ifnum\value{emphlevel}=1\textup{`#1'}\else \ifnum\value{emphlevel}=2\textsc{#1}\else \ifnum\value{emphlevel}=3\textit{#1}\else \addtocounter{emphlevel}{-4}\emph{#1}\addtocounter{emphlevel}{4}% \fi\fi\fi\addtocounter{emphlevel}{-1}% } \begin{document} \emph{Single quotes within \emph{Small Caps within \emph{more italics within \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}} and} so on}. \emph{Aa \emph{Bb \emph{Cc \emph{Dd \emph{Ee \emph{Ff \emph{Gg}}}}}}} \end{document} ``` [![enter image description here](https://i.stack.imgur.com/yl5Ai.jpg)](https://i.stack.imgur.com/yl5Ai.jpg)
A simple application of grouping: ``` \documentclass{article} \newcount\emphlevel \DeclareRobustCommand{\emph}[1]{% \begingroup \normalfont \advance\emphlevel by 1 \ifcase\emphlevel \or `\aftergroup'\normalfont \or \normalfont\expandafter\textsc \or \normalfont\expandafter\textit \else \normalfont!!!!\expandafter\textbf \fi {#1}% \endgroup } \begin{document} Normal text. \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}. Again normal text. \emph{Single quotes within \emph{Small Caps within \emph{more italics}}}. \end{document} ``` [![enter image description here](https://i.stack.imgur.com/ezhX2.png)](https://i.stack.imgur.com/ezhX2.png)
308,895
I'm trying to plot the Wien and Rayleigh-Jeans laws in a graph of `$I \times \nu$`. ``` Wien Law: \[ I=\frac{2h\nu^3}{c^2}e^{-\textstyle\frac{h\nu}{kT}}\] Rayleigh-Jeans Law: \[I=\frac{2k\nu^2T}{c^2}\] ``` But PGFPlot always crashes because the constants (in SI units) are way too small! Whats the best way to do this? Thanks! Edit: My actual code with just Wien's Law is: ``` \begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = $\nu$, ylabel = {$I(\nu,T)$ em $T=8.10^{-3}K$}, ] \addplot [ domain=0:10, samples=100, color=red, ] {(1.48*10^(-50))*(x^3)*exp((-6*10^(-9))x)}; \addlegendentry{Lei de Wien} \end{axis} \end{tikzpicture} ``` I don't know what the best domain is.
2016/05/10
[ "https://tex.stackexchange.com/questions/308895", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/102658/" ]
A simple application of grouping: ``` \documentclass{article} \newcount\emphlevel \DeclareRobustCommand{\emph}[1]{% \begingroup \normalfont \advance\emphlevel by 1 \ifcase\emphlevel \or `\aftergroup'\normalfont \or \normalfont\expandafter\textsc \or \normalfont\expandafter\textit \else \normalfont!!!!\expandafter\textbf \fi {#1}% \endgroup } \begin{document} Normal text. \emph{Single quotes within \emph{Small Caps within \emph{more italics} and} so on}. Again normal text. \emph{Single quotes within \emph{Small Caps within \emph{more italics}}}. \end{document} ``` [![enter image description here](https://i.stack.imgur.com/ezhX2.png)](https://i.stack.imgur.com/ezhX2.png)
I decided to use another command name, but the nesting can be controlled with a counter and `\ifcase...\fi` conditional. The 4th level will provide an usual `\@ctrerr`, but this could be shifted to basically any level. ``` \documentclass{article} \newcounter{smartlevel} \makeatletter \newcommand{\smartcmd}[1]{% \stepcounter{smartlevel}% \ifcase\c@smartlevel \or'#1'\addtocounter{smartlevel}{-1}% \or\textsc{#1}\addtocounter{smartlevel}{-1}% \or\textit{#1}\addtocounter{smartlevel}{-1}% \else \@ctrerr% Too deeply nested \fi } \makeatother \begin{document} \smartcmd{First \smartcmd{Foo \smartcmd{inner} \smartcmd{inner again}}} \smartcmd{First \smartcmd{Foo} \smartcmd{Foo level \smartcmd{inner again}}} \end{document} ``` [![enter image description here](https://i.stack.imgur.com/U1kAh.png)](https://i.stack.imgur.com/U1kAh.png)
55,135,777
Can anybody help in knowing whether IFC entity type names are case sensitive or case insensitive. For example: Can we replace `IFCPERSON` with `IfcPerson` (camel case) or `ifcperson` (small) in an \*.ifc file?
2019/03/13
[ "https://Stackoverflow.com/questions/55135777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11195292/" ]
How about applying the following convention in every single context: Simply assume that they are case sensitive and work accordingly. If you always do that, you will never have a problem. If you see different casing examples, and all of them work, you can assume it is not case sensitive. Otherwise, you will always be on the safe side if you simply follow the case conventions that you see and are proven. Furthermore, you should always implement unit tests for every piece of functionality. If you have questions about case sensitivity, implement unit tests to prove your assumptions right.
You might want to take a look at [an online version of ISO10303-p21](http://www.steptools.com/stds/step/IS_final_p21e3.html) which defines the STEP data format (file format of .ifc files). Chapter 5.4 defines the format of tokens, to which entity names belong, to only contain uppercase letters and digits. So basically they are case sensitive, meaning they may only contain uppercase letters.
55,135,777
Can anybody help in knowing whether IFC entity type names are case sensitive or case insensitive. For example: Can we replace `IFCPERSON` with `IfcPerson` (camel case) or `ifcperson` (small) in an \*.ifc file?
2019/03/13
[ "https://Stackoverflow.com/questions/55135777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11195292/" ]
How about applying the following convention in every single context: Simply assume that they are case sensitive and work accordingly. If you always do that, you will never have a problem. If you see different casing examples, and all of them work, you can assume it is not case sensitive. Otherwise, you will always be on the safe side if you simply follow the case conventions that you see and are proven. Furthermore, you should always implement unit tests for every piece of functionality. If you have questions about case sensitivity, implement unit tests to prove your assumptions right.
Let's look at how cases are defined in the standards for EXPRESS (used to specify the schema) and for STEP physical files (used for the actual \*.ifc files). ### Entity type names in the schema definition According to [ISO10303-11](https://www.iso.org/standard/38047.html), in EXPRESS, entity names are case-insensitive. The grammar only mentions lower-case letters for entity identifiers (section 7.4 Identifiers and 7.1.2 Letters), reserving upper case for *EXPRESS* reserved words such as `ENTITY`. ``` entity_head = ENTITY entity_id subsuper ";" . entity_id = simple_id . simple_id = letter { letter | digit | '_' } letter = 'a' | 'b' | 'c' | ... | 'x' | 'y' | 'z' ``` So a schema can not define two different entity types that differ only by their case. In addition, the standard explicitly states case insensitivity: > > *EXPRESS* uses the upper and lower case letters of the English alphabet [..] The case of letters is significant only within explicit string literals. > NOTE - *EXPRESS* may be written using upper, lower, or mixed case letters [..]. > > > Thus, the camel case you see in IFC-EXPRESS definitions (e.g. for [IFC4](http://www.buildingsmart-tech.org/ifc/IFC4/Add2TC1/IFC4.exp)) and in the corresponding BuildingSMART [documentation](http://www.buildingsmart-tech.org/ifc/IFC4/Add2TC1/html/link/alphabeticalorder-entities.htm) is not significant and just chosen for the sake of readability. ### Entity type names in the instance encoding When it comes to the STEP physical file encoding ([ISO10303-21](https://www.iso.org/standard/63141.html)) and your actual instance files, the grammar mentions only upper case characters for entity types: ``` SIMPLE_ENTITY_INSTANCE = ENTITY_INSTANCE_NAME "=" SIMPLE_RECORD ";" . SIMPLE_RECORD = KEYWORD "(" [ PARAMETER_LIST ] ")" . KEYWORD = USER_DEFINED_KEYWORD | STANDARD_KEYWORD . STANDARD_KEYWORD = UPPER { UPPER | DIGIT } . UPPER = "A" | "B" | "C" | .. | "X" | "Y" | "Z" | "_" . ``` ISO10303-21 specifies further how to map the schema definition to the actual IFC file (section 12.2.). With regard to the encoding of entity type names it states that STEP files should only use upper case characters. > > [..] In either case, any small letters shall be converted to their > corresponding capital letters, i.e., the encoding shall not contain > any small letters. > > > This also ensures case insensitivity, but in a different way than in EXPRESS. ### Case sensitivity in STEP parsers Coming back to the original question, whether `IFCPERSON` can be replaced with `IfcPerson`. If you where to write the standard, you could use any case you like, since entity type names are case insensitive. ``` ENTITY IfcPerson; ``` If you are writing an IFC-STEP file, a strict interpretation of the standard would require to write entity type names in upper case. ``` #1 = IFCPERSON('ID', 'Last', 'First', $, $, $, $, $)); ``` In practice, parsers have to rely on the case-insensitivity of the schema anyway. Thus, they will perform case-insensitive comparison to the schema-defined entity type names. Most likely they will accept mixed- or lower-case entity type names in the \*.ifc file. But a parser could also reject an IFC file with mixed-case entity type names as not standard-conforming or just ignore the entities which are not all-capital. Imagine an implementation that just converts the schema definitions to upper-case and then does a case-sensitive lookup for the entity instance types. This would be perfectly in accordance with the standard.
41,535,837
I want to build a website that allows the user to convert `Hz` to `bpm` (note however that my question concerns all sort of unit conversion). I am using PHP and am hosting my website on Apache. So, I was wondering if it was possible to "bind" an input field to an HTML element, like we do in WPF developement where you can bind an input area to a WPF element, and apply some sort of data conversion so if the user types `12 bpm`, the bound element will automaticly and immediately display `0.2 Hz`. If the user then adds a "0" so `120 bpm` will be automaticly and immediately converted to `2 Hz`. The effect I am trying to describe can also be noted on this very forum : as I type my question, I can see a "real-time" final version of my text. How is this achieved? Is there any way to do it with PHP? I know of AJAX but I would really prefer to avoid using Javascript to hold my math functions. Correct me if I am wrong but I think this could be accomplished with Node.js? Should I consider migrating to Node?
2017/01/08
[ "https://Stackoverflow.com/questions/41535837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6622623/" ]
With just the DOM and JavaScript, you can use the [`input` event](https://developer.mozilla.org/en-US/docs/Web/Events/input) on a text field to receive an immediate callback when its value changes as the result of user action: ``` document.querySelector("selector-for-the-field").addEventListener("input", function() { // Code here to do and display conversion }, false); ``` Example (centigrade/Celsuis to Fahrenheit): ```js var f = document.getElementById("f"); document.querySelector("#c").addEventListener("input", function() { var value = +this.value; if (!isNaN(value)) { value = (value * 9) / 5 + 32; f.innerHTML = value; } }, false); ``` ```html <div> <label> Enter centigrade: <input type="text" id="c"> </label> </div> <div> Fahrenheit: <span id="f"></span> </div> ``` Stepping back, yes, there are dozens of libraries and frameworks that provide MVC/MVVM/MVM/whatever-the-acronym-is-this-week in the browser. A short list of current popular ones: React, Angular, Vue, Knockout, ... Note that these are not magic, they're just code written in JavaScript (or something like TypeScript or Dart or CoffeeScript that compiles to JavaScript) that use the DOM the covers.
I will give you an example of real-time "inches to cm" conversion. Note for this example to work, you will need to include jQuery. HTML: ``` <div> <label>Inches</label> <input type="text" id="user_input" /> </div> <div> <label>Centimeters</label> <input type="text" id="result" readonly /> </div> ``` JAVASCRIPT: ``` $(document).ready(function(){ $('#user_input').on('propertychange input keyup', function(){ var thisVal = $(this).val(); $('#result').val(thisVal * 2.54); }); }); ``` Fiddle: <https://jsfiddle.net/captain_theo/t10z01cm/> You can expand that for any type of conversion. Check my updated fiddle that includes Hz to bpm also: <https://jsfiddle.net/captain_theo/t10z01cm/1/> Cheers, Theo
45,933,651
I have a column named ***weight*** in my table **accounts**. i need to fetch the values from this column like, when the user clicks weight from 40 - 100, It need to display all the persons with weight in between 40 and 100. This is my html code, ``` <div class="float-right span35"> <form class="list-wrapper search-form" method="get" action="{{CONFIG_SITE_URL}}/index.php"> <div class="list-header"> Talent Search </div> <h4 style="margin-left: 10px; color: gray;">Weight</h4> <fieldset id="weight"> <input type="checkbox" name="weight" value="1" {{WEIGHT_1}}/>Below 40<br> <input type="checkbox" name="weight" value="2" {{WEIGHT_2}}/>40-70<br> <input type="checkbox" name="weight" value="3" {{WEIGHT_3}}/>70-100<br> <input type="checkbox" name="weight" value="4" {{WEIGHT_4}}/>Above 100<br> </fieldset> <br/> <input style="margin-left: 10px" type="submit" name="submit" value="search"/><br><br> <input type="hidden" name="tab1" value="search"> </form> </div> ``` This is my php code, ``` if(isset($_GET['submit'])){ $weight = ($_GET['weight'])? $escapeObj->stringEscape($_GET['weight']): NULL; $sql = "SELECT id FROM `".DB_ACCOUNTS."` WHERE `id` IS NOT NULL "; if(is_numeric($weight) && $weight != NULL){ $sql .= "AND `weight` IN (".$weight.")"; $is_weight = true; } $sql .= " ORDER BY `id` ASC"; } if($is_weight){ $themeData['weight_'.$weight] = 'checked'; } $query = $conn->query($sql); if($query->num_rows > 0){ while($fetch = $query->fetch_array(MYSQLI_ASSOC)){ $get[] = $fetch['id']; } $i = 0; $listResults = ''; $themeData['page_title'] = "Advanced Search - ".$lang['search_result_header_label']; foreach($get as $row){ $timelineObj = new \SocialKit\User(); $timelineObj->setId($row); $timeline = $timelineObj->getRows(); $themeData['list_search_id'] = $timeline['id']; $themeData['list_search_url'] = $timeline['url']; $themeData['list_search_username'] = $timeline['username']; $themeData['list_search_name'] = $timeline['name']; $themeData['list_search_thumbnail_url'] = $timeline['thumbnail_url']; $themeData['list_search_button'] = $timelineObj->getFollowButton(); $listResults .= \SocialKit\UI::view('search/list-each'); $i++; } $themeData['list_search_results'] = $listResults; } } ``` This code is almost working for an single weight from table. But I need to create a range in between the checkbox values as i mentioned in the code. Do i need to update the code.
2017/08/29
[ "https://Stackoverflow.com/questions/45933651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7057771/" ]
Simpliest way: administrator credentials should be predefined via some config file on server side. As additional protection you may force user to change password on first log in. Another way: a lot of CMS provides a full access + installation steps to first loggined user.
Use QSslSocket to get a secured communication layer (<http://doc.qt.io/qt-5/qsslsocket.html>), since you will exchange passwords on top of this administration link. There is an example here of the client part of the code, with Qt5: <http://doc.qt.io/qt-5/qtnetwork-securesocketclient-example.html> On the server side, accept the socket on a predefined unused port, dedicated to your service. Now, you can simply decide of a login with a random secret password, that will correspond to the administrator account, and create a program to send this password on top of a secured channel based on QSslSocket. You server has to check the password before accepting remote management. So, as you can see, the administrator must be created prior to using the service. You can use a private mail exchange, based on some cryptographic means (OpenPGP, S/MIME, etc.), to supply the administrator with its password.
81,961
I'm trying to attach programmatically an Image with caption to my node. I'm using [image\_field\_caption](https://drupal.org/project/image_field_caption) module. ``` $node = node_load($nid); $path = "images/gallery_articolo/".$value['foto']; $filetitle = $value['desc']; $filename = $value['foto']; $file_temp = file_get_contents($path); $file_temp = file_save_data($file_temp, 'public://' . $filename, FILE_EXISTS_RENAME); $node->field_steps['und'][($value['order'] - 1)] = array( 'image_field_caption' => array( 'value' => $value['desc'], 'format' => 'full_html'), 'fid' => $file_temp->fid, 'filename' => $file_temp->filename, 'filemime' => $file_temp->filemime, 'uid' => 1, 'uri' => $file_temp->uri, 'status' => 1 ); node_save($node); ``` I followed the stucture seen in devel, but I have a lot of issues.. This is the recent log entry: ``` PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'caption' cannot be null: INSERT INTO {field_image_field_caption_revision} (field_name, entity_type, entity_id, revision_id, bundle, delta, language, caption, caption_format) VALUES ( :db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8), (:db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17); Array ( [:db_insert_placeholder_0] => field_steps [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => 455 [:db_insert_placeholder_3] => 863 [:db_insert_placeholder_4] => article [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => und [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => field_steps [:db_insert_placeholder_10] => node [:db_insert_placeholder_11] => 455 [:db_insert_placeholder_12] => 863 [:db_insert_placeholder_13] => article [:db_insert_placeholder_14] => 2 [:db_insert_placeholder_15] => und [:db_insert_placeholder_16] => Wild Roses: fiori che sembrano appena sbocciati, che sottolineano ancora una volta la sua grande cifra stilistica, composizioni perfette per ogni dolce e speciale occasione. [:db_insert_placeholder_17] => full_html ) in image_field_caption_field_attach_update() (line 234 of /sites/all/modules/image_field_caption/image_field_caption.module). ``` But, as you can see, the :db\_insert\_placeholder\_16 is valorized. Can someone locate where the error is? I can't find it.. Thank you ^^
2013/08/08
[ "https://drupal.stackexchange.com/questions/81961", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/6984/" ]
in the log entry it shows that `[:db_insert_placeholder_7]` and `[:db_insert_placeholder_8]` elements of the Array were empty - that might be the reason why **Insert** statement failed for the `caption` field: ``` Array ( [:db_insert_placeholder_0] => field_steps [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => 455 [:db_insert_placeholder_3] => 863 [:db_insert_placeholder_4] => article [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => und [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => field_steps [:db_insert_placeholder_10] => node [:db_insert_placeholder_11] => 455 [:db_insert_placeholder_12] => 863 [:db_insert_placeholder_13] => article [:db_insert_placeholder_14] => 2 [:db_insert_placeholder_15] => und [:db_insert_placeholder_16] => Wild Roses: fiori che sembrano appena sbocciati, che sottolineano ancora una volta la sua grande cifra stilistica, composizioni perfette per ogni dolce e speciale occasione. [:db_insert_placeholder_17] => full_html ) in image_field_caption_field_attach_update() (line 234 of /sites/all/modules/image_field_caption/image_field_caption.module). ``` also, [:db\_insert\_placeholder\_16] - contains a string with 173 characters - is the `caption` field big enough? hope this helps
In Drupal 7, you can use **[system\_retrieve\_file](https://api.drupal.org/api/drupal/modules!system!system.module/function/system_retrieve_file/7)** > > **system\_retrieve\_file** - It will download a file from a remote source, > copy it from temp to a specified destination and optionally save it to > the file\_managed table if you want it to be managed. > > > ``` $node_info = node_load($nid);//load created node if(empty($node_info->field_image)){//assign only if the image field is empty $field_language = field_language('node', $node_info, 'field_image');//get image field language $url = 'https://ssl.gstatic.com/gb/images/k1_a31af7ac.png';//image URL to save. If image already saved in the drupal system then get the file ID(fid) //I have used picture folder to store images using image field settings $file_info = system_retrieve_file($url, 'public://pictures/', TRUE);//storing image inside picture folder if($file_info->fid){//if fid exist then image is saved from URL. $node_info->field_image[$field_language]['0']['fid'] = $file_info->fid;//assign fid $node_info->field_image[$field_language]['0']['image_field_caption']['value'] = 'test caption';//assign caption $node_info->field_image[$field_language]['0']['image_field_caption']['format'] = 'full_html';//assign format } node_save($node_info);//update node } ``` Note: * Change your image field name. * If the image is already stored in the drupal system then get the file ID(fid) and assign it to the image field directly.
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
Maybe this will help a little (adapting documentation exaple for `Slider2D`): ``` DynamicModule[{p = {2 π, 0}}, Row @ {Slider2D[Dynamic[p], {{2 Pi, 0}, {0, Pi}}], Plot3D[Exp[-(x^2 + y^2)], {x, -3, 3}, {y, -3, 3}, ImageSize -> {700, 700}, PlotRange -> All, ViewAngle -> .0015, ViewPoint -> Dynamic[1200 {Cos[p[[1]]] Sin[p[[2]]], Sin[p[[1]]] Sin[p[[2]]], Cos[p[[2]]]} ] ] }] ``` ![enter image description here](https://i.stack.imgur.com/SQqfg.png) Notice that for parallel projection (like here) box edges **do not seem to be parallel but they are** and for default *Mathematica* display they **are not but they look parallel**
Combining some of the ideas here and elsewhere, this appears to produce a parallel projection: ``` tr = TransformationMatrix[ RescalingTransform[{{-2, 2}, {-2, 2}, {-3/2, 5/2}}]]; p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}}; DynamicModule[{vm = {tr, p}, vp = {0, 0, 100}}, tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}, ViewMatrix -> Dynamic[vm], ViewPoint -> Dynamic[vp]], {aa, xnn}, {bb, ynn}, {cc, znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black]] ``` which you can test by looking at the columns of spheres end on - there's hardly any perspective at all: ![a load of balls](https://i.stack.imgur.com/9i5eV.png)
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
Maybe this will help a little (adapting documentation exaple for `Slider2D`): ``` DynamicModule[{p = {2 π, 0}}, Row @ {Slider2D[Dynamic[p], {{2 Pi, 0}, {0, Pi}}], Plot3D[Exp[-(x^2 + y^2)], {x, -3, 3}, {y, -3, 3}, ImageSize -> {700, 700}, PlotRange -> All, ViewAngle -> .0015, ViewPoint -> Dynamic[1200 {Cos[p[[1]]] Sin[p[[2]]], Sin[p[[1]]] Sin[p[[2]]], Cos[p[[2]]]} ] ] }] ``` ![enter image description here](https://i.stack.imgur.com/SQqfg.png) Notice that for parallel projection (like here) box edges **do not seem to be parallel but they are** and for default *Mathematica* display they **are not but they look parallel**
I think the only way to do this is by dynamically reseting the [`ViewMatrix`](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html) to be an [orthographic projection](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html#464375084). It was beyond my ability, patience, or inclination to figure how to decompose the `ViewMatrix` that is created when the graphic is moved into the components `ViewPoint`, `ViewVertical`, etc. It seemed to me that the front end usually make a discontinuous jump from the view point in the orthographic projection to the initial view point in rotated graphic. Discouraged by this apparent behavior, I opted for a hybrid solution. I used an ordinary `Graphics3D` with `Dynamic` view properties and used `Inset` to insert the graphics `tom2` into it. The view properties of the outer `Graphics3D` are used to compute a corresponding orthographic projection `ViewMatrix` to be used to display the graphics `tom2`. So the mouse rotates the outer graphics and the code rotates the inset `tom2` in the same way. The only difference is that `tom2` is projected orthographically instead of perspectively. To do this, I used and adapted code from [Heike](https://mathematica.stackexchange.com/users/46) in [this answer](https://mathematica.stackexchange.com/questions/3528/extract-values-for-viewmatrix-from-a-graphics3d/5764#5764) and [Alexey Popkov](https://mathematica.stackexchange.com/users/280) in [this answer](https://mathematica.stackexchange.com/questions/18034/how-to-get-the-real-plotrange-of-graphics-with-geometrictransformations-in-it/18040#18040). I needed Alexey Popkov's `completePlotRange` because `AbsoluteOptions` would not return the actual plot range. ``` (* Heike *) theta[v1_] := ArcTan[v1[[3]], Norm[v1[[;; 2]]]]; phi[v1_] := If[Norm[v1[[;; 2]]] > .0001, ArcTan[v1[[1]], v1[[2]]], 0]; alpha[vert_, v1_] := ArcTan[{-Sin[phi[v1]], Cos[phi[v1]], 0}.vert, Cross[v1/Norm[v1], {-Sin[phi[v1]], Cos[phi[v1]], 0}].vert]; tt[v1_, vert_, center_, r_, scale_] := TransformationMatrix[ RotationTransform[-alpha[vert/scale, v1], {0, 0, 1}] . RotationTransform[-theta[v1], {0, 1, 0}] . RotationTransform[-phi[v1], {0, 0, 1}] . ScalingTransform[r {1, 1, 1}] . TranslationTransform[-center]]; (* orthographic projection *) pp = N@{{1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, -1, 0}, {0, 0, 0, 2}}; (* Alexey Popkov *) completePlotRange[plot : (_Graphics | _Graphics3D)] := Quiet@Last@ Last@Reap[ Rasterize[ Show[plot, Axes -> True, Ticks -> (Sow[{##}] &), DisplayFunction -> Identity], ImageResolution -> 1]] (* OP *) a0 = 1; ceng = 1; znn = 3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; (* updated - switched Graphics3D and Table, adjusted options *) tom2 = Graphics3D[ Table[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[N@sinpq2[[cc, bb, aa]], rr]}, {aa, xnn}, {bb, ynn}, {cc, znn}], Axes -> False, BoxStyle -> Directive[Orange, Opacity[1]], BoxRatios -> Automatic, Background -> Black]; (* adapted from Heike *) bb = completePlotRange@tom2; scale = 1/Abs[#1 - #2] & @@@ bb; center = Mean /@ bb; vv = {Flatten[Differences /@ bb] + center, center}; v1 = (vv[[1]] - center); vert = {0, 0, 1} - {0, 0, 1}.v1 v1; viewAngle = 2 ArcCot[2.]; (* final graphic *) Graphics3D[{}, Epilog -> Inset[ Show[tom2, ViewMatrix -> Dynamic@{tt[v1, vert, center, Cot[viewAngle/2]/Norm[v1], scale], pp}, PlotRange -> bb], Center, Center, 1], ViewAngle -> Dynamic[viewAngle], ViewVector -> Dynamic[vv, (vv = #; center = vv[[2]]; v1 = vv[[1]] - center) &], ViewVertical -> Dynamic[vert], SphericalRegion -> True, PlotRange -> bb, Boxed -> False] ``` Output after manual rotation: ![](https://i.stack.imgur.com/7uzil.png) ![](https://i.stack.imgur.com/DcEwn.gif)
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
Maybe this will help a little (adapting documentation exaple for `Slider2D`): ``` DynamicModule[{p = {2 π, 0}}, Row @ {Slider2D[Dynamic[p], {{2 Pi, 0}, {0, Pi}}], Plot3D[Exp[-(x^2 + y^2)], {x, -3, 3}, {y, -3, 3}, ImageSize -> {700, 700}, PlotRange -> All, ViewAngle -> .0015, ViewPoint -> Dynamic[1200 {Cos[p[[1]]] Sin[p[[2]]], Sin[p[[1]]] Sin[p[[2]]], Cos[p[[2]]]} ] ] }] ``` ![enter image description here](https://i.stack.imgur.com/SQqfg.png) Notice that for parallel projection (like here) box edges **do not seem to be parallel but they are** and for default *Mathematica* display they **are not but they look parallel**
I just found the simplest solution. Don't set `ViewPoint` to infinity!!! Just set it any number large enough, the effect will equivalent to setting to infinity. Try for example the following ``` ListPointPlot3D[Tuples[Range[10], 3], BoxRatios -> Automatic, ViewPoint -> {0, 0, 1000}] ``` for your example just change `ViewPoint -> {0, 0, ∞}` to `ViewPoint -> {0, 0, 1000}` or any number large than 1000 as you wish. You'll be amazed at how simple it is to get rid of perspective. Rotate freely! : )
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
Maybe this will help a little (adapting documentation exaple for `Slider2D`): ``` DynamicModule[{p = {2 π, 0}}, Row @ {Slider2D[Dynamic[p], {{2 Pi, 0}, {0, Pi}}], Plot3D[Exp[-(x^2 + y^2)], {x, -3, 3}, {y, -3, 3}, ImageSize -> {700, 700}, PlotRange -> All, ViewAngle -> .0015, ViewPoint -> Dynamic[1200 {Cos[p[[1]]] Sin[p[[2]]], Sin[p[[1]]] Sin[p[[2]]], Cos[p[[2]]]} ] ] }] ``` ![enter image description here](https://i.stack.imgur.com/SQqfg.png) Notice that for parallel projection (like here) box edges **do not seem to be parallel but they are** and for default *Mathematica* display they **are not but they look parallel**
Mathematica Version 11.2 affords the new option : `ViewProjection-> "Orthographic"`. It seems to do the job, but I can't test the interacitvity because I have only access to Mathematica 11.2 in the cloud (in the "Wolfram Development Platform"). So instead of interacting, I have set `ViewPoint -> {0, 0, 3}` in your example. Here are the results : ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[\[Theta]_] := RotationTransform[\[Theta], {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}] Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}, ViewProjection-> "Orthographic" (* <--- Here is the modification *) ] ``` [![enter image description here](https://i.stack.imgur.com/nRXEh.png)](https://i.stack.imgur.com/nRXEh.png) It seems to work fine.
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
I think the only way to do this is by dynamically reseting the [`ViewMatrix`](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html) to be an [orthographic projection](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html#464375084). It was beyond my ability, patience, or inclination to figure how to decompose the `ViewMatrix` that is created when the graphic is moved into the components `ViewPoint`, `ViewVertical`, etc. It seemed to me that the front end usually make a discontinuous jump from the view point in the orthographic projection to the initial view point in rotated graphic. Discouraged by this apparent behavior, I opted for a hybrid solution. I used an ordinary `Graphics3D` with `Dynamic` view properties and used `Inset` to insert the graphics `tom2` into it. The view properties of the outer `Graphics3D` are used to compute a corresponding orthographic projection `ViewMatrix` to be used to display the graphics `tom2`. So the mouse rotates the outer graphics and the code rotates the inset `tom2` in the same way. The only difference is that `tom2` is projected orthographically instead of perspectively. To do this, I used and adapted code from [Heike](https://mathematica.stackexchange.com/users/46) in [this answer](https://mathematica.stackexchange.com/questions/3528/extract-values-for-viewmatrix-from-a-graphics3d/5764#5764) and [Alexey Popkov](https://mathematica.stackexchange.com/users/280) in [this answer](https://mathematica.stackexchange.com/questions/18034/how-to-get-the-real-plotrange-of-graphics-with-geometrictransformations-in-it/18040#18040). I needed Alexey Popkov's `completePlotRange` because `AbsoluteOptions` would not return the actual plot range. ``` (* Heike *) theta[v1_] := ArcTan[v1[[3]], Norm[v1[[;; 2]]]]; phi[v1_] := If[Norm[v1[[;; 2]]] > .0001, ArcTan[v1[[1]], v1[[2]]], 0]; alpha[vert_, v1_] := ArcTan[{-Sin[phi[v1]], Cos[phi[v1]], 0}.vert, Cross[v1/Norm[v1], {-Sin[phi[v1]], Cos[phi[v1]], 0}].vert]; tt[v1_, vert_, center_, r_, scale_] := TransformationMatrix[ RotationTransform[-alpha[vert/scale, v1], {0, 0, 1}] . RotationTransform[-theta[v1], {0, 1, 0}] . RotationTransform[-phi[v1], {0, 0, 1}] . ScalingTransform[r {1, 1, 1}] . TranslationTransform[-center]]; (* orthographic projection *) pp = N@{{1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, -1, 0}, {0, 0, 0, 2}}; (* Alexey Popkov *) completePlotRange[plot : (_Graphics | _Graphics3D)] := Quiet@Last@ Last@Reap[ Rasterize[ Show[plot, Axes -> True, Ticks -> (Sow[{##}] &), DisplayFunction -> Identity], ImageResolution -> 1]] (* OP *) a0 = 1; ceng = 1; znn = 3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; (* updated - switched Graphics3D and Table, adjusted options *) tom2 = Graphics3D[ Table[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[N@sinpq2[[cc, bb, aa]], rr]}, {aa, xnn}, {bb, ynn}, {cc, znn}], Axes -> False, BoxStyle -> Directive[Orange, Opacity[1]], BoxRatios -> Automatic, Background -> Black]; (* adapted from Heike *) bb = completePlotRange@tom2; scale = 1/Abs[#1 - #2] & @@@ bb; center = Mean /@ bb; vv = {Flatten[Differences /@ bb] + center, center}; v1 = (vv[[1]] - center); vert = {0, 0, 1} - {0, 0, 1}.v1 v1; viewAngle = 2 ArcCot[2.]; (* final graphic *) Graphics3D[{}, Epilog -> Inset[ Show[tom2, ViewMatrix -> Dynamic@{tt[v1, vert, center, Cot[viewAngle/2]/Norm[v1], scale], pp}, PlotRange -> bb], Center, Center, 1], ViewAngle -> Dynamic[viewAngle], ViewVector -> Dynamic[vv, (vv = #; center = vv[[2]]; v1 = vv[[1]] - center) &], ViewVertical -> Dynamic[vert], SphericalRegion -> True, PlotRange -> bb, Boxed -> False] ``` Output after manual rotation: ![](https://i.stack.imgur.com/7uzil.png) ![](https://i.stack.imgur.com/DcEwn.gif)
Combining some of the ideas here and elsewhere, this appears to produce a parallel projection: ``` tr = TransformationMatrix[ RescalingTransform[{{-2, 2}, {-2, 2}, {-3/2, 5/2}}]]; p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}}; DynamicModule[{vm = {tr, p}, vp = {0, 0, 100}}, tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}, ViewMatrix -> Dynamic[vm], ViewPoint -> Dynamic[vp]], {aa, xnn}, {bb, ynn}, {cc, znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black]] ``` which you can test by looking at the columns of spheres end on - there's hardly any perspective at all: ![a load of balls](https://i.stack.imgur.com/9i5eV.png)
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
I just found the simplest solution. Don't set `ViewPoint` to infinity!!! Just set it any number large enough, the effect will equivalent to setting to infinity. Try for example the following ``` ListPointPlot3D[Tuples[Range[10], 3], BoxRatios -> Automatic, ViewPoint -> {0, 0, 1000}] ``` for your example just change `ViewPoint -> {0, 0, ∞}` to `ViewPoint -> {0, 0, 1000}` or any number large than 1000 as you wish. You'll be amazed at how simple it is to get rid of perspective. Rotate freely! : )
Combining some of the ideas here and elsewhere, this appears to produce a parallel projection: ``` tr = TransformationMatrix[ RescalingTransform[{{-2, 2}, {-2, 2}, {-3/2, 5/2}}]]; p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}}; DynamicModule[{vm = {tr, p}, vp = {0, 0, 100}}, tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}, ViewMatrix -> Dynamic[vm], ViewPoint -> Dynamic[vp]], {aa, xnn}, {bb, ynn}, {cc, znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black]] ``` which you can test by looking at the columns of spheres end on - there's hardly any perspective at all: ![a load of balls](https://i.stack.imgur.com/9i5eV.png)
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
I think the only way to do this is by dynamically reseting the [`ViewMatrix`](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html) to be an [orthographic projection](http://reference.wolfram.com/mathematica/ref/ViewMatrix.html#464375084). It was beyond my ability, patience, or inclination to figure how to decompose the `ViewMatrix` that is created when the graphic is moved into the components `ViewPoint`, `ViewVertical`, etc. It seemed to me that the front end usually make a discontinuous jump from the view point in the orthographic projection to the initial view point in rotated graphic. Discouraged by this apparent behavior, I opted for a hybrid solution. I used an ordinary `Graphics3D` with `Dynamic` view properties and used `Inset` to insert the graphics `tom2` into it. The view properties of the outer `Graphics3D` are used to compute a corresponding orthographic projection `ViewMatrix` to be used to display the graphics `tom2`. So the mouse rotates the outer graphics and the code rotates the inset `tom2` in the same way. The only difference is that `tom2` is projected orthographically instead of perspectively. To do this, I used and adapted code from [Heike](https://mathematica.stackexchange.com/users/46) in [this answer](https://mathematica.stackexchange.com/questions/3528/extract-values-for-viewmatrix-from-a-graphics3d/5764#5764) and [Alexey Popkov](https://mathematica.stackexchange.com/users/280) in [this answer](https://mathematica.stackexchange.com/questions/18034/how-to-get-the-real-plotrange-of-graphics-with-geometrictransformations-in-it/18040#18040). I needed Alexey Popkov's `completePlotRange` because `AbsoluteOptions` would not return the actual plot range. ``` (* Heike *) theta[v1_] := ArcTan[v1[[3]], Norm[v1[[;; 2]]]]; phi[v1_] := If[Norm[v1[[;; 2]]] > .0001, ArcTan[v1[[1]], v1[[2]]], 0]; alpha[vert_, v1_] := ArcTan[{-Sin[phi[v1]], Cos[phi[v1]], 0}.vert, Cross[v1/Norm[v1], {-Sin[phi[v1]], Cos[phi[v1]], 0}].vert]; tt[v1_, vert_, center_, r_, scale_] := TransformationMatrix[ RotationTransform[-alpha[vert/scale, v1], {0, 0, 1}] . RotationTransform[-theta[v1], {0, 1, 0}] . RotationTransform[-phi[v1], {0, 0, 1}] . ScalingTransform[r {1, 1, 1}] . TranslationTransform[-center]]; (* orthographic projection *) pp = N@{{1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, -1, 0}, {0, 0, 0, 2}}; (* Alexey Popkov *) completePlotRange[plot : (_Graphics | _Graphics3D)] := Quiet@Last@ Last@Reap[ Rasterize[ Show[plot, Axes -> True, Ticks -> (Sow[{##}] &), DisplayFunction -> Identity], ImageResolution -> 1]] (* OP *) a0 = 1; ceng = 1; znn = 3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; (* updated - switched Graphics3D and Table, adjusted options *) tom2 = Graphics3D[ Table[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[N@sinpq2[[cc, bb, aa]], rr]}, {aa, xnn}, {bb, ynn}, {cc, znn}], Axes -> False, BoxStyle -> Directive[Orange, Opacity[1]], BoxRatios -> Automatic, Background -> Black]; (* adapted from Heike *) bb = completePlotRange@tom2; scale = 1/Abs[#1 - #2] & @@@ bb; center = Mean /@ bb; vv = {Flatten[Differences /@ bb] + center, center}; v1 = (vv[[1]] - center); vert = {0, 0, 1} - {0, 0, 1}.v1 v1; viewAngle = 2 ArcCot[2.]; (* final graphic *) Graphics3D[{}, Epilog -> Inset[ Show[tom2, ViewMatrix -> Dynamic@{tt[v1, vert, center, Cot[viewAngle/2]/Norm[v1], scale], pp}, PlotRange -> bb], Center, Center, 1], ViewAngle -> Dynamic[viewAngle], ViewVector -> Dynamic[vv, (vv = #; center = vv[[2]]; v1 = vv[[1]] - center) &], ViewVertical -> Dynamic[vert], SphericalRegion -> True, PlotRange -> bb, Boxed -> False] ``` Output after manual rotation: ![](https://i.stack.imgur.com/7uzil.png) ![](https://i.stack.imgur.com/DcEwn.gif)
Mathematica Version 11.2 affords the new option : `ViewProjection-> "Orthographic"`. It seems to do the job, but I can't test the interacitvity because I have only access to Mathematica 11.2 in the cloud (in the "Wolfram Development Platform"). So instead of interacting, I have set `ViewPoint -> {0, 0, 3}` in your example. Here are the results : ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[\[Theta]_] := RotationTransform[\[Theta], {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}] Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}, ViewProjection-> "Orthographic" (* <--- Here is the modification *) ] ``` [![enter image description here](https://i.stack.imgur.com/nRXEh.png)](https://i.stack.imgur.com/nRXEh.png) It seems to work fine.
28,600
I have plotted a figure of MoS2 crytal structure. But the actual output looks like the spheres are not in the correct position due to the perspective effect. I obtained the correct position figure by setting the `ViewPoint` to `Infinity`. But when I rotate the figure, the infinity effect fails and the perspective effect takes place again. ![before and after rotation](https://i.stack.imgur.com/PI6Hk.png) I was wondering if there is a way to get rid of the perspective effect when you draw a graphic? Thank you. Here is my code ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[θ_] := RotationTransform[θ, {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, ∞}] ```
2013/07/15
[ "https://mathematica.stackexchange.com/questions/28600", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8200/" ]
I just found the simplest solution. Don't set `ViewPoint` to infinity!!! Just set it any number large enough, the effect will equivalent to setting to infinity. Try for example the following ``` ListPointPlot3D[Tuples[Range[10], 3], BoxRatios -> Automatic, ViewPoint -> {0, 0, 1000}] ``` for your example just change `ViewPoint -> {0, 0, ∞}` to `ViewPoint -> {0, 0, 1000}` or any number large than 1000 as you wish. You'll be amazed at how simple it is to get rid of perspective. Rotate freely! : )
Mathematica Version 11.2 affords the new option : `ViewProjection-> "Orthographic"`. It seems to do the job, but I can't test the interacitvity because I have only access to Mathematica 11.2 in the cloud (in the "Wolfram Development Platform"). So instead of interacting, I have set `ViewPoint -> {0, 0, 3}` in your example. Here are the results : ``` a0 = 1; ceng = 1; znn =3*ceng; ynn = 5; xnn = 5; a1 = 2; cznn = 3; hh = 2; p1[\[Theta]_] := RotationTransform[\[Theta], {0, 0, 1}]; posx1 = (nx1 - 1) a0 + ((ny1 - 1) a0)/2 + (Mod[nz1 - 1, 3] a0)/2; posy1 = Sqrt[3]/2 (ny1 - 1) a0 + (Sqrt[3] Mod[nz1 - 1, 3] a0)/6; posz1 = Sqrt[3]/2 (nz1 - 1) a0 + Floor[(nz1 - 1)/3] a0; sinpq2 = Transpose[Table[{posx1, posy1, posz1}, {ny1, ynn}, {nz1, znn}, {nx1, -xnn, 0}]]; rr = 0.3 a0; tom2 = Table[ Graphics3D[{If[Mod[cc, 3] == 2, Pink, Yellow], Sphere[sinpq2[[cc, bb, aa]], rr]}], {aa, xnn}, {bb, ynn}, {cc,znn}]; Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}] Show[tom2, Axes -> False, BoxStyle -> Directive[Orange, Opacity[0]], BoxRatios -> Automatic, PlotRange -> All, Background -> Black, ViewPoint -> {0, 0, 3}, ViewProjection-> "Orthographic" (* <--- Here is the modification *) ] ``` [![enter image description here](https://i.stack.imgur.com/nRXEh.png)](https://i.stack.imgur.com/nRXEh.png) It seems to work fine.
349,678
I've seen Facebook's APIs that will sometimes start with resource id. Also, if the URI is for a business process as opposed to a fine grained resource, would it be acceptable to start the endpoint with an ID, e.g. ``` /{fine-grained-id}/businessProcess ``` So the ID does not represent an item in a list of business processes, but is the key resource ID needed for the process.
2017/05/26
[ "https://softwareengineering.stackexchange.com/questions/349678", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/273555/" ]
Roy Fielding introduced REST - <https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm> - and I don't believe there's anything in his dissertation prescribing a particular URI scheme. As long as your scheme is consistent it should be fine. It would also be advisable if it makes some kind of sense to users why the structure exists, even if it's not a public API.
A key tenet of RESTful interfaces is that they: identify information. For example, if you wanted to READ information - e.g. User 123, then you should send a GET request with the id as 123. Where the ID of the user is located, within the URL, is immaterial. Generally most routes specify the ID at the end of the URL. But you can certainly specify it where ever you like. You don't even need the http protocol to make a restful interface. so long as you can identify the resource - whether at the start of the uri or at the end - it doesn't matter.
349,678
I've seen Facebook's APIs that will sometimes start with resource id. Also, if the URI is for a business process as opposed to a fine grained resource, would it be acceptable to start the endpoint with an ID, e.g. ``` /{fine-grained-id}/businessProcess ``` So the ID does not represent an item in a list of business processes, but is the key resource ID needed for the process.
2017/05/26
[ "https://softwareengineering.stackexchange.com/questions/349678", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/273555/" ]
Roy Fielding introduced REST - <https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm> - and I don't believe there's anything in his dissertation prescribing a particular URI scheme. As long as your scheme is consistent it should be fine. It would also be advisable if it makes some kind of sense to users why the structure exists, even if it's not a public API.
> > /{fine-grained-id}/businessProcess > > > I'm not familiar with the Facebook API, but you should avoid putting actions or processes in your URLs if the intent is to call that action by making a request to that URL. For example this is wrong `GET /infrastructure/database/reshard` Instead, the client should put the abstract `database` resources into the `resharding` state and then tell the server that is the new state of the database. ``` PUT /infrastructure/database {state: resharding} ``` The only actions you can perform on a resource are defined in the HTTP spec (GET, POST, PUT, DELETE etc). HTTP is about state transfer. The client doesn't ask the server to perform an action on a resource it has (client: *please reshard the database*). Instead, it changes the state of a resource (which is an abstract concept remember) and then uses the simple HTTP actions to let the server know it has updated this resource and the server should get in sync (client: *I've put the database into this new state of resharding, update your representation of this resource*) The physical database gets physically resharded as a side-effect of the server syncing up its state of the resource with the state of the client.
8,779,929
I want my app to have an activity that shows instruction on how to use the app. However, this "instruction" screen shall only be showed once after an install, how do you do this?
2012/01/08
[ "https://Stackoverflow.com/questions/8779929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871956/" ]
You can test wether a special flag (let's call it `firstRun`) is set in your application `SharedPreferences`. If not, it's the first run, so show your activity/popup/whatever with the instructions and then set the `firstRun` in the preference. ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences settings = getSharedPreferences("prefs", 0); boolean firstRun = settings.getBoolean("firstRun", true); if ( firstRun ) { // here run your first-time instructions, for example : startActivityForResult( new Intent(context, InstructionsActivity.class), INSTRUCTIONS_CODE); } } // when your InstructionsActivity ends, do not forget to set the firstRun boolean protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == INSTRUCTIONS_CODE) { SharedPreferences settings = getSharedPreferences("prefs", 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("firstRun", false); editor.commit(); } } ```
**yes, you can fix this problem with SharedPreferences** ``` SharedPreferences pref; SharedPreferences.Editor editor; pref = getSharedPreferences("firstrun", MODE_PRIVATE); editor = pref.edit(); editor.putString("chkRegi","true"); editor.commit(); ``` Then check String chkRegi ture or false
7,495,922
protecting a page for Read and/or Write access is possible as there are bits in the page table entry that can be turned on and off at kernel level. Is there a way in which certain region of memory be protected from write access, lets say in a C structure there are certain variable(s) which need to be write protected and any write access to them triggers a segfault and a core dump. Its something like the scaled down functionality of mprotect (), as that works at page level, is there a mechanism to similar kind of thing at byte level in user space. thanks, Kapil Upadhayay.
2011/09/21
[ "https://Stackoverflow.com/questions/7495922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/940022/" ]
No, there is no such facility. If you need per-data-object protections, you'll have to allocate at least a page per object (using `mmap`). If you also want to have some protection against access beyond the end of the object (for arrays) you might allocate at least one more page than what you need, align the object so it ends right at a page boundary, and use `mprotect` to protect the one or more additional pages you allocated. Of course this kind of approach will result in programs that are very slow and waste lots of resources. It's probably not viable except as a debugging technique, and valgrind can meet that need much more effectively without having to modify your program...
One way, although terribly slow, is to protect the whole page in which the object lies. Whenever a write access to that page happens, your *custom handler for invalid page access* gets called and resolves the situation by quickly unprotecting the page, writing the data and then protecting the page again. This works fine for single-threaded programs, I'm not sure what to do for multi-threaded programs. This idea is probably not new, so you may be able to find some information or even a ready-made implementation of it.
10,473,661
Recently I've decided to move from Common DBCP to Tomcat JDBC Connection Pool. I changed bean description (using spring 3.1 + hibernate 4 + tomcat) and was faced with the next issue on my web app start up: **HHH000342: Could not obtain connection to query metadata : com.mysql.jdbc.Driver** and then when I try to query db from my app I am getting: **23:04:40,021 WARN [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:143) - SQL Error: 0, SQLState: null** **23:04:40,022 ERROR [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:144) - com.mysql.jdbc.Driver** I must have done something wrong with configuration so hibernate cannot obtain connection but do not see it. really appreciate if you can point me to the right direction. here is piece of my datasource bean definition ``` <bean id="jdbcDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy- method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://127.0.0.1:3306/test" p:username="root" p:password="test" p:defaultAutoCommit="false" p:maxActive="100" p:maxIdle="100" p:minIdle="10" p:initialSize="10" p:maxWait="30000" p:testWhileIdle="true" p:validationInterval="60000" p:validationQuery="SELECT 1" p:timeBetweenEvictionRunsMillis="60000" p:minEvictableIdleTimeMillis="600000" p:maxAge="360000" /> ``` and here is how I tie it with spring's session factory ``` <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="jdbcDataSource" />... ```
2012/05/06
[ "https://Stackoverflow.com/questions/10473661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340495/" ]
First of all it seems that you are creating lots of string objects in the inner loop. You could try to build list of prefixes first: ``` linker = 'CTGTAGGCACCATCAAT' prefixes = [] for i in range(len(linker)): prefixes.append(linker[:i]) ``` Additionally you could use `string`'s method `endswith` instead of creating new object in the condition in the inner loop: ``` while True: line=f.readilne() if not line: break for prefix in prefixes: if line_1.endswith(prefix): new_line='>\n%s\n' % line_1[:-len(prefix)] seq_1.append(new_line_1) if seq_2.count(line)==0: seq_2.append(line) ``` I am not sure about indexes there (like `len(prefix)`). Also don't know how much faster it could be.
**About twise faster** than all theese variants (at least at python 2.7.2) ``` seq_2 = set() # Here I use generator. So I escape .append lookup and list resizing def F(f): # local memory local_seq_2 = set() # lookup escaping local_seq_2_add = local_seq_2.add # static variables linker ='CTGTAGGCACCATCAAT' linker_range = range(len(linker)) for line in f: line_1=line[:-1] for i in linker_range: if line_1[-i:] == linker[:i]: local_seq_2_add(line) yield '>\n' + line_1[:-i] + '\n' # push local memory to the global global seq_2 seq_2 = local_seq_2 # here we consume all data seq_1 = tuple(F(f)) ``` Yes, it's ugly and non-pythonic, but it is the fastest way to do the job. You can also upgrade this code with `with open('file.name') as f:` inside generator or add some other logic. Note: This place `'>\n' + line_1[:-i] + '\n'` - is doubtful. On some machines it is the fastest way to concat strings. On some machines the fastest way is `'>\n'%s'\n'%line_1[:-i]` or `''.join(('>\n',line_1[:-i],'\n'))` (in version without lookup, of course). I dont know what will be best for you. It is strange, but new formatter `'{}'.format(..)` on my computer shows the slowest result.
10,473,661
Recently I've decided to move from Common DBCP to Tomcat JDBC Connection Pool. I changed bean description (using spring 3.1 + hibernate 4 + tomcat) and was faced with the next issue on my web app start up: **HHH000342: Could not obtain connection to query metadata : com.mysql.jdbc.Driver** and then when I try to query db from my app I am getting: **23:04:40,021 WARN [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:143) - SQL Error: 0, SQLState: null** **23:04:40,022 ERROR [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:144) - com.mysql.jdbc.Driver** I must have done something wrong with configuration so hibernate cannot obtain connection but do not see it. really appreciate if you can point me to the right direction. here is piece of my datasource bean definition ``` <bean id="jdbcDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy- method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://127.0.0.1:3306/test" p:username="root" p:password="test" p:defaultAutoCommit="false" p:maxActive="100" p:maxIdle="100" p:minIdle="10" p:initialSize="10" p:maxWait="30000" p:testWhileIdle="true" p:validationInterval="60000" p:validationQuery="SELECT 1" p:timeBetweenEvictionRunsMillis="60000" p:minEvictableIdleTimeMillis="600000" p:maxAge="360000" /> ``` and here is how I tie it with spring's session factory ``` <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="jdbcDataSource" />... ```
2012/05/06
[ "https://Stackoverflow.com/questions/10473661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340495/" ]
Probably a large part of the problem is the `seq_2.count(line) == 0` test for whether `line` is in `seq_2`. This will walk over each element of `seq_2` and test whether it's equal to `line` -- which will take longer and longer as `seq_2` grows. You should use a set instead, which will give you constant-time tests for whether it's present through hashing. This will throw away the order of `seq_2` -- if you need to keep the order, you could use both a set and a list (test if it's in the set and if not, add to both). This probably doesn't affect the speed, but it's much nicer to loop `for line in f` instead of your `while True` loop with `line = f.readline()` and the test for when to break. Also, the `else: pass` statements are completely unnecessary and could be removed. The definition of `linker` should be moved outside the loop, since it doesn't get changed. @uhz's suggestion about pre-building prefixes and using `endswith` are also probably good.
**About twise faster** than all theese variants (at least at python 2.7.2) ``` seq_2 = set() # Here I use generator. So I escape .append lookup and list resizing def F(f): # local memory local_seq_2 = set() # lookup escaping local_seq_2_add = local_seq_2.add # static variables linker ='CTGTAGGCACCATCAAT' linker_range = range(len(linker)) for line in f: line_1=line[:-1] for i in linker_range: if line_1[-i:] == linker[:i]: local_seq_2_add(line) yield '>\n' + line_1[:-i] + '\n' # push local memory to the global global seq_2 seq_2 = local_seq_2 # here we consume all data seq_1 = tuple(F(f)) ``` Yes, it's ugly and non-pythonic, but it is the fastest way to do the job. You can also upgrade this code with `with open('file.name') as f:` inside generator or add some other logic. Note: This place `'>\n' + line_1[:-i] + '\n'` - is doubtful. On some machines it is the fastest way to concat strings. On some machines the fastest way is `'>\n'%s'\n'%line_1[:-i]` or `''.join(('>\n',line_1[:-i],'\n'))` (in version without lookup, of course). I dont know what will be best for you. It is strange, but new formatter `'{}'.format(..)` on my computer shows the slowest result.
10,473,661
Recently I've decided to move from Common DBCP to Tomcat JDBC Connection Pool. I changed bean description (using spring 3.1 + hibernate 4 + tomcat) and was faced with the next issue on my web app start up: **HHH000342: Could not obtain connection to query metadata : com.mysql.jdbc.Driver** and then when I try to query db from my app I am getting: **23:04:40,021 WARN [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:143) - SQL Error: 0, SQLState: null** **23:04:40,022 ERROR [http-bio-8080-exec-10] spi.SqlExceptionHelper:(SqlExceptionHelper.java:144) - com.mysql.jdbc.Driver** I must have done something wrong with configuration so hibernate cannot obtain connection but do not see it. really appreciate if you can point me to the right direction. here is piece of my datasource bean definition ``` <bean id="jdbcDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy- method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://127.0.0.1:3306/test" p:username="root" p:password="test" p:defaultAutoCommit="false" p:maxActive="100" p:maxIdle="100" p:minIdle="10" p:initialSize="10" p:maxWait="30000" p:testWhileIdle="true" p:validationInterval="60000" p:validationQuery="SELECT 1" p:timeBetweenEvictionRunsMillis="60000" p:minEvictableIdleTimeMillis="600000" p:maxAge="360000" /> ``` and here is how I tie it with spring's session factory ``` <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="jdbcDataSource" />... ```
2012/05/06
[ "https://Stackoverflow.com/questions/10473661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340495/" ]
I am not sure what your code is meant to do, but general approach is: 1. Avoid unnecessary operations, conditions etc. 2. Move everything you can out of the loop. 3. Try to do as few levels of loop as possible. 4. Use common Python practices where possible (they are generally more efficient). But most important: try to simplify and optimize the algorithm, not necessarily the code implementing it. Judging from the code and applying some of the above rules code may look like this: ```py seq_2 = set() # seq_2 is a set now (maybe seq_1 should be also?) linker = 'CTGTAGGCACCATCAAT' # assuming same linker for every line linker_range = range(len(linker)) # result of the above assumption for line in f: line_1=line[:-1] for i in linker_range: if line_1[-i:] == linker[:i]: # deleted new_line_1 seq_1.append('>\n' + line_1[:-i] + '\n') # do you need this line? seq_2.add(line) # will ignore if already in set ```
**About twise faster** than all theese variants (at least at python 2.7.2) ``` seq_2 = set() # Here I use generator. So I escape .append lookup and list resizing def F(f): # local memory local_seq_2 = set() # lookup escaping local_seq_2_add = local_seq_2.add # static variables linker ='CTGTAGGCACCATCAAT' linker_range = range(len(linker)) for line in f: line_1=line[:-1] for i in linker_range: if line_1[-i:] == linker[:i]: local_seq_2_add(line) yield '>\n' + line_1[:-i] + '\n' # push local memory to the global global seq_2 seq_2 = local_seq_2 # here we consume all data seq_1 = tuple(F(f)) ``` Yes, it's ugly and non-pythonic, but it is the fastest way to do the job. You can also upgrade this code with `with open('file.name') as f:` inside generator or add some other logic. Note: This place `'>\n' + line_1[:-i] + '\n'` - is doubtful. On some machines it is the fastest way to concat strings. On some machines the fastest way is `'>\n'%s'\n'%line_1[:-i]` or `''.join(('>\n',line_1[:-i],'\n'))` (in version without lookup, of course). I dont know what will be best for you. It is strange, but new formatter `'{}'.format(..)` on my computer shows the slowest result.
28,728,398
I have 2 arrays : 1. $valid\_sku\_array 2. $qb\_sku\_array I want to `intersect` them, and print out the `bad` one (diff) Then I do this : ``` // Case Sensitive $intersect_sku_array_s = array_intersect( $valid_sku_array, $qb_sku_array ); dd($intersect_sku_array_s); ... array (size=17238) ``` Then I also tried with the Case Insensitive by doing this : ``` // Case Insensitive $intersect_sku_array_is = array_intersect(array_map('strtolower', $valid_sku_array), array_map('strtolower', $qb_sku_array )); dd($intersect_sku_array_is); ... array (size=18795) ``` As you can see the diff of both array = 18795 - 17238 = 1557. I want to see what are they. Then I tried this : `$diff = array_diff( $intersect_sku_array_is , $intersect_sku_array_s );` and when do `dd($diff);` I got `array (size=18795)` I just couldn't figure it out how to get to print out those **1557**. Can someone please explain what is going on here ?
2015/02/25
[ "https://Stackoverflow.com/questions/28728398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're problem already begins with your intersect call! There you will lose your "real" array data, because you compare everything in lowercase and assign it also in lowercase. So your array\_diff won't find anything, because it's case sensitive and if you make it case insensitive you still doesn't have the real data. You already have to change your intersect. So your code should look something like this: ``` $intersect_sku_array_s = array_intersect($valid_sku_array, $qb_sku_array); $intersect_sku_array_is = array_uintersect($valid_sku_array, $qb_sku_array, "strcasecmp"); //^^^^^^^^^^^^^^^^ See here I used 'array_uintersect' with 'strcasecmp', so that you don't lose your case ``` After this you can do your array\_diff normal like this: ``` $diff = array_diff($intersect_sku_array_is, $intersect_sku_array_s); ```
I'm not familiar with `dd` as a PHP function. Your question is not entirely clear, but if you are just trying to look at the contents of the array `$diff` there are many ways to do it... ``` echo "diff=<pre>".print_r($diff,true)."</pre><br />\n"; ``` -or- ``` var_dump($diff); ``` -or- ``` foreach ($diff as $k=>$v) echo "k=$k, v=$v<br />\n"; ``` Is that what you are trying to do?
220,741
I have a file share, and I want a process which enumerates files on that share and automatically creates a 7z self-extracting exe of *files* over 1 month old. On a different share, I want to create a 7z self-extracting exe of *directories* that are over 1 month old. Any idea if there is a program which can do this? I already have ``` 7z a -t7z -mx9 -sfx filename.exe filename.txt ``` Portion of it, just need more of the auto-management portion. Running on Windows Server 2008, yes, PowerShell is available. Cygwin would not be an option.
2011/01/10
[ "https://serverfault.com/questions/220741", "https://serverfault.com", "https://serverfault.com/users/3479/" ]
I ended up doing this with a batch file, and setting it to run via Task Scheduler. Here is the batch file if anyone is interested: ``` @echo off set RETENTION_PERIOD_DAYS=30 set FILE_BASED_ARCHIVES=g:\shares\public\crashes set DIRECTORY_BASED_ARCHIVES=g:\shares\results set MINIMUM_FILESIZE=1000000 set ZIP_PATH="c:\Program Files\7-Zip\7z.exe" if not {%1}=={} call :archive %1 %2 %3 %4&exit /b 0 echo Archiving files older than %RETENTION_PERIOD_DAYS% days. echo File Based: %FILE_BASED_ARCHIVES% echo Directory Based: %DIRECTORY_BASED_ARCHIVES% for %%a in (%FILE_BASED_ARCHIVES%) do ( echo ********* Archiving %%a du /s "%%a" echo ----------------------- forfiles /p %%a /s /m *.* /d -%RETENTION_PERIOD_DAYS% /c "cmd /c call ^0x22%~dpnx0^0x22 ^0x22FILE^0x22 ^0x22@isdir^0x22 ^0x22@fsize^0x22 @path" echo ----------------------- du /s "%%a" echo **************************************************** ) for %%a in (%DIRECTORY_BASED_ARCHIVES%) do ( echo ********* Archiving %%a du /s "%%a" echo ----------------------- forfiles /p %%a /d -%RETENTION_PERIOD_DAYS% /c "cmd /c call ^0x22%~dpnx0^0x22 ^0x22DIR^0x22 ^0x22@isdir^0x22 ^0x22@fsize^0x22 @path" echo ----------------------- du /s "%%a" echo **************************************************** ) exit /b 0 :archive if /i "%~1"=="FILE" ( if /i "%~2"=="FALSE" (call :archive_file %3 %4) else (echo Skipping %~4 as it is not a file.) ) if /i "%~1"=="DIR" ( if /i "%~2"=="TRUE" (call :archive_dir %4) else (echo Skipping %~4 as it is not a directory.) ) exit /b 0 :archive_file set FILESIZE=%~1 if %FILESIZE% GEQ %MINIMUM_FILESIZE% ( call :7zip %2 && del /q /f %2 ) else ( echo Skipping %~2 as it is smaller than %MINIMUM_FILESIZE% bytes. ) exit /b 0 :archive_dir call :7zip %1 && rd /q /s %1 exit /b 0 :7zip %ZIP_PATH% t "%~1">nul || ( %ZIP_PATH% a -t7z -mx9 -sfx "%~dp1%~n1.exe" "%~dpnx1" || exit /b 1 ) exit /b 0 ```
Looks like he's running windows guys. (.exe) Create a shortcut or batch file that runs the command, and then run the shortcut or batch file from Windows Task Scheduler.
18,008
Что-то меня вчера заклинило. Можно ли сказать "оказывать консультацию" или только "давать"?
2013/04/02
[ "https://rus.stackexchange.com/questions/18008", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Давать консультацию, совет, а оказывать помощь и т.п. Возможно, но менее употребительно - предоставить консультацию.
Только "дать" или "провести". Но никак не "оказать". Оказать можно помощь.