text:
Q: Pass current page URL on click to CF7 Hi I'm using CF7 Dynamic Text Extension.
I have a call back button that goes to a CF7 Form, but I need to know the URL that the click came from. Currently using the code below
<?php echo 'ID)) .'">Request Callback'; ?>
However there are titles that are the same, so I really need the URL to tell us exactly what the contact is related to.

A: Instead of
get_the_title($post->ID)

Make it
get_permalink($post->ID)


text:
Q: How to create custom metadata record What is the way to create custom metadata in salesforce org? Are there any specific steps that i should follow?I have tried to create custom metadata via force.com IDE by creating an object with __md appended but it was creating custom object instead with __c appended at the end.I could not find any documentation related to creation of custom metadata records creation.

A: You can follow the below pdf to know all about custom metadata.
https://resources.docs.salesforce.com/198/latest/en-us/sfdc/pdf/custom_metadata_types_impl_guide.pdf

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to make an event on one element cause a bootstrap popover on another element? Am trying to create a picture upload button with js, that will have the following functionality....
1)Pop up file chooser on click (accomplished)
2)Preview image selected inside a bootstrap popover when the image is selected from file chooser...
The button contains an input tag of type file, with a css class(.file-inputs) that applies a display of none on the element, so I cant add the popover to the input tag since popovers don't work on hidden elements, how can I make the popover display on the visible button when the value of the input tag is changed
Maybe something like so

$('#photo').change()(function(){

if(!($("#photo").val() == '')){

  //Use bootstrap popover to show image over button

    });

  });

Here is the button code

<button class="btn btn-default" rel="popover" id="btn-photo">
  <i class="glyphicon glyphicon-picture"></i>
  <input class="file-inputs" type="file" name="photo" id="photo" />
</button>

And here is the js

$(document).ready(function() {

  var img = '';

  //Event to display file chooser
  $('.post-box').on('click', '#btn-photo', function() {
    event.preventDefault();
    var elem = document.getElementById('photo');
    if (elem && document.createEvent) {
      var evt = document.createEvent("MouseEvents");
      // Event(event_type:String, bubbles:Boolean, cancelable:Boolean)
      evt.initEvent("click", false, true);
      elem.dispatchEvent(evt);

    }

  });

  // Show popover on button

  $("#btn-photo").popover({
    placement: 'top',
    trigger: 'click',
    title: 'Add a picture to your post! :)',
    content: img,
    html: true
  });
  // });

});

A: A fast answer is something like this:
$("#yourbutton").on("yourevent", function(){$("#otherbutton").trigger("click");});


text:
Q: Issue in cast_receiver.js prevents Custom Chromecast Receiver from running on Chromecast fw 1.26 As the title suggests, since the FW update, i'm getting a very strange error with my Custom Chromecast Receiver.

Uncaught TypeError: Cannot read property 'decrypt' of undefined
    at cast_receiver.js:130
    at cast_receiver.js:236

Basically what happens is that when a user tries to connect to the chromecast device from the client app, my implementation of the Receiver gets this error and will not load, instead the Chromecast goes back to the idle screen.
What's even more interesting is that I have 2 variants of the receiver. Both have the same codebase, but they are hosted in different places. One is hosted on firebase, while the other is hosted on a private server. Both of them worked on the 1.25 FW and now only the one hosted on Firebase works.
I'm trying to understand the error that i'm getting as that's my only lead so far in debugging this issue.
I also saw that several other persons are reporting issues with this latest Chromecast FW, but so far there is no solid response as to why they are having problems. (Source)
Does anyone have an idea as to why this is happening ?
Thanks


text:
Q: can #+BIND: be wrapped? Correct Version:
#+BIND: org-html-postamble-format (("en" "abcxyz"))

but if the format string is very long, is there a way to wrap it to multilines?
something like this:
#+BIND: org-html-postamble-format (("en" "abc ~
# xyz"))

A: Unfortunately no.  Keywords in org-mode are constrained to a single line and there is no wrapping character.  If you feel strongly about your line length you might consider:

*

*Using the #+SETUPFILE mechanism (see: In-buffer settings)

*Defining that format in your dotemacs file so you can span multiple lines.

*Using some form of local file or directory variables.  For example local variables may span multiple lines:

# Local Variables:
# eval: (setq org-html-postamble t)
# eval: (setq org-html-postamble-format '(("en" "foo
# bar \
# baz")))
# End:

Note: You may notice that some some particular keywords have "wrapping" behavior such as node properties (http://orgmode.org/manual/Property-syntax.html):
 #+PROPERTY: var  foo=1
 #+PROPERTY: var+ bar=2

Behavior like this is special and limited to those keywords.  No equivalent wrapping behavior exists for the BIND keyword.
Current org-mode version (as of this post): 8.3.4


text:
Q: How to select buyers who increased their order quantity with each consecutive order I have table Buyer

BuyId
QuantityOrdered
dateordered

1
10
2021-11-04

1
20
2022-01-22

2
50
2022-02-20

2
60
2022-05-02

3
10
2022-05-02

4
10
2022-05-02

I need to select all BuyId's who consecutively had higher QuantityOrder in each new record

*

*buyid=1 had first order with quantity=10, second order with quantity=20

*buyid=2 had first order with quantity=50, second order with quantity=60

So BuyId=1 and 2 would enter the results, while 3 and 4 would be filtered out because they had only one order or they did not have orders with consecutively higher quantities ordered
I tried with this, and I'm aware that this query gives me only buyid's who have more than one order, but I am missing the rule where I have to filter results out by quantity increased with each new order
select buyid, count(*) as ordered
from buyer
group by buyid
having count(*) >1

How would I write out that rule in a query, to select only BuyId's who had multiple orders, and in each new order they ordered higher quantities than in previous orders?

A: Taking advantage of the fact that count() doesn't takes into account NULL values:
select buyid from (
select buyid, count(QuantityOrdered) as norders, count(mod) as nqttyincreasing
from (
    select d.*,
        case when nvl(lag(QuantityOrdered) over(partition by buyid order by dateordered),0) < QuantityOrdered then 1 end as mod
    from data d
)
group by buyid
) where norders = nqttyincreasing ;

A: With this query, it will check if all purchases as bigger in quantity as the last and will not show buyers id. that have only one purchase or sold equal or less than the last time4
CREATE TABLE buyers
    ([BuyId] int, [QuantityOrdered] int, [dateordered] date)
;

INSERT INTO buyers
    ([BuyId], [QuantityOrdered], [dateordered])
VALUES
    (1, 10, '2021-11-04'),
    (1, 20, '2022-01-22'),
  (1, 30, '2022-02-22'),
    (2, 50, '2022-02-20'),
    (2, 60, '2022-05-02'),
    (3, 60, '2022-05-02'),
    (4, 10, '2022-05-02'),
    (4, 6, '2022-06-02')
;

8 rows affected

WITH CTE as (SELECT
[BuyId], [QuantityOrdered], [dateordered],
  (SELECT COUNT(*) FROM buyers b1 WHERE b1.[BuyId] = buyers.[BuyId]) _count_
,CASE WHEn [QuantityOrdered] >
   LAG([QuantityOrdered]) OVER(PARTITION BY [BuyId] ORDER BY [dateordered])
THEn 1
   ELSe
      CASE WHEN LAG([QuantityOrdered]) OVER(PARTITION BY [BuyId] ORDER BY [dateordered]) IS NULL
           THEN 1 ELSE 0 END
  END _bigger_
FROM buyers)
SELECT DISTINCT [BuyId] FROM CTE
  WHERE _count_ > 1 AND NOT EXISTS ( SELECT 1 FROM CTE c1
                     WHERE c1.[BuyId] = CTE.[BuyId] AND c1._bigger_ = 0)

BuyId

1

2

fiddle


text:
Q: Filter text based on two-and-conditions for an if-condition for logstash configuration I have a log file. The log file contains many db-exceptions . I am interested in fetching all exceptions using logstash and index in ElasticSearch
Exception :
05-06-19 05:34:42.794     6a5ba226-da6a-469a-8304-2f79f68fdbcd        http-bio-8080-exec-8     ERROR     c.w.m.n.o.i.o.r.XYZRepo         executeMerge      157     Failed while processing deliveryList:[deliveryTO{deliveryNumber=92183914, itemNumber=565683539, asnNumber='0664420512', channelMethod='SSTKU,CROSSU', baseDivisionName='wm', countryCode='US' itemUomCode='null', poInd='r', obsoleteInd=null, processStatus='null', itemQuantity=null, overageItemQuantity=null, availableQuantity=322, whpkQuantity=null, vnpkQuantity=null, unfulfilledQty=null ,newItemQty=null} ] with exception:{} com.a.b.c.exceptions.MyDBException: ExceptionCode-BE-00028

Logstash filter :
filter {
  grok{
      match => { "message" => "%{TIMESTAMP_ISO8601:Date}%{DATA:corelationid}%{LOGLEVEL:loglevel}%{DATA:javaclass}%{NUMBER:number}%{GREEDYDATA:content}" }
      overwrite => ["message"]
 }

  if  ("ERROR" not in [loglevel] and "ExceptionCode-BE-00028" not in [content])  {
       drop { }
  }
}

Logstash output :
output {
stdout {
    codec => dots
}
elasticsearch {
   index => "db-failure"
  }
}


text:
Q: Detect [[noreturn]] support by C++ compiler via CMake or preprocessor checks? I'm working with some code that is supposed to support both C++11 and C++03. I would like to mark a function [[noreturn]] but since that does not exist in C++03 I'm trying to figure out how best to guard it with preprocessor symbols.
In this email thread, it's suggested to try to check whether an individual feature is supported rather than all of C++11:
https://cmake.org/pipermail/cmake/2013-February/053635.html
Todd Greer writes:

You might consider using code from Boost's config subsystem. There's a list of dozens of macros they define to set what features are available in what compilers here: http://www.boost.org/doc/libs/1_53_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
--
  Todd Greer
  Principal Scientist, Affinegy, Inc.

However, I didn't find anything that seems to do what I want. (In the boost config stuff, or elsewhere.)
Does anyone know a way to do this directly with a C preprocessor trick, or know of an existing CMake module that detects this feature? (If not I guess I will try to kludge one together.)

A: Try something like this:
#ifdef __has_cpp_attribute
#  if __has_cpp_attribute(noreturn)
#    define NO_RETURN [[noreturn]]
#  else
#    define NO_RETURN
#  endif
#else
#  define NO_RETURN
#endif

NO_RETURN void myFunc()
{
    //...
}

A: You can perform the following CMake check:
include(CheckCXXSourceCompiles)

check_cxx_source_compiles("
   [[noreturn]] void testFunc()
   {}

   int main(void)
   {
     return 0;
   }
"  HAS_ATTRIBUTE_NORETURN
)

Then you can pass HAS_ATTRIBUTE_NORETURN to your config.h and use this in your C++ code with an ifdef.
The advantage is, that you don't miss compilers that do not set the right _cpluplus variable or does not support the __has_attribute feature.
Depending on your setting, you might need to add flags to set the C++ mode (like -std=c++11 or c++0x). This can be done with CMakePushCheckState and modifying CMAKE_REQUIRED_FLAGS.


text:
Q: Home server software I have a computer that runs pretty much always. It runs windows 8.1 and due to being a gaming computer, is powerful enough to handle server operations. I would like to run a server software on it to host files of selected directories. It must have a web interface. Preferably must have a mobile website and be able to have multiple user accounts. Any ideas?

A: Take a look at ownCloud. It has a webinterface & mobile apps for android and iOS.


text:
Q: How to switch between folders using keyboard in visual studio code? Just like we switch to different files using ctrl+p command in Visual Studio Code, Is there any shortcut for switching to different folders in Visual Studio Code?

A: No, there is no shortcut key for it. Yes you can use CTRL+Shift+Q to open the location of selected file.

A: "Ctrl + q" just tipping not holding!
Then you can navigate there with the errows over the files and with "shift + Tab" and Tab over the folders and the menu.
Or you can use "Ctrl + p" or "Ctrl+ e" for the searchmod of all, in the IDE, open/bound project files. Then you can scroll down or type the first letters of the file!
And of course "Alt + f" to open a new or old project/directory.


text:
Q: How do I best use common-lisp in elisp (if at all)? Can someone please explain what the specific issues are with using the cl package in elisp?  As a new coder in emacs I feel as though I'm making a mistake whenever I reach for the (require 'cl) option.  I have read and understood the byte-compilation issue with the cl package.  I have looked at the old arguments and have no wish to revive them. I am also not looking for any generalist comment on whether common-lisp is better than x brand lisp.
What I would like to know is practically how to use common-lisp so that any elisp I write will have a good chance of being accepted by the majority of elisp coders.  Specifically, should I avoid using common lisp entirely, or are there some parts of the language that are acceptable to everyone and some parts where a good majority of coders would snigger and scoff at?
Without wishing to limit the breadth of the answer, is this:
(mapcar (lambda(x) (* x x)) '(1 2 3))

much more acceptable than this:
(require 'cl)
(loop for el in '(1 2 3) collect (* el el))

A: While using a lot of third-party libraries and writing some of my own eLisp code, I never encountered the situation when using CL package resulted in a name conflict. So, I'd be tempted to say that the argument against using CL is nothing but puritanism (in the original sense of the word, not meaning the religious side of things).
But, if you are planning on a very long time support and you want to have some sort of a backup, here's what I would do (but I'm not doing that myself, because fixing things once they are broken seems to be a better tactic). For the functions in CL package that you are using, create a special file, where you defalias all of them to have a cl- prefix. So, for example, instead of having a (position ...) you would have (cl-position ...). Theoretically will save you the problem of forward compatibility. However functions don't get removed instantly, you'll get a warning ahead of time of them being deprecated, and will have a lot of time to update. Up to you, really.
Loop macro in Common Lisp is a controversy all by itself, it is not a typical construct for the language and that's why, for example, the iterate library exists. It also requires that you learn "the loop mini-language" to use it well, which is sort of a small domain-specific language, and there's really no requirement that this kind of construct use one. BUT, loop has its strong sides. List processing functions such as mapcar or reduce will serve you well in more trivial cases, like the one you have in your example, but in the less trivial cases loop is going to be a better and also less verbose way of doing the same thing.

A: Have you read the macros section of the manual?  Using macros such as your loop example is perfectly okay.
But you would use eval-when-compile around the require.
In fact (eval-when-compile (require 'cl)) appears 66 times just in the root lisp folder in my Emacs.

A: Unless you plan to integrate your code in Emacs use the CL package, and put this snippet in your .emacs to disable the warnings.
(byte-compile-disable-warning 'cl-functions)

Note: You can find some advices on elisp programming on nicferrier's blog.


text:
Q: How to achieve custom dialog at the bottom of the screen in Android Which component do I choose to achieve custom dialog at the bottom as shown in the below image? Shall I choose alertdialog,popupwindow, or fragmentdialog?

A: Try this
BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this);
dialog.setContentView(YourView);

dialog.show();

A: Edit: I didn't there was a built in component in Android to do so. Good to know! Also, check this out:
https://medium.com/glucosio-project/moving-from-dialogs-to-bottomsheetdialogs-on-android-15fb8d140295#
I would recommend FragmentDialog without a doubt.
It's so much easier to create a customized Dialog regarding location & layout design.

A: Kotlin code for run custom ButtomSheetDialog (run inside Activity)
 var CustomSelectProfilePicBottomSheetDialog  =   BottomSheetDialog(this)
  val   layoutButtomSheetView  = this.layoutInflater.inflate(R.layout.ly_custom_buttom_sheet_frg_dialog, null)
   CustomSelectProfilePicBottomSheetDialog.setContentView(layoutButtomSheetView)
  CustomSelectProfilePicBottomSheetDialog.show()


text:
Q: Combinatorics: endless series I have the following problem:
In an urn, you have 1 blue and 9 white balls. You pull out one ball a time; if it is the blue one, you win. If it it is white, you throw it back in and pull again. Imagine 2 people are playing this game. Who has a better chance to win, the person who goes first or the second?

A: There is a $\frac{1}{10}$ chance that the first player wins on the first pull. There is a $\frac{9}{10}\cdot\frac{1}{10}=\frac{9}{100}$ chance that the second player wins on their first pull. Finally, there is an $\frac{81}{100}$ chance that the game returns to the "start", i.e. it is the first player's turn again. So the probability $P$ that the first player wins satisfies
$$P=\frac{1}{10}+\frac{81}{100}P$$
and therefore
$$\frac{19}{100}P=\frac{1}{10}$$
$$P=\frac{10}{19}$$
Thus the first player has a slight advantage (the probability that the second player wins is only $\frac{9}{19}$).

A: Let $q$ be the probability of the next player winning this turn, and let $P$ be the probability of the next player eventually winning.  The next player eventually wins if he wins on this turn, or if he fails to win on this turn (with probability $1-q$) and then the other player eventually loses (with probability $1-P$).
So $$P=q + (1-q)(1-P)=1-P+qP,$$
or
$$P = \frac{1}{2-q}.$$
Note that for small $q$ (long games), $P$ approaches $1/2$, while for large $q$ (short games), $P$ approaches $1$.  For this particular game, $q=1/10$, so $$P=\frac{1}{2-1/10}=\frac{1}{19/10}=\frac{10}{19}.$$

A: Complete solutions have already been given, but you can see without calculation that in any case the first to draw has a better chance to win. Let $S$ be the chance that the second player eventually wins, and reasoning for the aburd assume that $S\geq\frac12$. For the first player two scenarios are possible: with some (small) positive probability $p$ she wins immediately, and otherwise she finds herself in a position equivalent to the initial positon of the second player. In the first scanrio she has a 100% chance to win, and in the second scenario she has probility $S$ to eventually win. Her actual odds are a weighted average of these two probabilities $1$ and $S\geq\frac12$ (the weights depend on $p$, but both are positive) with definitely lies in the interval $(\frac12,1)$. So adding $S$ to it gives more than $1$, contradicting the fact that both players cannot win at the same time (in principle one could imagine that neither wins and the game goes on for ever; this turns out to have probability $0$, but the reasoning does not depend on this).


text:
Q: Open a custom Finder Window on plugging in USB I would like to open a custom finder window on plugging in a USB drive without activating any applescript on the Mac.
I know for sure that it is possible because, I have a USB from VMWare (VMware fusion app) that does the same. As soon as I plug in the Fusion app USB, it opens up a custom finder window.
Could someone help me out with this please?

A: Have you taken a look at this?
http://jordan.broughs.net/archives/2008/03/creating-cross-platform-windows-and-mac-installer-cds
It rounds down to creating a custom .dmg and then burning it to the usb key with the following command sudo dd if=~/path/to/image.dmg of=/dev/rdisk{N} bs=1m
where {N} should be replaced with the correct disk number that you can lookup at: diskutil list
That's all there is to it.


text:
Q: Flyway-sbt not Found According to the Flywaydb documentation provided, I added Flyway to my plugins.sbt:
addSbtPlugin("org.flywaydb" % "flyway-sbt" % "4.0.3")

and to my resolvers in my main build.sbt:
resolvers += "Flyway" at "https://flywaydb.org/repo"

But upon build I'm getting the following:
[info] Resolving org.flywaydb#flyway-sbt;4.0.3 ...
[warn]  module not found: org.flywaydb#flyway-sbt;4.0.3
...
sbt.ResolveException: unresolved dependency: org.flywaydb#flyway-sbt;4.0.3: not found

I'm not sure why this is not resolving? According to this question it's an https issue, but I've made sure to indicate that here. Am I doing something wrong? If not, is there a way I can determine if that repository location is up, and if so if it has the requested module (flyway-sbt version 4.0.3)? I was unable to find documentation on this on Flyway's site.
The flyway-core for the same version can be found here, but no sbt plugin.

A: The resolvers must be updated inside the plugins.sbt file, not in the main build.sbt file. Doing this allows the dependency to be found and downloaded.


text:
Q: Solve for $x$ : $\sqrt{3x^{-2}-2}=2x-1$ Solve for $x$:
$$\sqrt{3x^{-2}-2}=2x-1$$
I got $x=(1, -1,\frac{1}{2})$ but $-1$ or $\frac{1}{2}$ does not solve the equation
Please help me solve it...

A: This is how I would do it. It might not be a rigorous answer but WolframAlpha agrees with my conclusion
\begin{align}\sqrt{3x^{-2}-2}&=2x-1\\
3x^{-2}-2&=(2x-1)^2\tag{square both sides}\\
3x^{-2}-2&=4x^2-4x+1\tag{expand bracket}\\
\frac{3}{x^2}-2&=4x^2-4x+1\tag{meaning of $x^{-2}$}\\
\frac{3}{x^2}&=4x^2-4x+3\\
3&=4x^4-4x^3+3x^2\tag{multiply by $x^2$}\\
4x^4-4x^3+3x^2-3&=0\tag{set equal to $0$}\\
(x-1)(4x^3+3x+3)&=0\tag{trial and error to find factor}\\
\implies x&=1
\end{align}


text:
Q: No versions of org.tensorflow:tensorflow-android are available I am creating an Android Studio Project that uses tensorflow for image recognition, but suddenly the gradle console prompt an error in the following line:

compile 'org.tensorflow:tensorflow-android:+'

The error is this one:

Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
   > Could not find any matches for org.tensorflow:tensorflow-android:+ as no versions of org.tensorflow:tensorflow-android are available.

Is this a problem from the Tensorflow servers? or how can I fix it?

A: (Duplicate of Tensorflow: not resolving in gradle)
Please also see https://github.com/tensorflow/tensorflow/issues/13653#issuecomment-336145329


text:
Q: Fade and change background image if checkbox is checked I am still trying to add a fading animation between background images of a div after checking a checkbox.
I have a live example here
My jQuery:
$(function(){
$('#check').on('change', function(){
if ($(this).is(':checked'))
{
   $(".icons")
   .css({
       'background-image': 'url(/files/images/iconsfilled.svg)' });
    }
    else $(".icons").css({'background':''});
   });
});

and my CSS:
.icons {
background: url('/files/images/icons.svg') no-repeat;
margin-left: 32px;
margin-right: 32px;
margin-top: 32px;
margin-bottom: 32px;
}
.basketball {
background-position: -52px 0;
width: 50px;
height: 50px;
}
.mail {
background-position: 0 0;
width: 50px;
height: 54px;
 }

and my HTML:

A: Option 1: Using CSS 3
Try setting a transition property in the .icons css rule.
Like:
.icons {
background: red;
margin-left: 32px;
margin-right: 32px;
margin-top: 32px;
margin-bottom: 32px;
transition: 0.5s;
}

Quick example in jsFiddle
Option 2: Using jQuery
$(function(){
    $('#check').on('change', function(){
    if ($(this).is(':checked'))
    {
        $('.icons').fadeTo('slow', 0.3, function(){
        $(this).css({'background': 'blue' });
        }).fadeTo('slow', 1);
    }
        else $(".icons").css({'background':''});
    });

});

SAMPLE USING JQUERY


text:
Q: Special Character (~) automatically Converted into (-) when fetch (PHP, PDO, MYSQL) I am using PDO with mysql. In my Table(table1) I have the following values.
+-------+-------------------+-----------------+
|   ID  |        TYPE       |      VALUE      |
+-------+-------------------+-----------------+
|   1   |   NORMAL          |   1~2           |
|   2   |   NORMAL1         |   4~5           |
|   3   |   NORMAL2         |   5~6           |
+-------+-------------------+-----------------+

The following code is used to fetch the value -
$this->dbh = new \PDO("mysql:dbname=". $this->config['db']['name'] .";host=". $this->config['db']['host'] .";port=". $this->config['db']['port']. ";charset=utf8",

 $sql   = $this->dbh->prepare("SELECT VALUE FROM table1 WHERE TYPE = ?");
 $sql->execute(array("NORMAL1"));
 $cols = $sql->fetch(\PDO::FETCH_ASSOC);

 echo $cols['VALUE'];

Value Display Like This: 4-5. i need the exact value like this 4~5. (~) symbol automatically changed into (-). what can i do.


text:
Q: OAuth2RestTemplate with Ribbon + Eureka I am working on microservices with Spring Cloud and Netflix OSS Eureka and Ribbon. I have another service running as oauth-server which provides OAuth2 token. All my microservices are registered with Eureka including oauth-server.
My whole solution works if I use hardcoded url of oauth-server as "clientCredentialsResourceDetails.setAccessTokenUri("http://localhost:9000/oauth/token");"
but when I try to use Eureka Discovered url of oauth-server like "clientCredentialsResourceDetails.setAccessTokenUri("http://oauth-server/oauth/token");" I get error:
java.net.UnknownHostException: oauth-server
MyConfig.java
@Bean(name = "myOauth2RestTemplate")
@LoadBalanced
public OAuth2RestOperations restTemplate(RestTemplateCustomizer customizer,
                                             ClientCredentialsResourceDetails resourceDetails) {
    OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(resourceDetails);
    ClientCredentialsAccessTokenProvider provider = new ClientCredentialsAccessTokenProvider();
    restTemplate.setAccessTokenProvider(provider);
    customizer.customize(restTemplate);
    return restTemplate;
}

@Bean
public ClientCredentialsResourceDetails resourceDetails() {
    ClientCredentialsResourceDetails clientCredentialsResourceDetails = new ClientCredentialsResourceDetails();
    clientCredentialsResourceDetails.setAccessTokenUri("http://oauth-server/oauth/token");
    clientCredentialsResourceDetails.setId("1");
    clientCredentialsResourceDetails.setClientId("candy");
    clientCredentialsResourceDetails.setClientSecret("123");
    clientCredentialsResourceDetails.setScope(Arrays.asList("read", "write"));
    clientCredentialsResourceDetails.setGrantType("client_credentials");
    return clientCredentialsResourceDetails;
}

MyController.java
@Autowired
@Qualifier("myOauth2RestTemplate")
@LoadBalanced
private OAuth2RestTemplate myOauth2RestTemplate;

@GetMapping("/secure/hello")
public String getSecureData() {
    String result = myOauth2RestTemplate.getForObject("http://securems/secure/hello", String.class);
    return result;
}

I have searched through a lot of documentation and online help, but those solutions didn't work.
I thought this should have been an easy configuration issue has now eaten up my two days of effort.

A: I was finally able to make it work with following code:
@Bean
@LoadBalanced
public OAuth2RestTemplate restTemplate(SpringClientFactory clientFactory) {
    OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(resourceDetails());
    RibbonLoadBalancerClient ribbonLoadBalancerClient = new RibbonLoadBalancerClient(clientFactory);
    LoadBalancerInterceptor loadBalancerInterceptor = new LoadBalancerInterceptor(ribbonLoadBalancerClient);
    ClientCredentialsAccessTokenProvider accessTokenProvider = new ClientCredentialsAccessTokenProvider();
    accessTokenProvider.setInterceptors(Arrays.asList(loadBalancerInterceptor));
    restTemplate.setAccessTokenProvider(accessTokenProvider);

    return restTemplate;
}


text:
Q: Various ways of calling C++ object destructor A C++ object can be explicitly destructed using destructor call syntax (for non-class types pseudo-destructed). But it looks like that in addition to universally accepted syntax, almost any modern compiler supports its own ways of calling the destructor:
using T = int;
const int x = 1;
int main() {
    x.~T();             //ok everywhere
    x.~int();           //#1: ok in MSVC only
    x.~auto();          //#2: ok in GCC only
    x.~decltype(x)();   //#3: ok in Clang and MSVC only
}

In addition to x.~T(), which works in all compilers, there are at least 3 other options, demo: https://gcc.godbolt.org/z/895bd9T5c
Are any of the options #1, #2 or #3 legal according to the standard or all of them are just extensions/bugs of the corresponding compilers?

A: The grammar doesn't allow (1) and (2), so those are illegal.
(See [expr.prim.id.dtor] -> id-expression -> unqualified-id -> type-name.)
The grammar does allow (3) though (... -> unqualified-id -> decltype-specifier), and I don't see anything in [expr.prim.id.dtor] that would disallow using decltype in this scenario.
I tried several different things (making T a class type, making x dependent, etc), and in all cases GCC has rejected ~decltype(...). I'm assuming this is a GCC bug.


text:
Q: Pandas DateTime Calculating Daily Averages I have 2 columns of data in a pandas DF that looks like this with the "DateTime" column in format YYYY-MM-DD HH:MM:SS - this is first 24 hrs but the df is for one full year or 8784 x 2.
        BAFFIN BAY      DateTime
8759    8.112838 2016-01-01 00:00:00
8760    7.977169 2016-01-01 01:00:00
8761    8.420204 2016-01-01 02:00:00
8762    9.515370 2016-01-01 03:00:00
8763    9.222840 2016-01-01 04:00:00
8764    8.872423 2016-01-01 05:00:00
8765    8.776145 2016-01-01 06:00:00
8766    9.030668 2016-01-01 07:00:00
8767    8.394983 2016-01-01 08:00:00
8768    8.092915 2016-01-01 09:00:00
8769    8.946967 2016-01-01 10:00:00
8770    9.620883 2016-01-01 11:00:00
8771    9.535951 2016-01-01 12:00:00
8772    8.861761 2016-01-01 13:00:00
8773    9.077692 2016-01-01 14:00:00
8774    9.116074 2016-01-01 15:00:00
8775    8.724343 2016-01-01 16:00:00
8776    8.916940 2016-01-01 17:00:00
8777    8.920438 2016-01-01 18:00:00
8778    8.926278 2016-01-01 19:00:00
8779    8.817666 2016-01-01 20:00:00
8780    8.704014 2016-01-01 21:00:00
8781    8.496358 2016-01-01 22:00:00
8782    8.434297 2016-01-01 23:00:00

I am trying to calculate daily averages of the "BAFFIN BAY" and I've tried these approaches:
davg_df2 = df2.groupby(pd.Grouper(freq='D', key='DateTime')).mean()
davg_df2 = df2.groupby(pd.Grouper(freq='1D', key='DateTime')).mean()
davg_df2 = df2.groupby(by=df2['DateTime'].dt.date).mean()

All of these approaches yields the same answer as shown below :
                BAFFIN BAY
    DateTime
    2016-01-01    6.008044
However, if you do the math, the correct average for 2016-01-01 is 8.813134 Thank you kindly for your help. I'm assuming the grouping is just by day or 24hrs to make consecutive DAILY averages but the 3 approaches above clearly is looking at other data in my 8784 x 2 DF.

A: I just ran your df with this code and i get 8.813134:
df['DateTime'] = pd.to_datetime(df['DateTime'])
df = df.groupby(by=pd.Grouper(freq='D', key='DateTime')).mean()
print(df)

Output:
            BAFFIN BAY
DateTime
2016-01-01    8.813134


text:
Q: How to symbolically represent N-dimensional matrix? Considering the following simple problem:
Given $A$ an n x n matrix, $B$ an n-dimensional column vector, find the gradient:
$$\nabla _B((A B) . (A B))$$
The solution is obviously $2(A + A^T) B$, but Mathematica seems to have a hard time finding the close form solution:
In[17]:= TensorExpand[v, Element[A,Matrices[{d,d},Reals]]&&Element[B,Vectors[{d},Reals]]]
Out[17]= TensorExpand[(A B).(A B),A\[Element]Matrices[{d,d},Reals,{}]&&B\[Element]Vectors[d,Reals]]

In[14]:= Grad[v,A]
Out[14]= \!\(\*
SubscriptBox["\[Del]",
TemplateArgBox["A"]]\*
TemplateArgBox[
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{"A", " ", "B"}], ")"}], ".",
RowBox[{"(",
RowBox[{"A", " ", "B"}], ")"}]}], ")"}]]\)

What function should I use to solve this simple problem? Thanks a lot for any help!
UPDATE Now I know that such facet of symbolic computing is not very aligned with the scope of Mathematica, is there a reason why it is considered too trivial or too hard to be implemented?
Yours Peng


text:
Q: Edit Form in Laravel: Creates New Entry instead of Updating Old Data I tried to create edit method on form data submission, but instead of updating the old entry, it creates a new entry in the database.
My source files are:
web.php
Route::get('/input_gedung_bangunan/{id_bangunan}', 'input_gedung_bangunan@tampiledit');
Route::post('/data_gedung_bangunan/hitung_data', 'input_gedung_bangunan@store');

Controller:
public function store(Request $request){
        //DB::enableQueryLog();
        //$id_bangunan = $id;
        $validation = \App\Tbl_uraian_datas::where('id_bangunan', '=', $request->get('id_bangunan'))->first();
        if(is_null($validation)){
        $tbl_uraian_datas = new \App\Tbl_uraian_datas;
        $tbl_uraian_datas->id_bangunan = $request->get('id_bangunan');
        $tbl_uraian_datas->id_kanwil = Input::get('IDKanwil');
        $tbl_uraian_datas->id_kota_kab = Input::get('IDKotaKab');
        $tbl_uraian_datas->nomor_baris = Input::get('NomorBaris');
        $tbl_uraian_datas->nama_bangunan = Input::get('NamaBangunan');
        $tbl_uraian_datas->alamat_bangunan = Input::get('AlamatBangunan');
        $tbl_uraian_datas->nama_kota_kab = Input::get('Kota/Kabupaten');
        $tbl_uraian_datas->kode_barang = Input::get('KodeBarang');
        $tbl_uraian_datas->nup_barang = Input::get('NUPBarang');
        $tbl_uraian_datas->luas_lantai = Input::get('LuasLantai');
        $tbl_uraian_datas->jumlah_lantai = Input::get('JumlahLantai');
        $tbl_uraian_datas->tahun_penilaian = Input::get('TahunPenilaian');
        $tbl_uraian_datas->tahun_dibangun = Input::get('TahunDibangun');
        $tbl_uraian_datas->tahun_direnovasi = Input::get('TahunDirenovasi');
        $tbl_uraian_datas->id_jenis_bangunan = Input::get('IDJenisBangunan');
        $tbl_uraian_datas->jenis_bangunan = Input::get('JenisBangunan');
        $tbl_uraian_datas->id_kategori = Input::get('IDKategoriBangunan');
        $tbl_uraian_datas->kategori_bangunan = Input::get('KategoriBangunan');
        $tbl_uraian_datas->id_kondisi = Input::get('IDKondisiBangunan');
        $tbl_uraian_datas->kondisi_bangunan = Input::get('KondisiBangunan');
        $tbl_uraian_datas->luas_carport = Input::get('LuasCarport');
        $tbl_uraian_datas->panjang_pagar_material1 = Input::get('PanjangPagar1');
        $tbl_uraian_datas->panjang_pagar_material2 = Input::get('PanjangPagar2');
        $tbl_uraian_datas->panjang_pagar_material3 = Input::get('PanjangPagar3');
        $tbl_uraian_datas->harga_per_m2 = Input::get('Hargaperm2');
        $tbl_uraian_datas->alasan_fisik = Input::get('Alasan1');
        $tbl_uraian_datas->penyusutan = Input::get('Penyusutan');
        $tbl_uraian_datas->alasan_penyusutan = Input::get('Alasan2');
        $tbl_uraian_datas->save();

        }else{
          //Edit Data Gedung/Bangunan
        $tbl_uraian_datas = \App\Tbl_uraian_datas::update(['id_kanwil' =>  Input::get('IDKanwil'), 'id_kota_kab' =>  Input::get('IDKotaKab'), 'nomor_baris' =>  Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);

        //$tbl_hasil_perhitungans = \App\Tbl_hasil_perhitungans::where('id_bangunan', '=',$request->get('id_bangunan'))->update(['umur_efektif_bangunan' =>  Input::get('nUmurEfektifBangunan'), 'pembulatan' =>  Input::get('nPembulatan')]);

        $request->session()->flash('alert-success', 'Data Gedung Bangunan was successfully added!');

        return back();
        }
     }

It looks like the controller keeps making the new id for the editted data and I don't know what I did wrong in my controller.

A: Instead of the following lines in your code:
$validation = \App\Tbl_uraian_datas::where('id_bangunan', '=', $request->get('id_bangunan'))->first();
if(is_null($validation)){

Try this:
$validation = \App\Tbl_uraian_datas::where('id_bangunan', $request->input('id_bangunan'))->first();
if(empty($validation)){

AND
instead of
$tbl_uraian_datas = \App\Tbl_uraian_datas::update(['id_kanwil' =>  Input::get('IDKanwil'), 'id_kota_kab' =>  Input::get('IDKotaKab'), 'nomor_baris' =>  Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);

Try:
$tbl_uraian_datas = \App\Tbl_uraian_datas::where('id_bangunan',$request->input('id_bangunan'))->update(['id_kanwil' =>  Input::get('IDKanwil'), 'id_kota_kab' =>  Input::get('IDKotaKab'), 'nomor_baris' =>  Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);

You need to tell which row to actually update by giving a where clause


text:
Q: Website displays as gibberish when linked from Facebook in IE I recently had a server switch but this happened on occasion prior to my server being switched.  When I link a post on my facebook fan page, occasionally it will just show the link with no description and look odd.  Apparently, the reason is because it's rendering the page like this in IE...

Does anyone have any idea why it's doing that?  It's a wordpress blog and here are my top lines...
<!DOCTYPE html><!-- HTML 5 -->
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

Thanks for any help!
replies:
Tried changing DOCTYPE as requested, no luck.  I also removed the meta tag and same thing. I am using http://web-sniffer.net/ with IE and it seems 50% of the time it loads normal, the rest looks like gibberish.  Will keep updated based on replies
reply 2:
Here is my exact header in php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "w3.org/TR/html4/strict.dtd">
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link href='http://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="/favicon.ico" >
<link rel="icon" type="image/gif" href="animated_favicon1.gif" >
<title><?php bloginfo('name'); if(is_home() || is_front_page()) { echo ' - '; bloginfo('description'); } else { wp_title(); } ?></title>

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
</head>

Added this as my new header:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

Still no luck, it shows as gibberish.

I am beginning to wonder if it's server side because it seems to work fine on my local drive (though to be fair I'm not connected to the live DB), and I changed the theme to the basic wordpress theme and it still had the error

A: I'm pretty sure I know what happened.  It appears to be a compression issue on the server using WP-Super Cache.   I turned it off and it appears to be better


text:
Q: CakePHP "cake schema generate" command is not creating table relationships I just used the "cake schema generate" command to generate a schema.php file in order to migrate the database schema of my cakePHP application.
When I use the command "cake schema create" in the new database, it creates the tables but all the relations between them are not present.
Why is this happening? do I have to use any parameter to include this relations?


text:
Q: Dosbox - How and where to add `mount` commands? Looking at this:
https://www.dosbox.com/wiki/DOSBox_and_Mac_OS_X
I read

Editing DOSBox preferences
After you first run DOSBox, go to the ~/Library/Preferences/ folder and open the newly > created file DOSBox 0.74 Preferences. The exact folder name in the Finder may vary, depending on the language you use for OS X.
By editing this file, you can set the system settings and initialization values that define your emulated environment. You can also add MOUNT commands to the AUTOEXEC section at the bottom of the configuration files, so that you do not have to type them in every time you start DOSBox.

I can run DOSBOX and also an abbandonware. No violacion of copyright.
I cannot find this file

My question is: how to add mount commands ? and where?

I have Monterey 12.4 installed

A: You need to look into the Library/Preferences folder within your home directory, not the global Library as shown in the screenshot.


text:
Q: What is the significance of the Dragon's 3 names? In the Wheel of Time series, we see that Lews Therin Telamon has 3 names, but the majority of the other characters and Forsaken in the book only have 2 names. Is it unique that he has 3? Is it of any significance?

A: It's significant but not unique.
From the companion volume The World of Robert Jordan's Wheel of Time (emphasis mine):

The people of [the Age of Legends] had long outgrown any interest in material wealth as a goal unto itself. Status and honour were all-important, and could only be gained through service to the community. All hoped to be allowed to serve according to their gifts and to be found worthy of that service. Several sources mention the fact that even names reflect a person's status and honor. Everyone was born with two names and could earn the third one only through accomplishment, apparently possible in many fields.

There were several other people in the Age of Legends besides myself who are known to have had a third name, including eight of the thirteen Forsaken:

*

*Barid Bel Medar (Demandred)

*Duram Laddel Cham (Be'lal)

*Elan Morin Tedronai (Ishamael)

*Ilyena Moerelle Dalisar (my wife)

*Ishar Morrad Chuain (Aginor)

*Joar Addam Nessosin (Asmodean)

*Kamarile Maradim Nindar (Graendal)

*Latra Posae Decume

*Nemene Damendar Boann (Semirhage)

*Tel Janin Aellinsar (Sammael)

A: I'm at work, so I can't quote directly from the books until I get home, but the third name was granted to individuals who made great accomplishments. I seem to remember one book saying that one of the Forsaken was jealous that he never got a third name.

A: Is it unique? No. Looking in the WoT wiki shows that several of the forsaken have 3 names.
Forsaken:
Ishamael: Elan Morin Tedronai
Rahvin: Ared Mosinel
Demandred: Barid Bel Medar
Sammael: Tel Janin Aellinsar
Aginor: Ishar Morrad Chuain
Balthamel: Eval Ramman
Asmodean: Joar Addam Nessosin
Be'lal: Duram Laddel Cham
Lanfear: Mierin Eronaile
Semirhage: Nemene Damendar Boann
Mesaana: Saine Tarasind
Graendal: Kamarile Maradim Nindar
Moghedien: Lilen Moiral
Is it significance? No. At least nothing suggests it. We even have at least one character with 4 names in their full name.


text:
Q: Problema con enlaces relativos en Scrapy Quiero levantar las noticias completas de los enlaces que aparecen en la portada de un sitio informativo.  Pero los enlaces son relativos
El sitio es http://www.puntal.com.ar/v2/
Y los enlaces se ven así

            Barros Schelotto: "No somos River y vamos a tratar de pasar a la final"

El enlace sería entonces, "/v2/article.php?id=187222"
Mi código es el siguiente:
# -*- coding: utf-8 -*-

from scrapy.selector import Selector
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.http.request import Request
try:
    from urllib.parse import urljoin # Python3.x
except ImportError:
    from urlparse import urljoin # Python2.7

from puntalcomar.items import PuntalcomarItem

class PuntalComArSpider(CrawlSpider):
    name = 'puntal.com.ar'
    allowed_domains = ['http://www.puntal.com.ar/v2/']
    start_urls = ['http://www.puntal.com.ar/v2/']

    rules = (
            Rule(LinkExtractor(allow=(''),), callback="parse_url", follow=True),
        )

    def parse_url(self, response):
        hxs = Selector(response)
        urls = hxs.xpath('//div[@class="article-title"]/a/@href').extract()
        print 'enlace relativo ', urls
        for url in urls:
           urlfull = urljoin('http://www.puntal.com.ar',url)
           print 'enlace completo ', urlfull
           yield Request(urlfull, callback = self.parse_item)

    def parse_item(self, response):
        hxs = Selector(response)
        dates = hxs.xpath('//span[@class="date"]')
        title = hxs.xpath('//div[@class="title"]')
        subheader = hxs.xpath('//div[@class="subheader"]')
        body = hxs.xpath('//div[@class="body"]/p')
        items = []
        for date in dates:
            item =  PuntalcomarItem()
            item["date"] = date.xpath('text()').extract()
            item["title"] = title.xpath("text()").extract()
            item["subheader"] = subheader.xpath('text()').extract()
            item["body"] = body.xpath("text()").extract()
            items.append(item)
        return items

Pero no funciona.
Utilizo Linux Mint con Python 2.7.6
Salida por consola de scrapy:
$ scrapy crawl puntal.com.ar
2016-07-10 13:39:15 [scrapy] INFO: Scrapy 1.1.0 started (bot: puntalcomar)
2016-07-10 13:39:15 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'puntalcomar.spiders', 'SPIDER_MODULES': ['puntalcomar.spiders'], 'ROBOTSTXT_OBEY': True, 'BOT_NAME': 'puntalcomar'}
2016-07-10 13:39:15 [scrapy] INFO: Enabled extensions:
['scrapy.extensions.logstats.LogStats',
 'scrapy.extensions.corestats.CoreStats']
2016-07-10 13:39:15 [scrapy] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware',
 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
 'scrapy.downloadermiddlewares.retry.RetryMiddleware',
 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
 'scrapy.downloadermiddlewares.chunked.ChunkedTransferMiddleware',
 'scrapy.downloadermiddlewares.stats.DownloaderStats']
2016-07-10 13:39:15 [scrapy] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
 'scrapy.spidermiddlewares.referer.RefererMiddleware',
 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
 'scrapy.spidermiddlewares.depth.DepthMiddleware']
2016-07-10 13:39:15 [scrapy] INFO: Enabled item pipelines:
['puntalcomar.pipelines.XmlExportPipeline']
2016-07-10 13:39:15 [scrapy] INFO: Spider opened
2016-07-10 13:39:15 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2016-07-10 13:39:15 [scrapy] DEBUG: Crawled (404) <GET http://www.puntal.com.ar/robots.txt> (referer: None)
2016-07-10 13:39:15 [scrapy] DEBUG: Redirecting (301) to <GET http://www.puntal.com.ar/v2/> from <GET http://www.puntal.com.ar/v2>
2016-07-10 13:39:15 [scrapy] DEBUG: Crawled (200) <GET http://www.puntal.com.ar/v2/> (referer: None)
enlace relativo  [u'/v2/article.php?id=187334', u'/v2/article.php?id=187324', u'/v2/article.php?id=187321', u'/v2/article.php?id=187316', u'/v2/article.php?id=187335', u'/v2/article.php?id=187308', u'/v2/article.php?id=187314', u'/v2/article.php?id=187315', u'/v2/article.php?id=187317', u'/v2/article.php?id=187319', u'/v2/article.php?id=187310', u'/v2/article.php?id=187298', u'/v2/article.php?id=187300', u'/v2/article.php?id=187299', u'/v2/article.php?id=187306', u'/v2/article.php?id=187305']
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187334
2016-07-10 13:39:15 [scrapy] DEBUG: Filtered offsite request to 'www.puntal.com.ar': <GET http://www.puntal.com.ar/v2/article.php?id=187334>
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187324
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187321
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187316
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187335
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187308
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187314
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187315
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187317
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187319
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187310
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187298
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187300
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187299
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187306
enlace completo  http://www.puntal.com.ar/v2/article.php?id=187305
2016-07-10 13:39:15 [scrapy] INFO: Closing spider (finished)
2016-07-10 13:39:15 [scrapy] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 660,
 'downloader/request_count': 3,
 'downloader/request_method_count/GET': 3,
 'downloader/response_bytes': 50497,
 'downloader/response_count': 3,
 'downloader/response_status_count/200': 1,
 'downloader/response_status_count/301': 1,
 'downloader/response_status_count/404': 1,
 'finish_reason': 'finished',
 'finish_time': datetime.datetime(2016, 7, 10, 16, 39, 15, 726952),
 'log_count/DEBUG': 4,
 'log_count/INFO': 7,
 'offsite/domains': 1,
 'offsite/filtered': 16,
 'request_depth_max': 1,
 'response_received_count': 2,
 'scheduler/dequeued': 2,
 'scheduler/dequeued/memory': 2,
 'scheduler/enqueued': 2,
 'scheduler/enqueued/memory': 2,
 'start_time': datetime.datetime(2016, 7, 10, 16, 39, 15, 121104)}
2016-07-10 13:39:15 [scrapy] INFO: Spider closed (finished)

Solución:
Faltaba descomentar la configuración para solicitudes simultaneas en settings.py
# Configure maximum concurrent requests performed by Scrapy (default: 16)
CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
CONCURRENT_REQUESTS_PER_DOMAIN = 16
CONCURRENT_REQUESTS_PER_IP = 16

Moraleja:  'No des nada por sentado'

A: Con lo que expones no está claro donde está el error ni muestras el error completo. Entiendo que el error debe estar en el método parse_url. A ver si lo siguiente te funciona:
try:
    from urllib.parse import urljoin # Python3.x
except ImportError:
    from urlparse import urljoin # Python2.7

# ...

class PuntalComArSpider(CrawlSpider):
    # ...

    def parse_url(self, response):
        hxs = Selector(response)
        urls = hxs.xpath('//div[@class="article-title"]/a/@href').extract()
        for url in urls:
           #################################################
           # La siguiente línea está adaptada
           urlfull = urljoin('http://www.puntal.com.ar',url)
           #################################################
           yield Request(urlfull, callback = self.parse_item)

Si no te funciona, por favor, corrige tu pregunta para intar ser más claro sobre donde te está dando el error.


text:
Q: How to add a webpart using Sharepoint Designer 2010 Is it possible to add a webpart to a page using Sharepoint Designer 2010. I'm trying to modify the newform.aspx page of a list to add a Content Editor Webpart into it. I can't find any way to do that in Sharepoint designer.

A: You can actually do it through the UI, which avoids "customizing" the page. I have an old blog post for 2007, but the process is the same in 2010.
Go to your newform.aspx (ie: http://sharepoint.corp.local/lists/mylist/newform.aspx), and append "?ToolPaneView=2" to the end of the URL (ie: http://sharepoint.corp.local/lists/mylist/newform.aspx?toolpaneview=2). The form will open with the ability to add web parts. In my experience, this never seems to work correctly unless you do it using Internet Explorer, but it does work in IE, and saves you from customizing the page in SPD.
This is my preferred approach if I need to add CEWP's or other web parts to a form as it's far less likely to have issues with future upgrades than customizing the page.
Obviously, once you have your CEWP, just point it to your script file and you're good to go. I use this approach all the time for adding jQuery enhancements to forms.


text:
Q: Issue with number tags via XSLT Output date:
<products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1">
<product>
<sku>SKU 11077</sku>
<imgs>
<image>https://testtest.com/_data/products/sku-11077sku-11077.jpg</image>
<image>https://testtest.com/_data/products/sku-11077sku-11077,1.jpg</image>
<image>https://testtest.com/_data/products/sku-11077sku-11077,2.jpg</image>
<image>https://testtest.com/_data/products/sku-11077sku-11077,3.jpg</image>
<image>https://testtest.com/_data/products/sku-11077sku-11077,4.jpg</image>
</imgs>
</product>
</products>

I try convert using XSLT 1.0 to get result number tags <image1>:
<products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1">
<product>
<sku>SKU 11077</sku>
<image1>https://testtest.com/_data/products/sku-11077sku-11077.jpg</image1>
<image2>https://testtest.com/_data/products/sku-11077sku-11077,1.jpg</image2>
<image3>https://testtest.com/_data/products/sku-11077sku-11077,2.jpg</image3>
<image4>https://testtest.com/_data/products/sku-11077sku-11077,3.jpg</image4>
<image5>https://testtest.com/_data/products/sku-11077sku-11077,4.jpg</image5>
</product>
</products>

I try to do via code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://base.google.com/ns/1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="products">
<xsl:element name="products">
  <xsl:for-each select="product">
    <xsl:element name="product">
         <xsl:element name="sku">
             <xsl:value-of select="sku"/>
         </xsl:element>
     <xsl:template match="imgs">
    <xsl:copy>
      <xsl:for-each select="image">
        <xsl:element name="image{position()}">
          <xsl:value-of select="."/>
        </xsl:element>
      </xsl:for-each>
    </xsl:copy>
  </xsl:template>

    </xsl:element>
  </xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

I get issue:
But after paste your code we get: Warning: XSLTProcessor::importStylesheet(): compilation error: file /home/fs/domains/public_html/pub/ line 18 element template in /home/fs/domains/public_html/vendor/firebear/importexport/Model/Output/Xslt.php on line 107
Can someone help me format this?

A: EDIT (imgs-element not needed)
Wel just use xsl:apply-templates with a select="imgs" so a next template match will catch your imgs:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://base.google.com/ns/1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="products">
    <xsl:element name="products">
      <xsl:for-each select="product">
        <xsl:element name="product">
          <xsl:element name="sku">
            <xsl:value-of select="sku"/>
          </xsl:element>
          <xsl:apply-templates select="imgs"/>
        </xsl:element>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>

  <xsl:template match="imgs">
    <xsl:for-each select="image">
      <xsl:element name="image{position()}">
        <xsl:value-of select="."/>
      </xsl:element>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

But while you are only changing those image-elements you could make it simpeler using a generic copy-template like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

  <!-- Identity template : copy all nodes and attributes -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="imgs">
    <xsl:for-each select="image">
      <xsl:element name="image{position()}">
        <xsl:value-of select="."/>
      </xsl:element>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

A: Templates cannot be nested.
--- edited in response to your changing the expected result ---
AFAICT, the result you want can be produced quite simply by:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/products">
    <xsl:copy>
        <xsl:copy-of select="@version"/>
        <xsl:for-each select="product">
            <xsl:copy>
                <xsl:copy-of select="sku"/>
                <xsl:for-each select="imgs/image">
                    <xsl:element name="image{position()}">
                        <xsl:value-of select="."/>
                    </xsl:element>
                </xsl:for-each>
            </xsl:copy>
        </xsl:for-each>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Or, if you prefer:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="imgs">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="image">
    <xsl:element name="image{position()}">
        <xsl:value-of select="."/>
    </xsl:element>
</xsl:template>

</xsl:stylesheet>

P.S. Do not use xsl:element where a literal result element will suffice.


text:
Q: Best practices for creating and parsing XML documents I'm in doubt if I should use TXMLTransformProvider or TXMLDocument.
TXMLTransformProvider looks more maintainable, and it seems to me that using it will require less coding than TXMLDocument.
In the other hand TXMLDocument looks more flexible.
What I need is to generate and parse a XML document with nested attributes, map it to master-detail clientDataSets and write back one XML document.
Do you have tips on this?
Thanks.

A: If the data files are from an outside source, my first thought would be the XML Binding Wizard.  Here's a short video tutorial, too.
If you are generating the XML from your own data source, you could link it to a TClientDataSet and save it as XML.  This is convenient because you can re-load the XML and just treat it like any other dataset.
If the data is extremely large, it will take a long time to read in to a DOM in memory.  I would look at a SAX processor.  This is a different process, and doesn't let you navigate a tree in memory the same way, but it's much faster.
If you're OK to manipulate the XML yourself and you aren't dealing with very large XML files, I like Peter's idea of importing the MSXML library and using it directly.  This performs better than using TXMLDocument.

A: This is just anecdotal, I have no idea what a best practice would be:
I was using that TXMLDocument for a little while, but it's pretty cumbersome and at least the Delphi 7 version didn't let me do XPath, which is pretty much why I'd want to use XML in the first place.
I imported the type library for IXMLDomDocument2 and I've been using that ever since.  I really don't understand how it all works, but it's pretty awesome, and all the help is in the MSDN.

A: Solutions from Bruce and Peter are ok, but they require, that the client machine has MSXML installed.
I would recommend  DIXML, especially if you will need validation and/or transformation of these XML files.


text:
Q: How to get second-level output from sar when used with -f option? sar man page says that one can specify the resolution in seconds for its output.
However, I am not able to get a second level resolution by the following command.
sar -i 1 -f /var/log/sa/sa18

11:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:10:01 AM     all      0.04      0.00      0.04      0.00      0.01     99.91
11:20:01 AM     all      0.04      0.00      0.04      0.00      0.00     99.92
11:30:01 AM     all      0.04      0.00      0.04      0.00      0.00     99.92

Following command too does not give second level resolution:
sar  -f /var/log/sa/sa18 1

I am able to get second-level result only if I do not specify the -f option:
sar 1 10
08:34:31 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:34:32 PM     all      0.12      0.00      0.00      0.00      0.00     99.88
08:34:33 PM     all      0.00      0.00      0.12      0.00      0.00     99.88
08:34:34 PM     all      0.00      0.00      0.12      0.00      0.00     99.88

But I want to see system performance varying by second for some past day.
How do I get sar to print second-level output with the -f option?
Linux version: Linux 2.6.32-642.el6.x86_64
sar version  : sysstat version 9.0.4

A: I think the exist sar report file 'sa18' collected with an interval 10 mins. So we don't get the output in seconds.
Please check the /etc/cron.d/sysstat file.
[root@testserver ~]# cat /etc/cron.d/sysstat
 #run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
 #generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

If you want to reduce the sar interval interval you can modify the sysstat file.

A: The /var/log/sa directory has all of the information already.
The sar command serves here as a parser, and reads all data in the sa file.
So you can use sar -f /var/log/sa/<sa file> to see first-level results, and use other flags, like '-r', for other results.
# sar -f /var/log/sa/sa02

12:00:01    CPU %user   %nice   %system %iowait %steal  %idle
12:10:01    all 14.70   0.00    5.57    0.69    0.01    79.03
12:20:01    all 23.53   0.00    6.08    0.55    0.01    69.83

# sar -r -f /var/log/sa/sa02

12:00:01  kbmemfree   kbavail kbmemused  kbactive   kbinact   kbdirty
12:10:01    2109732   5113616  30142444  25408240     2600
12:20:01    1950480   5008332  30301696  25580696     2260
12:30:01    2278632   5324260  29973544  25214788     4112


text:
Q: Trying to transfer the ear files from jenkins server to tomcat server Trying to transfer the ear files from jenkins server to other server.Configured the global credential username and password and trying access the same from pipeline script stage by using with credentials
withCredentials([usernamePassword((credentialsID:'JBW12801',usernameVariable: 'USERNAME',passwordVariable: 'PASSWORD')])
sh 'echo $PASSWORD'
echo USERNAME
echo "username is $USERNAME"
ERROR
java.lang.IllegalStateException: withCredentials step must be called with a body


text:
Q: TikZ Curved Path Construction, Controls is not mathematically unique In the TikZ & PGF Manual for Version 3.1.5b, page 33/1318, section 2.4, we get Curved Path Construction. The general syntax for extending a path in a "curved" way is
.. controls  and  .. .
This curve mathematically is not unique. I like to read the source code for this to understand how exactly they define this controls curve. There are many curves that can be a solution. Do you know where I can get the source code?


text:
Q: Tensorflow variables are not instantiated beforehand when the empty layer is created I am trying to create a new custom keras model for Keras. For calculating the loss, I am using Gradient Tape as suggested at https://towardsdatascience.com/custom-loss-function-in-tensorflow-2-0-d8fa35405e4e.
 However, I found that the variables are not initialized before the call operation. To give you a simple example.
l = tf.keras.layers.Dense(activation=None,
                      units = 1,
                      input_shape = (10, ))
l.variables

There the variables are empty. But on calling
l = tf.keras.layers.Dense(activation=None,
                      units = 1,
                      input_shape = (10, ))
l(np.ones((10, 10)))
l.variables

The above code provides the list of variables.
I was just trying to understand if this is expected behavior. In such cases, I should calculate loss before adding the variables to watch list.

A: In tensorflow/keras, layer weights do not get initialized when creating them (calling __init__), but when calling their build() method, or invoking the __call__ method for the first time like you did with a zero tensor. You can read about it briefly here in the Custom layers documentation, or in the official source code.


text:
Q: Storing special characters (German, French, Spanish) in SQL Server result in weird strings I'm trying to store the German ß in SQL Server, but it results in ß.
For example "Gleimstraße" is stored as "Gleimstraße"
But this also happens for other characters:

*

*"König-Karl-Straße" stored as "König-Karl-Straße"

*"Quai André-Citroën" stored as "Quai André Citroën"

*"Carrer dels Adreçadors stored as "Carrer dels Adreçadors"

I looked at the database collation and it shows SQL_Latin1_General_CP1_CI_AS. I then Googled and found this.
But I have no idea if my existing collation is causing the issue, or what I need to do to be able to store the special characters like ö, ß, é, ë, ç, ñ, í.
UPDATE 1
Indeed, I'm storing the strings in an nvarchar column. I send the data to the database via my .NET application. This is what I have in my web.config as the connection string:
<add name="conn" connectionString="data source=(local)\sql;Initial Catalog=mydb;User Id=myuser;Password=mypassword;" providerName="System.Data.SqlClient"/>
UPDATE 2
I read values from a JSON file which I've passed into a Newtonsoft.Json.Linq.JArray and then pass it to a function, like below:
    InsertStreetId(item.SelectToken("location.street").Value(Of String))

  Public Shared Function InsertStreetId(ByVal street As String) As Integer
        Dim streetId As Integer

        Dim myConnection As SqlConnection = GetConnection()
        Dim cmd As New SqlCommand("INSERT INTO geo_streets(streetname) VALUES (@streetname)" +
                             ";SELECT CAST(scope_identity() as int);", myConnection)
        cmd.Parameters.Add(New SqlParameter("@streetname", street))

        Try
            myConnection.Open()
            streetId = CInt(cmd.ExecuteScalar)
        Catch ex As Exception
        Finally
            myConnection.Close()
        End Try
        Return streetId
    End Function

UPDATE 3
Ok, so here's what I did:
Dim myConnection As SqlClient.SqlConnection = GetConnection()

Dim cmd As New SqlClient.SqlCommand("UPDATE cities SET name=@name,updatedate=getdate() WHERE geonameid=@geonameid", myConnection)
cmd.Parameters.Add(New SqlClient.SqlParameter("@name", "Kąty Wrocławskie"))
cmd.Parameters.Add(New SqlClient.SqlParameter("@geonameid", 6474))

myConnection.Open()
cmd.ExecuteNonQuery
myConnection.Close()

This correctly inserts the string "Kąty Wrocławskie" into my database. So I guess the database collation is working properly to support special characters?
If so, I now may have another issue, but please let me know if it's best to create a new issue on that:
As stated, newly inserted records work fine. However, in my database I still have values like: "SÄpĂłlno KrajeĹskie" (it should be "Sępólno Krajeńskie").
Should I now do a find/replace on all columns? And if so, where can I find a mapping table to know what to look for and what te replace with, because I have no idea where to start.

A: Somehow the data is being sent over as UTF-8 bytes. Because your database collation is SQL_Latin1_General_CP1_CI_AS, that uses code page 1252 (Latin1) for VARCHAR data. The ß character is encoded as bytes C3 9F. In code page 1252, those two bytes equate to the following characters: Ã and Ÿ.
You can see this for yourself by executing the following in SSMS or Visual Studio Code, etc:
SELECT CHAR(0xC3) + CHAR(0x9F);

One option to solve this would be to use a UTF-8 collation (i.e. one ending in _UTF8) as the database default collation, which you can do since you are using SQL Server 2019.
If you can't, or simply do not want to, change the database default collation to a _UTF8 collation, then you will need to find a way to change the encoding / culture / locale / collation of the connection to match your database code page (i.e. Windows 1252). Fortunately code page 1252 does store those characters (i.e. ö, ß, é, ë, ç, ñ, í ), but if you need to store a greater range of characters, you might need to either switch to a UTF-8 collation (if sticking with VARCHAR data), OR switch to using NVARCHAR columns / data (in which case you need to prefix your string literals, in the app, with an upper-case N, and/or specify the NVARCHAR instead of VARCHAR datatype for parameters, depending on how the data is being sent). Both of those options are Unicode, which can handle all characters. If switching to NVARCHAR data and columns (which could be a much larger change), the database connectivity software should assume the encoding to be UTF-16 Little Endian without you needing to specify that.

Update 2 of the Question indicates two possible suspects:

*

*

I read values from a JSON file which I've passed into a Newtonsoft.Json.Linq.JArray

and:

*

then pass it to a function:
cmd.Parameters.Add(New SqlParameter("@streetname", street))

Let's start with the second item since it's an issue even if it's not the source of this particular problem.
You are using the following constructor for SqlParameter: SqlParameter(String, Object) (which I'm guessing is the same as the infamous SqlParameterCollection.AddWithValue(String, Object) method). The problem here is that the datatype is inferred from the value, and sometimes mistakes can be made when trying to guess the datatype. It is always better to specify the datatype explicitly. And you know the datatype. So, use the following instead (be sure to adjust the size of the parameter to match the actual column if not 500):
Dim param as New SqlParameter("@streetname", SqlDbType.NVarChar, 500)
param.Value = street
cmd.Parameters.Add(param)

You should make that change first to see if it fixes the problem (and then fix all code that creates parameters without explicitly setting the datatype). While it will be an improvement in either case, I suspect that it won't actually solve the problem. I think that it would have to infer the type being XML in order to convert to UTF-8 encoding, and I don't believe that would happen with just a name and no actual XML in the value.
The other item of interest is reading the data from a file via Json.NET. I wouldn't be surprised if you need to explicitly set the output encoding else it defaults to UTF-8. It appears that the file is being read correctly since ß does indeed encode into UTF-8 as the bytes C3 9F.
So, if fixing how the SqlParameter is created doesn't fix the issue, then you need to look into setting the encoding of the JSON.

I highly recommend that you save the bytes of the value coming into your InsertStreetId method to a file for debugging, using something like:
BitConverter.ToString( BitConverter.GetBytes( street ) )

I suspect you will see a value such as:
4700 6C00 6500 6900 6D00 7300 7400 7200 6100 C300 7801 6500
which is the UTF-16 LE representation of N'Gleimstraße'. If this is the case, then the issue is happening prior to the InsertStreetId method being called, which means this has nothing to do with SQL Server.


text:
Q: How do you properly import the kikoso swipeable cards from github to Android studio? https://github.com/kikoso/Swipeable-Cards
I haven't imported libraries before and I'm struggling to actually get it all working. Can somebody give me step by step instructions to properly import this library and get it working on Android studio, that would be great (starting from downloading the zip file).
Thanks!!

A: You can fix this by adding
xmlns:tools="http://schemas.android.com/tools"
to manifest tag and adding this
tools:replace="android:icon"to your application tag

A: I don't know if you still need the "how-to" guide but here it is:
Import using gradle
Go to your build.gradle (module app) file, there you will find the dependencies section.
There you will paste the compile command.
compile 'com.github.kikoso:SwipeableCards:1.1-RELEASE@aar'

Android Studio then will tell you that the gradle files have changed since last sync and will give you in the upper corner a Sync now text. You just click it and everything will synchronize.


text:
Q: Método update Lavarel Tengo una vista donde me traigo los datos para editar de cada usuario, mediante un foreach.
Me trae los datos dependiente del usuario que yo quiera...
Mi vista:

                ID
                Nombre
                Apellido
                ID
                Primera calificación
                Segunda calificación
                Promedio
                Tercera calificación
                Promedio Final
                Fecha del curso
                Tipo de aprobación
                Acciones
                idk alumno
                idc materia

    @foreach($alumnosxmat as $alumnosxm)
            @foreach($idkalificacionn as $idkalificacion)
                                    @if ($alumnosxm->idk_alumno === $alumno)

                    {{$alumnosxm->idk_alumno}}
                    {{$alumnosxm->a_nombre}}
                    {{$alumnosxm->a_apaterno}}

has('id') ? ' has-error' : '' }}">

                                <input id="id" type="input" class="form-control" name="id"
                                value="{{$idkalificacion->id}}">
                                @if ($errors->has('id'))

                                        {{ $errors->first('id') }}

                                @endif

has('primera_cal') ? ' has-error' : '' }}">

                                <input id="primera_cal" type="input" class="form-control" name="primera_cal" value="{{$idkalificacion->primera_cal}}">

                                @if ($errors->has('primera_cal'))

                                        {{ $errors->first('primera_cal') }}

                                @endif

has('segunda_cal') ? ' has-error' : '' }}">

                                <input id="segunda_cal" type="input" class="form-control" name="segunda_cal" value="{{$idkalificacion->segunda_cal or old('segunda_cal') }}">

                                @if ($errors->has('segunda_cal'))

                                        {{ $errors->first('segunda_cal') }}

                                @endif

has('ps_cal') ? ' has-error' : '' }}">

                                <input id="ps_cal" type="input" class="form-control" name="ps_cal" value="{{$idkalificacion->ps_cal or old('ps_cal') }}">

                                @if ($errors->has('ps_cal'))

                                        {{ $errors->first('ps_cal') }}

                                @endif

has('tercera_cal') ? ' has-error' : '' }}">

                                <input id="tercera_cal" type="input" class="form-control" name="tercera_cal" value="{{$idkalificacion->tercera_cal or old('tercera_cal') }}">

                                @if ($errors->has('tercera_cal'))

                                        {{ $errors->first('tercera_cal') }}

                                @endif

has('prom_cal') ? ' has-error' : '' }}">

                                <input id="prom_cal" type="input" class="form-control" name="prom_cal" value="{{$idkalificacion->prom_cal or old('prom_cal') }}">

                                @if ($errors->has('prom_cal'))

                                        {{ $errors->first('prom_cal') }}

                                @endif

has('fecha_curso') ? ' has-error' : '' }}">

                                <input id="fecha_curso" type="date" class="form-control" name="fecha_curso" value="{{$idkalificacion->fecha_curso or old('fecha_curso') }}">

                                @if ($errors->has('fecha_curso'))

                                        {{ $errors->first('fecha_curso') }}

                                @endif

has('tipo_de_aprob') ? ' has-error' : '' }}">

                            <select id="tipo_de_aprob" type="input" class="form-control" name="tipo_de_aprob">
                                <option value="Ordinario">Ordinario</option>
                                <option value="Extraordinario">Extraordinario</option>
                            </select>

                            @if ($errors->has('tipo_de_aprob'))

                                    {{ $errors->first('tipo_de_aprob') }}

                            @endif

                                id)}}" class="btn btn-warning">Actualizar calificación

has('idk_alumno') ? ' has-error' : '' }}">

                                    <select  id="idk_alumno" class="form-control" name="idk_alumno">
                                        <option value="{{$alumnosxm->idk_alumno}}">{{$alumnosxm->idk_alumno}}</option>
                                    </select>
                            @if ($errors->has('idk_alumno'))

                                    {{ $errors->first('idk_alumno') }}

                            @endif

has('idc_materia') ? ' has-error' : '' }}">

                                    <select  id="idc_materia" class="form-control" name="idc_materia">
                                        <option value="{{$id}}">{{$id}}</option>
                                    </select>
                            @if ($errors->has('idc_materia'))

                                    {{ $errors->first('idc_materia') }}

                            @endif

                    @endif
                @endforeach
                      @endforeach

Entonces para traerme los datos de un campo, lo hago así:
    value="{{$idkalificacion->prom_cal or old('prom_cal') }}"
Para llevarmelo a actualizar...
lo hago con esta linea de código:
 id)}}" class="btn btn-warning">Actualizar calificación

pero mi problema es que en el método actualizar, si me buscar el registro pero cuando le doy actualizar me lo deja todo en blanco.
 public function update(Request $request, $id)
 {

$idkalificacionn=K_calificacion::find($id);
//$request->all();
$idkalificacionn->primera_cal = $request->primera_cal;
$idkalificacionn->segunda_cal= $request->segunda_cal;
$idkalificacionn->ps_cal=$request->ps_cal;
$idkalificacionn->tercera_cal=$request->tercera_cal;
$idkalificacionn->prom_cal=$request->prom_cal;
$idkalificacionn->fecha_curso=$request->fecha_curso;
$idkalificacionn->tipo_de_aprob=$request->tipo_de_aprob;
$idkalificacionn->idk_alumno=$request->idk_alumno;
$idkalificacionn->idc_materia=$request->idc_materia;
$idkalificacionn->save();   }

En realidad no se como hacer el request, porque en mi vista no es solo.
   $primera_cal

si no:
    $idkalificacion->primera_cal

A: A que te refieres que te envia a una página en blanco? Te envia a una pagina en blanco por que en el controlador actualizas y no haces nada más, puedes agregar al final return back(); para que te regrese a la página anterior.
Con lo de los request te enviará el valor dependiendo del name en el input, por ejemplo:
<input type="text" name="nombre" />
esto por el request lo podrías recibir $request->nombre.
Te recomiendo que veas los metodos de laravel para que no tengas que asignar variables uno por uno, en vez de eso que haces podrías simplemente hacer $k_calificacion::update($request->all());
En general el codigo correcto sería hacer esto:
public function update(Request $request, K_calificacion $calificacion)
 {
         $calificacion->update($request->all);
         return back();
 }

y agregar en el modelo las variables fillable con los campos.
Saludos

A: En la vista usa array de valores
name="idkalificacion[{{$id}}}][primera_cal]"

y luego en el controlador puedes recogerlo así:
foreach ($request->idkalificacion as $calificacion) {
      dd(calificacion['primera_cal'])
}


text:
Q: Receiving req.body empty with post form with Express node.js I've got a simply form, that sends POST data to my Node.JS server, with Express. This is the form:
<form method="post" action="/sendmessage">
  <div class="ui-widget">
      <input type="text" id="search" data-provide="typeahead" placeholder="Search..." />
  </div>
  <textarea id="message"></textarea>
</form>

The ui-widget and the input is releated with typehead, an autocomplete library from Twitter.
And this is how I handle the POST request in the server:
app.post('/sendmessage', function (req, res){

  console.log(req.body);

  usermodel.findOne({ user: req.session.user }, function (err, auser){

        if (err) throw err;

        usermodel.findOne({ user: req.body.search }, function (err, user){

            if (err) throw err;

             var message = new messagemodel({

                  fromuser: auser._id,
                  touser: user._id,
                  message: req.body.message,
                  status: false

             });

             message.save(function (err){

                  if (err) throw err;

                  res.redirect('/messages')

             })

        });

   });

});

The console shows me '{}', and then an error with req.body.search, because search is not defined. I don't know what is happening here, and it's not a problem related with the typehead input. Any solution for this problem...?
Thank's advance!

A: on express 4 would be this one. (note that this will not parse multipart/uploads).
app.use(bodyParser.urlencoded({extended: true}));

and if you want to receive json input
app.use(bodyParser.json());

A: req.body is made up of names and values.
add name="search" on your search box and try again.
You also must use the express/connect.bodyParser() middleware, thanks Nick Mitchinson!

A: I had this problem and it turned out I was using app.use(express.bodyParser()); but it was after the code I was using. Moving it up solved the issue.

A: In my case it was caused by my app redirecting http to https.
Updating Facebook to use the https uri fixed it.

A: In my case I did not provide name tags like this name="firstname" in my input field. After adding them, everything worked.


text:
Q: Java Reg expression for replacing img tag with ending tag i want reg expression to replace  html  tag with close tag like :
 with  or

Please i need this because i need this proper html using for Itext pdf generator api it need proper ending tags .. please give me solution

A: Find:
(]*[^/]>)(?!\s*)

Replace:
$1

This makes sure that you're not screwing up tags that already close
e.g You do not want to replace  with
In Java I believe the code might be:
str.replaceAll("(]*[^/]>)(?!\\s*)", "$1");

A: I am not sure if that is what you are looking for but maybe instead of regex try using HTML parser? Jsoup seems to return something similar to what you are looking for.
Document doc = Jsoup.parse("
something");
System.out.println(doc);

Output:

   something

A: If you really just want to change all  tags to  tags, you can use the following sed command, but as others pointed out it's not really a good idea, it can easily go wrong.
sed "s/\(<\s*img.*\)>/\1\/>/" Your_File.html


text:
Q: ASP.NET MVC 4 Code first, How add tables using Code first Im playing currently on visual studio 2012 asp.netmvc4 with simple membership. This will generate 5 tables after running.
My problem is how do i add additional tables? I tried by creating a new model and adding a DbSet on the context class but it will throw error saying dbo.model does not exist in the database. The table is not created.
Is there a standard way of adding a model that will generate a table without running db migrations command?
I even added this Database.SetInitializer(new HWMDContextInitializer()); on application start but the error is still there.

A: Go through this. It will give you the exact approach
    http://programmaticponderings.wordpress.com/2012/10/30/first-impressions-of-code-first-development-with-entity-framework-5-in-visual-studio-2012/

A: Have you tried this?
protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        Database.SetInitializer<YourContext>(new DropCreateDatabaseIfModelChanges<YourContext>());

A: If you want Entity Framework to drop and regenerate your database
automatically whenever you change your model schema, use data migrations.
For more information refer to the documentation:
http://msdn.microsoft.com/en-us/data/jj591621.aspx


text:
Q: Two ways to define controllers in AngularJS? I saw these two differents patterns to define controllers in AngularJS:
myApp.controller('myControllerName', function($scope) {
    // ... my controller code ...
});

and
myApp.controller('myControllerName', ['$scope', function($scope) {
    // ... my controller code ...
}]);

In dependency injection, parameters added respectively.
What is the difference between those two coding routines? I'd love for detailed answer, for both the JavaScript and AngularJS low-level aspects.

A: The second way is used to resolve minification issues.

Since Angular infers the controller's dependencies from the names of
  arguments to the controller's constructor function, if you were to
  minify the JavaScript code for PhoneListCtrl controller, all of its
  function arguments would be minified as well, and the dependency
  injector would not be able to identify services correctly.
We can overcome this problem by annotating the function with the names
  of the dependencies, provided as strings, which will not get minified

A Note on Minification

A: Both examples will have the same effect. When using the first pattern Angular parses out the parameter names by converting the function to a string. When using the second pattern the names are explicitly provided as strings.
The second pattern is useful because it's good practice to minify production code. Any good minifier will rename parameter identifiers so the first example would end up something like this:
a.controller('myControllerName',function(a){});

In this situation Angular will no longer know which service to inject since it will parse the parameter names, get a and attempt to inject the a service (which may or may not exist but definitely isn't what you wanted).
The second example will minfiy to something like this:
a.controller('myControllerName',['$scope',function(a){}]);

This time Angular will provide the correct service. Inside the controller function a is a reference to the provided service and everything will work as expected.

A: Both will do the same thing, but the later is useful when we minify code.
Minifying code will shorten local variables and arguments names in functions.
For example, your code snippets would be changed to the following after minification:
myApp.controller('myControllerName', function(a) {

});

and
myApp.controller('myControllerName', ['$scope', function(a) {
    // ... my controller code ...
}]);

As angular inject services based on the argument name, it would not find the provider with the name 'a', so it fails.


text:
Q: Place item at specific position in dropdown list Can we place/keep dropdownlist item at particular position. Say for example I want to bind dropdownlist to datasource and then add new item which is placed at particular position in dropdownlist. How can this be possible.

A: You can use Insert method.
dropDownList.Items.Insert(index, new ListItem("Default Panel", "0"));


text:
Q: Cannot get jasmine test to succeed calling injected service I'm trying to wrap my head around unit testing with Angular and I'm running into some road blocks.  In trying to create a plnkr for this question: Jasmine test fails making $httpbackend call I've encountered a different error.  I was hoping if someone could help figure out this plunkr, it would help fix the original question: http://plnkr.co/edit/lJTx0ldR9nEnlYbU5pJd
    (function(){'use strict';
  var RestService = function($http, $rootScope){
    var _postData = function(url, params, data, successFunction,  errorMsg, errorFunction, config) {

            if(config && config.hasOwnProperty('showLoader')){
                $rootScope.showLoader = config.showLoader;
            }

            $http({
                method: 'POST',
                url: url,
                params: params,
                data: data,
                cache: false
            })
                .success(function(data, status, headers, config) {
                    $rootScope.showLoader = false;
                    if (successFunction === undefined) {
                        _defaultSuccessFunction(data, status, headers, config);
                    }
                    else {
                        successFunction(data, status, headers, config);
                    }
                })
                .error(function (data, status, headers, config) {
                    $rootScope.showLoader = false;
                    if(status === 401){
                        _processError(data, status, headers, config, errorMsg, errorFunction);
                    }
                });
        };

        return {
            postData: _postData
        };
  };
  angular.module('ram-utilities.ui.rest.service', []).factory('RestService', ['$http', '$rootScope', RestService]);
})();

(function(){ 'use strict';
    var LoginController = function($scope, RestService){
        var _user = undefined;
        var _message = 'hello';

        var _login = function(user){
            var _success = function(response){
                _message = response.success;
                _user = response.user;
            };

            var _error = function(response){
                _message = response.success;
            };

            RestService.postData('/api/login',  null, {username: user.username, password: user.password}, _success, 'Invalid login, please try again', _error, {showLoader: true});
        };

        $scope.model = {
            login: _login,
            user: _user,
            message: _message
        };
    };

    angular.module('danny',['ram-utilities.ui.rest.service']).controller('LoginController',['$scope', 'RestService',LoginController]);
})();

describe('LoginController', function(){
    var scope, $httpBackend, controller, restService;

    beforeEach(function(){
        module('danny');
    });

    beforeEach(inject(function(_$controller_, _$rootScope_, _$httpBackend_, _RestService_){
        $httpBackend = _$httpBackend_;
        restService = _RestService_;
        scope = _$rootScope_.$new();
        controller = _$controller_('LoginController', {
            $scope: scope,
            RestService: restService
        });
    }));

    afterEach(function() {
        $httpBackend.verifyNoOutstandingExpectation();
        $httpBackend.verifyNoOutstandingRequest();
    });

    describe('successfully logging in', function(){

       it('should redirect to /blog when authenticated', function(){

           var user = {"username":"danny@ravenartmedia.com", "password":"test"};
            expect(user.username).toEqual('danny@ravenartmedia.com');

          $httpBackend.expectPOST('/api/login', user).response(200, {});

          scope.model.login(user);
          $httpBackend.flush();

          expect(scope.model.user).not.toBe(undefined);
       });
    });
});

(function() {
  var jasmineEnv = jasmine.getEnv();
  jasmineEnv.updateInterval = 250;

  /**
   Create the `HTMLReporter`, which Jasmine calls to provide results of each spec and each suite. The Reporter is responsible for presenting results to the user.
   */
  var htmlReporter = new jasmine.HtmlReporter();
  jasmineEnv.addReporter(htmlReporter);

  /**
   Delegate filtering of specs to the reporter. Allows for clicking on single suites or specs in the results to only run a subset of the suite.
   */
  jasmineEnv.specFilter = function(spec) {
    return htmlReporter.specFilter(spec);
  };

  /**
   Run all of the tests when the page finishes loading - and make sure to run any previous `onload` handler

   ### Test Results

   Scroll down to see the results of all of these specs.
   */
  var currentWindowOnload = window.onload;
  window.onload = function() {
    if (currentWindowOnload) {
      currentWindowOnload();
    }

    //document.querySelector('.version').innerHTML = jasmineEnv.versionString();
    execJasmine();
  };

  function execJasmine() {
    jasmineEnv.execute();
  }
})();

Thanks!!!

A: There is a couple of things:

*

*Use respond instead of response in $httpBackend.expectPOST

*data argument gets hidden in $http.success handler - rename it to postData. Also pass expected object to success callback.
var _postData = function(url, params, data, successFunction /* ... */) {
    //...

    $http( {
        method: 'POST',
        url: url,
        params: params,
        data: data,
        cache: false
    } )
        .success( function ( postData, status, headers, config ) {
            // ...
            successFunction({
                success: true,
                user: data
            }, status, headers, config);
        } );

    //...
}

*LoginController returns object that can be changed only via explicit referencing like $scope.model.user = response.user; - simply calling _user = response.user won't change $scope.model.user unless you wrap _user in a closure.

*Working Plunk


text:
Q: Close another workbook error with code before closing I have a code in my "current" workbook that close "other" workbook. However that "other" workbook has a code that when you close it, a code will be executed.
What I want is that when I run the code from my "current" workbook, it will bypass or ignore the code of another workbook.
Current Workbook Code:
NewName = "v10.0_" & Left(CurFile, Len(CurFile) - 5)
pseudo = "'"
MacroName = "Workbook_BeforeClose"

Call SaveAs(wbk_r, NewName, FolderPath) 'Save the file to destination folder

Application.Run pseudo & NewName & "'!" & MacroName & ".xlsm", Cancel

Other Workbook Code:
'''
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If MsgBox("All data input will be permanently saved in the file database! Are you sure for your update?", vbYesNo) = vbNo Then
        Exit Sub
    Else
        Call SaveChangesA
        ThisWorkbook.Saved = True
    End If
End Sub

'''

A: Use Application.EnableEvents = False to turn off events. So the event Workbook_BeforeClose will not run if you close the workbook.
Make sure you turn it on afterwards (or in case of an error) Application.EnableEvents = True otherwise events will stay turned off in your entire Excel.

To give an Example for the error handling
Option Explicit

Public Sub Example()

    ' your inital code before closing the workbook goes here …

    Application.EnableEvents = False
    On Error Goto ERR_EVENTS

    ' close your workbook here (nothing else)

    On Error Goto 0 ' re-enable error reporting for the rest of your code!
    Application.EnableEvents = True

    ' your other code goes here …

    Exit Sub  ' run the following only in case of an error
ERR_EVENTS:

    ' Enable events!
    Application.EnableEvents = True

    Err.Raise Err.Number  ' raise an error in case there was one (otherwise you will never know that something went wrong).
End Sub

For more see VBA Error Handling – A Complete Guide.