_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d19001
test
Why not use a string in place of the AddWithValue, eg: string instructorStr = ""; string stilartStr = ""; ... if (DropDownList_Instruktorer.SelectedValue != "*") { instructorStr = "fk_in_id = " + DropDownList_Instruktorer.SelectedValue + " AND"; } if (DropDownList_Stilart.SelectedValue != "*") { stilartStr = "fk_st_id = " + DropDownList_Stilart.SelectedValue + " AND"; } ... SqlCommand cmd = new SqlCommand(@"SELECT * FROM Hold INNER JOIN Instruktorer ON instruktor_id = fk_in_id INNER JOIN Stilarter ON stilart_id = fk_st_id INNER JOIN Aldersgruppe ON aldersgruppe_id = fk_ag_id INNER JOIN Niveauer ON niveau_id = fk_ni_id INNER JOIN Tider ON tid_id = fk_ht_id WHERE " + instructorStr + stilartStr + ... + " 1 = 1", conn); Then you have the option to do all sorts of stuff with the individual variables, including ORDER BY Using Stringbuilder would be cleaner but it's easier to show it this way.
unknown
d19002
test
I had to add the following Nuget packages: MSTest.TestAdapter MSTest.TestFramework Microsoft.NET.Test.Sdk Visual Studio release notes A: Ok, you can add Nuget packages as asked. But you can also try to disable the following setting (Tools->Options->Test): "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file". Let me know if it works for you. A: If you are using MS Test, try installing MSTest.TestAdapter via nuget or if you are using nunit, install NUnit3TestAdapterlatest versions via nuget. After installing please restart the visual studio and then you can see the tests running. A: I had the same issue and none of the answers above worked. Installing NUnit3TestAdapter V3.10.0 fixed it. A: I had a very similar issue recently with xUnit, the same outcome, however my fix was due to the fact that previously with lower versions of Microsoft.NET.Test.Sdk you didn't need XUnit.Runner.VisualStudio explicitly installed. When I updated my Microsoft.NET.Test.Sdk to version 15.9.0 it stopped allowing tests to run until I installed the XUnit.Runner.VisualStudio Nuget. Now, This may seem blatantly obvious, but, previously it would cope without it and still work. Now, it does not. The same will probably be true of other test platforms. It worked for me. A: My reputation score does not currently allow me to add this as a comment to the accepted answer. For reference, I've appended version numbers to the nuget packages referenced in csharpsql's answer: MSTest.TestAdapter v1.3.2 MSTest.TestFramework v1.3.2 Microsoft.NET.Test.Sdk v15.9.0 A: I know that it is stupid, but for me nothing from earlier answers were working. After that I just restart my computer and everything is working correctly :) (My proble was that one day everything was working correctly and next day it stopped working) A: For me I felt very foolish after spending hours, trying EVERYTHING, only to find that I had simply forgotten to add the [TestMethod] directive on the unit test method. A: I was trying to run an existing project. I had the .NET Core SDK 3.3 installed, but did not have 2.1 installed. This was causing the tests to silently fail. A: I ran into this problem too (in VS 2019), which can be found all over the web. I also support @csharpsql's simple solution. I also couldn't directly comment (how annoying Stack Overflow!) I had used 'Remove unused references' in VS. I did have to restart VS to get the references removed from view. Cleaning and rebuilding posed no problem. But running all tests from the Test Explorer reported 'Not run' on all tests, without any explanation or error message. Very annoying. After finding the suggestion here I started experimenting with re-adding the latest versions of those 3 references. That solved my problem. I just remains annoying this unnecessary problem occurs! A: Adding NuGet packages doesn't work for me. Disable the following setting (Tools->Options->Test): "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file" works. A: Since its just a checkbox, Ive tried disabling the following setting before anything else, and it worked! Tools -> Options -> Test -> "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file"
unknown
d19003
test
You first file is overwritten by the second call to the function
unknown
d19004
test
I would just suggest manually reading/writing the members of the struct individually. Packing using your compiler directives can cause inefficiency and portability issues with unaligned data access. And if you have to deal with endianness, it's easy to support that later when your read operations break down to field members rather than whole structs. Another thing, and this relates more to futuristic maintenance-type concerns, is that you don't want your serialization code or the files people have saved so far to break if you change the structure a bit (add new elements or even change the order as a cache line optimization, e.g.). So you'll potentially run into a lot less pain with code that provides a bit more breathing room than dumping the memory contents of the struct directly into a file, and it'll often end up being worth the effort to serialize your members individually. If you want to generalize a pattern and reduce the amount of boilerplate you write, you can do something like this as a basic example to start and build upon: struct Fields { int num; void* ptrs[max_fields]; int sizes[max_fields]; }; void field_push(struct Fields* fields, void* ptr, int size) { assert(fields->num < max_fields); fields->ptrs[fields->num] = ptr; fields->sizes[fields->num] = size; ++fields->num; } struct Fields s_fields(struct s* inst) { struct Fields new_fields; new_fields.num = 0; field_push(&new_fields, &inst->i1, sizeof inst->i1); field_push(&new_fields, &inst->s1, sizeof inst->s1); field_push(&new_fields, &inst->c1, sizeof inst->c1); return new_fields; } Now you can use this Fields structure with general-purpose functions to read and write members of any struct, like so: void write_fields(FILE* file, struct Fields* fields) { int j=0; for (; j < fields->num; ++j) fwrite(fields->ptrs[j], fields->sizes[j], 1, file); } This is generally a bit easier to work with than some functional for_each_field kind of approach accepting a callback. Now all you have to worry about when you create some new struct, S, is to define a single function to output struct Fields from an instance to then enable all those general functions you wrote that work with struct Fields to now work with this new S type automatically. A: Many compilers accept a command line parameter which means "pack structures". In addition, many accept a pragma: #pragma pack(1) where 1 means byte alignment, 2 means 16-bit word alignment, 4 means 32-bit word alignment, etc. A: To make your solution platform independent, you can create a function that writes each field of the struct one at a time, and then call the function to write as many of the structs as needed. int writeStruct(struct s* obj, size_t count, FILE* file) { size_t i = 0; for ( ; i < count; ++i ) { // Make sure to add error checking code. fwrite(&(obj[i].i1), sizeof(obj[i].i1), 1, file); fwrite(&(obj[i].s1), sizeof(obj[i].s1), 1, file); fwrite(&(obj[i].c1), sizeof(obj[i].c1), 1, file); } // Return the number of structs written to file successfully. return i; } Usage: struct s example[2]; writeStruct(s, 2, file);
unknown
d19005
test
The TryParse method allows you to test whether something is parseable. If you try Parse as in the first instance with an invalid int, you'll get an exception while in the TryParse, it returns a boolean letting you know whether the parse succeeded or not. As a footnote, passing in null to most TryParse methods will throw an exception. A: TryParse and the Exception Tax Parse throws an exception if the conversion from a string to the specified datatype fails, whereas TryParse explicitly avoids throwing an exception. A: If the string can not be converted to an integer, then * *int.Parse() will throw an exception *int.TryParse() will return false (but not throw an exception) A: Parse throws an exception if it cannot parse the value, whereas TryParse returns a bool indicating whether it succeeded. TryParse does not just try/catch internally - the whole point of it is that it is implemented without exceptions so that it is fast. In fact the way it is most likely implemented is that internally the Parse method will call TryParse and then throw an exception if it returns false. In a nutshell, use Parse if you are sure the value will be valid; otherwise use TryParse. A: TryParse does not return the value, it returns a status code to indicate whether the parse succeeded (and doesn't throw an exception). A: For the record, I am testing two codes: That simply try to convert from a string to a number and if it fail then assign number to zero. if (!Int32.TryParse(txt,out tmpint)) { tmpint = 0; } and: try { tmpint = Convert.ToInt32(txt); } catch (Exception) { tmpint = 0; } For c#, the best option is to use tryparse because try&Catch alternative thrown the exception A first chance exception of type 'System.FormatException' occurred in mscorlib.dll That it is painful slow and undesirable, however, the code does not stop unless Debug's exception are settled for stop with it. A: I know its a very old post but thought of sharing few more details on Parse vs TryParse. I had a scenario where DateTime needs to be converted to String and if datevalue null or string.empty we were facing an exception. In order to overcome this, we have replaced Parse with TryParse and will get default date. Old Code: dTest[i].StartDate = DateTime.Parse(StartDate).ToString("MM/dd/yyyy"); dTest[i].EndDate = DateTime.Parse(EndDate).ToString("MM/dd/yyyy"); New Code: DateTime startDate = default(DateTime); DateTime endDate=default(DateTime); DateTime.TryParse(dPolicyPaidHistories[i].StartDate, out startDate); DateTime.TryParse(dPolicyPaidHistories[i].EndDate, out endDate); Have to declare another variable and used as Out for TryParse. A: double.Parse("-"); raises an exception, while double.TryParse("-", out parsed); parses to 0 so I guess TryParse does more complex conversions.
unknown
d19006
test
I discovered a method of doing this through 'Loop While' and removing the Select Case: Do WScript.Sleep (1000 * 1 * PromptTime) Loop While WshShell.Popup("Are you still using Syteline?", 5, "Please select yes or no", vbYesNo) = vbYes
unknown
d19007
test
It does not appear so. From here (emphasis mine): For 35mm digital capture, we strongly recommend use of a professional-quality digital SLR using RAW or uncompressed TIFF format. RAW or uncompressed TIFF images will tend to be very large, which could make uploading them via an API problematic. Instead, contributors would use the upload portal to supply content to Getty images. Further, your images must go through a submission process, which would suggest the API could not be used. Getty Images do have a Flickr collection that anyone can submit to, though once again there is submission process.
unknown
d19008
test
First check whether your GPS is on in your device. You can use CLLocationManager to get your current location. - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //Get your current location here } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{ } Use these methods to get the location. A: I am not sure what the question is, but I think you have an IP address and you want to know which location is associated with it, right ? If so, you're out of luck. There are some databases to map these, but they can only tell you where the owner of the IP is located... and that is your ISP, not you (the customer). On iOS, there's Core Location, doesn't that work for you ? A: I am using the same, and it works fine when I am outside of my house, but in case I am inside the house or in basement it doesn't get the current location. I am saying while using the IP address we can get the location so we will have a current location and then we can get the longitude and latitude of a particular location using g.
unknown
d19009
test
Why not to join two tables, master one with id,type,name fields and nested with id,master_id,lang,value. For the given example that will be looking like: ID TYPE NAME 1 text question ID MASTER_ID LANG TRANSLATION 1 1 en question 2 1 nl vraag The translation set for one language is given by SQL query: SELECT * FROM `nested` WHERE `lang` = 'nl' -- vraag -- ..... The translation for the given term (e.g. question, having id=1): SELECT * FROM `nested` WHERE `master_id` = 1 AND `lang` = 'nl' -- vraag A: The downside of the second idea is that for every new language you want to add you have to change your database structure (following code changes to reflect that structure change) whereas the first only needs new rows (which keeps the same structure). another plus for the first idea is that you really only need the space/memory for translations you add to the database. in the second approach you could have lots of empty fields in case you won't translate all texts. a way to do it could be (an addition to the answer above from @mudasobwa): Master Table: | id | type | master_name | |----+------+-------------| |853 | text | question | |854 | text | answer | Language Table: | id | language_name | |----+---------------| | 1 | english | | 2 | german | Translation Table: | id | master_id | language_id | translation | |----+-----------+-------------+--------------------| | 1 | 853 | 1 | question | | 1 | 854 | 2 | Frage | | 2 | 853 | 1 | answer | | 2 | 854 | 2 | Antwort | So if you have another language, add it to the language table and add the translations for your master texts for that language. Adding indexes to the ids will help speeding up queries for the texts. A: Second way is much better: * *Keeps less place in Database. *Loads faster. *Easy to edit.
unknown
d19010
test
It turns out that with iOS10, the values for CMSampleTimingInfo are apparently parsed more stringently. The above code was changed to the following to make rendering work correctly once more: CMSampleTimingInfo sampleTimeinfo{ CMTimeMake(duration.count(), kOneSecond.count()), kCMTimeZero, kCMTimeInvalid}; Please note the kCMTimeZero for the presentationTimeStamp field. @Sterling Archer: You may want to give this a try to see if it addresses your problem as well.
unknown
d19011
test
When you imported the project did you check the "Copy projects into workspace"? If not import your project again and see if this problem still continues.
unknown
d19012
test
This seem to work for me: WebElement table = wait.until(presenceOfElementLocated(By.tagName("tbody"))); int len = table.findElements(By.tagName("tr")).size(); for (int index = 0; index < len; index++) { WebElement tr = table.findElements(By.tagName("tr")).get(index); //save information in row if (index == len - 1) { JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("window.scrollBy(0,250)"); len = table.findElements(By.tagName("tr")).size(); } } the length of the loop changes when you scroll down so it gets all the rows in the table A: This will not scroll down the page but take all the links in the web table into the list and click on the link which you need. A: public void ClickLink(string link) { //scroll to table. Actions action = new Actions(driver); action.MoveToElement(driver.FindElement(By.Id("tableID")); //get elements in list List<WebElement> req = driver.findElements(By .xpath("//table[@class='forceRecordLayout uiVirtualDataGrid--defaultuiVirtualDataGrid forceVirtualGrid resizable-cols']//tr")); List<string> linkNamesList = new List<string>(); //Click the required link. foreach(IWebElement element in req) { string linkName = element.text; if(linkName == link) { element.click(); break; } } } This should work. Thanks, Rakesh Raut
unknown
d19013
test
As it stands, there isn't much to choose between them. However, the @classmethod has one major plus point; it is available to subclasses of MyClass. This is far more Pythonic than having separate functions for each type of object you might instantiate in a list. A: I would argue that the first method would be better (list comprehension) since you will always be initializing the data from a list. This makes things explicit.
unknown
d19014
test
As I understand it you should and can avoid custom getters and setters and then you can leave core data to do it's thing and not worry about retain/release. As for reducing memory overhead you can ask core data to turn your object to fault using this method: refreshObject:mergeChanges: Check out the Apple documentation here: http://gemma.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/index.html. It's all there and hopefully I've been able to give you the right terms to look for. Hope that's some help. A: If your setters are retaining the managed objects then you need to release them to match the retain/release. However you may not need to retain the managed objects depending on how the application is designed. Without seeing all of the code it is difficult to give solid advice but you can use the analyzer to check for leaks, use instruments to make sure your memory is not increasing out of control, etc. And last but not least you can turn off retains, switch them to assigns and see if it crashes. Since the NSManagedObjectContext will retain the objects there is a fair chance that your views do not need to retain the NSManagedObject instances at all. A: Yes, you need to release your representedGrid and representedCell properties in your dealloc method. If you didn't, the retain/release methods would not be balanced- your setter would be retaining the object, and with no corresponding release, the object will never be deallocated. When written properly, a retain setter will release its old value and retain the new value. So there is no need to release the old grid when setting gridView.representedGrid. Why are you writing your own setters, out of curiosity?
unknown
d19015
test
Then don't put the scroll on the main window. Put ScrollViewer only on the content (rows) that you want to scroll. Careful not to use an auto for the height of the rows with the ScrollViewer or the container will grow to support all the content and the Scroll does not come into play. A: One way: <Window x:Class="Sample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <ListBox> <!--Hardcoded listbox items just to force the scrollbar for demonstration purposes --> <ListBoxItem>Item1</ListBoxItem> <ListBoxItem>Item2</ListBoxItem> <ListBoxItem>Item3</ListBoxItem> <ListBoxItem>Item4</ListBoxItem> <ListBoxItem>Item5</ListBoxItem> <ListBoxItem>Item6</ListBoxItem> <ListBoxItem>Item7</ListBoxItem> <ListBoxItem>Item8</ListBoxItem> <ListBoxItem>Item9</ListBoxItem> <ListBoxItem>Item10</ListBoxItem> <ListBoxItem>Item11</ListBoxItem> <ListBoxItem>Item12</ListBoxItem> <ListBoxItem>Item14</ListBoxItem> <ListBoxItem>Item15</ListBoxItem> <ListBoxItem>Item16</ListBoxItem> <ListBoxItem>Item17</ListBoxItem> <ListBoxItem>Item18</ListBoxItem> <ListBoxItem>Item19</ListBoxItem> <ListBoxItem>Item20</ListBoxItem> <ListBoxItem>Item21</ListBoxItem> <ListBoxItem>Item22</ListBoxItem> </ListBox> <Grid Panel.ZIndex="5" VerticalAlignment="Bottom" Background="DarkGray"> <StackPanel> <TextBox HorizontalAlignment="Left" VerticalAlignment="Center">Text box 1</TextBox> <TextBox HorizontalAlignment="Left" VerticalAlignment="Center">Text box 2</TextBox> <TextBox HorizontalAlignment="Left" VerticalAlignment="Center">Text box 3</TextBox> </StackPanel> </Grid> </Grid>
unknown
d19016
test
You cannot populate a BigQuery query parameter dropdown list using another BigQuery query. A workaround for this would be: * *create a Community Connector using Advanced Services *Add the query parameter as a config param *in getConfig, use BigQuery REST API or Apps Script BigQuery service to retrieve list *in getData, pass the parameter from your getConfig to BigQuery
unknown
d19017
test
The code is passing the return value of the method call, not the method itself. Pass a callback function using like following: self.ins9 = Tk.Button(self.numbuts, text="9", width=3, command=lambda: self.fins(9)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
unknown
d19018
test
Okay, I've managed to fix it! Had a little jump around with delight. I set up a new function called setupScale() that is called in viewdidload when the view is presented. I also added the viewwillLayoutSubview() override and called the setupScale() function inside it. If looks like this: private func setupScale() { scrollView.frame = UIScreen.main.bounds scrollView.contentSize = (detailImage.image?.size)! scrollViewContents() let scrollViewFrame = scrollView.frame let scaleWidth = scrollViewFrame.size.width / scrollView.contentSize.width let scaleHieght = scrollViewFrame.size.height / scrollView.contentSize.height let minScale = min(scaleHieght, scaleWidth) scrollView.minimumZoomScale = minScale scrollView.maximumZoomScale = 1 scrollView.zoomScale = minScale } override func viewWillLayoutSubviews() { setupScale() } Results look perfect on my iPad and iPhone 7 in landscape and portrait.
unknown
d19019
test
What you actually want to do here is get the text inside the div class but not the text in the nested tags within it. You can use soup.find with option text = True and recursive = False Creating the data from bs4 import BeautifulSoup html_doc = '''<span class="job-search-key-1hbqxax elwijj240" data-test="detailsalary"> ₹362,870 - ₹955,252 <span class="job-search-key- elwijj242">(Glassdoor Est.)</span> <span class="SVGInline greyInfoIcon" data-test="salaryIcon"> <svg class="SVGInline-svg greyInforcon-svg" height="16" viewbox="0 @ 16 16" width="16" xmlns="http://www.w3.org/2000/svg"> <g fill="none" fill-rule="evenodd" id="prefix__info-16-px" stroke="none" stroke-width="1"> <path d="M8 14A6 6 @ 118 2a6 6 @ 010 12zme- 1A5 5 @ 108 3a5 5 @ 880 18zm-.6-5.60.6.6 8 111.2 8v11a.6.6 @ 01-1.2 8v7.42MS 5.62.6.6 110-1.2.6.6 @ 810 1.2z" fill="#505863" id="prefix_a"></path> </svg> </span> <div class="d-none"></div> </span>''' soup = BeautifulSoup(html_doc, 'html.parser') Generating the output soup.find(class_='job-search-key-1hbqxax elwijj240').find(text=True, recursive=False).strip() Output This gives us '₹362,870 - ₹955,252'
unknown
d19020
test
Yes, at every thirteenth line you'd have the information of an employee. However, instead of using twelve different lists, you can use a dictionary of lists, so that you wouldn't have to worry about the number of employees. And you can either use a parameter on the number of lines directed to each employee. You could do the following: infile = open("file.txt", "rt") employee = dict() name = infile.readline().strip() while name: employee[name] = list() for i in xrange(1, 12): val = float(infile.readline().strip()) employee[name].append(val) name = infile.readline().strip() Some ways to access dictionary entries: for name, months in employee.items(): print name print months for name in employee.keys(): print name print employee[name] for months in employee.values(): print months for name, months in (employee.keys(), employee.values()): print name print months The entire process goes as follows: infile = open("file.txt", "rt") employee = dict() name = infile.readline().strip() while name: val = 0.0 for i in xrange(1, 12): val += float(infile.readline().strip()) employee[name] = val print ">>> Employee:", name, " -- salary:", str(employee[name]) name = infile.readline().strip() Sorry for being round the bush, somehow (: A: Here is option. Not good, but still brute option. summed = 0 with open("file.txt", "rt") as f: print f.readline() # We print first line (first man) for line in f: # then we suppose every line is float. try: # convert to float value = float(line.strip()) # add to sum summed += value # If it does not convert, then it is next person except ValueError: # print sum for previous person print summed # print new name print line # reset sum summed = 0 # on end of file there is no errors, so we print lst result print summed since you need more flexibility, there is another option: data = {} # dict: list of all values for person by person name with open("file.txt", "rt") as f: data_key = f.readline() # We remember first line (first man) data[data_key] = [] # empty list of values for line in f: # then we suppose every line is float. try: # convert to float value = float(line.strip()) # add to data data[data_key].append(value) # If it does not convert, then it is next person except ValueError: # next person's name data_key = line # new list data[data_key] = [] Q: let's say that I want to print a '2% bonus' to employees that made more than 7000 in total sales (12 months) for employee, stats in data.iteritems(): if sum(stats) > 7000: print employee + " done 7000 in total sales! need 2% bonus" A: I would not create 7 different arrays. I would create some sort of data structure to hold all the relevant information for one employee in one data type (this is python, but surely you can create data structures in python as well). Then, as you process the data for each employee, all you have to do is iterate over one array of employee data elements. That way, it's much easier to keep track of the indices of the data (or maybe even eliminates the need to!). This is especially helpful if you want to sort the data somehow. That way, you'd only have to sort one array instead of 7.
unknown
d19021
test
You can achieve that by: window?.toolbar?.showsBaselineSeparator = false
unknown
d19022
test
You have issue with this code: v_emp_first_name := select first_name from us_employees where email = '[email protected]'; You can not use the assignment operator against the query as you have used. Replace this assignment := with INTO as follows: select first_name INTO v_emp_first_name from us_employees where email = '[email protected]'; A: The short answer is NO. You can't assign the output of a scalar query to a variable. The proper syntax for your "assignment" is the one you are already aware of. I am sure that you will then ask WHY. Why did Oracle choose that "weird" syntax for assignment, and not the simpler one you tried? The answer is that in more general cases a select statement may return multiple columns, not just one; and the values from multiple columns can be "assigned" to multiple variables (local to the PL/SQL block) simultaneously. Which, by the way, is the more common usage - people extract one "record" at a time, rather than a single value. So, how would you re-write the "select into" operation as an "assignment" (or multiple "assignments")? There is no natural way to do that. You may ask why Oracle doesn't allow "your" assignment syntax, in the case of a single column selected, in addition to the select into syntax (which is needed for multi-column rows anyway). The answer is that would be wasteful. We already have a syntax - that we need for more general cases anyway; we don't need one more. You might say that we could put all the receiving local variables into a record type, and do a single assignment (to a record) even for general "rows" returned by a select. Alas, SQL statements return rows, not records; rows are a SQL concept, and specifically they are not a data type. Perhaps Oracle could do further development along those lines (to add functionality that doesn't exist today), but why bother - they already have a perfectly fine syntax for what you need, and you already know what that syntax is - without needing to define a record type to hold all your local variables, then define a "record type" for rows coming from a SQL select statement, then .....
unknown
d19023
test
A few issues ... * *You should have .section .text before .global _start so that _start ends up in the .text section *Add -g to get debug infomation Unfortunately, adding -g to a .c compilation would be fine. But, it doesn't work too well for a .s file Here's a simple C program, similar to yours: int value1; short value2; unsigned char value3; We can compile this with -S to get a .s file. We can do this with and without -g. Without -g the .s file is 7 lines. Adding -g increases this to 150 lines. The debug information has to be added with special asm directives (e.g. .loc and .section .debug_info,"",@progbits). Then, gdb has enough information to allow p (or x) to work. To get p to work without debug information, we have to cast the values to the correct type. For example, in your program: p (int) value1 p (short) value2 p (char) value3 Here is the .s output for the sample .c file without -g: .file "short.c" .text .comm value1,4,4 .comm value2,2,2 .comm value3,1,1 .ident "GCC: (GNU) 8.3.1 20190223 (Red Hat 8.3.1-2)" .section .note.GNU-stack,"",@progbits Here is the .s output with -g: .file "short.c" .text .Ltext0: .comm value1,4,4 .comm value2,2,2 .comm value3,1,1 .Letext0: .file 1 "short.c" .section .debug_info,"",@progbits .Ldebug_info0: .long 0x71 .value 0x4 .long .Ldebug_abbrev0 .byte 0x8 .uleb128 0x1 .long .LASF5 .byte 0xc .long .LASF6 .long .LASF7 .long .Ldebug_line0 .uleb128 0x2 .long .LASF0 .byte 0x1 .byte 0x1 .byte 0x5 .long 0x33 .uleb128 0x9 .byte 0x3 .quad value1 .uleb128 0x3 .byte 0x4 .byte 0x5 .string "int" .uleb128 0x2 .long .LASF1 .byte 0x1 .byte 0x2 .byte 0x7 .long 0x50 .uleb128 0x9 .byte 0x3 .quad value2 .uleb128 0x4 .byte 0x2 .byte 0x5 .long .LASF2 .uleb128 0x2 .long .LASF3 .byte 0x1 .byte 0x3 .byte 0xf .long 0x6d .uleb128 0x9 .byte 0x3 .quad value3 .uleb128 0x4 .byte 0x1 .byte 0x8 .long .LASF4 .byte 0 .section .debug_abbrev,"",@progbits .Ldebug_abbrev0: .uleb128 0x1 .uleb128 0x11 .byte 0x1 .uleb128 0x25 .uleb128 0xe .uleb128 0x13 .uleb128 0xb .uleb128 0x3 .uleb128 0xe .uleb128 0x1b .uleb128 0xe .uleb128 0x10 .uleb128 0x17 .byte 0 .byte 0 .uleb128 0x2 .uleb128 0x34 .byte 0 .uleb128 0x3 .uleb128 0xe .uleb128 0x3a .uleb128 0xb .uleb128 0x3b .uleb128 0xb .uleb128 0x39 .uleb128 0xb .uleb128 0x49 .uleb128 0x13 .uleb128 0x3f .uleb128 0x19 .uleb128 0x2 .uleb128 0x18 .byte 0 .byte 0 .uleb128 0x3 .uleb128 0x24 .byte 0 .uleb128 0xb .uleb128 0xb .uleb128 0x3e .uleb128 0xb .uleb128 0x3 .uleb128 0x8 .byte 0 .byte 0 .uleb128 0x4 .uleb128 0x24 .byte 0 .uleb128 0xb .uleb128 0xb .uleb128 0x3e .uleb128 0xb .uleb128 0x3 .uleb128 0xe .byte 0 .byte 0 .byte 0 .section .debug_aranges,"",@progbits .long 0x1c .value 0x2 .long .Ldebug_info0 .byte 0x8 .byte 0 .value 0 .value 0 .quad 0 .quad 0 .section .debug_line,"",@progbits .Ldebug_line0: .section .debug_str,"MS",@progbits,1 .LASF1: .string "value2" .LASF5: .string "GNU C17 8.3.1 20190223 (Red Hat 8.3.1-2) -mtune=generic -march=x86-64 -g" .LASF0: .string "value1" .LASF6: .string "short.c" .LASF2: .string "short int" .LASF3: .string "value3" .LASF4: .string "unsigned char" .LASF7: .string "/tmp/asm" .ident "GCC: (GNU) 8.3.1 20190223 (Red Hat 8.3.1-2)" .section .note.GNU-stack,"",@progbits
unknown
d19024
test
I don't think that this is achievable via memoization, you need a cache instead from guava. It has methods that explicitly invalidate a key. So you would need a database trigger/listener that catches the event of when some entry changes and when that happens call: Cache.invalidate(key) and then cache.put(key, value)
unknown
d19025
test
We were able to create our own test data by using the 'Rest-Client’ gem (to call endpoints) and Cucumber hooks (used to determine when to generate test data). See below example of how we created new accounts/customers by using the Rest-Client gem, cucumber hooks, a data manager class and a factory module. Here's a link with a bit more info on how it works. AccountDataManager.rb require 'rest-client' require_relative '../factory/account' class AccountDataManager include Account def create current_time = Time.now.to_i username = 'test_acc_' + current_time.to_s password = 'password1' url = 'http://yourURLhere.com/account/new' request_body = manufacture_account(username, password) response = RestClient.post url, request_body.to_json, {:content_type => 'application/json', :accept => 'application/json'} if response.code != 200 fail(msg ="POST failed. Response status code was: '#{response.code}'") end response_body = JSON.parse(response clientId = response_body['Account']['ClientId'] # return a hash of account details account_details = { username: username password: password, clientId: clientId } end end Account.rb The below factory manufactures the request's body. module Account def manufacture_account(username, password) payload = { address:{ :Address1 => '2 Main St', :Address2 => '', :Suburb => 'Sydney', :CountryCode => 8 }, personal:{ :Title => 'Mr', :Firstname => 'John', :Surname => 'Doe', :UserName => "#{username}", :Password => "#{password}", :Mobile => '0123456789', :Email => "#{username}@yopmail.com", :DOB => '1990-12-31 00:00:00' } } end end Hook.rb You should add your hook.rb file to a shared directory and then add a reference to it into your env.rb file (we added our hook file to the "/features/support" directory). require_relative '../data_manager/data_manager_account' Before() do $first_time_setup ||= false unless $first_time_setup $first_time_setup = true # call the data managers needed to create test data before # any of your calabash scenarios start end end Before('@login') do # declare global variable that can be accessed by step_definition files $account_details = AccountDataManager.new.create end at_exit do # call the data managers to clean up test data end Login_steps.rb The final piece of the jigsaw is to get your calabash scenarios to consume the test data your've just generated. To solve this problem we declared a global variable ($account_details) in our hook.rb file and referenced it in our step_definition file. Given(/^I log in with newly created customer$/) do @current_page = @current_page.touch_login_button unless @current_page.is_a?(LoginPage) raise "Expected Login page, but found #{@current_page}" end # use global variable declared in hook.rb @current_page = @current_page.login($account_details) unless @current_page.is_a?(HomePage) raise "Expected Home page, but found #{@current_page}" end end A: I haven't gotten into using any fixture data libraries myself, however I've had luck just using simple models, like the following for a User. class User @validUser = "[email protected]" @validPass = "123" @invalidUser = "[email protected]" @invalidPass = "foobar" def initialize(username, password) @username = username @password = password end def username @username end def password @password end def self.getValidUser return new(@validUser, @validPass) end def self.getInvalidUser return new(@invalidUser, @invalidPass) end end Let's say I have the following feature: Scenario: Successful login When I enter valid credentials into the login form Then I should see a logout button Then when I need a valid user, it's as easy as: When(/^I enter valid credentials into the login form$/) do user = User.getValidUser enterCredentials(user) end And you can obviously replicate this model structure for anything than needs to hold a simple amount of information. Again, I can't speak for any fixture libraries as I haven't utilized those. However, to your other question regarding the non-dependence of Scenario A on Scenario B - this is true, but this does not mean you can't string together step definitions to achieve your goals. Let's say the test above was simply used to validate that I can successfully log in to the application with a valid user - all is well, the user is logged in, and everyone's happy. But what happens when I need to test the profile page of a user? Well I obviously need to login, but I don't need that to be explicitly stated in my feature file, I can create a step definition that chains together other step definitions: Scenario: Validate behavior of user profile page Given I'm on my profile page Then I should see a selfie Given(/^I'm on my profile page$/) do step "I enter valid credentials into the login form" navigateToProfilePage() end This is a quick example, but hopefully you're seeing that you can indeed chain together step definitions without having scenarios themselves being depending on one another. Such a bad style of cucumber would be such that you log in to the application with Scenario "Login Successful" but then NEVER log the user out, and simply proceed with Scenario "Validate behavior of profile" which just navigates to the profile page without first logging back in. I hope I wasn't too far off from your original request! * *https://github.com/cucumber/cucumber/wiki/Calling-Steps-from-Step-Definitions A: You can write a Backdoor to clean up your data before running tests: public class MainActivity extends Activity { public void setUp() { // Here you can clean and setup the data needed by your tests } }
unknown
d19026
test
There is no linux-aarch64 version of pytorch on the default conda channel, see here This is of course package specific. E.g. there is a linux-aarch64 version of beautifulsoup4 which is why you wre able to install it without an issue. You can try to install from a different channel that claims to provide a pytorch for aarch64, e.g. conda install -c kumatea pytorch
unknown
d19027
test
When a requested entity is not found you should use 404 Not Found. Period. If your server deploy failed, clients should get a 5xx error, not a 4xx error. You shouldn't design your application around your infrastructure shortcomings. If you need circumvent those shortcomings, you should do it in ways that are decoupled from your application, like middlewares, proxies, etc.
unknown
d19028
test
Here is a very small program that performs an Ordered bulkWrite using Spring. You can change to unordered by changing the enum value on BulkOperations.BulkMode. This program will insert 3 records, then delete one, then update one. Because of the filter predicates in the later bulk commands I had to go with an ordered update. If you are only inserting you could easily get away with a faster unordered bulk command. Main.java package com.example.accessingdatamongodb; import com.mongodb.bulk.BulkWriteResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.mongodb.core.BulkOperations; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; @SpringBootApplication public class Main implements CommandLineRunner { @Autowired private MongoOperations mongoTemplate; public static void main(String[] args) { SpringApplication.run(Main.class, args); } @Override public void run(String... args) throws Exception { // CLEAR THE COLLECTION mongoTemplate.remove(new Query(), Customer.class); BulkOperations bulkOps = mongoTemplate.bulkOps(BulkOperations.BulkMode.ORDERED, Customer.class); for (Integer i = 0; i < 3; i++) { Customer customer = new Customer(); customer.firstName = "Barry"; customer.id = i.toString(); bulkOps.insert(customer); } bulkOps.remove(new Query().addCriteria(new Criteria("i").is(1))); bulkOps.updateOne(new Query().addCriteria(new Criteria("i").is(2)), new Update().set("name", "Barry")); BulkWriteResult results = bulkOps.execute(); } } For completeness here are the other files in the project... application.properties spring.data.mongodb.uri=mongodb://localhost:27017/springtestBulkWrite spring.data.mongodb.database=springtestBulkWrite pom.xml <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>accessing-data-mongodb</artifactId> <version>0.0.1-SNAPSHOT</version> <name>accessing-data-mongodb</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <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> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-sync</artifactId> <version>4.5.0</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-core</artifactId> <version>4.5.0</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>bson</artifactId> <version>4.5.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> SimpleMongoConfig.java import com.mongodb.client.MongoClient; import com.mongodb.ConnectionString; import com.mongodb.MongoClientSettings; import com.mongodb.client.MongoClients; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.MongoTemplate; @Configuration public class SimpleMongoConfig { @Value("${spring.data.mongodb.database}") private String databaseName; @Value("${spring.data.mongodb.uri}") private String uri; @Bean public MongoClient mongo() { ConnectionString connectionString = new ConnectionString(uri); MongoClientSettings mongoClientSettings = MongoClientSettings.builder() .applyConnectionString(connectionString) .build(); return MongoClients.create(mongoClientSettings); } @Bean public MongoTemplate mongoTemplate() throws Exception { return new MongoTemplate(mongo(), databaseName); } } CustomerRepository.java (not really used in this trivial example) package com.example.accessingdatamongodb; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; public interface CustomerRepository extends MongoRepository<Customer, String> { public Customer findByFirstName(String firstName); public List<Customer> findByLastName(String lastName); public void deleteByLastName(String lastName); } Customer.java package com.example.accessingdatamongodb; import org.springframework.data.annotation.Id; public class Customer { @Id public String id; public String firstName; public String lastName; public Customer() {} public Customer(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } @Override public String toString() { return String.format( "Customer[id=%s, firstName='%s', lastName='%s']", id, firstName, lastName); } }
unknown
d19029
test
you can use the unicode character ‘U+221E’ to represent the large infinity symbol. To use this unicode in your plot, you can use the following code: import matplotlib.pyplot as plt fig = plt.figure(figsize=(10,10)) plt.rcParams.update({'font.size':16}) plt.title(u'U\u221E') plt.show()
unknown
d19030
test
If you wait a few weeks, MediaWiki 1.35 will be released with a PHP implementation of Parsoid.
unknown
d19031
test
Form onSubmit handler To answer your immediate question, what's happening is input type submit in Angular calls the onSubmit method of the form (instead of submitting the form like in plain HTML). And because you don't have a handler for onSubmit in your class, nothing is happening. For a quick test, follow this link to create a simple onSubmit handler method to test that your submit button works. Here's a Stackblitz example which logs to console when you click the submit button: https://stackblitz.com/edit/angular-uy481f File upload To make file upload work, you would need to make a few things. This touches the component class, creating a new service and injecting it, and updating your form to bind it to the class. * *Create a proper Angular form. Here's an example. *Create a method that will handle the onSubmit() of the form. *Create a service that will handle Http calls to upload files. *Inject the service into your class, and call the file upload method of that class. As you can see, there's a lot involved in making this work unlike having a simple post form in the template. As such, it will be too much for a single answer. But hopefully, the initial paragraph answered your question and the rest of the answer pointed you in the right direction.
unknown
d19032
test
jQuery selectors return an Array object, objects cannot be deemed equal unless they are derived from each other. i.e. var a = [] var b = [] console.log(a==b); //would output false If you changed you code to select the item in the array you would get the actual DOM node $('li.active').next()[0] != next[0] A: All you need to check the class name, Please check below updated code $(document).ready(function() { var pageItem = $(".pagination li").not(".prev,.next"); var prev = $(".pagination li.prev"); var next = $(".pagination li.next"); pageItem.click(function() { $('li.active').removeClass("active"); $(this).addClass("active"); }); // stay on current button if next or prev button is ".next" or ".prev" next.click(function() { if($('li.active').next().attr('class') != 'next') { $('li.active').removeClass('active').next().addClass('active'); } }); prev.click(function() { if($('li.active').prev().attr('class') != 'prev') { $('li.active').removeClass('active').prev().addClass('active'); } }); }); <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <nav> <ul class="pagination"> <li class="prev"> <a href="#"><span>&laquo;</span></a> </li> <li class="active"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li class="next"> <a href="#"><span>&raquo;</span></a> </li> </ul> </nav>
unknown
d19033
test
yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TheWindowsClub?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TheWindowsClub?a=tjWEu-9hLFk:Jv9oVdSsx2A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TheWindowsClub?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TheWindowsClub?a=tjWEu-9hLFk:Jv9oVdSsx2A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/TheWindowsClub?i=tjWEu-9hLFk:Jv9oVdSsx2A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TheWindowsClub?a=tjWEu-9hLFk:Jv9oVdSsx2A:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TheWindowsClub?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TheWindowsClub?a=tjWEu-9hLFk:Jv9oVdSsx2A:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/TheWindowsClub?d=cGdyc7Q-1BI" border="0"></img></a></div><img src="http://feeds.feedburner.com/~r/TheWindowsClub/~4/tjWEu-9hLFk" height="1" width="1" alt=""/> Unlike last time I can't use quotation marks or other such character. I have to delete the whole line. One thing I thought about was to do something like this: $html = preg_replace('/<a href=".*?(alt=""/>)/', '', $html); I thought that using the above code would find the last portion in this segment and replace everything inside but it replaces nothing. Please suggest what should I do? After running above line of code the output should be nothing. It should remove all this code block. A: <a\s+href.*(alt="[^"]*")?> or without quotation mark : <a\s+href.*(alt="[^"]*"){0,1}> We match everything that starts by <a, is followed by at least one space, then by any character until the character >, before which you may have zero or one iteration of the string alt="" containing anything but a ".
unknown
d19034
test
Here: Item firstItem = new Item(values[0]); You are creating a new Item with an item pointer as its argument. This is the same as: Item firstItem(new Item(values[0])); And it should be: Item *firstItem = new Item(values[0]);
unknown
d19035
test
Replace container.internalList.Add(item); by Dispatcher.BeginInvoke(new Action(() => container.internalList.Add(item))); This way the Add is executed on the Dispatcher thread. A: You can just get your data from a background thread as a List and then cast this list to an ObservableCollection as follows List<SomeViewModel> someViewModelList = await GetYourDataAsListAsync(); ObservableCollection<SomeViewModel> Resources = new TypedListObservableCollection<SomeViewModel>(someViewModelList); I hope this helps. A: Make sure that you set the properties of UI objects on the UI thread: Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { MyDataGrid.ItemsSource = container.internalList; }); This will add the code within the curly braces onto the work items queue of the UI thread Dispatcher. A: The problem is not in the Collection on your class but in the Control that is binding to this collection from UI Thread. There is something new in WPF 4.5: http://www.jonathanantoine.com/2011/09/24/wpf-4-5-part-7-accessing-collections-on-non-ui-threads/ //Creates the lock object somewhere private static object _lock = new object(); //Enable the cross acces to this collection elsewhere BindingOperations.EnableCollectionSynchronization(_persons, _lock); MSDN: http://msdn.microsoft.com/en-us/library/hh198845(v=vs.110).aspx
unknown
d19036
test
https://www.medo64.com/2019/12/copy-to-clipboard-in-qt/ solved it for me. QClipboard* clipboard = QApplication::clipboard(); clipboard->setText(text, QClipboard::Clipboard); if (clipboard->supportsSelection()) { clipboard->setText(text, QClipboard::Selection); } #if defined(Q_OS_LINUX) QThread::msleep(1); //workaround for copied text not being available... #endif
unknown
d19037
test
Eventually realized what the issue was with this. The change necessary to get this to work was to make these changes to the "Player" class... public class Player { /* other properties */ List<Picks> PickList { get; set; } } The issue was occurring because RestSharp was confused because the Property's name ("Picks") was the same as the Object Type ("Picks") that it was trying to deserialize.
unknown
d19038
test
<div ng-class="{'currPeriod': day.current, 'notCurrPeriod': !day.current}"> {{day.date | date:"d"}} </div> ng-class doesn't work this way, use the object syntax to acheive what you want, or you can either set a default style when the day isn't in the current period, and apply the class when it is, it would shorten your ng-class statement
unknown
d19039
test
It depends on what you want to do with birth.month later. If you have no intention of changing it, then the first is better (quicker, no memory cleanup requirement required, and each Date_t object shares the same data). But if that is the case, I would change the definition of month to const char *. In fact, any attempt to write to *birth.month will cause undefined behaviour. The second approach will cause a memory leak unless you remember to free(birth.month) before birth goes out of scope. A: You're correct, the second variant is the "good" one. Here's the difference: With 1, birth->month ends up pointing to the string literal "Nov". It is an error to try to modify the contents of birth->month in this case, and so birth->month should really be a const char* (many modern compilers will warn about the assignment for this reason). With 2, birth->month ends up pointing to an allocated block of memory whose contents are "Nov". You are then free to modify the contents of birth->month, and the type char* is accurate. The caveat is that you are also now required to free(birth->month) in order to release this memory when you are done with it. The reason that 2 is the correct way to do it in general, even though 1 seems simpler in this case, is that 1 in general is misleading. In C, there is no string type (just sequences of characters), and so there is no assignment operation defined on strings. For two char*s, s1 and s2, s1 = s2 does not change the string value pointed to by s1 to be the same as s2, it makes s1 point at exactly the same string as s2. This means that any change to s1 will affect the contents of s2, and vice-versa. Also, you now need to be careful when deallocating that string, since free(s1); free(s2); will double-free and cause an error. That said, if in your program birth->month will only ever be one of several constant strings ("Jan", "Feb", etc.) variant 1 is acceptable, however you should change the type of birth->month to const char* for clarity and correctness. A: Neither is correct. Everyone's missing the fact that this structure is inherently broken. Month should be an integer ranging from 1 to 12, used as an index into a static const string array when you need to print the month as a string. A: I suggest either: const char* month; ... birth->month = "Nov"; or: char month[4]; ... strcpy(birth->month, "Nov"); avoiding the memory allocation altogether. A: With option 1 you never allocate memory to store "Nov", which is okay because it's a static string. A fixed amount of memory was allocated for it automatically. This will be fine so long as it's a string that appears literally in the source and you never try to modify it. If you wanted to read a value in from the user, or from a file, then you'd need to allocate first. A: In the first case your cannot do something like birth->month[i]= 'c'. In other words you cannot modify the string literal "Mov" pointed to by birth->month because it is stored in the read only section of memory. In the second case you can modify the contents of p->month because "Mov" resides on the heap. Also you need to deallocate the allocated memory using free in this case. A: Seperate to your question; why is struct Date typedefed? it has a type already - "struct Date". You can use an incomplete type if you want to hide the structure decleration. In my experience, people seem to typedef because they think they should - without actually thinking about the effect of doing so. A: For this example, it doesn't matter too much. If you have a lot of Date_t variables (in, say, an in-memory database), the first methow will lead to less memory usage over-all, with the gotcha that you should not, under any circumstances, change any of the characters in the strings, as all "Nov" strings would be "the same" string (a pointer to the same 4 chars). So, to an extent, both variants are good, but the best one would depend on expected usage pattern(s).
unknown
d19040
test
Did you start a worker to process the task? It looks like no worker is running (as only your client connected to Redis). Run rqworker from your project's root.
unknown
d19041
test
I managed to fix the issue by installing Visual Studio 2022
unknown
d19042
test
For filtering you can use LINQ, to set the values use a loop: var commonItems = from x in list1 join y in list2 on x.Name equals y.Name select new { Item = x, NewValue = y.Value }; foreach(var x in commonItems) { x.Item.Value = x.NewValue; } A: In one result, you can get the objects joined together: var output= from l1 in list1 join l2 in list2 on l1.Name equals l2.Name select new { List1 = l1, List2 = l2}; And then manipulate the objects on the returned results. by looping through each and setting: foreach (var result in output) result.List1.Value = result.List2.Value; A: You are looking for a left join var x = from l1 in list1 join l2 in list2 on l1.Name equals l2.Name into l3 from l2 in l3.DefaultIfEmpty() select new { Name = l1.Name, Value = (l2 == null ? l1.Value : l2.Value) };
unknown
d19043
test
in this excerpt of your code: ...( (if (= (get array (int... you are calling the result of that conditional as if it were a function. The code is very hard to read, but I see no signs that it returns a function of no arguments. PS. please try to use idiomatic style, in particular this code would be much more readable with let bindings and line breaks. the trivial fix is to add a call to println (or some other innocuous function) at that hanging open brace: ...(println (if (= (get array (int... Better is to actually make readable and idiomatic Clojure code: (defn binary-search "searches for a single element in a sorted array in logartihmic time" ([array start end element] (let [middle_exact (+ (/ (- end start) 2) start) middle (int middle_exact) middle-elt (get array (int middle))] (println "start " start " end " end " middle " middle) (cond (= middle-elt element) (do (println "element found at " middle) middle) (or (= end middle) (= start middle)) (do (println "not found :(") -1) (> middle-elt element) (recur array start (int (Math/floor (- end (/ middle_exact 2)))) element) :otherwise (recur array (int (Math/ceil (+ start (/ middle_exact 2)))) end element)))) ([array element] (println "starting binary search....") (binary-search array 0 (dec (count array)) element))) A: As noisesmith suggested, the cause of NPE is that you tried to perform function application against nil, which was the return value from println. I just tried to tidy up the code. (defn binary-search "Searches for a single element in a sorted vector in logarithmic time, and returns the index of the element if it exists, otherwise returns nil" ([v elem] ;(println "starting binary search....") (binary-search v 0 (count v) elem)) ([v start end elem] (let [index (+ start (quot (- end start) 2))] ;(println 'start start 'end end 'middle index) (if (<= start index (dec end)) (let [mid (nth v index)] (cond (> mid elem) (recur v start index elem) (< mid elem) (recur v (inc index) end elem) :else index)) nil)))) If you want to trace the execution, remove the ';' at the beginning of the lines commented out.
unknown
d19044
test
For the case that someone has the same problem (like me some hours ago), there is a still better solution: Let "bootloader.out" be the bootloader-binary. Then we can generate with nm -g bootloader.out | grep '^[0-9,a-e]\{8\} T' | awk '{printf "PROVIDE(%s = 0x%s);\n",$3,$1}' > bootloader.inc a file that we can include in the linker script of the application with INCLUDE bootloader.inc The linker knows now the addresses of all bootloader-functions and we can link against it without to have the actual function code in the application. All what we need there is a declaration for every bootloader-function which we want to execute. A: The way I found around this was to use function pointers, i.e. void (*formatted_write)( int a, char * b, struct mystruct c ); then, in the code somewhere at boot set the address of this function, i.e. formatted_write = 0xa0000; you can then call your function using the normal convention. Additionally, you can use the -Wl,--just-symbols=symbols.txt flag when compiling. You can set the address of your symbols as follows: formatted_write = 0xa0000;
unknown
d19045
test
In case anyone discovered this post, I managed to finish it myself. I used this plugin but had to manually rewrite it quite a lot, changing the conditions on when to call the authentication endpoint (call it on init rather than on url route parameter change), had to write new code for calling reshresh token endpoint and logout endpoint and all sorts of other stuff. Sadly, i can't publish the newly edited plugin, since my client wouldn't allow it. The takeaway from this is that if you want SSO against an external identity provider in such a way that without being logged in through your SSO you can't view the page, it's difficult and you'd either have to pay money for an expensive plugin or extend an existing plugin, spending days figuring out how to do it. A: Was working on something similar way back. It is true that for most of the plugins we need to pay. I too have tried miniorange and the other plugin you have mentioned. The use case which you are referring to, I have done some manual changes from my side to achieve it and never got the solution I was looking for. After some research, I found out that this Page and Post restriction plugin by miniorange itself along with the SSO plugin can be used to restrict all access to users who are not logged in if I am not wrong about it, you can give it a try yourself.
unknown
d19046
test
Generally speaking, the server-side upgrade does not affect your client. The client is still based on Subversion 1.6. You have to upgrade the client to benefit from the client-side improvements. In other words, upgrade the svn plug-in that you use in Eclipse (Subclipse / Subversive or whatever you use in the IDE) to the latest version. A: sudo yum update sudo yum groupinstall "Development tools" sudo yum groupinstall "Additional Development" wget https://archive.apache.org/dist/subversion/subversion-1.7.8.tar.gz tar zxvf subversion-1.7.8.tar.gz cd subversion-1.7.8 ./get-deps.sh ./configure make make check sudo make install On my system this seems to put the binary in /usr/local/bin/svn whereas the 1.6 binary is in /usr/bin/svn so you might need set up an alias.
unknown
d19047
test
As an alternative to using the :substitute command (the usage of which is already covered in @Peter’s answer), I can suggest automating the editing commands for performing the replacement by means of a self-referring macro. A straightforward way of overwriting occurrences of the search pattern with a certain character by hand would the following sequence of Normal-mode commands. * *Search for the start of the next occurrence. /\(hello\)\+ *Select matching text till the end. v//e *Replace selected text. r- *Repeat from step 1. Thus, to automate this routine, one can run the command :let[@/,@s]=['\(hello\)\+',"//\rv//e\rr-@s"] and execute the contents of that s register starting from the beginning of the buffer (or anther appropriate location) by gg@s A: %s/\v(hello)*/\=repeat('-',strlen(submatch(0)))/g
unknown
d19048
test
You can use fn:replace() and fn:toLowerCase(). <c:forEach items="${userChargingTypeAccessArray}" var="chargingType"> <div id="${fn:toLowerCase(fn:replace(chargingType.value,' ',''))}-wrapper"></div> </c:forEach>
unknown
d19049
test
Solution Change virtual ~hittable() = 0; into virtual ~hittable() = default; or virtual ~hittable() { // does nothing } The destructor can remain pure virtual, but it must have a definition. hittable::~hittable() { // does nothing } So what happened? We can crush the given code down to the following example (Note I can't reproduce the missing vtable with this code or the given code, but regardless, the above will fix it) Minimal example: class hittable { public: virtual ~hittable() = 0; // here we have a destructor, // but there's no implementation // so there is nothing for the // destructors of derived classes // to call virtual bool hit() const = 0; }; class sphere: public hittable { public: bool hit() const; }; bool sphere::hit() const { return false; } destructors call any base class destructors, and when shpere goes to call ~hittable, it finds that while ~hittableis declared, there is no implementation. Nothing to call.
unknown
d19050
test
Yes with GNU Parallel like this: parallel -j 10 < ListOfJobs.txt Or, if your jobs are called job_1.sh to job_200.sh: parallel -j 10 job_{}.sh ::: {1..200} Or. if your jobs are named with discontiguous, random names but are all shell scripts named with .sh suffix in one directory: parallel -j 10 ::: *.sh There is a very good overview here. There are lots of questions and answers on Stack Overflow here. A: Simply run them as background jobs: for i in {1..10}; { ./script.sh & } Adding more jobs if less than 10 are running: while true; do pids=($(jobs -pr)) ((${#pids[@]}<10)) && ./script.sh & done &> /dev/null A: There are different ways to handle this: * *Launch them together as background tasks (1) *Launch them in parallel (1) *Use the crontab (2) *Use at (3) Explanations: (1) You can launch the processes exactly when you like (by launching a command, click a button or whatever event you choose) (2) The processes will be launched at the same time, every (working) day, periodically. (3) You choose a time when the processes will be launched together once. A: I have used below to trigger 10 jobs a time. max_jobs_trigger=10 while mapfile -t -n ${max_jobs_trigger} ary && ((${#ary[@]})); do jobs_to_trigger=`printf '%s\n' "${ary[@]}"` #Trigger script in background done
unknown
d19051
test
You can call the procedure from a function just as you'd call any other PL/SQL block CREATE OR REPLACE FUNCTION my_function RETURN integer IS l_parameter VARCHAR2(100) := 'foo'; BEGIN insert_into_table_a( l_parameter ); RETURN 1 END; That being said, it doesn't make sense to call this procedure from a function. Procedures should manipulate data. Functions should return values. If you call a procedure that manipulates data from a function, you can no longer use that function in a SQL statement, which is one of the primary reasons to create a function in the first place. You also make managing security more complicated-- if you use functions and procedures properly, DBAs can give read-only users execute privileges on the functions without worrying that they'll be giving them the ability to manipulate data. The procedure itself seems highly suspicious as well. A column named address_id in the address table should be the primary key and the name implies that it is a number. The same applies for the contact_id column in the contact table and the telephone_id column in the telephone table. The fact that you are inserting a string rather than a number and the fact that you are inserting the same value in the three tables implies that neither of these implications are actually true. That's going to be very confusing for whoever has to work with your system in the future.
unknown
d19052
test
There must be something missing in your code that is not supplied in your question. When I created an example and ran it it works. The only change I made was I used the static method JasperViewer.viewReport(jasperPrint, true); to view the report. public static void main(String[] args) throws JRException { File file = new File("C:\\Test\\src\\report1.jrxml"); System.out.println("file = "+file.exists()); JasperDesign _des = JRXmlLoader.load(file); _des.setPageHeight(842); _des.setPageWidth(595); JasperReport _rep = JasperCompileManager.compileReport(_des); JasperPrint jasperPrint = JasperFillManager.fillReport(_rep, new HashMap<String, Object>()); JasperViewer.viewReport(jasperPrint, true); } If you could provide a small single java class that is runnable and reproduces the issue, I may be able to help more.
unknown
d19053
test
Using a robust HTML parser (see http://htmlparsing.com/ for why): use strictures; use Web::Query qw(); my $w = Web::Query->new_from_html(<<'HTML'); <div class="name"><a href="/v/name/idlike123123ksajdfk">name</a></div> <div class="name"><a href="/v/name/idlike123123ksajdfk">name</a></div> <div class="name"><a href="/v/name/idlike123123ksajdfk">name</a></div> <div class="name"><a href="/v/name/idlike123123ksajdfk">name</a></div> <div class="name"><a href="/v/name/idlike123123ksajdfk">name</a></div> HTML my @v_links = $w->find('div.name > a[href^="/v/"]')->attr('href'); A: There are plenty of Perl modules that extract links from HTML. WWW::Mechanize, Mojo::DOM, HTML::LinkExtor, and HTML::SimpleLinkExtor can do it. A: Web scraping with Mojolicious is probably simplest way to do it in Perl nowadays http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Web_scraping A: You should not use regex for parsing HTML, as there are many libraries for such parsing. Daxim's answer is good example. However if you want to use regex anyway and you have your text assigned to $_, then my @list = m{<div class="name"><a href="(/v/.*?)">}g; will get you a list of all findings.
unknown
d19054
test
Can you try in this way? address should be set as the site you want to read URL page = new URL(address); StringBuffer text = new StringBuffer(); HttpURLConnection conn = (HttpURLConnection) page.openConnection(); conn.connect(); InputStreamReader in = new InputStreamReader((InputStream) conn.getContent()); BufferedReader buff = new BufferedReader(in); box.setText("Getting data ..."); String line; do { line = buff.readLine(); text.append(line + "\n"); } while (line != null); final String result = new String(text.toString());
unknown
d19055
test
PNG is a compressed image format, so the IDAT chunk(s) contain a zlib-compressed representation of the RGB pixels. Probably the easiest way for you to access the pixel data is to use a converter such as ImageMagick or GraphicsMagick to decompress the image into the Netpbm "PPM" format. magick image.png image.ppm or gm convert image.png image.ppm Then read the "image.ppm" in the same way you tried to read the PNG. Just skip over the short header, which in the case of your image is P 6 \n 6 6 0 3 3 0 \n 2 5 5 \n where "P6" is the magic number, 660 and 330 are the dimensions, and 255 is the image depth (maximum value for R,G,and B is 255, or 0xff). The remainder of the file is just the R,G,B values you were expecting.
unknown
d19056
test
Suppose you've defined a component named" ChildComponent.razor <div>@ID.ToString()</div> @code { [Parameter] public int ID { get; set; } } Which has a parameter property ID, provided by the parent component, like this: ParentComponent.razor @for (int i = 0; i < 10; i++) { <ChildComponent @ref="component" ID="i" /> } @code { private ChildComponent component { set => components.Add(value); } List<ChildComponent> components = new List<ChildComponent>(); protected override void OnInitialized() { foreach (var component in components) { Console.WriteLine(component.ID); } } } Now, you can identify the component by its ID. A simple and effective way, though you may do that in other ways. Note: This is wrong: <MyInput @onkeydown="KeyDown" @ref="NewInput"></MyInput> because you assign the name of a method, the "KeyDown", to the @onkeydown compiler directive, which is only applicable to Html tags, not to component. You can do something like this: <MyInput ID="id" @ref="NewInput"></MyInput> ID should be a parameter property defined in MyInput component, which is a child component, mind you. You also have to define an EventCallback which should be triggered from an event handler for the keydown event. In the cuurent case the EventCallback should return to the parent component, the ID of the child component in whose html tag, say an input html element, the keydown event occurs. I hope you succeed to get what I'm saying... if not, don't hesitate to ask questions. UPDATE: Note: I've added some code to my previous code sample to demonstrate how to return the ID of each ChildComponent when you hit the KeyDown button of an input Html element embedded in each child component. Additionally, my code also demonstrate how to return a reference to each component when its KeyDown event takes place: ChildComponent.razor <input type="text" @onkeydown="@KeyDown" /> @code { [Parameter] public int ID { get; set; } // [Parameter] // public EventCallback<int> CallBack { get; set; } [Parameter] public EventCallback<ChildComponent> CallBack { get; set; } private void KeyDown(KeyboardEventArgs args) { // if (args.Code == "ArrowDown") // { // InvokeAsync(() => { CallBack.InvokeAsync(ID); }); // } if (args.Code == "ArrowDown") { InvokeAsync(() => { CallBack.InvokeAsync(this); }); } } } ParentComponent.razor <div>@output</div> @for (int i = 0; i < 10; i++) { <ChildComponent CallBack="ShowID" @ref="component" ID="i" /> } @code { private ChildComponent component { set => components.Add(value); } List<ChildComponent> components = new List<ChildComponent>(); protected override void OnInitialized() { foreach (var component in components) { Console.WriteLine(component.ID); } } private string output = ""; // private void ShowID(int id) // { // output = id.ToString(); // } private void ShowID(ChildComponent child) { output = child.ID.ToString(); } }
unknown
d19057
test
I personally use jsonObject XML and use OM type for storing complex types as WSO2 has better xml type support. <property expression="//jsonObject" name="token" scope="default" type="OM"/> <property name="conf:/storage/SampleToken.xml" scope="registry" expression="$ctx:token" type="OM"/> But, there is one "pitfall", as WSO2 are cacheing the registry entries for default 15seconds. So you will read old values for some time. If that is a problem i use workaround. I use script mediator for better handling that, and with checking if that resource exist or not. I tested it on EI 6.5 <script language="js"><![CDATA[ var regUrl = mc.getProperty('regUrl'); var registry = mc.getConfiguration().getRegistry(); if(registry.isResourceExists(regUrl) == false) { registry.newResource(regUrl, false); } registry.updateResource(regUrl,mc.getProperty('token')); var regEntry = registry.getRegistryEntry(regUrl); regEntry.setCachableDuration(0); registry.updateRegistryEntry(regEntry);]]> </script> I also made some blog post, may be also useful:: Reading, modifying and writing data in WSO2 Enterprise Integrator registry on an example
unknown
d19058
test
You are returning null outside the method, you need to return inside getHungryPeople() in case values is null. public int[] getHungryPeople() { // Get hungry people data from the class's Android Intent field final int[] values = mIntent.getIntArrayExtra( HUNGRY_PEOPLE ); if ( null != values ) { return Arrays.copyOf( values, values.length ); } // if values is null, return null return null; }
unknown
d19059
test
You can extract a file name from a path using basename like this: basename($imagePath); // output: 123.jpeg or without the extension: basename($imagePath, ".jpeg"); // output: 123 A: <?php $path = "index.php"; //type file path with extension $title = basename($path,".php"); // get only title without extension /remove (,".php") if u want display extension echo $title; ?> A: Try it with two way.. First : base_path unlink(base_url("uploads/".$image_name)); getcwd : Some times absolute path not working. unlink(getcwd()."/uploads/".$image_name);
unknown
d19060
test
As I've pointed out, I think this is a duplicate. But summarising the answers, you simply need to include the Where clause on the child as part of the Select statement (by using it as part of an anonymous type), enumerate the query, and then retrieve the objects you want. Because you've selected the TeamMembers that you want into another property they will be retrieved from the database and constructed in your object graph. result = (from t in this.context.Teams where t.EndDateTime == null orderby t.Name select new { Team = t, Members = t.TeamMembers.Where(tm => tm.EndDateTime == null) }) .ToList() .Select(anon => anon.Team) .ToList(); A: this should work: var result = this.context.Teams.Where(t=>t.EndDateTime==null).Select(t=> new { Name = t.Name, PropertyX = t.PropertyX... //pull any other needed team properties. CareCoordinators = t.CareCoordinators.Where(c=>c.EndDateTime==null) }).ToList(); this returns a list of anonymous objects.
unknown
d19061
test
You might also try fixing your app so it always saves the same base date with the time (like '01/01/1900' or whatever) and then you do not have to do all these slow and inefficient date stripping operations every time you need to do a query. Or as Joel said, truncate or strip off the date portion before you do the insert or update. A: from d in dates orderby d.TimeOfDay select d; or dates.OrderBy(d => d.TimeOfDay); Note: This will work as long as this is plain LINQ and not LINQ-to-SQL. If you're using LINQ-to-SQL to query your database, you'll need something that will translate to SQL. A: Well, you can't really store a datetime without a date, but you could just store the total seconds as an double (using @florian's method). You'd have to add a second method to convert this back to a date in your object, if you still need a date, such as: public class BusinessObjectWithDate { private string _someOtherDbField = ""; private double _timeInMS = 0; // save this to the database // sort by this? in sql or in code. You don't really need this // property, since TimeWithDate actually saves the _timeInMS field public double TimeInMS { get { return _timeInMS; } } public DateTime TimeWithDate { // sort by this too, if you want get { return (new DateTime(1900,1,1).AddMilliseconds(_timeInMS)); } set { _timeInMS = value.TimeOfDay.TotalMilliseconds; } } } var f = new BusinessObjectWithDate(); MessageBox.Show( f.TimeWithDate.ToString() ); // 1/1/1900 12:00:00 AM f.TimeWithDate = DateTime.Now; MessageBox.Show( f.TimeWithDate.ToString() ); // 1/1/1900 1:14:57 PM You could also just store the real date time, but always overwrite with 1/1/1900 when the value gets set. This would also work in sql public class BusinessObjectWithDate { private DateTime _msStoredInDate; public DateTime TimeWithDate { get { return _msStoredInDate; } set { var ms = value.TimeOfDay.TotalMilliseconds; _msStoredInDate = (new DateTime(1900, 1, 1).AddMilliseconds(ms)); } } } A: Try this in your sql: ORDER BY startTime - CAST(FLOOR(CAST(startTime AS Float)) AS DateTime)
unknown
d19062
test
You can get the parent of any object in the scene by using myParent = $myObject.parent And you can use the following line to get all of a parent's children: myParent.children so in combination with select and group methods, you can do the following: myParent = $myObject.parent select myParent selectmore myParent.children group (GetCurrentSelection() as array) name:"myGroup" And now you have a group named myGroup containing a parent object and all of its children. With a little tinkering you can turn this into a method and also iterate through every object in your scene. Hope this helps you.
unknown
d19063
test
You should iterate over $datas['0']['costs'] foreach ($datas['0']['costs'] as $key =$value){ echo $value['service'] . ' - ' $value['cost'][0]['value']; }
unknown
d19064
test
At the point where the video is moved and you are echo'ing its location: "Stored in: " . "upload/" . $_FILES["file"]["name"]; instead of echo'ing where it's stored you could add it to a videos table of some sort: $videoLocation = "upload/".$_FILES['file']['name']; // now insert $videoLocation into a database table //so you can fetch it on whatever page you feel like
unknown
d19065
test
It seems your accuracy function is correct since you didn't post whole your code, I would suggest you calculate accuracy inside the session, so each time you can print the content of predictions and true labels and trace the execution. Get predictions like predictions = sess.run(y, feed_dict={x: batchx, y_: batchy}) then print predictions by print predictions.eval(), then use plabel = tf.argmax(predictions, 1), again print plabel.eval(), also print batchy and print (tf.argmax(batchy)).eval() Now you should know what's going wrong with each print statement. A: For accuracy : def evaluate(X_data, y_data): num_examples = len(X_data) total_accuracy = 0 sess = tf.get_default_session() for offset in range(0, num_examples, BATCH_SIZE): batch_x, batch_y = X_data[offset:offset+BATCH_SIZE], y_data[offset:offset+BATCH_SIZE] accuracy = sess.run(accuracy_operation, feed_dict={x: batch_x, y: batch_y}) total_accuracy += (accuracy * len(batch_x)) return total_accuracy / num_examples for getting the prediction : prediction = sess.run(tf.argmax(logits, 1), feed_dict={x: train_data})
unknown
d19066
test
It's probably because you only installed cffi on your Windows, so you probably need to install it on your Mac also. You can follow rules on the docs: pip install cffi A: cffi is a third-party module. It's installed on your Windows computer but not on your Mac.
unknown
d19067
test
The Artist property is not automatically created - you have to create an instance of the artist first: var s = new Song(); s.SongTitle = SongName; s.Artist = new Artist(); s.Artist.ArtistName = artistName;
unknown
d19068
test
I'm assuming you're looking for number_format or its more advanced brother money_format. This will take care of the server-side for you. As for the client-side, I would advise against making things change while the user's typing. Just let them type in the number how they want. Bonus points if you allow them to type in thousand separators (since you can just strip them out easily in PHP to get the number itself). A: Try number_format $english_format_number = number_format(floatval($total)); echo $english_format_number; A: You need to use javascript for that, when user change the input value you need to call the function to format the value. You have to something like this: $("[name^='num']").change(function(){ var value = $(this).val(); $(this).val(money_format(format, value)); }); Here is the function for monet format : Ref: https://github.com/kvz/phpjs/blob/master/functions/strings/money_format.js function money_format (format, number) { // http://kevin.vanzonneveld.net // + original by: Brett Zamir (http://brett-zamir.me) // + input by: daniel airton wermann (http://wermann.com.br) // + bugfixed by: Brett Zamir (http://brett-zamir.me) // - depends on: setlocale // % note 1: This depends on setlocale having the appropriate locale (these examples use 'en_US') // * example 1: money_format('%i', 1234.56); // * returns 1: 'USD 1,234.56' // * example 2: money_format('%14#8.2n', 1234.5678); // * returns 2: ' $ 1,234.57' // * example 3: money_format('%14#8.2n', -1234.5678); // * returns 3: '-$ 1,234.57' // * example 4: money_format('%(14#8.2n', 1234.5678); // * returns 4: ' $ 1,234.57 ' // * example 5: money_format('%(14#8.2n', -1234.5678); // * returns 5: '($ 1,234.57)' // * example 6: money_format('%=014#8.2n', 1234.5678); // * returns 6: ' $000001,234.57' // * example 7: money_format('%=014#8.2n', -1234.5678); // * returns 7: '-$000001,234.57' // * example 8: money_format('%=*14#8.2n', 1234.5678); // * returns 8: ' $*****1,234.57' // * example 9: money_format('%=*14#8.2n', -1234.5678); // * returns 9: '-$*****1,234.57' // * example 10: money_format('%=*^14#8.2n', 1234.5678); // * returns 10: ' $****1234.57' // * example 11: money_format('%=*^14#8.2n', -1234.5678); // * returns 11: ' -$****1234.57' // * example 12: money_format('%=*!14#8.2n', 1234.5678); // * returns 12: ' *****1,234.57' // * example 13: money_format('%=*!14#8.2n', -1234.5678); // * returns 13: '-*****1,234.57' // * example 14: money_format('%i', 3590); // * returns 14: ' USD 3,590.00' // Per PHP behavior, there seems to be no extra padding for sign when there is a positive number, though my // understanding of the description is that there should be padding; need to revisit examples // Helpful info at http://ftp.gnu.org/pub/pub/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_7.html and http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/strfmp.htm if (typeof number !== 'number') { return null; } var regex = /%((=.|[+^(!-])*?)(\d*?)(#(\d+))?(\.(\d+))?([in%])/g; // 1: flags, 3: width, 5: left, 7: right, 8: conversion this.setlocale('LC_ALL', 0); // Ensure the locale data we need is set up var monetary = this.php_js.locales[this.php_js.localeCategories['LC_MONETARY']]['LC_MONETARY']; var doReplace = function (n0, flags, n2, width, n4, left, n6, right, conversion) { var value = '', repl = ''; if (conversion === '%') { // Percent does not seem to be allowed with intervening content return '%'; } var fill = flags && (/=./).test(flags) ? flags.match(/=(.)/)[1] : ' '; // flag: =f (numeric fill) var showCurrSymbol = !flags || flags.indexOf('!') === -1; // flag: ! (suppress currency symbol) width = parseInt(width, 10) || 0; // field width: w (minimum field width) var neg = number < 0; number = number + ''; // Convert to string number = neg ? number.slice(1) : number; // We don't want negative symbol represented here yet var decpos = number.indexOf('.'); var integer = decpos !== -1 ? number.slice(0, decpos) : number; // Get integer portion var fraction = decpos !== -1 ? number.slice(decpos + 1) : ''; // Get decimal portion var _str_splice = function (integerStr, idx, thous_sep) { var integerArr = integerStr.split(''); integerArr.splice(idx, 0, thous_sep); return integerArr.join(''); }; var init_lgth = integer.length; left = parseInt(left, 10); var filler = init_lgth < left; if (filler) { var fillnum = left - init_lgth; integer = new Array(fillnum + 1).join(fill) + integer; } if (flags.indexOf('^') === -1) { // flag: ^ (disable grouping characters (of locale)) // use grouping characters var thous_sep = monetary.mon_thousands_sep; // ',' var mon_grouping = monetary.mon_grouping; // [3] (every 3 digits in U.S.A. locale) if (mon_grouping[0] < integer.length) { for (var i = 0, idx = integer.length; i < mon_grouping.length; i++) { idx -= mon_grouping[i]; // e.g., 3 if (idx <= 0) { break; } if (filler && idx < fillnum) { thous_sep = fill; } integer = _str_splice(integer, idx, thous_sep); } } if (mon_grouping[i - 1] > 0) { // Repeating last grouping (may only be one) until highest portion of integer reached while (idx > mon_grouping[i - 1]) { idx -= mon_grouping[i - 1]; if (filler && idx < fillnum) { thous_sep = fill; } integer = _str_splice(integer, idx, thous_sep); } } } // left, right if (right === '0') { // No decimal or fractional digits value = integer; } else { var dec_pt = monetary.mon_decimal_point; // '.' if (right === '' || right === undefined) { right = conversion === 'i' ? monetary.int_frac_digits : monetary.frac_digits; } right = parseInt(right, 10); if (right === 0) { // Only remove fractional portion if explicitly set to zero digits fraction = ''; dec_pt = ''; } else if (right < fraction.length) { fraction = Math.round(parseFloat(fraction.slice(0, right) + '.' + fraction.substr(right, 1))) + ''; if (right > fraction.length) { fraction = new Array(right - fraction.length + 1).join('0') + fraction; // prepend with 0's } } else if (right > fraction.length) { fraction += new Array(right - fraction.length + 1).join('0'); // pad with 0's } value = integer + dec_pt + fraction; } var symbol = ''; if (showCurrSymbol) { symbol = conversion === 'i' ? monetary.int_curr_symbol : monetary.currency_symbol; // 'i' vs. 'n' ('USD' vs. '$') } var sign_posn = neg ? monetary.n_sign_posn : monetary.p_sign_posn; // 0: no space between curr. symbol and value // 1: space sep. them unless symb. and sign are adjacent then space sep. them from value // 2: space sep. sign and value unless symb. and sign are adjacent then space separates var sep_by_space = neg ? monetary.n_sep_by_space : monetary.p_sep_by_space; // p_cs_precedes, n_cs_precedes // positive currency symbol follows value = 0; precedes value = 1 var cs_precedes = neg ? monetary.n_cs_precedes : monetary.p_cs_precedes; // Assemble symbol/value/sign and possible space as appropriate if (flags.indexOf('(') !== -1) { // flag: parenth. for negative // Fix: unclear on whether and how sep_by_space, sign_posn, or cs_precedes have // an impact here (as they do below), but assuming for now behaves as sign_posn 0 as // far as localized sep_by_space and sign_posn behavior repl = (cs_precedes ? symbol + (sep_by_space === 1 ? ' ' : '') : '') + value + (!cs_precedes ? (sep_by_space === 1 ? ' ' : '') + symbol : ''); if (neg) { repl = '(' + repl + ')'; } else { repl = ' ' + repl + ' '; } } else { // '+' is default var pos_sign = monetary.positive_sign; // '' var neg_sign = monetary.negative_sign; // '-' var sign = neg ? (neg_sign) : (pos_sign); var otherSign = neg ? (pos_sign) : (neg_sign); var signPadding = ''; if (sign_posn) { // has a sign signPadding = new Array(otherSign.length - sign.length + 1).join(' '); } var valueAndCS = ''; switch (sign_posn) { // 0: parentheses surround value and curr. symbol; // 1: sign precedes them; // 2: sign follows them; // 3: sign immed. precedes curr. symbol; (but may be space between) // 4: sign immed. succeeds curr. symbol; (but may be space between) case 0: valueAndCS = cs_precedes ? symbol + (sep_by_space === 1 ? ' ' : '') + value : value + (sep_by_space === 1 ? ' ' : '') + symbol; repl = '(' + valueAndCS + ')'; break; case 1: valueAndCS = cs_precedes ? symbol + (sep_by_space === 1 ? ' ' : '') + value : value + (sep_by_space === 1 ? ' ' : '') + symbol; repl = signPadding + sign + (sep_by_space === 2 ? ' ' : '') + valueAndCS; break; case 2: valueAndCS = cs_precedes ? symbol + (sep_by_space === 1 ? ' ' : '') + value : value + (sep_by_space === 1 ? ' ' : '') + symbol; repl = valueAndCS + (sep_by_space === 2 ? ' ' : '') + sign + signPadding; break; case 3: repl = cs_precedes ? signPadding + sign + (sep_by_space === 2 ? ' ' : '') + symbol + (sep_by_space === 1 ? ' ' : '') + value : value + (sep_by_space === 1 ? ' ' : '') + sign + signPadding + (sep_by_space === 2 ? ' ' : '') + symbol; break; case 4: repl = cs_precedes ? symbol + (sep_by_space === 2 ? ' ' : '') + signPadding + sign + (sep_by_space === 1 ? ' ' : '') + value : value + (sep_by_space === 1 ? ' ' : '') + symbol + (sep_by_space === 2 ? ' ' : '') + sign + signPadding; break; } } var padding = width - repl.length; if (padding > 0) { padding = new Array(padding + 1).join(' '); // Fix: How does p_sep_by_space affect the count if there is a space? Included in count presumably? if (flags.indexOf('-') !== -1) { // left-justified (pad to right) repl += padding; } else { // right-justified (pad to left) repl = padding + repl; } } return repl; }; return format.replace(regex, doReplace); }
unknown
d19069
test
I wasn't able to, but my lead was able to fix this problem. The following packages were updated in the package.json: "rollup-plugin-commonjs": "8.3.0", "rollup-plugin-execute": "1.0.0", "rollup-plugin-node-resolve": "3.0.3", "rollup-plugin-sourcemaps": "0.4.2", "rollup-plugin-uglify": "3.0.0" An update was made to rollup.config.js and rollup.config.dev.js. The sections of name, exports, and sourcemap were moved over to the output section. See below: function createDevBundle(bundle) { let bundleDirectory = `${DEV_DIRECTORY}/${bundle.name}`; return { input: bundle.input, output: { file: `${bundleDirectory}/${bundle.name}.js`, name: `${MODULE_NAME_PATH}.${bundle.name}`, exports: 'default', sourcemap: true, format: 'umd' } ... [omitted for brevity]
unknown
d19070
test
The simple answer is don't use autoCommit - it commits on a schedule. Instead, let the container do the commits; using AckMode RECORD. However you should still make your code idempotent - there is always a possibility of redelivery; it's just that the probability will be smaller with a more reliable commit strategy.
unknown
d19071
test
So, according to your question and comments, you have code somewhere that creates a JLabel named topCaption, adds it to a JPanel called viewWindow, and you can see the label as a results. So somewhere you have: JLabel topCaption = new JLabel( you may have some stuff here ); Right after that, do this: Font font = topCaption.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); topCaption.setFont(font.deriveFont(attributes)); Also, I might suggest you need to do more reading before you continue with this, as knowledge of what a Map is, etc. is pretty basic to most UI programming, and you're going to continue to have trouble like this without some fundamentals under your belt.
unknown
d19072
test
As per the documentation Mass Assignment You may also use the create method to save a new model in a single line. The inserted model instance will be returned to you from the method. However, before doing so, you will need to specify either a fillable or guarded attribute on the model, as all Eloquent models protect against mass-assignment by default. You need to make sure $fillable or $guarded is correctly set otherwise changes may not be persistant. A: You can do what you want like this too: public function update(UserUpdateRequest $request, Users $uzytkownik) { $this->authorize('update', $uzytkownik); $uzytkownik->birth = $request->birth; $uzytkownik->sex = $request->sex; $uzytkownik->about = $request->about; if ( $uzytkownik->save() ) { return 1; } return 0; }
unknown
d19073
test
I found this: When we want to use transition for display:none to display:block, transition properties do not work. The reason for this is, display:none property is used for removing block and display:block property is used for displaying block. A block cannot be partly displayed. Either it is available or unavailable. That is why the transition property does not work. form this link. I hope this help.
unknown
d19074
test
You can do something like this: For c = 5 To 50 rawCol = vbNullString On Error Resume Next rawCol = headers(procSht.Cells(8, c).Text) On Error Goto 0 if rawcol <> vbnullstring then v = rawSht.Range(rawSht.Cells(5, rawCol), rawSht.Cells(Rows.Count, rawCol).End(xlUp)).Value2 procSht.Cells(9, c).Resize(UBound(v, 1)).Value = v End If Next
unknown
d19075
test
go to controller/product/product.php run this, to check product in stock: <?php foreach ($products as $product) { if($product['stock'] > 0 && $product['product_id']==$product_id['GIFTBOX']) { } ?>
unknown
d19076
test
If you add an onKeyPress event to the element in question, you can prevent the default action (form submission) by returning false from the function: <input id="txt" type="text" onKeyPress="var key = event.keyCode || event.which; if (key == 13) return false;"></input> Note that the which property of the keyboard event is deprecated, but you'll still want to check for it to support older user agents and/or Internet Exploder (reference). If you don't want to use inline javascript (which is not recommended), you can instead attach an event. Also, it may be better to use the preventDefault (docs) method of the event object, as well as the stopPropagation method (docs) - the necessity for these methods this is highly dependent on what other events you have attached to the form or the elements: var preventFormSubmit = function (event) { var key = event.keyCode || event.which; if (key != 13) return; if (event.stopPropagation) event.stopPropagation(); else event.cancelBubble = true; // deprecated, for older IE if (event.preventDefault) event.preventDefault(); else event.returnValue = false; // deprecated, for older IE return false; }; var target = document.getElementById('txt'); if (typeof target.addEventListener == 'function') target.addEventListener('keypress', preventFormSubmit, false); else if (typeof target.attachEvent == 'function') target.attachEvent('onkeypress', preventFormSubmit); There are other approaches to use, such as attaching a more complex onSumit handler to the form itself - this may be more appropriate if you're going to be doing further manipulation of the form or data before submitting (or using AJAX to submit the form data). A: Solution input id="txt" type="text" onKeyPress="if (event.which == 13) return false;"></input> Link http://stackoverflow.com/questions/1567644/submit-form-problem-enter-key Question closed
unknown
d19077
test
There are at least two ways to achieve same results. First one with namespaces. Second one - with static functions in classes. With namespaces: #include <stdio.h> namespace GenericMath { void add(); void dot(); } namespace ArmMath { void add(); using GenericMath::dot; } namespace GenericMath { void add() { printf("generic add"); } void dot() { Math::add(); printf("generic dot"); } } namespace ArmMath { void add() { printf("arm add"); } using GenericMath::dot; } int main() { Math::dot(); return 1; } With classes: #include <stdio.h> class GenericMath { public: static void add(); static void dot(); }; class ArmMath : public GenericMath { public: static void add(); }; void GenericMath::add() { printf("generic add"); } void GenericMath::dot() { printf("generic dot"); Math::add(); } void ArmMath::add() { printf("arm add"); } int main() { Math::add(); Math::dot(); return 1; } IMO inline namespaces make code less readable and too verbose. A: Once issue is that unlike #ifdef, the compiler still compiles all the code that isn't for the current platform. So you can't use it for dealing with platform-specific APIs.
unknown
d19078
test
from collections import defaultdict words_seen = defaultdict(list) for word,filedate in get_words(): words_seen[word].append(filedate) then frequency is len(words_seen[word]).
unknown
d19079
test
Before sorting the data you need to count the data. You can try : library(dplyr) Data_I_Have %>% count(Node_A, sort = TRUE) %>% left_join(Data_I_Have, by = 'Node_A') # Node_A n Node_B X.Place_Where_They_Met Years_They_Have_Known_Each_Other What_They_Have_In_Common #1 John 5 Claude Chicago 10 Sports #2 John 5 Peter Boston 10 Movies #3 John 5 Tim Seattle 1 Computers #4 John 5 Tim Boston 5 Computers #5 John 5 Claude Paris 2 Video Games #6 Adam 2 Tim Chicago 3 Sports #7 Adam 2 Henry London 3 Sports #8 Kevin 1 Claude London 10 Computers #9 Peter 1 Henry Paris 8 Sports #10 Tim 1 Kevin Chicago 7 Movies #11 Xavier 1 Claude Paris 5 Video Games Or we can use add_count instead of count so that we don't have to join the data. Data_I_Have %>% add_count(Node_A, sort = TRUE) You can remove the n column from the final output if it is not needed. A: As the last answer of the post you mentionend : Data_I_Have %>% group_by(Node_A) %>% arrange( desc(n())) # Node_A Node_B X.Place_Where_They_Met Years_They_Have_Known_Each_Other What_They_Have_In_Common # <chr> <chr> <chr> <chr> <chr> # 1 John Claude Chicago 10 Sports # 2 John Peter Boston 10 Movies # 3 John Tim Seattle 1 Computers # 4 John Tim Boston 5 Computers # 5 John Claude Paris 2 Video Games # 6 Peter Henry Paris 8 Sports # 7 Tim Kevin Chicago 7 Movies # 8 Kevin Claude London 10 Computers # 9 Adam Tim Chicago 3 Sports # 10 Adam Henry London 3 Sports # 11 Xavier Claude Paris 5 Video Games
unknown
d19080
test
I'll assume you have SQL Server 2008 or greater. You can do this all in one statement without any variables. Instead of doing all the work to first get the variables and see if they don't match, you can easily do that in as part of where clause. As folks have said in the comments, you can have multiple rows as part of inserted and deleted. In order to make sure you're working with the same updated row, you need to match by the primary key. In order to insert or update the row, I'm using a MERGE statement. The source of the merge is a union with the where clause above, the top table in the union has the older fahrer, and the bottom has the new farher. Just like your inner IFs, existing rows are matched on farher and dispodat, and inserted or updated appropriately. One thing I noticed, is that in your example newfahrer and oldfahrer could be exactly the same, so that only one insert or update should occur (i.e. if only bzeit was different). The union should prevent duplicate data from trying to get inserted. I do believe merge will error if there was. MERGE tbldispofahrer AS tgt USING ( SELECT d.farher, d.dispodat, GETDATE() [laenderung] INNER JOIN inserted i ON i.PrimaryKey = d.PrimaryKey AND (i.fahrer <> d.fahrer OR i.beschreibk <> d.beschreik ... ) UNION SELECT i.farher, i.dispodat, GETDATE() [laenderung] INNER JOIN inserted i ON i.PrimaryKey = d.PrimaryKey AND (i.fahrer <> d.fahrer OR i.beschreibk <> d.beschreik ... ) ) AS src (farher, dispodat, laenderung) ON tgt.farher = src.farher AND tgt.dispodat = src.dispodat WHEN MATCHED THEN UPDATE SET laenderung = GETDATE() WHEN NOT MATCHED THEN INSERT (fahrer,dispodat,laenderung) VALUES (src.fahrer, src.dispodat, src.laenderung) A: There were a few little syntax errors in the answer from Daniel. The following code is running fine: MERGE tbldispofahrer AS tgt USING ( SELECT d.fahrer, d.dispodat, GETDATE() [laenderung] from deleted d INNER JOIN inserted i ON i.satznr = d.satznr AND (i.fahrer <> d.fahrer OR i.beschreibk <> d.beschreibk or i.bus <> d.bus or i.bzeit <> d.bzeit or i.vzeit <> d.vzeit) UNION SELECT i.fahrer, i.dispodat, GETDATE() [laenderung] from inserted i INNER JOIN deleted d ON i.satznr = d.satznr AND (i.fahrer <> d.fahrer OR i.beschreibk <> d.beschreibk or i.bus <> d.bus or i.bzeit <> d.bzeit or i.vzeit <> d.vzeit) ) AS src (fahrer, dispodat, laenderung) ON tgt.fahrer = src.fahrer AND tgt.dispodat = src.dispodat WHEN MATCHED THEN UPDATE SET laenderung = GETDATE() WHEN NOT MATCHED THEN INSERT (fahrer,dispodat,laenderung) VALUES (src.fahrer, src.dispodat, src.laenderung);
unknown
d19081
test
Someone taught me how to do it. I had to add the following below namespace. static class global { public static int Var1; public static int Var2; public static int Var3; public static int Var4; } And then define their values in the same place as InitializeComponent(); is. global.Var1 = 5; global.Var2 = 3; global.Var3 = 1; global.Var4 = 1; And then just change the numbers with the correct variable name. It's fairly easy I suppose, but I din't know it and I hope it might help someone else too.
unknown
d19082
test
Calling Promise.allSettled returns a Promise, so just like any other Promise, call .then on it: Promise.allSettled(arrOfPromises) .then((result) => { // all Promises are settled });
unknown
d19083
test
From what I understand about your code, this should be the job of your dataprovider. As it should return a promise, you can make the two api calls in it and resolve only after you get the second call response
unknown
d19084
test
It's virtually impossible to debug this without seeing the data. The use quotes option requires that each field is surrounded by double quotes. Do not use this if your data does not contain these because the input process will import everything into the first field. When you use comma as the delimiter, the observed behaviour is likely to be because there are additional commas contained in the data. This seems likely if the data is based on Twitter. This confuses the import because it is just looking for commas. Generally, if you can get the input data changed, try to get it produced using a delimiter that cannot appear in the raw text data. Good examples would be | or tab. If you can get quotes around the fields, this will help because it allows delimiter characters to appear in the field. Dates formats can be handled using the data format parameter but my advice is to import the date field as a polynominal and then convert it later to date using the Nominal to Date operator. This gives more control especially when the input data is not clean.
unknown
d19085
test
The window wrapper is the one you need to change: $("#dialog").kendoWindow({ actions: ["Minimize"], minimize: function(e) { $("#dialog").getKendoWindow().wrapper.css({ width: 200 }); } }); Example: Window size change
unknown
d19086
test
One way to solve this is with jQuery and an additional control variable: $( gui.domElement ).mouseenter(function(evt) { enableRaycasting = false; } ); $( gui.domElement ).mouseleave(function() { enableRaycasting = true; } ); You can then use enableRaycasting in order to determine if raycasting should happen. Demo: https://jsfiddle.net/gnwz5ae7/
unknown
d19087
test
Would this work? function randomString() { var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; var string_length = 8; var randomstring = ''; for (var i = 0; i < string_length; i++) { var rnum = Math.floor(Math.random() * chars.length); randomstring += chars.substring(rnum, rnum + 1); } return randomstring; } document.getElementById("randstring").innerHTML = randomString(); window.setTimeout(function(){document.getElementById("randstring").innerHTML = ""}, 2000); This assumes you have an element with the ID of randstring.
unknown
d19088
test
I had the error user lacks privilege or object not found while trying to create a table in an empty in-memory database. I used spring.datasource.schema and the problem was that I missed a semicolon in my SQL file after the "CREATE TABLE"-Statement (which was followed by "CREATE INDEX"). A: As said by a previous response there is many possible causes. One of them is that the table isn't created because of syntax incompatibility. If specific DB vendor syntax or specific capability is used, HSQLDB will not recognize it. Then while the creation code is executed you could see that the table is not created for this syntax reason. For exemple if the entity is annoted with @Column(columnDefinition = "TEXT") the creation of the table will fail. There is a work around which tell to HSQLDB to be in a compatible mode for pgsl you should append your connection url with that "spring.datasource.url=jdbc:hsqldb:mem:testdb;sql.syntax_pgs=true" and for mysql with "spring.datasource.url=jdbc:hsqldb:mem:testdb;sql.syntax_mys=true" oracle "spring.datasource.url=jdbc:hsqldb:mem:testdb;sql.syntax_ora=true" note there is variant depending on your configuration it could be hibernate.connection.url= or spring.datasource.url= for those who don't use the hibernate schema creation but a SQL script you should use this kind of syntax in your script SET DATABASE SQL SYNTAX ORA TRUE; It will also fix issues due to vendor specific syntax in SQL request such as array_agg for posgresql Nota bene : The the problem occurs very early when the code parse the model to create the schema and then is hidden in many lines of logs, then the unitTested code crash with a confusing and obscure exception "user lacks privilege or object not found error" which does not point the real problem at all. So make sure to read all the trace from the beginning and fix all possible issues A: If you've tried all the other answers on this question, then it is most likely that you are facing a case-sensitivity issue. HSQLDB is case-sensitive by default. If you don't specify the double quotes around the name of a schema or column or table, then it will by default convert that to uppercase. If your object has been created in uppercase, then you are in luck. If it is in lowercase, then you will have to surround your object name with double quotes. For example: CREATE MEMORY TABLE "t1"("product_id" INTEGER NOT NULL) To select from this table you will have to use the following query select "product_id" from "t1" A: user lacks privilege or object not found can have multiple causes, the most obvious being you're accessing a table that does not exist. A less evident reason is that, when you run your code, the connection to a file database URL actually can create a DB. The scenario you're experiencing might be you've set up a DB using HSQL Database Manager, added tables and rows, but it's not this specific instance your Java code is using. You may want to check that you don't have multiple copies of these files: mydb.log, mydb.lck, mydb.properties, etc in your workspace. In the case your Java code did create those files, the location depends on how you run your program. In a Maven project run inside Netbeans for example, the files are stored alongside the pom.xml. A: I had similar issue with the error 'org.hsqldb.HsqlException: user lacks privilege or object not found: DAYS_BETWEEN' turned out DAYS_BETWEEN is not recognized by hsqldb as a function. use DATEDIFF instead. DATEDIFF ( <datetime value expr 1>, <datetime value expr 2> ) A: When running a HSWLDB server. for example your java config file has: hsql.jdbc.url = jdbc:hsqldb:hsql://localhost:9005/YOURDB;sql.enforce_strict_size=true;hsqldb.tx=mvcc check to make sure that your set a server.dbname.#. for example my server.properties file: server.database.0=eventsdb server.dbname.0=eventsdb server.port=9005 A: I was inserting the data in hsql db using following script INSERT INTO Greeting (text) VALUES ("Hello World"); I was getting issue related to the Hello World object not found and HSQL database user lacks privilege or object not found error which I changed into the below script INSERT INTO Greeting (text) VALUES ('Hello World'); And now it is working fine. A: Add these two extra properties: spring.jpa.hibernate.naming.implicit-strategy= org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl spring.jpa.hibernate.naming.physical-strategy= org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl A: I bumped into kind of the same problem recently. We are running a grails application and someone inserted a SQL script into the BootStrap file (that's the entry point for grails). That script was supposed to be run only in the production environment, however because of bad logic it was running in test as well. So the error I got was: User lacks privilege or object not found: without any more clarification... I just had to make sure the script was not run in the test environment and it fixed the problem for me, though it took me 3 hours to figure it out. I know it is very, very specific issue but still if I can save someone a couple of hours of code digging that would be great. A: I was having the same mistake. In my case I was forgetting to put the apas in the strings. I was doing String test = "inputTest"; The correct one is String test = "'inputTest'"; The error was occurring when I was trying to put something in the database connection.createStatement.execute("INSERT INTO tableTest values(" + test +")"; In my case, just put the quotation marks ' to correct the error. A: In my case the error occured because i did NOT put the TABLE_NAME into double quotes "TABLE_NAME" and had the oracle schema prefix. Not working: SELECT * FROM FOOSCHEMA.BAR_TABLE Working: SELECT * FROM "BAR_TABLE" A: had this issue with concatenating variables in insert statement. this worked // var1, var3, var4 are String variables // var2 and var5 are Integer variables result = statement.executeUpdate("INSERT INTO newTable VALUES ('"+var1+"',"+var2+",'"+var3+"','"+var4+"',"+var5 +")"); A: In my case the issue was caused by the absence (I'd commented it out by mistake) of the following line in persistence.xml: <property name="hibernate.hbm2ddl.auto" value="update"/> which prevented Hibernate from emitting the DDL to create the required schema elements... (different Hibernate wrappers will have different mechanisms to specify properties; I'm using JPA here) A: I had this error while trying to run my application without specifying the "Path" field in Intellij IDEA data source (database) properties. Everything else was configured correctly. I was able to run scripts in IDEA database console and they executed correctly, but without giving a path to the IDEA, it was unable to identify where to connect, which caused errors. A: You have to run the Database in server mode and connect.Otherwise it wont connect from external application and give error similar to user lacks privilege. Also change the url of database in spring configuration file accordingly when running DB in server mode. Sample command to run DB in server mode $java -cp lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:data/mydb --dbname.0 Test Format of URL in configuration file jdbc:hsqldb:hsql://localhost/Test A: In my case, one of the columns had the name 'key' with the missing @Column(name = "key") annotation so that in the logs you could see the query that created the table but in fact it was not there. So be careful with column names A: For what it's worth - I had this same problem. I had a column named 'TYPE', which I renamed to 'XTYPE' and a column named ORDER which I renamed to 'XORDER' and the problem went away. A: Yet another reason could be a misspelt field name. If your actual table has an id column named albumid and you'd used album_id, then too this could occur. As another anwer remarked, case differences in field names too need to be taken care of. A: I faced the same issue and found there was more than one PersistenceUnit (ReadOnly and ReadWrite) , So the tables in HSQLDDB created using a schema from one persistence unit resulted in exception(HSQL database user lacks privilege or object not found error) being thrown when accessed from other persistence unit .It happens when tables are created from one session in JPA and accessed from another session A: In my case the table MY_TABLE was in the schema SOME_SCHEMA. So calling select/insert etc. directly didn't work. To fix: * *add file schema.sql to the resources folder *in this file add the line CREATE SCHEMA YOUR_SCHEMA_NAME;
unknown
d19089
test
You are not setting your SqlCommand object to be a stored procedure. You should do a couple of things: * *Remove the EXEC prefix from the string ~(it's not needed) *Set command to be a stored procedure: command.CommandType = CommandType.StoredProcedure; *Not sure how the square braces around the DataTable column names will affect this either, but I suspect it's better with them removed.
unknown
d19090
test
You should send the file content, not the file handle. Your example is missing .read() Try: r = requests.post('url', data=methodBody.read(), headers=headers)
unknown
d19091
test
TWithChild extends T & ..., meaning if used as explicit type parameter it can union e.g. {a: 1}, you don't know its exact type, so you can't instantiate it. Define it as a known limited generic type, then it'll work type TWithChild<T> = T & {children: TWithChild<T>[]} function withChildren< T extends { id?: string; parentId?: string; } >(parentItem: T, items: T[]): TWithChild<T> { const children = items.filter((ba) => ba.parentId === parentItem.id); return { ...parentItem, children: children.map((child) => withChildren(child, items)), }; } Playground
unknown
d19092
test
1) First of all in parent layout xml put linearlayot as below: <LinearLayout android:id="@+id/parent_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"></LinearLayout> 2) Than Make a layout that is want to add in every click. 3) You can now add your view in parent like below : LinearLayout parent_layout = (LinearLayout)findViewById(R.id.parent_layout); for(i=0;i<3;i++) { parentlayout.addView(myViewReview(data.get(i))); } public View myViewReview() { View v; // Creating an instance for View Object LayoutInflater inflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.row_facility_review, null); TextView row_reviewer_name = (TextView) v.findViewById(R.id.row_reviewer_name); TextView row_review_text = (TextView) v.findViewById(R.id.row_review_text); return v; }
unknown
d19093
test
Looks like there are some problems with the embedded derby database. I'd try to completely redeploy ODE so that the database is extracted from the .war again. A: You have to execute Eclipse or NetBeans as Administrator.
unknown
d19094
test
Is there any reason why you are using both ng-if and ng-show? I think one of them should suffice. The ngIf directive removes or recreates a portion of the DOM tree based on an expression. If the expression assigned to ngIf evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM. A: Your code has ng-show="claim.claimToDealerCurrencyExchangeRate == null" which means the div will be visible when claim.claimToDealerCurrencyExchangeRate is null. As per your ask, your logic is wrong. Use ng-hide="claim.claimToDealerCurrencyExchangeRate == null" or ng-show="claim.claimToDealerCurrencyExchangeRate != null". But since you are already using ng-if, you should combine all the conditions within it, unless you absolutely want the DOM element to be toggled between visibility and non-visibility multiple times and not have it re-instantiated every time, use a combination of ng-if and ng-show. Also, understand empty and null are two different things in JavaScript. For example, if value is a variable. Then value = "" is empty but not null. value = "null" is not null but a non-empty string. Set value = null explicitly then it is null. And in all cases value is not undefined. Check what exactly claim.claimToDealerCurrencyExchangeRate is being set and define your logic in ng-show appropriately.
unknown
d19095
test
You can match it with a regular expression: var pattern = /\d{4}-\d{4}/; A: If you are not using any javascript library (like jQuery, etc), Javascript Regular Expressions could be used for validating the input.
unknown
d19096
test
if you have some experience with resposive design and media queries, i would code it myself to avoid the thousands of lines of unnecessary code that comes with frameworks/libraries. bootstrap is great, but it also requires a bit of effort to master, and it would be a bit overkill for this one layout (if i understand you correctly). if you just need this one layout, i would really recommend you do code it from scratch (personally i'd use something like jQuery and LESS). i hope i understood your question correctly, and sorry if this was not very hands-on. to sum it up: in my opinion you're probably better off coding it yourself, but bootstrap and other frameworks will provide valuable insight and inspiration for how to do it.
unknown
d19097
test
I don't really understand your code, but what you can do is to create an animation for each element and define the same duration for each element of the animation (the total animation time). After that, you just have to handle "what is displayed when" using % In my example, I will handle 4 elements, so 25% of the total time for each one (and +/-5% for fadeIn fadeOut) .el-1, .el-2, .el-3, .el-4 { position: absolute; width: 100px; height: 100px; animation-duration: 10s; /* Total time */ animation-iteration-count: infinite; animation-delay: 0; /* by default */ } .el-1 { animation-name: example-1; background: red; } .el-2 { animation-name: example-2; background: green; } .el-3 { animation-name: example-3; background: blue; } .el-4 { animation-name: example-4; background: yellow; } @keyframes example-1 { 0% {opacity: 0;} 5% {opacity: 1;} 20% {opacity: 1;} 30% {opacity: 0;} 100% {opacity: 0;} } @keyframes example-2 { 0% {opacity: 0;} 20% {opacity: 0;} 30% {opacity: 1;} 40% {opacity: 1;} 60% {opacity: 0;} 100% {opacity: 0;} } @keyframes example-3 { 0% {opacity: 0;} 40% {opacity: 0;} 60% {opacity: 1;} 70% {opacity: 1;} 80% {opacity: 0;} 100% {opacity: 0;} } @keyframes example-4 { 0% {opacity: 0;} 70% {opacity: 0;} 80% {opacity: 1;} 95% {opacity: 1;} 100% {opacity: 0;} } <div class="el-1">1</div> <div class="el-2">2</div> <div class="el-3">3</div> <div class="el-4">4</div>
unknown
d19098
test
You can work with a local database (SQLite) to store and retrieve things to use throughout the classes or you can create a class that would store all the data and have an instance of that class live in an interface that you would implement on all those classes.
unknown
d19099
test
Q: I used the method *px = 8 first to change it A: The value of both "x" and "*px" changed to "8", correct? Q: but right after that I used x = 99, and it changed too A: Cool. So now both "x" and "*px" are 99. This is what you expected, correct? Q: so I do not know what is the difference between them. In this example, they're both equivalent. They both accomplish exactly the same thing. Why use pointers at all? Because the variable "x" is tied to a specific memory location: you can't change it. The pointer "px", on the other hand, can be changed at runtime to point to DIFFERENT memory locations, if you needed to. Why is that useful? There are many different reasons. For example: * *When you malloc() dynamic memory, the system gives you a pointer. You don't know or care where in memory it's located: you just use it. *Pointers are frequently needed to traverse the elements in a linked list *The ability to increment (++) and decrement (--) pointers simplifies many algorithms *Etc. etc. You might find these articles helpful: * *C - Pointers *Pointer (computer programming) A: Other answers explained what is happening, but in your question I also read you ask 'why' someone would want to use references instead of direct accessing of a memory address. There are many reasons why anything is the way it is in computer science, but a few I think most people wouldn't argue that are helpful for a beginning theoretical understanding: A lot of Computer Science as a discipline is efficient/optimal management of resources, in many cases computer memory, but I/O and CPU make up two other resources we manage to make 'good' software. You may recall that a simple computer can be thought of as a CPU, RAM, and Storage, connected by a "bus". Up until relatively recently, most software wasn't being run on a machine with lots and lots of RAM. It was necessary that memory be managed for performance purposes, and though we have access to higher memory machines today - memory must still be managed! We manage that in more recently created languages with abstraction - or in this context, doing things for people when we know with a high degree of certainty what they are trying to do. We call languages where much of resource management is abstracted and simplified as "high-level" languages. You are "talking" to the machine with your code at a high level of control relative to machine code (you can think of that as the ones and zeros of binary). TLDR; Memory is finite, and pointers generally take up less space than the data they point to, allowing for an efficiency in address space utilization. It also allows for many other neat things, like virtualized address spaces.
unknown
d19100
test
I have spent the last couple hours trying to diagnose this issue and came up with a solution however the code changes quite abit. Basically the first thing you can do is actually set the property "location" to be required. You will notice that once you set it as required that the Graph API is failing due to a required property missing. This is a good sign, it means that something is not quite right with the submission. After digging around and manually creating objects in the Object Browser I came up with a solution. Now it is worth noting that I am using dnyamic ExpandoObjects instead of dictionaries but the concept is the same. Review the commented code //create our location object dynamic locationData = new ExpandoObject(); locationData.title = "sample app testing " + DateTime.Now.ToString(); //create our geolocation object dynamic geoData = new ExpandoObject(); geoData.latitude = 37.416382; geoData.longitude = -122.152659; geoData.altitude = 42; //<-- important altitude figure //create our geo data item container and add the geoData object to the geolocation property dynamic geoDataItem = new ExpandoObject(); geoDataItem.geolocation = geoData; //set the data property of our location data to the geo data item container locationData.data = geoDataItem; //create our root object setting the location property to the location data object dynamic objItem = new ExpandoObject(); objItem.location = locationData; var response = context.Client.Post("me/<my_app_name>:<app_action>", objItem); Really all we are doing is creating a simple structure using the expando object. Where I personally got stuck what not understanding how the complete GeoPoint operates. If you notice we have to create 2 containers. One container so we can set the geolocation property on the data property of the location object. The final structure resembles --- MyStory --- location --- title : 'Sample app testing....' --- data --- geolocation --- latitude : 37.416... --- longitude : -122.1526... --- altitude : 42 This does seem rather complex but here is a final output preview.
unknown