_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d9801
train
You must run a web server (even locally) when working with Google+ Sign in. A simple example is to run Python with your port set to 8080: python -m SimpleHTTPServer 8080 You can also configure / run Apache or another server for local testing.
unknown
d9802
train
This can be done via the filterMenuInit event: /* grid configuration snip */ .Events(e => e.FilterMenuInit("filterMenuInit")) /* grid configuration snip */ <script> function filterMenuInit(e) { e.container .find("select.k-filter-and") .data("kendoDropDownList") .value("or"); } </script> Here is a live demo: http://jsbin.com/etItEpi/1/edit A: You can also do this on a per column basis on your grid definition (MVC): cols.Bound(m => m.xxx).Filterable(f=> f.Cell(cell => cell.Operator("or")));
unknown
d9803
train
Look at the documentation here https://github.com/mysqljs/mysql#escaping-query-values. connection.query('INSERT INTO posts SET ?', post, function(err, result) { if (!err) { console.log('Successfully added information.'); } else { console.log(result); console.log('Was not able to add information to database.'); } }); Valid mysql statement is SET instead of Values.
unknown
d9804
train
You just need to specify the breaks in scale_color_continous() g1 <- ggplot(mtcars, aes(x=mpg, y=carb, color=disp)) + geom_point(size=3) + theme(legend.key.height = unit(2,'cm')) g1 + scale_color_continuous(breaks=seq(50,500,25))
unknown
d9805
train
Use the property value you pass in as computed key of your el object (tag in your code), in order to pass the property value for the element inside the forEach dynamically, depending on the property you passed in arr.forEach(el => { links.push(el[property]); })
unknown
d9806
train
I think you need see documentation about Hierarchical Queries to connect your data use connect by, to get root element - connect_by_root, to filter the elements by root you need use where connect_by_root(E622SIM.CodPro) = 'BSFX30' I tried to compile your description into scripts create table E622SIM(NumLig int, CodPro varchar2(100), CodDer varchar2(100)); insert into E622SIM values (901, 'BSFX30', '0140I18'); insert into E622SIM values (898, 'RSFX30', '18'); insert into E622SIM values (6, 'MFLX', 'U'); create table E622DER (NumLig int, CodCmp varchar2(100), DerCmp varchar2(100), QtdUti varchar2(100), PerCmp varchar2(100)); insert into E622DER values(901, 'RSFX30',18,1,'2,5'); insert into E622DER values(901, 'EDEAD0005',0,245,0); insert into E622DER values(898, 'MFLX','U','0,942',2); insert into E622DER values(898, 'MDCAM0002',null,'0,05',0); insert into E622DER values(6, 'MDFIB0008', null, 1, 2); insert into E622DER values(6, 'MDQDN0009',null,'0,24',1); and this is the query that looks as what you need select E622DER.CodCmp ,E622DER.DerCmp ,E622DER.QtdUti ,E622DER.PerCmp from E622DER left outer join E622SIM on E622SIM.NumLig = E622DER.NumLig where connect_by_root(E622SIM.CodPro) in ('BSFX30') connect by prior E622DER.CodCmp = E622SIM.CodPro order by level desc, E622DER.CodCmp asc CODCMP DERCMP QTDUTI PERCMP 1 MDFIB0008 1 2 2 MDQDN0009 0,24 1 3 MDCAM0002 0,05 0 4 MFLX U 0,942 2 5 EDEAD0005 0 245 0 6 RSFX30 18 1 2,5
unknown
d9807
train
I found the answer, sorted it out. I must add the expression begin for multiple statements after when. Not the double parentheses. (for ([I (range (- (length List) 1))]) (for ([J (range (+ I 1) (length List))]) (set! Left (list-ref List I)) (set! Right (list-ref List J)) (when (> Left Right) (begin (set! List (list-set List I Right)) (set! List (list-set List J Left )) )))) Or just a series of forms after when: (for ([I (range (- (length List) 1))]) (for ([J (range (+ I 1) (length List))]) (set! Left (list-ref List I)) (set! Right (list-ref List J)) (when (> Left Right) (set! List (list-set List I Right)) (set! List (list-set List J Left )) )))
unknown
d9808
train
there are few things which i am not able to understand... <ul ng-change="timeline.selectNote()" ng-model="timeline.updateNotes" ng-repeat="note in timeline.notes"> why ng-change and ng-model on the ul ng-model="timeline.updateNotes" timeline.updateNotes = function(){ updateNotes is a function, it can not be used as ng-model given that you are you want notes for each timeline, you can just directly call the function, why wait for change?? EDIT just to answer you comment... if you have provided some way of saving the notes either button or form, you can do it as below <button ng-click="updateNotes()" text="save"></button> or <form ng-submit="updateNotes()"> <button type="submit" text="submit"></button> </form>
unknown
d9809
train
Hole punching is what it sounds like you may need. Add a etc/cache.xml file with a <config> root to your module. (see Enterprise/PageCache/etc/cache.xml). Choose a unique [placeholder] name. The placeholders/[placeholder]/block node value must match the class-id of your custom dynamic block, e.g. mymodule/custom The placeholders/[placeholder]/container node value is the class to generate the content dynamically and handle block level caching The placeholders/[placeholder]/placeholder node value is a unique string to mark the dynamic parts in the cached page placeholders/[placeholder]/cache_lifetime is ignored, specify a block cache lifetime in the container’s _saveCache() method if needed Implement the container class and extends Enterprise_PageCache_Model_Container_Abstract. Use _renderBlock() to return the dynamic content. Implement the _getCacheId() method in the container to enable the block level caching. Use cookie values instead of model ids (lower cost). One last note: You DON’T have the full Magento App at your disposal when _renderBlock() is called. Be as conservative as possible. SOURCE: http://tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching
unknown
d9810
train
The MDM is supposed to handle this. You should not be required to check every request in the API to make sure it is secure. Airwatch, for instance, makes all of your applications downloadable only through their catalog and the agent or vpn system connects when the application is opened. If the user were to attempt to circumvent these limits it unenrolls their device and disallows access until a new enrollment code is issued by your tech department.
unknown
d9811
train
Basically, you're constructing a programming language here (albeit simple, it's still a programming language). To interpret a programming language you need a compiler, which usually contains a lexer (which splits input stream into meaningful tokens) and a parser (which reads tokens one by one and takes whatever actions are needed). In your simplified example, the lexer would be probably regexp-based, and the parser can be a simple stack-based one. (terms in italic should actually be wikipedia links). A: I am not entirely sure about what your question is, but there has been a lot of debating about templating languages in PHP but I think a general consensus reached by now was that it usually doesn't make much sense to roll your own templating language. You might get instant nice result by e.g. using string replacement and regular expressions, but eventually you will need more functionality like loops or other expressions and then it will become quite tricky (ultimately ending in creating your own compiler). The best suggestion usually is to either use PHP as your templating language directly (that is what PHP was designed for in the first place and with strictly following the MVC pattern quite a good solution, too) or try one of the existing templating engines. Only if you can't make any of them fit your needs (most of them are extensible through a plugin mechanism) you should start making your own.
unknown
d9812
train
I think I found a solution for you man check this out: <i id="icon">click</i> <input class="datepicker" style="display:none;" value="click"></input> $('.datepicker').pickadate({ selectMonths: true, selectYears: 15 }); $('#icon').click(function(event){ event.stopPropagation(); $(".datepicker").first().pickadate("picker").open(); console.log("test1"); }); Fiddle: http://jsfiddle.net/k2qtzp7p/1/ Code taken from here and here
unknown
d9813
train
BY USING JQUERY: $('.pds-votebutton-outer').css('text-align','center'); DEMO USING JQUERY http://jsfiddle.net/rathoreahsan/25LjE/29/ OR BY USING CSS: .pds-votebutton-outer { text-align:center; } DEMO USING CSS http://jsfiddle.net/rathoreahsan/25LjE/33/ A: You can try $('#example td:nth-col(1)').textAlign(','); where your class to be replaced with id specified.
unknown
d9814
train
Yes, last week. No warning from Facebook. A: Our apologies for this change - we've reverted this change and will take precaution to avoid these things in the future. Thank you for the report. We've added another parameter to use in your query if you want to get the city name without the state. Documentation updated: https://developers.facebook.com/docs/reference/ads-api/get-autocomplete-data/
unknown
d9815
train
You can use the Cordova plugin InAppBrowser https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/ A: No need to change, if you just want your cordova project would run on web as well then use below command : cordova platform add browser This works for me.
unknown
d9816
train
check the construct of the class : AuthorCollection . it seems that it si not supporting ; \Magento\Store\Model\StoreManagerInterface; but need an \Magento\Framework\DB\Adapter\AdapterInterface object . so when you call the construct of the class AuthorCollection you should use exactly the same type share your class AuthorCollection so I could help you
unknown
d9817
train
The problem you're having is because you're trying to convert a string to a currency. From MSDN: The Currency ("C") Format Specifier The "C" (or currency) format specifier converts a number to a string that represents a currency amount. The .ToString(string format, IFormatProvider formatProvider) overload you're trying to use only exists for numeric types, which is why it's not compiling. As an example to demonstrate this: public class TestModel { public decimal Amount { get; set; } public string StringAmount { get; set; } } class Program { static void Main(string[] args) { var model = new TestModel { Amount = 1.99M, StringAmount = "1.99" }; IFormatProvider formatProvider = new CultureInfo("en-US"); // Prints $1.99 Console.WriteLine(model.Amount.ToString("C", formatProvider)); // Prints 1.99 Console.WriteLine(string.Format(formatProvider, "{0:C}", model.StringAmount)); } } So you have a couple of choices: * *Convert your data to a numeric type in the template, and then format it. *Store your data as a numeric type to begin with. I believe 2 is the better option, because you're wanting to work with numeric data, so storing it as a string only adds complexity when it comes to calculating and formatting (as you can see here), as you're always going to have to perform conversions first.
unknown
d9818
train
From Apple documentation: // Reference type example class C { var data: Int = -1 } var x = C() var y = x // x is copied to y x.data = 42 // changes the instance referred to by x (and y) println("\(x.data), \(y.data)") // prints "42, 42" Copying a reference implicitly creates a shared instance. After a copy, two variables then refer to a single instance of the data. A: This is because primitives are value-based types, and classes are reference-based. You can find detailed explanation on Apple's blog. // Value type example struct S { var data: Int = -1 } var a = S() var b = a // a is copied to b a.data = 42 // Changes a, not b println("\(a.data), \(b.data)") // prints "42, -1" // Reference type example class C { var data: Int = -1 } var x = C() var y = x // x is copied to y x.data = 42 // changes the instance referred to by x (and y) println("\(x.data), \(y.data)") // prints "42, 42"
unknown
d9819
train
One option is to use the onNavigationStateChange event handler to intercept and seize control from the WebView: render() { var recipientViewURL = this.props.route.data.url; console.log('Recipient URL is: ' + recipientViewURL); return ( <View style={styles.container}> <WebView source={{uri: recipientViewURL, method: 'GET'}} scalesPageToFit={true} javaScriptEnabled={true} domStorageEnabled={true} onNavigationStateChange={this.whenNavigationStateChanges.bind(this)} > </WebView> </View> ); } whenNavigationStateChanges(navState){ var navigator = this.props.navigator; var parsed = Url.parse(navState.url, true); if (parsed.hostname == 'YOUR_HOSTNAME'){ console.log("Event is: " + parsed.query.event); navigator.pop(); } } A: You will need to configure Custom URL Schemes. For Android: http://developer.android.com/training/basics/intents/filters.html For iOS: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
unknown
d9820
train
You need BooleanField. BinaryField is for binary data. https://docs.djangoproject.com/en/dev/ref/models/fields/#booleanfield
unknown
d9821
train
It seems as if this has a historic background. What makes using -hd graphics still worthwhile is that loading them doesn't rely on Apple functionality but is rather done in framework code. So -hd can be loaded for iPads in iPhone Simulator mode and make use of the higher resolution pictures in 2x mode. Other than that I couldn't find any more reasons to not use @2x when I was looking into this a week ago. In case you want all the details it is probably best to drop riq an email. A: This seems to be the main reason from this link: http://www.cocos2d-iphone.org/forum/topic/12026 Specifically this post by riq: I don't know if initWithContentsOfFile was fixed, but in 4.0 it was broken and it wasn't working with @2x, ~iphone extensions. imageNamed caches all the loaded files so it consumes much more memory than initWithContentsOfFile Also the @2x extension does something (I don't know exactly what) but it doesn't work OK with cocos2d. Another good point: Back when the iPhone 4 was just released with the retina display, I am sure some users of Cocos2D were using an older version of it so when the user was using the retina display on a version of Cocos2D that didn't support it, things were twice as large as they should've been. Again this is now fixed to most unless you are using a VERY early version of Cocos2D. Overview, so it seems that the main issue was with initWithContentsOfFile from iOS 4 but they have fixed this since because I use that exact API with Cocos2D 2.0-rc2 in my app and I do not have any issues whatsoever. I use all Apple specified extensions for images and everything works jolly good! :)
unknown
d9822
train
The validation you are doing is asynchronous. You call the User.find method, and after that the validation method returns. Sequelize has no way of knowing that you are doing something async in your validation, unless you tell it so. Once your find call is done you throw the error, but the validation has completed, so there is no code to catch that error, which means the error is thrown and crashes the app The way to tell sequelize that you are doing something async is to take a second argument to your function, which is a callback. If you call the callback without any arguments, the validation succeeded, if you give it an argument, the validation failed. var User = sequelize.define('User', { username: { type: DataTypes.STRING, validate: { isUnique: function (username, done) { User.find({ where: { username: username }}) .done(function (err, user) { if (err) { done(err); } if (user) { done(new Error('Username already in use')); } done(); }); } } }, Could you point me to the part of the documentation that mislead you, then we can hopefully correct it :) A: Sequelize supports Promise style async operations. Specifically the Bluebird.js lib. Just change your function to specifically use the Promise -> next() pattern. var User = sequelize.define('User', { username: { type: DataTypes.STRING, validate: { isUnique: function (username) { User.find({ where: { username: username }}) .then(function (user) { if (user) { throw new Error('Username already in use'); } }); } } }, This will also handle any errors on User.find() for you. See this example in their codebase Of course the easiest way to handle unique constraints is by setting unique: true on the field definition itself: var User = sequelize.define('User', { username: { type: DataTypes.STRING, unique: true }, But this requires that you are either creating the table using Sequelize or already have a table with the unique constraint set. A: This question got a valid answer which explains how the validation option works. But in this situation you don't have to check if a user exists on your own. Sequelizejs has a findOrCreate() method, that checks if somethings exists before doing anything. Very useful method :)
unknown
d9823
train
I can think of 3 possible causes of your problems, given that no errors are shown in your console. * *JQuery could have been loaded twice. * *check for inclusions of files which may already have been included in the others. *The .js files which you are referencing might not be in the right order, * *make sure JQuery is loaded and only then Bootstrap . *Your JQuery doesn't work well with your current Bootstrap version. Try upgrading either of the 2 or both.
unknown
d9824
train
I found the Solution for this problem. I am having method inside method which closing the database. Because of that error coming. Thanks for help.
unknown
d9825
train
In Scanner you can use it with Locale to specify Locale like dot . as decimal separator: Scanner fin = new Scanner((new URL(url)).openStream()).useLocale(Locale.ENGLISH);
unknown
d9826
train
It called "Ripple effect". there are many related question in SO, see this https://stackoverflow.com/a/27237195/3814729 .
unknown
d9827
train
The problem is that you are always calling the mypass function inside myModule. This happens also when you import it from the main module. This is why you don't see the password printed to the terminal on the first time when running the main.py file. You should put the mypass() function call in the myModule inside the if name == "main" guard. Change the code inside myModule to the following: from getpass import getpass import sys def mypass(): try: password = getpass('Password: ') except Exception as e: print(e) sys.exit(1) while password == '': password = getpass('Enter password again: ') return password if __name__ == '__main__': password = mypass() print(password) Now the mypass function won't be called when the myModule is imported.
unknown
d9828
train
You can save your music file in the documents folder and set "Application supports iTunes file sharing" to YES. Then you can reach the file from outside the app. Hope this helps
unknown
d9829
train
Quoting the manual: When using ‘fields’ and ‘contain’ options - be careful to include all foreign keys that your query directly or indirectly requires. A: I think you should remove the 'fields' option and the model name in the fields lists: $this->Review->Behaviors->attach('Containable'); $latestReviews = $this->Review->find('all', array( 'contain' => array( 'Business' => array( 'fields' => array('name'), 'BusinessType' => array( 'fields' => array('url') ) ) ))); A: Using the 3.x version : If you have limited the fields you are loading with select() but also want to load fields off of contained associations, you can pass the association object to select(): // Select id & title from articles, but all fields off of Users. $query = $articles->find() ->select(['id', 'title']) ->select($articles->Users) ->contain(['Users']); The $articles is the equivalent for $this->Review in the question
unknown
d9830
train
Here is how to get a report to fit on a letter page: * *Click on the blank space outside of your report *Look at the properties and find interactive size. Set it to 11,8.5in. Set your Margins to 0.5in, 0.5in, 0.5in, 0.5in *Click on the body and select properties. Set the width to 10in and something less than 7.5 for the height. A: I was having this issue too. I set my margins to zero, which allowed me to print on 1 pdf page instead of 2. A: When you develop report from SpagoBI Studio change setting of Master Page (next to Layout). No need to change orientation but you need to increase the width of report according to your number of columns and column with. make sure it is greater than sum of all column's width (table width) This will solve the issues
unknown
d9831
train
Did you implement the mail class in your .h files A: Replace your hard coded values in "launchMailAppOnDevice".. it works for mine
unknown
d9832
train
Of course this question will be opinionated because it's fairly broad. Everyone has their own preferred choice. Though if you are a beginner to web programming and you'd like to use python I'd say start with flask.
unknown
d9833
train
Here are some of the possible causes: * *The encoding of the file doesn't match the encoding that you are using to read it, and the "pound" character in the file is getting "mangled" into something else. *The file and your source code are using different pound-like characters. For instance, Unicode has two code points that look like a "pound sign" - the Pound Sterling character (00A3) and the Lira character (2084) ... then there is the Roman semuncia character (10192). *You are trying to compile a UTF-8 encoded source file without tell the compiler that it is UTF-8 encoded. Judging from your comments, this is an encoding mismatch problem; i.e. the "default" encoding being used by Java doesn't match the actual encoding of the file. There are two ways to address this: * *Change the encoding of the file to match Java's default encoding. You seem to have tried that and failed. (And it wouldn't be the way I'd do this ...) *Change the program to open the file with a specific (non default) encoding; e.g. change new FileReader(aFile) to new FileReader(aFile, encoding) where encoding is the name of the file's actual character encoding. The names of the encodings understood by Java are listed here, but my guess is that it is "ISO-8859-1" (aka Latin-1). A: This is probably a case of encoding mismatch. To check for this, * *Print delim.length and make sure it is 1. *Print inputLine.length and make sure it is the right value (42). If one of them is not the expected value then you have to make sure you are using UTF-8 everywhere. You say delim.length is 1, so this is good. On the other hand if inputLine.length is 34, this is very wrong. For "19 x 75 Bullnose Architrave/Skirting £1.02" you should get 42 if all was as expected. If your file was UTF-8 encoded but read as ISO-8859-1 or similar you would have gotten 43. Now I am a little at a loss. To debug this you could print individually each character of the string and check what is wrong with them. for (int i = 0; i < inputLine.length; i++) System.err.println("debug: " + i + ": " + inputLine.charAt(i) + " (" + inputLine.codePointAt(i) + ")"); A: Many thanks for all your replies. Specifying the encoding within the read & saving the original text file as UTF -8 has worked. However, the experience has taught me that delimiting text using "£" or indeed other characters that may have multiple representations in different encodings is a poor strategy. I have decided to take a different approach: 1) Find the last space in the input string & replace it with "xxx" or similar. 2) Split this using the delimiter "xxx." which should split the strings & rip out the "£". 3) Carry on..
unknown
d9834
train
I got the same error (for archiving only) for my Swift framework with C code inside. Only this remedy helped me. Add -Xcc -Wno-error=non-modular-include-in-framework-module in Other Swift Flags (build settings of framework). This flag forces the compiller count that error as a warning.
unknown
d9835
train
You can use the checklist parent() property Assuming your rendered html look like this <div id="repeater_435734957439857435"> <input type="text" class="RepeaterTextbox">Test</input> <input type="checkbox"> </div> Your checkbox select event can be something like $(this).parent().find(".RepeaterTextbox")[0].text(); A: This should work with your markup: $(document).ready(function () { $(document).on("click", "input:checkbox[name='chkActive']:checked", function () { var nexttr = $(this).closest('tr').next('tr'); $(nexttr).find('textarea').each(function () { alert($(this).val());//Or whatever you want }) }); }); A: Try this, it seems there are multiple textarea you have in nested repeater so the second line in the event handler will loop through each textarea and print value in console. $("[type=checkbox]").on("change", function () { var oTexts = $(this).parents("tr").next().find("textarea"); $(oTexts).each(function (ind, val) { console.log($(val).val()); }); });
unknown
d9836
train
A : in the function signature always means an input argument to the function. The function signature contains the argument label followed by a :. The _ means there's no argument label, in which case you can omit the : as well when supplying that specific input argument to the function call. This is exactly what you see with the insert(_:at:) function. You supply two input arguments to it, "John" and 3, but it only needs an argument label for the second input argument, hence you only need one :. It's also important to note that at call time, you separate the input arguments using ,, not :. A: The convention, frequently seen in documentation, is a concise way of referring to a function, using only the function name and argument labels. So consider this function declaration: func insert(_ objects: [Any], at indexes: IndexSet) This is * *a method called insert; *the first parameter name is called objects, this parameter has no argument label (designated with the _) and has a type of [Any]; and *the second parameter name is indexes, its argument label is at and has a type of IndexSet. So you call it like so: insert(someObjects, at: someIndex) When you call it, you don’t care what the parameter names that are used inside that function, but rather just what the argument labels are. So, the convention when referring to that method in documentation is to omit the parameter names and types and just use the function name and the argument labels, but no comma: insert(_:at:) Note, you’d never actually use this syntax in your code. This is just a documentation convention employed to distill long function declarations down to something more manageable and concise: For more information about argument labels and parameter names, see Function Argument Labels and Parameter Names A: Swift functions have a unique way of specifying the signature, which is a carry over pattern from Objective C. There are 3 parts to specifying each input argument to the function signature. The signature for the function you mentioned is as follows: func insert(_ objects: [Any], at indexes: IndexSet) Let's look at the second argument first: * *at indicates the argument label, which is how the caller specifies the parameter. *indexes indicates the function's parameter name to the object. This means that in the body of the function, whatever was passed as at: would be referred to as indexes. *IndexSet is the type of the argument. Part 1 can be something besides a name, too: * *if it is not specified, the argument name and parameter label are the same. For example, if the signature were func insert(objects: [Any], indexes: IndexSet), the function would be called as o.insert(objects: ['a','b'], at: [1,2]). *If it is an underscore (_), then the argument has no label for the caller. This allows the caller to use the simpler, intuitive call o.insert(['a','b'], at: [1,2]). A: In a signature, the colon separates the name of a parameter from its value. Functions have this anatomy: func functionName(label1 parameter1: Type1, label2 paramter2: Type2) -> ReturnType { ... } where labels are the names seen when calling the function and parameters are the names of the values as used in the body of the function. A label of _ removes the label from the parameter when calling it. When calling a function, the colon simply separates parameter labels from the values passed to the function. Commas separate different parameters. A parameter with no label requires no colon. The following function would have no colons at all: func myFunc(_ par1: Int, _ par2: String) { print(par1, par2) } myFunc(3, "what") // 3 "what"
unknown
d9837
train
You can group the data by ParentCategory and within that group order the grouped data by PackageCost. This should give you the expected output:- var packageId = objentity.PackageGalleries .Where(p => p.ParentCategory != "Indian" && p.ParentCategory != "International") .GroupBy(p => p.ParentCategory) .Select(x => x.OrderBy(p => p.PackageCost).FirstOrDefault()) .ToList(); Update: For your issue althought I have never experienced such issue but it may be due to deferred execution of LINQ as per this post. You can force execute the query using ToList() as updated.
unknown
d9838
train
Your description says that you are actually not interested in the concatenation but in the (2-element) sets that are composed from the paired data. Representing them (as you do) as a 2-letter string, go along the following template. WITH CTE AS ( SELECT CPR1.PARTY_IDENTIFIER AS PARTY1, CPR2.PARTY_IDENTIFIER AS PARTY2, CCR.CLIENT_RELATIONSHIP_TYPE_CODE, CPR1.CLIENT_TYPE_CODE FROM GOLD.CLIENT_TO_PARTY_RELATIONSHIP CPR1 JOIN GOLD.CLIENT_TO_CLIENT_RELATIONSHIP CCR ON CPR1.CLIENT_IDENTIFIER = CCR.CLIENT_IDENTIFIER AND CCR.CLIENT_RELATIONSHIP_TYPE_CODE = '04' AND CPR1.CLIENT_TYPE_CODE = '1' JOIN GOLD.CLIENT_TO_PARTY_RELATIONSHIP CPR2 ON CPR2.CLIENT_IDENTIFIER = CCR.CLIENT_IDENTIFIER WHERE (CPR1.PARTY_IDENTIFIER_INACTIVE_DATE IS NULL OR CPR1.PARTY_IDENTIFIER_INACTIVE_DATE ='') AND (CPR2.PARTY_IDENTIFIER_INACTIVE_DATE IS NULL OR CPR2.PARTY_IDENTIFIER_INACTIVE_DATE ='') AND CPR1.PARTY_IDENTIFIER<>CPR2.PARTY_IDENTIFIER AND CPR1.DATA_AS_OF_DATE LIKE '201912%' AND CPR2.DATA_AS_OF_DATE LIKE '201912%' AND CCR.DATA_AS_OF_DATE LIKE '201912%' ) select distinct CASE WHEN party1 < party2 THEN party1 || party2 ELSE party2 || party1 END pair FROM CTE ; Caveats Pull the CTE definition out of the subquery. Concat syntax may vary depending on the sql dialect / database product you are using.
unknown
d9839
train
Note that in Pandas you can index in ways other than elementwisely with at. In the four-liner below, index is a list which can then be used for indexing with loc. for parameter in dictionary_of_parameters: index = df[df[parameter].isin(dictionary_of_parameters[parameter]['target'])].index df.loc[index,'financialliteracyscore'] += dictionary_of_parameters[parameter]['score'] df['financialliteracyscore'] = df['financialliteracyscore'] /27.0*100 Here's a reference although I personally never found it useful in my earlier days of programming... https://pandas.pydata.org/pandas-docs/stable/indexing.html
unknown
d9840
train
Difficult to tell from the snippet you provide, but I'd consider having three derived foo classes, FooI1, FooI2 and FooI3, and constructing the appropriate one with a factory based on InputType. Then all the specializations just get implemented in virtual methods for each of the new classes. class FooI1: public Foo { void doSomething() {...}; } ditto for I2/I3.. Foo * fooFactory(InputType iType) { return new FooX - depending on iType }; Foo *f = fooFactory(i) f->doSomething(); A: your current code couples Foo and InputType: 1. Foo creates InputType Object 2. InputType calls Foo function Suggested solution is: 1. Decouple InputType and Foo by using composites mode Foo could hold a pointer to `InputType*` then call InputType `virtual` function. 2. To make InputType, a factory will simple enough. Sample code: class InputType { public: virtual ~InputType(); virtual void DoSomething(); }; InputType* MakeInputObject(const IType& inputType) { return new InputTypeX; } class Foo { public: Foo(const InputType& input) : input_type_ptr(MakeINputObject(input) {} void DoSomething() { input_type_ptr->DoSomeThing(); } private: std::unique_ptr<InputType> input_type_ptr; };
unknown
d9841
train
Try something like this: nvim -c ':vsp|Explore|sp|Explore|sp|Explore' Placing terminal in front is tricky because it steals focus. Now I got a idea. nvim -c ':vsp|Explore|sp|Explore|sp|Explore|wincmd w|te'
unknown
d9842
train
What you're seeing is the list of Element objects that were selected by xpath(). In this case, it's just one Element with the name {http://autosar.org/schema/r4.0}ECUC-CONTAINER-VALUE. That's the full name with the namespace uri in Clark notation. If you want to print the serialized tree, try (untested): print(etree.tostring(subcontainers[0]).decode())
unknown
d9843
train
What about this solution: public class Pages { private string _folderName; public int PageID { get; set; } public string FolderName { get { return _folderName; } set { _folderName = value?.Trim() ?? string.Empty; } } } A: You need a backing field: public class Pages { public int PageID { get; set; } private string _folderName; public string FolderName { get { return _folderName; } set { _folderName = value.Trim(); } } } In the setter method we use the Trim string's method, which Removes all leading and trailing white-space characters from the current String object. For further info regarding this method, please have a look here. A: You may consider writing a custom extension method to call Trim only if the value of your string is not null: public static class CustomExtensions { public static string TrimIfNotNull(this string value) { if (value != null) { value = value.Trim(); } return value; } } And then in your Pages class, something like private string _folderName; public string FolderName { get { return _folderName.TrimIfNotNull(); } set { _folderName = value.TrimIfNotNull(); } } If you're using C#6, as mentioned by Jacob Krall, you can use the null conditional operator directly and not worry about the extension method: public string FolderName { get { return _folderName; } set { _folderName = value?.Trim(); } } A: The shorthand syntax for properties is only for when you want to provide a thin layer of abstraction on top of a field. If you want to manipulate the field within the getter or setter, you need to specify the backing field on your own. namespace sample.Models { public class Pages { public int PageID { get; set; } private string folderName; public string FolderName { get { return folderName; } set { folderName = value.Trim(); } } } } A: public class Pages { public int PageId { get; set; } // you need a backing field then you can customize the set and get code private string folderName; public string FolderName { get { return this.folderName; } // if the fileName can be set to null you'll want to use ?. or you'll get // a null reference exception set { this.folderName = value?.Trim(); } } } A: See the code below. //You can filter the entry before saving it into the database. //About the null issue. You can use this. if(String.IsNullOrEmpty(txtusername.Text)) { throw new Exception("Cannot be blank!"); } //You can filter the entry before saving it into the database txtpageid.Text = book.PageID.Trim(); txtfoldername.Text = book.FolderName.Trim();
unknown
d9844
train
Fatal errors can't be muted or catched. You need to raise amount of memory allowed for PHP script by using memory_limit setting in php.ini
unknown
d9845
train
Just use something like df[df != 0] to get at the nonzero parts of your dataframe: import pandas as pd import numpy as np np.random.seed(123) df = pd.DataFrame(np.random.randint(0, 10, (5, 5)), columns=list('abcde')) df Out[11]: a b c d e 0 2 2 6 1 3 1 9 6 1 0 1 2 9 0 0 9 3 3 4 0 0 4 1 4 7 3 2 4 7 df[df != 0] = 1 df Out[13]: a b c d e 0 1 1 1 1 1 1 1 1 1 0 1 2 1 0 0 1 1 3 1 0 0 1 1 4 1 1 1 1 1 A: As an unorthodox alternative, consider %timeit (df/df == 1).astype(int) 1000 loops, best of 3: 449 µs per loop %timeit df[df != 0] = 1 1000 loops, best of 3: 801 µs per loop As a hint what's happening here: df/df gives you 1 for any value not 0, those will be Inf. Checking ==1 gives you the correct matrix, but in binary form - hence the transformation at the end. However, as dataframe size increases, the advantage of not having to select but simply operate on all elements becomes irrelevant - eventually you it becomes less efficient. A: Thanks Marius. Also works on just one column when you want to replace all values except 1. Just be careful, this does it inplace create column 280 from 279 for class {1:Normal,0:Arrhythmia} df[280] = df[279] df[280][df[280]!=1] = 0
unknown
d9846
train
Use {{comida.id}} to get unique ids : {% for comida in comidas %} {% if comida.slug_food == page.slug %} <div class="food2"> <div id="food-title">{{comida.titulo}}</div> <div id="food-price">{{comida.precio|floatformat:"-1"}}€</div> <button class="button" onclick="showDescription('{{comida.id}}')">ver+ <div id="food-description-{{comida.id}}" > {{comida.descripcion|safe}} </div> </button> <div id="add-cart">AÑADIR AL PEDIDO</div> {% if comida.imagen != null %} <img src="{{comida.imagen.url}}"></img> {% endif %} </div> {% endif %} {% endfor %} And javascript : function showDescription(comidaId){ var showText = document.getElementById("food-description-" + comidaId); if (showText.style.display === "block"){ showText.style.display = "none"; } else { showText.style.display = "block"; } }
unknown
d9847
train
I made an example of what you are trying to achieve: class SO extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( height: 200, width: 300, decoration: BoxDecoration( color: Colors.orange, borderRadius: BorderRadius.circular(10), ), padding: EdgeInsets.only(left: 25), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), Text('title'), ], ), Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), Text('title'), ], ), Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), Text('title'), ], ), Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), Text('title'), ], ), ], ), Spacer(), Container( height: 60, width: 60, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: Colors.white, width: 2, ), ), child: Center( child: Text('Photo'), ), ), Spacer(), ], )), ), ); } } OUTPUT : A: This is the code, which will help you attain what you want to achieve. Also, I have replaced the photo with the real image, to give you a feel about how the image works. However, it is NetworkImage(), it uses web images, if you want to use the local image, then do use AssetImage() Container( height: 200.0, width: 350.0, padding: EdgeInsets.all(20.0), decoration: BoxDecoration( color: Colors.orange, borderRadius: BorderRadius.circular(10.0) ), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), SizedBox(width: 10.0), Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)), ] ), Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), SizedBox(width: 10.0), Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)), ] ), Row( children: <Widget>[ Icon( Icons.mail_outline, color: Colors.white, size: 30, ), SizedBox(width: 10.0), Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)), ] ) ] ), Expanded( flex: 1, child: Align( alignment: Alignment.center, child: Container( height: 80.0, width: 80.0, decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 3.0), borderRadius: BorderRadius.all(Radius.circular(40.0)), image: DecorationImage( fit: BoxFit.cover, image: NetworkImage('https://image.shutterstock.com/image-photo/beautiful-pink-flower-anemones-fresh-260nw-1028135845.jpg') ) ) ) ) ) ] ) ) RESULT
unknown
d9848
train
Try this instead : @Html.DropDownListFor(model => model.PropertyStatus, ViewBag.PropertyStatus) Edit ::: Alternately try this Controler: public ActionResult Edit(int id) { Property property = db.Properties.Find(id); ViewBag.PropertyStatusList = SetViewBagPropertyStatus(property.PropertyStatus); return View(property); } private IEnumerable<SelectListItem> SetViewBagPropertyStatus(string selectedValue = "") { IEnumerable<ePropStatus> values = Enum.GetValues(typeof(ePropStatus)).Cast<ePropStatus>(); IEnumerable<SelectListItem> items = from value in values select new SelectListItem { Text = value.ToString(), Value = value.ToString(), Selected = (selectedValue == value.ToString()) }; return items; } View: @Html.DropDownList("PropertyStatus", ViewBag.PropertyStatusList)
unknown
d9849
train
The server error indicates that is searching something called aws/dev (where aws is the data bag's name and dev is the name of the item within that data bag). So you would have to place your JSON file under test/integration/data_bags/aws/dev.json. Btw. you don't have to manually specify the data_bags_path, as test-kitchen will search for items at exactly this path.
unknown
d9850
train
try to use wrap_content to RelativeLayout height attribute inside NestedScrollView like below code <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/postDetails" android:background="?attr/backgroundColor"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> //change here <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="fitXY" android:id="@+id/postFeaturedImage"/> <com.app.customizeviews.Lato_Bold_TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:textColor="?attr/primaryTextColor" android:letterSpacing="0.02" android:lineSpacingExtra="6sp" android:layout_marginStart="16dp" android:layout_marginTop="20dp" android:layout_marginEnd="16dp" android:id="@+id/postTitle" android:layout_below="@+id/postFeaturedImage"/> <com.app.customizeviews.Lato_Regular_TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/postDate" android:textColor="?attr/secondaryTextColor" android:textSize="14sp" android:layout_below="@+id/postTitle" android:layout_marginTop="8dp" android:layout_marginStart="16dp" /> <WebView android:id="@+id/webView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/postDate" android:layout_marginTop="12dp"/> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="50dp" android:id="@+id/progressBar" android:layout_centerHorizontal="true"/> </RelativeLayout> </android.support.v4.widget.NestedScrollView>
unknown
d9851
train
You need to call a method like ToList() to force linq to get the data. Then just add that list to your cache.
unknown
d9852
train
Your parameter for the Include method should be the column name which is a pointer, not the class name which is pointed to. Try changing this line: $pqry->whereInclude("productId") ;
unknown
d9853
train
Add it here: $this->fileHandle = @fopen($this->filename, 'w'); if (!$this->fileHandle) { $this->setError('Could not open file'); $this->fileHandle = NULL; return FALSE; } fputs($this->fileHandle, chr(0xEF) . chr(0xBB) . chr(0xBF));
unknown
d9854
train
possibly syntax, it's working on this fiddle A: The background-size property allows you to change the dimensions of the background image, unless you need it to work in IE8 and perhaps Opera Mini.
unknown
d9855
train
Machine Independence Machine independence refers to the idea of software that can be executed irrespective of the machine on which it executes. A piece of Machine dependent software might be something written to use, say assembly instructions that are specific to a certain architecture. For example, if you write a C++ application with inline assembly that relies on special processor instructions such as for example, SIMD instructions, then that peice of software is machine dependent because it has specific machine requirements - it can only work on a machine that supports that specific required SIMD instruction set. In contrast, C# and Java compile to bytecode that is executed by a virtual machine which takes that bytecode and executes it as native code directly on the processor. In this case the virtual machine is machine dependent because it will execute against the specific hardware it is written for - for example, only a 32 bit Intel processor, or an ARM Smartphone. The Java and C# applications that run on the virtual machine however are machine independent because they care not what the underlying platform is, as long as there is a virtual machine to translate to the underlying paltform for them. That abstraction layer, the virtual machine, helps separate the application from the underlying hardware and that is the reason why those applications can be machine independent. Portability Portability is a separate but related concept, it is a broad term that covers a number of possibilities. A piece of software is portable simply if it can be built and executed or simply executed on more than one platform. This means that machine independent software is inherently portable as it has to be by nature. There are broadly two facets to portability - hardware portability, and software portability. Ignoring for the moment .NET implementations such as Mono and focussing purely on Microsoft's .NET implementation it is fair to say that .NET is hardware portable because it can be executed on any hardware that supports the .NET runtime, however because Microsoft's implementation is only available on Windows and Windows descended operating systems it is fair to say that it is not particularly software portable - without Mono it cannot be executed on Mac OS X or Linux. In contrast, Java could be said to be both hardware portable and software portable because it can run on multiple operating systems like Windows, OS X, Linux hence it is software portable, and hardware portable because it can run on different hardware architectures such as ARM, x86 and x64. Finally, there is also the question of language portability. Many would argue that although a C++ application compiled for Windows will not natively execute on Linux, it is possible to write C++ code in such a way that the same set of source code can be compiled on both Linux and Windows with no changes - this means that you can port the same application to different operating systems simply by just compiling it as is. In this respect we can say that whilst a compiled C++ application is not portable, the source code for a C++ application can be portable. This applies to a number of other languages including C. Disclaimer This is a somewhat simplified explanation and there are many edge cases that break these rules which make it such a complex and subjective subject - for example it is possible to write a Java application that is machine dependent if for example you use the Java native interfaces. A: Portable means that you can run this programm without any installation. Machine independent means that the same code can be executed on different OS. This question could be helpfull, too. A: From Wikipedia: Software is portable when the cost of porting it to a new platform is less than the cost of writing it from scratch. The lower the cost of porting software, relative to its implementation cost, the more portable it is said to be. Machine-independent software, on the other hand, does not need any work to be ran on another machine (ex. from Windows to Mac OS). It is by this definition also highly portable. A: What is difference between PORTABLE and Machine Independent? There is no real answer to this. It depends on whose definitions of "portable" and "machine independent" you chose to accept. (I could pick a pair of definitions that I agree with and compare those. But I don't think that's objective.) What is Java, c#.net : portable or machine independent? You could argue that Java and C# are neither portable or machine independent. * *A Java or C# program only runs on a platform with a JVM or CLR implementation, and a "compliant" implementation of the respective standard libraries. Ergo, the languages are not machine independent (in the literal sense). *There are many examples of Java (and I'm sure C#) programs that behave differently on different implementations of Java / C#. Sometimes it is due to differences in runtime libraries and/or the host operating system. Sometimes it is due to invalid assumptions on the part of the programmer. But the point is that Java / C# software often requires porting work. Ergo, they are not portable (in the literal sense.)
unknown
d9856
train
I did this using https://stackoverflow.com/a/54561421/12302484. I've made the class that implements the IControl interface. Then returned the component from the onAdd method resolved by dynamic component service. map.component.ts: private configureControls(): void { this.map.dragRotate.disable(); this.map.touchZoomRotate.disableRotation(); this.map.addControl(new mapboxgl.NavigationControl({ showCompass: false })); this.map.addControl(new CustomMapControls(this.dynamicComponentService)); } custom-map-controls.ts: export class CustomMapControls { private _container: HTMLElement; private _switchColorButton: HTMLElement; private map: mapboxgl.Map; private dynamicComponentService: DynamicComponentService; constructor(dynamicComponentService: DynamicComponentService) { this.dynamicComponentService = dynamicComponentService; this._container = document.createElement('div'); this._container.classList.add('mapboxgl-ctrl', 'mapboxgl-ctrl-group'); } getDefaultPosition(): any { return undefined; } onAdd(map: mapboxgl.Map): HTMLElement { this.map = map; this._container.appendChild(this.dynamicComponentService.injectComponent(MapColorSwitcherComponent)); return this._container; } onRemove(map: mapboxgl.Map): any { } } result:
unknown
d9857
train
You are doing nothing wrong here. You need to use the methods like .entires(), .get(), .getAll() and so on to access the values, or keys. I had the same issue some time ago, and if you need to convert your FormData to JSON, you need to write some code, which does this for you, JSON.stringify() does not work in this case. Have a look here Or, if you need a jQuery solution: SO A: I figured out what I need to do. It's simple: console.log("Here it is: " + JSON.stringify($('#myform').serializeArray()[0])); Gives the expected result: a JSON string containing name / value pairs from the form. I can then send this using XMLHttpRequest. No reason to use a FormData object in this case.
unknown
d9858
train
EditPad Pro can do this: Using the Convert - &#65535; and &#xFFFF; -> Character command (and assuming that the current file is set to UTF-8 and that you're using a font that contains the required glyphs), you get When you save that, you get a correctly UTF-8-encoded file with or without BOM, as you choose. Disclaimer: I am the translator for EPP's German version (but I'm doing this for free, because this editor is excellent). A: You could try this http://www.artlebedev.ru/tools/decoder/ tool (Russian lang). Translated version: http://bit.ly/15O0eQW (eng) updated: Try this script https://gist.github.com/Funfun/6839052
unknown
d9859
train
Does this works? Button button = (Button) findViewById(R.id.button); button .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText et = findViewById(R.id.number); int num = Integer.parseInt(et.getText().toString()); // num now have the number user given as input } }); A: Create a static variable for the input number. static int userInputNumber = 0; Initialized your Element like EditText and Button in your onCreate method. Button button = findViewById(R.id.button); EditText editText = findViewById(R.id.number); Then here, set the onClickListener on the Button button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Set the userInputNumber, use the Integer.parseInt because what the userinput //is always a String unless you manually set the userinput type userInputNumber = Integer.parseInt(editText.getText().toString()); //Then do what you want when button is clicked } }); Then after that, you can use the userInputNumber in any function you want.
unknown
d9860
train
Use ` to escape the $ in an expandable string literal: $Read_Opus_Category -replace 'Tag000: (.*)', "Tag000: `$1 hello $scategory"
unknown
d9861
train
Instead of trying to create a separate widget SearchUsers, try to create a dialog and show it when anyone wants to search users. You can also use the navigator and the back button in this case and get arguments passed from the next screen to the previous screen.
unknown
d9862
train
RegEx: (?:<iframe.+src=")([^"]+)(?:.*>) Then you'll have a captured group $1 containing only the src url.
unknown
d9863
train
Sure. Just use OPENROWSET(BULK ...) instead of BULK INSERT and you can add whatever extra columns you want. EG select * from openrowset(bulk 'C:\TEMP\dane.csv', format='CSV')
unknown
d9864
train
You have to draw over using a suitable Layout like RelativeLayout. Using ImageView and TextView, it is possible to have such result.
unknown
d9865
train
I made some napkin math, and I have an idea that may work. As per Reference Manual, page 948, the max baud rate for UART of STM32F334 is 9Mbit/s. If we want to send memory at the specific address, it will be 32 bits. 1 bit takes 1/9Mbps or 1.111*10^(-7)s, multiply that by 32 bits, that makes it 3.555 microseconds. Obviously, as I said, it's purely napkin math. There are start and stop bits involved. But we have a lot of wiggle room. You can easily fit 64 bits into transmission too. Now, I've checked with the internet, it seems the ST-Link based on STM32F103 can have max baud rate of 4.5Mbps. A bummer, but we simply need to double our timings. 3.55*2 = 7.1us for 32-bit and 14.2us for 64-bit transmission. Even given there is some start and stop bit overhead, we still seem to fit into our 25us time budget. So the suggestion is the following: You have a timer set to 25us period that fires an interrupt, that activates DMA UART transmission. That way your MCU actually has very little overhead since DMA will autonomously handle the transmission, while your MCU can do whatever it wants in the meantime. Entering and exiting the timer ISR will be in fact the greatest part of the overhead caused by this, since in the ISR you will literally flip a pair of bits to tell DMA to send stuff over UART @ 4.5Mbps.
unknown
d9866
train
I did not look through all your code. I will answer only your question. You have to pass pRoot to TTree_Insert by reference. Otherwise you pass its copy to the function and any changes of the copy within the function do not influence the original value. For example void TTree_Insert ( TNo **pRoot, char word[80] ){ char* c = malloc(sizeof(char)*strlen(word) + 1 ); // <== strcpy( c, word ); // <== TNo* pAux; pAux = *pRoot; //... And in main you have to call the function like TTree_Insert( &pRoot, aux ); Take into account that you have to adjust all other code of the function. For example void TTree_Insert( TNo **pRoot, const char word[80] ) { char* c = malloc( sizeof( char ) * strlen( word ) + 1 ); strcpy( c, word ); TNo **pAux = pRoot; while ( *pAux != NULL ) { printf("TESTE"); if ( strcmp(c, ( *pAux )->item.key ) < 0 ) { pAux = &pAux->pLeft; } else if ( strcmp(c, ( *pAux )->item.key ) > 0 ) { pAux = &pAux->pRight; } else { ( *pAux )->item.no++; break; } } if ( *pAux == NULL ) *pAux = TNo_Create(c); return; } I hope it will work.:) A: pRoot is initially NULL, and you never change it later. so it seems the pAux is always NULL for some reason Well, that's the reason... why don't you use a debugger or do some printing?
unknown
d9867
train
:h :sort is your friend: :[range]sort r /[^;]*/ If along the way you wish to remove duplicates, add the uniq flag: :[range]sort ur /[^;]*/ (This won't do any good if you have different comments after the ';' though) A: :1,4s/;$// :sort :1,4s/$/;/ (where 1,4 are lines with using statements) A: Not using CodeRush or ReSharper is stealing from your employer <ducks for downvotes> (Yes, I know that requires VS (and AFAIK VS10 has this OOTB)) A: On my linux box with a local other than C (tested fr_FR, fr_FR.UTF-8, en_US, en_GB), the sort command sorts as you expect. You could very well pipe to the sort command : :1,4!sort If you are on windows, I suppose you can install unix tools (like SFU) that could do the job since vim's sort command doesn't seem to handle locale.
unknown
d9868
train
var_dump out your query just before you run it, Are all the expected parameters there? Try running that in your local db tool (mysql workbench, phpmyadmin), does it do what you like? var_dump out the variables at each step of the way and die (or alternatively use a debugger to step through the code 1 line at a time), to see what is happening. It doesn't look like you've declared $varID above the query. I think you need to move foreach($shOrders->varID AS $varID) { above the $sql_statement = ... line.
unknown
d9869
train
This code should get you close. I tried to document exactly what I was doing. It does rely on BASH and the GNU version of find to handle spaces in file names. I tested it on a directory fill of .DOC files, so you'll want to change the extension as well. #!/bin/bash V=1 SRC="." DEST="/tmp" #The last path we saw -- make it garbage, but not blank. (Or it will break the '[' test command LPATH="/////" #Let us find the files we want find $SRC -iname "*.doc" -print0 | while read -d $'\0' i do echo "We found the file name... $i"; #Now, we rip off the off just the file name. FNAME=$(basename "$i" .doc) echo "And the basename is $FNAME"; #Now we get the last chunk of the directory ZPATH=$(dirname "$i" | awk -F'/' '{ print $NF}' ) echo "And the last chunk of the path is... $ZPATH" # If we are down a new path, then reset our counter. if [ $LPATH == $ZPATH ]; then V=1 fi; LPATH=$ZPATH # Eat the error message mkdir $DEST/$ZPATH 2> /dev/null echo cp \"$i\" \"$DEST/${ZPATH}/${FNAME}${V}\" cp "$i" "$DEST/${ZPATH}/${FNAME}${V}" done A: #!/bin/bash ## Find folders under test. This assumes you are already where test exists OR give PATH before "test" folders="$(find test -maxdepth 1 -type d)" ## Look into each folder in $folders and find folder[0-9]*.c file n move them to test folder, right? for folder in $folders; do ##Find folder-named-.c files. leaf_folder="${folder##*/}" folder_named_c_files="$(find $folder -type f -name "*.c" | grep "${leaf_folder}[0-9]")" ## Move these folder_named_c_files to test folder. basename will hold just the file name. ## Don't know as you didn't mention what name the file to rename to, so tweak mv command acc.. for file in $folder_named_c_files; do basename=$file; mv $file test/$basename; done done
unknown
d9870
train
For HTML like this: ... <div> <label for="NameTextBox">Name:</label> <input type="text" id="NameTextBox" /> </div> <div> <label for="AgeTextBox">Age:</label> <input type="text" id="AgeTextBox" /> </div> <div> <label for="EducationSelect">Education:</label> <select id="EducationSelect"> <option value="Bachelors">Bachelors</option> <option value="Masters">Masters</option> </select> </div> <input type="button" value="Add" /> <table> <tr> <th></th> <th>Name</th> <th>Age</th> <th>Education</th> </tr> <tr> <td><input type="button" id="row1" value="Select" /></td> <td>Name1</td> <td>44</td> <td>Bachelors</td> </tr> <tr> <td><input type="button" id="row2" value="Select" /></td> <td>Name2</td> <td>32</td> <td>Masters</td> </tr> </table> ... The following jQuery expression will copy the values from the selected row into the form on 'Select' button click: $(function() { $("table input").click(function(event) { $("#NameTextBox").val($("tr").has("#" + event.target.id).find("td:nth-child(2)").html()); $("#AgeTextBox").val($("tr").has("#" + event.target.id).find("td:nth-child(3)").html()); $("#EducationSelect").val($("tr").has("#" + event.target.id).find("td:nth-child(4)").html()); }); });
unknown
d9871
train
The problem described in the question can be resolved by changing the application.css.scss manifest to use import instead of require: @import "bootstrap_local"; It is also necessary to remove any require_tree . from the manifest because it would otherwise require the same bootstrap_local file because it lies in its path. On reflection, not having require tree . in the manifest is probably wise because it prevents unwanted files from being included. I only had it there because it's there by default in a new Rails project (the same goes for require_self; it's cleaner not to put that in the manifest). In reference to the suggestion about prefixing the file with an underscore, this is a good thing to do when the you don't need file, like bootstrap-social in the question, to be a compiled into a separate CSS file. So, I did end up renaming it to _bootstrap-social.scss.
unknown
d9872
train
Found it! The variable hash is not in hexadecimal format - well, it actually is, but not in the way the system wants it. I don't understand why, but the fact is that you have to do a hash.toHex() in order to get the right value. So, the solution is something like this: const hash = await api.tx.balances .transfer(to, amount) .signAndSend(from, { tip, nonce: -1 }) .catch(e => { throw e; }); return hash.toHex(); It was in the docs, I didn't pay attention to it: https://polkadot.js.org/docs/api/examples/promise/make-transfer
unknown
d9873
train
I can't see anywhere where you set the cell sizes so be sure your cells content sizes are being setup correctly. If you're using a flow layout you can set the size like this: let layout = UICollectionViewFlowLayout() layout.scrollDirection = .vertical layout.itemSize = CGSize(width: 50, height: 50) collectionView.collectionViewLayout = layout Alternatively you can use the UICollectionViewDelegateFlowLayout protocol to return a size for the cell: extension LoginTableCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return self.cells.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LoginCollectionCell", return cell } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: 100, height: 100) }
unknown
d9874
train
You need to add GROUP BY cities.name SELECT cities.name, COUNT(answers.id) FROM answers JOIN users ON users.id = answers.user_id JOIN cities on users.city_id = cities.id GROUP BY cities.name This will tell MySQL that you want the COUNT to be grouped by cities. Without this, mysql will group everything together and count it all. A: You should be aggregating to get a count, etc. So something like: SELECT COALESCE(c.city, '<Unknown>') AS Cityname, COUNT(a.id) AS amount FROM Answers AS a LEFT JOIN Users AS u ON a.user_id = u.id LEFT JOIN Cities AS c ON u.city_id = c.id GROUP BY c.city
unknown
d9875
train
* *change < to > in if condition as n >(Math.pow(3,i)) *or use below code which calculates pow only once int temp = 0, a; Scanner obj = new Scanner(System.in); System.out.print("Enter the number "); int n = obj.nextInt(); int i = 1; while (true) { int pow = (int) Math.pow(3, i); if (pow > n) { break; } else { temp = temp + n / pow; } i++; } System.out.println("Answer: " + temp);
unknown
d9876
train
Just update your androidx.test.ext:junit dependency to 1.1.3 or later. This should solve your problem. androidTestImplementation "androidx.test.ext:junit:1.1.3" A: It might be due to deprecated gradle features used is incompatible with your Gradle version 8.0 Try running the Gradle build with this command line argument --warning-mode=all. It will give detailed description of what exactly the deprecated features are used along with links to documentation regarding the fix.
unknown
d9877
train
A submodule can work, but if you try to clone something that contains submodules for which one of the remotes is unavailable, you'll have aggravating errors. My alternative would be to use the 'filter-branch' command to maintain a public branch that would omit the copyrighted files for public consumption on GitHub. A: You could use the git submodule support to hold the "copyrighted" directory in a separate Git repository. Keep this separate repository somewhere accessible to people who should be able to see it, and don't push it to github. For people accessing the public repository, they would see a reference to a "copyrighted" repository but would be unable to populate it. A: I think it is not possible. What you can try is to put "copyrighted" directory in a separate branch which is not mirrored, but it will just make more hassle.
unknown
d9878
train
Use the struct module (documentation), specifying the data as a float.
unknown
d9879
train
You need to use extern "C" to prevent name mangling and ensure the function is exported: extern "C" __declspec(dllexport) void Myfunction(BOOL); To view the exports from your DLL you can use dumpbin.exe utility that is shipped with Visual Studio: dumpbin.exe /EXPORTS MyDll.dll This will list the names of all exported symbols. In addition to this do not have either of the following compiler switches specified: Gz __stdcall calling convention: "Myfunction" would be exported as Myfunction@4 Gr __fastcall caling convention: "Myfunction" would be exported as @Myfunction@4 Note: I think last symbol is dependent on compiler version but is still not just "Myfunction". A: The DLL export process is subject to name mangling and decoration. The long obsolete 16 bit pascal calling convention is equivalent to stdcall on 32 bit platforms. First of all you should use extern "C" to specify C linkage and disable name mangling. However, your function will still be subject to name decoration. If you export it with __declspec(dllexport) then it will in fact be exported with the name _Myfunction@4. If you wish to export it by its true name then you need to use a .def file. However, the possibility still remains that you did not export the function from the DLL at all. Use Dependency Walker to check whether it was exported, and if so by what name. A: Why are you using the pascal calling-convention? Perhaps that alters the names of symbols, and if so you might need to take that into account. A: The symbol is going to be decorated, so it will never be called MyFunction, its more likely _MyFunction@4. you can quickly check this using something like dumpbin. You can read up more on mangling here, if you want to avoid mangling, you need to use a def file to specify symbol names (or ordinals).
unknown
d9880
train
to share a an url, website, in facebook u can use: https://www.facebook.com/sharer.php?u=URLHERE so, to get the thumbnail, title and the excerpt, to show properly in anywhere, u need to set in ur website as meta-tags inside head tags. like: <!-- FB Share --> <meta property="og:url" content="URLHERE" /> <meta property="og:type" content="website" /> <meta property="og:title" content="TITLE HERE" /> <meta property="og:description" content="DESC HERE" /> <meta property="og:image" content="URLIMAGE" /> <meta property="og:image:width" content="800" /> <meta property="og:image:height" content="600" /> <!-- FB Share -->
unknown
d9881
train
You need a file to tie them together. So along with a.js and b.js, have a main.js that looks like this: import A from './a'; import B from './b'; export default { A, B, }; Then update your rollup.config.js with input: path/main.js.
unknown
d9882
train
With Java 8, life is easy: list.removeIf(s -> !s.startsWith("ab")); This will remove all elements that don't begin with "ab". Note that you can use values() to retrieve the map's values and work directly on them, without the need to convert to ArrayList.
unknown
d9883
train
Windows by default will prefer .DLL files in the same directory as the .EXE. So while developing, you can put them in your Visual Studio Debug and Release folders. For other people, you include the DLL's in the installer. The exception is the *140.dll stuff, for which you need the Visual C++ redistributable. That's installed as part of Visual Studio 2017, but can also be distributed independently (hence the name).
unknown
d9884
train
You should initialize your app in the ng-app. Like this <html ng-app="appModule"> Then it will work. if the ngApp directive were not placed on the html element then the document would not be compiled, the AppController would not be instantiated See angularjs docs for reference on this https://docs.angularjs.org/api/ng/directive/ngApp
unknown
d9885
train
In gridview setAdapter() as you normally do for custom ListView by extending BaseAdapter and passing the arraylist of paths to this adapter class. Now in getView() method of Adapter add following lines Bitmap mBitmap = BitmapFactory.decodeFile(path); mView.setImageBitmapReset(mBitmap, 0, true); where mView is an ImageView and path will be fetched from arraaylist that you pass to adapter A: public class MainActivity extends Activity { String[] prgmNameList = {"Grid_1", "Grid_1", "Grid_1"}; int[] prgmImages = new int[] {R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher}; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Gridimageadapter gpa = new Gridimageadapter(MainActivity.this, prgmNameList, prgmImages); GridView gridView = (GridView) findViewById(R.id.gridView1); gridView.setAdapter(gpa); } }
unknown
d9886
train
Singleton pattern is a common approach if you only want one instance of the object. A lot of people regard it as an anti-pattern, yet it is still very popular. Spring beans are singletons, and redux store is a singleton! If you are only using it in one method, you might as well free up the heap and store it locally in the method, as described here. Freeing up the heap will technically give better performance, but Java is not exactly a super-efficient language anyway, and it also manages the memory for you. Memory generally isn't a problem though, because it's quite cheap and we have lots of it (maybe I should be more careful about my memory management!)
unknown
d9887
train
Follow steps : 1. Get registration ID of app user's device and save it to your database. private String getRegistrationId(Context context) { final SharedPreferences prefs = getGCMPreferences(context); String registrationId = prefs.getString(PROPERTY_REG_ID, ""); if (registrationId.isEmpty()) { Log.d(TAG, "Registration ID not found."); return ""; } int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE); int currentVersion = getAppVersion(context); if (registeredVersion != currentVersion) { Log.d(TAG, "App version changed."); return ""; } return registrationId; } 2.Use your php code.(remove HTML part) Note - use array of registration IDs 3.In response open this php script with registration ids. A: You can have a longer method where you send the information to a php script. This php script will select all the registration ids of the users and use a foreach loop to send the notifications. This means you need to store the registration ids in your mysql database
unknown
d9888
train
This was the solution i found by the hint from Ander Biguri. I used surf to plot spheres instead of scatter3. fig = figure(1); hold on daspect([1,1,1]); colormap summer shading interp % removes the lines in surfplot surface.xnum = 8; surface.znum = 8; surface.r = 0.75; circlenumber = 0; for m = 1:surface.xnum for n = 1:surface.znum circlenumber = circlenumber + 1; surface.circlecentre(circlenumber,:) = [m + 0.1*surface.r*randn ,0 , n + 0.1*surface.r*randn ]; [x,y,z] = sphere; surf(x*surface.r+m*2*surface.r+0.1*surface.r*randn, y*surface.r, z*surface.r+n*2*surface.r+0.1*surface.r*randn,'Edgecolor','none'); end end
unknown
d9889
train
Yes that's possbile. let el_array = document.getElementsByClassName('edit'); Then loop on el_array and apply this to each element el.contentEditable = true; A: Yes this is possible, just run a simple loop over all elements with the edit class and give them contentEditable true [...document.getElementsByClassName("edit")].forEach( el => el.contentEditable = "true" ); Thats all! Edit: as harry mentioned in the comments: forEach doesnt work on htmlCollection objects, so you must cast it to an array using [...theHTMLCollection] A: function edit_content(){ document.querySelectorAll('.myP').forEach(function(ele){ ele.contentEditable = 'true'; }) } <p class="myP"> abcdefghijklmnop </p> <button onclick="edit_content()"> Click to edit </button> you can do this. first, select all classes in the DOM by querySelectorAll then iterate that from forEach loop. A: YOu can try to find all the elements with the class name 'edit' and change all off them like below. document.querySelectorAll('.edit').forEach(function(element){ element.contentEditable = 'true'; })
unknown
d9890
train
Three issues appear to need attention. * *"time to go" needs to be stored outside the screen update function and decremented or calculated each time the screen is updated. *using parseInt to convert numbers to integer numbers is regarded as a hack by some. Math.floor() or integer calculation can be alternatives. *Timer call backs are not guaranteed to made exactly on time: counting the number of call backs for a 10msec time does not give the number of 1/100ths of elapsed time. The following code is an example of how it could work, minus any pause button action. var countdownTimer; var endTime; var counter = 0; // ** see reply item 3. ** function startCountDown( csecs) // hundredths of a second { endTime = Date.now() + 10*csecs; // endTime in millisecs decrement(); countdownTimer = setInterval(decrement, 10); counter = 0; // testing } function decrement() { var now, time, mins, secs, csecs, timeStr; ++ counter; // testing now = Date.now(); if( now >= endTime) { time = 0; timeStr = "Times up! counter = " + counter; clearInterval( countdownTimer); } else { time = Math.floor( (endTime - now)/10); // unit = 1/100 sec csecs = time%100; time = (time-csecs)/100; // unit = 1 sec secs = time % 60; mins = (time-secs)/60; // unit = 60 secs timeStr = ( (mins < 10) ? "0" + mins : mins) + ":" + ( (secs < 10) ? "0" + secs : secs) + ":" + ( (csecs < 10) ? "0" + csecs : csecs); } document.getElementById("output").innerHTML=timeStr; } The argument to startCountDown gives the number of 1/100ths of second for the count down. If the counter result is the same as the argument,try swapping browser tabs and back again during the countdown. HTML to test: <button type="button" onclick="startCountDown(600)">start</button> <div id="output"> </div>
unknown
d9891
train
I am not sure what is going on here. If I take a very simple DGEMM example (cribbed directly from the MKL fortran guide): PROGRAM MAIN IMPLICIT NONE DOUBLE PRECISION ALPHA, BETA INTEGER M, K, N, I, J PARAMETER (M=8000, K=8000, N=8000) DOUBLE PRECISION A(M,K), B(K,N), C(M,N) PRINT *, "Initializing data for matrix multiplication C=A*B for " PRINT 10, " matrix A(",M," x",K, ") and matrix B(", K," x", N, ")" 10 FORMAT(a,I5,a,I5,a,I5,a,I5,a) PRINT *, "" ALPHA = 1.0 BETA = 0.0 PRINT *, "Intializing matrix data" PRINT *, "" DO I = 1, M DO J = 1, K A(I,J) = (I-1) * K + J END DO END DO DO I = 1, K DO J = 1, N B(I,J) = -((I-1) * N + J) END DO END DO DO I = 1, M DO J = 1, N C(I,J) = 0.0 END DO END DO PRINT *, "Computing matrix product using DGEMM subroutine" CALL DGEMM('N','N',M,N,K,ALPHA,A,M,B,K,BETA,C,M) PRINT *, "Computations completed." PRINT *, "" PRINT *, "Top left corner of matrix A:" PRINT 20, ((A(I,J), J = 1,MIN(K,6)), I = 1,MIN(M,6)) PRINT *, "" PRINT *, "Top left corner of matrix B:" PRINT 20, ((B(I,J),J = 1,MIN(N,6)), I = 1,MIN(K,6)) PRINT *, "" 20 FORMAT(6(F12.0,1x)) PRINT *, "Top left corner of matrix C:" PRINT 30, ((C(I,J), J = 1,MIN(N,6)), I = 1,MIN(M,6)) PRINT *, "" 30 FORMAT(6(ES12.4,1x)) PRINT *, "Example completed." STOP END If I build the code with the Intel compiler (12.1) and run it under nvprof (note I don't have access to MKL at the moment so I am using OpenBLAS built with ifort): $ ifort -o nvblas_test nvblas_test.f -L/opt/cuda-7.5/lib64 -lnvblas $ echo -e "NVBLAS_CPU_BLAS_LIB /opt/openblas/lib/libopenblas.so\nNVBLAS_AUTOPIN_MEM_ENABLED\n" > nvblas.conf $ nvprof --print-gpu-summary ./nvblas_test ==23978== NVPROF is profiling process 23978, command: ./nvblas_test [NVBLAS] Config parsed Initializing data for matrix multiplication C=A*B for matrix A( 8000 x 8000) and matrix B( 8000 x 8000) Intializing matrix data Computing matrix product using DGEMM subroutine Computations completed. Top left corner of matrix A: 1. 2. 3. 4. 5. 6. 8001. 8002. 8003. 8004. 8005. 8006. 16001. 16002. 16003. 16004. 16005. 16006. 24001. 24002. 24003. 24004. 24005. 24006. 32001. 32002. 32003. 32004. 32005. 32006. 40001. 40002. 40003. 40004. 40005. 40006. Top left corner of matrix B: -1. -2. -3. -4. -5. -6. -8001. -8002. -8003. -8004. -8005. -8006. -16001. -16002. -16003. -16004. -16005. -16006. -24001. -24002. -24003. -24004. -24005. -24006. -32001. -32002. -32003. -32004. -32005. -32006. -40001. -40002. -40003. -40004. -40005. -40006. Top left corner of matrix C: -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 Example completed. ==23978== Profiling application: ./nvblas_test ==23978== Profiling result: Time(%) Time Calls Avg Min Max Name 92.15% 8.56855s 512 16.736ms 9.6488ms 21.520ms void magma_lds128_dgemm_kernel<bool=0, bool=0, int=5, int=5, int=3, int=3, int=3>(int, int, int, double const *, int, double const *, int, double*, int, int, int, double const *, double const *, double, double, int) 7.38% 685.77ms 1025 669.04us 896ns 820.55us [CUDA memcpy HtoD] 0.47% 44.017ms 64 687.77us 504.56us 763.05us [CUDA memcpy DtoH] I get what I expect - offload of the DGEMM call to the GPU. When I do this: $ echo "NVBLAS_GPU_DISABLED_DGEMM" >> nvblas.conf $ nvprof --print-gpu-summary ./nvblas_test ==23991== NVPROF is profiling process 23991, command: ./nvblas_test [NVBLAS] Config parsed Initializing data for matrix multiplication C=A*B for matrix A( 8000 x 8000) and matrix B( 8000 x 8000) Intializing matrix data Computing matrix product using DGEMM subroutine Computations completed. Top left corner of matrix A: 1. 2. 3. 4. 5. 6. 8001. 8002. 8003. 8004. 8005. 8006. 16001. 16002. 16003. 16004. 16005. 16006. 24001. 24002. 24003. 24004. 24005. 24006. 32001. 32002. 32003. 32004. 32005. 32006. 40001. 40002. 40003. 40004. 40005. 40006. Top left corner of matrix B: -1. -2. -3. -4. -5. -6. -8001. -8002. -8003. -8004. -8005. -8006. -16001. -16002. -16003. -16004. -16005. -16006. -24001. -24002. -24003. -24004. -24005. -24006. -32001. -32002. -32003. -32004. -32005. -32006. -40001. -40002. -40003. -40004. -40005. -40006. Top left corner of matrix C: -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -1.3653E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -3.4131E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -5.4608E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -7.5086E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -9.5563E+15 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 -1.1604E+16 Example completed. ==23991== Profiling application: ./nvblas_test ==23991== Profiling result: Time(%) Time Calls Avg Min Max Name 100.00% 768ns 1 768ns 768ns 768ns [CUDA memcpy HtoD] I get no offload to the GPU. If you can't reproduce this, then the problem is either with your compiler version (you haven't said which one you are using), if you can, then perhaps the somewhat fancier build options you are using are interacting with NVBLAS in an unexpected way
unknown
d9892
train
You ever heard of SQL Server? Like SQL Server EMBEDDED? No install ;) A: You have contradictory requirements. Small and embedded (no server) usually means SQL Server compact or SQLLite. But these are neither multi-user not network aware in practice. Especially whan you say "hundreds of multiple users" So you have to decide what you want to do. A proper, scalable, web based app with correct architecture? Or a a cheap kludgely unworkable unmaintainable mess? SQL Server Compact will scale up of course in future to normal SQL Server with minimum fuss. But I'd start with SQL Server properly now A: You can use FireBird, it can be embedded and scales well and deployment is really easy - an ADO.NET provider is available... see for more information http://www.firebirdsql.org/en/net-provider/
unknown
d9893
train
public List<string> FirstNames { get { return _contactList.Select(C => C.FirstName).ToList(); } } A: You want to use the Select method, not Where here: _contactList.Select(C => C.FirstName).ToList(); Further, the need for the ToList() only exists because the property demands it. You could return an IEnumerable<string> instead if you wanted to get rid of that.
unknown
d9894
train
I can't reproduce the problem. If I run this snippet of code: myRef.orderByKey().addValueEventListener(new ValueEventListener() { public ArrayList<Long> mDataArrayList; @Override public void onDataChange(DataSnapshot dataSnapshot) { if (mDataArrayList == null) { mDataArrayList = new ArrayList<>(); } else { mDataArrayList.clear(); } getDataChange(dataSnapshot); System.out.println(mDataArrayList); } private void getDataChange(DataSnapshot dataSnapshot){ try { for (DataSnapshot data : dataSnapshot.getChildren()){ long timestamp = Long.parseLong(data.getKey()); mDataArrayList.add(timestamp); } } catch (Exception e){ System.err.println("onDataChange Exception: " + e.toString()); } } @Override public void onCancelled(DatabaseError databaseError) { throw databaseError.toException(); } }); With this JSON: { "1476986154" : true, "1477280739" : true } It prints: [1476986154, 1477280739] Which seems the correct order to me since 1476986154 < 1477280739.
unknown
d9895
train
Seems I had automatic backup turned on but the config file was missing. So, the server looked like it started up but actually didn't. I created the config file and set enabled to false. Still didn't start up because it sees the false and stops the configuration and throws an exception because the 'delay' parameter isn't set. I think orientdb should start up without backups enabled if the config file is missing or the enabled parameter is set to false. At least the console is working now.
unknown
d9896
train
An overload of CreateFullTextQuery exists that allows you to specify the types to search: fullTextSession.CreateFullTextQuery(query, typeof(EntityA), typeof(EntityB)).List<ISearchable>(); It's a little clunky having to specify all the types, but they load fine. The only remaining problem I have is that my assumption that you could just do an all fields search by default was incorrect, so it requires building a MultiFieldQueryParser over all properties of all searchable entities: private static Query ParseQuery(string query, IFullTextSession searchSession) { var parser = new MultiFieldQueryParser(GetAllFieldNames(searchSession), new StandardAnalyzer()); return parser.Parse(query); } private static string[] GetAllFieldNames(IFullTextSession searchSession) { var reader = searchSession.SearchFactory.ReaderProvider.OpenReader( searchSession.SearchFactory.GetDirectoryProviders(typeof (Company))); var fieldNames = reader.GetFieldNames(IndexReader.FieldOption.ALL); return fieldNames.Cast<string>().ToArray(); }
unknown
d9897
train
I originally wrote a for loop that was straightforward but I incurred in the problem to delete item(i) recursively. The next item previously accessed as item(i+1) will decrease by 1, creating a strange effect of erasing several rows unexpectedly. As proposed by @absolute.madeness, below the solution that avoids that. I hope other will benefit from this solution and don't get stuck wondering why a simple loop can create such unexpected issues: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); remove = new QAction(QIcon(":/icons/remove_item.png"), "Remove", this); QObject::connect(remove, SIGNAL(triggered()), this, SLOT(on_eraseBtn_clicked())); // other operations in the constructor.... } void MainWindow::on_eraseBtn_clicked() { for(auto item: ui->listWidget->selectedItems()) if(item->text() != "Add New") delete item; } This way the user selectively erase single rows in the QListWidget leaving only a specific row.
unknown
d9898
train
Jobs are asynchronous. Your code is not. Ignoring for the moment the fact that if you're dynamically granting privileges that something in the world is creating new tables live in production without going through a change control process (at which point a human reviewer would ensure that appropriate grants were included) which implies that you have a much bigger problem... When you run the CREATE TABLE statement, the trigger fires and a job is scheduled to run. That job runs in a separate session and can't start until your CREATE TABLE statement issues its final implicit commit and returns control to the first session. Best case, that job runs a second or two after the CREATE TABLE statement completes. But it could be longer depending on how many background jobs are allowed to run simultaneously, what other jobs are running, how busy Oracle is, etc. The simplest approach would be to add a dbms_lock.sleep call between the CREATE TABLE and the SELECT that waits a reasonable amount of time to give the background job time to run. That's trivial to code (and useful to validate that this is, in fact, the only problem you have) but it's not foolproof. Even if you put in a delay that's "long enough" for testing, you might encounter a longer delay in the future. The more complicated approach would be to query dba_jobs, look to see if there is a job there related to the table you just created, and sleep if there is in a loop.
unknown
d9899
train
use the split function: string[] paths = txtattach.Text.Split(','); A: One way to do this is using the Split method so you easily can iterate over the items in a loop: foreach(var filename in txtAttach.Text.Split(',')) { // Do something with filename }
unknown
d9900
train
A different approach: final = [] for i in range(10): temp = ["." for j in range(10)] temp[int(i / 2)] = "#" temp[int(i / 2) + 1] = "#" temp[-int(i / 2) - 1] = "#" temp[-int(i / 2) -2] = "#" final.append(temp) for a in final: print("".join(a)) Will print: ##......## ##......## .##....##. .##....##. ..##..##.. ..##..##.. ...####... ...####... ....##.... ....##.... This can be made even cleaner, but here you can see all the different steps, so I hope it helps A: # 10x10 # first # start position second # start position from last # LN 0 1: 0 -1 # LN 2 3: 1 -2 # LN 2k 2k+1: k -k-1 # LN 8 9: 4 -5 # dw: dot '.' width # sw: sharp '#' width # if k == 0 part is ugly, for list slicing def draw(dw, sw): for k in range(dw//2): row = [ '.' for _ in range(dw) ] row[k:k+sw] = '#' * sw if k == 0: row[-sw:] = '#' * sw else: row[-k-sw:-k] = '#' * sw print("".join(row)) print("".join(row)) draw(10, 2) with draw(20, 2) got ##................## ##................## .##..............##. .##..............##. ..##............##.. ..##............##.. ...##..........##... ...##..........##... ....##........##.... ....##........##.... .....##......##..... .....##......##..... ......##....##...... ......##....##...... .......##..##....... .......##..##....... ........####........ ........####........ .........##......... .........##......... A: I would use itertools' product, and filter the indices that aren't relevant def v(row): return set([int(row/4), row-int(row/4), int(row/4)+1, row-int(row/4)-1]) from itertools import product indices = product(range(len(array)),range(len(array[0]))) indices = filter(lambda i: i[1] in v(i[0]), indicies) for r,c in indices: array[r][c] = "#" A: Don't know what you're trying to accomplish here, but I can do it, too: a = "##..." for i in range(10): b = ("."*int(i/2) + a)[:5] print(b + b[::-1]) A: Slightly more concise: width = 10 for i in range(width): line = ['.'] * width m = i//2 line[m] = line[m+1] = line[-m-1] = line[-m-2] = "#" print(''.join(line))
unknown