query_id
stringlengths
4
64
query_authorID
stringlengths
6
40
query_text
stringlengths
66
72.1k
candidate_id
stringlengths
5
64
candidate_authorID
stringlengths
6
40
candidate_text
stringlengths
9
101k
e20e46349b1da08460f2efa30a615cf924449a91f6e0287291798002c03de993
['04bd9cbb03cd4d0d8172e2779a2a58af']
OS: Arch Linux kernel 4.7.6-1 GPU Driver: AMDGPU 1.1.2-1 Xorg version: 1.18.4-1 Blender version: 2.78.a-1 (latest in official Arch repo) I'm 100% sure Xorg is loading the GPU driver based on the log file /var/Xorg/Xorg.1.log. I've enabled OpenCL with: CYCLES_OPENCL_SPLIT_KERNEL_TEST=1 blender and then I selected my GPU under User Preferences > System > Compute Device > OpenCL > AMD FIJI GPU. Under the scene settings, I switched Compute device from CPU to GPU. And I of course switched to Cycles Engine. When trying to render things, however, blender throws an error about being unable to find the CPU known as FIJI and renders nothing. How do I get my Fury X to render in blender on Linux? I don't have an integrated GPU on my CPU, so unless only one process can deal with the GPU at a time (which shouldn't be the case), Xorg should be able to share my GPU with blender.
4cad8a03fd2aa38bba4903c5e07fb8e3ba189ddf314f1cab093f73e11fa69769
['04bd9cbb03cd4d0d8172e2779a2a58af']
I have a class that includes the following: try { stuff.... }catch(Exception e){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()+'ERROR')); } } I'm trying to catch the error message in a test class to bring the code coverage to 75%. try { STUFF to PURPOSEFULLY BREAK...... System.assert(false, 'Exception expected'); } catch (DmlException e) { String message = e.getMessage(); System.assert(e.getMessage().contains('ERROR'), 'message=' + e.getMessage()); } Yet nothing happens.
c247d5ce64f830fc27adc056a1646849ce0452aaca49fe95bf681f176acda431
['04c16df7cdd6479d853b398ddfe584d5']
In short, if I use a <PERSON> model I would need to calculate the marginal effects for the betas in order to be able to interpret the data properly. This can be easily achieved using major statistical software packages. However, from what I understood, I cannot use those marginal effect procedures with interaction or quadratic terms. And my main hypotheses depend on those non-linear terms. Thus, while the <PERSON> model results are helpful in showing the significance and direction of the effects, I cannot interpret the results properly. [1 of 2]
6cfd1aa031fb2c62a76040acbbc1d0e69cea0663b4f720cf59c57b5d002e9422
['04c16df7cdd6479d853b398ddfe584d5']
This is why I thought of using a linear model which doesn't suffer from this issue, given of course that the method I described is not flawed, which is why I asked the question (otherwise I'll omit from using the method). As for the <PERSON> model suggestion, my outcome is actually a time measurement (time it takes to complete service), so it is a continuous variable. In the case of zero observed value, it simply means that the worker didn't engage in the optional service stage. [2 of 2]
fbae44852332bba5658afbb065bd0967ebfbb08bec50298a6a06db13cd095ba1
['04e574cf971c43649cccc481f835c50d']
I have to save highlighted text from textarea into database on click event how can i do it. I found some code from so but it doesn't work for me. $('#send').on("click", function(){ ShowSelection(); }); function ShowSelection() { var textComponent = $('#my-content span').val(); console.log(textComponent); var selectedText; if (textComponent.selectionStart !== undefined) {// Standards Compliant Version var startPos = textComponent.selectionStart; var endPos = textComponent.selectionEnd; selectedText = textComponent.value.substring(startPos, endPos); } else if (document.selection !== undefined) {// IE Version textComponent.focus(); var sel = document.selection.createRange(); selectedText = sel.text; } alert("You selected: " + selectedText); }
529c0a0aff7150827e512dd475010f80e163bbc95f6b8e083f84ff81a62073c8
['04e574cf971c43649cccc481f835c50d']
I have a chat box and i have to keep scroll bar always on bottom of chat also if there is a new message coming scroll bar automatically scroll to bottom. The code i am using scrolled chat box only half also when a new message popup it doesn't scroll to bottom. $('#chat_history_'+to_user_id).stop().animate({ scrollTop: $('#chat_history_'+to_user_id)[0].scrollHeight}, 1000);
a43a86196c56e040a9568f2834b4e3ebc856ec2a623c3a244428626c491a0d06
['04f796e8b2de4f6486ab800e100a3dec']
Here is an example of how to do that: import java.io.FileWriter; import java.io.PrintWriter; import java.io.IOException; public class Foo { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(new FileWriter("myFile.html")); out.println("<u><i>my output</i></u>"); out.flush(); out.close(); } }
2497d0b7e15ddadca497baf9a2e9507d5d4050eeaaee635a1449c30ac736464d
['04f796e8b2de4f6486ab800e100a3dec']
I have a home page called index.php.. And a registration page called registration.php. The index.php has some logic in it that needs to be executed inorder for the site to work properly. So lets say the url is http://www.testwebsite.com and the registration url is: So lets say the url is http://www.testwebsite.com/registration.php When a user just immediately navigates to So lets say the url is http://www.testwebsite.com/registration.php the logic in index.php gets bypassed and is not executed and causes problems. So question now.. Is there a way for me to redirect them to the index.php page if they ever go to the registration.php link directly? So the code has to check and see if the index.php webpage was hit first, if it was not hit then it should redirect to index.php. But, if the index.php site was already hit then it should just continue and not redirect back to index.php.
1cb00ea2a970070960707f3dbc50aee18a586eca2b32913718296a78b3a4f437
['050123451a31441384f72003cde1aebd']
The best way to know when finish a socket connection is to try to read something. If read method return -1 you can end threadling socket connection byte[] data = new byte[2048]; while (!done) { int count = input.read(data); if (count <= 0) { if (count < 0) done = true; continue; } String request = new String(data, 0, count); //do stuff } We try to read something in input if count == -1, the socket client is disconnected now we can end the loop, by changing the value of done.
ca968efec2dd0bd2fdf402bc91880c7a0ac8355d5f65ea97141571d45fd6d832
['050123451a31441384f72003cde1aebd']
I think you have complicated your writer. Just use FileWriter. See bellow: String path = "/path/"; FileWriter writer = new FileWriter(path + dateiname + ".csv"); writer.append("data1;data2;data3"); writer.flush(); writer.close(); You can see this page is more detailled: https://www.mkyong.com/java/how-to-export-data-to-csv-file-java/ Cheers
6339ab46e0cd3aa9bb2cba872d4b9b63d8fe8cf4472f908009a9e39b79d2632c
['0507108263b7468abdfbae8967a25e46']
http://jsfiddle.net/xwF6E/14/ Above is a JSfiddle of an animation i'm trying to create. It's works 100% fine in Chrome, however having various issues in other browsers. It appears that in firefox it doesn't render the animation. As per the the Mozilla Dev Network docs @ https://developer.mozilla.org/en-US/docs/DOM/window.requestAnimationFrame , i believe i've added cross browser support but perhaps i'm doing something wrong. In IE (8 + 10, at least) it does not render the animation, nor my radial gradient (also a side issue if anyone can help). IE gives me a IndexSizeError error on this line of code var imageData = context.createImageData(context.canvas.width, context.canvas.height); But i'm not sure what that means specifically, and I can't find much regarding that error/that method. Anyone able to enlighten me please? Cheers
bfb22f305316cd78656d206be7be431dca5f8abebfbe040ef9b046ea5d00a5b8
['0507108263b7468abdfbae8967a25e46']
After trying about a million different solutions that all basically led back to the problem of.. It's a pain to check if a user is authenticated before the 401 error is sent - as there is an initial 401 sent to the browser which then prompts for it for authentication.. I came up with a quick and dirty solution, as the project is small and not worth investing much more in. I placed a very simple check in the page_load event like so, that checks for username if it isn't a postback (first load), and redirects if the static user list isn't found. Far far far from prfect, but it'll do. if (!Page.IsPostBack) { var user = Request.LogonUserIdentity.Name.ToLower().ToString(); if (user != "domain\\user") { Response.Redirect("/path/to/redirect/to.html"); } }
b0061b72559523f65a85d957438f2a2a47e83ba249760e5b278d40aece2d79c1
['05088f92590e48d98a745a3e6f5eb681']
divblock = document.createElement("blockquote"); divblock.setAttribute("class", "row"); var printWords = function() { for(i = 0; i < words.length; i++) { block = document.createElement("blockquote"); p = document.createElement("p"); p.innerHTML = words[i]["word"]; small = document.createElement("small") small.innerHTML = words[i]["translation"]; block.appendChild(p); block.appendChild(small); //Add block to the div divblock.appendChild(block); if ( (i%3) == 2) { //Render the previous div document.getElementById('siteContent').appendChild(divblock); //Create a new div block divblock = document.createElement("div"); divblock.setAttribute("class", "row"); } } }
7880f2b2b873715c8bbf8786fdb6c2da46c5bf53a3254d6a74fa7441d2c75af1
['05088f92590e48d98a745a3e6f5eb681']
I prefer it this way: if ($is_read_only) echo ($affiliate['affiliate_gender'] == 'm') ? MALE : FEMALE; elseif ($error) if ($entry_gender_error) echo tep_draw_radio_field('a_gender', 'm', $male) . '&nbsp;&nbsp;' . MALE. '&nbsp;&nbsp;' . tep_draw_radio_field('a_gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_ERROR; else echo ($a_gender == 'm') ? MALE : FEMALE , tep_draw_hidden_field('a_gender'); else echo tep_draw_radio_field('a_gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('a_gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_TEXT; I avoid using too long echo sentences, to improve Readability. To much {s and }s result are messy too.
d7467ba4f07f52c8a49bb2050e76a1b1a1a289ea25da832db50e49a5d3724a2f
['0509cc86dd8542b9bb9e5dd1ed0c6870']
Everything works well, but some changes have to be made: 1)Open Startup.cs: public void ConfigureServices(IServiceCollection services) { services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN"); services.AddMvc(); } 2)Open HomeController.cs: [ValidateAntiForgeryToken] public IActionResult OnPost() { return new JsonResult("Hello Response Back"); } 3)Open About.cshtml: @{ ViewData["Title"] = "About"; } <h2>@ViewData["Title"]</h2> <h3>@ViewData["Message"]</h3> <p>Use this area to provide additional information.</p> <form method="post"> <input type="button" value="Ajax test" class="btn btn-default" onclick="ajaxTest();" /> </form> <script src="~/lib/jquery/dist/jquery.js"></script> <script type="text/javascript"> function ajaxTest() { $.ajax({ type: "POST", url: 'onPost', contentType: "application/json; charset=utf-8", beforeSend: function (xhr) { xhr.setRequestHeader("XSRF-TOKEN", $('input:hidden[name="__RequestVerificationToken"]').val()); }, dataType: "json" }).done(function (data) { console.log(data.result); }) } </script> It should be noted that "onPost" was added inside the controller, so in AJAX the correct "url" should be indicated. Then: url: 'onPost',
56edfb0d43e425fcf98abca049a32af0a4deeddc112aa087a4bd74f6a78e2421
['0509cc86dd8542b9bb9e5dd1ed0c6870']
I'm following your own course. And, like you, I noticed that there are some problems going to Asp.net Core. My Controller: public JsonResult Save([FromBody]SalesOrderViewModel salesOrderViewModel) { SalesModel salesOrder = new SalesModel(); salesOrder.CustomerName = salesOrderViewModel.CustomerName; salesOrder.PONumber = salesOrderViewModel.PONumber; _context.SalesModels.Add(salesOrder); _context.SaveChanges(); salesOrderViewModel.MessageToClient = string.Format("{0}’s sales order has been added to the database.", salesOrder.CustomerName); return Json(new { salesOrderViewModel }); } My Knockout Script: SalesOrderViewModel = function (data) { var self = this; ko.mapping.fromJS(data, {}, self); self.save = function () { $.ajax({ url: "/Sales/Save/", type: "POST", data: ko.toJSON(self), contentType: "application/json", success: function (data) { if (data.salesOrderViewModel != null) { ko.mapping.fromJS(data.salesOrderViewModel, {}, self); } } }); } }; My Create Page: @model SolutionName.ViewModels.SalesOrderViewModel @using Newtonsoft.Json @{ ViewBag.Title = "Create a Sales Order"; } @{ string data = JsonConvert.SerializeObject(Model); } @section scripts{ <script src="~/lib/knockout/dist/knockout.js"></script> <script src="~/lib/knockout-mapping/build/output/knockout.mapping-latest.js"></script> <script src="~/lib/Scripts/SalesOrderViewModel.js"></script> <script type="text/javascript"> var salesOrderViewModel = new SalesOrderViewModel(@Html.Raw(data)); ko.applyBindings(salesOrderViewModel); </script> } <h2>@ViewBag.Title</h2> <p data-bind="text: MessageToClient"></p> <div> <div> <label>Customer Name:</label> <input data-bind="value: CustomerName" /> </div> <div> <label>P.O. Number:</label> <input data-bind="value: PONumber" /> </div> </div> <p><button data-bind="click: save">Save</button></p> <p> @Html.ActionLink("Back to List", "Index") </p> I used "FromBody" in my Controller and the data saved in the database works correctly. What does not work, however, is that after pressing the button saves the view does not update correctly. I understand that with asp.net Core, this piece of code does not work properly: ko.mapping.fromJS(data.salesOrderViewModel, {}, self);
499bcebd064a8dcaff33fb08864c89bcc77b40f202bc4272a78cc26cb01a00d6
['050f2b4ba5d945a295e6204b1e509671']
Cost is not that much of an issue in my case, mostly I was curious how cheap devices integrate such feature with minimal BOM. I was more concerned about the complexity because of the space it takes on the board, but after looking more into it, it looks like I will have more space to spare than I had anticipated. To give more context, this is for a small (~2cm side) device with a microcontroller and a small OLED screen, powered by a 500mAh LiPo battery, and with a micro-usb port for recharging, so the current draw when turned off should not empty the battery in less than a week for example.
1f9b91c4c5599ee5e7bc7a21b42a936b7cb4b565f8ad7476efb1ce573657c7cc
['050f2b4ba5d945a295e6204b1e509671']
By the way, another idea I just got : you could do as you planned, measuring the battery voltage and entering unlimited deep sleep when it is too low. Then, you could also connect the charger input voltage to an interrupt pin on the ESP (don't forget the voltage divider), in order to wake the chip up. I don't know the ESP much but I'm pretty sure it can be woken up by an interrupt. This might be the easiest way to solve your problem.
640700ce195ddcd4236a82987a72f5577b2d24c787c72e65b5653d941496eebd
['0517c08d77e745fbb7d56942596bceeb']
He tried to upgrade from 14.04 I believe to 15.10, now after he types in his password it looks like this: http://imgur.com/AZqSWal It's an AIO desktop from asus core i5 with a nvidea 540m connected wirelessly if that is any help. He fears he somehow screwed something up during the updating process and I am of no help, since I am a complete noob when it comes to typing in any commands and such (which is something I hope someone here can teach me to fix this. He himslef doesn't even speak english.) I hope to maybe reset the pc to a previous state to keep all his data or maybe even successfully upgrade to 15.10, but again I've no idea where to even begin. Thank you for reading, I hope I'm not violating any rules this being my first post here.
c3dbc33cac0860a6df2812964d7696c7e9e778a1bfdb7550bd210e9b8393924d
['0517c08d77e745fbb7d56942596bceeb']
$('#contactNumber').bind('keypress', function (event) { event = event || window.event; canAdd = new Boolean(false); canAdd = ((event.charCode > 47) && (event.charCode < 58) || (event.charCode == 32) || (event.charCode == 40) || (event.charCode == 41) || (event.charCode == 43) || (event.charCode == 45) || (event.charCode == 124)); if (!canAdd && event.charCode) return false; }); But better to use HTML5 tel attrubute
459db1a40764a4d2ed6fc47ab471817db84481f1be4a87d2a28f87abd1062500
['051f1e927d9540eda0ffab4860dfa72b']
I'm struggling to remove item from recursive array if parent id don't match. All I want to display separate tree for each tree number. I didn't find any solution with SQL so now I am retrieving top nodes of that tree number and removing array those items don't have that top node ids. I already have tree structure, below I'm providing the structure of array. { "196": { "id": "196", "username": "test1", "parent_id": null, "children": [ { "id": "197", "parent_id": "196", "flower_id": null, "username": "test1", "children": [] }, { "id": "198", "parent_id": "196", "flower_id": "1690587", "username": "test3", "children": [ { "id": "213", "parent_id": "198", "flower_id": "5197062", "username": "test33", "children": [] } ] }, { "id": "199", "parent_id": "196", "flower_id": "1690587", "username": "test2", "children": [ { "id": "205", "parent_id": "199", "flower_id": null, "username": null, "children": [ { "id": "207", "parent_id": "205", "flower_id": null, "username": null, "children": [] } ] }, { "id": "212", "parent_id": "199", "flower_id": "6794158", "username": "<PERSON><PHONE_NUMBER>", "username": "test3", "children": [ { "id": "213", "parent_id": "198", "flower_id": "5197062", "username": "test33", "children": [] } ] }, { "id": "199", "parent_id": "196", "flower_id": "<PHONE_NUMBER>", "username": "test2", "children": [ { "id": "205", "parent_id": "199", "flower_id": null, "username": null, "children": [ { "id": "207", "parent_id": "205", "flower_id": null, "username": null, "children": [] } ] }, { "id": "212", "parent_id": "199", "flower_id": "6794158", "username": "gunu", "children": [] } ] } ] } } Here is what I'm doing doing function recursive_unset(&$array, $parentIds = array()) { foreach ($array as $key => &$value) { if(!in_array($value['parent_id'], $parentIds)) { unset($array[$key]); } if (is_array($value['children'])) { $this->recursive_unset($value, $parentIds); } } } This is how I'm calling this function $data = $this->recursive_unset($array, [198,199]); Any help is appreciated. Thanks in advance.
8c6da404889e1873d9adc6b6e5f2d1c59be8f2bba665052f2d47748a420667fa
['051f1e927d9540eda0ffab4860dfa72b']
I'm looking for a javascript function that converts a string to binary and sum it, I also have an example of what I'm looking for. Suppose I have a string "aB1@aaaaaa", the sum should be 27. I'm totally blank to do this. Please help Thank you
444d30cd6ef3838c8cac2a8da0a4353c2de96b3f8de073fcb677c8d7fee3f737
['052272c179294b5f94d4568bfacf8218']
You could also try checking the encoding on you data file. I've just come across this exact problem as well when trying to plot a data file. And it turned out that Gnuplot was unable to understand the data file due to its encoding (which was UTF-16LE). When I changed the file's encoding to UTF-8, Gnuplot was able to read it without issues. Since this post is already a bit old, you've probably already managed to solve it. Though I just thought it might help anyone else who also gets this problem.
68b367b9aac24e4b1c7a89f34f00af5ee05d5a06b00503433cc95b04215e6aca
['052272c179294b5f94d4568bfacf8218']
I have stumbled upon an issue when working with arrays in D. I need to initialize an array with an arbitrary number of elements of a pre-defined value. I know it can be done like double[10] arr = 5;, for example, this will make an array with 10 elements of value 5. The problem, however, is that I need the number of elements passed on during the program's execution. I thought it could be done this way: void test(immutable int x) { double[x] arr = 5; writeln(arr); } void main() { test(10); } But this causes Error: variable x cannot be read at compile time during compilation. While it could be done by making a dynamic array and appending elements through a for loop, I think this may be rather inefficient (please correct me if I am wrong). So the question is, is there another efficient way to create an array with an arbitrary number of elements?
9dbe7689de7d448e2b4fb2b4ad7c2c8b4461de73d85bcf4a27ca9f43f00b8d64
['052aa13cde7c400c810078ba178b0f3f']
Interestingly, when you first time made the connection b/w your table view controller and view controller using Push you can start editing the navigation bar without a problem (e.g put bar items onto it). Then delete the connection between your table view controller and view controller (but do not delete the nav bar items you just added), then re-connect the two controllers by using segue Show, you will see the navigation bar works just like segue Push now. Hope it helps
2d45bbc80255a61c15881e520661edd1c439ca56d0b0f16aba683a2352eaa3d5
['052aa13cde7c400c810078ba178b0f3f']
Based on Description of SlideUp() If .slideDown() is called on an unordered list () and its elements have position (relative, absolute, or fixed), the effect may not work properly in IE6 through at least IE9 unless the has "layout." To remedy the problem, add the position: relative; and zoom: 1; CSS declarations to the ul. even the TAG is not ul and not for slideUp(), try to set css property: zoom:1 and position: relative Hope it helps
bd25a72b2e79393aa204c24e1171a4bb0eeb1c35bbb3ec25ec96ab906c40fd54
['053eaa5ba71f4c75b1b3a8f04e1207bb']
Android newbie here! I'm trying to read a JSON like this: { "channel0":{ "song":"Crush", "artist":"Jennifer Paige", "duration":"180", "playedat":"<PHONE_NUMBER>", "image_extralarge":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/300x300\/8eecc92227fcbb09b43472f000df74e1.png" }, "channel1":{ "song":"Reasons Why", "artist":"Brand New Immortals", "duration":"180", "playedat":"<PHONE_NUMBER>", "image_extralarge":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/300x300\/c059afda95dd35354af26cf72e5deab4.png" }, "channel2":{ "song":"Dance Me To The End Of Love", "artist":"Leonard Cohen", "duration":"300", "playedat":"<PHONE_NUMBER>", "image_extralarge":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/300x300\/a368617dc7dc4716a9badb523ff6e7d4.png" }, "channel3":{ "song":"4 Minutes", "artist":"Madonna", "duration":"180", "playedat":"<PHONE_NUMBER>", "image_extralarge":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/300x300\/1dcefc6496be4155a00f919dcbb54f77.png" }, "channel4":{ "song":"Mothers, Sisters, Daughters", "artist":"Voxtrot", "duration":"180", "playedat":"<PHONE_NUMBER>", "image_extralarge":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/300x300\/5861b97231bd4ffe9218dfcacc27d68a.png" } } from an URL with using Retrofit 2. I'm using this structure in my MainActivity: retrofit2.Call<List<Channel>> call = restInterface.getChannels(); call.enqueue(new Callback<List<Channel>>() { @Override public void onResponse(retrofit2.Call<List<Channel>> call, Response<List<Channel>> response) { List<Channel> channelList= new ArrayList<>(); channelList=response.body(); for (int i=0;i<4;i++){ System.out.println(""+channelList.get(i).getArtist()+"\n"); } } and when I run my application, I get this error: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.korhan.frontend, PID: 30563 java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference at com.example.korhan.frontend.MainActivity$1.onResponse(MainActivity.java:44) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) By the way I'm using only one Channel class for all of this Channels in the JSON but when I tried to use POJO creator it created 4 classes like Channel1, Channel2... for every Channel in JSON class. Here is my Channel class: public class Channel { @SerializedName("song") @Expose private String song; @SerializedName("artist") @Expose private String artist; @SerializedName("duration") @Expose private String duration; @SerializedName("playedat") @Expose private String playedAt; @SerializedName("image_extralarge") @Expose private String img; //Getters, setters etc. } So, how should I parse this JSON in my situation?
c655f03cca9cf26cb62cb4d5b96cf584d3ac54a1d4b16c0f5106dfbeb6d0bff2
['053eaa5ba71f4c75b1b3a8f04e1207bb']
I'm trying to use the values I get from my request but I can't use them because void onReponse method. Values I get is only staying in onResponse method. I know it is because it is void and I can't return anything but is there a way to fill an object with values I get? Here is my ApiClient class: public class ApiClient implements Callback<Map<String, Channel>> { static final String BASE_URL = "some url"; public void start() { Gson gson = new GsonBuilder() .setLenient() .create(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create(gson)) .build(); RestInterface restInterface = retrofit.create(RestInterface.class); Call<Map<String, Channel>> call = restInterface.getChannels(); call.enqueue(this); } @Override public void onResponse(retrofit2.Call<Map<String, Channel>> call, Response<Map<String, Channel>> response) { System.out.println(response.code()); if(response.isSuccessful()) { Map<String, Channel> body = response.body(); List<Channel> channels = new ArrayList<>(body.values()); for (Channel channel : body.values()) { System.out.println(channel.getSong()); } ... What I have to do is create Channel objects with the values I get from onResponse. I tried to use it in an another class like this: ApiClient apiClient = new ApiClient(); apiClient.start(); but it still only works in onResponse. I need to create Channel objects like: Channel channel = new Channel(channels(1)); this but in another class not in the ApiClient.
c7e53232093f9e0e7b8b9f11b9f02d0d1e01ac6e438d8a4fd69f615cf8fbdfcf
['0546046068f04fada0536674df42ce42']
i have html page and parsing with htmlagilitypack i manualy change how value for node exist but i need automatic change by value 'statusAct' or 'statusInac' if (checkBox1.Checked == true) { foreach (HtmlNode text in htmlDoc.DocumentNode.SelectNodes("//table[@id='rTbl']/tr/td/span[@class='statusAct']/a[@title='Status Definitions']/text()")) { dataGridView1.Rows[n].Cells[1].Value = text.InnerText; i++; } } else if (checkBox2.Checked == true) { foreach (HtmlNode text in htmlDoc.DocumentNode.SelectNodes("//table[@id='rTbl']/tr/td/span[@class='statusInac']/a[@title='Status Definitions']/text()")) { dataGridView1.Rows[n].Cells[1].Value = text.InnerText; i++; } }
16f17d576308c77ed575441ce4ca196e596e61c6a958faffca709f329651c609
['0546046068f04fada0536674df42ce42']
when i view pe file in hexeditor value is reversing stored in it but why? for example : in pe file header structure 2nd record is referred to Number Of Section that's value is 0300 but real value is 0003 that's mean for read value from pe file we must read it byte to byte from right !
5cb75d3e59093df5e1adf15809751bfdeb7f55c6b252ad9a06a89135e33cc278
['0558897c46af4e4898fa3dc6d59d1e0d']
I'm doing a small experiment using fourier transform on emgu cv. My aim is to have the fourier transform of an image, then take the inverse fourier transform again, and check if the image shows up or not. mathematically, it should. this is my code which i believe is correct Image<Gray, float> image = new Image<Gray, float>("c://box1.png"); IntPtr complexImage = CvInvoke.cvCreateImage(image.Size, Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_32F, 2); CvInvoke.cvSetZero(complexImage); // Initialize all elements to Zero CvInvoke.cvSetImageCOI(complexImage, 1); CvInvoke.cvCopy(image, complexImage, IntPtr.Zero); CvInvoke.cvSetImageCOI(complexImage, 0); Matrix<float> dft = new Matrix<float>(image.Rows, image.Cols, 2); CvInvoke.cvDFT(complexImage, dft, Emgu.CV.CvEnum.CV_DXT.CV_DXT_FORWARD, 0); Matrix<float> idft = new Matrix<float>(dft.Rows, dft.Cols, 2); CvInvoke.cvDFT(dft, idft, Emgu.CV.CvEnum.CV_DXT.CV_DXT_INVERSE, 0); IntPtr complexImage2 = CvInvoke.cvCreateImage(idft.Size, Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 2); CvInvoke.cvShowImage("picture", idft); System.Threading.Thread.Sleep(99999); // to wait and see the picture I have two problems: 1- error : an error shows up saying " OpenCV: Source image must have 1, 3 or 4 channels " i believe its related about the IDFT, but I couldn't solve it 2- it still shows an output image, but unfortunately, its not the original image that was input. all what show is a plain grey image. Thanks.
1943efdd8829de758a77cf68c15e86f217395a5149b745a4e7d6953880f89d48
['0558897c46af4e4898fa3dc6d59d1e0d']
I'm trying to do fourier transform using Aforge. According to the documentation, This code should work. Bitmap a1 = new Bitmap("c://z3.bmp"); ComplexImage complexImage1 = ComplexImage.FromBitmap(a1); complexImage1.ForwardFourierTransform(); Bitmap fourierImage = complexImage1.ToBitmap(); fourierImage.Save("c:/z2.bmp"); For some reason, a weird error come up saying : " Image width and height should be power of 2." I have no idea what that means, the code should perfectly work. Any help please?
fc57796c9ba22a649355c9f4d586ed328d59162b76cc7241d307c0abdd4769f1
['055986eb950f4aebb426c14935ae7b64']
My current version of Visual Studio for Mac is (v7.0.1.24) -- this is how I resolved the issue with the internal warnings: Update the package nugget (located in fileTree sidebar) Follow the instructions on this page and install the extension. Note the exception for mac: IMPORTANT: Starting from v0.7.3, please download the .mpack files from https://github.com/xunit/xamarinstudio.xunit/releases Then in Extension Manager you can use "Install from file..." button to manually install this extension. This let's me run my tests and gives me feedback in the UI: [TestFixture()] public class Test { [Test()] public void TestCase() { int a = 100; int b = 100; Assert.AreEqual(a, b); } }
71036d1b8726a5192bdf4c8874f1823c76c11425d8dcb0610687d9e87f3c9ccb
['055986eb950f4aebb426c14935ae7b64']
I'm using CSS Modules to scope all my styles locally by default. From my understanding the only way I'm able to use the class names set in the local stylesheet (./movieCard.styl), is by using the attribute styleName="something". So className="something", won't be able to access styles in ./movieCard.styl. I guess I could use the style={} method on the HTML element, but I want my components clean with no style markup - so I'm hoping there is another way of doing it with the way CSS Module syntax behave. I have tried the following (Even though the methods don't give any errors, they don't work): styleName={isHovered ? ' movie-card--show' : ''} className={isHovered ? ' movie-card--show' : ''} Context: I'm trying to show the movie information based on if the user is hovering over the movie poster or not. I will need to apply some sort of styling to the move-card__info element to make the text visible when the poster is hovered. Below is an example of what I'm trying to accomplish. import React, { Component } from 'react'; import CSSModule from 'react-css-modules'; import styles from './movieCard.styl'; class MovieCard extends Component { state = { movie: this.props.movie, isHovered: false, }; cardHoverToggle = () => { const { isHovered } = this.state; this.setState({ isHovered: !isHovered }); }; render() { const { movie, isHovered } = this.state; return ( <div styleName="movie-card" onMouseEnter={this.cardHoverToggle} onMouseLeave={this.cardHoverToggle}> <img styleName="movie-card__poster" src={`https://image.tmdb.org/t/p/w200/${movie.poster_path}`} alt={`Movie poster for ${movie.original_title}`} /> <div styleName="movie-card__info"> <p>{movie.original_title}</p> </div> </div> ); } } export default CSSModule(MovieCard, styles); Question: How would I be able to conditionally apply styles written in the local scope of the react-component (CSS Module), based on a state? Is this possible to do with styleName, if so how?
86689f6bfe96b94a5c7ca89be83daea62d70d90cf0c0f273d92b02cbe233a55c
['056c6453e01f4a27b5ab957329ddb4b3']
Mount the NFS-share on the clients using the mount-options "bg,intr,hard". Most important in your case is "bg" for background - which tells the system not to block when the server is not available. "intr" for interrruptable - so you can kill hanging mounts on the client with the kill command. "hard" is the opposite of "soft". The difference is that "hard" will keep trying endlessly while "soft" will exponentially back off its retries when the server is not available.
cac1542850d74fcf0d0eee3f39a0d974c2932dd3c3d3f5fe2f60ff58652e3d79
['056c6453e01f4a27b5ab957329ddb4b3']
<PERSON> didn't actually give it to <PERSON>. When <PERSON> was young, <PERSON> transplanted the Rinnegan onto <PERSON>, without his knowledge. <PERSON> had achieved the Rinnegan near to end of his physical life. So he decided that would have to die someday as his body was nearing the end. As a plan to be revived later on, he transplanted his eyes onto an Uzumaki individual. This was <PERSON>. Uzumaki clan was known for their huge chakra reserves, so the user of the Rinnegan could tap into its original power because of their chakra levels. So he transplanted his Rinnegan into a young <PERSON> without the boy's knowing, intending <PERSON> to someday use the eyes to restore <PERSON> to life. If <PERSON> was to do this, however, <PERSON> would need an agent to act on his behalf and guide <PERSON> towards this ultimate goal. <PERSON> waited, connecting himself to Demonic Statue to keep him alive until someone could be found. He then found <PERSON> in the ruins and decided that he will be the one to lead <PERSON> to use the Samsara of Heavenly Life to bring him back to life. Source: Naruto Wikia
e44a26f85a2e21462fddd95876c535df637f69477463f02f8305015865373467
['0576d634835541a081fa7c6418a3bc5f']
I am developing a Note App that store file in external sd card. File Management is also a part of app. App allow user to create folder. I use this code. file.mkdir(); After that I refresh my ListView; I can see newly created folder in listView. But i can't acess it( click it) immediately. I have to wait for a while to be able to access it. Please help me out..
c6abff2b8b91f3ba916308b58a966c9d025b8950bab82be0c1083733a4fb78f4
['0576d634835541a081fa7c6418a3bc5f']
I want to accept pdf and image on a form. I code my custom class named 'Myfileupload' like this. <?php defined('BASEPATH') OR eixt('No direct script acccess allowed'); //myfileupload library class Myfileupload{ var $image_name; var $pdf_name; function __construct() { $this->CI = & get_instance(); } function upload_image($image) { $config['upload_path'] = './upload/image'; $config['allowed_types'] = 'jpeg|gif|jpg|png'; $config['max_size'] = 0; $config['max_width'] = 0; $config['max_height'] = 0; $config['encrypt_name'] = TRUE; $this->CI->load->library('upload', $config); $temp = $this->CI->upload->do_upload($image); $this->image_name = $this->CI->upload->data('file_name'); return $temp; } function getImageName() { return $this->image_name; } function upload_pdf($pdf_name) { $config['upload_path'] = './upload/pdf'; $config['allowed_types'] = 'pdf'; $config['max_size'] = 0; $config['encrypt_name'] = TRUE; $this->CI->load->library('upload', $config); $temp = $this->CI->upload->do_upload($pdf_name); $this->pdf_name = $this->CI->upload->data('file_name'); } function getPdfName() { return $this->pdf_name; } } ?> In the controller, I call 'upload_image' function first. It wroked exactly as I have expected. The error occur when I call upload_pdf afterward. It's showing that 'pdf' type is not allowed for upload. Seem like that I can't overwrite configuration in 'image_upload' with the one in 'pdf_upload'. Here is the error. The result is modified with var_dump(); PDF UPLOAD! The filetype you are attempting to upload is not allowed. array(14) { ["file_name"]=> string(94) "IP address သိရင္ ဘယ္လို hack လို႔ရႏိုင္သလဲ.pdf" ["file_type"]=> string(15) "application/pdf" ["file_path"]=> string(48) "/opt/lampp/htdocs/mm-bookstore.com/upload/image/" ["full_path"]=> string(142) "/opt/lampp/htdocs/mm-bookstore.com/upload/image/IP address သိရင္ ဘယ္လို hack လို႔ရႏိုင္သလဲ.pdf" ["raw_name"]=> string(90) "IP address သိရင္ ဘယ္လို hack လို႔ရႏိုင္သလဲ" ["orig_name"]=> string(14) "kali_linux.png" ["client_name"]=> string(94) "IP address သိရင္ ဘယ္လို hack လို႔ရႏိုင္သလဲ.pdf" ["file_ext"]=> string(4) ".pdf" ["file_size"]=> int(90637) ["is_image"]=> bool(false) ["image_width"]=> int(800) ["image_height"]=> int(557) ["image_type"]=> string(3) "png" ["image_size_str"]=> string(24) "width="800" height="557"" }
d4ec3d383c75d282ab1fdaa6f5d2c9fac76443ecfeb4951c911d648820ed0387
['057ee96b4df04c78b78d53cfcd604d4d']
I use Spring Boot and Thymeleaf. I have a post method where the form is processing(adding data from fields to database) I want to use Toastr library to show notifications if adding data is successfull or not after pressing submit button. Library works, but notification is immediately disappear because page refresh occurs after submit button is pressed. After clicking on submit button I want to stay on the same page How can I prevent page refresh after clicking submit button to show notification messages? Controller: @PostMapping("/sketches/add") public String addSketch( @Valid Sketch sketch, BindingResult result, ModelMap model, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { return "admin/add-sketch"; } sketchRepository.save(sketch); return "redirect:/admin/sketches/add"; } HTML: <form action="#" th:action="@{/admin/sketches/add}" th:object="${sketch}" method="post" id="save-sketch"> <div class="add-sketch"> <div class="title"> <div class="title-text"> <p>Title <span th:if="${#fields.hasErrors('title')}" th:errors="*{title}" class="error"></span> </p> <input type="text" class="title-input" th:field="*{title}"> </div> <div class="title-file"> <label for="file-input"> <img th:src="@{/images/add image.png}" alt="upload image"> </label> <input id="file-input" type="file"/> </div> <span id="image-text">No file chosen, yet</span> </div> <!--SKETCH TEXT====================================--> <div class="sketch-text"> <p>Sketch Text <span th:if="${#fields.hasErrors('text')}" th:errors="*{text}" class="error"></span> </p> <textarea name="sketch-area" id="" cols="55" rows="6" th:field="*{text}"></textarea> </div> <!--DROPDOWN--> <div class="select"> <select name="select-category" id="select-category" th:field="*{category}"> <option value="Buttons">Buttons</option> <option value="Potentiometers">Potentiometers</option> <option value="Encoders">Encoders</option> <option value="Leds">Leds</option> </select> </div> <span th:if="${#fields.hasErrors('category')}" th:errors="*{category}" class="error"></span> <!--ADD GIF=====================================--> <input type="file" id="gif-file" hidden="hidden"> <button type="button" id="gif-button">Add GIF<i class="fas fa-image"></i></button> <span id="gif-text">No file chosen, yet</span> <div class="save-sketch"> <input type="submit" class="save-sketch-button" id="button-save" value="Save Sketch"/> </div> </div> </form> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script> <script> document.getElementById('button-save').addEventListener('click', function () { toastr.info('Button Clicked'); }); </script> </body> </html>
d1c79e9f9f9469360148aad40b9bc00c28800e881f05c41bce455503347ebaf0
['057ee96b4df04c78b78d53cfcd604d4d']
I have Spring Boot Application. I also use Spring Security and Thymeleaf.\ I have a piece of code where I get you tube videos from database and apply it in my thymeleaf template. If I open dev tools in browser(any) I get error message: Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. If I remove a piece of code with You Tube videos errors will be gone. How Can I resolve this error? Spring Security Config: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/admin/**").authenticated() .antMatchers("/**").permitAll() .and().exceptionHandling().accessDeniedPage("/handlers/access-denied.html") .and().csrf().disable(); } @Override public void configure(WebSecurity web) { web.ignoring().antMatchers( // статика "/css/**", "/js/**", "/fonts/**", "../libs/**", "/images/**" ); } } Template: <div class="video-container"> <div class="video-item" th:each="video : ${videos}"> <iframe th:src="${video.url}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <h3 th:text="${video.title}"></h3> </div> </div>
eedafd5c809cd06dcecdd7a9aed05b107f9bf607338adc61778ddc84e6da31cd
['0592e76609124fc598e61c1fae2fd06b']
Regular expressions seem a bit like overkill for this, you could just do two string replacements, so that you don't get all the overhead from regexes, using - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement and just replace it twice. Also, you don't need to do the NSString allocations, because it creates a reference in the return.
1573fb61eefa56c0832cf19bafa01a69139b1d5c8816eb866aba27c45b18ee7c
['0592e76609124fc598e61c1fae2fd06b']
This way will allow scrollable elements while still preventing the overscroll in the browser itself. //uses document because document will be topmost level in bubbling $(document).on('touchmove',function(e){ e.preventDefault(); }); //uses body because jquery on events are called off of the element they are //added to, so bubbling would not work if we used document instead. $('body').on('touchstart','.scrollable',function(e) { if (e.currentTarget.scrollTop === 0) { e.currentTarget.scrollTop = 1; } else if (e.currentTarget.scrollHeight === e.currentTarget.scrollTop + e.currentTarget.offsetHeight) { e.currentTarget.scrollTop -= 1; } }); //prevents preventDefault from being called on document if it sees a scrollable div $('body').on('touchmove','.scrollable',function(e) { e.stopPropagation(); });
a3d705e778a7fed378512f02486abeb67e09da3a4c70f48cdc3fd2fe4bda8f68
['0599d455c3d14e94b1cf4ab494faf21c']
I'm writing code in Rust for parsing streams, trait Stream. The streams can consist of other streams. The trait StreamIterator gives access to the substreams. This is when parsing tar files, zip files and other files that contain files. While writing this code, I've been unsuccessfully fighting the borrow checker. The code below is a simplified example. In main a file is opened as a stream. That stream is passed to the analyze function which tries to open the stream as a TarStreamIterator to iterate of the streams in the tar. Each embedded stream is also analyzed. I think that I might to introduce a second lifetime in the StreamIterator trait. use std<IP_ADDRESS>io; trait Stream<T> { fn read(&mut self) -> io<IP_ADDRESS>Result<&[T]>; } trait StreamIterator<'a,T,S: Stream<T>> { fn next(&'a mut self) -> Option<io<IP_ADDRESS>Result<S>>; } struct FileStream { } impl<T> Stream<T> for FileStream { fn read(&mut self) -> io<IP_ADDRESS>Result<&[T]> { Err(io<IP_ADDRESS>Error<IP_ADDRESS>new(io<IP_ADDRESS>ErrorKind<IP_ADDRESS>UnexpectedEof, "")) } } struct TarStream<'a> { stream: &'a mut Stream<u8> } impl<'a> Stream<u8> for TarStream<'a> { fn read(&mut self) -> io<IP_ADDRESS>Result<&[u8]> { self.stream.read() } } struct TarStreamIterator<'a> { stream: &'a mut Stream<u8> } impl<'a> StreamIterator<'a,u8,TarStream<'a>> for TarStreamIterator<'a> { fn next(&'a mut self) -> Option<io<IP_ADDRESS>Result<TarStream>> { // todo: read tar header Some(Ok(TarStream{stream: self.stream})) } } fn analyzeAsTar(s: &mut Stream<u8>) -> bool { let mut tar = TarStreamIterator{stream: s}; while let Some(Ok(mut substream)) = tar.next() { analyze(&mut substream); } true } fn analyze(s: &mut Stream<u8>) -> bool { analyzeAsTar(s) } fn main() { let mut fs = FileStream{}; analyze(&mut fs); } This gives this error: <anon>:38:41: 38:44 error: cannot borrow `tar` as mutable more than once at a time [E0499] <anon>:38 while let Some(Ok(mut substream)) = tar.next() { ^~~ <anon>:38:41: 38:44 help: see the detailed explanation for E0499 <anon>:38:41: 38:44 note: previous borrow of `tar` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `tar` until the borrow ends <anon>:38 while let Some(Ok(mut substream)) = tar.next() { ^~~ <anon>:42:2: 42:2 note: previous borrow ends here <anon>:36 fn analyzeAsTar(s: &mut Stream<u8>) -> bool { ... <anon>:42 }
c12f1c93e26f2ad5a71f701df0c3eb198a2359a8a89391c9f062fee18b4d1a0e
['0599d455c3d14e94b1cf4ab494faf21c']
There is a workaround. Instead of having a trait with a next() function, one can use a trait with an iterate function. In the example below, TarStreamIterator has a function iterate can accept a closure. (Alternatively, iterator could be called for_each.) The implementation still has a next function, but the borrow checker accepts this form. This short example does not actually do anything with the streams. use std<IP_ADDRESS>io; // generic version of std<IP_ADDRESS>io<IP_ADDRESS>Read trait Stream<T> { fn read(&mut self) -> io<IP_ADDRESS>Result<&[T]>; } trait StreamIterator<T> { // call `f` on each of the streams in the iterator fn iterate<F>(&mut self, mut f: F) where F: FnMut(&mut Stream<T>); } struct FileStream { } impl<T> Stream<T> for FileStream { fn read(&mut self) -> io<IP_ADDRESS>Result<&[T]> { Err(io<IP_ADDRESS>Error<IP_ADDRESS>new(io<IP_ADDRESS>ErrorKind<IP_ADDRESS>UnexpectedEof, "")) } } struct TarStream<'a> { stream: &'a mut Stream<u8> } impl<'a> Stream<u8> for TarStream<'a> { fn read(&mut self) -> io<IP_ADDRESS>Result<&[u8]> { self.stream.read() } } struct TarStreamIterator<'a> { stream: &'a mut Stream<u8> } impl<'a> TarStreamIterator<'a> { // pass the next embedded stream or None if there are no more fn next(&mut self) -> Option<TarStream> { Some(TarStream{stream: self.stream}) } } impl<'a> StreamIterator<u8> for TarStreamIterator<'a> { fn iterate<F>(&mut self, mut f: F) where F: FnMut(&mut Stream<u8>) { while let Some(mut substream) = self.next() { f(&mut substream); } } } fn analyze_as_tar(stream: &mut Stream<u8>) { TarStreamIterator{stream: stream}.iterate(|substream| { analyze(substream); }); } fn analyze(s: &mut Stream<u8>) { analyze_as_tar(s) } fn main() { let mut fs = FileStream{}; analyze(&mut fs); }
4a4e032d423ec75d0bb2701aa604ecab4704b8b9fa7ea955bf4db07526e6ff63
['059e3d94bef24a18a96d192eb10b4f18']
I was able to fix it by adding the variable name to it and also because i am removing an index, going in reverse like so: for ($i=count($userCartBis['items']) - 1; $i >= 0; $i--) { //for now remove each element from the cart and put it in the orders section, if it's active if ($userCartBis['items'][$i]['status'] == 'active') { //this one we can process //add it to the orders table $updateOrder = $order ->push( 'products', [ 'location' => $userCartBis['items'][$i]['location'], 'quantity' => $userCartBis['items'][$i]['quantity'], 'price' => $userCartBis['items'][$i]['price'], 'product' => $userCartBis['items'][$i]['item'], ] ); //remove it from the cart table $removeItem = $userCart ->pull( 'items', $userCartBis['items'][$i], ); } else if ($userCartBis['items'][$i]['status'] == 'deleted') { //it is already deleted //do nothing for now } }
5e28a436600db3c19fb40b5faf2cd85fb3b5531355b8eedbc60a795d1b93bf2b
['059e3d94bef24a18a96d192eb10b4f18']
I was able to get help here: github and this was the perfect solution. Thank you <PERSON>. $elasticsearch = ClientBuilder<IP_ADDRESS>create() ->setHosts(config('services.search.hosts')) ->build(); $model = new ProductsListing; $items = $elasticsearch->search([ 'index' => $model->getSearchIndex(), 'type' => $model->getSearchType(), 'body' => [ //this helped a lot // https://stackoverflow.com/questions/60716639/how-to-implement-elastic-search-in-laravel-for-auto-complete //using query_string 'query' => [ 'query_string' => [ // 'fields' => ['brand', 'name^5', 'description'], //notice the weight operator ^5 'fields' => ['name'], 'query' => $query.'*', ], ], ], ]);
af6d3ccf17da1eb2582e1fa4d3ee6b2168181387e09a6332fb9975326edf7f25
['05a54db17892415692dd91d8875297df']
When I wrote a simple version of the program shown above, it did correctly choose the derived class-method when the constructor was called with the derived class. [I was getting strange behavior when I tested as part of my larger project... but I realize now those were due to other errors in my code - a reminder to myself to actually test things - this is the first time in four years I've done any programming so I am forgetting the basics...].
e02f0b2f8a5dc93a07f8b0550163ba15365116888d32b7293dda1add91ad1f77
['05a54db17892415692dd91d8875297df']
Is it possible to overload constructors in C# so that the program chooses to use one constructor if the argument is of a derived class and a different if it is the base class. For instance class BaseClass {...} class DerivedClass : BaseClass {...} class foo { public foo(DerivedClass bar) { //do one thing } public foo(BaseClass bar) { //do another } } That is, I want the program to pick the correct constructor based on the object type.
d72a5f622c03497d11046b6effeeb697798cb92e8e288025f8f99ad181352b75
['05b09e80cf43474a96786e3f717fa23e']
On my thinkpad t440s I ran ubuntu 14.04 happily for around 2 years, in the beginning having a battery life of over 7 hours, and still now easily 5 or 6 hours. Recently I switched to Arch, and I can't trust my laptop to work half an hour anymore. It does not charge over 79% anymore on both batteries, this is after it charged all night: ~$ acpi -i Battery 0: Unknown, 79% Battery 0: design capacity 6426 mAh, last full capacity 5673 mAh = 88% Battery 1: Unknown, 79% Battery 1: design capacity 2029 mAh, last full capacity 1311 mAh = 64% and if I unplug it, it says: $ acpi -i Battery 0: Discharging, 79%, 03:45:56 remaining Battery 0: design capacity 6583 mAh, last full capacity 5811 mAh = 88% Battery 1: Unknown, 79% Battery 1: design capacity 2029 mAh, last full capacity 1311 mAh = 64% ten seconds later it says only 3 hours remaining, and after maybe half an hour or 45 minutes it says the battery is empty and goes to suspend. I have no idea what is going on. Are my batteries suddenly broken? I find the change of OS more suspicious. I have no idea where to begin debugging this though. Does anyone have an idea? Thanks a lot.
73e966e8c6a2d05d9792e30da0274d5d80f35f923535a6ca9cc415f6358775f6
['05b09e80cf43474a96786e3f717fa23e']
<PERSON> I think so... But there's a lot of infraestructure to implement the Security Flag and it would involve a lot of money to implement correctly the RFC 1750 algorithms in all of it. I also think i is just a pitty that companies interests are not on that
ca2c259b501c114cf8a8f4c7257f3e2ee3a9a619d94c666aab32f907af3dfcfc
['05bde45e5c8845518c592bcdc990c495']
i'm stumped. I created a reservation page in Bluefish and Dreamweaver. When I open a preview in Safari I get the php page I created. With exemption of the Google reCAPTCHA: http://theatervonk.be/afbeeldingen/previeuw_mac.png When I upload the same page to my server I get only the header: http://www.theatervonk.be/reservaties.php I can't seem to find something wrong in the code, but I must overlooking something... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Reservaties</title> <LINK REL="STYLESHEET" HREF="afbeeldingen/vonk_phpstyle.css" TYPE="text/css"> </style> </head> <body> <div class="container"> <div class="header"> <center> <table width="908" border="0"> <tr> <td width="281"><img src="afbeeldingen/vonk_logo.gif" width="281" height="280"></td> <td width="339">&nbsp;</td> <td width="339" style="background-image:url(afbeeldingen/menu_vonk.png); background-repeat:no-repeat"><div id="navigation"> <?php echo do_main_nav() ; ?></div></td> </tr> </table> </center> <!-- end .header --></div> <div class="content"> <form id="form1" name="form1" method="post" action="send.php"> <table width="908" border="0"> <tr> <td width="302" rowspan="9" align="left" valign="top"><table width="908" border="0"> <tr> <td width="302" rowspan="12" align="left" valign="top"><h5>Je kan reserveren door te mailen naar: <a href="mailto:<EMAIL_ADDRESS>"><EMAIL_ADDRESS></a> of bellen naar 0486 611 447.</h5> <h5>Geef volgende gegevens door:</h5> <ul> <li> <h5>Datum van de voorstelling</h5> </li> <li> <h5>Aantal plaatsen</h5> </li> <li> <h5>Soort kaarten en prijs</h5> </li> <li> <h5>Uw telefoonnummer</h5> </li> <li> <h5>Uw adres en e-mailadres als u op de hoogte wilt blijven van onze voorstellingen</h5> </li> </ul> <h5>(zie ook het verzendformulier hiernaast)</h5> <h2>Betalen</h2> <h5>Triodos: BE86 5230 8029 4150</h5> <h2>Audities</h2> <h5>Wil je graag een auditie meedoen, meld je aan!</h5> <h2>Reacties op voorstellingen</h2> <h5>Wij zijn altijd heel blij uw reactie op onze voorstellingen te lezen! Uw mailtje is dan ook heel welkom! </h5> <h5><a href="mailto:<EMAIL_ADDRESS>"><EMAIL_ADDRESS><PERSON> door <PERSON>: <a href="mailto:reserveringen@theatervonk.be">reserveringen@theatervonk.be</a> of <PERSON> 0486 611 447.</h5> <h5><PERSON>> <ul> <li> <h5><PERSON>> </li> <li> <h5><PERSON>> </li> <li> <h5><PERSON> en prijs</h5> </li> <li> <h5><PERSON>> </li> <li> <h5><PERSON> en e-<PERSON> op de hoogte <PERSON> onze voorstellingen</h5> </li> </ul> <h5>(zie ook <PERSON>> <h2>Betalen</h2> <h5>Triodos: BE86 5230 8029 4150</h5> <h2>Audities</h2> <h5>Wil je graag een auditie meedoen, meld je aan!</h5> <h2>Reacties op voorstellingen</h2> <h5>Wij zijn altijd heel blij uw reactie op onze voorstellingen te lezen! <PERSON> is dan ook heel welkom! </h5> <h5><a href="mailto:info@theatervonk.be">info@theatervonk.be</a> Of laat een berichtje achter op ons gastenboek.</h5></td> <td align="center" valign="middle">&nbsp;</td> <td colspan="3" align="left" valign="middle"><h1><PERSON>> </tr> <tr> <td width="7" align="center" valign="middle">&nbsp;</td> <td width="215" align="center" bgcolor="#CCCCCC" valign="middle">&quot;Creme au beurre&quot;</td> <td colspan="2" bgcolor="#CCCCCC"><p> <input type="checkbox" name="kaarten[]" value="19 oktober 10u30 Cafe Kiebooms" /> <label for="19 oktober 10u30 Cafe Kiebooms">19 oktober 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="26 oktober 10u30 Cafe Kiebooms" /> <label for="26 oktober 10u30 Cafe Kiebooms">26 oktober 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="21 december 10u30 Cafe Kiebooms" /> <label for="21 december 10u30 Cafe Kiebooms">21 december 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="18 januari 2015 10u30 Cafe Kiebooms" /> <label for="18 januari 2015 10u30 Cafe Kiebooms">18 januari 2015 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="15 februari 2015 10u30 Cafe Kiebooms" /> <label for="15 februari 2015 10u30 Cafe Kiebooms">15 februari 2015 10u30 Cafe Kiebooms</label> </p> <p><PERSON>, maar <PERSON>> </tr> <tr> <td align="center" valign="middle">&nbsp;</td> <td align="center" bgcolor="#CCCCCC" valign="middle">&quot;Wie is er <PERSON> <PERSON>> <td colspan="2" bgcolor="#CCCCCC"><p> <input type="checkbox" name="kaarten[]" value="17 oktober 2014 - 20u. <PERSON>" /> <label for="17 oktober 2014 - 20u. <PERSON> oktober 2014 - 20u. <PERSON>> </p> <p> <input type="checkbox" name="kaarten[]" value="18 oktober 2014 - 20u. <PERSON>" /> <label for="18 oktober 2014 - 20u. <PERSON> oktober 2014 - 20u. <PERSON>> </p> <p> <input type="checkbox" name="kaarten[]" value="19 oktober 2014 - 15u. <PERSON>" /> <label for="19 oktober 2014 - 15u. <PERSON> oktober 2014 - 15u. <PERSON>> </p> <p>10 euro / 2 euro (Omniostatuut)</p></td> </tr> <tr> <td align="left">&nbsp;</td> <td align="right"><label for="tickets">Aantal kaarten en prijs:</label></td> <td colspan="2"><textarea name="tickets" id="tickets" cols="55" rows="5" ><PERSON><PHONE_NUMBER>.</h5> <h5>Geef volgende gegevens door:</h5> <ul> <li> <h5>Datum van de voorstelling</h5> </li> <li> <h5>Aantal plaatsen</h5> </li> <li> <h5>Soort kaarten en prijs</h5> </li> <li> <h5>Uw telefoonnummer</h5> </li> <li> <h5>Uw adres en e-mailadres als u op de hoogte wilt blijven van onze voorstellingen</h5> </li> </ul> <h5>(zie ook het verzendformulier hiernaast)</h5> <h2>Betalen</h2> <h5>Triodos: BE86 5230 8029 4150</h5> <h2>Audities</h2> <h5>Wil je graag een auditie meedoen, meld je aan!</h5> <h2>Reacties op voorstellingen</h2> <h5>Wij zijn altijd heel blij uw reactie op onze voorstellingen te lezen! Uw mailtje is dan ook heel welkom! </h5> <h5><a href="mailto:info@theatervonk.be">info@theatervonk.be</a> Of laat een berichtje achter op ons gastenboek.</h5></td> <td align="center" valign="middle">&nbsp;</td> <td colspan="3" align="left" valign="middle"><h1>Kaarten bestellen:</h1></td> </tr> <tr> <td width="7" align="center" valign="middle">&nbsp;</td> <td width="215" align="center" bgcolor="#CCCCCC" valign="middle">&quot;Creme au beurre&quot;</td> <td colspan="2" bgcolor="#CCCCCC"><p> <input type="checkbox" name="kaarten[]" value="19 oktober 10u30 Cafe Kiebooms" /> <label for="19 oktober 10u30 Cafe Kiebooms">19 oktober 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="26 oktober 10u30 Cafe Kiebooms" /> <label for="26 oktober 10u30 Cafe Kiebooms">26 oktober 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="21 december 10u30 Cafe Kiebooms" /> <label for="21 december 10u30 Cafe Kiebooms">21 december 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="18 januari 2015 10u30 Cafe Kiebooms" /> <label for="18 januari 2015 10u30 Cafe Kiebooms">18 januari 2015 10u30 Cafe Kiebooms</label> </p> <p> <input type="checkbox" name="kaarten[]" value="15 februari 2015 10u30 Cafe Kiebooms" /> <label for="15 februari 2015 10u30 Cafe Kiebooms">15 februari 2015 10u30 Cafe Kiebooms</label> </p> <p>Gratis, maar wel reserveren!</p></td> </tr> <tr> <td align="center" valign="middle">&nbsp;</td> <td align="center" bgcolor="#CCCCCC" valign="middle">&quot;Wie is er bang voor Virginia Woolf?&quot;</td> <td colspan="2" bgcolor="#CCCCCC"><p> <input type="checkbox" name="kaarten[]" value="17 oktober 2014 - 20u. Zwarte Komedie" /> <label for="17 oktober 2014 - 20u. Zwarte Komedie">17 oktober 2014 - 20u. Zwarte Komedie</label> </p> <p> <input type="checkbox" name="kaarten[]" value="18 oktober 2014 - 20u. Zwarte Komedie" /> <label for="18 oktober 2014 - 20u. Zwarte Komedie">18 oktober 2014 - 20u. Zwarte Komedie</label> </p> <p> <input type="checkbox" name="kaarten[]" value="19 oktober 2014 - 15u. Zwarte Komedie" /> <label for="19 oktober 2014 - 15u. Zwarte Komedie">19 oktober 2014 - 15u. Zwarte Komedie</label> </p> <p>10 euro / 2 euro (Omniostatuut)</p></td> </tr> <tr> <td align="left">&nbsp;</td> <td align="right"><label for="tickets">Aantal kaarten en prijs:</label></td> <td colspan="2"><textarea name="tickets" id="tickets" cols="55" rows="5" >Hier opstommen, aub</textarea></td> </tr> <tr> <td align="left">&nbsp;</td> <td align="right"><label for="naam">Naam:</label></td> <td colspan="2"><input type="text" name="naam" id="naam" /> (<img src="afbeeldingen/verplicht_veld.gif" width="8" height="8">) </td> </tr> <tr> <td>&nbsp;</td> <td align="right">Straat:</td> <td colspan="2"><input type="text" name="straat" id="straat" /> (<img src="afbeeldingen/verplicht_veld.gif" alt="" width="8" height="8">) </td> </tr> <tr> <td>&nbsp;</td> <td align="right">Postcode:</td> <td colspan="2"><input name="postcode" type="text" id="postcode" size="5" maxlength="4" /> (<img src="afbeeldingen/verplicht_veld.gif" alt="" width="8" height="8">) </td> </tr> <tr> <td>&nbsp;</td> <td align="right"><label for="plaats">Gemeente:</label></td> <td colspan="2"><input type="text" name="plaats" id="plaats" /> (<img src="afbeeldingen/verplicht_veld.gif" alt="" width="8" height="8">) </td> </tr> <tr> <td>&nbsp;</td> <td align="right"><label for="tel">Tel:</label></td> <td colspan="2"><input type="text" name="tel" id="tel" /> (<img src="afbeeldingen/verplicht_veld.gif" alt="" width="8" height="8">) </td> </tr> <tr> <td>&nbsp;</td> <td align="right"><label for="mail">E-mail:</label></td> <td colspan="2"><input type="text" name="mail" id="mail" /></td> </tr> <tr> <td align="center" valign="middle">&nbsp;</td> <td colspan="3" align="center" valign="middle"><?php require_once('recaptchalib.php'); $publickey = "xxxxxxxxxxxxxxxxxxxx"; // you got this from the signup page echo recaptcha_get_html($publickey); ?></td> </tr> <tr> <td>&nbsp;</td> <td> (<img src="afbeeldingen/verplicht_veld.gif" alt="" width="8" height="8">) Verplicht veld</td> <td width="113" align="center" valign="middle"><input type="submit" name="Verzenden" id="Verzenden" value="Verzenden" /></td> <td width="278" align="center" valign="middle"><input type="reset" name="Wissen" id="Wissen" value="Wissen" /></td> </tr> </table> <h5>&nbsp;</h5></td> </tr> </table> </form> <!-- end .content --></div> <div class="footer"> <blockquote> <p><font color="#660033" size="-3" face="Verdana, Geneva, sans-serif"><a href="https://login.one.com/mail" target="_blank">Webmail</a> <!-- end .footer --></p> </blockquote> </div> <!-- end .container --></div> </body> </html>
00436d709795f5feecfafeba1d85eb84601b34bf48684ac5c6e3364ee1af3c2f
['05bde45e5c8845518c592bcdc990c495']
I have some troubles with CSS in chrome/g-mail. I have a newsletter with custom CSS: <!doctype html> <html> <head> <meta charset="UTF-8"> <title>[newsletters_subject]</title> <style type="text/css">.bean li { list-style-image: url('/wp-content/uploads/li.png'); } I use the same code in the WP site, works just fine. If I send the newsletter the lay-out and li custom image is there but not in G-mail. I don't know why it won't work. Any tips ideas?
cc262bc35c71a7829a33dde332db83b4609606d588ab3e30a0acf182754caba8
['05c9fed18a754990b59675f6fd1172e4']
Good day, I am trying to duplicate my javascript countdowns along with pictures of cards on every loop. The problem is even when placed on the table inside the loop itself, the countdown only shows up in the first. I would like to know what am I missing. There are other codes like adding cards in the webpage shown in the screenshot once clicked and the timer begins on each one, but the main issue is the loop not duplicating. when I add plain text on the table in place of , the plain texts show up on every card. Thanks for any help. HTML: <div class="container"> <br> <div class="row"> <h2 class="bold_font text-align-center">LIST OF CLAIMED CARDS</h2><br> <?php $i = 0; foreach($lstOrders as $rowOrder) { ?> <div class="col-md-4 spacer"> <div class="col-md-12"> <?php $productid = $rowOrder['productid']; $rowProduct = $mcProduct->SelectObj_ProductId($db, $productid); ?> </div> <div class="col-md-12"> <?php for($j = 0; $j < $rowProduct['packageid']; $j++) { echo(' <span class="glyphicon glyphicon-gift color-black"></span> '); } ?> </div> <div class="col-md-12"> <a href="info-detailed.php?i=<?php echo($rowProduct['productid']) ?>"> <img src="../img/uploads/<?php echo($rowProduct['photosrc']) ?>" class="img-responsive clinic"> <img src="../img/shadow-bottom.png" class="img-responsive"> </a> </div> <table align="center"> <tr> <td colspan="4">Reclaim This Coupon In:<hr></td> </tr> <tr align="center"> <td id="c_countdown"></td> </tr> </table> </div> <?php $i = $i + 1; if($i >= 3) { echo('<div class="col-md-12"></div>'); $i = 0; } } ?> <!-- Empty Col --> <div class="col-md-3 form-group"> </div> </div> <!--row--> <div class="row"> <div class="col-md-12 spacer"> </div> </div> </div> JAVASCRIPT: (c_countdown) var countDownDate = new Date("Jan 5, 2019 15:37:25").getTime(); var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); document.getElementById("c_countdown").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; if (distance < 0) { clearInterval(x); document.getElementById("c_countdown").innerHTML = "EXPIRED"; } }, 1000); added TEST in table
a02a52436790814be44eeb85291ce9617d3639dbf39ea39e33e11bf3551b5c61
['05c9fed18a754990b59675f6fd1172e4']
I have a PHP and SQL code that uses Dropzone.js to try and upload photos and add to the database. My issue is that i get a error when I try to use the dropzone for a picture. Heres my Dropzone div: <div class="col-md-4 bg-color-white shadow border-radius"><!-- Photos { --> <div class="row bg-color-dark-gold border-top-radius"> <div class="col-md-12 color-white section-title-bar"> <span class="ion-image"></span>&nbsp;&nbsp;&nbsp; PHOTO </div> </div> <div class="col-md-12 spacer"></div> <div class="col-md-12"> <form action="for_lease_sale_photos_upload.php?i=<?php echo($rowProduct['productid']); ?>" class="dropzone"></form> <br> </div> <div class="col-md-12 spacer"></div> </div> UI: If I try to drag a photo, my other codes do not follow through and get this error message: [Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) characters and less-than characters (`<`) are blocked. m Please remove newlines and encode less-than characters from places like element attribute values in order to load these resources. See https://www.chromestatus.com/feature/5735596811091968 for more details. I am confused why I get the error of "whitespace" and less-than characters because I do not seem to have those. This is my page URL: http://localhost/infinitygroup/cms/for_lease_photos_list.php?i=1 the i=1 is from my SQL statement I was also told to check the "Network" tab in the developer tools to see if I can find the error there.There seems to be no less than or white space in any file. As seen in the screenshot, my photo is being blocked. Will appreciate any help in solving my error. Thank you
d35c1acb149a5e99516768d5355f870a45ced8a3ed76324f683cbcfee2eb03e4
['05d3f918ac8745658bc1c8a72bfcfa73']
I have to admit I have no intuitive feeling (beyond the definition) as what means geometrically to not have a 4-handle for a 4-manifold. Why is it that extending to the 3-skeleton is the same as extending to M ? Is it because a 4-manifold without 4 handle is equal to its 3 skeleton ?
521c2a4153440889968ca7f38a9a4bca9339ba1cd703ab18a8b30003775c70bd
['05d3f918ac8745658bc1c8a72bfcfa73']
I'm not sure I understand the question. They're an academic requirement. Having the citations on the slide allows people to see where I got information from. I don't really expect anyone to actually pay attention to the citations there and then, but if I don't put them in I am open to accusations of plagiarism.
44236406a7741858a71dea6724e903b8faced6469781430d8ad2795b1c13c62f
['05e17e849b684ba3951560d4028e7851']
maxximiliann@Maxximiliann:$ iex -S mix Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [ Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> :observer.start 12:45:30.511 [error] ERROR: Could not find 'wxe_driver.so' in: /home/maxximiliann/.asdf/installs/erlang/22.3.3/lib/wx-1.9/priv {:error, {{:load_driver, 'No driver found'}, [ {:wxe_server, :start, 1, [file: 'wxe_server.erl', line: 65]}, {:wx, :new, 1, [file: 'wx.erl', line: 115]}, {:observer_wx, :init, 1, [file: 'observer_wx.erl', line: 107]}, {:wx_object, :init_it, 6, [file: 'wx_object.erl', line: 372]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]} ]}} These instructions were followed to install erlang-wx on this Ubuntu machine: Operating System: Ubuntu 20.04.1 LTS Kernel: Linux 5.4.0-48-generic Architecture: x86-64 What else is required to get observer to run?
c39ef12615b22b7a94540b7dbc4ac0fca1163f702a261ecd645079bba52c0cb8
['05e17e849b684ba3951560d4028e7851']
Please note: Experience level - Beginner Pyrlang was installed following the instructions provided here and here. maxximiliann@Maxximiliann:~/Pyrlang-master$ make example10a PYTHONPATH=~/Pyrlang-master:~/Pyrlang-master/../Term PYRLANG_ENABLE_LOG_FORMAT=1 PYRLANG_LOG_LEVEL=DEBUG python3 examples/elixir/e10.py Native term ETF codec library import failed, falling back to slower Python impl Traceback (most recent call last): File "examples/elixir/e10.py", line 13, in <module> from pyrlang.gen_server import GenServer ModuleNotFoundError: No module named 'pyrlang.gen_server' make: *** [Makefile:69: example10a] Error 1 What's causing these errors and how are they correctly resolved?
9065b7641e62608711535a8bbe8beb43d0a166c0fd77789fbf294c010c6d73db
['0615ab349f63434f89ae6d0a612c631a']
I found a way to download files without using FtpGetFile. I hope this code can help someone: bool RetrieveFile(const string& strSource, const string& strTarget) { /* The handle for the transfer */ HINTERNET hTransfer = NULL; /* * Set default error */ DWORD error = ERROR_SUCCESS; if( !isConnected ) { debug("%s(): ERROR not connected\n", __FUNCTION__); return false; } /* Initiate access to a remote FTP connection */ hTransfer = FtpOpenFile(hFtpSession, strSource.c_str(), GENERIC_READ, FTP_TRANSFER_TYPE_BINARY, 0); if(hTransfer) { std<IP_ADDRESS>ofstream myostream(strTarget.c_str(), std<IP_ADDRESS>ios<IP_ADDRESS>binary); if ( myostream.is_open() ) { static const DWORD SIZE = 1024; BYTE data[SIZE]; DWORD size = 0; do { BOOL result = InternetReadFile(hTransfer, data, SIZE, &size); if ( result == FALSE ) { error = GetLastError(); Debug("InternetReadFile(): %lu\n", error); } myostream.write((const char*)data, size); } while ((error == ERROR_SUCCESS) && (size > 0)); // Close the stream myostream.close(); } else { Debug("Could not open '%s'.\n", strTarget.c_str()); error = ERROR_FILE_NOT_FOUND; // Not necessarily not found, but it is to describe a file error which is different from ERROR_SUCCESS } // Close const BOOL result = InternetCloseHandle(hTransfer); if ( result == FALSE ) { const DWORD error = GetLastError(); debug("InternetClose(): %lu\n", error); } /* Check error status of the process */ return (error == ERROR_SUCCESS); } DWORD dwInetError; DWORD dwExtLength = 1000; TCHAR *szExtErrMsg = NULL; TCHAR errmsg[1000]; szExtErrMsg = errmsg; int returned = InternetGetLastResponseInfo( &dwInetError, szExtErrMsg, &dwExtLength ); debug("dwInetError: %d Returned: %d\n", dwInetError, returned); debug("Buffer: %s\n", szExtErrMsg); debug("%s() : ERROR to get '%s' file (errorCode=%d)\n", __FUNCTION__, strSource.c_str(), GetLastError()); return false; }
4f038ce64d2d562008ba05083f476972af05e02203405ec91ac38c6c234c774e
['0615ab349f63434f89ae6d0a612c631a']
I'm experiencing a curious problem (very strange, let me say hehe). During a FTP download of an EXE file (24 MB), if the connection is ever interrupted, it appears that the function FtpGetFile of the WinINEt library has a bug and it never returns. This causes that future file transfers fail (the connection is already opened). Apparently, I found a workaround by increasing the timeout of the server transfers but I do not like it. I didn't found a similar problem by googling (maybe I introduced the wrong keywords). I read some forums on the internet and it seems that everyone does not recommend using the FtpGetFile because it is buggy. This appears in a network scenario that has a big lag (and not always) but in good conditions it disappears (downloads take place correctly and FtpGetFile returns always). Here is how I use the function: if( FtpGetFile(m_hFtpSession, strSourcePath.c_str(), strTargetPath.c_str(), 0, 0, FTP_TRANSFER_TYPE_BINARY, 0)==TRUE) Can anyone confirm that? Should I refactor my code and look for an update? Thank you
7bd457645d9819a1c758d0fadacaa2de95479e0867175920ba9a9a4bb79ecf60
['0621be2c254640fb92976e80c12de869']
I fail to see how this question is duplicate of a question that asks "What are some things you can in Windows 7 that you couldn't do in previous versions of Windows? Don't limit your answers to a single feature, I want to learn as much as possible."
51fbcf7d77b17798ec365cad26c5bc2f65f7c696197736349588233535e21665
['0621be2c254640fb92976e80c12de869']
There's alot of ways to do this "by the book" but.. it is completely up to the DM wether or not you can become a god/deity.. My DM could do a scenario where we travel on the road and i get stung by a bee and become the god of bee's for all he cares.. ANYTHING can turn you into a god if it suits the DM.. Pretty simple..
6976466b0b220dffee4748343fcd07933bfebd278d28bcf1ed419920b448f7bf
['06260f3ee4384d9e84ddf3ca090241b1']
<% @parts.each do|x| %> <% @bbb = Relation.where(part: "#{x}") %> <%= **@"#{x}"** = @bbb.collect {|x| x.car} %> <% end %> I'm trying to set the variable in line 3 to the x part value @"#{x}". I can't find the right syntax. I know about send(x) and x.to_sym. But I need to know how to set x in the each loop to an @variable with @. Thanks!
bf567e44517fa702ea95ddb67a67b5209f1ff9eaa9e38362183f5db906b24172
['06260f3ee4384d9e84ddf3ca090241b1']
This is the contents of a each loop, names.each do|x| . I need to substitute v02 with #{x} but am having trouble with the syntax. Please show me how to replace v02 with x. <% @a = Count.find_by_user_id(@user) %> <% @b = @a.v02 %> <% @c = @b * 1.0 %> <% @d = Carpart.find_by_part("v02") %> <% @e = @d.requirement %> <% @f = @c / @e %> <% @g = @f * 100 %> <% @h = [@g, 100].min %> <% @i = Percentage.find_by_user_id(@user) %> <% @i.update_attribute(:v02, @h) %> V02 <%= @i.v02 %>% <% @v02 = @i.v02 %>
09d4b0d54b727fba10f2d52e540e5fddc0686866b46304bcfe54bef687145906
['06282ae7562b4538bbd48d1e437396b2']
I believe your problem is here: { pName: [ foo: // <-- invalid JSON [ nodejs: [ staging: ... If that's the output of an inspector I'd have a look at exactly how the projectObject is being constructed (are you creating an array and then assigning something to a property on it? In which case create an object instead). I'm afraid I'm not sure how I'm expected to get to the requested result with the information available however.
d148e390884e73ed2124b124f49f947ff6ea89e251701f89eb1696c12ca034ef
['06282ae7562b4538bbd48d1e437396b2']
The appearance of option tags is determined by the browser in my experience and often for good reason - think about how differently the appearance is on iOS v chrome and the benefits of this. You can exert some control of the select element however, by using the browser prefixed appearance attribute. For example: select { padding: 2px 10px; border: 1px solid #979997; -webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; -o-appearance: none; appearance: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; } However when clicked, they appear as they normally do in whatever browser you're using. If you want finer control, your best bet I think is @sumitb.mdi's suggestion of a jquery plugin or build something similar yourself from scratch.
d9bde43339b1d7af58d18d62e7601f90ab1c5dd6388603a3f6243d566afd680e
['064414de6d8a4a8cb90b13d78a2dfe25']
Sometimes we have to perform same DB operation multiple times within a loop. How can I compute the execution time for each operation using JMH? public void applyAll(ArrayList<parameter_type> lists) { for(parameter_type param : lists) { saveToDB(param); } } How can I compute the execution time for saveToDB(param) for each time it is being executed/called?
ff65c9f7c6ddd32e277e233c7497cdc6f9b717cfef062379a698ee6be318b71e
['064414de6d8a4a8cb90b13d78a2dfe25']
Say I have a list of apple "listOfApples". class apple { int serial; int price; ...... } Multiple apple may have same serial. I have to make sure that all the apples in listOfApples are sorted based on their serial. More precisely all apples from listOfApples that have serial 0 are in the front of the list. How can I test listOfApples whether it keep the apple in order or not using junit ?
e666833e8f4bd90a539ffc3375fafaf6dcfe306562e40fb541a69ca6b65ae493
['06539c4776234314822fa7e6c7a29aea']
invalidateOptionsMenu() is used to say Android, that contents of menu have changed, and menu should be redrawn. For example, you click a button which adds another menu item at runtime, or hides menu items group. In this case you should call invalidateOptionsMenu(), so that the system could redraw it on UI. This method is a signal for OS to call onPrepareOptionsMenu(), where you implement necessary menu manipulations. Furthermore, OnCreateOptionsMenu() is called only once during activity (fragment) creation, thus runtime menu changes cannot be handled by this method.
2599906a7975f956f3e29c0ef6be3fac761bb4e865eeace79843bf6d3bafdd93
['06539c4776234314822fa7e6c7a29aea']
thanks to @ρяσѕρєя K and <PERSON> ... it helps me a lot and works perfectly From Activity you send data with intent as: Bundle bundle = new Bundle(); bundle.putString("edttext", "From Activity"); // set Fragmentclass Arguments Fragmentclass fragobj = new Fragmentclass(); fragobj.setArguments(bundle); and in Fragment onCreateView method: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // get arguments String strtext = getArguments().getString("edttext"); return inflater.inflate(R.layout.fragment, container, false); } reference : Send data from activity to fragment in android
3f5487398663894024ceaf078a488a2af21e01fd7cca401ff1ad19a889f8da06
['0654275fd5524b1faf8118d4ea9db109']
I am new to struts. I am writing a web application using struts2 rest. I have struts2 configured to accept both rest and non rest url. ( following http://struts.apache.org/release/2.3.x/docs/rest-plugin.html) I expect "http://mylocalhost.com/myApp/detail" url to call DetailController class's index() method. However, I got this error : java.lang.NoSuchMethodException: com.project.struts.rest.controllers.DetailController.execute() java.lang.Class.getMethod(Class.java:1665) It seems struts worked out it need to call detailController, but it tries to call the execute() method instead of the index() method. Have I missed something in my struts config? struts.xml configure file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true" /> <constant name="struts.action.extension" value="xhtml,,xml,json,action"/> <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper" /> <constant name="struts.mapper.prefixMapping" value="/rest:rest,:struts"/> <constant name="struts.convention.action.suffix" value="Controller"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.default.parent.package" value="rest-default"/> <constant name="struts.convention.package.locators" value="controllers"/> </struts> I have a controller called DetailController in com.project.struts.rest.controllers DetailController class: package com.project.struts.rest.controllers; import org.apache.struts2.rest.DefaultHttpHeaders; import org.apache.struts2.rest.HttpHeaders; import com.opensymphony.xwork2.ModelDriven; public class DetailController implements ModelDriven<Object> { private String propertyId; @Override public Object getModel() { // TODO Auto-generated method stub return null; } // GET /test/1 public HttpHeaders show() { return new DefaultHttpHeaders("show"); } // GET /test public HttpHeaders index() { return new DefaultHttpHeaders("index"); } }
428fe3e80ef6eceea0a593aa2cf74fe2f159a9197286d56ebb411bf60190db0e
['0654275fd5524b1faf8118d4ea9db109']
Update: I found out where I went wrong: There should be no # before the variable "Empty" is a jsp tag which isn't working in struts 2 expression(at least not for me). So the code should be, that worked for me. <s:if test="%{property.propertyTypeZhcn!= null || property.propertyAge != null}"> <div id="mini_hosedetail_text"> <s:if test="%{property.propertyTypeZhcn != null}"> <p>propertyType:<s:property value="fullPropertyDetail.propertyTypeZhcn"/> </p> </s:if> <s:if test="%{property.propertyAge != null}"> <p>PropertyAge:<s:property value="fullPropertyDetail.propertyAge"/></p> </s:if> </div> </s:if>
692a5b0b33761b4ea677906a7608060d70d7f7d95423a14fbdad2e5d3a995659
['0657ceca7b25435ab6b1c7a22002a50e']
Here's a JSFiddle for you: http://jsfiddle.net/soyn0xag/6/ Instead of using complex nesting of iterations and loops, use JQuery. This checks whether the key has left the text area (aka complete) $("input[type='text'], textarea").on("keyup", function(){ if($(this).val() != "" && $("textarea").val() != "" && $("input[name='category']").is(":checked") == true){ $("input[type='submit']").removeAttr("disabled"); } }); This check whether the check box has been selected or changed. $("input[name='category']").on("change", function(){ if($(this).val() != "" && $("textarea").val() != "" && $("input[name='category']").is(":checked") == true){ $("input[type='submit']").removeAttr("disabled"); } }); This checks if the element is checked, when everything is check change the submit to show. This is just a snippet, you will need to expand.
17fd1b2de7481f161c60ed8287986174454f33161bcb02f9616e4c5bcbb1be89
['0657ceca7b25435ab6b1c7a22002a50e']
As @CommonsWare's answer is probably the most relevant to your specific case. In the perspective of efficiency, readability and hindsight I would recommend creating a custom TextView and then assigning the TextView to the item row of your RecyclerView or anywhere in your application where you need a specified font for that matter. CustomFontTextView.java package icn.premierandroid.misc; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.widget.TextView; import icn.premierandroid.R; public class CustomFontTextView extends TextView { AttributeSet attr; public CustomFontTextView(Context context) { super(context); setCustomFont(context, attr); } public CustomFontTextView(Context context, AttributeSet attrs) { super(context, attrs); setCustomFont(context, attrs); } public CustomFontTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setCustomFont(context, attrs); } private void setCustomFont(Context ctx, AttributeSet attrs) { String customFont = null; TypedArray a = null; if (attrs != null) { a = ctx.obtainStyledAttributes(attrs, R.styleable.CustomFontTextView); customFont = a.getString(R.styleable.CustomFontTextView_customFont); } if (customFont == null) customFont = "fonts/portrait-light.ttf"; setCustomFont(ctx, customFont); if (a != null) { a.recycle(); } } public boolean setCustomFont(Context ctx, String asset) { Typeface tf = null; try { tf = Typeface.createFromAsset(ctx.getAssets(), asset); } catch (Exception e) { Log.e("textView", "Could not get typeface", e); return false; } setTypeface(tf); return true; } } values/attrs.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="CustomFontTextView"> <attr name="customFont" format="string"/> </declare-styleable> </resources > Example item row for RecyclerView <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp" card_view:cardUseCompatPadding="true" card_view:cardCornerRadius="8dp"> /** Containers and other Components **/ <icn.premierandroid.misc.CustomFontTextView android:id="@+id/comment_user_name" android:layout_height="match_parent" android:layout_width="0dp" android:layout_marginStart="5dp" android:layout_marginLeft="5dp" android:gravity="center_vertical" android:layout_weight="0.36"/> <icn.premierandroid.misc.CustomFontTextView android:layout_width="0dp" android:layout_weight="0.40" android:layout_height="match_parent" android:gravity="center_vertical" android:layout_marginStart="1dp" android:layout_marginLeft="1dp" /> <icn.premierandroid.misc.CustomFontTextView android:id="@+id/comment_time" android:layout_width="0dp" android:layout_weight="0.25" android:gravity="center_vertical" android:layout_height="match_parent"/> /** Containers and other Components **/ </android.support.v7.widget.CardView> So armed with this code, you won't need to change anything in your RecyclerView.Adapter, RecyclerView.ViewHolder or anywhere where you have a TextView already initialized. Note: you can still initialize the components by using TextView textView = (TextView) findViewById(R.id.textView);. The XML does all the work for you. Unless you are creating TextView components programmatically then you would need to create it as CustomFontTextView textView = new CustomFontTextView(); Also you can apply the same logic to almost any components such as EditText, Switches, RadioButtons, TabLayouts etc etc
4b508c8435d503b5bfd2c00551ce27a79527824a04752f290bea8734c253f18c
['0657ee72494947be865cf1d39ce98485']
My Solution: I had to use an Ubuntu Image as a docker Image. I installed on this docker image python pyspark and spark. Dockerfile: FROM ubuntu:latest RUN apt-get update RUN apt-get install -y openjdk-8-jdk RUN apt-get update RUN apt-get install git -y RUN apt-get update RUN apt-get install wget -y COPY handler.py / COPY Crimes.csv / RUN wget 'https://downloads.apache.org/spark/spark-3.0.1/spark-3.0.1-bin- hadoop2.7.tgz' RUN tar -xzvf spark-3.0.1-bin-hadoop2.7.tgz RUN rm spark-3.0.1-bin-hadoop2.7.tgz RUN apt-get install -y python3-pip python3-dev python3 RUN apt-get update RUN pip3 install --upgrade pip RUN ln -s /usr/bin/python3 /usr/bin/python RUN pip install pyspark RUN sed -i.py 's/\r$//' handler.py CMD ./spark-3.0.1-bin-hadoop2.7/bin/spark-submit --master spark://spark-master:7077 -- files Crimes.csv ./handler.py The spark-submit command with --files is uploading the csv to the master and all slaves. After this i was able to read in the CSV file with following code: from pyspark.sql import SparkSession from pyspark import SparkFiles spark = SparkSession.builder.appName("pysparkapp").config("spark.executor.memory", "512m").getOrCreate() sc = spark.sparkContext df = sc.textFile(SparkFiles.get('Crimes.csv')) The SparkFiles.get('fileName') gets the path from the file within the spark system, which was uploaded with the spark-submit --files command.
867e3cae30d18d3f71525d08118edce4f95962ede57b5977a22f1a1c5b8ebb40
['0657ee72494947be865cf1d39ce98485']
i'm new to testing in C# using Appium. I was able to set everything up and to run test. I used UiAutomatorViewer to get access to some Buttons, now i need to Click on a Button, but i just got the Cont-desc. Which FindElement(ByAndroidUIAutomator."") is linked to the cont-desc? I tried everything but i always get an error. I already tried to Click on this Button using TouchAction or mouse.Click();Nothing worked... Any Help would be nice. Thanks in advance:)
6350530a0a07dd0bd500111282c9f6c0e33aed9d79e845c2a2c9f953d437b141
['066148c84f0b45ac975eecf1ceff546b']
import { ReflectiveInjector } from '@angular/core'; import { Http, XHRBackend, ConnectionBackend, BrowserXhr, ResponseOptions, XSRFStrategy, BaseResponseOptions, CookieXSRFStrategy, RequestOptions, BaseRequestOptions } from '@angular/http'; class MyCookieXSRFStrategy extends CookieXSRFStrategy {} ... let http = ReflectiveInjector.resolveAndCreate([ Http, BrowserXhr, { provide: ConnectionBackend, useClass: XHRBackend }, { provide: ResponseOptions, useClass: BaseResponseOptions }, { provide: XSRFStrategy, useClass: MyCookieXSRFStrategy }, { provide: RequestOptions, useClass: BaseRequestOptions } ]).get(Http); Sure, you still need HttpModule included, enjoy!
eb73d4f572f3997f17865f5d0b584bc8e35dbcef21e0750066f26f9e2b360750
['066148c84f0b45ac975eecf1ceff546b']
Experimenting with OrientDB, I'm trying to execute a linked to an instance OFunction from a function. There is a OFunction instance with name "testFunction" and @rid #6:2; My class has a property: create property MyClass.myFunction LINK OFunction My instance is: insert into MyClass set myFunction = #6:2 Now I want to create a HTTP REST executable function that selects my instance and executes its linked function. I see that db.query('select from MyClass limit 1')[0].field('myFunction'); is resulting correctly to "@type": "d", "@rid": "#6:2", "@version": 1, "@class": "OFunction", ... How to execute it by this reference? I know it can be executed by name with: db.getMetadata().getFunctionLibrary().getFunction("test1").execute(); But it make no sense to search the function by string. Thank you.
4460c7b6e3068a75efddd5853732e5cd0a10e400203afd948dd4dda1a15c3671
['067bcbe679c44cba889bb1bcc1c2de2a']
i am using a surface view to draw interactive piechart. here is my code which will looks like all surface view examples. class PieChart extends SurfaceView implements SurfaceHolder.Callback { public PieChart(Context context) { super(context); // Log.i("PieChart", "PieChart : constructor"); getHolder().addCallback(this); } @Override public void onDraw(Canvas canvas) { if (hasData) { resetColor(); try { canvas.drawColor(getResources().getColor(R.color.graphbg_color)); graphDraw(canvas); } catch (ValicException ex) { } } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.i("PieChart", "surfaceChanged"); } public int callCount = 0; @Override public void surfaceCreated(SurfaceHolder holder) { try { // Log.i("PieChart", "surfaceCreated"); mChartThread = new ChartThread(getHolder(), this); mChartThread.setRunning(true); if (!mChartThread.isAlive()) { mChartThread.start(); } Rect mFrame = holder.getSurfaceFrame(); mOvalF = new RectF(0, 0, mFrame.right, mFrame.right); } catch (Exception e) { // No error message required } } @Override public void surfaceDestroyed(SurfaceHolder holder) { // Log.i("PieChart", "surfaceDestroyed"); boolean retry = true; callCount = 0; mChartThread.setRunning(false); while (retry) { try { mChartThread.join(); retry = false; } catch (InterruptedException e) { // No error message required } } } } class ChartThread extends Thread { private SurfaceHolder mSurfaceHolder; private PieChart mPieChart; private boolean mRefresh = false; public ChartThread(SurfaceHolder surfaceHolder, PieChart pieChart) { // Log.i("ChartThread", "ChartThread"); mSurfaceHolder = surfaceHolder; mPieChart = pieChart; } public void setRunning(boolean Refresh) { // Log.i("ChartThread", "setRunning : " + Refresh); mRefresh = Refresh; } @Override public void run() { Canvas c; // Log.i("ChartThread", "run : " + mRefresh); while (mRefresh) { c = null; try { c = mSurfaceHolder.lockCanvas(null); // c.drawColor(0xFFebf3f5); synchronized (mSurfaceHolder) { mPieChart.onDraw(c); } } catch (Exception ex) { } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { mSurfaceHolder.unlockCanvasAndPost(c); } } } } } with this i am able to draw pie charts successfully. but here the issue is "before loading pie chart black rectangle is visible for a second which is surfaceview's default back ground". so I want to set background color for surface view to avoid the black rectangle. The following is the changed code for drawing background color to surface view. public PieChart(Context context) { super(context); // Log.i("PieChart", "PieChart : constructor"); getHolder().addCallback(this); setBackgroundColor(getResources().getColor(R.color.graphbg_color)); } @Override public void onDraw(Canvas canvas) { if (hasData) { setBackgroundColor(getResources().getColor(R.color.graphbg_color)); resetColor(); try { canvas.drawColor(getResources().getColor(R.color.graphbg_color)); graphDraw(canvas); } catch (ValicException ex) { } } } with these changes, black rectangle issue is resolved. but piechart is not refreshing properly. can someone help me to resolve any of these two issues.
c16a8dee8858376276271cc2f3ba36e1ba18f48ec5cea483f73481fa45fb7e00
['067bcbe679c44cba889bb1bcc1c2de2a']
I wants to group multiple push notifications received to My app like Gmail. below picture will describe the requirement. I have gone through many tutorials including developers website https://developer.android.com/training/notify-user/group But no luck. all the Received notifications are displaying as individual notification. Below is my code snippet. @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); // put the new message onto the event bus so that interested activities can subscribe to it // TODO[tim] we should probably look at the content of the message and send different events // onto the bus for different message types. int notificationId = (int) SystemClock.currentThreadTimeMillis(); createNotificationChannel(); NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext, ANDROID_CHANNEL_ID) .setSmallIcon(R.mipmap.ic_launcher) // notification icon .setContentTitle(getTitle()) // title .setContentText("Vyn processed and ready to play") // body message .setContentIntent(getVynPlayIntent(getIntentExtraValues(), notificationId)) .setAutoCancel(true) // clear notification when clicked .setGroup(GROUP_KEY_VYNS) .setGroupSummary(true) .setPriority(NotificationCompat.PRIORITY_DEFAULT); if (builder != null) { getManager().notify(notificationId, builder.build()); } } private static final String ANDROID_CHANNEL_ID = "notifications.ANDROID_CHANNEL_ID"; private static final String GROUP_KEY_VYNS = "notifications.GROUP_KEY_VYNS"; private void createNotificationChannel() { // Create the NotificationChannel, but only on API 26+ because // the NotificationChannel class is new and not in the support library if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = "channel_name"; String description = "channel_description"; int importance = NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel(ANDROID_CHANNEL_ID, name, importance); channel.setDescription(description); // Register the channel with the system; you can't change the importance // or other notification behaviors after this getManager().createNotificationChannel(channel); } } private NotificationManagerCompat mManagerCompat; public NotificationManagerCompat getManager() { if (mManagerCompat == null) { mManagerCompat = NotificationManagerCompat.from(mContext); } return mManagerCompat; } Please help me finding whats missed in this code, if you identify.
c1958b4c2acfa982164eba6f8655f393b5062c69ca61ace31e10112dba5ddc6f
['0685b5bbd11542d3ad75dad4cebabedf']
I am trying to generate row number for each row selected from my database but it seems that the row number follows the sequence of the table before it's arranged (order by). Actual table https://www.dropbox.com/s/otstzak20yxcgt6/test1.PNG?dl=0 After query https://www.dropbox.com/s/i9jaoy04vq6u2zh/test2.PNG?dl=0 Code SET @row_num = 0; SELECT @row_num := @row_num + 1 as Position, Student.Stud_ID, Student.Stud_Name, Student.Stud_Class, SUM(Grade.Percentage) AS Points FROM Student, Student_Subject, Grade WHERE Student.Stud_ID = Student_Subject.Stud_ID AND Student_Subject.Stud_Subj_ID = Grade.Stud_Subj_ID AND Student.Stud_Form = '1' AND Grade.Quarter = '1' GROUP BY Student.Stud_ID ORDER BY Points DESC Pls help. Looking forward to receiving replies from yall. Thanks!
d01138f8fe871f2f8eab1da18532b2428de6522c363ede732fc4a3910c899704
['0685b5bbd11542d3ad75dad4cebabedf']
Desired output - https://www.dropbox.com/s/1mnrabcefvezt89/test11.png?dl=0 I'm trying to join these 4 different queries from the same table ON Attend_Date but I have no idea how to do it. The final output would be Attend_Date, P, A, MC (total of 4 columns) SELECT Attendance.Attend_Date FROM Student, Attendance LEFT OUTER JOIN ( SELECT Attendance.Attend_Date, COUNT(Attendance.AttendDet_Type) as P FROM Student, Attendance WHERE Student.Stud_ID = Attendance.Stud_ID AND Student.Stud_Class = '1A1' AND Attendance.Attend_Date BETWEEN '2014-01-01' AND '2014-12-01' AND Attendance.AttendDet_Type = 'P' GROUP BY Attendance.Attend_Date ) ON Attendance.Attend_Date WHERE Student.Stud_ID = Attendance.Stud_ID AND Student.Stud_Class = '1A1' AND Attendance.Attend_Date BETWEEN '2014-01-01' AND '2014-12-01' GROUP BY Attendance.Attend_Date Can anyone help me out? Thanks alot!!
403c8fa44e2a79ba6e5a6a8c0e51f8863927c6a4b5e9cbcfa1973f0627ebafbb
['069a502e351d405ba14c796cf9272a43']
I was successfully bypassed certificate validation by the following steps: Get the certificate X509Certificate2 clientCert = GetClientCertificate(); Create request handler and pass the certificate WebRequestHandler requestHandler = new WebRequestHandler(); requestHandler.ClientCertificates.Add(clientCert); Call the handler System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; Create HttpClient object passing the handler and call the service. HttpClient client = new HttpClient(requestHandler) I hope this is useful for you.
7ff14039119a0159d8e3f976deb5b00edd528f7601a75c2b04fc7ce6e8f0034a
['069a502e351d405ba14c796cf9272a43']
I searched google and SO for my scenario but not able to find an answer. I want to create a regular expression data annotation validation in a viewmodel class properties which are of double type. Since I have around 20 properties of type double. So I want to create a custom regular expression validation and apply to all double type properties without explicitly specifying on each property like: [RegularExpression(@"^[0-9]{1,6}(\.[0-9]{1,2})?$", ErrorMessage ="Invalid Input")] public double Balance { get; set; } I am expecting thing like this: [ApplyRegExpToAllDoubleTypes] public class MyModel { public double Balance { get; set; } public double InstallmentsDue { get; set; } }
9a8680ea796635201a626ce4c30ea090342acbabaab79e8a7f47e01c2c0f113a
['069d2760123a4c2493f9e8e3831ee278']
You can do it simply and totally from GUI: to create a root owned shell file to launch it as root from GUI do: sudo mousepad create a .sh file, from instance save it in /home/YOUR_USER/studio.sh put in it this command: gksudo android-studio (if you don't have gksudo install package gksu to get it) from terminal change file permissions to execute it: sudo chmod 775 /home/YOUR_USER/studio.sh edit the menu entry to add the entry: settings -> menu edit (can change from your ubuntu version) add an entry for the shell script: /home/YOUR_USER/studio.sh, you could use the original android studio icon for it now you can launch the studio from the menu providing the superuser password
367639b4b5330e344847933d3918d17bcf77d03893dde81bde275dda8e705c98
['069d2760123a4c2493f9e8e3831ee278']
what I did is: sudo mousepad: to create a root owned shell file to launch it as root from GUI save a .sh file with this command: gksudo android-studio for instance save it in /home/YOUR_USER/studio.sh sudo chmod 775 /home/luca/studio.sh: allow execution of it settings -> menu edit add an entry in the menu, with the command: /home/YOUR_USER/studio.sh done. the advantage is that it didn't open a terminal to work an is very simple
e72070fcb7805641d1b104bfef3f965a70afc45859a8fe64b471b867e8ab93b9
['06a40da53fc54fa28f9225c2d1c6c56a']
As an aside, I managed to fix this, and @PeterTheLobster came closest. In short, in attaching to the 'click' listener, we then e.preventDefault(); the form, made sure the overlay was displayed by delaying the submission of the form by 1 second. function main_form_overlay() { var form_outer = jQuery('.main-form'), form = jQuery('.main-form form'), html, overlay; html = '<div class="loading-overlay"><span class="text">Checking 77 Destinations, please Be Patient <i class="fa fa-circle-o-notch fa-spin"></i></span></div>'; form_outer.append(html); overlay = jQuery('.main-form .loading-overlay'); jQuery('#gform_submit_button_2').on('click', function(event){ //Prevent the form from submitting var e = event || window.event; e.preventDefault(); console.log("In Here!"); if (!overlay.is(':visible')) { overlay.show(); console.log("Show Overlay"); } else { overlay.hide(); console.log("Hide Overlay"); } //Submit the form now window.setTimeout(function() { form = jQuery('.main-form form'); form.submit(); },1000); }); }
984ef2b95d43a7c2a62210a1289be51aa49da345956929cf50c1f173b2b72ad9
['06a40da53fc54fa28f9225c2d1c6c56a']
Okay. If anybody else gets this issue, it's because it's a brand new site. After a while (about a week for me), it corrected itself. <PERSON>'s answer below is half way there, if you sign up to Google Search Console and go to Security & Manual Actions > Security, you will see if your site has any security issues. If you don't, then eventually the warning will disappear. Again, it was about a week, but you may be different. I guess possible advice is to register a domain before needing it.
b34a20d014fbbcb7567893d5fd0ab4752d5bd5c8f5ba7413ea382a06ec138245
['06baf537be3b4d5bb0de6c2059594370']
No, you don't need to use access tokens in this case. When devices are connected to the ThingsBoard via integrations (TTN integration in your case) - they are automatically registered in the ThignsBoard and you do not need to explicitly manage the authentication process. The reason is that authentication is performed on the integration level (the link between TTN and the thingsBoard).
d0c60700c4434959b961f430e73a656b8dffdae16d1c7f9ce788d2ec4a0d37bf
['06baf537be3b4d5bb0de6c2059594370']
In the ThingsBoard, for SQL databases, UUID is trimmed inside the database and - chars are removed. Take a look at this util: org.thingsboard.server.common.data.UUIDConverter fromTimeUUID() -> transform UUID into String (this value you see in the Postgresql) fromString() -> convert string to real UUID public static UUID fromString(String src) { return UUID.fromString(src.substring(7, 15) + "-" + src.substring(3, 7) + "-1" + src.substring(0, 3) + "-" + src.substring(15, 19) + "-" + src.substring(19)); }
c5e1d7489cc345ad1c44928d4299f091485892deeb89e5a0103cb1aca8a0395f
['06c5e3b4ced4441599a4197f0f21824d']
Your css applies the height attribute only to the body. The divs with id "playbox" and "player" still have height 0. Since it looks like you're embedding a player from another site, do you have a working example of this player? Maybe start from a working example and insert that into your code. Generally you don't need to manually style elements of a player like this in order to get it to work. It could be that there is some sort of deeper problem going on...like nothing showing up inside the box and that's why it's having height 0. You could try adding CSS to style specific elements by ID, like: #player #playbox{ height: 100%; } etc. but my intuition is that this won't achieve what you want.
d45d1a134a7904249a192b0dc1080c63bfaf7a5b6967cb54be4a4720bcde7ad2
['06c5e3b4ced4441599a4197f0f21824d']
There are many different ways of implementing this. In general, you probably won't be able to do something this complicated with HTML and Javascript alone, you'll need a database and some sort of scripting language like PHP or Ruby on your server to dynamically generate the pages. It's not clear to me what languages you'd want to use, so I'll give a general description: On the back-end, in a database I'd create a table for the general product. This table would have a field for product type. Then I would create additional tables for the specific product types, and have these tables store all the additional fields, and the primary key referencing the entry in the main, general product table. I would then create a table for product type, which has the product ID's used in the field in the general product table, and a second field referencing the name of the table in the database that stores this type of product. The code that is all in common between all types of products, I would have reference the general product table. I would then allow the user to specify the product type, and when this is clicked, send the user to a new page, which would run a script. The script would query the database to retrieve the table name for that data type, and then query the database for a description of additional fields specific to that data type, and display an appropriate form, dynamically generated based on what the database returns.
ffc51f5886ef92fe7968e0edf5b1c791b60d418c9c301d70e16f07268649feed
['06c6f2a3ccc6405eb6bfa2cf85bda3d9']
I figured it out. To count number of days: =SUMPRODUCT((A2:A8)<>"")/(COUNTIF((A2:A8);(A2:A8))+((A2:A8)=""))) And since I am using indirect referencing here is the actual formula that I used: =SUMPRODUCT(((INDIRECT("A" &B2):INDIRECT("A" &B3))<>"")/(COUNTIF((INDIRECT("A" &B2):INDIRECT("A" &B3));(INDIRECT("A" &B2):INDIRECT("A" &B3)))+((INDIRECT("A" &B2):INDIRECT("A" &B3))="")))
6932f9345e80721cc19123d5620c3bf8e26560eded906a0cdc6609b85f17388c
['06c6f2a3ccc6405eb6bfa2cf85bda3d9']
I have a list of, among other things, dates and hours worked on during each session. This means that I can have multiple entries for the same date. Ex: |Date| -- |Hours/session| 1/1/2015 -- 1.5 1/1/2015 -- 2 1/1/2015 -- 0.5 1/3/2015 -- 1.5 1/3/2015 -- 1 1/4/2015 -- 2 1/7/2015 -- 1.5 I want to be able to find out how many hours per day I am averaging, but dividing hours by the number of days includes the 2nd, 5th and 6th in the average. In this example, if I take all the hours and divide it by number of days from the beggining to end, I end up with (1.5+2+.5+1.5+1+2+1.5=10) 10/7(1st to the 7th)=1.43 instead of the correct daily average of 10/4(actual days worked)=2.5 The main problem is that I have a list of over 2k entries, so I cannot go through and do this manually. Help?
8ec7da10f480b6e31579522c77c24ea05a2023621abf0f86e336a7c1d6795ef9
['06d45a5eab854e8aa7627a593251631e']
I researched this over the weekend and learned that my D600's Intel Pentium M CPU actually DOES support pae, though its CPUID does not have the pae bit set. Armed with this information, I booted the D600 with the current pae Live-USB build, selected Install and hit TAB instead of ENTER to display the boot command line, and added " forcepae -- forcepae" (just as I typed it here, without the "s) before hitting Enter to start the install. Since my 40GB hard drive was already filled with Windows XP and data I wanted to keep, I installed into the empty space on my 32 GB Sandisk USB drive. There was 28.24GB available because it also contained the Live image that I booted to in order to run the install. I let the installer find the largest contiguous unallocated space (or words to that effect) and decide how to allocate it between the installation and swap partitions. I let the installer install Grub on my hard drive so I can select Kali or WinXP at boot time (in theory... I was out of the room when the install finished and the D600 rebooted, and I returned to find the Kali login screen on it). After testing a bit, the only flies in the ointment are that: Grub doesn't offer me the choice of booting the Windows XP on the system hard drive as promised during installation, and Kali is slower than molasses in winter. I'm guessing I need to update the display driver for the ATI Radeon 9000 Mobility device. It does, however, capture network traffic with Wireshark and that's what I wanted it for. On the bright side, the wireless device worked with the stock install with no additional drivers.
1138848b71255a745246da399ee4a22a8b3641a93641e652290cd3c76ae6be10
['06d45a5eab854e8aa7627a593251631e']
@SolarMike Apple might have various commercial reasons for their advice, which may not matter to me or to SE contributors. E.g., Apple may seek to avoid bad publicity from a few laptop fires. As they sell millions of laptops, this makes sense to them, even if the probability of an individual laptop burning is tiny. Maybe Apple would want people buy new laptops, and so on.
71cdfe05734f1f25e6ea72f24f3d87287a2d87da0de055a2cb1d37ae966d2353
['06e4278821994acea835d382397f6d68']
I'm a little new to programming and to Twilio I'm trying to build a web app that can send bulk voice and SMS to a group of people by uploading an audio file and uploading an excel sheet with phone numbers and press send can anyone help me get started?
719e41f6f14baec5e613df944b6492311326a50be0d1381a3cd3a71e5709449a
['06e4278821994acea835d382397f6d68']
I'm trying to make a google sheet where people can come and scan a barcode and they will automatically get a receipt by cell range I will set is there a way to print a receipt every time cell a1 is changing without someone should press control p or any other buttons?
b91fa1957faa7b7a162bbf0f61600d32f77037073036011bc899c76ab8e6bfb8
['06f4c0b9bce343bfa2fc8d5965b3ec71']
@vicatcu Its not that its too slow, for my application SD card plus connector is more costly and SD cards can be less reliable. <PERSON> I wasn't sure where to put it. Like a lot of embedded design questions this sort of falls in the middle. If it doesn't go well here I would gladly move it.
5dfeed08d3725eb8ceef73eff56ca99137b0c2dd9d90bc6b6d98137537f47bf3
['06f4c0b9bce343bfa2fc8d5965b3ec71']
Hehehe, duty. But in all seriousness, Hz is a measure of cycles per second. For example, driving a PWM servo motor, the standard period is 20 ms I believe, which is 50 Hz. Inside of that, the duty cycle is a measure of active period (could be active high or low) as a percent of the total period time. The servo control comes from duty cycle. If there is 2 ms of asserted signal, and 18 ms of deasserted signal, you now have a 50 Hz signal, with a 10% duty cycle. Conversely, if you have 18 ms of asserted signal, followed by 2 ms of deasserted signal within the single 20 ms period; you still have a 50 Hz signal, but now you have a 90% duty cycle.
a84518fe870eb053703ce4b533047a69daa06464c821935cfe586ef38e4bb917
['06fe3f3badf5404f876bfe0016ed0116']
I was hoping there was someone who could help me with the problem I am having here. My program is below, and the problem I am having is that I can't figure out how to write the process() function to take a .txt file with a bunch of random numbers, read the numbers, and output only the positive ones to a separate file. I have been stuck on this for days now and I don't know where else to turn. If anyone could provide some help of any kind I would be very appreciative, thank you. /* 10/29/13 Problem: Write a program which reads a stream of numbers from a file, and writes only the positive ones to a second file. The user enters the names of the input and output files. Use a function named process which is passed the two opened streams, and reads the numbers one at a time, writing only the positive ones to the output. */ #include <iostream> #include <fstream> using namespace std; void process(ifstream & in, ofstream & out); int main(){ char inName[200], outName[200]; cout << "Enter name including path for the input file: "; cin.getline(inName, 200); cout << "Enter name and path for output file: "; cin.getline(outName, 200); ifstream in(inName); in.open(inName); if(!in.is_open()){ //if NOT in is open, something went wrong cout << "ERROR: failed to open " << inName << " for input" << endl; exit(-1); // stop the program since there is a problem } ofstream out(outName); out.open(outName); if(!out.is_open()){ // same error checking as above. cout << "ERROR: failed to open " << outName << " for outpt" << endl; exit(-1); } process(in, out); //call function and send filename in.close(); out.close(); return 0; } void process(ifstream & in, ofstream & out){ char c; while (in >> noskipws >> c){ if(c > 0){ out << c; } } //This is what the function should be doing: //check if files are open // if false , exit // getline data until end of file // Find which numbers in the input file are positive //print to out file //exit }
c83d17959060f28c88384c51d312c75379f8e6ffeb44b209f1b483491181bd81
['06fe3f3badf5404f876bfe0016ed0116']
I have this java program that reads values from a database, and uses those values in each table for creating a schedule. I do not have a server accessible, so the database will have to be moved around from computer to computer when the program is moved. It will have about 200 tables, each one with a time, number, title, and description. I have tried using Microsoft Access, but Java 8 just changed some setting so that the program cannot link the Access database, even though there used to be a simple way to do this. I know about Java DB, but to my knowledge it needs a server to host the database on, same with SQL, and I do not have one to use. My question is, which program can I use to create a client-side database that can be linked with a java program, without breaking off an arm and a leg. Thank You for any suggestions.
b31978ad2c2fe77e2d3073e2ae5074aeec68a402d2bd686596dc49cb9feefe9a
['06ffd16198254e908e880e5e7bdf6e7d']
It is not possible to do exactly the thing that you are asking, but you can achieve the functionality if you wrap your OtherClass with WrapperClass public class WrapperClass { public OtherClass Input; } public class CLass1 { WrapperClass _wrapper; public Bind(ref WrapperClass wrapper) { wrapper = new WrapperClass(); wrapper.Input = new OtherClass(); // instantiating the object _wrapper = wrapper; // keeping a reference of the created object for later usage! } public void Unbind() { _wrapper.Input= null; } }
946d76b74660448d4dd9809bdc3ac33b2d5a30f5cbbb0440d242fce983c42a06
['06ffd16198254e908e880e5e7bdf6e7d']
For simplicity, I skipped comparison of the byte array and DateTime data membes, only left the IDs and the string data members, but to add them you will need some small modification. The test is very-very basic, but shows all three of the changes options: static void Main(string[] args) { ClassOfKb KbA = new ClassOfKb(); ClassOfKb KbB = new ClassOfKb(); // Test data -------- Data data1 = new Data() { ID = Guid.NewGuid(), name = "111" }; Data data2 = new Data() { ID = Guid.NewGuid(), name = "222" }; Data data2_changed = new Data() { ID = data2.ID, name = "222_changed" }; Data data3 = new Data() { ID = Guid.NewGuid(), name = "333" }; Info info1 = new Info() { ID = Guid.NewGuid(), text = "aaa" }; Info info2 = new Info() { ID = Guid.NewGuid(), text = "bbb" }; Info info2_changed = new Info() { ID = info2.ID, text = "bbb_changed" }; Info info3 = new Info() { ID = Guid.NewGuid(), text = "ccc" }; KbA.KbData.Add(data1); KbA.KbData.Add(data2); KbA.KbInfo.Add(info1); KbA.KbInfo.Add(info2); KbB.KbData.Add(data2_changed); KbB.KbData.Add(data3); KbB.KbInfo.Add(info2_changed); KbB.KbInfo.Add(info3); // end of test data --------- // here is the solution: var indexes = Enumerable.Range(0, KbA.KbData.Count); var deleted = from i in indexes where !KbB.KbData.Select((n) => n.ID).Contains(KbA.KbData[i].ID) select new { Name = KbA.KbData[i].name, KbDataID = KbA.KbData[i].ID, KbInfoID = KbA.KbInfo[i].ID }; Console.WriteLine("deleted:"); foreach (var val in deleted) { Console.WriteLine(val.Name); } var added = from i in indexes where !KbA.KbData.Select((n) => n.ID).Contains(KbB.KbData[i].ID) select new { Name = KbB.KbData[i].name, KbDataID = KbB.KbData[i].ID, KbInfoID = KbB.KbInfo[i].ID }; Console.WriteLine("added:"); foreach (var val in added) { Console.WriteLine(val.Name); } var changed = from i in indexes from j in indexes where KbB.KbData[i].ID == KbA.KbData[j].ID && (//KbB.KbData[i].file != KbA.KbData[j].file || KbB.KbData[i].name != KbA.KbData[j].name || //KbB.KbInfo[i].date != KbA.KbInfo[j].date || KbB.KbInfo[i].text != KbA.KbInfo[j].text ) select new { Name = KbA.KbData[j].name, KbDataID = KbA.KbData[j].ID, KbInfoID = KbA.KbInfo[j].ID }; Console.WriteLine("changed:"); foreach (var val in changed) { Console.WriteLine(val.Name); } Console.ReadLine(); } } public class ClassOfKb { public List<Data> KbData = new List<Data>(); public List<Info> KbInfo = new List<Info>(); } public class Data { public Guid ID { get; set; } public byte[] file { get; set; } public string name { get; set; } } public class Info { public Guid ID { get; set; } public string text { get; set; } public DateTime date { get; set; } }
633732ff29543af61fd13de22451ea833dbfa8bd060ec1b458db6d7fe42e9feb
['07091cdec2634274841e7ce643d20fe4']
I'm still learning how to test components and js code but now I'm stuck with Vuex modules... Here is the code of the test: import { shallowMount } from '@vue/test-utils' import WorkoutsHistory from '../../src/components/WorkoutsHistory.vue' import workout from '../../src/store/modules/workout' const mocks = { $store: { modules: { workout } } } const propsData = { show: false } let wrapper describe('WorkoutsHistory.vue', () => { beforeEach(() => { wrapper = shallowMount(WorkoutsHistory, { mocks, propsData }) }) it('should match snapshots', () => { expect(wrapper).toMatchSnapshot() }) it('should render the workout-list', () => { expect(wrapper.find('.workout-list')).toBeTruthy() }) }) And the imported module is: import mutations from './mutations' const state = { exercises: {}, workouts: {} } export default { namespaced: true, state, mutations } My problem here is simple, when I run the test, it returns me an error: TypeError: Cannot read property 'workout/' of undefined, which is weird for me due that I'm declaring the structure as is in the Vuex Store (I also tried with \createLocalVue). Here is the component script: <script> import { mapState } from 'vuex' import NewExercise from './NewExercise' export default { name: 'WorkoutsHistory', components: { NewExercise }, data() { return { show: false } }, computed: { ...mapState('workout', ['workouts']) }, methods: { showForm() { this.show = !this.show } } } </script> Any idea or advice here?
8844990090e130df6184edc9e641e865f57d0e69b23d51911193b845ce323f5c
['07091cdec2634274841e7ce643d20fe4']
I'm triying to make a controller/service for a state that get via my own query-method a list of clients. It's weird because the "getAll" method works perfectly, the problem is query or some other get method... anyway, here is the service: (function() { 'use strict'; angular .module('omi.services') .factory('cliente', clienteFactory); clienteFactory.$inject = ['$http']; function clienteFactory ($http) { var baseUrl = 'http://localhost:3000/omi/v1/clientes/'; var service = { create : create, getAll : getAll, getOne : getOne, query : query, remove : remove, update : update }; return service function create (clienteData) { // body... } // end create function getAll () { return $http.get(baseUrl) .success(getAllComplete) .error(getAllOnError); function getAllComplete (data) { return data; } function getAllOnError (data) { return data; } } } // end facturaFactory function getOne (cliente) { return $http.get(baseUrl + cliente) .success(getOneComplete) .error(getOneOnError); function getOneComplete (data) { return data; } function getOneOnError (data) { return data; } } // end getOne function query (query) { return $http.get(baseUrl + 'buscar' + query) .success(queryComplete) .error(queryOnError); function queryComplete (data) { return data; } function queryOnError (error) { return data; } } // end query function remove (factura) { // body } // end remove function update (clienteData) { // body... } // end update })(); it's not complete yet, but is the entire structure. So, the problem is fired in the controller: (function(){ 'use strict'; angular .module('omi.controllers') .controller('clientReportsResult', clientReports); clientReports.$inject = ['$stateParams', 'cliente']; function clientReports ($stateParams, cliente) { /* jshint validthis: true */ var vm = this; vm.clientes = []; var id = $stateParams.data; var query = "?id=" + id; fire(); function fire () { cliente.query(query).then(function(data) { vm.clientes = data.data.clientes; }); } } })(); It fire me this traceback: "Error: $http is not defined query@http://localhost:8080/js/services/clientes.service.js:55:7 fire@http://localhost:8080/js/controllers/clientes.reports.results.js:21:9 clientReports@http://localhost:8080/js/controllers/clientes.reports.results.js:18:7 invoke@http://localhost:8080/js/libs/angular/angular.js:4182:14 instantiate@http://localhost:8080/js/libs/angular/angular.js:4190:27 $ControllerProvider/this.$get</<@http://localhost:8080/js/libs/angular/angular.js:8449:18 $ViewDirectiveFill/<.compile/<@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3897:28 invokeLinkFn@http://localhost:8080/js/libs/angular/angular.js:8213:9 nodeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7722:1 compositeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7075:13 publicLinkFn@http://localhost:8080/js/libs/angular/angular.js:6954:30 updateView@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3839:23 $ViewDirective/directive.compile/<@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3807:9 invokeLinkFn@http://localhost:8080/js/libs/angular/angular.js:8213:9 nodeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7722:1 compositeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7075:13 compositeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7078:13 publicLinkFn@http://localhost:8080/js/libs/angular/angular.js:6954:30 $ViewDirectiveFill/<.compile/<@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3905:9 invokeLinkFn@http://localhost:8080/js/libs/angular/angular.js:8213:9 nodeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7722:1 compositeLinkFn@http://localhost:8080/js/libs/angular/angular.js:7075:13 publicLinkFn@http://localhost:8080/js/libs/angular/angular.js:6954:30 updateView@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3839:23 $ViewDirective/directive.compile/</<@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3801:11 $RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost:8080/js/libs/angular/angular.js:14702:15 transitionTo/$state.transition<@http://localhost:8080/js/libs/angular-ui-router/release/angular-ui-router.js:3218:11 processQueue@http://localhost:8080/js/libs/angular/angular.js:13170:27 scheduleProcessQueue/<@http://localhost:8080/js/libs/angular/angular.js:13186:27 $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:8080/js/libs/angular/angular.js:14383:16 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:8080/js/libs/angular/angular.js:14199:15 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8080/js/libs/angular/angular.js:14488:13 done@http://localhost:8080/js/libs/angular/angular.js:9646:36 completeRequest@http://localhost:8080/js/libs/angular/angular.js:9836:7 requestLoaded@http://localhost:8080/js/libs/angular/angular.js:9777:1 " "<div ui-view="" class="details ng-scope">" I'm triying to solve the problem, but i can't understand the problem, why this error appear's here? In the others controllers where i use the "getAll" method all is working fine!
7f662804663aca43c5eebdca64f5c14edce681b94f1ffd819c2832f455792865
['0712f3bc4c5941208468b99327b28107']
Is it possible using SAML that is available with Gsite? Since both GSuite and O365 is free for education we can switch between these. If it is possible with SAML are there any wireless controllers that support SAML without having a costly local server? Our school is currently using Cisco 2500 Series Wireless Controller, Cisco Catalyst 3650 24 Port Data 4x1G Uplink IP Base, Catalyst 2960-X 24 GigE and Cisco access points. Is there something I can add to enable SSO ro LDAP compatibility. We dont have a local server now.
2080d386ed8a54223c7162343c7e68dadb2cdb15b480ea5f9a07f58a43d69564
['0712f3bc4c5941208468b99327b28107']
We setup a WiFi system in our school and currently we are using single password to let teachers login into campus WiFi. Next Semester we want to let kids login into WiFi for in class activities. We provide them with office 365 accounts(Free version for education) and it comes with Azure AD. Is there a way I can authenticate the students into WiFi using Azure AD? Do I need to add additional infrastructure? My WiFi controller(Has public IP) comes with option for setting LDAP server. Is there something I can do to make Azure AD work like LDAP server. Being a non profit we have limited resources so please suggest a economical solution.
54f92eaac487510e86ec8904c6647942ec1e352599b54adb462a9c998061ea6f
['07215008a42546349bd7dd161270c8f9']
I actually worked in the PVR set-top box world for 5+ years and at my old company we were faced with a similar choice. Since your intent is to store the PVR recordings on disk, here are some of the approaches you can take - Binary Protocol: Dump the C or C++ POD types to a binary file. This will require a custom parser with difficult to maintain compatibility when adding/deleting fields. Also not human readable, so debugging will be a pain. If you do go this route for speed or disk usage reasons, at least use Google's protocol buffers as the binary protocol. Serialized Protocol Use a human readable protocol like XML, JSON to serialize the data to/from disk. Easy to debug and also to add/remove fields to the schema. Lots of opensource parsers are available e.g. expat, libxml2, rapidjson, json-c that can do the heavy lifting for you. Embedded Database If your system needs to support sort, search, filtering, etc. I highly recommend SQlite, a lightweight database suitable for embedded platforms with native C interface. This option requires more development effort upfront but will scale better as your system evolves.
0ca2c3b510508ab9c460c945838387f6873da020dae62b26d4c1d7ba9f70906e
['07215008a42546349bd7dd161270c8f9']
Excerpt from SQLite reference on sqlite3_mprintf() API http://www.sqlite.org/c3ref/mprintf.html "The %Q option works like %q except it also adds single quotes around the outside of the total string. Additionally, if the parameter in the argument list is a NULL pointer, %Q substitutes the text "NULL" (without single quotes)." When using %q, we have to be careful to always use single quotes around it e.g. char *zText = "It's a happy day!"; char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText); It seems more convenient to always use %Q instead of %q as follows: char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText); My question - is there a valid use case where '%q' is more suitable or more efficient? Or can I safely use %Q as a replacement for %s in all statements?
f5717ab09ac83a9a8d6cc18bcc2f8298594d7d368a6bb8c85082d333807c854d
['072c9fbb3e5a4dbba0a8c9d1d88228ef']
Try this plugin by barryvdh. It would really help you debug you laravel app. It include several collectors QueryCollector: Show all queries, including binding + timing. RouteCollector: Show information about the current Route. ViewCollector: Show the currently loaded views. (Optionally: display the shared data) EventsCollector: Show all events. etc. Happy coding;
89ca33682d43a66be9d2ab42bf052f01a2b24fd5f58464db968ce76de3ce2a9b
['072c9fbb3e5a4dbba0a8c9d1d88228ef']
Check out alphinejs. It was built for that purpose. According to the docs, Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM, and sprinkle in behavior as you see fit. Think of it like Tailwind for JavaScript.
534e7983aa0965cadb16285d5b80ed6cb9105327b6ffb9d186f7e6d7bbcf0b6f
['0730c827ebef497aba4f09ef621da2e1']
I know the title sounds kinda like some other things, but my issue is kinda... Weird? Idk. I'm making a poll command, and everything is working atm. But I want to make it so instead of just automatically adding four reaction options, it counts the options, and adds the reacts based on that. I've got it working (to an extent), but it kept error 400'ing. Instead of making it react, I made it tell me how many reacts it was adding... It was adding 36 reactions at 8 options. Code and result below. Code: public async Task MakePoll(IMessageChannel channel, string title, string description, [Remainder] string choices) { string[] options = choices.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var zero = new Emoji($"{734770204311027712}"); var one = new Emoji("1️⃣"); var two = new Emoji("2️⃣"); var three = new Emoji("3️⃣"); var emotes = (zero, one, two, three ); var choicecount = options.Count() - 1; int reactioncount = choicecount; var poll = new EmbedBuilder(); poll.WithTitle(title); poll.WithDescription(description); for (int a = 0; a <= choicecount; a++) { poll.AddField($"{a}", $"{options[a].ToString()}"); } var derp = await channel.SendMessageAsync("", false, poll.Build()); for (int b = 1; b < reactioncount; b++) { //await derp.AddReactionsAsync(had an array of emotes, plugged it in here. just haven't added it back after ctrl+z spam.); await Context.Channel.SendMessageAsync($"{b} emotes tried to add"); } } Result: https://cdn.discordapp.com/attachments/689738717589798913/735340372838056026/unknown.png
a4127d053c0b35844708894d1e47d9932d24031c984a39181df4f3e54a0537fc
['0730c827ebef497aba4f09ef621da2e1']
I did this an eternity ago with like... My first bot. I managed to grab all the invites for a server my bot was in, and then list them into an Embed. If there wasn't one, it would make one and then list it. Problem is, I somehow lost the code to that bot, and don't remember how I did it. Anybody got any ideas how I'd pull this off again?
e92debd044dcdd0032e768db7bc36c9c22d93c9d28950fb0d99a2d8d8d84dbdc
['073d631105a04fd7a40458279f9a4775']
Ваш код делает то, что мне нужно. Но я не уловил такие моменты. Для чего условный выход из функции `setProperty` при отсутствии `obj`? Просто на случай если такого свойства в объекте нет? И второй вопрос. В функции `setProperty` переписывается `obj` спускаясь все ниже по дереву вложенности. То есть вместо всего дерева записывается только ветка. Почему при выходе из функции, объект сохраняет всё дерево, так будто в функцию был передан клон объекта. При этом переписанное значение сохраняется, так будто в функцию передали ссылку на объект?
3881e5bd6bef61ebebe62f807bdcb8e6238e9e6235e6d3f8f8ff88e1e24539e1
['073d631105a04fd7a40458279f9a4775']
An alternative using a messy regular expression: public static void main(String[] args) throws Exception { Pattern p = Pattern.compile("^(\\w*)[\\s]+(\\w*)[\\s]+(\\w*)[\\s]+(\\w*)[\\s]+(\\w*)[\\s]+[“](.*)[”][\\s]+[“](.*)[”][\\s]+[“](.*)[”]"); Matcher m = p.matcher("AddItem rt456 4 12 BOOK “File Structures” “Addison-Wesley” “<PERSON>”"); if (m.find()) { for (int i=1;i<=m.groupCount();i++) { System.out.println(m.group(i)); } } } That prints: AddItem rt456 4 12 BOOK File Structures Addison-Wesley <PERSON> I assumed quotes are as you typed them in the question “” and not "", so they dont need to be escaped.
d74d70de2501bdecffdd02396a8151041c49e8885b7569e3d150c8048f6e1e16
['073ee9b4f69643bdb59177f970bd452b']
It is somewhat ad hoc to say that the explanations are buried in the code, since this was pointed out in the reply. The second section of the code gives further insight into how the functoin `ks.test` works by demonstrating why and how the warning "ties should not be present for the Kolmogorov-Smirnov test" was returned. However,
40afaf74981c59f5adbd88a8141771d99da5d6169c302930160b2146ec53a21c
['073ee9b4f69643bdb59177f970bd452b']
In my opinion you have to perform a one-sample Kolmogorov-Smirnov Test. You have a sample of the random variable Y and you want to check if the random variable is two-parameter APE distributed. So I've updated your cdf such that it has a further argument for the values of the sample, called argument y. However, you have some problems performing the KS-Test. First problem is that this random sample y has ties (meaning repeated values). Since the KS-Test is designed for continuous distributions your y should not contain repeated values. Second problem is that you are using estimates that are computed on the basis of y. In the attached reprex I've perfomed a one-sample KS-Test. But I can not reproduce the desired test statistic D and p-value. I've inserted some comments. cdf <- function(y, alpha,lambda){ if(alpha!=1){ apecdf<-((alpha^(1-exp(-lambda*y)))-1)/ (alpha-1)}else if(alpha==1){ apecdf<- 1-(exp(-lambda*y))} return(apecdf) } # given: y <- c(1, 4, 4, 7, 11, 13, 15, 15, 17, 18, 19, 19, 20, 20, 22, 23, 28, 29, 31, 32, 36, 37, 47, 48, 49, 50, 54, 54, 55, 59, 59, 61, 61, 66, 72, 72, 75, 78, 78, 81, 93, 96, 99, 108, 113, 114, 120, 120, 120, 123, 124, 129, 131, 137, 145, 151, 156, 171, 176, 182, 188, 189, 195, 203, 208, 215, 217, 217, 217, 224, 228, 233, 255, 271, 275, 275, 275, 286, 291, 312, 312, 312, 315, 326, 326, 329, 330, 336, 338, 345, 348, 354, 361, 364, 369, 378, 390, 457, 467, 498, 517, 566, 644, 745, 871, 1312, 1357, 1613, 1630) alpha <- 0.00366583 lambda <- 0.0009550325 # Case 1: Perform a one-sample KS-Test: t1 <- ks.test(x = y,y = "cdf", alpha, lambda) #> Warning in ks.test(x = y, y = "cdf", alpha, lambda): ties should not be present #> for the Kolmogorov-Smirnov test t1 #> #> One-sample Kolmogorov-Smirnov test #> #> data: y #> D = 0.061673, p-value = 0.8014 #> alternative hypothesis: two-sided ## Problems: ### 1) KS-Test is for continuous distributions and hence your y should not contain the repeated values (ties)! ### 2) Parameters should not be estimated from data ### (specified in ?ks.test... "If a single-sample test is used, the parameters ### specified in ... must be pre-specified and not estimated from the data. ### There is some more refined distribution theory for the KS test with estimated ### parameters (see <PERSON>, 1973), but that is not implemented in ks.test.") # Case 2: Perform a one-sample KS-Test adding some variation in y: y_var <- y + rnorm(length(y), sd = 0.005) # because of the ties problem! colMeans(cbind(y, y_var)) #> y y_var #> 233.3211 233.3211 apply(cbind(y, y_var), 2, sd) #> y y_var #> 296.4344 296.4344 # pretty similar! t2 <- ks.test(x = y_var, y = "cdf", alpha, lambda) t2 #> #> One-sample Kolmogorov-Smirnov test #> #> data: y_var #> D = 0.061669, p-value = 0.8015 #> alternative hypothesis: two-sided ## Problem: ### Second Problem of Case 1 from line 30 - 34! Created on 2020-07-15 by the reprex package (v0.3.0) Hope it helps!
b87854cdee05d3bc001dc7803e4e9035579ff63c744925b876fd870ada773e77
['075a1cf193d3444bb1beed89a107de06']
Доброго времени суток. Нашел массу информации по интересующей проблеме, но ни один пример не удалось применить на своем проекте. Загвоздка в том, что в TreeView вложены разные по типу данные и как их выбрать не могу понять. Вот Model public class Algorithms { public AlgorithmsType TypeName { get; set; } public List<Algorithm> Algorithm { get; set; } } public class Algorithm { public string Name { get; set; } public string Text { get; set; } } Далее ViewModel public class AlgorithmsViewModel : ViewModelBase { private Algorithm _selectedAlgorithm; public Algorithm SelectedAlgorithm { get { return _selectedAlgorithm; } set { _selectedAlgorithm = value; RaisePropertyChanged(); } } public List<Algorithms> AlgorithmList { get; set; } public AlgorithmsViewModel() { } } } И View <Window.Background> <RadialGradientBrush> <GradientStop Color="#FF7831AA" Offset="1"/> <GradientStop Color="#FFDDB7F7" Offset="0.009"/> </RadialGradientBrush> </Window.Background> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="106*"/> <ColumnDefinition Width="181*"/> </Grid.ColumnDefinitions> <StackPanel CanVerticallyScroll="True" Grid.Column="1" Margin="0,0,0,10"> <Border BorderThickness="5" BorderBrush="#FFF9F8F7" Margin="10,10,10,10" Height="242"> <TextBox Text="{Binding SelectedAlgorithms}" IsReadOnly="True" TextWrapping="Wrap" Margin="5"/> </Border> </StackPanel> <Button x:Name="btnGo" Content="Перейти" HorizontalAlignment="Left" Margin="274,257,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Height="22"/> <TreeView x:Name="tvAlgorithms" ItemsSource="{Binding AlgorithmList}" Grid.Column="0" HorizontalAlignment="Left" Height="269" VerticalAlignment="Top" Width="198" Margin="10,10,0,0"> <TreeView.Resources> <HierarchicalDataTemplate ItemsSource="{Binding Algorithm}" DataType="{x:Type models:Algorithms}"> <Label> <Label.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding TypeName}" Value="Symmetrical"> <Setter Property="Label.Content" Value="Симетрические"/> </DataTrigger> <DataTrigger Binding="{Binding TypeName}" Value="Asymmetric"> <Setter Property="Label.Content" Value="Асиметрические"/> </DataTrigger> </Style.Triggers> </Style> </Label.Style> </Label> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type models:Algorithm}"> <Label Content="{Binding Name}"/> </DataTemplate> </TreeView.Resources> </TreeView> </Grid> Так вот, каким образом мне заполучить заветный объект Algorithm, чтобы дальше с ним работать?
9117a9c88d5f6d42d6381e6b332ca897ff0545f661131d9b8d803c91a26a7464
['075a1cf193d3444bb1beed89a107de06']
At first, there will be a frictional force due to the relative slipping between the cylinder and floor But after some time, due to the action of the frictional force, the cylinder will be in pure rolling i.e. v=Ωr Once this is reached, there won't be any relative slipping between the surfaces and hence no friction This raises the question why in real world rolling objects come to rest This happens as no body is rigid ideally i.e. it undergoes deformation while rolling
6e86e7ef617b4b269ecfb6d63f011184271757ea350ee77af6421a126596cc4a
['0772570bd650454ea7b37ddce7736d44']
If you prefer using this data in a pandas DataFrame, and since your data behaves like a list of dictionaries, you could try: import pandas as pd df = pd.DataFrame.from_dict(data) df author country ... title year 0 Chinua Achebe Nigeria ... Things Fall Apart 1958 1 <PERSON> Denmark ... Fairy tales 1836
8230656aaa1b92d318b54f25c12d7da317b9c56ab553b52bf28181a88e6b9f4f
['0772570bd650454ea7b37ddce7736d44']
Give this a try - It seems to work for me import pandas as pd filepath = '' # insert your files path here (I created a csv with columns 'SI_No' and 'Date' to test this and then copied your data) df = pd.read_csv(filepath, parse_dates=['Date']) df = df.set_index('SI_No') df Date SI_No 1 1990-08-09 2 1988-01-06 3 1989-04-10 4 1991-11-15 5 1968-01-06
844436843c58b09692a430284fa05cd498cbff7aa33c6808e0f54f18dbc4776b
['07728c63ece04f8182b93e7f60aab70d']
On my stm32 mcu there is no eeprom. So, I am using internal flash to save one byte user data to retain it between power cycles.I am doing it the following way, Add Data section in memory in linker script MEMORY { RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K DATA (xrw) : ORIGIN = 0x8003800, LENGTH = 2K //Allocated one full flash page } Create user data section .user_data : { . = ALIGN(4); *(.user_data) . = ALIGN(4); } >DATA Create a variable to store in flash attribute((section(".user_data"))) const uint8_t userConfig[64] Write data using following functions, HAL_FLASH_Unlock(); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR ); FLASH_Erase_Sector(FLASH_SECTOR_11, VOLTAGE_RANGE_3); HAL_FLASH_Program(TYPEPROGRAM_WORD, &userConfig[index], someData); HAL_FLASH_Lock(); My question is how many writes can be done this way to the internal flash to save the user data?
01d205590e66998a5a338fd655559f3ba69ae2e415c5339169b6d62911393b0b
['07728c63ece04f8182b93e7f60aab70d']
I am using a STM32 board to send I2C commands to a I2C slave using interrupt mode. I have initialized I2C module as below, hi2c2.Instance = I2C2; hi2c2.Init.Timing = 0x00303D5B; hi2c2.Init.OwnAddress1 = 0; hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; hi2c2.Init.OwnAddress2 = 0; hi2c2.Init.OwnAddress2Masks = I2C_OA2_NOMASK; hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; if (HAL_I2C_Init(&hi2c2) != HAL_OK) { Error_Handler(); } /** Configure Analogue filter */ if (HAL_I2CEx_ConfigAnalogFilter(&hi2c2, I2C_ANALOGFILTER_ENABLE) != HAL_OK) { Error_Handler(); } /** Configure Digital filter */ if (HAL_I2CEx_ConfigDigitalFilter(&hi2c2, 0) != HAL_OK) { Error_Handler(); } And for transfer I use the HAL API, HAL_I2C_Master_Transmit_IT(&hi2c2, 0x60, buffer, 2); But this code doesn't seem to work for me. In buffer, first byte is the register address on the I2C slave and second byte is the data. When I use the blocking mode API, HAL_I2C_Master_Transmit(&hi2c2, 0x60, buffer, 2,HAL_MAX_DELAY); It works fine. Any suggestions what could be wrong here?
7e7a06303613f855f54603a0aa3b90f389cffc937a8895898a6a08f117bbfe5b
['0774df560214400884504f7633a268ef']
I have an app that has a textbox, validation control and a button. The problem is that if someone copies text from a word document inside the textbox, some of the special characters won't be allowed because of the validation control. But if I delete those special characters and we typed them, the validation control works. Is there a way to convert that text to plain text or rich text inside the textbox?
481226283e4dbe42473ddace93943b723439efa0c653bd937080d32377793cca
['0774df560214400884504f7633a268ef']
I have a column (called Check_Regions), in a table in SQL, that is a Varchar with a comma delimiter. I need to write a store procedure that selects all from table where Check_Regions(list) = @Region. How do I search the Check_Regions list to see if it equals the number that's pass to it?
a05f3f71f37e4f63a1c90bb155c64ca1f075d07b4bcbdbd304ac32b8fc10b3e3
['07763c416e364d43a2c3476ea0c2884a']
Currently I'm using Windows10 and WSL2 with Ubuntu 20.04 for developing. For the most case this works excellent, apart from one problem. There seems to be something broken in the networking layer between Windows/WSL2. When serving angular using 'ng serve', I can't access it from Windows. Only when using the terminal in VS Code, and opening the browser from the link in the terminal output, will Windows open it - however, it does not open 'localhost:4200', it opens <IP_ADDRESS>:'random port' which is not allowed by our proxy, which means the angular application will show up but not be usable. After doing this, the application is available from localhost:4201 - but never before opening it from VS Code. This means I cannot use other terminals (like the new Windows Terminal or ConEmu) to start the applications. As far as I can tell this is a Windows-problem rather than a problem with the Linux-installation itself, but I have not found a way to 'reinstall' the Windows-part of WSL2 without losing all data on the Linux-installation. Any pointers would be appreciated.
563a3725e84fb8845bfe4ca9b354af58d4179749015f0475c696347f6ac3fef6
['07763c416e364d43a2c3476ea0c2884a']
Have you actually started WSL in the terminal you are using? Also, have you installed node/npm in Ubuntu? Looks like it is using npm from the Windows-installation. I can recommend nvm, which has a simple install script - this is a download manager for node and allows easy install/update of node/npm on Linux.
031299e55e7cf12149605216c7eae6f6f5a49da26237afdc75fd026c0ee695a2
['0777b0222c2a4fc883cea41d702bd39c']
Yes, you can spend anywhere between the given values. I was thinking about getting two linear or logarithmic functions (whatever fits better the plot), having x1 + x2 = 40K (Where x1: advertising budget, x2: RnD budget). Then we are interested in the MAX. of the combination of these functions, given x1+ x2 = 40. This is where I don't know what to do - I take the 2nd derivative but it doesn't seem to work. I guess my thinking is wrong
1588b4a01e3da483996c79a8aa15cd88fa6b5afc3843ff263a8a30e71833e4b0
['0777b0222c2a4fc883cea41d702bd39c']
Do MOUSE_OVER / MOUSE_OUT events work on the buttons at all? Sounds like it could either be that your parent SWF files have objects in them which cover the buttons, or you could be setting the "mouseChildren" and "mouseEnabled" properties of one of the parent SWFs to false? Try explicitly setting mouseChildren and mouseEnabled to true on the parent containers and see if that helps?
8551ff1c67c00ca0f3c2f22d6a328d8750f1d23d1a1422fca4f6bd08ac05a990
['077d75af7daf4fe6adaf504d9845a194']
i have created a program on code blocks on mac that allows you to read contents from a file as well as write to them. i am able to read the file as well as write into it, but i couldnt seem to find the file itself unless i used spotlight. i thought the files created by ofstream were located in the same directory the project is in by default, but it is not there. what i would like to know is if there is a way to set the default location for files as the same directory for the project itself?
7d9d0c9f6fc0bd41e3e541e1858867913297884f414c49ae319145d3a6332ec5
['077d75af7daf4fe6adaf504d9845a194']
One of my school assignments is to create a program where you can input a minimum number of passengers, a max number of passengers, and the price of a ticket. As the groups of passengers increase by 10, the price of the ticket lowers by 50 cents. At the end it is supposed to show the maximum profit you can make with the numbers input by the user, and the number of passengers and ticket price associated with the max profit. This all works, but when you input numbers that result in a negative profit, i get a run time error. What am i doing wrong? I have tried making an if statement if the profit goes below 0, but that doesn't seem to work. here is my work for you all to see. A lead in the right direction or constructive criticism would be a great help. #first variables passengers = 1 maxcapacity = 500 maxprofit = 0 ticketprice = 0 fixedcost = 2500 #inputs and outputs again = 'y' while (again == 'y'): minpassengers = abs(int(input("Enter minimum number of passengers: "))) maxpassengers = abs(int(input("Enter maximum number of passengers: "))) ticketprice = abs(float(input("Enter the ticket price: "))) if (minpassengers < passengers): minpassengers = passengers print ("You need at least 1 passenger. Setting minimum passengers to 1.") if (maxpassengers > maxcapacity): maxpassengers = maxcapacity print ("You have exceeded the max capacity. Setting max passengers to 500.") print ("Passenger Run from", minpassengers, "to", maxpassengers, "with an initital ticket price of $",format (ticketprice, "7,.2f"), "with a fixed cost of $2500.00\n" "Discount per ticket of $0.50 for each group of 10 above the starting count of", minpassengers, "passengers") for n in range (minpassengers, maxpassengers + 10, 10): ticketcost = ticketprice - (((n - minpassengers)/10) * .5) gross = n * ticketcost profit = (n * ticketcost) - fixedcost print ("Number of \nPassengers", "\t Ticket Price \t Gross \t\t Fixed Cost \t Profit") print (" ", n, "\t\t$", format (ticketcost, "7,.2f"), "\t$", format (gross, "5,.2f"), "\t$", format(fixedcost, "5,.2f"), "\t$", format (profit, "5,.2f")) if (profit > maxprofit): maxprofit = profit maxpass = n best_ticket = ticketcost print ("Your max profit is $", format (maxprofit, "5,.2f")) print ("Your max profit ticket price is $", format (best_ticket,"5,.2f")) print ("Your max profit number of passengers is", maxpass) again = input ("Run this again? (Y or N): ") again = again.lower() print ("\n")
4fc7d8b0391252a40bb3fd864330df4460944259da47429e5b5f3aedac63e1bd
['078583e2a4634b9980feb8e5679e2109']
As per your code structure, you are not having index.jsp/html in your project roof folder. While running the server it will first find out the index.html/jsp by default. If its not available it will returns the 404 error. To fix this you can add the following lines your web.xml file, <welcome-file-list> <welcome-file>/jsp/login.jsp</welcome-file> </welcome-file-list> Save all your changes and run your server. If the problem again exists you have to check Struts configuration file and the build path.
3ca326192771a22b946252c907c3906a4428bc2d1a6dd1f4742db1f10c213d23
['078583e2a4634b9980feb8e5679e2109']
I have used the following code to create database connection using Hibernate configuration file. <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.username">xxx</property> <property name="connection.password">xxx</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.jdbc.batch_size">50</property> <property name="show_sql">true</property> <!-- C3PO Connection pool setting --> <property name="hibernate.c3p0.min_size">3</property> <property name="hibernate.c3p0.max_size">100</property> <property name="hibernate.c3p0.timeout">5000</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.c3p0.acquire_increment">3</property> <property name="hibernate.c3p0.validate">true</property> <property name="hibernate.c3p0.idle_test_period">900</property> --> <!-- Connection pool setting --> It seems connections are opening and closing successfully. If 10 users accessing the website at same time my website login page spinning long time after 5 or 10 minutes the server getting down. Also the I could not restart the mysql server it says process Unexpectedly terminated. Then I have to install mysql server again. This is happening in my production server. I lost so many real data for this problem. Please can anyone suggest me to use database connection effectively while accessing 10000 users at a time. What is the best approach to handling this kind of situation.
57fccc131bb1927062f71456acf9b3d1d5c64176c328f9d432092d5dd96a717e
['0795650077fc4e72a7d85bd31e488c94']
I am porting an application to WordPress. It uses a form to select what attributes the customer is looking for in an Adult Family Home via checkboxes and drop-downs. It re-searches the database on each onchange and keyup. Originally I had the application standalone in PHP, but when I migrated it to WordPress I started having issues. Currently in WP I have the code conditionalized ($DavesWay == 1) to do ajax the normal no-WordPress-way and ($DavesWay == 0) to do it the WordPress-way. In the non-WordPress-way, the ajax works fine EXCEPT that I get a WP header and menu between the search form and the results-div that Ajax puts the data in. I get no errors from WP or in the JS console. In the WP-way The search form displayed, but nothing happens when I check any of the checkboxes. The JS console displays POST http://localhost/demo4/wp-admin/admin-ajax.php 400 (Bad Request) But I don't see any way to tell exactly what it is complaining about. How should I troubleshoot this? Troubleshooting = Examine the HTML output, lots of echos and exits in PHP code, look at JS console. function submitPg1(theForm) { // Used with onChange from "most" form elements, but not on those that change the page // rather than the select criteria. Such as rowsPerPage, pageNumber etc. setById("pageNo", "1"); // set inital page mySubmit(); } function mySubmit(theForm) { // The actual ajax submit // DO NOT set page number jQuery.ajax({ // create an AJAX call... data: jQuery("#asi_search_form").serialize(), // get the form data type: jQuery("#asi_search_form").attr("method"), // GET or POST url: jQuery("#asi_search_form").attr("action"), // the file to call success: function (response) { // on success.. jQuery("#result").html(response); // update the DIV } }) } function setById(id, value) { // Used to set vales by Id x = document.getElementById(id).value; x.value = value; } // 1st submit with blank selection jQuery(document).ready(function () { submitPg1(this.form) }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> Code fragments: (from the displayed page source) <div id="asi_container" class="asi_container" > <noscript><h2>This site requires Javascript and cookies to function. See the Help page for how to enable them.</h2></noscript> <div id="searchForm"> <form id="asi_search_form" name="asi_search_form" method="post" action="http://localhost/demo4/wp-admin/admin-ajax.php"> <input type="hidden" name="action" value="asi_LTCfetchAll_ajax" style="display: none; visibility: hidden; opacity: 0;"> <table id="greenTable" class="asi_table" title="The Green areas are for site administration, not typical users"> <tbody> PHP code: $DavesWay = 0; if ($DavesWay == 1){ //echo "Daves Way Setup"; // <PERSON>'s way, which works but prints the menu twice if( $operation == "submit"){ require("asi_LTCfetchAll.php"); // for each onchange or onkeyup }else{ add_filter( 'the_content', 'asi_tc_admin', '12' ); // Initial page refresh # must be >12 } }else{ // The WordPress way that I could't get to work -- asi_LTCfetch never gets called function asi_LTCfetchAll_ajax(){ //echo "<br /> Goto to Submit function"; // DEBUG require($asi_plugin_dir . "/includes" . '/asi_LTCfetchAll.php'); } add_action( "wp_ajax_asi_LTCfetchAll_ajax", "asi_LTCfetchAll_ajax" ); // admin users add_action( "wp_ajax_nopriv_asi_LTCfetchAll_ajax", "asi_LTCfetchAll_ajax" ); // non-logged in users add_filter( "the_content", "asi_tc_admin", "12" ); // Initial page refresh # must be >12 }
9b9bc395e2faf606273873a0fcfe9e350f295312c443b87b7c8cfa6ea6b38874
['0795650077fc4e72a7d85bd31e488c94']
I have a WordPress site (www.AgingSafely.com) and on it I have built a plugin to show the “Details” about various Adult Family Homes (AFHs). All of the details are retrieved out of database table via a query-string (?asi_id=WA_Af_nnnnn) where the n’s are the AFH’s license number. I have created a “Site Map” page (https://www.agingsafely.com/asi-site-map/) that lists an overview and has links to the Details Page for each AFH, so that Google can find and link them. They are also listed in sitemap.xml. Google isn’t indexing them, but is indexing the more normal pages on my site. I figure that I need to change my URLs from https://www.agingsafely.com/adult-family-home/?asi_id=WA_Af_751252 to something like https://www.agingsafely.com/adult-family-home/AFH/751252 to make Google happy. To add a little more complication, The “Af” in the query string is for “Adult Family Home”. The plugin also handles “Boarding Homes” “Bf” and “Nursing Facilities” “Nf”. How do I get the URL with the ?asi_id=WA_Af_751252 rewritten to AFH/75152 This appears to two parts: Change the links in the plugins to the /AFH/nnnn format which should be easy. Have some re-write rule that converts the new URL format back to a query string. What is the best way to do this? Does Google ignore query strings?
4f0cbc135c9848f7465218f2d53c4419779900cfd09372e69a24954ddadeb6f4
['0799cc8672844ebe88f0bac54cfc60e2']
In C++, the std<IP_ADDRESS>list<IP_ADDRESS>insert() function takes an iterator to indicate where the insert should occur. That means the caller already has this iterator, and the insert operation is not doing a search and therefore runs in constant time. The find() algorithm, however, is linear, and is the normal way to search for a list element. If you need to find+insert, the combination is O(n). However, there is no requirement to do a search before an insert. For example, if you have a cached (valid) iterator, you can insert in front of (or delete) the element it corresponds with in constant time.
e16177ffc62a03d8c1402bfba4eeec39a9a0449822b5d9af8719ceb38dba155b
['0799cc8672844ebe88f0bac54cfc60e2']
if(s1 == "rectangle" || "Rectangle"){ There are 2 conditions when this is true, the first is what you expect, the second is your bug because it's now what you meant to say in your code: 1) the input string s1, compared for equality to the string literal "rectangle" returns true, or 2) if the string-literal "Rectangle", by itself, is considered a true value. As this conversion is essentially a "null pointer check", and the string literal is never null, this case is always true. What you need is to repeat the test: if(s1 == "rectangle" || s1 == "Rectangle"){
84a1df2e955e9c83dad789ffcbb718cffa947d343ca064b0ec0fad059d3cd3c0
['07a5fc400db14bfc947af3389218e476']
I use main() to run the program but it keeps calling it an invalid syntax. Even the debugger can't seem to make heads or tails of it. Here's my total code. """ InvestmentCalculator.py helps generate how much interest one earns after a certain period of time """ def main(): total_money = 0 months_invested = 0 years_investment = 0 investment = float(input("How much would you like to invest? ")) years_investment = float(input("How many years would you like to invest? ")) interest_rate = float(input("What is the interest rate? ")) total_money = float() months_invested = years_investment / 12 while months_invested > 0: total_money = investment + total_money months_invested = months_invested - 1 print("You have earned ${:,.2f}".format(total_money)) else: print("You've earned a total of ${:,.2f}".format(total_money) main()
2aa2e8eb18a0918609106d78bfe3749ea6cc4ddc4a732a0eb12b04c0fc88ab19
['07a5fc400db14bfc947af3389218e476']
Oh, goodness. I've become a regular here. I have all of my code but it's weird because I'm trying my best but I cannot seem to get it to work. I've tried rewriting parts of it and even making minor changes but it just won't work. At all. """ WeeklyPay.py helps calculate the gross pay of multiple employees based on the hours they worked and their hourly rate """ def main(): """ call other modules to get the work done :return: None """ total_gross_pay = 0 total_hours_worked = 0 employee_quantity = 0 company_employee = input("Did the employee work this week? Y or y for yes: ") while company_employee == "y" or "Y": employee_quantity += 1 name, hours, rate = get_info() gross_pay = caculate_gross_pay(hours, rate) pay_stub(name, hours, rate, gross_pay) total_gross_pay += gross_pay total_hours_worked += hours company_employee = input("Have more employees worked? Y or y for yes: ") show_summary(employee_quantity, total_hours_worked, total_gross_pay) def get_info(): """ This module gets the needed info from employees :return: name, hours_worked, pay_rate """ name = input("Enter the employee's name: ") hours_worked = float(input("How many hours did the employee work? ")) pay_rate = float(input("What is the employee's hourly pay rate? ")) return name, hours_worked, pay_rate def caculate_gross_pay(hours_worked, pay_rate): """ Hours above 40 will be paid time and a half (1.5) :param hours_worked: :param pay_rate: :return: gross_pay """ if hours_worked > 40: gross_pay = 40 * pay_rate + (hours_worked - 40) * 1.5 * pay_rate else: gross_pay = pay_rate * hours_worked return gross_pay def pay_stub(name, hours_worked, pay_rate, gross_pay): """ This module prints the pay_stub :param name: :param hours_worked: :param pay_rate: :param gross_pay: """ print("Employee Name: " + name) print("Hours Worked: %.2f"%hours_worked) print("Hourly Pay Rate: $%.2f"%pay_rate) print("Gross Pay: $%.2f"%gross_pay) def show_summary(employee_quantity, total_hours, total_pay): """ :param employee_quantity: :param total_hours: :param total_pay: :return: None """ print("Pay Summary ") print("Total number of employees: {}".format(employee_quantity)) print("Total hours worked by all employees {}".format(total_hours)) print("Total pay given to employees ${:,.2f}".format(total_pay)) main() Any idea what I'm doing wrong? I get these errors: Traceback (most recent call last): File "C:/Users/inge scool/PycharmProjects/Week1/WeeklyPay.py", line 80, in <module> main() File "C:/Users/inge scool/PycharmProjects/Week1/WeeklyPay.py", line 20, in main pay_stub(name, hours, rate, gross_pay) File "C:/Users/inge scool/PycharmProjects/Week1/WeeklyPay.py", line 65, in pay_stub print("Gross Pay: $%.2f"%gross_pay) TypeError: must be real number, not NoneType I've tried searching online and keep getting stuff about integers with NoneType but is isn't fully applicable to what I'm doing. I'm adding numbers?
2fc1806ad550e1ecbc65a57e443c98506de191d4f3b398c73e0fbfe867a9a904
['07b95b948ad543c78b119228b93bdac3']
I'm trying to send a email with commons api, but, i goting error! This is an example of Commons guide, but, i cant send here.. public class Emailsss { /** * @param args the command line arguments */ public static void main(String[] args) throws EmailException, MalformedURLException { // TODO code application logic here // Create the email message HtmlEmail email = new HtmlEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "mypw")); email.setSSLOnConnect(true); email.setFrom("username"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("to"); URL url = new URL("http://www.apache.org/images/asf_logo_wide.gif"); String cid = email.embed(url, "Apache logo"); email.setHtmlMsg("<html>The apache logo - <img src=\"cid:"+cid+"\"></html>"); email.setTextMsg("Your email client does not support HTML messages"); // send the email email.send(); } } And here's my error: Exception in thread "main" java.lang.NoSuchMethodError: javax.mail.internet.MimeBodyPart.setText(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V at org.apache.commons.mail.HtmlEmail.build(HtmlEmail.java:581) at org.apache.commons.mail.HtmlEmail.buildMimeMessage(HtmlEmail.java:519) at org.apache.commons.mail.Email.send(Email.java:1436) at emailsss.Emailsss.main(Emailsss.java:46) Java Result: 1
7285245d890d473e43be1efa029c8a735a2ef5636b0896032020e83d9c5c00ac
['07b95b948ad543c78b119228b93bdac3']
If anyone have that problem... Just put: button.requestFocusInWindow(); // in last line of method... Like that: for (int i; i < 5; i++) { JButton button = new JButton(); button.setText("" + i); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { System.out.print("\n Test: " + ae.getActionCommand()); } }); button.setSize(60,20); button.setLocation(100, 140); button.setVisible(true); this.add(button); this.revalidate(); this.repaint(); button.requestFocusInWindow(); }
c1f9ffbdb69695a0d4609af8b0b1c59b13692854098915eb48064417bc6a3c86
['07caab38cac04c2c8a5180fb8230c9d5']
I'm setting up my .vimrc but I encountered a problem with spell checking. Here is my .vimrc: setlocal spell spelllang=en_us,fr_fr In the editor, the spell check seems to work properly for both languages, but the problem is that before it opens vim I got "Warning: region fr not supported". Is there a way to make this warning message disappear?
037d5bd3ef776912b2b1b0166bdba95cc4bdd9903cc035615dd7014ffabe66ec
['07caab38cac04c2c8a5180fb8230c9d5']
I was coding a BinTree class looking like that: class Tree: def __init__(self, key, left=None, right=None): self.key = key self.left = left self.right = right @staticmethod def traversal(t): if t is None: # Do something pass else: # Preorder Tree.traversal(t.left) # Inorder Tree.traversal(t.right) # Postorder And I was curious about doing it with a non-static method. I tried to do this which seems not to work: def traversal(self): if self is None: # Do something pass else: # Preorder self.left.traversal() # Inorder self.left.traversal() # Postorder Is it because self can not be None? Anyway, I would like to know it this is possible to do a BinTree traversal (and even other methods, like insertion, etc.) with a non-static method either recursive or iterative?
66fcea676d1b0305d24169c12cf1f26849957873eb676d46e520f8367c288569
['07dc76297e9d46a99636f50b7d18be95']
I've been trying to create my own program, with custom close maximize and minimize buttons (like in Visual Studio, or Word 2013 etc...(my border style is set to "None")) So what I've been trying to do is creating three buttons. One with the closing option, (works fine) one with the minimize option, (also works fine) and one with the maximize button. alone the maximize button works fine, but i want to have it like standard windows buttons, so that when the form is maximized, it will restore the forms previous state (Normal) which i know can be done with this.WindowState = FormWindowState.Normal; But it should be with one button if you understand what i mean. What i've tried is making a bool, which's value is set to true when the form is maximized (with an "if" statement) and set to false when the form isn't maximized (else function). Now when the maximize button is clicked the form will maximize and therefore the boolean will be set to true, but when i click again, nothing happens! The other functions like close and minimize works just fine, i even made a "Restore" button, which works just fine! Any help appreciated, this is my code: bool restore; private void set_Restore() { { if (this.WindowState == FormWindowState.Maximized) //Here the "is" functions is { restore = true; //Sets the bool "restore" to true when the windows maximized } else { restore = false; //Sets the bool "restore" to false when the windows isn't maximized } } } private void MaximizeButton_Click(object sender, EventArgs e) { { if (restore == true) { this.WindowState = FormWindowState.Normal; //Restore the forms state } else { this.WindowState = FormWindowState.Maximized; //Maximizes the form } } } Well, i've got three warnings and this is the one i thinks is wrong: Field 'WindowsFormsApplication2.Form1.restore' is never assigned to, and will always have its default value false. I think it says that the bool "restore" is never used and will always have it's default value FALSE, which it shouldn't because of my set_Restore when it is maximized. The other two warnings are: The variable 'restore' is assigned but its value is never used The variable 'restore' is assigned but its value is never used Thank you in advance.
0bf739457dab76a56e4db87dc00088a81dc7638d59940802abdaf5860dec944d
['07dc76297e9d46a99636f50b7d18be95']
i have a question. Or more like a task or whatever you could call it. See i got this thing i want to do, but i need to access a variable inside a function, i know this has been asked before, but i just couldnt figure it out. Actually i got two questions. I am trying to make a form, where a user is presented with two random numbers, and he then has to answer what the sum of these two numbers is. This is my code: HTML <button class="Btn" id="check" onclick="check()">Check!</button> <button class="Btn" onclick="newCalculation()">New Calculation</button> <label id="question"></label> <input id="answerBox" class="txtBox" type="text"></input> This is two buttons, a label and a textbox. The first button makes a new calculation, the second one checks to see if the value of the textbox is equal to the answer of the calculation. The label is for the calculation to show. This is the Javascript for the New calculation button: function newCalculation() { var firstnumber, secondnumber, answer; firstnumber = (Math.floor(Math.random()*10)+1)*10+(Math.floor(Math.random()*10)); secondnumber = (Math.floor(Math.random()*10)+1)*10+(Math.floor(Math.random()*10)); answer = firstnumber + secondnumber; document.getElementById("question").innerHTML = firstnumber + " + " + secondnumber + " = "; } As far as i can see this is all rigth. But when i have to check if it's correct, i can't access the variables. Checkbutton function check() { if (document.getElementById("answerBox").innerHTML === newCalculation.answer) { alert("Correct!") } else { alert("Wrong!") };} In the console log it says the right value with the textbox, but 'undefined' with the answer variable. If i remove the "newCalculation." it just says that the variable is undefined. I'm just interested in knowing how to get around this, and have all this working. If you could give a full code example, it'd be great! Thanks
37da204987bc2c1773d63e5a90cb854a86f7532c26b1ca1f83889e4e69b0c0f5
['07e4d53de9864733919ca8490f52fb1f']
I'm dealing with raw function pointers that can be invalid (point to an incorrect function) / null if the application (source not available) I am interfacing with updates. I want to create a class that would inherit std<IP_ADDRESS>function which would overload operator() and send a message to stdout whenever the class was called, then calling the original function pointer. This would be done so I would be able to easily isolate which function would crash because of a null call. I am not worried about overhead as this would be available in Debug mode only with the use of _DEBUG Because the STL implementation is up to the compiler and inheriting from it is typically a bad idea I am unsure as to how to do this. The compiler I am using is MSVC (2015). How would I do this?
94a0b948314f80647cb7dd0633cfc9b245ecb023a69d7e2c37f60ec0e2a305cf
['07e4d53de9864733919ca8490f52fb1f']
void __usercall sub_101A7850@<eax>(int a1@<edx>, int a2@<ecx>, int a3, int a4, int a5, int a6) My first attempt (crashes): __declspec(naked) void __stdcall callit(const int& a1, const int& a2, unsigned int a3, const int *a4, int a5, int *a6) { // void __usercall sub_101A7850@<eax>(int a1@<edx>, int a2@<ecx>, int a3, int a4, int a5, int a6) __asm { mov ecx, [esp + 4] // a1 mov edx, [esp + 8] // a2 push [esp + 12] // a3 push [esp + 16] // a4 push [esp + 20] // a5 push [esp + 24] // a6 call funcaddr retn 24 } } I have verified funcaddr is valid. Pretty sure its a __fastcall
ad24648f7f8eb5a1a61e2f232197125728f1d328b0b78addb8b8ea491aacf361
['07e5709d05074185a9b8b844286de619']
For a project, I have to use RequireJS to load mapbox-gl-js library. However, it does not work and I always get the following error message: Uncaught ReferenceError: mapboxgl is not defined This is my RequireJS Code: requirejs.config({ { ... 'leaflet-mapbox-gl': 'js/leaflet-mapbox-gl', 'mapbox-gl': 'js/mapbox-gl' } I want to use it together with leaflet-mapbox-gl. Without RequireJS everything works but is obviously not what I want. I also tried the following shim configuration without success: shim : { 'mapbox-gl': { exports: ['mapboxgl'] } 'leaflet-mapbox-gl': { deps: ['leaflet','mapbox-gl'] } } How do I load mapbox-gl-js correctly with RequireJS?
bab0364e3825f54b926860ea43b0074379c1c9c83480d730bb638ea766aaf8f6
['07e5709d05074185a9b8b844286de619']
I'm using json.net to serialize an object to a json string. Now I have a list of Objects which I like to serialize into a Json array. However, I'm unable to do that with json.net and hope someone can point out my mistake. I have the following classes: class PeopleList { public Person inputs { get; set; } } class Person { public String name { get; set; } public int age { get; set; } } I'm using the following code to serialize the objects: var json = new List<PeopleList>(); Person p1 = new Person { name = "Name 1", age = 20 }; json.Add(new PeopleList { inputs = p1 }); Person p2 = new Person { name = "Name 2", age = 30 }; json.Add(new PeopleList { inputs = p2 }); string jsonString = JsonConvert.SerializeObject(json, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented }); This gives me the following output: [ { "inputs": { "name": "Name 1", "age": 20 } }, { "inputs": { "name": "Name 2", "age": 30 } } ] Here is what I actually want: [ { "inputs": [ { "name": "Name 1", "age": 20 } ] }, { "inputs": [ { "name": "Name 2", "age": 30 } ] } ] As you see I need every object in my list encapsulated with []. How can I achieve that with Json.net? Thanks!
2c4f3eb991d9aff2184c33bab3926e74ab8bb24d673439cedf91643a046f9461
['07ecb683ae9b4c61886d79b37ac32741']
I was refered to this pull request on Github that stated the the proces was not killed properly: https://github.com/EventStore/eventstore-docker/pull/52 After building a new image with the Docker file from the pull request put this image in the deployment. I am killing pods left and right, no data corruption issues anymore. Hope this helps someone facing the same issue.
770c685264bf57e121bddfac6e2805eb0a0b27dcbf37fe39101b304c6862f407
['07ecb683ae9b4c61886d79b37ac32741']
I kept at it, and I found a proper way to implement this. While I did not find a way to convert the header, it's possible write a handlerMethodArgumentResolver that allows us to use custom objects in listeners. Inside this code it's easy to convert the header to a PreAuthenticatedAuthenticationToken object which I can then use in the listener directly. More details: https://docs.spring.io/spring-kafka/docs/2.5.3.RELEASE/reference/html/#adding-custom-handlermethodargumentresolver-to-kafkalistener Validated to be working. Cheers.
cf9cd4db26a7c4cfcd601927affd1dc67470ebf70422987dad0f9ac2ca8314e3
['08132a34c8d844e2bd659e0d98132f50']
I feel very strongly that it is outside the scope of the original question here to discuss other JDK's and environments. The original question is specifically how to install the Oracle JDK 8 on Ubuntu 19 since the PPA was removed. I've studied the install script in question and I have some comments regarding various OpenJDK packages and the Windows Linux subsystem, in relation to the said installer script, but these new questions about other JDK's and environments truly need their own threads since they are not relevant to this particular question.
7a816a7a8aa0f4889063e213593e04fb8b59ff3594868bd09f7b8f116e24fe95
['08132a34c8d844e2bd659e0d98132f50']
It works fine for me with Oracle JDK 8u221, in fact the author recently updated the script on GitHub and added some improvements. I recommend posting the full details of your error as a separate question and include the script link and the distribution file you are trying to install, and the command line syntax you used. Your error appears to be a unique issue/question.
daff7d00af8f72cfacea5ddf19f4b71783f35db91f54a15dfa9e821856ed8ba8
['082c247c907c43f3a455cebae1967bf2']
I'm trying to convert a clipped multi-spectral sentinel-2 image in QGIS to an 8-bit rendered image in a different CRS. I've clipped the image to the coastline and defined the other unwanted areas of the image as no data values. However, when I save the rendered image, all the no data values are converted to zero, which then causes a problem when I finally convert the image to a single band 8-bit image. All the no data values which have been converted to zero produce a black background around the image, which I don't want. I can't remove the zero values, because there are zero values elsewhere in the image which I require, values representing water, shadow etc... Is there any way to save a rendered image without converting the no data values to zero?
71f93e722916b3fba8e40e758820d18b01988587d23e15e87b6619c59197b6cf
['082c247c907c43f3a455cebae1967bf2']
We had a little (temporarily) succes with this. With the help of a stack overflow page we managed to get the backlog list empty for a little time. Right after that, the module you also use (Bol.com), worked in that sense that the products were exported from Magento to the Bol.com site (allthough I'm not sure if all products are exported). But after one hour or so I checked the indexes, and the backlogs now show the same number as before and the _cl tables related to the Bol.com module are filled with items again. So I'm not sure whether a new product added in Magento will be exported to Bol.com now. Did not try that yet. Steps we took to make the backlogs empty: disabled bol.com module in Magento disabled cronjobs related to magento indexes on 'on save' (php bin/magento indexer:set-mode realtime) indexes reset (php bin/magento indexer:reset) truncated _cl tabels related to bol in bol.com, deleted offers (products) after making a backup. This is required for a correct step in the process of connecting magento with bol.com reindex indexes (php bin/magento indexer:reindex) bol module enabled emptied caches and reindexed (php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush) indexes on scedule (php bin/magento indexer:set-mode schedule) enabled cronjobs related to magento regards, <PERSON>
8b29e25804c5b9e20cefa8f9e870db1c9b619f96f7d249b419d5bfffeba21e70
['082d63a1d3444064933dcf9c8926060e']
I finally got this to work. The trick is: The DrawIcon() function (from WinAPI.Windows) doesn't work with Bitmaps of the type FMX.Types.TBitmap which the TImages now have under Firemonkey. So I had to create a temporary Bitmap of the type Vcl.Graphics.TBitmap on which I can draw the cursor icon. I than create a temporary MemoryStream and use the SaveToStream method of my temporary Bitmap to write it to that MemoryStream from which I can load it to the TImage on my form (Image1.Bitmap.LoadFromStream(TmpMemoryStream)).
f697d6bd008d70caa1c1f5c30be33b1fd84eeedda7f13d6736600f00c041d582
['082d63a1d3444064933dcf9c8926060e']
When I localize an application with the new TLang and a translated text is much longer than the original, wouldn't it break my layout for example because a button could be to small to fit the translated text? How do you handle this? Or is it possible to adapt the font size to the length of the translated string (I know that I could do this for every element on my form for example with Canvas.TextWidth() but this would be a pain).
43d97fe6f6dc912c84439380984af517fa15480af606bc2cb987d07f5c53e2f7
['08355c5344754e22815c4d4507a8b7d8']
As previously answered, you can go with the app "against" the local calendar, but you can also go directly to the Google calendar API accessing the very last centraliced version of the events. Just search the Google calendar API at Google developers site and use it. I prefer the second method to avoid inconsistencies. Let's say while offline two apps updates a previosly existing event. What happens? The second method is also "multiplatform" so in the future you want the app to run in Windows, iOS... the code is more reusable. To provide offline access to the calendar events in a second phase I would store local copies of the selected user's calendars. Method works with Ionic, Cordoba or native code. I hope it will help you.
e9964c388c18fbeaac928d909d6af50fec45ca1b25d4acdf05f364fc72e7293e
['08355c5344754e22815c4d4507a8b7d8']
Without hidden cells is possible to do it with an alternative method than the one proposed by <PERSON> (that did not work in my case). I have tested it with google spreadsheets (from data coming from a google form using multiple selection answers): =UNIQUE(TRANSPOSE(SPLIT(JOIN(", ";A2:A);", ";FALSE))) Explanation goes as follows: JOIN to mix all the values from the A column (except A1 that could be the header of the column, if not, substitute it by A:A) separated by a coma SPLIT to separate all the mixed values by their comas TRANSPOSE to transformate the column into rows and viceversa UNIQUE to avoid repeated values Take into account that my "," coma includes and space character i.e., ", " to avoid incorrect unique values because "Z" y not equal to " Z".
f558cc140dabd2323ab738784134eaf4dd4fca563bbc6ee117dd3a856a779b0d
['0867e84402e64877a567cdf00860de34']
The way you check worksheet exist is wrong. If the sheet isn't exist then it cannot take the name of the worksheet then it will alert "script out of range" You can try this Dim ws As Worksheet On Error Resume Next Set ws = Worksheets(dst) If Not ws Is Nothing Then MsgBox ("Worksheet Exists!") Else MsgBox ("Worksheet Dosent Exist!") End If
39f39bdd8350349885919c351484ca3eabcc28439e8e660c309a0434e8dffc79
['0867e84402e64877a567cdf00860de34']
Cause you put the variables j and I inside the mark "" , therefore VBA understand it is the text, and doesnt pass any value into these variables. As the result, your formula will be error. You can try this for your formula: "=VLOOKUP(" & j.Address & "," & Worksheets(I).Name & "!B:C,2,0)"
f634760077f6f8da73f95ffaf81cd37af341a73a0e85b444fd0eaad22514b837
['086a292c9aa84b7498c9b863aca8852f']
Is there a way to obtain a Configuration object from a configuration file in the isolated storage? I'm storing a several configuration files in my app's IsolatedStorage and i need to be able to retrieve the configuration sections within those files. The problem is that the ConfigurationManager only accepts a path and i can't obtain the absolute path of a file within the isolated storage. Is there a way to obtain a Configuration object from a configuration file in the isolated storage?
91f65a07777c656b578d57d7e0514f3b205a0f7605beecbe4d5661857c756190
['086a292c9aa84b7498c9b863aca8852f']
I want to create custom editor from richtextBox which have intelligence and syntax highlighting feature.But i want the control to be single line and if the content is long to fit the Actual width , the left part of the content will be hidden as normal text box works. My Question is how i can create a richtextBox with single line? I can not use text box because it does not support text highlighting and it is relatively easy to do that using richtextBox .
350182ecb79631485ca867233939becec34c39bf0e3a586f5affea9387333e82
['0870c49d2f8a4db3a9ba184aa59aace0']
I have been writing a code which uses SDL to render particles in Visual Studio. However, there does not seem to be any way to include RVO2 library: http://gamma.cs.unc.edu/RVO2/downloads/ to Visual Studio. I have been able to include header files, but library file seems to be libRVO.a which Visual Studio is maybe not accepting. Also, there is no .dll file as was with SDL2 download. So, I wanted to ask is there any way in which I can use RVO library in Visual Studio. If not, I have another similar question... I am using wsl(Windows Subsystem for Linux) and found that SDL cannot be run in it. I am able include RVO in wsl. So, can you suggest me a way where I can use both the libraries RVO and SDL2 simultaneously...
47cae6ada87bb45dcb04a105a19bd5f20473dc1c0978e073e91fbd34c38e59be
['0870c49d2f8a4db3a9ba184aa59aace0']
I know parent and child can communicate using shared memory or via sockets. I am trying to make them communicate with each other using pipes. I first create a child using fork and the I finally want child to read message from stdout which will be outputted by parent, but I was unable to this so I am trying to make them communicate from a temporary file. After fork, I used dup2 to set this file as input-fd for child and output-fd for parent. Then using sleep I ensured child reads after parent outputs. #include<bits/stdc++.h> #include<sys/types.h> #include<sys/wait.h> #include<unistd.h> #include <sys/stat.h> #include <fcntl.h> using namespace std; int main(int argc, char** argv){ if(argc<2){ printf("Usage: %s <string>\n", argv[0]); return 0; } int raw_desc = open("/tmp/raw.txt",O_RDWR); if(raw_desc<0){ FILE* fptr = fopen("/tmp/raw.txt", "a+"); raw_desc = open("/tmp/raw.txt",O_RDWR); } int f=fork(); if(f==0){ dup2(raw_desc, 0); sleep(3); string s; cin>>s; cout<<"Child got : "<<s<<endl; }else{ dup2(raw_desc, 1); sleep(1); cout<<std<IP_ADDRESS>string(argv[1])<<endl; wait(NULL); } return 0; }
6b89322009d9c74ba7e5687bede9e76b1078a0ce1b14f90cb17da0f5348d60a2
['0875b8e713674a3dafd034977936ce09']
Google Translate says he said: "<PERSON> know the těchhle point I stopped, I'm a beginner and do not know what I stand on it all night" Sounds like you need to read up on some JavaScript and jQuery tutorials. I began with something like this: jQuery for Absolute Beginners: The Complete Series Really hope this helps.
d1318969cfc7249f5f491f9dbc6a8b1c86a7d6cb9866266a5d2a9429ffef83bb
['0875b8e713674a3dafd034977936ce09']
This is what I did to get this working on my home network. On the machine actually running Vagrant, edit the Vagrantfile and port forward 8088 (or whatever port # you choose) from the Host ('Actual Machine' as you called it) to port 80 on the Guest ('VM Running Apache' as you called it). Do a normal vagrant up and you should see the port forwarding happening on boot up. I personally have approximately 8 virtual hosts running inside my Vagrant box each with their own host name. I edited my hosts file on the Host (machine 'B' above) in order to point these hostnames to the ip of the Vagrant box. It works great and I can just put in something like mysite.dev in the address bar and that site pulls up on my local machine. Now to get this to work on another machine, within the same subnet as the Host machine, you will need to edit the hosts file on that second machine. Point the hostnames, my example was mysite.dev, to the actual ip address of the Host machine. This will forward any instance of mysite.dev to the machine you have labeled as 'B' in your question. The only problem is that this is just pointing to the standard port 80 like any normal webpage. You want this traffic to actually get to machine 'A' in your question. So instead of just putting mysite.dev into the address bar of the browser, put mysite.dev:8088 (or whatever port number you chose to forward to machine 'A' earlier). Now the traffic from 'C' will be sent to machine 'B' because the hosts file tells it to go there and the additional port you added to the address forces machine 'B' to forward that traffic to port 80 on machine 'A'. Machine 'A' receives the request and returns the data to machine 'B' which then forwards it back to machine 'C'. The end result is machine 'C' seeing the page returned from machine 'A'. Hope that about sums it all up. Good luck! c0p
defb1bfd3c15c5d31b2bfa485d8552222940425b5c3854e6029925f1f32645f2
['087f85b89aa1461d98eac63f16c9dfe0']
import time import sys import random import pygame #Variables white = (255,255,255) simStart = True black = (0,0,0) red = (255,0,0) green = (0,255,0) blue = (0,0,255) x = 590.575 y = 450 clock = pygame.time.Clock() pygame.init() screen = pygame.display.set_mode((1200,600)) pygame.display.set_caption("Squirrel Problem") screen.fill(white) pygame.display.update() while simStart == True: while x > 1: for event in pygame.event.get(): if (event.type==pygame.QUIT): pygame.quit() screen.fill(white) pygame.draw.rect(screen, red, (300, 50, 600, 291.53)) pygame.draw.rect(screen, blue, (x, y, 18.85, 55.81)) x = x - .5 clock.tick(30) pygame.display.update() When I run the code, the screen will flicker. I've heard that this is because of screen.fill() but I don't know another way to clear the last position of [pygame.draw.rect(screen, blue, (x, y, 18.85, 55.81))]. Does anyone know how to do this without the screen glitching/flickering?
5d3ac7cd830e43f5981fada9d993650ef8feea43b8416d18e18bc1584d3e0e7b
['087f85b89aa1461d98eac63f16c9dfe0']
My program runs playerinf() twice but never runs the next function when I call for it. At the bottom of the code is where I call which functions to run. I have never had this problem before. What am I doing wrong? import pygame import time import random import sys import hashlib pygame.init() screen = pygame.display.set_mode((1000,600)) pygame.display.set_caption("Parkour Legend") # variables black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) green = (0, 255, 0) blue = (0, 0, 255) clock = pygame.time.Clock() x = 0 # Create Screen screen.fill(black) pygame.display.flip() # Default player name = "<PERSON>" age = 15 gender = "Boy" # Information Access class information: def __init__(self, name, age, gender, enlistmentNum): self.name = name self.age = age self.gender = gender self.enlistmentNum = enlistmentNum self.playerinf() def playerinf(self): if self.age < 12: print("Sorry you are too young to play this game :(") sys.exit() else: print("Your keyboard movements are being transmitted through one of the human-like beings of the world...") time.sleep(5) print("you have complete control of where he goes, but not his mind!") time.sleep(3) passrequested = raw_input("Enter Enlistment Number: ") if passrequested == enlistmentNum: print("Connecting to port: 597643") time.sleep(.5) print("Satellite Signal: Low") time.sleep(2) print("Recalibrating...") time.sleep(2) print("Satellite Signal: Excellent") time.sleep(2) data = random.randint(3872, 5195) data = str(data) print("Transmitting Data: "+str(data)+" GB/S") else: print("Password Entered was incorrect!") time.sleep(1) print("Shutting Down...") sys.exit() def startup(self): screen.fill(white) name = raw_input("What is your name: ") age = int(input("What is your age: ")) gender = raw_input("Are you a boy or a girl: ") enlistmentNum = hashlib.sha256(name.encode()) enlistmentNum = enlistmentNum.hexdigest() print("-----------------------------") print("Enlistment forum:") print("Name: "+str(name)) print("Age: "+str(age)) print("Gender: "+str(gender)) print(" ") print("Your Enlistment Number is: "+str(enlistmentNum)) print("-----------------------------") player1 = information(name, age, gender, enlistmentNum) while x == 0: x = 1 player1.playerinf() else: player1.startup() pygame.display.flip() clock.tick(10)
c3fa231683c030cf9152ac34c296924b51d2f8377c629564fe7f0b6659f0793c
['088614c9d61744058beb177da95e017e']
Indeed. Disabling Avast Web/Mail shield on my home system brought it into synch with my work system - same error messages. That certainly helps since my web server is at home. Thanks very much! It seems the problem is that the clients use a cached certificate, with SHA-1, instead of my new certificate with SHA-2. I tried changing the name of my intermediate certificate, configuring my web site to use the new name and restarting Apache. Unfortunately, that did not fix the problem. I don't have Avast on my Debian system. Thanks,
db8bfbf786d95ff5b0b1b8216684af05f0cfe96792d2168ff8a6dcf36d21ecc3
['088614c9d61744058beb177da95e017e']
For that you need to create your own QML plugin what is a simple Qt/C++ code. In that QML plugin you can access the system the same way as you would access from any C++ code and expose the functions, properties to the QML layer. There is a template available in the Ubuntu SDK. Open the Ubuntu SDK (QtCreator) go to the "Touch" tab, click on the "Create a new project >" and choose the Ubuntu -> QML Extension Library
762ec59523e4d8414c6f21ad4cc0af440b41b2d2e36a5f7602212f1f4e963554
['08a72c5ccc2540e3a697c25337d0590f']
Lets Suppose you are having Voyage in Cell A2 value B109 onwards and summary report starts from cell D3 contains the Voyage number B109 & E3 contains the count, then you can use =COUNTIF($A2:$A31,D2) in E3 and drag & drop for all unique voyage values Refer the attached snapshot
46c80ab770121f9b6279746987c4e187402b02fab0faeff80ef9f163d05a9f2f
['08a72c5ccc2540e3a697c25337d0590f']
Add a Slicer to the Pivot Table The quickest way to see a list of the Multiple Items in the filter is to add a slicer to the pivot table. Select any cell in the pivot table. Select the Analyze/Options tab in the ribbon. Click the Insert Slicer button. Check the box for the field that is in the Filters area with the filter applied to it. Press OK. A slicer will be added to the worksheet. The items that are selected in the filter drop-down list will also be selected/highlighted in the slicer. These two controls work interchangeably, and we can use both the slicer and the filter drop-down menu to apply filters to the pivot table.
5bcf094902ecd38755b7bb9f456b99d4eb9ca676e84286fe4f1118098fb81910
['08c33c2f23604f8c9fc038652731279d']
Is every pair of continuous functions $f:[0,2\pi]\to\Bbb R$ and $g:[0,2\pi]\to\Bbb R$ homotopic? I mean the straight line homotopy $F:[0,2\pi]\times[0,1]\to\Bbb R$ defined by $F(\theta,t)=(1-t)\times f(\theta)+t\times g(\theta)$.
b59afe363bf1b396114c3d164d243919dba6b8b3a36329a0e6a3b0ba4535e8ad
['08c33c2f23604f8c9fc038652731279d']
@user253751 The idea was to link assets with `/_front/foo.css` which would rewrite to `/public/foo.css` to avoid rewriting to the Front Controller like `/public/index.php?_url=/public/foo.css`. But I think I was wrong about my **.htaccess** configuration at the time I wrote that, this can be served directly, only the application should write the correct path to the assets.
a72aa489f2f5a7bae9f3b5a774720202509f3ae3c265774a754fbc2331ea8c6f
['08d26eff0ac9410483fb742b23ce942f']
I want to create a custom value picker which can have: Same labels Can't use simple Domino view value picker as I need to check individual entry for some business criteria I want to show a short summary as well to help user distinguish among similar labels (I want to add some formatting to it e.g. label in bold, summary in green small chars) I can create an Xpage for all such value pickers or I can have a custom data provider. Now, my question is, do I need to create a custom renderer as well to display Label with summary? How do I implement the picker with modal look-n-feel (I am using bootstrap theme)? Thanks in advance <PERSON>
f4aeadf652c15a2a6c59c18237f5dd57f935aae31727c1e164d949d501a60408
['08d26eff0ac9410483fb742b23ce942f']
I have a scenario. I am using a viewpanel with a pager. I have bound a search box to viewscope and filer view using viewscope value. Its all fine. Now, I have a column value which displays on first page. Now if I go to next page using pager and search, resulting view is filtered and does not display any row unless I use pager. So it looks like view is filtered only results on current page will be displayed. I can navigate to another results using pager only. I am sure this should not be the case but can't figure out what I am doing wrong. Any help is appreciated!!
ec60981ba5d516ba5307dba4f961fb1927940f7816c3e026dbaa3babf5cc7ea2
['08d78810cbf246db9bcebc38a77916f6']
If I understand the fc docu correctly, an 'fc -1' should open the editor with the last command in it, and which I can edit and then execute by leaving the editor. But what happens for me is that the command is executed immediately, and the editor (vi) opens emptily. If I close the editor nothing happens. Any idea what could cause this? I have nothing special installed as far as I know. The history shows properly on 'fc -l'.
6213465feec88a17660f87b9b577c446ce0912aecc0540d476f2dfaed1063ff3
['08d78810cbf246db9bcebc38a77916f6']
After some more experimentation, I found that the only way to do that is to have the argument handover outside the expect logic, e.g.: set input [binary format H* 7f80] exec echo "$input" > input.dat spawn sh -c "./myprog `cat input.dat`" Note that using ${...} instead of backticks does not seem to work easily due to the special meaning of $ to expect. Of course, having spawned a shell instead of the process directly is not the same thing but that does not matter for most of my use cases.
105431a30fa6e4e348d700b103cf7188778abb8fffddd5ad28c5a48a9e90dd6e
['08dbd6d1c5f64425b265baf9ba480643']
Hi I found out the Best solution i.e, through SDWebImages. * Fist I get the response into url and then append it to a array = (String)[] * then I called the sdwebimages in cellforitem function... ####CODE // getting the url images into an array of string let jsonResponse = jsonObj["response"] as! [[String: Any]] print("galleryResponse/\(jsonObj)") for i in 0...jsonResponse.count-1 { let strGalleryImage = jsonResponse[i]["Gallery_Full"] as? String print("o12\(strGalleryImage!)") let str = String((strGalleryImage?.dropFirst(11))!) as? String print("LAAL\(str)") if let imgurl = str { self.arrimages.append(imgurl) print("kl\(self.arrimages)") self.collectionView.reloadData() } THEN -> //Calling the images into cellforitem func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! CollectionViewCell // called the url array into sd_setimages cell.imgProfile.sd_setImage(with: URL(string: arrimages[indexPath.row]), placeholderImage: UIImage(named: "placeholder.jpg")) return cell } Thanks for the answers but this is simplest solution of all...:)
4e75cb0155daeb1ce78f47b08d54ad48b7beef1892a34666dc9d2ecfcb87f55d
['08dbd6d1c5f64425b265baf9ba480643']
used completion handler in the api call and reloaded the data in the api call :----- override func viewDidLoad() { super.viewDidLoad() // self.getFav() //self.viewWillAppear(true) // refreshControl.addTarget(self, action: #selector(viewDidAppear(_:)), for: UIControlEvents.valueChanged) refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh") refreshControl.addTarget(self, action: #selector(newCartViewController.refreshData), for: UIControlEvents.valueChanged) tableView.addSubview(refreshControl) if btn2 != btn3 { lblPreorder.isHidden = true lblOrdermethod.isHidden = false print("BUTTONCLICKED") UserDefaults.standard.removeObject(forKey: "button1") } else if btn2 == btn3 { lblPreorder.isHidden = false lblOrdermethod.isHidden = true print("BUTTON-NOT-CLICKED") UserDefaults.standard.removeObject(forKey: "button1") } // self.view.layoutIfNeeded() // self.view.setNeedsDisplay() // self.getFav() // self.updateTableview() self.tableView.dataSource = self self.tableView.delegate = self print("111111111 -> \(cartid)") self.view.addSubview(self.tableView) if #available(iOS 10.0, *) { tableView.refreshControl = refreshControl } else { tableView.addSubview(refreshControl) } } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.updateTableview() self.getFav() } @objc func refreshData() { self.getFav() self.getTotal1() DispatchQueue.main.async { self.refreshControl.endRefreshing() } } func updateTableview() { DispatchQueue.main.async{ self.tableView.reloadData() } } func getFav() { getFav(completionHandler: { success in if success { DispatchQueue.main.async{ self.tableView.reloadData() } } }) } //TOTAL API CALL: func getTotal1() { let request = getApi.getamountcartGetWithRequestBuilder(restId: "17", cartId: (cartid as? String)!) Alamofire.request(request.URLString, method: .get , parameters: nil, encoding: JSONEncoding.default) .responseJSON { response in print("123321#######/\(response)") let res = response print("101res/\(res)") if let value = response.value as? [String: AnyObject] { if let success = value["error"] as? Bool { if success == false { var grandtotal = value["total"] as Any var gtotal = grandtotal print("^^^^^/\(gtotal)") print("@@@@/\(grandtotal)") UserDefaults.standard.set(10, forKey: "gtotal") } } } } } // // Mark: getting all cart items:--> func getFav(completionHandler: @escaping (Bool) -> Void){ let request = getApi.displaycartGetWithRequestBuilder(restId: "17", cartId:cartid!) Alamofire.request(request.URLString, method: .get , parameters: nil, encoding: JSONEncoding.default) .responseJSON { response in print("123321/\(response)") let res = response print("101res/\(res)") let total = self.cartData print("cartd1/\(total)") if let value = response.value as? [String: AnyObject] { if let success = value["error"] as? Bool { if success == false { print("2222/\(response)") if let response = value["cartdata"] as? [String: AnyObject] { let cart = response["simple"] as! [[String: AnyObject]] // let total = value["total"] as! [String: Any] // print("1231231231234/\(total)") //let userdata: [Favourites] = [] // var cartData: [FavouriteCart] = [] for (_ , value) in cart.enumerated() { let obj = value as! [String:AnyObject] let p_name = obj["p_name"] as! String let p_price = obj["p_price"] as! String let p_id = obj["p_id"] as! String let qty = obj["qty"] as! String // UserDefaults.standard.set(qty, forKey: "qty") var prid = p_id as! String print("stirng ID - > /\(p_id)") let item = FavouriteCart(p_name: p_name, p_price: p_price, p_id: p_id, qty: qty) cartData.append(item) DispatchQueue.main.async{ print("RELOADED-----ON-----API") self.cartData.append(favSection(favitems: cartData)) self.tableView.reloadData() } // self.tableView.reloadData() // self.cartData.append(favitems) //QTY<IP_ADDRESS><IP_ADDRESS><IP_ADDRESS>------- // let quant = QtyCart(qty: qty) // self.qtyData.append(quant) // //print("hiiooooooooooooooooooooooo/\(itemsdata)") } } print("COMPLETION-------------HANDLER") completionHandler(true) } } else { let myAlert = UIAlertController(title:"Alert",message:value["error_msg"] as? String,preferredStyle:UIAlertControllerStyle.alert) let okAction = UIAlertAction(title:"OK",style:UIAlertActionStyle.default , handler: nil) myAlert.addAction(okAction) } } } }
84d9e81ef1eb7ba900852b1b0b16d7ddbdd289f7c3e003fff8ccf1ce52533b09
['08dc970d5e98481cbd39935db0de1cd4']
I'm trying to apply Clean Architecture to a mobile Android App, but I still have some doubts about how to manage API calls. Currently, the classes are structured like this: View -> ViewModel -> UseCase -> Repository -> DataSource It's all well and good when the API calls are about fetching some data from/sending some data to an API. The Repository handles the data I put into it or retrieve from it, and behaves like a collection. Now, what should I do when my API call has nothing to do with some data I could put in a collection? Example: The user hasn't received the "confirm your email" link on his email, so he clicks a button named "Resend Email Confirmation Link". Then, I'll have a ResendEmailConfirmationUseCase. My question is: should I have a repository to make that API call? That doesn't make sense to me, as I'll handle no data, but just send a signal to an API saying "Hey, send that confirmation email again". There is no collection of data that translates into a repository here. How would I even name that repository? How would you approach this problem?
d73f43eaa5c59d3cfcaf598c0e3e2131aba5949b2a6dc9325a654351cdf909e5
['08dc970d5e98481cbd39935db0de1cd4']
I know this is an old question but maybe I can help others that also come looking for this answer. I think you're confusing Repositories with DataSources. A Repository should represent a collection of objects, or a single object, as if it were always in memory. In your example, you would have a UserSubscriptionRepository with a get() method. This repository would have two DataSources: RemoteUserSubscriptionDataSource and LocalUserSubscriptionDataSource. Each of these would know how to get the user subscription from a different source (maybe an API for the remote and a database for the local). Then, the UserSubscriptionRepository would orchestrate how and when to use each of these DataSources (change the word repository for datasource in your step 2 and this turns into the implementation of your get() method). Finally, your use case would call userSubscriptionRepository.get() and get the data it wants, not knowing where it came from (remote or local sources).
34419f76b6515be3ba863a91096b84afefcf57a452a6ef90bef081738997fd74
['08e0f72c63c549deadbf20c8659664b8']
In our current business case we have clients opening a MediaElementJS browsing the player page via a firewall protected network. When the TCP Port 1935 is blocked by firewalls we want the Player to understand that the port is blocked and try the connection for the streaming towards the server by switching to the RMTPT protocol (protocol rollover) and so using HTTP Port 80. We already configured our NGINX to redirect traffic internally from Port 80 to 5080 (our RED5 Server listening for HTTP/RTMPT). We tried doing tests simulating the inbound/outbound connection block of port 1935 on the client. Looks like the MediaElementJS simply does nothing when the Play button is pressed. Is this protocol rollover / fallback on port 80 with RTMPT feature available on MediaElementJS ? Does somebody had the same problem and can explain possibile solutions to it ? We have: nginx 0.7.43 Red5 1.0.5 MediaElementJS <IP_ADDRESS> (not sure about this version).
2095f21f3e550ca04072100aad5059744883ce13b2bf8d4eef5a558c93ccfcf9
['08e0f72c63c549deadbf20c8659664b8']
It turned out it was not a problem of MediaElementJS. The RTMP protocol is transparent to the player. What was required it was a correct configuration of the nginx to forward certain types of HTTP Requests to the RMTPT TCP internal port of the Red5 server. After setting up nginx correctly we tested the port 80 fallback successfully.
cd66a2985c13145dcbd9381dd829b8d3563e49acbc9a715c79f413c8f6f07f88
['08e9cf41b6cf44c592f07682aa01e080']
Hey guys i am trying to get this countdown timer to go faster so i can test it when it goes to the next level etc... but i am playing around with the numbers but its not work :( please if you guys can comment what you are doing im new to programming and it helping me package { import flash.events.TimerEvent; import flash.utils.Timer; public class CountdownTimer extends Timer { public var time:Number = 0; public function CountdownTimer(time:Number = Number.NEGATIVE_INFINITY, delay:Number = 1000) { super(delay, repeatCount); if (isNaN(time)) { this.time = 0; } else { this.time = time; } repeatCount = Math.ceil(time / delay); } to start the timer override public function start():void { super.start(); addEventListener(TimerEvent.TIMER, timerHandler); addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler); } to reset the timer override public function reset():void { super.reset(); time = 0; } protected function timerHandler(event:TimerEvent):void { time -= delay; if(time == 0){ trace("time = 0") } trace("delay"); trace(time); } this par is for timer complete protected function timerCompleteHandler(event:TimerEvent):void { } to stop the timer override public function stop():void { super.stop(); removeEventListener(TimerEvent.TIMER, timerHandler); removeEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler); } } }
31717cbdd0b4df54baf7c6d774646acb095ca67bf8930fada23b94765be3af8b
['08e9cf41b6cf44c592f07682aa01e080']
Hi guys i am new to AS3 and to Starling i am having problem displaying an image in a different class. it does show on my game menu class but i wanted it to show on my play game class. so i got 3 classes Main that starts the starling that runs GameMenu class. "GameMenu class" package { import starling.display.BlendMode; import starling.display.Button; import starling.display.Image; import starling.display.Sprite; import starling.events.Event; public class GameMenu extends Sprite { private var bg:Image; private var gameLogo:Image; private var playBtn:Button; private var rankBtn:Button; private var settingBtn:Button; private var inGame:PlayGame; public function GameMenu () { super (); this.addEventListener (Event.ADDED_TO_STAGE, onAddedToStage); } private function onAddedToStage (event:Event):void { this.removeEventListener (Event.ADDED_TO_STAGE, onAddedToStage); drawScreen (); } private function drawScreen ():void { bg = new Image(Assets.getAtlas().getTexture(("Background.png"))); bg.blendMode = BlendMode.NONE; this.addChild(bg); gameLogo = new Image(Assets.getAtlas().getTexture(("GameLogo.png"))); gameLogo.x = stage.stageWidth/2 - gameLogo.width/2; gameLogo.y = 30; this.addChild(gameLogo); playBtn = new Button(Assets.getAtlas().getTexture("PlayBtn.png")); playBtn.x = stage.stageWidth/2 - playBtn.width/2; playBtn.y = 450; playBtn.addEventListener(Event.TRIGGERED, onPlayClick); this.addChild(playBtn); rankBtn = new Button(Assets.getAtlas().getTexture("RankBtn.png")); rankBtn.x = rankBtn.bounds.left + 60; rankBtn.y = 600; rankBtn.addEventListener(Event.TRIGGERED, onRankClick); this.addChild(rankBtn); settingBtn = new Button(Assets.getAtlas().getTexture("SettingBtn.png")); settingBtn.x = settingBtn.bounds.right + 60; settingBtn.y = 600; settingBtn.addEventListener(Event.TRIGGERED, onSettingClick); this.addChild(settingBtn); } private function onRankClick (event:Event):void { trace("LEADERBOARD BUTTON HIT") } private function onSettingClick (event:Event):void { trace("SETTING SCREEN BUTTON HIT") } private function onPlayClick (event:Event):void { playBtn.removeEventListener(Event.TRIGGERED, onPlayClick); trace("PLAY BUTTON HIT") gameLogo.visible = false; playBtn.visible = false; rankBtn.visible = false; settingBtn.visible = false; //bg.visible = false; inGame = new PlayGame(); } } } this class works perfectly now. "PlayGame class" package { import starling.display.Image; import starling.display.Sprite; import starling.events.Event; public class PlayGame extends Sprite { private var bubble:Image; public function PlayGame () { trace("PlayGame"); super (); this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage2); } private function onAddedToStage2 (event:Event):void { trace("OnAddedToStage"); this.removeEventListener (Event.ADDED_TO_STAGE, onAddedToStage2); drawScreen (); } public function drawScreen ():void { trace("Bubble"); bubble = new Image(Assets.getAtlas().getTexture(("Bubble.png"))); bubble.x = 100; bubble.y = 100; this.addChild(bubble); } } } the bubble image is now showing and i don't know why?
e4e664e1d7fa16c20a648311d201a88f1f8c15884a9c76458cccfefb867803a3
['08efdffda8b543088071df569665d8a0']
Here is cannonical example from multiprocessing documentation: from multiprocessing import Process, Value, Array def f(n, a): n.value = 3.1415927 for i in range(len(a)): a[i] = -a[i] if __name__ == '__main__': num = Value('d', 0.0) arr = Array('i', range(10)) p = Process(target=f, args=(num, arr)) p.start() p.join() print num.value print arr[:] Note that num and arr are shared objects. Is it what you are looking for?
aac98af9f300ca26fd23f99f0328ba42de74e2d69f2e99261cbbebd728308116
['08efdffda8b543088071df569665d8a0']
I have a binary data on the disk stored in IEEE 754-2008 format which is the 32-bit floating point with base 10 exponent (if I got it right: http://en.wikipedia.org/wiki/Decimal_floating_point). How would I convert it to base 2 floating point (like the standard float32 on intel processors)? Sample code in C, Python or Java would be great! Thanks for help!
17222f6d347a497d6fcb9699da2a9bd2f4c25176a7a406564bad38301cac0479
['08f6a6a498084274a39aec382f8a4d45']
The way you pass a password is probably wrong. It may be encrypted at this point. In provided example I will try to do this at first: describe 'user access' do let (:user) { create(:user, password: 'secret') } before :each do login_user(user[:email], 'secret') end it "should log in the user" do controller.should be_logged_in end end
dfac7aa07779ffc021fe3d2e04d79193360ad10b15b78471285cb0e83d9831e2
['08f6a6a498084274a39aec382f8a4d45']
Last time I did it with rails 2. I've placed helper module in lib directory with following line added in init.rb which is placed in root directory of a gem/plugin: ActionController<IP_ADDRESS>Base.helper TestHelper It makes TestHelper module methods available for template. Here is how above helper method works: helper method
7acef89e04fab659f32afb63dba71726da2e426dff1c3d5323c962a9accc2426
['08f7f861cac0403983e0bfd2a14019b6']
We faced a similar issue when working with Appium 1.4.16 version, and we have searched a lot in different forums and appium related support forumns. came to know that it is an issue and they gave an alternative for users to continue to work till they fix this in next releases. Basically we need to modify file adb.js present inside of appium folder: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\ Drafted those details clearly @ http://www.testingtools.co/appium/error-command-failed-adb-exe-s-emulator-5554-shell-ps-uiautomator hope it helps and you will be abl
1297e0b8515c2bf98b7b433c0958f2611c5e98419deec6aca9c45169bf976f4c
['08f7f861cac0403983e0bfd2a14019b6']
In case you using Appium 1.4 + version to automate android (7.0 / N / Nougat ) version, this issue persists. you have to make couple of changes to get this working properly. We had a similar issue, when we started to automate a simple mobile application using appium, android studio and selenium webdriver, after so many searches and also looking at various appium support tickets, we found that it was a bug and they have given an alternative to fix and go ahead. You have to change code in couple of places in following file: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js Those details have been listed in below article: http://www.testingtools.co/appium/error-command-failed-adb-exe-s-emulator-5554-shell-ps-uiautomator Hope it helps you, in case you have any queries, you can post them over the blog article in form of comments as well.
31259e8cfa1c06393f2a49604361a06201824c7269ff06d8b957521487e79aa0
['0900ef87b8a84973a6aa155b50aab332']
I use one activity and few fragments. I want to hide toolbar only on splash screen. I wrote this: class MainActivity : AppCompatActivity() { lateinit var auth: FirebaseAuth override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) auth = Firebase.auth val currentUser = auth.currentUser updateUI(currentUser) setSupportActionBar(toolbar) findNavController(R.id.nav_container).addOnDestinationChangedListener { _, destination, _ -> when (destination.id) { R.id.splashScreenFragment -> { supportActionBar?.hide() appBarLayoutz.visibility = View.GONE } else -> { supportActionBar?.show() appBarLayoutz.visibility = View.VISIBLE } } } } private fun updateUI(currentUser: FirebaseUser?) { if (currentUser != null) { findNavController(R.id.nav_container).navigate(R.id.action_splashScreenFragment_to_mainPageFragment) } else { CoroutineScope(Dispatchers.Default).launch { delay(500) findNavController(R.id.nav_container).navigate(R.id.action_splashScreenFragment_to_loginFragment) } } } } but it returns android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. error. Full logs: 2020-10-04 18:36:56.949 <PHONE_NUMBER>/pl.rybson.musicquiz E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: pl.rybson.musicquiz, PID: 23070 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8613) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1528) at android.view.View.requestLayout(View.java:24634) at android.view.View.setFlags(View.java:15312) at android.view.View.setVisibility(View.java:10919) at com.google.android.material.appbar.AppBarLayout.setVisibility(AppBarLayout.java:417) at pl.rybson.musicquiz.ui.MainActivity$onCreate$1.onDestinationChanged(MainActivity.kt:43) at androidx.navigation.NavController.dispatchOnDestinationChanged(NavController.java:498) at androidx.navigation.NavController.navigate(NavController.java:1097) at androidx.navigation.NavController.navigate(NavController.java:935) at androidx.navigation.NavController.navigate(NavController.java:868) at androidx.navigation.NavController.navigate(NavController.java:854) at androidx.navigation.NavController.navigate(NavController.java:842) at pl.rybson.musicquiz.ui.MainActivity$updateUI$1.invokeSuspend(MainActivity.kt:57) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2020-10-04 18:36:56.959 <PHONE_NUMBER>/pl.rybson.musicquiz I/Process: Sending signal. PID: 23070 SIG: 9 Du you have idea how to fix it?
a726c18e79ce65a7b76d51dd84b33c852074c79efcee081d749aa91e60607002
['0900ef87b8a84973a6aa155b50aab332']
I want to pick image from gallery, I added the READ_EXTERNAL_STORAGE permission to Manifest, but it doesn't work fine. It take path uri of image but doesn't show it. Only rectangle with good proportions (screen and code below) class NewRestaurantFragment : Fragment(R.layout.fragment_new_restaurant) { companion object { private const val TAG = "NewRestaurantFragment" private const val GET_IMAGE_REQUEST_CODE = 2137 } private lateinit var ivPhoto: ImageView override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) ivPhoto = view.findViewById(R.id.iv_photo) ivPhoto.setOnClickListener { selectPhoto() } } private fun selectPhoto() { val intent = Intent() intent.apply { type = "image/" action = Intent.ACTION_PICK } startActivityForResult(intent, GET_IMAGE_REQUEST_CODE) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == GET_IMAGE_REQUEST_CODE && resultCode == RESULT_OK) { val uri = data!!.data ivPhoto.setImageURI(uri) } } }
fd6f732c98547e0fde976c27cad56521e27848f610b381106374833a96157f08
['0907a29e5ffc4397bbdfb8899fa5f071']
You compiled 3 cpp files, g++ main.cpp userofconverter.cpp anotheruserofconverter.cpp, each cpp file in the command line will generate a Translation unit. Each translation unit will #include "converter.hpp" because you told it to, and while compiling those two translation units, both of them spotted warnings and error in converter.hpp so you see the same messages. Yes it can be solved, for example you can compile one file (main.cpp for example) and include userofconverter.cpp and anotheruserofconverter.cpp and it will compile as one translation unit.
11fb20d573d33bc5764dc15acb75556493ccb1af072ffceff7223d40a26423d1
['0907a29e5ffc4397bbdfb8899fa5f071']
First, the variable: int MAXTEMPS; is not initialized, as the original code shows, it needs to be equal to 5. int MAXTEMPS = 5; Second, you cant get input (cin) with a string literal, and you don't wont to use one index to get the input all so (temp[1]), so do this: cin >> temp[i]; you should also consider using tabs when you enter a block (better to understand the code in my opinion)
082b6aa4cf66df179953c31c7a89b6db18ffd7c2d488a548921e0798b5e370a9
['091839d4058c4ad0b8739d4db5c68028']
I believe the answer is 1024 Explanation: When we reach each wife the number of diamonds needs to be divisible by 4. Let $x_i$ denote the number of diamonds when he reaches each wife ($x_5$ being the amount left after all wives are done taking). Every $x_i$ has to be divisible by 4 and can be found by the following recursive formula $$x_i - x_i/4 = x_{i+1}$$. So, we choose initially $x_5$ to be the smallest multiple of 4; 4! This doesn't work as each time we recursively find the previous $x_i$ we have to do the following: $$A: x_{i-1} = 4x_i/3$$ so, we need to multiply $x_5$ by $3^4$ to give us $x_5 = 4*3^4 = 324$. We can then recursively work backwards using A to get $$x_4 =432,x_3=576,x_2=768,x_1=1024$$
ffb68b3d2732b3bbadb3a9f2604fa529f82c046c35c79a7590ab66b3a6a535e6
['091839d4058c4ad0b8739d4db5c68028']
You cannot mount an EF-M Lens on a standard DSLR or at least it won't work the way you want it to. The EF-M lenses are designed to sit closer to the sensor than on a DLSR. There is no way to get the EF-M lens closer to a DSLR sensor because the mirror is in the way. You can however, put a DSLR lens on the EOS-M camera with what is essentially a spacer to keep the lens further from the EOS-M sensor (the distance it would be if used on a DSLR).