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
|
---|---|---|---|---|---|
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | ### Use a mixture to modify the water's properties
You could use an antifreeze/water mixture that you put in a bottle. You will have a much lower freezing and higher boiling point that just water. This will allow you to keep your frozen packs at a lower temperature than plain ice for longer.
### Safety Concerns
You will also need to be **extremely careful with antifreeze around food and/or drinks as it is toxic to almost all mammals.** Other creatures may also have toxic reactions to the antifreeze. Insure that if you use a recycled water bottle that it is **extremely difficult** (*aim for impossible*) for you and/or **children** to get into it.
### Options
You could also try using alcohol instead of water. It is the same principle as mixing antifreeze with water. It is also much safer than antifreeze, but you will still need to modify the bottle to prevent child access. | The "R" value of the cooler insulation as well as the seal around the lid are important in retaining the cold. The size of the cooler is also important because the ratio of ice to the product you are trying to keep cool is also a factor. You can get pink RV anti-freeze used to winterize drinking water pipes and tanks in boats and motor homes It is I would assume non-toxic if accidentally ingested. Ice packs made from anti-freeze would probably cool faster to a lower temperature but not for a longer time. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | ### Use a mixture to modify the water's properties
You could use an antifreeze/water mixture that you put in a bottle. You will have a much lower freezing and higher boiling point that just water. This will allow you to keep your frozen packs at a lower temperature than plain ice for longer.
### Safety Concerns
You will also need to be **extremely careful with antifreeze around food and/or drinks as it is toxic to almost all mammals.** Other creatures may also have toxic reactions to the antifreeze. Insure that if you use a recycled water bottle that it is **extremely difficult** (*aim for impossible*) for you and/or **children** to get into it.
### Options
You could also try using alcohol instead of water. It is the same principle as mixing antifreeze with water. It is also much safer than antifreeze, but you will still need to modify the bottle to prevent child access. | Place you whole cooler in extra isolation, like a good sleeping bag or several old blankets.
This works best if you do not have to open the cooler much or at all.
You can take out the beers all at once and keep them cool by rolling them, individualy, in a big towel.
That allows the cooler to stay at a steady temperature. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | Insulate your cooler more effectively.
--------------------------------------
You didn't mention what type of cooler you are using, so I am guessing that you have a standard injection molded plastic cooler. If you have Styrofoam, then this answer won't work for you.
Drill a hole into the injection molded plastic at one corner so that your hole makes it between the layers of plastic. On the opposite corner, drill another hole so that will allow air to escape. Buy a can of insulating spray foam at your favorite hardware store. Following the instructions on the can, spray the foam into either of the holes you drilled previously. Once you have foam flowing out the other hole, you will want to rotate the cooler to get the foam in as many places internally as possible. Use the quick curing foam so you don't have to tape the holes closed. Let it sit as per the instructions on the can.
If you find that you have missed sections of the cooler, you can always drill more holes and repeat the steps as necessary. | The "R" value of the cooler insulation as well as the seal around the lid are important in retaining the cold. The size of the cooler is also important because the ratio of ice to the product you are trying to keep cool is also a factor. You can get pink RV anti-freeze used to winterize drinking water pipes and tanks in boats and motor homes It is I would assume non-toxic if accidentally ingested. Ice packs made from anti-freeze would probably cool faster to a lower temperature but not for a longer time. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | Insulate your cooler more effectively.
--------------------------------------
You didn't mention what type of cooler you are using, so I am guessing that you have a standard injection molded plastic cooler. If you have Styrofoam, then this answer won't work for you.
Drill a hole into the injection molded plastic at one corner so that your hole makes it between the layers of plastic. On the opposite corner, drill another hole so that will allow air to escape. Buy a can of insulating spray foam at your favorite hardware store. Following the instructions on the can, spray the foam into either of the holes you drilled previously. Once you have foam flowing out the other hole, you will want to rotate the cooler to get the foam in as many places internally as possible. Use the quick curing foam so you don't have to tape the holes closed. Let it sit as per the instructions on the can.
If you find that you have missed sections of the cooler, you can always drill more holes and repeat the steps as necessary. | Place you whole cooler in extra isolation, like a good sleeping bag or several old blankets.
This works best if you do not have to open the cooler much or at all.
You can take out the beers all at once and keep them cool by rolling them, individualy, in a big towel.
That allows the cooler to stay at a steady temperature. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | I've never done this myself, but I've camped with people who have used dry ice to keep things cold/frozen over the course of four days.
Dry ice is much colder than regular ice, so you may actually have to insulate things you don't want to freeze from it. Keep it at the bottom of the bag, or maybe move it to the top if it isn't cooling as much.
It's a bad idea to hold dry ice with your hands, so think about plastic bags and tongs.
I would also say that dry ice is a "slower" coolant, so try not to open your cooler as much. | The "R" value of the cooler insulation as well as the seal around the lid are important in retaining the cold. The size of the cooler is also important because the ratio of ice to the product you are trying to keep cool is also a factor. You can get pink RV anti-freeze used to winterize drinking water pipes and tanks in boats and motor homes It is I would assume non-toxic if accidentally ingested. Ice packs made from anti-freeze would probably cool faster to a lower temperature but not for a longer time. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | I've never done this myself, but I've camped with people who have used dry ice to keep things cold/frozen over the course of four days.
Dry ice is much colder than regular ice, so you may actually have to insulate things you don't want to freeze from it. Keep it at the bottom of the bag, or maybe move it to the top if it isn't cooling as much.
It's a bad idea to hold dry ice with your hands, so think about plastic bags and tongs.
I would also say that dry ice is a "slower" coolant, so try not to open your cooler as much. | Place you whole cooler in extra isolation, like a good sleeping bag or several old blankets.
This works best if you do not have to open the cooler much or at all.
You can take out the beers all at once and keep them cool by rolling them, individualy, in a big towel.
That allows the cooler to stay at a steady temperature. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | This may seem to be a simple approach but here it goes. 2 options:
1. 2 separate coolers, one for beers one for food. If you don't open the food cooler till the morning the cooling will last much longer.
2. The easier option: place your beers in the freezer as well not long enough for them to freeze but maybe 5 hours they would drop to -4 > -7 degrees, but not freeze. Therefore bottles or cans are not damaged but cold enough that they will double the life of your cooler as they will continue to cool all the time they are in there. | The "R" value of the cooler insulation as well as the seal around the lid are important in retaining the cold. The size of the cooler is also important because the ratio of ice to the product you are trying to keep cool is also a factor. You can get pink RV anti-freeze used to winterize drinking water pipes and tanks in boats and motor homes It is I would assume non-toxic if accidentally ingested. Ice packs made from anti-freeze would probably cool faster to a lower temperature but not for a longer time. |
7,812 | I'd like to make some extra icepacks to put in my coolbag. The 2 commercial icepacks it comes with don't maintain the temperature for long enough, so I've tried supplementing them with plastic bottles of water that I've frozen. This works reasonably well but are there other containers that would work better and is there anything I could add to the water? | 2015/07/27 | [
"https://lifehacks.stackexchange.com/questions/7812",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/5304/"
] | This may seem to be a simple approach but here it goes. 2 options:
1. 2 separate coolers, one for beers one for food. If you don't open the food cooler till the morning the cooling will last much longer.
2. The easier option: place your beers in the freezer as well not long enough for them to freeze but maybe 5 hours they would drop to -4 > -7 degrees, but not freeze. Therefore bottles or cans are not damaged but cold enough that they will double the life of your cooler as they will continue to cool all the time they are in there. | Place you whole cooler in extra isolation, like a good sleeping bag or several old blankets.
This works best if you do not have to open the cooler much or at all.
You can take out the beers all at once and keep them cool by rolling them, individualy, in a big towel.
That allows the cooler to stay at a steady temperature. |
175,583 | >
> **Possible Duplicate:**
>
> [Where does this concept of “favor composition over inheritance” come from?](https://softwareengineering.stackexchange.com/questions/65179/where-does-this-concept-of-favor-composition-over-inheritance-come-from)
>
>
>
I have colleagues at work who claim that "Inheritance is an anti-pattern" and want to use composition systematically instead, except in (rare, according to them) cases where inheritance is really the best way to go.
I want to suggest an alternative where we continue using inheritance, but it is strictly forbidden (enforced by code reviews) to use anything but public members of base classes in derived classes.
For a case where we don't need to swap components of a class at runtime (static inheritance), would that be equivalent enough to composition? Or am I forgetting some other important aspect of composition? | 2012/11/12 | [
"https://softwareengineering.stackexchange.com/questions/175583",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/65385/"
] | You're sort of looking at it backwards. Composition isn't preferred because of some unseen benefit of composition, it's preferred because it avoids the drawbacks of inheritance. Inheritance adds the significant benefit of substitutability. However, that benefit comes with the significant cost of tight coupling. Inheritance is the strongest coupling relationship possible. If you don't need the substitutability, the coupling cost isn't worth it.
Your restricted version of inheritance addresses its other cost, a loss of encapsulation, but does nothing about the much more significant cost of coupling. | I think the difference between the two things is in their intent. Is the class you are writing really meant to be used as replacement / specialisation of its Base class or is it just using some functionality? If the First Case is true you should go with inheritance. If the latter is true go for composition. In my experience using inheritance where composition would be appropriate creates a more complex, less understandable and meanigful codebase. |
11,708,005 | I want to know how to put text to a website's textbox with VB.NET.
Like when you complete a textbox and press enter.
Something like this:
Dim web as webbrowser
web.document.textbox(1).insert("text") | 2012/07/29 | [
"https://Stackoverflow.com/questions/11708005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1494250/"
] | it would look something like this:
```
WebBrowser1.Document.GetElementById("login_password").SetAttribute("value", TextBox2.Text)
``` | As giuseppe has suggested, you need to search for the element in the document and then set it's value property. for example following code logins into website by setting its userId and password textboxes and clicking the submit button.
```
Dim htmlDoc=WebBrowser1.Document
Dim elem_Input_UsrName As HtmlElement = htmlDoc.GetElementById("username")
Dim elem_Input_PssWrd As HtmlElement = htmlDoc.GetElementById("password")
Dim elem_Input_Submit As HtmlElement = getElementByClassName("Submit", "Input", htmlDoc)
If elem_Input_UsrName IsNot Nothing AndAlso elem_Input_PssWrd IsNot Nothing Then
elem_Input_UsrName.SetAttribute("value", "[email protected]")
elem_Input_PssWrd.SetAttribute("value", "yourpassoword")
elem_Input_Submit.InvokeMember("click")
End If
``` |
11,708,005 | I want to know how to put text to a website's textbox with VB.NET.
Like when you complete a textbox and press enter.
Something like this:
Dim web as webbrowser
web.document.textbox(1).insert("text") | 2012/07/29 | [
"https://Stackoverflow.com/questions/11708005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1494250/"
] | it would look something like this:
```
WebBrowser1.Document.GetElementById("login_password").SetAttribute("value", TextBox2.Text)
``` | This will help 100%:
```
webbrowser1.document.getElementById("yourtextboxidinwebsite").innertext = textbox1.text
``` |
11,708,005 | I want to know how to put text to a website's textbox with VB.NET.
Like when you complete a textbox and press enter.
Something like this:
Dim web as webbrowser
web.document.textbox(1).insert("text") | 2012/07/29 | [
"https://Stackoverflow.com/questions/11708005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1494250/"
] | it would look something like this:
```
WebBrowser1.Document.GetElementById("login_password").SetAttribute("value", TextBox2.Text)
``` | I get a way that if u want to receive from the website itself another way I need to receive results from the website into the text box. U can use this method.
first, make a web browser to load the page
WebBrowser1.Navigate("https://tools.keycdn.com/geo")
then this
```
TextBox1.Text = WebBrowser1.Document.GetElementById("geoResult").InnerText
``` |
725,817 | I'm seeing a strange problem with the ADFS updatepassword page. We're batch-creating users, and they are trying to change their passwords. However, roughly 50% of the accounts can't change their password, the following event is logged:
>
> Password change failed for following user:
>
>
> Additional Data
>
>
> User: DOMAIN\username
>
>
> Device Certificate:
>
>
> Server on which password change was attempted: ad01.ad.domain Error
> details: NewPasswordHistConflict
>
>
>
The error would indicate that the password is the same as the previous, but we've tested several different passwords, and still get the same error. I can't find anything special common between the accounts that have problems and those who don't.
The users are created with this Powershell line:
```
New-ADUser -Name $displayName -DisplayName $displayName -SamAccountName $accountName`
-GivenName $FirstName -Surname $LastName -EmailAddress $Email -Path $oupath`
-UserPrincipalName "[email protected]" -AccountPassword $securePassword `
-Enabled $true
```
Any ideas? The domain controllers and ADFS is Windows 2012R2. | 2015/09/30 | [
"https://serverfault.com/questions/725817",
"https://serverfault.com",
"https://serverfault.com/users/38771/"
] | I've seen these types of problems (though not that specific one) because of the minimum password age policy. If set to 1 day it means that once the user changes their password, they cannot do so again for 1 day.
So when you bulk create you need a dummy password because you can't create a user without one and then the user changes the password on the same day etc. | I'm not terribly familiar with using ADFS to change passwords, but in my experience, AD doesn't get that specific with why a new password was rejected. It's usually just an error that the new password violated some aspect of the password policy (history, complexity, length, minimum age, etc).
In the interest of troubleshooting though, I'd probably try modifying your password policy temporarily. Start by setting the passwords remembered value to 0 so password history wouldn't be a problem anymore. If that doesn't solve it, keep loosening the policy one setting at a time until your failures go away and you'll hopefully arrive at the real problem. |
242,604 | Working to remove the Gift Card feature on Magento 2 Cart summary section. Having issue getting this working.
Have created the following file:
```
.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_cart_index.xml
```
The following code is not working to remove the giftcard block:
```
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="cart.summary">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="block-giftcard" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | 2018/09/17 | [
"https://magento.stackexchange.com/questions/242604",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/48552/"
] | After reading the first proposed solution which had already been tested, searched and found the module block in gift-card-account and this is the solution in the same file I was using in my question:
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="cart.summary">
<referenceBlock name="checkout.cart.giftcardaccount" remove="true"/>
</referenceContainer>
</body>
</page>
```
As it may be useful for removing the gift card from the checkout page you can add/edit this file:
```
.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_index_index.xml
```
with this code:
```
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="giftCardAccount" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | The `Gift Card` is in `module-gift-message` and not in `module_checkout`so :
>
> /app/design/frontend/{Vendor}/{themeName}/Magento\_GiftMessage/layout/checkout\_cart\_index.xml
>
>
>
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.order.actions.gift_options" remove="true"/>
</body>
</page>
``` |
242,604 | Working to remove the Gift Card feature on Magento 2 Cart summary section. Having issue getting this working.
Have created the following file:
```
.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_cart_index.xml
```
The following code is not working to remove the giftcard block:
```
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="cart.summary">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="block-giftcard" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | 2018/09/17 | [
"https://magento.stackexchange.com/questions/242604",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/48552/"
] | To remove the Gift Card Message block from the cart page I tried the layout block remove instructions but it throughs me a JS error in the console for missing gift-message component.
I found the below solutions that works for me in proper way by dislabling the gift message component for Cart page.
>
> Create File:
>
>
>
```
app/design/frontend/{YourThemePackage}/{yourtheme}/Magento_GiftMessage/layout/checkout_cart_index.xml
```
>
> Add XML instructions to disabled gift-message component:
>
>
>
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.order.actions.gift_options">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="giftOptionsCart" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | The `Gift Card` is in `module-gift-message` and not in `module_checkout`so :
>
> /app/design/frontend/{Vendor}/{themeName}/Magento\_GiftMessage/layout/checkout\_cart\_index.xml
>
>
>
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.order.actions.gift_options" remove="true"/>
</body>
</page>
``` |
242,604 | Working to remove the Gift Card feature on Magento 2 Cart summary section. Having issue getting this working.
Have created the following file:
```
.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_cart_index.xml
```
The following code is not working to remove the giftcard block:
```
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="cart.summary">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="block-giftcard" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | 2018/09/17 | [
"https://magento.stackexchange.com/questions/242604",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/48552/"
] | After reading the first proposed solution which had already been tested, searched and found the module block in gift-card-account and this is the solution in the same file I was using in my question:
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="cart.summary">
<referenceBlock name="checkout.cart.giftcardaccount" remove="true"/>
</referenceContainer>
</body>
</page>
```
As it may be useful for removing the gift card from the checkout page you can add/edit this file:
```
.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_index_index.xml
```
with this code:
```
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="giftCardAccount" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` | To remove the Gift Card Message block from the cart page I tried the layout block remove instructions but it throughs me a JS error in the console for missing gift-message component.
I found the below solutions that works for me in proper way by dislabling the gift message component for Cart page.
>
> Create File:
>
>
>
```
app/design/frontend/{YourThemePackage}/{yourtheme}/Magento_GiftMessage/layout/checkout_cart_index.xml
```
>
> Add XML instructions to disabled gift-message component:
>
>
>
```
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.order.actions.gift_options">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="giftOptionsCart" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
``` |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | Personally, I feel that the beauty of the badges is in their names. Some are very creative and others are well, some may say abstract.
As much as part of me is curious/excited to see how the graphical badges might turn out, I feel that it will dilute the names' impact.
Having say that, maybe someone can come out with a couple 'prototype' graphical badges that can swing my vote. :P
UPDATE:
Added dboarman's recommendation
[some badges from dboarman http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544](http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544) | For some reason, this reminded me of [a scene from *Time Bandits*](http://www.youtube.com/watch?v=jmS_hMnFNVM#t=1m12s). View last few seconds starting from about 1:12. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | You can see graphical badges on some of the Stack Exchange sites -- epic advice and VFX overflow come to mind.
While I fully support this kind of customization for SE, I am not sure it really fits well with the highly-text oriented, no frills nature of the trilogy at the moment. | For some reason, this reminded me of [a scene from *Time Bandits*](http://www.youtube.com/watch?v=jmS_hMnFNVM#t=1m12s). View last few seconds starting from about 1:12. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | It doesn't sound real useful even for visual effect, since the badges are only seen when you look at your profile page or the badge page. | For some reason, this reminded me of [a scene from *Time Bandits*](http://www.youtube.com/watch?v=jmS_hMnFNVM#t=1m12s). View last few seconds starting from about 1:12. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | My eyes are already bleeding | You can see graphical badges on some of the Stack Exchange sites -- epic advice and VFX overflow come to mind.
While I fully support this kind of customization for SE, I am not sure it really fits well with the highly-text oriented, no frills nature of the trilogy at the moment. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | Personally, I feel that the beauty of the badges is in their names. Some are very creative and others are well, some may say abstract.
As much as part of me is curious/excited to see how the graphical badges might turn out, I feel that it will dilute the names' impact.
Having say that, maybe someone can come out with a couple 'prototype' graphical badges that can swing my vote. :P
UPDATE:
Added dboarman's recommendation
[some badges from dboarman http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544](http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544) | You can see graphical badges on some of the Stack Exchange sites -- epic advice and VFX overflow come to mind.
While I fully support this kind of customization for SE, I am not sure it really fits well with the highly-text oriented, no frills nature of the trilogy at the moment. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | Personally, I feel that the beauty of the badges is in their names. Some are very creative and others are well, some may say abstract.
As much as part of me is curious/excited to see how the graphical badges might turn out, I feel that it will dilute the names' impact.
Having say that, maybe someone can come out with a couple 'prototype' graphical badges that can swing my vote. :P
UPDATE:
Added dboarman's recommendation
[some badges from dboarman http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544](http://imgcash4.imageshack.us/img197/8514/badgeideas.png?0.6349713410095544) | It doesn't sound real useful even for visual effect, since the badges are only seen when you look at your profile page or the badge page. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | We do have a very large community here.
Of programmers, system administrators and computer power users.
I'm not sure I'd count too heavily on this community for engaging, attractive, consistent (from a design language perspective) graphical icons.
Now, if you want a bunch of awesome freehand MS Paint art, you are totally in the right place. Freehand circles and arrows FTW! | For some reason, this reminded me of [a scene from *Time Bandits*](http://www.youtube.com/watch?v=jmS_hMnFNVM#t=1m12s). View last few seconds starting from about 1:12. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | You can see graphical badges on some of the Stack Exchange sites -- epic advice and VFX overflow come to mind.
While I fully support this kind of customization for SE, I am not sure it really fits well with the highly-text oriented, no frills nature of the trilogy at the moment. | It doesn't sound real useful even for visual effect, since the badges are only seen when you look at your profile page or the badge page. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | My eyes are already bleeding | It doesn't sound real useful even for visual effect, since the badges are only seen when you look at your profile page or the badge page. |
38,330 | Well, the faq does say no question is too small and I haven't found this question asked elsewhere so...
I'd like to suggest the introduction of icons for the badges, as seen in Team Fortress 2, Day of Defeat: Source or even Kongregate. Imagine your favourite badge transformed with a colourful and amusing image!
With a community as large and diverse as this one, we ought to be able to come up with some decent badge icons.
What say ye?
EDIT: How about them apples? (Just a sample of what's possible..)
<http://www.freeimagehosting.net/uploads/708d33b019.jpg> Commentor
<http://www.freeimagehosting.net/uploads/e367b04bbe.jpg> Epic | 2010/02/04 | [
"https://meta.stackexchange.com/questions/38330",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/142697/"
] | My eyes are already bleeding | We do have a very large community here.
Of programmers, system administrators and computer power users.
I'm not sure I'd count too heavily on this community for engaging, attractive, consistent (from a design language perspective) graphical icons.
Now, if you want a bunch of awesome freehand MS Paint art, you are totally in the right place. Freehand circles and arrows FTW! |
32,156,993 | How do I override the string representation for a single function in Python?
What I have tried:
```
>>> def f(): pass
...
>>> f
<function f at 0x7f7459227758>
>>> f.__str__ = lambda self: 'qwerty'
>>> f
<function f at 0x7f7459227758>
>>> f.__repr__ = lambda self: 'asdfgh'
>>> f
<function f at 0x7f7459227758>
>>> f.__str__(f)
'qwerty'
>>> f.__repr__(f)
'asdfgh'
```
I know I can get the expected behavior by making a class with `__call__` (to make it look like a function) and `__str__` (to customize the string representation). Still, I'm curious if I can get something similar with regular functions. | 2015/08/22 | [
"https://Stackoverflow.com/questions/32156993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852604/"
] | You can't. `__str__` and `__repr__` are special methods and thus are [always looked up on the type](https://docs.python.org/2/reference/datamodel.html#special-method-lookup-for-new-style-classes), not the instance. You'd have to override `type(f).__repr__` here, but that then would apply to *all* functions.
Your only realistic option then is to use a wrapper object with a `__call__` method:
```
def FunctionWrapper(object):
def __init__(self, callable):
self._callable = callable
def __call__(self, *args, **kwargs):
return self._callable(*args, **kwargs)
def __repr__(self):
return '<custom representation for {}>'.format(self._callable.__name__)
``` | As explained by MartijnPieters, you can't do it without going through a class. But you can easily write a decorator which completely hides the added complexity:
```
from functools import update_wrapper
class _CustomReprFunc(object):
def __init__(self, fn, repr_):
self.fn = fn
self.repr = repr_
update_wrapper(self, fn)
def __repr__(self):
return self.repr
def __call__(self, *args, **kwargs):
return self.fn(*args, **kwargs)
def custom_repr(repr_):
def decorator(fn):
return _CustomReprFunc(fn, repr_)
return decorator
```
Usage:
```
@custom_repr('foobar')
def foo():
"""foo function"""
return 'bar'
``` |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | Well I responded to some posts above that had incorrect information, but I figured I should just post my own response to better explain.
Anonymous is made up of basically 2 subgroups:
1. Skiddies (script kiddies) and newbies who have only the most basic security knowledge, and just sit in their IRC and basically be the pwns for the attack. These are the people that the FBI was knocking down their doors.
2. Anonymous core leadership, a group with some hacking knowledge that owned hbgary, but also got owned recently by ninja hack squad. You won't be able to trace this subgroup unless you are a security guru.
**How do they hide their tracks?**
Like a previous answerers mentioned,
1. **Through proxy servers** like Tor
2. **by compromising boxes and launching attacks from those boxes** (basically masquerading as that person's IP), or
3. **by using a VPN that's in a foreign country** and keeps no logs. With the VPN, all your traffic is relayed through it so wherever you connect it can only track back the IP addy to the VPN itself and no further (unless the VPN is keeping logs in which case you shouldn't use it anyways).
Hope this helps clarify a bit. | Maybe you should read [this PDF](http://cryptome.org/0003/anonymous-barr.pdf). They are not so anonymous. The LOIC tool used for DDOS, leaks the original IP of the person using it. You can use the browser (JavaScript) version of the same tool, maybe hiding behind Tor.
HBGary Federal exposed their names and addresses in that PDF. That is why they attacked his site, email, wipe his iPad, took over his twitter etc....
Search the #hbgary hashtag on twitter for more info on that. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | In addition to the answers that have already been given, another reason it is so hard to catch **anonymous** is because **anonymous** can be anyone, literally. I mean this in two ways. First, hackers can use a combination of malware, spyware, and bots to access and use/loop through other peoples computers anywhere in the world; thus, making any computer, theoretically, a point from which **anonymous** can work. Secondly, true to the name **anonymous**, any hacker, anywhere, using any method or style, using any random pattern of activity, can make their attack and call themselves **anonymous**. Thus, it is extremely difficult for a government/authority to track activity by pattern or style or signature, because it is always changing due to the varied nature of the attacks since it can, as I said before, literally be coming from anyone.
Essentially,
**Anonymous** is not one person...
**Anonymous** is not one group...
**Anonymous** is anywhere and everywhere...
**Anonymous** could be everyone or no one...
Unfortunately, that is the nature, uniqueness, and genius of the name. | Maybe you should read [this PDF](http://cryptome.org/0003/anonymous-barr.pdf). They are not so anonymous. The LOIC tool used for DDOS, leaks the original IP of the person using it. You can use the browser (JavaScript) version of the same tool, maybe hiding behind Tor.
HBGary Federal exposed their names and addresses in that PDF. That is why they attacked his site, email, wipe his iPad, took over his twitter etc....
Search the #hbgary hashtag on twitter for more info on that. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | One of the most important aspects of an attack like this is covering your tracks. There are lots of different ways to do this, as it depends on the technology. To address your specific questions:
When they DDoS: If the flood was coming from their own machines, then it would be fairly easy to track them. The problem lies in the fact that they aren't using their own machines. They are either a) taking control of someone elses without permission, or b) getting someone to do it on their behalf. The latter is what happened with the Wikileaks attacks. People signed up to to do it.
Things start getting hinky when servers are in countries that don't generally respond to requests for logs. If the company that is being attacked is in the US, it's fairly easy to get a court order if the attack can be proven to originate in the States. What happens if it's a US target, but the attack is originating in Russia or China? The same thing goes for purchase records.
As for being scared... there are quite a few of these sorts of groups out there. Most of them are (I don't want to say harmless, but...) harmless. In this particular case, someone poked the bear and the bear got pissed.
EDIT: Not that I condone their actions, blah blah blah. | In addition to the answers that have already been given, another reason it is so hard to catch **anonymous** is because **anonymous** can be anyone, literally. I mean this in two ways. First, hackers can use a combination of malware, spyware, and bots to access and use/loop through other peoples computers anywhere in the world; thus, making any computer, theoretically, a point from which **anonymous** can work. Secondly, true to the name **anonymous**, any hacker, anywhere, using any method or style, using any random pattern of activity, can make their attack and call themselves **anonymous**. Thus, it is extremely difficult for a government/authority to track activity by pattern or style or signature, because it is always changing due to the varied nature of the attacks since it can, as I said before, literally be coming from anyone.
Essentially,
**Anonymous** is not one person...
**Anonymous** is not one group...
**Anonymous** is anywhere and everywhere...
**Anonymous** could be everyone or no one...
Unfortunately, that is the nature, uniqueness, and genius of the name. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | One of the most important aspects of an attack like this is covering your tracks. There are lots of different ways to do this, as it depends on the technology. To address your specific questions:
When they DDoS: If the flood was coming from their own machines, then it would be fairly easy to track them. The problem lies in the fact that they aren't using their own machines. They are either a) taking control of someone elses without permission, or b) getting someone to do it on their behalf. The latter is what happened with the Wikileaks attacks. People signed up to to do it.
Things start getting hinky when servers are in countries that don't generally respond to requests for logs. If the company that is being attacked is in the US, it's fairly easy to get a court order if the attack can be proven to originate in the States. What happens if it's a US target, but the attack is originating in Russia or China? The same thing goes for purchase records.
As for being scared... there are quite a few of these sorts of groups out there. Most of them are (I don't want to say harmless, but...) harmless. In this particular case, someone poked the bear and the bear got pissed.
EDIT: Not that I condone their actions, blah blah blah. | [Here is an article](http://www.scientificamerican.com/article.cfm?id=tracking-cyber-hackers) asking (and answering) just that very question from the Scientific American site posted this month. The short answer to the question is spoofing of source addresses and the use of proxies. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | The thing about a DDoS is that you use *other people's* IPs, not your own. It's relatively simple to become untraceable on the Internet -- just route your traffic though a host that is not keeping traffic logs. As someone who frequently has to try to track these people down, I can tell you what an impossible nightmare it is. Here's the pattern I frequently see:
1. Select a relatively recent exploit in some web software package (e.g. joomla extension).
2. Use google to find an appropriately vulnerable attack target
3. From some location that can't be traced to you (e.g. coffee shop), execute the attack to gain control over the vulnerable server, but don't do anything else that would draw attention to yourself. (bonus points, fix the vulnerablity so no one comes in behind you). Delete any logs that might trace back to your presumed location.
4. Repeat the above, relaying your traffic through the previously compromised server. Repeat again several times until you're removed multiple steps from the machine that will be behaving as your proxy. Ideally these servers should be located in countries like China, India, Brasil, Mexico, etc., where datacenter techs tend to be *uncooperative* toward investigations, and should all be located in different countries as to create jurisdiction and communication nightmares for the people trying to track you.
Congratulations, you're now anonymous on the Internet. It's a bit like Tor, except none of the nodes know they're participating. Usually these attackers set up and use backdoors on servers for which no logs or records are kept (since the backdoor presumably doesn't exist). Once the attacker disconnects, that link becomes permanently untraceable.
One hop drops your chances of detection dramatically. Two hops makes detection almost impossible. Three hops and it's not even worth the effort. | Maybe you should read [this PDF](http://cryptome.org/0003/anonymous-barr.pdf). They are not so anonymous. The LOIC tool used for DDOS, leaks the original IP of the person using it. You can use the browser (JavaScript) version of the same tool, maybe hiding behind Tor.
HBGary Federal exposed their names and addresses in that PDF. That is why they attacked his site, email, wipe his iPad, took over his twitter etc....
Search the #hbgary hashtag on twitter for more info on that. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | There are NUMEROUS ways for a hacker to cover their tracks..
Here is one very generalized example:
A hacker can compromise a third party machine and use it to do attacks on the hackers behalf. Because the system is compromised, the hacker can delete/modify logs. A hacker can also piggyback machines, such as, log into machine A, from machine A log into machine B, from machine B log into machine C, from machine C attack machine D, then cleanse the logs for machines C, B, then A making tracking the hacker more difficult.
This doesn't even take into account hacked internet accounts (so even if traced back they point to a different person), open proxies, etc etc etc..
I know the above isn't flawless, but like I said this is just a VERY VERY general example. There are many many ways to cover your tracks.
That said, what makes you so sure certain 3 letter agencies don't already know who many of them are, but don't make a move on them so that those individuals can lead them to others?
I'm sure others will chime in who can explain more thoroughly, but I think the ultimate lesson to be learned is to concern yourself less with specific hackers and hacking groups, and more with your own security. The fact that their latest claim to fame originated from something as TRIVIAL to fix as a SQL Injection vulnerability (which is nothing new, very well documented and understood) is a huge discredit to the unnamed "security firm" who was hacked. *rant over* | Several post discuss the technical difficulties in finding the persons behind these groups. It is not at all easy to backtrack their activity when using many machines to create a sense of anonymity.
Another very important aspect is that the police, the intelligence communities around the globe and the different counties legislation is not really constructed to handle these situations. So if you find a server in one country that has been used to hop to a server in another country it takes too long to go through the proper channels to get the local police to get hold of the information. Even if you do the information such as logs are not always kept for longer periods of time.
It's easy to unlawfully hop around the Internet, but much much slower to hop around the Internet in a lawful way. This is a very prohibiting factor when trying to find these groups. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | Maybe you should read [this PDF](http://cryptome.org/0003/anonymous-barr.pdf). They are not so anonymous. The LOIC tool used for DDOS, leaks the original IP of the person using it. You can use the browser (JavaScript) version of the same tool, maybe hiding behind Tor.
HBGary Federal exposed their names and addresses in that PDF. That is why they attacked his site, email, wipe his iPad, took over his twitter etc....
Search the #hbgary hashtag on twitter for more info on that. | **Hackers can be caught, Anonymous cannot.** Anonymous is such a lose collective that it is not materially hurt by law enforcement striking out at its individual hackers. However, it does respond violently against any organization that attempts to do so. This means
* Its very hard to strike down Anonymous just by catching its members.
* Anonymous will make life hard on anyone who tries.
All Anonymous has to do is continue to be "not worth the effort" to go after its members en masse and it will continue to be free. However, they play a dangerous game. If the public ever decides they are a sufficient nuisance, then it will suddenly be worth the cost to track down and catch its members, enduring the counter-hacks by Anonymous as they go. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | From some experience with law enforcement and forensics, I can say one of the biggest issues is that ISPs really don't want to have to track users. Once they get beyond a certain level of management they lose 'common carrier' status and become liable for an awful lot of what their customers may do.
Also, many countries do not want to pass on information to another country - especially countries which may be opposed to western culture or western interference.
And it is extremely easy to hide almost anything on the internet.
Regarding your three points:
* **Server should have IP addresses** - No - this is simple to spoof or erase
* **Private server** - Not likely, although possible - but it wouldn't
be their credit card used
* **ISP's trace** - Not going to happen - it doesn't affect ISP's negatively, and is way too difficult
**update** It might happen after all - <http://blogs.forbes.com/andygreenberg/2011/03/18/ex-anonymous-hackers-plan-to-out-groups-members/> | There is one thing that hasn't been mentioned yet: the human factor.
These groups do not have a hierarchy as such, instead they form around a set of ideas. Most of the time, the only idea in common is "the governments are wrong, we must do justice by hacking", which is probably a feeling that's only getting stronger, with the current pressure the US gov (itself pressured by corporations) is putting in other countries below the covers to pass draconian laws against free speech that could harm the aforementioned corporations.
So the great appeal here, especially by Anonymous, is that if you have the knowledge and hate the government (who doesn't?), you can join them by yourself and on your own account and risk.
In order to see where this thinking comes from, I recommend the movie/comic novel "V for Vendetta", from which they took that mask you see so often.
Some groups, of course, have much less heroic intentions. LulzSec was "all for the lulz".
The bottom line is that yes, they might get a few members of each group, but more will show up. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | My answer pokes at the original question. What makes you think that they don't get caught?
The CIA and DoD found Osama bin Laden.
Typical means include OSINT, TECHINT, and HUMINT. Forensics can be done on Tor. Secure deletion tools such as sdelete, BCWipe, and DBAN are not perfect. Encryption tools such as GPG and Truecrypt are not perfect.
Online communications was perhaps Osama bin Laden's biggest strength (he had couriers that traveled to far away cyber-cafes using email on USB flash drives) and Anonymous/LulzSec's biggest weakness. They use unencrypted IRC usually. You think they'd at least be using OTR through Tor with an SSL proxy to the IM communications server(s) instead of a cleartext traffic through an exit node.
Their common use of utilities such as Havij and sqlmap could certainly backfire. Perhaps there is a client-side vulnerability in the Python VM. Perhaps there is a client-side buffer overflow in Havij. Perhaps there are backdoors in either.
Because of the political nature of these groups, there will be internal issues. I saw some news lately that 1 in 4 hackers are informants for the FBI.
It's not "difficult" to "catch" anyone. Another person on these forums suggested that I watch a video from a Defcon presentation where the presenter tracks down a Nigerian scammer using the advanced transform capabilities in Maltego. The OSINT capabilities of Maltego and the i2 Group Analyst's Notebook are fairly limitless. A little hint; a little OPSEC mistake -- and a reversal occurs: the hunter is now being hunted. | [Here is an article](http://www.scientificamerican.com/article.cfm?id=tracking-cyber-hackers) asking (and answering) just that very question from the Scientific American site posted this month. The short answer to the question is spoofing of source addresses and the use of proxies. |
2,231 | I'm not security literate, and if I was, I probably wouldn't be asking this question. As a regular tech news follower, I'm really surprised by the [outrage](http://en.wikipedia.org/wiki/Anonymous_%28group%29#Activities) of [Anonymous (hacker group)](http://en.wikipedia.org/wiki/Anonymous_%28group%29), but as a critical thinker, I'm unable to control my curiosity to dig out how exactly they are doing this? Frankly, this group really scares me.
One thing that I don't understand is how they haven't been caught yet. Their IP addresses should be traceable when they DDOS, even if they spoof it or go through a proxy.
* The server with which they are spoofing should have recorded the IPs of these guys in its logs. If the govt. ask the company (which owns the server) don't they give the logs?
* Even if it is a private server owned by these guys, doesn't IANA (or whoever the organization is) have the address & credit card details of the guy who bought & registered the server?
* Even if they don't have that, can't the ISPs trace back to the place these packets originated?
I know, if it was as simple as I said, the government would have caught them already. So how exactly are they able to escape?
PS: If you feel there are any resources that would enlighten me, I'll be glad to read them.
[Update - this is equally appropriate when referring to the [Lulzsec group](http://en.wikipedia.org/wiki/LulzSec), so have added a quick link to the Wikipedia page on them] | 2011/02/21 | [
"https://security.stackexchange.com/questions/2231",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/1152/"
] | Well I responded to some posts above that had incorrect information, but I figured I should just post my own response to better explain.
Anonymous is made up of basically 2 subgroups:
1. Skiddies (script kiddies) and newbies who have only the most basic security knowledge, and just sit in their IRC and basically be the pwns for the attack. These are the people that the FBI was knocking down their doors.
2. Anonymous core leadership, a group with some hacking knowledge that owned hbgary, but also got owned recently by ninja hack squad. You won't be able to trace this subgroup unless you are a security guru.
**How do they hide their tracks?**
Like a previous answerers mentioned,
1. **Through proxy servers** like Tor
2. **by compromising boxes and launching attacks from those boxes** (basically masquerading as that person's IP), or
3. **by using a VPN that's in a foreign country** and keeps no logs. With the VPN, all your traffic is relayed through it so wherever you connect it can only track back the IP addy to the VPN itself and no further (unless the VPN is keeping logs in which case you shouldn't use it anyways).
Hope this helps clarify a bit. | [Here is an article](http://www.scientificamerican.com/article.cfm?id=tracking-cyber-hackers) asking (and answering) just that very question from the Scientific American site posted this month. The short answer to the question is spoofing of source addresses and the use of proxies. |
53,928,105 | I am trying to access my database every 30 seconds, however, whenever the method executes I can clearly see a performance dip in the application.
So far this is my current code:
```
var timer = Timer()
override func viewDidLoad() {
super.viewDidLoad()
scheduledTimerWithTimeInterval()
}
func scheduledTimerWithTimeInterval(){
timer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true)
}
@objc func updateCounting(){
getDatabaseInfo()
}
```
I am trying to do the same thing, except I would like to execute the getDatabaseInfo() method on a background thread so that the app's performance is not compromised. | 2018/12/26 | [
"https://Stackoverflow.com/questions/53928105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9964910/"
] | Use Grand Central Dispatch :
```
DispatchQueue.global(qos: .background).async {
getDatabaseInfo()
}
``` | You can try with below code.
```
var timer = Timer()
override func viewDidLoad() {
super.viewDidLoad()
scheduledTimerWithTimeInterval()
}
func scheduledTimerWithTimeInterval(){
timer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true)
}
@objc func updateCounting(){
DispatchQueue.global(qos: .background).async {
print("This is run on the background queue")
getDatabaseInfo()
DispatchQueue.main.async {
print("This is run on the main queue, after the previous code in outer block")
}
}
}
``` |
53,928,105 | I am trying to access my database every 30 seconds, however, whenever the method executes I can clearly see a performance dip in the application.
So far this is my current code:
```
var timer = Timer()
override func viewDidLoad() {
super.viewDidLoad()
scheduledTimerWithTimeInterval()
}
func scheduledTimerWithTimeInterval(){
timer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true)
}
@objc func updateCounting(){
getDatabaseInfo()
}
```
I am trying to do the same thing, except I would like to execute the getDatabaseInfo() method on a background thread so that the app's performance is not compromised. | 2018/12/26 | [
"https://Stackoverflow.com/questions/53928105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9964910/"
] | You can just run the timer directly on the background queue by using a `DispatchSourceTimer`:
```
private var timer: DispatchSourceTimer?
func startTimer() {
let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".timer")
timer = DispatchSource.makeTimerSource(queue: queue)
timer!.schedule(deadline: .now(), repeating: .seconds(1))
timer!.setEventHandler { [weak self] in
// do whatever stuff you want on the background queue here here
getDatabaseInfo()
DispatchQueue.main.async {
// update your model objects and/or UI here
}
}
timer!.resume()
}
func stopTimer() {
timer?.cancel()
timer = nil
}
```
Using `Timer`, you schedule it on the main queue's run loop and then have it dispatch the task to a background queue, and then dispatch UI/model updates back to the main queue. Using dispatch timer, like above, bypasses that first step, running the timer directly on a GCD background queue. | You can try with below code.
```
var timer = Timer()
override func viewDidLoad() {
super.viewDidLoad()
scheduledTimerWithTimeInterval()
}
func scheduledTimerWithTimeInterval(){
timer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true)
}
@objc func updateCounting(){
DispatchQueue.global(qos: .background).async {
print("This is run on the background queue")
getDatabaseInfo()
DispatchQueue.main.async {
print("This is run on the main queue, after the previous code in outer block")
}
}
}
``` |
1,812,405 | Determining the image of a function $\psi:\mathbb{R}^2 \rightarrow \mathbb{R}^2$, $\psi(x,y) = (x^2 - y^2, x^2 + y^2)$
I made some observations about $\psi$:
$\psi$ isn't injective, since $\psi(-x,-y) = \psi(x,y)$.
The restriction $\psi\_{|D}$, where $D = \{(x,y) \in \mathbb{R}^2 | x,y>0\}$ makes $\psi$ injective, since:
$(x\_{1}^2-y\_{1}^2,x\_{1}^2+y\_{1}^2) = (x\_{2}^2-y\_{2}^2,x\_{2}^2+y\_{2}^2)$ occurs when $x\_{1}^2-y\_{1}^2=x\_{2}^2-y\_{2}^2$ and $x\_{1}^2+y\_{1}^2=x\_{2}^2+y\_{2}^2$, which will lead to $(x\_1,y\_1)=(x\_2,y\_2)$.
How do I determine the image of $\psi\_{|D}$? (My objective here is to create a bijection) | 2016/06/04 | [
"https://math.stackexchange.com/questions/1812405",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Let $(a,b)$ be arbitrary in $\mathbb{R}^2$ and consider $\phi(x,y) = (a,b)$, so:
$$\left\{\begin{array}{rcl}
x^2-y^2 & = & a \\
x^2+y^2 & = & b
\end{array}\right. \iff
\left\{\begin{array}{rcl}
x^2 & = & \frac{a+b}{2} \\
y^2 & = & \frac{b-a}{2}
\end{array}\right.$$
This is only possible when $a+b \ge 0 \iff b \ge -a$ and when $b-a \ge 0 \iff b \ge a$ which can be combined into the condition $b \ge |a|$. In that case, you can solve for $x$ and $y$.
This condition is satisfied by points in the 'infinite triangle' in the $xy$-plane where $y \ge |x|$; top in the origin and extending above along the lines $y=x$ and $y=-x$. | Take any $(a,b)\in \mathbb{R}^2$ and try to find a preimage:
We want to find $(x,y)\in D$ such that $x^2-y^2=a$ and $x^2+y^2=b$.
Hence, you have: $2x^2=a+b$ and $2y^2=b-a$ so $\psi(\sqrt{\frac{a+b}2},\sqrt{\frac{b-a}2})=(a,b)$
However, you have to make sure that both expressions for $x$ and $y$ makes sense i.e. that $a+b\geq 0$ and $b-a\geq0$. That's the image of your map |
15,417,588 | OK now I know that this question has been asked before several times on SO but none of the answers have worked for me.
I am attempting to create a custom preference for my project. More specifically it is a preference with a [`HorizontalListView`](http://www.dev-smart.com/archives/34) attached directly underneath it. I basically created it by modifying [this code](http://robobunny.com/wp/2011/08/13/android-seekbar-preference/) for a `SeekBarPreference` (which I am also using and is working fine). My `ListViewPreference` is located in exactly the same folder as the `SeelkBarPreference` (which, as I said is having no problem) but I am constantly getting a `ClassNotFoundException` (see logcat below). Here is my `ListViewPreference` class:
```
package com.example.ebookreader;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ListViewPreference extends Preference {
private final String TAG = getClass().getName();
private static final String ROBOBUNNYNS = "http://robobunny.com";
private static final int DEFAULT_VALUE = 50;
private int mCurrentValue;
private String mUnitsLeft = "";
private String mUnitsRight = "";
private HorizontalListView mListView;
private TextView mStatusText;
public ListViewPreference(Context context, AttributeSet attrs) {
super(context, attrs);
initPreference(context, attrs);
}
public ListViewPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initPreference(context, attrs);
}
private void initPreference(Context context, AttributeSet attrs) {
setValuesFromXml(attrs);
mListView = new HorizontalListView(context, attrs);
LayoutParams params = mListView.getLayoutParams();
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.WRAP_CONTENT;
mListView.setLayoutParams(params);
}
private void setValuesFromXml(AttributeSet attrs) {
mUnitsLeft = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsLeft",
"");
String units = getAttributeStringValue(attrs, ROBOBUNNYNS, "units", "");
mUnitsRight = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsRight",
units);
}
private String getAttributeStringValue(AttributeSet attrs,
String namespace, String name, String defaultValue) {
String value = attrs.getAttributeValue(namespace, name);
if (value == null)
value = defaultValue;
return value;
}
@Override
protected View onCreateView(ViewGroup parent) {
RelativeLayout layout = null;
try {
LayoutInflater mInflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = (RelativeLayout) mInflater.inflate(
R.layout.horizontal_list_view_preference, parent, false);
} catch (Exception e) {
Log.e(TAG, "Error creating seek bar preference", e);
}
return layout;
}
@Override
public void onBindView(View view) {
super.onBindView(view);
try {
// move our seekbar to the new view we've been given
ViewParent oldContainer = mListView.getParent();
ViewGroup newContainer = (ViewGroup) view
.findViewById(R.id.listViewPrefBarContainer);
if (oldContainer != newContainer) {
// remove the seekbar from the old view
if (oldContainer != null) {
((ViewGroup) oldContainer).removeView(mListView);
}
// remove the existing seekbar (there may not be one) and add
// ours
newContainer.removeAllViews();
newContainer.addView(mListView,
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
} catch (Exception ex) {
Log.e(TAG, "Error binding view: " + ex.toString());
}
updateView(view);
}
/**
* Update a SeekBarPreference view with our current state
*
* @param view
*/
protected void updateView(View view) {
try {
RelativeLayout layout = (RelativeLayout) view;
mStatusText = (TextView) layout
.findViewById(R.id.listViewPrefValue);
mStatusText.setText(String.valueOf(mCurrentValue));
mStatusText.setMinimumWidth(30);
TextView unitsRight = (TextView) layout
.findViewById(R.id.listViewPrefUnitsRight);
unitsRight.setText(mUnitsRight);
TextView unitsLeft = (TextView) layout
.findViewById(R.id.listViewPrefUnitsLeft);
unitsLeft.setText(mUnitsLeft);
} catch (Exception e) {
Log.e(TAG, "Error updating seek bar preference", e);
}
}
@Override
protected Object onGetDefaultValue(TypedArray ta, int index) {
int defaultValue = ta.getInt(index, DEFAULT_VALUE);
return defaultValue;
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
if (restoreValue) {
mCurrentValue = getPersistedInt(mCurrentValue);
} else {
int temp = 0;
try {
temp = (Integer) defaultValue;
} catch (Exception ex) {
Log.e(TAG, "Invalid default value: " + defaultValue.toString());
}
persistInt(temp);
mCurrentValue = temp;
}
}
}
```
For most people this problem is the result of not having a constructor with parameters `Context` and `AttributeSet` but as you can see, I clearly have it.
Here is the XML file where the error keeps on occurring:
```
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/com.example.ebookreader"
android:background="@drawable/wallpaper" >
<android:PreferenceCategory
android:key="device_settings"
android:title="Device Settings" >
<android:CheckBoxPreference
android:key="wifi"
android:summary="Enable or Disable Wi-Fi"
android:title="Wi-Fi" />
<android:CheckBoxPreference
android:key="bluetooth"
android:summary="Enable or Disable Bluetooth"
android:title="Bluetooth" />
<android:CheckBoxPreference
android:key="autosync"
android:summary="Enable or Disable AutoSync"
android:title="AutoSync" />
<custom:SeekBarPreference
android:id="@+id/brightness_adjust"
android:defaultValue="100"
android:key="brightness"
android:max="200"
android:summary="Adjust Brightness Levels"
android:title="Brightness" />
</android:PreferenceCategory>
<android:PreferenceCategory
android:key="account_settings"
android:title="Account Settings" >
<custom:ListViewPreference> <!-- Error happens here -->
android:id="@+id/font_selector"
android:key="font"
android:title="Font"
android:summary="Edit Font"
/>
</custom:ListViewPreference>
</android:PreferenceCategory>
</PreferenceScreen>
```
Below is my full Logcat:
```
03-14 17:53:14.290: E/AndroidRuntime(449): FATAL EXCEPTION: main
03-14 17:53:14.290: E/AndroidRuntime(449): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ebookreader/com.example.ebookreader.SettingsActivity}: android.view.InflateException: Binary XML file line #40: Error inflating class ListViewPreference
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.os.Looper.loop(Looper.java:126)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread.main(ActivityThread.java:3997)
03-14 17:53:14.290: E/AndroidRuntime(449): at java.lang.reflect.Method.invokeNative(Native Method)
03-14 17:53:14.290: E/AndroidRuntime(449): at java.lang.reflect.Method.invoke(Method.java:491)
03-14 17:53:14.290: E/AndroidRuntime(449): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
03-14 17:53:14.290: E/AndroidRuntime(449): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
03-14 17:53:14.290: E/AndroidRuntime(449): at dalvik.system.NativeStart.main(Native Method)
03-14 17:53:14.290: E/AndroidRuntime(449): Caused by: android.view.InflateException: Binary XML file line #40: Error inflating class ListViewPreference
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.inflate(GenericInflater.java:326)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.inflate(GenericInflater.java:263)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1333)
03-14 17:53:14.290: E/AndroidRuntime(449): at com.example.ebookreader.SettingsActivity.onCreate(SettingsActivity.java:31)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
03-14 17:53:14.290: E/AndroidRuntime(449): ... 11 more
03-14 17:53:14.290: E/AndroidRuntime(449): Caused by: java.lang.ClassNotFoundException: android.preference.ListViewPreference in loader dalvik.system.PathClassLoader[/data/app/com.example.ebookreader-2.apk]
03-14 17:53:14.290: E/AndroidRuntime(449): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
03-14 17:53:14.290: E/AndroidRuntime(449): at java.lang.ClassLoader.loadClass(ClassLoader.java:548)
03-14 17:53:14.290: E/AndroidRuntime(449): at java.lang.ClassLoader.loadClass(ClassLoader.java:508)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.createItem(GenericInflater.java:375)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
03-14 17:53:14.290: E/AndroidRuntime(449): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
03-14 17:53:14.290: E/AndroidRuntime(449): ... 20 more
```
Any help would be greatly appreciated. | 2013/03/14 | [
"https://Stackoverflow.com/questions/15417588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1679658/"
] | but why you wrote
```
<custom:ListViewPreference
```
it should be
```
<com.example.ebookreader.ListViewPreference
```
As your package, where class placed, called | Generally, you need to use the full path to a component:
```
<com.example.ebookreader.ListViewPreference
android:id="@+id/font_selector"
android:key="font"
android:title="Font"
android:summary="Edit Font"
/>
```
I have never seen the use of "Custom:" as an element. |
47,788,964 | When I run the following code
```
public class Program
{
public static void Main()
{
string s = "480";
Console.WriteLine(1 == -1 ? 0 : s[1]);
Console.WriteLine(s[1]);
}
}
```
I get
```
56
8
```
I don't understand how I get 56. | 2017/12/13 | [
"https://Stackoverflow.com/questions/47788964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208848/"
] | Your `0 : s[1]` converts the `char` in `s[1]` to an integer. And the value of `8` in the ASCII table is `56`.
You want to use a `char` on the left hand side too (using single quotes):
```
Console.WriteLine(1 == -1 ? '0' : s[1]);
``` | s[1] is the int value of the char.
The question operator implies an integer from the zero meaning it is an int. It converts the char to int. |
47,788,964 | When I run the following code
```
public class Program
{
public static void Main()
{
string s = "480";
Console.WriteLine(1 == -1 ? 0 : s[1]);
Console.WriteLine(s[1]);
}
}
```
I get
```
56
8
```
I don't understand how I get 56. | 2017/12/13 | [
"https://Stackoverflow.com/questions/47788964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208848/"
] | From the [Documentation on the ?: Operator](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator:)
>
> "Either the type of first\_expression and second\_expression must be the same, or an implicit conversion must exist from one type to the other."
>
>
>
and
>
> "The conditional operator is right-associative."
>
>
>
So your result becomes a numeric in the first case, and a char in the second case. | s[1] is the int value of the char.
The question operator implies an integer from the zero meaning it is an int. It converts the char to int. |
47,788,964 | When I run the following code
```
public class Program
{
public static void Main()
{
string s = "480";
Console.WriteLine(1 == -1 ? 0 : s[1]);
Console.WriteLine(s[1]);
}
}
```
I get
```
56
8
```
I don't understand how I get 56. | 2017/12/13 | [
"https://Stackoverflow.com/questions/47788964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208848/"
] | Your `0 : s[1]` converts the `char` in `s[1]` to an integer. And the value of `8` in the ASCII table is `56`.
You want to use a `char` on the left hand side too (using single quotes):
```
Console.WriteLine(1 == -1 ? '0' : s[1]);
``` | >
> I don't understand how I get 56.
>
>
>
in the first line it is interpreted as UTF-16 code of the char `8`:
```
Console.WriteLine(1 == -1 ? 0 : s[1]);
```
Using the conditional operator you give here the choice between an `int` `0` and a `char` so the compiler converts the latter implicitly to an `int` (which gives you the UTF-16 code) and prints it to the console
and in the second line you actually get the `char` value printed
```
Console.WriteLine(s[1]);
```
No implicit conversion happens here. |
47,788,964 | When I run the following code
```
public class Program
{
public static void Main()
{
string s = "480";
Console.WriteLine(1 == -1 ? 0 : s[1]);
Console.WriteLine(s[1]);
}
}
```
I get
```
56
8
```
I don't understand how I get 56. | 2017/12/13 | [
"https://Stackoverflow.com/questions/47788964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208848/"
] | From the [Documentation on the ?: Operator](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator:)
>
> "Either the type of first\_expression and second\_expression must be the same, or an implicit conversion must exist from one type to the other."
>
>
>
and
>
> "The conditional operator is right-associative."
>
>
>
So your result becomes a numeric in the first case, and a char in the second case. | >
> I don't understand how I get 56.
>
>
>
in the first line it is interpreted as UTF-16 code of the char `8`:
```
Console.WriteLine(1 == -1 ? 0 : s[1]);
```
Using the conditional operator you give here the choice between an `int` `0` and a `char` so the compiler converts the latter implicitly to an `int` (which gives you the UTF-16 code) and prints it to the console
and in the second line you actually get the `char` value printed
```
Console.WriteLine(s[1]);
```
No implicit conversion happens here. |
22,204 | Ven. Members of the Sangha (of Bhikkhus), Ven. fellows, valued Upasaka and Upasika, dear readers and interesed,
This question is intellectual and theoretical, or literary, but also/merely inviting self-reflection; but of course it can also be answered with words of the Buddha in "should-form" (in the later case, exchange "you" with "a serious follower of the Buddha, a person in general, to find peace", how ever you wish and feel obligated or loyal to).
So, about loyalty,
* In regard of what are you able to claim being loyal?
* Whom are you loyal to?
* How far goes your loyalty?
* Where and how does it end?
Also, finally:
* What must one be loyal to, to find, to reach the highest aim all Buddha-following seekers are after?
* What are you loyal and/or are you not loyal to, so that you have't found final peace already, or you highest desired goal?
* What is an Arahat loyal to? Has loyality, then, an end (no more required)?
Maybe you try to give a loyal answer.
Much joy and inside in giving a benefical answer, at least for youself. | 2017/08/19 | [
"https://buddhism.stackexchange.com/questions/22204",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/11958/"
] | Generally Buddhist take refuge in Buddha, Dhamma, and Sangha.
In that regard, I would say I support Sangha. Because they protect Dhamma. Which helps to attain Buddhahood. Generally, Sangha means Ariya Sangha. But here I meant any person who can guide me in the right direction. | If I ever knew , I forgotten many times before remembering.
I forget and get caught up into the world. I suppose I am loyal to the world but more and more I am loyal to the naked truth of the Dhamma.
On the frontlines of the world is were learning is, right in the defilement! I don't know if I need a monastery. I don't always need to aim for a tranquil state of mind. |
22,204 | Ven. Members of the Sangha (of Bhikkhus), Ven. fellows, valued Upasaka and Upasika, dear readers and interesed,
This question is intellectual and theoretical, or literary, but also/merely inviting self-reflection; but of course it can also be answered with words of the Buddha in "should-form" (in the later case, exchange "you" with "a serious follower of the Buddha, a person in general, to find peace", how ever you wish and feel obligated or loyal to).
So, about loyalty,
* In regard of what are you able to claim being loyal?
* Whom are you loyal to?
* How far goes your loyalty?
* Where and how does it end?
Also, finally:
* What must one be loyal to, to find, to reach the highest aim all Buddha-following seekers are after?
* What are you loyal and/or are you not loyal to, so that you have't found final peace already, or you highest desired goal?
* What is an Arahat loyal to? Has loyality, then, an end (no more required)?
Maybe you try to give a loyal answer.
Much joy and inside in giving a benefical answer, at least for youself. | 2017/08/19 | [
"https://buddhism.stackexchange.com/questions/22204",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/11958/"
] | >
> **self-reflecting...**
>
>
>
*Atta-manasikara-self-reflecting*.
>
> **In regard of what are... able to claim being loyal?**
>
>
>
Anatta ([SN 22.59](http://www.accesstoinsight.org/tipitaka/sn/sn22/sn22.059.mend.html)). Sunnata ([SN 35.85](http://www.accesstoinsight.org/tipitaka/sn/sn35/sn35.085.than.html)). Lokuttara dhamma ([SN 20.7](http://www.accesstoinsight.org/tipitaka/sn/sn20/sn20.007.than.html)).
>
> **Whom are... loyal to?**
>
>
>
The ignorance-created idea of "who" is properly negated in [SN 12.12](http://www.accesstoinsight.org/tipitaka/sn/sn12/sn12.012.nypo.html)
>
> **How far goes... loyalty?**
>
>
>
Anatta. Sunnata. Nibbana. Vimutti
>
> **Where and how does it end?**
>
>
>
[MN 29](https://suttacentral.net/en/mn29) & 30 state the holy life has *ceto-vimutti* (liberation of mind) as its final end (*pariyosāna*). | If I ever knew , I forgotten many times before remembering.
I forget and get caught up into the world. I suppose I am loyal to the world but more and more I am loyal to the naked truth of the Dhamma.
On the frontlines of the world is were learning is, right in the defilement! I don't know if I need a monastery. I don't always need to aim for a tranquil state of mind. |
22,204 | Ven. Members of the Sangha (of Bhikkhus), Ven. fellows, valued Upasaka and Upasika, dear readers and interesed,
This question is intellectual and theoretical, or literary, but also/merely inviting self-reflection; but of course it can also be answered with words of the Buddha in "should-form" (in the later case, exchange "you" with "a serious follower of the Buddha, a person in general, to find peace", how ever you wish and feel obligated or loyal to).
So, about loyalty,
* In regard of what are you able to claim being loyal?
* Whom are you loyal to?
* How far goes your loyalty?
* Where and how does it end?
Also, finally:
* What must one be loyal to, to find, to reach the highest aim all Buddha-following seekers are after?
* What are you loyal and/or are you not loyal to, so that you have't found final peace already, or you highest desired goal?
* What is an Arahat loyal to? Has loyality, then, an end (no more required)?
Maybe you try to give a loyal answer.
Much joy and inside in giving a benefical answer, at least for youself. | 2017/08/19 | [
"https://buddhism.stackexchange.com/questions/22204",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/11958/"
] | Everyone who can give me the whole 6 benefits: 1)own benefit, 2)other benefits, 3)public benefit, 4)this life benefit, 5)next life benefit, and 6)nibbāna benefit.
**Everyone** mean I try listen everyone.
**The whole** mean I trust in no separate benefits.
Infinity, until I will parinibbāna. | If I ever knew , I forgotten many times before remembering.
I forget and get caught up into the world. I suppose I am loyal to the world but more and more I am loyal to the naked truth of the Dhamma.
On the frontlines of the world is were learning is, right in the defilement! I don't know if I need a monastery. I don't always need to aim for a tranquil state of mind. |
10,422,335 | that opens Minecraft.exe, and logs in when clicked. Is this possible? | 2012/05/02 | [
"https://Stackoverflow.com/questions/10422335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hmm, Is this what you want; it should work:
```
@echo off
"%cd%\minecraft.exe" username password serverip
```
edit the username, password and ip to your liking.
---
A Better Solution in my opinion:
Just figured it out, the batch file doesn't work, however; when set up as a shortcut it does! So create a new shortcut and for the path use this:
Format:
```
"<FilePath>" <username> <password> <server>
```
Example:
```
"C:\Program Files\Minecraft\Minecraft.exe" bobjones passchuck 123.123.123.123
```
Hope that works out for you, alot simpler then a bath file IMO.
also if you don't include IP, it just goes and logins in to minecraft. Stopping at the title screen. | <http://www.minecraftwiki.net/wiki/Tutorials/Setting_up_a_server#Start_the_Minecraft_Server_.28.jar_version.29>
To start the jar version of Minecraft on Windows, create a new file in Notepad, and paste in
java -Xms512M -Xmx1G -jar minecraft\_server.jar
Save the file as startserver.bat, and place the file in the same folder as minecraft\_server.jar. The .bat extension saves the file as a batch file. |
42,537,222 | I have functions that include different javax Query annotations like : `@QueryParam` , `@Context` , `@PathParam` etc..
is there a way to exclude these parameters when calling joinPoint.getArgs()?
Example:
```
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("{pathParam}/v1/{pathParam2}/")
@MyAnnotation
public Response update(@PathParam("pathParam") String p1, @PathParam("pathParam2") int p2, MyObject x);
@Before("@annotation(MyAnnotation)")
public void doSomething(JoinPoint joinPoint){
Object[] objects = joinPoint.getArgs(); // HERE - is there a way to get only MyObject and not other params..?
}
```
The reason I want to do it is that I have several urls, while marking ~10% as persistent. It means that I want the input data to be saved in some persistent service. The Query & Context params are not important to me, but the input data itself is. | 2017/03/01 | [
"https://Stackoverflow.com/questions/42537222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386966/"
] | Assuming you really use **full AspectJ and not Spring AOP** like so many others, you should be aware of the fact that in full AspectJ `@annotation(XY)` potentially matches not just `execution()` joinpoints but also `call()`, i.e. your advice will be triggered twice. Even worse, if other places than method executions are also annotated - e.g. classes, fields, constructors, parameters - the pointcut will also match and your try to cast to `MethodSignature` will cause an exception as a consequence.
Furthermore, please note that in @AspectJ syntax you need to provide the fully qualified class name of the annotation you want to match against, i.e. don't forget to also prepend the package name. Otherwise there will be no match at all. So before doing anything else you want to change your pointcut to:
```java
@annotation(de.scrum_master.app.MyAnnotation) && execution(* *(..))
```
Now here is a fully self-consistent example, an [SSCCE](http://sscce.org/) producing repeatable results, as requested by me in the comment under your question:
**Annotation:**
```java
package de.scrum_master.app;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation {}
```
**Driver application:**
As you can see, the test method has parameters with different types of annotations:
1. only javax annotation
2. javax + own annotation
3. only your own annotation
4. no annotation
We want to ignore #1/2 and only print #3/4.
```java
package de.scrum_master.app;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
public class Application {
public static void main(String[] args) {
new Application().update("foo", 11, "bar", 22);
}
@MyAnnotation
public Response update(
@PathParam("pathParam") String p1,
@PathParam("pathParam2") @MyAnnotation int p2,
@MyAnnotation String text,
int number
) {
return null;
}
}
```
**Aspect:**
Just as user *Andre Paschoal* started to show in his code fragment, you need to iterate over both the arguments and annotations arrays in order to pull off the filtering trick. I think it is quite ugly and possibly slow just for logging's sake (and I assume this is what you want to do), but for what it is worth, here is your solution:
```java
package de.scrum_master.aspect;
import java.lang.annotation.Annotation;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
@Aspect
public class ParameterFilterAspect {
@Before("@annotation(de.scrum_master.app.MyAnnotation) && execution(* *(..))")
public void doSomething(JoinPoint joinPoint) {
Object[] args = joinPoint.getArgs();
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Annotation[][] annotationMatrix = methodSignature.getMethod().getParameterAnnotations();
for (int i = 0; i < args.length; i++) {
boolean hasJavaxAnnotation = false;
for (Annotation annotation : annotationMatrix[i]) {
if (annotation.annotationType().getPackage().getName().startsWith("javax.")) {
hasJavaxAnnotation = true;
break;
}
}
if (!hasJavaxAnnotation)
System.out.println(args[i]);
}
}
}
```
**Console log:**
```none
bar
22
```
Tadaa! :-) | I don't think there's a magic way to do this, so go with the obvious:
* define your argument acceptance criteria;
* iterate over the args and filter based on the previously defined criteria and that's it.
It seems that your acceptance criteria is that the arg is not annotated with these **javax** annotations, right ?
Try this:
```
Object[] args = joinPoint.getArgs();
Annotation[][] anns = ((MethodSignature) joinPoint.getSignature()).getMethod().getParameterAnnotations();
for (int i = 0; i < args.length; i++) {
for (int j = 0; j < args[i].length; j++) {
// check here for the annotations you would like to exclude
}
}
``` |
42,537,222 | I have functions that include different javax Query annotations like : `@QueryParam` , `@Context` , `@PathParam` etc..
is there a way to exclude these parameters when calling joinPoint.getArgs()?
Example:
```
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("{pathParam}/v1/{pathParam2}/")
@MyAnnotation
public Response update(@PathParam("pathParam") String p1, @PathParam("pathParam2") int p2, MyObject x);
@Before("@annotation(MyAnnotation)")
public void doSomething(JoinPoint joinPoint){
Object[] objects = joinPoint.getArgs(); // HERE - is there a way to get only MyObject and not other params..?
}
```
The reason I want to do it is that I have several urls, while marking ~10% as persistent. It means that I want the input data to be saved in some persistent service. The Query & Context params are not important to me, but the input data itself is. | 2017/03/01 | [
"https://Stackoverflow.com/questions/42537222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386966/"
] | Assuming you really use **full AspectJ and not Spring AOP** like so many others, you should be aware of the fact that in full AspectJ `@annotation(XY)` potentially matches not just `execution()` joinpoints but also `call()`, i.e. your advice will be triggered twice. Even worse, if other places than method executions are also annotated - e.g. classes, fields, constructors, parameters - the pointcut will also match and your try to cast to `MethodSignature` will cause an exception as a consequence.
Furthermore, please note that in @AspectJ syntax you need to provide the fully qualified class name of the annotation you want to match against, i.e. don't forget to also prepend the package name. Otherwise there will be no match at all. So before doing anything else you want to change your pointcut to:
```java
@annotation(de.scrum_master.app.MyAnnotation) && execution(* *(..))
```
Now here is a fully self-consistent example, an [SSCCE](http://sscce.org/) producing repeatable results, as requested by me in the comment under your question:
**Annotation:**
```java
package de.scrum_master.app;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation {}
```
**Driver application:**
As you can see, the test method has parameters with different types of annotations:
1. only javax annotation
2. javax + own annotation
3. only your own annotation
4. no annotation
We want to ignore #1/2 and only print #3/4.
```java
package de.scrum_master.app;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
public class Application {
public static void main(String[] args) {
new Application().update("foo", 11, "bar", 22);
}
@MyAnnotation
public Response update(
@PathParam("pathParam") String p1,
@PathParam("pathParam2") @MyAnnotation int p2,
@MyAnnotation String text,
int number
) {
return null;
}
}
```
**Aspect:**
Just as user *Andre Paschoal* started to show in his code fragment, you need to iterate over both the arguments and annotations arrays in order to pull off the filtering trick. I think it is quite ugly and possibly slow just for logging's sake (and I assume this is what you want to do), but for what it is worth, here is your solution:
```java
package de.scrum_master.aspect;
import java.lang.annotation.Annotation;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
@Aspect
public class ParameterFilterAspect {
@Before("@annotation(de.scrum_master.app.MyAnnotation) && execution(* *(..))")
public void doSomething(JoinPoint joinPoint) {
Object[] args = joinPoint.getArgs();
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Annotation[][] annotationMatrix = methodSignature.getMethod().getParameterAnnotations();
for (int i = 0; i < args.length; i++) {
boolean hasJavaxAnnotation = false;
for (Annotation annotation : annotationMatrix[i]) {
if (annotation.annotationType().getPackage().getName().startsWith("javax.")) {
hasJavaxAnnotation = true;
break;
}
}
if (!hasJavaxAnnotation)
System.out.println(args[i]);
}
}
}
```
**Console log:**
```none
bar
22
```
Tadaa! :-) | this snippet code works for me:
```
Annotation[][] anns = ((MethodSignature) thisJoinPoint.getSignature()).getMethod().getParameterAnnotations();
parameterValues = thisJoinPoint.getArgs();
signature = (MethodSignature) thisJoinPoint.getSignature();
parameterNames = signature.getParameterNames();
if (parameterValues != null) {
for (int i = 0; i < parameterValues.length; i++) {
boolean shouldBeExcluded = false;
for (Annotation annotation : anns[i]) {
if (annotation instanceof ExcludeFromCustomLogging) {//<<---------ExcludeFromCustomLogging is my class
shouldBeExcluded = true;
break;
}
}
if (shouldBeExcluded) {
//System.out.println("should be excluded===>"+parameterNames[i]);
continue;
}
//.......and your business
}
``` |
134,341 | I am designing a simple 16 bit adder circuit in Digilent's Xilinx Spartan 6 FPGA. The Verilog design accepts two 16 bit inputs A and B and returns the 16 bit sum C = A+B. I am ignoring carry in and carry out.
I want to send A and B from PC to FPGA using serial port as well send the sum C from FPGA to PC using serial port. I am not sure how to do this. I have googled but could not find something simple. Can i send A and B as decimals like A = 5, B = 3? or do i have to send it as ASCII? How do i distinguish A from B if A = 255 and B = 512 (i.e., both A and B have multiple digits). How does FPGA deal with ASCII.
Some pointers or explanations will be really appreciated | 2014/10/14 | [
"https://electronics.stackexchange.com/questions/134341",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/35416/"
] | I would suggest either writing a UART module from scratch or finding one online. Then all you would need to do is write a wrapper that interfaces the UART to your registers. Here is one possible open source Verilog UART module that I wrote a while ago:
<https://github.com/alexforencich/verilog-uart>
This particular module uses the AXI stream interface, so it should not be very difficult to interface with your design.
The AXI stream interface has three signals: tdata, tvalid, and tready. tvalid indicates that tdata contains valid data, and tready indicates that the sink is ready to receive the data. Data bytes are transferred only when tvalid and tready are both high.
What I would recommend doing is defining a simple serial protocol that supports some basic framing. Say, to send A and B to the FPGA, you would send some sort of start indication (e.g. 0 or perhaps ASCII S or W), then the MSB of A, then the LSB of A, then the MSB of B, then the LSB of B. Then you can write a state machine that looks for the start indication, then loads the next four bytes into the appropriate registers. Then once the operation is complete, the state machine can send the result back to the computer. If you want to use ASCII instead of binary, you can do that too, but it's a bit more complicated to convert everything. I would recommend using hex if you want something human readable as it is much easier to divide by 16 than it is to divide by 10 (bit shift/bit slice instead of an actual division operation). | Ken Chapman (Xilinx employee) provides a simple and lightweight UART module as an external I/O device for his 8-bit processor (PicoBlaze). These UART modules (RX and TX) can be used on every Xilinx FPGA. Each module has a simple byte interface. This processor and it's periphery comes with a lot of documentation and examples :)
=> Search "PicoBlaze" on the Xilinx website.
For your requested transmission of 2x 16 bit, you will need a simple statemachine which receives 4 bytes in 4 cycles e.g. coded as A0, A1, B0, B1. I would advice to send all bytes already binary encoded to the FPGA, so there is no ascii or BCD to binary decoding need. |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | VirtualBox can run VMWare VMDK images, which gives you a lot more options. (There are also ways to convert VMDK virtual hard drives to native VirtualBox format.) You can almost certainly find what you want here: <http://www.vmware.com/appliances/>
Why not intstall the VirtualBox support software and just use shared folders and the console to develop in Linux, instead of ssh? | [Linux from Scratch](http://www.linuxfromscratch.org/)
I just finished doing just what you want to do, to have a base very minimal Linux OS for dev work. I did the install by hand because I wanted to, but they have automated installers for it. Final disk use is around 700MB.
Normally I'd just use [Gentoo](http://www.gentoo.org/) and call it a day, but I wanted even more minimal, and it worked well. |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | Turnkey linux has a number of preconfigured server images that will work in virtualbox
<http://www.turnkeylinux.org/>
<http://www.turnkeylinux.org/docs/installation-appliances-virtualbox> | VirtualBox can run VMWare VMDK images, which gives you a lot more options. (There are also ways to convert VMDK virtual hard drives to native VirtualBox format.) You can almost certainly find what you want here: <http://www.vmware.com/appliances/>
Why not intstall the VirtualBox support software and just use shared folders and the console to develop in Linux, instead of ssh? |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | >
> If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking.
>
>
>
I don't believe you'll easily find anything prebuilt that matches your requirements. I'd suggest [Ubuntu Server](http://www.ubuntu.com/server) to build your own. Install it without anything extra, then run aptitude to get these packages:
* **openssh-server** — SSH server
* **screen** or **tmux** — per your choice
* **vim** or another editor — the vim-tiny package omits many features
* **gcc**, **g++**, **gdb**, etc.
* **make**, **automake**, **autoconf**, etc.
* **manpages-dev**, **manpages-posix-dev** — useful
* **mercurial**, **git-core**, **bzr** — you'll want at least one
Plus any other packages you want. The list above should already meet and exceed the requirements you've mentioned.
(Use "/" in aptitude to search using a regex, "n" and "N" for the next and previous matches. Use "+" to mark for installation, which also marks dependencies, then "g" to preview the selection and "g" on the preview to download and install. You'll need to run aptitude via sudo.) | If I understand your question correctly, you are wanting a VBox image that is a pre-made linux distro that you will run, but ssh into to communicate, to do some non-gui development? But you do not have a lot of RAM?
I guess my first concern is that even with just running a CLI interface, won't VBox take up your RAM anyways? Do you have enough to run vbox in the first place (which I believe is the amount needed for you host system + the amount needed for your virtual instance)?
Second, though no pre-made distros come to mind (bearing, I have done no research), it seems given your unique circumstances it might be to your benefit to download something like [Debian-minimal](http://www.debian.org/distrib/netinst) and install the core system and the utilities you need on top of that. It will require a one-time setup, but once it's done, you can just reuse your own custom image.
At this point in linux's development, I am all for package-managed systems, even when space is a concern.
I know this doesn't directly answer the question at hand, but I hope it helps a little.
Cheers! |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | Turnkey linux has a number of preconfigured server images that will work in virtualbox
<http://www.turnkeylinux.org/>
<http://www.turnkeylinux.org/docs/installation-appliances-virtualbox> | [Linux from Scratch](http://www.linuxfromscratch.org/)
I just finished doing just what you want to do, to have a base very minimal Linux OS for dev work. I did the install by hand because I wanted to, but they have automated installers for it. Final disk use is around 700MB.
Normally I'd just use [Gentoo](http://www.gentoo.org/) and call it a day, but I wanted even more minimal, and it worked well. |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | VirtualBox can run VMWare VMDK images, which gives you a lot more options. (There are also ways to convert VMDK virtual hard drives to native VirtualBox format.) You can almost certainly find what you want here: <http://www.vmware.com/appliances/>
Why not intstall the VirtualBox support software and just use shared folders and the console to develop in Linux, instead of ssh? | If I understand your question correctly, you are wanting a VBox image that is a pre-made linux distro that you will run, but ssh into to communicate, to do some non-gui development? But you do not have a lot of RAM?
I guess my first concern is that even with just running a CLI interface, won't VBox take up your RAM anyways? Do you have enough to run vbox in the first place (which I believe is the amount needed for you host system + the amount needed for your virtual instance)?
Second, though no pre-made distros come to mind (bearing, I have done no research), it seems given your unique circumstances it might be to your benefit to download something like [Debian-minimal](http://www.debian.org/distrib/netinst) and install the core system and the utilities you need on top of that. It will require a one-time setup, but once it's done, you can just reuse your own custom image.
At this point in linux's development, I am all for package-managed systems, even when space is a concern.
I know this doesn't directly answer the question at hand, but I hope it helps a little.
Cheers! |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | You can try [virtualboximages.com](http://virtualboximages.com/) - they have plenty of distros, but they charge a token sum ($.99-3.99) per download - which, i assume, goes to cover their bandwidth costs. | [Linux from Scratch](http://www.linuxfromscratch.org/)
I just finished doing just what you want to do, to have a base very minimal Linux OS for dev work. I did the install by hand because I wanted to, but they have automated installers for it. Final disk use is around 700MB.
Normally I'd just use [Gentoo](http://www.gentoo.org/) and call it a day, but I wanted even more minimal, and it worked well. |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | You can try [virtualboximages.com](http://virtualboximages.com/) - they have plenty of distros, but they charge a token sum ($.99-3.99) per download - which, i assume, goes to cover their bandwidth costs. | If I understand your question correctly, you are wanting a VBox image that is a pre-made linux distro that you will run, but ssh into to communicate, to do some non-gui development? But you do not have a lot of RAM?
I guess my first concern is that even with just running a CLI interface, won't VBox take up your RAM anyways? Do you have enough to run vbox in the first place (which I believe is the amount needed for you host system + the amount needed for your virtual instance)?
Second, though no pre-made distros come to mind (bearing, I have done no research), it seems given your unique circumstances it might be to your benefit to download something like [Debian-minimal](http://www.debian.org/distrib/netinst) and install the core system and the utilities you need on top of that. It will require a one-time setup, but once it's done, you can just reuse your own custom image.
At this point in linux's development, I am all for package-managed systems, even when space is a concern.
I know this doesn't directly answer the question at hand, but I hope it helps a little.
Cheers! |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | Turnkey linux has a number of preconfigured server images that will work in virtualbox
<http://www.turnkeylinux.org/>
<http://www.turnkeylinux.org/docs/installation-appliances-virtualbox> | You can try [virtualboximages.com](http://virtualboximages.com/) - they have plenty of distros, but they charge a token sum ($.99-3.99) per download - which, i assume, goes to cover their bandwidth costs. |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | Turnkey linux has a number of preconfigured server images that will work in virtualbox
<http://www.turnkeylinux.org/>
<http://www.turnkeylinux.org/docs/installation-appliances-virtualbox> | If I understand your question correctly, you are wanting a VBox image that is a pre-made linux distro that you will run, but ssh into to communicate, to do some non-gui development? But you do not have a lot of RAM?
I guess my first concern is that even with just running a CLI interface, won't VBox take up your RAM anyways? Do you have enough to run vbox in the first place (which I believe is the amount needed for you host system + the amount needed for your virtual instance)?
Second, though no pre-made distros come to mind (bearing, I have done no research), it seems given your unique circumstances it might be to your benefit to download something like [Debian-minimal](http://www.debian.org/distrib/netinst) and install the core system and the utilities you need on top of that. It will require a one-time setup, but once it's done, you can just reuse your own custom image.
At this point in linux's development, I am all for package-managed systems, even when space is a concern.
I know this doesn't directly answer the question at hand, but I hope it helps a little.
Cheers! |
199,696 | Long story short, I am trying to find a pre-made Linux development environment for VirtualBox so I don't have to worry about installing a distro, getting all packages installed, and so forth, since last time I did that it took me a full day to get something that remotely did what I wanted.
I've got a few semi-weird requirements, which doesn't help...
* Preferably SSH only, no slick GUI etc installed, as the laptop host is not endowed with a lot of HD space or RAM. (Which is also why I cannot dual boot, so please do not suggest that option.) I intend to do pretty much all using PuTTy, as it is a workflow I'm already accustomed to.
* Basic gcc, automake etc are all I need.
I really don't care about the distro itself, or the packaging system, or anything else really. I just want to download it, set up some mounts, and be ready to go.
If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking. | 2010/10/15 | [
"https://superuser.com/questions/199696",
"https://superuser.com",
"https://superuser.com/users/50442/"
] | Turnkey linux has a number of preconfigured server images that will work in virtualbox
<http://www.turnkeylinux.org/>
<http://www.turnkeylinux.org/docs/installation-appliances-virtualbox> | >
> If such a thing doesn't exist, I'd still appreciate suggestions of the best distro to use that will get me to my requirements fastest without a lot of tweaking.
>
>
>
I don't believe you'll easily find anything prebuilt that matches your requirements. I'd suggest [Ubuntu Server](http://www.ubuntu.com/server) to build your own. Install it without anything extra, then run aptitude to get these packages:
* **openssh-server** — SSH server
* **screen** or **tmux** — per your choice
* **vim** or another editor — the vim-tiny package omits many features
* **gcc**, **g++**, **gdb**, etc.
* **make**, **automake**, **autoconf**, etc.
* **manpages-dev**, **manpages-posix-dev** — useful
* **mercurial**, **git-core**, **bzr** — you'll want at least one
Plus any other packages you want. The list above should already meet and exceed the requirements you've mentioned.
(Use "/" in aptitude to search using a regex, "n" and "N" for the next and previous matches. Use "+" to mark for installation, which also marks dependencies, then "g" to preview the selection and "g" on the preview to download and install. You'll need to run aptitude via sudo.) |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | Intel-based Macs use the GUID Partition Table (GPT) by default. GPT in turn supports up to 128 partitions by default (that value can be increased if necessary, although most partition tools don't enable you to do so). Thus, there's no problem with having more than four partitions on an Intel-based Mac.
The limitation you've heard about is a distortion of the limitation on hybrid MBRs, which are a dangerous and standards-violating hybridization of GPT with the older Master Boot Record (MBR) partitioning system used on most PCs. In a hybrid MBR, up to *three* of the GPT's partitions are duplicated in an MBR data structure. MBR is limited to four *primary* partitions, and in a hybrid MBR the fourth primary partition is occupied by a special partition that identifies the disk as being a GPT disk. This fourth partition is often mistaken for an MBR-side duplicate of the EFI System Partition (ESP) that's present on most GPT disks, but it's not that.
Apple uses hybrid MBRs to enable Windows to dual-boot with OS X on Macs. Windows favors the MBR data structures, so it sees the disk as being an MBR disk, whereas OS X favors GPT data structures, so it sees the disk as being a GPT disk. (Linux, like OS X, sees a hybrid MBR as a GPT disk.) A hybrid MBR doesn't limit the number of GPT partitions you may have, but it does limit the number of partitions that the Windows installation can see, to no more than three.
Note that extended partitions and Extended Boot Records (EBRs) have nothing to do with hybrid MBRs -- or at least, they shouldn't! In the MBR scheme, extended partitions serve as placeholders for logical partitions, which are defined by EBRs. Using this scheme, an MBR disk can support a huge number of partitions -- theoretically about half as many as there are sectors on the disk, although practical limits are much lower than that. Disks with hybrid MBRs don't use extended partitions, though, because maintaining consistency between the GPT and MBR sides of the disk -- already a challenging enough task with regular hybrid MBRs -- would become much tougher. | It's not because of GPT. It's because of MBR. There are many problems with MBR and GPT compatibility which limit partition number to 4. If you aren't using MBR at all, which could be happening, everything should work fine. New versions of windows support GPT, so there is a chance that MBR isn't being used.
If you are using MBR, then I have no idea what's happening. |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | It's not because of GPT. It's because of MBR. There are many problems with MBR and GPT compatibility which limit partition number to 4. If you aren't using MBR at all, which could be happening, everything should work fine. New versions of windows support GPT, so there is a chance that MBR isn't being used.
If you are using MBR, then I have no idea what's happening. | The problem here is that, as cmurphy says, Windows (x64) can't use Apple's EFI implementation(which is basically EFI 1.1). It needs either UEFI (EFI 2.0) or BIOS. But because Windows has an [artificial limitation](http://www.rodsbooks.com/gdisk/booting.html) of tying up UEFI to GPT disks and BIOS to MBR disks, it needs some trickery to work. Specifically, Windows and OS X on an EFI 1.1 can coexist on a single drive "only" if Windows is fooled into thinking it's an MBR drive while it's actually GPT (OS X does not support MBR). This trickery is what is called Hybrid MBR - it's a dangerous and ugly hack like cmurphy says.
However, you CAN boot windows on GPT from BIOS *IF* you have any *small* MBR drive you can boot off, or even a floppy. It's not even a hack and will even work on Windows 32-bit.
Basically Boot into the Windows install/repair disc. Just create the system drive on the floppy, and use `bcdboot` to put your boot files on the floppy. Add a bootsector with `bootsect`. Change the `{bootmgr}` `device` to `boot`. Boot from floppy.
Steps are detailed [here](http://www.sevenforums.com/installation-setup/320700-boot-windows-7-8-gpt-bios-system-no-hybrid-mbrs-duet.html). |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | Intel-based Macs use the GUID Partition Table (GPT) by default. GPT in turn supports up to 128 partitions by default (that value can be increased if necessary, although most partition tools don't enable you to do so). Thus, there's no problem with having more than four partitions on an Intel-based Mac.
The limitation you've heard about is a distortion of the limitation on hybrid MBRs, which are a dangerous and standards-violating hybridization of GPT with the older Master Boot Record (MBR) partitioning system used on most PCs. In a hybrid MBR, up to *three* of the GPT's partitions are duplicated in an MBR data structure. MBR is limited to four *primary* partitions, and in a hybrid MBR the fourth primary partition is occupied by a special partition that identifies the disk as being a GPT disk. This fourth partition is often mistaken for an MBR-side duplicate of the EFI System Partition (ESP) that's present on most GPT disks, but it's not that.
Apple uses hybrid MBRs to enable Windows to dual-boot with OS X on Macs. Windows favors the MBR data structures, so it sees the disk as being an MBR disk, whereas OS X favors GPT data structures, so it sees the disk as being a GPT disk. (Linux, like OS X, sees a hybrid MBR as a GPT disk.) A hybrid MBR doesn't limit the number of GPT partitions you may have, but it does limit the number of partitions that the Windows installation can see, to no more than three.
Note that extended partitions and Extended Boot Records (EBRs) have nothing to do with hybrid MBRs -- or at least, they shouldn't! In the MBR scheme, extended partitions serve as placeholders for logical partitions, which are defined by EBRs. Using this scheme, an MBR disk can support a huge number of partitions -- theoretically about half as many as there are sectors on the disk, although practical limits are much lower than that. Disks with hybrid MBRs don't use extended partitions, though, because maintaining consistency between the GPT and MBR sides of the disk -- already a challenging enough task with regular hybrid MBRs -- would become much tougher. | I found [this article](http://www.rickycampbell.com/the-intel-mac-partitioning-system-efi-and-gpt/) which explains the partitioning scheme.
Essentially, if I understand the article correctly, there is an “Extended Boot Record” on one of the partitions on one of the primary four partitions which describes the extra "extended" partitions. Some legacy operating systems cannot see them.
Linux can see the extended partitions after the kernel is loaded. I presume you're able to boot properly because the Linux partition is on one of the four "primary" partitions. |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | I found [this article](http://www.rickycampbell.com/the-intel-mac-partitioning-system-efi-and-gpt/) which explains the partitioning scheme.
Essentially, if I understand the article correctly, there is an “Extended Boot Record” on one of the partitions on one of the primary four partitions which describes the extra "extended" partitions. Some legacy operating systems cannot see them.
Linux can see the extended partitions after the kernel is loaded. I presume you're able to boot properly because the Linux partition is on one of the four "primary" partitions. | The problem here is that, as cmurphy says, Windows (x64) can't use Apple's EFI implementation(which is basically EFI 1.1). It needs either UEFI (EFI 2.0) or BIOS. But because Windows has an [artificial limitation](http://www.rodsbooks.com/gdisk/booting.html) of tying up UEFI to GPT disks and BIOS to MBR disks, it needs some trickery to work. Specifically, Windows and OS X on an EFI 1.1 can coexist on a single drive "only" if Windows is fooled into thinking it's an MBR drive while it's actually GPT (OS X does not support MBR). This trickery is what is called Hybrid MBR - it's a dangerous and ugly hack like cmurphy says.
However, you CAN boot windows on GPT from BIOS *IF* you have any *small* MBR drive you can boot off, or even a floppy. It's not even a hack and will even work on Windows 32-bit.
Basically Boot into the Windows install/repair disc. Just create the system drive on the floppy, and use `bcdboot` to put your boot files on the floppy. Add a bootsector with `bootsect`. Change the `{bootmgr}` `device` to `boot`. Boot from floppy.
Steps are detailed [here](http://www.sevenforums.com/installation-setup/320700-boot-windows-7-8-gpt-bios-system-no-hybrid-mbrs-duet.html). |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | Intel-based Macs use the GUID Partition Table (GPT) by default. GPT in turn supports up to 128 partitions by default (that value can be increased if necessary, although most partition tools don't enable you to do so). Thus, there's no problem with having more than four partitions on an Intel-based Mac.
The limitation you've heard about is a distortion of the limitation on hybrid MBRs, which are a dangerous and standards-violating hybridization of GPT with the older Master Boot Record (MBR) partitioning system used on most PCs. In a hybrid MBR, up to *three* of the GPT's partitions are duplicated in an MBR data structure. MBR is limited to four *primary* partitions, and in a hybrid MBR the fourth primary partition is occupied by a special partition that identifies the disk as being a GPT disk. This fourth partition is often mistaken for an MBR-side duplicate of the EFI System Partition (ESP) that's present on most GPT disks, but it's not that.
Apple uses hybrid MBRs to enable Windows to dual-boot with OS X on Macs. Windows favors the MBR data structures, so it sees the disk as being an MBR disk, whereas OS X favors GPT data structures, so it sees the disk as being a GPT disk. (Linux, like OS X, sees a hybrid MBR as a GPT disk.) A hybrid MBR doesn't limit the number of GPT partitions you may have, but it does limit the number of partitions that the Windows installation can see, to no more than three.
Note that extended partitions and Extended Boot Records (EBRs) have nothing to do with hybrid MBRs -- or at least, they shouldn't! In the MBR scheme, extended partitions serve as placeholders for logical partitions, which are defined by EBRs. Using this scheme, an MBR disk can support a huge number of partitions -- theoretically about half as many as there are sectors on the disk, although practical limits are much lower than that. Disks with hybrid MBRs don't use extended partitions, though, because maintaining consistency between the GPT and MBR sides of the disk -- already a challenging enough task with regular hybrid MBRs -- would become much tougher. | While Windows 7 x86\_64 supports GPT, it only supports UEFI or BIOS. Windows 7 does not support "Apple EFI" which is an amalgam of Intel EFI 1.1, and some bits of Apple's own and some bits of UEFI 2.x. It is not strictly a UEFI 2.x implementation which is what all non-Mac OS operating systems require. So this in effect limits Bootcamp (or rEFIt) users to using the CSM (BIOS), and thus require an MBR since BIOS only understands MBRs.
MBR=4 partitions, but 1 of which is reserved when it's a hybrid MBR, as mentioned it's to indicate that the entire drive is GPT so that you have some warning from an MBR-only aware partitioning application. So in effect hybrid MBR is limited to 3 partitions.
In theory you can choose which 3 of the potentially 128 GPT partitions you want exported to the hybrid MBR. But most tools don't let you do this. The only one I know that does is gdisk.
I agree that hybrid MBR is standards-violating and is a bastardization. My preference would be for Apple to issue a fully standards compliant UEFI 2.x firmware for all machines sold in the past few years. In particular it's annoying as balls that brand new machines sold today still are based on Intel EFI 1.1, not UEFI 2.x. |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | Intel-based Macs use the GUID Partition Table (GPT) by default. GPT in turn supports up to 128 partitions by default (that value can be increased if necessary, although most partition tools don't enable you to do so). Thus, there's no problem with having more than four partitions on an Intel-based Mac.
The limitation you've heard about is a distortion of the limitation on hybrid MBRs, which are a dangerous and standards-violating hybridization of GPT with the older Master Boot Record (MBR) partitioning system used on most PCs. In a hybrid MBR, up to *three* of the GPT's partitions are duplicated in an MBR data structure. MBR is limited to four *primary* partitions, and in a hybrid MBR the fourth primary partition is occupied by a special partition that identifies the disk as being a GPT disk. This fourth partition is often mistaken for an MBR-side duplicate of the EFI System Partition (ESP) that's present on most GPT disks, but it's not that.
Apple uses hybrid MBRs to enable Windows to dual-boot with OS X on Macs. Windows favors the MBR data structures, so it sees the disk as being an MBR disk, whereas OS X favors GPT data structures, so it sees the disk as being a GPT disk. (Linux, like OS X, sees a hybrid MBR as a GPT disk.) A hybrid MBR doesn't limit the number of GPT partitions you may have, but it does limit the number of partitions that the Windows installation can see, to no more than three.
Note that extended partitions and Extended Boot Records (EBRs) have nothing to do with hybrid MBRs -- or at least, they shouldn't! In the MBR scheme, extended partitions serve as placeholders for logical partitions, which are defined by EBRs. Using this scheme, an MBR disk can support a huge number of partitions -- theoretically about half as many as there are sectors on the disk, although practical limits are much lower than that. Disks with hybrid MBRs don't use extended partitions, though, because maintaining consistency between the GPT and MBR sides of the disk -- already a challenging enough task with regular hybrid MBRs -- would become much tougher. | The problem here is that, as cmurphy says, Windows (x64) can't use Apple's EFI implementation(which is basically EFI 1.1). It needs either UEFI (EFI 2.0) or BIOS. But because Windows has an [artificial limitation](http://www.rodsbooks.com/gdisk/booting.html) of tying up UEFI to GPT disks and BIOS to MBR disks, it needs some trickery to work. Specifically, Windows and OS X on an EFI 1.1 can coexist on a single drive "only" if Windows is fooled into thinking it's an MBR drive while it's actually GPT (OS X does not support MBR). This trickery is what is called Hybrid MBR - it's a dangerous and ugly hack like cmurphy says.
However, you CAN boot windows on GPT from BIOS *IF* you have any *small* MBR drive you can boot off, or even a floppy. It's not even a hack and will even work on Windows 32-bit.
Basically Boot into the Windows install/repair disc. Just create the system drive on the floppy, and use `bcdboot` to put your boot files on the floppy. Add a bootsector with `bootsect`. Change the `{bootmgr}` `device` to `boot`. Boot from floppy.
Steps are detailed [here](http://www.sevenforums.com/installation-setup/320700-boot-windows-7-8-gpt-bios-system-no-hybrid-mbrs-duet.html). |
160,224 | I've read everywhere that you can't have more than 4 partitions because of GPT on intel Macs. But what happens if you make more than 4? On my iMac I have EFI, Macintosh HD, Windows, Linux, and Linux swap partitions and I am able to boot from all three operating systems with rEFIt. So, I have 5 partitions, so why does it work? I made the partitions with Snow Leopard's Disk Utility by the way. | 2010/07/05 | [
"https://superuser.com/questions/160224",
"https://superuser.com",
"https://superuser.com/users/5408/"
] | While Windows 7 x86\_64 supports GPT, it only supports UEFI or BIOS. Windows 7 does not support "Apple EFI" which is an amalgam of Intel EFI 1.1, and some bits of Apple's own and some bits of UEFI 2.x. It is not strictly a UEFI 2.x implementation which is what all non-Mac OS operating systems require. So this in effect limits Bootcamp (or rEFIt) users to using the CSM (BIOS), and thus require an MBR since BIOS only understands MBRs.
MBR=4 partitions, but 1 of which is reserved when it's a hybrid MBR, as mentioned it's to indicate that the entire drive is GPT so that you have some warning from an MBR-only aware partitioning application. So in effect hybrid MBR is limited to 3 partitions.
In theory you can choose which 3 of the potentially 128 GPT partitions you want exported to the hybrid MBR. But most tools don't let you do this. The only one I know that does is gdisk.
I agree that hybrid MBR is standards-violating and is a bastardization. My preference would be for Apple to issue a fully standards compliant UEFI 2.x firmware for all machines sold in the past few years. In particular it's annoying as balls that brand new machines sold today still are based on Intel EFI 1.1, not UEFI 2.x. | The problem here is that, as cmurphy says, Windows (x64) can't use Apple's EFI implementation(which is basically EFI 1.1). It needs either UEFI (EFI 2.0) or BIOS. But because Windows has an [artificial limitation](http://www.rodsbooks.com/gdisk/booting.html) of tying up UEFI to GPT disks and BIOS to MBR disks, it needs some trickery to work. Specifically, Windows and OS X on an EFI 1.1 can coexist on a single drive "only" if Windows is fooled into thinking it's an MBR drive while it's actually GPT (OS X does not support MBR). This trickery is what is called Hybrid MBR - it's a dangerous and ugly hack like cmurphy says.
However, you CAN boot windows on GPT from BIOS *IF* you have any *small* MBR drive you can boot off, or even a floppy. It's not even a hack and will even work on Windows 32-bit.
Basically Boot into the Windows install/repair disc. Just create the system drive on the floppy, and use `bcdboot` to put your boot files on the floppy. Add a bootsector with `bootsect`. Change the `{bootmgr}` `device` to `boot`. Boot from floppy.
Steps are detailed [here](http://www.sevenforums.com/installation-setup/320700-boot-windows-7-8-gpt-bios-system-no-hybrid-mbrs-duet.html). |
20,011,854 | What I want to do might be better achieved with a database, however I have very limited experience with them, and only have to change the information infrequently.
What I have is a sheet where each row has 8 cells of relevant data.
What I want to do in another sheet is to enter a number into 1 cell, and have a group of cells below use that number to reference data in the other sheet.
For example, in Sheet1 I could have the following (fig 1):
```
| A | B | C | D | E | F | G | H
-----+-----+-----+-----+-----+-----+-----+-----+-----
101 | Dep | 700 | Sta | 100 | Sta | 300 | Dep | 900
```
What I want to achieve in sheet 2, by typing the row number into 1 cell, is to have the data in those 8 cells copied below, for example (fig 2):
```
| A | B | C | D |
-----+-----+-----+-----+-----+
1 | "Row Number" |
-----+-----+-----+-----+-----+
2 | =A# | =B# | =D# | =C# |
-----+-----+-----+-----+-----+
3 | =E# | =F# | =H# | =G# |
-----+-----+-----+-----+-----+
```
And yes, I am aware those formulae above do not reference the other sheet - this was to save space.
Which, if using the example row above, should look like this (fig 3):
```
| A | B | C | D |
-----+-----+-----+-----+-----+
1 | 101 |
-----+-----+-----+-----+-----+
2 | Dep | 700 | 100 | Sta |
-----+-----+-----+-----+-----+
3 | Sta | 300 | 900 | Dep |
-----+-----+-----+-----+-----+
```
So, in that example above (fig 3), what do I need to put in as a formula in cells A2-D2 & A3-D3 to automatically use the number in A1 as part of the cell reference to print the data from the other sheet.
Does that make sense? I hope so because I have over 300 lines to enter into my 1st sheet and another 70 lines x 7 blocks of columns on the second sheet.
Lastly I just want to say I want to avoid programming languages, like VBA, wherever possible. | 2013/11/15 | [
"https://Stackoverflow.com/questions/20011854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2329155/"
] | Check out the INDIRECT() function.
For cell A2 in your example on the second sheet, enter:
```
=INDIRECT("Sheet1!"&"A"&$A$1)
```
Expand this formula to the apply to other target cells by changing the "&"A" portion to reference columns B, C, D, etc. from Sheet1 as needed in your grid per the following example:
```
=INDIRECT("Sheet1!"&"B"&$A$1)
=INDIRECT("Sheet1!"&"C"&$A$1)
=INDIRECT("Sheet1!"&"D"&$A$1)
```
These formulas will reference your selected "Row Number" in cell A1 and pull the related data from Sheet1 into Sheet2. | You can do this using the `INDIRECT` function
```
Returns the reference specified by a text string.
References are immediately evaluated to display their contents.
Use INDIRECT when you want to change the reference to a cell within a
formula without changing the formula itself.
```
<http://office.microsoft.com/en-gb/excel-help/indirect-HP005209139.aspx> |
62,565,369 | I tried to add jquery library file to assets folder and I added the directory to scripts in angular.json but when I run `ng serve` Angular told me Jquery library does not exist and I am using angular version 9.
I don't know where the problem any help please.
This the error message:
```
An unhandled exception occurred: Script file assets/js/jquery-3.5.1.slim.min.js does not exist.
```
angular.json file:
```
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"HorsesClubFrontend": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/HorsesClubFrontend",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"assets/css/bootstrap.min.css"
],
"scripts": [
"assets/js/jquery-3.5.1.slim.min.js",
"assets/js/bootstrap.min.js",
"assets/js/popper.min.js"]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "HorsesClubFrontend:build"
},
"configurations": {
"production": {
"browserTarget": "HorsesClubFrontend:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "HorsesClubFrontend:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "HorsesClubFrontend:serve"
},
"configurations": {
"production": {
"devServerTarget": "HorsesClubFrontend:serve:production"
}
}
}
}
}},
"defaultProject": "HorsesClubFrontend"
}
```
assets folder:
[](https://i.stack.imgur.com/xB7gA.png) | 2020/06/24 | [
"https://Stackoverflow.com/questions/62565369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8297550/"
] | To add jquery in angular have to follow below steps.
Step-1
>
> Add jquery file in **index.html** file into the head tag
>
>
>
```js
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
```
Step-2
>
> Also need to install two npm packages
>
>
>
```js
npm i [email protected]
npm i @types/jquery
```
Step-3
>
> Add jquery into **angular.json** file into the **script** array
>
>
>
```js
"scripts": [
"node_modules/jquery/dist/jquery.js"
]
```
Try above steps, I hope this will help you out. | Thanks for your answer your way it's worked, But I found other way by install bootstrap directly `npm install bootstrap --save` and include the libraries to angular.json:
```
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/bootstrap/dist/js/bootstrap.js"
]
```
and its worked perfectly |
3,742 | Usually one constructs a graph and then asks questions about the adjacency matrix's (or some close relative like the [Laplacian](http://en.wikipedia.org/wiki/Laplacian_matrix)) eigenvalue decomposition (also called the [spectra of a graph](http://en.wikipedia.org/wiki/Spectral_graph_theory)).
But what about the reverse problem? Given $n$ eigenvalues, can one (efficiently) find a graph that has this spectra?
I suspect that in general this is hard to do (and might be equivalent to GI) but what if you relax some of the conditions a bit? What if you make conditions that there is no multiplicity of eigenvalues? What about allowing graphs that have "close" spectra by some distance metric?
Any references or ideas would be welcome.
**EDIT**:
As Suresh points out, if you allow undirected weighted graphs with self loops, this problem becomes pretty trivial. I was hoping to get answers on the set of undirected, unweighted simple graphs but I would be happy with simple unweighted directed graphs as well. | 2010/12/11 | [
"https://cstheory.stackexchange.com/questions/3742",
"https://cstheory.stackexchange.com",
"https://cstheory.stackexchange.com/users/834/"
] | Cvetcovic et all in Section 3.3 of "Recent results in the theory of graph spectra" [goes over](http://yaroslavvb.com/upload/save/cstheory-cvetcovic-spectra.pdf) algorithms for constructing graphs given spectrum in some special cases | One other obstacle in defining your question is that the are isospectral (same eigenvalues) but non-isomorphic graphs. So given a list of eigenvalues in such a case, which graph do you want? Maybe you just want an algorithm to return one random element of the set of such non-isomorphic graphs? |
3,742 | Usually one constructs a graph and then asks questions about the adjacency matrix's (or some close relative like the [Laplacian](http://en.wikipedia.org/wiki/Laplacian_matrix)) eigenvalue decomposition (also called the [spectra of a graph](http://en.wikipedia.org/wiki/Spectral_graph_theory)).
But what about the reverse problem? Given $n$ eigenvalues, can one (efficiently) find a graph that has this spectra?
I suspect that in general this is hard to do (and might be equivalent to GI) but what if you relax some of the conditions a bit? What if you make conditions that there is no multiplicity of eigenvalues? What about allowing graphs that have "close" spectra by some distance metric?
Any references or ideas would be welcome.
**EDIT**:
As Suresh points out, if you allow undirected weighted graphs with self loops, this problem becomes pretty trivial. I was hoping to get answers on the set of undirected, unweighted simple graphs but I would be happy with simple unweighted directed graphs as well. | 2010/12/11 | [
"https://cstheory.stackexchange.com/questions/3742",
"https://cstheory.stackexchange.com",
"https://cstheory.stackexchange.com/users/834/"
] | Even asking whether a graph with a given spectrum exists is a tough question. This is witnessed by the [open problem](https://en.wikipedia.org/wiki/Moore_graph) of determining whether there exists a graph of girth 5 diameter 2 and order 3250 whose spectrum (if it exists) is known. | One other obstacle in defining your question is that the are isospectral (same eigenvalues) but non-isomorphic graphs. So given a list of eigenvalues in such a case, which graph do you want? Maybe you just want an algorithm to return one random element of the set of such non-isomorphic graphs? |
15,337 | I have a Vauxhall Corsa "C" (2003)(EU) which is a standard 16v 1.2 petrol, the engine is chain driven and sits at 50k. I don't think it was well looked after (service wise) in previous lifes.
Recently it sounds a bit more like a diesel when cold, but not too loud -and a common issue with the Corsa, however at the moment when the engine hits ~80-90 degrees it starts to "tick" loudly, to the point I can hear it in the cabin.
Observations
------------
* When I accelerate the ticking gets faster, if I depress the clutch and throttle, it gets faster, once the ticking starts it doesn't go away till the engine is cool. It will be audible when Idle and parked too.
* "slight" loss of power, hardly noticable not anything serious though, and no misfiring or overheating. Taking ~10min to get to temperature in 20-35mph traffic.
* prior to the ticking starting, when moving off in 1st, it sounds a bit "throaty" like an exhaust rattle but being in the car I can't work out where this is. No noticable smoke or anything from the exhaust as far as I can tell.
* Plenty (almost full) oil and coolant. Oil is fairly dark and theres a bit of gunk around from a bit of moisture (Not HGF, a common mistake when diagnosing things with this engine!) It's from doing short journeys and the build up of condensation. Multiple owner forums confirmed this.
Conditions:
-----------
* Engine is warm and has typically being driven for ~15min
* Starting in cold weather ~0-4 degrees c.
* Used for short journeys (~6 miles each way)
Notes
-----
* When I start the engine, it goes to about 2K RPM, sounds rough for about half a second then it's fine. This has been diagnosed as normal though for this car.
* When I move off when the engine is cold, I get slight revving for the first couple of seconds, again this looks fairly normal for this engine looking on owner forums.
Thoughts?
---------
My first though would be that it could be the oil, as it gets warmer the vicosity changes and it's not as effective? I thought it could be the timing chain, but it doesn't happen from cold. My third thought would be tappets. I'm not brilliant with mechanics so not a clue.
I recently put some Wynns Hydraulic Lifter fluid into the oil with no success. Sounds the same. The car *did* have some gasket work done and I'd be suprised if they did a full flush of fluids.
Tried to include as much info as I thought was relevant, but if theres anything else let me know
EDIT: Conclusion?
-----------------
It got a bit worse when the engine got to 85-86ish and the ticking was getting louder, it was also happening on *some* cold starts for 30seconds.
It went in for a full check hoping it was the Ex. Man. gasket, and they found that the **timing chain** had a small amount of slack on it, and on an unrelated note the oil pressure switch needed replacing, the old oil in the system probably didn't help the longevity of the chain.
**Update**
Months on and the car still does the same thing.
I have checked the oil, changed it, had the chain done and still after a 15-20 min drive it will tick away to itself. I think its the tappets, and occasionally the sound will go away again before returning later in my journey. | 2015/02/06 | [
"https://mechanics.stackexchange.com/questions/15337",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9353/"
] | Corsa's (actually Vauxhalls/Opels in general) sometimes have noisy hydraulic lifters. I drove mine for 60 thousand kilometers with this noise before I upgraded to a Turbo Coupe and gave the car to my mom. No problems so far. The Coupe had the same stupid tick. Again, I drove it for 30 thousand kilometers before trading it in for a Subaru Forester XT. Only problem I had with it was the turbo. Nothing wrong with the lifters or valves. If you click on my profile and check out my questions, you'll actually see one [where I posted a video of a loud ticking coming from my engine bay in the Coupe](https://mechanics.stackexchange.com/questions/7539/astra-turbo-sounding-like-a-diesel). I assume this is the same sound you hear. (The video makes it out to be a bit harsher than it actually is).
These noises are usually a valve that's stuck for whatever reason. It's something you can have looked at when the car is in for a major service or something, but it's my experience, and there is considerable consensus, that it's not a serious problem that you need to immediately spend your Valentine's Day money on. | I think this is a dual overhead camshaft engine. In that case, one of your lifters or springs may be going bad. This would slow down the return of the lifter as the cam moves away from it. that would create a momentary space and then a click when the lifter contacts the cam again. Just a guess.
Your mechanic probably has a modified stethoscope that he (or she) can use to pinpoint which cylinder is clicking.
I had a rocker arm in a 351W ford that was slightly loose because it was not thick enough at the mounting hole and creating a click. Added a .020" SS washer and fixed that. No rockers (probably) in the DOHC. |
15,337 | I have a Vauxhall Corsa "C" (2003)(EU) which is a standard 16v 1.2 petrol, the engine is chain driven and sits at 50k. I don't think it was well looked after (service wise) in previous lifes.
Recently it sounds a bit more like a diesel when cold, but not too loud -and a common issue with the Corsa, however at the moment when the engine hits ~80-90 degrees it starts to "tick" loudly, to the point I can hear it in the cabin.
Observations
------------
* When I accelerate the ticking gets faster, if I depress the clutch and throttle, it gets faster, once the ticking starts it doesn't go away till the engine is cool. It will be audible when Idle and parked too.
* "slight" loss of power, hardly noticable not anything serious though, and no misfiring or overheating. Taking ~10min to get to temperature in 20-35mph traffic.
* prior to the ticking starting, when moving off in 1st, it sounds a bit "throaty" like an exhaust rattle but being in the car I can't work out where this is. No noticable smoke or anything from the exhaust as far as I can tell.
* Plenty (almost full) oil and coolant. Oil is fairly dark and theres a bit of gunk around from a bit of moisture (Not HGF, a common mistake when diagnosing things with this engine!) It's from doing short journeys and the build up of condensation. Multiple owner forums confirmed this.
Conditions:
-----------
* Engine is warm and has typically being driven for ~15min
* Starting in cold weather ~0-4 degrees c.
* Used for short journeys (~6 miles each way)
Notes
-----
* When I start the engine, it goes to about 2K RPM, sounds rough for about half a second then it's fine. This has been diagnosed as normal though for this car.
* When I move off when the engine is cold, I get slight revving for the first couple of seconds, again this looks fairly normal for this engine looking on owner forums.
Thoughts?
---------
My first though would be that it could be the oil, as it gets warmer the vicosity changes and it's not as effective? I thought it could be the timing chain, but it doesn't happen from cold. My third thought would be tappets. I'm not brilliant with mechanics so not a clue.
I recently put some Wynns Hydraulic Lifter fluid into the oil with no success. Sounds the same. The car *did* have some gasket work done and I'd be suprised if they did a full flush of fluids.
Tried to include as much info as I thought was relevant, but if theres anything else let me know
EDIT: Conclusion?
-----------------
It got a bit worse when the engine got to 85-86ish and the ticking was getting louder, it was also happening on *some* cold starts for 30seconds.
It went in for a full check hoping it was the Ex. Man. gasket, and they found that the **timing chain** had a small amount of slack on it, and on an unrelated note the oil pressure switch needed replacing, the old oil in the system probably didn't help the longevity of the chain.
**Update**
Months on and the car still does the same thing.
I have checked the oil, changed it, had the chain done and still after a 15-20 min drive it will tick away to itself. I think its the tappets, and occasionally the sound will go away again before returning later in my journey. | 2015/02/06 | [
"https://mechanics.stackexchange.com/questions/15337",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9353/"
] | I think this is a dual overhead camshaft engine. In that case, one of your lifters or springs may be going bad. This would slow down the return of the lifter as the cam moves away from it. that would create a momentary space and then a click when the lifter contacts the cam again. Just a guess.
Your mechanic probably has a modified stethoscope that he (or she) can use to pinpoint which cylinder is clicking.
I had a rocker arm in a 351W ford that was slightly loose because it was not thick enough at the mounting hole and creating a click. Added a .020" SS washer and fixed that. No rockers (probably) in the DOHC. | I'm going with a leaking exhaust manifold for the ticking. Try tightening the manifold bolts a little. They will have a torque specification but hand tight will have a noticeable affect on the ticking if the manifold is your problem. Go back later and torque them properly. As far as the car running at 2000 RPM on start up, that is normal for most modern cars. My 2011 Nissan starts at about 1500 and slowly ends at 900.
-JMR(Auto Hobbyist / Diesel Mech. 8 Years) |
15,337 | I have a Vauxhall Corsa "C" (2003)(EU) which is a standard 16v 1.2 petrol, the engine is chain driven and sits at 50k. I don't think it was well looked after (service wise) in previous lifes.
Recently it sounds a bit more like a diesel when cold, but not too loud -and a common issue with the Corsa, however at the moment when the engine hits ~80-90 degrees it starts to "tick" loudly, to the point I can hear it in the cabin.
Observations
------------
* When I accelerate the ticking gets faster, if I depress the clutch and throttle, it gets faster, once the ticking starts it doesn't go away till the engine is cool. It will be audible when Idle and parked too.
* "slight" loss of power, hardly noticable not anything serious though, and no misfiring or overheating. Taking ~10min to get to temperature in 20-35mph traffic.
* prior to the ticking starting, when moving off in 1st, it sounds a bit "throaty" like an exhaust rattle but being in the car I can't work out where this is. No noticable smoke or anything from the exhaust as far as I can tell.
* Plenty (almost full) oil and coolant. Oil is fairly dark and theres a bit of gunk around from a bit of moisture (Not HGF, a common mistake when diagnosing things with this engine!) It's from doing short journeys and the build up of condensation. Multiple owner forums confirmed this.
Conditions:
-----------
* Engine is warm and has typically being driven for ~15min
* Starting in cold weather ~0-4 degrees c.
* Used for short journeys (~6 miles each way)
Notes
-----
* When I start the engine, it goes to about 2K RPM, sounds rough for about half a second then it's fine. This has been diagnosed as normal though for this car.
* When I move off when the engine is cold, I get slight revving for the first couple of seconds, again this looks fairly normal for this engine looking on owner forums.
Thoughts?
---------
My first though would be that it could be the oil, as it gets warmer the vicosity changes and it's not as effective? I thought it could be the timing chain, but it doesn't happen from cold. My third thought would be tappets. I'm not brilliant with mechanics so not a clue.
I recently put some Wynns Hydraulic Lifter fluid into the oil with no success. Sounds the same. The car *did* have some gasket work done and I'd be suprised if they did a full flush of fluids.
Tried to include as much info as I thought was relevant, but if theres anything else let me know
EDIT: Conclusion?
-----------------
It got a bit worse when the engine got to 85-86ish and the ticking was getting louder, it was also happening on *some* cold starts for 30seconds.
It went in for a full check hoping it was the Ex. Man. gasket, and they found that the **timing chain** had a small amount of slack on it, and on an unrelated note the oil pressure switch needed replacing, the old oil in the system probably didn't help the longevity of the chain.
**Update**
Months on and the car still does the same thing.
I have checked the oil, changed it, had the chain done and still after a 15-20 min drive it will tick away to itself. I think its the tappets, and occasionally the sound will go away again before returning later in my journey. | 2015/02/06 | [
"https://mechanics.stackexchange.com/questions/15337",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9353/"
] | Corsa's (actually Vauxhalls/Opels in general) sometimes have noisy hydraulic lifters. I drove mine for 60 thousand kilometers with this noise before I upgraded to a Turbo Coupe and gave the car to my mom. No problems so far. The Coupe had the same stupid tick. Again, I drove it for 30 thousand kilometers before trading it in for a Subaru Forester XT. Only problem I had with it was the turbo. Nothing wrong with the lifters or valves. If you click on my profile and check out my questions, you'll actually see one [where I posted a video of a loud ticking coming from my engine bay in the Coupe](https://mechanics.stackexchange.com/questions/7539/astra-turbo-sounding-like-a-diesel). I assume this is the same sound you hear. (The video makes it out to be a bit harsher than it actually is).
These noises are usually a valve that's stuck for whatever reason. It's something you can have looked at when the car is in for a major service or something, but it's my experience, and there is considerable consensus, that it's not a serious problem that you need to immediately spend your Valentine's Day money on. | I'm going with a leaking exhaust manifold for the ticking. Try tightening the manifold bolts a little. They will have a torque specification but hand tight will have a noticeable affect on the ticking if the manifold is your problem. Go back later and torque them properly. As far as the car running at 2000 RPM on start up, that is normal for most modern cars. My 2011 Nissan starts at about 1500 and slowly ends at 900.
-JMR(Auto Hobbyist / Diesel Mech. 8 Years) |
15,337 | I have a Vauxhall Corsa "C" (2003)(EU) which is a standard 16v 1.2 petrol, the engine is chain driven and sits at 50k. I don't think it was well looked after (service wise) in previous lifes.
Recently it sounds a bit more like a diesel when cold, but not too loud -and a common issue with the Corsa, however at the moment when the engine hits ~80-90 degrees it starts to "tick" loudly, to the point I can hear it in the cabin.
Observations
------------
* When I accelerate the ticking gets faster, if I depress the clutch and throttle, it gets faster, once the ticking starts it doesn't go away till the engine is cool. It will be audible when Idle and parked too.
* "slight" loss of power, hardly noticable not anything serious though, and no misfiring or overheating. Taking ~10min to get to temperature in 20-35mph traffic.
* prior to the ticking starting, when moving off in 1st, it sounds a bit "throaty" like an exhaust rattle but being in the car I can't work out where this is. No noticable smoke or anything from the exhaust as far as I can tell.
* Plenty (almost full) oil and coolant. Oil is fairly dark and theres a bit of gunk around from a bit of moisture (Not HGF, a common mistake when diagnosing things with this engine!) It's from doing short journeys and the build up of condensation. Multiple owner forums confirmed this.
Conditions:
-----------
* Engine is warm and has typically being driven for ~15min
* Starting in cold weather ~0-4 degrees c.
* Used for short journeys (~6 miles each way)
Notes
-----
* When I start the engine, it goes to about 2K RPM, sounds rough for about half a second then it's fine. This has been diagnosed as normal though for this car.
* When I move off when the engine is cold, I get slight revving for the first couple of seconds, again this looks fairly normal for this engine looking on owner forums.
Thoughts?
---------
My first though would be that it could be the oil, as it gets warmer the vicosity changes and it's not as effective? I thought it could be the timing chain, but it doesn't happen from cold. My third thought would be tappets. I'm not brilliant with mechanics so not a clue.
I recently put some Wynns Hydraulic Lifter fluid into the oil with no success. Sounds the same. The car *did* have some gasket work done and I'd be suprised if they did a full flush of fluids.
Tried to include as much info as I thought was relevant, but if theres anything else let me know
EDIT: Conclusion?
-----------------
It got a bit worse when the engine got to 85-86ish and the ticking was getting louder, it was also happening on *some* cold starts for 30seconds.
It went in for a full check hoping it was the Ex. Man. gasket, and they found that the **timing chain** had a small amount of slack on it, and on an unrelated note the oil pressure switch needed replacing, the old oil in the system probably didn't help the longevity of the chain.
**Update**
Months on and the car still does the same thing.
I have checked the oil, changed it, had the chain done and still after a 15-20 min drive it will tick away to itself. I think its the tappets, and occasionally the sound will go away again before returning later in my journey. | 2015/02/06 | [
"https://mechanics.stackexchange.com/questions/15337",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9353/"
] | Corsa's (actually Vauxhalls/Opels in general) sometimes have noisy hydraulic lifters. I drove mine for 60 thousand kilometers with this noise before I upgraded to a Turbo Coupe and gave the car to my mom. No problems so far. The Coupe had the same stupid tick. Again, I drove it for 30 thousand kilometers before trading it in for a Subaru Forester XT. Only problem I had with it was the turbo. Nothing wrong with the lifters or valves. If you click on my profile and check out my questions, you'll actually see one [where I posted a video of a loud ticking coming from my engine bay in the Coupe](https://mechanics.stackexchange.com/questions/7539/astra-turbo-sounding-like-a-diesel). I assume this is the same sound you hear. (The video makes it out to be a bit harsher than it actually is).
These noises are usually a valve that's stuck for whatever reason. It's something you can have looked at when the car is in for a major service or something, but it's my experience, and there is considerable consensus, that it's not a serious problem that you need to immediately spend your Valentine's Day money on. | I had similar ticking noise when accelerating after changing my engine oil on Toyota Corolla 1NZE. I came to find out that the oil does not reach to the most parts of the engine and it was caused by a poor performance of the oil strainer. The strainer was blocked by some bad oil left overs. Get the straigner cleaned and everything will be OK. |
15,337 | I have a Vauxhall Corsa "C" (2003)(EU) which is a standard 16v 1.2 petrol, the engine is chain driven and sits at 50k. I don't think it was well looked after (service wise) in previous lifes.
Recently it sounds a bit more like a diesel when cold, but not too loud -and a common issue with the Corsa, however at the moment when the engine hits ~80-90 degrees it starts to "tick" loudly, to the point I can hear it in the cabin.
Observations
------------
* When I accelerate the ticking gets faster, if I depress the clutch and throttle, it gets faster, once the ticking starts it doesn't go away till the engine is cool. It will be audible when Idle and parked too.
* "slight" loss of power, hardly noticable not anything serious though, and no misfiring or overheating. Taking ~10min to get to temperature in 20-35mph traffic.
* prior to the ticking starting, when moving off in 1st, it sounds a bit "throaty" like an exhaust rattle but being in the car I can't work out where this is. No noticable smoke or anything from the exhaust as far as I can tell.
* Plenty (almost full) oil and coolant. Oil is fairly dark and theres a bit of gunk around from a bit of moisture (Not HGF, a common mistake when diagnosing things with this engine!) It's from doing short journeys and the build up of condensation. Multiple owner forums confirmed this.
Conditions:
-----------
* Engine is warm and has typically being driven for ~15min
* Starting in cold weather ~0-4 degrees c.
* Used for short journeys (~6 miles each way)
Notes
-----
* When I start the engine, it goes to about 2K RPM, sounds rough for about half a second then it's fine. This has been diagnosed as normal though for this car.
* When I move off when the engine is cold, I get slight revving for the first couple of seconds, again this looks fairly normal for this engine looking on owner forums.
Thoughts?
---------
My first though would be that it could be the oil, as it gets warmer the vicosity changes and it's not as effective? I thought it could be the timing chain, but it doesn't happen from cold. My third thought would be tappets. I'm not brilliant with mechanics so not a clue.
I recently put some Wynns Hydraulic Lifter fluid into the oil with no success. Sounds the same. The car *did* have some gasket work done and I'd be suprised if they did a full flush of fluids.
Tried to include as much info as I thought was relevant, but if theres anything else let me know
EDIT: Conclusion?
-----------------
It got a bit worse when the engine got to 85-86ish and the ticking was getting louder, it was also happening on *some* cold starts for 30seconds.
It went in for a full check hoping it was the Ex. Man. gasket, and they found that the **timing chain** had a small amount of slack on it, and on an unrelated note the oil pressure switch needed replacing, the old oil in the system probably didn't help the longevity of the chain.
**Update**
Months on and the car still does the same thing.
I have checked the oil, changed it, had the chain done and still after a 15-20 min drive it will tick away to itself. I think its the tappets, and occasionally the sound will go away again before returning later in my journey. | 2015/02/06 | [
"https://mechanics.stackexchange.com/questions/15337",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9353/"
] | I had similar ticking noise when accelerating after changing my engine oil on Toyota Corolla 1NZE. I came to find out that the oil does not reach to the most parts of the engine and it was caused by a poor performance of the oil strainer. The strainer was blocked by some bad oil left overs. Get the straigner cleaned and everything will be OK. | I'm going with a leaking exhaust manifold for the ticking. Try tightening the manifold bolts a little. They will have a torque specification but hand tight will have a noticeable affect on the ticking if the manifold is your problem. Go back later and torque them properly. As far as the car running at 2000 RPM on start up, that is normal for most modern cars. My 2011 Nissan starts at about 1500 and slowly ends at 900.
-JMR(Auto Hobbyist / Diesel Mech. 8 Years) |
62,698,801 | I have .csv files (abc.csv, def.csv, etc...) in the directory and I would like to count of rows in every file and save the single file having name column and count column. My expected output as below :
```
df = name count
abc ....
def ....
ghi ....
```
I am doing something like below to get count but not able to covert in dataframe. Please suggest.
```
import os
path = '/some/path/to/file'
for filename in os.listdir(path):
with open(filename, 'r', encoding="latin-1") as fileObj:
# -1 to exclude the header
print("Rows Counted {} in the csv {}:".format(len(fileObj.readlines()) - 1, filename))
``` | 2020/07/02 | [
"https://Stackoverflow.com/questions/62698801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13838014/"
] | Put the name/line count of each file into lists, and then create your DataFrame once the loop is over:
```
import os
import pandas as pd
path = '/some/path/to/file'
names, counts = [], []
for filename in os.listdir(path):
with open(filename, 'r', encoding="latin-1") as fileObj:
names.append(filename)
# -1 to exclude the header
counts.append(len(fileObj.readlines()) - 1)
df = pd.DataFrame({'name': names, 'count': counts})
``` | using pandas and pathlib
```
from pathlib import Path
import pandas as pd
path_to_csv = 'your\\dir'
file_info = pd.DataFrame( {file.name :
pd.read_csv(file).shape for file in Path(path_to_csv).glob('*.csv')})\
.T.rename(columns={0 : 'rows', 1 : 'columns'})
print(file_info)
rows columns
01_02_20.csv 3 3
01_28_20.csv 3 4
12_02_19.csv 77 10
12_09_19.csv 86 7
``` |
150,243 | I have to redesign an existing M2-Shop with a given style guide.
That guide defines structures for headlines, sub-lines, product etc. like a style guide does.
My problem is that there is no given structure in the less structure to change that easily.
Is that even possible to have a let's say boilerplate for CSS?
The styles are spread all over the less files. To say a headline H1 has to have a font size with 24px and a red text color and maybe a given line height that modifications I have also to change in every less file e.g. `cms.less`, `product.less`, `product-list.less` and so on.
Is there a way to simplify that? | 2016/12/14 | [
"https://magento.stackexchange.com/questions/150243",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20318/"
] | I would never recommend writing a module to hide an attribute, in most cases this can be done via the admin panel. Here is how to disable fax via the admin panel.
**This is for Magento EE 2.1.1**
1. Goto `Stores - Attributes - Customer Address`
2. Click on the attribute fax and set `use in customer segment` to no
**This is for Magento CE 2.0.7**
1. Goto Stores - Configuration - Customers - Customer Configuration
2. Expand Address Templates group and remove `{{depend fax}}<br/>F: {{var
fax}}{{/depend}}` from all the text boxes.
>
> I've only specified these versions because thats the ones I tested on.
>
>
> | Add the following code in your `style.css` and it will remove the Fax field only from your Checkout page in frontend.
>
> .checkout-index-index .field[name="shippingAddress.fax"] { display:
> none; }
>
>
> |
150,243 | I have to redesign an existing M2-Shop with a given style guide.
That guide defines structures for headlines, sub-lines, product etc. like a style guide does.
My problem is that there is no given structure in the less structure to change that easily.
Is that even possible to have a let's say boilerplate for CSS?
The styles are spread all over the less files. To say a headline H1 has to have a font size with 24px and a red text color and maybe a given line height that modifications I have also to change in every less file e.g. `cms.less`, `product.less`, `product-list.less` and so on.
Is there a way to simplify that? | 2016/12/14 | [
"https://magento.stackexchange.com/questions/150243",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20318/"
] | I would never recommend writing a module to hide an attribute, in most cases this can be done via the admin panel. Here is how to disable fax via the admin panel.
**This is for Magento EE 2.1.1**
1. Goto `Stores - Attributes - Customer Address`
2. Click on the attribute fax and set `use in customer segment` to no
**This is for Magento CE 2.0.7**
1. Goto Stores - Configuration - Customers - Customer Configuration
2. Expand Address Templates group and remove `{{depend fax}}<br/>F: {{var
fax}}{{/depend}}` from all the text boxes.
>
> I've only specified these versions because thats the ones I tested on.
>
>
> | One can remove the Fax field from the Magento checkout Page by setting `Show Fax to No` as seen in the screenshot below. My store is on Magento CE 2.3.4
[](https://i.stack.imgur.com/wQFb8.png) |
3,283,693 | If $S=\left\{ A=\begin{bmatrix}A\_1&0 \\ 0&A\_2 \end{bmatrix} \in \mathbb{M}\_4(\mathbb{C}): det A\_1=detA\_2 \right\}$. Then is this set open in $\mathbb{M}\_{4}(\mathbb{C})$ with usual topology. If not then what are the interior points. I would like some hints towards this. Also if someone could suggest a book to study topology of space of complex matrices, it will be helpfull to me. Thank you.
I have an analytic map from open unit disc to the norm unit ball of space of matrices having image contained in $S$. That is why i am wondering about the interior of this set. | 2019/07/05 | [
"https://math.stackexchange.com/questions/3283693",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/303760/"
] | The area of a circular sector is given by:
$$A\_{\text{circular sector}} = \frac{r^2}{2} (\theta - \sin(\theta))$$
The intersection of two circles is just twice this:
$$A\_{\text{intersection}} = r^2 (\theta - \sin(\theta))$$
The height of the rectangle can be found using simple trigonometry:
$$h = 2r \sin\left(\frac{\theta}{2}\right)$$
And the width of the rectangle is twice the height of the circle segment.
$$w = 2 r \left(1 - \cos\left(\frac{\theta}{2}\right)\right)$$
$\theta$ itself can be found also using trigonometry.
$$\theta = 2 \arccos\left(\frac{d}{2r}\right)$$
So the ratio between the area of the intersection and its bounding rectangle is:
$$\begin{split}
R &= \frac{4r^2\left(1 - \cos\left(\frac{\theta}{2}\right)\right)\sin\left(\frac{\theta}{2}\right)}{r^2 \left(\theta - \sin\left(\theta\right)\right)} \\
&= \frac{4 \left(1 - \cos\left(\arccos\left(\frac{d}{2r}\right)\right)\right) \sin\left(\arccos\left(\frac{d}{2r}\right)\right)}{2\arccos\left(\frac{d}{2r}\right) - \sin\left(2\arccos\left(\frac{d}{2r}\right)\right)} \\
\end{split}$$
It is true that $\sin( \arccos(x)) = \sqrt{1 - x^2}$ and $\sin(2 \arccos(x)) = 2x \sqrt{1-x^2}$ so:
$$\begin{split}
R &= \frac{4 \left(1 - \frac{d}{2r}\right)\sqrt{1 - {\left(\frac{d}{2r}\right)}^2}}{2 \left(\arccos\left(\frac{d}{2r}\right) - \frac{d}{2r} \sqrt{1-{\left(\frac{d}{2r}\right)}^2} \right)} \\
&= \frac{2\left(1 - \frac{d}{2r}\right)\sqrt{1 - {\left(\frac{d}{2r}\right)}^2}}{\arccos\left(\frac{d}{2r}\right) - \frac{d}{2r} \sqrt{1-{\left(\frac{d}{2r}\right)}^2}} \\
\end{split}$$
We can take $\frac{d}{2r}$ to be $u$, a dimensionless parameter that describes the relationship between the size of the circles and the distance between them.
$$R = \frac{2 \left(1 - u\right)\sqrt{1 - u^2}}{\arccos(u) - u \sqrt{1-u^2}}$$
This function is monotonically increasing on the interval $u \in [0, 1)$ so $R$ has a maximum in the limit when $u = 1$ (and in particular, the complete overlap case of $u = 0$ where $R = \frac{4}{\pi}$ is actually the minimum).
This value can be found via L'Hopital's rule:
$$\begin{split}
\lim\_{u \rightarrow 1} \, &\frac{2 \left(1 - u\right)\sqrt{1 - u^2}}{\arccos(u) - u \sqrt{1-u^2}} \\
&=\lim\_{u \rightarrow 1} \, \frac{2\frac{2u^2 - u - 1}{\sqrt{1 - u^2}}}{-2 \sqrt{1 - u^2}} \\
&=\lim\_{u \rightarrow 1} \, -\frac{2u^2 - u - 1}{1 - u^2} \\
&=\lim\_{u \rightarrow 1} \, \frac{(2u + 1)(1-u)}{(1 + u)(1-u)} \\
&=\lim\_{u \rightarrow 1} \, \frac{(2u + 1)}{(1 + u)} \\
&= \frac{3}{2}
\end{split}$$ | To compute the area $B$ of the rectangle, we need its width and height.
The width $w$ is easy to compute, as we know the widest points are at $(d-r,0)$ and $(r,0)$, thus
$$ w=2r-d $$
The height $h$ can be computed by noticing that the high/low point lies as $(d/2,+a)$ and $(d/2,-a)$ width $a$ being the corresponding point on the intersection of the two circles.
$a$ can be computed by the pythagorean theorem if we look at the triangle from the origin of the left circle $(0,0)$, the point $(d/2,0)$ and $(d/2,a)$. Because the point of interest lies on the circle, the hypothenuse is $r$, thus overall we can say
$$r^2 = (d/2)^2+a^2$$
and thus
$$a = \sqrt{r^2-(d/2)^2}$$
The total height $h$ is the distance between $(d/2,+a)$ and $(d/2,-a)$, that is $2a$.
To sum up, the total area of the smallest enclosing rectangle is
$$B=wh=2(2r-d)\sqrt{r^2-(d/2)^2}$$
If you look at d in the range $[0,2r]$, it is apparent that B will be maximized at d=0.
If the same holds for B/A is for someone else to solve! :) |
3,283,693 | If $S=\left\{ A=\begin{bmatrix}A\_1&0 \\ 0&A\_2 \end{bmatrix} \in \mathbb{M}\_4(\mathbb{C}): det A\_1=detA\_2 \right\}$. Then is this set open in $\mathbb{M}\_{4}(\mathbb{C})$ with usual topology. If not then what are the interior points. I would like some hints towards this. Also if someone could suggest a book to study topology of space of complex matrices, it will be helpfull to me. Thank you.
I have an analytic map from open unit disc to the norm unit ball of space of matrices having image contained in $S$. That is why i am wondering about the interior of this set. | 2019/07/05 | [
"https://math.stackexchange.com/questions/3283693",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/303760/"
] | The area of a circular sector is given by:
$$A\_{\text{circular sector}} = \frac{r^2}{2} (\theta - \sin(\theta))$$
The intersection of two circles is just twice this:
$$A\_{\text{intersection}} = r^2 (\theta - \sin(\theta))$$
The height of the rectangle can be found using simple trigonometry:
$$h = 2r \sin\left(\frac{\theta}{2}\right)$$
And the width of the rectangle is twice the height of the circle segment.
$$w = 2 r \left(1 - \cos\left(\frac{\theta}{2}\right)\right)$$
$\theta$ itself can be found also using trigonometry.
$$\theta = 2 \arccos\left(\frac{d}{2r}\right)$$
So the ratio between the area of the intersection and its bounding rectangle is:
$$\begin{split}
R &= \frac{4r^2\left(1 - \cos\left(\frac{\theta}{2}\right)\right)\sin\left(\frac{\theta}{2}\right)}{r^2 \left(\theta - \sin\left(\theta\right)\right)} \\
&= \frac{4 \left(1 - \cos\left(\arccos\left(\frac{d}{2r}\right)\right)\right) \sin\left(\arccos\left(\frac{d}{2r}\right)\right)}{2\arccos\left(\frac{d}{2r}\right) - \sin\left(2\arccos\left(\frac{d}{2r}\right)\right)} \\
\end{split}$$
It is true that $\sin( \arccos(x)) = \sqrt{1 - x^2}$ and $\sin(2 \arccos(x)) = 2x \sqrt{1-x^2}$ so:
$$\begin{split}
R &= \frac{4 \left(1 - \frac{d}{2r}\right)\sqrt{1 - {\left(\frac{d}{2r}\right)}^2}}{2 \left(\arccos\left(\frac{d}{2r}\right) - \frac{d}{2r} \sqrt{1-{\left(\frac{d}{2r}\right)}^2} \right)} \\
&= \frac{2\left(1 - \frac{d}{2r}\right)\sqrt{1 - {\left(\frac{d}{2r}\right)}^2}}{\arccos\left(\frac{d}{2r}\right) - \frac{d}{2r} \sqrt{1-{\left(\frac{d}{2r}\right)}^2}} \\
\end{split}$$
We can take $\frac{d}{2r}$ to be $u$, a dimensionless parameter that describes the relationship between the size of the circles and the distance between them.
$$R = \frac{2 \left(1 - u\right)\sqrt{1 - u^2}}{\arccos(u) - u \sqrt{1-u^2}}$$
This function is monotonically increasing on the interval $u \in [0, 1)$ so $R$ has a maximum in the limit when $u = 1$ (and in particular, the complete overlap case of $u = 0$ where $R = \frac{4}{\pi}$ is actually the minimum).
This value can be found via L'Hopital's rule:
$$\begin{split}
\lim\_{u \rightarrow 1} \, &\frac{2 \left(1 - u\right)\sqrt{1 - u^2}}{\arccos(u) - u \sqrt{1-u^2}} \\
&=\lim\_{u \rightarrow 1} \, \frac{2\frac{2u^2 - u - 1}{\sqrt{1 - u^2}}}{-2 \sqrt{1 - u^2}} \\
&=\lim\_{u \rightarrow 1} \, -\frac{2u^2 - u - 1}{1 - u^2} \\
&=\lim\_{u \rightarrow 1} \, \frac{(2u + 1)(1-u)}{(1 + u)(1-u)} \\
&=\lim\_{u \rightarrow 1} \, \frac{(2u + 1)}{(1 + u)} \\
&= \frac{3}{2}
\end{split}$$ | 1. If you have two circles of the same radii, then it's easier as the setup is symmetric. They overlap over a region of length $2d-r$, so that is how long one side of the rectangle is. This also allows you to find the other side by a basic trigonometric argument which is something you would need to calculate their area of overlap anyway (angle subtended at the centre by the arc etc. etc.). It's not too difficult and you don't *necessarily* need the exact answer to figure out the second part.
2. If you have two identical circles and distance between their centres is $0$, it means the area of overlap is the entire circle so the rectangle is a square. Consider the following exercise:
>
> Take a circle $C$ of radius $r$. centre $X$, and consider a sector $A$, where the
> end points of the arc are $P$ and $Q$, and the angle subtended at the
> centre is $x$. Let the midpoint of the arc $PQ$ be $R$. Let $S=A\backslash PQX$. Then, can you find the condition on $x$ by differentiation or otherwise such that the ratio of $|PQR|/|S|$ is the highest?
>
>
>
Note that the area of $PQR$ is quite nicely related to your original $B$. Can you then relate this to your original problem? I believe it is still going to be a fair bit of tedious calculation but I think this a better way to go about it than plug in actual formulae for $B$ and $A$; think of it as an easier substitution. |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | Aaron Beall's answer is excellent. It may be worth knowing that if "lib" is not specified in the tsConfig.JSON file a default list of libraries are injected. The default libraries injected are:
► For --target ES5: DOM,ES5,ScriptHost
► For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
In other words: We must specify those libs that were previously added automatically. (see: <https://www.typescriptlang.org/docs/handbook/compiler-options.html> for further info)
```
"compilerOptions": {
"target": "es6",
"lib": [ "es2019", "DOM", "ES6" ,"DOM.Iterable", "ScriptHost"],}
``` | As of angular 11 and thx to [typescript 3.9](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html) this is now the new config.
```json
"compilerOptions": {
"target": "es2018",
"module": "es2020",
"lib": ["es2020", "dom"],
}
```
### Why `es2020` instead of `esnext`?
>
> In TypeScript 3.9, the behavior of the TypeScript compiler controlled by module is the same with both "esnext" and "es2020" values. This behavior can change in the future, because the "esnext" option could evolve in a backwards incompatible ways, resulting in build-time or run-time errors during a TypeScript update. As a result, code can become unstable. Using the "es2020" option mitigates this risk.
>
>
>
[for further read](https://angular.io/guide/migration-update-module-and-target-compiler-options) |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | Aaron Beall's answer is excellent. It may be worth knowing that if "lib" is not specified in the tsConfig.JSON file a default list of libraries are injected. The default libraries injected are:
► For --target ES5: DOM,ES5,ScriptHost
► For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
In other words: We must specify those libs that were previously added automatically. (see: <https://www.typescriptlang.org/docs/handbook/compiler-options.html> for further info)
```
"compilerOptions": {
"target": "es6",
"lib": [ "es2019", "DOM", "ES6" ,"DOM.Iterable", "ScriptHost"],}
``` | You can also add `esnext` to your --lib instead of 'es2019'
```
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "esnext"]
}
```
It worked for me. |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | I tried most answers and they didn't work for me.
IDE: VScode
but this did
```sh
npm i -D @types/node
``` | You can also add `esnext` to your --lib instead of 'es2019'
```
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "esnext"]
}
```
It worked for me. |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | If you're are in a lower version than es2019, you can implement a shim to provide similar functionality to `.flat()` and `.flatMap()` provided by later libraries.
To flat single level array
```
arr.reduce((acc, val) => acc.concat(val), []);
```
To flat multi level array
```
function flatDeep(arr, d = 1) {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), []) : arr.slice();
};
```
to know deeply you can also check below link
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> | I tried most answers and they didn't work for me.
IDE: VScode
but this did
```sh
npm i -D @types/node
``` |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | If you're are in a lower version than es2019, you can implement a shim to provide similar functionality to `.flat()` and `.flatMap()` provided by later libraries.
To flat single level array
```
arr.reduce((acc, val) => acc.concat(val), []);
```
To flat multi level array
```
function flatDeep(arr, d = 1) {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), []) : arr.slice();
};
```
to know deeply you can also check below link
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> | You can also add `esnext` to your --lib instead of 'es2019'
```
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "esnext"]
}
```
It worked for me. |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | You should add `es2019` or `es2019.array` to your `--lib` setting for TypeScript to recognize `array.flat()` and `flatMap()`.
Example:
```
{
"compilerOptions": {
"target": "es5",
"lib": [
"es2019"
]
}
}
```
Previously this was available as part of `esnext` or `esnext.array`, but it's now officially part of ES2019. | You can extend the global array interface while you wait for stability, at which point it will be added to the default library.
```
interface Array<T> {
flat(): Array<T>;
flatMap(func: (x: T) => T): Array<T>;
}
``` |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | As of angular 11 and thx to [typescript 3.9](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html) this is now the new config.
```json
"compilerOptions": {
"target": "es2018",
"module": "es2020",
"lib": ["es2020", "dom"],
}
```
### Why `es2020` instead of `esnext`?
>
> In TypeScript 3.9, the behavior of the TypeScript compiler controlled by module is the same with both "esnext" and "es2020" values. This behavior can change in the future, because the "esnext" option could evolve in a backwards incompatible ways, resulting in build-time or run-time errors during a TypeScript update. As a result, code can become unstable. Using the "es2020" option mitigates this risk.
>
>
>
[for further read](https://angular.io/guide/migration-update-module-and-target-compiler-options) | You can also add `esnext` to your --lib instead of 'es2019'
```
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "esnext"]
}
```
It worked for me. |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | If you're are in a lower version than es2019, you can implement a shim to provide similar functionality to `.flat()` and `.flatMap()` provided by later libraries.
To flat single level array
```
arr.reduce((acc, val) => acc.concat(val), []);
```
To flat multi level array
```
function flatDeep(arr, d = 1) {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), []) : arr.slice();
};
```
to know deeply you can also check below link
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> | Aaron Beall's answer is excellent. It may be worth knowing that if "lib" is not specified in the tsConfig.JSON file a default list of libraries are injected. The default libraries injected are:
► For --target ES5: DOM,ES5,ScriptHost
► For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
In other words: We must specify those libs that were previously added automatically. (see: <https://www.typescriptlang.org/docs/handbook/compiler-options.html> for further info)
```
"compilerOptions": {
"target": "es6",
"lib": [ "es2019", "DOM", "ES6" ,"DOM.Iterable", "ScriptHost"],}
``` |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | If you're are in a lower version than es2019, you can implement a shim to provide similar functionality to `.flat()` and `.flatMap()` provided by later libraries.
To flat single level array
```
arr.reduce((acc, val) => acc.concat(val), []);
```
To flat multi level array
```
function flatDeep(arr, d = 1) {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), []) : arr.slice();
};
```
to know deeply you can also check below link
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> | You can extend the global array interface while you wait for stability, at which point it will be added to the default library.
```
interface Array<T> {
flat(): Array<T>;
flatMap(func: (x: T) => T): Array<T>;
}
``` |
53,556,409 | I'm using Chrome 70 and Chrome does add methods `.flatMap`, `.flatten`, `.flat`. So my code does run as expected. Unfortunately, TypeScript doesn't like it.
```
// data.flatMap lint error
export const transformData = (data: any[]) => data.flatMap(abc => [
parentObj(abc),
...generateTasks(abc)
]);
```
The warning I got is `TS2339: Property 'flatMap' does not exist on type 'any[]'.`
I'm using Angular 6, which uses Typescript ~2.9.2, and I already include `import 'core-js/es7/array';` in `polyfills.ts`.
My guess is that there is no typing for these methods, and I did try to `npm run -dev @types/array.prototype.flatmap` but still not solve. | 2018/11/30 | [
"https://Stackoverflow.com/questions/53556409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3648961/"
] | Aaron Beall's answer is excellent. It may be worth knowing that if "lib" is not specified in the tsConfig.JSON file a default list of libraries are injected. The default libraries injected are:
► For --target ES5: DOM,ES5,ScriptHost
► For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
In other words: We must specify those libs that were previously added automatically. (see: <https://www.typescriptlang.org/docs/handbook/compiler-options.html> for further info)
```
"compilerOptions": {
"target": "es6",
"lib": [ "es2019", "DOM", "ES6" ,"DOM.Iterable", "ScriptHost"],}
``` | I tried most answers and they didn't work for me.
IDE: VScode
but this did
```sh
npm i -D @types/node
``` |
17,824,212 | I want to write a sql query wherein the fourth letter should be `'x'` and there should be `'m'` anywhere in the whole word. I am having a list of over 5000 words.
I tried the command
```
where name like '___x%m%'
```
but that would only give me those where `x` is the fourth letter and there is m after x, but how to find those names which have `x` as fourth letter and have `m` coming before `x`? | 2013/07/24 | [
"https://Stackoverflow.com/questions/17824212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569014/"
] | You can do this:
```
where name like '____x%' and name like '%m%'
``` | Simply have the 2 conditions:
```
WHERE name LIKE '___x%' AND name LIKE '%m%'
```
Assuming the \_\_\_x part works for you. |
70,478,973 | I have list which contains a map List<Map<String, Object>> map has two keys which is a id and the amount. I want to sort the list descending order base on the amount key, if the amount is same for two elements in the list then sort it based on the id. How can I do this ?
```
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> hm = new HashMap<>();
hm.put(id, 1);
hm.put(amount, 25000);
list.add(hm);
```
index of list element = 1, 2, 3 ,4 ,5 ,6
values for id = 1, 2, 3 ,4 ,5, 4
values for amount = 10000, 450000, 25000, 45000, 35000, 75000
list should sorted as follows(index of list) = 6, 4 (id is large), 2, 5, 3, 1 | 2021/12/25 | [
"https://Stackoverflow.com/questions/70478973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11383967/"
] | Your model is not wrong as suggested in comments - your NetworkP2P might be missing only one column (Reciever), which could work as optional foreign key (to satisfy your sentence "Not all Phone numbers match the ones that Subscribers have."), but it looks more log than relational table.
Query for your desired output:
```
select
caller.SubscriberID as Caller,
reciever.SubscriberID as Reciever,
caller.PhoneNumber as CallerPhone,
nt.AddresseeNumber as RecieverPhone, -- better than reciever.PhoneNumber because you can use left join recievers to get missing substribers
nt.CallStart,
nt.CallEnd
from Subscriber as caller
inner join NetworkP2P as nt
on nt.SubscriberID = caller.SubscriberID
inner join Subscriber as reciever
on nt.AddresseeNumber = reciever.PhoneNumber
-- where '2021-02-03' between nt.CallStart and nt.CallEnd -- calls in 2021-02-03
-- where nt.CallStart between '2021-02-01' and '2021-02-28' -- calls in specific interval
-- where eomonth(nt.CallStart) = eomonth('2021-02-01') -- calls in specific month
```
You should always use database schema for all your tables (for example dbo.Subscriber). | Two joins to Subscriber should do it.
>
>
> ```
> SELECT
> nw.SubscriberID AS Caller
> , rcvr.SubscriberID AS Receiver
> , callr.PhoneNumber AS CallerPhone
> , nw.AddresseeNumber AS ReceiverPhone
> FROM NetworkP2P nw
> JOIN Subscriber callr ON callr.SubscriberID = nw.SubscriberID
> LEFT JOIN Subscriber rcvr ON rcvr.PhoneNumber = nw.AddresseeNumber
> WHERE rcvr.SubscriberID IS NOT NULL
> ORDER BY Caller, Receiver
>
> ```
>
>
| Caller | Receiver | CallerPhone | ReceiverPhone |
| --- | --- | --- | --- |
| 1 | 3 | 613-555-0156 | 613-555-0119 |
| 1 | 4 | 613-555-0156 | 613-555-0182 |
| 2 | 1 | 613-555-0112 | 613-555-0156 |
| 2 | 3 | 613-555-0112 | 613-555-0119 |
| 3 | 2 | 613-555-0119 | 613-555-0112 |
Demo on *db<>fiddle [here](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=373815a6685d2fa4b842da4cbee26ace)* |
49,161,709 | My data looks something like this:
```
dat <- data.frame(Model = rep(c("OM", "EM-1", "EM-2", "EM-3"), each = 3),
Run = rep(c(1,2,3), time=4),
Value = c(2,10,5,20,26,7,8,15,33,11,31,7))
```
Where I have values from multiple models across several runs, in this case 4 models with 3 runs each. The "OM" model is the base case and I would like to compare everything back to it.
I would like to, using tidyverse, calculate a new value which would be the difference between each model run and its corresponding "OM" model run. I think I am getting close with:
```
library(tidyverse)
x <- dat %>%
group_by(Run) %>%
filter(!is.na(Value)) %>%
mutate(Diff = c(NA, diff(Value)))
```
Which calculates the difference between Runs of subsequent models but I cant figure out how to get all of these calculations to be in relation to the "OM" model, instead of just whatever the previous model was. I know I can do this by subsetting my data and doing the calculations that way but I am trying to do it cleanly in tidyverse since I will have lots of different models over time and don't want to have to subset all of them to run calculations.
Thanks in advance for the help. | 2018/03/07 | [
"https://Stackoverflow.com/questions/49161709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666272/"
] | Yes, your coding technique is good (or at least acceptable).
Using `break` is perfectly fine in `for` loops. In fact, it suggest you may have advanced knowledge about `Java` as you already demonstrate that you know that `break` will end the loop.
The same goes for using `return` multiple times as it demonstrates that you know that a function will stop running once it `return`s something, meaning that you know using multiple `return`s can improve efficiency.
Also, your frequent use of `for` loops demonstrates that you're comfortable using them, which is good. Your use of `i` and `j` as counter variables strengthens this impression.
Note: I would just like to point out that using lengthy variable names isn't the best practice as you're more prone to making a typo (that said, it's good that you're using camelCase for your variables). | I refactored the method into smaller methods to show you an example of what I meant in my comment. See below. Multiple `return` or `break` statements, as well as a lot of variables, all in one method, can be hard to read. By breaking the logic up into smaller pieces it's more manageable. Three steps - find the breaking element, get the new fixed array, check it and return a `boolean` based on what it looks like.
```
public boolean isAlmostIncreasing(int[] sequence) {
int[] newFixedArray = toNewFixedArray(sequence);
for (int i = 0; i < newFixedArray.length - 1; i++) {
if (newFixedArray[i] >= newFixedArray[i + 1]) {
return false;
}
}
return true;
}
private int[] toNewFixedArray(int[] sequence) {
int[] newFixedArray = new int[sequence.length
- 1]; /* an array used to store the edited or fixed array for further processing */
int indexOfBreakingElement = findBreakingElementIndex(sequence);
if (indexOfBreakingElement > 0) {
for (int i = 0; i < indexOfBreakingElement; i++) {
newFixedArray[i] = sequence[i];
}
for (int i = indexOfBreakingElement + 1; i < sequence.length; i++) {
newFixedArray[i - 1] = sequence[i];
}
}
for (int i = 0; i < sequence.length - 2; i++) {
if (newFixedArray[i] >= newFixedArray[i + 1]) {
indexOfBreakingElement = i;
for (int j = i + 1; j < sequence.length; j++) {
newFixedArray[j - 1] = sequence[j];
}
break;
}
}
return newFixedArray;
}
private int findBreakingElementIndex(int[] sequence) {
int indexOfBreakingElement = 0;
for (int i = 0; i < sequence.length - 1; i++) {
if (sequence[i] >= sequence[i + 1]) {
indexOfBreakingElement = i + 1;
break;
}
}
return indexOfBreakingElement;
}
``` |
20,032 | I've just started implementing bullet into my Ogre project. I followed the install instructions here: <http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1>
And the rest if the tutorial here:
<http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2>
I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.
I need a way to fix the capsule to always stay upright, but I have no idea how
Below is the code I'm using.
(part of) Header File
```
OgreBulletDynamics::DynamicsWorld *mWorld; // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *> mBodies;
std::deque<OgreBulletCollisions::CollisionShape *> mShapes;
OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
```
main file
```
bool MinimalOgre::go(void)
{
...
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0,0,0));
mCamera->lookAt(Vector3(0,0,300));
mCamera->setNearClipDistance(5);
mCameraMan = new OgreBites::SdkCameraMan(mCamera);
OgreBulletCollisions::CollisionShape *Shape;
Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
"BasePlane",
mWorld);
defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
// push the created objects to the deques
mShapes.push_back(Shape);
mBodies.push_back(defaultPlaneBody);
character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));
charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
charNode->attachObject(mCamera);
charNode->setPosition(mCamera->getPosition());
characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
characterBody->setShape( charNode,
character,
0.0f, // dynamic body restitution
10.0f, // dynamic body friction
10.0f, // dynamic bodymass
Vector3(0,0,0),
Quaternion(0, 0, 1, 0));
mShapes.push_back(character);
mBodies.push_back(characterBody);
...
}
``` | 2011/11/21 | [
"https://gamedev.stackexchange.com/questions/20032",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/11299/"
] | I've never used Bullet, but in Havok you could constrain a model on certain axes. If you can constrain rotation of your model on both horizontal axes that may stop it from falling over. Alternatively Havok let you have a special type of physics called a CharacterProxy, each from you could for it to face straight up, and you could also run your own code for its physics simulation so you could prevent rolling. This is similar to how the JigLib/JigLibX physics engines handle it as well. I'm willing to bet Bullet allows one of these methods. | A capsule shape will fall and roll around according to its physical properties. If you want to couple your camera to a physics object, why not use btBoxShape (or the Ogre equivalent) instead?
I don’t really know what you’re trying to do, but my suggestion would be to have the camera separate from the physics. That way, you’ll be able to move it as you like. |
20,032 | I've just started implementing bullet into my Ogre project. I followed the install instructions here: <http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1>
And the rest if the tutorial here:
<http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2>
I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.
I need a way to fix the capsule to always stay upright, but I have no idea how
Below is the code I'm using.
(part of) Header File
```
OgreBulletDynamics::DynamicsWorld *mWorld; // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *> mBodies;
std::deque<OgreBulletCollisions::CollisionShape *> mShapes;
OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
```
main file
```
bool MinimalOgre::go(void)
{
...
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0,0,0));
mCamera->lookAt(Vector3(0,0,300));
mCamera->setNearClipDistance(5);
mCameraMan = new OgreBites::SdkCameraMan(mCamera);
OgreBulletCollisions::CollisionShape *Shape;
Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
"BasePlane",
mWorld);
defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
// push the created objects to the deques
mShapes.push_back(Shape);
mBodies.push_back(defaultPlaneBody);
character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));
charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
charNode->attachObject(mCamera);
charNode->setPosition(mCamera->getPosition());
characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
characterBody->setShape( charNode,
character,
0.0f, // dynamic body restitution
10.0f, // dynamic body friction
10.0f, // dynamic bodymass
Vector3(0,0,0),
Quaternion(0, 0, 1, 0));
mShapes.push_back(character);
mBodies.push_back(characterBody);
...
}
``` | 2011/11/21 | [
"https://gamedev.stackexchange.com/questions/20032",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/11299/"
] | I actually just finished writing this for my capsule object yesterday.
You just need to call btRigidBody::setAngularFactor(btVector3(Yaw, Pitch, Roll)); Calling it with all 0s will prevent your object from rotating on any angle.
Here is where I originally found the answer: <http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=2956>
(In reply to that thread I have had no issues using Bullet 2.79 and setAngularFactor) | A capsule shape will fall and roll around according to its physical properties. If you want to couple your camera to a physics object, why not use btBoxShape (or the Ogre equivalent) instead?
I don’t really know what you’re trying to do, but my suggestion would be to have the camera separate from the physics. That way, you’ll be able to move it as you like. |
20,032 | I've just started implementing bullet into my Ogre project. I followed the install instructions here: <http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1>
And the rest if the tutorial here:
<http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2>
I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.
I need a way to fix the capsule to always stay upright, but I have no idea how
Below is the code I'm using.
(part of) Header File
```
OgreBulletDynamics::DynamicsWorld *mWorld; // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *> mBodies;
std::deque<OgreBulletCollisions::CollisionShape *> mShapes;
OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
```
main file
```
bool MinimalOgre::go(void)
{
...
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0,0,0));
mCamera->lookAt(Vector3(0,0,300));
mCamera->setNearClipDistance(5);
mCameraMan = new OgreBites::SdkCameraMan(mCamera);
OgreBulletCollisions::CollisionShape *Shape;
Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
"BasePlane",
mWorld);
defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
// push the created objects to the deques
mShapes.push_back(Shape);
mBodies.push_back(defaultPlaneBody);
character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));
charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
charNode->attachObject(mCamera);
charNode->setPosition(mCamera->getPosition());
characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
characterBody->setShape( charNode,
character,
0.0f, // dynamic body restitution
10.0f, // dynamic body friction
10.0f, // dynamic bodymass
Vector3(0,0,0),
Quaternion(0, 0, 1, 0));
mShapes.push_back(character);
mBodies.push_back(characterBody);
...
}
``` | 2011/11/21 | [
"https://gamedev.stackexchange.com/questions/20032",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/11299/"
] | I actually just finished writing this for my capsule object yesterday.
You just need to call btRigidBody::setAngularFactor(btVector3(Yaw, Pitch, Roll)); Calling it with all 0s will prevent your object from rotating on any angle.
Here is where I originally found the answer: <http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=2956>
(In reply to that thread I have had no issues using Bullet 2.79 and setAngularFactor) | I've never used Bullet, but in Havok you could constrain a model on certain axes. If you can constrain rotation of your model on both horizontal axes that may stop it from falling over. Alternatively Havok let you have a special type of physics called a CharacterProxy, each from you could for it to face straight up, and you could also run your own code for its physics simulation so you could prevent rolling. This is similar to how the JigLib/JigLibX physics engines handle it as well. I'm willing to bet Bullet allows one of these methods. |
5,388,194 | Is there a Java Web Framework, with mvc, thrid-party integration APIs, libraries and tools? Something like Zend Framework for PHP? | 2011/03/22 | [
"https://Stackoverflow.com/questions/5388194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268912/"
] | There are a lot of Java web Frameworks, here you have a list with lots of them: <http://java-source.net/open-source/web-frameworks>
The most "famous" would be Struts, JSF or Spring mvc framework (not in that particular order). | You also have [AppFuse](http://appfuse.org/display/APF/Home)
>
> **AppFuse** is an open source project and
> application that uses open source
> tools built on the Java platform to
> help you develop Web applications
> quickly and efficiently. It was
> originally developed to eliminate the
> ramp-up time found when building new
> web applications for customers. At its
> core, AppFuse is a project skeleton,
> similar to the one that's created by
> your IDE when you click through a
> wizard to create a new web project.
>
>
> AppFuse 2.x is a restructuring of
> AppFuse 1.x to use Maven 2 and JDK 5
> and annotations. The major reasons we
> use Maven 2 are:
>
>
>
> ```
> Dependency downloading
> Easier maintenance (everything can be compiled at once)
> Easier upgrading for end-users
>
> ```
>
> If you'd like to help out or ask
> questions about AppFuse 2.0, please do
> so on the user mailing list. If you'd
> like to use AppFuse 2.0, see the Demos
> and Videos and use the QuickStart
> Guide to get started.
>
>
> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.