text:
Q: HTML5 Video tag not working in Safari , iPhone and iPad I am trying to create an html5 web page in which there is a small video like 13s , I converted the flash version of this video into 3 format : .ogv using fireFogg , .webm using firefogg also and .mp4 using HandBrake application the html script I used in my page :
<video  width="800" height="640" loop preload="false" autoplay  controls tabindex="0">
  <source src="xmasvideo/video.mp4" type="video/mp4" />
  <source src="xmasvideo/M&P-Xmas 2.ogv" type="video/ogv" />
  <source type="video/webm" src="xmasvideo/M&P-Xmas.webm" />
</video>

The video is working fine in Chrome and FireFox but not working at all neither in Safari on Desktop nor on iPhone or iPad , the output is simply a blank page that shows the controls of the the video tag but nothing is loaded
Note that the Safari version that I have supports HTML5 video

A: By using this code video will play in all browser in safari as well with ios devices... Go for it everyone (I have used this and working fine)
<video autoplay loop muted playsinline poster="video_thumbnail/thumbanil.jpg" src="video/video.mp4">
        <source src="video/video.mp4" type="video/mp4"></source>
        <source src="video/video.webm" type="video/webm"></source>
        <source src="video/video.mov" type="video/mov"></source>
</video>

A: Another possible solution for you future searchers:
(If your problem is not a mimetype issue.)
For some reason videos would not play on iPad unless i set the controls="true" flag.
Example:  This worked for me on iPhone but not iPad.
<video loop autoplay width='100%' height='100%' src='//some_video.mp4' type='video/mp4'></video>

And this now works on both iPad and iPhone:
<video loop autoplay controls="true" width='100%' height='100%' src='//some_video.mp4' type='video/mp4'></video>

A: I have found that although Safari does support HTML5 Video, the Quicktime Player has to be installed in order for this to work. On a site that I built that uses HTML5 Video, the user is alerted when using Safari, telling them they must have Quicktime installed, otherwise they will only be able to see video transcripts. Hope this helps.

A: I've seen weird issues with a non trusted 'development' SSL certificates where mobile Safari will quite happily serve your page but refuses to serve a video to a 'fake' SSL certificate even if you've accepted the certificate.
To test you can deploy the video elsewhere - or switch to http (for the whole page) and it should play.

A: Adding 'playsinline' works for me on Iphone and Ipa if you don't mind your video being muted.
<video muted playsinline>
  <source src="..." type="video/mp4">
</video>

If you don't want your video being muted, but still want autoplay, maybe try to remove muted attribute with js:
How to unmute html5 video with a muted prop

A: I had a similar issue where videos inside a <video> tag only played on Chrome and Firefox but not Safari. Here is what I did to fix it...
A weird trick I found was to have two different references to your video, one in a <video> tag for Chrome and Firefox, and the other in an <img> tag for Safari. Fun fact, videos do actually play in an <img> tag on Safari. After this, write a simple script to hide one or the other when a certain browser is in use. So for example:
<video id="video-tag" autoplay muted loop playsinline>
    <source src="video.mp4" type="video/mp4" />
</video>
<img id="img-tag" src="video.mp4">

<script type="text/javascript">
    function BrowserDetection() {

    //Check if browser is Safari, if it is, hide the <video> tag, otherwise hide the <img> tag
    if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
        document.getElementById('video-tag').style.display= "none";
    } else {
        document.getElementById('img-tag').style.display= "none";
    }

    //And run the script. Note that the script tag needs to be run after HTML so where you place it is important.
    BrowserDetection();
</script>

This also helps solve the problem of a thin black frame/border on some videos on certain browsers where they are rendered incorrectly.

A: Your web server might not support HTTP byte-range requests. This is the case with the web server I'm using, and the result is that the video widget loads and a play button appears, but clicking the button has no effect. — The video works in FF and Chrome, but not iPhone or iPad.
Read more here on mobiforge.com about byte-range requests, in Appendix A: Streaming for Apple iPhone:

First, the Safari Web Browser requests the content, and if it's an
  audio or video file it opens it's media player. The media player then
  requests the first 2 bytes of the content, to ensure that the
  Webserver supports byte-range requests. Then, if it supports them, the
  iPhone's media player requests the rest of the content by byte-ranges
  and plays it.

You might want to search the web for "iphone mp4 byte-range".

A: As of iOS 6.1, it is no longer possible to auto-play videos on the iPad. According to Apple documentation Autoplay feature is not working on Safari in all ios devices including iPad:
"Apple has made the decision to disable the automatic playing of video on iOS devices, through both script and attribute implementations.
In Safari, on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and auto-play are disabled. No data is loaded until the user initiates it."
You can read more abut it in this Apple documentation

A: For a .mp4 this works ( safari mobile & desktop ) :
<video height="250" width="250" controls>
    <source src="video.mp4" type="video/mp4" />
    Your browser does not support the video tag.
</video>

The controls="true" mentioned in an above post make no sence to me as Apple says just use controls on its own.
Reference : "To use HTML5 audio or video, start by creating an  or  element, specifying a source URL for the media, and including the controls attribute.
<video src="http://example.com/path/mymovie.mp4" controls></video>"
Source : https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Introduction/Introduction.html
In my dealings ( a small digression ) :
I have found that uploading video from iPhone sends it to server as .quicktime. Ironically, this is the problem when trying to play back the video from the server on safari. ( mobile & desktop ).
So if ( like me ) you are experiencing a .quicktime ( or anything other than .mp4 ) problem in safari, here is a work around provided by apple. Note, I'm yet to test it myself and I'm not all that happy with it at a glance, just providing more info.
Reference :
"Fall Back to the QuickTime Plug-in There is a simple way to fall back to the QuickTime plug-in that works for nearly all browsers—download the prebuilt JavaScript file provided by Apple, ac_quicktime.js, from HTML Video Example and include it in your webpage by inserting the following line of code into your HTML head: <script src="ac_quicktime.js" type="text/javascript"></script>"
Source : https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html#//apple_ref/doc/uid/TP40009523-CH2-SW6
Update: For .quicktime rename to .mov prior upload to server ( in base64 filetype "data:video/mov;" ), skip ac_quicktime.js . . . will then work in html video tag; Hackerdy Hack.

A: I had same problem - make sure the url for video asset is coming from secure domain.  Our dev environment is http while production is secure.  Due to the video being referenced via relative path, it wasn't working on development.  Seems to be an issue that apple requires video to be secure...

A: If your using in REACT use playsInline this is working in all IOS devices

A: Add these 4 param autoplay loop muted playsinline, like:
<video autoplay loop muted playsinline
    style="width:100%;height:auto;max-width:100%;">

in video tag to make it autoplay in iOS devices.

A: I had same issue with apple devices like iPhone and iPad, I turned off the low power mode and it worked and you should also include playsinline attribute in video tag like this:
<video class="video-background" autoplay loop muted playsinline>

It only worked when including playsinline.

A: If your videos are protected by a session-based login system, Safari will fail to load them. This is because Safari makes an initial request for the video, then hands the task over to QuickTime, which makes another request. Since Safari holds the session info, it will pass the authentication, but QuickTime will not.
You can see this if you view your server access log ... first the request from Safari, then the request from QuickTime. Other browsers just make a single request from the browser itself.
If this is your problem, you might have to rework the video access to use temporary tokens or a limited time access from the original request. I'll update this answer if I find a more direct solution.

A: For someone comes here, using the MediaSource Extension to operate video source.
And had tried other solutions but still not work.
I checked at Can I use MSE, and found the reason is the iOS of iPhone does not support MSE(Media Source Extension).
So the MSE didn't work on iPhone.
an image from Can I use MSE

The iPhone's iOS support HLS originally (apple's dev docs),
so you need to convert the MP4 to HLS format.
(can use bento4 HLS)
 MP4 format must be fMP4 format
After converted, the HLS format output directory will look like this

The filename extension should be .m3u8, and the master.m3u8 is a doument that describe the video's all information.
Then let the video tag's src attribute point to the HLS resource's URL(master.m3u8).
like this sample code
<video src="https://XXX/master.m3u8">
</video>

For more information
Look this link

A: My complete solution yesterday includes several good answers from this question plus another blog articles. I`ll try to compile it.
The frontend
video tag

*

*playsInline attribute makes difference

<video id='my-video' class='video-js' controls preload='auto' autoplay height="270" poster='img/logo_cathedra.png' playsInline type="video/mp4">

*

*withCredentials makes difference to send cookies (in my case, JWT token)

var player = videojs('my-video');
...
window.addEventListener("load", () => {
    player.src({
        src: 'path-to-video',
        type: 'video/mp4',
        withCredentials: true
    });
});

The backend

*

*write to the response the status 206 and the headers necessary to byte range and video streaming

Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 1289232
Content-Range: bytes 0-1289231/1289232
Content-Type: video/mp4
Last-Modified: Sun, 06 Nov 2022 14:08:57 GMT

In my case, I expect a request Header WITH or WITHOUT limit (right side of range). When the right side is not suplied, I used a fixed chunk size and calculate the Content-Length and Content-Range

*

*Ex. using Chrome

# REQUEST
Range: bytes=0-
...
# RESPONSE
Content-Length: 4096
Content-Range: bytes 0-4096/1289232

*

*Ex. using Safari

# REQUEST
Range: bytes=0-1
...
# RESPONSE
Content-Length: 1
Content-Range: bytes 0-1/1289232

*

*add back do the response headers safari sends playing HTML5 video

X-Playback-Session-Id: someRandom.chars.like.uuid

A: For future searches as well, I had an mp4 file that I downscaled with Handbrake using handbrake-gtk from apt-get, e.g. sudo apt-get install handbrake-gtk. In Ubuntu 14.04, the handbrake repository doesn't include support for MP4 out of the box. I left the default settings, stripped the audio track out, and it generates an *.M4V file. For those wondering, they are the same container but M4V is primarily used on iOS to open in iTunes.
This worked in all browsers except Safari:
<video preload="yes" autoplay loop width="100%" height="auto" poster="http://cdn.foo.com/bar.png">
            <source src="//cdn.foo.com/bar-video.m4v" type="video/mp4">
            <source src="//cdn.foo.com/bar-video.webm" type="video/webm">
</video>

I changed the mime-type between video/mp4 and video/m4v with no effect. I also tested adding the control attribute and again, no effect.
This worked in all browsers tested including Safari 7 on Mavericks and Safari 8 on Yosemite. I simply renamed the same m4v file (the actual file, not just the HTML) to mp4 and reuploaded to our CDN:
<video preload="yes" autoplay loop width="100%" height="auto" poster="http://cdn.foo.com/bar.png">
            <source src="//cdn.foo.com/bar-video.mp4" type="video/mp4">
            <source src="//cdn.foo.com/bar-video.webm" type="video/webm">
</video>

Safari I think is fully expecting an actually-named MP4. No other combinations of file and mime-type worked for me. I think the other browsers opt for the WEBM file first, especially Chrome, even though I'm pretty sure the source list should select the first source that's technically supported.
This has not, however, fixed the video issue in iOS devices (iPad 3 "the new iPad" and iPhone 6 tested).

A: Just add a muted attribute and everything will work fine.
The source of this answer is here: https://webkit.org/blog/6784/new-video-policies-for-ios/

By default, WebKit will have the following policies:
<video autoplay> elements will now honor the autoplay attribute, for elements which meet the following conditions:

*

*<video> elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.

*<video muted>  elements will also be allowed to autoplay without a user gesture.

*If a <video> element gains an audio track or becomes un-muted without a user gesture, playback will pause.

*<video autoplay> elements will only begin playing when visible on-screen such as when they are scrolled into the viewport, made visible through CSS, and inserted into the DOM.

*<video autoplay> elements will pause if they become non-visible, such as by being scrolled out of the viewport.

  <video> elements will now honor the play() method, for elements which meet the following conditions:

*

*<video> elements will be allowed to play() without a user gesture if their source media contains no audio tracks, or if their muted property is set to true.

*If a <video> element gains an audio track or becomes un-muted without a user gesture, playback will pause.

*<video> elements will be allowed to play() when not visible on-screen or when out of the viewport.

*video.play() will return a Promise, which will be rejected if any of these conditions are not met.

  On iPhone, <video playsinline> elements will now be allowed to play inline, and will not automatically enter fullscreen mode when playback begins.
   <video> elements without playsinline attributes will continue to require fullscreen mode for playback on iPhone.
  When exiting fullscreen with a pinch gesture, <video> elements without playsinline will continue to play inline.

A: Working around for few days into the same problem (and after check "playsinline" and "autoplay" and "muted" ok, "mime-types" and "range" in server ok, etc). The solution for all browsers was:
<video controls autoplay loop muted playsinline>
    <source src="https://example.com/my_video.mov" type="video/mp4">
</video>

Yes: convert video to .MOV and type="video/mp4" in the same tag. Working!

A: I had this problem where .mp4 playback in Safari didn't work, but in other browsers it was fine. The error that I was seeing in the console was: error media src not supported. In my case this turned out to be a MIME type issue, but not because it wasn't declared as MIME type in IIS, rather that it was declared twice (once in IIS and also in a web.config file). I found this out by trying to download the .mp4 file locally on the server. I removed the config file from the location of the content I was trying to play and it fixed the issue. I could have just deleted the MIME type from the web.config file, but in this case the web.config file wasn't needed.

A: For IOS, please use only mp4 source file.
I have observed one issue in latest safari browser that safari browser cant able to detect source file correctly and because of this, video autoplay doesn't work.
Lets check below example -
     <video autoplay loop muted playsinline poster="video_thumbnail/thumbanil.jpg" src="video/video.mp4">
        <source src="video/video.mp4" type="video/mp4"></source>
        <source src="video/video.webm" type="video/webm"></source>
     </video>

As I have used mp4, webm in source files. Safari deosnt support webm but still in latest safari version, it would select webm and it fails video autoplay.
So to work autoplay across supported browser, I would suggest to check browser first and based on that you should generate your html.
So for safari, use below html.
     <video autoplay loop muted playsinline poster="video_thumbnail/thumbanil.jpg" src="video/video.mp4">
        <source src="video/video.mp4" type="video/mp4"></source>
     </video>

For other than safari,
     <video autoplay loop muted playsinline poster="video_thumbnail/thumbanil.jpg" src="video/video.mp4">
        <source src="video/video.webm" type="video/webm"></source>
        <source src="video/video.mp4" type="video/mp4"></source>
     </video>

A: is working but MacOs recently has autoplay policy for user:  https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/, I resolved the same issue using a button to enable sound:
ejm:

<video autoplay loop muted id="myVideo">
  <source src="amazon.mp4" type="video/mp4">
  Sorry, your browser doesn't support embedded videos...
</video>

<button class="pausee" onclick="disableMute()" type="button">Enable sound</button>

<script>
var vid = document.getElementById("myVideo");
function disableMute() {
  vid.muted = false;
}
</script>

A: I had exactly the same problem, my HTML video tag played well on Chrome & Mozilla, on Safari - controls appeared but video was blank. I tried to play with all the above attributes, remove/add muted, playsInline, etc. and nothing worked. Problem was with servers as described here as well. I had this - DID NOT WORK:
<video
  muted
  playsInline
  controls
  style={{ width: `100%` }}>
  <source src={MfMfVideo} type="video/mp4" />
  <source src={MfMfVideoWebM} type="video/webm" />
</video>

and I just moved my video out to external library and I am fine on Safari now, it WORKS well:
<video
  muted
  playsInline
  controls
  style={{ width: `100%` }}>
  <source src={"https://blabla.com/video/dixneuf-video_r8xuvc.mp4"} type="video/mp4" />
  <source src={"https://blabla.com/videodixneuf-video_gyquuu.webm"} type="video/webm" />
  Sorry, your browser doesn't support embedded videos.
</video>

A: Experienced it too. Video not showing on my iphone... What I did was add the muted and preload attribute to the video element.. and it worked.
 <video width="250" muted preload="metadata">
      <source  src="vid_3.mp4" type="video/mp4" />
 </video>

A: My problem was the video encoding. I changed it by using ffmpeg:
ffmpeg \
  -i input.mp4 \
  -vcodec libx264 \
  -acodec aac output.mp4

Related:

For static video files, use H.264-encoded MP4 files.
Apple.com: "Delivering Video Content for Safari"

A: I have faced same issue. Because my video frame size was too big. ie.2248 px
apple support
H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. Note that B frames are not supported in the Baseline profile.
check this for more info

A: What helped in my case was dropping the audio track. It was silent before, but it had to be gone completely.
On ubuntu:
ffmpeg -i input.mp4 -vcodec copy -an output.mp4

And safari/desktop start to play the video

A: Nothing worked for me except for compressing the video to be under 30mb. That did the trick but with very bad compression.

A: If someone having same problem i solved it by enabling Byte-Range support on my server. It appears that Safari requires Byte range requests. In my case i use NGINX and i had to add proxy_force_ranges on; to my config file. Thanks to this answer!

A: I know this is an old post, but the issue still seems to surface under different server environments. None of the above were the solution for me. In my case it came down to web optimization and making use gzip, or rather needing to disable it for videos.
I added this to my htaccess file and it took care it.
SetEnvIfNoCase Request_URI .(?:ogv|ogg|oga|m4v|mp4|m4a|mov|mp3|wav|webma?|webmv)$ no-gzip dont-vary
I was already using these attributes on my  tag: controls playsinline

A: On my iPhone 10, I turned off the low power mode & it autoplayed on Chrome.
Include playsinline attribute on video tag.

A: For my use case there were two things:

*

*I wasn't using the new attribute / webkit's policy playsinline;

*My video / mime-type or whathathell wasn't properly encoded, so I used this site to convert it to all formats I needed: https://pt.converterpoint.com/
o/


text:
Q: jqueryUI: Drag element from dialog and drop onto main page? I am trying to create a drag and drop system consisting of a workspace and a "palette". The workspace currently consists of re-orderable list items, and I want the palette to be a floating window from which I can drag items and add them to a specific position on the workspace.
I am currently using the jqueryUI "sortable" plugin for the workspace and the jqueryUI "dialog" plugin for the palette.
However, I cannot drag something out of the dialog and on to the main page. When I try, the item being dragged disappears as it crosses the boundary of the dialog (which makes sense). What can I change so that items will remain visible as I drag them out of the palette and allow me to drop them onto the main workspace?
Alternatively, are there any jquery plugins that offer this sort of drag-n-drop palette as a primary feature?

A: If dragging items from the palette duplicates them, without removing them from the palette, then the answer is the appendTo option of the draggable plugin. This specifies the container to use during dragging. In my case I created a new div outside the bounds of the dialog and specified that as the dragging container. This allows the element to be drug beyond the bounds of the dialog window.
To move items from the palette onto the workspace, I used the techniques from this similar SO question.

redpajama_set_name: RedPajamaStackExchange


text:
Q: JavaScript loop in a simple quiz Simple school quiz-project based on JavaScript, these are the files the whole quiz consists of:

*

*Quiz.html: http://www.rapidimg.org/server/files/50ab9c326115cKAUf6S.png

*Quiz_questions.js: http://www.rapidimg.org/server/files/50ace68ad21d9GPIha7.png (random letters behind the images to show it does load the answers)

*Quiz_functions.js: This is where it's mainly about, see below.

*Output: http://www.rapidimg.org/server/files/50ace6c57c01aTsZpMk.png (This is correct!)

It loads one question with the corresponding answers, so that works fine. (See the Output above). Now as soon as I click "Next Question" by selecting or not selecting an answer, two different things happen.
Not selected an answer: http://www.rapidimg.org/server/files/50ace9123bce6TzoiqL.png - loads Question 2 + answers but puts the page in an infinite loading state. When I click another answer and hit "Next Question", Firebug shows: http://www.rapidimg.org/server/files/50ace9a08b88aqLFZ1K.png
Selected an answer: http://www.rapidimg.org/server/files/50acea1422aed6gZkcL.png - loads Question 3 + answers (???) but also puts the page at infinite load. Same error as above when clicking an answer + "Next Question" button: http://www.rapidimg.org/server/files/50acea4e4bc3cLn8g2U.png
Here's the code of "quiz_functions.js" where this is realised:
var useranswers = new Array();
var imgArray = new Array();
var answered = 0;
var currentQuestion = 0;

function renderQuizViaArray()
{
    document.write('
' + questions[currentQuestion] + '
');

    for(i=0, j=choices[currentQuestion].length; i < j; i++)
    {
        document.writeln('<input type="radio" name="answer_' + currentQuestion + '" value="1" id="answer_' + currentQuestion + '_' + i + '" class="question_' + currentQuestion + '" onclick="submitAnswer(' + currentQuestion + ', this, \'question_' + currentQuestion + '\', \'label_' + currentQuestion + '_' + i + '\')" /> ' + choices[currentQuestion][i] + '
');
    }

        document.write('<input type="submit" value="Next Question" onclick="nextQuestion()" />');
}

function nextQuestion()
{
    currentQuestion++;
    renderQuizViaArray();
}

function submitAnswer(questionId, obj, classId, labelId)
{
  useranswers[questionId] = obj.value;
  document.getElementById(labelId).style.fontWeight = "bold";
  disableQuestion(classId);
  answered++;
}

function disableQuestion(classId)
{
  var alltags = document.all? document.all : document.getElementsByTagName("*")
  for (i = 0; i < alltags.length; i++)
  {
    if (alltags[i].className == classId)
    {
      alltags[i].disabled = true;
    }
  }
}


text:
Q: Correcting a NullReferenceException in PositionWithLocationProvider? I am working through the How to build an Augmented Reality App using the Foursquare API + Mapbox + ARKit sample project and receive the following error at runtime:
NullReferenceException: Object reference not set to an instance of an object
Mapbox.Examples.LocationProvider.PositionWithLocationProvider.get_LocationProvider () (at Assets/PositionWithLocationProvider.cs:42)
Mapbox.Examples.LocationProvider.PositionWithLocationProvider.Start () (at Assets/PositionWithLocationProvider.cs:63)

Taking a look at PositionWithLocationProvider.cs, this is the block in question:
ILocationProvider _locationProvider;
public ILocationProvider LocationProvider
{
  private get
  {
    if (_locationProvider == null)
    {
      _locationProvider = _useTransformLocationProvider ?
      LocationProviderFactory.Instance.TransformLocationProvider : LocationProviderFactory.Instance.DefaultLocationProvider; // Line 42
    }

    return _locationProvider;
  }
  set
  {
    if (_locationProvider != null)
    {
      _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;

    }
    _locationProvider = value;
    _locationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated;
  }
}
Vector3 _targetPosition;

void Start()
{
  LocationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated; // Line 63
  _map.OnInitialized += () => _isInitialized = true;
}

(The full file can be found in this gist.)
I know that _locationProvider is null at this point but I'm not sure why my LocationProviderFactory.Instance would be bombing out. Any help would be appreciated!


text:
Q: Terminate(end, kill) a specific thread in python? I am looking for a way I can kill a thread that I start using an event. I am starting the bot with code as below:
 new_thread = threading.Thread(target=info, args=(doc,), name=doc["token"])
 new_thread.start()

I have a list where am storing all the threads i start. (I store the threads using the names which are unique UUIDS.
I need to be able to kill a thread using its name. How do I do this? Any help will be highly appreciated. Thank you.

A: Implementing threading on your own is not the best solution, it introduces lots of bugs. I found a good solution would be to use task schedulers such as celery click here or Huey click here!


text:
Q: Is $c_0$ a Banach space for a non-standard norm? It is well known that the space $c_0$, consisting of all real sequences converging to zero, equipped with the supremum norm
$$
\|(x_n)\| = \sup_n |x_n|
$$
is a Banach space.

Does there exists a norm $\| \cdot \|_1$ which is not equivalent to the norm defined above and such that $c_0$ equipped with this norm is still a Banach space?


text:
Q: Spring MVC UTF-8 Character Encoding At the moment, I'm trying to develop a website by using Spring MVC. But there is a problem in my views, that we can name it as character problem. I want to display UTF-8 characters in my JSP view pages.
In view pages, I've seperated my headers, footers and bodies in my JSP files, and I am implementing my headers and footers into my bodies. (in case to be an important thing to say).
Here is my header intro:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

    <meta charset="latin5">
    <title>orcunyilmaz.com</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
    <link href="<c:url value="/resources/css/foundation.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/css/foundation-icons.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/css/flexslider.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/css/style.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/css/mediaqueries.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/colors/default.css"/>" rel="stylesheet">...

And here is my home.jsp intro:
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@include file="/WEB-INF/views/template/header.jsp" %>

            <form action="/" class="searchform" method="get" role="search">
                <input size="27" type="text" title="Ara.." class="s" name="s"> </form>

...

(If whole of the code is needed, I can paste it here)
I've found an answer in this post: Spring MVC UTF-8 Encoding
That says I need to implement some filters into my web.xml, but it didn't work either. Here is the filter that I've implemented to my web.xml:
<filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Here is the sctreenshot of a part:

I need it to be seen as: İlan Tarihi & İlan No. So any help will be greatly appreciated, thanks in advance.

A: Try to add URIEncoding = "UTF-8" to <Connector > tag in server.xml under tomcat directory. Also if you are using Maven you can try to add this to pom.xml
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
</properties>

A: Every jsp-file needs this line:
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>

Check also the encoding in your IDE.

A: To set the encoding of all JSPs to UTF-8 add this snippet to web.xml:
<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

see here https://sorenpoulsen.com/utf-8-encoding-a-jsp-with-spring-mvc


text:
Q: Retrieve Second to Last Word in PostgreSQL I am using PostgreSQL 9.5.1
I have an address field where I am trying to extract the street type (AVE, RD, ST, etc). Some of them are formatted like this: 5th AVE N or PEE DEE RD N
I have seen a few methods in PostgreSQL to count segments from the left based on spaces i.e. split_part(name, ' ', 3), but I can't seem to find any built-in functions or regular expression examples where I can count the characters from the right.
My idea for moving forward is something along these lines:
select case when regexp_replace(name, '^.* ', '') = 'N'
            then *grab the second to last group of string values*
       end as type;

A: Leaving aside the issue of robustness of this approach when applied to address data, you can extract the penultimate space-delimited substring in a string like this:
with a as (
    select string_to_array('5th AVE N', ' ') as addr
    )
select
    addr[array_length(addr, 1)-1] as street
from
    a;


text:
Q: How to drop foreign keys of a particular column I have created a foreign key without specifying the name so sql server has created it with auto generated name. Now I want to drop the column which has this foreign key. The problem is that i don't know the name of this foreign key. Is there any way to drop all the foreign keys for particular column in particular table?
So far I've found this script which drops all default constraints for column
DECLARE @tableName VARCHAR(MAX)
DECLARE @ConstraintName nvarchar(200)
DECLARE @columnName VARCHAR(MAX)

SET @tableName = 'tablename'
SET @columnName = 'columnname'
SELECT @ConstraintName = Name
FROM SYS.DEFAULT_CONSTRAINTS
WHERE PARENT_OBJECT_ID = OBJECT_ID(@tableName)
AND PARENT_COLUMN_ID = (
    SELECT column_id FROM sys.columns
    WHERE NAME = @columnName AND object_id = OBJECT_ID(@tableName))
IF @ConstraintName IS NOT NULL
    BEGIN
 EXEC('ALTER TABLE '+@tableName+' DROP CONSTRAINT ' + @ConstraintName)
 END

ALTER TABLE [tablename] DROP COLUMN columnname
GO

But it doesn't help with foreign key constraints.

A: If you want to get more information about FK and specifically about a particular scheme and table than you can use.
 SELECT
    t.Name as TableName,
    c.name as ColumnName,
    fk.name as FK_NAME

 FROM sys.foreign_keys as fk
 inner join sys.tables as t on fk.parent_object_id = t.object_id
 inner join sys.columns as c on c.object_id = t.object_id
 inner join sys.schemas as sc on t.schema_id = sc.schema_id
 WHERE sc.name = 'Schema' and t.name = 'Table' and c.name = 'Column'

If you are interested only about certain column then u can use Ross Presser answer.
Also if you want to drop all fk constraint you can execute this:
  Declare @sql  nvarchar(4000)
  SET @sql = N'';

  SELECT @sql = @sql + '
  ALTER TABLE [' + sc.NAME + '].[' + OBJECT_NAME(fk.parent_object_id) + ']' + ' DROP  CONSTRAINT ' + '[' + fk.NAME + ']
   '
  FROM sys.foreign_keys as fk
  inner join sys.tables as t on fk.parent_object_id = t.object_id
  inner join sys.columns as c on c.object_id = t.object_id
  inner join sys.schemas as sc on t.schema_id = sc.schema_id
  WHERE sc.name = 'schemaName'  and c.name = 'columnName' -- you can include and fk name
  ORDER BY fk.NAME
  PRINT @sql;
--EXEC sys.sp_executesql @sql;

A: You can get all the constraint list along with the names assigned to particular tables with the help of the below query:
SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE TABLE_NAME='YourTableName';

Once you find the constraint you want to delete you can do it with the help of below query:
ALTER TABLE Orders
DROP CONSTRAINT constraint_name;

A: You can find all constraints throughout the database that use the column:
SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CCU
WHERE CCU.COLUMN_NAME='someColumn'

The output gives the constraint name and the table it is attached to.

A: Here's an example to find foreign keys using the system views (which aren't amazingly well documented):
select  fk.name as ForeignKeyName
    ,   t_parent.name as ParentTableName
    ,   c_parent.name as ParentColumnName
    ,   t_child.name as ReferencedTableName
    ,   c_child.name as ReferencedColumnName
from sys.foreign_keys fk
inner join sys.foreign_key_columns fkc on fkc.constraint_object_id = fk.object_id
inner join sys.tables t_parent on t_parent.object_id = fk.parent_object_id
inner join sys.columns c_parent on fkc.parent_column_id = c_parent.column_id
                        and c_parent.object_id = t_parent.object_id
inner join sys.tables t_child on t_child.object_id = fk.referenced_object_id
inner join sys.columns c_child on c_child.object_id = t_child.object_id
                            and fkc.referenced_column_id = c_child.column_id
order by t_parent.name, c_parent.name


text:
Q: How can you style/theme an element of just one type in react-native-elements? I'm trying to throw together a simple phone app mockup using React Native & React Native Elements as a set of UI components. I want to set the styling of various elements to a common theme, so I'm following the example in the documentation: https://reactnativeelements.com/docs/customization#using-themeprovider.
But the trouble with the example there (as it says in the docs), it sets the style of all buttons. What I'd like to do is to set the background colour of only the solid buttons for example, leaving the clear buttons, clear! Can anyone point me in the right direction of how to do this?
Current snippet (trimmed to save space):
const myTheme = {
  Button: {
    buttonStyle: {
      borderRadius: 4,
      backgroundColor: '#03E0EE',
    },
    titleStyle: {
      color: '#180D43',
    },
  },
};

...

<ThemeProvider theme={myTheme}>
  <View style={styles.footerContainer}>
    <Button title="Primary Button"/>
    <Button title="Secondary Button" type="clear" />
  </View>
</ThemeProvider>

A: Create a wrapper component for SolidButton and or ClearButton. Make this wrapper components consuming the myTheme context with style props (e.g. ButtonSolid\ButtonClear). AFAIK there are no selector capabilities like in css.


text:
Q: Jquery search and hash How is it possible to make live-search with hashes?
Now I have a simple jquery search:
 $(function(){
/// Start searching
       $("form#search-form").submit(function(e){
          var hash = 'q=' + encodeURI(document.getElementById('q').value);
          window.location.hash = hash;
          e.preventDefault();
          $("#results").fadeOut();
            $.ajax({
               type:"GET",
               data: $(this).serialize(),
               url: "search.php",
               success: function(msg){
                      $("#results").html(msg).fadeIn();
                                     }
                    });
        });
});

As you see, I have added here
 var hash = 'q=' + encodeURI(document.getElementById('q').value);
 window.location.hash = hash;

to have search-input in hash. So my idea is to type "http://url/#q=word" and have results for "word". Currently my "hash function" is useless, it performs nothing - just adds value to address bar. How could I make jquery perform in that way?
I tried to add
 if (window.location.hash != "") {
}

but it doesn't help. Or I used to do that wrongly.

A: Try this
$(function(){
    $("form#search-form").submit(function(e){
        e.preventDefault();
        var hash = 'q=' + encodeURI(document.getElementById('q').value);
        window.location.hash = hash;
        search();
    });

    if (window.location.hash != "") {
        search()
    }

    function search() {
        var search = window.location.hash.replace('#q=','');

        $.ajax({
            type:"GET",
            data: { 'search' : search },
            url: "test2.php",
            success: function(msg){
                $("#results").html(msg).fadeIn();
            }
        });
    }
});

For better performance use jquery.hashchange plugin

A: So.. may be it is too difficult, but it works:
$(function(){
    $("form#search-form").submit(function(e){
        e.preventDefault();
        var hash = 'search=' + $('#q').val() + '&lang=' + $('.lang:checked').val(); // radio-buttons have class="lang"
        window.location.hash = hash;
        search();
    });

    if (window.location.hash != "") {
        search()
    }

    function search() {
        var hash_arr = window.location.hash.substr(1).split('&'),
            values = new Array(),
            i = 0,
            json = '{';

        for (var key in hash_arr) {
            values = hash_arr[key].split('=');
            if (i++ != 0) json += ',';
            json += '"' + values[0] + '":"' + values[1] + '"';
        }

        json += '}';

        $("#results").fadeOut();
        $.ajax({
            type:"POST",
            data: { data : json },
            url: "test2.php",
            success: function(msg){
                $("#results").html(msg).fadeIn();
            }
        });
    }
});

In PHP:
$data = (array)json_decode($_POST['data']);
$search = $data['search'];
$language = $data['language'];

A: This is the way how near everything works fine:
What I have in index:
 $(document).ready(function() {

   $("form#search-form").submit(function(e){
      e.preventDefault();
      var hash = '' + encodeURI(document.getElementById('q').value);
      window.location.hash = hash;

      $("#results").fadeOut();
        $.ajax({
           type:"GET",
           data: $(this).serialize(),
           url: "search.php",
           success: function(msg){
                      $("#results").html(msg).fadeIn();
           }
        });
   });

if (window.location.hash != "") {
    s();
}

function s() {
    var s = window.location.hash.replace('#','');

    if($('#language1').attr('checked')===true) {
    var lang = 'language1';
    }
    else if($('#language2').attr('checked')===true) {
    var lang = 'language2';
    }
    else if($('#language3').attr('checked')===true) {
    var lang = 'language3';
    }

    $.ajax({
        type:"GET",
        data: { 's' : s, language : lang},
        url: "search.php",
        success: function(msg){
            $("#results").html(msg).fadeIn();
        }
    });
}

});

In PHP:
 $search = filter_var($_GET["s"], FILTER_SANITIZE_STRING);
 $search_term = urldecode($search);

So the address bar looks like: 127.0.0.1/dictionary/#search_term
A necessary language comes from cookies — so it is very convenient. The only little issue is as in your scripts (because I've taken pieces of your scripting) search_term changing in address bar. I'll try to explain that. If I take a link 127.0.0.1/dictionary/#word, it shows "word". If I try myself to change in address bar "word" into "other word" it shows nothing — I have to reload page to get a result or just open a new tab/window. I don't know why previous codes didn't work. May it is my mistakes - I have no idea.


text:
Q: Using `std::function` to call non-void function A while ago I used std::function pretty much like this:
std::function<void(int)> func = [](int i) -> int { return i; };

Basically, I did this because I wanted to store different function objects in a std::function, but I didn't want to restrict the return types of these functions. Since this seemed to work, I went with it. But I'm not convinced that it is safe to use, and I haven't been able to find any documentation on it. Does anyone know whether this usage is legitimate? Or more generally, what the rules are for the object which can safely be assigned to a std::function?
Edit
For clarification, the issue I'm concerned with is that the lambda function returns an int, while func is declared with return type void. I'm not sure if this is OK, especially once a call to func() is made.

A: Your code has undefined behavior.  It may or may not work as you expect.  The reason it has undefined behavior is because of 20.8.11.2.1 [func.wrap.func.con]/p7:

Requires: F shall be CopyConstructible. f shall be Callable (20.8.11.2) for argument types ArgTypes and return type R.

For f to be Callable for return type R, f must return something implicitly convertible to the return type of the std::function (void in your case).  And int is not implicitly convertible to void.
I would expect your code to work on most implementations.  However on at least one implementation (libc++), it fails to compile:
test.cpp:7:30: error: no viable conversion from 'int (int)' to 'std::function<void (int)>'
    std::function<void(int)> ff = f;
                             ^    ~

Ironically the rationale for this behavior stems from another SO question.
The other question presented a problem with std::function usage. The solution to that problem involved having the implementation enforce the Requires: clause at compile time. In contrast, the solution to this question's problem is forbidding the implementation from enforcing the Requires: clause.

A: Your use case is well-defined according to the standard.
You are constructing a std::function from a callable object[1]
§20.8.11.2.1/7:

template<class F> function(F f);

Requires: F shall be CopyConstructible. f shall be Callable (20.8.11.2) for argument types ArgTypes
  and return type R.

So is your f callable?
§20.8.11.2/2 says:

A callable object f of type F is Callable for argument types ArgTypes
  and return type R if the expres- sion INVOKE (f, declval<ArgTypes>()..., R), considered as an unevaluated operand
  (Clause 5), is well formed (20.8.2).

And the definition of INVOKE says:
§20.8.2

*

*Define INVOKE (f, t1, t2, ..., tN) as follows:
  ... stuff dealing with member function/var pointers ...
  — f(t1, t2, ..., tN) in all other cases.

*Define INVOKE (f, t1, t2, ..., tN, R) as INVOKE (f, t1, t2, ..., tN) implicitly converted to R.

And since any type can be implicitly converted to void, your code should be fine with a standards-conforming compiler. As pointed out by litb below, there isn't an implicit conversion to void so this isn't well defined.
[1]: I think the lambda counts as a callable object here, although I don't have a reference for that. Your lambda could also be used as a function pointer as it captures no context

A: This looks like it may be ok for anonymous functions.
Quote from http://www.alorelang.org/release/0.5/doc/std_function.html (this is not from the C++ standard library, however it looks like they are using something similar in there bindings down to C++)

Function objects can only be created with a function definition, an anonymous function expression or by accessing a bound method using the dot (.) operator.

Another way this could possibly be done is by storing the function pointer in auto as seen here: http://en.wikipedia.org/wiki/Anonymous_function (C++ section)


text:
Q: Abortable: Dangling Futures? I am using the Abortable crate to suspend the execution of a Future. Say I have an abortable future in which the async function itself awaits other async functions. My question is, if I abort the root Future, would the child Futures be aborted instantly at the same time, or would they be dangling?
I read the source code for Abortable, in particular the code for try_poll:
fn try_poll<I>(
        mut self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        poll: impl Fn(Pin<&mut T>, &mut Context<'_>) -> Poll<I>,
    ) -> Poll<Result<I, Aborted>> {
        // Check if the task has been aborted
        if self.is_aborted() {
            return Poll::Ready(Err(Aborted));
        }

        // attempt to complete the task
        if let Poll::Ready(x) = poll(self.as_mut().project().task, cx) {
            return Poll::Ready(Ok(x));
        }

        // Register to receive a wakeup if the task is aborted in the future
        self.inner.waker.register(cx.waker());

        // Check to see if the task was aborted between the first check and
        // registration.
        // Checking with `is_aborted` which uses `Relaxed` is sufficient because
        // `register` introduces an `AcqRel` barrier.
        if self.is_aborted() {
            return Poll::Ready(Err(Aborted));
        }

        Poll::Pending
    }

My understanding is that once abort is called, it will propagate to the downstream Futures in the sense that when the root Future is aborted, it will stop polling its child Future (because Poll::Ready(Err(Aborted)) will be returned), which will in turn stop polling its child. If this reasoning is true, then the effect of calling abort is immediate.
Another argument is that if Future is pull-based, the root node should be invoked first and then propagate to the sub tasks until the leaf one is invoked and aborted (and then go back to root). This means that there is a latency between when the abort method is called and when the leaf Future actually stops polling. Might be relevant, but this blogpost mentions dangling tasks, and I am concerned this is the case.
For example, here is a toy example that I wrote:
use futures::future::{AbortHandle, Abortable};
use tokio::{time::sleep};
use std::{time::{Duration, SystemTime}};

/*
 *       main
 *         \
 *       child
 *         | \
 *        |   \
 *    leaf1   leaf2
 */

async fn leaf2() {
    println!("This will not be printed")
}

async fn leaf1(s: String) {
    println!("[{:?}] ====== in a ======", SystemTime::now());
    for i in 0..100000 {
        println!("[{:?}] before sleep i is {}", SystemTime::now(), i);
        sleep(Duration::from_millis(1)).await;
        println!("[{:?}] {}! i is {}", SystemTime::now(), s.clone(), i);
    }
}

async fn child(s: String) {
    println!("[{:?}] ====== in child ======", SystemTime::now());
    leaf1(s.clone()).await;
    leaf2().await
}

#[tokio::main]
async fn main() {
    let (abort_handle, abort_registration) = AbortHandle::new_pair();
    let result_fut = Abortable::new(child(String::from("Hello")), abort_registration);

    tokio::spawn(async move {
        println!("{:?} ^^^^^ before sleep ^^^^^", SystemTime::now());
        sleep(Duration::from_millis(100)).await;
        println!("{:?} ^^^^^ after sleep, about to abort ^^^^^", SystemTime::now());
        abort_handle.abort();
        println!("{:?} ***** operation aborted *****", SystemTime::now());
    });

    println!("{:?} ====== before main sleeps ======", SystemTime::now());
    sleep(Duration::from_millis(5)).await;
    println!("{:?} ====== after main wakes up from sleep and now getting results \
            ======", SystemTime::now());
    result_fut.await.unwrap();
}

Rust playground
I am personally leaning more towards the first argument that there is no latency between abortion of the root and abortion of leaf because the leaf doesn't need to know it needs to abort (the leaf only pulls when root tells it to). The example above prints the time the child is executed and the time when the root is aborted. The execution of child is always before the root is aborted, but I am not sure if this can prove that my first argument is true, so I would like to know what y'all think!

A: Yes, because a future needs to polled to executed but it will not be polled if it is aborted, the child futures will not be polled either and therefore the execution will stop immediately.
Of course, execution will stop only after reaching the next yield point, and spawned tasks using tokio::spawn() will not stop.

A: *

*Dropping a Future type equals to drop all the states within that Future, including its child Futures. Remember Futures in Rust are all state machines. If you succeeded in safely dropping a Future's states, then it means the execution must have already been stopped before the drop, otherwise it is a data race.

*Specifically, dropping a tokio JoinHandle conceptually only drops the handle itself, but does nothing about the task that the handle represents. Or in other words, if you use tokio::spawn(), then whatever Future you throw into that task became unrelated to your current Future (except you can receive back a result from the JoinHandle and explicitly call abort). So they call tokio's tasks as detached by default.

*Let's talk about timing issues. For Abortable, it does not directly "drop" your Future. Instead, it "drops" in an indirect way. If you call AbortHandle::abort(), then immediately an atomic boolean flag is flipped and then a Waker::wake() is called, but the async executor would be unaware of this at this moment. The executor would still think your Abortable is either progressing or suspended at this moment. We should discuss them separately:

*

*The executor was still polling your Future at the time of the atomic boolean flip. Then according to the source code

*

*If this polling happens to be the one that completes the future, then the Abortable would return a completion.

*If this polling returns Pending in the end, then Abortable has a high chance of return an aborted error, small chance of going back into suspense, depending on when the atomic flag flip became observable to the thread of this polling.

If either a completion or an aborted error is returned, the Abortable as a Future would be considered as completed and eventually(*) get dropped. When it gets dropped, it would mean all its child Futures would have also been dropped.
If you happen to be coding in a very poor style and this polling happens to have touched a long computation / a blocking call, then unfortunately, everything else would have to wait however long for this poll to return, and the executor may be starved during the process.

*Your Future was suspended at the time of the atomic boolean flip. The Waker::wake() call tells the executor to poll this Abortable at least once sometime in the future. Some time later, the executor will finally decide to give your Abortable a poll. Then almost immediately the poll returns an aborted error. Then the same thing happens, your Abortable as a Future would be considered as completed and eventually get dropped.
In summary, no, the abort does not happen at the same time as the drop.
*: I'm not sure when the Future gets dropped after its completion. It would really depend on how Rust compiler transforms the .await point and I haven't looked into it yet.


text:
Q: copy field in schema of solr is not working This is schema.xml file implementation of copy field
<copyField source="UniversityName" dest="_text_"/>
<copyField source="UniversityName" dest="_text_"/>
<copyField source="UniversityLocation" dest="_text_" maxChars="256"/>
<copyField source="UniversityWebLink" dest="_text_" maxChars="256"/>
<copyField source="DegreeLink" dest="_text_" maxChars="256"/>
<copyField source="UniversityName" dest="_text_" maxChars="256"/>
<copyField source="DegreeName" dest="_text_" maxChars="256"/>
<copyField source="UniversityType" dest="_text_" maxChars="256"/>
<copyField source="ProgramType" dest="_text_" maxChars="256"/>
<copyField source="ProgramTypeLink" dest="_text_" maxChars="256"/>
<copyField source="ProgramCatagory" dest="_text_" maxChars="256"/>
<copyField source="FacultyName" dest="_text_" maxChars="256"/>
<copyField source="FacultyLink" dest="_text_" maxChars="256"/>
<copyField source="Email" dest="_text_" maxChars="256"/>
<copyField source="ContactPerson" dest="_text_" maxChars="256"/>

This is config.xml implementation of default search field
 <requestHandler name="/select" class="solr.SearchHandler">
<!-- default values for query parameters can be specified, these
     will be overridden by parameters in the request
  -->
<lst name="defaults">
  <str name="echoParams">explicit</str>
  <int name="rows">10</int>
  <!-- Default search field-->
     <str name="df">_text_</str>

I have modified scema.xml file and config file of my collection in solr. But the copy field is not working.why is it? what is the solution?
When I directly give the fieldname in config.xml file it is working.

A: Here is my checklist when this kind of problem occurs. Please check.

*

*Make sure you saved all the edited config files and reload core or restart server.

*Check whether source fields are having data or not?

*Then reindex your data and see you are getting results or not.

*Make sure the source field itself is not getting data from any other copyfield.
Because Solr will not support chaining. Here is a reference from Solr documentation.

Copying is done at the stream source level and no copy feeds into
  another copy. This means that copy fields cannot be chained i.e. you
  cannot copy from here to there and then from there to elsewhere.
  However, the same source field can be copied to multiple destination
  fields:

<copyField source="here" dest="there"/> <copyField source="here" dest="elsewhere"/>.

*If you like to see copied content on the destination field make the destination fields stored property value to true on schema.xml and reload core then index and see. It may help you to understand what exactly happens when using copyfield. In our case whether data is populated on dest field or not.

Hope this helps.
Thanks.


text:
Q: Absolute/outer and inner namespace confusion in C# using Foo.Uber;

namespace MyStuff.Foo
{
    class SomeClass{
        void DoStuff(){
            // I want to reference the outer "absolute" Foo.Uber
            // but the compiler thinks I'm refering to MyStuff.Foo.Uber
            var x = Foo.Uber.Bar();
        }
    }
}

How could I solve this? Just moving the using statement inside my namespace doesn't help.

A: You can actually specify the full path via the root namespace
var x = global::Foo.Uber.Bar();

Namespaces Overview
A namespace has the following
  properties:

*

*They organize large code projects.

*They are delimited with the . operator.

*The using directive means you do not need to specify the name of the
  namespace for every class.

*The global namespace is the "root" namespace: global::system
  will always refer to the .NET
  Framework namespace System.

I prefer this over aliases because when you read it, you know exactly what is going on. Aliases can be easy to misunderstand if you skip over the definition.

A: Alias the namespace in the using statement:
using ThatOuterFoo = Foo.Uber;
...
...
//Some time later...
var x = ThatOuterFoo.Bar();

A: You can use using alias directives
using Outer = Foo.Uber;

namespace MyStuff.Foo
{
    class SomeClass{
        void DoStuff(){
            var x = new Outer.Bar(); //outer class
        }
    }
}

A: You can do this using a namespace alias qualifier (typically global::) to refer to the default / root namespace:
global::Foo.Uber

A: Using Aliaseseseseseses
using Foo.Uber;
using FooUberBar = Foo.Uber.Bar

namespace MyStuff.Foo
{
    class SomeClass{
        void DoStuff(){
            // I want to reference the outer "absolute" Foo.Uber
            // but the compiler thinks I'm refering to MyStuff.Foo.Uber
            var x = FooUberBar();
        }
    }
}

A: You can assign an alias in your using directive as described on MSDN.


text:
Q: Cant move the menus in the header upwards to align with the logo Header with logo

*

*i want to align home, etc with the logo, but i think the logo is occupying all the space on top of the menu-headers and i dont know how to reduce it, i've already tried the margin-left or right and also padding but it doesnt help.
i also want to know if it is a bad practice to have negative CSS rules or if there is any bad practices in my code so far.
sorry for the bad english, i`m not a native

<!DOCTYPE html>

    <title>Heloisa Antoniely │ Makeup</title>
    <link rel="stylesheet" type="text/css" href="Makeup.css">
    <meta charset="UTF-8">
    <meta name="author" content="Thiago Marvin">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=STIX+Two+Math&display=swap" rel="stylesheet">

                    Home
                    Contato
                    Portfólio
                    Localização

body{
    background-color: #137B77;
    margin: 0;
    padding: 0;
}
header{
    background-color: #45a29e;
    margin: 0;
    padding:0;
    justify-content: baseline;
}
.center{
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 15%;
    vertical-align: middle;
    margin-bottom: -124px;
    margin-top: -65px;
}
.main-header{
    margin-top: 0px;
    margin-bottom: 62px;
}
.header-menus{
    padding-top: 0;
}
.header-menus ul li {
    list-style: none;
    color: #000000;
}
.header-menus ul li a{
    color: #000000;
    text-decoration:none;
    padding-left: 30px;
    font-size: 15px;
    line-height: 2.0;
    font-family: 'STIX Two Math', serif;
}

A: Give the logo a width of x px. That will give it a set size. You can do width=100% and make sure you style the container div as a inline-block or use flex-box in order to set its size straight.
.main-header {
    display: flex;
}
img {
    width: 100%;
}

That should make every element inside the header display on a row.
Look more into flex-box in order to understand it well. https://flexboxfroggy.com/ is a good resource.

A: You can use flexbox in main div which wraps logo and links
.main-header{
    margin-top: 0px;
    margin-bottom: 62px;
    display: flex;
    justify-content: center; //you can do also space-between or space-evenly
    align-items: center;
}

A: Since div elements are block elements, they take all available horizontal space of the parent element, i.e. a complete "line".
See https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
I would recommend using display: flex on the .main-header class. By default the child elements will be arranged in a row (flex-direction: row).
The align-items property can be used to arrange the elements vertically.
See https://css-tricks.com/snippets/css/a-guide-to-flexbox/

.main-header {
    display: flex;
    align-items: center;
}

Demo: https://jsfiddle.net/u3gv6s7f/


text:
Q: Getting the value from an array in the model in rails I have a relatively simple problem. I have a model named Item which I've added a status field. The status field will only have two options (Lost or Found). So I created the following array in my Item model:
STATUS = [ [1, "Lost"], [2, "Found"]]

In my form view I added the following code which works great:
<%= collection_select :item, :status, Item::STATUS, :first, :last, {:include_blank => 'Select status'}  %>

This stores the numeric id (1 or 2) of the status in the database. However, in my show view I can't figure out how to convert from the numeric id (again, 1 or 2) to the text equivalent of Lost or Found.
Any ideas on how to get this to work? Is there a better way to go about this?
Many thanks,
Tony

A: You can define a method in your Item model:
class Item < ActiveRecord::Base
  #
  def status_str
    Item::STATUS.assoc(status).last
  end
end

And use it:
item.status_str # => "Lost" (if status == 1)

Or you can check out enum_fu plugin:
class Item < ActiveRecord::Base
  #
  acts_as_enum :status, ["Lost", "Found"]
end

and then item.status gives you string value:
item.status # => "Lost"


text:
Q: What is the R-C Feedback to this FET? I'm studying this RF Power Amplifier and I'm curious about the drain-gate feedback shown as R3 and C6:

*

*What is the purpose of the R-C feedback?

*What is this mechanism known as?

A: That, for high open loop gain (e, g. very inductive), sets the voltage gain and lowers distortion.
Imagine a 50 ohm Rsource and that 500 ohm Rfeedback.
Maximum voltage gain is -10x.
=======================================
By the way, a resistive feedback will alter the S12 (S_param feedback gain/phase) and perhaps greatly alter the stability factors/circles.


text:
Q: how to get first text node while bypassing  and ? I want to get the first text node from a string but it may contain few tags like , and . I have tried it like this but it gives only login whereas it should give loginuser account
var s = $.trim('loginuser account

 Lorem ipsum dummy text

This is a new paragraph

Email

This is yet another text

');

if( $(s).find('*').andSelf().not('b,i').length > 1 ) {

   if( s.substring( 0, s.indexOf('<') ) != '') {
        alert(s.substring(0, s.indexOf('<')));
    } else {
        alert($(s).find('*:not(:empty)').first().text());
    }
}

check it on jsfiddle
Note:
This string will be dynamic, so write generic answer not specific to this text only.
More Information :
@Jeremy J Starcher! I just want to get the first non-empty text node of iframe being clicked. This node will include  or  and whatever is in between them like this:
hi my bold text is here // note the bold tags as it is

If only one element is clicked then its text is thrown but if there are more than then one elements selected then it must get the very first text node among all the nodes.

A: Kind of a brute method but you can take out all the tags you're expecting to occur in the first node and read until the start of the next tag like so:
text = text.replace(""," ");
text = text.replace(""," ");
text = text.replace(""," ");
text = text.replace(""," ");
text = text.replace(""," ");
text = text.replace(""," ");

text = text.substr(0, text.indexOf("<"));

A: I didn't fully follow the question, but if you are trying to extract the text from a DOM element, this may help:
  var getText = function (el) {
    var ret;
    var txt = [],
      i = 0;

    if (!el) {
      ret = "";
    } else if (el.nodeType === 3) {
      // No problem if it's a text node
      ret = el.nodeValue;
    } else {
      // If there is more to it, then let's gather it all.
      while (el.childNodes[i]) {
        txt[txt.length] = getText(el.childNodes[i]);
        i++;
      }
      // return the array as a string
      ret = txt.join("");
    }
    return ret;
  };


text:
Q: Estimote beacons vs real device I've been working for a while with ibeacons and for testing purposes I bought some devices from a company back in Hong Kong for a couple of bucks each. I wish I didn't... They kinda suck, I really understand why they cost so low.
Anyway since I could not come up with anything interesting I started playing with iPhones/iPads using a mocking app I created to turn them into ibeacons, and the result was way way better than the real hong-kong beacons. I also used the Estimote app to turn iPhones in live beacons and everything was fine.
I'm asking now, if you ever bought/used Estimote beacons, is there any difference between them and an iPhone/iPad broadcasting the signal? I mean, is a mocked iDevice always better than any beacon you can purchase (say for better hardware components)? Or are just the one I purchased to be sh*t?
Thanks

A: A properly built beacon that meets the specifications of the beacon format will work just as well or better than an iOS device transmitting as a beacon.  I have experience with dozens of different beacon vendors, so I can say this with confidence.
Dedicated hardware beacons are often configurable in ways that iOS devices transmitting as a beacon are not.  With the RadBeacon line from Radius Networks (my company), you can configure:

*

*The advertisement rate (from 1 Hz - 10 HZ.)  On iOS, transmission these are locked at 10 Hz and not changeable.

*The transmitter power (from ~5 meter range to ~50 meter range.)  Again on iOS, this is not configurable.  The transmission distance is around 40 meters.

*Different beacon advertisement formats like AltBeacon and Eddystone

One reason that cheap beacons are often poor quality is that they are often powered by a coin cell batter, and take shortcuts to save power.   They often advertise infrequently (say at 0.2 Hz instead of the recommended minimum of 1 Hz), which causes very inaccurate distance estimates, and random entry/exit events.
It is important to note that there are also a number of options for software beacon transmitters different platforms, some of which do allow you to have lots of configurability just like hardware beacons.  Locate for Android, for example, allows you all of the configuration options mentioned above.

*

*Locate (iOS)

*Locate (Android)

*MacBeacon (OSX)

*QuickBeacon (Windows)

Full Disclosure:  I am Chief Engineer at Radius Networks


text:
Q: Hue service dies every few minutes I have setup hue to use it to create oozie work flow on HDP2.0
I start Hue using /etc/init.d/hue start and I login to Hue webserver and work for a few minutes and then the server dies suddenly.
I have everything configured correctly, but I dont know why Hue service keeps crashing. Is Hue an unstable product ?
Where can I find the logs for the service while its running ?
sudo /etc/init.d/hue status
supervisor is stopped

A: Hue is used by hundred of organizations and is available in the main Hadoop distributions.
The root cause of the crash could be caused by an underlying Hadoop service. Could you check the Hue logs in order to know more? (default is /var/log/hue normally).
Which Hue version are you using? The latest one as today is 3.5. You should also post your logs / questions on the Hue user list which is pretty active.

A: The first thing to be checked is all the permission of the keytab hue.service.keytab indside /etc/security/keytabs.
They should be as follows:
-r--r----- 1 root      hadoop 340 Jun 17 03:29 hue.service.keytab.
Note :- The above keytab should not have the write permission.
Also kerberos section in hue.ini file which is located at /etc/hue/conf should be properly configured according to your need.


text:
Q: Values not updating on button click As a learning exercise I am trying to code a generic feedback application that counts the number of "good"(+1), "bad"(-1) and "neutral"(0) button clicks, the sum of their values, the average value and positive percentage.
Now I am noticing that the sum –— and only sum! –— value somehow lags one button click behind the events, as the first click, say, on "good" button would produce an average value of "NaN". I assume the sum is somehow still "zero". The rest of the values are being updated as expected.
Could anyone please explain what am I missing here? The App.js code is as follows:
import React, {useState} from 'react'

const Button = (props) => {
  return (
    <>
    <button onClick = {props.handleClick}>{props.text}</button>
  </>
  )
}

const App = () => {
  const [good, setGood] = useState(0)
  const [neutral, setNeutral] = useState(0)
  const [bad, setBad] = useState(0)

  const [all, setAll] = useState(0)
  const [sum, setSum] = useState(0)

  const [average, setAverage] = useState(0)
  const [positive, setPositive] = useState(0)

  const [history, setHistory] = useState([])

  const handleGoodClick = () => {
    setAll(all + 1)
    setSum(sum + 1)
    setGood(good + 1)

    setHistory(history.concat(1))
    setPositive(good / all)
    setAverage(sum / all)

  }

  const handleBadClick = () => {
    setAll(all + 1)
    setSum(sum - 1)
    setBad(bad + 1)

    setHistory(history.concat(-1))
    setPositive(good / all)
    setAverage(sum / all)
  }

  const handleNeutralClick = () => {
    setAll(all + 1)
    setNeutral(neutral + 1)

    setHistory(history.concat(0))
    setPositive(good / all)
    setAverage(sum / all)

  }

  return (
    <>

Give Feedback

      <Button handleClick = {handleGoodClick} text = {'good'}/>
      <Button handleClick = {handleNeutralClick} text = {'neutral'}/>
      <Button handleClick = {handleBadClick} text = {'bad'}/>

Statistics

Good: {good}

Neutral: {neutral}

Bad: {bad}

All: {all}

Average: {average}

Positive: {positive}

History: {history.join(' ')}

    </>
  )
}

export default App

A: Try to refactor into something like this:
  const [good, setGood] = useState(0)
  const [neutral, setNeutral] = useState(0)
  const [bad, setBad] = useState(0)

  const handleGoodClick = () => {
    setGood(good + 1)
  }

  const handleBadClick = () => {
    setBad(bad + 1)
  }

  const handleNeutralClick = () => {
    setNeutral(neutral + 1)
  }

  const all = good + bad + neutral;
  const positive = good / all;
  const sum = good - bad;
  const average = sum / all;

read this article for more details: https://kentcdodds.com/blog/dont-sync-state-derive-it


text:
Q: C++ inline initialize static function member I want to implement a member function as follows:
void X() {}

class Foo
{
    static void(*Bar)() = X;
};

This does not compile:

error: 'constexpr' needed for in-class initialization of static data member 'void (* Foo::Bar)()' of non-integral type

I know this is not legal. I have to either initialize Bar outside of the class scope or make it "inline static". The problem is that the latter is a C++17 feature and I must do with C++11 (BCC32X limitations). So my question is: Is there a way to do this on the same line? Maybe making it const? I know we can do this(Source)...
class Foo
{
    static int const i = 42;
}

But can we apply it to functions somehow?
PD: I know there are infinite solutions to my question all over SO, but up until now all I've seen end up relying on later C++ features not available to me.

A: Since C++11 you can use constexpr to initialize static members of non-integral/enumeration types in the class declaration.
As @paddy comments below, this makes Bar const so it would only be a viable solution if you don't plan to modify it, what you are not doing in the question's code.
[Demo]
#include <iostream>  // cout

void X() {
    std::cout << "Blah\n";
}

struct Foo {
    static constexpr void(*Bar)() = X;
};

int main() {
    Foo::Bar();
}


text:
Q: Mail() header "FROM: " не работает Всем привет, у меня есть функция:
public static function sendEmail($to, $theme, $body){
        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "From: Техническая поддержка <support@test.ru>\r\n";
        $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";

        mail($to, $theme, $body, $headers);
    }

И когда я отправляю к колонке от кого, всегд имя хостинга(к примеру: lastchtest_pr1_amhb@astral.beget.ru), и не подставляется знаение которое я указал в хедере, подскажите где у меня ошибка?
A: Почитайте это но повнимательнее!
Если читать совсем Лень то вот:
public static function sendEmail($to, $theme, $body){
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type:  text/html; charset=iso-8859-1\r\n";

    $headers .= "From: Техническая поддержка <support@test.ru>\r\n";
    mail($to, $theme, $body, $headers);
}


text:
Q: How does the size of an n-ball (of a graph) scale as a function of n for various centers of the ball Let $G$ be a connected locally finite graph with countably infinitely many vertices. Consider $B_n(v)$, the ball of radius $n$ centerd at vertex $v\in G$, that is, the set of all vertices that are a distance $n$ or less to $v$. I suspect that the way that the ball grows as $n$ increases should be independent of $v$. To be more precise, I suspect that if the function $f_v(n) := |B_n(v)| \in O(g(n))$, then so must $f_w(n) \in O(g(n))$ for any $w\in G$.
My reason for suspecting this is that, because the graph $G$ is assumed to be connected, we have a finite path between any two vertices $v$ and $w$. As $n$ grows, the balls of radius $n$ will overlap evermore, and thus the size of the balls should be similar.
I would like a proof/counter example of this claim, and if applicable, the name of the theorem.

A: If two vertices $v,w$ are at distance $d$, then $f_v(n) \ge f_w(n-d)$ and $f_w(n) \ge f_v(n-d)$. Whether this gets us what we want depends on how quickly these functions grow: can we say that $f_v(n) = O(f_v(n-d))$? That's true when the growth rate is at most exponential, which covers all graphs you typically encounter.
However, it's possible to write down functions that don't have this behavior. For example, if $f_v(n)$ grows like $2^{n^2}$, then it is not even true that $2^{n^2} = O(2^{(n-1)^2})$; there is a factor of $2^{2n-1}$ difference.
It's also possible to draw locally finite graphs where $f_v(n)$ will have this growth rate. Take a half-infinite path $v_1, v_2, v_3, \dots$ and let $w = v_1$ and $v = v_2$. Right now, we have $$f_v(n) = \begin{cases}1 & n=0 \\ n+2 & n \ge 1\end{cases}$$
But suppose we add $\ell_i$ leaves to $v_i$ for every $i \ge 3$. Then we will have $$
   f_v(n) = \begin{cases}1 & n=0 \\ 3 & n=1 \\ (n + 2) + \ell_3 + \dots + \ell_{n+1} & n\ge 2\end{cases}
$$
and it is easy to choose $\ell_3, \ell_4, \dots$ so that for all $n \ge 2$, $f_v(n) = 2^{n^2}$.
In this example, $f_w(n)$ will lag behind: its growth rate will be "merely" $O(2^{(n-1)^2})$. Even though it is always just one step behind $v$, that one step makes all the difference.


text:
Q: Two small non-normally distributed samples and one simple question A great newbie in statistics, I am. Begging for your help, I am.
So, I have two samples. The first one contains 19 mean preference scores (based on a series of twelve 0s and 1s) and the second one contains 20 mean preference scores. Clearly, they do not follow a normal distribution and that is why I read that I should do a Wilcoxon test instead of Student test. OK. But R tells me that I have many ties for this test. Even if it is not an error message, I do not like warning messages. Not at all. So I was wondering if I could trust that results. And also, what do you think about changing the ties by some randomly chosen very very closed values? Like changing 0.7 by a random value chosen between 0.6999 and 0.7001? Can it do the trick?
Here are my samples:
Treatment   MeanPrefScore   Treatment   MeanPrefScore
Quick       0.5             Long        0.571428571
Quick       0.9             Long        0.777777778
Quick       0.916666667     Long        0.333333333
Quick       1               Long        0.666666667
Quick       0.714285714     Long        1
Quick       0.4             Long        1
Quick       0.888888889     Long        0.777777778
Quick       0.857142857     Long        0.857142857
Quick       1               Long        0.916666667
Quick       1               Long        1
Quick       1               Long        0.75
Quick       0.916666667     Long        0.916666667
Quick       0.5             Long        1
Quick       0.909090909     Long        0.909090909
Quick       0.571428571     Long        0.8
Quick       0.909090909     Long        0.75
Quick       0.8             Long        1
Quick       0.5             Long        0.5
Quick       0.545454545     Long        0.916666667
Quick       0.777777778

Here is what R tells me:
Result1 <- wilcox.test(MeanPrefScore ~ Treatment, data = MeanPrefScore)
Warning message: In wilcox.test.default(x = c(0.571428571, 0.777777778, 0.333333333,  :
cannot compute exact p-value with ties

Result1
     Wilcoxon rank sum test with continuity correction
     data:  MeanPrefScore by Treatment
     W = 209, p-value = 0.6002
     alternative hypothesis: true location shift is not equal to 0

So any help, any explanation for a super simple quick to do test, would be infinitely appreciated!

A: I would not recommend modifying the data to eliminate ties.  I think the test result is fine as is. The message merely says that the exact p-value cannot be computed because of the ties.  But you do have an approximate p-value of 0.6002. This means the difference between the two mean preference scores is not statistically significant. Looking at the data this makes sense since in many cases the two results are exactly equal or nearly equal.

A: Thanks a lot for your help guys. Here is an answer a bit more detailed and also what I decided to do.
So, I have 2 treatments, one quick to learn called Quick and the other long to learn called Long.
My goal is to see if my treatment Long changes the number of individuals able to learn a given task.
I have 40 individuals in 8 groups, with 4 group per treatment and 5 individuals per group. Each group does 60 trials. I look at each individual every 5 trials. At the end of the test, I end up with a list of 12 values per individual. These values are a list of failure F and success S.
Then, I want to see if an individual is more likely than random to get a S, i.e. is 6 S out of 12 significantly different from random? Is 9 S out of 12 significantly different from random? Etc...
Here is an example of the beginning of my dataset:
Group          Treatment          ID          Trial          Score
G1             Quick              Ind1        1              F
G1             Quick              Ind1        2              F
...            ...                ...         ...            ...
G1             Quick              Ind1        7              F
...            ...                ...         ...            ...
G1             Quick              Ind1        12             S

An example of the middle of my dataset:
G3             Quick              Ind14       1              F
G3             Quick              Ind14       2              F
...            ...                ...         ...            ...
G3             Quick              Ind14       5              S
...            ...                ...         ...            ...
G3             Quick              Ind14       12             S

And an example of the end of my dataset:
G8             Long               Ind40       1              S
G8             Long               Ind40       2              F
...            ...                ...         ...            ...
G8             Long               Ind40       8              S
...            ...                ...         ...            ...
G8             Long               Ind40       12             S

Then in R, I calculated the number of S for each individual:
Group          Treatment          ID          S
G1             Quick              Ind1        4
G1             Quick              Ind2        8
...            ...                ...         ...
G6             Long               Ind26       9
G6             Long               Ind27       3
...            ...                ...         ...
G8             Long               Ind39       12
G8             Long               Ind40       11

Then I groped for the minimum number of S required to get a significant p-value using binom.test():
binom.test(1, 12, alternative = "greater")
binom.test(2, 12, alternative = "greater")
...
binom.test(10, 12, alternative = "greater")

I found that 10 S are required to get a significant p-value (p = 0.01929).
Then, I went back to my dataset summarizing the number of S of each individual. I found that 8 individuals have learned in the treatment Quick while 9 individuals have learned in the treatment Long.
I then did a chi squared table:
Observed values:
               Quick    Long    Total
Learned        8        9       17
Did not learn  12       10      22
Total          20       19      39

Theoretical values:
               Quick    Long    Total
Learned        8.7      8.3     17
Did not learn  11.3     10.7    22
Total          20       19      39

Now, I am wondering if it is correct to do a chi squared test in my case. I found online that I can do it if there is no cell value under 5 when I have a table with 1 degree of freedom (which is the case, right?). I also found 10. I read some things about a certain correction when cell values are between 5 and 10 but I did not understand well. I saw that a Fisher test is better in some cases. Basically, it is incredibly nebulous to me.
So please, I am begging your help. Enlighten me! :D


text:
Q: UIActivityIndicatorView Never Animates I have a PhotoViewController class with an @property UIActivityIndicatorView* spinner.  FlickrPhotoViewController is a subclass of PhotoViewController that downloads a photo from Flickr and tells the spinner when to start and stop animating.  'updatePhoto' is called every time the view controller is given a Flickr photo:
- (void)updatePhoto { // Download photo and set it
    NSLog("updatePhoto called");
    if (self.spinner) NSLog(@"Spinner exists in updatePhoto");
    dispatch_queue_t downloadQueue = dispatch_queue_create("downloader",
                                                           NULL);
    [self.spinner startAnimating];

    dispatch_async(downloadQueue, ^{
        // Download the photo
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.spinner stopAnimating];
            // Set the photo in the UI
            }
        });
    });
}

The above methodology is exactly what I use for displaying a spinning wheel in my table view controllers while the table contents download, and it always works there.
You will notice at the beginning of updatePhoto I print a message if the UIActivityIndicatorView exists.  I put a similar statement in awakeFromNib, viewDidLoad, and viewWillAppear.  When I run it, this is the exact output I get:
2013-01-31 21:30:55.211 FlickrExplorer[1878:c07] updatePhoto called
2013-01-31 21:30:55.222 FlickrExplorer[1878:c07] Spinner exists in viewDidLoad
2013-01-31 21:30:55.223 FlickrExplorer[1878:c07] Spinner exists in viewWillAppear

Why does spinner not exist in awakeFromNib?  Docs indicate that "When an object receives an awakeFromNib message, it is guaranteed to have all its outlet and action connections already established."  Can an IBOutlet be connected without the existence of the object it is connecting to?  In this case, can the spinner IBOutlet be connected to the storyboard without spinner being allocated?
Moving beyond this, I overrode the getter for spinner so that it would instantiate if it does not exist.  As a result, the printing output now looks like this:
2013-01-31 21:48:45.646 FlickrExplorer[2222:c07] Spinner exists in awakeFromNib
2013-01-31 21:48:45.647 FlickrExplorer[2222:c07] updatePhoto called
2013-01-31 21:48:45.647 FlickrExplorer[2222:c07] Spinner exists in updatePhoto
2013-01-31 21:48:45.649 FlickrExplorer[2222:c07] Spinner exists in viewDidLoad
2013-01-31 21:48:45.650 FlickrExplorer[2222:c07] Spinner exists in viewWillAppear

This is what I would have expected to see earlier.  Nevertheless, I still do not get any animation.
Possible problems that I have ruled out:

*

*The spinner is the same color as the background, making it invisible. In my project, the background is black and the spinner is white.

*I am attempting to animate the UIActivityIndicatorView while some expensive method is blocking the main thread.  In my project, all my file system I/O and downloading methods are called in a non-main dispatch_async queue.

*The spinner's IBOutlet is not hooked up.  In my project, I have double checked this numerous times.  It can be seen from both the storyboard and the PhotoViewController.h file that it is connected.

All three of these possibilities are ruled out by the fact that putting [self.spinner startAnimating]; in viewWillAppear makes it successfully animate throughout the download process.
You can download this project if you like. Just go to any screen that attempts to display a large photo and you will see that the spinner does not appear.  There are many problems with this project, but this is the one I am focusing on now.
Edit 1:

*

*I added the project's missing dependencies on Git, so the project will
now compile for you

Edit 2 (2 February 2013):

*

*I am seeing this problem only on the iPhone when the updatePhoto method is called due to another view controller's prepareForSegue setting the photo in the FlickrPhotoViewController.  Is it possible that this contributes to the problem?

A: Try to fire start animating uiactivityindictor before u call updatePoto method like this
Tru calling this iinstead of calling UpdatePhoto just all :
[self startAnimatingAndThenUpdatePhoto];

-(void)startAnimatingAndThenUpdatePhoto{
 if (self.spinner) NSLog(@"Spinner exists in updatePhoto");
  [self.spinner startAnimating];
 [self performSelector:@selector(updatePhoto) withObject:nil afterDelay:0.01];
}
 - (void)updatePhoto { // Download photo and set it
        NSLog("updatePhoto called");
        dispatch_queue_t downloadQueue = dispatch_queue_create("downloader",
                                                               NULL);

        dispatch_async(downloadQueue, ^{
            // Download the photo
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.spinner stopAnimating];
                // Set the photo in the UI
                }
            });
        });
    }

Not the best method in the world but it will do thejob


text:
Q: Rstudio freezes when clicking global options I've recently installed Rstudio 0.99.441 on Ubuntu 14.04. I have installed the latest version of R (3.20).
I want to change the background color of the console, but each time I press tools -> global options the programme freezes...Any suggestion?
I posted this question also on Rstudio support site, so if I get a solution I will post it here.
Then when I launch it from the terminal the program run without problems but I get a strange

output:umberto@R2:~$ rstudio
load glyph failed err=6 face=0x2574750, glyph=2793

when I close the program I get

QApplication::qAppName: Please instantiate the QApplication object first

A: I faced a similar problem(1. fonts of tab's title were blurred; 2.freezing when clicking global options) after installing texlive2015 in ubuntu 14.04. In order to access texlive fonts according to the link,
I used these 2 commands in shell (Rstudio is normal before these operation):
$ cd /etc/fonts/conf.d
$ sudo ln -s /usr/local/texlive/2015/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts 09-texlive.conf

After tring so many methods but invalid, Occasionally, I remove the file '09-texlive.conf', and refreshed:
$ sudo rm /etc/fonts/conf.d/09-texlive.conf
$ sudo fc-cache -fsv

It back! I'm not sure why, but I hope it could give some hint for anyone encounter such dilemma. :D


text:
Q: Swiftui expand Vstack to cover remaining space I have a login screen in which I want to cover VStack whole white space which is remaining. I have 2 Vstack If I give Spacer to second one its not working.
My code
struct loginView: View {
    @State private var stringOfTextField: String = String()

    var body: some View {
        ZStack {
            LinearGradient(colors: [Color("primarycolor"), Color("secondarycolor")],
                           startPoint: .top,
                           endPoint: .center).ignoresSafeArea()
            VStack() {

                Text("Login").foregroundColor(.white).font(
                    .system(size: 18)

                )

                Image("logo")
                Spacer()
            }
            VStack{
                TextField("Enter Email", text: $stringOfTextField)
                    .padding()
                    .overlay(RoundedRectangle(cornerRadius: 10.0).strokeBorder(Color.gray, style: StrokeStyle(lineWidth: 1.0)))
                    .padding(.bottom)

                TextField("Enter Password", text: $stringOfTextField)
                    .padding()
                    .overlay(RoundedRectangle(cornerRadius: 10.0).strokeBorder(Color.gray, style: StrokeStyle(lineWidth: 1.0)))
                    .padding(.bottom)

                Text("Forgot Password ?")
                    .frame(maxWidth: .infinity, alignment: .trailing)
                    .padding(.bottom)

                Button(action: {
                    print("sign up bin tapped")
                }) {
                    Text("SIGN IN")
                        .frame(minWidth: 0, maxWidth: .infinity)
                        .font(.system(size: 18))
                        .padding()
                        .foregroundColor(.white)
                        .overlay(
                            RoundedRectangle(cornerRadius: 10)
                                .stroke(Color("secondarycolor"), lineWidth: 1)
                        )
                }
                .background(Color("secondarycolor"))
                .cornerRadius(25)

            }
            .padding(.vertical, 60)
            .padding(.horizontal, 20)
            .background(Color.white)
            .cornerRadius(30)

        }

    }
}

I try to add spacer in Vstack But its not working maybe due to Zstack. Its going on top if I give Spacer() to VStack

A: I think I understood what you are trying to achieve, just please next time post a complete minimal reproducible example, replacing the custom colours and images.
You can keep the logo visible and cover the bottom area with 4 changes:

*

*Wrap your current VStack with a new one; you need this to add a Spacer() that will keep the logo visible.

*Add a Spacer() at the top of the new VStack, right before the existing one

*Add a Spacer() at the bottom of the existing VStack

*Add the .ignoreSafeArea() modifier to the ZStack
Here's the code:
ZStack {
    LinearGradient(colors: [.primary, .secondary],
                   startPoint: .top,
                   endPoint: .center).ignoresSafeArea()
    VStack() {

        Text("Login").foregroundColor(.white).font(
        // ... rest of the code
    }

    // 1) New VStack around the first one
    VStack {

        // 2) Spacer() before the existing VStack with minimum length, to keep the logo visible
        Spacer(minLength: 200)

        VStack{

            TextField("Enter Email", text: $stringOfTextField)

            // ... rest of the code

            .cornerRadius(25)

            // 3) New Spacer() at the bottom of the existing VStack
            Spacer()
        }
        .padding(.vertical, 60)
        .padding(.horizontal, 20)
        .background(Color.white)
        .cornerRadius(30)
    }

}

// 4) Add this modifier to the ZStack
.ignoresSafeArea(edges: [.bottom])


text:
Q: Create a jar with only one main class and only its dependecies I have a Java that contains many main classes. I want to create a Jar with only one main class and only its dependencies. I want only the code of the main class and dependencies to be included in the jar. I use Maven to make my jar.

A: The maven way is to have maybe one parent project, and for every application one module project. Every single application project has one Main-Class specified in the META-IBF/MANIFEST.MF, and separate minimal dependencies. Probably need to have one or more library project for internal dependencies.
/all
    /lib-a
        pom.xml --> lib-a-0.1-SNAPSHOT.jar
    /lib-b
        pom.xml --> lib-b-0.1-SNAPSHOT.jar
    /app-m
        pom.xml --> app-m-0.1-SNAPSHOT.jar
    /app-n
        pom.xml --> app-n-0.1-SNAPSHOT.jar
    ...
    pom.xml --> all-src-0.1-SNAPSHOT.zip
            --> all-0.1-SNAPSHOT.jar

The applications generate a manifest with a Main-Class: ... entry.
The dependencies are defined per application.
You might have the idea of having just one project, and a smart maven plugin that handles local dependencies, but why.
You could keep all sources in one project, say generating as artifact a zip with sources.
And every application project could take a specific list of sources from the zip. Hard.
If you indeed want something very customized, I think going back to ant + ivy would be more effective.


text:
Q: is n! = $\theta((n+1!))$ Asymptotic notation I had a doubt whether n!=$\theta{(n+1)!}$.
In my opinion, it should be correct, as there must surely exist values for $c_1$, $c_2$ such that the definition for asymptotic notation is satisfied.
But my assignment solution simply says that it's not so and doesn't provide any explanation. I tried searching through the web, but to no avail.
Is my solution correct? And if not, what am I missing, which has led to the wrong answer?
Thanks in advance!


text:
Q: Using High Charts with PHP and MySQL I am looking into using High Charts, but I want to populate the data dynamically with PHP and MySQL.
Looking for an easy way to get data from the DB into the jQuery functions.
This is how the points are created with jQuery (sorry for the big chunk of code).

A: The Highcharts documentation is excellent, I would start there. This is likely the type of graph you want:
http://www.highcharts.com/demo/dynamic-update
And you want to mess with the Point object:
http://www.highcharts.com/ref/#point-object
You are going to want to add the data using jQuery .post or .get commands to get the data from the server.


text:
Q: transform guid to string for sas put statement The following code should print a guid to the log:
%let test = %sysfunc(uuidgen());

data _null_;
 put &test.;
run;

For some reasons the put line fails. Any ideas? Thanks!

A: You forgot the %:
%put &test.;

A: The put statement in the datastep prints either variables or a string literals.
In your case you have a value within a macro variable that you would like the put statement to interpret as a string literal.  You can do this by wrapping it in quotes:
data _null_;
  put "&test";
run;

If you want to use the macro %put statement.  You can just replace the whole datastep with:
%put &test;


text:
Q: Disabling certificate revocation checks in Mule I am having an issue where service calls that I am making cannot validate server certificates presented by the TMG as part of connecting to the service. The certificate URLS from the TMG address are not reachable from the target servers. This is causing 30 second timeouts for new connections.
Is there a way to disable certificate revocation checks in Mule to avoid this issue?

A: If you're talking about Mule HTTP endpoints, then this would vary, if you're using http transport you can create a custom message dispatcher and allow http client to ignore the certificates, otherwise you can manually install the certificates in the keystore so you don't get SSL errors.


text:
Q: Python Turtle - Issue with custom shape in Snake program I have a python program using turtle to make the game "Snake". It is fully functional. At this point I'm adding in .gif images to spruce it up.
The problem arises when I'm trying to use a custom shape as the head of the snake. If I use a basic shape from turtle like "triangle" or "arrow" it works fine. It turns correctly and is printed over the first body segment as intended. When I change it to my custom image, the problem is that it is printed out under the first body segment and cannot turn.
Sample of controls
    if direction == "up":
        if snake_direction != "down":
            snake_direction = "up"
            head_stamper.setheading(90)

Stampers used to make numerous sections, and a head over the first segment.
        for segment in snake:
            stamper.goto(segment[0], segment[1]) #These are the body segments, they work fine.
            stamper.stamp()
            head_stamper.goto(new_head)

Showing both stampers here.
# Stamper for each body section
stamper = turtle.Turtle()
stamper.shape(bod_segment)
stamper.shapesize(25 / 20)
stamper.penup()

# Special stamper just for the snake's head.
head_stamper = turtle.Turtle()
# head_stamper has no issues when I make the shape "arrow" or "triangle", etc.
head_stamper.shape(head_segment)
stamper.shapesize(25 / 20)
head_stamper.penup()

I think this is all the code relevant to the problem.

A:
When I change it to my custom image, the problem is that it is printed
out under the first body segment and cannot turn.

As far as not turning, this is addressed in the Python turtle documentation of register_shape() aka addshape():

Note: Image shapes do not rotate when turning the turtle, so they do
not display the heading of the turtle!

As far as the overlap problem, I can only guess.  Generally the rule in turtle is the last thing that moved is on top.  So turning your generic head shape lands it on top, but since your image shape doesn't actually turn, it winds up on the bottom.  Again, just a guess.