question
stringlengths
11
28.2k
answer
stringlengths
26
27.7k
tag
stringclasses
130 values
question_id
int64
935
78.4M
score
int64
10
5.49k
I know this (or similar) has been asked many times but having tried out numerous possibilities I've not been able to find a a regex that works 100%. I've got a CSV file and I'm trying to split it into an array, but encountering two problems: quoted commas and empty elements. The CSV looks like: 123,2.99,AMO024,Title,"D...
Description Instead of using a split, I think it would be easier to simply execute a match and process all the found matches. This expression will: divide your sample text on the comma delimits will process empty values will ignore double quoted commas, providing double quotes are not nested trims the delimiting comma...
Split
18,144,431
65
I have this text file made up of numbers and words, for example like this - 09807754 18 n 03 aristocrat 0 blue_blood 0 patrician and I want to split it so that each word or number will come up as a new line. A whitespace separator would be ideal as I would like the words with the dashes to stay connected. This is what...
Given this file: $ cat words.txt line1 word1 word2 line2 word3 word4 line3 word5 word6 If you just want one word at a time (ignoring the meaning of spaces vs line breaks in the file): with open('words.txt','r') as f: for line in f: for word in line.split(): print(word) Prints: line1 word1 w...
Split
16,922,214
64
I need to split text before the second occurrence of the '-' character. What I have now is producing inconsistent results. I've tried various combinations of rsplit and read through and tried other solutions on SO, with no results. Sample file name to split: 'some-sample-filename-to-split' returned in data.filename. ...
You can do something like this: >>> a = "some-sample-filename-to-split" >>> "-".join(a.split("-", 2)[:2]) 'some-sample' a.split("-", 2) will split the string upto the second occurrence of -. a.split("-", 2)[:2] will give the first 2 elements in the list. Then simply join the first 2 elements. OR You could use regular ...
Split
36,300,158
63
I have a pandas dataframe with a column named 'City, State, Country'. I want to separate this column into three new columns, 'City, 'State' and 'Country'. 0 HUN 1 ESP 2 GBR 3 ESP 4 FRA 5 ID, USA 6 GA, USA 7 Hoboke...
I'd do something like the following: foo = lambda x: pd.Series([i for i in reversed(x.split(','))]) rev = df['City, State, Country'].apply(foo) print rev 0 1 2 0 HUN NaN NaN 1 ESP NaN NaN 2 GBR NaN NaN 3 ESP NaN NaN 4 FRA NaN NaN 5 USA ID NaN 6 USA G...
Split
23,317,342
63
I want to split a string like "first middle last" with String.split(). But when i try to split it I get String[] array = {"first","","","","middle","","last"} I tried using String.isEmpty() to check for empty strings after I split them but I it doesn't work in android. Here is my code: String s = "First Mid...
Since the argument to split() is a regular expression, you can look for one or more spaces (" +") instead of just one space (" "). String[] array = s.split(" +");
Split
10,079,415
63
I'm trying to split a photo into multiple pieces using PIL. def crop(Path,input,height,width,i,k,x,y,page): im = Image.open(input) imgwidth = im.size[0] imgheight = im.size[1] for i in range(0,imgheight-height/2,height-2): print i for j in range(0,imgwidth-width/2,width-2): p...
Splitting image to tiles of MxN pixels (assuming im is numpy.ndarray): tiles = [im[x:x+M,y:y+N] for x in range(0,im.shape[0],M) for y in range(0,im.shape[1],N)] In the case you want to split the image to four pieces: M = im.shape[0]//2 N = im.shape[1]//2 tiles[0] holds the upper left tile
Split
5,953,373
63
Is it possible to reopen closed window in vim, that was in split? Something like ctrl+shift+t with browser tabs?
:vs# will split current window vertically and open the alternate file. It's so simple that you don't need to bind it to key.
Split
8,184,001
62
I want to split a text with comma , not space in for foo in list. Suppose I have a CSV file CSV_File with following text inside it: Hello,World,Questions,Answers,bash shell,script ... I used following code to split it into several words: for word in $(cat CSV_File | sed -n 1'p' | tr ',' '\n') do echo $word done It p...
Set IFS to ,: sorin@sorin:~$ IFS=',' ;for i in `echo "Hello,World,Questions,Answers,bash shell,script"`; do echo $i; done Hello World Questions Answers bash shell script sorin@sorin:~$
Split
7,718,307
62
We need to split a large live WMV video feed in small chunks all of the same size. We made a script that works fine doing this, except for one thing: the video chunks don't start with a key frame, so when playing most video chunks they don't display any image until a key frame from the original video is eventually reac...
The latest builds of FFMPEG include a new option "segment" which does exactly what I think you need. ffmpeg -i INPUT.mp4 -acodec copy -f segment -vcodec copy \ -reset_timestamps 1 -map 0 OUTPUT%d.mp4 This produces a series of numbered output files which are split into segments based on Key Frames. In my own testi...
Split
14,005,110
61
I already know how to use the diffopt variable to start diff mode with horizontal/vertical splits but not how to toggle between the two when I already have two files open for comparison. I tried the accepted answer found in this older post, but to no avail. The Ctrl+W commands didn't work for me. Perhaps because I'm ru...
The following command will change a vertical split into a horizontal split: ctrl+w then shift+j To change back to a vertical split use either: ctrl+w then shift+h or ctrl+w then shift+l For more information about moving windows: :h window-moving :h ctrl-w_J :h ctrl-w_K :h ctrl-w_H :h ctrl-w_L
Split
5,682,759
61
I need to write a procedure to normalize a record that have multiple tokens concatenated by one char. I need to obtain these tokens splitting the string and insert each one as a new record in a table. Does Oracle have something like a "split" function?
There is apex_util.string_to_table - see my answer to this question. Also, prior to the existence of the above function, I once posted a solution here on my blog. Update In later versions of APEX, apex_util.string_to_table is deprecated, and a similar function apex_string.split is preferred.
Split
3,710,589
61
I have a list of product codes in a text file, on each line is the product code that looks like: abcd2343 abw34324 abc3243-23A So it is letters followed by numbers and other characters. I want to split on the first occurrence of a number.
import re s='abcd2343 abw34324 abc3243-23A' re.split('(\d+)',s) > ['abcd', '2343', ' abw', '34324', ' abc', '3243', '-', '23', 'A'] Or, if you want to split on the first occurrence of a digit: re.findall('\d*\D+',s) > ['abcd', '2343 abw', '34324 abc', '3243-', '23A'] \d+ matches 1-or-more digits. \d*\D+ matches 0-...
Split
3,340,081
61
I am using split() to tokenize a String separated with * following this format: name*lastName*ID*school*age % name*lastName*ID*school*age % name*lastName*ID*school*age I'm reading this from a file named "entrada.al" using this code: static void leer() { try { String ruta="entrada.al"; File myFile ...
No, the problem is that * is a reserved character in regexes, so you need to escape it. String [] separado = line.split("\\*"); * means "zero or more of the previous expression" (see the Pattern Javadocs), and you weren't giving it any previous expression, making your split expression illegal. This is why the error wa...
Split
917,822
61
I have a table with this values: Articles/Search/ArtMID/2681/ArticleID/2218/Diet.aspx OurStory/MeettheFoodieandtheMD.aspx TheFood/OurMenu.aspx I want to get this Diet.aspx MeettheFoodieandtheMD.aspx OurMenu.aspx How can i do this?
The way to do it in SQL : SELECT SUBSTRING( string , LEN(string) - CHARINDEX('/',REVERSE(string)) + 2 , LEN(string) ) FROM SAMPLE; JSFiddle here http://sqlfiddle.com/#!3/41ead/11
Split
14,412,898
60
For example, there is a string val s = "Test". How do you separate it into t, e, s, t?
Do you need characters? "Test".toList // Makes a list of characters "Test".toArray // Makes an array of characters Do you need bytes? "Test".getBytes // Java provides this Do you need strings? "Test".map(_.toString) // Vector of strings "Test".sliding(1).toList // List of strings "Test".sliding(1).toArray /...
Split
5,052,042
60
What is a good way to do some_string.split('') in python? This syntax gives an error: a = '1111' a.split('') ValueError: empty separator I would like to obtain: ['1', '1', '1', '1']
Use list(): >>> list('1111') ['1', '1', '1', '1'] Alternatively, you can use map() (Python 2.7 only): >>> map(None, '1111') ['1', '1', '1', '1'] Time differences: $ python -m timeit "list('1111')" 1000000 loops, best of 3: 0.483 usec per loop $ python -m timeit "map(None, '1111')" 1000000 loops, best of 3: 0.431 usec...
Split
17,380,592
59
I don't understand this behaviour: var string = 'a,b,c,d,e:10.'; var array = string.split ('.'); I expect this: console.log (array); // ['a,b,c,d,e:10'] console.log (array.length); // 1 but I get this: console.log (array); // ['a,b,c,d,e:10', ''] console.log (array.length); // 2 Why two elements are returned instead...
You could add a filter to exclude the empty string. var string = 'a,b,c,d,e:10.'; var array = string.split ('.').filter(function(el) {return el.length != 0});
Split
12,836,062
59
In JS if you would like to split user entry into an array what is the best way of going about it? For example: entry = prompt("Enter your name") for (i=0; i<entry.length; i++) { entryArray[i] = entry.charAt([i]); } // entryArray=['j', 'e', 'a', 'n', 's', 'y'] after loop Perhaps I'm going about this the wrong way - ...
Use the .split() method. When specifying an empty string as the separator, the split() method will return an array with one element per character. entry = prompt("Enter your name") entryArray = entry.split("");
Split
7,979,727
59
In SQL Server 2016 I receive this error with STRING_SPLIT function SELECT * FROM STRING_SPLIT('a,b,c',',') Error: Invalid object name 'STRING_SPLIT'.
Make sure that the database compatibility level is 130 you can use the following query to change it: ALTER DATABASE [DatabaseName] SET COMPATIBILITY_LEVEL = 130 As mentioned in the comments, you can check the current compatibility level of a database using the following command: SELECT compatibility_level FROM sys.dat...
Split
47,205,829
58
I have file that contains values separated by tab ("\t"). I am trying to create a list and store all values of file in the list. But I get some problem. Here is my code. line = "abc def ghi" values = line.split("\t") It works fine as long as there is only one tab between each value. But if there is one than one tab th...
You can use regex here: >>> import re >>> strs = "foo\tbar\t\tspam" >>> re.split(r'\t+', strs) ['foo', 'bar', 'spam'] update: You can use str.rstrip to get rid of trailing '\t' and then apply regex. >>> yas = "yas\t\tbs\tcda\t\t" >>> re.split(r'\t+', yas.rstrip('\t')) ['yas', 'bs', 'cda']
Split
17,038,426
58
I want to open my file.txt and split all data from this file. Here is my file.txt: some_data1 some_data2 some_data3 some_data4 some_data5 and here is my python code: >>>file_txt = open("file.txt", 'r') >>>data = file_txt.read() >>>data_list = data.split(' ') >>>print data some_data1 some_data2 some_data3 some_data4 so...
Your file contains UTF-8 BOM in the beginning. To get rid of it, first decode your file contents to unicode. fp = open("file.txt") data = fp.read().decode("utf-8-sig").encode("utf-8") But better don't encode it back to utf-8, but work with unicoded text. There is a good rule: decode all your input text data to unicode...
Split
18,664,712
57
Given: String input = "one two three four five six seven"; Is there a regex that works with String.split() to grab (up to) two words at a time, such that: String[] pairs = input.split("some regex"); System.out.println(Arrays.toString(pairs)); results in this: [one two, three four, five six, seven] This question is ...
Currently (last tested on Java 17) it is possible to do it with split(), but in real world don't use this approach since it looks like it is based on bug since look-behind in Java should have obvious maximum length, but this solution uses \w+ which doesn't respect this limitation and somehow still works - so if it is a...
Split
16,485,687
57
Possible Duplicate: substring between two delimiters I have a string like "ABC[ This is to extract ]" I want to extract the part "This is to extract" in java. I am trying to use split, but it is not working the way I want. Does anyone have suggestion?
If you have just a pair of brackets ( [] ) in your string, you can use indexOf(): String str = "ABC[ This is the text to be extracted ]"; String result = str.substring(str.indexOf("[") + 1, str.indexOf("]"));
Split
13,796,451
57
I have some input that looks like the following: A,B,C,"D12121",E,F,G,H,"I9,I8",J,K The comma-separated values can be in any order. I'd like to split the string on commas; however, in the case where something is inside double quotation marks, I need it to both ignore commas and strip out the quotation marks. So basica...
Lasse is right; it's a comma separated value file, so you should use the csv module. A brief example: from csv import reader # test infile = ['A,B,C,"D12121",E,F,G,H,"I9,I8",J,K'] # real is probably like # infile = open('filename', 'r') # or use 'with open(...) as infile:' and indent the rest for line in reader(infil...
Split
8,069,975
57
I would like to split a string with delimiters but keep the delimiters in the result. How would I do this in C#?
If the split chars were ,, ., and ;, I'd try: using System.Text.RegularExpressions; ... string[] parts = Regex.Split(originalString, @"(?<=[.,;])") (?<=PATTERN) is positive look-behind for PATTERN. It should match at any place where the preceding text fits PATTERN so there should be a match (and a split) after eac...
Split
4,680,128
57
I've used multiple ways of splitting and stripping the strings in my pandas dataframe to remove all the '\n'characters, but for some reason it simply doesn't want to delete the characters that are attached to other words, even though I split them. I have a pandas dataframe with a column that captures text from web page...
EDIT: the correct answer to this is: df = df.replace(r'\n',' ', regex=True) I think you need replace: df = df.replace('\n','', regex=True) Or: df = df.replace('\n',' ', regex=True) Or: df = df.replace(r'\\n',' ', regex=True) Sample: text = '''hands-on\ndev nologies\nrelevant scripting\nlang ''' df = pd.DataFrame({...
Split
44,227,748
55
Is there a Python-way to split a string after the nth occurrence of a given delimiter? Given a string: '20_231_myString_234' It should be split into (with the delimiter being '_', after its second occurrence): ['20_231', 'myString_234'] Or is the only way to accomplish this to count, split and join?
>>> n = 2 >>> groups = text.split('_') >>> '_'.join(groups[:n]), '_'.join(groups[n:]) ('20_231', 'myString_234') Seems like this is the most readable way, the alternative is regex)
Split
17,060,039
55
Right now I'm doing a split on a string and assuming that the newline from the user is \r\n like so: string.split(/\r\n/) What I'd like to do is split on either \r\n or just \n. So how what would the regex be to split on either of those?
Did you try /\r?\n/ ? The ? makes the \r optional. Example usage: http://rubular.com/r/1ZuihD0YfF
Split
6,551,128
55
Is there a way to split a string into 2 equal halves without using a loop in Python?
Python 2: firstpart, secondpart = string[:len(string)/2], string[len(string)/2:] Python 3: firstpart, secondpart = string[:len(string)//2], string[len(string)//2:]
Split
4,789,601
55
How can I write a Ruby function that splits the input by any kind of whitespace, and remove all the whitespace from the result? For example, if the input is aa bbb cc dd ee Then return an array ["aa", "bbb", "cc", "dd", "ee"].
This is the default behavior of String#split: input = <<-TEXT aa bbb cc dd ee TEXT input.split Result: ["aa", "bbb", "cc", "dd", "ee"] This works in all versions of Ruby that I tested, including 1.8.7, 1.9.3, 2.0.0, and 2.1.2.
Split
13,537,920
54
Here is the current code in my application: String[] ids = str.split("/"); When profiling the application, a non-negligeable time is spent string splitting. Also, the split method takes a regular expression, which is superfluous here. What alternative can I use in order to optimize the string splitting? Is StringUtils...
String.split(String) won't create regexp if your pattern is only one character long. When splitting by single character, it will use specialized code which is pretty efficient. StringTokenizer is not much faster in this particular case. This was introduced in OpenJDK7/OracleJDK7. Here's a bug report and a commit. I've ...
Split
11,001,330
54
The Java documentation doesn't seem to mention anything about deprecation for StringTokenizer, yet I keep hearing about how it was deprecated long ago. Was it deprecated because it had bugs/errors, or is String.split() simply better to use overall? I have some code that uses StringTokenizer and I am wondering if I sho...
Java 10 String Tokenizer -- not deprecated Java 9 String Tokenizer -- not deprecated Java 8 String Tokenizer -- not deprecated Java 7 String Tokenizer -- not deprecated Java 6 String Tokenizer -- not deprecated Java 5 String Tokenizer -- not deprecated If it is not marked as deprecated, it is not going away.
Split
6,983,856
54
I have a formatted string from a log file, which looks like: >>> a="test result" That is, the test and the result are split by some spaces - it was probably created using formatted string which gave test some constant spacing. Simple splitting won't do the trick: >>> a.split(" ") ['test', ''...
Just do not give any delimeter? >>> a="test result" >>> a.split() ['test', 'result']
Split
2,492,415
54
I have a to do this: AccountList.Split(vbCrLf) In c# AccountList is a string. How can i do? thanks
You are looking for System.Environment.NewLine. On Windows, this is equivalent to \r\n though it could be different under another .NET implementation, such as Mono on Linux, for example.
Split
2,401,786
54
Let's say I have a column which has values like: foo/bar chunky/bacon/flavor /baz/quz/qux/bax I.e. a variable number of strings separated by /. In another column I want to get the last element from each of these strings, after they have been split on /. So, that column would have: bar flavor bax I can't figure this...
Edit: this one is simplier: =REGEXEXTRACT(A1,"[^/]+$") You could use this formula: =REGEXEXTRACT(A1,"(?:.*/)(.*)$") And also possible to use it as ArrayFormula: =ARRAYFORMULA(REGEXEXTRACT(A1:A3,"(?:.*/)(.*)$")) Here's some more info: the RegExExtract function Some good examples of syntax my personal list of Regex ...
Split
37,390,009
52
Afternoon, I need to split an array into smaller "chunks". I am passing over about 1200 items, and need to split these into easier to handle arrays of 100 items each, which I then need to process. Could anyone please make some suggestions?
Array.Copy has been around since 1.1 and does an excellent job of chunking arrays. List.GetRange() would also be a good choice as mentioned in another answer. string[] buffer; for(int i = 0; i < source.Length; i+=100) { buffer = new string[100]; Array.Copy(source, i, buffer, 0, 100); // process array } An...
Split
11,207,526
52
I am trying to split a column into multiple columns based on comma/space separation. My dataframe currently looks like KEYS 1 0 FIT-4270 4000.0439 1 FIT-4269 4000.0420, 4000.0471 2...
In case someone else wants to split a single column (deliminated by a value) into multiple columns - try this: series.str.split(',', expand=True) This answered the question I came here looking for. Credit to EdChum's code that includes adding the split columns back to the dataframe. pd.concat([df[[0]], df[1].str.spl...
Split
37,600,711
51
I was following this article And I came up with this code: string FileName = "C:\\test.txt"; using (StreamReader sr = new StreamReader(FileName, Encoding.Default)) { string[] stringSeparators = new string[] { "\r\n" }; string text = sr.ReadToEnd(); string[] lines = text.Split(stringSeparators, StringSplit...
The problem is not with the splitting but rather with the WriteLine. A \n in a string printed with WriteLine will produce an "extra" line. Example var text = "somet interesting text\n" + "some text that should be in the same line\r\n" + "some text should be in another line"; string[] stringSeparators = new stri...
Split
22,185,009
51
I am trying to split up a string by caps using Javascript, Examples of what Im trying to do: "HiMyNameIsBob" -> "Hi My Name Is Bob" "GreetingsFriends" -> "Greetings Friends" I am aware of the str.split() method, however I am not sure how to make this function work with capital letters. I've tried: str.split("(?=\\p...
Use RegExp-literals, a look-ahead and [A-Z]: console.log( // -> "Hi My Name Is Bob" window.prompt('input string:', "HiMyNameIsBob").split(/(?=[A-Z])/).join(" ") )
Split
10,064,683
51
I have table with data 1/1 to 1/20 in one column. I want the value 1 to 20 i.e value after '/'(front slash) is updated into other column in same table in SQL Server. Example: Column has value 1/1,1/2,1/3...1/20 new Column value 1,2,3,..20 That is, I want to update this new column.
Try this: UPDATE YourTable SET Col2 = RIGHT(Col1,LEN(Col1)-CHARINDEX('/',Col1))
Split
9,260,044
51
I have a string and I would like to split that string by delimiter at a certain position. For example, my String is F/P/O and the result I am looking for is: Therefore, I would like to separate the string by the furthest delimiter. Note: some of my strings are F/O also for which my SQL below works fine and returns des...
Therefore, I would like to separate the string by the furthest delimiter. I know this is an old question, but this is a simple requirement for which SUBSTR and INSTR would suffice. REGEXP are still slower and CPU intensive operations than the old subtsr and instr functions. SQL> WITH DATA AS 2 ( SELECT 'F/P/O' ...
Split
26,878,291
50
let string = "hello hi" var hello = "" var hi = "" I wan't to split my string so that the value of hello get "hello" and the value of hi get "hi"
Try this: var myString: String = "hello hi"; var myStringArr = myString.componentsSeparatedByString(" ") Where myString is the name of your string, and myStringArr contains the components separated by the space. Then you can get the components as: var hello: String = myStringArr [0] var hi: String = myStringArr [1] D...
Split
25,818,197
50
I need help splitting a string in javascript by space (" "), ignoring space inside quotes expression. I have this string: var str = 'Time:"Last 7 Days" Time:"Last 30 Days"'; I would expect my string to be split to 2: ['Time:"Last 7 Days"', 'Time:"Last 30 Days"'] but my code splits to 4: ['Time:', '"Last 7 Days"', 'Ti...
s = 'Time:"Last 7 Days" Time:"Last 30 Days"' s.match(/(?:[^\s"]+|"[^"]*")+/g) // -> ['Time:"Last 7 Days"', 'Time:"Last 30 Days"'] Explained: (?: # non-capturing group [^\s"]+ # anything that's not a space or a double-quote | # or… " # opening double-quote [^"]* # …followed by ...
Split
16,261,635
49
In Swift, it's easy to split a string on a character and return the result in an array. What I'm wondering is if you can split a string by another string instead of just a single character, like so... let inputString = "This123Is123A123Test" let splits = inputString.split(onString:"123") // splits == ["This", "Is", "A...
import Foundation let inputString = "This123Is123A123Test" let splits = inputString.components(separatedBy: "123")
Split
49,472,570
48
I have a huge CSV with many tables with many rows. I would like to simply split each dataframe into 2 if it contains more than 10 rows. If true, I would like the first dataframe to contain the first 10 and the rest in the second dataframe. Is there a convenient function for this? I've looked around but found nothing ...
I used a List Comprehension to cut a huge DataFrame into blocks of 100'000: size = 100000 list_of_dfs = [df.loc[i:i+size-1,:] for i in range(0, len(df),size)] or as generator: list_of_dfs = (df.loc[i:i+size-1,:] for i in range(0, len(df),size))
Split
25,290,757
48
I am trying to get and array of text after using the text function, having a ul list like <ul> <li>one <ul> <li>one one</li> <li>one two</li> </ul> </li> </ul> then get something like ['one', 'one one', 'one two']
var array = $('li').map(function(){ return $.trim($(this).text()); }).get(); http://api.jquery.com/map/ Demo Fiddle --> http://jsfiddle.net/EC4yq/
Split
16,570,564
48
I would like to split a string only where there are at least two or more whitespaces. For example str = '10DEUTSCH GGS Neue Heide 25-27 Wahn-Heide -1 -1' print(str.split()) Results: ['10DEUTSCH', 'GGS', 'Neue', 'Heide', '25-27', 'Wahn-Heide', '-1', '-1'] I would like it to look like this: ['10DEUTSC...
>>> import re >>> text = '10DEUTSCH GGS Neue Heide 25-27 Wahn-Heide -1 -1' >>> re.split(r'\s{2,}', text) ['10DEUTSCH', 'GGS Neue Heide 25-27', 'Wahn-Heide', '-1', '-1'] Where \s matches any whitespace character, like \t\n\r\f\v and more {2,} is a repetition, meaning "2 or more"
Split
12,866,631
47
I have a JSON feed connected to my app. One of the items is lat & long separated by a comma. For example: "32.0235, 1.345". I'm trying to split this up into two separate values by splitting at the comma. Any advice? Thanks!!
NSArray *strings = [coords componentsSeparatedByString:@","];
Split
6,443,535
47
In Tinkerpop 3, how to perform pagination? I want to fetch the first 10 elements of a query, then the next 10 without having to load them all in memory. For example, the query below returns 1000,000 records. I want to fetch them 10 by 10 without loading all the 1000,000 at once. g.V().has("key", value).limit(10) Edit ...
From a functional perspective, a nice looking bit of Gremlin for paging would be: gremlin> g.V().hasLabel('person').fold().as('persons','count'). select('persons','count'). by(range(local, 0, 2)). by(count(local)) ==>[persons:[v[1],v[2]],count:4] gremlin> g.V().hasLabel(...
Gremlin
39,826,983
23
I'm trying to understand how this pattern for a conditional insert works: g.V() .hasLabel('person').has('name', 'John') .fold() .coalesce( __.unfold(), g.addV('person').property('name', 'John') ).next(); What is the purpose of the fold/unfold? Why are these necessary, and why does this not work: g.V() ...
Consider what happens when you just do the following: gremlin> g = TinkerFactory.createModern().traversal() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] gremlin> g.V().has('name','marko') ==>v[1] gremlin> g.V().has('name','stephen') gremlin> For "marko" you return something and for "stephen" you...
Gremlin
51,784,430
22
I've been playing with Titan graph server for a while now. And my feeling is that, despite an extensive documentation, there is a lack of Getting started from scratch tutorial. My final goal is to have a titan running on cassandra and query with StartTheShift/thunderdome. I have seen few ways of starting Titan: Using R...
According to the documentation TitanFactory.open() takes either the name of a config file or the name of a directory to open or create a database in. If what steven says is true, there would be two ways to connect to the database with a BerkelyDB backend: Start the database through bin/titan.sh. Connect to the data...
Gremlin
16,397,426
22
I am new to Gremlin query language. I have to insert data on a Cosmos DB graph (using Gremlin.Net package), whether the Vertex (or Edge) already exists in the graph or not. If the data exists, I only need to update the properties. I wanted to use this kind of pattern: g.V().hasLabel('event').has('id','1').tryNext().orE...
There are a number of ways to do this but I think that the TinkerPop community has generally settled on this approach: g.V().has('event','id','1'). fold(). coalesce(unfold(), addV('event').property('id','1')) Basically, it looks for the "event" with has() and uses fold() step to coerce to a list. The li...
Gremlin
49,758,417
20
What is the best way to create a bidirectional edge between two vertices using gremlin. Is there a direct command which adds the edge or should we add two edges like vertex X -> Vertex Y and vertex Y -> Vertex X?
You can add an edge between two vertices and then ignore the direction at query-time by using the both() step. This is how you typically address bidirectional edges in Gremlin. Let's open the Gremlin Console and create a simple graph where Alice and Bob are friends: \,,,/ (o o) -----oOOo-(3)-oOOo-----...
Gremlin
40,699,756
18
GREMLIN and SPARQL only define the APIs for graph queries. How do I use the API responses and and plot that as an actual graph, with edges and vertices? Is there something like MySQL Workbench for graphs?
UPDATE: As of Nov 2019, Neptune launched Workbench, which is a Jupyter based visualization for Gremlin and SPARQL. UPDATE: As of Aug 2020, Neptune Workbench extended support for visualizing graph data as nodes and edges in addition to tabular representation that was previously supported. https://aws.amazon.com/abou...
Gremlin
52,848,013
16
I am working with groovy (gremlin to traverse a graph database to be exact). Unfortunately, because I am using gremlin, I cannot import new classes. I have some date values that I wish to convert to a Unix timestamp. They are stored as UTC in the format: 2012-11-13 14:00:00:000 I am parsing it using this snippet (in gr...
Here are two ways to do it in Java: /* * Add the TimeZone info to the end of the date: */ String dateString = "2012-11-13 14:00:00:000"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d H:m:s:S Z"); Date theDate = sdf.parse(dateString + " UTC"); /* * Use SimpleDateFormat.setTimeZone() */ String dateStrin...
Gremlin
13,390,631
16
I have an array of usernames (eg. ['abc','def','ghi']) to be added under 'user' label in the graph. Now I first want to check if the username already exists (g.V().hasLabel('user').has('username','def')) and then add only those for which the username property doesn't match under 'user' label. Also, can this be done in ...
With "scripts" you can always pass a multi-line/command script to the server for processing to get what you want done. This question is then answered with normal programming techniques using variables, if/then statements, etc: t = g.V().has('person','name','bill') t.hasNext() ? t.next() : g.addV('person').property('nam...
Gremlin
46,027,444
14
Is it possible to search Vertex properties with a contains in Azure Cosmos Graph DB? For example, I would like to find all persons which have 'Jr' in their name? g.V().hasLabel('person').has('name',within('Jr')).values('name') Seems like the within('') function only filters values that are exactly equal to 'Jr'. I am ...
None of the text matching functions are available for CosmosDB at this time. However, I was able to implement a wildcard search functionality by using a UDF (User Defined Function) which uses the Javascript match() function: function userDefinedFunction(input, pattern) { return input.match(pattern) !== null; }; Then y...
Gremlin
44,864,203
13
I wanted to model partner relationship like the following, which I expressed in the format of labeled property graph. I wanted to use RDF language to express the above graph, particularly I wanted to understand if I can express the label of the "loves" edge (which is an URI to an article/letter). I am new to RDF, and ...
RDF doesn't support edge properties, so the brief answer is no. But of course there are ways to model this kind of thing in RDF. Plain RDF triple without edge properties If we didn't want to annotate the edge, the relationship between Bob and Mary would simply be a triple with Bob as Subject, Mary as object, and “loves...
Gremlin
55,885,944
13
I'm new to Gremlin and just trying to build out a basic graph. I've been able to do a basic addEdge on new vertices, i.e. gremlin> v1 = g.addVertex() ==>v[200004] gremlin> v2 = g.addVertex() ==>v[200008] gremlin> e = g.addEdge(v1, v2, 'edge label') ==>e[4c9f-Q1S-2F0LaTPQN8][200004-edge label->200008] I have also been...
The key issue is that .has returns a Pipe: in order to get the specific vertex instance, a simple call to .next() does the trick: gremlin> v1 = g.V.has("x",5).has('y",7).next() ==>v[200004] gremlin> v2 = g.V.has("x",3).has('y",5).next() ==>v[200008] gremlin> e = g.addEdge(v1, v2, 'edge label') ==>e[4c9f-Q1S-2F0LaTPQN8...
Gremlin
17,117,683
13
Im using OrientDB type graph. I need syntax of Gremlin for search same SQL LIKE operator LIKE 'search%' or LIKE '%search%' I've check with has and filter (in http://gremlindocs.com/). However it's must determine exact value is passed with type property. I think this is incorrect with logic of search. Thanks for anythi...
For Cosmos Db Gremlin support g.V().has('foo', TextP.containing('search')) You can find the documentation Microsoft Gremlin Support docs And TinkerPop Reference
Gremlin
19,085,078
12
I want to query my TITAN 0.4 graph, based on two filter conditions with "OR" logical operator (return vertices if either of conditions is true). I searched this on http://sql2gremlin.com/, but only "AND" operator is given, My requirement is something as given below: SELECT * FROM Products WHERE Discontinued = 1 O...
You could do: g.V('type','product').or(_().has('discontinued', true), _().has('unitsInStock', 0)) See the or step in GremlinDocs.
Gremlin
30,043,747
12
In the Modern graph, I want to get for each person the name and the list of names of software he created. So I tried the following query g.V().hasLabel('person').project('personName','softwareNames'). by(values('name')). by(out('created').values('name').aggregate('a').s...
You can simplify your Gremlin to this: gremlin> g.V().hasLabel('person'). ......1> project('personName','softwareNames'). ......2> by('name'). ......3> by(out('created').values('name').fold()) ==>[personName:marko,softwareNames:[lop]] ==>[personName:vadas,softwareNames:[]] ==>[personName:josh,softwareNames:[r...
Gremlin
49,466,453
12
I want to remove edge between two vertices, so my code in java tinkerpop3 as below private void removeEdgeOfTwoVertices(Vertex fromV, Vertex toV,String edgeLabel,GraphTraversalSource g){ if(g.V(toV).inE(edgeLabel).bothV().hasId(fromV.id()).hasNext()){ List<Edge> edgeList = g.V(toV).inE(edgeLabel).to...
Here's an example of how to drop edges between two vertices (where you just have the ids of those vertices: gremlin> graph = TinkerFactory.createModern() ==>tinkergraph[vertices:6 edges:6] gremlin> g = graph.traversal() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] gremlin> g.V(1).bothE() ==>e[9][1...
Gremlin
34,589,215
11
What is the easiest & most efficient way to count the number of nodes/edges in a large graph via Gremlin? The best I have found is using the V iterator: gremlin> g.V.gather{it.size()} However, this is not a viable option for large graphs, per the documentation for V: The vertex iterator for the graph. Utilize this t...
I think the preferred way to do a count of all vertices would be: gremlin> g = TinkerGraphFactory.createTinkerGraph() ==>tinkergraph[vertices:6 edges:6] gremlin> g.V.count() ==>6 gremlin> g.E.count() ==>6 though, I think that on a very large graph g.V/E just breaks down no matter what you do. On a very large graph th...
Gremlin
17,214,959
11
When user enters data in a text box, many possibilities of SQL Injection are observed. To prevent this, many methods are available to have placeholders in the SQL query, which are replaced in the next step of code by the input. Similarly, how can we prevent Gremlin Injection in C#? Example: The following is a sample co...
The question was originally about Gremlin injections for cases where the Gremlin traversal was sent to the server (e.g., Gremlin Server) in the form of a query script. My original answer for this scenario can be found below (Gremlin Scripts). However, by now Gremlin Language Variants are the dominant way to execute Gre...
Gremlin
44,473,303
11
I've been looking at the management system but some things still elude me. Essentially what I want to do is: List all Edge based indexes (including vertex centric). List all Vertex based indexes (on a per label basis if the index is attached to a label). It's basically like mapping out the graph schema. I've tried a ...
it's not really straight forward, hence I'm going to show it using an example. Let's start with the Graph of the Gods + an additional index for god names: g = TitanFactory.open("conf/titan-cassandra-es.properties") GraphOfTheGodsFactory.load(g) m = g.getManagementSystem() name = m.getPropertyKey("name") god = m.getVert...
Gremlin
25,702,461
11
I have following graph: g.addV('TEST').property(id, 't1') g.addV('TEST').property(id, 't2').property('a', 1) If I do: g.V('t2').project('a').by(values('a')) the traversal works and returns map with key a because property is there. But if I have project step in my traversal like following: g.V('t1').project('a').by(val...
You can use coalesce(): gremlin> g.V().project('a').by(coalesce(values('a'),constant('default'))) ==>[a:default] ==>[a:1]
Gremlin
56,669,894
10
I'm using cosmos graph db in azure. Does anyone know if there is a way to add an edge between two vertex only if it doesn't exist (using gremlin graph query)? I can do that when adding a vertex, but not with edges. I took the code to do so from here: g.Inject(0).coalesce(__.V().has('id', 'idOne'), addV('User').propert...
It is possible to do with edges. The pattern is conceptually the same as vertices and centers around coalesce(). Using the "modern" TinkerPop toy graph to demonstrate: gremlin> g.V().has('person','name','vadas').as('v'). V().has('software','name','ripple'). coalesce(__.inE('created').where(outV()....
Gremlin
52,447,308
10
The goal I have a simple enough task to accomplish: Set the weight of a specific edge property. Take this scenario as an example: What I would like to do is update the value of weight. Additional Requirements If the edge does not exist, it should be created. There may only exist at most one edge of the same type betw...
You are on the right track. Check out the vertex steps documentation. Label the edge, then traverse from the edge to the vertex to check, then jump back to the edge to update the property. g.V(vertex.id()). outE("votes_for").has("type", "eat").as("e"). inV().has("name", "pizza"). select("e").property("weight", 0....
Gremlin
40,746,954
10
I have a tree with many levels, where leaf nodes might have property "count". I want to calculate total count for each sub-tree, and cache those values in the root node of each sub-tree. Is that possible in Gremlin?
You could do it with a sideEffect - that's pretty straightforward. We setup a simple tree with: gremlin> g = new TinkerGraph() ==>tinkergraph[vertices:0 edges:0] gremlin> v1 = g.addVertex() ...
Gremlin
32,660,891
10
We're currently having some trouble with the bitbucket branch source plugin used to handle a multibranch test job in one of our Jenkins instances (productive instance): Any job related to a deleted branch is not getting deleted in Jenkins. Is is shown as disabled. Checking the Scan Multibranch Pipeline Log I find the f...
Finally I found the hidded switch by myself. Feeling little bit stupid, though. In the job configuration you can specify for how long to keep old items. When setting up this job initially I must have mixed up this setting with the setting which tells jenkins for how long to keep old builds. So it was set to 30 days. Bt...
Jenkins
51,734,259
39
I want to use scp/ssh to upload some files to a server. I discover that I need to use certificate-based authentication, but the question is how? Really what I want to do is to use the same sort of credentials I use with git - passworded ssh cert stored in Jenkins. However, I can't work out how to - the snippet generato...
withCredentials([sshUserPrivateKey(credentialsId: "yourkeyid", keyFileVariable: 'keyfile')]) { stage('scp-f/b') { sh 'scp -i ${keyfile} do sth here' } } Maybe this is what you want. Install Credentials Plugin and Credentials Binding Plugin. Add some credentials and then you will get "yourk...
Jenkins
44,377,238
39
I want to know if there is a function or pipeline plugin that allows to create directory under the workspace instead of using sh "mkdir directory"? I've tried to use a groovy instruction new File("directory").mkdirs() but it always return an exception. org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessExcepti...
What you can do is use the dir step, if the directory doesn't exist, then the dir step will create the folders needed once you write a file or similar: node { sh 'ls -l' dir ('foo') { writeFile file:'dummy', text:'' } sh 'ls -l' } The sh steps is just there to show that the folder is created. T...
Jenkins
42,654,875
39
I am running Jenkins and Docker on a CentOS machine. I have a Jenkins job that pulls a Github repo and builds a Docker image. When I try running the job I get the error: + docker build -t myProject . Cannot connect to the Docker daemon. Is the docker daemon running on this host? Build step 'Execute shell' marked build ...
After the installation of Jenkins and Docker. Add jenkins user to dockergroup (like you did) sudo gpasswd -a jenkins docker Edit the following file vi /usr/lib/systemd/system/docker.service And edit this rule to expose the API : ExecStart=/usr/bin/docker daemon -H unix:// -H tcp://localhost:2375 Do not create a new ...
Jenkins
38,105,308
39
Is there any method or plugins available to retrieve deleted Jenkins job? I have mistakenly deleted one job from Jenkins. So please give a suggestion to undo the delete.
In fact you have just to use this url to reactivate your deleted job : http://[url_of_jenkins]/jobConfigHistory/?filter=deleted You just need to have this plugin installed beforehand: https://wiki.jenkins.io/display/JENKINS/JobConfigHistory+Plugin
Jenkins
31,806,108
39
Recently my jenkins.log has started getting very large, very quickly, full of exceptions about DNS resolution. I attempted to use logrotate, but the log file grows too quickly even to be rotated, and just eats up all my disk space, which then causes various services to fail because they cannot write files anymore. How ...
You can disable the logging of these DNS errors by adjusting the logging settings within Jenkins. From the Jenkins web interface go to: Manage Jenkins -> System Log -> Log Levels (on the left) Add the following entry: Name: javax.jmdns Level: off This way you can keep the Multicast DNS feature but without all the l...
Jenkins
31,719,756
39
I want to set up Sonar with Jenkins. But I'm not sure if the Sonar site describes two different ways to do this or if there are two necessary steps: As far as I understood it, it's two different ways. If this is the case, what is the difference and what are the advantages and disadvantages (between the Sonar itself and...
If you want to analyse a project with SonarQube and Jenkins, here's what you need: A SonarQube server up and running A Jenkins server up and running with the SonarQube Scanner for Jenkins installed and configure to point to your SonarQube server A job configured to run a SonarQube analysis on your project: Using the ...
Jenkins
13,472,283
39
I've been pulling my hair out trying to find a way to include the list of changes generated by Jenkins (from the SVN pull) into our Testflight notes. I'm using the Testflight Plugin, which has a field for notes - but there doesn't seem to be any paramater/token that jenkins creates to embed that information. Has anyone...
It looks like the TestFlight Plugin expands variables placed into the "Build Notes" field, so the question is: how can we get the changes for the current build into an environment variable? As far as I'm aware, the Subversion plugin doesn't provide this information via an environment variable. However, all Jenkins SCM...
Jenkins
11,823,826
39
I've seen a number of posts on making a Maven-backed Jenkins build fail for a given project if a coverage threshold isn't met i.e. coverage must be at least 80% or the build fails. I'm wondering if there is a way to configure Jenkins to fail a build if the coverage is lower than the last build i.e. if the coverage for ...
I haven't tried it, but assuming you are using maven cobertura plugin, I believe it can be configured to fail as documented here. Would jenkins not honour the failure? I also see an open feature request for this.
Jenkins
6,486,054
39
Is there a plugin which would allow me to create a "trend" graph for a hudson build which shows the build time for that project? I'm tasked with speeding up the build and I'd like to show a nice trend as I speed it up.
This is supported out of the box: http://SERVER/hudson/job/JOBNAME/buildTimeTrend
Jenkins
1,772,633
39
I am trying to understand the difference between the two options “Wipe out repository and force clone” and “Clean before checkout” for pulling a git repo. Looking at the help section for both options, both seem to have similar functionality and I can't make out the difference. Here's how they look: Wipe out repository...
Wipe out repository & force clone will clean the entire project workspace and clone the project once again before building. It could be time consuming depends on the project size. If the project is 1GB, it downloads 1GB everytime you build it. Clean before checkout removes the files created as part of build - say your ...
Jenkins
42,305,565
38
I have an option (a plugin?) called "Poll SCM" in Jenkins and I know what it does and how to use it. Please tell me what "SCM" stands for. Is it "Source Code Management", "Sync Code [something]"? Thanks.
SCM = Source Control Management From jenkin's tutorial Section: Create your Pipeline project in Jenkins Step 6: From the Definition field, choose the Pipeline script from SCM option. This option instructs Jenkins to obtain your Pipeline from Source Control Management (SCM), which will be your locally cloned Git reposit...
Jenkins
41,758,231
38
I have just installed Jenkins on my RHEL 6.0 server via npm: npm -ivh jenkins-2.7.2-1.1.noarch.rpm I have also configured my port to be 9917 to avoid clashing with my Tomcat server, allowing me to access the Jenkins page at ipaddress:9917. After entering the initial admin password at the Unlock Jenkins page, I am pres...
I experienced the same problem but a simple restart fixed it . Just try this :- sudo service jenkins stop sudo service jenkins start
Jenkins
38,966,105
38
I'm trying to use DSL pipelines in Jenkins. I thought it'd be nice if I could use the project name as part of my script. git credentialsId: 'ffffffff-ffff-ffff-ffff-ffffffffffffff',\ url: "${repo_root}/${JOB_NAME}.git" I get the error: groovy.lang.MissingPropertyException: \ No such property: JOB_NAME for class: groo...
All environment variables are accessible using env, e.g. ${env.JOB_NAME}.
Jenkins
38,599,641
38
I'm confused about Jenkins Content Security Policy. I know these sites: Configuring Content Security Policy Content Security Policy Reference I have a html page shown via Jenkins Clover Plugin. This html page uses inline style, e.g.: <div class='greenbar' style='width:58px'> The div-element visualizes a progressbar...
While experimenting, I recommend using the Script Console to adjust the CSP parameter dynamically as described on the Configuring Content Security Policy page. (There's another note in the Jenkins wiki page that indicates you may need to Force Reload the page to see the new settings.) In order to use both inline styles...
Jenkins
37,618,892
38
I want to run a Jenkins instance in a docker container. I want Jenkins itself to be able to spin up docker containers as slaves to run tests in. It seems the best way to do this is to use docker run -v /var/run.docker.sock:/var/run/docker.sock -p 8080:8080 -ti my-jenkins-image source The Dockerfile I'm using is FROM...
A bit late, but this might help other users who are struggling with the same problem: The problem here is that the docker group on your docker host has a different group id from the id of the docker group inside your container. Since the daemon only cares about the id and not about the name of the group your solution w...
Jenkins
36,185,035
38
I seem to be having issues with integrating Xcode6 with jenkins, I currently have this setup and working with Xcode 5. With xcode 6 running remotely via SSH the simulator time-out, when I run locally it succeeds. Command xcodebuild -workspace PROJECTNAME.xcworkspace -scheme BGO_Tests -destination 'platform=iOS Simulato...
Note: the device names changed in Xcode 7, so you no longer specify them using iPhone 5 (9.1 Simulator) but rather iPhone 5 (9.1). Use xcrun instruments -s to get the current list of devices and then you can pre-launch it using: xcrun instruments -w "iPhone 5 (9.1)" || echo "(Pre)Launched the simulator." Prelaunching...
Jenkins
25,380,365
38
The website for the plugin says that you can create a groovy script to run to determine the parameter list. how is this resolved though? The instructions don't say anything. In what context is the script run? What am i supposed to return from the script? What directory is the cwd of the script? is it the environment ...
I had to dig into the source code to find the answer to these questions so i hope this helps everyone else. 1. In what context is the script run? The script is run inside a groovy.lang.GroovyShell. This class is currently from the Groovy 1.8.5 library. here is an excerpt from the code: // line 419 - 443 of the Extended...
Jenkins
24,730,186
38
I am new to Jenkins and I want to know how it is possible to display the HTML report (not the HTML code) generated after a successful build inside a mail body (not as an attachment). I want to know the exact steps I should follow and what should be the content of my possible jelly template.
Look deeper into the plugin documentations. No need for groovy here. Just make sure Content Type is set to HTML and add the following to the body: ${FILE,path="my.html"} This will place the my.html content in your email body (location of file is relative to job's workspace. I use it and it works well. I hope this he...
Jenkins
22,066,936
38
I'am using Jenkins now, and sometimes the build jobs stucked and with red progress bar. I am really confused how jenkins determine the color of the progress bar. When it is blue? and when it become red? Does anyone have ideas?
The progress bar is normally empty, filling with blue while a build in progress. The amount of time it takes the progress bar to fill is based on the estimated job duration. This estimate is generally based on the average duration of the last few successful builds. If there is no previous job data upon which to make a...
Jenkins
19,653,757
38
We have a lot of developers creating feature branches that I would like to build. Nightly we run a code quality tool that needs to run on every branch. I also would not like a static configuration because the number of branches changes every few weeks.
In Git configuration there is a field 'Branch Specifier (blank for default): ' if you put there ** it will build all branches from all remotes. having that you can use an environment variable ${GIT_BRANCH} e.g. to set a title for the build using https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin or...
Jenkins
15,344,955
38
I am getting an error when inputting my repo location into the "Source Code Management > Git > Repository URL" section of a new Job. I have searched all around and tried many different URLs with no success. Error: Failed to connect to repository : Error performing command: git ls-remote -h https://github.com/micdoodle8...
You might need to set the path to your git executable in Manage Jenkins -> Configure System -> Git -> Git Installations -> Path to Git executable. For example, I was getting the same error in Windows. I had installed git with chocolatey, and got the location via Powershell: Get-Command git.exe | Select Definition In ...
Jenkins
12,681,308
38
I have a .net application built on .net framework 3.5, I am trying to build this application on Jenkins CI server. I've added MSBuild plugin and and have added path to the .exe file of 2.0, 3.5 and 4.0 versions of MSBuild. But my building processes are failing by showing the below error message. Path To MSBuild.exe: ...
To make the MSBuild plugin work, you need to configure the plugin in the Jenkins management screen. NOTE: in the newer Jenkins versions you find the MSBuild configuration in the Global Tool Configuration: Note the "Name" field, where I've called this particular configuration v4.0.30319. You could call it anything yo...
Jenkins
10,227,967
38
Why are there two kinds of jobs for Jenkins, both the multi-configuration project and the free-style project project? I read somewhere that once you choose one of them, you can't convert to the other (easily). Why wouldn't I always pick the multi-configuration project in order to be safe for future changes? I would lik...
The two types of jobs have separate functions: Free-style jobs: these allow you to build your project on a single computer or label (group of computers, for eg "Windows-XP-32"). Multi-configuration jobs: these allow you to build your project on multiple computers or labels, or a mix of the two, for eg Windows-XP, Win...
Jenkins
7,515,730
38
My jenkinsfile has several paremeters, every time I make an update in the parameters (e.g. remove or add a new input) and commit the change to my SCM, I do not see the job input screen updated accordingly in jenkins, I have to run an execution, cancel it and then see my updated fields in properties([ parameters([ ...
One of the ugliest things I've done to get around this is create a Refresh parameter which basically exits the pipeline right away. This way I can run the pipeline just to update the properties. pipeline { agent any parameters { booleanParam(name: 'Refresh', defaultValue: false, ...
Jenkins
44,422,691
37
On my Jenkins I configured: Source Code Management Git repository: https://bitbucket.org/username/project.git credentials: username/password Builder Triggers Build when a change is pushed to BitBucket On my BitBucket Webhooks: http://Jenkins.URL:8080/bitbucket-hook I tried pushing a small change to a .txt file, but the...
You don't need to enable Polling SCM.. You have to ensure that your Webhook (Settings->Webhooks) is pointing to your Jenkins bitbucket-hook like the following: "https://ci.yourorg.com/bitbucket-hook/". Notice that last "/", without it, the build will not be triggered. It's an annoying thing, as you will get a 200 stat...
Jenkins
31,202,359
37
I want to use the Jenkins Remote API, and I am looking for safe solution. I came across Prevent Cross Site Request Forgery exploits and I want to use it, but I read somewhere that you have to make a crumb request. How do I get a crumb request in order to get the API working? I found this https://github.com/entagen/jenk...
I haven't found this in the documentation either. This code is tested against an older Jenkins (1.466), but should still work. To issue the crumb use the crumbIssuer // left out: you need to authenticate with user & password -> sample below HttpGet httpGet = new HttpGet(jenkinsUrl + "crumbIssuer/api/json"); String crum...
Jenkins
16,738,441
37
I can find out just about everything about my Jenkins server via the Remote API, but not the list of currently running jobs. This, http://my-jenkins/computer/api/json or http://my-jenkins/computer/(master)/api/json Would seem like the most logical choices, but they say nothing (other than the count of jobs) about wh...
There is often confusion between jobs and builds in Jenkins, especially since jobs are often referred to as 'build jobs'. Jobs (or 'build jobs' or 'projects') contain configuration that describes what to run and how to run it. Builds are executions of a job. A build contains information about the start and end time, t...
Jenkins
14,843,874
37
I have tried to rename a hudson/jenkins job. However it failed to rename. Is there any way so I can rename the job?
You can rename selected job through jenkins UI by following these steps: job>configure>Advanced Project Options>Display Name Other way is to rename the directory on the Jenkins/hudson server and then restart the Jenkins.
Jenkins
14,603,615
37
Anyone know a good way to add soapUI tests to my CI builds ?
soapUI offers test automation via Maven or Ant. Maven integration is described HERE. I tried it some month ago but had some strange issues with the eviware repository... Therefore I run my tests now via Ant. What you have to do is to call the testrunner.bat (or testrunner.sh) script in the soapUI bin directory. You can...
Jenkins
6,648,244
37