texts
sequence
tags
sequence
[ "Time complexity fro Dijkstra's algorithm", "As I read the time complexity for Dijkstra's algorithm on the unweighted graph using queue is O(n2) in the worst case. I assume this is because od bfs and dfs. BFS processes all the vertices during the marking phase and dfs is used for tracing back. They both have linear time complexity. But I'm not sure if this logic is correct. \n\nAlso for weighted graph, I know that the time complexity is O(EVlogV),where E is edges and V vertices. I think this is because of priority queue and I understand how priority queue works but still don't understand the O notation." ]
[ "time-complexity", "runtime", "dijkstra" ]
[ "keep focus in a WPF combo box in an addin", "I have a combobox in a Word addin. The contents of the combobox are often long enough to drape over Word's Zoom slider-bar control. However, selecting an item directly over the zoom control (which is hidden from view) causes the zoom control to get focus, close the combobox, and change your zoom setting! The selection in the combobox is untouched. \n\nHow can I make the combo box keep focus and change the selected value to the item (over the zoom bar) selected? Thanks..." ]
[ "c#", "wpf", "wpf-controls", "add-in" ]
[ "Node.js Web Socket H15 Idle Connection timeout on Heroku", "We run a Node.js and Express application on Heroku that uses the ws library for realtime web sockets. Below is a screen shot of the numerous H15 timeout's that we are seeing. \n\n\n\nI've read that Heroku terminates any idle connection after 55 seconds but our sockets send ping-pong back and forth every 5 seconds when the connection is open. A piece of the server code is below:\n\nvar _this = this;\n\nthis.server.on('connection', function(ws){\n\n // check for a ping, respond with pong\n ws.on('message', function(data){\n data = data.toString('utf8');\n if (data === PING) {\n ws.send(PONG);\n }\n });\n\n ws.on('close', function(err){\n TL.logger.info('Socket closed: '+path);\n _this.sockets = _.filter(_this.sockets, function(_ws){\n return ws != _ws;\n });\n });\n\n ws.on('error', function(err){\n TL.logger.info('Socket error: '+path);\n _this.sockets = _.filter(_this.sockets, function(_ws){\n return ws != _ws;\n });\n });\n\n _this.sockets.push(ws);\n});\n\n\nAnd here's a picture of client side socket in chrome:\n\n\n\nAny idea's how to prevent the idle connection?" ]
[ "node.js", "heroku", "express", "websocket", "timeout" ]
[ "Cannot convert type 'System.Windows.Forms.Control' to 'T'", "I am trying to make a Generic FindControl method and I get the following error:\n\nCannot convert type 'System.Windows.Forms.Control' to 'T'\n\nCode:\n\npublic T Control<T>(String id)\n{\n foreach (Control ctrl in MainForm.Controls.Find(id, true))\n {\n return (T)ctrl; // Form Controls have unique names, so no more iterations needed\n }\n\n throw new Exception(\"Control not found!\");\n}" ]
[ "c#" ]
[ "PyObjC + Xcode 3.2 + Non-Apple Python", "I want to get started trying to develop a few simple applications with PyObjC. I installed PyObjC and the Xcode templates. I know that PyObjC itself works, since I've run this script successfully. When I tried to create a project from the Cocoa-Python Application template and ran it, I got this error:\n\nTraceback (most recent call last):\n File \"main.py\", line 10, in \n import objc\n File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyObjC/objc/__init__.py\", line 25, in \n from _convenience import *\n File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyObjC/objc/_convenience.py\", line 21, in \n from itertools import imap\nImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/itertools.so, 2): no suitable image found. Did find:\n /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/itertools.so: mach-o, but wrong architecture\n2010-02-08 19:40:09.280 TestApplication[3229:a0f] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '/Users/icktoofay/Desktop/TestApplication/main.m:44 main() PyRun_SimpleFile failed with file '/Users/icktoofay/Desktop/TestApplication/build/Debug/TestApplication.app/Contents/Resources/main.py'. See console for errors.'\n\nWhen I tried opening a normal Python prompt and importing itertools, there was no error. I'm using Python 2.6.4 from MacPorts on Mac OS X 10.6 Snow Leopard.\n\nI'd appreciate any help." ]
[ "python", "xcode", "pyobjc", "itertools" ]
[ "C# WPF Material Design MaterialDesignFlatButton Hint\\HighLight Color", "How to change hint and animation color of buttons in my app.\nWhat I tried:\n <!--PRIMARY-->\n <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#349fda" />\n <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#333333" />\n <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#3d5671" />\n <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#333333" />\n <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#293a4c" />\n <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#333333" />\n \n <!--ACCENT-->\n <SolidColorBrush x:Key="SecondaryAccentBrush" Color="#349fda" />\n <SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#349fda" /> \n\nthis change color of a button, BUT I need to change the animation and hint(when mouse hover on button) color from purple(default) to custom. How can I do it?\nMy buttons now looks like this\nI need hint like this" ]
[ "c#", "wpf", "button", "colors", "material-design" ]
[ "Android LiveData: Difference between LiveData provided as method or as variable", "I am facing a strange, but huge difference in behaviour between observing LiveData that is exposed as a method and LiveData that is exposed as variable. Consider the following code in your ViewModel:\n\nLiveData as method\n\nprivate val carApiCall = carRepository.getCar(carId)\n\nfun getCarColors() = Transformations.switchMap(carApiCall ) { resource ->\n when (resource.resourceStatus) {\n ResourceStatus.SUCCESS -> databaseRepository.getCarColors(carId)\n }\n}\n\n\nLiveData as variable\n\nprivate val carApiCall = carRepository.getCar(carId)\n\nval carColors = Transformations.switchMap(carApiCall ) { resource ->\n when (resource.resourceStatus) {\n ResourceStatus.SUCCESS -> databaseRepository.getCarColors(carId)\n }\n}\n\n\nAs you can see, the only difference is how carColors are observable by the outside. First as as method getCarColors() then as a public variable carColors.\n\nThe car colors are observed and used by both the fragment and a few times in the xml data-binding layout.\n\nWhen using the variable approach, all works fine. As soon as the API call was successful, the code requests the car colors from the database once.\n\nWhen using the method approach, the API call is executed once, but the Transformation on it is called up to 20 times! Why does it behave like that?\n\nTo be clear: Both code examples end up with a working result, but for some reason the second one gets executed/called many times, although the transformed apiCall is only changed once." ]
[ "android", "android-livedata", "android-architecture-components", "android-livedata-transformations" ]
[ "trying to sum two arrays", "I'm trying to code something like this:\n\n \n\nwhere x and y are two different numpy arrays and the j is an index for the array. I don't know the length of the array because it will be entered by the user and I cannot use loops to code this. \n\nMy main problem is finding a way to move between indexes since i would need to go from \n\nx[2]-x[1] ... x[3]-x[2] \n\n\nand so on.\n\nI'm stumped but I would appreciate any clues." ]
[ "python", "arrays", "python-3.x", "numpy" ]
[ "how to scroll to bottom of scrollview in React native 0.63?", "How to scroll to the bottom of any list using hooks in React Native 0.63?\nWhen I do\nconst scrollviewref = useRef(ScrollView);\n\n<ScrollView\n ref={scrollviewref}\n onContentSizeChange={scrollviewref\n .getNode()\n .scrollTo({ animated: true }, 0)}\n >\n\nit says scrollviewref.getNode is not a function\nor\n<ScrollView\n ref={scrollviewref}\n onContentSizeChange={scrollviewref\n .scrollTo({ animated: true }, 0)}\n >\n\nit says scrollviewref.scrollTo is not a function\nI have added\nscrollviewref.current.scrollToEnd({ animated: true });\n\ninside useEffect but the scrollis not happening immediately, any suggestions why?\nCould anyone please help me out here?\nAny leads would be great." ]
[ "react-native", "react-native-android", "scrollview", "react-native-ios" ]
[ "(Java Interface) What does (Interface_name)class_name.newInstance() Mean in java?", "code :\ninterface MyInterface {\n void connect();\n}\nclass SQLconnection implements MyInterface {\n public void connect() {\n System.out.println("Connection successful to SQL database");\n }\n}\nclass OracleConnection implements MyInterface {\n public void connect() {\n System.out.println("Connection successful to Oracle database");\n }\n}\npublic class Main {\n public static void main(String[] args) throws Exception {\n String class_name = args[0];\n Class c = Class.forName(class_name);\n MyInterface obj = (MyInterface)c.newInstance();\n obj.connect();\n }\n}\n\nI am learning about interface from book, and the following code was written. What does the below line mean?\nMyInterface obj = (MyInterface)c.newInstance();" ]
[ "java" ]
[ "fullcalendar scheduler only allow select in Background event", "I want to allow select only in the background event that I set. Thus, I found something in https://fullcalendar.io/docs/selectOverlap . However, it does not work for me. \n\nevents: [\n {\n id : '1',\n start: '11:00',\n end: '18:30',\n color: 'gray',\n rendering: 'background',\n dow: [1],\n resourceId: \"jenny\"\n },\n {\n id: '2',\n start: '14:30',\n end: '22:30',\n color: 'gray',\n rendering: 'background',\n dow: [3],\n resourceId: \"tom\"\n }\n],\nselectOverlap: function(event) {\n return event.rendering === 'background';\n}\n\n\nEven if I do this, I can still select all of the slots. \n\n+)\nAlso, I tried to use businessHours, but it couldn't differentiate the resources.\n\nresources: [\n { id: 'a', title: 'A' },\n { id: 'b', title: 'B', eventColor: 'green' },\n { id: 'c', title: 'C', eventColor: 'orange' },\n { id: 'd', title: 'D', eventColor: 'red' },\n { id: 'e', title: 'E', eventColor: 'blue'}\n ],\n resourceAreaWidth: \"10%\",\n\n selectConstraint : \"businessHours\", \n businessHours: \n [\n {\n dow: [ 1, 2, 3 ], \n start: '11:00', \n end: '18:00',\n resourceId : \"a\" \n },\n {\n dow: [ 4, 5 ], \n start: '10:00', \n end: '16:00',\n resourceId: \"b\" \n }\n ]\n\n\nI set different businessHours per resource, but the result is all same businessHour for all of resources. \nresult" ]
[ "javascript", "html", "fullcalendar" ]
[ "Cakephp production application on subdomain in Single EC2 instance", "I have a cakephp web app which I've uploaded and linked to an apache server on an ubuntu Amazon EC2 instance. I now wish to:\n\na. link the production version with my domain under a subdomain link like: subdomain1.mywebsite.com\nb. Link the development version on subdomain2.mywebsite.com so I can keep making changes here and pushing them to the production subdomain.\n\nDo I have to use virtual hosts in apache, or is there another way using cakephp only?" ]
[ "apache", "cakephp", "amazon-web-services", "amazon-ec2", "subdomain" ]
[ "Wrong 3D plot in Matlab", "I'm trying to create 3D plots in Matlab, and I have practically no experience. I'd really like to draw the figure described by these equations:\n\nx = cos(u) sinh(t) / (cosh(t) - cos(u)); \ny = cos(u) sin(u) / (cosh(t) - cos(u)); \nz = sin(u);\n\n\nwhere both u and t vary from -pi to pi. This is what Paul Bourke calls Ghost Plane.\n\nclc\nclear\na = -pi:.01:pi;\nb = -pi:.01:pi;\n[U,T] = meshgrid(a,b);\nX = (cos(U).*sinh(T))./(cosh(T)-cos(U));\nY = (cos(U).*sin(U))./(cosh(T)-cos(U));\nZ = sin(U);\nfigure\nsurf(X,Y,Z)\n\n\nWith the code, I get something... indescribable. How do I plot the figure?" ]
[ "matlab", "plot" ]
[ "faster approach to multiples of 3 and 5", "Why is this approach faster?\n\nx=list(range(0,1000000,3))\nz=list(range(0,1000000,5))\ny=list(range(0,1000000,15))\n%timeit sum(x)+sum(z)-sum(y)\n24 ms ± 1.25 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n\n\nWhy is list comprehension slower?\n\n%timeit sum([i for i in range(1000000) if i % 3 == 0 or i % 5 == 0])\n205 ms ± 7.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n\n\nI thought list comprehension suppose to be faster. Is there any other approach that is faster than these two?" ]
[ "python", "python-3.x" ]
[ "Adding user to MySQL database in php using phpMyAdmin", "I think I am successfully connecting to my database by:\n\n<?php\n $user = 'root';\n $pass = '9KSroMDjEqNmEYY4';\n $db = 'chatservice';\n $host = '127.0.0.1';\n\n $conn = new mysqli($host, $user, $pass, $db, 3306) or die(\"Unable to connect\");\n if ($conn->connect_error){\n die(\"Connection failed: \" . $conn->connect_error);\n }\n?>\n\n\nMy question is how I would use the registration code to successfully add a user to the database. When entering the form I press register I do not get any error messages stating that the registration didn't succeed. It seems that the php code is not being reached after the initial connection. I am new to php and mySQL so any tips on formatting would be nice too!\n\n<?php\n require('connect.php');\n if(isset($_POST['user']) && isset($_POST['password'])){\n $user = $_POST['user'];\n $id = $_POST['IDNUM'];\n $password = $_POST['password'];\n\n $query = \"INSERT INTO 'users' (user ,IDNUM ,password) VALUES('$user', '$id', '$password')\";\n $result = mysqli_query($query);\n if($result){\n $msg = \"Registered Sussecfully\";\n echo $msg;\n }\n else\n $msg = \"Error Registering\";\n echo $msg;\n }\n?>\n\n\n<div class=\"register-form\">\n <title>Chat Page Start</title>\n <form action=\"\" methods=\"POST\">\n <p>\n <label>Username: </label>\n <input id=\"user\" type=\"text\" name=\"user\" placeholder=\"user\" />\n </p>\n\n <p>\n <label>ID: </label>\n <input id=\"IDNUM\" type=\"text\" name=\"IDNUM\" placeholder=\"ID number\" />\n </p>\n\n <p>\n <label>Password: </label>\n <input id=\"password\" type=\"password\" name=\"password\" placeholder=\"password\" />\n </p>\n\n <a class=\"btn\" href=\"login.php\">Login</a>\n <input class=\"btn register\" type=\"submit\" value=\"Register\" />\n </form>\n</div>\n\n\nAnother thing is how would I check the status of my database connection and where I should be checking this status?" ]
[ "php", "mysql", "phpmyadmin" ]
[ "PySpark, top for DataFrame", "What I want to do is given a DataFrame, take top n elements according to some specified column. The top(self, num) in RDD API is exactly what I want. I wonder if there is equivalent API in DataFrame world ?\n\nMy first attempt is the following \n\ndef retrieve_top_n(df, n):\n # assume we want to get most popular n 'key' in DataFrame\n return df.groupBy('key').count().orderBy('count', ascending=False).limit(n).select('key')\n\n\nHowever, I've realized that this results in non-deterministic behavior (I don't know the exact reason but I guess limit(n) doesn't guarantee which n to take)" ]
[ "apache-spark", "dataframe", "pyspark", "spark-dataframe" ]
[ "Bounding box offset after call to function setTop and renderall;", "<body>\n<canvas id=\"canvas\" width=\"1024\" height=\"700\" style=\"border:2px solid #000000\"></canvas>\n</body>\n\n<script>\n\n\ncanvas.add(pointA);\nvar pointA = new fabric.Circle({ radius: 4, id:\"A\", fill: 'red', left: 650, top: 210,hasControls:false,padding:5});\n\npointA.setTop(40).setLeft(40);\ncanvas.renderAll();\n\n</script>\n\n\nAfter I call function renderAll(); I can not select circle anymore(bounding box is somwere else on canvas), how to fix that ?" ]
[ "fabricjs" ]
[ "ReactJS with TypeScript 1.7", "I follow ReactSample using JavaScript \n\n\n\nIt can run right the result is \n\n\n\nBut When I change the js to TypeScript like this \n\n\n\nIt not give wrong result like this \n\n\n\nI think all is right . I can compile it with tsc --jsx react -target ES6 . I don't know why it can not get result in the html page ? Can you help me" ]
[ "reactjs", "typescript1.6" ]
[ "JavaScript - Pixastic - Error : this operation is unsecure", "I'm trying to desaturate an image using Pixastic. I donwloaded the script from the official website and checked the only things needed (core, jquery plugin, and desaturate effect).\n\nI tried using the same code as they show in the demo, except that i enclosed it inside the .ready function of jQuery, but this isn't supposed to cause problems :\n\n(function($) {\n $(document).ready(function() {\n var img = new Image();\n img.onload = function() {\n // document.body.appendChild(img); // Ialso tried putting this here.\n Pixastic.process(img, \"desaturate\", {average : false});\n };\n document.body.appendChild(img);\n img.src = \"http://127.0.0.1/some_path/Wallpapers/ (10).jpg\"; // This URL does point to the image file.\n });\n})(window.jQuery);\n\n\nBut i always get the same error : This operation is unsecure.\nThe error comes from the Pixastic js file at line 374 :\n\nprepareData : function(params, getCopy) {\n var ctx = params.canvas.getContext(\"2d\");\n var rect = params.options.rect;\n var dataDesc = ctx.getImageData(rect.left, rect.top, rect.width, rect.height); // 374\n var data = dataDesc.data;\n if (!getCopy) params.canvasData = dataDesc;\n return data;\n },\n\n\nI'm developing on a local wamp server.\n\nAny idea about what i'm doing wrong ?\nThanks for your help ! :)" ]
[ "javascript", "image", "canvas", "pixastic" ]
[ "Webhook warnings before purging an envelope", "I am working on integrating DocuSign into our product, and I have noticed that demo envelopes are being purged every 30 days as stated in the documentation. We have set up our product to use a webhook to keep up-to-date with DocuSign's envelope data. However, there doesn't appear to be any warning via webhook before the envelope is purged, it is just suddenly inaccessible. Is there any way to allow notification via webhook before an envelope is purged? Is there any way to find out that an envelope was purged other than hitting an endpoint and then receiving an ENVELOPE_DOES_NOT_EXIST error?\nAdditionally, does the purging of demo envelopes behave in the same way that setting rules for Document Rentention purges envelopes?" ]
[ "docusignapi" ]
[ "Best way to implement random numbers into a table via a button?", "So I have a table right now that, upon clicking a button, will populate the table with some arbitrary values.\n\nWhat I would like for it to do instead, is populate the table with random numbers, upon each click of the button.\n\nWhat would be the best way to accomplish this?" ]
[ "javascript", "html", "twitter-bootstrap" ]
[ "SQL database Columns error, or does not exist?", "I am working on my sqldatabase, but i cannot move on because my program is giving me an error that there is no such column, even though the column is clearly defined at the top of my code under \"KEY_NAME\" If anybody can help me or needs me to post anymore code please tell me Thanks!\nI've only posted my database.\n\n******* recent logcat information\n03-14 01:24:54.285: E/Database(26073): android.database.sqlite.SQLiteException: table PeopleTable has no column named persons_name: , while compiling: INSERT INTO PeopleTable(persons_hotness, persons_name) VALUES(?, ?);\n\n\n\npublic class HotOrNot {\n public static final String KEY_ROWID = \"_id\";\n public static final String KEY_NAME = \"persons_name\";\n public static final String KEY_HOTNESS = \"persons_hotness\";\n\n private static final String DATABASE_NAME = \"HotOrNotDB\";\n private static final String DATABASE_TABLE = \"PeopleTable\";\n private static final int DATABASE_VERSION = 1;\n\n private DbHelper ourHelper;\n private final Context ourContext;\n private SQLiteDatabase ourDatabase;\n\n private static class DbHelper extends SQLiteOpenHelper {\n public DbHelper(Context context) {\n super(context, DATABASE_NAME, null, DATABASE_VERSION);\n }\n\n @Override\n public void onCreate(SQLiteDatabase db) {\n // TODO Auto-generated method stub\n db.execSQL(\"CREATE TABLE \" + DATABASE_TABLE + \" (\" + KEY_ROWID\n + \" INTEGER PRIMARY KEY AUTOINCREMENT, \" + KEY_NAME\n + \" TEXT NOT NULL, \" + KEY_HOTNESS + \" TEXT NOT NULL);\");\n\n // String sql = String.format(\"create table %s \"\n // + \"(%s int primary key, %s int, %s text, %s text)\",\n // DATABASE_TABLE, KEY_ROWID, KEY_NAME, KEY_HOTNESS);\n // db.execSQL(sql);\n }\n\n @Override\n public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n // TODO Auto-generated method stub\n db.execSQL(\"DROP TABLE IF EXISTS \" + DATABASE_TABLE);\n onCreate(db);\n }\n }\n\n public HotOrNot(Context c) {\n ourContext = c;\n }\n\n public HotOrNot open() throws SQLException {\n ourHelper = new DbHelper(ourContext);\n ourDatabase = ourHelper.getWritableDatabase();\n return this;\n }\n\n public void close() {\n ourHelper.close();\n }\n\n public long createEntry(String name, String hotness) {\n // TODO Auto-generated method stub\n ContentValues cv = new ContentValues();\n cv.put(KEY_NAME, name);\n cv.put(KEY_HOTNESS, hotness);\n return ourDatabase.insert(DATABASE_TABLE, null, cv);\n }\n\n public String getData() {\n // TODO Auto-generated method stub\n String[] columns = new String[] { KEY_ROWID, KEY_NAME, KEY_HOTNESS };\n Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,\n null, null);\n String result = \"\";\n int iRow = c.getColumnIndex(KEY_ROWID);\n int iName = c.getColumnIndex(KEY_NAME);\n int iHotness = c.getColumnIndex(KEY_HOTNESS);\n\n for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {\n result = result + c.getString(iRow) + \" \" + c.getString(iName)\n + \" \" + c.getString(iHotness) + \"\\n\";\n }\n return result;\n }\n}" ]
[ "java", "android", "sql", "database", "sqlite" ]
[ "\"EXIT: Maximum Number of Iterations Exceeded.\" error while solving multiple optimization problem one by one", "I am trying to solve multiple optimization problems one by one using the Gekko optimization suite. The suite succeeds in solving the problems separately: run for problem 1, run the entire code again for problem 2, and so on. However, when I try to run it one by one using a simple for loop, an error occurs saying "Exception: @error: Solution Not Found" due to "EXIT: Maximum Number of Iterations Exceeded." It seems like the first problem is solved correctly, then stops in the middle of the second problem. Can I get advice on this problem?\nfrom gekko import GEKKO\nimport pandas as pd\nimport numpy as np\n\n\n# create GEKKO model\nm = GEKKO()\n\nd = {'A0': [10, 15, 20], 'h': [1, 0.8, 1.2],'emax': [4, 4, 5] }\ndftemp = pd.DataFrame(data=d)\nna=len(dftemp)\n\n\n# time points\nn=11 \nyear=10\n\nm.time = np.linspace(0,year,n)\nt=m.time\n\n# constants\nPa0 = 1 \nPe0 = 0.5 \nC = 1 \nr = 0.05 \nl = 0.1 \nk=50\n \nfor i in range(0,na):\n A0=dftemp.loc[i][0]\n h=dftemp.loc[i][1]\n emax=dftemp.loc[i][2] \n \n u = m.MV(value=0,lb=0, ub=emax)\n u.STATUS = 1\n u.DCOST = 0\n \n A = m.SV(value=A0)\n E = m.SV(value=0)\n t = m.Param(value=m.time)\n Pe = m.Var(value=Pe0)\n d = m.Var(value=1)\n \n # Equation\n m.Equation(A.dt()==-u)\n m.Equation(E.dt()==u)\n m.Equation(Pe.dt()==1.5/k*Pe)\n m.Equation(d==m.exp(-t*r))\n m.Equation(A>=0)\n \n # Objective (Utility)\n J = m.Var(value=0)\n \n # Final objective\n Jf = m.FV()\n Jf.STATUS = 1\n m.Connection(Jf,J,pos2='end')\n m.Equation(J.dt() == m.log((A+E*(1-l))*h*Pa0-C*u+E*Pe))*d\n \n # maximize U\n m.Maximize(Jf)\n \n # options\n m.options.IMODE = 6 # optimal control\n m.options.NODES = 3 # collocation nodes\n m.options.SOLVER = 3 # solver (IPOPT)\n \n # solve optimization problem\n m.solve()\n \n # print profit\n print('Optimal Profit: ' + str(Jf.value[0]))" ]
[ "python", "optimization", "gekko" ]
[ "Call symputx throws error for macro variable", "I am trying to save a value from a varialbe to a macro variable by using \n\n call symputx\n\n\nhowever SAS throws error \n\nthe program i wrote is this way\n\ndata want; \nset have;\narray SR(*) &orde; \nbb=dim(SR);\n\ncall symputx('D',bb);\n\narray M(symget('D'));\ndo i=1 to dim(SR);\nM(i)=SR(i);\nend; \n\nrun;\n\n\nit gives error as \n\narray MXY_A(symget(D));\n -\n 79\n 76\nERROR 79-322: Expecting a ).\n\nERROR 76-322: Syntax error, statement will be ignored.\n\n\nwhat could possibly be wrong here?" ]
[ "macros", "sas" ]
[ "page gets scrolled to top when absolute positioned drop down is opened", "I have notification drop down just like that of facebook. when clicked on link, this drop down is shown, which is positioned as absolute. problem is, when the drop down is opened, the page is getting scrolled to top. Unfortunately I cant paste code as its huge. can you guess what could be the problem.\n\nOk here is what I have. http://jsfiddle.net/testtracker/uuQf3/1/\nfirst scroll down then click on black link, and see that, it scrolls up first then shows notification drop down." ]
[ "javascript", "html", "css" ]
[ "In Chrome and Edge: How to make :target jump links to id's inside svg work?", "I have a scenario like this:\n\nhttps://codepen.io/agibdk/pen/RyreQL?editors=1000\n\n<nav>\n <a href=\"#red\">Red</a>\n <a href=\"#blue\">Blue</a>\n <a href=\"#green\">Green</a>\n <a href=\"#yellow\">Yellow</a>\n</nav>\n\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"656\" height=\"2224\" viewBox=\"0 0 656 2224\">\n <g id=\"Artboard\" fill=\"none\" fill-rule=\"evenodd\">\n <rect id=\"red\" width=\"363\" height=\"340\" x=\"150\" y=\"84\" fill=\"#BC2727\"/>\n <rect id=\"blue\" width=\"363\" height=\"340\" x=\"150\" y=\"635\" fill=\"#3327BC\"/>\n <rect id=\"green\" width=\"363\" height=\"340\" x=\"150\" y=\"1169\" fill=\"#2BBC27\"/>\n <rect id=\"yellow\" width=\"363\" height=\"340\" x=\"150\" y=\"1757\" fill=\"#F0E625\"/>\n </g>\n</svg>\n\n\nIn Firefox 59 the jump links work, but not in Chrome 65 nor in Edge 16.\n\nHow do I ensure (if at all possible), that my :target jump links actually scroll the page to the correct boxes in those browsers?" ]
[ "html", "google-chrome", "svg", "microsoft-edge" ]
[ "Access to getString() in a fragment that implements a viewpager", "I am using a nested fragment using SherlockFragment, all works fine. But i am not being able to make viewpager title to string so that i can support multilanguage using string.xml.\n\nHere is my code\n\npublic class schedule_pl extends SherlockFragment {\n\n\nprivate static String titles[] = new String[] { \"Portugal\", \"Lisbon\" , \"Azores\" };\n\n@Override\npublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.main_pager, container, false);\n // Locate the ViewPager in viewpager_main.xml\n ViewPager mViewPager = (ViewPager) view.findViewById(R.id.viewPager);\n // Set the ViewPagerAdapter into ViewPager\n mViewPager.setAdapter(new MyAdapter (getChildFragmentManager()));\n return view;\n}\n\n@Override\npublic void onDetach() {\n super.onDetach();\n try {\n Field childFragmentManager = Fragment.class\n .getDeclaredField(\"mChildFragmentManager\");\n childFragmentManager.setAccessible(true);\n childFragmentManager.set(this, null);\n } catch (NoSuchFieldException e) {\n throw new RuntimeException(e);\n } catch (IllegalAccessException e) {\n throw new RuntimeException(e);\n }\n}\n\n\npublic static class MyAdapter extends FragmentPagerAdapter {\n\n public MyAdapter(FragmentManager fm) {\n super(fm);\n }\n\n\n @Override\n public Fragment getItem(int position) {\n switch(position)\n {\n case 0:\n return new place();\n case 1: \n return new place2(); \n case 2:\n return new place3();\n\n }\n return null;\n }\n\n\n\n\n @Override\n public CharSequence getPageTitle(int position) {\n return titles[position];\n }\n\n @Override\n public int getCount() {\n // Show 3 total pages.\n return 3;\n } \n }\n\n\npublic static class place extends Fragment {\n\n public place() {\n }\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment1, container,\n false);\n return rootView;\n }\n}\npublic static class place3 extends Fragment {\n\n public place3() {\n }\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment2, container,\n false);\n return rootView;\n }\n}\npublic static class place2 extends Fragment {\n\n public place2() {\n }\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment3, container,\n false);\n return rootView;\n }\n}\n\n\n}\n\non getPageTitle i can't that working with strings and already tried several methods. \n\nAccess to getString() in android.support.v4.app.FragmentPagerAdapter?\nThis is a question similar on the site but neither answer got me on the right path.\n\nI tried using this:\n\n@Override\n public CharSequence getPageTitle(int position) {\n Locale l = Locale.getDefault();\n switch (position) {\n case 0:\n return getcontext.getString(R.string.title_section_schedule1).toUpperCase(l);\n case 1:\n return getcontext.getString(R.string.title_section_schedule2).toUpperCase(l);\n case 2:\n return getcontext.getString(R.string.title_section_schedule3).toUpperCase(l);\n }\n return null;\n }\n\n\nBut do not work. Anyone knows the solution to this?" ]
[ "android", "android-fragments", "android-viewpager", "android-nested-fragment" ]
[ "HTTP error: 403 while parsing a website", "So I'm trying to parse from this website http://dl.acm.org/dl.cfm . This website doesn't allow web scrapers, so hence I get an HTTP error: 403 forbidden.\n\nI'm using python, so I tried mechanize to fill the form (to automate the filling of the form or a button click), but then again I got the same error.\n\nI can't even open the html page using urllib2.urlopen() function, it gives the same error.\n\nCan anyone help me with this problem?" ]
[ "postgresql", "python-2.7", "beautifulsoup", "mechanize" ]
[ "Device suddenly disconnects when debugging in android studio", "I have a device running android 10 and i'm facing a weird problem when i debug my android app on android studio when the app is waiting , it suddenly disconnect Disconnected from the target VM, address: 'localhost:8601', transport: 'socket'. The problem is from the device itself, since I have another phone running android 9 and i have no problem when debugging on it. I have the same Debugging setting on the two phones and I tried everything. My device is honor 8x running android 10." ]
[ "java", "android", "debugging" ]
[ "retrieve day after tomorrow date query", "I want to select day after tomorrow date in sql. Like I want to make a query which select date after two days. If I select today's date from calender(29-04-2015) then it should show date on other textbox as (01-05-2015). I want a query which retrieve day after tomorrow date. So far I have done in query is below:\n\nSELECT VALUE_DATE FROM DLG_DEAL WHERE VALUE_DATE = GETDATE()+2\n\n\nthanks in advance" ]
[ "sql", "sql-server" ]
[ "text keeps flickering after 2 seconds. Coroutines", "So, I have some text that shows up when there is no grenades and currently, it disappears after 2 seconds and then it flickers forever. I just want it to appear for 2 seconds and disappear. Would appreciate some help!\nif (amountOfGrenades == 0)\n {\n StartCoroutine(ShowandHideGrenadeText(NOgrenadesText));\n\n }\n\n\nIEnumerator ShowandHideGrenadeText(GameObject NOgrenadesText)\n {\n NOgrenadesText.SetActive(true); // Enable the text so it shows\n yield return new WaitForSeconds(2.0f);\n NOgrenadesText.SetActive(false); // Disable the text so it is hidden\n yield return new WaitForSeconds(2.0f);\n\n }" ]
[ "c#", "unity3d", "text" ]
[ "Archive multiple artifacts in multiple folders in jenkins?", "I am trying to archive both the target/surefire-reports from my Maven project (easy), but in addition archive files that my project creates that are in the base workspace (csv report). Do I do something like this: target/surefire-reports/**/*, *.csv?" ]
[ "maven", "jenkins" ]
[ "How should Angular 7 Material `panelClass` property be used?", "Angular 5 Material Snackbar panelClass config Is a very similar question only there is a slew of guesswork involved and I am struggling to make any of it work in Angular 7. \n\nThe API is pretty simple. Provide a string | string[] which I presume are class names. \n\nBut where do you define these styles and what is the syntax involved? Is there a standard method? \n\nA naive guess would be to put panelClass: ['my-class'] then in styles.css\n\n.my-class{\n text-align: center;\n}\n\n\nBut it doesn't appear to be so simple. Especially when I look at ViewEncapsulation. Snackbars appear to be global styles and I don't really know the technique which wouldn't violate scoped styles. \n\nng-deep is leaving us but they mention:\n\n\n As such we plan to drop support in Angular (for all 3 of /deep/, >>>\n and ::ng-deep). Until then ::ng-deep should be preferred for a broader\n compatibility with the tools.\n\n\nI haven't seen a depricated feature be recommended and not sure what the future holds." ]
[ "angular", "angular-material2" ]
[ "sum values in a column with awk", "Hi all I have a file which looks like this:\n\nAAAA 5\nBBBB 4\nCCCC 12\n...\n\n\n(the file is tab separated and many 1000's of lines)\n\nWhat I am interested in doing is summing the second column of values, which is straight forward:\n\nawk '{sum +=$2}END{print sum}'\n\n\nWhich in the case of these 3 rows would give a value of 21. What I want to do is to first sum all of the 2nd column in the file, then print col1, col2, col2/sum. So the output would look like this:\n\nAAAA 5 0.2380\nBBBB 4 0.1904\nCCCC 12 0.5714\n\n\nWhat I have tried is this:\n\nawk '{sum +=$2}END{print $1,$2,$2/sum}'\n\n\nBut it doesn't seem to work, all I get is \"CCCC 12 0.5714\" to be printed. I have been trying to figure this out, but can't seem to get it. Any help would be appreciated.\nThanks" ]
[ "awk" ]
[ "How to open this file?", "Unfortunately I've allowed users to upload files to the server without sanitizing its names first (Linux, PHP, MySQL).\n\nOne of the uploaded filename is \"E_M_20-06-2013_14-15_ComidasTípicas.zip\" (it's correct in the MySQL database, UTF-8 encoded).\n\nBut when I try do a fopen() in PHP I can not find this file. Depending on the locale (LANG) I retrieve different filenames, as such:\n\n $ export LANG=pt_BR.UTF-8\n $ ls ../web/downloads/E_M_20-06-2013_14-15_ComidasT*\n ../web/downloads/E_M_20-06-2013_14-15_ComidasTípicas.zip\n\n $ export LANG=pt_BR.ISO-8859-1\n $ ls ../web/downloads/E_M_20-06-2013_14-15_ComidasT*\n ../web/downloads/E_M_20-06-2013_14-15_ComidasT▒?­picas.zip\n\n $ export LANG=C \n $ ls ../web/downloads/E_M_20-06-2013_14-15_ComidasT*\n ../web/downloads/E_M_20-06-2013_14-15_ComidasT????picas.zip\n\n\nCan someone help me in discovering how can I open this file using PHP?\n\nPS: of course, I've tried utf8_encode, utf8_decode, no sucess.\n\nThanks in advance!" ]
[ "php", "linux", "filenames", "non-ascii-characters" ]
[ "google-services plugin could not detect any version for com.google.android.gms or com.google.firebase - strange behaviour", "I have project with 4 modules:\n\n\napp (main)\ncommon-lib\nC\nD\n\n\nI have correctly set firebase as states here: https://firebase.google.com/docs/android/setup\n\nIn my app module I don't use any additional libraries, only module dependencies:\n\ndependencies {\n debugCompile project(path: ':common-lib', configuration: 'debug')\n releaseCompile project(path: ':common-lib', configuration: 'release')\n}\n\n\nIn my common-lib module I use firebase libraries:\n\ndependencies {\n (...)\n compile 'com.google.firebase:firebase-core:11.2.0'\n compile 'com.google.firebase:firebase-crash:11.2.0'\n compile 'com.google.firebase:firebase-messaging:11.2.0'\n compile 'com.google.firebase:firebase-config:11.2.0'\n compile 'com.google.firebase:firebase-ads:11.2.0'\n}\n\n\nIn this situation project compiles but I got the message:\n\ngoogle-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.\nplease apply google-services plugin at the bottom of the build file.\n\n\nWhat is interesting when I copy common-lib firebase dependencies to my app module the message disappear.\n\nIs it a bug? Did I set something wrong? Is my application output file contains proper 11.2.0 version of firebase libraries or as the messages says 9.0.0 ?\n\n\n\nEdited\n\nproject build.gradle:\n\nbuildscript {\n repositories {\n jcenter()\n }\n dependencies {\n classpath 'com.android.tools.build:gradle:2.3.3'\n classpath 'com.google.gms:google-services:3.1.0'\n }\n}\n\nallprojects {\n repositories {\n jcenter()\n maven {\n url 'https://maven.google.com'\n // Alternative URL is 'https://dl.google.com/dl/android/maven2/'\n }\n maven { url 'https://jitpack.io' }\n }\n}\n\n\napp module build.gradle\n\napply plugin: 'com.android.application'\n\nandroid {\n (...)\n}\n\n\ndependencies {\n\n debugCompile project(path: ':common-lib', configuration: 'debug')\n debugTestCompile project(path: ':common-lib', configuration: 'debugTest')\n releaseCompile project(path: ':common-lib', configuration: 'release')\n\n}\n\napply plugin: 'com.google.gms.google-services'\n\n\ncommon-lib moudle build.gradle\n\napply plugin: 'com.android.library'\n\n\nandroid {\n (...)\n}\ndependencies {\n (...)\n //firebase\n compile 'com.google.firebase:firebase-core:11.2.0'\n compile 'com.google.firebase:firebase-crash:11.2.0'\n compile 'com.google.firebase:firebase-messaging:11.2.0'\n compile 'com.google.firebase:firebase-config:11.2.0'\n compile 'com.google.firebase:firebase-ads:11.2.0'\n}" ]
[ "android", "android-studio", "firebase", "android-gradle-plugin", "google-play-services" ]
[ "Installing TensorFlow, where is cuda home on Ubuntu?", "Since upgrading to Ubuntu 16.04 I have been forced to use the cuda repository which came with Ubuntu due to issues with new security features in the package manager. I installed cuda using sudo apt-get install nvidia-cuda-toolkit. This works for everything else I have been doing. Unlike the packages provided by nvidia this does not create a cuda directory at /usr/local/cuda. I am now trying to install tensorflow from source and it wants to know where my cuda home directory is. I am not even sure I have one when using the ubuntu repo. Do any of you know where it is or how I might get around this issue?" ]
[ "ubuntu", "cuda", "tensorflow" ]
[ "Getting the database ID of the current row via load event", "i used this code for click event but how to get when the form load get the TR values\n\nmy code \n\nvar table = $('#mytable').DataTable();\n $('#mytable tbody').on('click','#btnview',function () {\n var data = table.row($(this).parents('tr')).data();\n alert(data[0]);\n });" ]
[ "javascript", "jquery" ]
[ "My cookie is set but php can't read it", "I've been trying to make a cookie autologin, but although the cookie is set, php can't read it. I know it is set because I can see it with Cookie Monster, I don't know what's wrong...\nNeed help! It's driving me crazy!\n\nThe code to set the cookie (I do it before any HTML tag)\n\nsetcookie(\"autologin\", $_SESSION['user'], time()+5184000, \"/\");\n\n\nthe code to retrieve it:\n\nif (!isset($_SESSION['user']) && isset($_COOKIE['autologin'])) {\n $_SESSION['user']=$_COOKIE['autologin'];\n}\n\n\nUPDATE: I don't use the code above in the same script. I do login, close the browser, reopen it and try to get the cookie, cookie is in Cookie Monster but php can't see it.\n\nFIX: My problem was I was trying to save a serialized object, $_SESSION['user'], in the cookie, it has been fixed with that:\n\nsetcookie(\"autologin\", base64_encode($_SESSION['user']), time()+5184000, \"/\");\n\n\nand retrieving with:\n\nif (!isset($_SESSION['user']) && isset($_COOKIE['autologin'])) {\n $_SESSION['user']=base64_decode($_COOKIE['autologin']);\n}" ]
[ "php", "cookies", "fixed" ]
[ "How to multithread with JavaFX", "I am creating a JavaFX application, I need the GUI to interact with some other code in the class but the GUI and the other piece of code obviously can't run without me making different Threads for them to run on.\n\npublic class Client extends Application {\npublic static void main(String[] args){\n launch(args);\n}\n@Override\npublic void start(Stage primaryStage){\n primaryStage.setTitle(\"Hello world!\");\n Button btn = new Button();\n btn.setText(\"Run Client\");\n\n btn.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n try{runClient();}catch (Exception e){System.out.println(\"Exception Occurred, Server is down.\");}\n }\n });\n\n\n StackPane root = new StackPane();\n root.getChildren().addAll(btn);\n primaryStage.setScene(new Scene(root, 500, 500));\n primaryStage.show();\n}\n\n\n\npublic void runClient() throws Exception {\n String sentence;\n String modSentence;\n BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in));\n Socket clientSocket = new Socket(\"localhost\", 6789);\n DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());\n BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));\n sentence = inFromUser.readLine();\n outToServer.writeBytes(sentence + \"\\n\");\n modSentence = inFromServer.readLine();\n System.out.println(\"From Server: \" + modSentence);\n clientSocket.close();\n}\n\n\nrunClient() is the client for the server. I need the GUI to communicate with the client but I can't make a new Thread to run both of them simultaneously." ]
[ "java", "multithreading", "javafx-8" ]
[ "Check urls before blocking", "I currently use the following code to block specific urls.It works fine but now i want to do some actions for some specific urls that are NOT blocked Before chrome process the cilent request.\n\nchrome.webRequest.onBeforeRequest.addListener(function(d){\n return {cancel:true};\n},{urls:[\"https://somesite.com/account/*\",\n \"http://evilsite.com\" \n ]},\n [\"blocking\"]); \n\n\nSay for e.g i want to get the urls of every url that the user visit with addon on.(Just a simple case here...ofcourse i am excluding the blocked sites here)\n\nchrome.webRequest.onBeforeRequest.addListener(function(d){\n console.log(d.url); // doesn't work\n return {cancel:true};\n },{urls:[\"https://somesite.com/account/*\",\n \"http://evilsite.com\" \n ]},\n [\"blocking\"]);" ]
[ "javascript", "api", "google-chrome", "google-chrome-extension" ]
[ "Subtract all elements in a column in sparkR", "I have DataFrame 'res' in sparkR. 'res' contains ID and dates. So the first entries looks like this 'ID' = 1 2 3 ... and 'date' = \"2012-6-5\", \"2013-5-5\", \"2015-10-11\" ...\n\nI want to create a new dataset where all 'dates' is subtracted with \"2010-01-01\". How can this be done? \nI have the exact same problem if I just wanted all elements in a DataFrame subtracted with an integer. \n\nIn sparkR I tried this\n\nnewres <- withColumn(res, \"subtract\", res$date - as.Date(\"2010-01-01\") )\n\n\nThis run but when I type head(newres) I get an error:mesage: \"returnstatus==0 is not True.\"" ]
[ "sparkr" ]
[ "Git workflow for avoiding lots of merge noise in the logs", "We currently have a workflow where master is the more long-term feature release branch and numbered branches like 3.0 are for releases coming up in the next week or so.\n\nWith the above example, we are pushing several last minute changes to 3.0 that need to be merged into master. If we don't merge often, we'll wind up having master out of date without recent changes. If we merge as we go, we have logs full of merges from 3.0 to master.\n\nThe seemingly magical command git-rerere seems to solve this problem, but only for local topic branches that you need to update. In other words, it would work if 3.0 was only on one person's machine and not public.\n\nIs there a way to keep master up-to-date without all the ugly merge noise? Do I understand the use of rerere?" ]
[ "git", "git-rerere" ]
[ "How to use property key value in servlet", "I have a multi-language system that works with property files, and in the .jsp files I am calling the values like so: <fmt:message key=\"welcome\"/>\n\nThis works only in .jsp files.\n\nHow would I got about doing the same directly in Java class files (Servlets), is it even possible?" ]
[ "java", "properties", "key" ]
[ "What Content-Type value should I send for my XML sitemap?", "I thought I should send \"text/xml\", but then I read that I should send \"application/xml\". Does it matter? Can someone explain the difference?" ]
[ "xml", "mime-types", "sitemap", "xml-sitemap" ]
[ "What is the max_fd number of dup2() function?", "int main()\n{\n int err1, err2;\n struct rlimit rlim;\n\n err = getrlimit(RLIMIT_NOFILE, &rlim);\n printf(\"max_fds: %d\\n\", rlim.rlim_max); // 4096\n\n err1 = dup2(1, 1023); // OK\n err2 = dup2(2, 4090); // error: EBADF\n\n return 0;\n}\n\n\nLike the codes above, I use getrlimit to get the max# of open files per process and it prints 4096. However, when I deliver the newfd which is bigger than 1023 to dup2(), it always return error EBADF. Why?" ]
[ "c", "linux", "operating-system" ]
[ "ASP.NET c# 2.0 subfolder login", "I am coming from Java and PHP world, so .net is a bit unknown to me. What i need to do is a simple one user login, and protect 2-3 pages in the same subfolder (ex. main site is at ./ and my new login should be just for these 2-3 files in ./home).\n\nThis is kind of simple admin, that in php i would have done it in less than 10 minutes :) and here is causing me all sorts of headaches. What i have ended now is i have made a simple Forms authentication, with the hardcoded username and pass, and i have protected the needed pages in web.config (all works great on my local server), but now when i uploaded it to the live server, with the web.config inside the ./home folder, i get an error that i haven't specified an application folder correctly in IIS (and i have no idea how to do this on live server, if i only have access on ftp). Then i tried updating the ./ web.config, so that points to login.aspx in ./home (using subfolders), that didn't work too because it wasn't protecting the pages it needed to protect.\n\nPlease help, and point me to right direction,\n\nThanks." ]
[ "c#", "asp.net", "login", "forms-authentication" ]
[ "jQuery and textarea change events", "i just met a strange behavior jQuery and can't figure out any more or less slight solution.\nSay, i have textarea and button. I want to disable button if textarea is empty.\nFor this i have a handler which does this job.\n\nHere is the code:\n\n// textarea control\nvar $textarea = $('#myTextarea');\nvar $button = $('#myButton');\n$textarea.on('input propertychange', function() {\n if($textarea.val().length > 0) {\n $button.removeClass('disabled').removeAttr('disabled');\n } else {\n $button.addClass('disabled').attr('disabled', 'disabled');\n }\n});\n$button.on('click', function() {\n if ($button.attr(\"disabled\") != null) {\n console.log('Disabled!');\n return false;\n } else {\n // do some stuff and eventually erase textarea \n $textarea.val('');\n }\n});\n\n\nMy trouble is when i erase textarea (the end of the code) it doesn't disable the button. Any ideas would be appreciated (actually it's slight adaptation of my code but the situation reflected pretty good, hope it would be clear for you, thanks!)\n\nUPD\nNothing found on stackoverflow doesn't help.\n\nUPD2\nAs i said in the begin, i was looking not for workaround like force trigger event, i thought it's possible to catch any event fired by $textarea.val(); Sure @Madbreaks and @epascarello 's solutions work pretty good, thanks guys." ]
[ "javascript", "jquery" ]
[ "After row saved call back in jqgrid", "I need to able to tap into an event after row has been updated, I use inline editing. There is a beforeSend event in ajaxRowOptions but no matching after.\n\nHow do I implement an after save callback?\n\nHere is my grid:\n\n $('#myGrid').jqGrid({\n datatype: 'local',\n jsonReader: common.jqgrid.jsonReader('Code'),\n editurl: common.getServerPath() + 'myAjax/updateSomething/',\n ajaxRowOptions: {\n beforeSend: function (jqXhr, settings) {\n //something here\n }\n }\n }, \n\n mtype: 'POST',\n pager: '#myPager',\n colNames: ['Method', 'Type', 'Package', 'Disc %'],\n colModel: [\n {\n name: 'Code',\n index: 'Code',\n width: 25,\n sortable: false\n },\n {\n name: 'MethodType',\n index: 'MethodType',\n width: 10,\n sortable: false,\n align: 'center'\n },\n {\n name: 'ProfNo',\n index: 'ProfNo',\n width: 15,\n sortable: false,\n align: 'center'\n },\n\n {\n name: 'Discount',\n index: 'Discount',\n width: 15,\n sortable: false,\n edittype: 'text',\n align: 'right',\n editable: true,\n editrules: {\n number: false,\n custom: true,\n custom_func: validateDiscount \n }\n }],\n\n scroll: true,\n hidegrid: false,\n altRows: true,\n altclass: 'gridAltRowClass',\n height: 330, \n scrollOffset: 0,\n width: 770, \n rowNum: 500,\n footerrow: true,\n userDataOnFooter: true\n});\n\n\nand \n\n validateDiscount: function (value) {\n\n if (isNaN(value)) {\n return [false, 'Discount must be a number.'];\n }\n else {\n var numValue = parseFloat(Number(value).toFixed(2));\n\n if (numValue >= 100.00) {\n return [false, 'is not a valid value. Discount must be a number less than 100.'];\n }\n }\n\n return [true, ''];\n}," ]
[ "javascript", "ajax", "jqgrid" ]
[ "Proper design to parse file in c++", "I'm trying to parse a file and store the different fields in some variable.\nHowever, I'm not sure of the proper design to do this:\n\nShould I have a class for parsing and a class for storage, or should the parser also be used as storage to hold the fields ?\n\nI also have to keep in mind that I might need to extend the parser as new fields may appear in the file.\n\nEdit: It has been mentionned that the question was too broad. I included more details here but I didn't want to influence the answers with what I already implemented. In my current implementation I faced some issues to extended the parser, and someone pointed out that I shouldn't separate data storage and parser (because of the single responsibility principle) but for me it made sense to separate them." ]
[ "c++", "parsing" ]
[ "Struts redirection from action to Jsp and back again to same action class giving null pointer exception", "I have created action classes and jsp's using affuse frame work. But problem is when i am working with redirections exmple when we press add button in jsp fReleaseList.jsp redirects to action class is FReleaseAction.java and initializes instance variable \"fRelease\" and redirects to fReleaseForm.jsp and when save button is pressed it agin redirects to same action class \nFReleaseAction.java and there the \"fRelease\" variable will be null. Config file for this is as bellow,\n\n\n \n /WEB-INF/pages/fReleaseList.jsp\n \n\n <action name=\"editFRelease\" class=\"com.vxl.appanalytix.webapp.action.FReleaseAction\" method=\"edit\">\n <result>/WEB-INF/pages/fReleaseForm.jsp</result>\n <result name=\"error\">/WEB-INF/pages/fReleaseList.jsp</result>\n </action>\n\n <action name=\"saveFRelease\" class=\"com.vxl.appanalytix.webapp.action.FReleaseAction\" method=\"save\">\n <result name=\"input\">WEB-INF/pages/fReleaseForm.jsp</result>\n <result name=\"cancel\" type=\"redirectAction\">fReleases</result>\n <result name=\"delete\" type=\"redirectAction\">fReleases</result>\n <result name=\"success\" type=\"redirectAction\">fReleases</result>\n </action>\n <!--FReleaseAction-END-->" ]
[ "java", "jsp", "struts" ]
[ "How to check to see if steam user has a game", "I am new to JavaScript. I am making a discord bot that gets game statistics from the steam API. I use the npm package steam-api and discord.js-commando. I can't figure out a way how to check to see if a steam user has a game.\n\nWhenever you input a steamID64 that has their games private or doesn't have the game it will print this in the terminal:\n\n\"D:\\Discord Bots\\statbot\\node_modules\\q\\q.js:155\n throw e;\"\n\n\nI have been trying to solve this for a week and a half. I could not find anything to solve this.\n\nThank you for your time." ]
[ "javascript", "q", "discord.js", "steam-web-api" ]
[ "GAE Golang - queries not returning data right after it is saved", "I am writing a Google App Engine Go application and I'm having problem in testing some functionality. Here is some sample code. The problem is as follows:\n\n\nI create a new item and save it to datastore\nI make a search query for that item immediately after (for example, getting all items in the namespace)\nThe item is not there\n\n\nIf I query for the item later (say, in subsequent pages), the item is found normally. I understand this behaviour might be intentional for apps deployed on GAE, but I would expect the local datastore to be instantly good for queries.\n\nIs there any way I can force the datastore to consolidate and be good for such queries?" ]
[ "google-app-engine", "go", "google-cloud-datastore" ]
[ "What is the difference \"getByText\" and \"getByTestId\" ? In testing-library/react", "What is the difference between getByText and getByTestId?\nWhen I had tested a React component, there were some gaps between these two functions.\nThe test failed in getByText code, but it succeeded in getByTestId.\nI have code that when an element was clicked, the color of the title changed to red.\nWhy this is the difference?\nI omitted styled-components of Container and Content. This has props 'toggled' to change the color to red.\nHere is the getByText code:\nconst { getByText } = render(<ListPresenter content={ListText} />);\nconst colorChangedText = getByText(/the party/);\nfireEvent.click(colorChangedText);\nscreen.debug(); // The result of render I want !\nexpect(colorChangedText).toHaveStyle("color: red"); * failed\n\nHere is the getByTestId code:\nconst { getByText } = render(<ListPresenter content={ListText} />);\nfireEvent.click(getAllByTestId("list-element-toggle")[0]);\nscreen.debug(); // The result of render I want !\nconst colorChangedText = getAllByTestId("list-element-content")[0];\nexpect(colorChangedText).toHaveStyle("color: red"); * success\n\nHere is the rendered component:\nconst Component = (props) => {\n return (\n <Container\n className="container"\n data-testid={"list-element-toggle"}\n toggled={state[data.id - 1]}\n >\n <Content className="content" data-testid={"list-element-content"} toggled={state[data.id - 1]}>\n {data.titleChild}. // This text had been changed to red color when i was clicked.\n \n </div>\n </div>\n )\n}" ]
[ "reactjs", "testing", "styled-components", "react-testing-library" ]
[ "The navigation bar is always open by default. Bootstrap-5", "Based on this question(@Zim's answer), for bootstrap-5 I used this code to close the navigation bar on click, but for some reason it does not work quite correctly. The navigation panel is default open. How to fix it?\nThank!\n\r\n\r\nconst navLinks = document.querySelectorAll('.nav-item');\nconst menuToggle = document.getElementById('navbarNav');\nconst bsCollapse = new bootstrap.Collapse(menuToggle);\nnavLinks.forEach((l) => {\n l.addEventListener('click', () => { bsCollapse.toggle() })\n});\r\n<script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js\"></script>\n<link href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css\" rel=\"stylesheet\"/>\n<nav class=\"navbar navbar-expand-lg navbar-light bg-light\">\n <div class=\"container-fluid\">\n <a class=\"navbar-brand\" href=\"#\">Navbar</a>\n <button class=\"navbar-toggler\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#navbarNav\" aria-controls=\"navbarNav\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n <span class=\"navbar-toggler-icon\"></span>\n </button>\n <div class=\"collapse navbar-collapse\" id=\"navbarNav\">\n <ul class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a class=\"nav-link active\" aria-current=\"page\" href=\"#\">Home</a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link\" href=\"#\">Features</a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link\" href=\"#\">Pricing</a>\n </li>\n <li class=\"nav-item\">\n <a class=\"nav-link disabled\" href=\"#\" tabindex=\"-1\" aria-disabled=\"true\">Disabled</a>\n </li>\n </ul>\n </div>\n </div>\n</nav>" ]
[ "twitter-bootstrap" ]
[ "Monitoring multiple machines - what kind od approach to use?", "I writing application that runs on client PC/tablets and each few seconds is sending some kind of data (numerical...) to server over TCP/IP. This \"server\" should be able to manage multiple connections in the same time and show those data on screen in \"real time\". My idea is to write web-type application as somekind of dashboard that will create frame for each connected machine and display some data, something like this: \n\nI'm doing this for the first time and I don't have so much experience with this kind of project I'm wondering from where to start? What is the best approach to achieve this? What kind of library, technology you suggest to use?" ]
[ "c#", "php", "webserver", "monitoring", "tcp-ip" ]
[ "Make plotly always show the origin (0,0) when making the plot in R", "I have a shiny application which present a scatterplot. The shiny user perform data filtering, then the data is display in the plotly graph. Sometime, the data created will be all negative or all positive, but I still want to plot to be positioned a way that the origin (0,0) is displayed. \n\nExample:\n\ndd <- data.frame(x=c(2,3,6,2), y=c(5,2,7,3))\nplot_ly(data=dd, x=~x, y=~y, type=\"scatter\", mode=\"markers\")\n\n\ngives:\n\n\n\nBut I want it to look initially more like that:\n\n\n\nAny idea how to do that?" ]
[ "r", "plotly" ]
[ "Angular RxJs level up during looping an array", "I have an http get request to get an array like\n\n[\n {name: 'name1', id: 1, specialProp: [] },\n {name: 'name2', id: 2, specialProp: [] }\n]\n\n\nI need to get each of array items, take an id and send a request to server to get some information. The results should be written into the property specialProp. After that I need to take the array of the prop specialProp and for each item get some data, put it into anotherSpecialProp. In the end I should have the final array like \n\n[\n {name: 'name1', id: 1, specialProp: [\n {name: 'c', anotherSpecialProp: []}, \n {name: 'd', anotherSpecialProp: []}\n ]},\n\n {name: 'name2', id: 2, specialProp: [\n {name: 'a', anotherSpecialProp: []},\n {name: 'b', anotherSpecialProp: []}\n ]}\n]\n\n\nI have the code:\n\nthis.http.get(url)\n .pipe(\n switchMap((mainItemArr: any) => from(mainItemArr)),\n mergeMap((mainItem: any): any => {\n return this.getSomeInfo(mainItem.Id) //another http get request\n .pipe(\n map((data: any): any => {\n return Object.assign(mainItem, { specialProp: data })\n }),\n switchMap((mainItemArr: any): any => from(mainItemArr.specialProp)),\n concatMap((item: any): any => {\n return this.getSomeOtherInfo(item.Id) // one more http get request\n .pipe(\n map((data: any): any => Object.assign({}, task, { anotherSpecialProp: data }))\n )\n }),\n )\n })\n )\n\n\nSo in subscribe I receive just the items, not the whole mainItemArr.\nCould anyone please assist me with the issue?:)" ]
[ "angular", "http", "rxjs" ]
[ "how to have composed primary key in hyperledger composer model file as identifer?", "I have this in my model file in hyperledger composer:\n\nparticipant seller identified by name {\no String name\no String lastName\n}\n\n\nbut I want to use name and lastName as identifier, anyone knows how can I do this?" ]
[ "hyperledger-fabric", "hyperledger", "hyperledger-composer", "identifier" ]
[ "Webbrowser SetAttribute not working (Password Field)", "tried to write a program which logs me in automatically in a webbrowser in c#. This is the code i use at the moment for this purpose:\n\nHtmlElementCollection pageTextElements = loginBrowser.Document.GetElementsByTagName(\"input\");\n foreach (HtmlElement element in pageTextElements)\n {\n if (element.Name.Equals(\"username\"))\n element.SetAttribute(\"value\", this.UserName);\n if (element.Name.Equals(\"password\"))\n element.SetAttribute(\"value\", this.Password);\n }\n\n\nIt fills in the Username, but not the password? ):\nGoogled around but there are only a few people which started topic to which no one ever replied. /:\n\nhopefully someone can help me.\nthis is the source auf the password field:\n\n<input type=\"password\" value=\"\" maxlength=\"50\" size=\"25\" name=\"password\" class=\"bginput\">" ]
[ "c#", "passwords", "browser", "setattribute" ]
[ "NHibernate Linq Provider question", "Can anyone answer me what are the differences of\n\nSession.Query\n Session.Linq and\n Session.QueryOver \n\nWhat I'm really interested in:\nWhat would be supported in the future versions.\nWhat should I start to use in a clean project. \n\nPlease tell me your thoughts about these three...\n\nThanks,\nZoltán" ]
[ "nhibernate", "linq-to-nhibernate" ]
[ "Why in the iOS vue-resouce get request cannot accept the callback?", "I had embeded an HTML in a webview of iOS. I want to send a request of ajax with vue-resouce framework. The request is ok, but why in the iOS vue-resouce get request cannot accept the callback?\n\nvar vm = new Vue({\n el:'#check',\n data:{\n msg:'Hello World!',\n url:'http://localhost:8080/v1/user/check/'\n },\n methods:{\n get:function(token){\n alert(token)\n\n var realUrl = this.url + token\n\n this.$http.get(realUrl).then(function(response){\n alert('1')}\n ).then(function(response){\n alert(response);\n alert('1')\n });\n }\n }\n});\n\nfunction getToken() {\n var token = bridge.call(\"getToken\")\n alert(token)\n vm.get(token);\n}" ]
[ "ios" ]
[ "IMDB API to retrieve character information", "Is there an IMDB API to retrieve character information ? Assuming I know the exact name of the character ?" ]
[ "api", "imdb" ]
[ "ES6 what is this triple fat arrow syntax", "Ran into some code that looks like the following:\n\nreturn store => next => action => {\n switch(action.type) {\n ...\n default:\n return next(action)\n};\n\n\nThe entire sample is here: https://exec64.co.uk/blog/websockets_with_redux/\n\nWhat is the triple arrow syntax here? I'm familiar with arrow functions, but I've never seen more than one used before to define a function." ]
[ "javascript", "ecmascript-6" ]
[ "cxGrid 6 FocusedRecordChanged want to know if FocusedItemChanged", "I have the GotToNextCellOnEnter and the FocuscellOnCycle properties set to true. When I press enter on the last cell the FocusedRecordChanged event fires and then the FocusedItemChanged event fires. Is there a way of detecting that the FocusedItemChanged event is due to fire from within the FocusRecordChanged event. I am trying to use these events stop the user from focusing on specific cells. I want to ignore the FocusedRecordChanged event if the FocusedItemChanged event is going to fire just after it. Ideally what I want is a FocusedCellChanged event but there is not one of these.\n\nThanks" ]
[ "delphi", "devexpress", "vcl" ]
[ "How does a javascript onclick attribute work for more output from array with loop?", "// My problem is when my checkit() function is called it only shows the check.png image once next to the first item in array.\n\n<?php\nrequire 'connectit.php';\n\nif($result = $db->query(\"SELECT * FROM people ORDER BY id\")) {\n if($count = $result->num_rows) {\n\n echo \"<h3>He's got $count bills to pay.</h3>\";\n echo \"<p>\";\n while($row = $result->fetch_object()) {\n echo \"<div id=\\\"check\\\" onClick=\\\"checkit();\\\"><img id=\\\"img\\\" src=\\\"\\\" /></div>\";\n $id = $row->id;\n\n echo $row->bill_name, ': $', $row->bill_cost,\n ' ',\"<a href=\\\"delete_id.php?id=\" . $id . \"\\\">X</a><br/><br/>\"; \n echo \"</p>\"; \n } \n }\n}\n?>\n//javascript onclick function\n<script type=\"text/javascript\">\nfunction checkit(){\ndocument.getElementById(\"img\").src = \"check.png\";\n//needed to put a line through the text, to mark through it but can't figure that out either. I tried this.\ndocument.getElementById(\"p\").style.texttransform = \"underline\"; //didn't work for me.\n}\n</script>" ]
[ "javascript", "php", "mysql" ]
[ "Calling the event handler programmatically in an MFC application", "I am working on an MFC application (C++)\n\nMy checkbox has an event hander mapped to the ON_BN_CLICKED. \nIt works fine when the user check/uncheck the box, i.e. the event handler is called.\n\nHowever, when I check the box programmatically: ((CButton *)this->GetDlgItem(x))-> ->SetCheck(1); the event handler is not called.\n\nWhat should I do in order to call the event handler programmatically?" ]
[ "c++", "mfc", "event-handling" ]
[ "add fields to SearchIndex dynamically (django-haystack)", "Currently I see two possibilities, with using locals() and using setattr() after definition of SearchIndex class:\n1.\nclass TestIndex(indexes.SearchIndex, indexes.Indexable):\n for name in fields:\n locals()["attr_%s" % name] = DescriptionSearchField(boost=3, **{"d_attr": name, "name": "attr"})\n locals()["slug_%s" % name] = DescriptionSearchField(**{"d_attr": name, "name": "slug"})\n\n2.\n\nclass TestIndex(indexes.SearchIndex, indexes.Indexable):\n pass\n\nfor name in fields:\n setattr(JobTestIndex, \"attr_%s\" % name, DescriptionSearchField(boost=3, **{\"d_attr\": name, \"name\": \"attr\"}))\n setattr(JobTestIndex, \"slug_%s\" % name, DescriptionSearchField(**{\"d_attr\": name, \"name\": \"slug\"}))\n\nI am using Django-haystack with ElasticSearch.\nI know that using locals() is not the best practice.\nWhat then is the correct approach to my issue?\nAny suggestions are greatly appreciated. Thanks." ]
[ "django", "django-haystack" ]
[ "Method calling and display issue", "I am new to java and the coding is probably sloppy so please don't be harsh! Anyways, I am making a method that will set increase in turn by 1 each time I hit the end turn button. \n\npublic int turns (int turn){\n int turns = 0;\n\nif (turn == 0){\n btnYes.setEnabled(false);\n btnNo.setEnabled(false);\n btnRolldie.setEnabled(true);\n btnPurchase.setEnabled(true);\n btnMove.setEnabled(true); \n turn++;\n}\n if (turn == 1){\n btnYes.setEnabled(false);\n btnNo.setEnabled(false);\n btnRolldie.setEnabled(true);\n btnPurchase.setEnabled(true);\n btnMove.setEnabled(true); \n turn++;\n}\n if (turn == 2){\n btnYes.setEnabled(false);\n btnNo.setEnabled(false);\n btnRolldie.setEnabled(true);\n btnPurchase.setEnabled(true);\n btnMove.setEnabled(true); \n turn++;\n}\n if (turn == 3){\n btnYes.setEnabled(false);\n btnNo.setEnabled(false);\n btnRolldie.setEnabled(true);\n btnPurchase.setEnabled(true);\n btnMove.setEnabled(true); \n turn = 0;\n}\nreturn(turns);\n}\n\nprivate void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) { \nint turns = 0;\n\nlblturn.setText(\"\" +turns(turns));\n\n\nWhen I run the program, the label constantly repeats 0 whenever I hit the button. I was thinking that int turns; would work, but the variable isn't initialized. I do not know if there is an error in my method, or if the initialization in the button is overriding the method.\n\nAs I said, i'm new to java so this might be the entirely wrong approach, and if it is, please give me some recommendations on how to improve this kind of structure. Thanks!" ]
[ "java" ]
[ "re build ul and li tag with Jquery", "I try to find the way to split ul tag by showing only 10 li tag per ul. \n\nSuppose I have li 30 elements. script will be re build into 3 ul and each ul has 10 li tag.\n\nHow can I do this ?\n\nsuppose original is : \n\n<ul id=\"ul1\" style=\"\">\n <li><a href=\"#\"><span>Adidas</span></a></li>\n <li><a href=\"#\"><span>jason markk</span></a></li>\n <li>... 28 mores </li>\n</ul>\n\n\nJquery will re build ul in to 3 ul (10 li per ul):\n\n<ul id=\"ul1\" style=\"\">\n <li>10 times</li>\n</ul>\n<ul id=\"ul2\" style=\"\">\n <li>10 times</li>\n</ul>\n<ul id=\"ul3\" style=\"\">\n <li>10 times</li>\n</ul>\n\n\nPlease guide,\nThanks" ]
[ "jquery", "html", "css" ]
[ "How do you do the \"therefore\" (∴) symbol on a Mac or in Textmate?", "Is there a way to write the ∴ therefore symbol with keyboard shortcuts in Textmate or just on a mac?" ]
[ "textmate", "symbols" ]
[ "bubble sort on link list is removing elements during swap", "current uni student and i am trying to sort a link list by only swapping the links and not the data ( as per requirements)\nmy link definition is:\ntypedef struct iorb {\n int base_pri;\n struct iorb *link;\n char filler[100];\n} IORB;\n\nI am building the list like so:\nvoid buildList(IORB **h, int size,int(*prio)(int)){\n int counter = size;\n // loop will run until the size of the list is reached \n while(size > 0){ \n IORB *temp = (IORB*)malloc(sizeof(IORB)); //alocating memory on the stack for the link list\n temp->base_pri = (rand() % 100); // assigning random number as the base pointer\n sprintf(temp->filler, "request %d : base priority = %d : priority = %d \\n",\n counter, temp->base_pri,(*prio)(temp->base_pri));\n temp->link = *h; // making sure the head points to the next item in the list.\n *h = temp;\n counter--;\n size--;\n \n }\n}\n\nand this is my sort function:\nvoid sortList(IORB* head,int (*prio)(int)){\n int swapped = 1;\n\n while(swapped)\n {\n //pointers for the last current and next node\n IORB **prev = &head, *curr, *next;\n\n swapped = 0;\n for(curr = head; curr; prev = &curr->link, curr = curr->link)\n {\n next = curr->link;\n\n if(next && (*prio)(curr->base_pri) > (*prio)(next->base_pri))\n {\n curr->link = next->link;\n next->link = curr;\n *prev = next;\n\n swapped = 1;\n }\n }\n }\n}\n\npriComp is an additional function defined as:\nint priComp(int bs){\n return (bs * 3);\n}\n\nand to display the list:\nvoid displayList(IORB* head){\n while(head != NULL)\n {\n printf("%s",head->filler);\n head = head->link;\n \n }\n \n}\n\nthe problem I am having:\nafter building the list and using the display function I can correctly see the list\nbut after I call the sort function and reprint the list sometimes the list will print sorted but majority of the time I will be missing elements\nfor example -\nbefore sort:\nrequest 1 : base priority = 10 : priority = 30\nrequest 2 : base priority = 3 : priority = 9\nrequest 3 : base priority = 53 : priority = 159\n\nafter sort:\nrequest 2 : base priority = 3 : priority = 9\nrequest 1 : base priority = 10 : priority = 30\n\nthe list fails to print request 3. (it is not always the last element it skips but sometimes will skip an element in the middle of the list)\nWhen i run the sort function through the debugger I can not pinpoint when the links are either being lost or removed. the loops and if statements seem to be flowing correctly." ]
[ "c", "linked-list", "bubble-sort" ]
[ "Cassandra parallel insert performance c#", "When testing Cassandra C# insert performance on single node i7 8cores got only 100 inserts/sec. Are there any code improvements possible using Datastax Cassandra driver? Tried async and sync Session.Execute, but performance is very poor.\n\n[TestMethod]\npublic void TestMethod2()\n{\n // CREATE TABLE table1(\n // col1 text,\n // col2 timestamp,\n // col3 int,\n // col4 text,\n // PRIMARY KEY(col1, col2, col3)\n // );\n\n PoolingOptions poolingOptions = new PoolingOptions();\n poolingOptions\n .SetCoreConnectionsPerHost(HostDistance.Local, 1280)\n .SetMaxConnectionsPerHost(HostDistance.Local, 1280)\n .SetCoreConnectionsPerHost(HostDistance.Remote, 1280)\n .SetMaxConnectionsPerHost(HostDistance.Remote, 1280);\n\n poolingOptions\n .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 32768)\n .SetMinSimultaneousRequestsPerConnectionTreshold(HostDistance.Remote, 2000);\n\n var cluster = Cluster.Builder()\n .AddContactPoints(\"localhost\")\n .WithPoolingOptions(poolingOptions)\n .WithQueryOptions(new QueryOptions().SetConsistencyLevel(ConsistencyLevel.One))\n .WithLoadBalancingPolicy(new RoundRobinPolicy())\n .Build();\n\n var options = new ParallelOptions();\n options.MaxDegreeOfParallelism = 50;\n\n using (var session = cluster.Connect(\"keyspace1\"))\n {\n var ps = session.Prepare(\"INSERT INTO table1(col1,col2,col3,col4) VALUES (?,?,?,?)\");\n\n var r = Parallel.For(0, 1000, options, (x) =>\n {\n {\n var statement = ps.Bind(\"123456\", DateTime.UtcNow, x, \"1234 some log message goes here. Hello world. 123334556567586978089-==00\");\n var t = session.ExecuteAsync(statement);\n t.Wait();\n }\n });\n }\n}" ]
[ "c#", "cassandra" ]
[ "change proxy configuration targets dynamically in angular", "In my angular application, I am using proxy configuration file consisting of some proxies. My file looks like this.\n\nproxy.conf.json\n\n{\n \"/login\": {\n \"target\": \"http://w3:8080\",\n \"changeOrigin\":true,\n \"secure\": false\n }, \n \"/api/usersvcs/*\": {\n \"target\": \"http://w3:8080\",\n \"pathRewrite\": {\"^/api/usersvcs\": \"\"},\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n \"/api/ordersvcs/*\": {\n \"target\": \"http://w3:8989\",\n \"pathRewrite\": {\"^/api/ordersvcs\": \"\"},\n \"changeOrigin\":true,\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n \"/api/paymentsvcs/*\": {\n \"target\": \"http://w3:9898\",\n \"pathRewrite\": {\"^/api/paymentsvcs\": \"\"},\n \"changeOrigin\":true,\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n}\n\n\nThis file is in root directory of my project (outside src folder).\nEvery time I need to change target parameter if I want to work with some other back end services hosted on different ports. In the above file, I am working with w3 , and then the port numbers after colon.\nIf I want to work with w5, I have to change the entire path targets like this.\n\n{\n \"/login\": {\n \"target\": \"http://w5:8080\",\n \"changeOrigin\":true,\n \"secure\": false\n }, \n \"/api/usersvcs/*\": {\n \"target\": \"http://w5:8080\",\n \"pathRewrite\": {\"^/api/usersvcs\": \"\"},\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n \"/api/ordersvcs/*\": {\n \"target\": \"http://w5:8989\",\n \"pathRewrite\": {\"^/api/ordersvcs\": \"\"},\n \"changeOrigin\":true,\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n \"/api/paymentsvcs/*\": {\n \"target\": \"http://w5:9898\",\n \"pathRewrite\": {\"^/api/paymentsvcs\": \"\"},\n \"changeOrigin\":true,\n \"secure\": false,\n \"logLevel\":\"debug\"\n },\n}\n\n\nI am using npm start command in which I have included proxy.conf.json file which looks like below in package.json\n\n\"scripts\":{\n ...\n \"start\": \"ng serve --proxy-config proxy.conf.json --o\",\n ...\n},\n\n\nIs it possible to change the target hostnames something like if I use\n\nnpm start w5\n\nthen the proxy file should be like one above with the targets having w5." ]
[ "angular" ]
[ "Processing a Table using Google Cloud DLP API is too slow", "Recently, I have been trying to use the Google DLP API in Python 3 to classify the content of tables. I first started by testing the API on small examples, which all worked perfectly. However, as I attempted to send larger tables (1000 rows x 18 columns which is smaller than the 50 000 quota), the request would crash. \nAfter reducing the size of the table to 100 rows, I did manage to make it run, however a single request of 100 rows takes approximately 10 seconds. \nMost values are fairly short, you find some of the columns bellow: \n\n\nAddress\nDate of birth\nEmail\nFirst Name\nGender\nJob Position\nLast Name\n\n\nFurthermore, after further experimentation, I have noticed that if the same table is provided as a string in a CSV format (columns separated by \",\" and rows by \"\\n\"), running time is reduced by a factor of 10. \n\nIs this a normal behaviour? Or am I perhaps using the api poorly leading to such poor running performances?\n\nI hope my question is clear enough,\nThanks for taking the time to read this ! :)" ]
[ "google-cloud-platform", "google-cloud-dlp" ]
[ "Apache Ignite topology separated in Kubernetes", "I have 5 replicas of stateful set of Apache Ignite cluster into a Kubernetes.\nI use TcpDiscoveryKubernetesIpFinder as a node discovery mechanism in the cluster.\n\nAfter running the cluster for sometime, I found out that the cluster is being split into 2 separated topologies.\n\nBelow is an example of config.xml of Apache Ignite:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n-->\n\n<!--\n Configuration example with Kubernetes IP finder and Ignite persistence enabled.\n WAL files and database files are stored in separate disk drives.\n-->\n<beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"\n http://www.springframework.org/schema/beans\n http://www.springframework.org/schema/beans/spring-beans.xsd\">\n\n <bean class=\"org.apache.ignite.configuration.IgniteConfiguration\">\n\n <property name=\"dataStorageConfiguration\">\n <bean class=\"org.apache.ignite.configuration.DataStorageConfiguration\">\n <!-- Redefining the default region's settings -->\n <property name=\"defaultDataRegionConfiguration\">\n <bean class=\"org.apache.ignite.configuration.DataRegionConfiguration\">\n <property name=\"name\" value=\"default\"/>\n <!-- Setting the size of the default region to 4GB. -->\n <property name=\"maxSize\" value=\"#{256L * 1024 * 1024}\"/>\n <!-- Enabling RANDOM_LRU eviction for this region. -->\n <property name=\"pageEvictionMode\" value=\"RANDOM_LRU\"/>\n </bean>\n </property>\n </bean>\n </property>\n\n <property name=\"peerClassLoadingEnabled\" value=\"true\"/>\n <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->\n <property name=\"discoverySpi\">\n <bean class=\"org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi\">\n <property name=\"ipFinder\">\n <!--\n Enables Kubernetes IP finder and setting custom namespace and service names.\n -->\n <bean class=\"org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder\">\n <property name=\"namespace\" value=\"dev\"/>\n <property name=\"serviceName\" value=\"ignite-dev\"/>\n </bean>\n </property>\n </bean>\n </property>\n </bean>\n</beans>\n\n\nI would like to know how can I prevent this from happening?" ]
[ "kubernetes", "ignite" ]
[ "How to enable stem language in php?", "I have installed porter stemmer: \n\npecl install stem\n\n...\n\nCompile Danish stemmer? [yes] : n\nCompile Dutch stemmer? [yes] : n\nCompile English stemmer? [yes] : y\nCompile Finnish stemmer? [yes] : n\nCompile French stemmer? [yes] : n\nCompile German stemmer? [yes] : n\nCompile Hungarian stemmer? [yes] : n\nCompile Italian stemmer? [yes] : y\nCompile Norwegian stemmer? [yes] : n\nCompile Portuguese stemmer? [yes] : n\nCompile Romanian stemmer? [yes] : n\nCompile Russian stemmer? [yes] : y\nCompile Russian (UTF8) stemmer? [yes] : y\nCompile Spanish stemmer? [yes] : n\nCompile Swedish stemmer? [yes] : n\nCompile Turkish (UTF8) stemmer? [yes] : n\n\n\nI have added\n\nextension=stem.so\n\n\nstring in the end of php.ini file and ... \n\nservice apache2 restart\n\n\nBut phpinfo shows me:\n\nstem\nstem support enabled\nversion 1.5.1\ncompiled as dynamic module\nLanguages Supported\nOriginal Porter enabled (default)\nDanish disabled\nDutch disabled\nEnglish disabled\nFinnish disabled\nFrench disabled\nGerman disabled\nHungarian disabled\nItalian disabled\nNorwegian disabled\nPortuguese disabled\nRomanian disabled\nRussian disabled\nRussian (Unicode) disabled\nSpanish disabled\nSwedish disabled\nTurkish (Unicode) disabled \n\n\n...and function stem_english does not exists. \n\nHow to enable languages? \n\nP.S.: And this text I have to insert to avoid \"looks like mostly code\" error. Moderators can remove it." ]
[ "php", "stem" ]
[ "how many docker containers should a java web app w/ database have?", "I'm trying to \"dockerize\" my java web application and finally run the docker image on EC2. \n\nMy application is a WAR file and connects to a database. There is also a python script which the application calls via REST. The python side uses the tornado webserver\n\nQuestion 1:\n\nShould I have the following Docker containers?\n\n\nContainer for Application Server (Tomcat 7)\nContainer for HTTP Server (nginx of httpd)\nContainer for postgres db \nContainer for python script (this will have tornado web server and my python script). \n\n\nQuestion 2:\n\nWhat is the best way to build dockerfile? I will have to do trial and error for what commands need to be put into the dockerfile for each container. Should I have an ubuntu VM on which I do trial and error and once I nail down which commands I need then put them into the dockerfile for that container?" ]
[ "python", "tomcat", "docker", "application-server" ]
[ "Column tag of css is not working in internet explorer", ".threeColulmn{\n columns:170px 3;\n -webkit-columns:170px 3; \n -moz-columns:170px 3; \n}\n\n\nI am trying to dividing div into three columns it works porperly in mozila and chrome but in internet explorer its not working. kindly give me some solution." ]
[ "css" ]
[ "Difference between MakeFile and Console App in Visual Studio", "For class I need to make a GUI based project. I chose C++ in Visual Studio. Saw a video of a guy making a simple factorial calculator app in Visual Studio, but at the beginning he chose MakeFile instead of ConsoleApp, and I was taught to use ConsoleApp but never the difference. Should I use MakeFile or can I do it at ConsoleApp?" ]
[ "c++", "visual-studio", "makefile", "console-application", "difference" ]
[ "Assign an object to an array within a loop in VBA", "I try to fill an array with objects that are created within a loop as follows. The problem is that all cells seem to have the same object in the end. The explanation might be that obj is not a local variable with respect to the loop.\n\nSub foo()\n Dim Arr(1 To 3) As Class1\n Dim i As Integer\n For i = 1 To 3\n Dim obj As New Class1\n obj.name = i\n Set Arr(i) = obj\n Next\n For i = 1 To 3\n Debug.Print Arr(i).name \n Next\nEnd Sub\n\n\nSurprisingly, the output is \n\n3\n3\n3\n\n\nI have also tried to remove the Set and instead have Arr(i) = obj. That results in Object variable or with block variable not set." ]
[ "excel", "vba" ]
[ "Creating child controllers", "I'm not sure if I'm thinking about my problem incorrectly, but basically here it is: I have a pen and paper gaming site I've built in PHP that I'm converting to Angular. I have one particular set of pages (for character sheets, displaying and editing) that are hit, then based on URL parameters, instantiate one of a few dozen subclasses, and call a common function among them. This function displays the page according to that subclasses template and logic. Example:\n\nURL: /characters/dnd4/5/\n\nWhen someone hits /characters/(anything)/ the site looks up (anything) to see if its a valid system, and instantiates an object of class (anything)Character, which is a child of Character. Character has a method called displayEdit which in (anything)Character calls the correct template for that system. Then everything gets carried down: functionality common to all characters (or a set of characters) is shared by parent classes, which can go up 2-3 tiers before hitting Character.\n\nIn PHP, this was just a case of having everything hit a set of common parents, but basic logic for the page is in the Character class, and then specific actions in the child classes. I'm having trouble figuring out how to map this in Angular. So far, I've just been creating controllers that do the logic for their page; I'm not sure how to set this up for logic being split to other functionality. I thought about making each option a directive, but can a directive be called dynamically? Should I be creating JS classes that operate the same? Can they carry the $scope from controllers?\n\nAll in all, I'm just not sure how to tackle this, or I've just overthought this so much I can't see an obvious solution." ]
[ "angularjs" ]
[ "How to Convert special chars with their entity names (like & with &) using javascript", "I have small requirement, have JSON data and I would like to convert all specialChars with escapeChars,\nI tried with following code but it throws an error like Object doesn't support property or method 'split', please share me your ideas.\n\nfunction applyEscapeChars()\n { \n var str = { \"aaData\": [\"dummy < data\",\"ampersand&aaa\",\"2015-02-16\",\"2015-02-16\",470.5,\"xyz\",1,0,\"\",\"Error: 1 Invalid format/sample\",\"---\"]} \n var specialChars = new Array();\n specialChars[0] = \"&\";\n specialChars[1] = \"\\\"\";\n specialChars[2] = \"'\";\n specialChars[3] = \"<\";\n specialChars[4] = \">\";\n var escapeChars = new Array();\n escapeChars[0] = \"&\";\n escapeChars[1] = \""\";\n escapeChars[2] = \"'\";\n escapeChars[3] = \"<\";\n escapeChars[4] = \">\";\n\n for (var i =0; i < specialChars.length; i++ )\n { \n str = JSON.stringify(str ).split(specialChars[i]).join(escapeChars[i]); \n }\n //alert(str);\n\n return str;\n\n }\n\n\nNow everything is working fine except less than symbol(<)" ]
[ "javascript", "jquery" ]
[ "Tagging an SVN checkout with externals on development branches", "Most of our projects use a lot of common code. We are (finally) moving towards a system where we are managing that shared code in a uniform way. We treat the shared code as a separate project in SVN, then reference it as an external. However, we tend to point the external libraries to development branches or even the trunk while the project is under development, due to the inevitable gotchas from porting the libraries from one usage to another. \n\nAs a result, we have been making mistakes when tagging files for release or internal milestones. Once in a while we will tag a project without ensuring that all the externals have been tagged first. How can we solve this problem? I'm looking for ways to reduce the possibility of a mistake or to recover/repair after making a sloppy tag like this. Ideally the solution would be a way to make SVN enforce the current policy, but I'm interested in any experience with problems like this." ]
[ "svn", "version-control", "tags" ]
[ "AutoMapper add custom property that does not exist in source but has to exist in target", "I've got a simple ASP.NET Core controller:\n\n[HttpGet(\"{id:int}\")]\n[ProducesResponseType(200)]\n[ProducesResponseType(404)]\n[ProducesResponseType(500)]\npublic ActionResult<RequestDto> Get(int id, [FromQuery]GetRequest getRequest)\n{\n var query = Mapper.Map<GetRequest, FindRequestQuery>(getRequest);\n query.Id = id;\n\n var request = _requestService.Find(query);\n\n if (request == null)\n {\n return NotFound();\n }\n\n var requestDto = Mapper.Map<Request, RequestDto>(request);\n\n return Ok(requestDto);\n}\n\n\nMy GetRequest does not have Id property, however my FindRequestQuery has one.\n\nThe example above works just fine, but I'm interested to know if there's a way to tell AutoMapper to map id from method parameter to FindRequestQuery property?" ]
[ "c#", "automapper" ]
[ "Phonegap record video for maximum 15 seconds", "I am creating an application in which user has to record video not more that 15 seconds. How to check duration while capturing video in phonegap. User should not record video more than 15 seconds.\n\nI dont want to use the below code. \n\nnavigator.device.capture.captureVideo(function(mediaFiles) {\n mediaFiles[0].getFormatData(function(data) {\n if(data.duration > 15) {\n alert('Your video is longer than the allowed 30 seconds.');\n }\n });\n }, function(error) { alert('An error occured'); }, null);\n\n\nThis checks duration after capturing video. \nIs it possible to stop recording video once user reach limit of 15 second." ]
[ "android", "ios", "video", "cordova" ]
[ "OCX registration free", "I would like to write a simple windows form application, I'd like to use a 3rd party\nfile, but it is deny to write in registry. \nI've tried to add this ocx control to project, but the Visual Studio runs the regsvr32, so it has been registered.\n\nIs it possible to use registration free activation, or I have to register in any case?" ]
[ "c#", "com", "manifest", "ocx", "side-by-side" ]
[ "WebRTC Packets in Network Logs", "Why is it that when WebRTC is streaming, nothing is captured in the network logs in the developers console in Chrome whereas when looking at Wireshark, it is clear that UDP segments are being transmitted and received." ]
[ "networking", "udp", "webrtc" ]
[ "PowerShell script and PSFTP command to verify directory is on remote server", "I am using the following code to log into a remote server in a PowerShell script & PuTTY SFTP (PSFTP), and I "put" a file from the local device, but I have no idea how to write code to figure out if the remote directory is there or not. I need to be able to verify the remote working directory is there before I put the file and before I delete it from the local folder.\n$path = "C:\\PSFTP\\psftp.exe"\n $user = "username"\n $password = "password"\n $Kiosk = "$Location"\n $cmd = @(\n "lcd C:\\Temp",\n "put $item",\n "bye"\n )\n $cmd | &$path -pw $password "$user@$kiosk"\n write-host "Moved $item to $Location"\n LogWrite "Moved $filePath to $Location"\n write-host "Deleted $NewfilePath"\n Remove-Item $NewfilePath\n }\n\nI would normally do an if statement like\nif (Get-ChildItem "$path") \n {\n #do stuff here\n }\n else\n {\n #couldn't connect to path so exit out\n exit\n }\n\nBut I don't know how to do this with PSFTP" ]
[ "powershell", "psftp" ]
[ "PHP Encryption and Decryption - High Level", "I need to create a good strong encryption system for a client. It would be used for storing sensitive user information. I just wanted to get some advice off someone who has more experience in this area. It sounds like 256 bit AES would be my best option.\n\nWhat I was thinking was http://www.movable-type.co.uk/scripts/aes-php.html\n\nAnd for the key, perhaps using a hash of something unique to each user?\n\nDoes this sound like a sufficient idea?" ]
[ "php", "encryption", "aes" ]
[ "Visual Studio 2010 HTML Designer Renders Unlike IE8?", "My question is: since Visual Studio 2010 was only just released, why does it not render pages in the same way as the latest Microsoft web browser, IE8?\n\nIs there a bunch of render options I should be setting?\n\nI thought Expression Web was supposed to help with its fancy Super Preview but that app doesn't even open VS solutions.\n\nThanks for any assistance, Luke" ]
[ "html", "css", "visual-studio" ]
[ "Return true/false along with model data", "I'm attempting to return a true or false (in JSON) along with my model data. Code builds and runs fine but I only get a return on my model data.\n\nWhat I've tried from reading other answers:\n\npublic IQueryable<Book> GetBooks()\n{\n HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);\n return db.Books;\n }\n\n\nAs you can probably easily see, I don't have the greatest idea of what I'm doing, but through the infinite wisom of this community I hope to learn another feat." ]
[ "asp.net-web-api2" ]
[ "Unable to move an image in HTML", "I am having an issue were i can move an image, no matter what i type it stays in the top right half cut out with no scrolling\n\r\n\r\n.container_767 {\n position: relative;\n text-align: center;\n color: #fff;\n}\n\n.imagetext_767 {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.image_767 {\n position: relative;\n width: 45%;\n height: 45%;\n left: 50%;\n bottom: 50%;\n transform: translate(-50%, -50%);\n}\r\n<div class=\"container_767\">\n <img class=\"image_767\" src=\"../images/aircraft/CS767_TN.JPG\">\n <div class=\"imagetext_767\">Captain Sim 767</div>\n</div>" ]
[ "html" ]
[ "Spark Structured Streaming MemoryStream + Row + Encoders issue", "I am trying to run some tests on my local machine with spark structured streaming. \n\nIn batch mode here is the Row that i am dealing with: \n\nval recordSchema = StructType(List(StructField(\"Record\", MapType(StringType, StringType), false)))\nval rows = List(\n Row(\n Map(\"ID\" -> \"1\",\n \"STRUCTUREID\" -> \"MFCD00869853\",\n \"MOLFILE\" -> \"The MOL Data\",\n \"MOLWEIGHT\" -> \"803.482\",\n \"FORMULA\" -> \"C44H69NO12\",\n \"NAME\" -> \"Tacrolimus\",\n \"HASH\" -> \"52b966c551cfe0fa7d526bac16abcb7be8b8867d\",\n \"SMILES\" -> \"\"\"[H][C@]12O[C@](O)([C@H](C)C[C@@H]1OC)\"\"\",\n \"METABOLISM\" -> \"The metabolism 500\"\n )),\n Row(\n Map(\"ID\" -> \"2\",\n \"STRUCTUREID\" -> \"MFCD00869854\",\n \"MOLFILE\" -> \"The MOL Data\",\n \"MOLWEIGHT\" -> \"603.482\",\n \"FORMULA\" -> \"\",\n \"NAME\" -> \"Tacrolimus2\",\n \"HASH\" -> \"52b966c551cfe0fa7d526bac16abcb7be8b8867d\",\n \"SMILES\" -> \"\"\"[H][C@]12O[C@](O)([C@H](C)C[C@@H]1OC)\"\"\",\n \"METABOLISM\" -> \"The metabolism 500\"\n ))\n )\nval df = spark.createDataFrame(spark.sparkContext.parallelize(rows), recordSchema)\n\n\nWorking with that in Batch more works as a charm, no issue. \n\nNow I'm try to move in streaming mode using MemoryStream for testing. I added the following: \n\n\nimplicit val ctx = spark.sqlContext\nval intsInput = MemoryStream[Row]\n\n\n\nBut the compiler complain with the as follows: \n\n\n No implicits found for parameter evidence$1: Encoder[Row]\n\n\nHence, my question: What should I do here to get that working\n\nAlso i saw that if I add the following import the error goes away: \n\n\n import spark.implicits._\n\n\nActually, I now get the following warning instead of an error\n\n\n Ambiguous implicits for parameter evidence$1: Encoder[Row]\n\n\nI do not understand the encoder mechanism well and would appreciate if someone could explain to me how not to use those implicits. The reason being that I red the following in a book when it comes to the creation of DataFrame from Rows.\n\nRecommended appraoch:\n\nval myManualSchema = new StructType(Array(\n new StructField(\"some\", StringType, true),\n new StructField(\"col\", StringType, true),\n new StructField(\"names\", LongType, false)))\nval myRows = Seq(Row(\"Hello\", null, 1L))\nval myRDD = spark.sparkContext.parallelize(myRows)\nval myDf = spark.createDataFrame(myRDD, myManualSchema)\nmyDf.show()\n\n\nAnd then the author goes on with this: \n\n\n In Scala, we can also take advantage of Spark’s implicits in the\n console (and if you import them in your JAR code) by running toDF on a\n Seq type. This does not play well with null types, so it’s not\n necessarily recommended for production use cases.\n\n\nval myDF = Seq((\"Hello\", 2, 1L)).toDF(\"col1\", \"col2\", \"col3\")\n\n\nIf someone could take the time to explain what is happening in my scenario when i use the implicit, and if it is rather safe to do so, or else is there a way to do it more explicitly without importing the implicit. \n\nFinally, if someone could point me to a good doc around Encoder and Spark Type mapping that would be great.\n\nEDIT1\n\nI finally got it to work with\n\n implicit val ctx = spark.sqlContext\n import spark.implicits._\n val rows = MemoryStream[Map[String,String]]\n val df = rows.toDF()\n\n\nAlthough my problem here is that i am not confident about what I am doing. It seems to me that it is like in some situation I need to create a DataSet to be able to convert it in an DF[ROW] with toDF conversion. I understood that working with DS is typeSafe but slower than with DF. So why this intermediary with DataSet? This is not the first time that i see that in Spark Structured Streaming. Again if someone could help me with those, that would be great." ]
[ "scala", "apache-spark", "spark-structured-streaming" ]
[ "What are the advantages of Hyperledger Fabric over Client-Server Model", "I have been searching but at the end the whole transaction process seems like Client-Server model with extra Blockchain steps." ]
[ "client-server", "hyperledger-fabric", "blockchain" ]
[ "HTMLWebPackPlugin and external GoogleMaps API Script", "I am using HtmlWebpackPlugin to generate my html with pug. When loading up the googlemaps API, I get initMap is not defined which I understand as my bundle (where initMap is defined) is loaded after the googlemaps script.\nMy HtmlWebpackPlugin set up:\n new HtmlWebpackPlugin({\n template: './src/pug/areas-covered.pug',\n filename: 'areas-covered.htm',\n inject: true\n }),\n\nRelevant generated html:\n <script async defer="defer" src="https://maps.googleapis.com/maps/api/js?key=xxxxx&callback=initMap">\n <script src="/assets/bundle.js">\n</body>\n\nRemoving async didn't seem to to the trick for me.\nMy current solution is to generate the Googlemaps script tag on the fly and append it to the body when the document is ready and this works fine:\nvar googlemaps = document.createElement('script');\ngooglemaps.setAttribute("src", "https://maps.googleapis.com/maps/api/js?key=xxxxx&callback=initMap");\ngooglemaps.setAttribute("type", "text/javascript");\ndocument.body.appendChild(googlemaps);\n\nI couldn't see any option to pass an external script and specify the order the scripts would be rendered. Is there a better way of achieving this with HtmlWebpackPlugin?" ]
[ "webpack", "html-webpack-plugin" ]
[ "Saving plots to working directory - plots are blank?", "I want to automatically write the output of my plots to my working directory. Also, I have structured my script in a way so some computation steps and plots are dependent on a preceding variable. Like this, some computation steps are skipped in case they are not necessary anymore or I am computing a different scenario.\n\nI am facing the following problem: the plot is correctly saved to the working directory if I call the function simply without the if condition. However, once I call the function within the if condition, only a blank plot is written to the working directory.\n\nThe following reproducible example demonstrates the issue (please replace the path of the working directory):\n\n##Set WD (!! replace with own path)\n\nsetwd(\"C:/Users/deca/Desktop\")\n\n##Initiate packages\n\ninstall.packages(\"effects\")\ninstall.packages(\"Cairo\")\n\nrequire(effects)\nrequire(Cairo)\n\n##Initiate data set and condition\n\nvarL <- rnorm(100, mean = 1000, sd = 10)\nvarP <- rnorm(100, mean = 5)\nentry <- as.factor(sample(0:1, 100, replace = TRUE))\n\ndat <- data.frame(varL, varP, entry)\n\ncondition <- \"YES\"\n\n##Define regression\n\nhx1 <- glm(entry ~ varL*varP, data = dat, family = binomial(link = \"probit\"))\n\n##Plot within R graphic device - works perfectly fine\n\nplot(effect(\"varL:varP\", hx1))\n\n##Save plot to WD without if condition - works fine\n\nCairo(file=as.character(\"plot1\"), \n type = \"png\",\n units = \"px\", \n width = 715, \n height = 489, \n pointsize = 12, \n dpi=\"auto\")\nplot(effect(\"varL:varP\", hx1))\ndev.off()\n\n##Save plot to WD with if condition - This is very the problem surfaces\n\nif(condition == \"YES\") {\n\n Cairo(file=as.character(\"plot2\"), \n type = \"png\",\n units = \"px\", \n width = 715, \n height = 489, \n pointsize = 12, \n dpi=\"auto\")\n plot(effect(\"varL:varP\", hx1))\n dev.off()\n\n}\n\n\nWhere is this problem coming from? How can I solve it within Cairo? How can I save plots to the WD so it works, potentially using a different solution other than Cairo?" ]
[ "r", "plot", "cairo" ]
[ "React mouse events: onClick doesn't fire after drag and drop", "I have a react application for drag and drop feature. Before dragging when I click the <img> the onClick fires and the onClick function definition works. After that I dragged the image and dropped inside a div then, the onClick event doesn't fire when I click the element.\n\nWhat might be the reason? Can anyone help?\n\n<img \n id=\"drag1\" \n draggable=\"true\" \n onDragStart={this.drag.bind(this)} \n onClick={this.click.bind(this)}\n alt=\"sample\" src=\"designs.png\">\n</img>" ]
[ "javascript", "html", "reactjs", "react-redux" ]
[ "How to test for highest value in JUnit", "I want to test to find the highest value.\nCan find out the value using assertEquals?\ngetValue() is a getter to get Value.\npublic class TestGetHighestValue {\n@Test\nValue theValue = new Value();\npublic void test() {\n assertEquals();\n}\n\nValue class\npublic class Value{ \npublic Value(){\n}\npublic int getHighestValue() {\n int highestValue = this.firstStuff.getValue();\n int secondValue = this.secondStuff.getValue();\n int thirdValue = this.thirdStuff.getValue();\n\n if (highestValue < secondValue) {\n highestValue = secondValue;\n }\n\n if (highestValue < thirdValue) {\n highestValue = thirdValue;\n }\n\n return highestValue;\n}\n\n}" ]
[ "java", "junit" ]
[ "Classes and constructor in Es6 program", "Create a class car with a constructor function which accepts 2 parameters (name and distance). Include a prototype method in class, which returns a message(msg) \"car name(name) had travelled for distance(distance) miles\".\n\nI know its a very simple question, but I guess I am not able to design the code well, though it is giving me the right result yet I believe as per standards it is not right??\n\n\r\n\r\nclass Car {\r\n constructor(name, distance) {\r\n this.name = name;\r\n this.distance = distance;\r\n\r\n }\r\n lengthMiles() {\r\n console.log(`${this.name} had travelled for ${this.distance} miles`)\r\n }\r\n}\r\n\r\nvar msg = new Car('Audi', 100);\r\nmsg.lengthMiles();" ]
[ "ecmascript-6", "es6-class" ]