texts
sequence | tags
sequence |
---|---|
[
"Are there any 'gotchas' involved when invoking BDE through a Delphi COM server or DLL from .NET?",
"I'm asking this as a follow-up to my previous question: What is a good way of accessing dBase files using BDE and Delphi?\n\nIt was suggested that I called upon a Delphi COM server instead of passing data though standard input/output, and I totally agree that such a solution is very limited.\n\nBasically I need a way to call BDE from C#, without using ADO/OLEDB. Origianlly my requirement was having the ability to execute queries directly and having some sort of RecordSet object returned, but I'm also okay with a strongly typed interface with method such as:\n\nuint CreateCustomer(string fname, string lname, string addr, string email)\nuint CreateContract(...)\nbool DeleteContract(...)\n\nI would prefer not having to register a COM server with regsvr32, but rather use Interop and DllImport to call DLL methods directly. Using the latter approach, are there any special considerations with regards to resource cleanup and \"BDE Sessions\" and what not.\n\nAlso, what would be the proper way to handle exceptions and ensure any BDE (or other) resources are freed if exceptions occur?\n\nI have a lot of questions, and I'm not really sure how to present them in a clear way :)\n\nEDIT: I'm fully aware that BDE is 'dead', but I have no control whatsoever over the third-party software that's still using BDE."
] | [
"delphi",
"interop",
"delphi-7",
"bde",
"dbase"
] |
[
"React-hot-loader using craco",
"I've been trying to get react-hot-loader to work in my project and have got it setup according to the instructions in the package readme. The main difference is that I'm using craco in this project and so step 1 means I have added\n\n babel: {\n plugins: [\"react-hot-loader/babel\"],\n },\n\n\nto my craco.config.js.\n\nMy root component is marked as hot-exported:\n\n// ...\nimport { hot } from 'react-hot-loader/root';\n// ...\n\nfunction App() {\n return (\n <div>\n <Suspense fallback={loadingFB()}>\n <Provider store={userStore}>\n <ProvideAuth>\n <Router />\n </ProvideAuth>\n </Provider>\n </Suspense>\n </div>\n );\n}\n\nexport default hot(App);\n\n\nI've got import 'react-hot-loader'; first in my index.js\n\nAnd finally I've installed @hot-loader/react-dom using the following yarn command:\nyarn add react-dom@npm:@hot-loader/react-dom\n\nI am currently not getting any warning/errors on compile or in the browser console. But when I refresh the page or manually try to go to any subpage by writing it's url I loose all state.\n\nAnyone got any idea what's missing?"
] | [
"javascript",
"reactjs",
"babeljs",
"react-hot-loader"
] |
[
"Doubt in implementing Service",
"I have written a service To delete data from a table when data inputed into it(tblTest) as given below\n\npublic class service_helper extends Service {\n private DatabaseAdapter dbAdapter;\n @Override\n public IBinder onBind(Intent arg0) {\n\n return null;\n\n }\n\n @Override\n\n public void onCreate() {\n\n super.onCreate();\n\n Toast.makeText(this,\"Service created ...\", Toast.LENGTH_LONG).show();\n dbAdapter = new DatabaseAdapter(this); \n dbAdapter.open();\n\n\n String sqlTransaction = \"Select test from tblTest where test > ?\";\n dbAdapter = new DatabaseAdapter(this); dbAdapter.open();\n Cursor cursorTransaction = dbAdapter.ExecuteRawQuery(sqlTransaction, \"-1\");\n\n for (int i = 0; i < cursorTransaction.getCount(); i++) {\n\n String sql = \"DELETE FROM tblTest WHERE test=\" + i + \" \";\n dbAdapter.ExecuteQuery(sql); \n }\n\n\n\n }\n\n\n\n @Override\n\n public void onDestroy() {\n\n super.onDestroy();\n\n Toast.makeText(this, \"Service destroyed ...\", Toast.LENGTH_LONG).show();\n\n }\n\n}\n\n\nI have Started the service in the on create of main activity as given below\n\nstartService(new Intent(this, service_helper.class));\n\nThe problem is that I can't do anything in my applicaion because of the service got stated.I cant navigate from my main form.Is it the Right way to implement Service ?\n\nWill any one help me"
] | [
"android"
] |
[
"Admin url console not available when running keycloak slave with --backup option",
"I am running keycloak in domain master-slave configuration. In order to have dc backup in case master goes down i configured in such a way that am able to connect to connect to domain controller through jboss cli using the command when the master goes down\njboss-cli --connect --controller=localhost\n/host-slave:write-local-domain-controller\nbut am not able to access the admin console\nAm not sure why admin console is not available when the slave takes over as master . Can someone throw some light on this\nThanks,\nAR"
] | [
"keycloak",
"keycloak-services",
"keycloak-gatekeeper",
"keycloak-rest-api",
"keycloak-connect"
] |
[
"Kafka topics to Spark Streaming DStream, how to get a Json",
"I'm trying to get the information from a Kafka Topic with Spark Streaming and then parse the json I get in the topic.\nIn order to get the topic in a DStream I use a stringReader and then I use foreach to get every RDD from the DStream:\n\nmyRDD.collect().foreach(println)\n\n\nIn order to convert myRDD into a json (when I print myRDD the format for a json is correct) and extract two fields I need, I've tried to use json4s and tried this:\n\nval jsonEvent = Json.parse(myRDD)\nval srcIp = (jsonEvent / \"src_ip\")\nval dstIp = (jsonEvent / \"dst_ip\")\n\n\nI've also tried to use json4s this way:\n\nval jsonEvent = parse(myRDD).asInstanceOf[JObject]\nval srcIp = jsonEvent / \"src_ip\"\n\n\nBut it's not working correctly either.\n\nThis is the output:\n\njava.lang.NoSuchMethodError: rg.json4s.jackson.JsonMethods$.parse$default$3()Z\n\n\nThese are the versions I'm using:\n\n<dependency>\n <groupId>org.json4s</groupId>\n <artifactId>json4s-native_2.10</artifactId>\n <version>3.5.1</version>\n</dependency>\n<dependency>\n <groupId>org.json4s</groupId>\n <artifactId>json4s-jackson_2.10</artifactId>\n <version>3.5.1</version>\n</dependency>\n\n\nI think that the problem is that I don't understand how exactly I can transform each record in the RDD to a json object to parse it. Can someone please explain it more deeply to me so I can understand how it works? \nIs my code correct?\n\nThank you."
] | [
"json",
"scala",
"apache-kafka",
"spark-streaming",
"dstream"
] |
[
"Python 3.2 installation on Ubuntu 12.04",
"I am trying to install python 3.2.3 on my ubuntu machine, which is 12.04, but I do not want to disturb the current 2.7 installation. After searching on the internet, I found a reference here. I followed the instructions, but when trying to run \n\nsudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev\n\nI get an error saying that \n\n\n E: Package 'libreadline5-dev' has no installation candidate.\n\n\nWhat am I missing? Is there any other way to install python 3.2 on ubuntu? If I use apt-get, will it disturb the current installation?"
] | [
"python",
"ubuntu-12.04",
"failed-installation",
"python-3.2"
] |
[
"why are there multiple fcntl.h in linux?",
"I write a c program which includes fcntl.h file. I search the file and get results as follow: \n\n[xunyl@localhost csapp]$ find /usr/include/ -name \"fcntl.h\"\n/usr/include/asm/fcntl.h\n/usr/include/asm-generic/fcntl.h\n/usr/include/linux/fcntl.h\n/usr/include/sys/fcntl.h\n/usr/include/bits/fcntl.h\n/usr/include/fcntl.h\n\n[xunyl@localhost csapp]$ grep -rn \"O_RDONLY\" /usr/include/\n/usr/include/asm-generic/fcntl.h:19:#define O_RDONLY 00000000\n/usr/include/linux/cdrom.h:32: * - drive = open(\"/dev/cdrom\", O_RDONLY);\n/usr/include/linux/cdrom.h:33: * + drive = open(\"/dev/cdrom\", O_RDONLY | O_NONBLOCK);\n...\n\n\nI find gcc calls /usr/include/asm-generic/fcntl.h actually when I put #include <fcntl.h> in program. I just wonder how gcc determines which \"fcntl.h\" should be called. Is there any call order or precedence ?"
] | [
"c++",
"c",
"linux",
"gcc",
"header-files"
] |
[
"4clojure: set-intersection, recursive lambda",
"I am attempting to write a recursive lambda function (accepting two arguments) that finds the intersection between two (potentially) unsorted sets. Here is the code, which I believe most will find straight forward:\n\n(fn intersection [a b]\n(fn inner [x y out]\n (if (empty? x) out\n (if (nil? (some ((set (first x)) y )))\n (inner (rest x) y out))))\n (inner (rest x) y (cons (first x) out))\n (inner a b '[])\n)\n\n\nI hope to use this lambda function intersection in place of the underscore _ that follows:\n\n(= (__ #{0 1 2 3} #{2 3 4 5}) #{2 3})\n\nHowever, this code fails to compile, insisting that Java is Unable to resolve symbol: inner in this context...\n\nAny suggestions?\n\nsource: http://www.4clojure.com/problem/81"
] | [
"clojure"
] |
[
"How can I reload .emacs after changing it?",
"How can I get Emacs to reload all my definitions that I have updated in .emacs without restarting Emacs?"
] | [
"emacs"
] |
[
"how to use result of first observable into next observables?",
"I have this method:\n\n zip(\n this.$one.getOne(id)\n .pipe(switchMap(oneResult => {\n return this.$two.getTwo(oneResult.id)\n }))\n .pipe(switchMap(twoResult => {\n // Here I Would like to use the **oneResult** as argument to the $three observable too.\n return this.$three.getThree(oneResult.id)\n })),\n this.$four.getFour()\n ).subscribe(zipResult => {\n [getTwoResult, getThreeResult]\n }\n\n\nHow do I pass the $one Observable result to $two Observable and $hree observable? I can just get it on the first switchMap."
] | [
"angular",
"rxjs"
] |
[
"How can I create derived class object from an existing base class object?",
"I am trying to create a derived class object and populate the data-members (coming from base class) with a existing base class object.\n\nIn my process lifecycle, I already had a base class object. For some decision, I have to create a new object (derived from base class). One way to do this is expose the assessors and copy the data. Is there any solution like aggregate initialization or dynamic_cast that I could use instead? \n\n#include <iostream>\n#include <string>\n\nusing namespace std;\n\nclass Base {\n protected: \n string name_;\n\n public:\n Base() : name_ (\"foo\")\n {\n }\n void ChangeName()\n {\n name_ = std::string {\"bar\"};\n }\n};\n\nclass Child final : Base {\n public:\n string GetName()\n {\n return name_;\n }\n};\n\nint main()\n{\n Base b;\n b.ChangeName();\n\n Child c = {b};\n cout<<\"Hello World. Here is my name: \" << c.GetName() << endl;\n\n return 0;\n}\n\n\n\n Expected Output:\n Hello World. Here is my name: bar\n\n\nCompilation Error\n\ntry.cpp:33:17: error: could not convert ‘{b}’ from ‘<brace-enclosed initializer list>’ to ‘Child’\n Child c = {b};"
] | [
"c++",
"c++11"
] |
[
"Get categories based on time in laravel",
"I am making website that have foods and different categories like breakfast,lunch,dinner etc.What I want to do is when user enter to website it will automatically shown that category according to current time.\nMy category table has fields:\n\n\nID\nName\nStart_time\nEnd_time\n\n\nMy Controller is:\n\npublic function index()\n{\n $now = Carbon::now();\n $Category=DB::table('Categories')\n ->where('Start_time', '>', $now)\n ->where('End_time', '<', $now)\n ->get();\n\n return view('welcome', compact('Category'));\n}\n\npublic function categ($Category_id)\n{\n $category = Categories::with('food')->findOrFail($Category_id);\n return view('category', compact('category'));\n}\n\n\nRoutes are:\n\nRoute::get('/','DetailsController@index');\nRoute::get('category/{Category_id}', 'DetailsController@categ');\n\n\nIn my view\n\n @foreach ($Category as $categories) \n <div class=\"food-box\">\n <button \n style=\"font-size:14px; width: 230px; height: 30px; background-color: #00A30C; color:white; font-style: italic; text-align: center; font-size: 15px; margin: 0 auto;\">\n\n{{$categories->CategoryName}} </button>\n\n </div>\n @endforeach\n\n\nI am using Carbon api to get current time by using this.\n\n<?php \n $mytime = Carbon\\Carbon::now();\n echo $mytime->format('l jS \\\\of F Y, h:i:s A');\n?>\n\n\nI want it shows me category based on current time.if time interval not meet then default page will be shown.How I can do this in laravel?I am new to laravel and didn't find any solution about this.Thanks"
] | [
"php",
"laravel",
"laravel-5.2"
] |
[
"Is Spring - SpEL vulnerable?",
"I came across an article Open source library with vulnerabilities.\n\nThis article states that\n\"Spring Expression Language (SpEL) could be exploited through HTTP parameter submissions that would allow attackers to get sensitive system data, application and user cookies.\" \n\nCan someone shed more light on this, please ?"
] | [
"spring",
"security",
"spring-el"
] |
[
"Why isn't the component rendering the correct information? ReactJS",
"I'm rendering an array of values and I have a two buttons, one to Add and another to Remove. Everything works the way it should but when I click Remove, the element in the correct index gets removed from the array but when it renders again, it removes the last entry, and not the entry at that specific index. \n\nFor example: (left side is webpage, right side is console)\n\n\n\nCurrently the array is [\"hello\", \"world\", \"everyone\"] and let's say I want to remove \"world\" and I click the Remove button next to it, the array updates correctly (I did a console.log) and it becomes [\"hello\", \"everyone\"], it re-renders but it shows it as if the array was [\"hello\", \"world\"] and renders it incorrectly:\n\n\n\nI'm not sure what I did incorrectly with my code as the array gets updated correctly and everything else seems to be okay.\n\n childChange: function(name, valid, value) {\n\n this.state.values = this.props.values;\n var pattern = /[0-9]+/; // Using regex to find last digits from 0-9\n var match = name.match(pattern); // Update state\n var i = parseInt(match); // Parse char into int\n // console.log(match);\n\n this.state.values[i] = value;\n\n this.setState(this.state);\n\n this.props.callback( // Call parent callback\n this.props.name,\n this.props.node.valid(this.state.values),\n this.state.values\n );\n },\n\n addEmptyItem: function() {\n\n this.state.values = this.props.values;\n this.state.values.push(\"\");\n this.setState(this.state);\n\n },\n\n removeItem: function(ev) {\n\n console.log(ev.currentTarget.dataset.index);\n var i = parseInt(ev.currentTarget.dataset.index);\n this.state.values = this.props.values;\n this.state.values.splice(i,1);\n console.log(this.state.values);\n this.setState(this.state.values);\n\n },\n\n render: function() {\n var that = this;\n\n console.log(\"===RENDER===\");\n\n return (\n <div id = \"form\">\n {this.props.values.map(function(v, i) {\n return (\n\n <div>\n {(that.props.node.get().constructor.name === \"Parent\") ?\n <ParentComponent\n name={that.props.name + i}\n key={i}\n timer={that.props.timer}\n callback={that.childChange}\n values={v}\n newParent={that.props.node.get()}\n />\n :\n <div>\n <NodeComponent\n name={that.props.name + i}\n key={i}\n timer={that.props.timer}\n callback={that.childChange}\n value={v}\n newNode={that.props.node.get()}\n />\n\n </div>\n\n }\n <button data-index={i} onClick={that.removeItem}>Remove\n </button>\n </div>\n\n )\n })}\n <button onClick={() => that.addEmptyItem()}>Add\n </button>\n\n </div>\n )\n\n }"
] | [
"javascript",
"reactjs"
] |
[
"Problems with the ACGIP Conference Project",
"So I have already attempted to do this project by myself but the program I'm using as a sandbox seems incredibly picky at how one is to do it. Despite using examples and other aids to help get this done, nothing has worked. I'm having three separate issues that I think I have done correctly but, apparently, had not done correctly. The issues are as followed:\n\n\nScript & Form Elements\nThe Regex\nThe Submit Button\n\n\nThe program will not tell me what's being done wrong either. Might I get some aid?\n\n <section>\n <h1>Conference Registration Form</h1>\n <p>Required Item (*)</p>\n <form action=\"http://www.example/cg/register\" method=\"post\">\n\n <!-- title -->\n <div>\n <label for=\"title\">Title</label>\n <input type=\"text\" name=\"title\" id=\"titleBox\" list=\"titleList\">\n <datalist id=\"titleList\">\n <option value=\"Mr.\"></option>\n <option value=\"Mrs.\"></option>\n <option value=\"Ms.\"></option>\n <option value=\"Prof.\"></option>\n <option value=\"Dr.\"></option>\n <option value=\"Assist. Prof.\"></option>\n <option value=\"Assoc. Prof.\"></option>\n </datalist>\n </div>\n\n <!-- firstName -->\n <label for=\"firstName\">First Name*</label>\n <input type=\"text\" name=\"firstName\" id=\"fnBox\" required>\n\n <!-- LastName -->\n <label for=\"lastName\">Last Name*</label>\n <input type=\"text\" name=\"lastName\" id=\"lnBox\" required>\n\n <!-- address -->\n <label for=\"address\">Address*</label>\n <textarea name=\"address\" id=\"addBox\"></textarea>\n\n <!-- Company or University -->\n <label for=\"group\">Company or University</label>\n <input type=\"text\" name=\"group\" id=\"groupBox\">\n\n <!-- E-mail -->\n <label for=\"email\">E-mail*</label>\n <input type=\"email\" name=\"email\" id=\"mailBox\" required>\n\n <!-- Phone Number -->\n <label for=\"phoneNumber\">Phone Number*</label>\n <input type=\"tel\" name=\"phoneNumber\" id=\"phoneNumber\" required pattern=\"^\\d{10}$|^(\\(\\d{3}\\)\\s*)?\\d{3}[\\s-]?\\d{4}$\" placeholder=\"(nnn) nnn-nnnn\">\n\n <!-- ACGIP Membership -->\n <label for=\"acgipID\">ACGIP Membership Number</label>\n <input type=\"text\" name=\"acgipID\" id=\"idBox\" placeholder=\"acgip-nnnnnn\" pattern=\"^acgip\\-\\d{6}$\">\n\n <!-- Registration Category -->\n <label for=\"regList\">Registration Category</label>\n <select id=\"regList\" name=\"\">\n <option value=\"member\">ACGIP Member ($695)</option>\n <option value=\"nonmember\">ACGIP Non-Member ($795)</option>\n <option value=\"student\">ACGIP Student ($310)</option>\n <option value=\"poster\">ACGIP Poster ($95)</option>\n <option value=\"guest\">ACGIP Guest ($35)</option>\n </select>\n\n <!-- Button -->\n <p><input type=\"submit\" name=\"continue\" value=\"Continue\"></p>\n\n </form>\n\n </section>"
] | [
"html",
"css"
] |
[
"Ruby on Rails on Heroku and Wordpress on EC2",
"My main application is hosted on heroku using ruby on rails and using rails-reverse-proxy (https://github.com/axsuul/rails-reverse-proxy) gem to redirect to wordpress blog website and it is running on EC2 and installed under subdirectory /blog. \n\nWordPress Address in WP: www.example.com/blog\nSite Address in WP: www.example.com/blog\n\n\nFollowed https://wordpress.org/support/article/giving-wordpress-its-own-directory/\n\nMy question is:\n\n1) Can we keep WP URL and WP site address same ?\n2) Is there any other configuration needed ?\n\n\nThanks in advance!"
] | [
"php",
"ruby-on-rails",
"wordpress",
"reverse-proxy"
] |
[
"Importing from index files in react",
"I cannot use index files for imports within my component library, but from the outside.\nI'm using the following directory structure:\n\n+ components\n | index.js\n + atoms\n | index.js\n + label\n | label.jsx\n | label.css\n + hoc\n | index.js\n + withFrame\n | withFrame.jsx\n | withFrame.css\n + clientSpecificStyle\n | index.js\n | clientLabel.jsx\n\n\nThe index files are just exporting a default import\n\n// just one sample\nexport { default as Label } from './label/label;\n\n\nWhat I want to do is being able to distinguish between typical (basic) styling of components and client specific styling.\nMy clientLabel is just a label surrounded with a frame:\n\n import React, {Component} from 'react';\n\n // this doesn't work\n import Label from '../atoms/index';\n import withFrame from '../hoc/index';\n\n // this works\n import Label from '../atoms/label/label';\n import withFrame from '../hoc/withFrame/withFrame';\n\n @withFrame\n class ClientLabel extends Component {\n render() {\n return (\n <Label {...this.props}>{this.props.children}</Label>\n );\n }\n }\n\n export default ClientLabel;\n\n\nWhen used from the \"outside\" (i. e. a demo page located on same folder hierarchy as components) using imports from the component index file, it works as expected. But I cannot import the HoC and the Label from the index files within the ClientLabel (fails with component/function undefined). It works however, when using the HoC and Label component files directly for import. The topmost index file (for the whole library) looks like this\n\nexport * from './atoms/index;\nexport * from './clientSpecificStyle/index';\n//...\n\n\nAs I expect this project to grow into many separate components, it'd be more convenient to use index files for all imports, hence allow me to reorganize code as I see fit and only changing one line of code in the corresponding index file.\n\nIs it possible to get this to work?\n\n\n\nMy webpack (v. 3.6) config works - apart from this issue - as expected. Just for clarity, here's the dev-config:\n\nconst webpack = require('webpack');\nconst path = require('path');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n entry: [\n 'webpack-dev-server/client?http://localhost:8080',\n 'webpack/hot/only-dev-server',\n path.resolve('src', 'demo', 'demo.jsx')\n ],\n\n output: {\n path: path.resolve('dist'),\n filename: 'bundle.js',\n },\n\n resolve: {\n extensions: ['.js', '.jsx']\n },\n\n module: {\n loaders: [\n {\n test: /\\.jsx?$/,\n loader: 'react-hot-loader/webpack!babel-loader',\n exclude: [/node_modules/]\n },\n {\n test: /\\.css$/,\n loaders: [\n 'style-loader?sourceMap',\n 'css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'\n ]\n }\n ]\n },\n\n devServer: {\n contentBase: './dist',\n hot: true\n },\n\n plugins: [\n new HtmlWebpackPlugin({\n template: path.resolve('src', 'demo', 'index.html'),\n filename: 'index.html',\n inject: 'body'\n }),\n new webpack.NamedModulesPlugin()\n ]\n};"
] | [
"javascript",
"reactjs",
"webpack",
"ecmascript-6"
] |
[
"Check if solution folder contains files that are not the part of the solution",
"How can I check if solution folder contains files that are not part of the solution? Is there any utility/extension that provides such functionality?\nI want to find all junk files in the solution."
] | [
"visual-studio",
"refactoring",
"visual-studio-extensions"
] |
[
"Backbone view class events overwritten when creating instance",
"I have created a class inherited from Backbone.View which defines some DOM events:\n\nvar MyView = Backbone.View.extend({\n el: '#myview',\n events: {\n 'click .somebutton': 'somefunction',\n 'click .otherbutton': 'otherfunction'\n },\n somefunction: function(){ console.log('somefunction!'); },\n otherfunction: function(){ console.log('otherfunction!'); }\n});\n\n\nWhen instantiating this view (new MyView();) all seem to be in order and my callbacks are fired whenever the elements are clicked.\n\nHowever if I instantiate my view like this:\n\nnew MyView({\n events: {\n 'click .thirdbutton': function(){ \n console.log('thirdfunction'); \n }\n }\n});\n\n\nAll my existing class events get overriden by this single one. What is the correct way to merge my instance-only events with the existing class events? In my example I want all 3 events to be active in my instance."
] | [
"javascript",
"events",
"backbone.js",
"prototypal-inheritance"
] |
[
"How to start with Classes in c++",
"I at classes and objects of C++, where i am facing difficulties to understand the concept of deceleration of a class, for which i have make a little program which is not compiling, anybody will guide me?\n\n#include <iostream>\n\nusing namespace std;\n\nclass myClass{\n friend increment(myClass, int);\n private:\n int topSecret;\n public:\n myClass(){\n topSecret = 100;\n }\n void display(){\n cout<<\"The value of top Secter is\"<<topSecret;\n }\n };\n\n void increment(myClass A, int i){\n A.topSecret += i;\n }\n\n int main() {\n myClass x;\n x.display();\n increment(x,10);\n x.display();\n\n }"
] | [
"c++",
"class",
"object"
] |
[
"Fill existing variables based on their column names and an other variable in R",
"My question seems simple and a lot of similar things have been asked already, but i haven't found something combing questions like this one and this one, where i do want to fill existing variables based on their column names and! an other variable. I posted some test code to showcase the problem:\nrequire(tibble)\nset.seed(123)\ndat1 <- as.tibble(data.frame("ID"=rep(1:10,3), "Stuff"=rep(c("A","B","C"),10),"Target"=runif(30)))\ndat2 <- as.tibble(data.frame("ID"=1:10, "A"=rep(NA,10), "B"=rep(NA,10), "C"=rep(NA,10) ) )\n\nI would like to fill the columns in dat2 with the values in "Target" based on "ID" and "Stuff" from dat1.\nI think it has to some combination of the to linked problems.\n(My regular dataset does include about 20 columns to be filled in and about 20'000 datapoints in dat1.)"
] | [
"r",
"dataframe",
"search",
"tibble"
] |
[
"Get image from wwwroot/images in ASP.Net Core",
"I have an image in wwwroot/img folder and want to use it in my server side code. \n\nHow can I get the path to this image in code?\n\nThe code is like this:\n\nGraphics graphics = Graphics.FromImage(path)"
] | [
"c#",
"asp.net-core",
"asp.net-core-mvc",
"asp.net-core-webapi"
] |
[
"Security Access rules for custom module",
"I have an isue trying to add access rules to my custom openerp module.\n\nAlready have security folder, and declared folder and files into the __openerp__.py file.\n\nStill no luck.\n\nI already did this with another custom module, and everything went fine, here's the code:\n\nir.model.access\n\nid,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink\naccess_solvencia_solvencia,solvencia.solvencia,model_solvencia_solvencia,compra_grafibond.group_purchase_usuario,1,1,1,1\naccess_solvencia_solvencia_manager,solvencia.solvencia manager,model_solvencia_solvencia,compra_grafibond.group_purchase_jefe,1,0,0,0\naccess_solvencia_solvencia_stock_manager,solvencia.solvencia,model_solvencia_solvencia,stock.group_stock_manager,1,0,1,0\n\n\nThe model in module.py:\n\nimport time\nfrom datetime import datetime\nfrom osv import osv, fields\n\nclass solvencia_solvencia(osv.osv):\n\n_name = 'solvencia.solvencia'\n_description = \"Modulo para llevar las solvencias\"\n\n\n_columns = {\n 'ministerio' : fields.char('Ministerio', size=64),\n 'Fecha_de_Emision': fields.date('Fecha de Emision', required=True, select=True),\n 'Fecha_de_Vence': fields.date('Fecha de Vencimiento', required=True, select=True),\n 'user_id': fields.many2one('res.users', 'Responsible'),\n 'ins_em' : fields.char('Institucion emisora', size=30),\n 'cod_ver': fields.integer('Codigo de verificacion'),\n 'nsol' : fields.char('Numero de solvencia'),\n 'cadidate' : fields.date('Fecha de entrega CADIVI', required=True, select=True),\n 'observa' : fields.text('Observaciones'),\n}\n\n_defaults = {\n'user_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).id ,\n}\nsolvencia_solvencia()\n\n\nAnd the security xml:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<openerp>\n<data noupdate=\"0\">\n\n<record model=\"ir.module.category\" id=\"module_category_purchase_management\">\n <field name=\"name\">Solvencias</field>\n <field name=\"parent_id\" ref=\"base.module_category_purchase_management\"/>\n <field name=\"sequence\">9</field>\n</record>\n\n<record id=\"group_solvencias_user\" model=\"res.groups\">\n <field name=\"name\">User</field>\n <field name=\"category_id\" ref=\"module_category_purchase_management\"/>\n</record>\n\n<record id=\"group_solvencias_manager\" model=\"res.groups\">\n <field name=\"name\">Manager</field>\n <field name=\"category_id\" ref=\"module_category_purchase_management\"/>\n <field name=\"implied_ids\" eval=\"[(4, ref('group_solvencia_user'))]\"/>\n <field name=\"users\" eval=\"[(4, ref('base.user_root'))]\"/>\n</record>\n\n</data>\n\n</openerp>\n\n\nAnyone can shed some light upon this?\n\nThanks in advance!"
] | [
"python",
"xml",
"module",
"openerp"
] |
[
"How to insert all values frow row into mysql database using insert record?",
"Hello i have a problem with my php where only the last value in the rows is inserted in the mysql database:Last value inserted from rows\n\nmysql database only show the last value to be inserted from insert record\n\nI want the three of the data to be inserted not only the last values... How do i do that?\n\nhere is my insert record behavior code:\n\n if ((isset($_POST[\"MM_insert\"])) && ($_POST[\"MM_insert\"] == \"form1\")) {\n $insertSQL = sprintf(\"INSERT INTO ordering (productCode, Name, paymentMethod, Quantity, TotalPrice) VALUES (%s, %s, %s, %s, %s)\",\n GetSQLValueString($_POST['productcode'], \"int\"),\n GetSQLValueString($_POST['Name'], \"text\"),\n GetSQLValueString($_POST['PaymentMethod'], \"text\"),\n GetSQLValueString($_POST['quantity'], \"int\"),\n GetSQLValueString($_POST['totalprice'], \"double\"));\n\n mysql_select_db($database_perfume_connection, $perfume_connection);\n $Result1 = mysql_query($insertSQL, $perfume_connection) or die(mysql_error());\n\n $insertGoTo = \"member_perfume_homepage.php\";\n if (isset($_SERVER['QUERY_STRING'])) {\n $insertGoTo .= (strpos($insertGoTo, '?')) ? \"&\" : \"?\";\n $insertGoTo .= $_SERVER['QUERY_STRING'];\n }\n header(sprintf(\"Location: %s\", $insertGoTo));\n}"
] | [
"php",
"mysql"
] |
[
"How to filter requests in Sinon",
"I am writing unit tests in Jasmine for Backbone application. And of course I use Sinon in my tests. But now I have problem. I am writing tests for Login screen and I need simulate server responce - because server works very bad. Now my code looks:\n\ndescribe('Login', function(){\n it('Should simulate server response', function(){\n server = sinon.fakeServer.create();\n server.respondWith(\"GET\", \"http:\\\\example.com\", [200, {\"Content-Type\": \"application/json\"}, '{\"Body:\"\"asd\"}'])\n })\n $('body').find('button#login').trigger('click');\n server.respond();\n server.restore()\n console.log(server.requests);\n})\n\n\nAnd this code works fine, but I see in console that fakes all requests, but during Login I also have other requests, and I don't need use fake server for them. It is requests for next screen. Maybe exist way to make filter or use fake responds for special requests. Help me please. Thanks."
] | [
"javascript",
"jasmine",
"sinon"
] |
[
"Optimized strcmp implementation",
"This function was found here. It's an implementation of strcmp:\n\nint strcmp(const char* s1, const char* s2)\n{\n while (*s1 && (*s1 == *s2))\n s1++, s2++;\n return *(const unsigned char*)s1 - *(const unsigned char*)s2;\n}\n\n\nI understand all but the last line, in short what is going on in the last line?"
] | [
"c",
"string-comparison",
"strcmp"
] |
[
"Exporting release build - Flex through Intellij Idea",
"How do I generate release build of my Flex Application\nthrough IntelliJ Idea, like I do in Flex Builder?"
] | [
"apache-flex",
"intellij-idea",
"flexbuilder",
"release-builds"
] |
[
"Flurry AppSpot Test Ads Not Appearing on Device",
"I have integrated Flurry AppSpot into my iOS App as per their instructions. This all seems to work fine when I test this on the simulator, all the correct delegate lifecycle methods are called and some test Ads appear in the top banner. However, when I try to run this on a real device (I've tried a few different types) all the correct calls are made and the delegate methods are called, but the Ad doesn't appear. I'm guessing there shouldn't be any distinction between these two modes but can't seem to find any information to confirm this.\n\nHas anyone else tried integrating AppSpot ads and either experienced the same issue or had this working successfully on real devices?"
] | [
"ios",
"flurry"
] |
[
"Hide console when py-file only (no pyw) [ANKI add-on]",
"I am about to adjust the music fiddler add-on for ANKI SRS for windows users. \nAnki ONLY runs add-ons with with ending .py, not pyw. Is there any way to hide the console that automatically pops up when I run the code.\n\nIf not, is there a way no to unselect the console windows (i basically have to click on the main anki windows after every five seconds because the console that as already closed again was in selection).\n\nThe command I use so far for opening windows is for example:\n os.system('\"nircmd.exe changesysvolume\"'+ change)\n\nThe complete code is below\nThe console runs the nircmd.exe and the number of volume units the system sound should change.\nIs there a possibility to adjust the code?\n\n# -*- coding: utf-8 -*-\n# Music-Fiddler (a plugin for Anki)\n# coded by D_Malik, [email protected]\n# Version 1\n# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html\n\n\"\"\"\nA simple plugin that fiddles with music volume to reinforce quick reviewing.\n\nBefore using:\n- This plugin was made for Linux. It will require modification to work on another OS.\n- Ensure that the \"amixer\" command works on your computer. If it doesn't, you're going to need to modify the code somehow. Don't ask me how.//Amixer has been replaced by nircmd.exe for windows\n- Change all lines (in the plugin source) marked with \"CHANGEME\" according to your preferences.\n\"\"\"\n\n import os\nfrom aqt import mw\nfrom aqt.utils import showInfo\nfrom os import system\nfrom aqt.qt import *\nfrom anki.hooks import addHook\n\n def resetMusicTimer():\n \"Boosts volume back up and starts the music timer.\"\n #CHANGEME: The next lines are a python dictionary associating deck names with times (in milliseconds) between volume-decrements.\n #Eg, when using the deck \"brainscience\", volume will decrement every 5 seconds. When using a deck without a listed name, \"other\" is used.\n #Change this according to your decks. Decks with shorter, easier cards need less time.\n deckMusicTimes = {\n \"rocketsurgery\" : 3000,\n \"brainscience\" : 5000,\n \"other\" : 5000,\n }\n if mw.col.decks.current()['name'] in deckMusicTimes:\n mw.musicTimeToDecrement = deckMusicTimes[mw.col.decks.current()['name']]\n else:\n mw.musicTimeToDecrement = deckMusicTimes[\"other\"]\n boostMusicVolume()\n mw.musicTimer = QTimer(mw)\n mw.musicTimer.setSingleShot(True)\n mw.musicTimer.start(mw.musicTimeToDecrement)\n mw.connect(mw.musicTimer, SIGNAL(\"timeout()\"), decrementMusicVolume)\n #showInfo(mw.state)\n\ndef changeMusicVolume(change):\n \"Changes volume according to string; can be either absolute ('40') or change ('2%-').\"\n os.system('\"nircmd.exe changesysvolume\"'+ change) #CHANGEME somehow, if amixer doesn't work \n\ndef boostMusicVolume():\n #showInfo(\"boosted\") #To test changes, you can uncomment this line.\n os.system('\"nircmd.exe changesysvolume 50000\"') #CHANGEME somehow, if amixer doesn't work \n #CHANGEME: Set to however high you want your volume to go each time it's boosted back.\n #Protip: your music-playing program might have its own \"volume multiplier\" that you can adjust easily.\n\ndef killMusicVolume():\n #showInfo(\"killed\") #To test changes, you can uncomment this line.\n os.system('\"nircmd.exe mutesysvolume 1\"') #CHANGEME somehow, if amixer doesn't work \n #CHANGEME: Set to how low volume should go when it dies, eg due to undoing a card.\n\ndef decrementMusicVolume():\n \"When reviewing, decrements volume, then sets a timer to call itself. When not reviewing, kills volume and stops timer.\"\n if mw.state == \"review\":\n #showInfo(\"music volume goes down\") #To test changes, you can uncomment this line.\n os.system('\"nircmd.exe changesysvolume -5000\"') #CHANGEME somehow, if amixer doesn't work \n mw.musicTimer.start(mw.musicTimeToDecrement) #(start the timer again)\n else:\n killMusicVolume()\n mw.musicTimer = None #(kill the timer if you're not reviewing)\n\naddHook(\"showQuestion\", resetMusicTimer)"
] | [
"python",
"windows",
"command-line",
"console",
"anki"
] |
[
"How to use both pman and custom help files in Vim with the viewdoc plugin?",
"When editing PHP files I want to use help files from two sources:\n\n\nvim help files in /etc/vim/bundle/yii-api-vim/doc/ from here.\nPHP man pages with pman\n\n\nIf there's no help available from the help files it should try pman.\n\nThe viewdoc plugin's help claims that\n\n\n You can have several documentation sources for same file type, and choose which one should be used on-the-fly. \n\n\nBut it does not explain, how to do this. The only feature that comes close are handlers for a specific filetype, like ViewDoc_{filetype}(topic, filetype, synid, have_context). But I don't know how to implement such a function.\n\nOpen questions to me are:\n\n\nHow can I check inside that function if a *.txt file exists in my specific directory?\nWhat should I return to let viewdoc open such a help file if it exists?\nWhat should I return to let viewdoc open a pman page for a ordinary PHP function?\n\n\nIt would be helpful to see an example for such a function."
] | [
"vim",
"vim-plugin"
] |
[
"ionic 3 display data from woocommerce rest api",
"im having a hard time displaying the data i got from woocommerce on my ionic 3 app, i have accessed the data successfully and displayed it on console.log the way i wanted, but im not being able to do so in html.\n\nthe data i want to display are the coupons list based on user email address, here is the function i used to display the data in consol log:\n\n coupon: any;\n\n couponz() {\n var data=[];\n for (let co of this.shared.couponz){\n data.push({ code: co.code, coEmail: co.email_restrictions[0], expiry: co.date_expires });\n if (co.email_restrictions[0] == this.shared.customerData.email) {\n this.coupon = co.code\n console.log(co.code)\n }\n }\n }\n\n\nand here is how i got the data in my shared provider:\n\n@Injectable()\nexport class SharedDataProvider {\n\n public couponz;\n\nthis.config.Woocommerce.getAsync(\"coupons/\").then((data) => {\n this.couponz = JSON.parse(data.body);\n});\n\n\nso any idea how to get it displayed in html?\n\nthanks"
] | [
"json",
"ionic-framework",
"ionic3"
] |
[
"PMA error : mbstring is missing",
"I am running on Windows 7 64 bit with:\n\n\nApache 2.2\nPHP 5.2.8\nMySQL 5.1 (essentials)\n\n\ninstalled and configured manually. As you all know, for this since MySQL essentials has no GUI for interaction the best suit is PhpMyAdmin. I am trying to get phpMyAdmin-4.0.10.8-english, downloaded from the PMA website, into my Apache web server. \n\nAfter all configuration work, now I get an error message when I try to log into PMA saying: \n\n\n \"The mbstring extension is missing. Please check your PHP\n configuration.\"\n\n\nIn this forum it was mentioned that possible causes for this are the unavailability of php_mbstring.dll in php folder or else the extension_dir variable in php.ini is set to ./ which is the current folder. \n\nI checked in the ext folder and the .dll file is available and the extension_dir variable is set to ./ext. And I tried setting the variable to C:/php/ext which is the absolute location, still it doesn't work. Any help on this concern would be much appreciated!"
] | [
"php",
"windows",
"phpmyadmin",
"apache2.2",
"mbstring"
] |
[
"Does separate method by argument?",
"Could you give me an opinion which A or B is better?\n\nI sometimes get lost in the definition of method.\n\n# Both returns same value.\n# Only the arguments are difference.\n\n\n# ------------------\n# pattern A\ndef some_method_by_name(name: str):\n record = <SELECT ... WHERE record_name=str>\n return record\n\ndef some_method_by_id(id: int):\n record = <SELECT ... WHERE record_id=id>\n return record\n\n\n# ------------------\n# pattern B\ndef some_method(**kwargs):\n if 'id' in kwargs:\n record = <SELECT ... WHERE record_id=kwargs.get('id')>\n elif 'str' in kwargs:\n record = <SELECT ... WHERE record_name=kwargs.get('str')>\n else:\n raise Exception('wrong!')\n return record\n\n\nI think that 'A' is good because to separate method by arguments is easy to understand, but I think that it is verbose.\n\nThanks."
] | [
"python",
"function",
"methods",
"architecture"
] |
[
"when i compiling eclipse RCP project,I encounter an error; the error is \"No git repository found searching upwards \"",
"when i build eclipse scada project by maven;why git is part of build process;how to remove it from build process;please look at follow error information\n\n[ERROR] Failed to execute goal\norg.eclipse.tycho:tycho-packaging-plugin:0.22.0:build-qualifier\n(default-build-qualifier) on project org.apache.commons.daemon: No git\nrepository found searching upwards from\nK:\\scada\\SourceCode\\org.eclipse.scada.external\\org.apache.commons.daemon\n-> [Help 1]"
] | [
"java",
"eclipse",
"git",
"maven",
"scada"
] |
[
"define and call a method inside CreateElement",
"I am new to reactjs and still learning, I need to define a method and call that method inside the CreateElement in Reactjs. Not sure if that is possible or i might be doing something in wrong way.\n\nI am trying to test a method that has a if-else condition in it based on that a text should be dispayed thought react.\n\nrender: function render() {\n test_method: function test_method(){ // <= if this should be placed here or \n // outside render, Tried placing it outside render with this.\n // but not reading the value of a\n if (this.a == true){\n return a;\n } else {\n return b; \n },\n\n React.createElement(\n 'li',\n null,\n this.test_method\n );\n};"
] | [
"javascript",
"reactjs"
] |
[
"Drawing the histogram using Python",
"I have a matrix A(20374, 1).\nI would like to draw histogram(DVH) using this data.\n\nMy code is as below.\n\nedge_A = np.linespace(0, max(A), 1000)\nx_A = np.linespace(0.5*max(A)/1000, max(A), 1000)\nn_A = np.histogram(A, bins=edge_A)\ny_A = 1 - np.cumsum(n_A / len(A), axis=0)\nplt.figure()\nplt.plot(x_A, y_A)\nplt.show()\n\n\nBut, this code is not work in line of y_A because n_A is tuple and len(A) is int, so this cannot be calculated.\nAlso, I think the line of n_A is not right.\n\nHow can I solve this problem.\n\nI'm attaching the matlab code in this part which runs well.\n\nedge_A = 0:max(A)/1000:max(A);\nx_A = 0.5*max(A)/1000:max(A)/1000:max(A);\nn_A = hiscounts(A, edge_A)\ny_A = 1 - cumsum(n_A/length(A));\nplot(x_A, y_A);"
] | [
"python",
"histogram"
] |
[
"alias_method and class_methods don't mix?",
"I've been trying to tinker with a global Cache module, but I can't figure out why this isn't working.\n\nDoes anyone have any suggestions?\n\nThis is the error:\n\nNameError: undefined method `get' for module `Cache'\n from (irb):21:in `alias_method'\n\n\n... generated by this code:\n\nmodule Cache\n def self.get\n puts \"original\"\n end\nend\n\nmodule Cache\n def self.get_modified\n puts \"New get\"\n end\nend\n\ndef peek_a_boo\n Cache.module_eval do\n # make :get_not_modified\n alias_method :get_not_modified, :get\n alias_method :get, :get_modified\n end\n\n Cache.get\n\n Cache.module_eval do\n alias_method :get, :get_not_modified\n end\nend\n\n# test first round\npeek_a_boo\n\n# test second round\npeek_a_boo"
] | [
"ruby",
"metaprogramming",
"alias-method"
] |
[
"Why is Lua loops slow?",
"Lua is said to be a fast scripting language. But when I tested looping e.g.:\n\na = 0\nwhile a < 1000000000 do\n a = a + 1\nend\n\n\nIt takes a lot of time (over 1 minute). Is it because Lua needs to copy and paste loop's content, and then evaluate?\n\nI know that when evaluating you need to pop() items away from stack.\n\nI tested this \"speed-test\" on Ruby too and it did the loop in about 20s.\n\nEDIT:\nWhy is this so much faster on local variables? (~16 seconds to do same iteration but on local variable inside function)"
] | [
"performance",
"lua"
] |
[
"I tried to put the form data in my show.html page. But it not working. I am using flask_sqlalchemy. I am begginer in flask",
"I want to be able to get the data sent to my Flask app. I've tried accessing request.form but it is an empty string. How do you access request data?\nI want to be able to get the data sent to my Flask app. I've tried accessing request.form but it is an empty string. How do you access request data?\nmy app.py file\nfrom flask import Flask,render_template,request,redirect,url_for\nfrom flask_sqlalchemy import SQLAlchemy\napp=Flask(__name__)\napp.config['SQLALCHEMY_DATABASE_URI']='sqlite:///students.sqlite3'\ndb=SQLAlchemy(app)\nclass students(db.Model):\n id=db.Column('student_id',db.Integer, primary_key=True)\n name=db.Column(db.String(100))\n city=db.Column(db.String(50))\n addr=db.Column(db.String(200))\n pin=db.Column(db.String(10))\ndef __init__(self,name,city,addr,pin):\n self.name=name\n self.city=city\n self.addr=addr\n self.pin=pin\[email protected]('/',methods=['GET','POST'])\ndef show_all():\n return render_template('show.html',students=students.query.all())\[email protected]('/new',methods=['GET','POST'])\ndef new():\n if request.method == 'POST':\n student=students(request.form['name'],request.form['city'],\n request.form['addr'],request.form['pin'])\n db.session.add(student)\n db.session.commit()\n return redirect(url_for('show_all'))\n return render_template('new.html')\n\nif __name__ == "__main__":\n app.run(debug=True)\n\nmy new.html file\n<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Document</title>\n</head>\n<body>\n <form action="/" method="post">\n <input type="text" name="name" placeholder="Your name"><br>\n <input type="text" name="city" placeholder="Your city"><br>\n <input type="text" name="addr" placeholder="your address"><br>\n <input type="text" name="pin" placeholder="your pin"><br>\n <input type="submit" valu='Submit'>\n </form>\n</body>\n</html>\n\nmy show.html file\n<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Document</title>\n</head>\n<body>\n <h3>students <a href="{{url_for('new')}}">Add student</a></h3>\n <table>\n <thead>\n <tr>\n <th>Name</th>\n <th>City</th>\n <th>Addr</th>\n <th>Pin</th>\n </tr>\n </thead>\n <tbody>\n {% for student in students %}\n <tr>\n <td>{{ student.name }}</td>\n <td>{{ student.city }}</td>\n <td>{{ student.addr }}</td>\n <td>{{ student.pin }}</td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n</body>\n</html>"
] | [
"python",
"flask",
"flask-sqlalchemy"
] |
[
"How to unzip a column in the database using PHP",
"I have a KMZ file stored in MySQL as a blob. KMZ file uses PKZIP compression. How can I unzip the file using PHP?"
] | [
"php",
"unzip",
"kmz"
] |
[
"Dom Navigation using Javascript",
"How can i access 3rd Element(H2) starting with the parent element \"id=\"services-list\".\n\nIam currently accessing using the below method.Is there a better way to do apart from the below. Please see i need purely Javascript.\n\nvar z = document.querySelectorAll('section[id=\"services-list\"]');\nz[0].firstElementChild.firstElementChild.firstElementChild.textContent\n\n\n<section id=\"services-list\" class=\"section container \">\n <div class=\"row\">\n <div class=\"col-12 col-md-10 col-lg-6 offset-md-1\">\n <h2 class=\"section__title\">Services</h2>\n </div>\n </div>\n</section>\n\n\nRegards,\nSree"
] | [
"javascript",
"dom"
] |
[
"Python/lxml/Xpath: How do I find the row containing certain text?",
"Given the URL http://www.smartmoney.com/quote/FAST/?story=financials&timewindow=1&opt=YB&isFinprint=1&framework.view=smi_emptyView , how would you capture and print the contents of an entire row of data? \n\nFor example, what would it take to get an output that looked something like:\n\"Cash & Short Term Investments 144,841 169,760 189,252 86,743 57,379\"? Or something like \"Property, Plant & Equipment - Gross 725,104 632,332 571,467 538,805 465,493\"?\n\nI've been introduced to the basics of Xpath through sites http://www.techchorus.net/web-scraping-lxml . However, the Xpath syntax is still largely a mystery to me.\n\nI already have successfully done this in BeautifulSoup. I like the fact that BeautifulSoup doesn't require me to know the structure of the file - it just looks for the element containing the text I search for. Unfortunately, BeautifulSoup is too slow for a script that has to do this THOUSANDS of times. The source code for my task in BeautifulSoup is (with title_input equal to \"Cash & Short Term Investments\"):\n\n page = urllib2.urlopen (url_local)\n soup = BeautifulSoup (page)\n soup_line_item = soup.findAll(text=title_input)[0].parent.parent.parent\n list_output = soup_line_item.findAll('td') # List of elements\n\n\nSo what would the equivalent code in lxml be?\n\nEDIT 1: The URLs were concealed the first time I posted. I have now fixed that.\n\nEDIT 2: I have added my BeautifulSoup-based solution to clarify what I'm trying to do.\n\nEDIT 3: +10 to root for your solution. For the benefit of future developers with the same question, I'm posting here a quick-and-dirty script that worked for me:\n\n #!/usr/bin/env python\n import urllib\n import lxml.html\n\n url = 'balancesheet.html'\n\n result = urllib.urlopen(url)\n html = result.read()\n\n\n doc = lxml.html.document_fromstring(html)\n x = doc.xpath(u'.//th[div[text()=\"Cash & Short Term Investments\"]]/following-sibling::td/text()')\n print x"
] | [
"python",
"xpath",
"python-2.7",
"lxml"
] |
[
"How to apply named range to existing formulas in excel?",
"I introduced some new named ranges into my excel workbook towards the end of a project. However, the existing formulas have not updated i.e. if I had a formula for A1*B1 and I have now names A1="cost" and B1="wages" the formulas do not read 'cost * wages'.\nI am aware that you can use the 'apply names' functionality in excel, but I have quite a few cells that need updating so this would not be the most efficient way of doing things (but happy to if there is no other alternative).\nIf anyone can help with me find a fix it would be much appreciated!"
] | [
"excel",
"vba",
"named"
] |
[
"Synchronizing SourceDataLine with display in Java",
"I'm creating sound visualizer in Java and I can't find a proper way to synchronize playing sound and displaying the soundwave.\n\nnote: snippets below are just sketches, but I actually tried them all\n\nApproaches I tried:\n\n\nUsing the fact that SourceDataLine.write() blocks until there's space in data line's buffer. That results in buffer always being nearly full and each sample actually being played after having whole buffer flushed. And that means half a second delay.\n\ntry (SourceDataLine sdl = AudioSystem.getSourceDataLine(someFormat)) {\n sdl.open(someFormat);\n sdl.start();\n\n while(true) {\n byte[] samples = getSamplesSomehow();\n sdl.write(samples, 0, samples.length); // <-- blocks\n displaySamples(samples);\n }\n}\n\nEnqueuing data to draw and dequeuing it after whole buffer flushed (frame position increased by buffer size or more). This just didn't work, I'm not sure why.\n\nQueue<Data> queue = new LinkedList<Data>();\ntry (SourceDataLine sdl = AudioSystem.getSourceDataLine(someFormat)) {\n sdl.open(someFormat);\n sdl.start();\n\n while(true) {\n int position = sdl.getFramePosition();\n byte[] samples = getSamplesSomehow();\n Data data = new Data(position, samples); // <-- java bean\n\n // display\n if (queue.size > 0 && queue.peek().getPosition() < position - sdl.getBufferSize()) {\n byte[] samplesToDisplay = queue.remove().getSamples();\n displaySamples(samplesToDisplay);\n }\n\n // push new data\n queue.add(data);\n sdl.write(samples, 0, samples.length);\n }\n}\n\nWaiting for buffer to be nearly empty. This works perfectly but introduces busy waiting, CPU usage increases 5 times.\n\ntry (SourceDataLine sdl = AudioSystem.getSourceDataLine(someFormat)) {\n sdl.open(someFormat);\n sdl.start();\n\n while(true) {\n byte[] samples = getSamplesSomehow();\n while(sdl.getBufferSize() - sdl.available() >= data.length); // <-- busy waiting\n sdl.write(samples, 0, samples.length); // <-- doesn't get a chance to block\n displaySamples(samples);\n }\n}\n\n\n\nWhat is common approach to this problem?"
] | [
"java",
"multithreading",
"javasound"
] |
[
"partial class naming for asp.net web form default template",
"My company has visual studio asp.net web site projects. When adding a new web form using the default webform template it will automatically create the codefile with the partial class name using the path and the filename you selected. For example, if you added a new web form named Default.aspx to the path User/Feature/ the partial class name will be User_Feature_Default. This works fine. The issue (which may not be an issue) is that of course if you move those files around it will not update the partial class name. Makes sense. Visual Studio is only going to do so much tweaking. My question is whether or not our development group should update these partial class names when the files are moved into new folders mainly for consistancy sake? Will this cause any other problems? I can't think of any."
] | [
"asp.net"
] |
[
"Lottie Animation in fabricjs canvas",
"Is it possible to load the Lottie animation in fabricjs canvas\n\nI have tried the following samples \n\n bodymovin.loadAnimation({\n wrapper: animateElement, // div element\n loop: true,\n animType: 'canvas', // fabricjs canvas\n animationData: dataValue, // AE json\n rendererSettings: {\n scaleMode: 'noScale',\n clearCanvas: true, \n progressiveLoad: false, \n hideOnTransparent: true,\n }\n });\ncanvas.add(bodymovin);\ncanvas.renderAll();\n\n\nI cant able to add the animation in the fabric js canvas. if any one overcome this issue kindly do comments on it"
] | [
"fabricjs",
"lottie",
"bodymovin"
] |
[
"What's the purpose of giving unreadable CSS class names in Whatsapp web?",
"I'm curious what are the benefits of giving unreadable CSS class names for example in WhatsApp Web?\nThis is a piece of code from an HTML document from https://web.whatsapp.com/"
] | [
"css",
"whatsapp"
] |
[
"Layout not disappearing completely when using coordinator Layout in fragment",
"I'm trying to use a coordinator layout and an AppBarLayout inside a fragment. My goal is to have a header than can be hidden when scrolling but to keep the title bar which is inside the activity and is necessary for other fragments.\n\nMy issue is that, when I scroll down, the header is not completely hidden. There a part that has status bar height that remains visible. I don't know how to make it completely disappear.\n\nHere are some scrren capture to make it more understandable:\n\nheader fully displayed\n\nscrolled down\n\nHere is the layout xml:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:fitsSystemWindows=\"true\">\n\n <android.support.design.widget.AppBarLayout\n android:id=\"@+id/appbar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"@android:color/holo_blue_dark\"\n android:fitsSystemWindows=\"true\">\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:orientation=\"vertical\"\n app:contentScrim=\"?attr/colorPrimary\"\n app:expandedTitleMarginStart=\"@dimen/general_padding\"\n app:layout_scrollFlags=\"scroll|exitUntilCollapsed\"\n app:layout_behavior=\"@string/appbar_scrolling_view_behavior\"\n android:fitsSystemWindows=\"true\">\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"25dp\"\n android:layout_marginTop=\"100dp\"\n android:layout_margin=\"@dimen/general_padding\"\n android:background=\"@android:color/holo_green_light\"\n android:orientation=\"vertical\">\n </LinearLayout>\n\n </LinearLayout>\n\n <android.support.design.widget.TabLayout\n android:id=\"@+id/tabs\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n app:tabMode=\"fixed\"\n app:tabGravity=\"fill\"/>\n\n </android.support.design.widget.AppBarLayout>\n\n <android.support.v4.view.ViewPager\n android:id=\"@+id/viewpager\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n app:layout_behavior=\"@string/appbar_scrolling_view_behavior\"/>\n\n</android.support.design.widget.CoordinatorLayout>\n\n\nAnd the onCreateView() method from the fragment which uses this layout:\n\n@Override\npublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\n View view = inflater.inflate(R.layout.fragment_tabs, container, false);\n mUnbinder = ButterKnife.bind(this, view);\n\n mTabsPresenter.subscribe(this);\n\n TabsPagerAdapter adapter = new TabsPagerAdapter(getChildFragmentManager());\n mPager.setAdapter(adapter);\n mTabs.setupWithViewPager(mPager);\n mTabs.getTabAt(0).setText(\"_Maintenance\");\n mTabs.getTabAt(1).setText(\"_History\");\n mTabs.getTabAt(2).setText(\"_Costs\");\n\n setHasOptionsMenu(true);\n\n return view;\n}\n\n\nCan someone help me with this issue ?\n\nThank you"
] | [
"android",
"android-fragments",
"android-viewpager",
"android-toolbar",
"android-coordinatorlayout"
] |
[
"Steam Web Api Authenticate HTTP Request Error",
"I am game developer with unity and socket.io.\nI want to use Steam API in order to check that client have ownership of my game.\nI want use Steam Web API. So I send test request like this\nbecause I don't know the format of response.\n\nhttps://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/\n?key=6**********&appid=22****&ticket=14000C9763018BF35*****\n\n\nand I got error like this.\n\n{\n \"response\": {\n \"error\": {\n \"errorcode\": 3,\n \"errordesc\": \"Invalid parameter\"\n }\n }\n}\n\n\nI can't find why the parameter is wrong.\nI tried all day for finding this error but i couldn't ㅠㅠ"
] | [
"socket.io",
"steam",
"steam-web-api",
"steamworks-api"
] |
[
"Ajax to load table data",
"Request your help, as the below line of code if not loading the data into the table when i choose the related radio button, not sure what is wrong nor missing, if there is any alternate way other then this please do let me know.\n\nCode\n\n<div>\n<label class=\"form-check-label><input type=\"radio\" class=\"form-check-input\" name=\"Gender\" value=\"M\" checked>Male</label>\n<label class=\"form-check-label><input type=\"radio\" class=\"form-check-input\" name=\"Gender\" value=\"F\" checked>Female</label>\n</div>\n<div class=\"row\" id=\"Dbackup\">\n<table id=\"Backup\">\n<thead>\n<tr>\n<th>Name</th><th>Gender</th>\n</tr>\n</thead>\n<tbody>\n<tr><td>xxxx<</td><td>Male</td></tr>\n.\n.\n<tr><td>xxxx<</td><td>Female</td></tr>\n</tbody>\n</table>\n</div>\n\n**Ajax script**\n<script type=\"text/javascript\">\n$(document).ready(function(){\n$(\"input[type='radio']\").on('click', function(){\n var radioValue = $(\"input[name='Gender']:checked\").val();\n $.ajax({\n url: \"/gdata/\" + radioValue,\n method: \"GET\",\n data:{rvalue:radioValue},\n success: function(data){\n $('#Backup').load(data);\n }\n });\n});\n});\n</script>\n\n\nFrom,\nVino"
] | [
"ajax",
"load"
] |
[
"Online calculation for Pandas' exponential moving average",
"Generally, we calculate exponential moving averages as the following:\n\ny_t = (1 - alpha) * y_tminus1 + alpha * x_t\n\n\nwhere alpha is the alpha specified for the exponential moving average, y_t is the resulting moving average, and x_t is the new inputted data.\n\nThis seems to be confirmed in the methodology behind Pandas' implementation of the exponentially weighted moving average as well.\n\nSo I wrote an online algorithm for calculating the exponentially weighted moving average of a dataset:\n\ndef update_stats_exp(new, mean):\n mean = (1 - ALPHA) * mean + ALPHA* new\n return mean\n\nHowever, this returns a different moving average compared to that of Pandas' implementation, called by the following two lines of code:\n\nexponential_window = df['price'].ewm(alpha=ALPHA, min_periods=LOOKBACK, \n adjust=False, ignore_na=True)\ndf['exp_ma'] = exponential_window.mean()\n\nIn both of the above pieces of code, I kept ALPHA the same, yet they resulted in different moving averages, even though the documentation that Pandas provided on exponentially weighted windows seems to match the methodology I had in mind. \n\nCan someone elucidate the differences between the online function I've provided for calculating moving average and Pandas' implementation for the same thing? Also, is there an easy way of formulating Pandas' implementation into an online algorithm? \n\nThanks so much!"
] | [
"python",
"pandas",
"exponential",
"moving-average"
] |
[
"Docker swarm: guarantee high availability after restart",
"I have an issue using Docker swarm.\n\nI have 3 replicas of a Python web service running on Gunicorn.\n\nThe issue is that when I restart the swarm service after a software update, an old running service is killed, then a new one is created and started. But in the short period of time when the old service is already killed, and the new one didn't fully start yet, network messages are already routed to the new instance that isn't ready yet, resulting in 502 bad gateway errors (I proxy to the service from nginx).\n\nI use --update-parallelism 1 --update-delay 10s options, but this doesn't eliminate the issue, only slightly reduces chances of getting the 502 error (because there are always at least 2 services running, even if one of them might be still starting up)."
] | [
"docker",
"docker-swarm"
] |
[
"How to implement selection of Nodes in JavaFX",
"I am very new JavaFX, started learning it yesterday. Spent the whole day reading through the documentation, but learned nothing...\n\nHere is what I want to do, make a simple JavaFX application that creates a circle. On click its stroke turns orange (some color). On unlicked (click on anything other than that circle), the stroke turns (some color) white.\n\nHere is my pseudo code what I have so far. I want to make a separate class that creates a circle and handle the events (important).\n\npublic class Something extends Application {\n\n @Override\n public void start(Stage primaryStage) {\n MyCircle c1 = new MyCircle();\n c1.setCircle(20, 0, 0);\n\n TilePane root = new TilePane();\n root.getChildren().add(c1.getCircle());\n //Some kind of mouse event listener, not sure which one should be\n c1.getCircle().addEventListener(); //pseudo code\n\n Scene scene = new Scene(root, 400, 400);\n\n primaryStage.setTitle(\"Circle\");\n primaryStage.setScene(scene);\n primaryStage.show();\n }\n\n public static void main(String[] args) {\n launch(args);\n }\n\n}\n\n\nThis the class that should create a circle and handle all the events, such as, mouse click, mouse location, click and drag and stuff like that.\n\npublic class MyCircle implements EventHandler{\n Circle circle = new Circle();\n\n public void setCircle(int radius, int x, int y){\n circle.setRadius(radius);\n position(x,y);\n circle.setStrokeWidth(3);\n circle.setStroke(Color.valueOf(\"white\"));\n }\n\n public Circle getCircle(){\n return circle;\n }\n\n public void position(int x, int y){\n circle.setTranslateX(x);\n circle.setTranslateY(y);\n }\n\n public void selected(){\n circle.setStroke(Color.valueOf(\"orange\"));\n }\n\n public void unselected() {\n circle.setStroke(Color.valueOf(\"white\"));\n }\n\n @Override\n public void handle(Event event) {\n if (event == MOUSE_CLICKED){ //pseudo code\n selected();\n }\n else if(event == MOUSE_UNCLICKED){ //pseudo code\n unselected();\n }\n }\n}\n\n\nSince I am very new to JavaFX, I'd much appreciate explanation as well. Thanks!\n\n\n\nEDIT: This is my pseudo code, and I want to convert it into an actual working code. I am not sure how would I do that. Any help would be appreciated.\n\n\n\nANOTHER EDIT: Everything is a code except 3 marked places. Please look for my comment Psuedo Code within the code, where I need help to change the pseudo code into an actual code."
] | [
"java",
"javafx",
"event-listener"
] |
[
"Storing specific data types in hashmap",
"I have to use a map which stores keys of type Integer, String and Long only.\nOne solution: To store type Object and in put method check with instanceof operator. Is there any better solution, maybe with enum"
] | [
"java"
] |
[
"Angular 5 Dynamic template in MatDialog",
"in my component I open a MatDialog and pass data to it. In my object data.obj is under this.data.obj.html html-code stored.\n\nIn electron I would use a webview to display the html-site.\n\nHow do I display the html-code in proper way in my MatDialog in angular 5? Its possible to create the template dynamically or is there any smoother way?\n\n@Component({\n selector: 'dialog-popup',\n template:`\n <h1 mat-dialog-title>Content-HTML</h1>\n <mat-dialog-content>\n {{this.data.obj.html}}\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button>Complain</button>\n <button mat-button (click)=onNoClick()>Cancel</button>\n </mat-dialog-actions>\n`\n})\nexport class DialogOverview {\n\n constructor(\n public dialogRef: MatDialogRef<DialogOverview>,\n @Inject(MAT_DIALOG_DATA) public data: any) { }\n\n ngOnInit() {\n console.log(this.data.obj.html);\n }\n onNoClick(): void {\n\n this.dialogRef.close();\n }\n\n}"
] | [
"javascript",
"html",
"angularjs"
] |
[
"Closing application only thru VBA",
"I have this workbook and I want to make it look like a program.\nI also want people using it to only be able to quit the application thru a specific command button.\n\nHere is the code I have\n\nPrivate Sub Workbook_BeforeClose(Cancel As Boolean)\nApplication.OnKey \"{ESC}\"\nCancel = True\nMsgBox \"Please use the QUIT button to save and close the database.\"\nEnd Sub\n\n\nAnd for the quit button:\n\nSub SAVE_CLOSE\nActiveWorkbook.Save\nIf Workbooks.Count < 2 Then\nApplication.Quit\nElse\nActiveWorkbook.Close\nEnd If\nEnd Sub\n\n\nMy problem is that when the user quit the application thru this button, it triggers the Private Sub Workbook_BeforeClose event and cancel the quitting process. How would you fix this?\n\nThanks!"
] | [
"excel",
"vba",
"exit"
] |
[
"BootStrap - DropDown",
"I'm trying to call the basic drop-down function that bootstrap offer, I hooked up a js function, setup links to the js. Tried non js everything doesn't work this is as close as I've got and its still a no go. This is my list - \n\n <div class=\"nav-collapse collapse\">\n <ul class=\"nav\">\n <li class=\"active\"><a href=\"index.html\">Home</a></li>\n <li class=\"dropdown\" id=\"accountmenu\"> \n <a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">Tutorials<b class=\"caret\"></b></a> \n <ul class=\"dropdown-menu\"> \n <li><a href=\"#\">PHP</a></li> \n <li><a href=\"#\">MySQL</a></li> \n <li class=\"divider\"></li> \n <li><a href=\"#\">JavaScript</a></li> \n <li><a href=\"#\">HTML5</a></li> \n </ul> \n </li> \n <li><a href=\"#contact\">News</a></li>\n <li><a href=\"http://MapleEdge.paycraft.co\">Shop</a></li>\n <li><a href=\"contact.html\">Contact</a></li>\n </ul>\n </div><!--/.nav-collapse -->> Blockquote\n\n\nSo it should just work with all the js hooked up but it doesn't you can see the live site here - http://www.epic-pvp.com/\n\nthanks so much I've tried everything!"
] | [
"html",
"css",
"twitter-bootstrap"
] |
[
"Loading an Excel file (with variable # of columns) into database using SSIS",
"I need to do a routine import of an Excel file. The problem is the columns of the Excel is not fixed. For example one month if can be:\n\nfirst_name last_name question_are_you_happy question_how_old_are_you\nJohn Smith no 32\nJane Doe yes 11\n\n\nNext month it can be\n\nfirst_name last_name question_favorite_color \nJohn Smith blue \nJane Doe red \n\n\nEvery Excel will have common columns such as first_name and last_name, however the other \"question\" column can be different. My goal is to load the data into a database table such that it looks like:\n\nfirst_name last_name question answer\nJohn Smith are_you_happy no\nJohn Smith how_old_are_you 32\nJohn Smith favorite_color blue\nJane Doe are_you_happy yes \nJane Doe how_old_are_you 11\nJane Doe favorite_color red\n\n\nI know in SSIS there is an unpivot transformation, however it seems that it cannot work with variable amount of columns? The problem is my source has different # of column with different name."
] | [
"sql-server",
"excel",
"ssis"
] |
[
"Handling DB connections and Env config in DDD (clean/hexagonal) architecture",
"While I grasped the general idea, I'm having trouble seeing the best practice for managing config envs and managing the DB connection.\n\nMeaning:\n\n\nIf I have the repository (for PostgreSQL for example), should I pass the NewRepository function the DB configuration? Will it not somehow adversely affect the architecture principles (maintenance, testability, etc.)?\nHow do we handle things like defer db.Close()?\n\nI mean, we'd obviously want it to defer in relation to the scope main function, so it's problematic to move that code into the Repository \"class\" (unless there's a way to do that with Context?)\n\nOn the other hand, calling NewRepository in main scope but then having the db handle the connection outside of it feels kind of strange.\n\nMost of the examples I've found used the main function so it was easy. The question is how do you that correctly when employing the DDD (clean/hexagonal) architecture ? especially so that all the pieces would be \"pluggable\" without having to change the code \"around it\".\n\n\nHere is an example I put together, is there a violation of some principles of the ddd pattern here? or is it actually how these things are done?\n\n1. Shouldn't I handle the defer db.Close() inside the repository itself? maybe with Context I can defer it in relation to the main function scope but inside the repository itself?\n\n2. Should I really pass the config into the NewRepository ?\n\npkg/main.go :\n\nfunc main() {\n\n // get configuration stucts via .env file\n configuration, err := config.NewConfig()\n if err != nil {\n panic(err)\n }\n\n postgresRepo, err := postgres.NewRepository(configuration.Database)\n\n defer postgresRepo.DB.Close()\n\n\n myService := autocomplete.NewService(postgresRepo)\n\n handler := rest.NewHandler(myService)\n\n ...\n ...\n ...\n\n}\n\n\npkg/config/config.go: \n\n// Config is a struct that contains configuration variables\ntype Config struct {\n Environment string\n Port string\n Database *Database\n}\n\n// Database is a struct that contains DB's configuration variables\ntype Database struct {\n Host string\n Port string\n User string\n DB string\n Password string\n}\n\n// NewConfig creates a new Config struct\nfunc NewConfig() (*Config, error) {\n env.CheckDotEnv()\n port := env.MustGet(\"PORT\")\n // set default PORT if missing\n if port == \"\" {\n port = \"3000\"\n }\n return &Config{\n Environment: env.MustGet(\"ENV\"),\n Port: port,\n Database: &Database{\n Host: env.MustGet(\"DATABASE_HOST\"),\n Port: env.MustGet(\"DATABASE_PORT\"),\n User: env.MustGet(\"DATABASE_USER\"),\n DB: env.MustGet(\"DATABASE_DB\"),\n Password: env.MustGet(\"DATABASE_PASSWORD\"),\n },\n }, nil\n}"
] | [
"go",
"database-design",
"architecture",
"domain-driven-design"
] |
[
"How to see C# Nuget Package's source code on Visual Studio Code?",
"Is there any way to see a Nuget Package's source code when we choose \"Go to Definition\" (or F12 or CRTL+click)?\nAt this time, I click (CRTL+click) on some class from Nuget Package in my code and the vscode shows me an assembly summary [metadata], where I can see only docs and methods signature.\nI'd like to see all the source code from this class. \nIs there some extension I need to install or I misunderstood some config?"
] | [
"visual-studio-code",
"nuget"
] |
[
"Uppy doesn't appear on the screen in rails app",
"I'm trying to do a very simple app just to test the Uppy file uploader. I've followed the Uppy's documentation, but it just worked with the library links (CDN).\n\nI've already tried npm install @uppy/core (and the same command for the additional plugins). I've already tried to put the code inside my coffee file (I'm using ruby on rails). And other things too, but no results.\n\nHere's my code: \n\nimport '@uppy/core/dist/style.css'\nimport '@uppy/dashboard/dist/style.css'\n\nUppy = require('uppy/lib/core')\n\nDashboard = require('uppy/lib/plugins/Dashboard')\n\nuppy = Uppy({ autoProceed: false })\n\nuppy.use(Dashboard, { target: '#drag-drop-area', inline: true })\n\n\nThis is actually throwing no errors, just doesn't appear on the screen."
] | [
"javascript",
"ruby"
] |
[
"Google Map with Default direction",
"In my site I've already implemented Google Map Direction API Version-3. With this I can show the direction between places by choosing from the selectbox.\n\nNow I want to implement another map which will load initially with the directions I have given. Also with point to point direction. I want to print the map with the map and the directions. But I cannot load the map with directions when the page loads. Anyone have any idea?"
] | [
"google-maps",
"google-maps-api-3"
] |
[
"Enable and restarting crontab in Ansible",
"I have a laravel cron that I would like to run/ restart each time container is deployed or restarted, but I cant make the service run in Ansible 2.9 . Running it manually inside the conatiner works fine.\n - name: run the scheduled commands a specific file\n shell: docker exec -it project_1 service cron restart\n\nBut ansible is complaining with the error\n cron start", "delta": "0:00:00.086710", "end": "2020-11-20 \n 14:32:47.259508", "msg": "non-zero return code", "rc": 1, "start": \n "2020-11-20 14:32:47.172798", "stderr": "Got permission denied \n while trying to connect to the Docker daemon socket at \n unix:///var/run/docker.sock: Get \n http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/project_1/json: \n dial unix /var/run/docker.sock: connect: permission denied", \n "stderr_lines": ["Got permission denied while trying to connect to \n the Docker daemon socket at unix:///var/run/docker.sock: \n dial unix /var/run/docker.sock: connect: permission denied"], \n "stdout": "", "stdout_lines": []}\n\nAnd my crontab looks like this\n * * * * * root . /root/.profile; /usr/local/bin/php /opt/app/public/../artisan schedule:run >> /dev/null 2>&1\n\nI know its a permission issue, I donthave the idea how because the /var/run/docker.sock only created once the cron command is being called. I also tried to set the permission in Dockerfile by adding\n RUN sudo chmod 666 /var/run/socket.sock \n\nBut it gives me error as the file doesnt exist yet\nIts working actually if I run manually inside the container\n service cron restart\n\nAny ideas?"
] | [
"ansible"
] |
[
"Getting the sum of a datediff result",
"I have a SQL statement (MS SQL Server 2005) that does a simple calculation of the differences in dates on a few records. I want to return the total/sum of the DATEDIFFs too.\n\nSELECT (DATEDIFF(day, StartDate, EndDate)+1) AS myTotal\nFROM myTable\nWHERE (Reason = '77000005471247')\n\n\nHow do I get the SUM from myTotal? That is all I want to return.\n\nThanks in advance"
] | [
"sql",
"sql-server",
"sql-server-2005"
] |
[
"Access text box to display date",
"I have a database to track user errors which includes a field for the date the error occurred, titled originally enough \"error date\". \n\nOn the main form when the database opens I would like to add a text box or some other box type that would display the oldest error date, and update automatically if a new entry is added with an older date. \n\nSo for example among the records currently in the database the oldest error date is 10/24/2016. So would want it to display that. If I add a new record with an error date of 10/15/2016, I would want the box to update and start displaying 10/15/2016. \n\nAny way to do this?"
] | [
"ms-access"
] |
[
"What does \"implements\" do on a class?",
"If a class implements another class... what does that mean? I found this code sample: http://www.java2s.com/Code/Php/Class/extendsandimplement.htm\n\nBut unfortunately it doesn't have any explanation with it..."
] | [
"java",
"php"
] |
[
"Send email with attachments in PHP?",
"How can I send emails with attachments with a PHP script?"
] | [
"php",
"email"
] |
[
"Let Bindings Type Inference",
"I have the following code in F#:\n\nlet value = NSUserDefaults.StandardUserDefaults.StringForKey(\"type\")\nif value <> null then \n //we know type is not null\n\n\nHere I do not specify a type for value. However, since F# is a statically typed language, the compiler must deduce an exact type for each construct during compilation. In this particular case, value is either null or a String. How does the compiler handle this? What is the type assigned to value at runtime?"
] | [
".net",
"types",
"f#"
] |
[
"sdist/bdist_wheel not including pyc in Linux but is included in Windows",
"I am trying to create a Python distribution where I have to include both the source and the compiled binary. (Yes, I read arguments against/for adding .pyc, but my use case requires the .pyc to be added). Running my steps in Windows, both the source and compiled binaries are added in the output file (I used both sdist and bdist_wheel).\n\nSay I have the following structure:\n\nroot\n+--folderA\n +--alpha\n +--beta\n +--__init__.py\n+--folderB\n\n\nfolderA contains source codes while folderB contains other files within its subdirectories.\n\nSteps done:\n\n\nModules are compiled using compileall\nSources in alpha are removed. Sources in beta are kept.\nRun python setup.py sdist|bdist_wheel\n\n\nI used find_packages() in setup.py to detect the modules. Modules in alpha are not detected while those in beta are found.\n\nIn the results .tgz and .whl files in Windows, all the needed files are there. All is good.\n\nHowever, when the same procedure is done in Linux (Ubuntu to be specific), only the modules in beta are added and some modules in folderB but not other files of different type and the module alpha. sdist will give only the source while bdist and bdist_wheel will give the .pycs only. I understand that sdist is for distributing source files while bdist is for binary files.\n\nMy question is why is the behavior different in Windows and is it possible to produce the same output in Linux (source and .pyc along with other files)?\n\nI am using Python 2.7."
] | [
"python",
"linux",
"setuptools",
"python-wheel",
"sdist"
] |
[
"Fetch data from database in codeigniter",
"I have 2 cases where i am fetching the entire data and total number of rows of a same table in codeigniter, I wish to know that is there a way through which i can fetch total number of rows, entire data and 3 latest inserted records from the same table through one code\n\n\n Controller code for both cases is as given below (although i am applying it for each case seperately with different parameters)\n\n\npublic function dashboard()\n {\n $data['instant_req'] = $this->admin_model->getreq();\n $this->load->view('admin/dashboard',$data);\n }\n\n\n1) to fetch the entire data from a table in codeigniter\n\nModel Code\n\npublic function getreq()\n {\n $this->db->where('status','pending');\n $query=$this->db->get('instanthire');\n return $query->result();\n }\n\n\nView Code\n\nforeach ($instant_req as $perreq) \n {\n echo $perreq->fullname;\n echo \"<br>\";\n }\n\n\n2) to fetch number of rows from a table in codeigniter\n\npublic function getreq()\n {\n $this->db->where('status','pending');\n $query=$this->db->get('instanthire');\n return $query->num_rows();\n }\n\n\nView Code\n\necho $instant_req;"
] | [
"php",
"mysql",
"codeigniter"
] |
[
"Why is my ASCII char to int conversion failing?",
"According to the chart here:\n\nhttp://www.idautomation.com/barcode-faq/code-128/\n\nThis character:\n\nË\n\n\nequates to the value 103.\n\nYet this code:\n\nstring barcode = textBoxRawCode128.Text.Trim(); \n. . .\nint runningTotal = ConvertToASCIIInt(barCode[0]);\n. . .\n\nprivate int ConvertToASCIIInt(char valToConvertToASCII)\n{\n const int ASCII_ADJUSTMENT_VAL = 32;\n return valToConvertToASCII - ASCII_ADJUSTMENT_VAL;\n}\n\n\n...when the value in the textbox and thus of barcode is \"ËTry another string.\", thus where barcode[0] is \"Ë\", returns a value of 171 instead of 103...???\n\nAnd according to this chart: http://www.adams1.com/128table.html, the value corresponding to 103 is ‡, but when I set barCode to \"‡Try another string.\", the returned value is 8193...??? Curiouser and curiouser...\n\nNote: A related/preliminary post is Is this code for calculating Code128 barcode check digits correct?"
] | [
"c#",
"barcode",
"checksum",
"code128",
"check-digit"
] |
[
"Dragging a bone system element in Flash",
"I thought I had a really simple task to do: Create an analog clock where student could set the time by moving the hours and minutes handles.\n\nWell, the whole thing works to a point... I have created a bone system to ensure that both handles bases stay put in the center of the clock while the handles get dragged about. The problem is that I cannot restrict the user movement within the \"reach\" of each handle (or is there?) and if the mouse happens to be OUTSIDE of the dragged handle at drop point, the MOUSE_UP event does not trigger.\n\nI have also looked for a MovieClipModified event which would work wonders in this case but I could not find it...\n\nIs there a way to get out of this?\n\nTIA"
] | [
"flash",
"actionscript-3"
] |
[
"Cannot access f:selectItems variable for passthrough attribute",
"I am using JSF 2.2 and I want to display a title attribute on each option element generated by h:selectOneMenu with passthrough by using an attribute of the f:selectItems variable. \n\nIt seems that I cannot access the f:selectItems variable to customize my passthrough attribute\n\nHere is what I have done so far\n\nMy entity to display\n\npublic class ItemBean {\n private int id;\n private String strName;\n private String strDescription;\n\n public ItemBean(int id, String strName, String strDescription) {\n this.id = id;\n this.strName = strName;\n this.strDescription = strDescription;\n }\n\n // Getters and Setters\n}\n\n\nMy backbean method to retrieve the list of entities\n\npublic List<ItemBean> getItems() {\n return new ArrayList<ItemBean>(){\n {\n add(new ItemBean(1, \"Java\", \"Java programming language\"));\n add(new ItemBean(2, \"PHP\", \"Yet another language\"));\n add(new ItemBean(3, \"Python\", \"Not a snake at all\"));\n }\n };\n}\n\n\nMy h:selectOneMenu in the view\n\n<h:selectOneMenu>\n <f:selectItems value=\"#{bean.items}\" var=\"item\"\n itemValue=\"#{item.id}\"\n itemLabel=\"#{item.strName}\"\n p:title=\"Description : #{item.strDescription}\"/>\n</h:selectOneMenu>\n\n\nThe problem is that I cannot access the item variable for p:title, the output is just empty there.\n\nHere is the code generated\n\n<select>\n <option title=\"Description : \" value=\"1\">Java</option>\n <option title=\"Description : \" value=\"2\">PHP</option>\n <option title=\"Description : \" value=\"3\">Python</option>\n</select>\n\n\nIs it possible to do it like that or is there another way ?"
] | [
"jsf",
"selectonemenu",
"passthrough-elements"
] |
[
"JQuery .load() Not Showing Images",
"I've been trying to figure out for hours on how to make JQuery's .load() work. Here is the full code - it is an external JS file:\n\n$(document).ready(function() {\n $(\".loader a\").hide();\n $(\".loader a\").find(\"img\").on(\"load\", function() {\n $(this).closest(\".loader a\").fadeIn(\"normal\");\n });\n);\n\n\n$(\".loader a\").hide(); works but the rest don't - the images don't show up and they still remain hidden. It is unlikely the cause but do you think it has something to do with the PHP-JSON code? I don't know. Hope you guys can help. Cheers!\n\n<?php\n $str_data = file_get_contents(\"portfolio/portfolio.json\");\n $json = json_decode($str_data, true);\n shuffle($json['portfolio']);\n\n foreach ($json['portfolio'] as $portfolio) {\n echo \"<div class='col-lg-3 col-md-4 col-xs-12 thumbnail portfolio-thumb'>\";\n echo \"<div class='portfolio-thumb-img'>\";\n echo \"<div class=\\\"loader\\\"><a href=\\\"\", $portfolio[\"url\"], \"\\\"><img src=\\\"\", $portfolio[\"main_image_url\"], \"\\\"></a></div>\";\n echo \"<h3>\", $portfolio[\"title\"], \"</h3>\";\n echo \"<p>\", $portfolio[\"category\"], \"</p>\";\n echo '</div>';\n echo '</div>';\n }\n?>\n\n\nThat above code is a PHP include file and it is going to be merged with the header.php and footer.php."
] | [
"javascript",
"php",
"jquery",
"json"
] |
[
"entry_points does not create custom scripts with pip, only with easy_install in Python",
"I'm packaging a script for the first time in python. It can be used both as a module, and an executable so I found out I could use\n\nentry_points = {\n 'console_scripts': [\n 'myscript = myscript:main',\n ],\n}\n\n\nin my setup.py to automatically generate a script in the user's python-x.x.x/bin directory. \n\nMy python script ends with\n\nif __name__ == '__main__': main()\n\n\nwhere main() parses command-line input.\n\nI packaged this using the command:\n\npython setup.py sdist\n\n\nand then tested the distribution as:\n\neasy_install dist/myscript-0.3.2.tar.gz\n\n\nThis puts a myscript executable in my python-2.7.5/bin as expected. \n\nBut this doesn't:\n\npip install dist/myscript-0.3.2.tar.gz\n\n\nAny ideas why? My directory tree looks like:\n\nRoot/\n|-- MANIFEST.in\n|-- README.rst\n|-- dist\n| `-- myscript-0.3.2.tar.gz\n|-- myscript.egg-info\n| |-- ...\n|-- myscript.py\n|-- setup.cfg\n|-- setup.py\n`-- test\n |-- ...\n\n\nand my setup.py roughly looks like:\n\nimport os\n\nfrom setuptools import setup\n\ndef read(*paths):\n \"\"\"Build a file path from *paths* and return the contents.\"\"\"\n with open(os.path.join(*paths), 'r') as f:\n return f.read()\n\nsetup(\n name='myscript',\n version='0.3.2',\n description='bla',\n long_description=(read('README.rst')),\n url='http://url',\n license='LGPL',\n author='Me',\n author_email='[email protected]',\n py_modules=['myscript'],\n include_package_data=True,\n classifiers=[\n 'Development Status :: 5 - Production/Stable',\n 'Intended Audience :: Developers',\n 'Natural Language :: English',\n 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.7',\n 'Topic :: Software Development :: Libraries :: Python Modules',\n ],\n install_requires=['Texttable'],\n entry_points = {\n 'console_scripts': [\n 'myscript = myscript:main',\n ],\n }\n)"
] | [
"python",
"python-2.7",
"pip",
"setuptools",
"easy-install"
] |
[
"when to register to model events in backbone.js?",
"In my backbone.js app I need to update a specific view field when a model changes. For example:\n\nthis.model.bind(\"change:name\", function() {\n $(\"#name\", this.el).text(this.model.get(\"name\"))\n})\n\n\nwhere should I put this code? If I put it in the initialize() then maybe the event is called before render() is. This seems a little dirty. In particular I may need the event to update UI elements that are only created in render.\n\nIf I put this code in render() then this seems again not appropriate. For example, I may call render() a few times but this logic should only be registered once."
] | [
"javascript",
"backbone.js"
] |
[
"Knockout Create Temporary Variable inside foreach",
"How create temporary variable inside foreach loop...\n\n<!-- ko foreach: { data: question, as: 'question' }-->\n <!-- ko foreach: { data: question.answers, as: 'answer' }-->\n\n // i want to define temporary variable here like:\n\n var answer_name = answer.name;\n\n if($parents[1].lang){\n answer_name = answer[$parents[1].lang + '_name'];\n }\n\n <span data-bind=\"text: answer_name\">\n // How to do like this? \n <!-- /ko -->\n<!-- /ko -->\n\n\nI don't want to use computed values and observables it's JS objects."
] | [
"knockout.js"
] |
[
"BigQuery combining data sets using dates and date ranges",
"Is there a way to combine 2 tables by serial number and using a date range from one table and dates from the other?\nI have 2 tables: table.events contains event data for a tracker, and table.dates contains the operational date of a tracker. A tracker can be in operation multiple times and as such, has a UID every time it is turned on. E.g. Tracker A can have the UID A1, A2, A3 etc.\nHow can I combine table.events with data such as\nDate,Serial,Quality,\n12/01/2019,A,1,\n12/01/2019,B,2,\n13/01/2019,C,3,\n14/01/2019,A,4,\n15/01/2019,A,5,\n16/01/2019,B,6,\n17/01/2019,B,7,\n17/01/2019,C,8,\n17/01/2019,B,9\n\nwith table.dates\nStart_Date,End_Date,Serial_id,\n15/01/2019,18/01/2019,A1,\n08/01/2019,14/01/2019,A2,\n10/02/2019,18/01/2019,B1,\n13/01/2019,16/01/2019,C1,\n17/02/2019,18/01/2019,C2\n\nTo give me an end result such as\nDate,Serial,Serial_id,Quality,Start Date,End Date\n12/01/2019,A,A1,1,15/01/2019,18/01/2019\n12/01/2019,B,B1,2,10/02/2019,18/01/2019\n13/01/2019,C,C1,3,13/01/2019,16/01/2019\n14/01/2019,A,A1,4,15/01/2019,18/01/2019\n15/01/2019,A,A2,5,08/01/2019,14/01/2019\n16/01/2019,B,B1,6,10/02/2019,18/01/2019\n17/01/2019,B,B1,7,10/02/2019,18/01/2019\n17/01/2019,C,C2,8,17/02/2019,18/01/2019\n17/01/2019,B,B1,9,10/02/2019,18/01/2019\n\nAny help would be much appreciated.\nEdit:\nOne date will contain more than one serial number, so I want to also join by serial number.\nE.g.\nI have trackers D1 and E1 which both were tracking on 23/01/2019. I have seperate entries in table.events for D and E so I will need to match by date range and by a substring of serial id."
] | [
"sql",
"google-bigquery",
"date-range"
] |
[
"Asp.Net Web API content negotiation",
"…API/emailMessage/?emailId=test123\n\nI have written the above URL using Web API to get the email in JSON data format(email body, sender, CC, To, etc).\n\nAlso, I have the requirement to allow download of email along with attachment for the same URL. \n\nOne way to do it is using content negotiation. I can use “MediaTypeHeaderValue(\"application/octet-stream\")” to send the content as downloadable.\n\nQuestion is….\n1. Which parameter in the GET request the user should request for JSON content or download of content? Or what is the correct way of asking the content type from HTTP client?\n2. On the server side I can read what content type the user is asking and send the appropriate data just using case statement. Is there anything to be considered on the server side in this scenarios?\n\nThank you,\nEric"
] | [
"rest",
"asp.net-web-api",
"asp.net-web-api2"
] |
[
"IPN - tutorial has errors",
"I was trying to follow the tutorial on paypal's developer site on setting up a basic IPN listener, and it looks nearly syntax for syntax like on their example. In fact when I started receiving the errors I've been receiving, I thought I would create a new ipn listener and use just the code they have in their example to see if it was my code or not and received the same errors.\n\nWarning: fgets(): supplied argument is not a valid stream resource in \\supergate\\ipn.php on line 42\n\nWarning: feof(): supplied argument is not a valid stream resource in \\supergate\\ipn.php on line 39\n\n\nthe errors on those line numbers are for these pieces of code at those lines:\n\n while (!feof($fp)) //line 39\n{\n\n $res = fgets($fp, 1024); //line 42\n\n\nhere is the rest of the entire code\n\n<?php\n//Empty Header HTTP 200 OK reponse to ack receipt of the notification\nheader('HTTP/1.1 200 OK');\n\n\n///////////////////////////////////////////////////////\n//assign payment notification values to local variables\n$item_name =$_POST['item_name'];\n$item_number =$_POST['item_number'];\n$payment_status =$_POST['payment_status'];\n$payment_ammount =$_POST['mc_gross'];\n$payment_currency =$_POST['mc_currency'];\n$txn_id =$_POST['txn_id'];\n$receiver_email =$_POST['receiver_email'];\n$payer_email =$_POST['payer_email'];\n///////////////////////////////////////////////////////\n\n\n//build the required ack message of notification just received\n$req = 'cmd=_notify-validate'; //add 'cmd=_notify-validate' to beginning of acknowledgement\n\nforeach ($_POST as $key => $value) { //loop through the notification nv pairs\n $value = urlencode(stripcslashes($value)); //encode these values\n $req .= \"&$key=$value\"; //add the nv pairs to the acknowledgement\n}\n\n//set up the acknowledgement request headers\n\n$header = \"POST /cgi-bin/webscr HTTP/1.1\\r\\n\"; //HTTP POST REQUEST\n$header .=\"Content-Type: application/x-www-form-urlencoded\\r\\n\";\n$header .=\"Content-Length: \" .strlen($req) . \"\\r\\n\\r\\n\";\n\n// Open a socket for the acknowledgement request\n$fp = fsockopen('ssl://sandbox.paypal.com', 443, $errno, $errstr, 30);\n\n//send the http post request back to paypal for validation\nfputs($fp, $header . $req);\n\nwhile (!feof($fp)) \n{\n\n $res = fgets($fp, 1024);\n if (strcmp ($res, \"VERIFIED\") == 0) \n {\n //WRITE TO EMAIL\n\n\n */\n }\n//--------------------------------------------------------------------------------------------------------------------\n else if (strcmp($res,\"INVALID\") == 0) \n {\n\n //write to email\n}\n\n\nfclose($fp); //close the file\n?>\n\n\nOkay now the new warning I get is this:\n\nWarning: fgets() [function.fgets]: SSL: An existing connection was forcibly closed by the remote host."
] | [
"php",
"paypal"
] |
[
"Uncaught TypeError: Cannot read property 'selection' of undefined?",
"while loading my calendar i have the error\nUncaught TypeError: Cannot read property 'selection' of undefined\nmy view is \n\n `<record model=\"ir.ui.view\" id=\"calldata_calendar_view\">\n <field name=\"name\">calldata.calendar</field>\n <field name=\"model\">calldata</field>\n <field name=\"type\">calendar</field>\n <field name=\"arch\" type=\"xml\">\n <calendar string=\"Call details\" date_start=\"Call_start\">\n <field name=\"Dialled_number\" string=\"Dialled number\"/>\n </calendar>\n </field>\n </record>`\n\n\nAny one please help ?"
] | [
"openerp",
"calendarview"
] |
[
"How to inline ignore format in Visual Code?",
"Which formatter VCode uses? I read somewhere VC uses jsbeautifier so I tried adding a compatible ignore comment to my .ejs template, but to no avail."
] | [
"formatting",
"visual-studio-code",
"inline",
"ignore"
] |
[
"Mongoose _id of type String not throwing error",
"I have a schema in Mongoose: \n\nconst member = new Schema({\n _id: { type: String, required: true },\n ...\n});\n\n\nbut when I use await MemberModel.findOne({ _id: req.params.userID }); in an express request handler, I get a CastError: Cast to ObjectId failed for value \"MY_SECRET_VALUE\" at path \"_id\" for model \"Member\".\n\nAs you can see, I have set _id's type to String in the Schema - why is it not allowing me to search for the _id by a String value?"
] | [
"javascript",
"node.js",
"mongodb",
"mongoose"
] |
[
"Unexpected MATLAB operator error when I initialize my function",
"I write a MATLAB function to do some processing in audio file and finally drawing the graph of audio.\n\ninput_sequence is a path of audio file.\n\nfunction []= quantizer_DSP(input_sequence, B)\n[y, Fs] = audioread('input_sequence'); \nMinRange = -1;\nMaxRange = +1; \nQuantizerLevel = 2^B;\nSignalRange = (MaxRange-MinRange)/(QuantizerLevel); \ny = y/SignalRange;\ny = round(y);\ny = y*SignalRange;\n\nx=5000:5500;\nplot(x,y(5000:5500),'r:');\n\nend\n\n\nWhen I use this function and use my audio file this error occurs:\n\n\nquantizer_DSP(F:\\HAMED\\Daneshgah\\Term8\\DSP\\Majid~\\majid\\1,4);\n ↑\nError: Unexpected MATLAB operator."
] | [
"matlab",
"function",
"audio",
"error-handling",
"syntax-error"
] |
[
"SSRS does not recognize custom DLL",
"I'm developing SSRS reports via VS2010 on my local machine.\nI need to reference from a certain report to a DLL I wrote, The DLL was built at .net framwork 3.5 and I've placed the dll in the following libraries:\n1.C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\PrivateAssemblies.\n2.C:\\Program Files\\Microsoft SQL Server\\MSRS10_50.MSSQLSERVER\\Reporting Services\\ReportServer\\bin\nboth on my local machine and the server where SSRS is located.\nI've also added rssrvpolicy.config file as following:\n\n<CodeGroup\n class=\"UnionCodeGroup\"\n version=\"1\"\n PermissionSetName=\"FullTrust\"\n Name=\"Test\"\n Description=\"\">\n <IMembershipCondition\n class=\"UrlMembershipCondition\"\n version=\"1\"\n Url=\"C:\\Program Files\\Microsoft SQL Server\\MSRS10_50.MSSQLSERVER\\Reporting Services\\ReportServer\\bin\\Test.dll\"\n />\n\n\nDone all that' I've referenced the DLL through the report properties but yet recieved the following error message while previewing the report:\n\"An error occured during local report processing, The definition of the report X is invalid.\nError while loading code module \"Test ...' Could not load file or assembly 'Test ...' or one of its dependenies. The system cannot find the file specified\"\n\nAny ideas?"
] | [
"visual-studio-2010",
"reporting-services"
] |
[
"modal does not hide and data does not show after \"POST\"",
"modal not hiding\nnew post not appearing at last\nmodal code\najax get/post code\najax get/post code"
] | [
"javascript",
"html",
"jquery",
"ajax",
"bootstrap-4"
] |
[
"iPhone OpenGL-ES: Adding a texture to one face of a cube",
"building a 3D environment, So far I have fully textured cubes and colored cubes. What I want to do is add a texture to one of the Coloured cube faces\n\nglDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, &colourCubeVertexFaces[0]);\n\nglColor4ub(colourCubeFaceColors[colorIndex], colourCubeFaceColors[colorIndex+1], colourCubeFaceColors[colorIndex+2], colourCubeFaceColors[colorIndex+3]);glColor4ub(colourCubeFaceColors[colorIndex], colourCubeFaceColors[colorIndex+1], colourCubeFaceColors[colorIndex+2], colourCubeFaceColors[colorIndex+3]);\nglDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, &colourCubeVertexFaces[6]);\nglDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, &colourCubeVertexFaces[12]);\nglDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, &colourCubeVertexFaces[18]);\nglDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, &colourCubeVertexFaces[24]);\n\n\nI thought it would be as easy as turning on (and off)\n\nglEnableClientState(GL_TEXTURE_COORD_ARRAY);\n\n\nThen Bind a texture\n\nglBindTexture(GL_TEXTURE_2D, ([[coordsArray objectAtIndex:4] floatValue]));\n\n\nand then plotting it\n\nglTexCoordPointer(2, GL_FLOAT, 0, texturedCubeCoord);\n\n\nBut it just seems to slow down alot and not show anything. My other fully textured cubes are fine."
] | [
"iphone",
"opengl-es"
] |
[
"D3.js: Changing the color of the bar depending on the value",
"I have been experimenting with d3.js bar chart, I want to change the color depending on the value of the y axis, how do I achieve this. I tried adding linear gradients but then I lose control over it. \n\nThe code I am working on is based on this: http://bost.ocks.org/mike/bar/"
] | [
"javascript",
"d3.js"
] |
[
"SmtpClient SendMailAsync sometimes never returns",
"We have implemented our own customized bulk email software. For three years we used it with a local Exchange server and never had any issues. A few months ago we switched to Office 365 and now have the problem that every now and then the email sending suddenly stops. \n\nI have copied a sketch of the code below. We use SmtpClient.SendMailAsync from System.Net.Mail. Since we need to be able to throttle the amount of emails per minute, we have a timer that is enabled after each successfully sent email and triggers the next email. At random times the process stops with the log output of the line marked with ***. So it looks as if SendMailAsync never returns and the lines after never get executed. No error message, nothing. The program itself does not look crashed or deadlocked, though.\n\nAny idea if there could be something wrong with our code?\nHow could it be that SendMailAsync never returns?\n\nprivate async Task SendEmailAsync(Recipient recipient)\n{\n MailMessage mm = new MailMessage();\n ...\n System.Net.NetworkCredential creds = new System.Net.NetworkCredential();\n ...\n\n using (SmtpClient sc = new SmtpClient(Host, Port))\n {\n sc.EnableSsl = UseSSL;\n sc.UseDefaultCredentials = false;\n sc.Credentials = creds;\n\n mm.Body = ...\n mm.To.Add(recipient.Adress);\n\n progressViewModel.Log($\"Sending e-mail to: {recipient.Adress} ...\"); ***\n\n await sc.SendMailAsync(mm);\n\n progressViewModel.Log($\"... Sent e-mail to: {recipient.Adress}\");\n }\n}\n\n\nprivate async void StartNextEmail()\n{\n try\n {\n timer.IsEnabled = false;\n\n //check aborted or completed\n ...\n\n Recipient currentRecipient = ...\n\n await SendEmailAsync(currentRecipient);\n\n timer.IsEnabled = true;\n }\n catch (SmtpException ex)\n {\n //failed, implement retry logic\n ...\n timer.IsEnabled = true;\n }\n catch (Exception ex)\n {\n //unexpected error, abort \n ...\n }\n}\n\n\nprivate void timer_Tick(object sender, EventArgs e)\n{\n StartNextEmail();\n}"
] | [
".net",
"async-await",
"office365"
] |
[
"Values for 'fun= ' in *apply functions",
"The *apply (apply, tapply, lapply etc.) are a very useful and straightforward method of applying a function across an array of data, with the generic structure:\n\n*apply(data, function ...)\n\n\nHowever, I cannot find a list of valid functions. \n\nCan anyone provide a link to such a list?"
] | [
"r",
"tapply"
] |
[
"Javascript import module to index.html not running due to errors",
"I am trying to import a module to my index.html file.\n\nHere is the code:\n\n// Index.html:\n\n<!doctype html>\n\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\n <title></title>\n\n</head>\n\n<body>\n\n<div></div>\n\n <script type=\"module\" src=\"module.js\"></script>\n <script type=\"text/javascript\">\n\n import { addTextToBody } from 'module.js';\n\n addTextToBody('some text here');\n\n </script>\n</body>\n</html>\n\n\nAnd the js:\n\nexport function addTextToBody(text) {\n\n const div = document.createElement('div');\n div.textContent = text;\n document.body.appendChild(div);\n\n}\n\n\nI am getting these errors:\n\nUncaught SyntaxError: Unexpected token { - Line 18\n\nAccess to Script at 'module.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.\n\nHow can I fix this?"
] | [
"javascript",
"ecmascript-6"
] |
[
"Is there a way to simulate Socket and Connection timeout?",
"I have a certain piece of code that integrates with a third party using HTTP connection, which handles socket timeout and connection timeout differently.\nI have been trying to simulate and test all the scenarios which could arise from the third party. was able to test connection timeout by connecting to a port which is blocked by the servers firewall e.g. port 81.\nHowever I'm unable to simulate a socket timeout. If my understanding is not wrong socket timeout is associated with continuous packet flow, and the connection dropping in between. Is there a way I can simulate this?"
] | [
"java",
"http",
"httpurlconnection",
"socket-timeout-exception"
] |
[
"length()function implementation in a linked-list",
"I am implementing a linked-list, and one of the function asks for the number of nodes in the linked list. However, as the requirement says it needs to be done recursively. \n\nHere is my implementation so far.\n\nclass LList {\n public:\n bool isEmpty() const;\n void cons(int x);\n int length() const;\n private:\n struct Node {\n int item;\n Node* next;\n };\n Node* head;\n}\n\nbool LList::isEmpty() const{\n if(head == nullptr)\n return true;\n else\n return false;\n}\nvoid LList::cons(int x){\n Node* temp = new Node;\n temp->item = x;\n temp->next = head;\n head = temp;\n}\n\n\nI can only do this literately, but couldn't make the recursion work.\n\nint LList::length(Node* head) const{\n Node* temp = head;\n if (temp == nullptr) {\n return 0;\n }\n return 1 + length(temp->next);\n}\n\nint LList::length() const {\n return length(head);\n}\n\n\nI tried to use a helper function to do the job, but it's saying declaration is incompatible with int LList::length() const\n\nCan anyone help me with this problem?"
] | [
"c++",
"linked-list"
] |
[
"what happens to the foreground service when associated notification is removed?",
"I have a service running in foreground . I m looking for a way to stop the service from running in foreground when the user touches the notification. I understrand that the foreground service can be removed by calling the stopforeground function . I referred to the android dev docs about foreground service, but it does not mention anything about the behavior of the foreground service when the notification associated with it gets removed. So my question are\n1)It is possible to stop a foreground service by creating a notification that clears when the user touches it ?\n2)How can one be sure that the service is not running in foreground anymore?"
] | [
"android",
"service"
] |
[
"TextFormField: Show suffixIcon only if text field is wide enough",
"I have a TextFormField component with a suffixIcon. But some of my input fields are quite some, as they only accept 2 or 3 characters. I want to hide the suffixIcon automatically if the text field is too small. Is this possible?\n\nTextFormField(\n decoration: InputDecoration(\n suffixIcon: IconButton(\n icon: Icon(\n Icons.clear,\n color: ThemeColors.iconColor,\n ),\n onPressed: () {\n _controller.clear();\n },\n )\n ),\n controller: _controller \n) \n\n\nEdit:\n\nThe width of the text field is not fixed - I don't know its width. Usually, the text field is integrated into a flexible layout, e.g. in Rows.\n\nSo, in fact, I need to know the width of a flexible text field."
] | [
"flutter"
] |
[
"Converting string values to float and removing strings from list",
"I have a list that looks like this\n\nlst = ['a','b','43.23','c','9','22']\n\n\nI would like to remove the elements that cannot be represented as floats and hence I am doing the following (Attempt 1):\n\nfor i,j in enumerate(lst):\n try:\n lst[i]=float(j)\n except:\n lst.remove(j)\n\n\nWhich leaves the list looking like this\n\nlst = ['b', 43.23, '9', 22.0]\n\n\nwhereas what I need is this\n\nlst = [43.23, 9.0 , 22.0]\n\n\nAnd so I'm doing the following:\n\nfor i,j in enumerate(lst):\n try:\n lst[i]=float(j)\n except:\n pass\nlst = [i for i in lst if type(i) != str]\n\n\nIs there a cleaner way to do this.?\n\nEDIT: Changed the name of example list from 'list' to 'lst' based on the recommendations below."
] | [
"python",
"list"
] |
[
"Mouse hover - libgdx",
"Is there any listener in libgdx that would allow me to detect just mouse hover not pressed just hover. In the button class of scene 2D you have 2 methods isOver and isPressed but they do the same thing ... Anyone else having this problem? Is there another way to detect mouse hover over actor?"
] | [
"java",
"libgdx",
"onclicklistener"
] |
[
"can not access sql server developer sp1 ssis from ssms",
"I am installing Sql server 2016 Sp1 developer on Azure VM Windows 2012 R2 datacenter. The database engine and analysis service (SSAS) are working proerpty however integration service (SSIS) is inaccessible even the service is running.\n\nThe services are running:\n\n\nbut I could not login from SSMS (run as Administrator). The message error is \"The specified service does not exist as an installed service\":"
] | [
"sql-server",
"ssis",
"ssms"
] |
[
"NAnt exec command garbling output",
"When I execute a batch file that calls npm from the command line I see nicely formatted output, such as:\n\n├── [email protected]\n├── [email protected]\n├── [email protected]\n├── [email protected]\n├── [email protected]\n├── [email protected] ([email protected])\n├── [email protected]\n├── [email protected]\n├── [email protected] ([email protected], [email protected], support\n├── [email protected] ([email protected], [email protected], end-of-\n├── [email protected] ([email protected], [email protected], [email protected],\n├── [email protected] ([email protected], [email protected], [email protected], defa\n└── [email protected] ([email protected], [email protected], array-uni\[email protected], [email protected], [email protected], [email protected])\n\n\nHowever, when I call the same batch file from a NAnt script, using the exec task, the output becomes garbled (even if I use the \"output\" switch to pipe output to a file):\n\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected] ([email protected])\n [exec] Ôö£ÔöÇÔöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected]\n [exec] Ôö£ÔöÇÔöÇ [email protected] ([email protected], [email protected], [email protected])\n [exec] Ôö£ÔöÇÔöÇ [email protected] ([email protected], [email protected], [email protected], [email protected])\n [exec] ÔööÔöÇÔöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], t\[email protected])\n\n\nIs there a workaround?"
] | [
"npm",
"nant"
] |
[
"Why are table borders not collapsing when caption is positioned?",
"In this fiddle http://jsfiddle.net/jnddfyeq/ I have two tables with border-collapse: collapse. In the first one everything works as expected. In the second one I position the caption with position: absolute and now the borders between the thead and tbody do not collapse.\n\nThis happens in Firefox 38 and IE8 (not in a fiddle.) I have not tested other browsers. Is this behavior standard? If so why?\n\nUPDATE: Same thing happens in Safari."
] | [
"html",
"css"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.