Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- URL



  Get hostname from a URL using JavaScript

Sometimes we may have strings which contain some UR;s and we may want to retrieve the hostname from the URLs for some statistic use. For example, we may have a URL : http://www.example.com/aboutus.html. We may want to retrieve the www.example.com from the URL. How? Use regular expression. Here I give an example using JavaScript. If you want to check whether a string is a URL or not. Refer to Detect URLs in a Block of Text. In JavaScript, we can have a regular expression like var pattern=/(.+:\/\...

   JavaScript,URL,regular expression, Hostname     2012-06-15 09:16:45

  Create tweet without explicitly showing the link URL

When crafting a tweet, there are instances where we may wish to include a link, but we prefer the preview to be shown without displaying the URL explicitly after the tweet is published. How can we accomplish this? This article outlines the steps to achieve it. To begin, copy and paste the link you want to share into the tweet box. After clicking Post, the tweet will be published without displaying the link; instead, it will showcase the page preview, and clicking on the preview image will open ...

   TWEET,LINK URL,X,PREVIEW     2024-01-23 08:06:46

  Java code to retrieve Bing background image path

When Microsoft presented their search engine Bing, this new design gave us some surprise, especially its background images, they are very beautiful and it will change every day. But   unfortunately we cannot save the image onto our PC by right clicking the mouse.  After some research on its source code, I found a feasible but not so sophisticated way to achieve this, we can retrieve the image path from the source code and then use this path we can download the image. This is just to sh...

   Java,Bing,Background image path,URL,Download,Save     2012-05-02 10:51:51

  An alternative way to parse URL in JavaScript

Normally when we need to process URL in JavaScript, we may use the location object. Then we can use location.hostname,location.href,location.port etc to get the information we need. In this post, we will parse an URL with an alternative way. We can use an URL to create a DOM object by calling document.createElement("a"). The complete code is: function parseURL(url) { var a = document.createElement('a'); a.href = url; return { source: url, protocol: a.protocol.replace(':',''), host: a.ho...

   URL,location,parse     2014-03-03 07:05:11

  Sending message to Slack Incoming Webhook using PHP

Slack is a popular work collaboration tool and it provides many features which help teams collaborate. It has one function which allows sending messages to channels from external source such as your own web service -- Incoming Webhook. This is extremely useful when want to monitor something and get notified when some event occurs and it doesn't require complicated setup. To send messages using Incoming Webhook, a service URL has to be generated on Slack and then the message can be posted to this...

   PHP,CURL,SLACK,INCOMING WEBHOOK     2017-03-11 21:32:28

  About short URL and its implementation

IntroductionURL shortening is a kind of technique to convert a long URL to a short URL. There are many companies now providing this kind of service, we now take Google's URL shortener service http://goo.gl/ as an example.First we navigate to http://goo.gl/, then we enter a random URL into the text field, here we use http://www.url-to-be-shortened.com as the input, it will return us an shortened URL : http://goo.gl/ZSVMM. URL ParsingWhen we type http://goo.gl/ZSVMM in browser address bar, the DNS...

       2012-07-02 07:15:09

  Crash your Chrome with %%30%30

Have you ever wondered a simple string can crash one of the most sophisticated designed web browsers -- Chrome? There is a finding from Andris Atteka who found that a null string "%%30%30" appended to an URL can crash Chrome. For example, if you have below URL in your browser address bar or you mouse over below URL, Chrome will crash: http://www.pixelstech.net/%%30%30 When the browser crashed, it may show : Or on Windows, you will see : This bug has been reported to Google at Is...

   CRASH,SECURITY,CHROME,GOOGLE     2015-09-20 08:24:16

  Fix could not read Username for 'https://xxx.com': terminal prompts disabled

Recently was working on a project which needed to build a docker image, but unfortunately it kept failing as below error was seen. fatal: could not read Username for 'https://xxx.com': terminal prompts disabled Based on the error, it looked like it was trying to pull code from remote Gitlab repository but failed as the terminal prompt is disabled. At first glance, have a doubt why it needs terminal prompt to be enabled? It should just succeed and without prompting for anything. The only reason...

   GIT,TERMINAL PROMPTS DISABLED,DOCKER     2020-12-13 04:43:12

  Source code for sharing webpage to facebook

Copy and paste the following code blocks into your site and replace '<url>' with the link you want to Share.Text link:<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank...

   Source code,Facebook,Share,Webpage     2011-07-23 06:52:07

  Different ways to pass query parameters in EmberJS

In EmberJS, one could pass query parameters when retrieving resources with store.query() method. But what if there is a requirement that one wants to pass query parameters when calling store.findRecord()? Or there is a requirement that one wants to pass query parameters to a relationship when calling model.get('hasManyAttribute') in a RESTful style? In this post, we will explain how these can be achieved. In the store.query() case, one could easily pass the query parameters by passing ...

   RELATIONSHIP,EMBERJS,QUERY PARAMETERS     2018-05-18 10:47:56