qid
int64
2
74.7M
question
stringlengths
31
65.1k
date
stringlengths
10
10
metadata
sequence
response_j
stringlengths
4
63.3k
response_k
stringlengths
4
60.5k
70,978,611
I am working on a project the backend is in python Django and frontend in react-js and database is MySQL. Now the problem is I need to search products from database in my project but don’t know how to get query for frontend to backend. I don’t know the code Moreover I am using rest-framework and Axios library to connect. I am very thankful to you if you help me to create search related queries in my project. Thank you
2022/02/03
[ "https://Stackoverflow.com/questions/70978611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10702134/" ]
With `GNU awk` you can [control array scanning](https://www.gnu.org/software/gawk/manual/html_node/Controlling-Scanning.html) via `PROCINFO["sorted_in"]` to sort arrays (by index or data) so that `for (index in array)` processes the array in the desired order. Adding this to your `END` block processing would look like: ``` END{ PROCINFO["sorted_in"]="@ind_str_asc" # sort array by index based on "string" data and in "ascending" order print "INCOME" "\n" for (j in a) { printf "%-33s\t%-20 .2f\n", i, a[i]; } printf "%-33s\t%-20 .2f\n", "\nTOTAL INCOME", sa; print "\n""\n" "EXPENSES" "\n" for (j in b) { printf "%-33s\t%-20 .2f\n", j, b[j]; } printf "%-33s\t%-20 .2f\n", "\nTOTAL EXPENSES", sb } ``` **NOTE:** once set the `PROCINFO["sorted_in"]` applies to all array references until either the end of the `awk` script or until a new `PROCINFO["sorted_in"]` is applied
I think that you will find it easier to sort the date before running this script. You don't tell us where it's coming from but either specify sort column or pipe it through awk '{ print $3 $7}' | sort
147,903
I'd like to reduce the left margin of the Friggeri template, in order to increase the width of the aside section. I first tried to change the numbers of the line 308 of friggeri-cv.cls file: ``` \RequirePackage[left=6.1cm,top=2cm,right=1.5cm,bottom=2.5cm,nohead,nofoot]{geometry} ``` But it was unsuccessful: only the main column moved. After that I found an interesting code in line 163 (aside section). ``` \begin{textblock}{3.6}(1.5, 4.33) ``` But when I changed those numbers, the aside section changed but the left margin was not reduced. Maybe I found the right line to change but I don't do it properly? How can I reduce the left margin so that the separation between the aside section and the main section doesn't move, thus increasing the width of the aside section? [Link to the template](http://www.latextemplates.com/template/friggeri-resume-cv) MWE: ``` \documentclass[]{friggeri-cv} \begin{document} \header{john}{smith}{junior business analyst} \begin{aside} \section{contact} 123 Broadway City, State 12345 Country ~ \href{mailto:john@smith.com}{john@smith.com} \section{languages} english mother tongue spanish \& italian fluency \section{programming} {\color{red} $\varheartsuit$} JavaScript Python, C++, PHP CSS3 \& HTML5 \end{aside} \section{education} \begin{entrylist} \entry {2011--2012} {Masters {\normalfont of Commerce}} {The University of California, Berkeley} {\emph{Money Is The Root Of All Evil -- Or Is It?} \\ This thesis blah blah blah} \end{entrylist} \end{document} ``` And this is the output (the arrow represents the margin I'd like to reduce): ![the margin i'd like to reduce](https://i.stack.imgur.com/AfP7f.jpg)
2013/12/01
[ "https://tex.stackexchange.com/questions/147903", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/39246/" ]
You can move the aside section by changing the numbers in the textblock command ``` \begin{textblock}{h-width}(x-pos, y-pos) ``` Changing these numbers can be difficult, so I suggest you to add a red background (as shown in this question [Add a border to textblock](https://tex.stackexchange.com/questions/86760/add-a-border-to-textblock)) to better understand what you do. In this MWE the left margin is reduced: ``` \documentclass[]{friggeri-cv} %%%%%%%%%%%%%% copied form line 163 in friggeri-cv % Side block % %%%%%%%%%%%%%% \RequirePackage[absolute,overlay]{textpos} \setlength{\TPHorizModule}{1cm} \setlength{\TPVertModule}{1cm} \renewenvironment{aside}{% \let\oldsection\section \renewcommand{\section}[1]{ \par\vspace{\baselineskip}{\Large\headingfont\color{headercolor} ##1} } \begin{textblock}{3.6}(0.5, 4.33) \textblockcolour{red} % this line is here to help you and then should be removed \begin{flushright} \obeycr }{% \restorecr \end{flushright} \end{textblock} \let\section\oldsection } \begin{document} \header{john}{smith}{junior business analyst} \begin{aside} \section{contact} 123 Broadway City, State 12345 Country ~ \href{mailto:john@smith.com}{john@smith.com} \section{languages} english mother tongue spanish \& italian fluency \section{programming} {\color{red} $\varheartsuit$} JavaScript Python, C++, PHP CSS3 \& HTML5 \end{aside} \section{education} \begin{entrylist} \entry {2011--2012} {Masters {\normalfont of Commerce}} {The University of California, Berkeley} {\emph{Money Is The Root Of All Evil -- Or Is It?} \\ This thesis blah blah blah} \end{entrylist} \end{document} ```
If you change two lines in your friggeri class file: `\begin{flushright}` --> `\begin{flushleft}` `\end{flushright}` --> `\end{flushleft}` then it looks more accurate for me. You can try this, maybe then you don't have to change the margin.
48,157,921
I'm using the tweepy library to download tweets of certain users. I want to save these tweets into a JSON file but im getting the following error: > > File "", line 63, in getTweetsList > json.dump(status.\_json,file,sort\_keys = True,indent = 4) > > > File "C:\ProgramData\Anaconda3\lib\json\_\_init\_\_.py", line 180, in > dump > > > fp.write(chunk) > > > TypeError: a bytes-like object is required, not 'str' > > > Here is the code: ``` def getTweetsList(self, screen_name): # Twitter only allows access to a users most recent 3240 tweets with this method # initialize a list to hold all the tweepy Tweets alltweets = [] # make initial request for most recent tweets (200 is the maximum allowed count) new_tweets = self.api.user_timeline(screen_name = screen_name,count=200) # save most recent tweets alltweets.extend(new_tweets) # save the id of the oldest tweet less one oldest = alltweets[-1].id - 1 # keep grabbing tweets until there are no tweets left to grab while len(new_tweets) > 0: # all subsiquent requests use the max_id param to prevent duplicates new_tweets = self.api.user_timeline(screen_name = screen_name,count=200,max_id=oldest) # save most recent tweets alltweets.extend(new_tweets) # update the id of the oldest tweet less one oldest = alltweets[-1].id - 1 print("...%s tweets downloaded so far" % (len(alltweets))) print("Total tweets downloaded %s" % (len(alltweets))) file = open('tweet.json', 'wb') print("Writing tweet objects to JSON please wait...") for status in alltweets: json.dump(status._json,file,sort_keys = True,indent = 4) return alltweets ``` I looked everywhere for an answer, but none of the solutions worked for me. I think it might have something to do with Python 3.6.
2018/01/08
[ "https://Stackoverflow.com/questions/48157921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4281635/" ]
You are opening the file in binary mode. The error indicates it wants a bytes object (binary data) due to this. Tweets are text (Unicode strings). Use text mode and declare an encoding, e.g.: ``` with open('tweet.json', 'w', encoding='utf8') as file: json.dump(status._json, file, ...) ``` Note that using a `with` statement ensures the file gets closed.
* Change the line `json.dump(status._json,file,sort_keys = True,indent = 4)` to `json.dumps(status._json,file,sort_keys = True,indent = 4)` * Use `json.dumps` * `json.dumps` serializes the object to a JSON formatted string * "dumps" means "dump string"
39,706,671
I have two folders: TypeScript and JavaScript. I need to compile the TypeScript file which are in TypeScript folder to JavaScript files in the JavaScript folder.
2016/09/26
[ "https://Stackoverflow.com/questions/39706671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739287/" ]
Not the most sophisticated piece of code in the world but it may be useful. ``` import subprocess, time x = subprocess.Popen(['sleep', '15']) polling = None i = 0 while polling == None: time.sleep(1) polling = x.poll() i +=1 if i > 15: break if polling == None: try: x.kill() print "Time out - process terminated" # process terminated by kill command except OSError: print "Process completed on time" # process terminated between poll and kill commands except Exception as e: print "Error "+str(e) # kill command failed due to another exception "e" else: print "Process Completed after "+str(i)+" seconds" ``` Edit: Problems with kill not appearing to function. Try using `os.kill(x.pid, signal.SIGKILL)` rather than `SIGTERM`. I believe that `SIGTERM` asks the process to close down cleanly, rather than terminate immediately. Not knowing what drives the fortran script, it's difficult to know what the terminate signal does. Perhaps the code is doing something. For example: if I ran a shell script as follows: ``` #!/bin/bash trap "echo signal" 15 sleep 30 ``` and sent it `kill -15 pid_number`, it would not print "signal" until the sleep had terminated after 30 seconds, whereas if I issued `kill -9 pid_number` it would terminate immediately with nothing printed out. The short answer, is I don't know but I suspect that the answer lies within the script running the fortran code. EDIT: Note: In order to successfully run `x.kill()` or `os.kill()` or `subprocess.call('kill '+ str(x.pid), shell=True)`, `shell` option in x needs to be False. Thus one can use ``` import shlex args = shlex.split(ARGS HERE) x = subprocess.Popen(args) # shell=False is default ``` But also note that if you want to write the output to a log file by using `... >& log_file` it wont work since `>&` is not an valid argument for your script but for your shell environment. Thus one needs to use only arguments that are valid for the script that python runs.
There's a timeout argument on check\_output, just set it to 15 seconds. ``` try: subprocess.check_output(['arg1', 'arg2'], timeout=15) except: print("Timed out") ``` Documentation here <https://docs.python.org/3/library/subprocess.html#subprocess.check_output> check\_output returns the output as well, so if you care about it just store the result. There's also a wait function that's useful for more complicated use cases. Both check\_output and wait block until the process finishes, or until the timeout is reached.
39,706,671
I have two folders: TypeScript and JavaScript. I need to compile the TypeScript file which are in TypeScript folder to JavaScript files in the JavaScript folder.
2016/09/26
[ "https://Stackoverflow.com/questions/39706671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739287/" ]
Not the most sophisticated piece of code in the world but it may be useful. ``` import subprocess, time x = subprocess.Popen(['sleep', '15']) polling = None i = 0 while polling == None: time.sleep(1) polling = x.poll() i +=1 if i > 15: break if polling == None: try: x.kill() print "Time out - process terminated" # process terminated by kill command except OSError: print "Process completed on time" # process terminated between poll and kill commands except Exception as e: print "Error "+str(e) # kill command failed due to another exception "e" else: print "Process Completed after "+str(i)+" seconds" ``` Edit: Problems with kill not appearing to function. Try using `os.kill(x.pid, signal.SIGKILL)` rather than `SIGTERM`. I believe that `SIGTERM` asks the process to close down cleanly, rather than terminate immediately. Not knowing what drives the fortran script, it's difficult to know what the terminate signal does. Perhaps the code is doing something. For example: if I ran a shell script as follows: ``` #!/bin/bash trap "echo signal" 15 sleep 30 ``` and sent it `kill -15 pid_number`, it would not print "signal" until the sleep had terminated after 30 seconds, whereas if I issued `kill -9 pid_number` it would terminate immediately with nothing printed out. The short answer, is I don't know but I suspect that the answer lies within the script running the fortran code. EDIT: Note: In order to successfully run `x.kill()` or `os.kill()` or `subprocess.call('kill '+ str(x.pid), shell=True)`, `shell` option in x needs to be False. Thus one can use ``` import shlex args = shlex.split(ARGS HERE) x = subprocess.Popen(args) # shell=False is default ``` But also note that if you want to write the output to a log file by using `... >& log_file` it wont work since `>&` is not an valid argument for your script but for your shell environment. Thus one needs to use only arguments that are valid for the script that python runs.
Additional answer to the one above, shell has an internal timeout command as well so it can be used as follows; ``` timeout <TIME IN SEC> ./blabla > log_file ``` I'm using it in python as follows; ``` try: check_output('timeout --signal=SIGKILL 12 ./<COMMAND> > log', shell=True) flag = 0 except: flag = 1 ``` Thus one can check if flag is 1 or 0 to understand what happened to the job. Note that `--signal=SIGKILL` is just written `Killed` at the end of the run if its terminated. For more signal options one can check `kill -l`.
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
There are *many* plugins for that. Did you search [vim.org's plugin repository](http://www.vim.org/scripts/script_search_results.php?keywords=pair&script_type=&order_by=rating&direction=descending&search=search) before asking? You could also do something like: ``` inoremap { {}<C-o>h ```
The surround plugin might work for you: <http://www.vim.org/scripts/script.php?script_id=1697>
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
[lh-brackets](http://code.google.com/p/lh-vim/wiki/lhBrackets#The_bracketing_subsystem) provides both the insert mode mappings and the surrounding mappings. If you want to use it for a filetype that I don't work with, you may have to add your specializations -- which is meant to be easy.
The surround plugin might work for you: <http://www.vim.org/scripts/script.php?script_id=1697>
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
The surround plugin might work for you: <http://www.vim.org/scripts/script.php?script_id=1697>
After fiddling around, I found that a plugin for such a feature would be overkill. I've setup my vimrc as such: ``` inoremap { {}<C-o>i ``` I've also added: ``` inoremap <C-l> <C-o>A inoremap <C-L> <C-o>A<Space> ``` So I can quickly jump outside of the parentheses and start typing again, with our without an extra space.
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
There are *many* plugins for that. Did you search [vim.org's plugin repository](http://www.vim.org/scripts/script_search_results.php?keywords=pair&script_type=&order_by=rating&direction=descending&search=search) before asking? You could also do something like: ``` inoremap { {}<C-o>h ```
[lh-brackets](http://code.google.com/p/lh-vim/wiki/lhBrackets#The_bracketing_subsystem) provides both the insert mode mappings and the surrounding mappings. If you want to use it for a filetype that I don't work with, you may have to add your specializations -- which is meant to be easy.
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
There are *many* plugins for that. Did you search [vim.org's plugin repository](http://www.vim.org/scripts/script_search_results.php?keywords=pair&script_type=&order_by=rating&direction=descending&search=search) before asking? You could also do something like: ``` inoremap { {}<C-o>h ```
After fiddling around, I found that a plugin for such a feature would be overkill. I've setup my vimrc as such: ``` inoremap { {}<C-o>i ``` I've also added: ``` inoremap <C-l> <C-o>A inoremap <C-L> <C-o>A<Space> ``` So I can quickly jump outside of the parentheses and start typing again, with our without an extra space.
10,460,650
I've been developing product catalog. All my needs fit perfectly with MongoDB but there is one problem: There are categories with structure like these: ``` { title:"Auto", // for h1 on page id: 1, // for urls level: 1, // left: 2, // nested set implementation right:10 // } ``` When user goes to url like "**www.example.com/category/1**" I need to show html forms to filter shown goods. I'm pretty sure it is bad idea to store static definitions for every category on the server(about 300 categories, i'm using Django => 300 form models?) So my idea is to store meta-information about each category in MongoDB. After some research I found out that I need 3-4 "html widgets" to construct any filter form that I need. For example: Range fields will look like this in HTML ``` <fieldset> <legend>Price</legend> <label for="price_from">from</label> <input type="text" name="price_from"> <label for="price_to">to</label> <input type="text" name="price_to"> </fieldset> ``` And its MongoDB JSON representation: ``` { name:"price", title:"Price", type:"range", // "range" type - 2 inputs with initial values categories:[1,2,5],// categories to which this so called "widget" relates values:[ {from: 100}, {to: 500} ] ``` } One more example: Group of selects: Its HTML version ``` <fieldset> <legend>Size and color</legend> <select name="size"> <option value="small">Small size</option> <option value="medium">Medium size</option> <option value="huge">Huge size</option> </select> <select name="color"> <option value="white">White color</option> <option value="black">Black color</option> <option value="purple">Purple color</option> </select> </fieldset> ``` And its MongoDB JSON version: ``` { title:"Size and color", type:"selectgroup", categories:[2,4,6] items:[ { name:"size", values:["small", "medium", "huge"] }, { name:"color", values:["white", "black", "purple"] } ] } ``` So the main idea is : **fetch all widgets from collection by category\_id, parse them and print complete HTML form.** Pros ---- * Easy to add any new type of widget to database * Easy to add parser for such widget to generate HTML from JSON * Each widget can relates to many categories => no duplicates Cons ---- * Collection of widgets has no less or more fixed structure of the document(actually i don't see real problem here) * Аll values related to widget are embedded. * Hard validation because fields are dynamic => no corresponding model on server side (right now i don't have any idea how to validate this) My question is: ***does anybody know a better way of doing this? Pros of my method are cool, but cons are terrible.*** Thanks for help and sorry for bad English.
2012/05/05
[ "https://Stackoverflow.com/questions/10460650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750144/" ]
[lh-brackets](http://code.google.com/p/lh-vim/wiki/lhBrackets#The_bracketing_subsystem) provides both the insert mode mappings and the surrounding mappings. If you want to use it for a filetype that I don't work with, you may have to add your specializations -- which is meant to be easy.
After fiddling around, I found that a plugin for such a feature would be overkill. I've setup my vimrc as such: ``` inoremap { {}<C-o>i ``` I've also added: ``` inoremap <C-l> <C-o>A inoremap <C-L> <C-o>A<Space> ``` So I can quickly jump outside of the parentheses and start typing again, with our without an extra space.
42,278,286
Is this possible to check this using server side code in Node js? OR if not then how can I use conditions like if-else: ``` if enabled then do this else do that ``` In a `node.js` project, I have to check that `JavaScript` is enabled or not on browser of user. I know that we can check this using `<noscript>` tag at client side code(I am using jade). On Jade page I have inserted `<noscript>` tag which displays message that `JavaScript` is disabled. e.g. ``` noscript .noscriptmsg(style="color:red; padding:15px;") | You don't have javascript enabled on your Browser. Please enable to use complete functionality. | To know more a(href='http://enable-javascript.com/') | Click Here ``` this is good to display the error message to user. But I wants to know it on my server side code in `node.js`. I am using `express` framework. I wants to make case for each and every page if `JavaScript` is disabled then user cannot move further OR in running app if user will disable `JavaScript` then app will be redirected on JS-No Found page. OR some kind of conditional part in `<noscript>` part. Can anyone please guide me how can I detect JS enable or disable on server side in Node.JS.
2017/02/16
[ "https://Stackoverflow.com/questions/42278286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4478280/" ]
You can put a `<meta>` tag in a `<noscript>` block to redirect to some special URL: ``` <noscript> <meta http-equiv=refresh content='0; url=http://your.domain/noscript'> </noscript> ``` You cannot of course be 100% certain that users who land on the special URL are there because they've disabled JavaScript, but for people not doing anything weird (other than disabling JavaScript) it works. Note that checking "in server-side code" does not make sense; the only place you can check if a **client** has JavaScript enabled is in code that's sent to the client.
* You can expose a GET / POST endpoint on your express app - ex: **/jsenabled/** * In the html page - On document ready you can call **'/jsenabled'** * In the jsenabled express handler -infer the user from the session / cookies * By default assume user has no js until you get this call
51,360,166
I know it's very easy to do it with JavaScript. For example, if I want to hide all children after 50th, I just need to do: ``` $("#container").find('div').each(function(){ if ($(this).index() > 50) $(this).hide(); }) ``` But is it possible to do it with **pure CSS**? Note: * The total children number is not a fixed one. It may change (by other JavaScript codes * I only need to support Chrome so no need to consider other browsers * I don't have access to the HTML DOM itself (because I am building a Chrome Extension) Update: * Sorry that I want to hide from `a to All the next` (the last one) children. I have edited my question. It's NOT from `a~b`. * div are the only children. There are NO other children in this container.
2018/07/16
[ "https://Stackoverflow.com/questions/51360166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1661640/" ]
`.container div:nth-child(n+51) { display:none; }` n is the cycle number, 51 is the offset so will start on the 51st item, then repeat every 1 item.
Another idea is to use the `~` selector in order to hide all the element after a particular one: ``` .container div:nth-child(51) ~ * { display:none; } ``` Here is an example: ```css .container div:nth-child(5) ~ * { display: none; } .container div { height:20px; width:20px; display:inline-block; border:1px solid; background:red; } ``` ```html <div class="container"> <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div> </div> ```
38,742,218
i started learning angular a week ago, and now im trying to construct a app by myself (because people say that is the best way to learn), im trying to do a thing that i didnt before so dont be so rude to me if it is easy, im trying to build a pokedex, im trying to use data that already exist for it in Json, and import it to the controller on angular so i can use ng-repeat to show the data, but i dont know why it doesnt result, maybe im doing a lot of mistakes but i cant find it :/ , i will post what i did here: **Html** ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <script src="angular.js"></script> <script src="pokedex.js"></script> ``` ``` <body ng-app ="pokedex"> <div class="row"> <div class="col-md-offset-1 form-group"> <label for="sel1">Select list:</label> <select class="form-control"> <option>All</option> <option>Normal</option> <option>Watter</option> <option>Fire</option> <option>Eletric</option> <option>Rock</option> <option>Ice</option> <option>Grass</option> <option>Psychic</option> <option>Poison</option> <option>Dragon</option> </select> </div> </div> <div class="row" ng-controller="PokemonController as pokedex"> <div class="col-md-offset-1 col-md-6" ng-repeat = "pokemon in pokedex.pokemons"> <p>Name: {{pokemon.Name}}</p> </div> </div> ``` **script** ``` (function(){ var app = angular.module('pokedex',[]); app.controller('pokemonController',['$http',function($http){ var pokemons = this; $http.get('https://pokedex-deluxor.rhcloud.com/getall').success(function(data){ pokemons = data; }); }]); }); ``` Json Url: [Pokedex](https://pokedex-deluxor.rhcloud.com/getall) Ps: Sorry about my bad english friends :/
2016/08/03
[ "https://Stackoverflow.com/questions/38742218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
you can use ng-blur option considering autofille\_data as your data we can call a function on ng-blur ``` $scope.remode(autofill_data){ var index=autofill_data.indexOf($scope.input_val1); autofill_data.splice(index, 1); } ``` where $scope.input\_val1 is the value in input field 1
repeat for creating text box. after that from array you need to remove those values which has been selected. for example: ``` html code <span"><input type="text" ng-model="x.name1"</span> <span"><input type="text" ng-model="x.name2"</span> <span"><input type="text" ng-model="x.name3"</span> js code: Suppose your suggestion values are coming from array named $scope.usStates. now you have to remove compare both value inside x an $scope.usStates and remove the matching element from $scope.usStates. you can use index of particullar element and splice method for removing an element. example: $scope.usStates.splice(index, 1); $scope.usStates = [ { name: 'ALABAMA', abbreviation: 'AL'}, { name: 'ALASKA', abbreviation: 'AK'}, { name: 'AMERICAN SAMOA', abbreviation: 'AS'}, { name: 'ARIZONA', abbreviation: 'AZ'}, { name: 'ARKANSAS', abbreviation: 'AR'}, { name: 'CALIFORNIA', abbreviation: 'CA'}, { name: 'COLORADO', abbreviation: 'CO'}, { name: 'CONNECTICUT', abbreviation: 'CT'}, { name: 'DELAWARE', abbreviation: 'DE'}, { name: 'DISTRICT OF COLUMBIA', abbreviation: 'DC'}, { name: 'FEDERATED STATES OF MICRONESIA', abbreviation: 'FM'}, { name: 'FLORIDA', abbreviation: 'FL'}, { name: 'GEORGIA', abbreviation: 'GA'}] Thanks. ```
32,423,594
I am only starting to learn to code with HTML, so if this question seems trivial or simple, I apologise in advance. Suppose I have a form, like `<form><input type="url" name="url"><input type="submit" value="Go"></form>` How do I make the submit button go to the url that the user types in?
2015/09/06
[ "https://Stackoverflow.com/questions/32423594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5150763/" ]
You cannot do that using pure HTML. The form will always post/get to the URL which the `action` attribute of the form points to. However, with some javascript you can do this. This should work: ``` <form id="form" method="get"> <input type="url" name="url" onchange="document.getElementById('form').action = this.value;"> <input type="submit" value="Go"> </form> ``` What this does is it uses the onchange event of the url input box so everytime that changes, the action of the form is updated.
In addition to the sending the user to the url when they hit submit, are you trying to save the url that is typed in? If so you will need more than HTML to accomplish this, probably php + sql would be the easiest route to save it. However, if all you're trying to do is let a user go to the url they are typing in, you could accomplish this through javascript or jquery. For example in your html: ``` <form> <input id="url" type="url" name="url"> <input type="button" value="Go" /> </form> ``` Then add this jquery: ``` $('input[type=button]').click( function() { var url = $('#url').text(); $(location).attr('href', url) }); ``` Try this: <http://jsfiddle.net/p6zxg25v/2/>
38,386,821
I am getting an error when i tried to use both mavencli and spring in my maven dependencies. mavencli won't clean and install properly when spring boot is being use. Here is my maven pom.xml ``` <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <artifactId>maven-client</artifactId> <groupId>com.group</groupId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <!-- MAVEN CLI depenedencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.3.3</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-wagon</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.9</version> </dependency> <!-- SPRING BOOT STARTER --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` and here is my stack error ``` 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader. 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary: 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s] 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00 10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M 10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch. 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException ```
2016/07/15
[ "https://Stackoverflow.com/questions/38386821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1852178/" ]
The error message is little misleading. The problem was not that there was invalid character, but the network was misconfigured. I had one LAN interface and one WLAN interface. LAN interface connects to a router A which forward requests to router B which was connected to internet. While the WLAN interface was directly connected to router B. I forgot to remove the WLAN configuration. Once I ensured the WLAN interface is removed, things worked smoothly. In short: Ensured DNS resolution works and that MTU is set right. **Another possible reason for error** If you are using Mac, please ensure to allow Unrestriction Access to Web Content like below: [![enter image description here](https://i.stack.imgur.com/5Xjoa.png)](https://i.stack.imgur.com/5Xjoa.png) **Another possible step in troubleshooting** Ensure there is no proxy or web filter in your network, that is, if possible connect to your 3G network and try again to see if the results are different
That error message looks like it's coming from a proxy server. From the [docker pull documentation](https://docs.docker.com/engine/reference/commandline/pull/) > > Proxy configuration > > > If you are behind an HTTP proxy server, for example in corporate > settings, before open a connect to registry, you may need to configure > the Docker daemon’s proxy settings, using the HTTP\_PROXY, HTTPS\_PROXY, > and NO\_PROXY environment variables. To set these environment variables > on a host using systemd, refer to the control and configure Docker > with systemd for variables configuration. > > > The link to the [instructions for configuring systemd with a proxy](https://docs.docker.com/engine/admin/systemd/#http-proxy) is straightforward.
38,386,821
I am getting an error when i tried to use both mavencli and spring in my maven dependencies. mavencli won't clean and install properly when spring boot is being use. Here is my maven pom.xml ``` <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <artifactId>maven-client</artifactId> <groupId>com.group</groupId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <!-- MAVEN CLI depenedencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.3.3</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-wagon</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.9</version> </dependency> <!-- SPRING BOOT STARTER --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` and here is my stack error ``` 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader. 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary: 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s] 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00 10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M 10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch. 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException ```
2016/07/15
[ "https://Stackoverflow.com/questions/38386821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1852178/" ]
That error message looks like it's coming from a proxy server. From the [docker pull documentation](https://docs.docker.com/engine/reference/commandline/pull/) > > Proxy configuration > > > If you are behind an HTTP proxy server, for example in corporate > settings, before open a connect to registry, you may need to configure > the Docker daemon’s proxy settings, using the HTTP\_PROXY, HTTPS\_PROXY, > and NO\_PROXY environment variables. To set these environment variables > on a host using systemd, refer to the control and configure Docker > with systemd for variables configuration. > > > The link to the [instructions for configuring systemd with a proxy](https://docs.docker.com/engine/admin/systemd/#http-proxy) is straightforward.
I ran into this problem on Ubuntu. I managed to solve it by disconnecting from NordVPN: ``` $ nordvpn disconnect You are disconnected from NordVPN. ``` It seems the VPN somehow slowed down the dockerhub traffic and broke my docker pulls.
38,386,821
I am getting an error when i tried to use both mavencli and spring in my maven dependencies. mavencli won't clean and install properly when spring boot is being use. Here is my maven pom.xml ``` <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <artifactId>maven-client</artifactId> <groupId>com.group</groupId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <!-- MAVEN CLI depenedencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.3.3</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-wagon</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.9</version> </dependency> <!-- SPRING BOOT STARTER --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` and here is my stack error ``` 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader. 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary: 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s] 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00 10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M 10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch. 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException ```
2016/07/15
[ "https://Stackoverflow.com/questions/38386821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1852178/" ]
The error message is little misleading. The problem was not that there was invalid character, but the network was misconfigured. I had one LAN interface and one WLAN interface. LAN interface connects to a router A which forward requests to router B which was connected to internet. While the WLAN interface was directly connected to router B. I forgot to remove the WLAN configuration. Once I ensured the WLAN interface is removed, things worked smoothly. In short: Ensured DNS resolution works and that MTU is set right. **Another possible reason for error** If you are using Mac, please ensure to allow Unrestriction Access to Web Content like below: [![enter image description here](https://i.stack.imgur.com/5Xjoa.png)](https://i.stack.imgur.com/5Xjoa.png) **Another possible step in troubleshooting** Ensure there is no proxy or web filter in your network, that is, if possible connect to your 3G network and try again to see if the results are different
I have run across this issue a couple times with Raspberry Pi boards running various flavors of Debian/Raspbian (RPi model info was obtained by `cat /proc/cpuinfo | grep Model`): * `Raspberry Pi Model B Rev 1` with Raspbian based on Debian 11 (bullseye) * `Raspberry Pi 4 MOdel B Rev 1.4` with Debian 10 (buster) In both cases, running `docker run --rm hello-world` resulted in the `408` HTTP status code reported in the original question in this thread: ```bash $ docker run --rm hello-world Unable to find image 'hello-world:latest' locally docker: Error response from daemon: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body> <h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body> </html>\n". See 'docker run --help'. ``` The solution (noted as an [aside](https://stackoverflow.com/a/38940404/5299483) by [@Romaan](https://stackoverflow.com/users/1707750/romaan)) was to adjust the MTU. I did this as follows: ```bash sudo ip link set dev eth0 mtu 1400 docker run --rm hello-world ``` and the `hello-world` container was successfully pulled and executed. Examples of how to permanently adjust the MTU for a network interface on Debian may be found [here](https://www.debianhelp.co.uk/mtu.htm).
38,386,821
I am getting an error when i tried to use both mavencli and spring in my maven dependencies. mavencli won't clean and install properly when spring boot is being use. Here is my maven pom.xml ``` <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <artifactId>maven-client</artifactId> <groupId>com.group</groupId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <!-- MAVEN CLI depenedencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.3.3</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-wagon</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.9</version> </dependency> <!-- SPRING BOOT STARTER --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` and here is my stack error ``` 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader. 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary: 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s] 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00 10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M 10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch. 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException ```
2016/07/15
[ "https://Stackoverflow.com/questions/38386821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1852178/" ]
The error message is little misleading. The problem was not that there was invalid character, but the network was misconfigured. I had one LAN interface and one WLAN interface. LAN interface connects to a router A which forward requests to router B which was connected to internet. While the WLAN interface was directly connected to router B. I forgot to remove the WLAN configuration. Once I ensured the WLAN interface is removed, things worked smoothly. In short: Ensured DNS resolution works and that MTU is set right. **Another possible reason for error** If you are using Mac, please ensure to allow Unrestriction Access to Web Content like below: [![enter image description here](https://i.stack.imgur.com/5Xjoa.png)](https://i.stack.imgur.com/5Xjoa.png) **Another possible step in troubleshooting** Ensure there is no proxy or web filter in your network, that is, if possible connect to your 3G network and try again to see if the results are different
I ran into this problem on Ubuntu. I managed to solve it by disconnecting from NordVPN: ``` $ nordvpn disconnect You are disconnected from NordVPN. ``` It seems the VPN somehow slowed down the dockerhub traffic and broke my docker pulls.
38,386,821
I am getting an error when i tried to use both mavencli and spring in my maven dependencies. mavencli won't clean and install properly when spring boot is being use. Here is my maven pom.xml ``` <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <artifactId>maven-client</artifactId> <groupId>com.group</groupId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <!-- MAVEN CLI depenedencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.3.3</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-wagon</artifactId> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> <version>2.9</version> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.9</version> </dependency> <!-- SPRING BOOT STARTER --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` and here is my stack error ``` 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader. 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt 10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary: 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s] 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s 10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00 10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M 10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - ----------------------------------------------------- 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1] 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch. 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: 10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException ```
2016/07/15
[ "https://Stackoverflow.com/questions/38386821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1852178/" ]
I have run across this issue a couple times with Raspberry Pi boards running various flavors of Debian/Raspbian (RPi model info was obtained by `cat /proc/cpuinfo | grep Model`): * `Raspberry Pi Model B Rev 1` with Raspbian based on Debian 11 (bullseye) * `Raspberry Pi 4 MOdel B Rev 1.4` with Debian 10 (buster) In both cases, running `docker run --rm hello-world` resulted in the `408` HTTP status code reported in the original question in this thread: ```bash $ docker run --rm hello-world Unable to find image 'hello-world:latest' locally docker: Error response from daemon: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body> <h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body> </html>\n". See 'docker run --help'. ``` The solution (noted as an [aside](https://stackoverflow.com/a/38940404/5299483) by [@Romaan](https://stackoverflow.com/users/1707750/romaan)) was to adjust the MTU. I did this as follows: ```bash sudo ip link set dev eth0 mtu 1400 docker run --rm hello-world ``` and the `hello-world` container was successfully pulled and executed. Examples of how to permanently adjust the MTU for a network interface on Debian may be found [here](https://www.debianhelp.co.uk/mtu.htm).
I ran into this problem on Ubuntu. I managed to solve it by disconnecting from NordVPN: ``` $ nordvpn disconnect You are disconnected from NordVPN. ``` It seems the VPN somehow slowed down the dockerhub traffic and broke my docker pulls.
20,164,956
Hello I am trying to finish my program. I am about two steps away from finishing but i'm stuck on how i can make it so once a box is clicked you can't click on it again until you restart the game. Here is my JavaScript code: ``` var cell; var nextTurn = "X"; function mouseMotion(ref, motion) { if (motion == 'over') { ref.style.borderColor = '#E00'; } else if (motion == 'out') { ref.style.borderColor = '#CCC'; } } function cellClick(cell) { if (cell.id == "cell1x1") { document.getElementById("cell1x1").innerHTML = "X"; document.getElementById("cell1x1").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell1x2") { document.getElementById("cell1x2").innerHTML = "X"; document.getElementById("cell1x2").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell1x3") { document.getElementById("cell1x3").innerHTML = "X"; document.getElementById("cell1x3").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell2x1") { document.getElementById("cell2x1").innerHTML = "X"; document.getElementById("cell2x1").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell2x2") { document.getElementById("cell2x2").innerHTML = "X"; document.getElementById("cell2x2").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell2x3") { document.getElementById("cell2x3").innerHTML = "X"; document.getElementById("cell2x3").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell3x1") { document.getElementById("cell3x1").innerHTML = "X"; document.getElementById("cell3x1").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell3x2") { document.getElementById("cell3x2").innerHTML = "X"; document.getElementById("cell3x2").innerHTML = nextTurn; playersTurn(); } else if (cell.id == "cell3x3") { document.getElementById("cell3x3").innerHTML = "X"; document.getElementById("cell3x3").innerHTML = nextTurn; playersTurn(); } } function playersTurn() { if (nextTurn == 'X') { nextTurn = 'O'; } else { nextTurn = 'X'; } } function startNewGame() { location.reload(true); } ``` Here's my HTML code: ``` <html> <title>Tic Tac Toe</title> <head> <script type="text/javascript" src="tictactoe.js"></script> <link rel="stylesheet" type="text/css" href="tictactoestyle.css"> </head> <body> <div id="playersTurn">&nbsp;</div> <div id="winnerIs"></div> <table id="tttTable" align="center"> <tr> <td id="cell1x1" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell1x2" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell1x3" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> </tr> <tr> <td id="cell2x1" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell2x2" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell2x3" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> </tr> <tr> <td id="cell3x1" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell3x2" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> <td id="cell3x3" class="cell" onclick="cellClick(this);" onMouseOver="mouseMotion(this, 'over');" onMouseOut="mouseMotion(this, 'out');">&nbsp;</td> </tr> </table> <input id="newGameBtn" type="button" value="Start New Game" onclick="startNewGame();" /> </body> </html> ``` I am still very new to writing javascript so please be gentle. So how would i make it so after a person clicks on a cell it won't let anyone else click it until you reset the game? Thank you for your help!
2013/11/23
[ "https://Stackoverflow.com/questions/20164956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3025364/" ]
You could check if the box has already been clicked, at the top of your function: ``` function cellClick(cell) { if (cell.innerHTML === "X" || cell.innerHTML === "O") { return; } ... ``` By the way, your code is horribly verbose. The following: ``` if (cell.id == "cell1x1") { document.getElementById("cell1x1").innerHTML = nextTurn; ``` could be compressed down to: ``` document.getElementById(cell.id).innerHTML = nextTurn; ``` which can be again compressed to: ``` cell.innerHTML = nextTurn; ``` There is no need for the `if` statements in what you have written above.
An easier way would be to use the DOM. Use that variable you pass to your function called `cell` in order to remove the onClick Attribute before doing anything else in the function, like so: ``` function cellClick(cell) { document.getElementById(cell).removeAttribute('onClick'); //and that's all you really need... //then when you refresh and/or regenerate the table, //the onClick Attribute should come back. } ```
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
I use this SQL code to implement the pagination with Access `Select TOP Row_Per_Page * From [` `Select TOP (TotRows - ((Page_Number - 1) * Row_Per_Page)` `From SampleTable Order By ColumnName DESC` `] Order By ColumnName ASC` I've published an article with some screenshots [on my blog](http://www.jertix.org/en/blog/programming/implementation-of-sql-pagination-with-ms-access.html)
One easy way to use limit or get pagination working in access is to use ADODB library which support pagination for many DBs with same syntax. <http://phplens.com/lens/adodb/docs-adodb.htm#ex8> Its easy to modify/override pager class to fetch required number of rows in array format then.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
This is the simple method of pagination using OleDbDataAdapter and Datatable classes. I am using a different SQL command for simplicity. ``` Dim sSQL As String = "select Name, Id from Customer order by Id" Dim pageNumber As Integer = 1 Dim nTop As Integer = 20 Dim nSkip As Integer = 0 Dim bContinue As Boolean = True Dim dtData as new Datatable Do While bContinue dtData = GetData(sSQL, nTop, nSkip, ConnectionString) nSkip = pageNumber * nTop pageNumber = pageNumber + 1 bContinue = dtData.Rows.Count > 0 If bContinue Then For Each dr As DataRow In dtData.Rows 'do your work here Next End If Loop ``` Here is the GetData Function. ``` Private Function GetData(ByVal sql As String, ByVal RecordsToFetch As Integer, ByVal StartFrom As Integer, ByVal BackEndTableConnection As String) As DataTable Dim dtResult As New DataTable Try Using conn As New OleDb.OleDbConnection(BackEndTableConnection) conn.Open() Using cmd As New OleDb.OleDbCommand cmd.Connection = conn cmd.CommandText = sql Using da As New OleDb.OleDbDataAdapter(cmd) If RecordsToFetch > 0 Then da.Fill(StartFrom, RecordsToFetch, dtResult) Else da.Fill(dtResult) End If End Using End Using End Using Catch ex As Exception End Try Return dtResult End Function ``` The above codes will return 10 rows from the table Customer each time the loop operate till the end of file.
One easy way to use limit or get pagination working in access is to use ADODB library which support pagination for many DBs with same syntax. <http://phplens.com/lens/adodb/docs-adodb.htm#ex8> Its easy to modify/override pager class to fetch required number of rows in array format then.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
See [astander's answer](https://stackoverflow.com/questions/1900635/how-do-i-implement-pagination-in-sql-for-ms-access/1900668#1900668) for the original answer, but here's my final implementation that takes into account some ODBC parser rules (for the first 15 records after skipping 30): ``` SELECT * FROM ( SELECT Top 15 -- = PageSize * FROM ( SELECT TOP 45 -- = StartPos + PageSize * FROM tblClient ORDER BY Client ) AS sub1 ORDER BY sub1.Client DESC ) AS clients ORDER BY Client ``` The difference here is that I need the pagination to work when sorted by client name, and I need all columns (well, actually just a subset, but I sort that out in the outer-most query).
``` SELECT * FROM BS_FOTOS AS TBL1 WHERE ((((select COUNT(ID) AS DD FROM BS_FOTOS AS TBL2 WHERE TBL2.ID<=TBL1.ID)) BETWEEN 10 AND 15 )); ``` Its result 10 to 15 records only.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
If you wish to apply paging in MS Acces use this ``` SELECT * FROM ( SELECT Top 5 sub.ClientCode FROM ( SELECT TOP 15 tblClient.ClientCode FROM tblClient ORDER BY tblClient.ClientCode ) sub ORDER BY sub.ClientCode DESC ) subOrdered ORDER BY subOrdered.ClientCode ``` Where 15 is the *StartPos + PageSize*, and 5 is the *PageSize*. **EDIT to comment:** The error you are receiving, is because you are trying to reference a column name assign in the same level of the query, namely *rownumber*. If you were to change your query to: ``` SELECT * FROM ( SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 ) WHERE rownumber BETWEEN 0 AND 15 ``` It should not give you an error, but i dont think that this is the paging result you want.
I use this SQL code to implement the pagination with Access `Select TOP Row_Per_Page * From [` `Select TOP (TotRows - ((Page_Number - 1) * Row_Per_Page)` `From SampleTable Order By ColumnName DESC` `] Order By ColumnName ASC` I've published an article with some screenshots [on my blog](http://www.jertix.org/en/blog/programming/implementation-of-sql-pagination-with-ms-access.html)
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
If you wish to apply paging in MS Acces use this ``` SELECT * FROM ( SELECT Top 5 sub.ClientCode FROM ( SELECT TOP 15 tblClient.ClientCode FROM tblClient ORDER BY tblClient.ClientCode ) sub ORDER BY sub.ClientCode DESC ) subOrdered ORDER BY subOrdered.ClientCode ``` Where 15 is the *StartPos + PageSize*, and 5 is the *PageSize*. **EDIT to comment:** The error you are receiving, is because you are trying to reference a column name assign in the same level of the query, namely *rownumber*. If you were to change your query to: ``` SELECT * FROM ( SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 ) WHERE rownumber BETWEEN 0 AND 15 ``` It should not give you an error, but i dont think that this is the paging result you want.
One easy way to use limit or get pagination working in access is to use ADODB library which support pagination for many DBs with same syntax. <http://phplens.com/lens/adodb/docs-adodb.htm#ex8> Its easy to modify/override pager class to fetch required number of rows in array format then.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
If you wish to apply paging in MS Acces use this ``` SELECT * FROM ( SELECT Top 5 sub.ClientCode FROM ( SELECT TOP 15 tblClient.ClientCode FROM tblClient ORDER BY tblClient.ClientCode ) sub ORDER BY sub.ClientCode DESC ) subOrdered ORDER BY subOrdered.ClientCode ``` Where 15 is the *StartPos + PageSize*, and 5 is the *PageSize*. **EDIT to comment:** The error you are receiving, is because you are trying to reference a column name assign in the same level of the query, namely *rownumber*. If you were to change your query to: ``` SELECT * FROM ( SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 ) WHERE rownumber BETWEEN 0 AND 15 ``` It should not give you an error, but i dont think that this is the paging result you want.
See [astander's answer](https://stackoverflow.com/questions/1900635/how-do-i-implement-pagination-in-sql-for-ms-access/1900668#1900668) for the original answer, but here's my final implementation that takes into account some ODBC parser rules (for the first 15 records after skipping 30): ``` SELECT * FROM ( SELECT Top 15 -- = PageSize * FROM ( SELECT TOP 45 -- = StartPos + PageSize * FROM tblClient ORDER BY Client ) AS sub1 ORDER BY sub1.Client DESC ) AS clients ORDER BY Client ``` The difference here is that I need the pagination to work when sorted by client name, and I need all columns (well, actually just a subset, but I sort that out in the outer-most query).
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
I use this SQL code to implement the pagination with Access `Select TOP Row_Per_Page * From [` `Select TOP (TotRows - ((Page_Number - 1) * Row_Per_Page)` `From SampleTable Order By ColumnName DESC` `] Order By ColumnName ASC` I've published an article with some screenshots [on my blog](http://www.jertix.org/en/blog/programming/implementation-of-sql-pagination-with-ms-access.html)
``` SELECT * FROM BS_FOTOS AS TBL1 WHERE ((((select COUNT(ID) AS DD FROM BS_FOTOS AS TBL2 WHERE TBL2.ID<=TBL1.ID)) BETWEEN 10 AND 15 )); ``` Its result 10 to 15 records only.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
If you wish to apply paging in MS Acces use this ``` SELECT * FROM ( SELECT Top 5 sub.ClientCode FROM ( SELECT TOP 15 tblClient.ClientCode FROM tblClient ORDER BY tblClient.ClientCode ) sub ORDER BY sub.ClientCode DESC ) subOrdered ORDER BY subOrdered.ClientCode ``` Where 15 is the *StartPos + PageSize*, and 5 is the *PageSize*. **EDIT to comment:** The error you are receiving, is because you are trying to reference a column name assign in the same level of the query, namely *rownumber*. If you were to change your query to: ``` SELECT * FROM ( SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 ) WHERE rownumber BETWEEN 0 AND 15 ``` It should not give you an error, but i dont think that this is the paging result you want.
``` SELECT * FROM BS_FOTOS AS TBL1 WHERE ((((select COUNT(ID) AS DD FROM BS_FOTOS AS TBL2 WHERE TBL2.ID<=TBL1.ID)) BETWEEN 10 AND 15 )); ``` Its result 10 to 15 records only.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
If you wish to apply paging in MS Acces use this ``` SELECT * FROM ( SELECT Top 5 sub.ClientCode FROM ( SELECT TOP 15 tblClient.ClientCode FROM tblClient ORDER BY tblClient.ClientCode ) sub ORDER BY sub.ClientCode DESC ) subOrdered ORDER BY subOrdered.ClientCode ``` Where 15 is the *StartPos + PageSize*, and 5 is the *PageSize*. **EDIT to comment:** The error you are receiving, is because you are trying to reference a column name assign in the same level of the query, namely *rownumber*. If you were to change your query to: ``` SELECT * FROM ( SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 ) WHERE rownumber BETWEEN 0 AND 15 ``` It should not give you an error, but i dont think that this is the paging result you want.
This is the simple method of pagination using OleDbDataAdapter and Datatable classes. I am using a different SQL command for simplicity. ``` Dim sSQL As String = "select Name, Id from Customer order by Id" Dim pageNumber As Integer = 1 Dim nTop As Integer = 20 Dim nSkip As Integer = 0 Dim bContinue As Boolean = True Dim dtData as new Datatable Do While bContinue dtData = GetData(sSQL, nTop, nSkip, ConnectionString) nSkip = pageNumber * nTop pageNumber = pageNumber + 1 bContinue = dtData.Rows.Count > 0 If bContinue Then For Each dr As DataRow In dtData.Rows 'do your work here Next End If Loop ``` Here is the GetData Function. ``` Private Function GetData(ByVal sql As String, ByVal RecordsToFetch As Integer, ByVal StartFrom As Integer, ByVal BackEndTableConnection As String) As DataTable Dim dtResult As New DataTable Try Using conn As New OleDb.OleDbConnection(BackEndTableConnection) conn.Open() Using cmd As New OleDb.OleDbCommand cmd.Connection = conn cmd.CommandText = sql Using da As New OleDb.OleDbDataAdapter(cmd) If RecordsToFetch > 0 Then da.Fill(StartFrom, RecordsToFetch, dtResult) Else da.Fill(dtResult) End If End Using End Using End Using Catch ex As Exception End Try Return dtResult End Function ``` The above codes will return 10 rows from the table Customer each time the loop operate till the end of file.
1,900,635
I'm accessing a Microsoft Access 2002 database (MDB) using ASP.NET through the `OdbcConnection` class, which works quite well albeit very slowly. My question is about how to implement pagination in SQL for queries to this database, as I know I can implement the `TOP` clause as: ``` SELECT TOP 15 * FROM table ``` but I am unable to find a way to limit this to an offset as can be done with SQL Server using ROWNUMBER. My best attempt was: ``` SELECT ClientCode, (SELECT COUNT(c2.ClientCode) FROM tblClient AS c2 WHERE c2.ClientCode <= c1.ClientCode) AS rownumber FROM tblClient AS c1 WHERE rownumber BETWEEN 0 AND 15 ``` which fails with: > > Error Source: Microsoft JET Database Engine > > > Error Message: No value given for one or more required parameters. > > > I can't work out this error, but I'm assuming it has something to do with the sub-query that determines a `rownumber`? Any help would be appreciated with this; my searches on google have yielded unhelpful results :(
2009/12/14
[ "https://Stackoverflow.com/questions/1900635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209668/" ]
This is the simple method of pagination using OleDbDataAdapter and Datatable classes. I am using a different SQL command for simplicity. ``` Dim sSQL As String = "select Name, Id from Customer order by Id" Dim pageNumber As Integer = 1 Dim nTop As Integer = 20 Dim nSkip As Integer = 0 Dim bContinue As Boolean = True Dim dtData as new Datatable Do While bContinue dtData = GetData(sSQL, nTop, nSkip, ConnectionString) nSkip = pageNumber * nTop pageNumber = pageNumber + 1 bContinue = dtData.Rows.Count > 0 If bContinue Then For Each dr As DataRow In dtData.Rows 'do your work here Next End If Loop ``` Here is the GetData Function. ``` Private Function GetData(ByVal sql As String, ByVal RecordsToFetch As Integer, ByVal StartFrom As Integer, ByVal BackEndTableConnection As String) As DataTable Dim dtResult As New DataTable Try Using conn As New OleDb.OleDbConnection(BackEndTableConnection) conn.Open() Using cmd As New OleDb.OleDbCommand cmd.Connection = conn cmd.CommandText = sql Using da As New OleDb.OleDbDataAdapter(cmd) If RecordsToFetch > 0 Then da.Fill(StartFrom, RecordsToFetch, dtResult) Else da.Fill(dtResult) End If End Using End Using End Using Catch ex As Exception End Try Return dtResult End Function ``` The above codes will return 10 rows from the table Customer each time the loop operate till the end of file.
``` SELECT * FROM BS_FOTOS AS TBL1 WHERE ((((select COUNT(ID) AS DD FROM BS_FOTOS AS TBL2 WHERE TBL2.ID<=TBL1.ID)) BETWEEN 10 AND 15 )); ``` Its result 10 to 15 records only.
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
In streaming.py, adding verify = False in line# 105 did the trick for me as shown below. Though it is not advisable to use this approach as it makes the connection unsafe. Haven't been able to come up with a workaround for this yet. ``` stream = Stream(auth, listener, verify = False) ```
First, verify if you can access twitter just using a proxy configuration. If so, you can modify this line on your code to include a proxy URL: ``` self.api = tweepy.API(self.auth) ```
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
In streaming.py, adding verify = False in line# 105 did the trick for me as shown below. Though it is not advisable to use this approach as it makes the connection unsafe. Haven't been able to come up with a workaround for this yet. ``` stream = Stream(auth, listener, verify = False) ```
Adding `verify=False` will ignore the validation that has to be made and all the data will be transferred in plain text without any encryption. ``` pip install certifi ``` The above installation fixes the bad handshake and ssl error.
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
In streaming.py, adding verify = False in line# 105 did the trick for me as shown below. Though it is not advisable to use this approach as it makes the connection unsafe. Haven't been able to come up with a workaround for this yet. ``` stream = Stream(auth, listener, verify = False) ```
For anybody that might stumble on this like I did, I had a similar problem because my company was using a proxy, and the SSL check failed while trying to verify the proxy's certificate. The solution was to export the proxy's root certificate as a `.pem` file. Then you can add this certificate to `certifi`'s trust store by doing: ```py import certifi cafile = certifi.where() with open(r<path to pem file>, 'rb') as infile: customca = infile.read() with open(cafile, 'ab') as outfile: outfile.write(customca) ``` You'll have to replace `<path to pem file>` with the path to the exported file. This should allow `requests` (and `tweepy`) to successfully validate the certificates.
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
I ran into the same problem and unfortunately the only thing that worked was setting verify=False in auth.py in Tweepy (for me Tweepy is located in `/anaconda3/lib/python3.6/site-packages/tweepy` on my Mac): ``` resp = requests.post(self._get_oauth_url('token'), auth=(self.consumer_key, self.consumer_secret), data={'grant_type': 'client_credentials'}, verify=False) ``` Edit: Behind a corporate firewall, there is a certificate issue. In chrome go to settings-->advanced-->certificates and download your corporate CA certificate. Then, in Tweepy binder.py, right under `session = requests.session()` add `session.verify = 'path_to_corporate_certificate.cer'`
First, verify if you can access twitter just using a proxy configuration. If so, you can modify this line on your code to include a proxy URL: ``` self.api = tweepy.API(self.auth) ```
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
I ran into the same problem and unfortunately the only thing that worked was setting verify=False in auth.py in Tweepy (for me Tweepy is located in `/anaconda3/lib/python3.6/site-packages/tweepy` on my Mac): ``` resp = requests.post(self._get_oauth_url('token'), auth=(self.consumer_key, self.consumer_secret), data={'grant_type': 'client_credentials'}, verify=False) ``` Edit: Behind a corporate firewall, there is a certificate issue. In chrome go to settings-->advanced-->certificates and download your corporate CA certificate. Then, in Tweepy binder.py, right under `session = requests.session()` add `session.verify = 'path_to_corporate_certificate.cer'`
Adding `verify=False` will ignore the validation that has to be made and all the data will be transferred in plain text without any encryption. ``` pip install certifi ``` The above installation fixes the bad handshake and ssl error.
37,349,419
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. `SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)` My code is like this. `auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)` I found this post [Python Requests throwing up SSLError](https://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror) and set the following code (`verify = false`) may be a quick solution. Does anyone know how to do it or other ways in tweepy? Thank you.
2016/05/20
[ "https://Stackoverflow.com/questions/37349419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902996/" ]
I ran into the same problem and unfortunately the only thing that worked was setting verify=False in auth.py in Tweepy (for me Tweepy is located in `/anaconda3/lib/python3.6/site-packages/tweepy` on my Mac): ``` resp = requests.post(self._get_oauth_url('token'), auth=(self.consumer_key, self.consumer_secret), data={'grant_type': 'client_credentials'}, verify=False) ``` Edit: Behind a corporate firewall, there is a certificate issue. In chrome go to settings-->advanced-->certificates and download your corporate CA certificate. Then, in Tweepy binder.py, right under `session = requests.session()` add `session.verify = 'path_to_corporate_certificate.cer'`
For anybody that might stumble on this like I did, I had a similar problem because my company was using a proxy, and the SSL check failed while trying to verify the proxy's certificate. The solution was to export the proxy's root certificate as a `.pem` file. Then you can add this certificate to `certifi`'s trust store by doing: ```py import certifi cafile = certifi.where() with open(r<path to pem file>, 'rb') as infile: customca = infile.read() with open(cafile, 'ab') as outfile: outfile.write(customca) ``` You'll have to replace `<path to pem file>` with the path to the exported file. This should allow `requests` (and `tweepy`) to successfully validate the certificates.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
I did some more research and could see that this can happen if there are concurrent requests to create queue/table with same name. Azure seems rejecting those requests with custom 409 http code which is meant for applications. To reproduce even in the latest Azure SDK, just have a webjob to process queues and start the JobHost only after having many requests in queue. In the Job function Get the blob as TextWriter and write into it. Makes sure the blob 'logs/webjob1' is not present when the JobHost starts to see the issue. ``` public static void ProcessQueueMessage([QueueTrigger("testqueue1")] string inputText, [Blob("logs/webjob1")]TextWriter writer) { writer.WriteLine(inputText); } ``` I just had 4 items in the queue when I started JobHost and was able to see the issue from Azure. Used free hosting.
I was getting the same error code > > > ``` > 2018-08-18T23:06:02.2102822Z ##[error]Conflict > 2018-08-18T23:06:02.2119417Z ##[error]Unable to retrieve connection details for Azure App Service : KaktusWatch. Status Code: 409 (Conflict) > 2018-08-18T23:06:02.2150200Z ##[section]Finishing: Deploy Azure App Service > > ``` > > In my case the **webjob-publish-settings.json** was obsolete. I had to fill in `interval` and `jobRecurrenceFrequency` settings parameters.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
I did some more research and could see that this can happen if there are concurrent requests to create queue/table with same name. Azure seems rejecting those requests with custom 409 http code which is meant for applications. To reproduce even in the latest Azure SDK, just have a webjob to process queues and start the JobHost only after having many requests in queue. In the Job function Get the blob as TextWriter and write into it. Makes sure the blob 'logs/webjob1' is not present when the JobHost starts to see the issue. ``` public static void ProcessQueueMessage([QueueTrigger("testqueue1")] string inputText, [Blob("logs/webjob1")]TextWriter writer) { writer.WriteLine(inputText); } ``` I just had 4 items in the queue when I started JobHost and was able to see the issue from Azure. Used free hosting.
We started receiving a 409 Conflict exception from Azure Web Jobs shortly after a release thrown from Microsoft.WindowsAzure.Storage. Not long before this release we had implemented archiving of older blobs. It turns out having readonly blobs in our storage (Archived) was the reason behind this exception being thrown in our case. It was not immediately evident that this was the culprit, I suspect it took time before the webjob started hitting the archived blobs. Once we removed the archived messages from our blob storage, the webjob was able to resume.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
I did some more research and could see that this can happen if there are concurrent requests to create queue/table with same name. Azure seems rejecting those requests with custom 409 http code which is meant for applications. To reproduce even in the latest Azure SDK, just have a webjob to process queues and start the JobHost only after having many requests in queue. In the Job function Get the blob as TextWriter and write into it. Makes sure the blob 'logs/webjob1' is not present when the JobHost starts to see the issue. ``` public static void ProcessQueueMessage([QueueTrigger("testqueue1")] string inputText, [Blob("logs/webjob1")]TextWriter writer) { writer.WriteLine(inputText); } ``` I just had 4 items in the queue when I started JobHost and was able to see the issue from Azure. Used free hosting.
When I was getting this error, I realized that the Jenkins job I was calling didn't have the parameters I was passing to it. Once I added the parameters, it worked fine.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
Changing the jobRecurrenceFrequency in webjob-publish-settings.json to "Hour" worked for my <https://error404.atomseo.com> project! I had the same problem and it turned out that publish process failed because I set it to recur every 10 minutes while the app was meant to run in free tier. As MS describes here: <https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/> one can deploy with all frequencies other than those defined in minutes.
I was getting the same error code > > > ``` > 2018-08-18T23:06:02.2102822Z ##[error]Conflict > 2018-08-18T23:06:02.2119417Z ##[error]Unable to retrieve connection details for Azure App Service : KaktusWatch. Status Code: 409 (Conflict) > 2018-08-18T23:06:02.2150200Z ##[section]Finishing: Deploy Azure App Service > > ``` > > In my case the **webjob-publish-settings.json** was obsolete. I had to fill in `interval` and `jobRecurrenceFrequency` settings parameters.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
Changing the jobRecurrenceFrequency in webjob-publish-settings.json to "Hour" worked for my <https://error404.atomseo.com> project! I had the same problem and it turned out that publish process failed because I set it to recur every 10 minutes while the app was meant to run in free tier. As MS describes here: <https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/> one can deploy with all frequencies other than those defined in minutes.
We started receiving a 409 Conflict exception from Azure Web Jobs shortly after a release thrown from Microsoft.WindowsAzure.Storage. Not long before this release we had implemented archiving of older blobs. It turns out having readonly blobs in our storage (Archived) was the reason behind this exception being thrown in our case. It was not immediately evident that this was the culprit, I suspect it took time before the webjob started hitting the archived blobs. Once we removed the archived messages from our blob storage, the webjob was able to resume.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
Changing the jobRecurrenceFrequency in webjob-publish-settings.json to "Hour" worked for my <https://error404.atomseo.com> project! I had the same problem and it turned out that publish process failed because I set it to recur every 10 minutes while the app was meant to run in free tier. As MS describes here: <https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/> one can deploy with all frequencies other than those defined in minutes.
When I was getting this error, I realized that the Jenkins job I was calling didn't have the parameters I was passing to it. Once I added the parameters, it worked fine.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
I was getting the same error code > > > ``` > 2018-08-18T23:06:02.2102822Z ##[error]Conflict > 2018-08-18T23:06:02.2119417Z ##[error]Unable to retrieve connection details for Azure App Service : KaktusWatch. Status Code: 409 (Conflict) > 2018-08-18T23:06:02.2150200Z ##[section]Finishing: Deploy Azure App Service > > ``` > > In my case the **webjob-publish-settings.json** was obsolete. I had to fill in `interval` and `jobRecurrenceFrequency` settings parameters.
When I was getting this error, I realized that the Jenkins job I was calling didn't have the parameters I was passing to it. Once I added the parameters, it worked fine.
25,169,467
I had a C# WebJob that was working nicely with the alpha WebJob api. I just updated it to the beta release, and after fixing connection strings and namespaces I get a HTTP 409 (Conflict) error when the JobHost tries to connect. Here is the call stack: ``` Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.TableOperationPreProcess(Microsoft.WindowsAzure.Storage.Table.TableResult result, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, System.Net.HttpWebResponse resp, System.Exception ex) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertImpl.AnonymousMethod__2(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, System.Net.HttpWebResponse resp, System.Exception ex, Microsoft.WindowsAzure.Storage.OperationContext ctx) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync<Microsoft.WindowsAzure.Storage.Table.TableResult>(Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand<Microsoft.WindowsAzure.Storage.Table.TableResult> cmd, Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy policy, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, Microsoft.WindowsAzure.Storage.Table.CloudTable table, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.WindowsAzure.Storage.dll!Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Storage.SdkCloudStorageAccount.Table.GetOrInsert<Microsoft.Azure.Jobs.Host.Runners.HostEntity>(Microsoft.Azure.Jobs.Host.Runners.HostEntity entity) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.Host.Runners.HostTable.GetOrCreateHostId(string hostName) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHostContext.JobHostContext(string dashboardConnectionString, string storageConnectionString, string serviceBusConnectionString, Microsoft.Azure.Jobs.ITypeLocator typeLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.GetHostContext(Microsoft.Azure.Jobs.ITypeLocator typesLocator, Microsoft.Azure.Jobs.INameResolver nameResolver) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(System.IServiceProvider serviceProvider) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost(Microsoft.Azure.Jobs.JobHostConfiguration configuration) Unknown Microsoft.Azure.Jobs.Host.dll!Microsoft.Azure.Jobs.JobHost.JobHost() Unknown ``` Exception text: [Microsoft.WindowsAzure.Storage.StorageException] {"The remote server returned an error: (409) Conflict."} Microsoft.WindowsAzure.Storage.StorageException packages.config: > > package id="Microsoft.Azure.Jobs" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Azure.Jobs.Core" > version="0.3.1-beta" targetFramework="net45" package > id="Microsoft.Azure.Jobs.ServiceBus" version="0.3.1-beta" > targetFramework="net45" package id="Microsoft.Bcl" version="1.1.7" > targetFramework="net45" package id="Microsoft.Bcl.Build" > version="1.0.14" targetFramework="net45" package > id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" > > package id="Microsoft.Data.OData" version="5.6.0" > targetFramework="net45" package id="Microsoft.Data.Services.Client" > version="5.6.0" targetFramework="net45" package > id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" > > package id="Microsoft.WindowsAzure.ConfigurationManager" > version="2.0.3" targetFramework="net45" package id="Newtonsoft.Json" > version="6.0.4" targetFramework="net45" package id="System.Spatial" > version="5.6.0" targetFramework="net45" package > id="WindowsAzure.MobileServices" version="1.3.0-alpha4" > targetFramework="net45" package id="WindowsAzure.ServiceBus" > version="2.4.2.0" targetFramework="net45" package > id="WindowsAzure.Storage" version="4.2.0" targetFramework="net45" > > > Any ideas?
2014/08/06
[ "https://Stackoverflow.com/questions/25169467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634845/" ]
We started receiving a 409 Conflict exception from Azure Web Jobs shortly after a release thrown from Microsoft.WindowsAzure.Storage. Not long before this release we had implemented archiving of older blobs. It turns out having readonly blobs in our storage (Archived) was the reason behind this exception being thrown in our case. It was not immediately evident that this was the culprit, I suspect it took time before the webjob started hitting the archived blobs. Once we removed the archived messages from our blob storage, the webjob was able to resume.
When I was getting this error, I realized that the Jenkins job I was calling didn't have the parameters I was passing to it. Once I added the parameters, it worked fine.
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
Either `serialize()` or `json_encode()` it, save it as a longtext database record. * <http://us.php.net/serialize> * <http://us.php.net/json-encode> * <http://dev.mysql.com/doc/refman/5.0/en/blob.html>
You can try storing the whole json object as plain text in user-specific files. That would make serving the settings really easy, since it would be plain json that simple needs to be evaluated. It seems a bit unorthodox though. When you say 800 entries do you mean 1. id : 0, timestamp : XXXXXXXXXXXXX, idSlider : X, etc 2. id : 1, timestamp : XXXXXXXXXXXXX, idSlider.... Or 800 user entries? Because you could save the whole object in the database as well and save yourself from executing lots of "costy" queries.
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
Either `serialize()` or `json_encode()` it, save it as a longtext database record. * <http://us.php.net/serialize> * <http://us.php.net/json-encode> * <http://dev.mysql.com/doc/refman/5.0/en/blob.html>
If you are concerned more about storage size than read/write performance you could [encode the array as json string](http://us.php.net/json-encode), [compress it using zlib library](http://php.net/manual/en/function.gzcompress.php) and [save it as a file](http://php.net/manual/en/function.file-put-contents.php).
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
Either `serialize()` or `json_encode()` it, save it as a longtext database record. * <http://us.php.net/serialize> * <http://us.php.net/json-encode> * <http://dev.mysql.com/doc/refman/5.0/en/blob.html>
This is a perfect use case for [MongoDB](http://www.mongodb.org/).
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
I think 800 is not as massive as you think. You could just save it to a database and transfer it with JSON. I believe the database should be pretty efficient and not waste a lot of storage, but this can depend on how you setup your tables. Don't use char() columns, for example. To see which uses more or less storage you could calculate how much space 1000 entries would take, then put them in the database and see how much space it uses and how much it's wasting. If you really were dealing with a very large number of items then network performance will probably become your first bottleneck. For loading I would then stream javascript to the browser so that the browser doesn't have to load the whole thing into memory. Also, for sending you would want to create manageable chunks of maybe 1000 at a time and send them in these chunks. But, this is assuming you're dealing with more data.
You can try storing the whole json object as plain text in user-specific files. That would make serving the settings really easy, since it would be plain json that simple needs to be evaluated. It seems a bit unorthodox though. When you say 800 entries do you mean 1. id : 0, timestamp : XXXXXXXXXXXXX, idSlider : X, etc 2. id : 1, timestamp : XXXXXXXXXXXXX, idSlider.... Or 800 user entries? Because you could save the whole object in the database as well and save yourself from executing lots of "costy" queries.
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
You can try storing the whole json object as plain text in user-specific files. That would make serving the settings really easy, since it would be plain json that simple needs to be evaluated. It seems a bit unorthodox though. When you say 800 entries do you mean 1. id : 0, timestamp : XXXXXXXXXXXXX, idSlider : X, etc 2. id : 1, timestamp : XXXXXXXXXXXXX, idSlider.... Or 800 user entries? Because you could save the whole object in the database as well and save yourself from executing lots of "costy" queries.
If you are concerned more about storage size than read/write performance you could [encode the array as json string](http://us.php.net/json-encode), [compress it using zlib library](http://php.net/manual/en/function.gzcompress.php) and [save it as a file](http://php.net/manual/en/function.file-put-contents.php).
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
You can try storing the whole json object as plain text in user-specific files. That would make serving the settings really easy, since it would be plain json that simple needs to be evaluated. It seems a bit unorthodox though. When you say 800 entries do you mean 1. id : 0, timestamp : XXXXXXXXXXXXX, idSlider : X, etc 2. id : 1, timestamp : XXXXXXXXXXXXX, idSlider.... Or 800 user entries? Because you could save the whole object in the database as well and save yourself from executing lots of "costy" queries.
This is a perfect use case for [MongoDB](http://www.mongodb.org/).
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
I think 800 is not as massive as you think. You could just save it to a database and transfer it with JSON. I believe the database should be pretty efficient and not waste a lot of storage, but this can depend on how you setup your tables. Don't use char() columns, for example. To see which uses more or less storage you could calculate how much space 1000 entries would take, then put them in the database and see how much space it uses and how much it's wasting. If you really were dealing with a very large number of items then network performance will probably become your first bottleneck. For loading I would then stream javascript to the browser so that the browser doesn't have to load the whole thing into memory. Also, for sending you would want to create manageable chunks of maybe 1000 at a time and send them in these chunks. But, this is assuming you're dealing with more data.
If you are concerned more about storage size than read/write performance you could [encode the array as json string](http://us.php.net/json-encode), [compress it using zlib library](http://php.net/manual/en/function.gzcompress.php) and [save it as a file](http://php.net/manual/en/function.file-put-contents.php).
7,237,739
I am currently working on a web-page in HTML5/Javascript, where the user can record the value of sliders changed in a period of time. For example, when the user click Record, a timer will start and every time the user move a slider, its value will be saved in an array. When the user stop the record and play, all sliders will then be 'played' as he recorded them. I store the value in an array, something like that: array[3] : {timeStamp, idSlider, valueSlider} The array can actually become pretty massive as the user can then record over the already recorded settings without losing the previous one, this allow the user to change multiple sliders for the same time stamp. I now want to be able to save this array somewhere (on server side), so the user can come back to the website later on, and just load its recorded settings, but I am not sure of the best approach to do that. I am thinking of a dataBase, but not sure if this will be a bit slow to save and load from the server, plus my DataBase capacity is pretty small (around 25 Mo on my OVH server). I am thinking of maybe an average of 800 entries to save. Maybe in a file (XML ?), but then I have no idea how to save that on my server-side... Any other idea is welcome as I am a bit stuck on this one. Thanks & sorry for any english mistakes, Cheers, Mat
2011/08/30
[ "https://Stackoverflow.com/questions/7237739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918807/" ]
I think 800 is not as massive as you think. You could just save it to a database and transfer it with JSON. I believe the database should be pretty efficient and not waste a lot of storage, but this can depend on how you setup your tables. Don't use char() columns, for example. To see which uses more or less storage you could calculate how much space 1000 entries would take, then put them in the database and see how much space it uses and how much it's wasting. If you really were dealing with a very large number of items then network performance will probably become your first bottleneck. For loading I would then stream javascript to the browser so that the browser doesn't have to load the whole thing into memory. Also, for sending you would want to create manageable chunks of maybe 1000 at a time and send them in these chunks. But, this is assuming you're dealing with more data.
This is a perfect use case for [MongoDB](http://www.mongodb.org/).
33,203,609
So I volunteered to create a user form at work and thought I'd add a fun little twist and do it in HTML/CSS/PHP/mySQL rather than MS word. Basically, this is a form I'll be using to add and delete user from my database. I've already finished the initial form, created a PHP file to save everything in my database and linked it properly. My question is, how do I create a page with a drop down list of all Names/Last Names/IDs where the person browsing it could click "submit" and get all the information about the user? I've been googling for hours now, but to no avail as it seems that some people have similar problems, but are missing some large puzzle piece that I need as well. I know it sounds a bit confusing, so here's my code so that you can get a better idea: **HTML:** ```css @charset "UTF-8"; table, th, td {} table { border-collapse: collapse; } td { padding: 3px; } input[type="text"], textarea { background-color: #F8FCFF; border: 2px solid #eeeeee; color: #333333; font-size: 0.9em; font-style: normal; font-weight: 400; font-family: Tahoma; Helvetica; } body { background-color: #e6e6e6; margin: 0 auto; } f { font-style: normal; font-weight: 550; font-family: sans-serif; source-sans-pro; } bigbold { font-style: normal; font-weight: bold; font-size: 20px; font-family: sans-serif; source-sans-pro; } info { font-style: normal; font-weight: bold; font-family: sans-serif; source-sans-pro; } .tr-top { border-top: 1pt solid black; } .tr-left { border-left: 1pt solid black; } .td-left { border-left: 1pt solid black; width: 35%; } .checkboxes label { display: block; float: left; padding-right: 10px; white-space: nowrap; } .checkboxes input { vertical-align: middle; } .checkboxes label span { vertical-align: middle; } #body1 { width: 1000px; background: #fff; height: 100%; } #wrapper { max-width: 1000px; height: 100%; background: #fff; margin: 0px auto 0; padding: 20px; } #colour { background: #C6DEFF; } </style> ``` ```html <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled D <!--#include file="NewUser_get.php" --> ocument</title> <link href="Untitled-4.css" rel="stylesheet" type="text/css"> </head> <body> <!--<div id="body1">--> <div id="wrapper"> <div id="head"> <form action="NewUser_get.php" method="POST"> <table style="width:1000px"> <tr> <td width=90%> <f>Request date:</f> <br> <input type="date" name="RequestDate"> </td> <td width=10%> <f>Requested by:</f> <br> <input type="text" style="width: 166px;" name="RequestBy"> </td> </tr> </table> <br> <div id="colour"> <info> <center>New User Info</center> </info> </div> <br> <table style="width:100%"> <tr> <td> <f>Employee's last name:&nbsp;</f> <input type="text" placeholder="Click to type" name="LastName"> </td> <td> <f>First name&nbsp; <input type="text" placeholder="Click to type" name="FirstName"> </td> <td> <f>Middle name&nbsp; <input type="text" placeholder="Click to type" name="MiddleName"> </td> <td> <f>Employment type&nbsp; <select name="EmploymentType"> <option value="Permanent">Permanent</option> <option value="Temporary">Temporary</option> <option value="Contractor">Contractor</option> <option value="Placement">Placement</option> <option value="Other">Other</option> </select> </td> <td width="80px"> <f>&nbsp;Gender</f> <br> <label for="GenderMale"> <input type="checkbox" name="GenderMale" value="Yes" /> <span>M</span> </label> <label for="GenderFemale"> <input type="checkbox" name="GenderFemale" value="Yes" /> <span>F</span> </label> </td> </tr> <tr> <td> <f>Department&nbsp;</f> <br> <input type="text" placeholder="Click to type" name="Department1"> </td> <td> <f>Job title&nbsp;</f> <input type="text" placeholder="Click to type" name="JobTitle"> </td> <td> <f>Manager's name&nbsp;</f> <input type="text" placeholder="Click to type" name="ManagerName"> </td> <td> <f>Start date&nbsp;</f> <br> <input type="date" placeholder="Click to type" name="StartDate"> </td> <td> <f>Finish date&nbsp;</f> <input type="date" style="width: 166px;" name="FinishDate"> </td> </tr> </table> <br> <table style="width:100%"> <tr> <td> <f>Full address:</f> <br> <input type="text" style="width: 992px;" placeholder="Click to type, Address/ P.O. Box, City, Street, Post code" name="FullAddress"> </td> </tr> </table> <br> <table style="width:100%"> <tr> <td> <f>User Group / Profile to Use:</f> <input type="text" style="width: 325px;" placeholder="Click to type, e.g. same as John, Accounts" name="UserGroup"> </td> <td> <f>Distribution Groups to be included:</f> <input type="text" style="width: 325px;" placeholder="Click to type, e.g. Staff, Internal, External" name="DistributionGroup"> </td> <td> <f>Shared Drive Access:</f> <input type="text" style="width: 325px;" placeholder="Click to type" name="SharedDriveAccess"> </td> </tr> </table> <br> <table style="width:100%"> <tr> <td> <f>Permissions on shared drives (in detail):</f> <br> <input type="text" style="width: 993px;" placeholder="Click to type, e.g. Marketing drive 'read only, Technical drive 'Full Access'" name="Permissions"> </td> </tr> </table> <br> <div id="colour"> <info> <center>Additional Info</center> </info> </div> <br> <div class="checkboxes"> <table style="width:100%"> <tr> <td width="%50">&nbsp; <bigbold>List of required items (Tick the &nbsp;box next to an item):</bigbold> </td> <td>&nbsp</td> <td class="td-left" width="%50"> <bigbold>List of required software/drive access:</bigbold> </td> </tr> <tr> <td></td> <td></td> <td class="td-left"> <info>&nbsp;Drives:</info> </td> <td> <info>&nbsp;Software:</info> </td> </tr> <tr> <td> <label for="iPad"> <input type="checkbox" name="iPad" value="Yes"> <span><f>iPad + case</f></span> </label> </td> <td> <label for="Mouse"> <input type="checkbox" name="Mouse" value="Yes"> <span><f>Mouse</f></span> </label> </td> <td class="td-left"> <label for="Sales"> <input type="checkbox" name="Sales" value="Yes"><span><f>Sales</f></span> </label> </td> <td> <label for="Salesforce"> <input type="checkbox" name="Salesforce" value="Yes"> <span><f>Salesforce</f></span> </label> </td> </tr> <tr> <td> <label for="iPhone"> <input type="checkbox" name="iPhone" value="Yes"> <span><f>iPhone + case</f></span> </label> </td> <td> <label for="Laptopb"> <input type="checkbox" name="Laptopb" value="Yes"> <span><f>Laptop bag</f></span> </label> </td> <td class="td-left"> <label for="Marketing"> <input type="checkbox" name="Marketing" value="Yes"> <span><f>Marketing</f></span> </label> </td> <td> <label for="VPN"> <input type="checkbox" name="VPN" value="Yes"> <span><f>VPN</f></span> </label> </td> </tr> <tr> <td> <label for="Laptop"> <input type="checkbox" name="Laptop" value="Yes"> <span><f>Laptop</f></span> </label> </td> <td> <label for="Dphone"> <input type="checkbox" name="Dphone" value="Yes"> <span><f>Desk phone</f></span> </label> </td> <td class="td-left"> <label for="General"> <input type="checkbox" name="General" value="Yes"> <span><f>General</f></span> </label> </td> <td> <label for="Terminal"> <input type="checkbox" name="Terminal" value="Yes"> <span><f>Terminal server</f></span> </label> </td> </tr> <tr> <td> <label for="Desktop"> <input type="checkbox" name="Desktop" value="Yes" /> <span><f>Desktop</f></span> </label> </td> <td> <label for="Printerw"> <input type="checkbox" name="Printerw" value="Yes"> <span><f>Printer (work)</f></span> </label> </td> <td class="td-left"> <label for="CAD"> <input type="checkbox" name="CAD" value="Yes"> <span><f>CAD</f></span> </label> </td> </tr> <tr> <td> <label for="Printerh"> <input type="checkbox" name="Printerh" value="Yes"> <span><f>Printer (home)</f></span> </label> </td> <td> <label for="Dongle"> <input type="checkbox" name="Dongle" value="Yes"> <span><f>Dongle</f></span> </label> </td> <td class="td-left"> <label for="Finance"> <input type="checkbox" name="Finance" value="Yes"> <span><f>Finance</f></span> </label> </td> </tr> <tr> <td> <label for="Monitor"> <input type="checkbox" name="Monitor" value="Yes"> <span><f>Monitor</f></span> </label> </td> <td> <label for="MiFi"> <input type="checkbox" name="Mifi" value="Yes"> <span><f>MiFi (Mobile Wifi)</f></span> </label> </td> <td class="td-left"> <label for="Accounts"> <input type="checkbox" name="Accounts" value="Yes"> <span><f>Accounts</f></span> </label> </td> <td></td> </tr> <tr> <td> <label for="Keyboard"> <input type="checkbox" name="Keyboard" value="Yes"> <span><f>Keyboard</f></span> </label> </td> <td></td> <td class="td-left"></td> <td></td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </table> <div id="colour"> <center> <info>Miscellaneous:</info> </center> </div> <br> <table style="width:100%"> <tr> <td> <f>Should the predecessor's email be assigned to this user?</f> </td> <td> <label for="Pemail"> <input type="checkbox" name="Pemail" value="Yes"> <span><f>Yes</f></span> </label> </td> </tr> <tr class="tr-top"> <td> <f>Is the user replacing someone else from the staff or is he/she a completely new employee?</f> </td> <td> <label for="Replacement"> <input type="checkbox" name="Replacement" value="Yes"> <span><f>Replacement</f></span> </label> </td> <td> <label for="NewUser"> <input type="checkbox" name="NewUser" value="Yes"> <span><f>New user</f></span> </label> </td> </tr> </table> <br> <textarea name="AddRequirements" style="width:1000px;" placeholder="Please continue here for any other extra requirements e.g. need of a special signature, software, hardware etc. or needed access to another user’s files and documents, or assign another user’s email profile to this user so they inherit all files and folders form the old user."></textarea> <!--<input type='hidden' name='articleid' id='articleid' value='<? echo $_GET["id"]; ?>' /> --> <input type="submit"> </form> </div> </div> </body> </html> ``` **PHP:** ```html <?php if( $_POST ) { $conn = mysqli_connect("myhost","myuser","mypassword", "mydb"); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $RequestBy = $_POST['RequestBy']; $FirstName = $_POST['FirstName']; $MiddleName = $_POST['MiddleName']; $LastName = $_POST['LastName']; $Desktop = $_POST['Desktop']; $EmploymentType = $_POST['EmploymentType']; $GenderMale = $_POST['GenderMale']; $GenderFemale = $_POST['GenderFemale']; $Department1 = $_POST['Department1']; $JobTitle = $_POST['JobTitle']; $ManagerName = $_POST['ManagerName']; $FullAddress = $_POST['FullAddress']; $UserGroup = $_POST['UserGroup']; $DistributionGroup = $_POST['DistributionGroup']; $SharedDriveAccess = $_POST['SharedDriveAccess']; $Permissions = $_POST['Permissions']; $iPad = $_POST['iPad']; $Mouse = $_POST['Mouse']; $Sales = $_POST['Sales']; $Salesforce = $_POST['Salesforce']; $iPhone = $_POST['iPhone']; $Laptopb = $_POST['Laptopb']; $Marketing = $_POST['Marketing']; $VPN = $_POST['VPN']; $Laptop = $_POST['Laptop']; $Dphone = $_POST['Dphone']; $General = $_POST['General']; $Terminal = $_POST['Terminal']; $Printerw = $_POST['Printerw']; $CAD = $_POST['CAD']; $Printerh = $_POST['Printerh']; $Dongle = $_POST['Dongle']; $Finance = $_POST['Finance']; $Monitor = $_POST['Monitor']; $Mifi = $_POST['Mifi']; $Accounts = $_POST['Accounts']; $Keyboard = $_POST['Keyboard']; $Pemail = $_POST['Pemail']; $Replacement = $_POST['Replacement']; $NewUser = $_POST['NewUser']; $AddRequirements = $_POST['AddRequirements']; } $sql= " INSERT INTO TestTable (RequestBy, FirstName, MiddleName, LastName, Desktop, EmploymentType, GenderMale, GenderFemale, Department1, JobTitle, ManagerName, FullAddress, UserGroup, DistributionGroup, SharedDriveAccess, Permissions, iPad, Mouse, Sales, Salesforce, iPhone, Laptopb, Marketing, VPN, Laptop, Dphone, General, Terminal, Printerw, CAD, Printerh, Dongle, Finance, Monitor, Mifi, Accounts, Keyboard, Pemail, Replacement, NewUser, AddRequirements) VALUES ('$RequestBy', '$FirstName', '$MiddleName', '$LastName', '$Desktop', '$EmploymentType', '$GenderMale', '$GenderFemale', '$Department1', '$JobTitle', '$ManagerName', '$FullAddress', '$UserGroup', '$DistributionGroup', '$SharedDriveAccess', '$Permissions', '$iPad', '$Mouse', '$Sales', '$Salesforce', '$iPhone', '$Laptopb', '$Marketing', '$VPN', '$Laptop', '$Dphone', '$General', '$Terminal', '$Printerw', '$CAD', '$Printerh', '$Dongle', '$Finance', '$Monitor', '$Mifi', '$Accounts', '$Keyboard', '$Pemail', '$Replacement', '$NewUser', '$AddRequirements');"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } mysqli_close($conn); ?> ``` Basically I want to create another page where I could select the user's name, click some button, and then see all the information such as access to "sales" drive, gender, etc. displayed. Ignore the lack of security measures in the code, it'll be used on a local server by very few and trustworthy people. If somebody could just guide me on the right path, it'd be much appreciated. Thank you in advance.
2015/10/18
[ "https://Stackoverflow.com/questions/33203609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5460628/" ]
You almost got it right. Just leave off the square brackets and the `include?` and it will work. I think the asterisks should not be necessary either since `File.extname` returns the extension with just a dot. ``` def choose_icon(myfile) case File.extname(myfile) when '.doc', '.docx', '.txt', '.dot' 'doc-icon' when '.xls', '.xlsx', '.xlt' 'sheet-icon' when '.mp3', '.aac', '.aiff', '.wav' 'audio-icon' when '.mov', '.m4a', '.wmv' 'movie-icon' else 'default-icon' end end ```
You could use a hash: ``` h = [*(%w| .doc .docx .txt .dot |).product(["doc-icon"]), *(%w| .xls .xlsx .xlt |).product(["sheet-icon"]), *(%w| .aac .aiff .wav |).product(["audio-icon"]), *(%w| .mov .m4a .wmv |).product(["movie-icon"])].to_h #=> {".doc"=>"default-icon", ".docx"=>"default-icon", # ".txt"=>"default-icon", ".dot"=>"default-icon", # ".xls"=>"sheet-icon" , ".xlsx"=>"sheet-icon", # ".xlt"=>"sheet-icon" , ".aac"=>"audio-icon", # ".aiff"=>"audio-icon" , ".wav"=>"audio-icon", # ".mov"=>"movie-icon" , ".m4a"=>"movie-icon", # ".wmv"=>"movie-icon"} h.default = "default-icon" h[File.extname("myfile.wav")] #=> "audio-icon" h[File.extname("./mydir/myfile.abc")] #=> "default-icon" ```
14,957,440
**Background:** I wrote an extension to search bookmarks and open the URL for the user. I've added JavaScript bookmarklet support to the extension and now it is invoking the script by something similar to this code: ``` var bookmark_address; // the address containing javascript:blah(); var js = bookmark_address.substr(11); chrome.tabs.executeScript({'code': js}); ``` Previously I had been using this code: ``` var bookmark_address; // the address containing javascript:blah(); chrome.tabs.update({'url': bookmark_address}); ``` The first one seems better, but they don't actually have much differences. Both of them requires the permissions `["tabs", "<all_urls>"]`. I am now requesting the permissions only when the user choose to enable bookmarklet support (by [optional permissions](http://developer.chrome.com/extensions/permissions.html)). **Problem:** I just thought of the security problem. Bookmarks are added by users so they are *usually* safe, but because my extension "invoke" the script, it is executed in the context of my extension. The script will be able to mess up my extension's local storage and variables. **Moreover, the script executed might have permission to perform Cross-Origin `XMLHttpRequest`.** [(Docs)](http://developer.chrome.com/extensions/xhr.html) Am I thinking it correctly? Is there really a security problem? Is there any way to "sandbox" the script execution from my extension, and/or disable the permission for the script? It could be a very bad thing for users of the extension, so please consider the problem seriously.
2013/02/19
[ "https://Stackoverflow.com/questions/14957440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1386111/" ]
Tested cross-origin XHR with the following bookmarklet (of course with `javascript:` appended): ``` var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { console.log(xhr.responseText); } }; xhr.open("POST", "http://jsfiddle.net/echo/json/", true); xhr.send("json=" + encodeURIComponent(JSON.stringify({"foo": "bar"}))); ``` **Result:** * Clicking on the bookmark does **not** permit cross-origin XHR. * Using `chrome.tabs.update` does **not** permit cross-origin XHR. * Using `chrome.tabs.executeScript` **does** permit cross-origin XHR. **Conclusion:** Using `chrome.tabs.update` to execute bookmarklets is basically as safe as clicking on the bookmark normally, while `chrome.tabs.executeScript` is **not** suitable for executing bookmarklets.
I think the most secure solution is to append the script to the page inside script tags. I think that this will work most similarly to how normal bookmarklets work, and will not give the code extra permissions. It may be even better if the script is then immediately removed.
40,570,663
I am saving some data into my Firebase database inside my Polymer element. All works fine. But as I person who's new to Promises I need help to understand what `Promise.resolved()` means here at then end of the method. Isn't the promise going through before that when `.then` is used? So what exactly this is doing? I looked [around](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve) but can't find an example of `resolved()` with no value. And how can I change this to have more familiar structure as below: ``` .then(function(snapshot) { // The Promise was "fulfilled" (it succeeded). }, function(error) { // The Promise was rejected. }); ``` Here's the block and the `Promise.resolved()` taken from the [documentation](https://elements.polymer-project.org/elements/polymerfire?active=firebase-document#method-save): ``` saveData : function() { this.$.document.data = this.$.message.value; this.$.document.save("/parent", "child").then(function() { console.log('sent the event!!!!!!'); this.$.document.reset(); }.bind(this)); return Promise.resolve(); }, ```
2016/11/13
[ "https://Stackoverflow.com/questions/40570663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5601401/" ]
First you need to understand the basics of Promises. Lets start from very basics - A newly created es6 promise is in one of the following states: * resolved * rejected * pending --> waiting to either resolved or rejected Lets create a sample Promise ``` var promise = new Promise(function(fulfill, reject) { // Do some stuff and either fullfill or reject the promise }); ``` So above promise receives a callback function also called **executor** function with signature `function(fullfill, reject)`. A newly created promise also has a very important property function called `then` used for chaining and controlling the logic flows. `then` takes two optional callback parameters `onFulfilled` and `onRejected`. Inside this **executor** function two things happens to indicate the outcome of promise - * `fullfill` **method gets called with or without a value:** means operation completed successfully. If you call **fulfill** with a **value** then `onFulfilled` callback in `then` will receive that value, if you decided not to provide a value in `fulfill` call then `onFulfilled` will be called with a parameter `undefined`. ``` var promise = new Promise(function(fulfill, reject) { // lets assume operation completed successfully fulfill('Success'); }); promise.then(onFulfilled, onRejected); function onFulfilled(result) { console.log(result); // Success will be printed } ``` * `reject` **method gets called with or without a value:** Some problem occurred while performing the operation. You can decided whether pass some error message `reject` callback to indicate the error occurred to end user. ``` var promise = new Promise(function(fulfill, reject) { // lets assume operation did not complete successfully reject(new Error('Error')); }); promise.then(onFulfilled, onRejected); function onRejected(error) { console.log(error.message); // Error message will be printed } ``` Now lets talk about `Promise.resolve`. At the top you learned how to create promise through the constructor. ``` var promise = new Promise(function (fulfill, reject) { fulfill('Success value'); }); // Now: Promise.resolve // Exactly does the same thing as above code var promise = Promise.resolve('Success value'); ``` Similarly comes `Promise.reject` - ``` var promise = new Promise(function (fulfill, reject) { reject(new Error('Error VALUE')); }); var promise = Promise.reject(new Error('Error VALUE')); ``` In your case `save` seems to be returning a promise already and internally that promise may be calling either `fulfill` or `reject` method so you don't need to call `Promise.resolve()`. You just need to get the values returned by that promise either `fulfilled` value or `rejected` value in the `then` method. ``` saveData : function() { this.$.document.data = this.$.message.value; // return this promise return this.$.document.save("/parent", "child"); } saveData() .then(function() { console.log('sent the event!!!!!!'); this.$.document.reset(); }.bind(this)); ``` I hope it makes things about promises somewhat clearer.
If you're trying to be able to do `obj.saveData().then(...)`, then you can return the inner promise like this: ``` saveData : function() { this.$.document.data = this.$.message.value; // return this promise return this.$.document.save("/parent", "child").then(function() { console.log('sent the event!!!!!!'); this.$.document.reset(); }.bind(this)); } ```
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
CTRL + B should do it. Otherwise you can create your own shortcuts.
I am using Mac (OS X Yosemite). Holding down the Command + Tapping the id of an Item is taking me to the xml right now. But another shortcut is point your cursor over the ID and click ***Command + B*** If you want to go to the class file from the xml then click ***Command + O*** I can share some additional shortcuts: **Command + E** for recent files. If you want to search from the recent list Then click **"Shift"** twice
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
I am using Mac (OS X Yosemite). Holding down the Command + Tapping the id of an Item is taking me to the xml right now. But another shortcut is point your cursor over the ID and click ***Command + B*** If you want to go to the class file from the xml then click ***Command + O*** I can share some additional shortcuts: **Command + E** for recent files. If you want to search from the recent list Then click **"Shift"** twice
My problem was that I, after recently changing the package name, accidentally added a blank space in the Manifest package name.
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
In Android Studio you can just click "**Shift**" button **twice**. You can either open java Class, xml layout, gradle files, android manifest and almost everything. hope it helps. -cheers / happy codings.
**Command + B** works for Mac For Windows, I am not so sure for I am not using windows.
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
**Command + B** works for Mac For Windows, I am not so sure for I am not using windows.
My problem was that I, after recently changing the package name, accidentally added a blank space in the Manifest package name.
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
I am using Mac (OS X Yosemite). Holding down the Command + Tapping the id of an Item is taking me to the xml right now. But another shortcut is point your cursor over the ID and click ***Command + B*** If you want to go to the class file from the xml then click ***Command + O*** I can share some additional shortcuts: **Command + E** for recent files. If you want to search from the recent list Then click **"Shift"** twice
So I figured it out! I don't know why, but it turns out that my main project's root folder (main 'app' module) was on the file type ignore list. All you have to do is remove the folder name from the list (highlighted in picture below). Oddly enough, this also resolved some the other anomalies I was experiencing. One issue was I could never see the AndroidManifest file in 'manifests' folder of the Hierarchy/Project Viewer ('Android' selected). Another issue was whenever I'd build and run the app, I'd get a warning about the AndroidManifest and have to click "Continue Anyway". Also, the app wouldn't auto-launch once installed. ![Ignore List](https://i.stack.imgur.com/Bils1.png)
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
in windows Ctrl+B switched between Design Mode and Text Mode. Ctrl + leftClick moves to declaration
**Command + B** works for Mac For Windows, I am not so sure for I am not using windows.
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
CTRL + B should do it. Otherwise you can create your own shortcuts.
**Command + B** works for Mac For Windows, I am not so sure for I am not using windows.
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
in windows Ctrl+B switched between Design Mode and Text Mode. Ctrl + leftClick moves to declaration
So I figured it out! I don't know why, but it turns out that my main project's root folder (main 'app' module) was on the file type ignore list. All you have to do is remove the folder name from the list (highlighted in picture below). Oddly enough, this also resolved some the other anomalies I was experiencing. One issue was I could never see the AndroidManifest file in 'manifests' folder of the Hierarchy/Project Viewer ('Android' selected). Another issue was whenever I'd build and run the app, I'd get a warning about the AndroidManifest and have to click "Continue Anyway". Also, the app wouldn't auto-launch once installed. ![Ignore List](https://i.stack.imgur.com/Bils1.png)
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
CTRL + B should do it. Otherwise you can create your own shortcuts.
in windows Ctrl+B switched between Design Mode and Text Mode. Ctrl + leftClick moves to declaration
29,082,629
I'm trying to create a jQuery/JavaScript timer that will continue running even when you've left the page. I tried a few plugins to do this but in the end what I found worked best as a starting point was a jsfiddle I came across by the user Daniel\_Hug: <http://jsfiddle.net/Daniel_Hug/pvk6p/> I've updated this to include Bootstrap 3, add some styles for responsive, and save the time of the timer into a cookie so it continues where it left off when you leave the page. Here's my updated version: <http://jsfiddle.net/ezrafree/hgks67u0/> HTML: ``` <div class="container"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-4"> <div id="timeContainer" class="well well-sm"> <time id="timerValue"></time> </div> <div id="timerButtons"> <button id="start" class="btn btn-success">START</button> <button id="stop" class="btn btn-danger" disabled="disabled">STOP</button> <button id="reset" class="btn btn-default" disabled="disabled">RESET</button> </div> <div class="col-sm-4 col-sm-4 col-md-4"></div> </div> </div> ``` JavaScript: ``` /** * jQuery Stopwatch * by @websightdesigns * * Based on "Javascript Stopwatch" by Daniel Hug * From http://jsfiddle.net/Daniel_Hug/pvk6p/ * Modified to: * - add responsive css styles * - add save functionality with cookies */ // Initialize our variables var timerDiv = document.getElementById('timerValue'), start = document.getElementById('start'), stop = document.getElementById('stop'), reset = document.getElementById('reset'), t; // Get time from cookie var cookieTime = getCookie('time'); // If timer value is saved in the cookie if( cookieTime != null && cookieTime != '00:00:00' ) { var savedCookie = cookieTime; var initialSegments = savedCookie.split('|'); var savedTimer = initialSegments[0]; var timerSegments = savedTimer.split(':'); var seconds = parseInt(timerSegments[2]), minutes = parseInt(timerSegments[1]), hours = parseInt(timerSegments[0]); timer(); document.getElementById('timerValue').textContent = savedTimer; $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); } else { var seconds = 0, minutes = 0, hours = 0; timerDiv.textContent = "00:00:00"; } // New Date object for the expire time var curdate = new Date(); var exp = new Date(); // Set the expire time exp.setTime(exp + 2592000000); function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timerDiv.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); // Set a 'time' cookie with the current timer time and expire time object. var timerTime = timerDiv.textContent.replace("%3A", ":"); // console.log('timerTime', timerTime); setCookie('time', timerTime + '|' + curdate, exp); timer(); } function timer() { t = setTimeout(add, 1000); } // timer(); // autostart timer /* Start button */ start.onclick = timer; /* Stop button */ stop.onclick = function() { clearTimeout(t); } /* Clear button */ reset.onclick = function() { timerDiv.textContent = "00:00:00"; seconds = 0; minutes = 0; hours = 0; setCookie('time', "00:00:00", exp); } /** * Javascript Stopwatch: Button Functionality * by @websightdesigns */ $('#start').on('click', function() { $('#stop').removeAttr('disabled'); $('#reset').removeAttr('disabled'); }); $('#stop').on('click', function() { $(this).prop('disabled', 'disabled'); }); $('#reset').on('click', function() { $(this).prop('disabled', 'disabled'); }); /** * Javascript Stopwatch: Cookie Functionality * by @websightdesigns */ function setCookie(name, value, expires) { document.cookie = name + "=" + value + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } /** * TODO: Continue timing the timer while the browser window is closed... */ ``` CSS: ``` /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } /** * jQuery Stopwatch * by @websightdesigns */ #timeContainer, #timerButtons { margin-left: auto; margin-right: auto; } #timeContainer { margin-top: 1em; } #timerValue { font-size: 1.5em; } #timerButtons { text-align: center; } #timerButtons button { font-size: 0.8em; } @media (min-width: 768px) { #timeContainer, #timerButtons { width: 210px; } } @media (max-width: 767px) { #timeContainer { width: 184px; } #timerButtons button { max-width: 32.75%; display: inline-block; } } @media (max-width: 240px) { #timeContainer { width: 100%; } #timerButtons button { width: 100%; max-width: 100%; clear: both; display: block; margin-bottom: 0.75em; } } ``` As you can see, I'm saving my cookie with a value such as: ``` 00:02:28|Mon Mar 16 2015 10:29:42 GMT-0600 (MDT) ``` In the above example, `00:02:28` is the current time of the timer, and the `Mon Mar 16 2015 10:29:42 GMT-0600 (MDT)` is the current date. What would be the best way to calculate what the new value of the timer would be if it had been running still while the window/tab was closed?
2015/03/16
[ "https://Stackoverflow.com/questions/29082629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583032/" ]
CTRL + B should do it. Otherwise you can create your own shortcuts.
So I figured it out! I don't know why, but it turns out that my main project's root folder (main 'app' module) was on the file type ignore list. All you have to do is remove the folder name from the list (highlighted in picture below). Oddly enough, this also resolved some the other anomalies I was experiencing. One issue was I could never see the AndroidManifest file in 'manifests' folder of the Hierarchy/Project Viewer ('Android' selected). Another issue was whenever I'd build and run the app, I'd get a warning about the AndroidManifest and have to click "Continue Anyway". Also, the app wouldn't auto-launch once installed. ![Ignore List](https://i.stack.imgur.com/Bils1.png)
37,881,787
This question may sound like a duplicate, but I have tried all steps in the other similar questions on stackoverflow but none of them worked. I am trying to connect to a Rails API using ionic. My setup is Rails 4, Devise for authentication, simple\_token\_authentication gem for token based API requests and ionic for mobile app. I'm able to login from ionic by passing a login request with a correct username and password to the devise session controller api and get a token after successful login through the devise api. After that, when I try to access any controller's index with a get query using the access token: <http://localhost:3002/api/categories?token=1098ccee839952491a4> or <http://localhost:3002/api/employers?token=1098ccee839952491a4> The response is a sign\_in page of devise. In the rails log, it shows ``` Started GET "/api/categories?token=1098ccee839952491a43" for ::1 at 2016-06-17 17:45:55 +0530 Processing by Api::CategoriesController#index as HTML Parameters: {"token"=>"1098ccee839952491a43"} User Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`authentication_token` = '1098ccee839952491a43' Completed 401 Unauthorized in 3ms (ActiveRecord: 0.7ms) Started GET "/users/sign_in" for ::1 at 2016-06-17 17:45:55 +0530 Processing by Devise::SessionsController#new as HTML Rendered devise/shared/_links.html.erb (6.5ms) Rendered devise/sessions/new.html.erb within layouts/login (78.3ms) Completed 200 OK in 3850ms (Views: 3847.1ms | ActiveRecord: 0.0ms) ``` I know for sure the token is correct as I have cross checked the token in the database. Also, I have included rack-cors gem and its configured for allowing any origin for cross domain request. In my application.rb the cors entry looks like this ``` class Application < Rails::Application config.active_record.raise_in_transactional_callbacks = true config.middleware.insert_before 0, "Rack::Cors" do allow do origins '*' resource '*', :headers => :any, :methods => [:get, :post, :options] end end end ``` The GET request in controllers.js in ionic looks like this :- ``` $http({ method: 'GET', headers: { 'X-XSRF-TOKEN': window.localStorage.getItem("token") , }, url: config.apiUrl+"/categories?token="+window.localStorage.getItem("token") , }).then(function successCallback(response) { console.log(response); }, function errorCallback(response) { $ionicPopup.alert({ title: 'Alert', template: response.data.message, }); }); ``` After the request is initiated, Chrome developer console shows the following message > > XMLHttpRequest cannot load > <http://localhost:3002/api/categories?token=1098ccee839952491a43>. The > request was redirected to '<http://localhost:3002/users/sign_in>', which > is disallowed for cross-origin requests that require preflight. > > > The response headers I get from the server is **General** ``` Request URL:http://localhost:3002/api/categories?token=1098ccee839952491a43 Request Method:GET Status Code:302 Found Remote Address:[::1]:3002 ``` **Response Headers** ``` view source Access-Control-Allow-Credentials:true Access-Control-Allow-Methods:GET, POST, OPTIONS Access-Control-Allow-Origin:http://localhost:8100 Access-Control-Expose-Headers: Access-Control-Max-Age:1728000 Cache-Control:no-cache Connection:Keep-Alive Content-Length:101 Content-Type:text/html; charset=utf-8 Date:Fri, 17 Jun 2016 12:26:13 GMT Location:http://localhost:3002/users/sign_in Server:WEBrick/1.3.1 (Ruby/2.2.1/2015-02-26) Set-Cookie:_backend_session=c05LRTgzdXNVdGNFeHcwaDNtRDkxZ1RBbXFNaDFNbE1zMTV6OGhFZG1VODdON2k4ODN0ZTg3YXo5OU5hOTZkcUNmR3VTaGVRQzBOUElCNnMrODhnemVCbUhQbUs2azNHdmVnbFpoL2JiRDA5S1I4NCtsVWNhOEpqeDdoYWxXR3hHNDg5RzNRcUlpcDZ4QWswY2NmUlpYbUkvTnpaVEViNXh6ZExCZkNyTXA0allMcW1RVGg1MjRLVnpEbzlSSVk4dGRUSTNsTUZFNEFOcVJxdm1hWXNaSFEzdnlSN01DZ2FTdEJYUTdUUGxucU44cFBMbDZ6RXlhVUx2ZHArWlNCVWgyTWs2emRrSXNGbTQ3ZVVQL0NCR0E9PS0tbmFzajFXZnZnd25oUkRFRjhxSy81QT09--281b2bd6413653ca006abc80f13329d6bf3ad0f5; path=/; HttpOnly Vary:Origin X-Content-Type-Options:nosniff X-Frame-Options:SAMEORIGIN X-Request-Id:3097ec28-6d55-4c70-90c9-de221b4321e3 X-Runtime:0.021444 X-Xss-Protection:1; mode=block ``` **Request Headers** ``` view source Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate, sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Host:localhost:3002 Origin:http://localhost:8100 Referer:http://localhost:8100/ User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36 X-XSRF-TOKEN:1098ccee839952491a43 ```
2016/06/17
[ "https://Stackoverflow.com/questions/37881787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1345936/" ]
Use argument binding. Perhaps this is what you're looking for? ```java PreparedBatch insertBatch = handle.prepareBatch("INSERT INTO foo.bar (baz) VALUES (:bazArgument)"); //assume what you want to insert is stored in a List<String> bazes for (String st : bazes) { insertBatch.bind("bazArgument", st).add(); } int[] countArray = insertBatch.execute(); ``` You can extend it for more variables etc.
Here is a simple example for a batch operation with JDBI and MySQL database. The table is of InnoDB type. ``` package com.zetcode; import org.skife.jdbi.v2.Batch; import org.skife.jdbi.v2.DBI; import org.skife.jdbi.v2.Handle; public class JDBIEx6 { public static void main(String[] args) { DBI dbi = new DBI("jdbc:mysql://localhost:3306/testdb", "testuser", "test623"); Handle handle = dbi.open(); Batch batch = handle.createBatch(); batch.add("DROP TABLE IF EXISTS Friends"); batch.add("CREATE TABLE Friends(Id INT AUTO_INCREMENT PRIMARY KEY, Name TEXT)"); batch.add("INSERT INTO Friends(Name) VALUES ('Monika')"); batch.add("INSERT INTO Friends(Name) VALUES ('Tom')"); batch.add("INSERT INTO Friends(Name) VALUES ('Jane')"); batch.add("INSERT INTO Friends(Name) VALUES ('Robert')"); batch.execute(); } } ``` The following is a Maven POM file for the project. ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.zetcode</groupId> <artifactId>JDBIEx6</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.jdbi</groupId> <artifactId>jdbi</artifactId> <version>2.73</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.39</version> </dependency> </dependencies> </project> ``` You can learn more about JDBI from my [tutorial](http://zetcode.com/db/jdbi/).
55,081,822
I'm new to React and am trying to pull in some information from an API, but keep getting this error when using the .map function to pass the retrieved data into an array: > > TypeError: items.map is not a function. > > > I'm not too familiar with JavaScript, so I don't fully understand what's going on here. I've included my code: ``` import React, { Component } from "react"; import "./App.css"; class App extends Component { constructor() { super(); this.state = { items: [], isLoaded: true }; } componentDidMount() { fetch("http://www.colr.org/json/colors/random/7") .then(res => res.json()) .then(json => { this.setState({ isLoaded: true, items: json }); }); } render() { var { items, isLoaded } = this.state; var itemInfo = items.map(item => ( <div key={item.colors.id}>Hex:{item.colors.hex}</div> )); if (!isLoaded) { return <div>{itemInfo}</div>; } else { return <div className="App">{itemInfo}</div>; } } } export default App; ```
2019/03/09
[ "https://Stackoverflow.com/questions/55081822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10285887/" ]
Since the `items` array in state is initially an empty array, you get this error when you change `items` to something that is not an array. Looking at the response from the API in your question, you will get an object from your JSON after you parse it. The array you want to use in the response is under the `colors` property, and each element in this array has `id` and `hex` properties. ``` class App extends Component { // ... componentDidMount() { fetch("http://www.colr.org/json/colors/random/7") .then(res => res.json()) .then(res => { this.setState({ isLoaded: true, items: res.colors }); }); } render() { var { items, isLoaded } = this.state; var itemInfo = items.map(item => <div key={item.id}>Hex:{item.hex}</div>); // ... } } ```
Since you do not specify types for anything and it is not really clear (not even for a human-reader) that `items` is an `Array`, you should explicitly tell TypeScript to use it as an array. You use [Type Assertion](https://basarat.gitbooks.io/typescript/docs/types/type-assertion.html) for that purpose. Should be something like: ``` (items as Array<YourArrayElementType>).map(/* .. */); ``` However, as a good practice you should always explicitly specify the type of anything you declare. In this way anything within you codebase will be statically typed. For anything coming from the outside (such as API requests) you should cast the information to [`interface`s](https://www.typescriptlang.org/docs/handbook/interfaces.html) you define.
55,081,822
I'm new to React and am trying to pull in some information from an API, but keep getting this error when using the .map function to pass the retrieved data into an array: > > TypeError: items.map is not a function. > > > I'm not too familiar with JavaScript, so I don't fully understand what's going on here. I've included my code: ``` import React, { Component } from "react"; import "./App.css"; class App extends Component { constructor() { super(); this.state = { items: [], isLoaded: true }; } componentDidMount() { fetch("http://www.colr.org/json/colors/random/7") .then(res => res.json()) .then(json => { this.setState({ isLoaded: true, items: json }); }); } render() { var { items, isLoaded } = this.state; var itemInfo = items.map(item => ( <div key={item.colors.id}>Hex:{item.colors.hex}</div> )); if (!isLoaded) { return <div>{itemInfo}</div>; } else { return <div className="App">{itemInfo}</div>; } } } export default App; ```
2019/03/09
[ "https://Stackoverflow.com/questions/55081822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10285887/" ]
Since you do not specify types for anything and it is not really clear (not even for a human-reader) that `items` is an `Array`, you should explicitly tell TypeScript to use it as an array. You use [Type Assertion](https://basarat.gitbooks.io/typescript/docs/types/type-assertion.html) for that purpose. Should be something like: ``` (items as Array<YourArrayElementType>).map(/* .. */); ``` However, as a good practice you should always explicitly specify the type of anything you declare. In this way anything within you codebase will be statically typed. For anything coming from the outside (such as API requests) you should cast the information to [`interface`s](https://www.typescriptlang.org/docs/handbook/interfaces.html) you define.
Tholle is absolutely correct as far as your specific problem... I would further clean up your code like so: ``` import React, { Component } from 'react'; class App extends Component { state = { items: [], isLoading: true, error: null }; componentDidMount() { fetch('http://www.colr.org/json/colors/random/7') .then(res => res.json()) .then(json => { this.setState({ isLoading: false, items: json.colors, }); }) .catch(error => this.setState({ error: error.message, isLoading: false }), ); } renderColors = () => { const { items, isLoading, error } = this.state; if (error) { return <div>{error}</div>; } if (isLoading) { return <div>Loading...</div>; } return ( <div> {items.map(item => ( <div key={item.id}>Hex: {item.hex}</div> ))} </div> ); }; render() { return <div>{this.renderColors()}</div>; } } export default App; ```
55,081,822
I'm new to React and am trying to pull in some information from an API, but keep getting this error when using the .map function to pass the retrieved data into an array: > > TypeError: items.map is not a function. > > > I'm not too familiar with JavaScript, so I don't fully understand what's going on here. I've included my code: ``` import React, { Component } from "react"; import "./App.css"; class App extends Component { constructor() { super(); this.state = { items: [], isLoaded: true }; } componentDidMount() { fetch("http://www.colr.org/json/colors/random/7") .then(res => res.json()) .then(json => { this.setState({ isLoaded: true, items: json }); }); } render() { var { items, isLoaded } = this.state; var itemInfo = items.map(item => ( <div key={item.colors.id}>Hex:{item.colors.hex}</div> )); if (!isLoaded) { return <div>{itemInfo}</div>; } else { return <div className="App">{itemInfo}</div>; } } } export default App; ```
2019/03/09
[ "https://Stackoverflow.com/questions/55081822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10285887/" ]
Since the `items` array in state is initially an empty array, you get this error when you change `items` to something that is not an array. Looking at the response from the API in your question, you will get an object from your JSON after you parse it. The array you want to use in the response is under the `colors` property, and each element in this array has `id` and `hex` properties. ``` class App extends Component { // ... componentDidMount() { fetch("http://www.colr.org/json/colors/random/7") .then(res => res.json()) .then(res => { this.setState({ isLoaded: true, items: res.colors }); }); } render() { var { items, isLoaded } = this.state; var itemInfo = items.map(item => <div key={item.id}>Hex:{item.hex}</div>); // ... } } ```
Tholle is absolutely correct as far as your specific problem... I would further clean up your code like so: ``` import React, { Component } from 'react'; class App extends Component { state = { items: [], isLoading: true, error: null }; componentDidMount() { fetch('http://www.colr.org/json/colors/random/7') .then(res => res.json()) .then(json => { this.setState({ isLoading: false, items: json.colors, }); }) .catch(error => this.setState({ error: error.message, isLoading: false }), ); } renderColors = () => { const { items, isLoading, error } = this.state; if (error) { return <div>{error}</div>; } if (isLoading) { return <div>Loading...</div>; } return ( <div> {items.map(item => ( <div key={item.id}>Hex: {item.hex}</div> ))} </div> ); }; render() { return <div>{this.renderColors()}</div>; } } export default App; ```
14,854,968
the problem I am having is connecting to an account on my sql server (2005) from an ASP.NET application. Ive tried using the default sa login and users ive created already also the setting of the sql management studio are set to mixed properties, I have the string connection in the webconfig as well but also doesnt work. c# code ``` //string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;"; string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]"; SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr); DataTable table = new DataTable(); dataAdapt.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); ``` The error message I receive is: Login failed for user 'james'. The user is not associated with a trusted SQL Server connection. Any help appreciated James
2013/02/13
[ "https://Stackoverflow.com/questions/14854968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863450/" ]
Your SQL SERVER configured for `Windows Only` connections and you current windows user not associated as trusted. Try to configure your SQL SEREVR to accept `Mixed Mode` connections.
Please try the following format If It is Sql Server user mode, ``` ConStr = "Server=JAMES-PC\SQLEXPRESS;Database=projectDB;User Id=james; Password=password;" ``` if you are trying to connect using windows, then you must provide `Trusted Connection = true`
14,854,968
the problem I am having is connecting to an account on my sql server (2005) from an ASP.NET application. Ive tried using the default sa login and users ive created already also the setting of the sql management studio are set to mixed properties, I have the string connection in the webconfig as well but also doesnt work. c# code ``` //string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;"; string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]"; SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr); DataTable table = new DataTable(); dataAdapt.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); ``` The error message I receive is: Login failed for user 'james'. The user is not associated with a trusted SQL Server connection. Any help appreciated James
2013/02/13
[ "https://Stackoverflow.com/questions/14854968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863450/" ]
Try this,I'm not sure but hope it will work- ``` <connectionStrings> <add name ="conStr" connectionString ="Initial Catalog = projectDB; Data Source =JAMES-PC\SQLEXPRESS; User Id=james;Password=password;"/> </connectionStrings> ```
Please try the following format If It is Sql Server user mode, ``` ConStr = "Server=JAMES-PC\SQLEXPRESS;Database=projectDB;User Id=james; Password=password;" ``` if you are trying to connect using windows, then you must provide `Trusted Connection = true`
14,854,968
the problem I am having is connecting to an account on my sql server (2005) from an ASP.NET application. Ive tried using the default sa login and users ive created already also the setting of the sql management studio are set to mixed properties, I have the string connection in the webconfig as well but also doesnt work. c# code ``` //string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;"; string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]"; SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr); DataTable table = new DataTable(); dataAdapt.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); ``` The error message I receive is: Login failed for user 'james'. The user is not associated with a trusted SQL Server connection. Any help appreciated James
2013/02/13
[ "https://Stackoverflow.com/questions/14854968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863450/" ]
try mapping projectDB to user:james. open SQL Server Management Studio, select **Security - Logins**, double click user:**james**, select page:**User Mapping**, check projectDB.
Please try the following format If It is Sql Server user mode, ``` ConStr = "Server=JAMES-PC\SQLEXPRESS;Database=projectDB;User Id=james; Password=password;" ``` if you are trying to connect using windows, then you must provide `Trusted Connection = true`
14,854,968
the problem I am having is connecting to an account on my sql server (2005) from an ASP.NET application. Ive tried using the default sa login and users ive created already also the setting of the sql management studio are set to mixed properties, I have the string connection in the webconfig as well but also doesnt work. c# code ``` //string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;"; string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]"; SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr); DataTable table = new DataTable(); dataAdapt.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); ``` The error message I receive is: Login failed for user 'james'. The user is not associated with a trusted SQL Server connection. Any help appreciated James
2013/02/13
[ "https://Stackoverflow.com/questions/14854968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863450/" ]
Your SQL SERVER configured for `Windows Only` connections and you current windows user not associated as trusted. Try to configure your SQL SEREVR to accept `Mixed Mode` connections.
Try this,I'm not sure but hope it will work- ``` <connectionStrings> <add name ="conStr" connectionString ="Initial Catalog = projectDB; Data Source =JAMES-PC\SQLEXPRESS; User Id=james;Password=password;"/> </connectionStrings> ```
14,854,968
the problem I am having is connecting to an account on my sql server (2005) from an ASP.NET application. Ive tried using the default sa login and users ive created already also the setting of the sql management studio are set to mixed properties, I have the string connection in the webconfig as well but also doesnt work. c# code ``` //string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;"; string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]"; SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr); DataTable table = new DataTable(); dataAdapt.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); ``` The error message I receive is: Login failed for user 'james'. The user is not associated with a trusted SQL Server connection. Any help appreciated James
2013/02/13
[ "https://Stackoverflow.com/questions/14854968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863450/" ]
Your SQL SERVER configured for `Windows Only` connections and you current windows user not associated as trusted. Try to configure your SQL SEREVR to accept `Mixed Mode` connections.
try mapping projectDB to user:james. open SQL Server Management Studio, select **Security - Logins**, double click user:**james**, select page:**User Mapping**, check projectDB.
6,628,639
I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? I guess if it is not possible, does anyone know a simple and easy way to escape these quotes so I can put it in a string? Keep in mind, part of this string will be JavaScript that I will later need to execute.
2011/07/08
[ "https://Stackoverflow.com/questions/6628639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835868/" ]
An easy way to escape the quotes is to use the javascript escape function. <http://www.w3schools.com/jsref/jsref_escape.asp>
Use the `escape` function to replace special characters (including single and double quotes). You can then use the `unescape` function to return the string to it's normal state later if necessary. For example: ``` var data = 'hello my name is "James"'; alert(escape(data)); //Outputs: hello%20my%20name%20is%20%22James%22 ```
6,628,639
I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? I guess if it is not possible, does anyone know a simple and easy way to escape these quotes so I can put it in a string? Keep in mind, part of this string will be JavaScript that I will later need to execute.
2011/07/08
[ "https://Stackoverflow.com/questions/6628639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835868/" ]
You need to escape the quotation characters with `\`: ``` var someString = 'escape all the quotation marks \"\''; ```
An easy way to escape the quotes is to use the javascript escape function. <http://www.w3schools.com/jsref/jsref_escape.asp>
6,628,639
I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? I guess if it is not possible, does anyone know a simple and easy way to escape these quotes so I can put it in a string? Keep in mind, part of this string will be JavaScript that I will later need to execute.
2011/07/08
[ "https://Stackoverflow.com/questions/6628639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835868/" ]
You need to escape the quotation characters with `\`: ``` var someString = 'escape all the quotation marks \"\''; ```
Use the `escape` function to replace special characters (including single and double quotes). You can then use the `unescape` function to return the string to it's normal state later if necessary. For example: ``` var data = 'hello my name is "James"'; alert(escape(data)); //Outputs: hello%20my%20name%20is%20%22James%22 ```
6,628,639
I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? I guess if it is not possible, does anyone know a simple and easy way to escape these quotes so I can put it in a string? Keep in mind, part of this string will be JavaScript that I will later need to execute.
2011/07/08
[ "https://Stackoverflow.com/questions/6628639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835868/" ]
> > Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? > > > No. JavaScript string literals are delimited with either single quotes or double quotes. Those are the only choices. > > does anyone know a simple and easy way to escape these quotes so I can put it in a string? > > > Do you mean in a string literal? ``` var str = "var foo=\"bar\"; function say(it) { alert('It is: ' + it); say(foo);"; ``` Or programmatically? ``` str = str.replace(/"/g, '\\"'); ```
Use the `escape` function to replace special characters (including single and double quotes). You can then use the `unescape` function to return the string to it's normal state later if necessary. For example: ``` var data = 'hello my name is "James"'; alert(escape(data)); //Outputs: hello%20my%20name%20is%20%22James%22 ```
6,628,639
I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? I guess if it is not possible, does anyone know a simple and easy way to escape these quotes so I can put it in a string? Keep in mind, part of this string will be JavaScript that I will later need to execute.
2011/07/08
[ "https://Stackoverflow.com/questions/6628639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835868/" ]
You need to escape the quotation characters with `\`: ``` var someString = 'escape all the quotation marks \"\''; ```
> > Is it possible, in javascript, to declare a string with information inside of it, that does not use single or double quotes? > > > No. JavaScript string literals are delimited with either single quotes or double quotes. Those are the only choices. > > does anyone know a simple and easy way to escape these quotes so I can put it in a string? > > > Do you mean in a string literal? ``` var str = "var foo=\"bar\"; function say(it) { alert('It is: ' + it); say(foo);"; ``` Or programmatically? ``` str = str.replace(/"/g, '\\"'); ```
63,736,355
I would like to test my controller class. But I couldn't manage to run springBootTest class. My project written in spring boot. We are writing REST API using spring boot. When I try to excute following test class. I still get following line from terminal. ``` import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.context.SpringBootTest; import static org.assertj.core.api.Assertions.assertThat; /* * * @A Sabirov Jakhongir * */ @SpringBootTest @WebMvcTest public class PrivilegesControllerTest { @Autowired private PrivilegesController privilegesController; @Test public void add() { assertThat(privilegesController).isNotNull(); } } ``` [![enter image description here](https://i.stack.imgur.com/dc0Cm.png)](https://i.stack.imgur.com/dc0Cm.png) I put here all needed dependency for testing from my project. ``` <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher --> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <version>1.6.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.3.2</version> <scope>test</scope> </dependency> ``` What might be cause of not working of test Class.
2020/09/04
[ "https://Stackoverflow.com/questions/63736355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7205323/" ]
With `Junit5` and `@SpringBootTest` will load the full application, I had faced the same issue before, you can find details about the question [here](https://stackoverflow.com/q/63245021/3493829) and answer [here](https://stackoverflow.com/a/63296026/3493829). The solution for this is to use your test without `@SpringBootTest`. The solution to your test class is as below. ``` @ExtendWith(MockitoExtension.class) public class PrivilegesControllerTest { @InjectMocks private PrivilegesController privilegesController; @Test public void add() { assertThat(privilegesController).isNotNull(); } } ``` You can also use `@ExtendWith(SpringExtension.class)` instead of `@ExtendWith(MockitoExtension.class)`
To test spring boot application is **creating** your controller, use `@SpringBootTest` annotation, and to test the **behavior or responsibility** of the controller is better to use `@WebMvcTest`. No need to annotate both the annotation to one class. There are two cases to test the controller's responsibility. 1. With running Server 2. Without Server For 1st Case, you can use `@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)` to start a server with a random port. For 2nd Case, use `@WebMvcTest` for testing the web layer. All the test cases are written with the following signature: ``` @Test public void test_Name() throws Exception { //your test definition } ``` You can also read the Official Documentation of Spring Boot <https://spring.io/guides/gs/testing-web/>
47,814,140
I am using xamarin Azure SDK to download and manage the local database for my Xamarin . Forms App. We are facing downloading time issues because we have a lot of data, so I am thinking of taking backup once of the SQLite File from one device and use it to restore on different devices as restoring the same SQLite File. Planned to use Azure Blob storage to store backup of SQLite files and for different device planning to download that blob of SQLite file and thinking of restore it on different devices. Any Help will be appreciated. Thanks :)
2017/12/14
[ "https://Stackoverflow.com/questions/47814140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7341447/" ]
An approach I have used in the past is to create a controller method on the azure end which the client app can call that generates a pre-filled sqlite database or 'snapshot' on the server (making sure you include all the extra azure tables and columns) and then return a download url for the file to the client. We also zip-up the snapshot database to reduce the download times. You could store this 'snapshot' in azure blob if you desired.
Please refer given link. SQLite is not supporting only relationship like Foreign Key. [Memory Stream as DB](https://stackoverflow.com/questions/11383775/memory-stream-as-db) you can upload back up file on Blob with respective user details. and when there is any call with same user details you can download it from blob.
47,814,140
I am using xamarin Azure SDK to download and manage the local database for my Xamarin . Forms App. We are facing downloading time issues because we have a lot of data, so I am thinking of taking backup once of the SQLite File from one device and use it to restore on different devices as restoring the same SQLite File. Planned to use Azure Blob storage to store backup of SQLite files and for different device planning to download that blob of SQLite file and thinking of restore it on different devices. Any Help will be appreciated. Thanks :)
2017/12/14
[ "https://Stackoverflow.com/questions/47814140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7341447/" ]
An approach I have used in the past is to create a controller method on the azure end which the client app can call that generates a pre-filled sqlite database or 'snapshot' on the server (making sure you include all the extra azure tables and columns) and then return a download url for the file to the client. We also zip-up the snapshot database to reduce the download times. You could store this 'snapshot' in azure blob if you desired.
Those are the links that provide you with the code / knowledge required to use Azure Blob Storage on Xamarin: * <https://learn.microsoft.com/en-us/azure/storage/blobs/storage-xamarin-blob-storage> * <https://learn.microsoft.com/en-us/azure/storage/blobs/storage-dotnet-how-to-use-blobs> As this question is very general I can provide you only with those general links. There are many details on how to implement that in your case, if you face some specific problem I recommend to ask another question with the exact description of that specific problem. EDIT: According to your comment you have some problems in replacing the local file. The only thing is that you must replace it before you initialize SQLite, otherwise it is a simple file operation.
37,416,944
Write the JavaScript to read the number of hours worked from the user. Then write the JavaScript to calculate how much money the user made if they were paid $12/hour for the first 40 hours worked, and $18/hr for all hours worked over 40. Then use the alert() function to print the total amount to the user. what code do I have to use var y = prompt("Enter a Value","");
2016/05/24
[ "https://Stackoverflow.com/questions/37416944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6376240/" ]
Change the prototype from: ``` int Split(const char* str, const char* delim,unsigned int& numtokens,char **tokensRes) ``` To: ``` int Split(const char* str, const char* delim,unsigned int& numtokens,char ** &tokensRes) ``` And the code `tokensRes = tokens;` will work. To understand why learn more about C++ and [references](https://en.wikipedia.org/wiki/Reference_(C%2B%2B)). Other answers about using strings are valid if you're planning to move from a C style of coding to a C++ one. The ease of coding would improve a lot and no worries about memory management and pointers (well not often), which are done automatically by classes. No worries about a performance decrease either as long as you follow good practices such as passing objects by reference and not value.
Assuming you want to return an array of strings (`char**`), then you need to pass a pointer to such an array that you can assign. That is, you need to pass a `char***` and assign it like `*tokensRes = tokens`.
37,416,944
Write the JavaScript to read the number of hours worked from the user. Then write the JavaScript to calculate how much money the user made if they were paid $12/hour for the first 40 hours worked, and $18/hr for all hours worked over 40. Then use the alert() function to print the total amount to the user. what code do I have to use var y = prompt("Enter a Value","");
2016/05/24
[ "https://Stackoverflow.com/questions/37416944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6376240/" ]
Change the prototype from: ``` int Split(const char* str, const char* delim,unsigned int& numtokens,char **tokensRes) ``` To: ``` int Split(const char* str, const char* delim,unsigned int& numtokens,char ** &tokensRes) ``` And the code `tokensRes = tokens;` will work. To understand why learn more about C++ and [references](https://en.wikipedia.org/wiki/Reference_(C%2B%2B)). Other answers about using strings are valid if you're planning to move from a C style of coding to a C++ one. The ease of coding would improve a lot and no worries about memory management and pointers (well not often), which are done automatically by classes. No worries about a performance decrease either as long as you follow good practices such as passing objects by reference and not value.
Just ditch the plain C types and use C++ types: ``` std::vector<std::string> Split(std:;string const& str, std::string const& delim, unsigned int& numtokens); ``` If you have to stick to the C interface, you need an additional indirection with a triple pointer (I am assuming that you want to return an array of token strings). ``` int Split(const char* str, const char* delim,unsigned int& numtokens,char ***tokensRes) char** tokens; Split("String;String", ";", 2, &tokens); ``` I really dislike output parameters, and I always wonder why anybody does not use `std::string` in C++. Tokenizing has been implemented in many libraries, e.g. in [boost::split](http://www.boost.org/doc/libs/1_61_0/doc/html/string_algo/usage.html#idp398633360) or [boost::tokenizer](http://www.boost.org/doc/libs/1_61_0/libs/tokenizer/tokenizer.htm). No need to reinvent the wheel: ``` // simple_example_1.cpp #include<iostream> #include<boost/tokenizer.hpp> #include<string> int main(){ using namespace std; using namespace boost; string s = "This is, a test"; tokenizer<> tok(s); for(tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){ cout << *beg << "\n"; } } ``` > > The output from simple\_example\_1 is: > > > > ``` > This > is > a > test > > ``` > >
33,328,935
I am trying to make a Dokumen class which has more than one foreign key, several of which can be set to null. I tried writing the code below, but when it hits the API the error below occurred. ``` class DokumenHandler(BaseHandler): allowed_methods = ('GET','POST', 'PUT', 'DELETE',) def read(self, request, dok_id=None): if dok_id: try: i = Dokumen.objects.get(pk=dok_id) p = { 'status': True, 'data': { 'id': i.id, 'prinsip_id': i.prinsip.id, 'kriteria_id': i.kriteria.id, 'subkriteria_id': i.subkriteria.id, 'indikator_id': i.indikator.id, 'nama_dokumen': i.nama_dokumen }, 'message': 'success' } return p except ObjectDoesNotExist: return [] else: dokumens = Dokumen.objects.all() data = [] for i in dokumens: p = { 'id': i.id, 'prinsip_id': i.prinsip.id, 'kriteria_id': i.kriteria.id, 'subkriteria_id': i.subkriteria.id, 'indikator_id': i.indikator.id, 'nama_dokumen': i.nama_dokumen } data.append(p) return data def create(self, request): if request.content_type: data = request.data nama_dokumen = request.FILES['nama_dokumen'] try: d = Dokumen() d.prinsip_id = data['prinsip_id'] d.kriteria_id = data['kriteria_id'] d.subkriteria_id = data['subkriteria_id'] d.indikator_id = data['indikator_id'] d.nama_dokumen = nama_dokumen d.save() except Exception, e: resp = {'status': False, 'message': unicode(e)} return resp else: resp = {'status': True, 'message': 'success created dokumen'} return resp else: resp = {'status': False, 'message': 'failed created dokumen'} return resp def update(self, request, dok_id=None): if request.content_type: data = request.data nama_dokumen = request.FILES['nama_dokumen'] try: d = Dokumen.objects.get(pk=dok_id) d.prinsip_id = data['prinsip_id'] d.kriteria_id = data['kriteria_id'] d.subkriteria_id = data['subkriteria_id'] d.indikator_id = data['indikator_id'] d.nama_dokumen = nama_dokumen d.save() except Exception, e: resp = {'status': False, 'message': unicode(e)} return resp else: resp = {'status': True, 'message': 'success updated dokumen'} return resp else: resp = {'status': False, 'message': 'failed updated dokumen'} return resp def delete(self, request, dok_id=None): if dok_id: try: d = Dokumen.objects.get(pk=dok_id) d.delete() except Exception, e: return {'status': False, 'message': unicode(e)} else: return { 'status': True, 'message': 'success deleted dokumen' } else: return {'status': False, 'message': 'failed deleted dokumen'} ``` Error received: > > Piston/0.2.3rc1 (Django 1.5.1) crash report: Traceback (most recent > call last): File "/home/notradamequeen/ISPO/ispo/api/handlers.py", > line 198, in read 'indikator\_id': i.indikator.id, AttributeError: > 'NoneType' object has no attribute 'id' > > > the class Dokumen Goes Here : ``` class Dokumen(models.Model): prinsip = models.ForeignKey(Prinsip) kriteria = models.ForeignKey(Kriteria) subkriteria = models.ForeignKey(Subkriteria, null=True, blank=True, default = 0) indikator = models.ForeignKey(Indikator, null=True, blank=True, default = 0) nama_dokumen = models.FileField(upload_to='dokumen') created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now_add=True) def __unicode__(self): return '%s' % (self.nama_dokumen) def save(self, *args, **kwargs): if self.created_at == None: self.created_at = datetime.now() self.updated_at = datetime.now() super(Dokumen, self).save(*args, **kwargs) ```
2015/10/25
[ "https://Stackoverflow.com/questions/33328935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5485693/" ]
This will get rid of everything but the status and the `Content-Length` header: ``` HttpListener listener = new HttpListener(); listener.Prefixes.Add("http://*:5555/"); listener.Start(); listener.BeginGetContext(ar => { HttpListener l = (HttpListener)ar.AsyncState; HttpListenerContext context = l.EndGetContext(ar); context.Response.Headers.Clear(); context.Response.SendChunked = false; context.Response.StatusCode = 200; context.Response.Headers.Add("Server", String.Empty); context.Response.Headers.Add("Date", String.Empty); context.Response.Close(); }, listener); ``` and in fiddler you'll see this: [![enter image description here](https://i.stack.imgur.com/3N7iv.png)](https://i.stack.imgur.com/3N7iv.png)
Just set `ContentLength64` to zero before closing response stream in order to transmit data the regular way: ``` response.ContentLength64 = 0; response.OutputStream.Close(); ``` If you flush or close response stream without setting content length to any value, data will be transmitted in chunks. And `0/r/n` in your response body is actually a closing chunk.
33,749,207
I have 4 buttons(B1,B2,B3,B4) in HEADER section,Each button redirects to different page in the same tab. Button background color is WHITE. Whenever I clicked on specific button, entire page will reload and redirects to specific button page. NOTE: Header section is included in all 4 button pages. Now my requirement is : Whenever I click on specific button, that specific button back ground color only should change to another color(say ex: RED) rest showld be WHITE color only. EX: If i click B1 button, page should reload, then back ground color of B1 button should change to RED rest should be WHITE. How to do this in Jquery or Java script or CSS? Pls. assist me. ```css .HeaderButtons { width: 15%; background-color: WHITE; } ``` ```html <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> ```
2015/11/17
[ "https://Stackoverflow.com/questions/33749207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3428041/" ]
It sounds like your trying to set an active state on button based on the URL, using a slight change on this article to use buttons rather than links <https://css-tricks.com/snippets/jquery/add-active-navigation-class-based-on-url/> ``` <div id="Header"> <input data-href="/" type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input data-href="/page1/" type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input data-href="/page2/" type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input data-href="/page3/" type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> <script> //jQuery code that adds active class to the button that has the URL path as its data-href attribute $(function() { $('input[data-href^="/' + location.pathname.split("/")[1] + '"]').addClass('active'); }); </script> .HeaderButtons.active { background-color: RED; //CSS to change the button color } ```
Best approach is to use **AJAX**. Otherwise if you are reloading the entire page, the clicked button you may have to store it into somewhere like session or db(Which is not a good practice) or pass through the url like `page.php?id=b1`. **CSS:** ``` .HeaderButtons { width:15%; background-color:WHITE; } .HeaderButtonsRed { background-color:red !important; } ``` **JS:** ``` $(document).ready(function(){ $(".HeaderButtons").click(function () { if ($(this).hasClass('HeaderButtonsRed')) { $(this).removeClass('HeaderButtonsRed'); } else { $(".HeaderButtons").removeClass('HeaderButtonsRed'); $(this).addClass('HeaderButtonsRed'); } }); }); ```
33,749,207
I have 4 buttons(B1,B2,B3,B4) in HEADER section,Each button redirects to different page in the same tab. Button background color is WHITE. Whenever I clicked on specific button, entire page will reload and redirects to specific button page. NOTE: Header section is included in all 4 button pages. Now my requirement is : Whenever I click on specific button, that specific button back ground color only should change to another color(say ex: RED) rest showld be WHITE color only. EX: If i click B1 button, page should reload, then back ground color of B1 button should change to RED rest should be WHITE. How to do this in Jquery or Java script or CSS? Pls. assist me. ```css .HeaderButtons { width: 15%; background-color: WHITE; } ``` ```html <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> ```
2015/11/17
[ "https://Stackoverflow.com/questions/33749207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3428041/" ]
It sounds like your trying to set an active state on button based on the URL, using a slight change on this article to use buttons rather than links <https://css-tricks.com/snippets/jquery/add-active-navigation-class-based-on-url/> ``` <div id="Header"> <input data-href="/" type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input data-href="/page1/" type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input data-href="/page2/" type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input data-href="/page3/" type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> <script> //jQuery code that adds active class to the button that has the URL path as its data-href attribute $(function() { $('input[data-href^="/' + location.pathname.split("/")[1] + '"]').addClass('active'); }); </script> .HeaderButtons.active { background-color: RED; //CSS to change the button color } ```
I think if the page redirects/refresh than U cant achive using pure css nither you can do it without adding parameters to URL as discribed in other comments But you can give a try on cookies, I havent tried applying it but you can try it using [jQuery cookie plugin](http://plugins.jquery.com/cookie/). ``` $('.b1').click(function(){ var clicks = $(this).data('clicks'); if(clicks && $.cookie("yourcookiename")=='') { $.cookie("yourcookiename","yourcookieval"); // $('.b1').css('background-color','red'); then redirect page code } else { // $.removeCookie("yourcookiename"); & then $('.b1').css('background-color','white'); } $(this).data("clicks", !clicks); }); ```
33,749,207
I have 4 buttons(B1,B2,B3,B4) in HEADER section,Each button redirects to different page in the same tab. Button background color is WHITE. Whenever I clicked on specific button, entire page will reload and redirects to specific button page. NOTE: Header section is included in all 4 button pages. Now my requirement is : Whenever I click on specific button, that specific button back ground color only should change to another color(say ex: RED) rest showld be WHITE color only. EX: If i click B1 button, page should reload, then back ground color of B1 button should change to RED rest should be WHITE. How to do this in Jquery or Java script or CSS? Pls. assist me. ```css .HeaderButtons { width: 15%; background-color: WHITE; } ``` ```html <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> ```
2015/11/17
[ "https://Stackoverflow.com/questions/33749207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3428041/" ]
It sounds like your trying to set an active state on button based on the URL, using a slight change on this article to use buttons rather than links <https://css-tricks.com/snippets/jquery/add-active-navigation-class-based-on-url/> ``` <div id="Header"> <input data-href="/" type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input data-href="/page1/" type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input data-href="/page2/" type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input data-href="/page3/" type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> <script> //jQuery code that adds active class to the button that has the URL path as its data-href attribute $(function() { $('input[data-href^="/' + location.pathname.split("/")[1] + '"]').addClass('active'); }); </script> .HeaderButtons.active { background-color: RED; //CSS to change the button color } ```
There are many ways to achieve this and the best method is ultimately going to depend on your application, personal taste and a wide array of other factors. Things to consider: * [cookies](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie) * [html localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage) * [html sessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) * [http url paramters](http://php.net/manual/en/reserved.variables.get.php) * [php sessions](http://php.net/manual/en/intro.session.php) Here's a method using [HTML localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to store the button id on a click event like below. You can then fetch the value on subsequent page load/reload anywhere on the same domain indefinitely. **DEMO: <http://buttons.demo.zuma-design.com/button-demo-a.html>** ``` <!DOCTYPE html> <html> <head> <style> .HeaderButtons { width: 15%; background-color: WHITE; } </style> </head> <body> <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons" onclick="setButton(this.id); window.location.href=window.location.href">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons" onclick="setButton(this.id); window.location.href=window.location.href">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons" onclick="setButton(this.id); window.location.href=window.location.href">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons" onclick="setButton(this.id); window.location.href=window.location.href">&nbsp; </div> <script type="text/javascript"> function setButton(value) { localStorage.setItem("buttonID", value); } if (localStorage.buttonID) { document.getElementById(localStorage.buttonID).style.backgroundColor = "RED"; } </script> </body> </html> ```
33,749,207
I have 4 buttons(B1,B2,B3,B4) in HEADER section,Each button redirects to different page in the same tab. Button background color is WHITE. Whenever I clicked on specific button, entire page will reload and redirects to specific button page. NOTE: Header section is included in all 4 button pages. Now my requirement is : Whenever I click on specific button, that specific button back ground color only should change to another color(say ex: RED) rest showld be WHITE color only. EX: If i click B1 button, page should reload, then back ground color of B1 button should change to RED rest should be WHITE. How to do this in Jquery or Java script or CSS? Pls. assist me. ```css .HeaderButtons { width: 15%; background-color: WHITE; } ``` ```html <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> ```
2015/11/17
[ "https://Stackoverflow.com/questions/33749207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3428041/" ]
It sounds like your trying to set an active state on button based on the URL, using a slight change on this article to use buttons rather than links <https://css-tricks.com/snippets/jquery/add-active-navigation-class-based-on-url/> ``` <div id="Header"> <input data-href="/" type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input data-href="/page1/" type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input data-href="/page2/" type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input data-href="/page3/" type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> <script> //jQuery code that adds active class to the button that has the URL path as its data-href attribute $(function() { $('input[data-href^="/' + location.pathname.split("/")[1] + '"]').addClass('active'); }); </script> .HeaderButtons.active { background-color: RED; //CSS to change the button color } ```
Thanks for your suggestions and answers, but the point is , I dont want script code on button click since Page will reload on click of button, hence unable to keep back ground color at that event. I got solution ,it is a bit old, but it works for me exactly. But I need to do hard coded. If any other solutions provided will be appreciated. Here is my Jquery/Javascript code : ``` $(document).ready(function () { var pageURl=window.location.href; if(pageURl.indexOf("Page1.aspx") >-1) { $('#B1').addClass('ButtonBackColorred'); } if(pageURl.indexOf("{Page2.aspx") >-1) { $('#B2').addClass('ButtonBackColorred'); } if(pageURl.indexOf("Page3.aspx") >-1) { $('#B3').addClass('ButtonBackColorred'); } if(pageURl.indexOf("Page4") >-1) { $('#B4').addClass('ButtonBackColorred'); } $('#B1').click(function() { window.location=".../Page1.aspx"; }); $('#B2').click(function() { window.location=".../Page2.aspx"; }); $('#B3').click(function() { window.location=".../Page3.aspx"; }); $('#B4').click(function() { window.location=".../Page4.aspx"; }); ``` });
33,749,207
I have 4 buttons(B1,B2,B3,B4) in HEADER section,Each button redirects to different page in the same tab. Button background color is WHITE. Whenever I clicked on specific button, entire page will reload and redirects to specific button page. NOTE: Header section is included in all 4 button pages. Now my requirement is : Whenever I click on specific button, that specific button back ground color only should change to another color(say ex: RED) rest showld be WHITE color only. EX: If i click B1 button, page should reload, then back ground color of B1 button should change to RED rest should be WHITE. How to do this in Jquery or Java script or CSS? Pls. assist me. ```css .HeaderButtons { width: 15%; background-color: WHITE; } ``` ```html <div id="Header"> <input type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> ```
2015/11/17
[ "https://Stackoverflow.com/questions/33749207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3428041/" ]
It sounds like your trying to set an active state on button based on the URL, using a slight change on this article to use buttons rather than links <https://css-tricks.com/snippets/jquery/add-active-navigation-class-based-on-url/> ``` <div id="Header"> <input data-href="/" type="button" name="B1" id="B1" value="B1" class="HeaderButtons">&nbsp; <input data-href="/page1/" type="button" name="B2" id="B2" value="B2" class="HeaderButtons">&nbsp; <input data-href="/page2/" type="button" name="B3" id="B3" value="B3" class="HeaderButtons">&nbsp; <input data-href="/page3/" type="button" name="B4" id="B4" value="B4" class="HeaderButtons">&nbsp; </div> <script> //jQuery code that adds active class to the button that has the URL path as its data-href attribute $(function() { $('input[data-href^="/' + location.pathname.split("/")[1] + '"]').addClass('active'); }); </script> .HeaderButtons.active { background-color: RED; //CSS to change the button color } ```
Well, this is a relatively simple piece of jquery. Here's how: ``` $('#*button id*').css('background-color', '#ff0000'); ``` This is just the code for the button color change.
41,624,664
I have a modal with dynamic title, and message, I would also like to provide it a dynamic function, when I test it; the function gets fired before the modal is shown, is there a way to not fire that function and instead put it into the scope var so it can be used in the reusable modal? **Dynamic Modal:** ``` <div class="modal fade" id="confirmationModal-reusable" tabindex="-1" role="dialog" aria-labelledby="confirmationTitle2"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="confirmationTitle2">{{reusableTitle}}</h4> </div> <div class="modal-body"> <p>{{reusableMessage}}</p> </div> <div class="modal-footer bootstrap-iso"> <button type="button" ng-click="{{reusableFunction}}" class="btn btn-danger" data-dismiss="modal">Yes</button> <button type="button" class="btn btn-success" data-dismiss="modal">No</button> </div> </div> </div> </div> ``` **JavaScript:** ``` $scope.Refresh = function(){ //prompt for refresh, all unsaved items will be lost. $scope.reusableTitle = "Are you sure?"; $scope.reusableMessage = "Are you sure you want to abandon changes and refresh from server?"; $scope.reusableFunction = $scope.init();//how can I pass this function to the ng-click on my reusable modal? $("#confirmationModal-reusable").modal('show'); }; $scope.init = function() { //gets json from server... }; ```
2017/01/12
[ "https://Stackoverflow.com/questions/41624664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4055982/" ]
You could something like this: ``` <button ng-click="reusableFunction('init')">Click this button</button> ``` And then in the controller do something like this: ``` $scope.reusableFunction = function (functionName){ if(angular.isFunction($scope[functionName])){ $scope[functionName](); } } $scope.init = function(){ //do your stuff } ``` And here is some more info on the `isFunction` call <https://docs.angularjs.org/api/ng/function/angular.isFunction>
I think that the only thing you have to do is this ``` <button type="button" ng-click="reusableFunction()" class="btn btn-danger" data-dismiss="modal">Yes</button> ```
45,734,925
How can I get Terraform 0.10.1 to support two different providers without having to run 'terraform init' every time for each provider? I am trying to use Terraform to 1) Provision an API server with the 'DigitalOcean' provider 2) Subsequently use the 'Docker' provider to spin up my containers Any suggestions? Do I need to write an orchestrating script that wraps Terraform?
2017/08/17
[ "https://Stackoverflow.com/questions/45734925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/772175/" ]
Terraform's current design struggles with creating "multi-layer" architectures in a single configuration, due to the need to pass dynamic settings from one provider to another: ``` resource "digitalocean_droplet" "example" { # (settings for a machine running docker) } provider "docker" { host = "tcp://${digitalocean_droplet.example.ipv4_address_private}:2376/" } ``` As you saw in the documentation, passing dynamic values into provider configuration doesn't fully work. It does actually *partially* work if you use it with care, so one way to get this done is to use a config like the above and then solve the "chicken-and-egg" problem by forcing Terraform to create the droplet first: ``` $ terraform plan -out=tfplan -target=digitalocean_droplet.example ``` The above will create a plan that only deals with the droplet and any of its dependencies, ignoring the docker resources. Once the Docker droplet is up and running, you can then re-run Terraform as normal to complete the setup, which should then work as expected because the Droplet's `ipv4_address_private` attribute will then be known. As long as the droplet is never replaced, Terraform can be used as normal after this. Using `-target` is fiddly, and so the current recommendation is to split such systems up into multiple configurations, with one for each conceptual "layer". This does, however, require initializing two separate working directories, which you indicated in your question that you didn't want to do. This `-target` trick allows you to get it done within a single configuration, at the expense of an unconventional workflow to get it initially bootstrapped.
Maybe you can use a provider instance within your resources/module to set up various resources with various providers. <https://www.terraform.io/docs/configuration/providers.html#multiple-provider-instances> The doc talks about multiple instances of same provider but I believe the same should be doable with distinct providers as well.
45,734,925
How can I get Terraform 0.10.1 to support two different providers without having to run 'terraform init' every time for each provider? I am trying to use Terraform to 1) Provision an API server with the 'DigitalOcean' provider 2) Subsequently use the 'Docker' provider to spin up my containers Any suggestions? Do I need to write an orchestrating script that wraps Terraform?
2017/08/17
[ "https://Stackoverflow.com/questions/45734925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/772175/" ]
Maybe you can use a provider instance within your resources/module to set up various resources with various providers. <https://www.terraform.io/docs/configuration/providers.html#multiple-provider-instances> The doc talks about multiple instances of same provider but I believe the same should be doable with distinct providers as well.
A little bit late... Well, got the same Problem. My workaround is to create modules. First you need a module for your docker Provider with an ip variable: ``` # File: ./docker/main.tf variable "ip" {} provider "docker" { host = "tcp://${var.ip}:2375/" } resource "docker_container" "www" { provider = "docker" name = "www" } ``` Next one is to load that modul in your root configuration: ``` # File: .main.tf module "docker01" { source = "./docker" ip = "192.169.10.12" } module "docker02" { source = "./docker" ip = "192.169.10.12" } ``` True, you will create on every node the same container, but in my case that's what i wanted. I currently haven't found a way to configure the hosts with an individual configuration. Maybe nested modules, but that didn't work in the first tries.
45,734,925
How can I get Terraform 0.10.1 to support two different providers without having to run 'terraform init' every time for each provider? I am trying to use Terraform to 1) Provision an API server with the 'DigitalOcean' provider 2) Subsequently use the 'Docker' provider to spin up my containers Any suggestions? Do I need to write an orchestrating script that wraps Terraform?
2017/08/17
[ "https://Stackoverflow.com/questions/45734925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/772175/" ]
Terraform's current design struggles with creating "multi-layer" architectures in a single configuration, due to the need to pass dynamic settings from one provider to another: ``` resource "digitalocean_droplet" "example" { # (settings for a machine running docker) } provider "docker" { host = "tcp://${digitalocean_droplet.example.ipv4_address_private}:2376/" } ``` As you saw in the documentation, passing dynamic values into provider configuration doesn't fully work. It does actually *partially* work if you use it with care, so one way to get this done is to use a config like the above and then solve the "chicken-and-egg" problem by forcing Terraform to create the droplet first: ``` $ terraform plan -out=tfplan -target=digitalocean_droplet.example ``` The above will create a plan that only deals with the droplet and any of its dependencies, ignoring the docker resources. Once the Docker droplet is up and running, you can then re-run Terraform as normal to complete the setup, which should then work as expected because the Droplet's `ipv4_address_private` attribute will then be known. As long as the droplet is never replaced, Terraform can be used as normal after this. Using `-target` is fiddly, and so the current recommendation is to split such systems up into multiple configurations, with one for each conceptual "layer". This does, however, require initializing two separate working directories, which you indicated in your question that you didn't want to do. This `-target` trick allows you to get it done within a single configuration, at the expense of an unconventional workflow to get it initially bootstrapped.
A little bit late... Well, got the same Problem. My workaround is to create modules. First you need a module for your docker Provider with an ip variable: ``` # File: ./docker/main.tf variable "ip" {} provider "docker" { host = "tcp://${var.ip}:2375/" } resource "docker_container" "www" { provider = "docker" name = "www" } ``` Next one is to load that modul in your root configuration: ``` # File: .main.tf module "docker01" { source = "./docker" ip = "192.169.10.12" } module "docker02" { source = "./docker" ip = "192.169.10.12" } ``` True, you will create on every node the same container, but in my case that's what i wanted. I currently haven't found a way to configure the hosts with an individual configuration. Maybe nested modules, but that didn't work in the first tries.
18,408,332
What approach should be used to save the current generated PHP page as an HTML file in the server database? My PHP page is like a liquidation report which I want to save and it uses JavaScript to get generated, so buffering didn't work (ob\_start and ob\_get\_contents). Edit: I use simple CSS styles and this JavaScript to give an effect of expand-collapse to some objects listed. ``` function showHide(HID,IMG) { if (document.getElementById(IMG).src.indexOf('expand') != -1) { document.getElementById(IMG).src='../../images/collapse.gif'; document.getElementById(HID).className='visibleRow'; } else { document.getElementById(IMG).src='../../images/expand.gif'; document.getElementById(HID).className='hiddenRow'; } } ```
2013/08/23
[ "https://Stackoverflow.com/questions/18408332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711869/" ]
Something like post the `$(body).html()` via AJAX could probably do the trick.
Make your field type as text not varchar. Then youll be able to save html
18,408,332
What approach should be used to save the current generated PHP page as an HTML file in the server database? My PHP page is like a liquidation report which I want to save and it uses JavaScript to get generated, so buffering didn't work (ob\_start and ob\_get\_contents). Edit: I use simple CSS styles and this JavaScript to give an effect of expand-collapse to some objects listed. ``` function showHide(HID,IMG) { if (document.getElementById(IMG).src.indexOf('expand') != -1) { document.getElementById(IMG).src='../../images/collapse.gif'; document.getElementById(HID).className='visibleRow'; } else { document.getElementById(IMG).src='../../images/expand.gif'; document.getElementById(HID).className='hiddenRow'; } } ```
2013/08/23
[ "https://Stackoverflow.com/questions/18408332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711869/" ]
``` $(document).ready( function(){ var data = $('body').html(); // and this can be used to store in database in blob or text field as u wish using AJAX } ``` hope this might help you.
Make your field type as text not varchar. Then youll be able to save html
18,408,332
What approach should be used to save the current generated PHP page as an HTML file in the server database? My PHP page is like a liquidation report which I want to save and it uses JavaScript to get generated, so buffering didn't work (ob\_start and ob\_get\_contents). Edit: I use simple CSS styles and this JavaScript to give an effect of expand-collapse to some objects listed. ``` function showHide(HID,IMG) { if (document.getElementById(IMG).src.indexOf('expand') != -1) { document.getElementById(IMG).src='../../images/collapse.gif'; document.getElementById(HID).className='visibleRow'; } else { document.getElementById(IMG).src='../../images/expand.gif'; document.getElementById(HID).className='hiddenRow'; } } ```
2013/08/23
[ "https://Stackoverflow.com/questions/18408332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711869/" ]
As I've commented on a lot of posts, I thought I should add an answer. For the JavaScript, you should have something like: ``` $(document).ready(function() { var page = $(document).html(); $.post("save_invoice.php", { page: page } ); }); ``` For the PHP, use something like: ``` <?php $page = $_POST['page']; // contains the posted page's content from javascript mysqli_query("INSERT INTO invoices SET page='".$page."'"); ?> ``` If there's any problems, try commenting. Connor :)
Make your field type as text not varchar. Then youll be able to save html
18,408,332
What approach should be used to save the current generated PHP page as an HTML file in the server database? My PHP page is like a liquidation report which I want to save and it uses JavaScript to get generated, so buffering didn't work (ob\_start and ob\_get\_contents). Edit: I use simple CSS styles and this JavaScript to give an effect of expand-collapse to some objects listed. ``` function showHide(HID,IMG) { if (document.getElementById(IMG).src.indexOf('expand') != -1) { document.getElementById(IMG).src='../../images/collapse.gif'; document.getElementById(HID).className='visibleRow'; } else { document.getElementById(IMG).src='../../images/expand.gif'; document.getElementById(HID).className='hiddenRow'; } } ```
2013/08/23
[ "https://Stackoverflow.com/questions/18408332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711869/" ]
Something like post the `$(body).html()` via AJAX could probably do the trick.
``` $(document).ready( function(){ var data = $('body').html(); // and this can be used to store in database in blob or text field as u wish using AJAX } ``` hope this might help you.
18,408,332
What approach should be used to save the current generated PHP page as an HTML file in the server database? My PHP page is like a liquidation report which I want to save and it uses JavaScript to get generated, so buffering didn't work (ob\_start and ob\_get\_contents). Edit: I use simple CSS styles and this JavaScript to give an effect of expand-collapse to some objects listed. ``` function showHide(HID,IMG) { if (document.getElementById(IMG).src.indexOf('expand') != -1) { document.getElementById(IMG).src='../../images/collapse.gif'; document.getElementById(HID).className='visibleRow'; } else { document.getElementById(IMG).src='../../images/expand.gif'; document.getElementById(HID).className='hiddenRow'; } } ```
2013/08/23
[ "https://Stackoverflow.com/questions/18408332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711869/" ]
As I've commented on a lot of posts, I thought I should add an answer. For the JavaScript, you should have something like: ``` $(document).ready(function() { var page = $(document).html(); $.post("save_invoice.php", { page: page } ); }); ``` For the PHP, use something like: ``` <?php $page = $_POST['page']; // contains the posted page's content from javascript mysqli_query("INSERT INTO invoices SET page='".$page."'"); ?> ``` If there's any problems, try commenting. Connor :)
``` $(document).ready( function(){ var data = $('body').html(); // and this can be used to store in database in blob or text field as u wish using AJAX } ``` hope this might help you.