_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d2101
train
What Conrad said, you need to send the file in smaller sizes, depending on what kind pf PPC you have. That could be as small as few mb, and then write to either a storage card or the main memory. I personaly use FTP to transfer "big" files ( Ranging in the hundreds of mb ) to transfer to my PPC, but im sure you can use any other solution you may desire. But you need to research the limits of your target PPC, they often have limited memory,storage and CPU. There is also a built in http downloader class in the .net compact framework you can use.
unknown
d2102
train
Try this: select src.id ID_wo_fresh, tgt.id ID_w_fresh, src.title from tbl src inner join tbl tgt on src.title= replace(replace(tgt.title,' (fresh)',''),' (Fresh)','') and src.id <> tgt.id This will return the ID of product without 'fresh' or 'Fresh' in the name, the ID with 'fresh' or 'Fresh' in the name and the name itself. Note that this will exclude rows which don't find a match i.e. only have the name with or without suffix, but not both. To show for all rows, use left join instead.
unknown
d2103
train
Your table structure should be something like this: <table> <tr> <th>Table heading 1</th> <th>Table heading 2</th> <th>Table heading 3</th> <th>Table heading 4</th> </tr> <tr> <td>cell 1</td> <td>cell 2</td> <td>cell 3</td> <td>cell 4</td> </tr> <tr> <td>cell 1</td> <td>cell 2</td> <td>cell 3</td> <td>cell 4</td> </tr> <tr> <td>cell 1</td> <td>cell 2</td> <td>cell 3</td> <td>cell 4</td> </tr> </table> JSFiddle Demo
unknown
d2104
train
I found out the cause of this issue: Apache is configured to only listen to .htaccess on specified subdirectories, and Site #2 is not one of them.
unknown
d2105
train
Okay so to have a negative margin you can use translateX, translateY or TranslationZ. in xml like so: <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Hello World!" android:translationX="-60dp" android:translationY="-90dp" android:translationZ="-420dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> or programmatically like so: View view = ...; view.setTranslationX(-60); view.setTranslationY(-90); view.setTranslationZ(-420); Then in order to slowly bring it in from right to left you can use the animate() method like so: View view = ...; view.animate().setDuration(1000).translationX(-600).start(); A: There is a problem with setting the width of the button using app:layout_constraintWidth_percent when the ImageView has a negative margin. The problem should go away if you can set a definite width to the button (instead of 0dp). The problem should also resolve if you set app:layout_constraintWidth_percent to a value such that the text of the button shows completely on one line. Here is a simplified layout to demonstrate this issue. The ConstraintLayout has two views that are simply constrained to the parent to appear in vertical center of the layout. These two views have no dependencies on each other. In addition, the ImageView has a top margin of -250dp, so it should appear above the layout's vertical center. <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_green_light"> <ImageView android:id="@+id/redRectangle" android:layout_width="100dp" android:layout_height="30dp" android:layout_marginTop="-250dp" android:layout_marginEnd="16dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:srcCompat="@drawable/red_rectangle" /> <Button android:id="@+id/button" android:layout_width="0dp" android:layout_height="wrap_content" android:text="Button" android:textSize="18sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintWidth_default="percent" app:layout_constraintWidth_percent="0.12" /> </androidx.constraintlayout.widget.ConstraintLayout> Here is what happens then the width of the ImageView is changed from 0dp to a non-zero value of 1dp. When the width is set to 0dp, the negative margin seems to be ignored. It is only when the width is set to a non-zero value that the ImageView is correctly placed. Changing the width of the button should have no effect on the placement of the ImageView; however, the button only appears in the proper position when the button has a non-zero width. Here is what happens when the app:layout_constraintWidth_percent is increased so that the word "Button" is not cutoff. Again, the placement of the ImageView should be independent of the width of the button. Instead, the button only appears in the correct position when the app:layout_constraintWidth_percent is set such that the word "Button" is not cutoff. This is only an issue with negative margins. Positive margins work as expected. This is a strange problem, so you may want to use one of the other solutions mentioned. (ConstraintLayout version 2.1.3)
unknown
d2106
train
You can disable/suppress the warnings for imports as suggested in this answer: How to disable pylint warnings and messages on Visual Studio Code? Use --disable=reportMissingImports to disable only this kind of warnings. You can find the list of Warnings here. This comes with the downside that VS Code won't underline other packages (e.g. pandas) if it's not installed in the environment. A: First, you have to check whether you have selected the correct interpreter.(Ctrl+Shift+P then type Python:Select Interpreter). When you confirm that there is no problem, but there are still errors. If you want to disable the reminder, you can add the following codes to your settings.json: "python.analysis.diagnosticSeverityOverrides": { "reportMissingImports": "none" },
unknown
d2107
train
You can use index and slicing: s = 'HeyEveryoneImtryingtolearnpythonandihavequestion' v1 = 'Imtrying' v2 = 'andihave' start = s.index(v1) + len(v1) end = s.index(v2, start) output = s[start:end] print(output) # tolearnpython A: You can also use regex: import re s = "HeyEveryoneImtryingtolearnpythonandihavequestion" V1 = 'Imtryingto' V2 = 'andihave' a = re.search(f"{re.escape(V1)}(.*?){re.escape(V2)}", s).group(1) # 'learnpython'
unknown
d2108
train
What does URL look like? jQuery figures out it's a JSONP request by adding ?callback= or ?foo= to the url. Request.JSONP instead uses an option callbackKey. There's no method option for JSONP (in any library), since it's just injecting a script tag. var myRequest = new Request.JSONP({ url: url, callbackKey: 'callback' onComplete: function(data){} }).send(); I have a feeling, however, you aren't using JSONP, but rather XHR with JSON. If that's the case, use Request.JSON, not Request.JSONP. Edit Since it sounds, from the comments on this answer, that you're not using JSONP, just do this: new Request.JSON({ url: url, method: 'get', onSuccess: function (data){ console.log(data) } }).send() Edit 2 To change the request headers just add them as an option: new Request.JSON({ headers: { 'X-Requested-With': 'XMLHttpRequest', 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }, url: url, method: 'get', onSuccess: function (data){ console.log(data) } }).send() A: You had a syntax error in your code. var myRequest = new Request.JSONP({ url: url, method: 'get', onComplete: function(data){} }); myRequest.send(); Also, the response should be wrapped with callback function, example: http://jsfiddle.net/zalun/yVbYQ/ A: Your ajax call should be like this $.ajax({ type: "GET", url: "http://localhost:17370/SampleService.asmx/HelloWorld", data: "{}", crossDomain: true, contentType: "application/json; charset=utf-8", dataType: "jsonp", async:false, success:function(data,status){ alert(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Error Occured!" + " | " + XMLHttpRequest + " | " + textStatus + " | " + errorThrown); } }); Your server side method should not return simple string it should return response in jsonp format for that you need to follow this blog: http://msrtechnical.blogspot.in/
unknown
d2109
train
Look at WTSSendMessage(): Displays a message box on the client desktop of a specified Remote Desktop Services session.
unknown
d2110
train
It's quite simple. They allow you to write push @hashes, { ... }; f(config => { ... }); instead of my %hash = ( ... ); push @hashes, \%hash; my %config = ( ... ); f(config => \%config); (If you want to know the purpose of references, that's another story entirely.) A: Anything "anonymous" is a data structure that used in a way where it does not get a name. Your question has confused everyone else on this page, because your example shows you giving a name to the hash you created, thus it is no longer anonymous. For example - if you have a subroutine and you want to return a hash, you could write this code:- return {'hello'=>123}; since it has no name there - it is anonymous. Read on to unwind the extra confusion other people have added on this page by introducing references, which are not the same thing. This is another anonymous hash (an empty one): {} This is an anonymous hash with something in it: {'foo'=>123} This is an anonymous (empty) array: [] This is an anonymous array with something in it: ['foo',123] Most of the time when people use these things, they are really trying to magically put them inside of other data structures, without the bother of giving them a waste-of-time temporary name when they do this. For example - you might want to have a hash in the middle of an array! @array=(1,2,{foo=>3}); that array has 3 elements - the last element is a hash! ($array[2]->{foo} is 3) perl -e '@array=(1,2,{foo=>1});use Data::Dumper;print Data::Dumper->Dump([\@array],["\@array"]);' $@array = [ 1, 2, { 'foo' => 1 } ]; Sometimes you want to don't want to pass around an entire data structure, instead, you just want to use a pointer or reference to the data structure. In perl, you can do this by adding a "\" in front of a variable; %hashcopy=%myhash; # this duplicates the hash $myhash{test}=2; # does not affect %hashcopy $hashpointer=\%myhash; # this gives us a different way to access the same hash $hashpointer->{test}=2;# changes %myhash $$hashpointer{test}=2; # identical to above (notice double $$) If you're crazy, you can even have references to anonymous hashes: perl -e 'print [],\[],{},\{}' ARRAY(0x10eed48)REF(0x110b7a8)HASH(0x10eee38)REF(0x110b808) and sometimes perl is clever enough to know you really meant reference, even when you didn't specifically say so, like my first "return" example: perl -e 'sub tst{ return {foo=>bar}; }; $var=&tst();use Data::Dumper;print Data::Dumper->Dump([\$var],["\$var"]);' $var = \{ 'foo' => 'bar' }; or:- perl -e 'sub tst{ return {foo=>bar}; }; $var=&tst(); print "$$var{foo}\n$var->{foo}\n"' bar bar A: It is a reference to a hash that can be stored in a scalar variable. It is exactly like a regular hash, except that the curly brackets {...} creates a reference to a hash. Note the usage of different parentheses in these examples: %hash = ( foo => "bar" ); # regular hash $hash = { foo => "bar" }; # reference to anonymous (unnamed) hash $href = \%hash; # reference to named hash %hash This is useful to be able to do, if you for example want to pass a hash as an argument to a subroutine: foo(\%hash, $arg1, $arg2); sub foo { my ($hash, @args) = @_; ... } And it is a way to create a multilevel hash: my %hash = ( foo => { bar => "baz" } ); # $hash{foo}{bar} is now "baz" A: You use an anonymous hash when you need reference to a hash and a named hash is inconvenient or unnecessary. For instance, if you wanted to pass a hash to a subroutine, you could write my %hash = (a => 1, b => 2); mysub(\%hash); but if there is no need to access the hash through its name %hash you could equivalently write mysub( {a => 1, b => 2} ); This comes in handy wherever you need a reference to a hash, and particularly when you are building nested data structures. Instead of my %person1 = ( age => 34, position => 'captain' ); my %person2 = ( age => 28, position => 'boatswain' ); my %person3 = ( age => 18, position => 'cabin boy' ); my %crew = ( bill => \%person1, ben => \%person2, weed => \%person3, ); you can write just my %crew = ( bill => { age => 34, position => 'captain' }, ben => { age => 28, position => 'boatswain' }, weed => { age => 18, position => 'cabin boy' }, ); and to add a member, $crew{jess} = { age => 4, position => "ship's cat" }; is a lot neater than my %newperson = ( age => 4, position => "ship's cat" ); $crew{jess} = \%newperson; and of course, even if a hash is created with a name, if its reference is passed elsewhere then there may be no way of using that original name, so it must be treated as anonymous. For instance in my $crew_member = $crew{bill} $crew_member is now effectively a reference to an anonymous hash, regardless of how the data was originally constructed. Even if the data is (in some scope) still accessible as %person1 there is no general way of knowing that, and the data can be accessed only by its reference.
unknown
d2111
train
Use a TreeSet with a custom comparator. Also, you should not work with Multi-dimensional arrays, use Maps (Name -> Score) or custom Objects A: Hey, if your array is sorted, u can use the Collections.binarySearch() or Arrays.binarySearch() method to guide u at what index to make the insertion. The way these method work is to make a binary search after an existing element, and if the element cannot be found in the collection it will return a value related to the insertion point. More info here Collections.binarySearch
unknown
d2112
train
You could try setting the TypoScript option config.absRefPrefix to /domain/www.example.com/ See http://buzz.typo3.org/people/soeren-malling/article/baseurl-is-dead-long-live-absrefprefix/ and http://wiki.typo3.org/TSref/CONFIG
unknown
d2113
train
The addMapPolygon() method of JMapViewer works for this, but paintPolygon() silently rejects a polygon having fewer than three vertices. For a line between two points, just repeat the last Coordinate. Coordinate one = new Coordinate(...); Coordinate two = new Coordinate(...); List<Coordinate> route = new ArrayList<Coordinate>(Arrays.asList(one, two, two)); map.addMapPolygon(new MapPolygonImpl(route)); A: I am also working on this software and using the JMapviewer.jar. Yet, I do not seem to have the addMapPolygon nor the MapPolygonImpl ... Is there a specific version I should be working with ? (I downloaded my version here: enter link description here
unknown
d2114
train
Just create style for Path, and apply it. A: There's an easier, built-in way to do this. Set x:Shared="False" on the resource. This will allow it to be reused. Then use it as many times as you want. <UserControl.Resources> <ResourceDictionary> <Path x:Shared="False" x:Key="N44" Width="20" Height="80" Stretch="Fill" Fill="#FF000000" Data="..."/> </ResourceDictionary> </UserControl.Resources> A: I've since found that I had missed an important part of the documentation from MSDN: Shareable Types and UIElement Types: A resource dictionary is a technique for defining shareable types and values of these types in XAML. Not all types or values are suitable for usage from a ResourceDictionary. For more information on which types are considered shareable in Silverlight, see Resource Dictionaries. In particular, all UIElement derived types are not shareable unless they come from templates and application of a template on a specific control instance. Excluding the template case, a UIElement is expected to only exist in one place in an object tree once instantiated, and having a UIElement be shareable would potentially violate this principle. Which I will summarise as, that's not the way it works because it’s not creating a new instance each time I execute that code – it’s only creating a reference to the object – which is why it works once but not multiple times. So after a bit more reading I’ve come up with 3 potential ways for a resolution to my problem. 1) Use a technique to create a deep copy to a new object. Example from other StackOverflow Question - Deep cloning objects 2) Store the XAML in strings within the application and then use the XAML reader to create instances of the Paths: System.Windows.Shapes.Path newPath = (System.Windows.Shapes.Path)System.Windows.Markup.XamlReader.Parse("<Path xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Width='20' Height='80' Stretch='Fill' Fill='#FF000000' Data='M 20,25.2941L 20,29.4118L 15.9091,29.4118L 15.9091,40L 12.2727,40L 12.2727,29.4118L 2.54313e-006,29.4118L 2.54313e-006,25.6985L 13.4872,7.62939e-006L 15.9091,7.62939e-006L 15.9091,25.2941L 20,25.2941 Z M 12.2727,25.2941L 12.2727,5.28493L 2.09517,25.2941L 12.2727,25.2941 Z M 20,65.2941L 20,69.4118L 15.9091,69.4118L 15.9091,80L 12.2727,80L 12.2727,69.4118L -5.08626e-006,69.4118L -5.08626e-006,65.6985L 13.4872,40L 15.9091,40L 15.9091,65.2941L 20,65.2941 Z M 12.2727,65.2941L 12.2727,45.2849L 2.09517,65.2941L 12.2727,65.2941 Z ' HorizontalAlignment='Left' VerticalAlignment='Top' Margin='140,60,0,0'/>"); LayoutRoot.Children.Add(newPath); 3) Only store the Path data in the Resource Dictionary. Create a new instance of a Path in code, apply the Path data to the new Path and then add the other properties I am interested in manually. The XAML - The Path data is stored as a StreamGeometry: <UserControl.Resources> <ResourceDictionary> <StreamGeometry x:Key="N44">M 20,25.2941L 20,29.4118L 15.9091,29.4118L 15.9091,40L 12.2727,40L 12.2727,29.4118L 2.54313e-006,29.4118L 2.54313e-006,25.6985L 13.4872,7.62939e-006L 15.9091,7.62939e-006L 15.9091,25.2941L 20,25.2941 Z M 12.2727,25.2941L 12.2727,5.28493L 2.09517,25.2941L 12.2727,25.2941 Z M 20,65.2941L 20,69.4118L 15.9091,69.4118L 15.9091,80L 12.2727,80L 12.2727,69.4118L -5.08626e-006,69.4118L -5.08626e-006,65.6985L 13.4872,40L 15.9091,40L 15.9091,65.2941L 20,65.2941 Z M 12.2727,65.2941L 12.2727,45.2849L 2.09517,65.2941L 12.2727,65.2941 Z</StreamGeometry> </ResourceDictionary> </UserControl.Resources> The C# code to then create an instance and apply the other values: System.Windows.Shapes.Path bPath = new System.Windows.Shapes.Path(); bPath.Data = (System.Windows.Media.Geometry)this.FindResource("N44"); bPath.Width = 20; bPath.Height = 80; bPath.VerticalAlignment = System.Windows.VerticalAlignment.Top; bPath.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; left = left + 40; System.Windows.Thickness thickness = new System.Windows.Thickness(left,100,0,0); bPath.Margin = thickness; bPath.Fill = System.Windows.Media.Brushes.Black; LayoutRoot.Children.Add(bPath);
unknown
d2115
train
Do not mix db thinking with PHP code design.. Regulary the property should be set to the object itself rather then to its id. Like this: class Order { /** * @var Contact */ protected $contact; public function __construct(Contact $contact) { $this->contact = $contact; } } But there are reasons when it might make sense to just have to id of the contact. The best example would be that the contact has to be fetched from database, but you regulary don't need its information, expect of special cases. Then it might be useful to only have the id as class property and fetch the contact if required. (Known as 'lazy loading'). Note that 'lazy loading' could be hidden behind the scenes by a framework.
unknown
d2116
train
Why don't you use a debug mode? Change, your the time rate you use in order to not wait too much, but I think you could determine that yourself, could you?
unknown
d2117
train
JWT can be revoked, so next time you log in lockout will kick in. Lockout is a log in/sign in process concept. After logging in you can get your token for authN/authZ activities.
unknown
d2118
train
you can get the height of the outermost window by using window.top in the jQuery. The height of window.top will get the height of the browser window or iframe inside it. $(window.top).height();
unknown
d2119
train
Using Jquery: $('input[type="submit"]').attr('disabled','disabled'); and $('a').attr('disabled','disabled'); like this A: You can attempt to prevent the default action on as many events as you like. Note that browsers usually allow this, but do have the final say (I vaguley remember some issues with this not always working). var events = ["keypress","click","submit","focus","blur","tab"]; events.forEach(function(eventName){ window.addEventListener(eventName, function(e){ // this is the list of tags we'd like to prevent events on // you may wish to remove this early return altogether, as even a div or span // can cause a form to submit with JavaScript if (["INPUT","A","FORM","BUTTON"].indexOf(e.tagName) === -1) { return; } // prevent the default action e.preventDefault(); // stop other JavaScript listeners from firing e.stopPropagation(); e.stopImediatePropagation(); // if an input is somehow focused, unfocus it var target = e.target; setTimeout(function(){ if (target.blur) target.blur(); }, 50); // true as the third parameter signifies 'use capture' where available; // this means we get the event as it's going down, before it starts to bubble up // our propagation prevention will thus also prevent most delegated event handlers }, true); }); You cannot solve this with CSS. pointer-events doesn't allow you to specify which pointer events are okay. For that, you do need JavaScript.
unknown
d2120
train
The built-in HTTP server ran by php -S is not Apache, thus there's no .htaccess nor mod_rewrite or any fancy stuff
unknown
d2121
train
Seeing cyclic redundancy in your code! Forward declaration should resolve the issue. Another way: #ifndef COMMON_H #define COMMON_H #include "anim.h" struct Sprite { }; struct Map { }; #endif #ifndef SPRITE_H #define SPRITE_H #include "common.h" void InitSprite(Sprite* sp, Charset* c, float x, float y, int nbstats); /* ... */ #endif #ifndef MAP_H #define MAP_H #include "common.h" #include "mario.h" #include "sprite.h" void Load_Tiles(Map* m, Charset* c, const char* fichier, int largeur_monde, int hauteur_monde); /* ... */ #endif
unknown
d2122
train
May be you can try this pytest_order pip install pytest-order After installing you can mark on your classes. https://pytest-dev.github.io/pytest-order/stable/usage.html#markers-on-class-level In the each python file on each class specify the order as said @pytest.mark.order(1) class test_onerodtraction: @pytest.mark.order(1) class test_onerodtorsion: @pytest.mark.order(1) class test_onerodbending: and now @pytest.mark.order(2) class test_onerodallcharges: and then @pytest.mark.order(3) class test_examples.py: A: I would recommend using pytest-dependency * *With order if you want to add a test case in middle, reordering will be required. *parallel execution wont be effective. https://pytest-dependency.readthedocs.io/en/stable/usage.html
unknown
d2123
train
Change your query to: $park = $wpdb->get_row("SELECT COUNT(1) as count FROM wp_richreviews WHERE review_status='1'"); and get count value with something like $park['count']; A: You have made life a little difficult for yourself by not giving the result column a nice easily accessible name If you change your query so the column has a known name like this $park = $wpdb->get_row("SELECT COUNT(1) as count FROM wp_richreviews WHERE review_status='1'"); then you have a nice easily accessible property called count echo $park->count;
unknown
d2124
train
What about create GridView column first... https://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn(v=vs.110).aspx and then AddChild method? https://msdn.microsoft.com/en-us/library/system.windows.controls.gridview(v=vs.110).aspx
unknown
d2125
train
I dont think it's really a problem of your application.. I think it's more about how Chrome is treated such invocations. Being on your place I would go for winpai SHELLEXECUTE solution. And #ifdef is not really ugly comparing with benefits that you move default browser invocation to operation system rather then on Qt library.
unknown
d2126
train
It is hard to tell what you're trying to do here but what's the data type of data? It looks like you're not getting past the try statement (good use of a try/except to handle Exceptions!) so the issue I think lies in the way you're indexing the items (d) in data. Think about it: if data didn't exist (meaning you didn't initialize it in your code for your program to use), how can you try to index it later on? Also, it's weird that you're not getting a NameError as I don't see data defined anywhere unless you cropped out where it was defined earlier (unless my eyes are tricking me). General Programming principles: * *Iterable Objects: String, List, Dictionary, etc... *Non-iterable Objects: Integer, Float, Boolean, etc... (depending on programming language) Iterable data types are ones that you can index using bracket notation ([]) so in any case, you'll need to know the types of your variables and then use the correct "processes" to work with them. Since you are indexing items in data, the data type of data therefore, needs to be an iterable too. In general, an IndexError means that you've tried to access/index an item in a list for example but that item didn't exist. Therefore, I think that trying to string AND index an item in an object that doesn't exist is giving you that error. Here's what I think would help: If I could see where you have data defined, I would be able to tell you where you may be going wrong, but for now, I can only recommend you going back to see whether you've indexed an item in d in data that doesn't exist. An example (I will assume data is a list for clarity): >>> data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] >>> data[0] # index a list in d in data [1, 2, 3] >>> data[0][1] 2 # If you try to access an index in data that doesn't exist: >>> data[3] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list index out of range I probably over-explained by now, so I'll just end this here. The above implementation was to give you an idea of how to access a list in a list correctly and when it isn't properly done what can happen. Hope this is clear!
unknown
d2127
train
Have a look at the COLLECT AQL command, it can return the count of documents that contain duplicate values, such as your id key. ArangoDB AQL - COLLECT You can use LET a lot in AQL to help break down a query into smaller steps, and work with the output in future queries. It may be possible to also collapse it all into one query, but this technique helps break it down. LET duplicates = ( FOR d IN myCollection COLLECT id = d.id WITH COUNT INTO count FILTER count > 1 RETURN { id: id, count: count } ) FOR d IN duplicates FOR m IN myCollection FILTER d.id == m.id RETURN m This will return: [ { "_key": "416140", "_id": "myCollection/416140", "_rev": "_au4sAfS--_", "id": 1, "name": "Mike" }, { "_key": "416176", "_id": "myCollection/416176", "_rev": "_au4sici--_", "id": 1, "name": "Robert" } ]
unknown
d2128
train
This sounds like a perfect use case for Java based bean configuration: @Configuration class DemoConfiguration { @Bean fun createProtocolService(): ProtocolService { val protocolPort: String? = System.getProperty("ProtocolPort", System.getenv("ProtocolPort")) val protocolHost: String? = System.getProperty("ProtocolHost", System.getenv("ProtocolHost")) return if(!protocolHost.isNullOrEmpty() && !protocolPort.isNullOrEmpty()) { YesBean() } else { NoBean() } } } open class ProtocolService class YesBean : ProtocolService() class NoBean : ProtocolService() You might also want look into Externalized Configurations to replace System.getProperty() and System.getenv(). This would then look like this: @Configuration class DemoConfiguration { @Bean fun createProtocolService(@Value("\${protocol.port:0}") protocolPort: Int, @Value("\${protocol.host:none}") protocolHost: String): ProtocolService { return if (protocolHost != "none" && protocolPort != 0) { YesBean() } else { NoBean() } } }
unknown
d2129
train
This should help: http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html EDIT: One more thing. I'm pretty sure that when you use Reports Server you should not use Server.MapPath. Just specify the path as you see it in Reports Server, in your case: /ReportingofUsers/ExpenseClaimReport. That is assuming that you publish reports to the server.
unknown
d2130
train
You can use function annotations for Python3: def return_locals_rpc_decorator(fun): def decorated_fun(*args, **kw): local_args = fun(*args, **kw) print(local_args) fun_parameters = fun.__annotations__ final_parameters = {a:list(args)[int(b[-1])-1] for a, b in fun_parameters.items() if a != 'return'} return final_parameters return decorated_fun @return_locals_rpc_decorator def my_funct(a:"val1", b:"val2", c:"val3") -> int: return a + b + c print(my_funct(10, 20, 30)) Output: 60 {'a': 10, 'b': 20, 'c': 30} In this way, you are using the wrapper function decorated_fun to access the decorated function's parameters and further information specified by the annotation. I changed the parameter descriptions in the annotations so that each string value would end in a digit that could be used to index args. However, if you do not want to change the parameter descriptions in the annotations, you can sort via ending character. Edit: the code in the body of my_funct is executed when called in the wrapper function (decorated_fun), since the args, declared in the scope of decorated_fun is passed to and unpacked in local_args.
unknown
d2131
train
ns = [] while not ns or ns[-1] != -9999: ns.append(int(input("Please, enter number {}(-9999 to end")))) A: ns = list(iter(lambda:int(input("Enter Number:")),-9999)) is a cool way to do it iter can take a sentinal value to wait for as a second argument, if you use a function for the first argument as an aside with your positive and negatives .... it seems it will ignore zeros (which may be intentional)... A: This code will loop while you add numbers to your list and stop when you enter -9999. It will then throw the -9999 away so you can get on with your averaging. It's not compact, but it works and it's simple. numbers = [] while True: numbers.append(input("Enter a number: ")) #append user input to 'numbers' if numbers[-1] == -9999: #check to see if the last number entered was -9999 numbers = numbers[:-1] #if it was, modify numbers to exclude it break # and break the loop
unknown
d2132
train
When you write an image that contains one or more partitions, you also write the partition table, which is expected to be at some offset or your memory by u-boot (according to this post it must be 0x60000000). So if you write your image again somewhere else, u-boot will still refer to the partition table from your first writing operation, which itself contains the memory address of your first 4 partitions. Your second partition table is somewhere else on the disk, but u-boot doesn't know. You can try to repair the partition table using the testdisk command line utility. It will scan the whole disk and hopefully it will find that there is 8 partitions in total, and create a new partition table at 0x60000000 that refers to all of them.
unknown
d2133
train
Something like this should work: while ($NumberOfProfiles -ge 0) { $DestinationDirectory = Join-Path $WhereToWrite "$Foldername$NumberOfProfiles" Copy-Item $SourceDirectory $DestinationDirectory -Recurse -Container $NumberOfProfiles-- } Or, probably even simpler, something like this: 0..$NumberOfProfiles | % { $DestinationDirectory = Join-Path $WhereToWrite "$Foldername$_" Copy-Item $SourceDirectory $DestinationDirectory -Recurse -Container } A: This should do it for you: replace: while ($NumberOfProfiles -ge 0) {$Copy; $NumberOfProfiles--} with: (0..$NumberOfProfiles) | % { Copy-Item $SourceDirectory "$WhereToWrite$_" -Recurse -Container } This will loop around from 0 to $NumberOfProfiles and copy to a location named $WhereToWrite with the iteration number attached $_
unknown
d2134
train
Re-query with same filters as in 1 in Z Thread. Return results in Main Thread. Okay so this is completely unnecessary because you can create a RealmQuery and store a field reference to the RealmResults, add a RealmChangeListener to it, and when you insert into Realm on the background thread, it will automatically update the RealmResults and call the RealmChangeListener. So you don't need to "re-query with same filters in Z thread" (because Realm's findAllSortedAsync() already queries on a background thread), and you don't need to manually return results in main thread because findAllSortedAsync() already does that. Solution: use Realm's notification system (and async query API). Read the docs: https://realm.io/docs/java/latest/#notifications
unknown
d2135
train
These messages include no sensitive data that the database user should not see. So I wouldn't worry, unless perhaps you show the information to the application user rather than logging them. Your database user may have access to information that the application user shouldn't see.
unknown
d2136
train
I think that you want a left join and conditional logic: select v.*, case when w.lot# is null then 0 else 1 end flag from vehicle v left join whishlist w on w.userid = @user and w.lot# = v.lot_ You can easily integrate this query in your stored procedure and add the row-limiting clause. A: I recommend using EXISTS: SELECT v.*, (CASE WHEN EXISTS (SELECT 1 FROM wishlist wl WHERE v.lot# = wl.lot_ AND wl.userid = @user ) THEN 1 ELSE 0 END) as Flag FROM vehicle1 v ORDER BY v.lot# OFFSET (@limit - 1)*10 ROWS FETCH NEXT 10 ROWS ONLY; I think it better captures the logic that you want. I also suspect that it might work better with ORDER BY and FETCH.
unknown
d2137
train
You can use Awk, provided you force the use of the C locale: LC_CTYPE=C awk '! /[^[:alnum:][:space:][:punct:]]/' my_file The environment variable LC_TYPE=C (or LC_ALL=C) force the use of the C locale for character classification. It changes the meaning of the character classes ([:alnum:], [:space:], etc.) to match only ASCII characters. The /[^[:alnum:][:space:][:punct:]]/ regex match lines with any non ASCII character. The ! before the regex invert the condition. So only lines without any non ASCII characters will match. Then as no action is given, the default action is used for matching lines (print). EDIT: This can also be done with grep: LC_CTYPE=C grep -v '[^[:alnum:][:space:][:punct:]]' my_file A: With GNU grep, which supports perl compatible regular expressions, you can use: grep -P '^[[:ascii:]]+$' file A: You can use egrep -v to return only lines not matching the pattern and use something like [^ a-zA-Z0-9.,;:-'"?!] as pattern (include more punctuation as needed). Hm, thinking about it, a double negation (-v and the inverted character class) is probably not that good. Another way might be ^[ a-zA-Z0-9.,;:-'"?!]*$. You can also just filter for ASCII: egrep -v "[^ -~]" foo.txt A: Perl supports an [:ascii:] character class. perl -nle 'print if m{^[[:ascii:]]+$}' inputfile
unknown
d2138
train
You can use SUMPRODUCT: =SUMPRODUCT(ISNUMBER(SEARCH("/FP_T",$C$2:$C$4))*($D$2:$D$4="Step3CallerAndCalleeClassTracesImpliesMethodTracePattern"))
unknown
d2139
train
This is an error because you use same declaration component in 2 modules AppModule and LoginPageModule. If you need to use 2 components in different modules you can try to use sharedModule where you can add your component and import sharedModule when you need it. A: You have declared LoginPage in both LoginPageModule and AppModule. Remove it from One module. A: Go in your app.module.ts file and remove LoginPage from the declarations A: Removed the LoginPage declaration from AppModule and got the result.
unknown
d2140
train
You can use the CursorMoved and CursorMovedI autocommands to set the desired textwidth (or any other setting) based on the line the cursor is currently on: augroup gitsetup autocmd! " Only set these commands up for git commits autocmd FileType gitcommit \ autocmd CursorMoved,CursorMovedI * \ let &l:textwidth = line('.') == 1 ? 50 : 72 augroup end The basic logic is simple: let &l:textwidth = line('.') == 1 ? 50 : 72, although the nested autocommands make it look rather funky. You could extract some of it out to a script-local function (fun! s:setup_git()) and call that, if you prefer. The &:l syntax is the same as setlocal, by the way (but with setlocal we can't use an expression such as on the right-hand-side, only a simple string). Some related questions: * *Line number specific text-width setting. *Set paste mode when at beginning of line but auto-indent mode when anywhere else on the line? Note that the default gitcommit.vim syntax file already stops highlighting the first line after 50 characters. From /usr/share/vim/vim80/syntax/gitcommit.vim: syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell [..] hi def link gitcommitSummary Keyword Only the first 50 lines get highlighted as a "Keyword" (light brown in my colour scheme), after that no highlighting is applied. If also has: syn match gitcommitOverflow ".*" contained contains=@Spell [..] "hi def link gitcommitOverflow Error Notice how it's commented out, probably because it's a bit too opinionated. You can easily add this to your vimrc though: augroup gitsetup autocmd! " Only set these commands up for git commits autocmd FileType gitcommit \ hi def link gitcommitOverflow Error \| autocmd CursorMoved,CursorMovedI * \ let &l:textwidth = line('.') == 1 ? 50 : 72 augroup end Which will make everything after 50 characters show up as an error (you could, if you want, also use less obtrusive colours by choosing a different highlight group).
unknown
d2141
train
Don't bother with hooks for this. Simply define a push mirror. This is available in CE version if you wonder (only pull mirrors need the EE version). Go to your repo > settings > repository > mirroring settings and just follow the guide. The only very small drawback I have experienced so far is that there is a 5 minutes limit between pushes. But it is rarely a blocker in real life as you can still push manually to all your remotes if you really need to. Reference: https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html
unknown
d2142
train
Assuming var some_values = new [] { "Value1", "Value2", "value3" }; Then: data.Where(x => some_values.Contains(x)) Or: from x in data where some_values.Contains(x) select x;
unknown
d2143
train
Replace your line: var latlon = new google.maps.LatLng (position.coords.latitude + "," + position.coords.longitude); with var latlon = new google.maps.LatLng (position.coords.latitude, position.coords.longitude); The problem is in concatenating two values into one where constructor expects two parameters.
unknown
d2144
train
Yes. Many of the Python threading examples are just about this idea, since it's a good use for the threads. Just to pick the top four Goggle hits on "python threads url": 1, 2, 3, 4. Basically, things that are I/O limited are good candidates for threading speed-ups in Python; things the are processing limited usually need a different tool (such as multiprocessing). A: You can do this using any of: * *the thread module (if your task is a function) *the threading module (if you want to write your task as a subclass of threading.Thread) *the multiprocessing module (which uses a similar interface to threading) All of these are available in the Python standard library (2.6 and later), and you can get the multiprocessing module for earlier versions as well (it just wasn't packaged with Python yet).
unknown
d2145
train
FROM https://github.com/Spaceface16518/Converse/issues/22 "I think you have to deploy it in the deploy session" A: First you must allow anonymous login Allow Users to login anonymously Click on the review and deploy changes at the top of the stitch UI Review and deploy changes A: You need to go Stitch Apps > Users > Providers > Allow users to login anonymously and enable that option.
unknown
d2146
train
I think that the problem is with cache. You can try running the site in an incognito/private window of your browser. You can also inspect the page and see if the new styles are loaded. You can also try Empty Cache and Hard Reload option when you right click the reload button on chrome browser while inspecting. A: one way you can prevent it is by doing all your css in the actual html file like so <head><style></style></head>
unknown
d2147
train
There are a few steps to ensure your page methods will work. * *Ensure you have a script manager defined with page methods enabled <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True" /> *Define your code behind with the web method attribute [System.Web.Services.WebMethod] public static bool authUser(string uid,string pass) { return true; // Do validation returning true if authenticated } *Define methods in client script to call the web method. PageMethods.authUser(uid, pass, function(result) { /* succeed */ }, function(error) { });
unknown
d2148
train
Synchronous HTTP requests halt execution of subsequent code while they are en route. While browsers may no longer block the UI during this time, we're relying on the user's available bandwidth, network reliability, and the server's current load for the performance of our code. This is generally not good practice. as i have found from this link may this will help you please look at this https://softwareengineering.stackexchange.com/questions/112551/should-we-still-consider-a-synced-xmlhttprequest-bad-practice you should also reffer to https://webtide.com/xmlhttprequest-bad-messaging-good/
unknown
d2149
train
Your defined __eq__ method enables you to compare class instances like this: if course_a == course_b: # Do something When comparing two lists, you call list.__eq__ method instead. If this list contains your Courses objects (btw, you should use singular form, as it is single Course), they will be compared using your defined __eq__ method. This means, that you can just compare [course_a, course_b] == [course_a, course_c] and it should work as you intented. class Example: def __init__(self, arg1, arg2): self.arg1 = arg1 self.arg2 = arg2 def __eq__(self, other): return self.arg1 == other.arg1 and self.arg2 == other.arg2 # Initialize two instances with identical arguments. one = Example('x', 'y') two = Example('x', 'y') print(one == two) # True a = [one] b = [two] print(a == b) # Also True P.S. Check out @dataclass(eq=True) as it does pretty much the same thing
unknown
d2150
train
You want to use the TextRenderer version since DrawString should really only be used for printing: TextRenderer.DrawText(e.Graphics, e.Value.ToString(), e.CellStyle.Font, e.CellBounds, e.CellStyle.ForeColor, TextFormatFlags.NoPrefix | TextFormatFlags.VerticalCenter); The NoPrefix flag will show the ampersand correctly.
unknown
d2151
train
I finally figured it out...only took a couple of days but I've been too busy to post up a solution. We'll I finally got time and am happy to post my solution. I had a hunch that this would'nt work unless it was done 100% programmatically, and I was right. Here's the final solution to my problem: if(mute == YES) { UIImage *image = [UIImage imageNamed:@"audio-off.png"]; UIButton *myMuteButton = [UIButton buttonWithType:UIButtonTypeCustom]; myMuteButton.bounds = CGRectMake( 0, 0, image.size.width, image.size.height ); [myMuteButton setImage:image forState:UIControlStateNormal]; [myMuteButton addTarget:self action:@selector(mute) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *myMuteBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:myMuteButton]; navBar.leftBarButtonItem = myMuteBarButtonItem; [myMuteBarButtonItem release]; } else { UIImage *image = [UIImage imageNamed:@"audio-on.png"]; UIButton *myUnmuteButton = [UIButton buttonWithType:UIButtonTypeCustom]; myUnmuteButton.bounds = CGRectMake( 0, 0, image.size.width, image.size.height ); [myUnmuteButton setImage:image forState:UIControlStateNormal]; [myUnmuteButton addTarget:self action:@selector(mute) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *myUnmuteBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:myUnmuteButton]; navBar.leftBarButtonItem = myUnmuteBarButtonItem; [myUnmuteBarButtonItem release]; } the good news is I finally finished my app and submitted it to the app store. Hopefully everything will go smooth and am looking forward to it! A: Swift, I set mine around an instance var, and used that to toggle my switch. I also had 3 buttons in my nav bar. private var activeStaff:Staff? { didSet { let image = (activeStaff == nil) ? UIImage(named: "active")! : UIImage(named: "notActive")! let button = UIBarButtonItem(image: image, style: .Plain, target: self, action: "activePressed:") if navigationItem.rightBarButtonItems?.count == 3 { navigationItem.rightBarButtonItems?.removeAtIndex(0) } navigationItem.rightBarButtonItems?.insert(button, atIndex: 0) } }
unknown
d2152
train
You're problem is that you are doing this on the wrong end of things -- you should be filtering all user input of potentially hostile content when you receive it. The first rule of thumb when doing this is "always whitelist, never blacklist". Rather than allowing any and all attributes in your user-generated HTML, simply keep a list of allowed attributes and strip away all others when you receive the HTML (possibly on the client side -- definitely on the server side.) Oh, and HTML is not a regular language. You'll want to use an HTML parser, not a regular expression for this task. A: .unbind will only unbind events attached using jQuery. You can get rid of inline event handler code by setting them to null, e.g.: $("preventjs *").removeAttr("onclick").removeAttr("onmouseover"); Demo. EDIT: Here's an evil solution, you can remove all attributes starting with "on": $("preventjs *").each(function() { var attribs = this.attributes; var that = this; $.each(attribs, function(i, attrib) { if(attrib.name.indexOf("on") === 0) { $(that).removeAttr(attrib.name); } }); }); Demo. A: The problem is that you've inline handlers. unbind cannot remove inline handlers. <p onclick="alert('evil stuff'... ^^^^ To remove inline handlers, use removeAttr $("preventjs").find("*").removeAttr('onclick'); $("preventjs").find("*").removeAttr('onmouseover'); A: You can unbind the events individually: $('p').each(function(){ this.onclick = this.onmouseover = undefined; }); If you want to unbind other events like mouseout you have to add them to that list: $('p').each(function(){ this.onclick = this.onmouseover = this.onmouseout = undefined; }); Of course you'll want to use a selector other than $('p'), I just didn't want to put your other one because preventjs is not an HTML tag
unknown
d2153
train
Try this WdInlineShapeType.wdInlineShapeEmbeddedOLEObject
unknown
d2154
train
Using RAII(Resource Acquisition is Initialization) Add a destructor to the Contained class: Contained::~Contained() { delete data; } This will ensure whenever your contained object goes out of scope, it will automatically delete the data pointer it has. So if you do //delete first element rooms.erase(rooms.begin()); data ptr of that object will automatically be deleted. Using smart pointers Use std::unique_ptr<T>. class Contained { private: std::unique_ptr<Data> data; public: Contained(); // what should I add ? a copy constructor ? an assignement operator ? and how }; and in the constructor: Contained::Contained() { data = std::make_unique<Data>(); } Using smart pointers i.e., (unique_ptr, shared_ptr) ensures your pointer will automatically delete when no one is owning it. Since you can not copy unique_ptr but only move it, you should define a move constructor and move assignment operator on the Contained class. Contained::Contained(Contained&& other) : data(std::move(other.data)) {} Contained& operator=(Contained&& rhs) { if (this != &other) { data = std::move(rhs.data); } return *this; }
unknown
d2155
train
I can't tell, but my DJoin function found here and this query: SELECT ItemNo, DJoin("[DocumentNo]","[Query3]","[ItemNo] = '" & [ItemNo] & "'"," | ") AS DocumentNos, Quantity FROM Query3 GROUP BY ItemNo, Quantity HAVING Count(*) >=2; will provide this output:
unknown
d2156
train
There is probably no good reason to have a method accepting only GString as input or output. GString is meant to be used interchangeably as a regular String, but with embedded values which are evaluated lazily. Consider redefining the method as: void foo (String baa) void foo (CharSequence baa) //more flexible This way the method accepts both String and GString (GString parameter is automagically converted to String as needed). The second version even accepts StringBuffer/Builder/etc. If you absolutely need to keep the GString signature (because it's a third party API, etc.), consider creating a wrapper method which accepts String and does the conversion internally. Something like this: void fooWrapper (String baa) { foo(baa + "${''}") } A: You can create overloaded methods or you can use generics; something as below: foo("Hello from foo GString ${X}") foo("Hello from foo") MyClass.foo("Hello from foo GString ${X}") MyClass.foo("Hello from foo") // method with GString as parameter void foo(GString g) { println("GString: " + g) } // overloading method with String as parameter void foo(String s) { println("String: " + s) } // using generics class MyClass<T> { static void foo(T t) { println(t.class.name + ": " + t) } }
unknown
d2157
train
You need to re-write all of the members/methods in the interface and add the abstract keyword to them, so in your case: interface baseInter { name: string; test(); } abstract class abs implements baseInter { abstract name: string; abstract test(); } (code in playground) There was a suggestion for it: Missing property declaration in abstract class implementing interfaces but it was declined for this reason: Although, the convenience of not writing the declaration would be nice, the possible confusion/complexity arising from this change would not warrant it. by examine the declaration, it is not clear which members appear on the type, is it all properties, methods, or properties with call signatures; would they be considered abstract? optional? A: You can get what you want with a slight trick that defeats the compile-time errors: interface baseInter { name : string; test(); } interface abs extends baseInter {} abstract class abs implements baseInter{ } This trick takes advantage of Typescript's Declaration Merging, and was originally presented here and posted on a related SO question here. A: Interfaces are used for defining a contract regarding the shape of an object. Use constructor to pass in properties to the class interface BaseInter { name : string; test(): boolean; } abstract class Abs implements BaseInter { constructor(public name: string) {} test(): boolean { throw new Error('Not implemented') } }
unknown
d2158
train
You could strip the trailing x and z and split on xz: st.strip('xz').split('xz') # ['abc', 'ghf'] A: Using regex. Ex: import re st = "zzabcxzghfxx" print(re.findall(r"z+(.*?)(?=x)", st)) #or print([[i] for i in re.findall(r"z+(.*?)(?=x)", st)]) Output: ['abc', 'ghf'] A: Does it have to be recursive? Here's a solution using itertools.groupby. from itertools import groupby string = "zzabcxzghfxx" def is_good_char(char): return char not in "zx" lists = [["".join(char for char in list(group))] for key, group in groupby(string, key=is_good_char) if key] print(lists) Output: [['abc'], ['ghf']] EDIT - Just realized that this might not actually produce the desired behavior. You said: [a] list is enclosed in 'z' and 'x' Which means a sublist starts with 'z' and must end with 'x', yes? In that case the itertools.groupby solution I posted will not work exactly. The way it's written now it will generate a new sublist that starts and ends with either 'z' or 'x'. Let me know if this really matters or not. A: st.replace("z", "[").replace("x", "]")
unknown
d2159
train
In your controller add pagination library, logic create offset & limit, and load view of listing like wise... (Place normal pagination code here) Write this jquery code on your view to load different pages : <script> $(function(){ $("#pagination-div-id a").click(function(){ $.ajax({ type: "POST", url: $(this).attr("href"), data:"q=<?php echo $searchString; ?>", success: function(res){ $("#containerid").html(res); } }); return false; }); }); </script> like wise... You need to do some dig & dag over here.. But this way is working for me. Here is one link for reference & detailed example : http://ellislab.com/forums/viewthread/122597/
unknown
d2160
train
g00se is right. My issue is solved. I had to parse the values from formula. Iterator<Row> itr = sheet.iterator(); while (itr.hasNext()) { Row row = itr.next(); //iterating over each column Iterator<Cell> cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); CellType cellType = cell.getCellType(); if (cell.getCellType() == CellType.FORMULA) { switch (cell.getCachedFormulaResultType()) { case NUMERIC: System.out.print(cell.getNumericCellValue() + "\t\t"); break; case STRING: System.out.print(cell.getRichStringCellValue() + "\t\t"); break; } } switch (cell.getCellType()) { case STRING: //field that represents string cell type System.out.print(cell.getStringCellValue() + "\t\t"); break; case NUMERIC: //field that represents number cell type if (DateUtil.isCellDateFormatted(cell)) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); System.out.print(dateFormat.format(cell.getDateCellValue()) + "\t\t"); } else { double roundOff = Math.round(cell.getNumericCellValue() * 100.0) / 100.0; System.out.print(roundOff + "\t\t"); } break; case BLANK: break; default: } } System.out.println(""); } }
unknown
d2161
train
You should try using Application Gateway V2, its a lot faster to create. updates are almost instantaneous (well, at least compared to V1). But I believe V1 is using windows VM's underneath, so it creates a set of vms for you, then it configures them. Each update would be a "sliding window" update, with 1 vm being recreated at a time. As far as I know. A: Application Gateway is a layer 7 load balancer which, as far as I understand, is a Windows VM (or collection of Windows VMs, depending on selected size) under the covers, which take some time to come up and be configured. In my experience, this time is usually around 15-30 minutes, depending on region and local time of day, capacity, etc. Azure Load balancers on the other hand are layer 4 load balancers, which typically take in the order of 1-2 minutes to come up. A: So, yes talking about the load balancer if you say it normally takes less than a minute to get deployed. But coming onto the Application gateway yeah it takes 15-20 minutes every time the reason being: * *Configuration Settings: Microsoft has the set of the vacant load balancers ready at their backend and when they receive a request to deploy a particular load balancer in any region, they just assign it an IP as requested by the user and it gets deployed within a minute. But coming onto the Application gateway, azure need to start deploying the load balancer [App Gateway in this case] from the scratch, need to attach it to the VNET so deployed and making it ready for the backend pools IP Address configuration and all, which basically take time about [15-20 minutes]. Now, Azure has brought up the V2 of the Application Gateway, a lot faster to create usually 5 minutes. And also talking about updates they are also really quick and instantaneous. *Subscriptions: Secondly, the reason that it takes time is subscription. Suppose, you have the MSDN, free subscription in your Azure account. And another individual sitting at any different place is using the enterprise applications subscription [basically a pay as you go] in his azure account. Now, both of you raise a request to deploy an Application gateway in the same region at the same time then, Microsoft will give the person request with the enterprise subscription the higher priority than your free subscription request. Which is another reason that it results in a delay. As I am using the enterprise edition so it takes 2 minutes for a VM to deploy which gets deployed in 5-6 minutes if using the free subscription! Thanks!
unknown
d2162
train
A dash is not a valid character in variable name. Use underscore instead. todays_date=$(date '+%F') You can use the variable directly with cd, no echo needed: cd "$todays_date" To save the output of a command to a file, use redirection: wc -l * > ~/"$todays_date"_wordcount.txt
unknown
d2163
train
Try changing the property from (nonatomic, weak) NSMutableString *title; NSMutableString *date; to (nonatomic, strong) should solve your problem. A: -(void) ViewDidLoad { [super ViewDidLoad]; parser = [Parser alloc] init]; You Reallocated and reinitialised parser, is there any part of the code that you are reloading data? If not your data store will be empty. A: My suggestions: * *Please check, if your tableView's delegate and dataSource are set up correctly. I haven't seen that in your code. *Please check, what cell class is registered to your table view. I mean, you need to use tableView's registerClass:forCellReuseIdentifier: or registerNib:forCellReuseIdentifier: somewhere. Anyway, I'm used to work with GUI without IB or storyboards (so, I'm doing everything programmatically), so it's possible that you don't need to do that. Good luck. A: I have similar issue before. the cause of my problem is that my view controller get released after I scroll my table view, can you please check if you have same cause? A: Try to do the below: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString * MyIdentifier = @"ArticleCell"; ArticleCell *cell = [tableView dequeueReusableCellWithIdentifier: MyIdentifier]; Article *article = [parser items][indexPath.row]; cell.title.text = article.title; cell.date.text = article.date; return cell; } A: The problem is that the identifier used should be static string So declare an identifier which is statisc and assign it static NSString *cellId = @"cellIdentifier"; ArticleCell *cell = [tableView dequeueReusableCellWithIdentifier: cellId]; Also make sure the storyboard cell has the same identifier value.ie here 'cellIdentifier' A: Check what happens with [[parser items] count] when you scroll. My guess is that it decreases which decrease the row count in your table. I may be wrong here because I don't know what's Parser (probably your custom class?) but in case if it is used to parse HTTP response, perhaps item count decreases when the parsing has been done? To check parser item count, add the following to your tableView:cellForRowAtIndexPath: NSLog(@"Parser item count: %d", parser.items.count);
unknown
d2164
train
It's a bug in the Blink & Webkit implementations. From the spec: "audioprocess events are only dispatched if the ScriptProcessorNode has at least one input or one output connected." It doesn't need both. For now, just connect it to a zero-gain GainNode connected to the audiocontext.destination.
unknown
d2165
train
It is way easier than I thought: Just use <animated.polygon ... /> instead of <animated.svg .../>
unknown
d2166
train
As for best practices, "avoid triggers like the plague" is the best advice I could give you. What I've done in a similar situation is to add a column that indicates that a row is now archived. I used a datetime column called ArchivedDt. Normal queries exclude this column like: where ArchivedDt is null You can even do this in a view. The hierarchical data is still there, and a specific archive run can be easily undone.
unknown
d2167
train
Windows stores list of all fonts in registry: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts". By default, fonts are referenced with file name only in these registry records and windows automatically searches them in fonts directory, but probably you can add fonts from other folders also by their full path.
unknown
d2168
train
Store the value from first selectmenu, then look for it in the second one. Select it using .prop('selected', true); and then call .selectmenu('refresh'). Demo $(document).on('pageinit', function () { $(document).on('change', '#ddl1', function () { var selected = $(this).val(); $('#ddl2 option[value="' + selected + '"]').prop('selected', true); $('#ddl2').selectmenu('refresh'); }); }); I used pageinit which is equivalent to .ready(). It is a special event for jQM. A: Have you checked that the change function is actually being called. Is the script you provide the entire contents of the script tag? The function will not be bound to the event until it is loaded, using the $(document).ready(); will bind the event to the control. $(document).ready(function() { $("#<%= ddl1.ClientID %>").change(function() { var Code = $(this).val(); $("#<%= ddl2.ClientID %>").val(Code); }); });
unknown
d2169
train
You are getting two errors of You must bind Parsley on an existing element. but those errors are not related to the code you posted. In your ...js/site.js you have the following code: $(document).ready(function() { $('.slider').flexslider({controlNav: false,slideshowSpeed: 3000,directionNav: true}); $('input').iCheck({checkboxClass: 'icheckbox_square-yellow',radioClass: 'iradio_square-yellow',increaseArea: '20%'}); $('#newsletter_signup').parsley(); $('#request_a_quote').parsley(); $('#contact').parsley(); var form = $('#newsletter_signup'); (...) You are binding parsley to three elements with the following ids: newsletter_signup, request_a_quote and contact. The thing is, in the current page you only have the element newsletter_signup. If you do a console.log($('#request_a_quote')) you will see an empty object. So, to fix your issue, you need to remove the code that binds parsley to non-existent elements. Or you could change your code in order to bind parsley only if the element exist. Something like this: $(document).ready(function() { $('.slider').flexslider({controlNav: false,slideshowSpeed: 3000,directionNav: true}); $('input').iCheck({checkboxClass: 'icheckbox_square-yellow',radioClass: 'iradio_square-yellow',increaseArea: '20%'}); if ($('#newsletter_signup').length > 0 ) $('#newsletter_signup').parsley(); if ($('#request_a_quote').length > 0 ) $('#request_a_quote').parsley(); if ($('#contact').length > 0 ) $('#contact').parsley(); var form = $('#newsletter_signup'); (...)
unknown
d2170
train
If they are different and not connected in anyway, the best thing in my opinion is to have their own seperate projects because it would be easier to deal with the webserver (like nginx) and the other options would just make everything more complicated.
unknown
d2171
train
It's hard to tell what your variables are and how you intend to use them without seeing your declarations. Here's how I set up a grayscale palette in SDL_gpu: SDL_Color colors[256]; int i; for(i = 0; i < 256; i++) { colors[i].r = colors[i].g = colors[i].b = (Uint8)i; } #ifdef SDL_GPU_USE_SDL2 SDL_SetPaletteColors(result->format->palette, colors, 0, 256); #else SDL_SetPalette(result, SDL_LOGPAL, colors, 0, 256); #endif The result SDL_Surface already has a palette because it is has an 8-bit pixel depth (see note in https://wiki.libsdl.org/SDL_Palette). A: It has been awhile since the OP posted the question and there has been no accepted answer. I ran into the same issue while trying to migrate a SDL 1.2 based game into using 2.0. here is what I did hoping it could help other who may be facing similar issue: Replace: SDL_SetColors(screen, color, 0, intColors); With: SDL_ SDL_SetPaletteColors(screen->format->palette, color, 0, intColors); David
unknown
d2172
train
This is now @DateTimeFormat as well which supports some common ISO formats A: Use @DateTimeFormat(pattern="yyyy-MM-dd") where yyyy is year, MM is month and dd is date public @ResponseBody List<Student> loadStudents(@DateTimeFormat(pattern="yyyy-MM-dd") Date birthDay) { ... } A: Use @DateTimeFormat("MMddyyyy") public @ResponseBody List<RecordDisplay> getRecords( @RequestParam(value="userID") Long userID, @RequestParam(value="fromDate") @DateTimeFormat(pattern="MMddyyyy") Date fromDate, @RequestParam(value="toDate") @DateTimeFormat(pattern="MMddyyyy") Date toDate) { A: You should use your application.properties (or any other project properties) and set the environment variable spring.mvc.format.date.
unknown
d2173
train
I would suggest using exists: select u.* from users u where exists (select 1 from checks c where c.user_id = u.id and c.checkin_date >= '2016-01-01' );
unknown
d2174
train
You get zero because you have a pre-C++11 compiler. Leaving the input value unchanged on failure is new in the latest standard. The old standard required the following: If extraction fails, zero is written to value and failbit is set. If extraction results in the value too large or too small to fit in value, std::numeric_limits::max() or std::numeric_limits::min() is written and failbit flag is set. (source) For gcc, you need to pass -std=c++11 to the compiler to use the new behavior.
unknown
d2175
train
I can see this file in TBB repo: https://github.com/01org/tbb/blob/tbb_2017/include/tbb/internal/_flow_graph_types_impl.h Please make sure that your installation of TBB is not damaged. Off-topic advice, there is a data-race in your program on sum and you can use lambda instead of explicit functor: int main(int argc, const char * argv[]) { float arr[4] = {1,3,9,27}; atomic<float> sum = 0; // fixing data-race. Still, it's not recommended way parallel_for(0, 4, [&](int i){ sum += arr[i]; }); cout<< sum << endl; } See also tbb::parallel_reduce in order to make this code correct, clean, and efficient.
unknown
d2176
train
Check the Issue Tracker Unexpected "authorization is required" error from google.script.run after installing Sheets add-on while logged into multiple gmail.com accounts * *Comment #114, has a workaround for add-ons *Comment #117, has another workaround for add-ons You haven't mentioned what you are trying to accomplish, but there may be a workaround there. Another idea might be to make an intermediate page that will serve as a sort of "landing page" that can remind your users about this issue and then re-direct them to the Web App. If you use cookies or the local storage API, then you could have it redirect immediately if they have seen it within the last few days. Current known status of the bug I seem to remember seeing somewhere, though I can't find it now, that the Apps Script team were planning on starting work to fix this in 2021.
unknown
d2177
train
Okay, this was silly of me. The pointers I was passing were pointing to the heap but they were pointers to pointers. The final data was sitting on the stack, so I was losing that data because of the additional function calls I introduced. I've properly allocated the data onto the heap now and it seems to be working now.
unknown
d2178
train
Ok so i figured out the problem. I was saving the code in an html file using wordpad and saving it in format Unicode. When I saved the file using notepad and format ANSI, everything is ok. Took me the entire morning to figure this out!!!
unknown
d2179
train
If my understanidng is correct you mean to say you want to show the message to the user, try following: if((senha == null) || (senha.trim().length() == 0)) { campoBranco = true; FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR, "Senha não informada!","Preencha a senha e tente novamente!")); return null; } this is what you have to add return null; so that it will stay in the same page and show up the message, As you are trying to navigate to the login page once agin after getting the error also, it will simply navigate rather than showing error messages. as well try to modify in the xhtml as suggested below: and in your xhtml: <p:growl id="growlLoginValidationStatus" showDetail="true" sticky="false" autoUpdate="true" life="4000" redisplay="false" showSummary="true" globalOnly="false" /> and remove your <p:message/> tag and make ajax as false in your command button. try this, if still not able to show the message, let me know in comment A: It seems like you're updating the wrong id. <h:form id="login" > <p:commandButton value="Login" update="loginForm" action="#{loginBean.loginAction}"/> </h:form> In this case, you need to change loginForm to login or change the id of your form to loginForm.
unknown
d2180
train
Solved: instead of: public Image Image{ get; set;} as other ppl have suggested, I used public Image Image{ get { return image; } set { image = value; btn1.Image = image; } }
unknown
d2181
train
From Mule-3.6 on wards, we have HTTP Listener Connector, using which you can pass URI parameters. You can access the URI parameters using the below MEL #[message.inboundProperties.'http.uri.params'.id] provided your URI should be like this: http://localhost:8086/idnum/{id} A: You need to put the id as a message inbound parameter as following .. In Mule flow you need to do the following :- <flow name="test"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8086" path="idnum" doc:name="HTTP"/> <!-- storing id in variable myId --> <set-variable variableName="myId" value="#[message.inboundProperties['id']]" doc:name="Variable"/> <!-- Print the variable in console --> <logger level="INFO" message="My id :- #[flowVars['myId']]"/> </flow> Now in browser access http://localhost:8086/idnum/?id=4583948364094 Now you can store it in a variable in Mule and you can see it in a logger like: My id :- 4583948364094
unknown
d2182
train
Use the AND operator (&&) which only executes the right operand when the left operand is truthy. It is not necessary to make a variable called dummy. { datas && datas.map(data=>{ console.log(data); }); }
unknown
d2183
train
Instead of doing: $('#contact_form_div').html(data); Do this: $('#contact_form_div').append(data); Then you just need to make sure on your PHP that you only return one new row. A: Instead of replacing the current form, append the new lines generated by your PHP script. So you need to use $('#contact_form_div').append(data); instead of $('#contact_form_div').html(data);. After you change that, you can use the num parameter to specify the number of rows to be added. A: Don't ask for the whole form on every request. Keep the page you have now to do the first load of the form when you load the page. Then, make a php page that outputs a single row of results, request it via ajax as you have done, then append the result to the current html of the page. A: replace this: $('#contact_form_div').html(data); with this : $('#contact_form_div').append(data); You just need to append it not to replace it. hope it help :)
unknown
d2184
train
You can configure Kafka to use AUTHBEARER which is implemented in latest kafka release , You can find more info how to configure here . And also get more information about the feature from Kafka doc You need to implement org.apache.kafka.common.security.auth.AuthenticateCallbackHandler to get token from keycloak and validate token from Keycloak.
unknown
d2185
train
All display objects have 'cacheAsBitmap' and 'cacheAsBitmapMatrix' propertiues that help with performance, but only for certain class of objects (primarily those not frequently changed). More info: Caching display objects Also, make sure you have HW acceleration turned on for maximum benefit, especially on mobile: HW acceleration
unknown
d2186
train
As documented in quite a few places - notably the part about cross validation -, cleaned_data only contains valid data - the fields that didn't validate wont show up here. You have to account for this one way or another - by testing for key existence or, as shown in the cross-validation example snippet, using dict.get(): def clean(self): cleaned_data = super(MyForm, self).clean() # boolean algebra 101: "not A and not B" => "not (A or B)" if not (cleaned_data.get('url1') or cleaned_data.get('url2')): raise ValidationError( _("You should enter at least one URL"), code='no_urls' ) return cleaned_data
unknown
d2187
train
The compilation was resolved with the following replacement. #option(CURL_STATICLIB "Set to ON to build libcurl with static linking." ON) if(WIN32) add_definitions("-DCURL_STATICLIB") endif() set(CURL_LIBRARY "-lcurl") find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIR}) if(LIBCURL_ENABLE) target_link_libraries(app ${CURL_LIBRARIES}) endif()
unknown
d2188
train
I actually ran into a very similar issue last night when I was working with a Xamarin.Forms application in Xamarin Studio. I had recently updated the Xamarin.Forms and Xamarin.Android.Support.v4 packages in my Android project when it started happening. I believe what I did to get it to work again (I tried a number of things so I'm not exactly sure which one actually fixed it) was to go into my Android project and delete the references to both Xamarin.Forms and Xamarin.Android.Supoort.v4. Then I went into "Manage NuGet Packages" and I added the official Xamarin.Forms library. Since the Xamarin.Android.Support.v4 package is a dependency it pulled that down for me as well. I cleaned and rebuilt my project and I got passed the error.
unknown
d2189
train
Based on your description (example data and expected output would be better), this would work: sleep_cycle[sleep_cycle['name'].str.startswith['B']]
unknown
d2190
train
For the A problem, you could count the number of white pixels in each column and each row. The columns/rows with the highest number of white pixels are where the borders of your rectangle are. (Assuming that the rectangle sides are parallel to the sides of the image) For B and C the hint is to start with Bitmap aImage; // Initialize with your images using (Graphics g = Graphics.FromImage(aImage)) { // Do stuff } And then you can find and overload of Graphics.DrawImage to scale and draw your images atop of each other. To count the number of pixels you can use the GetPixel method. // Sketchy code // Calculate each column in sum[x] [x,y] = b.Size; for(x ...) for(y ..) if (aImage.GetPixel(x, y) == Color.White) sum[x]++; A: Here is a snippet on draing an image over another image. (No credit i took it from here) Bitmap bmp = Bitmap.FromFile(initialFileName); // This draws another image as an overlay on top of bmp in memory. // There are additional forms of DrawImage; there are ways to fully specify the // source and destination rectangles. Here, we just draw the overlay at position (0,0). using (Graphics g = Graphics.FromImage(bmp)) { g.DrawImage(Bitmap.FromFile(overlayFileName), 0, 0); } bmp.Save(saveAsFileName, System.Drawing.Imaging.ImageFormat.Png); Now on how to locate a large white rectangle inside an image? This bit is a little trickier. There is a library which can do this for you
unknown
d2191
train
For the newer versions of React Native you have to import Bundle and place your own onCreate Method like this: // Added Bundle to use onCreate which is needed for our Fabrics workaround import android.os.Bundle; .......... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Fabrics Fabric.with(this, new Crashlytics()); } Not sure if this is good or not since they have removed the onCreate but it works for me A: I got it working in some way, but it may not be the perfect solution... 1: Add fabric/crashlytics into your app/build.gradle - File (I didn´t have the buildscript in my app/build.gradle so i just included it. But i am not sure if this is good....) buildscript { repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' // The Fabric Gradle plugin uses an open ended version to react // quickly to Android tooling updates classpath 'io.fabric.tools:gradle:1.+' } } // Add this directly under: apply plugin: "com.android.application" apply plugin: 'io.fabric' // and this directly under: apply from: "react.gradle" repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } // Last but not least add Crashlytics Kit into dependencies compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true } 2: The most important, because it is nowhere mentioned (or i didn´t find it anywhere), import Crashlytics and Fabric into MainActivity: import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; 3: In your onCreate - method add: // Fabrics Fabric.with(this, new Crashlytics()); When you´ve done this, you will at least get Crashreports which are caused by native Code (Java Code). Crashes which are caused through JS - Syntax or similar wont be notified. There you will get the known RedBox :P Good luck! A: Try this : https://fabric.io/kits/android/crashlytics/install Summarizes all the files you need to edit in your Android installation well. For the AndroidManifest.xml file, replace the android:value key (e.g. below) with your actual API key. Remember to get your API key from your organization settings... 1. login to https://fabric.io/settings/organizations and 2. click on build secret. <meta-data android:name="io.fabric.ApiKey" android:value="<api key here>" />
unknown
d2192
train
Please check your content of cour variable item2 containing the url. I guess, that this variable contains a line break at the end. Try to just print this variable with a leading and trailing char. If so, you can either replace the new line character in item2 or try to substring the content. A: To remove any unwanted characters from the input strings, you can trim them, or do a character replacement. For example, to remove CR/LF from the end of strings (untested, from memory); numb = numbtxt.Text.TrimEnd( {vbCr, vbLf, vbCrLf, Environment.Newline} ) or to remove all occurrences; year = yeartxt.Text.Replace(vbCrLf, String.Empty) or; year = yeartxt.Text.Replace(vbCr, String.Empty).Replace(vbLf, String.Empty) etc. YMMV depending on the actual CR/LF character arrangments and language settings!
unknown
d2193
train
You could use a dict of lists that looks like this: objectives_in = {"victory": [], "defeat": []} You can use it similar to what you have in your example: objectives_in[outcome].append(game['stats']['objectives_taken']) # Example stats: count = len(objectives_in["victory"]) print("Number of victories:", count) print("Average objectives:", sum(objectives_in["victory"]) / count)
unknown
d2194
train
I ended up using the following, but my gut feeling is there is a better way. if (typeof window !== "undefined") { // This code is rendered in browser vs server }
unknown
d2195
train
What you need is communication between the components. * *Create a service with a BehaviourSubject and subscribe it in the Dashboard component where in you can fetch the response again. *Whenever you add a new record from the modal, emit the value and you will get a hit in dashboard where you have subscribed to get the grid data again. This way you won't have to reload the page also. A: After doing your stuff you can use Router.Navigate as used below: constructor() {private _router: Router} this._router.routeReuseStrategy.shouldReuseRoute = () => { return false; }; // to reload your component on same page this._router.navigate(['/fsf']); // this will work
unknown
d2196
train
The name of the parameter jdbcTemplateOne has no bearing on the injection. So both parameters are asking for the same thing. There are multiple templates thus Micronaut doesn't know which one to inject. In your factory you can create a template for each datasource with @EachBean(DataSource.class) JdbcTemplate jdbcTemplateOne(DataSource dataSource) { return new JdbcTemplate(dataSource); } Then the named qualifier of the datasource will transfer to the template. That means in your example you could inject @Named("database2") JdbcTemplate jdbcTemplate. Alternatively you can add @Named qualifiers to the factory methods and then inject the jdbc templates with those qualifiers. A: Change your repository constructor like below @Inject public CodeSetRepository(@Named("database2") JdbcTemplate jdbcTemplateOne) { this.jdbcTemplateOne = jdbcTemplateOne; }
unknown
d2197
train
You can order the group before selecting the first record: var qryLatestInterview = from rows in dt.AsEnumerable() group rows by new { PositionID = rows["msbf_acc_cd"], CandidateID = rows["msbf_fac_tp"], } into grp select grp.OrderBy(x=> x["msbf_fac_dt"]).First(); A: If I understand correctly, you want to get recent facilitated record from this list, you could do ordering after grouping and take first record. dt.AsEnumerable() .GroupBy(row => new { PositionID = rows["msbf_acc_cd"], CandidateID = rows["msbf_fac_tp"] }) .Select(x=>x.OrderByDescending(o=>o["msbf_fac_dt"]>).FirstOrDefault() .ToList();
unknown
d2198
train
Assuming the plans are stored in a table named plan_table in a column named execution_plan you can use the following: select replace(substring(execution_plan from '\(cost=[0-9]+'), '(cost=', '') from plan_table; The substring(...) returns the first occurrence of (cost= and the replace is then used to remove that prefix. A: I get successful and the solution, the obcjetive was get the value 27726324.41, the Expression Regular final developted is: select substring('Aggregate (cost=27726324.40..27726324.41 Rows' from '[.]Y*([0-9]+.?[0-9]{2})') RESULT 27726324.41 Thanks a_horse_with_no_name and anothers that help-me.
unknown
d2199
train
I believe your goal is as follows. * *From I want the user to click the button "Open in Google Sheet" and open the CSV as a spreadsheet., you want to retrieve the text value from the textarea tab and create a Google Spreadsheet using the text value, and then, want to open the Google Spreadsheet. In order to achieve your goal, how about the following flow? * *Retrieve the text value from the textarea tab. *Send the text value to Web Apps created by Google Apps Script. *At Web Apps, a new Google Spreadsheet is created and the text value is put to the sheet. *In order to open the created Spreadsheet, change the permission of the Spreadsheet. In this case, it is publicly shared as the read-only. This is the sample situation. *Return the URL of the Spreadsheet. When this flow is reflected in the script, it becomes as follows. Usage: 1. Create a new project of Google Apps Script. Sample script of Web Apps is a Google Apps Script. So please create a project of Google Apps Script. If you want to directly create it, please access https://script.new/. In this case, if you are not logged in to Google, the log-in screen is opened. So please log in to Google. By this, the script editor of Google Apps Script is opened. 2. Sample script. Please copy and paste the following script to the created Google Apps Script project and save it. This script is used for Web Apps. In this sample, the value is sent as the POST request. function doPost(e) { const csv = Utilities.parseCsv(e.postData.contents); const ss = SpreadsheetApp.create("sample"); ss.getSheets()[0].getRange(1, 1, csv.length, csv[0].length).setValues(csv); DriveApp.getFileById(ss.getId()).setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW); return ContentService.createTextOutput(ss.getUrl()); } 3. Deploy Web Apps. The detailed information can be seen at the official document. * *On the script editor, at the top right of the script editor, please click "click Deploy" -> "New deployment". *Please click "Select type" -> "Web App". *Please input the information about the Web App in the fields under "Deployment configuration". *Please select "Me" for "Execute as". * *This is the importance of this workaround. *Please select "Anyone" for "Who has access". * *In this case, the user is not required to use the access token. So please use this as a test case. *Of course, you can also access to your Web Apps using the access token. Please check this report. *Please click "Deploy" button. *Copy the URL of the Web App. It's like https://script.google.com/macros/s/###/exec. * *When you modified the Google Apps Script, please modify the deployment as a new version. By this, the modified script is reflected in Web Apps. Please be careful this. *You can see the detail of this in the report of "Redeploying Web Apps without Changing URL of Web Apps for new IDE". 4. Testing. As the test of this Web Apps, I modified your script as follows. Before you use this script, please set the URL of your Web Apps to url. When you open this HTML and click the button, a new Spreadsheet including the text value in the textarea tab is opened with new window as the read-only. <textarea id="sampletext" value="f">id,value 2,alpha 3,beta 14,test</textarea> <button onclick="sample()">Open in Google Sheet</button> <script> function sample() { const url = "https://script.google.com/macros/s/###/exec"; // Please set the URL of your Web Apps. fetch(url, { method: "POST", body: document.getElementById("sampletext").value }) .then((res) => res.text()) .then((url) => window.open(url, "_blank")); } </script> Note: * *When you modified the Google Apps Script, please modify the deployment as a new version. By this, the modified script is reflected in Web Apps. Please be careful this. *You can see the detail of this in the report of "Redeploying Web Apps without Changing URL of Web Apps for new IDE". *My proposed script is a simple script. So please modify it for your actual situation. References: * *Web Apps *Taking advantage of Web Apps with Google Apps Script
unknown
d2200
train
You can do the same with the PHP cURL extension. You just need to set the options through curl_setopt, so you would do something like this $url = "http://www.google.com/trends/topcharts/trendingchart"; $fields = "ajax=1&cid=actors&geo=US&date=201310"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); Now you have the response of the website in $data and you can do whatever you want with it. You can find the PHP cURL documentation on http://php.net/curl A: Try this // Complete url with paramters $url = "http://www.google.com/trends/topcharts/trendingchart?ajax=1&cid=actors&geo=US&date=201310"; // Init session $ch = curl_init(); // Set options curl_setopt($ch, CURLOPT_URL, $url); // Set option to return the result instead of echoing it curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Execute session $data = curl_exec($ch); // Close session curl_close($ch); // Dump json decoded result var_dump(json_decode($data, true));
unknown