Explore all Web Site open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Web Site

open-event-wsgen

Release v3.1.0 🌈

overmind

v2021-06-27_0907

talebook

siteaudit

Release v2.1.1

calibre-webserver

v2.0.0 ( re-design )

Popular Libraries in Web Site

website

by CodingTrain doticonjavascriptdoticon

star image 5502 doticonMIT

The train engine powering the Coding Train website

itty-bitty

by alcor doticonshelldoticon

star image 3164 doticonMIT

Itty.bitty is a tool to create links that contain small sites

pinax

by pinax doticonpythondoticon

star image 2601 doticon

a Django-based platform for rapidly developing websites

clippy.js

by smore-inc doticonjavascriptdoticon

star image 2600 doticonNOASSERTION

Add Clippy or his friends to any website for instant nostalgia.

open-event-wsgen

by fossasia doticonjavascriptdoticon

star image 1985 doticonNOASSERTION

Open Event Website App Generator https://open-event-wsgen.herokuapp.com http://sched.eventyay.com

mustache.github.com

by mustache doticonjavascriptdoticon

star image 1883 doticonNOASSERTION

The {{official}} website

WebStack-Laravel

by hui-ho doticonphpdoticon

star image 1742 doticonMIT

一个开源的网址导航网站项目,您可以拿来制作自己的网址导航。

gci16.fossasia.org

by fossasia doticonhtmldoticon

star image 1534 doticonGPL-3.0

FOSSASIA Google Code-In Website 2016/17 http://gci16.fossasia.org

labs.fossasia.org

by fossasia doticoncssdoticon

star image 1532 doticon

Projects Website for FOSSASIA http://labs.fossasia.org

Trending New libraries in Web Site

fruitionsite

by stephenou doticonjavascriptdoticon

star image 719 doticonMIT

Build your website with Notion for free

Compilation of Resources from TCM's Practical Ethical Hacking Udemy Course

Website

by thenewboston-developers doticontypescriptdoticon

star image 599 doticonMIT

The website and documentation for thenewboston.

staythefuckhome

by flore2003 doticonhtmldoticon

star image 414 doticon

The #StayTheFuckHome Website

headers-css

by shadeed doticonhtmldoticon

star image 277 doticon

The blueprint HTML and CSS for 17+ website headers

signum

by nightborn-be doticontypescriptdoticon

star image 276 doticon

Generate leads through your website with our open source solution.

1mb-club

by bradleytaunt doticonhtmldoticon

star image 217 doticon

An exclusive members-only club for web pages weighing less than 1 megabyte

webapp-manager

by linuxmint doticonpythondoticon

star image 209 doticonGPL-3.0

bwb

by shbwb doticoncssdoticon

star image 170 doticonMIT

A basic webpage builder

Top Authors in Web Site

1

mozilla

12 Libraries

star icon453

2

fossasia

12 Libraries

star icon15973

3

canonical-web-and-design

10 Libraries

star icon64

4

sindresorhus

7 Libraries

star icon1038

5

GSA

7 Libraries

star icon77

6

AliMD

6 Libraries

star icon28

7

codeforamerica

6 Libraries

star icon61

8

mattmacneil

6 Libraries

star icon12

9

reysantana

5 Libraries

star icon10

10

MAGGIx1404

5 Libraries

star icon12

1

12 Libraries

star icon453

2

12 Libraries

star icon15973

4

7 Libraries

star icon1038

5

7 Libraries

star icon77

6

6 Libraries

star icon28

7

6 Libraries

star icon61

8

6 Libraries

star icon12

9

5 Libraries

star icon10

10

5 Libraries

star icon12

Trending Kits in Web Site

No Trending Kits are available at this moment for Web Site

Trending Discussions on Web Site

Create new color scheme for dark-light mode in bootstrap sass

The "(optional)" marker in cppreference.com documentation

Why does this footer element just disappear when it has fixed positioning?

How to store text of tag "a" of a div in an arrray

Is there any way we can use flex instead of float to keep the boxes right and left in between the content?

Error 400: redirect_uri_mismatch trying to access Google Drive

Azure App Service .net6 Deploy - Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'

How to access XML data with Coldfusion

How do you make your check constraint case insensitive in SQL?

Can I leave away an association class for many to many relations?

QUESTION

Create new color scheme for dark-light mode in bootstrap sass

Asked 2022-Jan-16 at 19:50

I want to create dark mode for a web site which use bootstrap. I have to add new root class which includes all boostrap colors. Here is my colors.scss:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  "brd-default": $body-color
11  );
12  
13

I want create new class like this:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  "brd-default": $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19

So how can i copy and paste all bootstrap colors for new color scheme?

If i can add colors, i will change HTML class so my root(color scheme) will be:

enter image description here

in my styles.scss:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  "brd-default": $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19@import "./colors";// custom colors
20@import "bootstrap/scss/functions";
21@import "bootstrap/scss/variables";
22@import "bootstrap/scss/utilities";
23

ANSWER

Answered 2021-Aug-07 at 20:32

As explained here, there's no way to attach a class to :root. However, you don't need this to achieve what you want.

Simply make a dark class then you can add that as desired to the html or body tag.

Make all the needed theme color changes inside .dark{}, and then @import "bootstrap". When .dark doesn't exist on the body, the theme colors will return to Bootstrap defaults.

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  "brd-default": $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19@import "./colors";// custom colors
20@import "bootstrap/scss/functions";
21@import "bootstrap/scss/variables";
22@import "bootstrap/scss/utilities";
23@import "functions";
24@import "variables";
25@import "mixins";
26
27
28.dark {
29
30    /* redefine theme colors for dark theme */
31    $primary: #012345;
32    $secondary: #111111;
33    $success: #222222;
34    $dark: #000;
35    
36    $theme-colors: (
37        "primary": $primary,
38        "secondary": $secondary,
39        "success": $success,
40        "danger": $danger,
41        "info": $indigo,
42        "dark": $dark,
43        "light": $light,
44    );
45
46    /* redefine theme color variables */
47    @each $color, $value in $theme-colors {
48        --#{$variable-prefix}#{$color}: #{$value};
49    }
50
51    /* redefine theme color rgb vars (used for bg- colors) */
52    $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
53    @each $color, $value in $theme-colors-rgb {
54        --#{$variable-prefix}#{$color}-rgb: #{$value};
55    }
56
57    $body-color: #eeeeee;
58    $body-bg: #263C5C;
59    
60    --#{$variable-prefix}body-color: #{$body-color};
61    --#{$variable-prefix}body-bg: #{$body-bg};
62      
63    @import "bootstrap";
64}
65
66

Source https://stackoverflow.com/questions/68667437

QUESTION

The "(optional)" marker in cppreference.com documentation

Asked 2022-Jan-04 at 14:27

Last week, I had a discussion with a colleague in understanding the documentation of C++ features on cppreference.com. We had a look at the documentation of the parameter packs, in particular the meaning of the (optional) marker:

Enter image description here

(Another example can be found here.)

I thought it means that this part of the syntax is optional. Meaning I can omit this part in the syntax, but it is always required to be supported by the compiler to comply with the C++ standard. But he stated that it means that it is optional in the standard and that a compiler does not need to support this feature to comply to the standard. Which is it? Both of these explanations make sense to me.

I couldn't find any kind of explanation on the cppreference web site. I also tried to google it but always landed at std::optional...

ANSWER

Answered 2021-Aug-21 at 20:22

It means that particular token is optional. For instance both these declarations work:

1template <class... Args>
2void foo();
3
4template <class...>
5void bar();
6

Source https://stackoverflow.com/questions/68876460

QUESTION

Why does this footer element just disappear when it has fixed positioning?

Asked 2022-Jan-02 at 08:12

I'm experimenting with CSS in a codecademy project, and I noticed that when I set a footer to have fixed positioning (with no left/right/top/bottom properties set), it just disappears. I would expect it to just shrink the way it does with absolute positioning, but it doesn't. Without fixed positioning the footer is there where it should be, but with it, it's gone. Why is it behaving this way?

The footer in question is selected in the CSS in the footer ruleset.

Here's the codepen: https://codepen.io/megas4ever/pen/ExwEEzv

And here's the full code:

1    <!DOCTYPE html>
2    <html>
3      
4      <head>
5        <link href='https://fonts.googleapis.com/css?family=Raleway:400, 600' rel='stylesheet' type='text/css'>
6        <link href='style.css' rel='stylesheet' type='text/css'/>
7<style>  
8
9html, body {
10      margin: 0;
11      padding: 0;
12    }
13    
14    header {
15      background-color: #333333;
16      position: fixed;
17      top: 0;
18      width: 100%;
19      z-index: 1;
20    }
21    
22    nav {
23      margin: 0;
24      padding: 20px 0;
25    }
26    
27    nav li {
28      display: inline-block;
29      width: 80px;
30      color: #fff;
31      font-family: 'Raleway', sans-serif;
32      font-weight: 600;
33      font-size: 12px;
34    }
35    
36    main {
37      text-align: center;
38      position: relative;
39      top: 80px;
40    }
41    
42    main h1 {
43      color: #333;
44      font-family: 'Raleway', sans-serif;
45      font-weight: 600;
46      font-size: 70px;
47      margin-top: 0px;
48      padding-top: 80px;
49      margin-bottom: 80px;
50      text-transform: uppercase;
51    }
52    
53    footer {
54      background-color: #333;
55      color: #fff;
56      padding: 30px 0;
57      position: fixed;
58    }
59    
60    footer p {
61      font-family: 'Raleway', sans-serif;
62      text-transform: uppercase;
63      font-size: 11px;
64    }
65    
66    .container {
67      max-width: 940px;
68      margin: 0 auto;
69      padding: 0 10px;
70      text-align: center;
71    }
72    
73    .jumbotron {
74      height: 800px;
75      background-image: url("https://content.codecademy.com/projects/broadway/bg.jpg");
76      -webkit-background-size: cover;
77      -moz-background-size: cover;
78      -o-background-size: cover;
79      background-size: cover;
80    }
81    
82    .btn-main {
83      background-color: #333;
84      color: #fff;
85      font-family: 'Raleway', sans-serif;
86      font-weight: 600;
87      font-size: 18px;
88      letter-spacing: 1.3px;
89      padding: 16px 40px;
90      text-decoration: none;
91      text-transform: uppercase;
92    }
93    
94    .btn-default {
95      font-family: 'Raleway', sans-serif;
96      font-weight: 600;
97      font-size: 10px;
98      letter-spacing: 1.3px;
99      padding: 10px 20px;
100      text-decoration: none;
101      text-transform: uppercase;  
102      margin-bottom: 20px;      
103    }
104    
105    .supporting {
106      padding-top: 80px;
107      padding-bottom: 100px;
108    }
109    
110    .supporting .col {
111      font-family: 'Raleway', sans-serif;
112      text-align: center;
113      display: inline-block;
114      width: 200px;
115      height: 200px;
116    }
117    
118    .supporting img {
119      height: 32px;
120    }
121    
122    .supporting h2 {
123      font-weight: 600;
124      font-size: 23px;
125      text-transform: uppercase;
126    }
127    
128    .supporting p {
129      font-weight: 400;
130      font-size: 14px;
131      line-height: 20px;
132      padding: 0 20px;
133      margin-bottom: 20px;
134    }
135    
136    .supporting a {
137      background-color: white;
138      color: #333333;
139      font-family: 'Raleway', sans-serif;
140      font-weight: 600;
141      font-size: 12px;
142      letter-spacing: 1.3px;
143      text-decoration: none;
144      text-transform: uppercase;
145      padding: 10px;
146      margin-bottom: 10px;
147      border: 2px solid #333333; 
148    }
149    
150    @media (max-width: 500px) {
151      main h1 {
152        font-size: 50px;
153        padding: 0 40px;
154      }
155    
156      .supporting .col {
157        width: 100%;
158      }
159    }
160
161</style>
162      </head>
163    
164      <body>
165        
166        <header>
167            <nav>
168              <ul>
169                <li> About </li> <li> Work </li> <li> Team </li> <li> Contact </li>
170              </ul>
171            </nav>
172        </header>
173    
174        <main>
175          <div class="jumbotron">
176            <div class="container">  
177              <h1>We are Broadway</h1>
178              <a href="#" class="btn-main"> Get Started </a>
179            </div>
180          </div>
181        </main>
182    
183        <section class="supporting">
184          <div class="container">
185            
186            <div class="col">
187              <img src="https://content.codecademy.com/projects/broadway/design.svg">
188              <h2>Design</h2>
189              <p>Make your projects look great and interact beautifully.</p>
190              <a href="#"> Learn More</a><br>
191            </div>
192            
193            <div class="col">
194              <img src="https://content.codecademy.com/projects/broadway/develop.svg">
195              <h2>Develop</h2>
196              <p>Use modern tools to turn your design into a web site</p>
197              <a href="#"> Learn More</a><br>
198            </div>
199            
200            <div class="col">
201              <img src="https://content.codecademy.com/projects/broadway/deploy.svg">
202              <h2>Deploy</h2>
203              <p>Use modern tools to turn your design into a web site</p>
204              <a href="#"> Learn More</a><br>
205            </div>
206            
207          </div>
208        </section>
209    
210        <footer>
211          <div class="container">
212            <p>© Broadway 2017</p>
213          </div>
214        </footer>
215        
216      </body>
217    </html>
218

ANSWER

Answered 2022-Jan-02 at 04:55

Well, you've kind of hinted at the problem yourself already.

I noticed that when I set a footer to have fixed positioning (with no left/right/top/bottom properties set), it just disappears.

Just because you haven't provided left/right/top/bottom properties, doesn't mean they are not in effect.

In this case, the default values (which most likely reflect the effective top/left values with the default position: static) are just not ideal.

Since the footer takes up the full width of the screen, the left value likely defaults to 0; this is fine and that's not the source of the problem. But, since the footer is located on the bottom of your site, its auto/default top value max well be like 2000px -> you have to scroll down to even be able to see it.

Once you enabled fixed positioning, and didn't provide any top value yourself, that number would still be top: 2000px. And since it's now fixed in place, scrolling has no effect on it, which means its permanently located outside of your viewport. If your browser window was to be >2000px high, you would be able to see it, just hovering along by itself way below the rest of the site.

Source https://stackoverflow.com/questions/70553619

QUESTION

How to store text of tag "a" of a div in an arrray

Asked 2021-Dec-24 at 16:07

I'm working on API, which extracts data from a web site. and the website is like - >

1<div id="mainContainer">
2<a class="item">text1</a>
3<a class="item">text2</a>
4<a class="item">text3</a>
5<a class="item">text4</a>
6<a class="item">text5</a>
7</div>
8

I want to store all text in an object like {"item1":"text1","item2":"text2"......}; here is what I'm doing

1<div id="mainContainer">
2<a class="item">text1</a>
3<a class="item">text2</a>
4<a class="item">text3</a>
5<a class="item">text4</a>
6<a class="item">text5</a>
7</div>
8var prediction = $('#mainContainer > item');
9console.log(prediction);
10

output

1<div id="mainContainer">
2<a class="item">text1</a>
3<a class="item">text2</a>
4<a class="item">text3</a>
5<a class="item">text4</a>
6<a class="item">text5</a>
7</div>
8var prediction = $('#mainContainer > item');
9console.log(prediction);
10<a class="item">text1</a><a class="item">text2</a><a class="item">text3</a>....
11

How do I do it ??

ANSWER

Answered 2021-Dec-24 at 11:07

You can create an object and then populate it with an each

1<div id="mainContainer">
2<a class="item">text1</a>
3<a class="item">text2</a>
4<a class="item">text3</a>
5<a class="item">text4</a>
6<a class="item">text5</a>
7</div>
8var prediction = $('#mainContainer > item');
9console.log(prediction);
10<a class="item">text1</a><a class="item">text2</a><a class="item">text3</a>....
11values = {};
12$('#mainContainer a.item').each((i,x) => values['item'+(i+1)] = $(x).text())
13

Source https://stackoverflow.com/questions/70471234

QUESTION

Is there any way we can use flex instead of float to keep the boxes right and left in between the content?

Asked 2021-Dec-08 at 08:53

I want to create a UI something like this example image by using flex and without negative margin -

enter image description here

The challenge is that I have used float and negative margin to create the same layout. But I don't want to use a negative value to set the green div outside the content. Also, I have used the float to keep the contents around the green boxes. But I want to use flex instead of float.

So, to summarize my question - Create a reference layout that will not use any float or negative value to align the boxes in green.

I have added the code snapshot here to take a look at my HTML and CSS.

Any help would be appreciated. Thanks in Advance.

1.container {
2  width: 50%;
3  text-align: justify;
4  margin: auto;
5}
6
7.box {
8  background-color: green;
9  width: 20%;
10  padding: 15px;
11  margin: 15px;
12}
13
14.right {
15  float: right;
16  margin-right: 0 !important;
17  margin-right: -15% !important;
18}
19
20.left {
21  float: left;
22  margin-left: 0 !important;
23  margin-left: -15% !important;
24}
1.container {
2  width: 50%;
3  text-align: justify;
4  margin: auto;
5}
6
7.box {
8  background-color: green;
9  width: 20%;
10  padding: 15px;
11  margin: 15px;
12}
13
14.right {
15  float: right;
16  margin-right: 0 !important;
17  margin-right: -15% !important;
18}
19
20.left {
21  float: left;
22  margin-left: 0 !important;
23  margin-left: -15% !important;
24}<div class="container">
25  <div class="paragrah">
26    electronictypesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheetscontainingLorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker includingversionsof Lorem
27    Ipsum. It is a long established fact that a reader will be distracted by the readable content of apage
28
29    <div class="box right"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque porttitor aliquet leo, et suscipit nulla sodales at. Praesent dictum imperdiet lacus nec pharetra.
30    </div>
31
32    when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distributionofletters, as opposed to using 'Content here, content here', making it look like readable English. Manydesktoppublishing packages and web page
33    editors now use Lorem Ipsum as their default model text, and a search for'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over theyears,sometimes by accident, sometimes on purpose (injected humour and
34    the like).Contrary to popular belief, Lorem Ipsum is not simply random text. Ithasroots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. RichardMcClintock, aLatin professor at Hampden-Sydney College in Virginia,
35    looked up one of the more obscure Latin words,consectetur,from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered theundoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus
36    Bonorum et Malorum"(TheExtremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics,verypopular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from alineinsection
37    1.10.32. There are many variations of passages of Lorem Ipsum available, but the majority havesufferedalteration in some form, by injected humour, or randomised words which don't look even slightly believable.Ifyou
38
39    <div class="box left"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque porttitor aliquet leo, et suscipit nulla sodales at. Praesent dictum imperdiet lacus nec pharetra. Ut ut risus ipsum ac leo auctor convallis.
40    </div>
41
42    are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden inthemiddle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks asnecessary,makingthis the first true generator
43    on the Internet. It uses a dictionary of over 200 Latin words, combined with ahandfulof model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum isthereforealways free from repetition, injected humour, or
44    non-characteristic words etc.he standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested.Sections1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exactoriginalform,accompanied
45    by English versions from the 1914 translation by H. Rackham. But I must explain to you how allthismistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account ofthesystem, and expound the actual teachings
46    of the great explorer of the truth, the master-builder of humanhappiness.No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do notknowhowto pursue pleasure rationally encounter consequences that are
47    extremely painful. Nor again is there anyonewholovesor pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstancesoccurinwhich toil and pain can procure him some great pleasure. To take a trivial example,
48    which of us everundertakeslaborious physical exercise, except to obtain some advantage from it? But who has any right to find faultwith amanwho chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces noresultant
49    pleasure? who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids apain that produces noresultant pleasure?who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids apain that produces noresultant
50    pleasure? who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids apain that produces noresultant pleasure? who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids apain that produces noresultant
51    pleasure? who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids apain that produces noresultant pleasure? who chooses to enjoy a pleasure that has no.
52  </div>
53</div>

ANSWER

Answered 2021-Dec-08 at 08:42

No.

Flexbox is for laying boxes out in a row or column.

Float is for making text wrap around boxes.

You need float for this.

Source https://stackoverflow.com/questions/70271819

QUESTION

Error 400: redirect_uri_mismatch trying to access Google Drive

Asked 2021-Nov-29 at 16:21

I know there are a ton of questions like this already, but none of the answers have helped me. I've listed all the suggested points at the end, please read there to see if I've missed anything.

I'm using the Google Drive C# API, and have a web site (Blazor, .NET5 in case it makes any difference) that has been working fine. I was using the client's Google credentials for this, had downloaded a JSON file (following instructions here) and all was well. When I first ran the web site in Visual Studio, I got the Google auth screen, in which I entered his email and password, and it worked. This created a JSON file in my web site which then allowed me to run the site next time without having to auth again.

In the credentials JSON file, I added the redirect URI, using the URI that VS uses when I debug the site. This gave me JSON file like this...

1{
2  "web": {
3    "client_id": "xxxxxxxxxxxxxxxx",
4    "project_id": "xxxxxxxxxxxxxxx",
5    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
6    "token_uri": "https://oauth2.googleapis.com/token",
7    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
8    "client_secret": "xxxxxxxxxxxxxxxxxxxxx",
9    "redirect_uris": [
10      "https://localhost:44378/authorize/",
11      "https://localhost:44378/authorize"
12    ],
13    "javascript_origins": [
14      "https://developers.google.com"
15    ]
16  }
17}
18

The code I use to create the Google service is quite closely copied from their .NET Quickstart (step 2)...

1{
2  "web": {
3    "client_id": "xxxxxxxxxxxxxxxx",
4    "project_id": "xxxxxxxxxxxxxxx",
5    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
6    "token_uri": "https://oauth2.googleapis.com/token",
7    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
8    "client_secret": "xxxxxxxxxxxxxxxxxxxxx",
9    "redirect_uris": [
10      "https://localhost:44378/authorize/",
11      "https://localhost:44378/authorize"
12    ],
13    "javascript_origins": [
14      "https://developers.google.com"
15    ]
16  }
17}
18UserCredential credential;
19using (FileStream stream = new(credJson, FileMode.Open, FileAccess.Read)) {
20  credential = GoogleWebAuthorizationBroker
21    .AuthorizeAsync(GoogleClientSecrets.FromStream(stream).Secrets, 
22      new[] { DriveService.Scope.Drive }, 
23      "user", 
24      CancellationToken.None, 
25      new FileDataStore(tokenPath, true))
26    .Result;
27}
28DriveService service = new(new BaseClientService.Initializer {
29  HttpClientInitializer = credential,
30  ApplicationName = ""
31});
32

That all worked fine. Now the client has set up another Google account specially for this site, and wants me to use that instead. No problem, I went to the Google developer console for the new account and did the same as before, ie configured the OAuth screen, created a new OAuth credential, downloaded the JSON file, added the redirect URIs as shown above, and replaced the existing JSON file with the new one.

When I try to debug, I get the error shown in the title.

Having read loads of other questions about this error, I have checked and double-checked the following...

  • The URI that VS uses never changes. Specifically, the port is always 44378
  • The base URI in the Google console and in my JSON file is the exact URI in the browser address bar when I'm debugging, I just added /authorize with and without the trailing slash
  • The URI that the Google window shows is of the form http://127.0.0.1:59777/authorize/, although the port number changes every time. It is not picking up the port that VS uses. Adding the one Google shows is a waste of time, as next time I try, it shows a different port
  • I have tried using 127.0.0.1 instead of localhost
  • I have tried removing the port altogether from the redirect URI
  • I have tried setting the redirect URIs in both the Google console (and waiting for them to update in case this was needed) and in the JSON file
  • When I created the credentials, I set is as a web project, not a desktop one

None of this helped, I always get the same error.

The weird thing is that if I now revert my credentials JSON file back to what it was before (with the client's own Google account), I get the same error.

Anyone any ideas? As far as I can see, I've tried everything mentioned in other answers, but still get this error.

ANSWER

Answered 2021-Nov-29 at 16:21

Hmm, reading your (very clear by the way!) question gives me the impression that all the changes you made were in the JSON file, not in the Google console. Correct me if I'm wrong, but I think that could be where you're hitting issues.

My (admittedly limited) experience leads me to believe that the redirect URIs in the JSON file are ignored, and it's the one(s) in the Google console that are used.

Forgive me if you already tried this, but try adding the following four URIs to your console, and then downloading the JSON file again...

1{
2  "web": {
3    "client_id": "xxxxxxxxxxxxxxxx",
4    "project_id": "xxxxxxxxxxxxxxx",
5    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
6    "token_uri": "https://oauth2.googleapis.com/token",
7    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
8    "client_secret": "xxxxxxxxxxxxxxxxxxxxx",
9    "redirect_uris": [
10      "https://localhost:44378/authorize/",
11      "https://localhost:44378/authorize"
12    ],
13    "javascript_origins": [
14      "https://developers.google.com"
15    ]
16  }
17}
18UserCredential credential;
19using (FileStream stream = new(credJson, FileMode.Open, FileAccess.Read)) {
20  credential = GoogleWebAuthorizationBroker
21    .AuthorizeAsync(GoogleClientSecrets.FromStream(stream).Secrets, 
22      new[] { DriveService.Scope.Drive }, 
23      "user", 
24      CancellationToken.None, 
25      new FileDataStore(tokenPath, true))
26    .Result;
27}
28DriveService service = new(new BaseClientService.Initializer {
29  HttpClientInitializer = credential,
30  ApplicationName = ""
31});
32http://127.0.0.1/authorize/
33http://127.0.0.1/authorize
34https://127.0.0.1/authorize/
35https://127.0.0.1/authorize
36

As you've realised, you seem to need to include versions with and without a trailing slash. I've found you often need to include the non-SSL versions as well. Don't ask me why, as VS uses https when debugging, but this is Google!

Once you've updated the console, download the JSON and include the new version in your app.

Anyway, try that and see if it works.

Source https://stackoverflow.com/questions/70086449

QUESTION

Azure App Service .net6 Deploy - Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'

Asked 2021-Nov-28 at 13:03

I updated my Asp.net core Blazor WebAssembly app to .net 6. Everything is fine, but the deploy from github actions doesn't work and throws this error:

1...
2Copying file: 'Microsoft.AspNetCore.ApiAuthorization.IdentityServer.dll'
3Copying file: 'Microsoft.AspNetCore.Authentication.JwtBearer.dll'
4Omitting next output lines...
5Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'
6An error has occurred during web site deployment.
7Kudu Sync failed
8\n/opt/Kudu/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"
9Error: Failed to deploy web package to App Service.
10Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
11

What could be a problem here?

  • app works on local
  • I updated the azure app to .net6 in configuration
  • I tried to restart the app
  • the app is in Central US region

EDIT/SOLUTION:

Previously the path to licence file was: /home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE/LICENSE new file was without the LICENSE dir. So when the new version of app arrived it tried to update the LICENSE file, which was actually a directory. Removing LICENSE/LICENSE helped.

ANSWER

Answered 2021-Nov-15 at 05:26
  • On Linux, it's important that any bash deployment scripts that get run have Unix line endings (LF) and not Windows line endings (CRLF).

  • Kuduscript will generate scripts with platform-appropriate line endings, but if those scripts are modified, or if you provide your own custom deployment scripts, it's important to make sure that your editor doesn't change the line endings.

  • If something seems off with your deployment script, you can always use the Kudu console to delete the contents of /home/site/deployments/tools.

  • This is the directory where Kudu caches kuduscript-generated deployment scripts. On the next deployment, the script will be regenerated.

  • The error you're currently seeing is a Kudu issue with running node/npm for deployments.

  • The easiest and fastest resolution for what you are currently seeing is to specify engines.node in your package.json.

Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'

EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory. In your case, NPM is trying to "read" a file which is a directory. Since the operation cannot be done the error is thrown.

Three things to make sure here

  1. Make sure the file exists. If it does not, you need to create it. (If NPM depends on any specific information in the file, you will need to have that information there).
  2. Make sure it is in fact a file and not a directory.
  3. It has the right permissions. You can change the file to have all permissions with "sudo chmod 777 FILE_NAME".

Note: You are giving Read, Write and Execute permissions to every one on that file.

Source https://stackoverflow.com/questions/69967124

QUESTION

How to access XML data with Coldfusion

Asked 2021-Oct-22 at 15:46

A client wants me to add a weather forecast to his web site. The official weather report comes in an XML file and I need help accessing some of the elements in the file.

I can download the two XML files that contain the data needed on the site, and I can parse them into ColdFusion XML variables.

I can extract the data I need from the top levels, but it's lower levels that are causing me some heartburn. The XML files contain weather observations and forecasts for every location in the state. We don't need that - we just want to access the data about my client's location.

Here's a sample of the XML data I'm talking about

1<area aac="NSW_PT123" description="Richmond" type="location" parent-aac="NSW_PW005">
2        <forecast-period index="0" start-time-local="2021-10-16T17:00:00+11:00" end-time-local="2021-10-17T00:00:00+11:00" start-time-utc="2021-10-16T06:00:00Z" end-time-utc="2021-10-16T13:00:00Z">
3            <element type="forecast_icon_code">2</element>
4            <text type="precis">Clear.</text>
5            <text type="probability_of_precipitation">5%</text>
6        </forecast-period>
7        <forecast-period index="1" start-time-local="2021-10-17T00:00:00+11:00" end-time-local="2021-10-18T00:00:00+11:00" start-time-utc="2021-10-16T13:00:00Z" end-time-utc="2021-10-17T13:00:00Z">
8            <element type="forecast_icon_code">1</element>
9            <element type="air_temperature_minimum" units="Celsius">7</element>
10            <element type="air_temperature_maximum" units="Celsius">24</element>
11            <text type="precis">Sunny.</text>
12            <text type="probability_of_precipitation">0%</text>
13        </forecast-period>
14        <forecast-period index="2" start-time-local="2021-10-18T00:00:00+11:00" end-time-local="2021-10-19T00:00:00+11:00" start-time-utc="2021-10-17T13:00:00Z" end-time-utc="2021-10-18T13:00:00Z">
15            <element type="forecast_icon_code">1</element>
16            <element type="air_temperature_minimum" units="Celsius">7</element>
17            <element type="air_temperature_maximum" units="Celsius">28</element>
18            <text type="precis">Sunny.</text>
19            <text type="probability_of_precipitation">5%</text>
20        </forecast-period>
21

In this snippet, index="0" indicates 'today' and index="1" indicates 'tomorrow'. The client wants outlook for 7 days.

So currently out of all that XML data I need to identify which day it's about, the icon code (for the pretty pictures) and the Precis (usually a single word or short phrase), probability_of_precipitation (is it gonna rain?) and the times. The rest I can throw away.

In another file with similar structure, there's a long form forecast for another version of the page.

I've been able to access the attributes in the first line (aac and description) but what I need help with is how to access the forecast-period elements under that line. There are forecast-period elements for all the other districts too, which we don't want to access.

I get to this part of the XML file with the ColdFusion XmlSearch/XPATH expression

1<area aac="NSW_PT123" description="Richmond" type="location" parent-aac="NSW_PW005">
2        <forecast-period index="0" start-time-local="2021-10-16T17:00:00+11:00" end-time-local="2021-10-17T00:00:00+11:00" start-time-utc="2021-10-16T06:00:00Z" end-time-utc="2021-10-16T13:00:00Z">
3            <element type="forecast_icon_code">2</element>
4            <text type="precis">Clear.</text>
5            <text type="probability_of_precipitation">5%</text>
6        </forecast-period>
7        <forecast-period index="1" start-time-local="2021-10-17T00:00:00+11:00" end-time-local="2021-10-18T00:00:00+11:00" start-time-utc="2021-10-16T13:00:00Z" end-time-utc="2021-10-17T13:00:00Z">
8            <element type="forecast_icon_code">1</element>
9            <element type="air_temperature_minimum" units="Celsius">7</element>
10            <element type="air_temperature_maximum" units="Celsius">24</element>
11            <text type="precis">Sunny.</text>
12            <text type="probability_of_precipitation">0%</text>
13        </forecast-period>
14        <forecast-period index="2" start-time-local="2021-10-18T00:00:00+11:00" end-time-local="2021-10-19T00:00:00+11:00" start-time-utc="2021-10-17T13:00:00Z" end-time-utc="2021-10-18T13:00:00Z">
15            <element type="forecast_icon_code">1</element>
16            <element type="air_temperature_minimum" units="Celsius">7</element>
17            <element type="air_temperature_maximum" units="Celsius">28</element>
18            <text type="precis">Sunny.</text>
19            <text type="probability_of_precipitation">5%</text>
20        </forecast-period>
21XmlSearch(IDN10064XML, "//area[@aac='NSW_PT123']")
22

So here's my question. In the example code above, (which i have no control over - it's what the government puts out) how do I create a variable that will give me the results

  • "Clear." from the above precis element?
  • "5%" from the probability of precipitation element?
  • "2" from the forecast_icon_code element?

ANSWER

Answered 2021-Oct-19 at 09:22
1<area aac="NSW_PT123" description="Richmond" type="location" parent-aac="NSW_PW005">
2        <forecast-period index="0" start-time-local="2021-10-16T17:00:00+11:00" end-time-local="2021-10-17T00:00:00+11:00" start-time-utc="2021-10-16T06:00:00Z" end-time-utc="2021-10-16T13:00:00Z">
3            <element type="forecast_icon_code">2</element>
4            <text type="precis">Clear.</text>
5            <text type="probability_of_precipitation">5%</text>
6        </forecast-period>
7        <forecast-period index="1" start-time-local="2021-10-17T00:00:00+11:00" end-time-local="2021-10-18T00:00:00+11:00" start-time-utc="2021-10-16T13:00:00Z" end-time-utc="2021-10-17T13:00:00Z">
8            <element type="forecast_icon_code">1</element>
9            <element type="air_temperature_minimum" units="Celsius">7</element>
10            <element type="air_temperature_maximum" units="Celsius">24</element>
11            <text type="precis">Sunny.</text>
12            <text type="probability_of_precipitation">0%</text>
13        </forecast-period>
14        <forecast-period index="2" start-time-local="2021-10-18T00:00:00+11:00" end-time-local="2021-10-19T00:00:00+11:00" start-time-utc="2021-10-17T13:00:00Z" end-time-utc="2021-10-18T13:00:00Z">
15            <element type="forecast_icon_code">1</element>
16            <element type="air_temperature_minimum" units="Celsius">7</element>
17            <element type="air_temperature_maximum" units="Celsius">28</element>
18            <text type="precis">Sunny.</text>
19            <text type="probability_of_precipitation">5%</text>
20        </forecast-period>
21XmlSearch(IDN10064XML, "//area[@aac='NSW_PT123']")
22<cffunction name="WeatherForecast" returntype="struct">
23  <cfargument name="weatherData" type="xml" required="yes">
24  <cfargument name="areaCode" type="string" required="yes">
25
26  <cfset var areas = XmlSearch(weatherData, "//area[@aac='#areaCode#']")>
27  <cfif ArrayLen(areas) eq 0>
28    <cfthrow message="WeatherForecast: area code #areaCode# not found.">
29  </cfif>
30  
31  <cfset var textOnly = function (node) {
32    return node.XmlType == 'ATTRIBUTE' ? node.XmlValue : node.XmlText;
33  }>
34
35  <cfreturn {
36    icons: XmlSearch(areas[1], "./forecast-period/element[@type='forecast_icon_code']").map(textOnly),
37    precis: XmlSearch(areas[1], "./forecast-period/text[@type='precis']").map(textOnly),
38    precipitation: XmlSearch(areas[1], "./forecast-period/text[@type='probability_of_precipitation']").map(textOnly)
39  }>
40</cffunction>
41

Usage:

1<area aac="NSW_PT123" description="Richmond" type="location" parent-aac="NSW_PW005">
2        <forecast-period index="0" start-time-local="2021-10-16T17:00:00+11:00" end-time-local="2021-10-17T00:00:00+11:00" start-time-utc="2021-10-16T06:00:00Z" end-time-utc="2021-10-16T13:00:00Z">
3            <element type="forecast_icon_code">2</element>
4            <text type="precis">Clear.</text>
5            <text type="probability_of_precipitation">5%</text>
6        </forecast-period>
7        <forecast-period index="1" start-time-local="2021-10-17T00:00:00+11:00" end-time-local="2021-10-18T00:00:00+11:00" start-time-utc="2021-10-16T13:00:00Z" end-time-utc="2021-10-17T13:00:00Z">
8            <element type="forecast_icon_code">1</element>
9            <element type="air_temperature_minimum" units="Celsius">7</element>
10            <element type="air_temperature_maximum" units="Celsius">24</element>
11            <text type="precis">Sunny.</text>
12            <text type="probability_of_precipitation">0%</text>
13        </forecast-period>
14        <forecast-period index="2" start-time-local="2021-10-18T00:00:00+11:00" end-time-local="2021-10-19T00:00:00+11:00" start-time-utc="2021-10-17T13:00:00Z" end-time-utc="2021-10-18T13:00:00Z">
15            <element type="forecast_icon_code">1</element>
16            <element type="air_temperature_minimum" units="Celsius">7</element>
17            <element type="air_temperature_maximum" units="Celsius">28</element>
18            <text type="precis">Sunny.</text>
19            <text type="probability_of_precipitation">5%</text>
20        </forecast-period>
21XmlSearch(IDN10064XML, "//area[@aac='NSW_PT123']")
22<cffunction name="WeatherForecast" returntype="struct">
23  <cfargument name="weatherData" type="xml" required="yes">
24  <cfargument name="areaCode" type="string" required="yes">
25
26  <cfset var areas = XmlSearch(weatherData, "//area[@aac='#areaCode#']")>
27  <cfif ArrayLen(areas) eq 0>
28    <cfthrow message="WeatherForecast: area code #areaCode# not found.">
29  </cfif>
30  
31  <cfset var textOnly = function (node) {
32    return node.XmlType == 'ATTRIBUTE' ? node.XmlValue : node.XmlText;
33  }>
34
35  <cfreturn {
36    icons: XmlSearch(areas[1], "./forecast-period/element[@type='forecast_icon_code']").map(textOnly),
37    precis: XmlSearch(areas[1], "./forecast-period/text[@type='precis']").map(textOnly),
38    precipitation: XmlSearch(areas[1], "./forecast-period/text[@type='probability_of_precipitation']").map(textOnly)
39  }>
40</cffunction>
41<cfset IDN10064XML = XmlParse(weatherXml, true)>
42<cfset forecast = WeatherForecast(IDN10064XML, "NSW_PT123")>
43

returns this struct:

1<area aac="NSW_PT123" description="Richmond" type="location" parent-aac="NSW_PW005">
2        <forecast-period index="0" start-time-local="2021-10-16T17:00:00+11:00" end-time-local="2021-10-17T00:00:00+11:00" start-time-utc="2021-10-16T06:00:00Z" end-time-utc="2021-10-16T13:00:00Z">
3            <element type="forecast_icon_code">2</element>
4            <text type="precis">Clear.</text>
5            <text type="probability_of_precipitation">5%</text>
6        </forecast-period>
7        <forecast-period index="1" start-time-local="2021-10-17T00:00:00+11:00" end-time-local="2021-10-18T00:00:00+11:00" start-time-utc="2021-10-16T13:00:00Z" end-time-utc="2021-10-17T13:00:00Z">
8            <element type="forecast_icon_code">1</element>
9            <element type="air_temperature_minimum" units="Celsius">7</element>
10            <element type="air_temperature_maximum" units="Celsius">24</element>
11            <text type="precis">Sunny.</text>
12            <text type="probability_of_precipitation">0%</text>
13        </forecast-period>
14        <forecast-period index="2" start-time-local="2021-10-18T00:00:00+11:00" end-time-local="2021-10-19T00:00:00+11:00" start-time-utc="2021-10-17T13:00:00Z" end-time-utc="2021-10-18T13:00:00Z">
15            <element type="forecast_icon_code">1</element>
16            <element type="air_temperature_minimum" units="Celsius">7</element>
17            <element type="air_temperature_maximum" units="Celsius">28</element>
18            <text type="precis">Sunny.</text>
19            <text type="probability_of_precipitation">5%</text>
20        </forecast-period>
21XmlSearch(IDN10064XML, "//area[@aac='NSW_PT123']")
22<cffunction name="WeatherForecast" returntype="struct">
23  <cfargument name="weatherData" type="xml" required="yes">
24  <cfargument name="areaCode" type="string" required="yes">
25
26  <cfset var areas = XmlSearch(weatherData, "//area[@aac='#areaCode#']")>
27  <cfif ArrayLen(areas) eq 0>
28    <cfthrow message="WeatherForecast: area code #areaCode# not found.">
29  </cfif>
30  
31  <cfset var textOnly = function (node) {
32    return node.XmlType == 'ATTRIBUTE' ? node.XmlValue : node.XmlText;
33  }>
34
35  <cfreturn {
36    icons: XmlSearch(areas[1], "./forecast-period/element[@type='forecast_icon_code']").map(textOnly),
37    precis: XmlSearch(areas[1], "./forecast-period/text[@type='precis']").map(textOnly),
38    precipitation: XmlSearch(areas[1], "./forecast-period/text[@type='probability_of_precipitation']").map(textOnly)
39  }>
40</cffunction>
41<cfset IDN10064XML = XmlParse(weatherXml, true)>
42<cfset forecast = WeatherForecast(IDN10064XML, "NSW_PT123")>
43{
44    "PRECIPITATION": ["5%", "0%", "5%"],
45    "PRECIS": ["Clear.", "Sunny.", "Sunny."],
46    "ICONS": ["2", "1", "1"]
47}
48

Each part will contain as many values as there are <forecast-period> elements for that <area> in the XML, in the order they appear in the XML. In other words, forecast.precipitation[1] will refer to "today", unless there is a chance that the XML ever arrives out of order (I doubt it).

Things like the time attribute values can be extracted in the same way:

1&lt;area aac=&quot;NSW_PT123&quot; description=&quot;Richmond&quot; type=&quot;location&quot; parent-aac=&quot;NSW_PW005&quot;&gt;
2        &lt;forecast-period index=&quot;0&quot; start-time-local=&quot;2021-10-16T17:00:00+11:00&quot; end-time-local=&quot;2021-10-17T00:00:00+11:00&quot; start-time-utc=&quot;2021-10-16T06:00:00Z&quot; end-time-utc=&quot;2021-10-16T13:00:00Z&quot;&gt;
3            &lt;element type=&quot;forecast_icon_code&quot;&gt;2&lt;/element&gt;
4            &lt;text type=&quot;precis&quot;&gt;Clear.&lt;/text&gt;
5            &lt;text type=&quot;probability_of_precipitation&quot;&gt;5%&lt;/text&gt;
6        &lt;/forecast-period&gt;
7        &lt;forecast-period index=&quot;1&quot; start-time-local=&quot;2021-10-17T00:00:00+11:00&quot; end-time-local=&quot;2021-10-18T00:00:00+11:00&quot; start-time-utc=&quot;2021-10-16T13:00:00Z&quot; end-time-utc=&quot;2021-10-17T13:00:00Z&quot;&gt;
8            &lt;element type=&quot;forecast_icon_code&quot;&gt;1&lt;/element&gt;
9            &lt;element type=&quot;air_temperature_minimum&quot; units=&quot;Celsius&quot;&gt;7&lt;/element&gt;
10            &lt;element type=&quot;air_temperature_maximum&quot; units=&quot;Celsius&quot;&gt;24&lt;/element&gt;
11            &lt;text type=&quot;precis&quot;&gt;Sunny.&lt;/text&gt;
12            &lt;text type=&quot;probability_of_precipitation&quot;&gt;0%&lt;/text&gt;
13        &lt;/forecast-period&gt;
14        &lt;forecast-period index=&quot;2&quot; start-time-local=&quot;2021-10-18T00:00:00+11:00&quot; end-time-local=&quot;2021-10-19T00:00:00+11:00&quot; start-time-utc=&quot;2021-10-17T13:00:00Z&quot; end-time-utc=&quot;2021-10-18T13:00:00Z&quot;&gt;
15            &lt;element type=&quot;forecast_icon_code&quot;&gt;1&lt;/element&gt;
16            &lt;element type=&quot;air_temperature_minimum&quot; units=&quot;Celsius&quot;&gt;7&lt;/element&gt;
17            &lt;element type=&quot;air_temperature_maximum&quot; units=&quot;Celsius&quot;&gt;28&lt;/element&gt;
18            &lt;text type=&quot;precis&quot;&gt;Sunny.&lt;/text&gt;
19            &lt;text type=&quot;probability_of_precipitation&quot;&gt;5%&lt;/text&gt;
20        &lt;/forecast-period&gt;
21XmlSearch(IDN10064XML, &quot;//area[@aac='NSW_PT123']&quot;)
22&lt;cffunction name=&quot;WeatherForecast&quot; returntype=&quot;struct&quot;&gt;
23  &lt;cfargument name=&quot;weatherData&quot; type=&quot;xml&quot; required=&quot;yes&quot;&gt;
24  &lt;cfargument name=&quot;areaCode&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;
25
26  &lt;cfset var areas = XmlSearch(weatherData, &quot;//area[@aac='#areaCode#']&quot;)&gt;
27  &lt;cfif ArrayLen(areas) eq 0&gt;
28    &lt;cfthrow message=&quot;WeatherForecast: area code #areaCode# not found.&quot;&gt;
29  &lt;/cfif&gt;
30  
31  &lt;cfset var textOnly = function (node) {
32    return node.XmlType == 'ATTRIBUTE' ? node.XmlValue : node.XmlText;
33  }&gt;
34
35  &lt;cfreturn {
36    icons: XmlSearch(areas[1], &quot;./forecast-period/element[@type='forecast_icon_code']&quot;).map(textOnly),
37    precis: XmlSearch(areas[1], &quot;./forecast-period/text[@type='precis']&quot;).map(textOnly),
38    precipitation: XmlSearch(areas[1], &quot;./forecast-period/text[@type='probability_of_precipitation']&quot;).map(textOnly)
39  }&gt;
40&lt;/cffunction&gt;
41&lt;cfset IDN10064XML = XmlParse(weatherXml, true)&gt;
42&lt;cfset forecast = WeatherForecast(IDN10064XML, &quot;NSW_PT123&quot;)&gt;
43{
44    &quot;PRECIPITATION&quot;: [&quot;5%&quot;, &quot;0%&quot;, &quot;5%&quot;],
45    &quot;PRECIS&quot;: [&quot;Clear.&quot;, &quot;Sunny.&quot;, &quot;Sunny.&quot;],
46    &quot;ICONS&quot;: [&quot;2&quot;, &quot;1&quot;, &quot;1&quot;]
47}
48XmlSearch(areas[1], &quot;./forecast-period/@start-time-local&quot;).map(textOnly)
49

Source https://stackoverflow.com/questions/69627435

QUESTION

How do you make your check constraint case insensitive in SQL?

Asked 2021-Oct-16 at 19:27

This is my piece of code.

1CREATE TABLE ORDER_SOURCE(
2    OS_ID NUMBER(4),
3    OS_DESC VARCHAR2(20),
4    CONSTRAINT order_source_os_id_pk PRIMARY KEY (OS_ID),
5    CONSTRAINT order_source_os_desc_cc CHECK ((OS_DESC='CATALOG DESCRIPTION') OR (OS_DESC='WEB SITE'))
6);
7

I want to be able to insert values in lower case too. Example down Below:

1CREATE TABLE ORDER_SOURCE(
2    OS_ID NUMBER(4),
3    OS_DESC VARCHAR2(20),
4    CONSTRAINT order_source_os_id_pk PRIMARY KEY (OS_ID),
5    CONSTRAINT order_source_os_desc_cc CHECK ((OS_DESC='CATALOG DESCRIPTION') OR (OS_DESC='WEB SITE'))
6);
7INSERT INTO ORDER_SOURCE VALUES(0002,'Web Site');
8

But I can edit my check constraints to add 'Web Site' or 'Catalog', I just want to try something else. Thanks.

ANSWER

Answered 2021-Oct-16 at 15:21

You may lowercase the column and then compare to lowercase string literals:

1CREATE TABLE ORDER_SOURCE(
2    OS_ID NUMBER(4),
3    OS_DESC VARCHAR2(20),
4    CONSTRAINT order_source_os_id_pk PRIMARY KEY (OS_ID),
5    CONSTRAINT order_source_os_desc_cc CHECK ((OS_DESC='CATALOG DESCRIPTION') OR (OS_DESC='WEB SITE'))
6);
7INSERT INTO ORDER_SOURCE VALUES(0002,'Web Site');
8CONSTRAINT order_source_os_desc_cc
9CHECK (LOWER(OS_DESC) IN ('catalog description', 'web site'))
10

Source https://stackoverflow.com/questions/69596903

QUESTION

Can I leave away an association class for many to many relations?

Asked 2021-Aug-05 at 22:55

Just a simple question: I'm working on a class diagram for a dynamic web site for my internship. I have an association between two classes (client and article), the relation is many to many.

Normally I have to add an association class between them, but I don't want to because the client can only read the article's writing on the web page, and he cannot post. Is it correct if I don't draw the association class on the diagram?

ANSWER

Answered 2021-Aug-05 at 17:12

There is no need to add association class only due to many to many relationship. The association class is needed when you have an association that at the same time is also a class, i.e. has some properties on its own.

You can use simple association with any multiplicity on any of the ends including having * on both ends.

Source https://stackoverflow.com/questions/68669184

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Web Site

Tutorials and Learning Resources are not available at this moment for Web Site

Share this Page

share link

Get latest updates on Web Site