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
|
---|---|---|---|---|---|
19,796,235 | I'm new to Android programming and working with Retrofit. I've done a bunch of research on this topic, but haven't been able to find a solution specific to my needs. I'm working with our API and trying to make a POST request. I successfully achieved this with the following non-Retrofit code:
```
private class ProcessLogin extends AsyncTask<Void, String, JSONObject> {
private ProgressDialog pDialog;
String email,password;
protected void onPreExecute() {
super.onPreExecute();
inputEmail = (EditText) findViewById(R.id.email);
inputPassword = (EditText) findViewById(R.id.password);
email = inputEmail.getText().toString();
password = inputPassword.getText().toString();
pDialog = new ProgressDialog(LoginActivity.this);
pDialog.setTitle("Contacting Servers");
pDialog.setMessage("Logging in ...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected JSONObject doInBackground(Void... params) {
HttpURLConnection connection;
OutputStreamWriter request = null;
URL url = null;
String response = null;
String parameters = "username="+email+"&password="+password;
try
{
url = new URL("http://.../api/login");
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestMethod("POST");
request = new OutputStreamWriter(connection.getOutputStream());
request.write(parameters);
request.flush();
request.close();
String line = "";
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null)
{
sb.append(line + "\n");
}
// Response from server after login process will be stored in response variable.
response = sb.toString();
// You can perform UI operations here
isr.close();
reader.close();
}
catch(IOException e)
{
// Error
}
System.out.println(response);
JSONObject jObj = null;
// Try to parse the string to a JSON Object
try {
jObj = new JSONObject(response);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// Return the JSONObject
return jObj;
}
protected void onPostExecute(JSONObject json) {
String status = (String) json.optJSONArray("users").optJSONObject(0).optJSONObject("user").optString("login");
pDialog.dismiss();
if (status.equals("Failed")) {
loginMessage.setText("Login Failed");
}
else if (status.equals("Success")) {
loginMessage.setText("Success!");
startActivity(new Intent(getApplicationContext(), DActivity.class));
}
}
}
```
Now, I'm trying to get the same results using Retrofit, but I'm not sure how to get the JSON back from our API using Callbacks (I'm assuming this call should happen asynchronously?):
I've made an interface with the following method:
```
@FormUrlEncoded
@POST("/login")
public void login(@Field("username") String username, @Field("password") String password, Callback<JSONObject> callback);
```
And instantiated the RestAdapter, etc in my Activity's onCreate method. When the user presses the "login" button (after entering their username and password), the following is called inside the button's onClick method:
```
service.login(email, password, new Callback<JSONObject>() {
@Override
public void failure(final RetrofitError error) {
android.util.Log.i("example", "Error, body: " + error.getBody().toString());
}
@Override
public void success(JSONObject arg0, Response arg1) {
}
}
);
```
This is not working as intended however, and I really don't think I'm approaching this correctly. I want to be able to make a POST to our server, which sends back a block of JSON formatted data about that user. If anyone could point me in the right direction, that would be really appreciated. Thank you in advance | 2013/11/05 | [
"https://Stackoverflow.com/questions/19796235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957545/"
] | One of the benefits of Retrofit is not having to parse the JSON yourself. You should have something like:
```
service.login(email, password, new Callback<User>() {
@Override
public void failure(final RetrofitError error) {
android.util.Log.i("example", "Error, body: " + error.getBody().toString());
}
@Override
public void success(User user, Response response) {
// Do something with the User object returned
}
}
);
```
Where `User` is a POJO like
```
public class User {
private String name;
private String email;
// ... etc.
}
```
and the returned JSON has fields that match the `User` class:
```
{
"name": "Bob User",
"email": "[email protected]",
...
}
```
If you need custom parsing, the place for that is when setting the REST adapter's converter with [.setConverter(Converter converter)](http://square.github.io/retrofit/javadoc/retrofit/RestAdapter.Builder.html#setConverter(retrofit.converter.Converter)):
>
> The converter used for serialization and deserialization of objects.
>
>
> | Seem Retrofit have problem with `@POST` and `@FormUrlEncoded`. It works well if we do synchronous but failed if asynchronous.
If @mike problem is deserialization object, User class should be
```
public class User {
@SerializedName("name")
String name;
@SerializedName("email")
String email;
}
```
Interface class
```
@FormUrlEncoded
@POST("/login")
void login(@Field("username") String username, @Field("password") String password, Callback<User> callback);
```
Or
```
@FormUrlEncoded
@POST("/login")
void login(@Field("username") String username, @Field("password") String password, Callback<UserResponse> callback);
```
Where
```
public class UserResponse {
@SerializedName("email")
String email;
@SerializedName("name")
String name;
}
``` |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Consider Titivilus
==================
Mordenkainen’s Tome of Foes includes a number of devils that you can draw on for your campaign. One of these is [Titivilus](https://www.dndbeyond.com/monsters/titivilus) who can innately cast [*Alter Self*](https://www.dndbeyond.com/spells/alter-self) and [*Nondetection*](https://www.dndbeyond.com/spells/nondetection) at will. *Alter Self* would allow him to easily pass as a human and *Nondetection* would help prevent his true nature from being discovered.
Other relevant spells include *Modify Memory*, *Major Image*, and *Mislead*.
Titivilus is the second in command to Dispater making him important enough to count as prestigious while still being lowly enough that he would personally manage his schemes on earth. | Would [Shapechange](http://engl393-dnd5th.wikia.com/wiki/Shapechange) go? It only lasts for an hour, but the caster can transform into any creature with same or lower challenge rating. Limitations are "not a construct or an undead, no class levels or the Spellcasting trait, and you must have seen the sort of creature at least once", so a human form seem to be available. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Why not try using the disguise of an entirely different person?
In the MM, all the stronger devils seem to have telepathy of 120ft. They could use their telepathy in order to communicate through another person that is in service to the devil. I think it would make sense that a higher more prestigious devil would employ servants to do dirty work.
This wouldn't be entirely undetectable. The devil would have to remain 120ft close to tell the Servant what to say or maybe even closer to hear the PCs(depending if you consider telepathic communication a 2-way street. I could not find a straight answer on this.) A wise PC might could notice the words of the Servant are not the Servant's own, maybe a hesitation in the Servant's voice which would require investigation, or sense they are being spied on a powerful being. | A hat of disguise could easily allow an erinyes pass off as an aarakocra or winged elf, either of which would stand out in a crowd, but wouldn't be barred entrance to a city. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | You had requested no homebrew creatures, and I'm not sure this qualifies as homebrew or just refluff, but you could easily take the Deva (MM pp16) and have it be "fallen" (think Lucifer.)
Instead of an Angel, it is a Fallen Angel, but still has all of the attributes which allows for Change Shape with everything you're looking for. It's technically homebrew because it's not the name/alignment of an Angel from the MM, but it's also basically the exact same creature, just with an alignment change from having "fallen" and probably a switch from Radiant to Necrotic (but not necessarily.) | A hat of disguise could easily allow an erinyes pass off as an aarakocra or winged elf, either of which would stand out in a crowd, but wouldn't be barred entrance to a city. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Consider Titivilus
==================
Mordenkainen’s Tome of Foes includes a number of devils that you can draw on for your campaign. One of these is [Titivilus](https://www.dndbeyond.com/monsters/titivilus) who can innately cast [*Alter Self*](https://www.dndbeyond.com/spells/alter-self) and [*Nondetection*](https://www.dndbeyond.com/spells/nondetection) at will. *Alter Self* would allow him to easily pass as a human and *Nondetection* would help prevent his true nature from being discovered.
Other relevant spells include *Modify Memory*, *Major Image*, and *Mislead*.
Titivilus is the second in command to Dispater making him important enough to count as prestigious while still being lowly enough that he would personally manage his schemes on earth. | When you say 'devil', would *any* devil do? If so, and given your "anything else that would normally interact with a party around a town" then - for a given definition of "interact" an imp works. It's technically a devil and can shapechange at will into a spider, rat or raven, all of which can be encountered in a town without raising suspicion. It retains its statistics in the new form which means it can speak Common and Infernal. You could either have it claim to be an Animal Messenger of a party who wishes to remain anonymous, or have it perch on the shoulder of a zombie (or corpse, or just someone paralytically drunk or intimidated or bribed into going along) disguised to look like a well-wrapped wizard. Nobody is going to assume the voice is coming from the spider. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Consider Titivilus
==================
Mordenkainen’s Tome of Foes includes a number of devils that you can draw on for your campaign. One of these is [Titivilus](https://www.dndbeyond.com/monsters/titivilus) who can innately cast [*Alter Self*](https://www.dndbeyond.com/spells/alter-self) and [*Nondetection*](https://www.dndbeyond.com/spells/nondetection) at will. *Alter Self* would allow him to easily pass as a human and *Nondetection* would help prevent his true nature from being discovered.
Other relevant spells include *Modify Memory*, *Major Image*, and *Mislead*.
Titivilus is the second in command to Dispater making him important enough to count as prestigious while still being lowly enough that he would personally manage his schemes on earth. | A hat of disguise could easily allow an erinyes pass off as an aarakocra or winged elf, either of which would stand out in a crowd, but wouldn't be barred entrance to a city. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Hide in plain sight. There are two good options for this:
**Erinyes** Based on the picture on MM 73, these creatures are mostly humanoid, but have wings. The horns on the helmet may or may not cover any natural horns; it's unclear. Either way, you could throw on a cloak to hide your wings, then claim to be a Tiefling. Depending on the campaign world, there may be any number of them around, trying to redeem their unsavory lineage.
**Asmodeus** If you'd like to go straight to the top, you could send in the lord of the lowest of the Nine Hells. He's described as "a handsome, bearded humanoid with small horns protruding from his forehead, piercing red eyes, and flowing robes." He can also assume other forms. He should easily pass as a Tiefling. | When you say 'devil', would *any* devil do? If so, and given your "anything else that would normally interact with a party around a town" then - for a given definition of "interact" an imp works. It's technically a devil and can shapechange at will into a spider, rat or raven, all of which can be encountered in a town without raising suspicion. It retains its statistics in the new form which means it can speak Common and Infernal. You could either have it claim to be an Animal Messenger of a party who wishes to remain anonymous, or have it perch on the shoulder of a zombie (or corpse, or just someone paralytically drunk or intimidated or bribed into going along) disguised to look like a well-wrapped wizard. Nobody is going to assume the voice is coming from the spider. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Hide in plain sight. There are two good options for this:
**Erinyes** Based on the picture on MM 73, these creatures are mostly humanoid, but have wings. The horns on the helmet may or may not cover any natural horns; it's unclear. Either way, you could throw on a cloak to hide your wings, then claim to be a Tiefling. Depending on the campaign world, there may be any number of them around, trying to redeem their unsavory lineage.
**Asmodeus** If you'd like to go straight to the top, you could send in the lord of the lowest of the Nine Hells. He's described as "a handsome, bearded humanoid with small horns protruding from his forehead, piercing red eyes, and flowing robes." He can also assume other forms. He should easily pass as a Tiefling. | Would [Shapechange](http://engl393-dnd5th.wikia.com/wiki/Shapechange) go? It only lasts for an hour, but the caster can transform into any creature with same or lower challenge rating. Limitations are "not a construct or an undead, no class levels or the Spellcasting trait, and you must have seen the sort of creature at least once", so a human form seem to be available. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | You had requested no homebrew creatures, and I'm not sure this qualifies as homebrew or just refluff, but you could easily take the Deva (MM pp16) and have it be "fallen" (think Lucifer.)
Instead of an Angel, it is a Fallen Angel, but still has all of the attributes which allows for Change Shape with everything you're looking for. It's technically homebrew because it's not the name/alignment of an Angel from the MM, but it's also basically the exact same creature, just with an alignment change from having "fallen" and probably a switch from Radiant to Necrotic (but not necessarily.) | Would [Shapechange](http://engl393-dnd5th.wikia.com/wiki/Shapechange) go? It only lasts for an hour, but the caster can transform into any creature with same or lower challenge rating. Limitations are "not a construct or an undead, no class levels or the Spellcasting trait, and you must have seen the sort of creature at least once", so a human form seem to be available. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | You had requested no homebrew creatures, and I'm not sure this qualifies as homebrew or just refluff, but you could easily take the Deva (MM pp16) and have it be "fallen" (think Lucifer.)
Instead of an Angel, it is a Fallen Angel, but still has all of the attributes which allows for Change Shape with everything you're looking for. It's technically homebrew because it's not the name/alignment of an Angel from the MM, but it's also basically the exact same creature, just with an alignment change from having "fallen" and probably a switch from Radiant to Necrotic (but not necessarily.) | When you say 'devil', would *any* devil do? If so, and given your "anything else that would normally interact with a party around a town" then - for a given definition of "interact" an imp works. It's technically a devil and can shapechange at will into a spider, rat or raven, all of which can be encountered in a town without raising suspicion. It retains its statistics in the new form which means it can speak Common and Infernal. You could either have it claim to be an Animal Messenger of a party who wishes to remain anonymous, or have it perch on the shoulder of a zombie (or corpse, or just someone paralytically drunk or intimidated or bribed into going along) disguised to look like a well-wrapped wizard. Nobody is going to assume the voice is coming from the spider. |
93,391 | I am designing a campaign and I have a couple of evil power blocs vying for control. I would really like to have one of them directly interacting with the party and I think I really want it to be a devil because I love the idea of the lawful evil tricking them while still being true to its word.
So my question would it be possible to disguise a devil as a human\* using canon mechanics? I know I could just house rule that the devil has the spell polymorph or something but I was wondering if there was a way to do it within the rules as written for 5e?
Now, this doesn't have to be an undetectable disguise. I am fine with the players discovering he is a devil in disguise if they look hard enough. Also, the type of Devil can change if needed, though I would prefer to have a more prestigious Devil that is calling the shots.
I have read the entire section on Devils in the Monster Manual and there isn't anything obvious. I was thinking of an Erinyes with a Hat of Disguise Self but I don't think Disguise Self would be able to conceal the wings, so they would have to pretend to be an Angel which I wouldn't really consider "normal" to be interacting with.
As for making a custom monster according to the DMG I would consider that akin to house ruling it. Which is definitely something I can fall back to, but I was trying to think of something more direct from the rules.
\*Or anything else that would normally interact with a party around a town. | 2017/01/18 | [
"https://rpg.stackexchange.com/questions/93391",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/29455/"
] | Hide in plain sight. There are two good options for this:
**Erinyes** Based on the picture on MM 73, these creatures are mostly humanoid, but have wings. The horns on the helmet may or may not cover any natural horns; it's unclear. Either way, you could throw on a cloak to hide your wings, then claim to be a Tiefling. Depending on the campaign world, there may be any number of them around, trying to redeem their unsavory lineage.
**Asmodeus** If you'd like to go straight to the top, you could send in the lord of the lowest of the Nine Hells. He's described as "a handsome, bearded humanoid with small horns protruding from his forehead, piercing red eyes, and flowing robes." He can also assume other forms. He should easily pass as a Tiefling. | Why not try using the disguise of an entirely different person?
In the MM, all the stronger devils seem to have telepathy of 120ft. They could use their telepathy in order to communicate through another person that is in service to the devil. I think it would make sense that a higher more prestigious devil would employ servants to do dirty work.
This wouldn't be entirely undetectable. The devil would have to remain 120ft close to tell the Servant what to say or maybe even closer to hear the PCs(depending if you consider telepathic communication a 2-way street. I could not find a straight answer on this.) A wise PC might could notice the words of the Servant are not the Servant's own, maybe a hesitation in the Servant's voice which would require investigation, or sense they are being spied on a powerful being. |
16,849,302 | I want to start my `MainActivity` with a new `Intent` in my other `Activity`. The two Activities are in the same app, and the second Activity is actually started from the MainActivity. So the scenario is like this:
1. MainActivity is created with an Intent
2. MainActivity starts SecondActivity (but MainActivity is not destroyed yet. It is just stopped)
3. SecondActivity starts MainActivity with a new Intent (SecondActivity is not closed)
The MainActivity is not flagged. I mean, the Activity's launch mode in the manifest is not set (so, it's default).
I want to know what happens to MainActivity's lifecycle and intent.
Is the Activity re-created? Is `onCreate()` called? Then is `onCreate()` called twice, without `onDestory()`? Or the new MainActivity is newly created and there will be two MainActivities? Will the Intent from `getIntent()` overwritten?
I know `Activity.onNewIntent()` is called for singleTop Activities. Then in my situation `onNewIntent()` is not called?
Thanks in advance. | 2013/05/31 | [
"https://Stackoverflow.com/questions/16849302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/869330/"
] | Create a table with single autoincrement column.
When you need another unique id - just insert `null` into that column and retrieve last insert id.
For oracle - create a sequence and use `SELECT sequence_name.nextval` FROM DUAL`
For sql server - create a sequence and fetch it with `NEXT VALUE FOR` | In SQL Server to generate truly unique ID I suggest using GUID, e.g.:
```
DECLARE @UniqueID uniqueidentifier
SET @UniqueID = NEWID()
``` |
107,980 | I took a bunch of screenshots and I want to make them pages in a single PDF. Selecting all four in Preview and exporting to PDF only exports two (?), separately. The "Export to PDF" File menu function adds a strange white border around the screenshots (and orients the page as portrait). So I converted each to PDFs individually and then combined them manually. I tried the solutions [here](https://apple.stackexchange.com/q/11163/21351), but Mavericks' Preview doesn't appear to work that way anymore. What's the best, free, hopefully built-in way to automate this? | 2013/11/01 | [
"https://apple.stackexchange.com/questions/107980",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21351/"
] | You can use the `convert` command if you install **ImageMagick**. ImageMagick isn't always a simple install, but if you install Xcode and [Homebrew](http://brew.sh) it should be fairly painless.
`convert *.png foobar.pdf`
<http://www.imagemagick.org/script/convert.php> | There is an Automator action - **New PDF from images**. It creates a single multi-page document from input images. You can create a workflow or app that would process your images that you drop onto it.
If I create an application in Automator with that single action, I can drop my images onto it, and it'll create a PDF with one page per image. |
107,980 | I took a bunch of screenshots and I want to make them pages in a single PDF. Selecting all four in Preview and exporting to PDF only exports two (?), separately. The "Export to PDF" File menu function adds a strange white border around the screenshots (and orients the page as portrait). So I converted each to PDFs individually and then combined them manually. I tried the solutions [here](https://apple.stackexchange.com/q/11163/21351), but Mavericks' Preview doesn't appear to work that way anymore. What's the best, free, hopefully built-in way to automate this? | 2013/11/01 | [
"https://apple.stackexchange.com/questions/107980",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21351/"
] | You can use the `convert` command if you install **ImageMagick**. ImageMagick isn't always a simple install, but if you install Xcode and [Homebrew](http://brew.sh) it should be fairly painless.
`convert *.png foobar.pdf`
<http://www.imagemagick.org/script/convert.php> | Preview's "Export As PDF..." places the converted image onto the default paper size, e.g. A4 or US Letter. That's why you get the "strange white border" around the image.
Using Preview's "Export..." menu item, and selecting PDF as the format will merely convert the image to PDF without placing it on a page.
Apple's Automator action "New PDF from Images" works well, but suffers from Automator's limitations in where output files can be saved.
A python script that will combine images (supplied as arguments) into a PDF file [can be found here](https://github.com/benwiggy/PDFsuite/blob/master/Automator_Scripts/image2pdf.py). It can be used in an Automator "Run Shell Script" action to create a Quick Action/Service. |
107,980 | I took a bunch of screenshots and I want to make them pages in a single PDF. Selecting all four in Preview and exporting to PDF only exports two (?), separately. The "Export to PDF" File menu function adds a strange white border around the screenshots (and orients the page as portrait). So I converted each to PDFs individually and then combined them manually. I tried the solutions [here](https://apple.stackexchange.com/q/11163/21351), but Mavericks' Preview doesn't appear to work that way anymore. What's the best, free, hopefully built-in way to automate this? | 2013/11/01 | [
"https://apple.stackexchange.com/questions/107980",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21351/"
] | There is an Automator action - **New PDF from images**. It creates a single multi-page document from input images. You can create a workflow or app that would process your images that you drop onto it.
If I create an application in Automator with that single action, I can drop my images onto it, and it'll create a PDF with one page per image. | Preview's "Export As PDF..." places the converted image onto the default paper size, e.g. A4 or US Letter. That's why you get the "strange white border" around the image.
Using Preview's "Export..." menu item, and selecting PDF as the format will merely convert the image to PDF without placing it on a page.
Apple's Automator action "New PDF from Images" works well, but suffers from Automator's limitations in where output files can be saved.
A python script that will combine images (supplied as arguments) into a PDF file [can be found here](https://github.com/benwiggy/PDFsuite/blob/master/Automator_Scripts/image2pdf.py). It can be used in an Automator "Run Shell Script" action to create a Quick Action/Service. |
54,439,830 | How will i set selected value=Booking.
```js
$('#status').val("Booking");
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select name="status" class="form-control">
<option value="" id="status">New</option>
<option value="">Follow</option>
<option value="">DND</option>
<option value="">Dead</option>
</select>
``` | 2019/01/30 | [
"https://Stackoverflow.com/questions/54439830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10954362/"
] | try to follow the below example. there is no booking option in your select add it like below code
```
$('#mySelect')
.append($("<option></option>")
.attr("value",key)
.text("Booking"));
``` | Try this:
```
<select id="status" class="form-control">
<option value="">New</option>
<option value="">Follow</option>
<option value="">DND</option>
<option value="">Dead</option>
<option value="Booking">Booking</option>
</select>
```
and the script should be:
```
$(document).ready(function() {
$('#status').val("Booking");
});
```
Also I have changed the name attribut to id since you are referring it using the '#' :) |
54,439,830 | How will i set selected value=Booking.
```js
$('#status').val("Booking");
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select name="status" class="form-control">
<option value="" id="status">New</option>
<option value="">Follow</option>
<option value="">DND</option>
<option value="">Dead</option>
</select>
``` | 2019/01/30 | [
"https://Stackoverflow.com/questions/54439830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10954362/"
] | try to follow the below example. there is no booking option in your select add it like below code
```
$('#mySelect')
.append($("<option></option>")
.attr("value",key)
.text("Booking"));
``` | There should be any value of option like below so when you want to select booking option. so according to me it should be like that please check Is that matching with your requirement.`<option value="new">New</option>` |
13,177,124 | In a Hashmap the hash code of the key provided is used to place the value in the hashtable. In a Hashset the obects hashcode is used to place the value in the underlying hashtable. i.e the advantage of the hashmap is that you have the flexibility of deciding what you want as the key so you can do nice things like this.
```
Map<String,Player> players = new HashMap<String,Player>();
```
This can map a string such as the players name to a player itself.
My question is is what happens to to the lookup when the key's Hashcode changes.
This i expect isn't such a major concern for a Hashmap as I wouldn't expect nor want the key to change. In the previous example if the players name changes he is no longer that player. However I can look a player up using the key change other fields that aren't the name and future lookups will work.
However in a Hashset since the entire object's hashcode is used to place the item if someone slightly changes an object future lookups of that object will no longer resolve to the same position in the Hashtable since it relies on the entire objects Hashcode. Does this mean that once data is in a Hashset it shouldnt be changed. Or does it need to be rehashed? or is it done automatically etc? What is going on? | 2012/11/01 | [
"https://Stackoverflow.com/questions/13177124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701264/"
] | In your example, the keys are String which are immutable. So the hashcode of the keys won't change. What happens when the hashcode of the keys changes is undefined and leads to "weird" behaviour. See the example below, which prints 1, false and 2. The object remains in the set, but the set looks like it is broken (contains returns false).
Extract from [Set's javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html):
>
> Note: Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set. A special case of this prohibition is that it is not permissible for a set to contain itself as an element.
>
>
>
```
public static void main(String args[]) {
Set<MyObject> set = new HashSet<>();
MyObject o1 = new MyObject(1);
set.add(o1);
o1.i = 2;
System.out.println(set.size()); //1
System.out.println(set.contains(o1)); //false
for (MyObject o : set) {
System.out.println(o.i); //2
}
}
private static class MyObject {
private int i;
public MyObject(int i) {
this.i = i;
}
@Override
public int hashCode() {
return i;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final MyObject other = (MyObject) obj;
if (this.i != other.i) return false;
return true;
}
}
``` | The `HashSet` is backed up by a `HashMap`.
From the **javadocs**.
>
> This class implements the Set interface, backed by a hash table
> (actually a HashMap instance).
>
>
>
So if you **change** the hashcode, I doubt whether you can access the object.
Internal Implementation Details
-------------------------------
The `add` implementation of `HashSet` is
```
public boolean add(E e) {
return map.put(e, PRESENT)==null;
}
```
The key is the elem and value is just a dummy Object called PRESENT
and the `contains` implementation is
```
public boolean contains(Object o) {
return map.containsKey(o);
}
``` |
13,177,124 | In a Hashmap the hash code of the key provided is used to place the value in the hashtable. In a Hashset the obects hashcode is used to place the value in the underlying hashtable. i.e the advantage of the hashmap is that you have the flexibility of deciding what you want as the key so you can do nice things like this.
```
Map<String,Player> players = new HashMap<String,Player>();
```
This can map a string such as the players name to a player itself.
My question is is what happens to to the lookup when the key's Hashcode changes.
This i expect isn't such a major concern for a Hashmap as I wouldn't expect nor want the key to change. In the previous example if the players name changes he is no longer that player. However I can look a player up using the key change other fields that aren't the name and future lookups will work.
However in a Hashset since the entire object's hashcode is used to place the item if someone slightly changes an object future lookups of that object will no longer resolve to the same position in the Hashtable since it relies on the entire objects Hashcode. Does this mean that once data is in a Hashset it shouldnt be changed. Or does it need to be rehashed? or is it done automatically etc? What is going on? | 2012/11/01 | [
"https://Stackoverflow.com/questions/13177124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701264/"
] | In your example, a String is immutable so its hashcode cannot change. But hypothetically, if the hashcode of an object did change while was a key in a hash table, then it would *probably disappear* as far as hashtable lookups were concerned. I went into more detail in this Answer to a related question: <https://stackoverflow.com/a/13114376/139985> . (The original question is about a `HashSet`, but a `HashSet` is really a `HashMap` under the covers, so the answer covers this case too.)
It is safe to say that if the keys of either a HashMap or a TreeMap are mutated in a way that affects their respective `hashcode()` / `equals(Object)` or `compare(...)` or `compareTo(...)` contracts, then the data structure will "break".
---
>
> Does this mean that once data is in a Hashset it shouldn't be changed.
>
>
>
Yes.
>
> Or does it need to be rehashed? or is it done automatically etc?
>
>
>
It won't be automatically rehashed. The `HashMap` won't notice that the hashcode of a key has changed. Indeed, you won't even get recomputation of the hashcode when the `HashMap` resizes. The data structure *remembers* the original hashcode value to avoid having to recalculate all of the hashcodes when the hash table resizes.
If you know that the hashcode of a key is going to change you need to remove the entry from the table BEFORE you mutate the key, and add it back afterwards. (If you try to `remove` / `put` it after mutating the key, the chances are that the `remove` will fail to find the entry.)
>
> What is going on?
>
>
>
What is going on is that you violated the contract. Don't do that!
The contract consists of two things:
1. The standard hashcode / equals contract as specified in the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html) for `Object`.
2. An additional constraint that an object's hashcode must not change while it is a key in a hash table.
The latter constraint is not stated specifically in the `HashMap` [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html), but the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html) for `Map` says this:
>
> *Note: great care must be exercised if mutable objects are used as map keys. The behavior of a map is not specified if the value of an object is changed in a manner that affects `equals` comparisons while the object is a key in the map.*
>
>
>
A change that affects equality (typically) also affects the hashcode. At the implementation level, if a `HashMap` entry's key's hashcode changes, the entry will typically *now* be in the wrong hash bucket and will be invisible to `HashMap` methods that perform lookups. | The `HashSet` is backed up by a `HashMap`.
From the **javadocs**.
>
> This class implements the Set interface, backed by a hash table
> (actually a HashMap instance).
>
>
>
So if you **change** the hashcode, I doubt whether you can access the object.
Internal Implementation Details
-------------------------------
The `add` implementation of `HashSet` is
```
public boolean add(E e) {
return map.put(e, PRESENT)==null;
}
```
The key is the elem and value is just a dummy Object called PRESENT
and the `contains` implementation is
```
public boolean contains(Object o) {
return map.containsKey(o);
}
``` |
13,177,124 | In a Hashmap the hash code of the key provided is used to place the value in the hashtable. In a Hashset the obects hashcode is used to place the value in the underlying hashtable. i.e the advantage of the hashmap is that you have the flexibility of deciding what you want as the key so you can do nice things like this.
```
Map<String,Player> players = new HashMap<String,Player>();
```
This can map a string such as the players name to a player itself.
My question is is what happens to to the lookup when the key's Hashcode changes.
This i expect isn't such a major concern for a Hashmap as I wouldn't expect nor want the key to change. In the previous example if the players name changes he is no longer that player. However I can look a player up using the key change other fields that aren't the name and future lookups will work.
However in a Hashset since the entire object's hashcode is used to place the item if someone slightly changes an object future lookups of that object will no longer resolve to the same position in the Hashtable since it relies on the entire objects Hashcode. Does this mean that once data is in a Hashset it shouldnt be changed. Or does it need to be rehashed? or is it done automatically etc? What is going on? | 2012/11/01 | [
"https://Stackoverflow.com/questions/13177124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701264/"
] | In your example, the keys are String which are immutable. So the hashcode of the keys won't change. What happens when the hashcode of the keys changes is undefined and leads to "weird" behaviour. See the example below, which prints 1, false and 2. The object remains in the set, but the set looks like it is broken (contains returns false).
Extract from [Set's javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html):
>
> Note: Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set. A special case of this prohibition is that it is not permissible for a set to contain itself as an element.
>
>
>
```
public static void main(String args[]) {
Set<MyObject> set = new HashSet<>();
MyObject o1 = new MyObject(1);
set.add(o1);
o1.i = 2;
System.out.println(set.size()); //1
System.out.println(set.contains(o1)); //false
for (MyObject o : set) {
System.out.println(o.i); //2
}
}
private static class MyObject {
private int i;
public MyObject(int i) {
this.i = i;
}
@Override
public int hashCode() {
return i;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final MyObject other = (MyObject) obj;
if (this.i != other.i) return false;
return true;
}
}
``` | With Java's hashes, the original reference is simply not found. It's searched in the bucket corresponding the current hashcode, and not found.
To recover from this after the fact, the Hash keySet must be iterated over, and and any key which is not found by `contains` method must be removed through the iterator. Preferable is to remove the key from the map, then store the value with new key. |
13,177,124 | In a Hashmap the hash code of the key provided is used to place the value in the hashtable. In a Hashset the obects hashcode is used to place the value in the underlying hashtable. i.e the advantage of the hashmap is that you have the flexibility of deciding what you want as the key so you can do nice things like this.
```
Map<String,Player> players = new HashMap<String,Player>();
```
This can map a string such as the players name to a player itself.
My question is is what happens to to the lookup when the key's Hashcode changes.
This i expect isn't such a major concern for a Hashmap as I wouldn't expect nor want the key to change. In the previous example if the players name changes he is no longer that player. However I can look a player up using the key change other fields that aren't the name and future lookups will work.
However in a Hashset since the entire object's hashcode is used to place the item if someone slightly changes an object future lookups of that object will no longer resolve to the same position in the Hashtable since it relies on the entire objects Hashcode. Does this mean that once data is in a Hashset it shouldnt be changed. Or does it need to be rehashed? or is it done automatically etc? What is going on? | 2012/11/01 | [
"https://Stackoverflow.com/questions/13177124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701264/"
] | In your example, a String is immutable so its hashcode cannot change. But hypothetically, if the hashcode of an object did change while was a key in a hash table, then it would *probably disappear* as far as hashtable lookups were concerned. I went into more detail in this Answer to a related question: <https://stackoverflow.com/a/13114376/139985> . (The original question is about a `HashSet`, but a `HashSet` is really a `HashMap` under the covers, so the answer covers this case too.)
It is safe to say that if the keys of either a HashMap or a TreeMap are mutated in a way that affects their respective `hashcode()` / `equals(Object)` or `compare(...)` or `compareTo(...)` contracts, then the data structure will "break".
---
>
> Does this mean that once data is in a Hashset it shouldn't be changed.
>
>
>
Yes.
>
> Or does it need to be rehashed? or is it done automatically etc?
>
>
>
It won't be automatically rehashed. The `HashMap` won't notice that the hashcode of a key has changed. Indeed, you won't even get recomputation of the hashcode when the `HashMap` resizes. The data structure *remembers* the original hashcode value to avoid having to recalculate all of the hashcodes when the hash table resizes.
If you know that the hashcode of a key is going to change you need to remove the entry from the table BEFORE you mutate the key, and add it back afterwards. (If you try to `remove` / `put` it after mutating the key, the chances are that the `remove` will fail to find the entry.)
>
> What is going on?
>
>
>
What is going on is that you violated the contract. Don't do that!
The contract consists of two things:
1. The standard hashcode / equals contract as specified in the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html) for `Object`.
2. An additional constraint that an object's hashcode must not change while it is a key in a hash table.
The latter constraint is not stated specifically in the `HashMap` [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html), but the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html) for `Map` says this:
>
> *Note: great care must be exercised if mutable objects are used as map keys. The behavior of a map is not specified if the value of an object is changed in a manner that affects `equals` comparisons while the object is a key in the map.*
>
>
>
A change that affects equality (typically) also affects the hashcode. At the implementation level, if a `HashMap` entry's key's hashcode changes, the entry will typically *now* be in the wrong hash bucket and will be invisible to `HashMap` methods that perform lookups. | In your example, the keys are String which are immutable. So the hashcode of the keys won't change. What happens when the hashcode of the keys changes is undefined and leads to "weird" behaviour. See the example below, which prints 1, false and 2. The object remains in the set, but the set looks like it is broken (contains returns false).
Extract from [Set's javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html):
>
> Note: Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set. A special case of this prohibition is that it is not permissible for a set to contain itself as an element.
>
>
>
```
public static void main(String args[]) {
Set<MyObject> set = new HashSet<>();
MyObject o1 = new MyObject(1);
set.add(o1);
o1.i = 2;
System.out.println(set.size()); //1
System.out.println(set.contains(o1)); //false
for (MyObject o : set) {
System.out.println(o.i); //2
}
}
private static class MyObject {
private int i;
public MyObject(int i) {
this.i = i;
}
@Override
public int hashCode() {
return i;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final MyObject other = (MyObject) obj;
if (this.i != other.i) return false;
return true;
}
}
``` |
13,177,124 | In a Hashmap the hash code of the key provided is used to place the value in the hashtable. In a Hashset the obects hashcode is used to place the value in the underlying hashtable. i.e the advantage of the hashmap is that you have the flexibility of deciding what you want as the key so you can do nice things like this.
```
Map<String,Player> players = new HashMap<String,Player>();
```
This can map a string such as the players name to a player itself.
My question is is what happens to to the lookup when the key's Hashcode changes.
This i expect isn't such a major concern for a Hashmap as I wouldn't expect nor want the key to change. In the previous example if the players name changes he is no longer that player. However I can look a player up using the key change other fields that aren't the name and future lookups will work.
However in a Hashset since the entire object's hashcode is used to place the item if someone slightly changes an object future lookups of that object will no longer resolve to the same position in the Hashtable since it relies on the entire objects Hashcode. Does this mean that once data is in a Hashset it shouldnt be changed. Or does it need to be rehashed? or is it done automatically etc? What is going on? | 2012/11/01 | [
"https://Stackoverflow.com/questions/13177124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701264/"
] | In your example, a String is immutable so its hashcode cannot change. But hypothetically, if the hashcode of an object did change while was a key in a hash table, then it would *probably disappear* as far as hashtable lookups were concerned. I went into more detail in this Answer to a related question: <https://stackoverflow.com/a/13114376/139985> . (The original question is about a `HashSet`, but a `HashSet` is really a `HashMap` under the covers, so the answer covers this case too.)
It is safe to say that if the keys of either a HashMap or a TreeMap are mutated in a way that affects their respective `hashcode()` / `equals(Object)` or `compare(...)` or `compareTo(...)` contracts, then the data structure will "break".
---
>
> Does this mean that once data is in a Hashset it shouldn't be changed.
>
>
>
Yes.
>
> Or does it need to be rehashed? or is it done automatically etc?
>
>
>
It won't be automatically rehashed. The `HashMap` won't notice that the hashcode of a key has changed. Indeed, you won't even get recomputation of the hashcode when the `HashMap` resizes. The data structure *remembers* the original hashcode value to avoid having to recalculate all of the hashcodes when the hash table resizes.
If you know that the hashcode of a key is going to change you need to remove the entry from the table BEFORE you mutate the key, and add it back afterwards. (If you try to `remove` / `put` it after mutating the key, the chances are that the `remove` will fail to find the entry.)
>
> What is going on?
>
>
>
What is going on is that you violated the contract. Don't do that!
The contract consists of two things:
1. The standard hashcode / equals contract as specified in the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html) for `Object`.
2. An additional constraint that an object's hashcode must not change while it is a key in a hash table.
The latter constraint is not stated specifically in the `HashMap` [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html), but the [javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html) for `Map` says this:
>
> *Note: great care must be exercised if mutable objects are used as map keys. The behavior of a map is not specified if the value of an object is changed in a manner that affects `equals` comparisons while the object is a key in the map.*
>
>
>
A change that affects equality (typically) also affects the hashcode. At the implementation level, if a `HashMap` entry's key's hashcode changes, the entry will typically *now* be in the wrong hash bucket and will be invisible to `HashMap` methods that perform lookups. | With Java's hashes, the original reference is simply not found. It's searched in the bucket corresponding the current hashcode, and not found.
To recover from this after the fact, the Hash keySet must be iterated over, and and any key which is not found by `contains` method must be removed through the iterator. Preferable is to remove the key from the map, then store the value with new key. |
1,780,461 | I have a shared library(.so) that I preload before executing an application and I have a few global data structures in the shared library that the application uses. The application can create other processes say using fork() and these processes can update the global data structures in the shared library. I would like to keep a consistent view of these global data structures across all the processes. Is there any way I can accomplish this in Linux?
I have tried using shm\_\* calls and mmap() to map the global data of the shared library to a shared segment but it does not work. | 2009/11/22 | [
"https://Stackoverflow.com/questions/1780461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/216682/"
] | To phrase this most clearly: you cannot do exactly what you asked. Linux does not support sharing of global variables that are laid out by the linker. That memory will be in unsharable mapped-to-swap space.
A general recipe I can offer is this:
1. define a struct that lays out your data. No Pointers! Just offsets.
2. first process creates a file in /tmp, sets access rw as needed. Open, mmap with MAP\_SHARED.
3. Subsequent processes also open, mmap with MAP\_SHARED.
4. everybody uses the struct to find the pieces they reference, read, or write.
5. Look Out For Concurrency!
If you really only care about a parent and it's forked children, you can use an anonymous mapping and not bother with the file, and you can store the location of the mapping in a global (which can be read in the children). | How about creating a simple pipe in a known directory location, then get other processes to fopen the pipe for reading/writing a la fread/fwrite respectively, to share data...the tricky part is ensuring that the data is passed through the pipe in a manner not to cause corruption in this case. The above you mentioned using shared memory shm\_ and mmap is tied to the process, when you fork code, that's no problem since the fork'd code is part of the original process! Hope this helps.
Best regards,
Tom. |
1,780,461 | I have a shared library(.so) that I preload before executing an application and I have a few global data structures in the shared library that the application uses. The application can create other processes say using fork() and these processes can update the global data structures in the shared library. I would like to keep a consistent view of these global data structures across all the processes. Is there any way I can accomplish this in Linux?
I have tried using shm\_\* calls and mmap() to map the global data of the shared library to a shared segment but it does not work. | 2009/11/22 | [
"https://Stackoverflow.com/questions/1780461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/216682/"
] | If you only want to share the data with and among descendent processes (and not with arbitrary processes that are started up seperately, that just happen to link to the same shared library), then the easiest way to do this is have the library create a mapping with `mmap()` in a constructor function (that is called when the library is initially loaded in the parent process).
Pass the `MAP_ANONYMOUS` and `MAP_SHARED` flags to `mmap` - this will mean that child processes that inherit the mapping will have a mapping that is shared with the parent (and the other children). The library should then store data structures to be shared within that mmaped memory segment (just as if it was memory returned from `malloc`). Obviously you may need some kind of locking.
Constructor functions for libraries can be indicated using the `gcc` `__constructor__` function attribute.
You don't need to worry about cleaning-up this kind of shared memory - when the last process with an anonymous mapping exits, the memory will be cleaned up. | How about creating a simple pipe in a known directory location, then get other processes to fopen the pipe for reading/writing a la fread/fwrite respectively, to share data...the tricky part is ensuring that the data is passed through the pipe in a manner not to cause corruption in this case. The above you mentioned using shared memory shm\_ and mmap is tied to the process, when you fork code, that's no problem since the fork'd code is part of the original process! Hope this helps.
Best regards,
Tom. |
1,780,461 | I have a shared library(.so) that I preload before executing an application and I have a few global data structures in the shared library that the application uses. The application can create other processes say using fork() and these processes can update the global data structures in the shared library. I would like to keep a consistent view of these global data structures across all the processes. Is there any way I can accomplish this in Linux?
I have tried using shm\_\* calls and mmap() to map the global data of the shared library to a shared segment but it does not work. | 2009/11/22 | [
"https://Stackoverflow.com/questions/1780461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/216682/"
] | To phrase this most clearly: you cannot do exactly what you asked. Linux does not support sharing of global variables that are laid out by the linker. That memory will be in unsharable mapped-to-swap space.
A general recipe I can offer is this:
1. define a struct that lays out your data. No Pointers! Just offsets.
2. first process creates a file in /tmp, sets access rw as needed. Open, mmap with MAP\_SHARED.
3. Subsequent processes also open, mmap with MAP\_SHARED.
4. everybody uses the struct to find the pieces they reference, read, or write.
5. Look Out For Concurrency!
If you really only care about a parent and it's forked children, you can use an anonymous mapping and not bother with the file, and you can store the location of the mapping in a global (which can be read in the children). | If you only want to share the data with and among descendent processes (and not with arbitrary processes that are started up seperately, that just happen to link to the same shared library), then the easiest way to do this is have the library create a mapping with `mmap()` in a constructor function (that is called when the library is initially loaded in the parent process).
Pass the `MAP_ANONYMOUS` and `MAP_SHARED` flags to `mmap` - this will mean that child processes that inherit the mapping will have a mapping that is shared with the parent (and the other children). The library should then store data structures to be shared within that mmaped memory segment (just as if it was memory returned from `malloc`). Obviously you may need some kind of locking.
Constructor functions for libraries can be indicated using the `gcc` `__constructor__` function attribute.
You don't need to worry about cleaning-up this kind of shared memory - when the last process with an anonymous mapping exits, the memory will be cleaned up. |
35,573 | I'm looking for all possible sources of clinically tested human SNPs. There is a handful of databases that store SNPs (like dbSNP), but I only need those that have validated presence/absence of phenotypic effects with some additional metadata. Thank you in advance. | 2015/06/27 | [
"https://biology.stackexchange.com/questions/35573",
"https://biology.stackexchange.com",
"https://biology.stackexchange.com/users/13338/"
] | You can search by traits (mostly diseases) for genome wide association, in these databases:
* [Gwasdb2](http://jjwanglab.org/gwasdb)
* [Human genome variation Database](https://gwas.biosciencedbc.jp/): it also links to a Copy number Variation (CNV) database. | Just to make this post a tiny bit more useful, I must add that there are several additional sources I've found:
* UniProt has an open dataset called `humsavar`
* ClinVar database
* HGMD database
* OMIM
* A [paper](http://www.ncbi.nlm.nih.gov/pubmed/25552646) with a manually collected database based on recent publications in Nature Genetics.
Different datasets intersect to some extent, but all in all you get over 200k somewhat validated SNPs. |
73,368,824 | `$ echo file.txt`
```
NAME="Ubuntu" <--- some of this
VERSION="20.04.4 LTS (Focal Fossa)" <--- and some of this
ID=ubuntu
ID_LIKE=debian
VERSION_ID="20.04"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
```
I want this: `Ubuntu 20.04.4 LTS`.
I managed with two commands:
```bash
echo "$(grep '^NAME="' ./file.txt | sed -E 's/NAME="(.*)"/\1/') $(grep '^VERSION="' ./file.txt | sed -E 's/VERSION="(.*) \(.*"/\1/')"
```
How could I simplify this to one command using grep/sed or perl? | 2022/08/16 | [
"https://Stackoverflow.com/questions/73368824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9971404/"
] | With your shown samples try following `awk` code.
```bash
awk -F'"' '/^NAME="/{name=$2;next} /^VERSION="/{print name,$2}' Input_file
```
***Explanation:***
* Setting field separator as `"` for all the lines here.
* Checking condition if line starts with `Name=` then create variable name which has 2nd field. `next` will skip all further statements from there of `awk` program, they needed not to be executed.
* Then checking if a line starts from `VERSION=` then print name and 2nd field here as per requirement. | Here is another `awk` solution:
```bash
awk -F '=?"' '$1 == "NAME" {s = $2; next}
$1 == "VERSION" {sub(/ \(.*/, "", $2); print s, $2}' file
Ubuntu 20.04.4 LTS
``` |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | This is simple math, the php code does exactly what it looks like it does. Am I missing something?
loop 1:
```
$i = 1
$s = 0 + (2*1 + 5) = 7
```
loop 2:
```
$i = 2
$s = 7 + (2*2 + 5) = 7 + 4 + 5 = 16
```
loop 3:
```
$i = 3
$s = 16 + (2*3 + 5) = 16 + 6 + 5 = 27
```
loop 4:
```
$i = 4
$s = 27 + (2*4 + 5) = 27 + 8 + 5 = 40
``` | N=2;
A=5;
X=3;
S=0;
```
for
I=1 => S (0) = 0 + (2*1+5) = 7
I=2 => S (7) = 7 + (2*2+5) = 16
I=3 => S (16) = 16 + (2*3+5) = 27
I=4 => S (27) = 27 (2*4+5) = 40
``` |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | its very simple, since i<=($n+2) the total iterations will be 4.
for first iteration,
```
$i=1 the value of s = 0+(2*1+5) = 7
$i=2 now s = 7+(2*2+5) = 16
$i=3 now s = 16+(2*3+5) = 27
$i=4 now s = 27+(2*4+5) = 40
```
Hope this explains. | N=2;
A=5;
X=3;
S=0;
```
for
I=1 => S (0) = 0 + (2*1+5) = 7
I=2 => S (7) = 7 + (2*2+5) = 16
I=3 => S (16) = 16 + (2*3+5) = 27
I=4 => S (27) = 27 (2*4+5) = 40
``` |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | This is simple math, the php code does exactly what it looks like it does. Am I missing something?
loop 1:
```
$i = 1
$s = 0 + (2*1 + 5) = 7
```
loop 2:
```
$i = 2
$s = 7 + (2*2 + 5) = 7 + 4 + 5 = 16
```
loop 3:
```
$i = 3
$s = 16 + (2*3 + 5) = 16 + 6 + 5 = 27
```
loop 4:
```
$i = 4
$s = 27 + (2*4 + 5) = 27 + 8 + 5 = 40
``` | Using pseudo code:
```
n = 2
a = 5
s = 0
for ( i in { 1...4 } ) {
s = s + ( ( 2 * i ) + 5 )
}
```
So we have
```
s = 0 + ( ( 2 * 1 ) + 5 ) = 0 + 7 = 7
s = 7 + ( ( 2 * 2 ) + 5 ) = 7 + 9 = 16
s = 16 + ( ( 2 * 3 ) + 5 ) = 16 + 11 = 27
s = 27 + ( ( 2 * 4 ) + 5 ) = 27 + 13 = 40
``` |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | its very simple, since i<=($n+2) the total iterations will be 4.
for first iteration,
```
$i=1 the value of s = 0+(2*1+5) = 7
$i=2 now s = 7+(2*2+5) = 16
$i=3 now s = 16+(2*3+5) = 27
$i=4 now s = 27+(2*4+5) = 40
```
Hope this explains. | Using pseudo code:
```
n = 2
a = 5
s = 0
for ( i in { 1...4 } ) {
s = s + ( ( 2 * i ) + 5 )
}
```
So we have
```
s = 0 + ( ( 2 * 1 ) + 5 ) = 0 + 7 = 7
s = 7 + ( ( 2 * 2 ) + 5 ) = 7 + 9 = 16
s = 16 + ( ( 2 * 3 ) + 5 ) = 16 + 11 = 27
s = 27 + ( ( 2 * 4 ) + 5 ) = 27 + 13 = 40
``` |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | This is simple math, the php code does exactly what it looks like it does. Am I missing something?
loop 1:
```
$i = 1
$s = 0 + (2*1 + 5) = 7
```
loop 2:
```
$i = 2
$s = 7 + (2*2 + 5) = 7 + 4 + 5 = 16
```
loop 3:
```
$i = 3
$s = 16 + (2*3 + 5) = 16 + 6 + 5 = 27
```
loop 4:
```
$i = 4
$s = 27 + (2*4 + 5) = 27 + 8 + 5 = 40
``` | This is simple math. s is the sum of for i from 1 to n+2 of 2i+a. This is equal to the twice sum of i plus the sum of a. The latter is clearly worth (n+2)a. The former is twice the sum of integers from 1 to n+2, i.e. 2 \* (n+2)(n+3)/2. The total is thus (n+2)(n+3) + (n+2)a = (n+2)(n+3+a) = (2+2)\*(2+3+5) = 4\*10 = 40. (Side effect: no need to have an explicit loop, just implement the above formula.) |
44,419,907 | I am trying to integrate a version/source control system with my unity project. [This answer](http://answers.unity3d.com/answers/1251608/view.html) directed me towards using source/version control. (I dont know the difference.)
The answer links to a tutorial which explains creating the repository and pushing it to a remote service. I followed the whole tutorial. But I still don't understand how this integrates with my current projects.
My question is that.
1. how can I do this locally
2. how will this make it possible to revert to previously-saved versions? | 2017/06/07 | [
"https://Stackoverflow.com/questions/44419907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5640537/"
] | its very simple, since i<=($n+2) the total iterations will be 4.
for first iteration,
```
$i=1 the value of s = 0+(2*1+5) = 7
$i=2 now s = 7+(2*2+5) = 16
$i=3 now s = 16+(2*3+5) = 27
$i=4 now s = 27+(2*4+5) = 40
```
Hope this explains. | This is simple math. s is the sum of for i from 1 to n+2 of 2i+a. This is equal to the twice sum of i plus the sum of a. The latter is clearly worth (n+2)a. The former is twice the sum of integers from 1 to n+2, i.e. 2 \* (n+2)(n+3)/2. The total is thus (n+2)(n+3) + (n+2)a = (n+2)(n+3+a) = (2+2)\*(2+3+5) = 4\*10 = 40. (Side effect: no need to have an explicit loop, just implement the above formula.) |
4,668,309 | I'm currently implementing a rather large interface and some of its methods are not applicable to the implementation.
Should I do something akin to:
```
/**
* @throws UnsupportedOperationException always. This method is not applicable.
*/
public void fooMethod() {
throw new UnsupportedOperationException("This method is not applicable for this implementation.");
}
```
or just silently ignore it, doing nothing:
```
public void fooMethod() {
}
```
The former way would alert a user of the class that it doesn't do a portion of what the interface provides, but might perhaps clash with legacy code where the class is used as a drop-in replacement (which it isn't, though).
Is there a general rule regarding this? | 2011/01/12 | [
"https://Stackoverflow.com/questions/4668309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73070/"
] | I think that simply depends on the contract defined by the method.
If for example "remove" is not supported by your "List" implementation, you should throw an exception to indicate that this behavior is missing because the client relies on an expected result.
If the feature is optional in the sense that the **contract** says for example "this method should inform the user about an ongoing activity" you're free to make a dummy implementation. | Throw an `UnsupportedOperationException`, definitely. I can't see any benefit in failing silently, unless the method is meant to be a "hint" sort of method.
If you can refactor your interface and split it up a bit, that would probably be cleaner - but I understand that with a legacy codebase this may not be feasible. |
4,668,309 | I'm currently implementing a rather large interface and some of its methods are not applicable to the implementation.
Should I do something akin to:
```
/**
* @throws UnsupportedOperationException always. This method is not applicable.
*/
public void fooMethod() {
throw new UnsupportedOperationException("This method is not applicable for this implementation.");
}
```
or just silently ignore it, doing nothing:
```
public void fooMethod() {
}
```
The former way would alert a user of the class that it doesn't do a portion of what the interface provides, but might perhaps clash with legacy code where the class is used as a drop-in replacement (which it isn't, though).
Is there a general rule regarding this? | 2011/01/12 | [
"https://Stackoverflow.com/questions/4668309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73070/"
] | Throw an `UnsupportedOperationException`, definitely. I can't see any benefit in failing silently, unless the method is meant to be a "hint" sort of method.
If you can refactor your interface and split it up a bit, that would probably be cleaner - but I understand that with a legacy codebase this may not be feasible. | UnsupportedOperationException is better. Otherwise client code cannot distinguish the method is availble or not. |
4,668,309 | I'm currently implementing a rather large interface and some of its methods are not applicable to the implementation.
Should I do something akin to:
```
/**
* @throws UnsupportedOperationException always. This method is not applicable.
*/
public void fooMethod() {
throw new UnsupportedOperationException("This method is not applicable for this implementation.");
}
```
or just silently ignore it, doing nothing:
```
public void fooMethod() {
}
```
The former way would alert a user of the class that it doesn't do a portion of what the interface provides, but might perhaps clash with legacy code where the class is used as a drop-in replacement (which it isn't, though).
Is there a general rule regarding this? | 2011/01/12 | [
"https://Stackoverflow.com/questions/4668309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73070/"
] | I think that simply depends on the contract defined by the method.
If for example "remove" is not supported by your "List" implementation, you should throw an exception to indicate that this behavior is missing because the client relies on an expected result.
If the feature is optional in the sense that the **contract** says for example "this method should inform the user about an ongoing activity" you're free to make a dummy implementation. | UnsupportedOperationException is better. Otherwise client code cannot distinguish the method is availble or not. |
1,745,183 | >
> I want to show that the ideals $(x,y)$ and $(2,x,y)$ of $\mathbb{Z}[x,y]$ are prime ideals.
>
>
>
---
Could you give some hints how we could do that?
Do we have to show that $\mathbb{Z}[x,y]/(x,y)$ and $\mathbb{Z}[x,y]/(2,x,y)$ are integral domains?
How could we do that? Could you give me a hint?
$$$$
**EDIT:**
Do we have that $\phi :\mathbb{Z}[x,y]\rightarrow \mathbb{Z}$ is an homomorphism because of the following? $$$$ Let $f(x,y)\in \mathbb{Z}[x,y]$, then $f(x,y)=\sum\_{j=0}^m\sum\_{i=0}^{n(j)}\alpha\_ix^iy^j$. We have that $$f\_1(x,y)+f\_2(x,y)=\sum\_{j=0}^{m\_1}\sum\_{i=0}^{n\_1(j)}\gamma\_ix^iy^j+\sum\_{j=0}^{m\_2}\sum\_{i=0}^{n\_2(j)}\beta\_ix^iy^j=:\sum\_{j=0}^m\sum\_{i=0}^{n(j)}\alpha\_ix^iy^j=:f(x,y)$$ Then $$\phi (f\_1(x,y)+f\_2(x,y))=\phi (f(x,y))=f(0,0)=f\_1(0,0)+f\_2(0,0)=\phi (f\_1(x,y))+\phi (f\_2(x,y))$$ We also have that $$f\_1(x,y)\cdot f\_2(x,y)=\left (\sum\_{j=0}^{m\_1}\sum\_{i=0}^{n\_1(j)}\gamma\_ix^iy^j\right )\cdot \left (\sum\_{j=0}^{m\_2}\sum\_{i=0}^{n\_2(j)}\beta\_ix^iy^j\right )=:\sum\_{j=0}^m\sum\_{i=0}^{n(j)}\alpha\_ix^iy^j=:f(x,y)$$ Then $$\phi (f\_1(x,y)\cdot f\_2(x,y))=\phi (f(x,y))=f(0,0)=f\_1(0,0)\cdot f\_2(0,0)=\phi (f\_1(x,y))\cdot \phi (f\_2(x,y))$$ | 2016/04/16 | [
"https://math.stackexchange.com/questions/1745183",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80708/"
] | Show that $\mathbb{Z}[x,y]/(x,y)$ is isomorphic to $\mathbb{Z}$ using the evaluation map at $0$ and $\mathbb{Z}[x,y]/(2,x,y)$ is isomorphic $\mathbb{Z}/2\mathbb{Z}$ by reducing the coefficents of the polynomial modulo $2$. In both cases consider the kernel of the map and use the first isomorphism theorem. | The first isomorphism is proved by observing that any polynomial in $\mathbb{Z}[x,y]$ can be written as a sum of a constant term, terms involving nontrivial powers of $x$, and terms involving nontrivial powers of $y$. More explicitly, the ideal $(x,y)$ has all polynomials with constant term $0$, i.e., if $f \in (x,y)$ then there exist $p,q \in \mathbb{Z}[x,y]$ such that $f(x,y) = xp(x,y) + yq(x,y)$. Now we note that if $f(x,y)$ is an arbitrary polynomial in $\mathbb{Z}[x,y]$ then we can write it as
$$ f(x,y) = a\_0 + xp(x,y) + yq(x,y)$$
for some $a\_0 \in \mathbb{Z}$ and some $p(x,y), q(x,y) \in \mathbb{Z}[x,y]$. In the quotient mapping $\mathbb{Z}[x,y] \to \mathbb{Z}[x,y]/(x,y)$ the polynomials $xp(x,y) + yq(x,y)$ get sent to zero. Consequently the identification
$$ f(x,y) \mod{(x,y)}= a\_0 + xp(x,y) + yq(x,y) \mod{(x,y)} \equiv a\_0 \mod{(x,y)}$$
induces an isomorphism $\mathbb{Z}[x,y]/(x,y) \cong \mathbb{Z}$ via the mapping $a\_0 + (x,y) \mapsto a\_0$ for all $a\_0 \in \mathbb{Z}$.
For the second isomorphism consider the following isomorphisms for (commutative) rings: if $R$ is a ring and $(a) \subseteq R$ is a principal ideal generated by $a \in R$, then there are isomorphisms
$$ (R/(a))[x,y] \cong R[x,y]/(a)$$
so if $p\_1, \cdots, p\_n$ are any number of polynomials of $R[x,y]$ then
$$ \frac{(R/(a))[x,y]}{(p\_1, \cdots, p\_n)} \cong \frac{R[x,y]}{(a,p\_1,\cdots,p\_n)}\cong \frac{R[x,y]/(p\_1,\cdots,p\_n)}{(a)}.$$
Since we already know $\mathbb{Z}[x,y]/(x,y) \cong \mathbb{Z}$, we have
$$ \frac{\mathbb{Z}[x,y]}{(2,x,y)} \cong \frac{\mathbb{Z}[x,y]/(x,y)}{(2)} \cong \frac{\mathbb{Z}}{(2)} = \frac{\mathbb{Z}}{2\mathbb{Z}}.$$ |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | Or use `\hphantom{{}={}}`:
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```

A better option would be to indent successive lines of an expression that breaks across lines, so it becomes clear that it's the continuation of a previous expression; something like
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}}\quad\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
 | use `\mathrel{...}`
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\mathrel{\hphantom{=}}\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
``` |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | use `\mathrel{...}`
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\mathrel{\hphantom{=}}\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
``` | I typically use
```
\begin{align}
... = {} & ... \\
= {} & ... \\
& ...
\end{align}
```
note the set of `{}` between the `=` and the `&` a lot faster to type than `\phantom` and friends |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | use `\mathrel{...}`
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\mathrel{\hphantom{=}}\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
``` | You don't need all the packages loaded; [`amsmath`](http://www.ctan.org/pkg/amsmath) is enough:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\sum_{i}c_{i}
&= \cos\sin\cos\sin\cos\sin\cos\sin\cos\sin\\
\sum_{i}c_{i}
&= \delta\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\\
&\hphantom{{}={}} \delta^{2}\sin\cos\cos\sin\cos\sin\cos\cos
\end{align}
\end{document}
```
 |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | Or use `\hphantom{{}={}}`:
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```

A better option would be to indent successive lines of an expression that breaks across lines, so it becomes clear that it's the continuation of a previous expression; something like
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}}\quad\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
 | I typically use
```
\begin{align}
... = {} & ... \\
= {} & ... \\
& ...
\end{align}
```
note the set of `{}` between the `=` and the `&` a lot faster to type than `\phantom` and friends |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | Or use `\hphantom{{}={}}`:
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```

A better option would be to indent successive lines of an expression that breaks across lines, so it becomes clear that it's the continuation of a previous expression; something like
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}={}}\quad\delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
 | You don't need all the packages loaded; [`amsmath`](http://www.ctan.org/pkg/amsmath) is enough:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\sum_{i}c_{i}
&= \cos\sin\cos\sin\cos\sin\cos\sin\cos\sin\\
\sum_{i}c_{i}
&= \delta\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\\
&\hphantom{{}={}} \delta^{2}\sin\cos\cos\sin\cos\sin\cos\cos
\end{align}
\end{document}
```
 |
160,890 | I have the following MWE
```
\documentclass[10pt, a4paper]{article}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}
\begin{document}
\begin{align}
\sum_i{ c_i} &= \cos \sin\cos \sin\cos \sin\cos \sin\cos \sin \\
\sum_i{ c_i} &= \delta \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \sin\cos \cos \sin\cos \\
&\hphantom{{}=} \delta^2\sin\cos \cos \sin\cos \sin\cos \cos
\end{align}
\end{document}
```
How do I align the last equation with the two above it? I have previously had success with `phantom`, but doesn't work here. | 2014/02/17 | [
"https://tex.stackexchange.com/questions/160890",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19396/"
] | I typically use
```
\begin{align}
... = {} & ... \\
= {} & ... \\
& ...
\end{align}
```
note the set of `{}` between the `=` and the `&` a lot faster to type than `\phantom` and friends | You don't need all the packages loaded; [`amsmath`](http://www.ctan.org/pkg/amsmath) is enough:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\sum_{i}c_{i}
&= \cos\sin\cos\sin\cos\sin\cos\sin\cos\sin\\
\sum_{i}c_{i}
&= \delta\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\sin\cos\cos\sin\cos\\
&\hphantom{{}={}} \delta^{2}\sin\cos\cos\sin\cos\sin\cos\cos
\end{align}
\end{document}
```
 |
30,341,842 | In this program I try to get data from SQL into a list of strings and show them in a `messageBox`. The program should start searching when I type one character in `textBox` and use this in the query as below:
```
string sql = " SELECT * FROM general WHERE element='" + textBox1.Text + "' OR element='" + textBox2.Text + "' OR element='" + textBox3.Text + "' OR element='" + textBox4.Text + "'";
MySqlConnection con = new MySqlConnection("host=localhost;user=mate;password=1234;database=element_database");
MySqlCommand cmd = new MySqlCommand(sql, con);
con.Open();
MySqlDataReader reader = cmd.ExecuteReader();
string rd;
rd = reader.ToString();
int i=0;
List<string> item = new List<string>();
while (reader.Read())
{
item.Add(rd["element"].ToString());//i got error in this line
}
for (i = 0; i < item.Count;i++ )
{
MessageBox.Show(item[i]);
}
```
What am I doing wrong? | 2015/05/20 | [
"https://Stackoverflow.com/questions/30341842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4909030/"
] | What are you doing wrong? a bunch of things:
In your question you write you gen an error but don't tell us what it is.
Exceptions has messages for a reason: so that you will be able to know what went wrong.
As to your code:
* You are concatenating values into your select statement instead of using [parameterized queries.](https://msdn.microsoft.com/en-us/library/vstudio/bb738521(v=vs.100).aspx) This creates an opening for [sql injection attacks.](https://xkcd.com/327/)
* You are using an `SqlConnection` outside of a `using` statement.
You should always use the `using` statement when dealing with `IDisposable` objects.
* You assume that `rd["element"]` always have a value.
If it returns as `null` from the database, you will get a null reference exception when using .ToString() on it. The proper way is to put it's value into a local variable and check if this variable is not null before using the `.ToString()` method.
* You are using `rd` instead of `reader` in your code. the `rd` variable is meaningless, as it only contain the string representation of `MySqlDataReader` object. | You have declared `rd` as string. You probably meant to use the reader object in this loop instead:
```
while (reader.Read())
{
item.Add(reader["element"].ToString());// change "rd" to "reader"
}
``` |
30,341,842 | In this program I try to get data from SQL into a list of strings and show them in a `messageBox`. The program should start searching when I type one character in `textBox` and use this in the query as below:
```
string sql = " SELECT * FROM general WHERE element='" + textBox1.Text + "' OR element='" + textBox2.Text + "' OR element='" + textBox3.Text + "' OR element='" + textBox4.Text + "'";
MySqlConnection con = new MySqlConnection("host=localhost;user=mate;password=1234;database=element_database");
MySqlCommand cmd = new MySqlCommand(sql, con);
con.Open();
MySqlDataReader reader = cmd.ExecuteReader();
string rd;
rd = reader.ToString();
int i=0;
List<string> item = new List<string>();
while (reader.Read())
{
item.Add(rd["element"].ToString());//i got error in this line
}
for (i = 0; i < item.Count;i++ )
{
MessageBox.Show(item[i]);
}
```
What am I doing wrong? | 2015/05/20 | [
"https://Stackoverflow.com/questions/30341842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4909030/"
] | What are you doing wrong? a bunch of things:
In your question you write you gen an error but don't tell us what it is.
Exceptions has messages for a reason: so that you will be able to know what went wrong.
As to your code:
* You are concatenating values into your select statement instead of using [parameterized queries.](https://msdn.microsoft.com/en-us/library/vstudio/bb738521(v=vs.100).aspx) This creates an opening for [sql injection attacks.](https://xkcd.com/327/)
* You are using an `SqlConnection` outside of a `using` statement.
You should always use the `using` statement when dealing with `IDisposable` objects.
* You assume that `rd["element"]` always have a value.
If it returns as `null` from the database, you will get a null reference exception when using .ToString() on it. The proper way is to put it's value into a local variable and check if this variable is not null before using the `.ToString()` method.
* You are using `rd` instead of `reader` in your code. the `rd` variable is meaningless, as it only contain the string representation of `MySqlDataReader` object. | I took the liberty of modifing the SQL to use an IN instead of multiple or statements as well as including the use of parameter into the query and not a string based approach. This should solve your problems.
```
string elem1 = "@elem1";
string elem2 = "@elem2";
string elem3 = "@elem3";
string elem4 = "@elem4";
List<string> parameters = new List<string>{ elem1, elem2, elem3, elem4 };
string sql = string.Format(" SELECT * FROM general WHERE element IN ({0})", string.Join(',', parameters.ToArray()));
using(MySqlConnection con = new MySqlConnection("host=localhost;user=mate;password=1234;database=element_database"))
{
con.Open();
MySqlCommand cmd = new MySqlCommand(sql, con);
cmd.Parameters.AddWithValue(elem1, textBox1.Text);
cmd.Parameters.AddWithValue(elem2, textBox2.Text);
cmd.Parameters.AddWithValue(elem3, textBox3.Text);
cmd.Parameters.AddWithValue(elem4, textBox4.Text);
MySqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string message = reader["element"] as string;
if(!string.IsNullOrEmpty(message))
{
MessageBox.Show(message);
}
}
}
``` |
23,408,853 | My program is running fine when i run it on VS with my own 'main()' function but i have to submit this where main is hidden from me I only know that it will pass arguements to my functions and check their return result. But it is giving segmentation fault error when I try to use arguement passed to my function.
Here is the code:
```
//I don't know what 'main' is passing to this function
string ExpressionManager::infixToPostfix(string infixExpression)
{
cout<<infixExpression<<endl; // first it was giving error on below 'if' condition,
//now i have written this statement it prints nothing but gives
//Segmentation Fault (core dumped) error here
cout<<"Hey"<<endl //it doesn't print this line
if( infixExpression[0] == '\0' )
{
return "";
}
int size = infixExpression.length();
if(!isValidInfixExpression(infixExpression))
return "Invalid Expression";
...
//some code here
}
```
Can Anyone Elaborate when string class behave this way? | 2014/05/01 | [
"https://Stackoverflow.com/questions/23408853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3592832/"
] | Shouldn't it be?
```
var d = value.FirstOrDefault(x => String.Equals(x.Culture, Thread.CurrentThread.CurrentCulture.Name, StringComparison.InvariantCultureIgnoreCase));
``` | Your issue is here:
```
var d ... x.Culture == Thread.CurrentThread.CurrentCulture.Name
```
This evaluates to `true`, so `string.Equals` where it is used yields unexpected results.
So the right code:
```
var d = value.FirstOrDefault(x => String.Equals(x.Culture, Thread.CurrentThread.CurrentCulture.Name, StringComparison.InvariantCultureIgnoreCase));
``` |
4,029 | I plan to ask about how to restore some defunct human genes. The GULO pseudo gene is the first one I am going to ask about. Should the question maybe be split into several question? The intended question is as follows.
A lot of base pairs in the defunct GULO pseudo gene in humans are missing to make a functional enzyme.
Should we take a whole gene from a close relative like a strepsirrhine, or maybe just fill in what is missing based on what?
Which cells should be transfected/infected and how?
Where should the working gene be put in the genome? Should the defunct gene be kept or replaced?
Transcription levels for the GULO pseudo gene are too low to make enough enzymes to increase ascorbate levels above levels achievable by consumption. How can that be increased?
I am not asking if this is beneficial or not nor about regulatory or ethical questions. Such questions are also meaningful but should be discussed in other questions. | 2020/01/10 | [
"https://biology.meta.stackexchange.com/questions/4029",
"https://biology.meta.stackexchange.com",
"https://biology.meta.stackexchange.com/users/11654/"
] | **NO: we should stick to the current threshold of 5.**
I have noticed wayy too many circumstances in which a question was being voted to be closed by 2-3 users *inappropriately* (i.e., the close votes were unfounded/not supported or the wrong close reason was chosen). Reasons for these inappropriate VTCs range from novice voters, rushed voting, malicious voting, and difference of opinion. By reducing the close-vote requirement, we will undoubtedly close more questions that do not fit the description for being closed.
We have two current problems on this SE site: (1) lack of review tasks being performed by current community members, and (2) decline in engaged users (+ an overall drop in visits overall!). I think this current VTC proposal is indirectly trying to account for these issues.
* A 3rd issue is that the overall quality of posts has declined sharply in the last 2-3 years. I (among others) still hold posts to a higher standard based on older expectations of this community (i.e., one *for scientists*). Truthfully, the community has shifted much more toward consisting of novices and students here asking simple questions. At some point, our expectations just can't outweigh the masses asking the questions... [I digress...]
However, I don't think the close-vote proposal will have the intended effect. The root of our problem is community engagement. By changing the VCT threshold we would not be changing that engagement level. Instead, we would be allowing decisions for the whole community to be made by an [even fewer] select active individuals.
In summary:
We have a community engagement problem on Bio.SE (perhaps an irreversible one), but I don't think the current proposal will fix that root issue. Instead, such a proposal will just give more closing power to the select individuals (<1% I'm sure of all users) who do vote. I'm afraid that such "power" would come off as a form of elitism as it does on some other SE sites, and may even result in a further decline in community engagement. | **Yes: we should try a reduced threshold of 3 votes**
In the last moderator election, one of the questions was about moderator use of the unilateral close vote. I think the general consensus has been that it's best to let the community handle whatever is possible for the community to handle, and yet sometimes the moderators have to step in to prevent an accumulation of questions that linger in the queue without a full 5 votes and either time out or attract poor answers.
It seems to me like changing the threshold would help a lot here - I would certainly drastically reduce my own use of the close-vote if the threshold were changed.
(see also [New moderators, please be more reserved with your close hammer](https://biology.meta.stackexchange.com/questions/3930/new-moderators-please-be-more-reserved-with-your-close-hammer) and especially AliceD's speculation about discouragement among voters in the community) |
4,029 | I plan to ask about how to restore some defunct human genes. The GULO pseudo gene is the first one I am going to ask about. Should the question maybe be split into several question? The intended question is as follows.
A lot of base pairs in the defunct GULO pseudo gene in humans are missing to make a functional enzyme.
Should we take a whole gene from a close relative like a strepsirrhine, or maybe just fill in what is missing based on what?
Which cells should be transfected/infected and how?
Where should the working gene be put in the genome? Should the defunct gene be kept or replaced?
Transcription levels for the GULO pseudo gene are too low to make enough enzymes to increase ascorbate levels above levels achievable by consumption. How can that be increased?
I am not asking if this is beneficial or not nor about regulatory or ethical questions. Such questions are also meaningful but should be discussed in other questions. | 2020/01/10 | [
"https://biology.meta.stackexchange.com/questions/4029",
"https://biology.meta.stackexchange.com",
"https://biology.meta.stackexchange.com/users/11654/"
] | UPDATED ANSWER -- 2 years later (May 2021):
Dropping vote-to-close thresholds has been a topic discussed across many SE sites for years. As of May 2021, there's now a formal effort to test minimizing the threshold to 3 votes across the SE network. The 45-day 3-vote test will occur on 13 sites (Not Biology) throughout May and June 2021. We'll await the results and future updates...
Here is the META post about this test:
[Testing three-vote close and reopen on 13 network sites](https://meta.stackexchange.com/q/364007/309922) | **Yes: we should try a reduced threshold of 3 votes**
In the last moderator election, one of the questions was about moderator use of the unilateral close vote. I think the general consensus has been that it's best to let the community handle whatever is possible for the community to handle, and yet sometimes the moderators have to step in to prevent an accumulation of questions that linger in the queue without a full 5 votes and either time out or attract poor answers.
It seems to me like changing the threshold would help a lot here - I would certainly drastically reduce my own use of the close-vote if the threshold were changed.
(see also [New moderators, please be more reserved with your close hammer](https://biology.meta.stackexchange.com/questions/3930/new-moderators-please-be-more-reserved-with-your-close-hammer) and especially AliceD's speculation about discouragement among voters in the community) |
4,029 | I plan to ask about how to restore some defunct human genes. The GULO pseudo gene is the first one I am going to ask about. Should the question maybe be split into several question? The intended question is as follows.
A lot of base pairs in the defunct GULO pseudo gene in humans are missing to make a functional enzyme.
Should we take a whole gene from a close relative like a strepsirrhine, or maybe just fill in what is missing based on what?
Which cells should be transfected/infected and how?
Where should the working gene be put in the genome? Should the defunct gene be kept or replaced?
Transcription levels for the GULO pseudo gene are too low to make enough enzymes to increase ascorbate levels above levels achievable by consumption. How can that be increased?
I am not asking if this is beneficial or not nor about regulatory or ethical questions. Such questions are also meaningful but should be discussed in other questions. | 2020/01/10 | [
"https://biology.meta.stackexchange.com/questions/4029",
"https://biology.meta.stackexchange.com",
"https://biology.meta.stackexchange.com/users/11654/"
] | **NO: we should stick to the current threshold of 5.**
I have noticed wayy too many circumstances in which a question was being voted to be closed by 2-3 users *inappropriately* (i.e., the close votes were unfounded/not supported or the wrong close reason was chosen). Reasons for these inappropriate VTCs range from novice voters, rushed voting, malicious voting, and difference of opinion. By reducing the close-vote requirement, we will undoubtedly close more questions that do not fit the description for being closed.
We have two current problems on this SE site: (1) lack of review tasks being performed by current community members, and (2) decline in engaged users (+ an overall drop in visits overall!). I think this current VTC proposal is indirectly trying to account for these issues.
* A 3rd issue is that the overall quality of posts has declined sharply in the last 2-3 years. I (among others) still hold posts to a higher standard based on older expectations of this community (i.e., one *for scientists*). Truthfully, the community has shifted much more toward consisting of novices and students here asking simple questions. At some point, our expectations just can't outweigh the masses asking the questions... [I digress...]
However, I don't think the close-vote proposal will have the intended effect. The root of our problem is community engagement. By changing the VCT threshold we would not be changing that engagement level. Instead, we would be allowing decisions for the whole community to be made by an [even fewer] select active individuals.
In summary:
We have a community engagement problem on Bio.SE (perhaps an irreversible one), but I don't think the current proposal will fix that root issue. Instead, such a proposal will just give more closing power to the select individuals (<1% I'm sure of all users) who do vote. I'm afraid that such "power" would come off as a form of elitism as it does on some other SE sites, and may even result in a further decline in community engagement. | This answer is in the nature of a reflection, with a suggestion that we try to accumulate more information on which to make a decision. To provide a one-liner:
**We should determine how difficult it is to find 5 votes to close an off-topic question on SE Biology, and drop the requirement to 3 votes if the barrier is too high.**
We are scientists. We are used to taking decisions based on evidence, but at the moment I think there is insufficient to do so. I wonder whether there may be, on average, too few people who have enough privilege to vote to close that actually view most questions. But I don’t know. So,
* What proportion of questions are viewed by fewer than 100 people?
* How many of the viewers of such questions have the 3000 reputation needed to vote to close?
* Of the questions that are closed, how many are done without a moderator short-circuiting the closure procedure?
* What are the numbers like if you take out the obvious personal medical and spam questions?
It strikes me the only people likely to have any of this info are the mods. Looking at the users who have increased their reputation this year (as a surrogate for activity) I would estimate that not more than 20 have enough reputation to vote to close. Given that people have interests in different biological fields — I never look at natural history questions or those on physiology — this seems quite low, and is possibly the reason that, in my opinion, a lot of poor questions do not get winnowed out. |
4,029 | I plan to ask about how to restore some defunct human genes. The GULO pseudo gene is the first one I am going to ask about. Should the question maybe be split into several question? The intended question is as follows.
A lot of base pairs in the defunct GULO pseudo gene in humans are missing to make a functional enzyme.
Should we take a whole gene from a close relative like a strepsirrhine, or maybe just fill in what is missing based on what?
Which cells should be transfected/infected and how?
Where should the working gene be put in the genome? Should the defunct gene be kept or replaced?
Transcription levels for the GULO pseudo gene are too low to make enough enzymes to increase ascorbate levels above levels achievable by consumption. How can that be increased?
I am not asking if this is beneficial or not nor about regulatory or ethical questions. Such questions are also meaningful but should be discussed in other questions. | 2020/01/10 | [
"https://biology.meta.stackexchange.com/questions/4029",
"https://biology.meta.stackexchange.com",
"https://biology.meta.stackexchange.com/users/11654/"
] | UPDATED ANSWER -- 2 years later (May 2021):
Dropping vote-to-close thresholds has been a topic discussed across many SE sites for years. As of May 2021, there's now a formal effort to test minimizing the threshold to 3 votes across the SE network. The 45-day 3-vote test will occur on 13 sites (Not Biology) throughout May and June 2021. We'll await the results and future updates...
Here is the META post about this test:
[Testing three-vote close and reopen on 13 network sites](https://meta.stackexchange.com/q/364007/309922) | This answer is in the nature of a reflection, with a suggestion that we try to accumulate more information on which to make a decision. To provide a one-liner:
**We should determine how difficult it is to find 5 votes to close an off-topic question on SE Biology, and drop the requirement to 3 votes if the barrier is too high.**
We are scientists. We are used to taking decisions based on evidence, but at the moment I think there is insufficient to do so. I wonder whether there may be, on average, too few people who have enough privilege to vote to close that actually view most questions. But I don’t know. So,
* What proportion of questions are viewed by fewer than 100 people?
* How many of the viewers of such questions have the 3000 reputation needed to vote to close?
* Of the questions that are closed, how many are done without a moderator short-circuiting the closure procedure?
* What are the numbers like if you take out the obvious personal medical and spam questions?
It strikes me the only people likely to have any of this info are the mods. Looking at the users who have increased their reputation this year (as a surrogate for activity) I would estimate that not more than 20 have enough reputation to vote to close. Given that people have interests in different biological fields — I never look at natural history questions or those on physiology — this seems quite low, and is possibly the reason that, in my opinion, a lot of poor questions do not get winnowed out. |
18,771,268 | I'm having trouble with 1 line of code I've run it over and over again but I don't know what I'm doing wrong, I'm thinking it's the `if` statement but I'm not sure. The line I'm having trouble with is in the comment. I don't know how to write it so it works properly.
```
import random
print"Hello hero, you are surrounded by a horde of orcs"
print"that span as far as the eye can see"
print"you have 5 health potions, 200 health"
print"you can either fight, run, or potion"
h=200 #health
w=0 #wave
o=0 #orc
p=5 #potion
while h>=0:
print"you run into a horde of orcs what will you do?"
a=raw_input("fight, run, potion")
if a=="fight":
print"you draw your sword and begin to fight"
d=random.randint(1, 20)
w+=1
o+=1
p=5
h-=d
print"you survive this horde"
print("you have, "+str(h)+" health left")
elif a=="potion":
print"you have used a potion"
h+=20
p=p-1
print"you have recovered 20 health"
print("you now have, "+str(h)+" health")
if p==0: #supposed to be if potion = 0 print (you dont have any left)
print"you dont have any left"
elif a=="run":
h-=5
print"you got away but suffered 5 damage"
print("you have, "+str(h)+" health left")
print"you have fought well but alas hero you were defeated"
print("you survived, "+str(w)+" waves and have killed, "+str(o)+" orcs")
``` | 2013/09/12 | [
"https://Stackoverflow.com/questions/18771268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2423223/"
] | I think you want to test if you have any potions before you award the benefits of using one. Like this:
```
elif a=="potion":
if p==0: #supposed to be if potion = 0 print (you dont have any left)
print"you dont have any left"
else:
print "you have used a potion"
h+=20
p=p-1
print "you have recovered 20 health"
print "you now have, "+str(h)+" health"
```
Also you have a lot of little things related to how you are using print that you should sort out, here is a cleaned up version of your original Python script (which I tested, and it appears to work, good luck with your game :)
```
import random
print "Hello hero, you are surrounded by a horde of orcs"
print "that span as far as the eye can see"
print "you have 5 health potions, 200 health"
print "you can either fight, run, or potion"
h=200 #health
w=0 #wave
o=0 #orc
p=5 #potion
while h>=0:
print "you run into a horde of orcs what will you do?"
a=raw_input("fight, run, potion")
if a=="fight":
print "you draw your sword and begin to fight"
d=random.randint(1, 20)
w+=1
o+=1
p=5
h-=d
print "you survive this horde"
print "you have, "+str(h)+" health left"
elif a=="potion":
if p==0: #supposed to be if potion = 0 print (you dont have any left)
print "you dont have any left"
else:
print "you have used a potion"
h+=20
p=p-1
print "you have recovered 20 health"
print "you now have, "+str(h)+" health"
elif a=="run":
h-=5
print "you got away but suffered 5 damage"
print "you have, "+str(h)+" health left"
print "you have fought well but alas hero you were defeated"
print "you survived, "+str(w)+" waves and have killed, "+str(o)+" orcs"
``` | here's what you should add to your code:
```
elif a=="potion":
if p>0:
print"you have used a potion"
h+=20
p=p-1
print"you have recovered 20 health"
print("you now have, "+str(h)+" health")
else: #supposed to be if potion = 0 print (you dont have any left)
print"you dont have any potion left"
continue
``` |
3,146,767 | I know that if we have $3$ points $a$, $b$,and $c$ in $\mathbb R^3$, the area of the triangle is given by: $\frac{1}{2}\|\vec{ab}\times \vec{ac}\|$.
This means that the area of the triangle equals half the length of the normal of the plane on which the triangle lays.
I don't quite understand how this can be. What other geometrical interpretation can be made of $\frac{1}{2}\|\vec{ab}\times \vec{ac}\|$?
[](https://i.stack.imgur.com/i3oah.jpg) | 2019/03/13 | [
"https://math.stackexchange.com/questions/3146767",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/649007/"
] | The [geometric interpretation](https://en.wikipedia.org/wiki/Cross_product#Geometric_meaning) of the magnitude of the cross product $\left\|\vec v \times \vec w\right\|$ is the area of the **parallellogram** spanned by the vectors $\vec v$ and $\vec w$ and the triangle with vertices $\vec o$, $\vec v$ and $\vec w$ is exactly half of that parallellogram, hence its area is given by $\tfrac{1}{2}\left\|\vec v \times \vec w\right\|$.
This interpretation can be clear from the definition (depending on how you define the cross product), or it follows from the formula $\left\|\vec v \times \vec w\right\|=\left\|v\right\|\left\|v\right\|\sin\theta$ (*"base times height"*) where $\theta$ is the angle between $\vec v$ and $\vec w$. | Every triangle can be completely specified by two vectors sharing a common vertex. This is because the third side is found by vector subtraction of the other two sides. The triangle spanned by the two vectors is the area we are looking for. By mirrorflipping the two sides across the vector subtraction of the two sides you create a parallelogram. You can see by symmetry that the area of the parallelogram is twice of the area of the triangle. In cartesian coordinates the area of a parallelogram spanned by two vectors with a common vertex is $|ab \times ac|$. Therefore the area of the triangle is $\frac{1}{2}|ab \times ac|$. |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | **Do not just increment the pointer if you have malloc'd any memory or your program will crash.** free needs the original pointer. You can copy the pointer, make a new chunk of memory and memcpy it, access it as ptr+1 or any of a bunch of other ways, but the people who say just increment the pointer are giving you dangerous advice. You can run this sample program and see what happens when you "just increment the pointer".
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = (char *)malloc(10);
strcpy(str, "1234567890");
printf("%s\n", str);
str++;
printf("%s\n", str);
free(str);
}
```
**Hint: Here's the result:**
```
[mfisch@toaster ~]$ ./foo
1234567890
234567890
*** glibc detected *** ./foo: free(): invalid pointer: 0x08c65009 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x724591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x725de8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x728ecd]
./foo[0x80484e3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x6cfbd6]
./foo[0x80483f1]
======= Memory map: ========
001c9000-001e4000 r-xp 00000000 08:01 2883609 /lib/ld-2.11.1.so
001e4000-001e5000 r--p 0001a000 08:01 2883609 /lib/ld-2.11.1.so
001e5000-001e6000 rw-p 0001b000 08:01 2883609 /lib/ld-2.11.1.so
006b9000-0080c000 r-xp 00000000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080c000-0080d000 ---p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080d000-0080f000 r--p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080f000-00810000 rw-p 00155000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
00810000-00813000 rw-p 00000000 00:00 0
00e4d000-00e4e000 r-xp 00000000 00:00 0 [vdso]
00fe0000-00ffd000 r-xp 00000000 08:01 2883667 /lib/libgcc_s.so.1
00ffd000-00ffe000 r--p 0001c000 08:01 2883667 /lib/libgcc_s.so.1
00ffe000-00fff000 rw-p 0001d000 08:01 2883667 /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:01 9700477 /home/mfisch/foo
08049000-0804a000 r--p 00000000 08:01 9700477 /home/mfisch/foo
0804a000-0804b000 rw-p 00001000 08:01 9700477 /home/mfisch/foo
08c65000-08c86000 rw-p 00000000 00:00 0 [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b776f000-b7770000 rw-p 00000000 00:00 0
b7780000-b7783000 rw-p 00000000 00:00 0
bfc22000-bfc37000 rw-p 00000000 00:00 0 [stack]
Aborted
``` | It sounds as if you're under the impression that a char\* "contains" characters. It does not. It merely *points* at *a* byte. The rest of the string is implied to consist of the subsequent byte in memory up until the next null byte. (You should also be aware that although the 'char' data type is a byte, by definition, it is not really a character - please be aware of Unicode - and nor is a byte necessarily an octet.)
The char\* is not an array, either, although there may exist an array of characters such that the pointer is pointing to the beginning of that array. |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | **Do not just increment the pointer if you have malloc'd any memory or your program will crash.** free needs the original pointer. You can copy the pointer, make a new chunk of memory and memcpy it, access it as ptr+1 or any of a bunch of other ways, but the people who say just increment the pointer are giving you dangerous advice. You can run this sample program and see what happens when you "just increment the pointer".
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = (char *)malloc(10);
strcpy(str, "1234567890");
printf("%s\n", str);
str++;
printf("%s\n", str);
free(str);
}
```
**Hint: Here's the result:**
```
[mfisch@toaster ~]$ ./foo
1234567890
234567890
*** glibc detected *** ./foo: free(): invalid pointer: 0x08c65009 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x724591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x725de8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x728ecd]
./foo[0x80484e3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x6cfbd6]
./foo[0x80483f1]
======= Memory map: ========
001c9000-001e4000 r-xp 00000000 08:01 2883609 /lib/ld-2.11.1.so
001e4000-001e5000 r--p 0001a000 08:01 2883609 /lib/ld-2.11.1.so
001e5000-001e6000 rw-p 0001b000 08:01 2883609 /lib/ld-2.11.1.so
006b9000-0080c000 r-xp 00000000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080c000-0080d000 ---p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080d000-0080f000 r--p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080f000-00810000 rw-p 00155000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
00810000-00813000 rw-p 00000000 00:00 0
00e4d000-00e4e000 r-xp 00000000 00:00 0 [vdso]
00fe0000-00ffd000 r-xp 00000000 08:01 2883667 /lib/libgcc_s.so.1
00ffd000-00ffe000 r--p 0001c000 08:01 2883667 /lib/libgcc_s.so.1
00ffe000-00fff000 rw-p 0001d000 08:01 2883667 /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:01 9700477 /home/mfisch/foo
08049000-0804a000 r--p 00000000 08:01 9700477 /home/mfisch/foo
0804a000-0804b000 rw-p 00001000 08:01 9700477 /home/mfisch/foo
08c65000-08c86000 rw-p 00000000 00:00 0 [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b776f000-b7770000 rw-p 00000000 00:00 0
b7780000-b7783000 rw-p 00000000 00:00 0
bfc22000-bfc37000 rw-p 00000000 00:00 0 [stack]
Aborted
``` | Here is my code
So simple
```
#include <stdio.h>
#include<stdlib.h>
int main()
{
char *str=(char *)malloc(100*sizeof(char));
scanf("%s",str);
str=&str[1];
printf("%s",str);
return 0;
}
```
str=&str[1] // here 1 indicates how many characters to remove. |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | `char* contents_chopped = contents + 1;`
This will result in `contents_chopped` pointing to the same string, except the first char will be the next after \n
Also, this method is faster. | ```
#include <stdio.h>
#include <string.h>
int main ()
{
char src[50] = "123456789123434567678";
char dest[16]={0};
memcpy(dest, src+1,sizeof(src));
printf("%s\n",dest);
return(0);
}
src+1 -> indicate how many char you want to remove
``` |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | It sounds as if you're under the impression that a char\* "contains" characters. It does not. It merely *points* at *a* byte. The rest of the string is implied to consist of the subsequent byte in memory up until the next null byte. (You should also be aware that although the 'char' data type is a byte, by definition, it is not really a character - please be aware of Unicode - and nor is a byte necessarily an octet.)
The char\* is not an array, either, although there may exist an array of characters such that the pointer is pointing to the beginning of that array. | If it finds the character it basically ignores the character and continues to loop.
```
void remove_character(char* string, char letter) {
int length = strlen(string);
int found = 0;
for (int i = 0; i < length; ++i)
{
if (string[i] == letter)
{
found = 1;
continue;
}
if (found == 1)
{
string[i-1] = string[i];
}
}
if (found == 1)
{
string[length - 1] = '\0';
}
```
} |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | **Do not just increment the pointer if you have malloc'd any memory or your program will crash.** free needs the original pointer. You can copy the pointer, make a new chunk of memory and memcpy it, access it as ptr+1 or any of a bunch of other ways, but the people who say just increment the pointer are giving you dangerous advice. You can run this sample program and see what happens when you "just increment the pointer".
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = (char *)malloc(10);
strcpy(str, "1234567890");
printf("%s\n", str);
str++;
printf("%s\n", str);
free(str);
}
```
**Hint: Here's the result:**
```
[mfisch@toaster ~]$ ./foo
1234567890
234567890
*** glibc detected *** ./foo: free(): invalid pointer: 0x08c65009 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x724591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x725de8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x728ecd]
./foo[0x80484e3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x6cfbd6]
./foo[0x80483f1]
======= Memory map: ========
001c9000-001e4000 r-xp 00000000 08:01 2883609 /lib/ld-2.11.1.so
001e4000-001e5000 r--p 0001a000 08:01 2883609 /lib/ld-2.11.1.so
001e5000-001e6000 rw-p 0001b000 08:01 2883609 /lib/ld-2.11.1.so
006b9000-0080c000 r-xp 00000000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080c000-0080d000 ---p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080d000-0080f000 r--p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080f000-00810000 rw-p 00155000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
00810000-00813000 rw-p 00000000 00:00 0
00e4d000-00e4e000 r-xp 00000000 00:00 0 [vdso]
00fe0000-00ffd000 r-xp 00000000 08:01 2883667 /lib/libgcc_s.so.1
00ffd000-00ffe000 r--p 0001c000 08:01 2883667 /lib/libgcc_s.so.1
00ffe000-00fff000 rw-p 0001d000 08:01 2883667 /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:01 9700477 /home/mfisch/foo
08049000-0804a000 r--p 00000000 08:01 9700477 /home/mfisch/foo
0804a000-0804b000 rw-p 00001000 08:01 9700477 /home/mfisch/foo
08c65000-08c86000 rw-p 00000000 00:00 0 [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b776f000-b7770000 rw-p 00000000 00:00 0
b7780000-b7783000 rw-p 00000000 00:00 0
bfc22000-bfc37000 rw-p 00000000 00:00 0 [stack]
Aborted
``` | Here is my code
```
char * bastakiniSil(char *contents){
char *p = malloc( sizeof(*p) * strlen(contents) );
int i;
for(i=0; i<strlen(contents); i++)
{
p[i]=contents[i+1];
}
return p;
```
} |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | ```
if (contents[0] == '\n')
memmove(contents, contents+1, strlen(contents));
```
Or, if the pointer can be modified:
```
if (contents[0] == '\n') contents++;
``` | It sounds as if you're under the impression that a char\* "contains" characters. It does not. It merely *points* at *a* byte. The rest of the string is implied to consist of the subsequent byte in memory up until the next null byte. (You should also be aware that although the 'char' data type is a byte, by definition, it is not really a character - please be aware of Unicode - and nor is a byte necessarily an octet.)
The char\* is not an array, either, although there may exist an array of characters such that the pointer is pointing to the beginning of that array. |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | It sounds as if you're under the impression that a char\* "contains" characters. It does not. It merely *points* at *a* byte. The rest of the string is implied to consist of the subsequent byte in memory up until the next null byte. (You should also be aware that although the 'char' data type is a byte, by definition, it is not really a character - please be aware of Unicode - and nor is a byte necessarily an octet.)
The char\* is not an array, either, although there may exist an array of characters such that the pointer is pointing to the beginning of that array. | Here is my code
So simple
```
#include <stdio.h>
#include<stdlib.h>
int main()
{
char *str=(char *)malloc(100*sizeof(char));
scanf("%s",str);
str=&str[1];
printf("%s",str);
return 0;
}
```
str=&str[1] // here 1 indicates how many characters to remove. |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | `char* contents_chopped = contents + 1;`
This will result in `contents_chopped` pointing to the same string, except the first char will be the next after \n
Also, this method is faster. | **Do not just increment the pointer if you have malloc'd any memory or your program will crash.** free needs the original pointer. You can copy the pointer, make a new chunk of memory and memcpy it, access it as ptr+1 or any of a bunch of other ways, but the people who say just increment the pointer are giving you dangerous advice. You can run this sample program and see what happens when you "just increment the pointer".
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = (char *)malloc(10);
strcpy(str, "1234567890");
printf("%s\n", str);
str++;
printf("%s\n", str);
free(str);
}
```
**Hint: Here's the result:**
```
[mfisch@toaster ~]$ ./foo
1234567890
234567890
*** glibc detected *** ./foo: free(): invalid pointer: 0x08c65009 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x724591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x725de8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x728ecd]
./foo[0x80484e3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x6cfbd6]
./foo[0x80483f1]
======= Memory map: ========
001c9000-001e4000 r-xp 00000000 08:01 2883609 /lib/ld-2.11.1.so
001e4000-001e5000 r--p 0001a000 08:01 2883609 /lib/ld-2.11.1.so
001e5000-001e6000 rw-p 0001b000 08:01 2883609 /lib/ld-2.11.1.so
006b9000-0080c000 r-xp 00000000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080c000-0080d000 ---p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080d000-0080f000 r--p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080f000-00810000 rw-p 00155000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
00810000-00813000 rw-p 00000000 00:00 0
00e4d000-00e4e000 r-xp 00000000 00:00 0 [vdso]
00fe0000-00ffd000 r-xp 00000000 08:01 2883667 /lib/libgcc_s.so.1
00ffd000-00ffe000 r--p 0001c000 08:01 2883667 /lib/libgcc_s.so.1
00ffe000-00fff000 rw-p 0001d000 08:01 2883667 /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:01 9700477 /home/mfisch/foo
08049000-0804a000 r--p 00000000 08:01 9700477 /home/mfisch/foo
0804a000-0804b000 rw-p 00001000 08:01 9700477 /home/mfisch/foo
08c65000-08c86000 rw-p 00000000 00:00 0 [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b776f000-b7770000 rw-p 00000000 00:00 0
b7780000-b7783000 rw-p 00000000 00:00 0
bfc22000-bfc37000 rw-p 00000000 00:00 0 [stack]
Aborted
``` |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | It sounds as if you're under the impression that a char\* "contains" characters. It does not. It merely *points* at *a* byte. The rest of the string is implied to consist of the subsequent byte in memory up until the next null byte. (You should also be aware that although the 'char' data type is a byte, by definition, it is not really a character - please be aware of Unicode - and nor is a byte necessarily an octet.)
The char\* is not an array, either, although there may exist an array of characters such that the pointer is pointing to the beginning of that array. | Here is my code
```
char * bastakiniSil(char *contents){
char *p = malloc( sizeof(*p) * strlen(contents) );
int i;
for(i=0; i<strlen(contents); i++)
{
p[i]=contents[i+1];
}
return p;
```
} |
4,295,758 | I have set my compression like this for my **NSMutableUrlRequest** on my iphone app (I use Monotouch, but it's a 1:1 API match):
```
var req = new NSMutableUrlRequest (new NSUrl (str), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 20)
req["Accept-Encoding"] = "compress, gzip";
```
When I download a resource (REST xml file) and monitor the bandwidth in the iPhoneSimulator, it indicates that the file is being downloaded at its raw file size (20 meg, zipped should be 3 meg-ish).
On my IIS 6 server I have set compression universally. Using a browser to the file works fine with compression when I monitor its bandwidth usage.
Ideas why?
 | 2010/11/28 | [
"https://Stackoverflow.com/questions/4295758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | ```
if (contents[0] == '\n')
memmove(contents, contents+1, strlen(contents));
```
Or, if the pointer can be modified:
```
if (contents[0] == '\n') contents++;
``` | **Do not just increment the pointer if you have malloc'd any memory or your program will crash.** free needs the original pointer. You can copy the pointer, make a new chunk of memory and memcpy it, access it as ptr+1 or any of a bunch of other ways, but the people who say just increment the pointer are giving you dangerous advice. You can run this sample program and see what happens when you "just increment the pointer".
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = (char *)malloc(10);
strcpy(str, "1234567890");
printf("%s\n", str);
str++;
printf("%s\n", str);
free(str);
}
```
**Hint: Here's the result:**
```
[mfisch@toaster ~]$ ./foo
1234567890
234567890
*** glibc detected *** ./foo: free(): invalid pointer: 0x08c65009 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x724591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x725de8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x728ecd]
./foo[0x80484e3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x6cfbd6]
./foo[0x80483f1]
======= Memory map: ========
001c9000-001e4000 r-xp 00000000 08:01 2883609 /lib/ld-2.11.1.so
001e4000-001e5000 r--p 0001a000 08:01 2883609 /lib/ld-2.11.1.so
001e5000-001e6000 rw-p 0001b000 08:01 2883609 /lib/ld-2.11.1.so
006b9000-0080c000 r-xp 00000000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080c000-0080d000 ---p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080d000-0080f000 r--p 00153000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
0080f000-00810000 rw-p 00155000 08:01 3015690 /lib/tls/i686/cmov/libc-2.11.1.so
00810000-00813000 rw-p 00000000 00:00 0
00e4d000-00e4e000 r-xp 00000000 00:00 0 [vdso]
00fe0000-00ffd000 r-xp 00000000 08:01 2883667 /lib/libgcc_s.so.1
00ffd000-00ffe000 r--p 0001c000 08:01 2883667 /lib/libgcc_s.so.1
00ffe000-00fff000 rw-p 0001d000 08:01 2883667 /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:01 9700477 /home/mfisch/foo
08049000-0804a000 r--p 00000000 08:01 9700477 /home/mfisch/foo
0804a000-0804b000 rw-p 00001000 08:01 9700477 /home/mfisch/foo
08c65000-08c86000 rw-p 00000000 00:00 0 [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b776f000-b7770000 rw-p 00000000 00:00 0
b7780000-b7783000 rw-p 00000000 00:00 0
bfc22000-bfc37000 rw-p 00000000 00:00 0 [stack]
Aborted
``` |
49,290,374 | I have a table who have creation date like:
```
SELECT [CreationDate] FROM Store.Order
```
So each register have one datetime like:
```
2018-03-14 00:00:00.000
2017-04-14 00:00:00.000
2017-06-14 00:00:00.000
```
I want to know how to `COUNT` only register of Date equals to current month and year, for example in this case,if I only have one
register in month 03 I just get 1 on count, how can I achieve it? Regards | 2018/03/15 | [
"https://Stackoverflow.com/questions/49290374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9452841/"
] | Here is one option:
```
SELECT COUNT(*)
FROM Store.Order
WHERE
CONVERT(varchar(7), [CreationDate], 126) = CONVERT(varchar(7), GETDATE(), 126);
```
[Demo
----](http://rextester.com/NLHQPE86189)
We can convert both the creation date in your table and the current date into `yyyy-mm` strings, and then check if they be equal. | The most efficient way is to do:
```
where creationdate >= dateadd(day, 1 - day(getdate(), cast(getdate() as date)) and
creationdate < dateadd(month, 1, dateadd(day, 1 - day(getdate(), cast(getdate() as date)))
```
Although this looks more complex than other solutions, all the complexity is on `getdate()` -- meaning that the optimizer can use indexes on `creationdate`. |
45,735,671 | I am using [GlideJS](http://glide.jedrzejchalubek.com/) to display a carousal. The height of each item in this carousal is different and I have therefore set the property:
```
autoheight: true
```
The problem is when I try to display the carousal in a collapsed div with the autoheight property set to 'true' the carousal is not displayed. When the autoheight property is set to false the carousal does display but then the height of the items is fixed. To illustrate this problem I have created the following Fiddle:
<https://jsfiddle.net/7dma7L84/21/>
How can I display the carousal in a collapsed div with auto height for each item? | 2017/08/17 | [
"https://Stackoverflow.com/questions/45735671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3398797/"
] | What you need to do is codesplitting.
Without code splitting
+ are loaded at the first start
```
import Login from './Login'
import Home from './Home'
const App = ({ user }) => (
<Body>
{user.loggedIn ? <Route path="/" component={Home} /> : <Redirect to="/login" />}
<Route path="/login" component={Login} />
</Body>
)
```
With code splitting:
```
import Async from 'react-code-splitting'
import Login from './Login'
const Home = () => <Async load={import('./Home')} />
const LostPassword = props => <Async load={import('./LostPassword')} componentProps={props}/>
const App = ({ user }) => (
<Body>
{user.loggedIn ? <Route path="/" component={Home} /> : <Redirect to="/login" />}
<Route path="/login" component={Login} />
<Route path="/lostpassword" component={LostPassword} />
</Body>
)
```
There are several ways of doing this, for example: <https://github.com/didierfranc/react-code-splitting> | Use `import` or `require` on the top on a given js file for adding custom scripts or custom css, but I agree that you should review it to be sure everything behaves as you expect.
Example:
```
import "../../assets/js/extensions/mouse-gesture/options.js";
```
Or if you want to import a script only when using a method:
```
myMethod() {
require("../../assets/js/extensions/mouse-gesture/options.js");
...
}
``` |
45,735,671 | I am using [GlideJS](http://glide.jedrzejchalubek.com/) to display a carousal. The height of each item in this carousal is different and I have therefore set the property:
```
autoheight: true
```
The problem is when I try to display the carousal in a collapsed div with the autoheight property set to 'true' the carousal is not displayed. When the autoheight property is set to false the carousal does display but then the height of the items is fixed. To illustrate this problem I have created the following Fiddle:
<https://jsfiddle.net/7dma7L84/21/>
How can I display the carousal in a collapsed div with auto height for each item? | 2017/08/17 | [
"https://Stackoverflow.com/questions/45735671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3398797/"
] | What you need to do is codesplitting.
Without code splitting
+ are loaded at the first start
```
import Login from './Login'
import Home from './Home'
const App = ({ user }) => (
<Body>
{user.loggedIn ? <Route path="/" component={Home} /> : <Redirect to="/login" />}
<Route path="/login" component={Login} />
</Body>
)
```
With code splitting:
```
import Async from 'react-code-splitting'
import Login from './Login'
const Home = () => <Async load={import('./Home')} />
const LostPassword = props => <Async load={import('./LostPassword')} componentProps={props}/>
const App = ({ user }) => (
<Body>
{user.loggedIn ? <Route path="/" component={Home} /> : <Redirect to="/login" />}
<Route path="/login" component={Login} />
<Route path="/lostpassword" component={LostPassword} />
</Body>
)
```
There are several ways of doing this, for example: <https://github.com/didierfranc/react-code-splitting> | You can try this library: npm install --save react-script-tag
<https://www.npmjs.com/package/react-script-tag>
```
import React, { Component } from 'react';
import ScriptTag from 'react-script-tag';
class Demo extends Component {
render() {
return (<ScriptTag isHydrating={true} type="text/javascript" src="some_script.js" />);
}
}
``` |
58,255,047 | How do I display the information data using the ID in the url
example is www.thatsite.com/?id=1092
and it will display the data of the 1092 ID
```
<?php
$connect = mysqli_connect("localhost", "xxxxxxx", "xxxx","xxxx");
$query = "SELECT `name`, `age`, `xxxxx` , `xxxxx`, `image` FROM `profiles` WHERE `id` = $id LIMIT 1";
$id=$_GET['id'];
$result = mysqli_query($connect, $query,$id);
while ($row = mysqli_fetch_array($result))
{
echo $row['name'];
echo $row['xxxx'];x
echo $row['age'];
echo $row['xxxxxxx'];
echo $row['image'];
}
?>
``` | 2019/10/06 | [
"https://Stackoverflow.com/questions/58255047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your code is full of security holes. It is prone to sql injection, xss attack, csrf, html injection.
I have re-written it to circumvent all the issues.
**1.) Sql Injection** is now mitigated using prepare queries
**2.) Html injection** is mitigated using **intval** for integer variables and **strip\_tags** for strings. you can read more about data validations and sanitization in php to see more options available
**3.) xss attack** has been mitigated via **htmlentities()**.
you can also use **htmlspecialchars()**. Read more about all this things
see better secured codes below
```
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ur dbname";
// Create connection
$connect = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($connect->connect_error) {
die("Connection failed: " . $connect->connect_error);
}
// ensure that the Id is integer using intval
$id = intval($_GET["id"]);
// if id is a string. you can strip all html elements using strip_tags
//$id = strip_tags($_GET["id"]);
//Avoid sql injection using prepared statement
// prepare and bind
$stmt = $connect->prepare("SELECT name, age , xxxxx, image FROM profiles WHERE id = ? LIMIT 1");
// id is integer or number use i parameter
$stmt->bind_param("i", $id);
// id is integer or number use s parameter
//$stmt->bind_param("s", $id);
$stmt->execute();
$stmt -> store_result();
$stmt -> bind_result($name, $age, $xxxxx, $image);
while ($stmt -> fetch()) {
// ensure that xss attack is not possible using htmlentities
echo "your Name: .htmlentities($name). <br>";
echo "your age: .htmlentities($age). <br>";
echo "your xxxxx: .htmlentities($). <br>";
echo "your image name: .htmlentities($image). <br>";
}
$stmt->close();
$connect->close();
?>
``` | from <https://www.w3schools.com/php/php_mysql_select.asp>
leave out the 'get id', the id is in the SQL:
```
$id=$_GET['id'];
```
The similar example at
<https://www.w3schools.com/php/php_mysql_select.asp>
```
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
``` |
71,729,307 | I'm a beginner in Python and flask. I am going through the Flask tutorial up to [Define and Access the Database](https://flask.palletsprojects.com/en/2.1.x/tutorial/database/) section.
wrote up all the codes, saved, and execute the command below to initalise the DB.
`flask init-db`
However, I get the error on the terminal as flows
`FileNotFoundError: [Errno 2] No such file or directory: /Desktop/flask-tutorial/instance/schema.sql'`
I double-checked the codes to find out what was wrong, searched through StackOverflow,w and find some similar issues but they end up not working for me.
**--Addition--**
**\_\_init\_\_py**
```
import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile('config.py', silent=True)
else:
# load the test config if passed in
app.config.from_mapping(test_config)
# ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
# a simple page that says hello
@app.route('/hello')
def hello():
return 'Hello, world! this is my first flask app'
from . import db
db.init_app(app)
return app
```
**db.py**
```
import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
def init_db():
db = get_db()
with current_app.open_instance_resource('schema.sql') as f:
db.executescript(f.read().decode('utf8'))
@click.command('init-db')
@with_appcontext
def init_db_command():
"""Clear the existing data and create new tables."""
init_db()
click.echo('Initialized the database.')
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row
return g.db
def close_db(e=None):
db = g.pop('db', None)
if db is not None:
db.close()
def init_app(app):
app.teardown_appcontext(close_db)
app.cli.add_command(init_db_command)
```
**Tree**
```
.
├── flaskr
│ ├── db.py
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── db.cpython-39.pyc
│ │ └── __init__.cpython-39.pyc
│ └── schema.sql
├── instance
│ └── flaskr.sqlite
``` | 2022/04/03 | [
"https://Stackoverflow.com/questions/71729307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18600140/"
] | Your code has `open_instance_resource`, which is looking for `instance/schema.sql` - but your `schema.sql` is not there. The original code has `open_resource`, which looks relative to `root_path`. | I think you have downloaded the file in virtual env and trying to access it outside your env.When you create virtual env,files are downloaded inside that env irrespective of that whole system.So you have to first enter in your env and then run the code. |
30,975,060 | i'm new to android developing and started to develop an booking app. There is a calendar view and i want to disable booked dates in that calendar. I found out that disabling feature is not there in android default calendar. so could you please help me to find a good custom calendar view that can disable specific dates. I need a resource or a library. Thank you! | 2015/06/22 | [
"https://Stackoverflow.com/questions/30975060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214782/"
] | Include CalendarPickerView in your layout XML.
```
<com.squareup.timessquare.CalendarPickerView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
```
In the onCreate of your activity/dialog or the onCreateView of your fragment, initialize the view with a range of valid dates as well as the currently selected date.
```
Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);
CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
Date today = new Date();
calendar.init(today, nextYear.getTime()).withSelectedDate(today);
```

github link- <https://github.com/square/android-times-square> | ```
i have faced the same problem using custom calendar ,
i just overridden the function of adapter
@Override
public boolean isEnabled(int position) {
if(mySet.contains(position))
return true;
else
return false;
}
then i call the function int the adapter view
isEnabled(position);
befoer that tale Hashset and add the position which is displaying the calanderview
// mysetSize=set.size();
//isEnabled(Integer.parseInt(gridvalue));
Log.d(dayView.getTag()+"------1-------"+gridvalue,"-------"+position);
} else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) {
dayView.setTextColor(Color.WHITE);
dayView.setClickable(false);
dayView.setFocusable(false);
Log.d("-------mySet------","-------"+mySet);
Log.d(mysetSize+"-------28------"+gridvalue,"-------"+position);
set.add(position);
} else {
// setting curent month's days in blue color.
dayView.setTextColor(Color.DKGRAY);
Log.d(dayView.getTag()+"-------current display post------","-------"+position);
mySet.add(position);
}
``` |
12,106,280 | In my code, I want to remove the img tag which doesn't have src value.
I am using **HTMLAgilitypack's HtmlDocument** object.
I am finding the img which doesn't have src value and trying to remove it.. but it gives me error Collection was modified; enumeration operation may not execute.
Can anyone help me for this?
The code which I have used is:
```
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
``` | 2012/08/24 | [
"https://Stackoverflow.com/questions/12106280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567913/"
] | It seems you're modifying the collection during the enumeration by using `HtmlNode.RemoveChild` method.
To fix this you need is to copy your nodes to a separate list/array by calling e.g. [`Enumerable.ToList<T>()`](http://msdn.microsoft.com/en-us/library/bb342261.aspx) or [`Enumerable.ToArray<T>()`](http://msdn.microsoft.com/en-us/library/bb298736.aspx).
```
var nodesToRemove = doc.DocumentNode
.SelectNodes("//img[not(string-length(normalize-space(@src)))]")
.ToList();
foreach (var node in nodesToRemove)
node.Remove();
```
If I'm right, the problem will disappear. | ```
var emptyImages = doc.DocumentNode
.Descendants("img")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.Select(x => x.XPath)
.ToList();
emptyImages.ForEach(xpath => {
var node = doc.DocumentNode.SelectSingleNode(xpath);
if (node != null) { node.Remove(); }
});
``` |
12,106,280 | In my code, I want to remove the img tag which doesn't have src value.
I am using **HTMLAgilitypack's HtmlDocument** object.
I am finding the img which doesn't have src value and trying to remove it.. but it gives me error Collection was modified; enumeration operation may not execute.
Can anyone help me for this?
The code which I have used is:
```
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
``` | 2012/08/24 | [
"https://Stackoverflow.com/questions/12106280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567913/"
] | It seems you're modifying the collection during the enumeration by using `HtmlNode.RemoveChild` method.
To fix this you need is to copy your nodes to a separate list/array by calling e.g. [`Enumerable.ToList<T>()`](http://msdn.microsoft.com/en-us/library/bb342261.aspx) or [`Enumerable.ToArray<T>()`](http://msdn.microsoft.com/en-us/library/bb298736.aspx).
```
var nodesToRemove = doc.DocumentNode
.SelectNodes("//img[not(string-length(normalize-space(@src)))]")
.ToList();
foreach (var node in nodesToRemove)
node.Remove();
```
If I'm right, the problem will disappear. | ```
var emptyElements = doc.DocumentNode
.Descendants("a")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.ToList();
emptyElements.ForEach(node => {
if (node != null){ node.Remove();}
});
``` |
12,106,280 | In my code, I want to remove the img tag which doesn't have src value.
I am using **HTMLAgilitypack's HtmlDocument** object.
I am finding the img which doesn't have src value and trying to remove it.. but it gives me error Collection was modified; enumeration operation may not execute.
Can anyone help me for this?
The code which I have used is:
```
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
``` | 2012/08/24 | [
"https://Stackoverflow.com/questions/12106280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567913/"
] | What I have done is:
```
List<string> xpaths = new List<string>();
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
xpaths.Add(node.XPath);
continue;
}
}
}
foreach (string xpath in xpaths)
{
doc.DocumentNode.SelectSingleNode(xpath).Remove();
}
``` | ```
var emptyImages = doc.DocumentNode
.Descendants("img")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.Select(x => x.XPath)
.ToList();
emptyImages.ForEach(xpath => {
var node = doc.DocumentNode.SelectSingleNode(xpath);
if (node != null) { node.Remove(); }
});
``` |
12,106,280 | In my code, I want to remove the img tag which doesn't have src value.
I am using **HTMLAgilitypack's HtmlDocument** object.
I am finding the img which doesn't have src value and trying to remove it.. but it gives me error Collection was modified; enumeration operation may not execute.
Can anyone help me for this?
The code which I have used is:
```
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
``` | 2012/08/24 | [
"https://Stackoverflow.com/questions/12106280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567913/"
] | What I have done is:
```
List<string> xpaths = new List<string>();
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
xpaths.Add(node.XPath);
continue;
}
}
}
foreach (string xpath in xpaths)
{
doc.DocumentNode.SelectSingleNode(xpath).Remove();
}
``` | ```
var emptyElements = doc.DocumentNode
.Descendants("a")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.ToList();
emptyElements.ForEach(node => {
if (node != null){ node.Remove();}
});
``` |
12,106,280 | In my code, I want to remove the img tag which doesn't have src value.
I am using **HTMLAgilitypack's HtmlDocument** object.
I am finding the img which doesn't have src value and trying to remove it.. but it gives me error Collection was modified; enumeration operation may not execute.
Can anyone help me for this?
The code which I have used is:
```
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
``` | 2012/08/24 | [
"https://Stackoverflow.com/questions/12106280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567913/"
] | ```
var emptyImages = doc.DocumentNode
.Descendants("img")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.Select(x => x.XPath)
.ToList();
emptyImages.ForEach(xpath => {
var node = doc.DocumentNode.SelectSingleNode(xpath);
if (node != null) { node.Remove(); }
});
``` | ```
var emptyElements = doc.DocumentNode
.Descendants("a")
.Where(x => x.Attributes["src"] == null || x.Attributes["src"].Value == String.Empty)
.ToList();
emptyElements.ForEach(node => {
if (node != null){ node.Remove();}
});
``` |
13,615,562 | Hi I really have googled this a lot without any joy. Would be happy to get a reference to a website if it exists. I'm struggling to understand the [Hadley documentation on polar coordinates](http://docs.ggplot2.org/current/coord_polar.html) and I know that pie/donut charts are considered inherently evil.
That said, what I'm trying to do is
1. Create a donut/ring chart (so a pie with an empty middle) like the [tikz ring chart](https://tex.stackexchange.com/questions/17898/how-can-i-produce-a-ring-or-wheel-chart-like-that-on-page-88-of-the-pgf-manu) shown here
2. Add a second layer circle on top (with `alpha=0.5` or so) that shows a second (comparable) variable.
Why? I'm looking to show financial information. The first ring is costs (broken down) and the second is total income. The idea is then to add `+ facet=period` for each review period to show the trend in both revenues and expenses and the growth in both.
Any thoughts would be most appreciated
Note: Completely arbitrarily if an MWE is needed if this was tried with
```
donut_data=iris[,2:4]
revenue_data=iris[,1]
facet=iris$Species
```
That would be similar to what I'm trying to do.. Thanks | 2012/11/28 | [
"https://Stackoverflow.com/questions/13615562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1675004/"
] | I don't have a full answer to your question, but I can offer some code that may help get you started making ring plots using `ggplot2`.
```
library(ggplot2)
# Create test data.
dat = data.frame(count=c(10, 60, 30), category=c("A", "B", "C"))
# Add addition columns, needed for drawing with geom_rect.
dat$fraction = dat$count / sum(dat$count)
dat = dat[order(dat$fraction), ]
dat$ymax = cumsum(dat$fraction)
dat$ymin = c(0, head(dat$ymax, n=-1))
p1 = ggplot(dat, aes(fill=category, ymax=ymax, ymin=ymin, xmax=4, xmin=3)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(0, 4)) +
labs(title="Basic ring plot")
p2 = ggplot(dat, aes(fill=category, ymax=ymax, ymin=ymin, xmax=4, xmin=3)) +
geom_rect(colour="grey30") +
coord_polar(theta="y") +
xlim(c(0, 4)) +
theme_bw() +
theme(panel.grid=element_blank()) +
theme(axis.text=element_blank()) +
theme(axis.ticks=element_blank()) +
labs(title="Customized ring plot")
library(gridExtra)
png("ring_plots_1.png", height=4, width=8, units="in", res=120)
grid.arrange(p1, p2, nrow=1)
dev.off()
```

**Thoughts:**
1. You may get more useful answers if you post some well-structured sample data. You have mentioned using some columns from the `iris` dataset (a good start), but I am unable to see how to use that data to make a ring plot. For example, the ring plot you have linked to shows proportions of several categories, but neither `iris[, 2:4]` nor `iris[, 1]` are categorical.
2. You want to "Add a second layer circle on top": Do you mean to superimpose the second ring directly on top of the first? Or do you want the second ring to be inside or outside of the first? You could add a second internal ring with something like `geom_rect(data=dat2, xmax=3, xmin=2, aes(ymax=ymax, ymin=ymin))`
3. If your data.frame has a column named `period`, you can use `facet_wrap(~ period)` for facetting.
4. To use `ggplot2` most easily, you will want your data in 'long-form'; `melt()` from the `reshape2` package may be useful for converting the data.
5. Make some barplots for comparison, even if you decide not to use them. For example, try:
`ggplot(dat, aes(x=category, y=count, fill=category)) +
geom_bar(stat="identity")` | Just trying to solve question 2 with the same approach from [bdemarest's answer](https://stackoverflow.com/a/13636037/5410410). Also using his code as a scaffold. I added some tests to make it more complete but feel free to remove them.
```
library(broom)
library(tidyverse)
# Create test data.
dat = data.frame(count=c(10,60,20,50),
ring=c("A", "A","B","B"),
category=c("C","D","C","D"))
# compute pvalue
cs.pvalue <- dat %>% spread(value = count,key=category) %>%
ungroup() %>% select(-ring) %>%
chisq.test() %>% tidy()
cs.pvalue <- dat %>% spread(value = count,key=category) %>%
select(-ring) %>%
fisher.test() %>% tidy() %>% full_join(cs.pvalue)
# compute fractions
#dat = dat[order(dat$count), ]
dat %<>% group_by(ring) %>% mutate(fraction = count / sum(count),
ymax = cumsum(fraction),
ymin = c(0,ymax[1:length(ymax)-1]))
# Add x limits
baseNum <- 4
#numCat <- length(unique(dat$ring))
dat$xmax <- as.numeric(dat$ring) + baseNum
dat$xmin = dat$xmax -1
# plot
p2 = ggplot(dat, aes(fill=category,
alpha = ring,
ymax=ymax,
ymin=ymin,
xmax=xmax,
xmin=xmin)) +
geom_rect(colour="grey30") +
coord_polar(theta="y") +
geom_text(inherit.aes = F,
x=c(-1,1),
y=0,
data = cs.pvalue,aes(label = paste(method,
"\n",
format(p.value,
scientific = T,
digits = 2))))+
xlim(c(0, 6)) +
theme_bw() +
theme(panel.grid=element_blank()) +
theme(axis.text=element_blank()) +
theme(axis.ticks=element_blank(),
panel.border = element_blank()) +
labs(title="Customized ring plot") +
scale_fill_brewer(palette = "Set1") +
scale_alpha_discrete(range = c(0.5,0.9))
p2
```
And the result:
 |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | I did the following:
* Delete manually the folder node\_modules
* Delete manually the file package-lock.json
* In the file package.json be sure to set the dependence of TypeScript as
```
"typescript": "2.7.2"
```
* run npm cache clean -f
* run npm install
That work for me. | Had the same issue (amongst many others) after updating to macOS Mojave.
Fixed it by removing node\_modules and package\_lock.json manually, changed in package.json from "typescript": "~2.7.2" to "typescript": "~2.8.0" and ran npm install. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | Installing "@angular/compiler-cli": "7.0.0-beta.4" resolved this issue.
I use "typescript": "3.0.3". | Had the same issue (amongst many others) after updating to macOS Mojave.
Fixed it by removing node\_modules and package\_lock.json manually, changed in package.json from "typescript": "~2.7.2" to "typescript": "~2.8.0" and ran npm install. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | Installing "@angular/compiler-cli": "7.0.0-beta.4" resolved this issue.
I use "typescript": "3.0.3". | Downgrading to `typescript 2.9.2 (npm install [email protected])` and `re-running ng update --all` still yields the error (twice):
```
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.10", would install "3.1.3"
Verified that version 2.9.2 of typescript was in node_modules.
``` |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | In your project folder run again `npm install [email protected]` as stated from here:
[Want to upgrade project from Angular v5 to Angular v6](https://stackoverflow.com/questions/48970553/want-to-upgrade-project-from-angular-v5-to-angular-v6/49474334)
Then it should work. | To upgrade, run the following commands in the terminal.
* Install the latest version of NPM
```
npm install npm@latest -g
```
* Run audit
```
npm audit
```
* Update the NPM
```
npm update
```
* Run the NPM run script.
```
npm start
```
Now your compiler is ready. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | To upgrade, run the following commands in the terminal.
* Install the latest version of NPM
```
npm install npm@latest -g
```
* Run audit
```
npm audit
```
* Update the NPM
```
npm update
```
* Run the NPM run script.
```
npm start
```
Now your compiler is ready. | This is just because in your projects `package.json` file has
eg.`"devDependencies": {"typescript": "~2.8.3"
}`
and in your machine where angular cli installed has `"typescript": "2.7.2"` version.
You can check this by `ng -v` or `ng v`.
So, just open **package.json** **update your typescript version** and `run npm install` and you are done. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | Installing "@angular/compiler-cli": "7.0.0-beta.4" resolved this issue.
I use "typescript": "3.0.3". | This is just because in your projects `package.json` file has
eg.`"devDependencies": {"typescript": "~2.8.3"
}`
and in your machine where angular cli installed has `"typescript": "2.7.2"` version.
You can check this by `ng -v` or `ng v`.
So, just open **package.json** **update your typescript version** and `run npm install` and you are done. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | I did the following:
* Delete manually the folder node\_modules
* Delete manually the file package-lock.json
* In the file package.json be sure to set the dependence of TypeScript as
```
"typescript": "2.7.2"
```
* run npm cache clean -f
* run npm install
That work for me. | Installing "@angular/compiler-cli": "7.0.0-beta.4" resolved this issue.
I use "typescript": "3.0.3". |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | I did next steps:
* removed package-lock.json;
* npm install -g --save [email protected];
* npm uninstall -g --save [email protected];
* in package.json, section "devDependencies" updated string with typescript as "typescript": "~2.7.2".
After all above run in project's terminal ng serve --open (I've been using IDEA 2018.1). | Had the same issue (amongst many others) after updating to macOS Mojave.
Fixed it by removing node\_modules and package\_lock.json manually, changed in package.json from "typescript": "~2.7.2" to "typescript": "~2.8.0" and ran npm install. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | To upgrade, run the following commands in the terminal.
* Install the latest version of NPM
```
npm install npm@latest -g
```
* Run audit
```
npm audit
```
* Update the NPM
```
npm update
```
* Run the NPM run script.
```
npm start
```
Now your compiler is ready. | Had the same issue (amongst many others) after updating to macOS Mojave.
Fixed it by removing node\_modules and package\_lock.json manually, changed in package.json from "typescript": "~2.7.2" to "typescript": "~2.8.0" and ran npm install. |
50,462,402 | I starting getting this error on my Angular app:
>
> The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3
> was found instead
>
>
>
and when I try to downgrade typescript to the right version doing:
`npm install -g [email protected]` it says updated 1 package.
when I verify typescript version using
`npm view typescript version`
I still get 2.8.3
I even tried removing typescript entirely using `npm uninstall -g typescript`
but when I verify typescript version again
`npm view typescript version` I still get 2.8.3
What are the commands to properly purge and restore typescript to a previous version such as 2.7.2?
I'm running node v10.0.0 and npm v6.0.1
When I run `npm list -g typescript` I see the correct version coming 2.7.2 but still version 2.8.3 is installed somehow globally | 2018/05/22 | [
"https://Stackoverflow.com/questions/50462402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931511/"
] | You should do `npm install typescript@'>=2.7.2 <2.8.0'`. This will install the correct typescript your project needs. Make sure you run this inside your Angular project.
On Windows, you should use double quotes instead of single quotes, like so:
```
npm install typescript@">=2.7.2 <2.8.0"
```
Otherwise, you'll get `The system cannot find the file specified.`. | I did the following:
* Delete manually the folder node\_modules
* Delete manually the file package-lock.json
* In the file package.json be sure to set the dependence of TypeScript as
```
"typescript": "2.7.2"
```
* run npm cache clean -f
* run npm install
That work for me. |
21,871 | (I am learning Buddhism/dharma in Chinese.)
为什么合掌鞠躬叫"问讯"?
或是说:
为什么现在的"问讯"不是用讲的?
"问"和"讯"都是动词吗?还是动词+名词? | 2016/11/17 | [
"https://chinese.stackexchange.com/questions/21871",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/15752/"
] | 依[香光莊嚴](http://www.gaya.org.tw/magazine/v1/2005/59/art1.htm)解釋:
在漢語的構詞上,問訊是由「問」與「訊」二個同義詞所組成的詞彙。
「問」是動詞,意思是「恤問」。
「訊」是動詞,意思是「詢問」。
如果「訊」作名詞,在非佛教場合也還是可以用的。如:打聽消息。
現在的"問訊"也還是有用講的,但通常只在人少的時候。當很多人同時向佛或法師表達恭敬時,沒辦法大家都講,所以就只有身體的動作。
問訊 is composed of two synonyms, 問 and 訊.
Both are verbs, meaning "comfort and ask".
If 訊 is a noun, it can still be used in non-Buddhist cases.
Such as: to inquire about something.
Nowadays, 問訊 can still be used orally, but usually only in the cases of 2 or 3 people. When many people express respectful to the Buddha or the masters at the same time, they cannot speak all together. So they only show the body movements. | A word with multiple meaning.
汉典 : [問訊](http://www.zdic.net/c/e/fc/265284.htm)
简单来说, 就是佛教借用这个词,用久了成规范。
同 `问好` 。 比如说: `遥遥点头问好` Greet with a node. 你不需要喊出来,不是吗?
如果是普通人, `問訊` 还是用说的或是写的。 |
27,411,468 | I'm trying to get my code to go through and pop-out after some math has been done. The file being summed is just lists of numbers on separate lines. Could you give me some pointers to make this work because I am stumped.
**EDIT:**
I'm trying to get the transition from the main function to Checker function working correctly. I also need some help with slicing. The numbers being imported from the file are like this:
```
136895201785
155616717815
164615189165
100175288051
254871145153
```
So in my `Checker` funtion I want to add the odd numbers from left to right together. For example, for the first number, I would want to add `1`, `6`, `9`, `2`, `1`, and `8`.
Full Code:
```
def checker(line):
flag == False
odds = line[1 + 3+ 5+ 9+ 11]
part2 = odds * 3
evens = part2 + line[2 + 4 +6 +8 +10 +12]
part3 = evens * mod10
last = part3 - 10
if last == line[-1]:
return flag == True
def main():
iven = input("what is the file name ")
with open(iven) as f:
for line in f:
line = line.strip()
if len(line) > 60:
print("line is too long")
elif len(line) < 10:
print("line is too short")
elif not line.isdigit():
print("contains a non-digit")
elif check(line) == False:
print(line, "error")
``` | 2014/12/10 | [
"https://Stackoverflow.com/questions/27411468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347640/"
] | `lambda args: expr` is not a special magic feature, it's just nice shorthand for
```
def someFunc(args):
return expr
```
which is mainly useful when you need a small function with a simple expression for its body and you don't care about the name. If we used familiar syntax, the `closest()` method would be:
```
def closest(self,*points):
def keyFunc(x):
return float(x-self)
return min(points,key=keyFunc)
```
that is, it creates a small, one off function which does a little bit of calculation depending on `self` and its argument `x`, and passes that into the `min()` builtin function. As Ostrea explains, `min(seq, key=f)` returns the item *x* in `seq` which minimizes `f(`*x*`)` | [`def __sub__`](https://docs.python.org/2/reference/datamodel.html#emulating-numeric-types) is one of the magic methods you can define on an object.
It will be called when you substract the two points. In the example, `self` will be `pt0`. |
27,411,468 | I'm trying to get my code to go through and pop-out after some math has been done. The file being summed is just lists of numbers on separate lines. Could you give me some pointers to make this work because I am stumped.
**EDIT:**
I'm trying to get the transition from the main function to Checker function working correctly. I also need some help with slicing. The numbers being imported from the file are like this:
```
136895201785
155616717815
164615189165
100175288051
254871145153
```
So in my `Checker` funtion I want to add the odd numbers from left to right together. For example, for the first number, I would want to add `1`, `6`, `9`, `2`, `1`, and `8`.
Full Code:
```
def checker(line):
flag == False
odds = line[1 + 3+ 5+ 9+ 11]
part2 = odds * 3
evens = part2 + line[2 + 4 +6 +8 +10 +12]
part3 = evens * mod10
last = part3 - 10
if last == line[-1]:
return flag == True
def main():
iven = input("what is the file name ")
with open(iven) as f:
for line in f:
line = line.strip()
if len(line) > 60:
print("line is too long")
elif len(line) < 10:
print("line is too short")
elif not line.isdigit():
print("contains a non-digit")
elif check(line) == False:
print(line, "error")
``` | 2014/12/10 | [
"https://Stackoverflow.com/questions/27411468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347640/"
] | `lambda args: expr` is not a special magic feature, it's just nice shorthand for
```
def someFunc(args):
return expr
```
which is mainly useful when you need a small function with a simple expression for its body and you don't care about the name. If we used familiar syntax, the `closest()` method would be:
```
def closest(self,*points):
def keyFunc(x):
return float(x-self)
return min(points,key=keyFunc)
```
that is, it creates a small, one off function which does a little bit of calculation depending on `self` and its argument `x`, and passes that into the `min()` builtin function. As Ostrea explains, `min(seq, key=f)` returns the item *x* in `seq` which minimizes `f(`*x*`)` | Yes, `__sub__` and `__pow__` redefines `-` and `**` respectively. In this example you just pass anonymous function to optional argument for `min()`. Here is what this optional argument does, as said in [docs](https://docs.python.org/2.7/library/functions.html#min):
>
> The optional keyword-only key argument specifies a one-argument ordering function like that used for list.sort().
>
>
>
In this anonymous function you just subtract point, on which `closest` was called from points, which was passed as arguments and then convert it to float (this conversion is overridden, see `__float__`) |
218,488 | My house's 240v circuit for the cooktop is a /2 cable. (black, white and bare copper). The new whirlpool cooktop has a 3 wire connection (black,red and bare copper). Whirlpool's instructions do not cover this wiring example. Their 3 wire to 3 wire example assumes you have a red wire from the house. Is there an easy path to wiring up the cooktop? | 2021/03/10 | [
"https://diy.stackexchange.com/questions/218488",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/131410/"
] | If that is indeed a 240V circuit, the white wire *kinda shoulda* been re-marked with tape to indicate that it is a hot wire. Prior to about 20 years ago, they were allowed to skip the marking "if the usage was obvious". The reason for the change is that their "obvious" is not your "obvious".
If you are confident that it is indeed 240V, remark that white wire with black or colored electrical tape. (red is *perfectly fine*).
---
Code does not require you to mark different *kinds* of hot by their function... *any* hot can be *any* color not reserved for other things. \*
White and gray are reserved for neutral.
Green, yellow w/green stripe, and bare are reserved for safety ground.
\* with an *extremely* obscure exception relating to 3-phase power, that isn't even worth mentioning. | Their wiring is based on a 240V/120V circuit with hot/hot/neutral/ground, which is *typically* black/red/white/green-or-bare. Normally white = neutral. However, if you have a pure 240V circuit wired with cable (as opposed to individual wires in conduit), it is perfectly legitimate for it to be hot/hot/ground using black/white/green-or-bare. So you should be just fine.
If you want to be 100% sure, use a multitester to check the voltage between the house wires. You should have ~240V black to white and ~120V black to bare and white to bare, and if so then you are all set. However, if you have ~120V black to white, ~120V black to bare and ~0V white to bare then you actually have a 120V circuit, which will not work for your cooktop.
**Important:** Be sure to compare the existing breaker with the requirements for the new cooktop. Typical is 30A, but it can be different. If the new cooktop matches the existing breaker then you are all set. If the new cooktop requires a **smaller** circuit then you can simply replace the breaker. However, if the new cooktop requires a **larger** circuit then before replacing the breaker you have to determine whether the wires are large enough to handle the current. |
3,588 | I am getting a 404 error when trying to go to my admin page was working fine earlier today. Haven't changed anything since I last logged in and the only thing I was doing was assigning products to categories.
<http://mytempsite.net/gotie/admin>
**WHAT IVE TRIED SO FAR**
Delete the following file:-
app/etc/use\_cache.ser <-- **I could not find the file in ftp or ssh**
then tried doing this
Opened PhpMyAdmin
- Went to my database
- Clicked SQL
- Ran the following SQL Query:
SET FOREIGN\_KEY\_CHECKS=0;
UPDATE `core_store` SET store\_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group\_id = 0 WHERE name='Default';
UPDATE `core_website` SET website\_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer\_group\_id = 0 WHERE customer\_group\_code='NOT LOGGED IN';
SET FOREIGN\_KEY\_CHECKS=1; | 2013/05/09 | [
"https://magento.stackexchange.com/questions/3588",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/1847/"
] | First, are you the only admin user?
Second, In your app/etc/local.xml, look for:
```
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
```
Does it say admin or something else?
Third, go in your core\_config\_data table and try to locate these variables (lines 226 + 229):
admin/url/custom
admin/url/custom\_path

Do you have any caching enabled, or have any redirects setup? Delete the Cache manually (var/cache/).
I would enable your server logs (a quick look at GoDaddy has this tutorial showing how to do it: [Working with Error Logs](http://support.godaddy.com/help/article/1197/working-with-error-logs)
Attempt to turn on Magento Logging (it should be on for dev sites). You can do this by going into "core\_config\_data" and look for a dev/log/active. It should be set to 1 for logging (yours is probably set to 0).

I would also go further and turn on Developer Mode (which should also be on for dev sites). You can do this by going to your index.php file and changing this:
```
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
```
to this:
```
//if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
//}
ini_set('display_errors', 1);
```
**After talking to the user, it turns out it was a file error. I referred him to setup a Diff of his core files and setup a version control system.** | make sure that your apache .htaccess are enabled
refer link when you are using ubuntu 15.x:
<https://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache> |
42,570,539 | When I run `docker-compose up -d`, docker always creates container name and network name prepended with the folder name that contains `docker-compose.yml`file.
I can specify the container name as follows:
```
nginx:
container_name: nginx
build:
context: .
dockerfile: .docker/docker-nginx.dockerfile
```
But how can I specify the network name so that it doesn't prepend folder name to it?
Thanks. | 2017/03/03 | [
"https://Stackoverflow.com/questions/42570539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1072698/"
] | Docker Prepends the current folder name with all the components name created using docker compose file.
Eg : If the current folder name containing the docker-compose.yml file is test, all the volumes,network and container names will get test appended to it. In order to solve the problem people earlier proposed the idea of using **-p** flag with docker-compose command but the solution is not the most feasible one as a project name is required just after the -p attribute. The project name then gets appended to all the components created using docker compose file.
The **Solution** to the above problem is using the **name** property as in below.
```
volumes:
data:
driver: local
name: mongodata
networks:
internal-network:
driver: bridge
name: frontend-network
```
This volume can be referred in the service section as
```
services:
mongo-database:
volumes:
- data:/data/db
networks:
- internal-network
```
The above **name** attribute will prevent docker-compose to prepend folder name.
Note : For the container name one could use the property **container\_name**
```
services:
mongo-database:
container_name: mongo
``` | You have to place a ".env" file in the root of your docker-compose project directory.
```
COMPOSE_PROJECT_NAME=MyFancyProject
```
See Docker docs for further information: <https://docs.docker.com/compose/reference/envvars/>
If you don't use docker-compose, you can use the "`-p`" parameter to set this on `docker run`. |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | It says
>
> THINGS LOOK A BIT OFF DONT THEY
>
>
>
if we
>
> replace each wingding character with the character at the same code point in the ordinary ASCII character set.
>
>
>
This isn't all; it turns out that
>
> the white background isn't all quite white, and a bit of colour-remapping produces this:
>
> [](https://i.stack.imgur.com/IoRmt.png)
>
>
>
I confess that
>
> transcribing all of this and either treating it as cryptograms or identifying whatever (presumably artificial) scripts they use seems ... more like work than fun. If I find the energy to decipher any of it, I will report here :-).
>
>
>
Many of these
>
> seem to be letter-for-letter transcriptions of (more or less) English text, with the symbols used here often somewhat resembling the corresponding ones in our familiar Latin alphabet.
>
>
>
Block 1:
>
> Pretty sure this says SAYAKA MIKI / SONY STORAGE FORMAT USING ATRAC. First part is an anime character, who is apparently known to fans of the anime as "Blue"; second perhaps "MiniDisc".
>
>
>
Block 2:
>
> Looks like SHADOW ANGEL / LEAD WEAPON IN CLU. First might be "demon" or something; second perhaps "pipe" if we assume there's an omitted "e". (Thanks to F1Krazy for getting started on this one.)
>
>
>
Block 3: (not really looked at yet)
Block 4: (not really looked at yet, but)
>
> I suspect the individual "characters" here may be vertical groups of three symbols rather than single symbols.
>
>
>
Block 5:
>
> Looks like CM POSTAL COMPANY / TYPE OF CORRECTION OR RAY. Second bit is probably GAMMA (thanks @ffao; I had had a strictly inferior idea for that).
>
>
>
Block 6: (not really looked at yet)
Block 7: (not really looked at yet)
Block 8: (not really looked at yet, but)
>
> one word appears to have three successive "S" characters (if that's what they are) which is ... unusual. Also, one word looks a lot like ALSO.
>
>
>
Block 9:
>
> qiupqiup seems to think this should say ENCHANTED PARADE / WORD AFTER ZERO FLUTE RHYMING / WITH DRINK; if so, presumably it's three things divided differently: enchanted parade, word after zero (tolerance? one? gravity? ...), flute rhyming with drink.
>
>
>
Block 10: (not really looked at yet)
Block 11: (not really looked at yet)
Block 12: (not really looked at yet) | If we use
>
> a Least Significant Bit detector,
>
>
>
we can find:
>
> [](https://i.stack.imgur.com/vUZMB.png)
>
>
>
However these runes currently elude me...
The fifth block appears to say:
>
> ... CM Postal Company, Type of correction or ray
>
>
> |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | As described in [Gareth's answer](https://puzzling.stackexchange.com/a/61853/20521) (go upvote that if you haven't already), the first step is to notice that:
>
> the white background isn't all quite white, and a bit of colour remapping produces [this image](https://i.stack.imgur.com/IoRmt.png).
>
>
>
From there, a bit of cryptogram work led us to what was written in the texts, as well as the scripts they were written in:
>
> Alphabet: Aquarion Alphabet
>
> SAYAKA MIKI: Puella Magi Madoka Magica character
>
> SONY STORAGE FORMAT USING ATRAC: MiniDisc
>
>
>
> Alphabet: Human Alphabet in "Is It Wrong to Try to Pick Up Girls in a Dungeon?"
>
> SHADOW ANGEL: main antagonists of Genesis of Aquarion
>
> LEAD WEAPON IN CLUE: pipe
>
>
>
> Alphabet: Konosuba Alphabet
>
> DOKUROXY: Villain in Mahou Tsukai Pretty Cure!
>
> LAST BUT BLANK LEAST: not
>
>
>
> Alphabet: Luna Alphabet (Little Witch Academia)
>
> ELSIE: The World God Only Knows character
>
> SPEEDY PARR KID: Dash
>
>
>
> Alphabet: Precure Alphabet
>
> CH POSTAL COMPANY: Company in Violet Evergarden
>
> TYPE OF CORRECTION OR RAY: gamma
>
>
>
> Alphabet: Imanity Alphabet (No Game No Life)
>
> DR. GEL: antagonist in Space Dandy
>
> GARACHINE AIRPORT CODE: GHE
>
>
>
> Alphabet: Unovian Alphabet (Pokémon)
>
> ORARIO: City in Is It Wrong to Try to Pick Up Girls in a Dungeon?
>
> MUSICAL BUILDUP OF LOUDNESS: crescendo
>
>
>
> Alphabet: Witch runes (Puella Magi Madoka Magica)
>
> EXPLOOOSION: Megumin's [signature spell chant](https://www.youtube.com/watch?v=coYieIF8I5M) in Konosuba
>
> TRACK EIGHT FROM STARRS ALBUM RINGO: "Six O'Clock"
>
>
>
> Alphabet: Space Dandy Alphabet
>
> ENCHANTED PARADE: Little Witch Academia series subtitle
>
> WORD AFTER ZERO FLUTE RHYMING WITH DRINK: countersink
>
>
>
> Alphabet: Zentradi Alphabet (Super Dimension Fortress Macross)
>
> BEST WISHES: Pokémon series subtitle
>
> WORD AFTER EUROPEAN OR TRADE: union
>
>
>
> Alphabet: Leiden Alphabet (Violet Evergarden)
>
> OLD DEUS: race in No Game No Life
>
> THINK WORK SERVE SCHOOL INITS: TSU
>
>
>
> Alphabet: Hell Alphabet (The World God Only Knows)
>
> MY BOYFRIEND IS A PILOT (Super Dimension Fortress Macross song)
>
> EARLY BYZANTINE GOLD COIN: solidus
>
>
>
We can notice that for each block of text,
>
> The first line refers to one of the anime the scripts come from, and the second line gives a word that represents a symbol. For instance, solidus is another name for slash, and the mathematical symbol for union is ∪.
>
>
>
Then @Deusovi brilliantly noticed that
>
> The symbols described are all part of the [Moon type](https://en.wikipedia.org/wiki/Moon_type) writing system, giving the letters, in order: HIMTEEKIVUDS
>
>
>
The final step is to
>
> Reorder the blocks in a cycle, in which the anime reference for one block is where the alphabet for the next block in the cycle comes from. The starting point of the cycle is the Luna Alphabet block, as indicated by the arrow pointing to it in the image. Doing so gives us the letters TSUKIHIME DEV:
>
>
>
> [](https://i.stack.imgur.com/ALjYR.png)
>
>
>
Giving us the final answer...
>
> Type-Moon. Quite fitting.
>
>
>
As a side note,
>
> The initials to this puzzle's title, Unintelligible Batch of Wingdinglish, are the same as those of Unlimited Blade Works, another TYPE-MOON creation.
>
>
> | It says
>
> THINGS LOOK A BIT OFF DONT THEY
>
>
>
if we
>
> replace each wingding character with the character at the same code point in the ordinary ASCII character set.
>
>
>
This isn't all; it turns out that
>
> the white background isn't all quite white, and a bit of colour-remapping produces this:
>
> [](https://i.stack.imgur.com/IoRmt.png)
>
>
>
I confess that
>
> transcribing all of this and either treating it as cryptograms or identifying whatever (presumably artificial) scripts they use seems ... more like work than fun. If I find the energy to decipher any of it, I will report here :-).
>
>
>
Many of these
>
> seem to be letter-for-letter transcriptions of (more or less) English text, with the symbols used here often somewhat resembling the corresponding ones in our familiar Latin alphabet.
>
>
>
Block 1:
>
> Pretty sure this says SAYAKA MIKI / SONY STORAGE FORMAT USING ATRAC. First part is an anime character, who is apparently known to fans of the anime as "Blue"; second perhaps "MiniDisc".
>
>
>
Block 2:
>
> Looks like SHADOW ANGEL / LEAD WEAPON IN CLU. First might be "demon" or something; second perhaps "pipe" if we assume there's an omitted "e". (Thanks to F1Krazy for getting started on this one.)
>
>
>
Block 3: (not really looked at yet)
Block 4: (not really looked at yet, but)
>
> I suspect the individual "characters" here may be vertical groups of three symbols rather than single symbols.
>
>
>
Block 5:
>
> Looks like CM POSTAL COMPANY / TYPE OF CORRECTION OR RAY. Second bit is probably GAMMA (thanks @ffao; I had had a strictly inferior idea for that).
>
>
>
Block 6: (not really looked at yet)
Block 7: (not really looked at yet)
Block 8: (not really looked at yet, but)
>
> one word appears to have three successive "S" characters (if that's what they are) which is ... unusual. Also, one word looks a lot like ALSO.
>
>
>
Block 9:
>
> qiupqiup seems to think this should say ENCHANTED PARADE / WORD AFTER ZERO FLUTE RHYMING / WITH DRINK; if so, presumably it's three things divided differently: enchanted parade, word after zero (tolerance? one? gravity? ...), flute rhyming with drink.
>
>
>
Block 10: (not really looked at yet)
Block 11: (not really looked at yet)
Block 12: (not really looked at yet) |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | It says
>
> THINGS LOOK A BIT OFF DONT THEY
>
>
>
if we
>
> replace each wingding character with the character at the same code point in the ordinary ASCII character set.
>
>
>
This isn't all; it turns out that
>
> the white background isn't all quite white, and a bit of colour-remapping produces this:
>
> [](https://i.stack.imgur.com/IoRmt.png)
>
>
>
I confess that
>
> transcribing all of this and either treating it as cryptograms or identifying whatever (presumably artificial) scripts they use seems ... more like work than fun. If I find the energy to decipher any of it, I will report here :-).
>
>
>
Many of these
>
> seem to be letter-for-letter transcriptions of (more or less) English text, with the symbols used here often somewhat resembling the corresponding ones in our familiar Latin alphabet.
>
>
>
Block 1:
>
> Pretty sure this says SAYAKA MIKI / SONY STORAGE FORMAT USING ATRAC. First part is an anime character, who is apparently known to fans of the anime as "Blue"; second perhaps "MiniDisc".
>
>
>
Block 2:
>
> Looks like SHADOW ANGEL / LEAD WEAPON IN CLU. First might be "demon" or something; second perhaps "pipe" if we assume there's an omitted "e". (Thanks to F1Krazy for getting started on this one.)
>
>
>
Block 3: (not really looked at yet)
Block 4: (not really looked at yet, but)
>
> I suspect the individual "characters" here may be vertical groups of three symbols rather than single symbols.
>
>
>
Block 5:
>
> Looks like CM POSTAL COMPANY / TYPE OF CORRECTION OR RAY. Second bit is probably GAMMA (thanks @ffao; I had had a strictly inferior idea for that).
>
>
>
Block 6: (not really looked at yet)
Block 7: (not really looked at yet)
Block 8: (not really looked at yet, but)
>
> one word appears to have three successive "S" characters (if that's what they are) which is ... unusual. Also, one word looks a lot like ALSO.
>
>
>
Block 9:
>
> qiupqiup seems to think this should say ENCHANTED PARADE / WORD AFTER ZERO FLUTE RHYMING / WITH DRINK; if so, presumably it's three things divided differently: enchanted parade, word after zero (tolerance? one? gravity? ...), flute rhyming with drink.
>
>
>
Block 10: (not really looked at yet)
Block 11: (not really looked at yet)
Block 12: (not really looked at yet) | Wrap-up: The Making Of *Unintelligible Batch of Wingdinglish*
=============================================================
*This is not a solution to the puzzle, but provides notes from its poser. This type of answer has been [approved by the community](https://puzzling.meta.stackexchange.com/questions/5420/).*
---
Just a number of comments not covered by the other answers, and also some background.
>
> - This puzzle's presentation is intended to be a mega version of [this puzzle by @Rubio](https://puzzling.stackexchange.com/questions/61750/when-was-this-marvelous-thing-first-invented), posted two days earlier.
>
>
>
> - Wingdinglish is a reference to [this TVTropes page](http://tvtropes.org/pmwiki/pmwiki.php/Main/Wingdinglish), which as of writing mentions two of the alphabets used.
>
>
>
> - [@Fifth\_H0r5eman's answer](https://puzzling.stackexchange.com/a/61854/46455) makes this slightly more obvious than [@Gareth McCaughan's](https://puzzling.stackexchange.com/a/61853/46455), but in addition to the white pixels, some of the black pixels are one bit off.
>
>
>
> - Some of these alphabets have been turned into useable fonts by fans. Whilst using such fonts would improve readability, it would look odd if half the puzzle was tablet-drawn, even if the alternative meant wrangling with [Imanity-go](http://no-game-no-life.wikia.com/wiki/Imanity-go).
>
>
>
> - Some candidate alphabets had to be cut due to mapping to Japanese kana instead of English letters, or due to difficulty of research.
>
>
>
> - Alphabet selection was influenced by how much I verified and trusted the charts used. [Primary sources](http://www.toei-anim.co.jp/tv/mahotsukai_precure/special/) were preferable but usually not available, alas.
>
>
>
> - @Deusovi managed to skip this step, but reading the first lines in chain order (ELSIE, MY BOYFRIEND IS A PILOT, ...) spells out EMBOSSED CODE.
>
>
>
> - Due to the first letters restriction, assigning good first-line clues proved surprisingly tricky, especially due to not being familiar with some of the series involved. As such some clues ended up referencing a franchise rather than the specific entry within the franchise, e.g. SHADOW ANGEL is more a reference to [Genesis of Aquarion](https://en.wikipedia.org/wiki/Genesis_of_Aquarion), rather than its sequel [Aquarion EVOL](https://en.wikipedia.org/wiki/Aquarion_Evol) which provides the alphabet used.
>
>
>
> - At least one clue was scrapped to avoid solvers potentially researching their way into spoilers, even though it would have improved the puzzle.
>
>
>
> - At least one clue was tweaked due to different circulated fan charts conflicting on the character used.
>
>
>
> - As @ffao points out, the title initals UBW is a reference to Unlimited Blade Works, part of the [Fate](https://en.wikipedia.org/wiki/Fate/stay_night) universe by Type-Moon.
>
>
> |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | As described in [Gareth's answer](https://puzzling.stackexchange.com/a/61853/20521) (go upvote that if you haven't already), the first step is to notice that:
>
> the white background isn't all quite white, and a bit of colour remapping produces [this image](https://i.stack.imgur.com/IoRmt.png).
>
>
>
From there, a bit of cryptogram work led us to what was written in the texts, as well as the scripts they were written in:
>
> Alphabet: Aquarion Alphabet
>
> SAYAKA MIKI: Puella Magi Madoka Magica character
>
> SONY STORAGE FORMAT USING ATRAC: MiniDisc
>
>
>
> Alphabet: Human Alphabet in "Is It Wrong to Try to Pick Up Girls in a Dungeon?"
>
> SHADOW ANGEL: main antagonists of Genesis of Aquarion
>
> LEAD WEAPON IN CLUE: pipe
>
>
>
> Alphabet: Konosuba Alphabet
>
> DOKUROXY: Villain in Mahou Tsukai Pretty Cure!
>
> LAST BUT BLANK LEAST: not
>
>
>
> Alphabet: Luna Alphabet (Little Witch Academia)
>
> ELSIE: The World God Only Knows character
>
> SPEEDY PARR KID: Dash
>
>
>
> Alphabet: Precure Alphabet
>
> CH POSTAL COMPANY: Company in Violet Evergarden
>
> TYPE OF CORRECTION OR RAY: gamma
>
>
>
> Alphabet: Imanity Alphabet (No Game No Life)
>
> DR. GEL: antagonist in Space Dandy
>
> GARACHINE AIRPORT CODE: GHE
>
>
>
> Alphabet: Unovian Alphabet (Pokémon)
>
> ORARIO: City in Is It Wrong to Try to Pick Up Girls in a Dungeon?
>
> MUSICAL BUILDUP OF LOUDNESS: crescendo
>
>
>
> Alphabet: Witch runes (Puella Magi Madoka Magica)
>
> EXPLOOOSION: Megumin's [signature spell chant](https://www.youtube.com/watch?v=coYieIF8I5M) in Konosuba
>
> TRACK EIGHT FROM STARRS ALBUM RINGO: "Six O'Clock"
>
>
>
> Alphabet: Space Dandy Alphabet
>
> ENCHANTED PARADE: Little Witch Academia series subtitle
>
> WORD AFTER ZERO FLUTE RHYMING WITH DRINK: countersink
>
>
>
> Alphabet: Zentradi Alphabet (Super Dimension Fortress Macross)
>
> BEST WISHES: Pokémon series subtitle
>
> WORD AFTER EUROPEAN OR TRADE: union
>
>
>
> Alphabet: Leiden Alphabet (Violet Evergarden)
>
> OLD DEUS: race in No Game No Life
>
> THINK WORK SERVE SCHOOL INITS: TSU
>
>
>
> Alphabet: Hell Alphabet (The World God Only Knows)
>
> MY BOYFRIEND IS A PILOT (Super Dimension Fortress Macross song)
>
> EARLY BYZANTINE GOLD COIN: solidus
>
>
>
We can notice that for each block of text,
>
> The first line refers to one of the anime the scripts come from, and the second line gives a word that represents a symbol. For instance, solidus is another name for slash, and the mathematical symbol for union is ∪.
>
>
>
Then @Deusovi brilliantly noticed that
>
> The symbols described are all part of the [Moon type](https://en.wikipedia.org/wiki/Moon_type) writing system, giving the letters, in order: HIMTEEKIVUDS
>
>
>
The final step is to
>
> Reorder the blocks in a cycle, in which the anime reference for one block is where the alphabet for the next block in the cycle comes from. The starting point of the cycle is the Luna Alphabet block, as indicated by the arrow pointing to it in the image. Doing so gives us the letters TSUKIHIME DEV:
>
>
>
> [](https://i.stack.imgur.com/ALjYR.png)
>
>
>
Giving us the final answer...
>
> Type-Moon. Quite fitting.
>
>
>
As a side note,
>
> The initials to this puzzle's title, Unintelligible Batch of Wingdinglish, are the same as those of Unlimited Blade Works, another TYPE-MOON creation.
>
>
> | If we use
>
> a Least Significant Bit detector,
>
>
>
we can find:
>
> [](https://i.stack.imgur.com/vUZMB.png)
>
>
>
However these runes currently elude me...
The fifth block appears to say:
>
> ... CM Postal Company, Type of correction or ray
>
>
> |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | If we use
>
> a Least Significant Bit detector,
>
>
>
we can find:
>
> [](https://i.stack.imgur.com/vUZMB.png)
>
>
>
However these runes currently elude me...
The fifth block appears to say:
>
> ... CM Postal Company, Type of correction or ray
>
>
> | Wrap-up: The Making Of *Unintelligible Batch of Wingdinglish*
=============================================================
*This is not a solution to the puzzle, but provides notes from its poser. This type of answer has been [approved by the community](https://puzzling.meta.stackexchange.com/questions/5420/).*
---
Just a number of comments not covered by the other answers, and also some background.
>
> - This puzzle's presentation is intended to be a mega version of [this puzzle by @Rubio](https://puzzling.stackexchange.com/questions/61750/when-was-this-marvelous-thing-first-invented), posted two days earlier.
>
>
>
> - Wingdinglish is a reference to [this TVTropes page](http://tvtropes.org/pmwiki/pmwiki.php/Main/Wingdinglish), which as of writing mentions two of the alphabets used.
>
>
>
> - [@Fifth\_H0r5eman's answer](https://puzzling.stackexchange.com/a/61854/46455) makes this slightly more obvious than [@Gareth McCaughan's](https://puzzling.stackexchange.com/a/61853/46455), but in addition to the white pixels, some of the black pixels are one bit off.
>
>
>
> - Some of these alphabets have been turned into useable fonts by fans. Whilst using such fonts would improve readability, it would look odd if half the puzzle was tablet-drawn, even if the alternative meant wrangling with [Imanity-go](http://no-game-no-life.wikia.com/wiki/Imanity-go).
>
>
>
> - Some candidate alphabets had to be cut due to mapping to Japanese kana instead of English letters, or due to difficulty of research.
>
>
>
> - Alphabet selection was influenced by how much I verified and trusted the charts used. [Primary sources](http://www.toei-anim.co.jp/tv/mahotsukai_precure/special/) were preferable but usually not available, alas.
>
>
>
> - @Deusovi managed to skip this step, but reading the first lines in chain order (ELSIE, MY BOYFRIEND IS A PILOT, ...) spells out EMBOSSED CODE.
>
>
>
> - Due to the first letters restriction, assigning good first-line clues proved surprisingly tricky, especially due to not being familiar with some of the series involved. As such some clues ended up referencing a franchise rather than the specific entry within the franchise, e.g. SHADOW ANGEL is more a reference to [Genesis of Aquarion](https://en.wikipedia.org/wiki/Genesis_of_Aquarion), rather than its sequel [Aquarion EVOL](https://en.wikipedia.org/wiki/Aquarion_Evol) which provides the alphabet used.
>
>
>
> - At least one clue was scrapped to avoid solvers potentially researching their way into spoilers, even though it would have improved the puzzle.
>
>
>
> - At least one clue was tweaked due to different circulated fan charts conflicting on the character used.
>
>
>
> - As @ffao points out, the title initals UBW is a reference to Unlimited Blade Works, part of the [Fate](https://en.wikipedia.org/wiki/Fate/stay_night) universe by Type-Moon.
>
>
> |
61,852 | *How do you even read these runes?*
[](https://i.stack.imgur.com/7yv5Q.png)
*Note: Click image for full size* | 2018/03/13 | [
"https://puzzling.stackexchange.com/questions/61852",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/46455/"
] | As described in [Gareth's answer](https://puzzling.stackexchange.com/a/61853/20521) (go upvote that if you haven't already), the first step is to notice that:
>
> the white background isn't all quite white, and a bit of colour remapping produces [this image](https://i.stack.imgur.com/IoRmt.png).
>
>
>
From there, a bit of cryptogram work led us to what was written in the texts, as well as the scripts they were written in:
>
> Alphabet: Aquarion Alphabet
>
> SAYAKA MIKI: Puella Magi Madoka Magica character
>
> SONY STORAGE FORMAT USING ATRAC: MiniDisc
>
>
>
> Alphabet: Human Alphabet in "Is It Wrong to Try to Pick Up Girls in a Dungeon?"
>
> SHADOW ANGEL: main antagonists of Genesis of Aquarion
>
> LEAD WEAPON IN CLUE: pipe
>
>
>
> Alphabet: Konosuba Alphabet
>
> DOKUROXY: Villain in Mahou Tsukai Pretty Cure!
>
> LAST BUT BLANK LEAST: not
>
>
>
> Alphabet: Luna Alphabet (Little Witch Academia)
>
> ELSIE: The World God Only Knows character
>
> SPEEDY PARR KID: Dash
>
>
>
> Alphabet: Precure Alphabet
>
> CH POSTAL COMPANY: Company in Violet Evergarden
>
> TYPE OF CORRECTION OR RAY: gamma
>
>
>
> Alphabet: Imanity Alphabet (No Game No Life)
>
> DR. GEL: antagonist in Space Dandy
>
> GARACHINE AIRPORT CODE: GHE
>
>
>
> Alphabet: Unovian Alphabet (Pokémon)
>
> ORARIO: City in Is It Wrong to Try to Pick Up Girls in a Dungeon?
>
> MUSICAL BUILDUP OF LOUDNESS: crescendo
>
>
>
> Alphabet: Witch runes (Puella Magi Madoka Magica)
>
> EXPLOOOSION: Megumin's [signature spell chant](https://www.youtube.com/watch?v=coYieIF8I5M) in Konosuba
>
> TRACK EIGHT FROM STARRS ALBUM RINGO: "Six O'Clock"
>
>
>
> Alphabet: Space Dandy Alphabet
>
> ENCHANTED PARADE: Little Witch Academia series subtitle
>
> WORD AFTER ZERO FLUTE RHYMING WITH DRINK: countersink
>
>
>
> Alphabet: Zentradi Alphabet (Super Dimension Fortress Macross)
>
> BEST WISHES: Pokémon series subtitle
>
> WORD AFTER EUROPEAN OR TRADE: union
>
>
>
> Alphabet: Leiden Alphabet (Violet Evergarden)
>
> OLD DEUS: race in No Game No Life
>
> THINK WORK SERVE SCHOOL INITS: TSU
>
>
>
> Alphabet: Hell Alphabet (The World God Only Knows)
>
> MY BOYFRIEND IS A PILOT (Super Dimension Fortress Macross song)
>
> EARLY BYZANTINE GOLD COIN: solidus
>
>
>
We can notice that for each block of text,
>
> The first line refers to one of the anime the scripts come from, and the second line gives a word that represents a symbol. For instance, solidus is another name for slash, and the mathematical symbol for union is ∪.
>
>
>
Then @Deusovi brilliantly noticed that
>
> The symbols described are all part of the [Moon type](https://en.wikipedia.org/wiki/Moon_type) writing system, giving the letters, in order: HIMTEEKIVUDS
>
>
>
The final step is to
>
> Reorder the blocks in a cycle, in which the anime reference for one block is where the alphabet for the next block in the cycle comes from. The starting point of the cycle is the Luna Alphabet block, as indicated by the arrow pointing to it in the image. Doing so gives us the letters TSUKIHIME DEV:
>
>
>
> [](https://i.stack.imgur.com/ALjYR.png)
>
>
>
Giving us the final answer...
>
> Type-Moon. Quite fitting.
>
>
>
As a side note,
>
> The initials to this puzzle's title, Unintelligible Batch of Wingdinglish, are the same as those of Unlimited Blade Works, another TYPE-MOON creation.
>
>
> | Wrap-up: The Making Of *Unintelligible Batch of Wingdinglish*
=============================================================
*This is not a solution to the puzzle, but provides notes from its poser. This type of answer has been [approved by the community](https://puzzling.meta.stackexchange.com/questions/5420/).*
---
Just a number of comments not covered by the other answers, and also some background.
>
> - This puzzle's presentation is intended to be a mega version of [this puzzle by @Rubio](https://puzzling.stackexchange.com/questions/61750/when-was-this-marvelous-thing-first-invented), posted two days earlier.
>
>
>
> - Wingdinglish is a reference to [this TVTropes page](http://tvtropes.org/pmwiki/pmwiki.php/Main/Wingdinglish), which as of writing mentions two of the alphabets used.
>
>
>
> - [@Fifth\_H0r5eman's answer](https://puzzling.stackexchange.com/a/61854/46455) makes this slightly more obvious than [@Gareth McCaughan's](https://puzzling.stackexchange.com/a/61853/46455), but in addition to the white pixels, some of the black pixels are one bit off.
>
>
>
> - Some of these alphabets have been turned into useable fonts by fans. Whilst using such fonts would improve readability, it would look odd if half the puzzle was tablet-drawn, even if the alternative meant wrangling with [Imanity-go](http://no-game-no-life.wikia.com/wiki/Imanity-go).
>
>
>
> - Some candidate alphabets had to be cut due to mapping to Japanese kana instead of English letters, or due to difficulty of research.
>
>
>
> - Alphabet selection was influenced by how much I verified and trusted the charts used. [Primary sources](http://www.toei-anim.co.jp/tv/mahotsukai_precure/special/) were preferable but usually not available, alas.
>
>
>
> - @Deusovi managed to skip this step, but reading the first lines in chain order (ELSIE, MY BOYFRIEND IS A PILOT, ...) spells out EMBOSSED CODE.
>
>
>
> - Due to the first letters restriction, assigning good first-line clues proved surprisingly tricky, especially due to not being familiar with some of the series involved. As such some clues ended up referencing a franchise rather than the specific entry within the franchise, e.g. SHADOW ANGEL is more a reference to [Genesis of Aquarion](https://en.wikipedia.org/wiki/Genesis_of_Aquarion), rather than its sequel [Aquarion EVOL](https://en.wikipedia.org/wiki/Aquarion_Evol) which provides the alphabet used.
>
>
>
> - At least one clue was scrapped to avoid solvers potentially researching their way into spoilers, even though it would have improved the puzzle.
>
>
>
> - At least one clue was tweaked due to different circulated fan charts conflicting on the character used.
>
>
>
> - As @ffao points out, the title initals UBW is a reference to Unlimited Blade Works, part of the [Fate](https://en.wikipedia.org/wiki/Fate/stay_night) universe by Type-Moon.
>
>
> |
3,070,274 | I'm looking for a way to do something like this:
```
// style.css
@def borderSize '2px';
.style {
width: borderSize + 2;
height: borderSize + 2;
}
```
where the width and height attributes would end up having values of 4px. | 2010/06/18 | [
"https://Stackoverflow.com/questions/3070274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317404/"
] | Mozilla kind-of-sort-of-not-really supports this with it's CSS `calc()` function.
This example shamelessly stolen (with attribution!) from [Ajaxian](http://ajaxian.com/archives/css-calc-in-the-house)
```
/*
* Two divs aligned, split up by a 1em margin
*/
#a {
width:75%;
margin-right: 1em;
}
#b {
width: -moz-calc(25% - 1em);
}
```
It's not cross-browser, and it's probably only barely supported by even bleeding-edge versions of Firefox, but there's at least being progress made in that direction. | I would also love somehting like that, but it's not possible.
Even in CSS 3 their is nothing planned like this.
If you really want to make something like that, one possibility is to use
php and configure your webserver, so that .css files are parsed by php.
So you could do something like
```
<?
$borderSize = 2;
?>
.style {
width: <? borderSize+2 ?>px;
height: <? borderSize+2 ?>px;
}
```
But as this is no 'standard' way, i think its better to not do it. |
3,070,274 | I'm looking for a way to do something like this:
```
// style.css
@def borderSize '2px';
.style {
width: borderSize + 2;
height: borderSize + 2;
}
```
where the width and height attributes would end up having values of 4px. | 2010/06/18 | [
"https://Stackoverflow.com/questions/3070274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317404/"
] | Sometimes I use the following:
```
@eval BORDER_SIZE_PLUS_2 2+2+"px"; /* GWT evaluates this at compile time! */
```
Oddly, this only works, if you don't put any spaces between the `+` operator and the operands. Also, in @eval you can't use constants that were previously defined by @def. You can however use constants that are defined as static fields in one of your Java classes:
```
@eval BORDER_SIZE_PLUS_2 com.example.MyCssConstants.BORDER_SIZE+2+"px";
```
Or you could let the calculation be performed completely by Java:
```
@eval WIDTH com.example.MyCssCalculations.width(); /* static function,
no parameters! */
@eval HEIGHT com.example.MyCssCalculations.height();
.style {
width: WIDTH;
height: HEIGHT;
}
```
But what I would actually like to do is very similar to your suggestion:
```
@def BORDER_SIZE 2;
.style {
width: value(BORDER_SIZE + 2, 'px'); /* not possible */
height: value(BORDER_SIZE + 3, 'px');
}
```
I don't think that's possible in GWT 2.0. Maybe you find a better solution - here's the [Dev Guide](http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#CssResource) page on this topic. | I would also love somehting like that, but it's not possible.
Even in CSS 3 their is nothing planned like this.
If you really want to make something like that, one possibility is to use
php and configure your webserver, so that .css files are parsed by php.
So you could do something like
```
<?
$borderSize = 2;
?>
.style {
width: <? borderSize+2 ?>px;
height: <? borderSize+2 ?>px;
}
```
But as this is no 'standard' way, i think its better to not do it. |
3,070,274 | I'm looking for a way to do something like this:
```
// style.css
@def borderSize '2px';
.style {
width: borderSize + 2;
height: borderSize + 2;
}
```
where the width and height attributes would end up having values of 4px. | 2010/06/18 | [
"https://Stackoverflow.com/questions/3070274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317404/"
] | You could also calculate in your provider method, if you put a parameter in the function:
```
@eval baseFontSize com.myexample.CssSettingsProvider.getBaseFontSize(0)+"pt";
@eval baseFontSize_plus_1 com.myexample.CssSettingsProvider.getBaseFontSize(1)+"pt";
```
`com.myexample.CssSettingsProvider` would look like this:
```
public static int getBaseFontSize(int sizeToAdd) {
if (true) {
return 9 + sizeToAdd;
}
return baseFontSize;
}
``` | I would also love somehting like that, but it's not possible.
Even in CSS 3 their is nothing planned like this.
If you really want to make something like that, one possibility is to use
php and configure your webserver, so that .css files are parsed by php.
So you could do something like
```
<?
$borderSize = 2;
?>
.style {
width: <? borderSize+2 ?>px;
height: <? borderSize+2 ?>px;
}
```
But as this is no 'standard' way, i think its better to not do it. |
3,070,274 | I'm looking for a way to do something like this:
```
// style.css
@def borderSize '2px';
.style {
width: borderSize + 2;
height: borderSize + 2;
}
```
where the width and height attributes would end up having values of 4px. | 2010/06/18 | [
"https://Stackoverflow.com/questions/3070274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317404/"
] | Sometimes I use the following:
```
@eval BORDER_SIZE_PLUS_2 2+2+"px"; /* GWT evaluates this at compile time! */
```
Oddly, this only works, if you don't put any spaces between the `+` operator and the operands. Also, in @eval you can't use constants that were previously defined by @def. You can however use constants that are defined as static fields in one of your Java classes:
```
@eval BORDER_SIZE_PLUS_2 com.example.MyCssConstants.BORDER_SIZE+2+"px";
```
Or you could let the calculation be performed completely by Java:
```
@eval WIDTH com.example.MyCssCalculations.width(); /* static function,
no parameters! */
@eval HEIGHT com.example.MyCssCalculations.height();
.style {
width: WIDTH;
height: HEIGHT;
}
```
But what I would actually like to do is very similar to your suggestion:
```
@def BORDER_SIZE 2;
.style {
width: value(BORDER_SIZE + 2, 'px'); /* not possible */
height: value(BORDER_SIZE + 3, 'px');
}
```
I don't think that's possible in GWT 2.0. Maybe you find a better solution - here's the [Dev Guide](http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#CssResource) page on this topic. | Mozilla kind-of-sort-of-not-really supports this with it's CSS `calc()` function.
This example shamelessly stolen (with attribution!) from [Ajaxian](http://ajaxian.com/archives/css-calc-in-the-house)
```
/*
* Two divs aligned, split up by a 1em margin
*/
#a {
width:75%;
margin-right: 1em;
}
#b {
width: -moz-calc(25% - 1em);
}
```
It's not cross-browser, and it's probably only barely supported by even bleeding-edge versions of Firefox, but there's at least being progress made in that direction. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.