texts
sequence
tags
sequence
[ "Kodein Scopes, Bind database service to an activity lifecycle", "I've been trying to implement a custom scope in kodein for the past day and I am about to rip my hair off.\nMy application is built on 2 activities, one activity for login, the other when the user is logged in (I'll call it MainActivity).\nI have several singleton services that fetches data from a Firestore database that I use within many fragments inside my MainActivity, and I am currently using Kodein for getting my singleton objects of each service.\nSummary of my Service:\nclass TagsService(context: Context): KodeinAware {\n override val kodein by closestKodein(context)\n\n val tags: MutableLiveData<ArrayList<Tag>> = MutableLiveData(ArrayList())\n\n // Other stuff fetching data and storing it in tags\n}\n\nAnd the service inside my Kodein application\nbind() from singleton { TagsService(applicationContext) }\n\nInside my fragment I simply fetch my tagsService class with\nprivate val tagsService: TagsService by instance()\n\nThe problem now is that when the user signs out, I have to clean up all tags in this case, wait for the user to get logged in, create a new query etc etc, a lot of work. But if this service could somehow be "killed" and then started up again when the user logged in (comes back to MainActivity, also without saving its last state, just a new object) everything would be cleaned up automatically, without me having to write a lot of code.\nGoal: Since MainActivity only is "active" when the user is logged in and properly authenticated I would like to attach a lifecycle to my TagsService object, whenever MainActivity dies it also kills my tagsService and then "re-initializes" whenever MainActivity "lives" again.\nI am terribly sorry if its hard to grasp what I'm trying to do, I'm quite new to kotlin and programming as a whole" ]
[ "java", "android", "kotlin", "dependency-injection", "kodein" ]
[ "How to set expiry time for all Ignite caches?", "I am starting ignite by a specific configuration. In that configuration, I specified expiration policy. But expiration is not working. When I specified a cache name in that property, it is working fine. \n\nI added configuration like below\n\n<property name=\"expiryPolicyFactory\">\n <bean class=\"javax.cache.expiry.CreatedExpiryPolicy\" factory-method=\"factoryOf\">\n <constructor-arg>\n <bean class=\"javax.cache.expiry.Duration\">\n <constructor-arg value=\"MINUTES\"/>\n <constructor-arg value=\"5\"/>\n </bean>\n </constructor-arg>\n </bean>\n </property>\n\n\nBut this is not working for all caches, \n\nWhen I tried config like below it is working,\n\n<bean class=\"org.apache.ignite.configuration.CacheConfiguration\">\n <property name=\"expiryPolicyFactory\">\n <bean class=\"javax.cache.expiry.CreatedExpiryPolicy\" factory-method=\"factoryOf\">\n <constructor-arg>\n <bean class=\"javax.cache.expiry.Duration\">\n <constructor-arg value=\"SECONDS\"/>\n <constructor-arg value=\"5\"/>\n </bean>\n </constructor-arg>\n </bean>\n </property>\n <property name=\"name\" value=\"test\"/>\n <property name=\"atomicityMode\" value=\"ATOMIC\"/>\n <property name=\"backups\" value=\"1\"/>\n </bean>\n\n\nHere the cache \"test\" is expiring correctly." ]
[ "xml", "spring", "scala", "ignite" ]
[ "How to fix border radius in IE8 (ie7, ie6)", "I'm using this CSS:\n\n #main{ \n border-radius: 50px;\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n -webkit-border-radius: 50px;\n -webkit-border-bottom-right-radius: 4px;\n -webkit-border-bottom-left-radius: 4px;\n -moz-border-radius: 50px;\n -moz-border-radius-bottomright: 4px;\n -moz-border-radius-bottomleft: 4px;\n }\n\n\nIt works perfectly in FF, Chrome, IE9(i think) and Safari...\nBut its soooo ugly in IE8 , \n\nThere are users using IE8, i have tried the .htc file but that dont support border-bottom-right-radius and border-bottom-left-radius... \n\nI'm looking for a JS or HTC file that does support that (or an other solution for this)\nI only need it for IE8, but its great if it support IE6 and IE7 aswell!\n\nThank you!" ]
[ "javascript", "html", "css" ]
[ "why tensorflow linear regression predict all 0?", "I want to realize a linear regression using tensorflow. But I don't know what's wrong with it. If I only train once, the predict result will all be 0. And if I train more, the loss increase instead of decrease. \n Can anyone help me? Thanks a lot!\n\n# Step2\nx = tf.placeholder(tf.float64, [None, 14])\ny_ = tf.placeholder(tf.float64, [None])\n# Step3\nfeature_size = int(x.shape[1])\nlabel_size = int(1)\nw = tf.Variable(tf.zeros([feature_size, label_size], dtype='float64'), name='weight')\nb = tf.Variable(tf.zeros([label_size], dtype='float64'), name='bias')\n# Step4\ny = tf.matmul(x, w) + b\n# Step5\nloss = tf.reduce_sum(tf.square(y-y_))# + tf.matmul(tf.transpose(w), w)\n# Step6\noptimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)\nwith tf.Session() as sess:\n # Step7\n tf.global_variables_initializer().run()\n train_loss, _, w_, b_, y_pred = sess.run([loss, optimizer, w , b , y],\n {x: X_train.as_matrix(), y_: y_train.as_matrix()})\n\n\nif I show the result with code below:\n\n print(\"The train_loss is :{0}\".format(train_loss))\n print(\"y_pred shape:{1}\\n y_pred value{0}\".format(y_pred, y_pred.shape))\n print(\"w_:{0}\".format(w_))\n print(\"b_:{0}\".format(b_))\n\n\nThe result with be:\n\nThe train_loss is :25366.999902840118\ny_pred shape:(151, 1)\n y_pred value[[ 0.]\n [ 0.]\n [ 0.]\n [ 0.]\n [ 0.]\n...\n [ 0.]]\nw_:[[ -4197.62931207]\n [ -5012.08767412]\n [-12005.66678623]\n [ 16558.73513235]\n [ -7305.34601191]\n [ -5714.5346788 ]\n [ -9633.25591793]\n [-12477.03557256]\n [ -9630.39349598]\n [ -7365.70395179]\n [-11168.48902116]\n [ -6483.21729379]\n [ 2177.84048453]\n [ -3059.72968574]]\nb_:[ 24045.6024]\n\n\nBut the data use libsvm babyfat_scale data set:\n\n1.0708 1:-0.482105 2:-0.966102 3:-0.707746 4:0.585492 5:-0.492537 6:-0.514938 7:-0.598475 8:-0.69697 9:-0.411471 10:-0.465839 11:-0.621622 12:-0.287129 13:-0.0791367 14:-0.535714 \n1.0853 1:-0.743158 2:-1 3:-0.552422 4:0.772021 5:-0.263682 6:-0.497364 7:-0.654384 8:-0.562998 9:-0.426434 10:-0.465839 11:-0.418919 12:-0.435644 13:0.136691 14:-0.142857 \n\n\nAnd if I try to train 100 times with the same data:\n\nfor i in range(100):\n train_loss, _, w_, b_, y_pred = sess.run([loss, optimizer, w , b , y],\n {x: X_train.as_matrix(), y_: y_train.as_matrix()})\n\n\nThe loss increase instead of decrease!!! WHY?\nPlease help me! Thanks a lot!" ]
[ "python", "machine-learning", "tensorflow", "linear-regression", "gradient-descent" ]
[ "Capybara Ambiguity Error", "My application is based on Rails 3 in action which have devise for user authentication i got this error. How could this error be solved ?\n\nbin/cucumber features/signing_up.feature\nRack::File headers parameter replaces cache_control after Rack 1.5.\nUsing the default profile...\nFeature: Signing up\n In order to be attributed for my work\n As a user\n I want to be able to sign up\n\n Scenario: Signing up # features/signing_up.feature:6\n Given I am on the homepage # features/step_definitions/web_steps.rb:44\n When I follow \"Sign up\" # features/step_definitions/web_steps.rb:56\n Ambiguous match, found 2 elements matching link \"Sign up\" (Capybara::Ambiguous)\n ./features/step_definitions/web_steps.rb:57:in `/^(?:|I )follow \"([^\"]*)\"$/'\n features/signing_up.feature:8:in `When I follow \"Sign up\"'\n And I fill in \"Email\" with \"[email protected]\" # features/step_definitions/web_steps.rb:60\n And I fill in \"Password\" with \"password\" # features/step_definitions/web_steps.rb:60\n And I fill in \"Password confirmation\" with \"password\" # features/step_definitions/web_steps.rb:60\n And I press \"Sign up\" # features/step_definitions/web_steps.rb:52\n Then I should see \"You have signed up successfully.\" # features/step_definitions/web_steps.rb:105\n Then I should see \"Please confirm your account before signing in.\" # features/step_definitions/web_steps.rb:105\n\nFailing Scenarios:\ncucumber features/signing_up.feature:6 # Scenario: Signing up\n\n1 scenario (1 failed)\n8 steps (1 failed, 6 skipped, 1 passed)\n0m0.272s\n\n\nstep definition:57\n\nWhen /^(?:|I )follow \"([^\"]*)\"$/ do |link|\n click_link(link)\nend\n\n\nroutes.rb\n\nTicketee::Application.routes.draw do\n\n devise_for :users, :controllers => { :registrations => \"registrations\" }\n get '/awaiting_confirmation', :to => \"users#confirmation\", :as => 'confirm_user'\n\n resources :projects do\n resources :tickets\n end\n root :to => \"projects#index\"\n\n namespace :admin do\n root :to => \"base#index\"\n resources :users\n end\n\n\nthat is the routes.rb which getting from the book , and in the book the test is passing but not passing with me" ]
[ "ruby-on-rails", "ruby-on-rails-3", "ruby-on-rails-3.2" ]
[ "How can I create a program which reads from any text file given?", "What I did so far:\ndef readMatrixFile(file):\n '''\n This function reads files\n '''\n fr = open("{}".format(file), 'r') \n \n # Checking every line whether it is a matrix row or not.\n for line in file:\n print(line)\n \n # close the file\n fr.close()\n \n\nI want to create a function that reads any file given. My code above did not work. What and where did I do wrong? What should I do further ?" ]
[ "python", "file-io" ]
[ "PayPal statement via API", "I have just reviewed REST API and Classic API references and there doesn't seem to be a method which would allow to obtain transactions statement? Essentially I am looking for what can be found in PayPal admin panel under History -> Download History -> Balance Affecting Payment.\n\nAny suggestions how to obtain PayPal statement via API very much appreciated." ]
[ "paypal" ]
[ "How to replace or remove XML HEADER while using xmlbuilder-js of NodeJs?", "I am using NodeJs library called xmlbuilder-js for building dynamic XML output but I'm having a little difficulty removing the header of the XML Output. Following is my code sample\n\nvar xml = builder.create('root')\n .ele('parent')\n .ele('content')\n .dat('something').up()\n .up()\n .end()\nconsole.log(xml) \n\n\nwhich produces following output\n\n<?xml version=\"1.0\"?>\n<root>\n<parent>\n<content><![CDATA[something]]></content>\n</parent><\n</root>\n\n\n\n Here I wanna remove the first line of the output which is called\n header that is <?xml version=\"1.0\"?> and replace it with another\n line like <vast version=\"2.5\"> but I'm confused how shall I do that.\n Can somebody please tell me with an example how to do so?" ]
[ "javascript", "node.js", "xml", "xml-builder" ]
[ "Is it possible to append the value of macro argument instead of appending it literally?", "I have a macro that I would like to use in the following fashion:\n\n`define assign_m(CH, INT_NUM) \\\n assign dp_input``CH``_if.master_mp.sigA[INT_NUM] = some_signal[CH][INT_NUM];\n\ngenerate\n for(genvar i=0; i<2; i++) begin\n for(genvar j=0; j<2; j++) begin\n `assign_m(i,j)\n end\n end\nendgenerate\n\n\nI would like to have a construct like this to expand to:\n\n\nassign dp_input0_if.master_mp.sigA[0] = some_signal[0][0];\nassign dp_input0_if.master_mp.sigA[1] = some_signal[0][1];\nassign dp_input1_if.master_mp.sigA[0] = some_signal[1][0];\nassign dp_input1_if.master_mp.sigA[1] = some_signal[1][1];\n\n\n\nBut of course it doesn't happen that way as Verilog literally appends the variable j instead of its value (§ 22.5 `define, `undef, and `undefineall of IEEE Std 1800-2012, page 644).\n\nHow can I have a macro where the argument's value is appended?" ]
[ "macros", "verilog" ]
[ "vim -- copy to system clipboard in OpenSuSE", "I've tried the methods mentioned at Vim: copy selection to OS X clipboard, but neither the * or + register seem to be working for me. I'm on OpenSuSE 11.3, and have vim and vim-data installed (there is no vim-full package as mentioned in the link in SuSE). I've tried with Klipper enabled and disabled. (edit) I've also tried pasting with ctrl+v and middle click.\n\nThanks in advance." ]
[ "vim", "clipboard" ]
[ "Searching for list in list python", "Let's say I have the following main_list that contains other small_lists:\n\nmain_list = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]\n\n\nI want to find the small_list knowing the index 0 and 1 of the small_lists. So for instance, how can I create a getlist() function such that:\n\ngetlist(4,5) = [4, 5, 6, 7]\ngetlist(0,1) = [0, 1, 2, 3]\ngetlist(5,5) = None\ngetlist(9,10) = None" ]
[ "python", "arraylist", "computer-science" ]
[ "Getting error in executing OWL API", "I am trying to execute following code.\n\nimport java.io.File;\n\nimport org.semanticweb.owlapi.apibinding.OWLManager;\nimport org.semanticweb.owlapi.model.AddAxiom;\nimport org.semanticweb.owlapi.model.IRI;\nimport org.semanticweb.owlapi.model.OWLAxiom;\nimport org.semanticweb.owlapi.model.OWLClass;\nimport org.semanticweb.owlapi.model.OWLDataFactory;\nimport org.semanticweb.owlapi.model.OWLOntology;\nimport org.semanticweb.owlapi.model.OWLOntologyCreationException;\nimport org.semanticweb.owlapi.model.OWLOntologyManager;\n\npublic class Snippet {\npublic static void main(String[] args) throws OWLOntologyCreationException {\n File file = new File(\n \"file:///c/Users/DTN/Desktop/Final SubmissionFilteringMechanism_Ontology.owl\");\n OWLOntologyManager m = OWLManager.createOWLOntologyManager();\n OWLDataFactory f = OWLManager.getOWLDataFactory();\n OWLOntology o;\n o = m.loadOntologyFromOntologyDocument(file);\n OWLClass clsA = f.getOWLClass(IRI.create(\"urn:test#ClassA\"));\n OWLClass clsB = f.getOWLClass(IRI.create(\"urn:test#ClassB\"));\n OWLAxiom ax1 = f.getOWLSubClassOfAxiom(clsA, clsB);\n AddAxiom addAxiom1 = new AddAxiom(o, ax1);\n m.applyChange(addAxiom1);\n for (OWLClass cls : o.getClassesInSignature()) {\n System.out.println(cls.getIRI());\n }\n m.removeOntology(o);\n}\n}\n\n\nIt is generating following error.\n\n\n Exception in thread \"main\" java.lang.NoClassDefFoundError:\n com/google/inject/Provider at\n java.lang.ClassLoader.defineClass1(Native Method) at\n java.lang.ClassLoader.defineClass(Unknown Source) at\n java.security.SecureClassLoader.defineClass(Unknown Source) at\n java.net.URLClassLoader.defineClass(Unknown Source) at\n java.net.URLClassLoader.access$100(Unknown Source) at\n java.net.URLClassLoader$1.run(Unknown Source) at\n java.net.URLClassLoader$1.run(Unknown Source) at\n java.security.AccessController.doPrivileged(Native Method) at\n java.net.URLClassLoader.findClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) at\n sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) at\n java.lang.ClassLoader.defineClass1(Native Method) at\n java.lang.ClassLoader.defineClass(Unknown Source) at\n java.security.SecureClassLoader.defineClass(Unknown Source) at\n java.net.URLClassLoader.defineClass(Unknown Source) at\n java.net.URLClassLoader.access$100(Unknown Source) at\n java.net.URLClassLoader$1.run(Unknown Source) at\n java.net.URLClassLoader$1.run(Unknown Source) at\n java.security.AccessController.doPrivileged(Native Method) at\n java.net.URLClassLoader.findClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) at\n sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) at\n test.main(test.java:18) Caused by: java.lang.ClassNotFoundException:\n com.google.inject.Provider at\n java.net.URLClassLoader.findClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) at\n sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at\n java.lang.ClassLoader.loadClass(Unknown Source) ... 25 more\n\n\nPlease some body help me out. thanks in advance." ]
[ "java", "owl" ]
[ "how to move the cmap.set_bad setting to PIL", "I provide here an example of what I am doing.\nI need to create a map with nodata value included, and I decided to have them in red color so:\n\nfrom PIL import Image\n\nimport matplotlib.cm as cm\n\ncurrent_cmap = cm.YlGn\n\ncurrent_cmap.set_bad(color = 'red')\n\n\nThen I have numpy array (image) to display and I move to PIL with this :\n\nimg = Image.fromarray(np.uint8(current_cmap(data)*255))\n\nimg.show()\n\n\nThe image comes out with the proper colormap, but the nodata values are still with the default setting, not the one I chose at the beginning. How can it be modified in PIL?\n\nI attach here two image to explain my question : \n\n\n\nthis is the map obtained with matplotlib, I have set the nodata with red color\n\nAnd now the other one obtained via PIL, with the same colormap:\n\n\n\n_It is clear that where I chose the red color, the colormap in this case has maintained the white color. I don't know why my setting is not working for it" ]
[ "python", "matplotlib", "python-imaging-library" ]
[ "Efficiently querying a multidimensional array of objects in MongoDB", "I have documents that have the following structure:\n\n{\n \"somekey1\": \"somevalue1\",\n \"data\" : [\n [\n {\n \"value\" : 0.807689530228178,\n \"unit\" : \"mL\"\n },\n {\n \"value\" : 0.7392892800962352,\n \"unit\" : \"mL\"\n },\n ],\n [\n {\n \"value\" : 0.8314139708574444,\n \"unit\" : \"mL\"\n },\n {\n \"value\" : 0.09766834482756892,\n \"unit\" : \"mL\"\n }\n ],\n [\n {\n \"value\" : 0.3821786847386669,\n \"unit\" : \"mL\"\n },\n {\n \"value\" : 0.18408410591658442,\n \"unit\" : \"mL\"\n }\n ]\n ]\n}\n\n\nWhat is the most efficient way to return all value/unit objects with value in a certain range? (ex. > 0.7?) Tried searching but didn't come up with anything helpful. Can it be done with a single find or aggregate operation?" ]
[ "mongodb" ]
[ "Created form not submitting after calling .submit()", "I need to create a form and call the submit on the fly like the following:\n(Chrome working, not on Firefox)\n\nvar form = document.createElement(\"form\");\nform.name=\"openGame\";\nform.method = \"post\";\nform.action=\"/public/games\";\nvar lat = document.createElement(\"input\");\nlat.name=\"latitude\";\nlat.value=$(\"#city[name=latitude]\").val() || \" \";\nlat.type=\"hidden\";\nform.appendChild(lat);\nvar lng = document.createElement(\"input\");\nlng.name=\"longitude\";\nlng.value=$(\"#city[name=longitude]\").val() || \" \";\nlng.type=\"hidden\";\nform.appendChild(lng);\nvar address = document.createElement(\"input\");\naddress.name=\"city\";\naddress.value=$(\"#city[name=city]\").val() || \" \" ;\naddress.type=\"hidden\";\nform.appendChild(address);\nvar game = document.createElement(\"input\");\ngame.name=\"game\";\ngame.value=id;\ngame.type=\"hidden\";\nform.appendChild(game);\nform.submit();\n\n\nbut the form is actually not submitting. No errors, no outputs in the console" ]
[ "javascript", "jquery", "forms" ]
[ "Webpack cannot resolve relative path", "I have this folder structure\n\n\n\nThis is my webpack.config.js\n\nvar path = require('path');\nvar ExtractTextPlugin = require('extract-text-webpack-plugin');\nvar CleanWebpackPlugin = require('clean-webpack-plugin');\n\nmodule.exports = {\n entry: {\n bundle: ['./src/index.js',\n './assets/style.less']\n },\n output: {\n filename: '[name].js',\n path: path.resolve(__dirname, 'web/dist'),\n publicPath: path.resolve('/webpackdemo/web/dist/')\n },\n module: { \n rules: [\n {\n test: /\\.less$/,\n use: ExtractTextPlugin.extract({\n fallback: \"style-loader\",\n use: [\"css-loader\", \"resolve-url-loader\", \"less-loader\"]\n })\n },\n {\n test: /\\.(eot|svg|ttf|woff|woff2)$/,\n loader: 'file-loader?name=/fonts/[name].[ext]'\n }\n ]\n },\n plugins: [\n new ExtractTextPlugin('style.css'),\n new CleanWebpackPlugin(['web/dist'])\n ]\n};\n\n\nassets/style.less\n\n@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,500,600,700&subset=latin,latin-ext);\n\n@import \"linearicons/linearicons.less\";\n\nbody{\n font-family: \"Open Sans\", sans-serif;\n font-size: 12px;\n}\n\n\nthen assets/linearicon/linearicon.less\n\n@font-face {\n font-family: 'linearicons';\n src:url('fonts/Linearicons-Free.eot?w118d');\n src:url('fonts/Linearicons-Free.eot?#iefixw118d') format('embedded-opentype'),\n url('fonts/Linearicons-Free.woff2?w118d') format('woff2'),\n url('fonts/Linearicons-Free.woff?w118d') format('woff'),\n url('fonts/Linearicons-Free.ttf?w118d') format('truetype'),\n url('fonts/Linearicons-Free.svg?w118d#Linearicons-Free') format('svg');\n font-weight: normal;\n font-style: normal;\n}\n\n\nThe problem is that compiling ends in errors because of the url(\"fonts/Linearicon-*). \n\n\n ERROR in\n ./node_modules/css-loader!./node_modules/resolve-url-loader?root=./../!./node_modules/less-loader/dist/cjs.js!./assets/style.less\n Module not found: Error: Can't resolve\n './linearicons/fonts/Linearicons-Free.eot?w118d' in\n '/home/wwwhome/webpackdemo/assets' @\n ./node_modules/css-loader!./node_modules/resolve-url-loader?root=./../!./node_modules/less-loader/dist/cjs.js!./assets/style.less\n 6:173-230 @ ./assets/style.less @ multi ./src/index.js\n ./assets/style.less\n\n\nFor the compiler it is relative to folder \"linearicons\" but i would like to resolve it always in assets/fonts.\nI could change all the urls in url('../fonts/Linearicons-Free.eot?w118d') but it's not convenient as this is a bit part of a bigger theme with hundreds of less files.\nI've tryied to add also a root parameter to resolve-url-loader?root=assets/fonts but it didn't work.\n\nAny idea?\n\nThanks" ]
[ "javascript", "webpack", "resolveurl" ]
[ "Winforms Rich Textbox allow scrolling when mouse over", "I have simple chat application with Rich Textbox to display messages and Textbox to write them. I'd like to have same behaviour as facebook chat does, which is having focus on the Textbox but being able to use mouse wheel to scroll the one I'm hovering over. So as an example: I'm writting something in the Textbox but in the meantime I want to scroll the Rich Textbox upwards by using my mousewheel without loosing focus on the Textbox. Facebook chat has this exact behaviour.\n\nSemi pseudo code I came up with:\n\n private void richTextBox_MouseOver(object sender, EventArgs e)\n {\n MouseWheelScroll -> richTextBox scroll, msgTextBox don't scroll\n }" ]
[ "c#", ".net", "winforms" ]
[ "Android: Message keys gets changed for signed apk in Firebase real time database chat", "I have developed a chat application with a firebase real-time database in android, it stores all the messages in the firebase real-time database, and it is working perfectly fine in debug mode however when I create a signed build it automatically changes all my messages key into a,b,c,d and so on.\n\nFor example, I have stored a message with keys \"name\", \"message\", \"image\" etc, Message gets stored perfectly fine with these keys in debug mode however in release mode all these keys are changed into a,b,c etc.\n\nI would really appreciate if anyone can help me with this." ]
[ "java", "android", "firebase", "firebase-realtime-database" ]
[ "Leveraging the wordpress API in an android reader app", "I'm writing an android magazine reader for a campus publication I work for. We use wordpress to publish our website, and I want to leverage the wordpress REST API to pull stories (posts) directly from the website, without publishers having to take any additional steps to publish posts on the app after publishing them on the site. I'll do this by getting JSON objects representing posts and deserializing them into POJOs of the Story class (defined in the android application), around which views will then be built dynamically. \n\nI've just discovered the Wordpress REST API and am really excited because I think that the implementation as described above is going to be pretty simple. Are there any obvious roadblocks that I'm missing that might complicate things? \n\nI know that the API responds with a \"content\" parameter that is a string containing the HTML code for the post, with references to included images/media in the appropriate places. How can I get Android to load that html and display it properly in a WebViewer?" ]
[ "java", "android", "wordpress" ]
[ "Aggregating monos in Spring reactive", "I am trying to aggregate the result of 5 service calls in Spring reactive. Each service call makes an external API call and gets a result. \n\nExample:\n\nMono<A> = serviceCall1(...);\nMono<B> = serviceCall2(...);\nMono<C> = serviceCall3(...);\nMono<D> = serviceCall4(...);\nMono<E> = serviceCall5(...);\n\n\nWhat I need to do is to make all these calls in parallel, aggregate the result into a Mono. However, if any call fails, I should still be able to ensure that all calls complete. Some calls may fail, some may succeed.\n\nHow can I go about this?" ]
[ "spring", "mono", "reactive" ]
[ "How to prevent trigger ngModelChange event for first time?", "Here is my code:\n\nimport { Component } from '@angular/core';\nimport { Validators, FormGroup, FormArray, FormBuilder } from '@angular/forms';\n\n\n@Component({\n\n selector: 'my-app',\n template: `\n <div id=\"my-div\">\n <h1>Ng2 DateTime Picker French Test</h1>\n\n <input [(ngModel)]=\"myDate\" \n (change)=\"myChange($event)\"\n (ngModelChange)=\"myNgModelChange($event)\"\n ng2-datetime-picker\n date-only=\"true\"/>\n</div>\n\n `,\n styles: [`\n div { font-family: Courier; font-size: 13px}\n input { min-width: 200px; font-size: 15px; }\n `]\n})\nexport class AppComponent {\n\n myDate: any = \"2016-12-28\";\n\n constructor(private fb: FormBuilder) {\n moment.locale('fr-ca');\n }\n\n myChange(ev) {\n alert(\"input field is manually changed to\", ev.target.value)\n }\n\n myNgModelChange(value) {\n alert(\"ngModel is changed to \" + value);\n }\n}\n\n\nWhen I load the page, it auto trigger ngModelChange event. But if i don't set myDate value, then it will not trigger event. So how to prevent ngModelChange for first time? and here is demo" ]
[ "javascript", "angular", "events" ]
[ "jquery datatable does not get initialized with given response", "I want to initialize data table with my generated response\n\nmy response looks like this\n\n{data: Array(3), status: true}\ndata : Array(3)\n0 : {countryId: 1, countryName: \"sampleCountry\", countryShortCode: \"sampleCode\", status: \"yes\"}\n1 : {countryId: 2, countryName: \"pakistan\", countryShortCode: \"pak\", status: \"yes\"}\n2 : {countryId: 3, countryName: \"sample2\", countryShortCode: \"pak\", status: \"yes\"}\n\n\nplease look at my html \n\n<table class=\"table table-striped\" id=\"countryTable\">\n\n <thead>\n <tr>\n <th>S.NO.</th>\n <th>Country Name</th>\n <th>Country Short Name</th>\n\n\n </tr>\n </thead>\n <tbody>\n </tbody>\n</table>\n\n\nplease look at my datatable initialization\n\n$.ajax({ \n url : url,\n\n type:\"get\", \n contentType:'application/json; charset=utf-8', \n dataType: 'json' ,\n async: false, \n success:function(response) \n { \n alert(response.data); \n\n $('#countryTable').DataTable( {\n \"fnRowCallback\" : function(nRow, aData, iDisplayIndex){\n $(\"td:first\", nRow).html(iDisplayIndex +1);\n return nRow;\n },\n destroy: true,\n mydata: response.data, \n columns: [ \n { mydata:'countryId'}, \n { mydata:'countryName'},\n { mydata:'countryShortCode'} \n\n\n ] \n } ); \n\n console.log(response);\n }\n });\n\n\nafter initialization data table shows as No data available in table but table gets initialized with datatable plugin .\ndata is not coming into table.\nwhat went wrong in my code please help me." ]
[ "datatables" ]
[ "Call a method any time other methods are called", "Is there any way to make a sort of \"supermethod\" that is called every time a method is called, even for non-defined methods? Sort of like this:\n\npublic void onStart() {\n System.out.println(\"Start\");\n}\n\npublic void onEnd() {\n System.out.println(\"End\");\n}\n\npublic SuperMethod superMethod() {\n System.out.println(\"Super\");\n}\n\n// \"Start\"\n// \"Super\"\nonStart();\n\n// \"End\"\n// \"Super\"\nonEnd();\n\n// \"Super\"\nonRun();\n\n\nEdit - Specifics: I have a library that updates a lot and gets reobfuscated on each update. To make my workflow easier I am making my program automatically update the library (required to do what I want it to do, I won't go that specific on why, but my program will work with future updates) and I have the obfuscation mappings download with the library, I want to make a sort of proxy called Library for example and then when I call Library.getInstance() it will get the obfuscation mapping for getInstance() and call the library's method getInstance() or abz as it is mapped to at this current moment in time." ]
[ "java" ]
[ "Set / update expiration on aspxauth and asp.net_sessionid cookies", "I am wondering if there is a way you can setup your .NET application to set and update the expiration time of the aspxauth and asp.net_sessionid cookies in the browser? \n\nFrom what I see, the cookies' expiration dates are something like 1/1/0001 telling the browser to keep them until the browser closes (I've observed this using Chrome). I'd like to set an explicit time, but, I will need to update that time on every request.\n\nI am attempting to do this with some code like : \n\nvar timeoutMins = Session.Timeout;\nif (Response.Cookies.Count > 0)\n{\n foreach (string s in Response.Cookies.AllKeys)\n {\n if (s == FormsAuthentication.FormsCookieName || s.ToLower() == \"asp.net_sessionid\")\n {\n Response.Cookies[s].Expires = DateTime.Now.AddMinutes(timeoutMins);\n }\n }\n}\n\n\nI tried doing this in the global.asax End_Request event, although this doesn't seem to be a good place since it fires several times per page and you dont have access to the sessionstate timeout; further it only triggers on login and logout, so basically I can set it once but I can never update it. This causes my users to be logged out 15 minutes after login even if they have been active.\n\nIt seems like there would be some setting somewhere to tell .net to handle this? I know this is a strange request but it is a security requirement on this project so I'm trying to make it work!" ]
[ "c#", ".net", "cookies", "asp.net-session", ".aspxauth" ]
[ "How to toggle show and hide for two forms present in the same div?", "I have two forms present in a div, form1 is visible when the page loads, and if I click the next button form1 is hidden and form2 is shown, which is working as expected. \n\nNow I want to achieve the reverse of above scenario which is on click of a back button, form2 should be hidden and form 1 is shown. \n\nHere's javascript code I have so far..\n\nfunction switchVisible() {\n\n document.getElementById(\"disappear\").innerHTML = \"\";\n\n if (document.getElementById('newpost')) {\n\n if (document.getElementById('newpost').style.display == 'none') {\n document.getElementById('newpost').style.display = 'block';\n document.getElementById('newpost2').style.display = 'none';\n } else {\n document.getElementById('newpost').style.display = 'none';\n document.getElementById('newpost2').style.display = 'block';\n }\n\n }\n\n}\n\n\nSo basically I am looking for a way to achieve toggle functionality for two forms present in the same div using javascript and setting their display property." ]
[ "javascript", "jquery", "html", "css", "forms" ]
[ "Data type differences between PHP sqlsrv driver and PDO driver", "Here I am using sqlsrv:\n\n$conn = sqlsrv_connect(\"192.168.1.102,1433\", array(\"Database\"=>\"RF_User\", \"UID\"=>\"rfo-gcp\", \"PWD\" => \"\"));\n\n$tsql = \"SELECT birthdate FROM tbl_rfaccount WHERE id = ?\";\n\n$stmt = sqlsrv_query($conn, $tsql, array(\"test\"));\n\n$result = sqlsrv_fetch_array($stmt);\n\nvar_dump($result);\n\n\nResult: array(2) { [0]=> object(DateTime)#1 (3) { [\"date\"]=> string(26) \"2020-04-19 20:40:00.000000\" [\"timezone_type\"]=> int(3) [\"timezone\"]=> string(3) \"UTC\" } [\"birthdate\"]=> object(DateTime)#1 (3) { [\"date\"]=> string(26) \"2020-04-19 20:40:00.000000\" [\"timezone_type\"]=> int(3) [\"timezone\"]=> string(3) \"UTC\" } }\n\nHere I am using PDO:\n\n$conn = new PDO(\"sqlsrv:Server=192.168.1.102,1433; Database=RF_User;\", \"rfo-gcp\", \"\");\n\n$tsql = \"SELECT birthdate FROM tbl_rfaccount WHERE id = cast(? as varchar(13))\"; \n\n$stmt = $conn->prepare($tsql);\n\n$stmt->execute(array(\"test\"));\n\n$result = $stmt->fetch(PDO::FETCH_ASSOC);\n\nvar_dump($result);\n\n\nResult: array(1) { [\"birthdate\"]=> string(19) \"2020-04-19 20:40:00\" }\n\nIf you notice, I had to use cast(? as varchar(13)) on the PDO code. Without it would not return any row. On the sqlsrv I didn't have to use the CAST() function. Why is this? Also, the id column on the database is a BINARY(13), so why do I have to cast the id to varchar and not to binary (with binary cast it also doesn't find the row)?" ]
[ "php", "sql-server", "pdo", "binary", "sqlsrv" ]
[ "All permutations of form options", "I'm trying to test a form by submitting a combination of all values to see if it breaks. These are ComboBoxes that I have stored in an ExtraField class\n\npublic class ExtraField\n{\n public String Name = \"\"; //name of form key\n public Dictionary<String, String> Options = new Dictionary<String, String>(); //Format: OptionText, Value\n}\n\n\nI have generated a list of these fields\n\nList<ExtraField> efList = new List<ExtraField>();\n\n\nI was thinking all possible combinations of these fields could be added to a string list that I can parse (I was thinking name=opt|name=opt|name=opt). I've provided an example of what would work below (where ExtraField list Count==3):\n\n List<ExtraField> efList = new List<ExtraField>();\n ExtraField f1 = new ExtraField();\n f1.Name = \"name1\";\n f1.Options.Add(\"text\", \"option1\");\n f1.Options.Add(\"text2\", \"option2\");\n f1.Options.Add(\"text3\", \"option3\");\n efList.Add(f1);\n ExtraField f2 = new ExtraField();\n f2.Name = \"name2\";\n f2.Options.Add(\"text\", \"option1\");\n f2.Options.Add(\"text2\", \"option2\");\n f2.Options.Add(\"text3\", \"option3\");\n f2.Options.Add(\"text4\", \"option4\");\n efList.Add(f2);\n ExtraField f3 = new ExtraField();\n f3.Name = \"name3\";\n f3.Options.Add(\"text2\", \"option1\");\n f3.Options.Add(\"text3\", \"option2\");\n f3.Options.Add(\"text4\", \"option3\");\n f3.Options.Add(\"text5\", \"option4\");\n f3.Options.Add(\"text6\", \"option5\");\n efList.Add(f3);\n\n\nShould produce\n\nname1=option1|name2=option1|name3=option1\nname1=option1|name2=option1|name3=option2\nname1=option1|name2=option1|name3=option3\nname1=option1|name2=option1|name3=option4\nname1=option1|name2=option1|name3=option5\nname1=option1|name2=option2|name3=option1\nname1=option1|name2=option2|name3=option2\nname1=option1|name2=option2|name3=option3\nname1=option1|name2=option2|name3=option4\nname1=option1|name2=option2|name3=option5\nname1=option1|name2=option3|name3=option1\nname1=option1|name2=option3|name3=option2\nname1=option1|name2=option3|name3=option3\nname1=option1|name2=option3|name3=option4\nname1=option1|name2=option3|name3=option5\nname1=option1|name2=option4|name3=option1\nname1=option1|name2=option4|name3=option2\nname1=option1|name2=option4|name3=option3\nname1=option1|name2=option4|name3=option4\nname1=option1|name2=option4|name3=option5\nname1=option2|name2=option1|name3=option1\n...etc\n\n\nAll ExtraFields in the list need to have a value and I need all permutations in one format or another. It's a big list with a lot of permutations otherwise I'd do it by hand." ]
[ "c#", ".net", "permutation" ]
[ "How can i resize the parent view after changing the constraints of child views?", "I have a pop up view which is loading from a xib file.In that file there are couple of views, labels and buttons. For specific condition i have hide couple of views and buttons and its working but total height of the parent view of those views and buttons is not changing.\n\nI have set the height constraints of the parent view and tried to change the constant but its not updating.\n\n self.translatesAutoresizingMaskIntoConstraints = YES;\n\n\nI want to resize the parent view after hide the parent view.\nMain window\nChanged window after constraints" ]
[ "ios", "ios-autolayout" ]
[ "adding a class attrib to html element based on certain condition javascript", "I have a ul element in my html..\n\n<ul class=\"sidebar-menu\"> /<ul>\n\n\nwhich can have <li> elements of two kinds..\n\na) simple..\n\n<li>\n <a href=\"/Campaign/CreateCampaignUrl\">\n <i class=\"fa fa-th\"></i> <span>Campaign Url</span>\n <small class=\"label pull-right bg-green\">new</small>\n </a>\n </li>\n\n\nb) complex..\n\n<li class=\"treeview\">\n <a href=\"#\">\n <i class=\"fa fa-files-o\"></i>\n <span>Classify Events</span>\n <span class=\"label label-primary pull-right\">4</span>\n </a>\n <ul class=\"treeview-menu\">\n <li><a href=\"/ClassificationUI/ClassifyStandardEvent\"><i class=\"fa fa-circle-o\"></i> Standard Events</a></li>\n <li><a href=\"/Campaign/ClassifyCampaignProperties\"><i class=\"fa fa-circle-o\"></i> Campaign Properties</a></li>\n </ul>\n </li>\n\n\nI wish to add class attribute with value 'active' to a specific <li> element via javascript\n\nIn my javascript I have a variable my_url.\n\nif my_url matches a href of simple <li> say.. \"/Campaign/CreateCampaignUrl\" then I want the <li> to look as below, the li element has class=\"active\"..\n\n<li class=\"active\">\n <a href=\"/Campaign/CreateCampaignUrl\">\n <i class=\"fa fa-th\"></i> <span>Campaign Url</span>\n <small class=\"label pull-right bg-green\">new</small>\n </a>\n </li>\n\n\nelse if complex <li> matches..\n\n<li class=\"treeview active\">\n <a href=\"#\">\n <i class=\"fa fa-files-o\"></i>\n <span>Classify Events</span>\n <span class=\"label label-primary pull-right\">4</span>\n </a>\n <ul class=\"treeview-menu\">\n <li class=\"active\"><a href=\"/ClassificationUI/ClassifyStandardEvent\"><i class=\"fa fa-circle-o\"></i> Standard Events</a></li>\n <li><a href=\"/Campaign/ClassifyCampaignProperties\"><i class=\"fa fa-circle-o\"></i> Campaign Properties</a></li>\n </ul>\n </li>\n\n\nIn this case, active value attaches to class in two places..\n\na) the li element which has the url which matches to my_url.. in above example \"/ClassificationUI/ClassifyStandardEvent\".\n\nb) the main li element which had class=\"treeview\" has now class=\"treeview active\"\n\nAll help is sincerely appreciated\n\nThanks" ]
[ "javascript", "jquery" ]
[ "ElasticSearch: Starting Multiple Cluster", "I started two clusters of ElasticSearch with different names but the other one won't show up either in Marvel or querying for health manually. \n\ncurl 'http://127.0.0.1:9200/_cat/health?v'\n\nepoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent\n1501062768 15:22:48 Cove_dev_cluster yellow 1 1 8 8 0 0 8 0 - 50.0%\n\n\nBut it's running on my screen." ]
[ "elasticsearch" ]
[ "How to get an input[type=\"number\"] to show all the values as selectable values?", "I have an input[type=\"number\"] within Woocommerce Bookings and right now this shows a field where I can type a number but I'd like to show all the possible values (in this case 1 up to and including 8) and be able to select one of these values. How can this be best achieved?\n\ninput type=\"number\" value=\"1\" step=\"1\" min=\"1\" max=\"8\" name=\"wc_bookings_field_persons\" id=\"wc_bookings_field_persons\"" ]
[ "input", "woocommerce", "types", "numbers" ]
[ "Can a class be static in php", "Possible Duplicate:\n Is it possible to create static classes in PHP (like in C#)? \n\n\n\n\nCan any one tell me if a php class can be declared as static ?\n\nstatic class StaticClass\n{\n public static function staticMethod()\n {\n return 'foo';\n }\n}\n\n\nThis code giving me error.parse error: parse error, expecting `T_VARIABLE'" ]
[ "php", "class", "static" ]
[ "Let a enemy attack when he sees the player", "Can someone help me I am using the code below to try to let the enemy look if he can see the player or not.\n\nBut the problem is can he still see me when I am behind a wall\nCan someone help me out ?\n\nusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.AI;\nusing UnityEngine.SceneManagement;\n\npublic class Test : MonoBehaviour\n{\n [SerializeField]\n float distance;\n\n public GameObject player;\n public Transform Shootpoint;\n\n public bool CanSee = false;\n\n [SerializeField]\n float chaseDistence = 0.5f;\n\n\n\n void Update()\n {\n distance = Vector3.Distance(Shootpoint.position, player.transform.position);\n\n if (!Physics.Raycast(Shootpoint.position, player.transform.position, chaseDistence))\n {\n Debug.DrawLine(Shootpoint.position, player.transform.position, Color.red);\n CanSee = false;\n Debug.Log(\"CANT SEE\");\n\n }\n else if (Physics.Raycast(Shootpoint.position, player.transform.position, chaseDistence))\n {\n Debug.DrawLine(Shootpoint.position, player.transform.position, Color.green);\n CanSee = true;\n Debug.Log(\"CAN SEE\");\n }\n }\n}" ]
[ "c#", "unity3d" ]
[ "mysql query retrieval missing one row", "i have retrieve data from database with this query: \n\nSELECT *\nFROM news, necat\nWHERE news.ns_cat = necat.nc_id \nORDER BY ns_id DESC\nLIMIT 0,4\n\n\nand when this query run return only 3 row?!\ncan you find any problem?" ]
[ "php", "mysql" ]
[ "Laravel 5.2 not showing form validation errors", "This is weird. I've been googling all day trying to find a solution for my problem and most of solutions don't work for me due to different versions or different request - controller handling.\n\nWhat's happening is this.\n\nI have a form:\n\n<div class=\"form-group\">\n Name *\n {!! Form::text('name', '', ['class'=>'form-control', 'placeholder'=>'Required field']) !!}\n</div>\n\n\nAnd a Request:\n\nclass ContactFormRequest extends Request\n{\n\n public function authorize()\n {\n return true;\n }\n\n\n public function rules()\n {\n return [\n 'name' => 'required|max:64',\n 'email' => 'required|email|max:128',\n 'message' => 'required|max:1024',\n ];\n }\n}\n\n\nI'm leaving the name field blank so it fails validation, and it should return to the contact form page and show the errors:\n\n@if(count($errors) > 0)\n <div class=\"alert alert-danger\">\n <ul>\n @foreach($errors->all() as $error)\n <li>{{ $error }}</li>\n @endforeach\n </ul>\n </div>\n@endif\n\n\nIt shows nothing! If I vardump the $errors variable, I get this:\n\nobject(Illuminate\\Support\\ViewErrorBag)[161]\n protected 'bags' => \n array (size=0)\n empty\n\n\nIf I fill the form field properly it successfully sends me to the success page and everything works perfect. All I need now is to make this error thing work properly :S\n\nThank you in advance!" ]
[ "php", "forms", "laravel", "laravel-5.2" ]
[ "Why android:gravity attribute for ImageView is not there?", "Does anybody know, why there is no android:gravity attribute for ImageView?\nWhy only android:layout_gravity is shown by Eclipse?" ]
[ "android" ]
[ "Expand List to same row in Power Query", "I'm new to power query. I'm parsing JSON. I have an array name as "categories" when I expand it using Power Query it creates three rows for each category while I just want to remain in one row and want to create 3 separate column for each category like category1,category2,category3.\nhere is my code\nlet\n Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],\n #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"no", type text}, {"complete", Int64.Type}, {"json", type text}}),\n #"Parsed JSON" = Table.TransformColumns(#"Changed Type",{{"json", Json.Document}}),\n #"Expanded json" = Table.ExpandRecordColumn(#"Parsed JSON", "json", {"title", "price", "StoreName", "ratings", "merchant", "categories", "VariantB", "detailA", "detailB", "bullets", "images", "description"}, {"title", "price", "StoreName", "ratings", "merchant", "categories", "VariantB", "detailA", "detailB", "bullets", "images", "description"})\nin\n #"Expanded json"" ]
[ "powerquery" ]
[ "Concat all column values with same userid python", "I have 2 columns i.e. userId and genres in the below format:\nUserId genres\n\n1 ['Animation', 'Drama'] \n1 ['Comedy', 'Drama'] \n1 ['Horror', 'Thriller'] \n2 ['Comedy', 'Drama'] \n2 ['Action', 'Mystery']\n\n...\nI want the following output by combining all genres watched by a particular user in following format:\nUserid Combined genres\n1 ['Animation', 'Drama','Comedy', 'Drama', 'Horror', 'Thriller'] \n1 ['Animation', 'Drama','Comedy', 'Drama', 'Horror', 'Thriller'] \n1 ['Animation', 'Drama','Comedy', 'Drama', 'Horror', 'Thriller'] \n2 ['Comedy', 'Drama', 'Action', 'Mystery'] \n2 ['Comedy', 'Drama', 'Action', 'Mystery'] \n\nPlease help" ]
[ "python-3.x", "list", "group-by", "concat" ]
[ "Make Windows Shortcuts Using Java", "I'm looking for a way to create shortcuts in java for WinXP, Vista, and Win7. In addition to the shortcut itself, I need to be able to specify the icon of the shortcut.\nThe solution can use command line commands, however I cannot use a solution that is GPL.\nIf WinXP creates shortcuts differently than Vista/7, than I'm okay with adding conditional logic (I'll just need to know how to do it for both cases).\nBackground\nThe shortcut creation will happen during the install process. The installer we are using is Java based, which is why I'm looking for the solution in Java. So it is important to note that the shortcut can vary, based on the user's selected install directory. If there is not a clean way to do this, then I will have to go with the recommend suggestion of creating a VBScript or C# program to do the work for me, then call that from my java code. I would prefer a simpler solution though." ]
[ "java", "windows", "windows-7", "windows-xp", "command-prompt" ]
[ "Phonegap on Android: AJAX request fails when setting Accept: 'application/xml' on request header", "I am making GET requests to the Assembla REST API. You can read about it here: http://www.assembla.com/spaces/breakoutdocs/wiki/Assembla_REST_API\n\nThe API requires you to set Accept: 'application/xml' on the request header to receive xml data back. Otherwise, html comes back in the response.\n\nMy service calls work in iOS and in Safari, but do not return anything in Android.\n\nMy cordova.xml file has <access origin=\".*\"/> so I do not think it is a whitelist issue. I have tried just about every variation I could think of here.\n\nSample ajax request:\n\n$.ajax({\n url: 'https://www.assembla.com/spaces/my_spaces',\n username: userModel.get('username'),\n password: userModel.get('password'),\n headers: { \n Accept: 'application/xml'\n },\n success: onSuccess,\n error: onError\n});\n\n\nLike I said, this request will not hit either onSuccess or onError in Android. The request works perfectly fine in iOS and in Safari. If I take out the headers property, the request will hit onSuccess in Android but will return html." ]
[ "android", "ajax", "cordova" ]
[ "Charting for Windows Store apps ( XAML C#)", "I am looking for references or samples on charting options in Windows 8 XAML/C#. \nI will also consider any third party options.\n\nI need to provide a charting solution include bar graphs, pie charts and line graphs" ]
[ "windows-8", "charts" ]
[ "node.js rss memory not freed after a heapsnapshot", "for a few days I was struggling with a memory leak in my node app, but during my \"fight\" I noticed that the rss memory is not freed after making a heapdump\n\nthe node version:\n\n$ node --version\nv12.16.2\n\n\nbefore the heapdump output from process.memoryUsage():\n\n{\n \"rss\": 108154880,\n \"heapTotal\": 36286464,\n \"heapUsed\": 33339600,\n \"external\": 1472841\n}\n\n\nand after the heapdump output:\n\n{\n \"rss\": 250208256,\n \"heapTotal\": 36286464,\n \"heapUsed\": 32413336,\n \"external\": 31776077\n}\n\n\nas you may notice the rss and external bumped up sinificantly (and I tested that, they stay at about the same level event after hours of idle running the app)\n\nthe heapdump code: \n\nimport { getHeapSnapshot } from 'v8'\nimport { createGzip } from 'zlib'\nimport { pipeline as streamPipeline, Readable, Writable, Duplex } from 'stream'\nimport { promisify } from 'util'\nimport { createWriteStream } from 'fs'\n\nconst pipeline = promisify(streamPipeline)\n\n/**\n * @param date `Date` to use in filename\n * @returns heapdump file name in format `heapdump-<date>-<time>-<pid>.heapsnapshot.gz`\n */\nexport default async function heapdump (\n date: Date | number,\n) {\n if (!(date instanceof Date)) {\n date = new Date(date)\n }\n\n const filename = `heapdump-${\n date.getUTCFullYear() // year\n }${\n `${date.getUTCMonth() + 1}`.padStart(2, '0') // month\n }${\n `${date.getUTCDate()}`.padStart(2, '0') // day\n }-${\n `${date.getUTCHours()}`.padStart(2, '0') // hour\n }${\n `${date.getUTCMinutes()}`.padStart(2, '0') // minute\n }${\n `${date.getUTCSeconds()}`.padStart(2, '0') // second\n }${\n `${date.getUTCMilliseconds()}`.padStart(3, '0') // millisecond\n }-${\n process.pid\n }.heapsnapshot.gz`\n\n let heap: Readable\n let gzip: Duplex\n let file: Writable\n\n await pipeline(\n (heap = getHeapSnapshot()),\n (gzip = createGzip({ level: 9 })),\n (file = createWriteStream(filename)),\n )\n\n if (!heap.destroyed) {\n heap.destroy()\n }\n\n if (!gzip.destroyed) {\n gzip.destroy()\n }\n\n if (!gzip.writableEnded) {\n gzip.end()\n }\n\n if (!file.writableEnded) {\n file.end()\n }\n\n return filename\n}\n\n\nand the question is:\n\nwhy is the memory not freed? what am I doing wrong here?" ]
[ "javascript", "node.js", "typescript", "memory-management", "v8" ]
[ "Voiceglue Expecting '=' after cookie attribute's name", "I am getting following Voiceglue error while executing in /var/log/dynlog/dynlog\n\n15:35:54:525 EROR OPEN_VXI luke---- callid=[58] |1098905920|58|SEVERE|swi:SBinet|257|SBinet: Expecting '=' after cookie attribute's name|attributeSpec=HttpOnly|attribute=HttpOnly\\n" ]
[ "asterisk", "ivr", "vxml", "error-log", "voicexml" ]
[ "Pause horizontal scrolling in chart.js for real time data", "I am working on chart.js plugin with real time chart so i want to pause scrolling chart but when i calling pause dynamically its not working.\n\npausestart:boolean;\n\nplugins: {\n streaming: {\n onRefresh: function(chart: any) {\n chart.data.datasets.forEach(function(dataset: any) {\n dataset.data.push({\n x: Date.now(),\n y: Math.random()\n });\n });\n },\n duration: 12000,\n refresh: 100,\n delay: 1000,\n frameRate: 60,\n pause: this.pausestart\n }\n }\n\n\ni am setting pausestartinitially false after click on pause button set it to true\n\npause() {\n this.pausestart = true;\n }\n\n start() {\n this.pausestart = false;\n }\n\n\nhow can i resolve this issue." ]
[ "angular", "chart.js", "ng2-charts" ]
[ "compatibility Android 3.* with android 4", "I want to build Android application. My target devices is tablets (not smartphones). Today exist only 3.* version of android OS, aimed for tablets. Is it normal if i begin build application for tablets in 3.* API? The tablets which will be release with android 4.0 (ice cream sandwich) can to run my application built on 3.0 API? Or me better to wait for 4.0 API if my target devices is tablets? \nGenerally, in which version of API to develop my app for tablets? \nThanks." ]
[ "android", "api", "tablet" ]
[ "Create separate landing page on blogger", "thanks for viewing this post and I know this not a programming related question. Well I have created a site My Blog and as you could see there are several links on the home page like \n\nC#--|-> Beginner\n |-> Advanced\n |-> Tips\n\n\nC# (Parent node and Beginner,Advanced etc are child nodes or menus).\n\nNow what I want,\nwhen someone click on the link C# it should redirect to a custom landing page\n(custom means I don't want to show any comment section at the bottom of the page)\n\nThere is an option to create a page from the scratch just like this but after creating it renders like this\n.\n\nSo my requirement is I want to create a page from scratch using my own html where header and footer will be same but its should not display any comment section like this..a new page \n\nHelp needed :)\n\nposted here too" ]
[ "blogger" ]
[ "Canvas OO GameLoop Not Outputting", "I have the following code, which for some reason will not output - I get the error:\nUncaught Error: TYPE_MISMATCH_ERR: DOM Exception 17\n\nWhich I'm pretty sure means that the code can't find the Canvas element at all, I don't suppose any of you lovely people have an idea why?\n\nJSDO.IT: http://jsdo.it/neuroflux/wfUK \n\nCode:\n\n<!DOCTYPE html>\n<html>\n <head>\n <title></title>\n <style type=\"text/css\">\n * { margin: 0px; padding: 0px; }\n </style>\n <script type=\"text/javascript\">\n var BG = {}; //NameSpace\n\n BG.Game = function() { //GameSpace\n canvas = null;\n this.ctx = null; //Element and Context\n this.world = new Array(); //The World\n this.worldSize = 32; //The Size of the World\n this.nodeSize = 16; //The Size of Each Square\n };\n\n\n BG.Game.prototype = {\n startGame : function() {\n /** INITIAL SET UP **/\n this.canvas = document.getElementById('display');\n this.ctx = this.canvas.getContext('2d');\n this.canvas.width = 480;\n this.canvas.height = 480;\n\n for (var x = 0; x < this.worldSize; x++) {\n this.world[x] = new Array();\n for (var y = 0; y < this.worldSize; y++) {\n this.world[x][y] = new Array();\n this.world[x][y].push(0);\n }\n }\n\n this.gameLoop();\n },\n\n drawScene : function() {\n this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height); //clear view\n\n /** DRAWING **/\n for (var x = 0; x < world.length; x++) {\n for (var y = 0; y < world[x].length; y++) {\n rect(nodeSize*x,nodeSize*y,nodeSize,nodeSize);\n }\n }\n },\n\n update : function() {\n /** LOGIC UPDATES **/\n\n /** ENGINE CALLS **/\n this.drawScene();\n this.gameLoop();\n },\n\n gameLoop : function() {\n setTimeout(function() {\n requestAnimFrame(this.update, this.canvas);\n }, 10);\n }\n } /** END NS **/\n\n function rect(x,y,w,h,c) {\n if (c) {\n var col = c;\n } else {\n var col = '#c4c4c4';\n }\n this.ctx.fillStyle = col;\n this.ctx.fillRect(x,y,w,h);\n };\n\n window.onload = function() {\n var g = new BG.Game();\n g.startGame();\n };\n\n window.requestAnimFrame = (function(){\n return window.requestAnimationFrame || \n window.webkitRequestAnimationFrame || \n window.mozRequestAnimationFrame || \n window.oRequestAnimationFrame || \n window.msRequestAnimationFrame || \n function (callback, element){\n window.setTimeout(callback, 1000 / 60);\n };\n }());\n </script>\n </head>\n <body>\n <canvas id=\"display\"></canvas>\n </body>\n</html>" ]
[ "javascript", "html", "canvas" ]
[ "Tornado Websocket Instances behind a Load Balancer (Nginx, HaProxy)", "I have previously used Tornado behind Nginx in production, that too with multiple tornado instances, but presently with Websockets implementation in Tornado, I am unable to understand few things.\n\n\n NOTE : Just running Websockets with Tornado is not my problem, I can get it to work and have used it in many projects fairly easily,\n but all as a single Tornado instance with/without a reverse-proxy or\n load balancer (nginx), both working fine.\n\n\nWith that said, my doubts are regarding how to handle multiple tornado websocket instances behind a load balancer. Lets look at a use case:\n\nUse Case : 2 Tornado Websocket Instances, T1 and T2 behind Nginx and there are 3 Clients (Browsers), lets say C1, C2, C3.\n\n ______|-------| \n C1-----------------| | | T1 |\n | | |_______| \n C2-----------------|---> Nginx --->| \n | | |-------| \n C3-----------------| |______| T2 | \n |_______|\n\n\nStep 1 - C1 initiated a websocket connection, at location w.x.y.z:80. Now Nginx load balanced the connection to lets say T1, which triggered the open event in T1's(Tornado's) websocket handler. Now T1 knows of a websocket connection object which is opened, let the object be w1.\n\nStep 2 - Now, C2 initiated a websocket connection, same as above, but now Nginx laod balanced it to T2 which triggered T2's(Tornado's) websocket handler's open event. Now T2 knows of a websocket connection object which is opened, let the object be w2.\n\nStep 3 - Now, similarly C3 initiated a websocket connection, Nginx load balanced it to T1, which now has a new opened websocket connection object, let the object be w3.\n\nStep 4 - Now, C1, our first client sent a message via the browser's ws.send() method, where ws is the browser(client) side's websocket object used to create the websocket connection in Step 1. So when the message reached Nginx, it load balanced it to T2.\n\nNow here is my question. \n\n\n Does Nginx load balance it to T2 or does it know that it should proxy\n the request to T1 itself?\n\n\nSuppose it sends it to T2, now T2 doesn't have the w1 object with it, since it is with T1, so when T2's websocket handler tries to process the request, which should originally trigger the on_message handler, so now,\n\n\n what happens at this condition, does T2 raise an Exception or what\n happens exactly?\n \n Also, how to manage the websocket connections in these cases when there\n are multiple tornado instances running behind a load balancer, how to\n solve this?\n\n\nIf suppose we use Redis as a solution, then what would redis actually store? The websocket objects? Or, what exactly should it store to let the instances work properly, if Redis is one of the solutions you are going to propose?" ]
[ "nginx", "websocket", "tornado" ]
[ "Running \"SQL\" query for each comment box will speed down multi-level commenting system?", "i am developing multi-level (comments and repelis) comment system using php.\nall comments and repelis are in same database table.\nin the function this system have to run 'sql' query for each comment box to generate them in correct order.\nso, will this slow down strongly my system while handling thousands of comments.\nhere below is my function,\n\nfunction getComments($row) {\n echo \"<li class='comment'>\";\n echo \"<div class='aut'>\".$row['author'].\"</div>\";\n echo \"<div class='comment-body'>\".$row['comment'].\"</div>\";\n echo \"<div class='timestamp'>\".$row['created_at'].\"</div>\";\n echo \"<a href='#comment_form' class='reply' id='\".$row['id'].\"'>Reply</a>\";\n $q = \"SELECT * FROM threaded_comments WHERE parent_id = \".$row['id'].\"\";\n $r = mysql_query($q);\n if(mysql_num_rows($r)>0)\n {\n echo \"<ul>\";\n while($row = mysql_fetch_assoc($r)) {\n getComments($row);\n }\n echo \"</ul>\";\n }\n echo \"</li>\";\n}\n\n\nor i have another idea to put comments and repelis in tow tables. while comments displaying,\nget all repelis data to Array and push them in to related comment box using for loop for that array.\n\nwhich method will be best for this work. the best performance ?" ]
[ "php", "mysql", "sql", "database-design" ]
[ "Setting default style of Ionic alert popup elements", "I followed the answers found here: Ionic 2 Alert customization\n\nBut I can't find all the other classes or elements that have to be styled so alerts look like I want.\n\nI edited my code so it looks like this:\n\napp.scss:\n\n.alertCustomCss {\n background-color: color($colors, dark, base);\n color: white;\n button {\n color: white !important;\n }\n}\n\n\nts:\n\nconst alert = this.alertCtrl.create({\n title: title,\n subTitle: msg,\n buttons: ['OK'],\n cssClass: 'alertCustomCss'\n});\nalert.present();\n\n\nBut this makes all the text white, replaces the transparency of the modal page that holds the popup and sets it to set 'background-color' (so the page that called the popup is not visible anymore). The text of the button is set to white.\n\nPlease notice that the background around the popup is not transparent anymore.\n\n\n\nThe question is how to set the background color of the text placeholder and not the whole page? What css properties to use?\n\nBroader question: What are the elements (css classes or directives) of the alert popup that can be styled? Title text color, content text font, etc.." ]
[ "css", "ionic-framework", "ionic2", "ionic3" ]
[ "BI Publisher administration API", "Are there any SOAP/REST API available for BIP administration? I'm mostly interested in a possibility to define JDBC data source for reports.\n\nWhole situation description:\nFor development purposes BI Publisher is run as Docker container. We have multiple environments (with separate databases), where some of them will have a BI Publisher instance. We would like to automate BI Publisher environment creation, so we need to dynamically define data source for BI Publisher reports, so that it would correspond to appropriate environment." ]
[ "oracle", "bi-publisher" ]
[ "open file dir problem", "I'm running an Linux OS and trying to open file in C compiler like this :\n\n file = fopen (\"list.txt\", \"r\");\n\n\nbut the file is not opend!\n\nand when i put the full path like this :\n\n file = fopen (\"/home/rami/Desktop/netfilter/list.txt\", \"r\");\n\n\nit is working!\n\nwhy the first example is not working? \n\n\nthe list.txt is in the same directory of the c file\nthanks." ]
[ "c", "linux" ]
[ "Matlab multidimensional extrapolation", "I have a 6 dimensional grid. I use interpn command in Matlab to find interpolated points between grid values. However, sometimes I need to evaluate points outside the grid. The interpn command does this automatically if the method is set to "makima" or "spline". However, when linear interpolation is used, the command can only return a prespecified single extrapolation point.\nIs there some other command I could use for linear extrapolation outside the grid? This could be done for example by fitting a line between the nearest points on the grid." ]
[ "matlab", "interpolation", "numerical-methods", "extrapolation" ]
[ "How to generate Class Diagram (UML) on Android Studio (IntelliJ Idea)", "I've try to search and found this link, but Ctrl+Alt+Shift+D doesn't work.\n\nI also use find Action Ctrl+Shift+A to find action about diagram and uml but found nothing.\n\nI also search for the uml plugin,\nbut most of them didn't work with new version of intelliJ (I didn't try it I just read the comment)." ]
[ "android", "android-studio", "intellij-idea", "ide", "class-diagram" ]
[ "How to get Mocha to execute unit tests in multiple subfolders in Node.js", "I'm integrating tests into my Node server and am having some trouble with unit testing. When I run npm test in my root directory, Mocha automatically runs all tests inside of my test folder. However, the unit tests which are dispersed throughout the project do not run. How can I ensure that Mocha automatically runs them?" ]
[ "javascript", "node.js", "mocha.js" ]
[ "How to iterate the input tag with-in a div tag and display multiple input tags based on inputdata", "I have Name field and I want to display it multiple times based on input.\n\nLike:\n\nName : Ash \nName : Win\n\n\r\n\r\nvar Property = [{\r\n \"content\": \"Ash\",\r\n \"Name\": \"Name\"\r\n}, {\r\n \"content\": \"Win\",\r\n \"Name\": \"Name\"\r\n}]\r\nvar data = Property;\r\nfor (var iter = 0; iter < data.length; iter++) {\r\n $(\"#Name\").val(Property[iter].content);\r\n}\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<div id=\"div-id\">\r\n <div class=\"form-row\">\r\n <label for=\"Name\"><i class=\"icon-tag\"></i> Name </label>\r\n <input type=\"text\" id=\"Name\">\r\n </div>\r\n</div>" ]
[ "javascript", "html" ]
[ "How can I reset deployment credentials in Windows Azure?", "I'm attempting to deploy to Windows Azure via git.\n\nI have created a site, but I do not know the 'deployment credentials' used to push via git. I make a username for deployment when I created a site: \n\nPlease provide the username for Git deployment\n\n\nBut I do not know what the password for this user is. Attempting to use the Windows Azure UI to reset the deployment credentials tries to load a page that 404s: \n\n\n\n\nHow do I know the password for the 'deployment credentials'?\nHow can I reset my deployment credentials?" ]
[ "git", "azure", "deployment" ]
[ "Why does this program close instead of displaying an output?", "I am new here and a student in a basic programming class at community college. I am having trouble understanding why this program simply closes instead of displaying the output.\n#include <iostream>\n#include <iomanip>\nusing namespace std;\n\nint main()\n{\n int quantity; // contains the amount of items purchased \n float itemPrice; // contains the price of each item\n float totalBill; // contains the total bill.\n \n cout << setprecision(2) << fixed << showpoint; // formatted output \n cout << "Please input the number of items bought " << endl;\n cin >> quantity;\n // Fill in the prompt to ask for the price.\n cout << "Please enter Item Price" << endl;\n // Fill in the input statement to bring in the price of each item.\n cin >> itemPrice;\n // Fill in the assignment statement to determine the total bill.\n totalBill = quantity * itemPrice; \n // Fill in the output statement to print total bill, // with a label to the screen.\n cout << "The bill is $" \n << totalBill << endl;\n \nreturn 0;\n}" ]
[ "c++" ]
[ "Python script suddenly fails to compile with \"expected an indent block\"", "This script has been working fine, however now when I go to execute it, it fails to compile with: \n\n File \"/Users/camerongordon/Desktop/Python Scripts/hello.py\", line 12\n def ConnectToDatabase(): \n ^\nIndentationError: expected an indented block\n\n\nHere is the script: \n\nimport tornado.ioloop\nimport tornado.web\nfrom tornado.httpclient import AsyncHTTPClient\nfrom tornado import gen \nfrom tornado.options import define, options \nfrom apscheduler.schedulers.tornado import TornadoScheduler\nfrom torndb import Connection\n\nclass MainHandler(tornado.web.RequestHandler):\n def get(self):\n\ndef ConnectToDatabase(): \n db = Connection(\"127.0.0.1\", 'helloworld', user='root', password='')\n return db\n\napplication = tornado.web.Application\n([\n (r\"/\", MainHandler),\n])\n\ndef ProcessQueue:\n\ndef main(): \n # http://stackoverflow.com/questions/29316173/apscheduler-run-async-function-in-tornado-python\n # https://github.com/teriyakichild/example-scheduler/blob/master/example_scheduler/__init__.py\n\n application.listen(8888)\n\n db = ConnectToDatabase() \n\n scheduler = TornadoScheduler()\n\n scheduler.add_job(ProcessQueue, 'interval', name='tick-interval-3-seconds', seconds=4, timezone='America/Chicago')\n\n scheduler.start()\n\n tornado.ioloop.IOLoop.current().start()\n\nif __name__ == \"__main__\":\n main(); \n\n\nWhat is going on? Everything looks syntactically correct and indented properly." ]
[ "python" ]
[ "Removing display none is changing the chart height and width", "I'm writing a code that generates a chart using google charts. And here is the original code.\n\n\r\n\r\n google.charts.load('current', {'packages':['corechart']});\r\n google.charts.setOnLoadCallback(drawChart);\r\n\r\n function drawChart() {\r\n\r\n var data = google.visualization.arrayToDataTable([\r\n ['Task', 'Hours per Day'],\r\n ['Work', 11],\r\n ['Eat', 2],\r\n ['Commute', 2],\r\n ['Watch TV', 2],\r\n ['Sleep', 7]\r\n ]);\r\n\r\n var options = {\r\n title: 'My Daily Activities'\r\n };\r\n\r\n var chart = new google.visualization.PieChart(document.getElementById('piechart'));\r\n\r\n chart.draw(data, options);\r\n }\r\n<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>\r\n <div id=\"piechart\" style=\"width: 900px; height: 500px;\"></div>\r\n \r\n\r\n\r\n\n\nHere is my modification. Initially, I want the Pie chart not to be displayed. and when I click on the button it should comeup.\n\n\r\n\r\ngoogle.charts.load('current', {\r\n 'packages': ['corechart']\r\n});\r\ngoogle.charts.setOnLoadCallback(drawChart);\r\n\r\nfunction drawChart() {\r\n\r\n var data = google.visualization.arrayToDataTable([\r\n ['Task', 'Hours per Day'],\r\n ['Work', 11],\r\n ['Eat', 2],\r\n ['Commute', 2],\r\n ['Watch TV', 2],\r\n ['Sleep', 7]\r\n ]);\r\n\r\n var options = {\r\n title: 'My Daily Activities',\r\n pieSliceText: 'value',\r\n\r\n };\r\n\r\n var chart = new google.visualization.PieChart(document.getElementById('piechart'));\r\n\r\n chart.draw(data, options);\r\n}\r\n\r\nfunction showPie() {\r\n document.getElementById(\"piechart\").style.display = '';\r\n}\r\n<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>\r\n<div id=\"piechart\" style=\"width: 900px; height: 500px; display:none\"></div>\r\n<button type=\"button\" onclick=\"showPie()\">Click Me!</button>\r\n\r\n\r\n\n\nEven this is working fine, but my question is, why the size is coming down? Is there a way that I can retain the size even when I get the pieChart back. Please let me know on where am I going wrong and how can I fix it.\n\nThanks!!!" ]
[ "javascript", "html", "css" ]
[ "disable flash in selenium cross browser", "I want to use selenium to disable flash in IE, firefox, and chrome.\n\nis there a way to do it cross browser, and if there isn't, is there a command you know for one of them or all?\n\n(I am using C#)" ]
[ "c#", "flash" ]
[ "Do session variables work differently during development?", "I'm building a website with ASP.NET MVC3. When a user signs in, I pull their display name from the database and store it to a session variable:\n\nSession[\"DisplayName\"] = user.Display;\n\n\nThen in _Layout.cshtml I use it to display at the top of each page:\n\n<span class=\"user\">@(Session[\"DisplayName\"] as string)</span>\n\n\nThis works fine when I start debugging the website then log in, but if I then rebuild my server and begin debugging again, my browser remains logged in but the Session variables are cleared. This leads to a bunch of empty spaces where my display name should be.\n\nIs this a side-effect of rebuilding the server, and not something I need to worry about in deployment? Is there a way to invalidate logins every time I rebuild, so that I avoid this issue? Or is there a better way to store this user data, other than a Session variable?" ]
[ "asp.net", "asp.net-mvc-3", "session" ]
[ "mailx command limitations in linux", "Iam using mailx command to send mail to the recipients as below image.\nCan someone clarify regarding the limitations for recipient mail for mailx\nI want to use till 1000 characters for multiple mail id's" ]
[ "linux", "mailx" ]
[ "Pyrax : This server could not verify that you are authorized to access the document you requested", "I am using Rackspace cloud storage for my media uploads and implemented with django-cumulus. The problem is that, file uploads are working well but when I tried to access my uploaded file with the container URI my browser shows an error as \"This server could not verify that you are authorized to access the document you requested.\". Whether I need to change any setting for the container from my Rackspace account ?" ]
[ "python", "django", "pyrax" ]
[ "How to build dynamic linq to sql query in c#?", "I have a web page where user can specify their query by click a set of DropDownList. Now I want build my sql query base on user's input. I used System.Linq.Expressions to do this. \n\npublic static IEnumerable<T> FilterTable<T>(List<Filter> filters, Table<T> table) where T : class\n {\n int top;\n IEnumerable<T> query;\n if (filters == null || filters.Count == 0)\n {\n query = table;\n }\n else\n {\n Func<T, bool> lamda = Build<T>(filters, out top);\n if (top > 0)\n {\n query = table.Where(lamda).Take(top);\n }\n else\n {\n query = table.Where(lamda);\n }\n }\n return query;\n }\n\n\nThis approach does work. But it is slow since IIS first fetch all data from db server, then apply the where clause. So there may be many unnecessary overhead between IIS server and db server.\n\nSo, is there a better way to do this? Is there something equivalent to System.Linq.Expressions in linq to sql?" ]
[ "c#", "asp.net", "linq" ]
[ "DynamoDB .NET - Delete all items from a table", "I'm learning how to work with DynamoDB for .net and I have a doubt, Is there a correct way to delete all items from an existing table?, I mean, I don't want to delete the table, just empty it.\nI've read about batch process but they don't help me much.\n\nI have this\n\nprivate string DeleteAllFromTable()\n {\n string result = string.Empty;\n\n try\n {\n\n var request = new BatchWriteItemRequest\n {\n RequestItems = new Dictionary<string, List<WriteRequest>> \n { \n {\n this.Tablename, new List<WriteRequest>\n {\n new WriteRequest\n {\n DeleteRequest = new DeleteRequest\n {\n Key = new Dictionary<string,AttributeValue>()\n {\n { \"Id\", new AttributeValue { S = \"a\" } }\n }\n }\n }\n }\n }\n }\n };\n\n var response = this.DynamoDBClient.BatchWriteItem(request);\n\n }\n catch (AmazonDynamoDBException e)\n {\n\n }\n\n\n return result;\n }\n\n\nBut of course, that only delete the id that match with the value \"a\". \n\nThanks." ]
[ "c#", ".net", "amazon-dynamodb", "dml" ]
[ "R maptools or rgdal package--how to fill the outside of a polygon?", "I am trying to plot a shapefile of polygons on top of another shapefile that already has colored polygons using R, and I am working with maptools and rgdal. I want to clip the bottom shapefile (which has multiple polygons) to the area delimited by the top shapefile, which has four polygons (i think). I know how to fill the inside of the top polygon, of course, by using the col= command within plot(). But what I want to do is fill the outside of the top polygon white, and leave the bottom colored polygons visible through the inside of the top polygons. I will redraw the boundaries of the bottom polygons after I am able to do this.\nI am using R 2.13.2 and the latest editions of maptools and rgdal and all of their dependencies on a Windows 7 machine. \n\nI have code that depends on these shapefiles:\nftp://ftpext.usgs.gov/pub/er/wi/la.crosse/McKann/bcr%20arcinfo%20files/\n\nlibrary(maptools)\n\nsm=readShapeSpatial('states.shp')\npm=readShapeSpatial('province.shp')\n\nlibrary(rgdal)\n\nrgm=readOGR(dsn=wd,layer='gwwa_new_range_5Jul11')\nrgm2=spTransform(rgm,CRS(proj4string(sm2)))\nplot(c(-120,-61),c(35,55),type='n',axes=F,bty='n',xlab='',ylab='', main=sp)\nplot(sm,col=c('red','green','yellow'),add=T)##us states\nplot(pm,col=c('red','green','yellow'),add=T)##canadian provinces\nplot(rgm2,lwd=2,add=T,border='blue')##gives the range of this bird\n\n\nI can make the inside of the range map a color\n\nplot(rgm2,add=T,col='blue')\n\n\nbut what i want to do is make the outside white (so I can draw the states and province boundaries over this afterwards), and keep the inside transparent, so I can see the colors of the states and provinces within the range.\n\nPlease let me know if you need more info and thanks in advance for any help. Maybe there is an easier way..." ]
[ "r", "gis", "spatstat", "maptools", "rgdal" ]
[ "Multiple enum implementing protocols questions", "I defined enums as confirming to a protocol Eventable:\n\nprotocol Eventable {\n var name: String { get }\n static var all: [Eventable] { get }\n}\n\nenum MyEnum: String, Eventable {\n case bla = \"bla\"\n case blu = \"blu\"\n\n var name: String {\n return self.rawValue\n }\n\n static var all: [Eventable] {\n return [\n MyEnum.bla,\n MyEnum.blu\n ]\n }\n}\n\n\nI have other enums like MyEnum also under the form:\n enum Bla: String, Eventable {\n }\n\nI have two questions:\n\n\nfor the enums having a String data type, I would like to avoid duplicating the generation of the variable name:\nvar name: String\nI am not sure how to write that in Swift. I tried to play around with the \"where\" clause but not success. How can I achieve that?\nwhen I write my enums and conform to the protocol for that part:\nstatic var all: [Eventable] { get }.\nI would like that for the enum MyEnum, it constrains the variable to:\nstatic var all: [MyEnum] { ... }\nbecause for now I can put in the returned array any element being an Eventable and it's not what I need.\nAmongst other things, I tried to define a generic constraint in the protocol for it, but I get the following error:\n\n\n\n Protocol 'Eventable' can only be used as a generic constraint because\n it has Self or associated type requirements\n\n\nThank you very much for the help!" ]
[ "swift", "enums", "protocols" ]
[ "Google maps API key works on a site, but does not work on an other site though referer for the other site is added", "I have a site using the javascript maps api and it works fine with an api key. I created a second site under a different domain and I want to use the same API key for that. I added the domain of the second site to the list of referers of the API key, so the referer list now has two entries: the domain of the first site and the domain of the second site. Yet the key refuses to work on the second site, while it's working fine on the first site.\n\nThis is the error I'm getting on the second site:\n\n\n Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site.\n\n\nWhat causes this error if the key is working fine on the first site and I added the second site to the key's enabled referers?" ]
[ "javascript", "api", "google-maps", "google-maps-api-3", "key" ]
[ "Can I make WPF RadioButtons look like CheckBoxes?", "I want to have the behavior of RadioButtons, but show them as CheckBoxes to the user. Is this easy to do?" ]
[ "wpf", "checkbox", "radio-button" ]
[ "How to update numberOfRowsInSection using NSMutableArray count", "In my app I allow users to add new rows of NSStrings to a UITableView. I save these new strings in an NSMutableArray *dataArray\n\nSo for numberOfRowsInSection I return [dataArray count], but it seems to just return 0 all the time so my table is not auto-populating.\n\nIf it helps, when I do an NSLog of [dataArray count] as a add more entries, it keeps remaining as 0. Why isn't it increasing?\n\nAny help?" ]
[ "iphone", "uitableview", "sdk" ]
[ "Polynomial Regression Using Python Only Works Up to Certain Degree", "import numpy as np\nimport matplotlib.pyplot as plt\n\n#Read Sum.fcc and store data in array A and E\ncontent = [x.strip() for x in content]\nA = []\nE = []\nfor i in content:\n A.append(float(i[0:3]))\n i = i[4:]\n sign = \"\"\n if i[0] == \"-\":\n sign = \"-\"\n index = int(i[-2:])\n num = i[i.index(\".\") + 1:i.index(\"E\")]\n E.append(float(sign + num[0:index] + \".\" + num[index:]))\nprint(\"\\n\".join([(str(A[n]) + \" \" + str(E[n])) for n in range(len(A))]))\nminA = min(A)\nmaxA = max(A)\n\ndef regress(n, x, y):\n global degree, coef, f\n degree = str(n)\n X = []\n for i in range(len(x)):\n X.append([x[i]**(index) for index in range(n+1)][::-1])\n a = np.array(X)\n b = np.array(y)\n #Estimated coefficient using ordinary least square estimation\n coef = np.matmul(np.matmul(np.linalg.inv(np.matmul(np.matrix.transpose(a), a)),np.matrix.transpose(a)), b)\n #2D Array with indexes and coefficients for the function\n f = [(x, coef[n-x]) for x in range(n+1)[::-1]]\n\ndef polynomial(x, function_array):\n y = 0\n for i in function_array:\n y += (x**i[0]) * i[1]\n return y\n\n#Defining the function to plot a graph of energy vs lattice constant\ndef plot(title = \"\"):\n if title == \"\":\n title = \"Polynomial Degree: \" + degree\n x = np.arange(minA, maxA + 0.01, 0.01)\n y = polynomial(x, f)\n plt.plot(x, y)\n plt.scatter(A, E)\n plt.xlabel(\"Lattice Constant/Å\")\n plt.ylabel(\"Energy/eV\")\n plt.title(title)\n plt.show()\n\nregress(2, A, E)\nplot()\nregress(3, A, E)\nplot()\nregress(4, A, E)\nplot()\nregress(5, A, E)\nplot()\nregress(6, A, E)\n\n\nThe regression function is the one I took from this Wikipedia page. The regression is pretty accurate up until degree 4 then it becomes off a a lot and I have no idea why.\n\nI have also tried another method of determining the coefficients based on the quadratic regression equations and expand the matrices when the polynomial degree is increased.\n\ndef regress(n, x, y):\n global degree, coef, f\n degree = str(n)\n sigmax = [sum(np.power(x, n)) for n in range(2 * n, -1, -1)]\n X = []\n for i in range(n + 1):\n X.append(sigmax[:n+1])\n sigmax.pop(0)\n Y = []\n for i in range(n, -1, -1):\n Y.append(sum([(x[j]**i) * y[j] for j in range(int(X[-1][-1]))]))\n coef = np.linalg.solve(X, Y)\n #2D Array with indexes and coefficients for the function\n f = [(x, coef[n-x]) for x in range(n+1)[::-1]]\n\n#Calculates the R squared\ndef error():\n global R2\n SSres = 0\n for i in range(len(A)):\n SSres += (polynomial(A[i], f) - E[i])**2\n ybar = sum(E)/len(E)\n SStot = 0\n for i in range(len(E)):\n SStot += (ybar - E[i])**2\n R2 = 1.0 - (SSres/SStot)\n return R2\n\n\nI have also defined a function to calculate the R squared and which starts to decrease at degree 5 for my particular Sum.fcc file. All the files including Sum.fcc can be found here. The coefficients also starts to defer away from those given by excel at degree 5. Is this simply due to the limitations in the number of digits stored in a float in python or did I miss something in my code?" ]
[ "python", "python-3.x", "regression", "linear-regression" ]
[ "Maven archetype for JSP", "I have a problem. I want to create Java Project which uses Servlets and JSP. So I create new Maven project and choose maven-archetype-webapp. So it creates the project, but there are .idea and src folder. There isn't source folder. What should I do to be generated \"source\" folder. I have the dependencies needed. I am using IntelliJ. While using Eclipse I have absolutely the same problem. I fix it with checking \"Maven Dependencies\" in \"Java Build Path/Order and Export\". It worked in eclipse, I don't know why. Or can someone tells me how to create project in IntelliJ which has generated pom.xml, web.xml and \"source\" folder. The question may be stupid, but I really don't know how and obviously I make something wrong.\nThanks for your attention." ]
[ "maven", "intellij-idea" ]
[ "Query Builder vs. ORM?", "What is the difference between a query builder and an ORM that developers use in their backend server-side code/logic for interacting with their database? It seems like the query builder can fulfill the goal of coding in the same language you are choosing to write the backend server-side code/logic to work with the database. However, I don't understand why an ORM comes in the picture then." ]
[ "orm", "backend", "server-side", "query-builder" ]
[ "How to run a F# script in the context of C# Application", "Is it easily possible to run a F# script from within (and in the context) of a C# Application (host). \n\nWith 'in the context' I mean the following should be true:\n\n\nno separate process for the execution of the script\naccess from the F# script to the static content of host application (classes, properties, methods) \n\n\nBasically I'm am looking for an API similar to this hypothetical API call\n\nFSharpScriptRunner.RunInContext(string script);\n\n\nPlease help.\n\n-Matthias" ]
[ "c#", "f#", "f#-scripting" ]
[ "what code should i use to automatically resize an image, whenever the browser window is made narrow?", "to start with a blank screen, suppose i have the following HTML code:\n\n<body>\n\n <div id=\"image\">\n <img src=\"pic.jpg\">\n </div>\n\n</body>\n\n\nand the CSS as:\n\n#image{\nwidth:100%;\nheight:auto;\n}\n\n\nor\n\n#image img {\nwidth:100%;\nheight:auto;\n}\n\n\nI am confused here as there is no change in the image because the image div have the size of the image(the image dimensions are 1920*1080 pixels), and its 100% is the whole image itself.\nbut if i set the width to 50% there is still no change.\n\nI just want the image to resize according to the browser, my screen resolution is 1366*768 so initially i need the image to fit that and when i resize the browser i needed the size of the image to change accordingly." ]
[ "html", "css" ]
[ "How to write these particular lines in MVVM WPF(c#)?", ".\n\n Console.WriteLine(DateTime.Now.ToLongTimeString());\n string name = (sender as Button).Name;\n\n\nI have to convert these two lines to MVVM .The following is my code.\n\nViewModel.cs :\n\n public ICommand MouseEnterCommand\n {\n get\n {\n return new RelayCommand(a => this.Executemethod(), p => Canexecutemethod());\n }\n }\n public bool Canexecutemethod()\n {\n return true;\n }\n\n public void Executemethod(){\n Console.WriteLine(DateTime.Now.ToLongTimeString());\n string name = (sender as Button).Name;\nswitch(name)\n {\ncase \"btn1\":\n...\ncase \"btn2\":\n ...\n }}\n\n\nWhere btn1 and btn2 are button names.....I have four buttons totally\n\nView.xaml::\n\n <UserControl\n xmlns:interact=\"clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity\" \n ..>\n <Grid>\n <Button Name=\"btn1\">\n <interact:Interaction.Triggers>\n <interact:EventTrigger EventName=\"MouseEnter\">\n <interact:InvokeCommandAction Command=\"{Binding Path=DataContext.ZoomInCommand}\" CommandParameter=\"{Binding }\" />\n </interact:EventTrigger>\n </interact:Interaction.Triggers>\n </Button>\n </Grid>\n </UserControl>\n\n\nPlease help me to write these lines in MVVM..Thanks in advance" ]
[ "c#", "mvvm", "mouseenter" ]
[ "How can I use create-react-app for React version 16.x.x with TypeScript?", "I need to run up a sandbox React app with version 16 and typescript.\nDoes anyone know how to do that as npx create-react-app --template=typescript blah now uses React 17?\nUpdate\nAs suggested in the comments I've attempted to install with this:\nnpm init react-app migration-calculator-npm-demo --scripts-version 3.4.4\nand\nnpm init react-app migration-calculator-npm-demo --template typescript --scripts-version 3.4.4\n3.4.4 looks like the last version of react-scripts since before the major update.\nUnfortunately, I'm getting errors with both.\n\ninternal/modules/cjs/loader.js:1088\nthrow err; ^\nError: Cannot find module 'cra-template'\n\nand\n\ninternal/modules/cjs/loader.js:1088\nthrow err; ^\nError: Cannot find module 'cra-template-typescript'" ]
[ "reactjs", "create-react-app" ]
[ "What's the difference between anaconda2/Lib/site-packages/ and anaconda2/pkgs/?", "I have the latest anaconda2 installed. I found the same packages exist in both anaconda2/Lib/site-packages/<pkg> and anaconda2/pkgs/<pkg>. What are the differences and the pkgs under which one are called in python?" ]
[ "python", "anaconda", "conda" ]
[ "All pairs shortest path lengths in a large undirected weighted graph with cycles in Python", "I am looking for an working algorithm to find the shortest path lengths (only the lengths not the paths) from all nodes to all other nodes. The graphs have around 2000 - 4000 vertices and around 3,5 times more edges. The graph looks something like this: A simple drawing of the graph\n\nI am working in Python and I've tried an implementation of the Floyd Warshall algorithm but it does not seem to do the trick in my case and keeps on running in all eternity. The implementation is tested on some smaller graphs and is correctly implemented. I am using a graphical representation such as (but much larger than):\n\ngraph = {0: {1: 3, 3:8, 4:5},\n 1: {0: 3, 2:5},\n 2: {1: 5, 3:4, 4:1 },\n 3: {0: 8, 2:4, 4:3},\n 4: {0:5, 2:1, 3:3}}\n\n\nKey are vertices, and ultimately the value is the weight. Is there any library that could help me with this task?" ]
[ "python", "graph", "shortest-path" ]
[ "Match everything, but ignore specific word", "In continuation of a previous question I had:\n\nSo I'm in a situation where I MUST use only regex to select everything but a specific word. For the purposes of example, the word will be 'foobar'. This is what should happen:\n\nThe original regex that works with this example is /\\W*\\b(?!foobar).+?\\b\\W*/g.\n\n\n\nThe problem with that regex is that things like foobartest and foobar1234 with anything after foobar, is ignored along with the foobar. This is not what I want. The test and 1234 should not be getting ignored, however the starting foobar should, it shouldn't disclude the entire word because it wasn't exactly foobar. The only scenario where this should occur is with something like foobarfoobar, where it ignores both foobars as intended. Everything else should be matched without exception.\n\nThe supposed duplicate does not accomplish what I'm requesting.\n\nOne last thing to note is that I can not use lookbehind, only lookahead. Is there any way to achieve what I want? Thanks!" ]
[ "regex" ]
[ "Liferay - React portlet: MIME type ('text/html') is not executable, and strict MIME type checking is enabled", "I am building a npm-react portlet in liferay 7 and i am trying to use https://react-table.js.org for rendering the table data. When i try to access the portlet in brower i get the erro in the screen shot below:\n\nError:\n\n\nMyJS file:\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Clock from './components/Clock'\nimport ReactTable from \"react-table\";\nimport 'react-table/react-table.css'\n\nfunction Mytable() {\n const data = [{\n name: 'Tanner Linsley',\n age: 26,\n friend: {\n name: 'Jason Maurer',\n age: 23,\n }\n }];\n\n const columns = [{\n Header: 'Name',\n accessor: 'name' // String-based value accessors!\n }, {\n Header: 'Age',\n accessor: 'age',\n Cell: props => <span className='number'>{props.value}</span> // Custom cell components!\n }, {\n id: 'friendName', // Required because our accessor is not a string\n Header: 'Friend Name',\n accessor: d => d.friend.name // Custom value accessors!\n }, {\n Header: props => <span>Friend Age</span>, // Custom header components!\n accessor: 'friend.age'\n }];\n\n return (<ReactTable\n data={data}\n columns={columns}\n />);\n}\n\nexport default function (elementId) {\n console.log(\"default\");\n ReactDOM.render(<Mytable/>, document.getElementById(elementId));\n}" ]
[ "javascript", "reactjs", "liferay-7" ]
[ "Unable to pin down a bug in a simple multithreading program", "I am working on a project that involves multi-threading. Although I have a decent understanding of multi-threading, I have not written many such codes. The following code is just a simple code that I wrote for hands-on. It works fine when compiled with gcc -pthread.\n\nTo build upon this code, I need to include some libraries that already have pthread included and linked. If I compile by including and linking those libraries, 3 out of 5 times it gives segmentation fault. There is some problem with the first for-loop in main() -- replacing this for-loop with multiple statements does the work.\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <pthread.h>\n\n#define NUM_THREADS 3\n\npthread_mutex_t m_lock = PTHREAD_MUTEX_INITIALIZER;\n\ntypedef struct{\n int id;\n char ip[20];\n} thread_data;\n\nvoid *doOperation(void* ctx)\n{\n pthread_mutex_lock(&m_lock);\n thread_data *m_ctx = (thread_data *)ctx;\n printf(\"Reached here\\n\");\n pthread_mutex_unlock(&m_lock);\n pthread_exit(NULL);\n}\n\nint main()\n{\n thread_data ctx[NUM_THREADS];\n pthread_t threads[NUM_THREADS];\n\n for (int i = 0; i < NUM_THREADS; ++i)\n {\n char ip_n[] = \"127.0.0.\";\n char ip_h[4];\n sprintf(ip_h, \"%d\", i+1);\n strcpy(ctx[i].ip, strcat(ip_n, ip_h));\n }\n\n for (int i = 0; i < NUM_THREADS; ++i)\n {\n pthread_create(&threads[i], NULL, doOperation, (void *)&ctx[i]) \n }\n\n for (int i = 0; i < NUM_THREADS; ++i)\n {\n pthread_join(threads[i], NULL);\n }\n\n pthread_exit(NULL);\n\n}" ]
[ "c", "multithreading", "segmentation-fault" ]
[ "Method headers allowed by the compiler (simple Java exercise)", "I am practicing and the simple exercise is, given a FeatureFilm class defined to have the following methods:\n\npublic void update(Actor a, String title)\npublic void update(Actor a, Actor b, String title)\npublic void update(String topic, String title)\n\n\nwhich of the following additional method headers would be allowed by the compiler?\n\npublic boolean update(String category, String theater)\npublic boolean update(String title, Actor a)\npublic void update(Actor b, Actor a, String title)\npublic void update(Actor a, Actor b)\n\n\nSo I did the code and the compiler doesn't allow this methods: public boolean update(String category, String theater) and public void update(Actor b, Actor a, String title), but I don't entirely understand why. Someone could explain this to me please?\nI hope to be making good use of this site. I'm a OPP beginner.\nSorry about my (poor) English,\nThanks." ]
[ "java" ]
[ "To call a block in magento home page static block", "I want to call a block in content of home page. I am writing a code like that:\n\n{{block type='blog/menu_sidebar' template='latest_blog/latest-blog.phtml'}}\n\n\nBut phtml file is not coming in home page.\n\nOn the other hand when I call block in layout update xml under under the design tab by writing the code like that :\n\n<block type=\"blog/menu_sidebar\" name=\"right.blog\">\n <action method=\"setTemplate\" >\n <template>latest_blog/latest-blog.phtml</template> \n </action>\n<block type=\"blog/tags\" name=\"blog_tags\" />\n</block>\n\n\nThen the phtml file is coming in home page.\n\nMy problem is that i want to include latest-blog.phtml file in the content of home page because I will have to play with the div structure for designing which i can not play in the layout section." ]
[ "php", "xml", "magento" ]
[ "MySQL after delete Trigger", "I have 2 tables member_details and archives. I want a trigger that will insert deleted data from member_details into archives as soon as as a particular record is deleted from the member_details table.\n\nDELIMITER $$ \nCREATE TRIGGER member_details_ADEL AFTER DELETE ON member_details \nFOR EACH ROW \ninsert into archives values" ]
[ "mysql", "triggers" ]
[ "How to insert a line just after the first regex match with sed?", "I have a few CmakeLists.txt files and I would like to insert another include right after a known include. So, here's what I've got:\n\ninclude_directories(src include)\n\n\nAnd, here's what I would like to end up with\n\ninclude_directories(src include)\ninclude_directories(\"${CMAKE_INSTALL_PREFIX}/include\")\n\n\nAny ideas on the best way to do this? I'm assuming sed would make the most sense, but I'm open to alternatives.\n\n[edit] Found a duplicate question." ]
[ "bash", "file-io", "sed" ]
[ "SonataAdminBundle + styles don't show properly", "Any idea why my admin area shows like this:\n\n\n\nI installed assets with no problem.\nand here is my config.ylm file:\n\nfos_user:\n db_driver: orm \n firewall_name: main\n user_class: Acme\\CoreBundle\\Entity\\User\n\n group:\n group_class: Acme\\CoreBundle\\Entity\\Group\n group_manager: sonata.user.orm.group_manager\n\n service:\n user_manager: sonata.user.orm.user_manager\n\nsonata_user:\n security_acl: true\n manager_type: orm\n\nsonata_block:\n default_contexts: [cms]\n blocks:\n sonata.admin.block.admin_list: # Enable the SonataAdminBundle block\n contexts: [admin]\n sonata.user.block.menu: # used to display the menu in profile pages\n sonata.user.block.account: # used to display menu option (login option)\n sonata.block.service.text: # used to if you plan to use Sonata user routes" ]
[ "sonata-admin", "sonata-user-bundle" ]
[ "google api \"Permission denied to generate login hint for target domain\"", "In https://console.developers.google.com/apis/credentials/oauthclient I created a \"Client ID for Web application\", No restrictions: empty \"Authorized JavaScript origins\" and empty \"Authorized redirect URIs\". I receiv a client Id and put it on a page.\n\nBelow is the most basic page sample. I receive the message:\n\n400. That’s an error.\n\nError: invalid_request\n\nPermission denied to generate login hint for target domain.\n\n??? what's wrong? \n\n<head>\n<meta name=\"google-signin-client_id\" content=\"****26190863-tm7mr9racl8bgooifq2kjssb1n7teoob.apps.googleusercontent.com\">\n</head>\n<script src=\"https://apis.google.com/js/platform.js\" async defer></script>\n<script type=\"text/javascript\">\nfunction onSignIn(googleUser) {\n var profile = googleUser.getBasicProfile();\n console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.\n console.log('Name: ' + profile.getName());\n console.log('Image URL: ' + profile.getImageUrl());\n console.log('Email: ' + profile.getEmail());\n}\n</script>\n<body>\n <div class=\"g-signin2\" data-onsuccess=\"onSignIn\"></div>\n</body>" ]
[ "javascript", "login", "oauth" ]
[ "Detect clicks on SystemTray applications", "I have an app with a widget that must when the user clicks anywhere outside the aforementioned widget. The problem is that the widget doesn't get any focus out signals when the user clicks in the SystemTray (for example the Skype or dropbox desktop app or the clock).\n\nHow can i capture the clicks in the SystemTray icons or make the widget to lose focus in that case?\n\nIm using Qt 5.3 in a mac os Yosemite.\n\nThx in advance" ]
[ "macos", "qt", "system-tray" ]
[ "NullPointerException warning in Binary Search Tree", "public void dfs(){\n LinkedList<BinaryNode> linkedList = new LinkedList<>();\n linkedList.add(root);\n\n while(!linkedList.isEmpty()){\n BinaryNode currentNode = linkedList.pollLast();\n\n if(currentNode.getRight() != null){\n linkedList.add(currentNode.getRight());\n }\n\n if(currentNode.getLeft() != null){\n linkedList.add(currentNode.getLeft());\n }\n\n System.out.println(currentNode.getNumber());\n }\n }\n\n\nif(currentNode.getRight() != null) is giving me a warning in IntelliJ \n\n\n Method invocation 'getRight' may produce NullPointerException \n\n\nCan someone give me an example of how I might get a NullPointerException. \n\nThe BinaryTree class has only one constructor \n\npublic class BinaryTree {\n private BinaryNode root;\n\n public BinaryTree(BinaryNode root) {\n this.root = root;\n }\n\n // rest of code here including bfs/dfs algorithms\n}\n\n\nalso here is the Node class:\n\npublic class BinaryNode {\n private int number;\n private BinaryNode left;\n private BinaryNode right;\n\n public BinaryNode(int number) {\n this.number = number;\n }\n\n //boilerplate code here\n}" ]
[ "java", "data-structures", "binary-search-tree" ]
[ "Python Pillow error: No such file or directory", "I have Pillow function for displaying images in Pandas dataframe on Windows machine.It works ok on testing dataset. \n\nPill function:\n\nfrom PIL import Image\n\ndef get_thumbnail(path):\n i = Image.open(path)\n print(path)\n i.show()\n return i\n\n\nThan I'm using that function to new create new Pandas column that should hold PIL image info. Image is generated based on image URL which is stored in another Pandas column:\n\nadInfoListPD['Ad_thumb']\n\n\nwhich looks like this:\n\n> 0 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\03_ps4-pro-500-million-limited-edition-blau-transparent-bundle-29598325900_ps4-pro-500-million-limited-edition-blau-transparent-bundle-295983259__thumb_100x75.jpg\n> 1 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\04_playstation-4-20th-anniversary-edition-ungeoeffnet-29586533000_playstation-4-20th-anniversary-edition-ungeoeffnet-295865330__thumb_100x75.jpg\n> 2 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\05_playstation-4-20th-anniversary-sammleredition-ovp-29496806400_playstation-4-20th-anniversary-sammleredition-ovp-294968064__thumb_100x75.jpg\n> 3 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\07_gratis-versand-alles-zusammen-xxxl-paket-29517022700_gratis-versand-alles-zusammen-xxxl-paket-295170227__thumb_100x75.jpg\n> 4 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\08_groesste-ankauf-mit-sofortigem-bargeld-30099513000_groesste-ankauf-mit-sofortigem-bargeld-300995130__thumb_100x75.jpg\n> 5 \n> C:\\Users\\user\\Documents\\001ML\\willat\\Games_Konsolen\\09_wir-zahlen-sofort-bargeld-30099285800_wir-zahlen-sofort-bargeld-300992858__thumb_100x75.jpg\n\n\nAnd I'm using this line to create column which will hold pill image:\nadInfoListPD['image'] = adInfoListPD.Ad_thumb.map(lambda f: get_thumbnail(f)).\n\nI get error:\n\nFileNotFoundError: [Errno 2] No such file or directory:\n'C:\\\\Users\\\\user\\\\Documents\\\\001ML\\\\willat\\\\Games_Konsolen\\\\03_ps4-pro-500-million-limited-edition-blau-transparent-bundle-29598325900_ps4-pro-500-million-limited-edition-blau-transparent-bundle-295983259__thumb_100x75.jpg'\n\n\nI've double checked paths and they are ok.\nI've also read all other posts about python path problems on windows. I think I'm passing path in proper way.\nAs I said, everything works ok on demo data, but it doesn't work with my data." ]
[ "python", "python-3.x", "pandas", "python-imaging-library" ]
[ "Facebook Like Button action not showing over activity Box", "I am using facebook social like plugin which is not generating an activity post on my Activity box on facebook timeline, when I use this use the like button over this site\n\nhttp://www.espncricinfo.com/england/content/image/646433.html?object=1;page=1\n\nit generate the activity post on activity box as the normal like button do.\n\n\n\nSomeone please tell me what I am missing in it.\n\nHere is the button code\n\n<fb:like class=\"fb-like\" data-href=\"<?php echo SITE_URL.'/post/page/'.$post->id ?>\" width=\"45\" height=\"20\" data-send=\"false\" data-layout=\"button_count\" data-width=\"45\" data-show-faces=\"false\" fb-xfbml-state=\"rendered\"></fb:like>\n\n\n\nwindow.fbAsyncInit = function() {\n FB.init({\n appId : social_ids.fb, // App ID\n status : false, // check login status\n cookie : true, \n xfbml : true, // parse XFBML\n oauth : true, //enable oauth 2.0\n channelUrl: SITE_URL+'channel.php' //custom channel\n }); \n};\n\n\nthe wall post through this app is working fine, but normal like action is not reflecting over timeline.\n\nThanks" ]
[ "php", "javascript", "facebook" ]
[ "Assembler debug trying to print quotient and remainder", "I am attempting to create a program through DOSBOX (program name is mod.com) and I'm having trouble printing out my quotient and remainder of 91 x 13 mod 23.\n\nmov cl, 91\nmov bl, 13\nmul bl\nmov al, 23\nmod al\nmov dl,al\nmov ah,2\nint 21" ]
[ "assembly" ]
[ "Parse issues when trying to use \"Examples\" section in Cucumber feature", "No luck in googling on this error message\n\nfeatures/manage_hand_evaluator.feature: Parse error at features/manage_hand_evaluator.feature:21. Found examples when expecting one of: comment, py_string, row, scenario, scenario_outline, step, tag. (Current state: step). (Gherkin::Parser::ParseError)\n\nHere's the setup I have for Examples section (there are no other Scenarios at this time, just this one after the \"Feature:\" section)\n\n...\n\nScenario: Evaluating for current straights\n Given I am a player with <hand>\n When the board is <board>\n Then the current possible straights should be <possibles>\n\n Examples:\n | board | hand | possibles | \n | A23 | 45 | A2345 | \n | 3456 | 23 | A2345,23456,34567,45678 | \n | 789T | A2 | 56789,6789T,789TJ,89TJQ | \n | 45678 | 23 | 23456,34567,45678,56789,6789T | \n\n\nI also have step definitions set up already for those \"Given, When, Then\" lines (and tests passes fine when I replace , , with some text and comment out the \"Examples\" section). So it seems step definitions are set up properly, just that there is some kind of parsing issue with the contents I have in .feature file and I cannot figure out what I am doing wrong.\n\nRelevant gems installed:\nGherkin (2.1.5) (tried 2.2.0 but it breaks with my version of Cucumber)\nCucumber (0.8.5)\nCucumber-Rails (0.3.2)\nRails (2.3.8)" ]
[ "ruby-on-rails", "ruby", "cucumber", "gherkin" ]
[ "How to let which() throw unordered values?", "Suppose we have a data frame\n\n> (df <- as.data.frame(matrix(1:12, 3, 4)))\n V1 V2 V3 V4\n1 1 4 7 10\n2 2 5 8 11\n3 3 6 9 12\n\n\nIs there a way to let which() throw column numbers in an unordered form? I. e. which(names(df) %in% c(\"V1\", \"V4\", \"V3\")) yielding 1, 4, 3 instead of 1, 3, 4? Or, if there isn't, how can we achieve this most easily?" ]
[ "r" ]
[ "Joomla 3.36 - Browser Page title", "Hi I go to menu page display and enter text into the Browser Page title field but\n\nIt does not change the browser page title.\n\nDoes anyone have any ideas what could create this issue?" ]
[ "joomla" ]
[ "Attempted import error: 'styles' is not exported from './styles'", "I am trying to import styles from style.js file and the that file contains below code\n const export styles = {\n border: 'solid',\n textAlign : 'center',\n boxShadow : '2px 2px'\n }\n\nBut it shows the below error in that file\n'export' is not allowed as a variable declaration name.\n\nBut when I add the export keyword as shown below code\n const styles = {\n border: 'solid',\n textAlign : 'center',\n boxShadow : '2px 2px'\n }\n export default styles;\n\nAnd trying to import in my component as\nimport * as styles from "./styles";\n\n<div style={styles.styles}>\n Style\n</div>\n\nI am getting the below error\nAttempted import error: 'styles' is not exported from './styles'.\n\nHow do I resolve it?" ]
[ "reactjs" ]
[ "Call another kohana method as a background task", "How is is possible in Kohana 3 to be in the action_index method of a controller and using something like this code\n\n exec(\"php index.php --uri=home/other_method\");\n\n\n... to run 'other_method' in the background? I'm in 'home/index' and want to call 'home/other_method' as a background task. I don't want to wait for the web page to respond and 'other_method' can take up to 3 minutes to complete.\n\nI don't want to use a queue and I would like to do it without Minion.\n\nIs this possible? No matter what I try I can't get 'other_method' to even respond. I can access it directly and I can even use a CRON job on the server to call my exec() code.\n\nWhy can't I access it via exec() while in action_index?\nIs there another way to call 'other_method' using a kohana thread so that I can continue with action_index?\n\n(Also, I code on Mac using MAMP. Maybe it has something to do with environment?)" ]
[ "exec", "kohana", "background-process" ]
[ "How to temporarily obscure WebView with full screen image?", "Displaying an (local) image inside WebView is straightforward.\n\nBut that means it must fit within whatever my standard WebView frame has (minus title bar for example).\n\nBefore loading any page or URL into WebView I could simply achieve this by doing:\n\nmyWebView.setBackgroundColor(0);\nmyWebView.setBackgroundResource(R.drawable.myImage);\n\n\nBut after some page has been loaded and rendered, the above trick no longer works.\n\nIs there a way to obscure WebView with a full screen image? (until a new HTML page or URL is loaded, of course)\n\nNote: I'm not interested in a webview.loadUrl() solution." ]
[ "android", "webview", "android-webview", "android-resources" ]