texts
list | tags
list |
---|---|
[
"Choose the correct NoSQL database for my application",
"My application will have hundreds reads and writes per second. Both of them have the same importance. Reads are typical SELECT FROM WHERE, but in WHERE I have three conditions. Example: \n\nSELECT * FROM table \nWHERE ((name1 between a AND b) AND (name2 BETWEEN c AND d) AND (name3 < e))\n\n\nI have tried with Cassandra but is difficult planing a query with three conditions, and writes are faster than reads. Is there a NoSQL database that solves this problem?"
] | [
"nosql",
"cassandra"
] |
[
"makefile for openmp by g++ ---- It is not working",
"I want to use a makefile for my code which is going to use openmp. My source files are compiled and linked without any error. But when I run it, it uses just one processor, even though I adjust their number by for instance export OMP_NUM_THREADS=2. \n\nThe makefile is shown in the following. I would be grateful if somebody could please help me.\n\nBest\n\n\r\n\r\nCPP_FILES := $(wildcard src/*.cpp)\r\nOBJ_FILES := $(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))\r\n\r\nCC = g++\r\nDEBUG = -g\r\n\r\nINTEL=icc\r\nifeq ($(notdir $(CC)),$(INTEL))\r\nCCFLAGS=-openmp -lm -lstdc++\r\nelse\r\nCCFLAGS=-fopenmp -lm -lstdc++\r\nendif\r\n\r\nLD_FLAGS :=-fopenmp -Wall $(DEBUG)\r\n#CC_FLAGS := -Wall -c $(DEBUG)\r\n\r\n\r\nMAIN: $(OBJ_FILES)\r\n $(CC) $(LD_FLAGS) -o $@ $^\r\n\r\nobj/%.o: src/%.cpp\r\n $(CC) $(CC_FLAGS) -c -o $@ $<\r\n\r\n.PHONY: clean\r\n\r\nclean:\r\n rm -f $(OBJ_FILES) *.o"
] | [
"makefile",
"g++",
"openmp"
] |
[
"MATLAB I would like to minimize the difference fitting",
"I have a curve that looks like an exponentiel function, I would like to fit this curve with this equation :\n\n\n\nThe goal is to find the value of A, T and d which will minimize V with my initial curve. \n\nI did a function that is able to do it but it takes 10 seconds to run. \n3 loops that test all the values that I want to and at the end of the 3 loops I calculate the RMSD (root mean square deviation) between my 2 curves and I put the result in a vector min_RMSN, at the end I check the minimum value of min_RMSD and it's done...\n\nBut this is not the best way for sure.\n\nThank you for your help, ideas :)"
] | [
"matlab",
"optimization"
] |
[
"How to forward SMB using NgrokοΌ",
"I learned about SMB infomation from https://en.wikipedia.org/wiki/Server_Message_Block.\n\nSMB use tcp 139/445 prot. And I check my server prot by lsof,SMB only listen 139 and 445 prot.\n\nThen I try forward SMB port by Ngrok. This is my config:\n\ntunnels:\n http:\n remote_port: 1122\n proto:\n tcp: 5000\n smb:\n remote_port: 139\n proto:\n tcp: 139\n smb2:\n remote_port: 445\n proto:\n tcp: 445\n\n\nThe http server is work. But SMB server not work.\n\nNgrok clone from https://github.com/inconshreveable/ngrok. Version is 1.7 and build by golang 1.12"
] | [
"smb",
"ngrok"
] |
[
"Xcode issue building 64-bit app with LibX library",
"I'm trying to use libXl for iOS and it is giving me a linker error.\n\"missing required architecture x86_64\"\n\nI've changed the Architechture to standard but when I try to build for a 64 bit simulator, it gives me the linker error.\n\nWhat needs to be changed to fix this error if I don't have the source code for the library?"
] | [
"ios",
"iphone",
"objective-c",
"xcode",
"64-bit"
] |
[
"Function that returns generic function pointers",
"Say I have two functions:\n\nfn function_with_one_argument(one: i64) -> bool{\n one==one // irrelevant\n}\n\nfn function_with_two_arguments(one: i64, two: i64) -> bool {\n one==two // irrelevant\n}\n\n\nGiven a different input value, I'd like to return a different function pointer:\n\nfn main() {\n println!(\"\\n\\n{:?}\\n\\n\", get_function_pointer(1)(321));\n println!(\"{:?}\", get_function_pointer(2)(321/*, 321*/));\n}\n\n\nHow can I represent the return value to return a pointer to different shaped functions?\n\nfn get_function_pointer(id: i64) -> /***/(fn(i64) -> bool)/***/ {\n match id {\n 1 => function_with_one_argument,\n // 2 => function_with_two_arguments, /*How do we make this work?*?\n _ => panic!(\"!?!?!\")\n }\n}"
] | [
"rust"
] |
[
"How to enforce that two (PK same FK) columns from two different tables are disjoint",
"Consider the following example\n\nVehicle is my superclass\nBike and Car are my subclasses\n\nCREATE TABLE Vehicle (\n\n Vehicle_id INT PRIMARY KEY\n ...\n\n);\n\nCREATE TABLE Bike (\n\n Vehicle_id INT PRIMARY KEY REFERENCES Vehicle(Vehicle_id)\n ...\n\n);\n\nCREATE TABLE Car (\n\n Vehicle_id INT PRIMARY KEY REFERENCES Vehicle(Vehicle_id)\n ...\n\n);\n\n\nVehicle doesn't have to be a Bike or a Car but it can't be both a Bike and a Car\nI've been trying something like this (How do I reference Bike in ??)\n\nALTER TABLE ONLY Car\n ADD CONSTRAINT not_in_bike CHECK (??)\n\n\nAlternatively, can I do something like this\n\nALTER TABLE Car AND Bike\n ADD CONSTRAINT Car_or_Bike CHECK (Car.Vehicle_id <> Bike.Vehicle_id)\n\nThank you!"
] | [
"postgresql",
"create-table"
] |
[
"Internationalization in Java Child Classes",
"I have a parent class, which extends JFrame. This parent class contains menu items which are supposed to change the language on the interface.\n\npublic class ParentCLass extends JFrame{\n//.....\nlocale = Locale.getDefault();\ntitleList = ResourceBundle.getBundle(\"res.TitleBundle\", locale);\n//....\nJMenu languageMenu = new JMenu(\"Language\");\nmenuBar.add(languageMenu);\nJMenuItem englishItem = new JMenuItem(\"English\");\nJMenuItem germanItem = new JMenuItem(\"German\");\nlanguageMenu.add(englishItem);\nlanguageMenu.add(germanItem);\n//added the actionlisteners to the menu items\npublic void setLocale(String language){\n if (language.equals(\"en\")) {\n locale = new Locale(\"en\",\"US\");\n } else\n if (language.equals(\"de\")) {\n locale = new Locale(\"de\",\"DE\");\n }\n titleList = ResourceBundle.getBundle(\"res.TitleBundle\",locale);\n refresh();\n }\n}\n\n\nThe refresh() method should refresh every interface element from the UI, to fit the selected language. \n\nNow, the problem is that I have several child classes which extend this ParentClass, and the interface may differ from child class to child class.\n\nCan I somehow pass the refresh event from the parent class to the child class? The UI elements should be refreshed there."
] | [
"java",
"oop",
"localization",
"internationalization",
"extends"
] |
[
"Layout constraint between Views not preserved when included as Fragment",
"I have a fragment_cameracontroller.xml which defines how buttons are laid out:\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n tools:context=\"cc.closeup.android.activities.TileActivity$CameraController\"\n android:id=\"@+id/cameracontroller_layout\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:gravity=\"right|top\">\n\n <LinearLayout\n android:orientation=\"horizontal\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginRight=\"150dp\"\n android:layout_marginTop=\"5dp\"\n android:id=\"@+id/cameracontroller_layout_top\"\n android:layout_toLeftOf=\"@+id/cameracontroller_layout_right\">\n\n <ImageButton\n android:id=\"@+id/button_togglecamera\"\n android:background=\"@android:drawable/ic_menu_camera\"\n android:layout_marginRight=\"8dp\"\n android:layout_width=\"48dp\"\n android:layout_height=\"48dp\"/>\n\n </LinearLayout>\n\n <LinearLayout\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:id=\"@+id/cameracontroller_layout_right\"\n android:layout_marginTop=\"15dp\"\n android:layout_marginRight=\"5dp\">\n\n <Button\n android:layout_width=\"72dp\"\n android:layout_height=\"72dp\"\n android:id=\"@+id/button_talk\"\n android:background=\"@drawable/button_talk\"\n android:text=\"@string/talk\"\n android:textColor=\"@color/white\"/>\n\n </LinearLayout>\n\n</RelativeLayout>\n\n\nSpecifically, pay attention to the android:layout_toLeftOf=\"@+id/cameracontroller_layout_right\" constraint, which specifies how the buttons relate to each other.\n\nIn the Preview in Android Studio, the relationship (green arrow) is honored:\n\n\n\nbut when I later embed that fragment xml in an Activity, both buttons are on top of each other (on the device). Here's the Activity XML:\n\n<RelativeLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\">\n\n <fragment\n android:name=\"cc.closeup.android.activities.TileActivity$CameraControllerFragment\"\n android:id=\"@+id/cameracontroller\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n tools:layout=\"@layout/fragment_cameracontroller\"\n android:layout_alignParentTop=\"true\"\n android:layout_alignParentRight=\"true\"/>\n\n</RelativeLayout>\n\n\nI inflate the fragment with the following static code snippet:\n\npublic static class CameraControllerFragment extends Fragment {\n @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n return inflater.inflate(R.layout.fragment_cameracontroller, container, false);\n }\n}\n\n\nIs there anything that I do wrong? I know I may lose width and height of the fragment's root layout in such a case, dependent on how I inflate, but that relationship is between two child views."
] | [
"android",
"xml",
"android-layout",
"android-fragments"
] |
[
"How to remove all data from an SQL Server connection to Excel?",
"I linked an excel workbook to a table on SQL Server. I did several sheets with pivot tables using those data. Now I want to distribute the Excel file with just the pivot tables. \nI deleted the connection to SQL Server, but the size of the file is still about 50MB while it should be at most 2-3 MB. I think excel embeds the data somewhere in the workbook. How can I remove all of them and have a file of reasonable dimensions?\n\nI'm working with Excel 2010 and SQL Server 2014."
] | [
"sql-server",
"excel",
"excel-2010",
"pivot-table",
"sql-server-2014"
] |
[
"Capturing multiple points of data from a text file using Regex in powershell",
"So I got this regex expression to work in Regex101 and it captures exactly what I want to capture. https://regex101.com/r/aJ1bZ4/3\n\nBut when I try the same thing in powershell all I get is the first set of matches. I've tried using the (?s:), the (?m:) but none of these modifiers seem to do the job. Here is my powershell script.\n\n$reportTitleList = type ReportExecution.log | Out-String |\nwhere {$_ -match \"(?<date>\\d{4}\\/\\d{2}\\/\\d{2}).*ID=(?<reportID>.*):.*Started.*Title=(?<reportName>.*)\\[.*\\n.*Begin ....... (?<reportHash>.*)\"} |\nforeach {\n new-object PSObject -prop @{\n Date=$matches['date']\n ReportID=$matches['reportID']\n ReportName=$matches['reportName']\n ReportHash=$matches['reportHash']\n }\n}\n\n$reportTitleList > reportTitleList.txt\n\n\nWhat am I doing wrong? Why am I not getting all the matches as the regex101 example?"
] | [
"regex",
"powershell"
] |
[
"PyQt QSplitter: is there a way to define orientation as both vertical and horizontal?",
"If I want to be able to change the dimensions of an object inside the splitter in both directions."
] | [
"pyqt",
"orientation",
"splitter",
"qsplitter"
] |
[
"How to detect when a Java Swing scroll bar is at or near the bottom of the bar?",
"I'm working on a program that needs a sort of spreadsheet built into it. I'm using a JTable for a spreadsheet and I'm going to enclose that in a scrollable window, but spreadsheets are typically infinite, and the only way I could think to do that is make it such that when the user has scrolled to the bottom (or NEAR the bottom) of the spreadsheet, it adds like 20 new rows. How would I go about doing this?"
] | [
"java",
"swing",
"jscrollpane"
] |
[
"CActiveRecord::findall throws exception",
"I'm trying to perform a search in one of my tables based on a given criteria like so:\n\n$id = 1;\n$criteria = new CDbCriteria();\n$criteria->addCondition(\"usr_currency=:currency\");\n$currencies = User::model()->findAll($criteria, array(':currency' => $id,)); \n\n\nI get a CDbException:\n\nCDbCommand failed to execute the SQL statement: \nSQLSTATE[HY093]: Invalid parameter number: no parameters were bound. \nThe SQL statement executed was: \n SELECT * FROM `user` `t` \n WHERE usr_currency=:currency\n\n\nWhere as, this works:\n\n$id = 1;\n$criteria = new CDbCriteria();\n$criteria->addCondition(\"usr_currency=:currency\");\n$criteria->params = array(':currency' => $id,);\n$comments = User::model()->findAll($criteria); \n\n\nWhat is wrong with the first code fragment?"
] | [
"yii"
] |
[
"How to pass parameters to the function called by ElapsedEventHandler?",
"How to pass parameters to the function called by ElapsedEventHandler?\n\nMy code:\n\nprivate static void InitTimer(int Index)\n{\n keepAlive[Index] = new Timer();\n keepAlive[Index].Interval = 3000;\n keepAlive[Index].Elapsed += new ElapsedEventHandler(keepAlive_Elapsed[, Index]);\n keepAlive[Index].Start();\n}\n\npublic static void keepAlive_Elapsed(object sender, EventArgs e[, int Index])\n{\n\n PacketWriter writer = new PacketWriter();\n writer.AppendString(\"KEEPALIVE|.\\\\\");\n ServerSocket.Send(writer.getWorkspace(), Index);\n ServerSocket.DisconnectSocket(Index);\n}\n\n\nWhat I want to do is between the brackets ([ and ]).\nBut just doing it like that obviously doesn't work..."
] | [
"c#",
"events",
"timer",
"elapsed"
] |
[
"Android - Launching Activity on top of other Apps",
"Background: I am trying to build a Launcher app that will restrict users to a set of permitted applications only and will not allow them to access device settings & anything other then the permitted apps.\n\nWhy: This is a project for a private company to distribute devices to their employees with restricted usage.\n\nIssue: I am able to detect launch of other apps, but i am not able to overlay my activity on top of them. Below is the code, i am trying after receiving broadcast of not allowed app. \n\nprivate class BadAppReceiver extends BroadcastReceiver {\n\n @Override\n public void onReceive(Context arg0, Intent arg1) {\n Intent i = new Intent(HomePage.this,ErrorClass.class);\n wh.topAct = wh.bad_app;\n HomePage.this.startActivity(i);\n Toast.makeText(HomePage.this, \"Access to \" + wh.bad_app + \" is not allowed.\",Toast.LENGTH_LONG).show();\n }\n\n}\n\n\nInteresting Fact: I am able to overlay if I just launch another app instead of trying to open an Activity from my app. Using this solution will make my app dependent on another app and kind of freezes the screen for couple of seconds.\n\nQuestion: What am i missing or can do to pop my Activity over other apps.\n\nThanks in advance and your help is highly appreciated.\n- Pratidhwani\n\nThanks Umer, \nI have used your solution, but this is what is happening now, user opens settings from tray, my app gets the broadcast and shoots ErrorClass Activity, the Toast I have in place appears but ErrorClass Activity do not appear. So user is able to access the settings, now when user presses back button on settings, ErrorClass appears.\n\nthis is what I have in ErrorClass onCreate\n\n super.onCreate(savedInstanceState);\n\n WindowManager.LayoutParams windowManagerParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY , \n WindowManager.LayoutParams. FLAG_DIM_BEHIND, PixelFormat.TRANSLUCENT);\n\n WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);\n\n LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);\n View myView = inflater.inflate(R.layout.error, null);\n\n wm.addView(myView, windowManagerParams);\n\n wh = ((Launcher) getApplication()).getvar();\n mHandlerReg.removeCallbacks(mUpdatereg);\n mHandlerReg.postDelayed(mUpdatereg,2000); \n\n\nThanks!!\n- Pratidhwani"
] | [
"android",
"android-activity",
"android-launcher"
] |
[
"Microsoft Interview Question : Write an efficient string matching program for string matching?",
"Write a time efficient C program that takes two strings (string a, string b) and gives the first occurence of string b in string a."
] | [
"algorithm",
"string"
] |
[
"How to convert a child state to parent state or vice versa dynamically based on screen width?",
"I have a kind of situation where I need to nest the child state when screen size is desktop and convert the child state to parent state when screen is mobile.\n\nDesktop\n\n<div ui-view=\"parent\">\n <div ui-view=\"child\"></div>\n</div>\n\n\nMobile\n\n<div ui-view=\"child\"></div>\n\n\nWhat is the best way to do that? \nI'm thinking of creating a separate state for desktop and mobile with same controller and template and navigate to the state based on screen width"
] | [
"angularjs",
"angular-ui-router"
] |
[
"How does one start programming with Clojure in Windows?",
"I know it is possible to use CounterClockwise inside Eclipse, but I have been trying to get Leiningen to work so that I could use ClojureScript. \n\nI downloaded leiningen using git clone. It then says run the script. I have tried lein self-install from inside PowerShell and inside the git bash environment. \n\nIn each I get an error about failing to download leiningen (which I thought I had with the git clone? hmm). It is interesting because one reads instructions that include things that don't make sense to Windows. \n\nFor example, inside Powershell, Windows doesn't understand export HTTP_CLIENT. It was only inside the git bash that I got a message that it is possible my HTTP client's certificate store does not have the correct certificate authority. \n\nIt then suggests this command, which runs ok, export HTTP_CLIENT=\"curl --insecure -f -L -o\"\nbut it doesn't fix the problem."
] | [
"clojure",
"leiningen",
"clojurescript"
] |
[
"Google Reseller APIs: how to get customer Billing data",
"can anyone please explain how to extract billing information from a Reseller's Perspective? i mean i want to get -if possible- a general billing file and also a more detailed report-let's say for each customer. Is that possible? \nThanks, Alex"
] | [
"google-apis-explorer",
"google-reseller-api"
] |
[
"How can you quickly check if you package.json file has modules that could be updated to newer versions?",
"How can you quickly check if you package.json file has modules that could be updated to newer versions?\n\nFor example, a quick way to check if either express or nodemailer has an available update?\n\n{\n \"name\": \"some_module_name\"\n , \"description\": \"\"\n , \"version\": \"0.0.3\"\n , \"dependencies\": {\n \"express\": \"3.1\"\n , \"nodemailer\" : \"0.4.0\"\n }\n}\n\n\nI read over the FAQs, but didn't see anything:\nhttps://npmjs.org/doc/faq.html\n\nThanks."
] | [
"node.js",
"npm"
] |
[
"Launch my app in background using voice commands from Cortana",
"I modified my Windows Phone 8.1 application (universal app with just the Windows Phone project live yet) to have a VoiceCommandDefinition (VCD) file in place and this works fine to start my app in foreground mode and handle parameters.\n\nBut I want to let my app quickly answer some app specific questions like it is described in this blog for Windows 10. I have tried to apply this blog but the app manifest modification fails. It does not know the: \n\n\n uap:AppService\n\n\nWhen I looked it up, it seems to be available for Windows 10 only. So I searched up the internet mainly MSDN and stack overflow, but I could only find examples that run the app in foreground.\n\nDoes anyone know an example how to provide answers to the Cortana content page with a background service?"
] | [
"c#",
"windows-phone-8.1",
"windows-phone",
"cortana"
] |
[
"What's the best practice for React integrate scss?",
"My scss directory in project:\n\nsrc/styles/\nβββ base\nβ βββ _global.scss\nβ βββ _normalize.scss\nβββ libraries\nβ βββ _antd-custom.scss\nβββ utilities\nβ βββ _utilities.scss\nβββ variables\nβ βββ _colors.scss\nβββ base.scss\nβββ settings.scss\n\n\nThe base.scss import global and basic scss files:\n\n@import 'src/styles/base/normalize';\n@import 'src/styles/base/global';\n\n@import 'src/styles/libraries/antd-custom';\n@import 'src/styles/utilities/utilities';\n\n\nThe settings.scss import config styles like variables, mixins, functions .e.g.\n\n@import 'src/styles/variables/colors';\n\n\nAnd the settings.scss will be loaded before other scss files.\n\nwebpack.conf.js\n\nrules: [\n // styles\n {\n test: /\\.(s)css$/,\n use: [\n 'style-loader',\n {\n loader: 'css-loader',\n options: {\n sourceMap: true,\n modules: true,\n localIdentName: '[name]__[local]--[hash:base64:5]',\n },\n },\n {\n loader: 'postcss-loader',\n options: {\n plugins() {\n return [autoprefixer()]\n },\n sourceMap: true,\n },\n },\n {\n loader: 'sass-loader',\n options: {\n sourceMap: true,\n // load settings scss files before\n data: '@import \"src/styles/settings.scss\";',\n },\n },\n ],\n exclude: /node_modules/,\n },\n}\n\n\nThe base.scss will be imported in app entrypoint:\n\nsrc/index.js\n\nimport 'src/styles/base.scss'\n\n\nThe result is that settings.scss works but not base.scss.\n\nShould I import both setting.scss and base.scss files in webpack sass loader options? Or any other better solutions?"
] | [
"reactjs",
"webpack",
"sass"
] |
[
"Where to specify custom directive dependency. is it the same at controller and directive level?",
"I have a custom directive defined like this: \n\napp.directive('tagProfile', ['userService', function(userService) {\n return {\n restrict: 'E',\n scope: {\n mode: '@'\n ,entity: '='\n ,onUpdate: '&'\n ,onCancel: '&'\n },\n templateUrl: '/public/user/tag_profile.html',\n\n controller: ['$scope', function($scope) {\n $scope.userService = userService\n }],\n\n link: function(scope, element, attrs) {\n }\n }\n}])\n\n\nNotice that I inject userService in directive, because most of tutorials on custom directive inject dependencies there. I have tried to inject it in controller function and it works as well\n\n controller: ['$scope', 'userService', function($scope, userService) \n\n\nI am most likely to use only controller function, not link function. so userService won't be used in link. Beside that, is injecting in both places the same? or which one is better? \n\nAlso, why is the link function injects scope instead of $scope? and we dont use explicit annotation for minify support?"
] | [
"angularjs",
"angularjs-directive"
] |
[
"\"Nested transaction are not supported\" using pooling with MySQL Server >=5.7.17",
"Starting - I guess - after reconfigured MySQL Server 5.7.17 from Developer Machine to Server Machine, our web app (.NET Core 1.2) stopped working. Whenever we try to start a transaction, MySQL throws an exception \"Nested transaction are not supported.\" We use connection pooling, there is no transaction left in an open state when closing any connection. In fact, we used this with MySQL Server Community 5.7.17 and Connector 7.0.6-IR31 for over 2 years with no problems.\n\nI reduced the problem to that even after a plain query the server status goes into \"InTransaction\". After closing this connection (goes back to connection pool) and reopening it right after and starting a transaction throws the exception.\n\nUpdating both servers to 5.7.21 and Connector to 8.0.10rc did not resolve the issue.\n\nUsing 5.5.57 (MariaDB) solves the issue, however, we don't like to downgrade our server due to this issue.\n\n public static IDbConnection GetConnection()\n {\n var connection = new MySqlConnection(Settings.ConnectionString);\n connection.Open();\n return connection;\n }\n\n using (var dbConnection = GetConnection())\n {\n var list = dbConnection.Query(\"select * from cf_genre\", null).ToList();\n }\n\n using (var dbConnection = GetConnection())\n {\n using (var transaction = dbConnection.BeginTransaction())\n {\n // Not reached! An exception is thrown: \"Nested transactions are not supported.\"\n }\n }"
] | [
"mysql",
"asp.net-core"
] |
[
"In which situations will you use ZeroSaltGenerator",
"In which situation should I use ZeroSaltGenerator. Definition says. This implementation of \n\nSaltGenerator always returns a salt of the required length, filled with zero bytes. \n\nPlease explain me the concept."
] | [
"java",
"encryption",
"jasypt"
] |
[
"How to get Touch Event TouchUp using libgdx",
"Am trying to change the screen when removes his finger/no longer touches the screen\nHave tried doing it this way\n\nif (Gdx.input.isTouched(0)) {\ncamera.unproject(_touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));\n//stuff...\n}\n\n\nNow When ever the User leaves his finger i want to change the Screen \nHave also tried to use this call \n\nGdx.input.setInputProcessor(processor);\n\n\nBut of no idea how to check/use this event in render method.\nPlease help me out on this."
] | [
"java",
"android",
"libgdx"
] |
[
"When installing phpmyadmin, when and where is the MySQL application password used?",
"When installing phpmyadmin (ubuntu) we are asked for a MySQL application password.\n\nAll of the articles I found say to use the same as the MySQL root password but I like to keep things separate. So when and where is this application password used?\n\nRelated also is the login page (.../phpmyadmin), is this asking for the MySQL user and password or a phpmyadmin user and password?"
] | [
"phpmyadmin"
] |
[
"How I can use onListItem to start a new activity with the ListView Value?",
"Hi I have a android application and i use a sqlite database and a listview in my Activity. \nNow I want to use onListItemClick but I don_t know how I can get the value that I click and open a new activity with this value :( \n\nhere my code:\n\n@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_show);\n\n mHelper = new DatenbankManager(this);\n mDatenbank = mHelper.getReadableDatabase(); \n\n ladeDaten(); \n\n }\n\n\nmy ladeDaten method:\n\n private void ladeDaten() {\n Cursor KlassenCursor = mDatenbank.rawQuery(KLASSEN_SELECT_ROW, null); \n startManagingCursor(KlassenCursor); \n\n android.widget.SimpleCursorAdapter KlassenAdapter = new android.widget.SimpleCursorAdapter(this,\n android.R.layout.simple_list_item_1, \n KlassenCursor, \n new String[] {\"name\"},\n new int[] {\n android.R.id.text1\n });\n\n setListAdapter(KlassenAdapter);\n\n }\n\n\nHere my onListItemClick that don't work :(\n\n @Override\n protected void onListItemClick(ListView l, View v, int position, long id) {\n\n String selection = l.getItemAtPosition(position).toString();\n Toast.makeText(this, selection, Toast.LENGTH_LONG).show();\n\n }"
] | [
"android",
"sqlite",
"listview",
"android-activity",
"simplecursoradapter"
] |
[
"Ray Oriented bounding box (OBB) intersection function not working with scale",
"So I have this function for getting the intersection of a ray with an OBB:\nstd::optional<float> Ray::hitsOBB(const glm::vec3& min, const glm::vec3& max, const glm::mat4& modelMatrix) {\n float tMin = 0.0f;\n float tMax = 100000.0f;\n\n glm::vec3 OBBposition_worldspace(modelMatrix[3].x, modelMatrix[3].y, modelMatrix[3].z);\n glm::vec3 delta = OBBposition_worldspace - origin;\n\n {\n glm::vec3 xaxis(modelMatrix[0].x, modelMatrix[0].y, modelMatrix[0].z);\n float e = glm::dot(xaxis, delta);\n float f = glm::dot(direction, xaxis);\n\n if (fabs(f) > 0.001f) {\n float t1 = (e + min.x) / f;\n float t2 = (e + max.x) / f;\n\n if (t1 > t2) std::swap(t1, t2);\n\n if (t2 < tMax) tMax = t2;\n if (t1 > tMin) tMin = t1;\n if (tMin > tMax) return {};\n\n }\n else {\n if (-e + min.x > 0.0f || -e + max.x < 0.0f) return {};\n }\n }\n\n\n {\n glm::vec3 yaxis(modelMatrix[1].x, modelMatrix[1].y, modelMatrix[1].z);\n float e = glm::dot(yaxis, delta);\n float f = glm::dot(direction, yaxis);\n\n if (fabs(f) > 0.001f) {\n\n float t1 = (e + min.y) / f;\n float t2 = (e + max.y) / f;\n\n if (t1 > t2) std::swap(t1, t2);\n\n if (t2 < tMax) tMax = t2;\n if (t1 > tMin) tMin = t1;\n if (tMin > tMax) return {};\n\n }\n else {\n if (-e + min.y > 0.0f || -e + max.y < 0.0f) return {};\n }\n }\n\n\n {\n glm::vec3 zaxis(modelMatrix[2].x, modelMatrix[2].y, modelMatrix[2].z);\n float e = glm::dot(zaxis, delta);\n float f = glm::dot(direction, zaxis);\n\n if (fabs(f) > 0.001f) {\n\n float t1 = (e + min.z) / f;\n float t2 = (e + max.z) / f;\n\n if (t1 > t2) std::swap(t1, t2);\n\n if (t2 < tMax) tMax = t2;\n if (t1 > tMin) tMin = t1;\n if (tMin > tMax) return {};\n\n }\n else {\n if (-e + min.z > 0.0f || -e + max.z < 0.0f) return {};\n }\n }\n\n return tMin;\n}\n\nI use it to click on cubes in OpenGL. The test case is a cube with min and max of (-1, -1, -1) and (1, 1, 1). Now this works fine when rotating and translating the modelMatrix but it does not seem to take scale into account. I've tried pre-multiplying the min and max with the modelMatrix scale but to no avail. Anyone know what's going on?"
] | [
"c++",
"opengl",
"linear-algebra",
"glm-math"
] |
[
"Subversion - find file in repo",
"How can I get the path of one file in a SVN repo?\n\nSuppose I want to find a file named \"LoginInterceptor.c\" with its complete path in one SVN repository; which command would I use?"
] | [
"svn"
] |
[
"How to call method in same class",
"I have a superclass, SuperClassYeh and a subclass, SubClassYeh. I have method inheritTest in SuperClassYeh and I override inheritTest in SubClassYeh. I start the program running by calling method testSuperAndSelf in SubClassYeh. This method would call another method, fromYEH in SuperClassYeh. In fromYEH, I would like to call inheritTest in SuperClassYeh. How do I do that? Using [self inheritTest] calls the inheritTest in SubClassYeh, not SuperClassYeh. \nHere's the code fragment to start the whole thing running\n\nSubClassYeh *testing = [[SubClassYeh alloc] init];\n[testing testSuperAndSelf];\n\n\nHere's the code fragment for SuperClassYeh\n\n- (void) fromYEH\n{\n [self inheritTest]; //Calls the inheritTest in SubClassYeh, not SuperClassYeh\n}\n\n- (void) inheritTest\n{\n NSLog(@\"Testing Indicator. Inside SuperClassYEH inheritTest\");\n}\n\n\nHere's the code fragment for SubClassYeh\n\n- (void) inheritTest\n{\n NSLog(@\"Testing Indicator. Inside SubClassYeh inheritTest\");\n}\n\n- (void) testSuperAndSelf\n{\n [super fromYEH]; \n}"
] | [
"objective-c"
] |
[
"PHP RadioButton Submit form",
"I have been creating a website to allow users to rate an image uploaded by another user. I have my code working great. The user is presented with the image, a button to flag the image, 10 radio buttons to choose their rating and a submit button (all within the same form).\n\nMy problem is that I would like to remove the submit button and process the form when the user clicks the radio button. The problem with this is that the flag button (image button) is also submitting the form. My code is below:\n\nHTML\n\n<form name=\"ratebox\" action=\"Box.php?bid=<?php echo $boxId ?>\" method=\"post\">\n <table style=\"margin: 0 auto;\">\n <tr>\n <td colspan=\"2\"><img src=\"img/boxes/<?php echo $boxId ?>.png\" title=\"<?php echo $boxName ?>\" height=\"350\" width=\"350\"></td>\n </tr>\n <tr>\n <input\n type=\"image\"\n name=\"flag_submit\"\n src=\"img/Flag.png\"\n onmouseover=\"this.src='img/Flag_Click.png'\"\n onmouseout=\"this.src='img/Flag.png'\"\n height=\"30\"\n width=\"30\"\n />\n </td>\n </tr>\n <tr>\n <td colspan=\"2\" style=\"text-align:center;\">\n 1<input type=\"radio\" name=\"rdoRate\" value=\"1\" >\n 2<input type=\"radio\" name=\"rdoRate\" value=\"2\" >\n 3<input type=\"radio\" name=\"rdoRate\" value=\"3\" >\n 4<input type=\"radio\" name=\"rdoRate\" value=\"4\" >\n 5<input type=\"radio\" name=\"rdoRate\" value=\"5\" >\n 6<input type=\"radio\" name=\"rdoRate\" value=\"6\" >\n 7<input type=\"radio\" name=\"rdoRate\" value=\"7\" >\n 8<input type=\"radio\" name=\"rdoRate\" value=\"8\" >\n 9<input type=\"radio\" name=\"rdoRate\" value=\"9\" >\n 10<input type=\"radio\" name=\"rdoRate\" value=\"10\" > \n </td>\n </tr>\n <tr><td colspan='4' align='center'><input type='submit' name='rate_submit' value='Rate'></td></tr>\n</table>\n</form>\n\n\nPHP\n\nif (isset($_POST['flag_submit_x']))\n{\n //Code to process the flagged image\n}\n\nif (!empty($_POST['rate_submit']))\n{\n //Code to process the rated image\n}\n\n\nIs there any way I can submit the form when a radio button is pressed and retrieve the value of the radio button that has been pressed?"
] | [
"php",
"post",
"radio-button",
"submit"
] |
[
"Add Fragment Tag and Retrive it",
"I am trying to call Fragment Function from my activity. I am following This Answer for same. Currently My Fragment code is like below in my HomeActivity.\n class ViewPagerAdapter extends FragmentPagerAdapter {\n private final List<Fragment> mFragmentList = new ArrayList<>();\n private final List<String> mFragmentTitleList = new ArrayList<>();\n\n ViewPagerAdapter(FragmentManager manager) {\n super(manager);\n }\n\n @Override\n public Fragment getItem(int position) {\n return mFragmentList.get(position);\n }\n\n @Override\n public int getCount() {\n return mFragmentList.size();\n }\n\n void addFragment(Fragment fragment, String title) {\n mFragmentList.add(fragment);\n mFragmentTitleList.add(title);\n }\n\n @Override\n public CharSequence getPageTitle(int position) {\n return mFragmentTitleList.get(position);\n }\n }\n\nI want add Tag in this Fragment but does not know how can I do it. I have total three fragment in which I need add Tag so I can retrieve it later. Let me know if someone can help me for achieve this.\nThanks"
] | [
"android",
"android-fragments",
"navigation-drawer"
] |
[
"How to avoid Ionic cursor blinking?",
"IonicFramework Question:\n\nHave a standard input text field, which when focused gets this ugly blinking blue cursor. The worse is that this blinking stays on even when the page is scrolled, and shows through other modal elements like header and sub-header."
] | [
"ionic-framework"
] |
[
"One Service Worker Process stop another Service Worker Process and Vice Versa",
"We are using the platinum service worker (Google Polymer Element) for offline and Caching feature of our app. When we open our app for first time the service worker of polymer element starts running. The app works fine.\n\nBut as soon as we Subscribe to One Signal (3rd Party) for push notification, their Service worker runs and our platinum service worker stops running (un-register). The same case happens when we again reload our app the one signal service worker stops running (un-register) and the platinum service worker starts running.\n\nWe want both the service worker works independently without effecting one another. Please give me some suggestions."
] | [
"android",
"push-notification",
"polymer",
"service-worker",
"onesignal"
] |
[
"Nodejs and Handlebars - list duplicating on refresh, instead of refreshing",
"I've been playing around with Handlebars templating. Current practice is a simple todo list. On first load it's just fine, but if I refresh my page, it doesn't actually refresh. Instead, it duplicates the results of my GET and appends them to the list.\n\nSo, first time the list is like:\n\n\nGet groceries\nTake kids to soccer\n\n\nThen upon refresh I get:\n\n\nGet groceries\nTake kids to soccer\nGet groceries\nTake kids to soccer\n\n\nindex.js GET method\n\napp.get('/', (req, res) => {\n let query = \"select * from todos\";\n db.query(query, function(err, rows) {\n if (err) throw err;\n rows.forEach(function(todo) {\n todos.push(todo.todo);\n console.log(todo.todo)\n })\n res.render('index', {\n todos\n });\n })\n});\n\n\nindex.hbs\n\n<h2>Here's some Todos</h2>\n<ul id=\"list\">\n{{#each todos}}\n <li>{{this}}</li>\n{{/each}}\n</ul>"
] | [
"node.js",
"express",
"handlebars.js",
"express-handlebars"
] |
[
"how can I determine that an element height is fixed",
"I need to know whether an HTML element will expand as the content is added to it. The height of the element can be preset in a number of ways - with the inline style height or max-height, by setting relative height when the parent element has its height set, via a css class, etc. \n\nAll I need to know whether the height of the element will increase as I add children. I hoped to use the JQuery css method, but it computes the actual value and does not tell me whether it will change as new children are added."
] | [
"javascript",
"html",
"css"
] |
[
"How to square and add numbers in a generated list in python?",
"For an assignment, I have to square or cube each number in a generated list and add them together. So far, I've used the list function to create a list between two values that the user inputs and attempted to square each number, but I have yet to add them together. I'm not sure what exactly to do from here, as I'm getting some sort of generator error.\n\nsquares = \"squares\"\ncubes = \"cubes\"\nexit = \"exit\"\n\ncommand = input(\"Please enter a command ('squares,' 'cubes,' or 'exit' to terminate): \")\n\n\nwhile True:\n if command == squares:\n integer = int(input(\"Please enter an initial integer: \"))\n term = int(input(\"Please enter the number of terms to be generated: \"))\n\n for x in range(integer, integer+term+1):\n sqnums = (x**2 for x in range)\n print(sqnums)\n command = input(\"Please enter a command ('squares,' 'cubes,' or 'exit' to terminate): \")\n\n if command == cubes:\n integer = int(input(\"Please enter an initial integer: \"))\n term = int(input(\"Please enter the number of terms to be generated: \"))\n\n command = input(\"Please enter a command ('squares,' 'cubes,' or 'exit' to terminate): \")\n\n if command == exit:\n print(\"Goodbye\")\n break"
] | [
"python",
"list"
] |
[
"Ways to share regex across DataAnnotations /Attributes",
"I am playing around with the System.ComponentModel.DataAnnotations namespace, with a view to getting some validation going on my ASP.NET MVC application.\n\nI have already hit an issue with the RegularExpression annotation.\n\nBecause these annotations are attributes they require constant expressions.\n\nOK, I can use a class filled with regex string constants.\n\nThe problem with that is I don't want to pollute my regex with escape characters required for the C# parser. My preference is to store the regex in a resources file.\n\nThe problem is I cant use those string resources in my data annotations, because they are not constants!\n\nIs there any solution to this?\n\nIf not, this seems a significant limitation of using attributes for validation."
] | [
"c#",
"regex",
"data-annotations"
] |
[
"Load More Functionality for tag using jQuery",
"I have <li class=\"level1> <ul class=\"level1\"> <li class=\"level2\"> in foreach loop. I have to put load more link in mega menu.\n\n\nfrom above image , I want to put load more link in all li tags if have more than 5 li,\n\nI put below jQuery for that, but it not work. can any one help me?\n\n<script type=\"text/javascript\">\njQuery(document).ready(function () {\n\n\n size_li = jQuery(\".level1 li\").size();\n x=5;\n jQuery('.level1 li\":lt('+x+')').show();\n jQuery('#loadMore').click(function () {\n x= (x+5 <= size_li) ? x+5 : size_li;\n jQuery('.level1 li\":lt('+x+')').show();\n });\n});\n</script>\n\n\nalso add css \n\n<style type=\"text/css\">\n.level1 li{\n display:none;\n}\n</style> \n\n\nGetting Below output"
] | [
"jquery",
"html",
"css"
] |
[
"Setting background images in Jekyll stylesheets",
"Given that I have the following markup on my Jekyll site:\n\n<header>\n <hgroup>\n <h1>Page title</h1>\n <h2>Page subtitle</h2>\n </hgroup>\n</header>\n\n\nI'm trying to apply a background image it using CSS, however, I need to use the {{ site.baseurl }} variable so the location of the image file is parsed correctly. Unfortunately, the following code does not work:\n\nheader {\n background-image: url('{{ site.baseurl }}/img/bicycle.jpg');\n}\n\n\nInline styles actually do work with {{ site.baseurl }} and the below code works.\n\n<header style=\"background-image: url('{{ site.baseurl }}/img/bicycle.jpg');\">\n\n\nBut I really don't want to use inline styles. What is the method to apply background images to Jekyll sites?"
] | [
"css",
"background-image",
"jekyll"
] |
[
"Selecting An Embedded Language",
"I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app.\n\nI'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external \"agents\"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? \n\nAlso, are there any other interpreted languages I can use other than Python?"
] | [
"c++",
"python",
"perl",
"performance",
"lua"
] |
[
"download the JRockit 5 jre",
"I want to download Bea JRockIt 5 because the JRE doesnβt seem to be able to allocate VM more than 1.6 GB.\nplease i not find the link for download the JRockIT jre \nI use machine 32 bits windows7 and ram 3GB.\n\nThanks in advance"
] | [
"java",
"jvm",
"jrockit"
] |
[
"Background-color disappears when over an element",
"I have two Twitter Bootstrap 3 containers. The first container has a simple image inside it, the second one contains some text loaded from The Loop. I would like the second container to overlap the first one a little bit.\n\nI tried setting a negative margin-top for the second container and a negative margin-bottom for the first one. It works, as for moving the text, but background-color of the second container just doesn't overlap the image. Only text does that.\n\nIt looks as if the second container's background-color disappeared under the image from the first container.\n\nCould you please help me with that? I want the background-color of the second container to overlap the first container's image. Just as it is already done with text.\n\nHTML:\n\n<div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-md-12 singlePostCoverContainer\">\n <?php the_post_thumbnail('full', array('class' => 'center-block singlePostCover')); ?>\n </div>\n </div>\n</div>\n<div class=\"container singlePost\">\n <div class=\"row titleRow\">\n <div class=\"col-sm-3 col-sm-push-9 col-xs-12\">\n <p>TEST</p>\n </div> \n <div class=\"col-sm-9 col-sm-pull-3 col-xs-12 post\">\n <span class=\"catDescription\">XXX</span>\n <h4><?php the_title(); ?></h4>\n </div>\n </div>\n</div>\n\n\nLESS (it is being compiled to CSS, shouldn't be that much of a problem to read for people who know CSS):\n\ndiv.singlePostCoverContainer {\n img {\n margin-bottom:-200px;\n }\n}\n\n.singlePost {\n background-color:white !important;\n}"
] | [
"html",
"css",
"twitter-bootstrap-3",
"less"
] |
[
"Configuring a biztalk sendport to an EBS package",
"Okay, I've been looking over this for the past couple of days but I cannot get it to consume a message. Here is my basic message schema structure. The message is created against this schema through a pipeline (works, tested).\n\n<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<xs:schema targetNamespace=\"http://Microsoft.LobServices.OracleDB/2007/03/XXSCHEMA/Package/XXPAC_AQ_PKG\" \n xmlns=\"http://XXCOMPANY.Schemas.adEnqueueRequest\" \n xmlns:b=\"http://schemas.microsoft.com/BizTalk/2003\" \n xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n <xs:element name=\"ENQUEUE\">\n <xs:complexType>\n <xs:sequence minOccurs=\"1\" maxOccurs=\"1\">\n <xs:element name=\"p_queue_name\" type=\"xs:string\" maxOccurs=\"1\" minOccurs=\"1\" nillable=\"false\" />\n <xs:element name=\"p_payload\" type=\"xs:string\" maxOccurs=\"1\" minOccurs=\"1\" nillable=\"false\" />\n <xs:element name=\"p_message_type\" type=\"xs:string\" maxOccurs=\"1\" minOccurs=\"1\" nillable=\"false\" />\n </xs:sequence>\n </xs:complexType>\n </xs:element>\n</xs:schema>\n\n\nThe send port is configured like to use the WCF-OracleEBSAdapter and I've confirmed I have all my environment details set up correctly(ie, username, password, TNS information.)\n\nThe current bts action I've set is:\n\n<BtsActionMapping xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <Operation Name=\"ENQUEUE\" Action=\"http://Microsoft.LobServices.OracleDB/2007/03/XXSCHEMA/Package/XXPAC_AQ_PKG/ENQUEUE\" />\n</BtsActionMapping>\n\n\nBut I've tried all of the action mappings on http://msdn.microsoft.com/en-us/library/dd788171.aspx to get it working. Each time my message suspends and the event log shows:\n\nA message sent to adapter \"WCF-OracleEBSAdapter\" on send port \"SENDPORTNAME\" with URI \"SENDPORTURI\" is suspended. \n\n Error details: Microsoft.ServiceModel.Channels.Common.UnsupportedOperationException: Action \"http://Microsoft.LobServices.OracleDB/2007/03/XXSCHEMA/Package/XXPAC_AQ_PKG/ENQUEUE\" is invalid.\n\nServer stack trace: \n at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)\n at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)\n at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)\n at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)\n\nException rethrown at [0]: \n at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\n at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\n at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)\n at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result) \n MessageId: {26BF83FF-742E-4649-8FCC-45729767FF8E}\n InstanceID: {CA97B656-FC1A-4884-8A6A-F95D156298ED}\n\n\nThe aim of this send port is to call a routine on an oracle server that will place a message on a specified queue. Has anyone successfully done this before? Can anyone see anything that might be wrong with my configuration. Any tips would also be appreciated."
] | [
"oracle",
"configuration",
"biztalk",
"biztalk-2010",
"send-port"
] |
[
"not able to return the data in the `response.json `",
"I'm using mongoCleint to connect to the database using node server. Able to post the data to the database and able to read back the data in JSON.stringify(items) but not able to return it. Problem is that res.json(getRequest) in not giving back any json despite 'JSON.stringify(items)` is giving me a list of items. Am I not doing it right? \n\napp.get('/getItems', function (req, res) {\n var getRequest;\n MongoClient.connect(url, function(err, client) {\n if(err){\n console.log(\"there is an error\")\n } else {\n console.log(\"running get request\")\n const db = client.db(dbName);\n db.collection('documents').find({}).toArray(function(err, items) {\n if(err) { \n console.error(err) \n } else {\n console.log(JSON.stringify(items))\n getRequest = JSON.stringify(items)\n }\n })\n client.close();\n }\n });\n console.log(res.json(getRequest))\n return res.json({ success: true, data: getRequest });\n})"
] | [
"node.js"
] |
[
"way to use tomcat basic/digest authentication with hashed passwords in JDBCRealm?",
"I want to use Tomcats role based authentication, problem is i'm storing the passwords hashed in my database so cannot use basic authentication/or digest. Is there a way to compare the clear text password with the hashed password? I'm usng SHA to hash passwords."
] | [
"java",
"tomcat",
"authentication",
"jdbc",
"jdbcrealm"
] |
[
"Switching from 3D to 2D in OpenGL",
"I'm making a weather simulation in Opengl 4.0 and am trying to create the sky by creating a fullscreen quad in the background. I'm trying to do that by having the vertex shader generate four vertexes and then drawing a triangle strip. Everything compiles just fine and I can see all the other objects I've made before, but the sky is nowhere to be seen. What am I doing wrong?\n\nmain.cpp\n\nGLint stage = glGetUniformLocation(myShader.Program, \"stage\");\n//...\nglBindVertexArray(FS); //has four coordinates (-1,-1,1) to (1,1,1) in buffer object\nglUniform1i(stage, 1);\nglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\nglBindVertexArray(0);\n\n\nvertex shader\n\nuniform int stage;\nvoid main()\n{\n if (stage==1)\n {\n gl_Position = vec4(position, 1.0f);\n }\n else\n {\n //...\n } \n}\n\n\nfragment shader\n\nuniform int stage;\nvoid main()\n{\n if (stage==1)\n { //placeholder gray colour so I can see the sky\n color = vec4(0.5f, 0.5f, 0.5f, 1.0f);\n }\n else\n {\n //...\n }\n}\n\n\nI should also mention that I'm a beginner in OpenGL and that it really has to be in OpenGL 4.0 or later.\n\nEDIT:\nI've figured out where's the problem, but still don't know how to fix it. The square exists, but only displays if I multiply it with the view and projection matrix (but then it doesn't stay glued to the screen and just rotates along with the rest of the scene, which I do not want). Essentially, I somehow need to switch back to 2D or to screen space or however it's called, draw the square, and switch back to 3D so that all the other objects work fine. How?"
] | [
"c++",
"opengl",
"fragment-shader",
"vertex-shader",
"opengl-4"
] |
[
"Can a custom vue package export pieces of a Vuex State, that could then be imported/used within a Laravel Project's Vuex State",
"Hey Stackoverflow community!\nI've got a question regarding Vuex in a Laravel/Vue Project, that is also importing a custom Vue components library/package.\nI'd like to have our package export certain pieces of Vuex state (state, mutations, getters, etc) that relate specifically to our package.\nI'd like these pieces to work with our Laravel Project's Vuex Instance. The hope is that this would allow the project to use state pieces from the custom package, as well as state pieces specific to the Laravel project, in one Vuex Instance.\nIs this possible or even a good approach? The package is meant to be re-usable and is not project-specific, but it would be ideal if the Laravel Project could read/manipulate/interact the package state from its own Vuex State.\nHere are some relevant code snippets:\nCustom Component Library - main.js\nimport ExampleComponent from './components/ExampleComponent.vue'\nimport AnotherComponent from './components/AnotherComponent.vue'\n\nexport {\n ExampleComponent,\n AnotherComponent\n}\n\nLaravel Project - app.js\nimport {ExampleComponent, AnotherComponent} from 'vue-components-library'\n\nimport Vue from 'vue'\nimport Vuex from 'vuex'\n\nVue.use(Vuex)\n\nconst store = new Vuex.Store({\n state: {\n filterData: {\n page: 1\n },\n fetchResultsFlag: 0\n },\n mutations: {\n updateFilterData: (state, filterData) => {\n Object.entries(filterData).forEach(([key, value]) => {\n state.filterData[key] = value\n });\n state.fetchResultsFlag = 1\n },\n incrementPage: (state) => {\n state.filterData.page++\n state.fetchResultsFlag = 1\n },\n resetFetchResultsFlag: (state) => {\n state.fetchResultsFlag = 0\n }\n },\n getters: {\n filterData: state => {\n return state.filterData\n },\n fetchResultsFlag: state => {\n return state.fetchResultsFlag\n },\n page: state => {\n return state.filterData.page\n }\n }\n })\n\nconst app = new Vue({\n el: '#app',\n store: store\n});\n\n\nAny help or insight is greatly appreciated!\nThanks."
] | [
"laravel",
"vue.js",
"vuejs2",
"state",
"vuex"
] |
[
"AngularJS ng-checked not updating with model",
"On my page I have brand A and Brand B. By clicking on one, I display a filtered list of address types, and clicking on one of those then filters locations.\n\nWhen I click on brand A, I save an object of the checked items and overwrite with brand B's list. When I click back to Brand A, the location list is filtered correctly, but the address types are not being checked, even though they exists in the array.\n\nFYI, md-checkbox is an Angular Material checkbox.\n\nHere is my HTML:\n\n<ul >\n <li id=\"brandA\" ng-click=\"setBrand(0)\" ng-class=\"{'brandSelected': brand == 0}\">\n </span>Brand A</span>\n\n </li>\n\n <li id=\"brandB\" ng-click=\"setBrand(1)\" ng-class=\"{'brandSelected': brand == 1}\">\n </span>Brand B</span>\n </li>\n</ul>\n\n<div ng-repeat=\"item in addressTypes | filter : filterAddressTypeByBrand\">\n <md-checkbox class=\"md-primary\" ng-checked=\"exists(item)\" ng-click=\"toggle(item)\" ng-model=\"item.selected\">\n {{ item.desc }}\n </md-checkbox>\n</div>\n\n\nHere is an extract of my controller:\n\n$scope.addressTypesSelected = [];\n$scope.addressTypesSelectedBrandA = [];\n$scope.addressTypesSelectedBrandB = [];\n\n\n$scope.toggle = function (item) {\n var idx = $scope.addressTypesSelected.indexOf(item);\n if (idx > -1) $scope.addressTypesSelected.splice(idx, 1);\n else $scope.addressTypesSelected.push(item);\n};\n$scope.exists = function (item) {\n return $scope.addressTypesSelected.indexOf(item) > -1;\n};\n\n\n$scope.setBrand = function (val) {\n $scope.brand = val;\n $scope.addressTypesSelected = [];\n\n if ($scope.brand == 1) {\n $scope.addressTypesSelectedBrandB = [];\n $scope.addressTypesSelectedBrandB = angular.copy($scope.addressTypesSelected);\n\n $scope.addressTypesSelected = angular.copy($scope.addressTypesSelectedBrandA);\n } else {\n $scope.addressTypesSelectedBrandA = [];\n $scope.addressTypesSelectedBrandA = angular.copy($scope.addressTypesSelected);\n\n $scope.addressTypesSelected = angular.copy($scope.addressTypesSelectedBrandB);\n }\n\n $scope.filterDealers($scope.dealers);\n}\n\n\nWhat needs to be done to get the checkboxes checked when switching between brands?\n\nUPDATE 1.\n\nI've added ng-model=\"item.selected\" to md-checkbox. This seemed to do the trick. However, if I check a box on Brand A, then click on Brand B, then click Brand A, the checkbox remains checked. If I continue and click on Brand B then click again on Brand A, the checkbox is unchecked, yet the value in the model is set to true."
] | [
"javascript",
"angularjs"
] |
[
"how to grep lines with patterns in a seperate file using sed or awk",
"I've a big data file (data.txt) and a pattern file (patt.dat) and the data is like below \n\ndata.txt \n\n[bottle]:[some description 1] \n[pen]:[some description 2] \n[mobile]:[some description 3] \n[pen_pencil]:[some description 4] \n[mouse]:[some description 5] \n\n\npatt.dat \n\npen \nmobile \n\n\ni give like this \n\ngrep -F -f patt.dat data.txt \n\n\nthen i get the below \n\n[pen]:[some description 2] \n[mobile]:[some description 3] \n[pen_pencil]:[some description 4] \n\n\nbut I want only want,\n\n[pen]:[some description 2] \n[mobile]:[some description 3] \n\n\nPlease help with any solution.\nI don't want to hard code anything because there'll be a lot of such patterns and hard-coding all won't look good. \n\nIf the same can be achieved in any other way possibly, please suggest that one too."
] | [
"linux",
"unix",
"awk",
"sed",
"grep"
] |
[
"Azure publishsettings file Fails to Import Using Eclipse",
"I am using my MSDN Azure subscription to try to publish a Java web site using Eclipse. I have installed the Azure SDK v2.6 and the Azure plug-in for Eclipse v0.2.0.201506041823. As part of the deployment set-up, I need to import my Publish-Settings file. I have downloaded the publish profile from the Azure portal. When I import the publishsettings file, I am getting this error:\nImporting filename file failed.\nReason: Failed to parse file. Ensure publish settings file is valid.\n\nAny idea what I am missing?\nI appreciate any suggestions."
] | [
"java",
"eclipse",
"azure",
"azure-web-app-service"
] |
[
"Translating a document from Spanish to English & preserve formatting",
"I have been using https://translate.google.com/ to translate Spanish PDFs & Word Documents to English. \n\nIs there a Restful API (or other method) to translate a document from Spanish to English while preserving the formatting of the document?\n\nI know I can extract the text then translate it using Google APIs but I would loose the formatting."
] | [
"google-translate",
"translate"
] |
[
"I want my jQuery animation to work only once",
"I want this to work only once. For now, my scroll top always work and so it's impossible to scroll down my page.\n\n$(function() {\n $(\".showhover\").hover(\n function() {\n $('div.mouseover').show(),\n $(\"html, body\").animate({scrollTop: $('div.mouseover').innerHeight() });\n });\n});"
] | [
"javascript",
"jquery"
] |
[
"brew (cask) update doesn't work",
"Could somebody help me here. I try to update flux (from 36.5 to 36.6).\n\n$ brew update\nAlready up-to-date.\n\n$ brew cask list\n....\nflux\n...\n\n$ brew cask info flux\nflux: 36-6\nf.lux\nhttps://justgetflux.com/\nNot installed\nhttps://github.com/caskroom/homebrew-cask/blob/master/Casks/flux.rb\n==> Contents\n Flux.app (app)\n\n$ brew cask update flux\nUpdated 1 tap (caskroom/cask).\nNo changes to formulae.\n\n\nI got the same behavior with other packages. What's wrong? I also run brew doctor and brew cleanup. \n\nThanks\nLukas"
] | [
"homebrew",
"homebrew-cask"
] |
[
"Commands in Docker ENTRYPOINT",
"Is there a way to execute a command as an argument in a Dockerfile ENTRYPOINT? I am creating an image that should automatically run mpirun for the number of processors, i.e., mpirun -np $(nproc) or mpirun -np $(getconf _NPROCESSORS_ONLN).\n\nThe following line works:\n\nENTRYPOINT [\"/tini\", \"--\", \"mpirun\", \"-np\", \"4\"] # works\n\n\nBut I cannot get an adaptive form to work:\n\nENTRYPOINT [\"/tini\", \"--\", \"mpirun\", \"-np\", \"$(nproc)\"] # doesn't work\nENTRYPOINT [\"/tini\", \"--\", \"mpirun\", \"-np\", \"$(getconf _NPROCESSORS_ONLN)\"] # doesn't work\n\n\nUsing the backtick `nproc` notation does not work either. Nor can I pass an environment variable to the command.\n\nENV processors 4\nENTRYPOINT [\"/tini\", \"--\", \"mpirun\", \"-np\", \"$processors\"] # doesn't work\n\n\nHas anyone managed to get this kind of workflow?"
] | [
"docker",
"mpi"
] |
[
"SQL - Join, but include null results (as if there was no join)?",
"I have a Contacts table and a Businesses table, they are joined via a Contacts_vs_Businesses table (it's a many-to-many relationship).\n\nI want to query the two tables; if a contact is related to two businesses, I want to return:\n\n\nA row with all contact details and all details of Business A;\nA row with all contact details and all details of Business B\nA row with all contact details and NO business details at all (as if I'd just done a basic SELECT on the first table)\n\n\nContacts Table\n\nID Contact_Name Contact_Phone\n1 Jez Clark 01234 567 890\n2 Someone Else 01254 648 654\n\n\nBusinesses Table\n\nID Business_Name Business_Address\n1 A Company 24, A Street, A Town\n2 Another Company 43, Another Street, Another Town\n\n\nContacts_vs_Businesses\n\nContact_ID Business_ID\n1 1\n1 2\n2 2\n\n\nI want to return:\n\nContact_Name Contact_Phone Business_Name Business_Address\nJez Clark 01234 567 890 A Company 24, A Street, A Town\nJez Clark 01234 567 890 Another Company 43, Another Street, Another Town\nJez Clark 01234 567 890 NULL NULL\n\n\nI'm on SQL Server 2008 R2.\n\nHow would I go about this (I'm guessing it's something REALLY easy...)? I've tried the various permutations of OUTER and INNER and LEFT/RIGHT joins, but none seem to give me that last line of results.\n\nThanks"
] | [
"sql",
"sql-server-2008",
"join"
] |
[
"Handle overlapping components in java swing",
"I am working on an app which when used for loading a file and drawing the contained components, may result into painting of overlapping components. For example, consider a big rectangle box containing text line inside it.\nNow because these components are overlapping, it is difficult for the user to select the inner text box in this case as it has been overlapped by the rectangle box.\n\nWe were thinking of solving this with allowing the users to actually move any component to a layer below the current one. But this has its own limitations on the usability side, as then for every such case the user will have to move the bigger or the most recently painted component to a layer below and then do the other processing on the inner components like dragging etc. There can be more than 2 components at the same 2d (x & y position) in this app.\n\nI am sure that there should be a better solution for this and could someone please provide some pointers on the implemention part of it."
] | [
"java",
"swing"
] |
[
"VBA formula for correlation coefficient between two variables where one of the variables is the sumproduct of two other variables",
"I need to calculate the correlation coefficient between two variables where one of them is the sumproduct of two other variables. In the following example I need to calculate CORREL which is the correlation coefficient between SUMPR and X. SUMPR is the sumproduct of values A and B with each of the values Y1 and Y2.\n\nIs there a way I can find CORREL without having to calculate SUMPR first? In other words, can I pass SUMPR in the correlation coefficient formula as a variable? I need to do that for very large dynamic tables and calculating SUMPR first takes a lot of space and time.\nThank you"
] | [
"arrays",
"vba",
"sumproduct"
] |
[
"After submit, b(array_name).map is not a function - ReactJS",
"I have started learning ReactJS and I am stuck on this error for a while now. \n\nexport default class Bag extends Component {\nconstructor(props){\n super(props)\n this.state = {\n books : [\n {\n name : \"Origin\",\n read : \"Yes\",\n owner: \"Yes\"\n },\n {\n name: \"The Alchemist\",\n read: \"Yes\",\n owner: \"Yes\"\n },\n {\n name : \"The Tale of Twisted Candle\",\n read : \"Yes\",\n owner: \"Yes\"\n },\n {\n name: \"Martian\",\n read: \"Yes\",\n owner: \"Yes\"\n }\n ]\n }\n this.setStateHandler = this.setStateHandler.bind(this)\n this.handleChange = this.handleChange.bind(this)\n}\n\n\nsetStateHandler(){\n this.setState({books: this.state.books })\n}\n\nhandleChange(book){\n console.log(\"Here is your book:\")\n console.log(book)\n console.log(this.state.books)\n let tempVal = {\n name : book.name,\n read : book.read,\n owner: book.owner \n }\n this.setState({books: this.state.books.push(tempVal) })\n console.log(this.state.books)\n}\n\nrender(){\n let b = this.state.books\n return (\n <div align=\"center\">\n <h1>{this.props.name}'s Bag</h1>\n <table>\n <tbody>\n <tr>\n <th>Book Name</th>\n <th>Read</th>\n <th>Ownership</th>\n </tr>\n </tbody>\n\n <tbody>\n { b.map(function(book){\n return <Book name={book.name} read={book.read} owner={book.owner}/>\n })}\n </tbody>\n </table>\n <BookForm name=\"Book\" read=\"No\" owner=\"No\" onChange={this.handleChange} />\n <Button /> \n </div>\n )\n}\n}\n\n\nWhen code is run for first time, everything works fine. But when I try to submit a new book, an error is thrown.\n\n TypeError: b.map is not a function \n\nWhile looking for the solution in other similar questions, they all referred that the map function is for Array not Object. So, I have checked that too. Apparently, the new value of 'b' after submit is still an Array."
] | [
"javascript",
"reactjs"
] |
[
"Why use JSONP and callbacks instead of a caller defined variable name?",
"I understand the idea behind jsonp and I'm sure there is a reason for not doing the following but I am curious as to what that is. \n\nWhy (due to security, ease of use, etc.) would one not create an API such as the following?\n\nhttp://www.something.com/json/?caller_var_name=the_var\n\nreturning JavaScript containing:\n\nthe_var = {\"my\": \"json\", \"content\": 1};\n\n\nOn the client, the code would look like:\n\n<script>\nvar the_var;\n</script>\n<script src=\"http://www.something.com/json?varname=the_var\"></script>\n// the_var now contains the requested JSON data\n\n\nThis seems straightforward and I've tested it cross domain but as mentioned, I'm sure those that thought of JSONP had a reason for not doing the above. Why is that?"
] | [
"javascript",
"json",
"jsonp"
] |
[
"using MongoDB in WSO2 EI",
"I want to use MongoDB for the DBlookup in sequence. My WSO2 EI version 6.1.1. I using PostgreSQL to logging calling sequences steps. Is WSO2 supporting NoSQL(not RDBMS)? \nHere example my PostgreSQL DB lookup:\n\n<dblookup>\n <connection>\n <pool>\n <dsName>jdbc/WSO2EsbLogsDB</dsName>\n </pool>\n </connection>\n <statement>\n <sql><![CDATA[select id as table_name]]></sql>\n <result column=\"id\" name=\"Id\"/>\n </statement>\n</dblookup>"
] | [
"mongodb",
"wso2",
"wso2esb",
"wso2ei"
] |
[
"JavaScript array handling: What am I doing wrong?",
"I have the following code:\n\n<html><body>\n<div id=\"1\" style=\"display:none\"></div>\n<div id=\"2\" style=\"display:none\"></div>\n<div id=\"3\" style=\"display:none\"></div>\n<div id=\"4\" style=\"display:none\"></div>\n<div id=\"5\" style=\"display:none\"></div>\n</body></html>\n\n<script>\nvar minutes_array = [];\n\nfor (var i = 0; i < 6; i++) {\n minutes_array.push(i);\n}\n\nminutes_array.forEach(myFunction);\n\nfunction myFunction(item, index) {\n document.getElementById(item).style.display = 'flex';\n}\n\n</script>\n\n\nI want to show all the five div's with this JavaScript code. But it isn't working. The div's don't show up. What am I doing wrong? Many thanks in advance."
] | [
"javascript",
"arrays",
"for-loop"
] |
[
"Sitecore privileges on users with multiple roles",
"Lets say I have users imported from active directory and I have only read only privileges on AD roles (I still can add my sitecore roles on top):\n\nevery user is in a generic domainuser role\n\nI have other roles, for instance budgetviewers\n\nI have a folder, budget that should be accessible only to users on budgetviewers role.\n\nso, the typical user accessing to that folder will be on domainusers AND budgetviewers roles\n\nNow, my problem is that deny privileges/inheritance seem to take precedence on \"allow privileges\". So\nIf domainusers are denied privileges and or inheritance on the budget folder, no matter what i do to the budgetviewer role, the users are not able to see the folder. As every user is in the domainusers folder, no user can access the budget folder. If I don't limit domainusers from seen budget folder, as every user is in that role, every one will see that folder.\n I don't have privileges/ownership to delete the domainuser role from users.\nHo should I approach this.\nthank you"
] | [
".net",
"security",
"sitecore",
"roles",
"sitecore6"
] |
[
"Google Chrome - download attribute of anchor tags",
"I've an extension which saves some files to the downloads folder. The code below is just for testing\n\n//This lies in the background page of my extension\nfunction fileTest(name) {\n var a = document.createElement('a');\n a.href = 'data:text/plain;base64,SGVsbG8gV29ybGQh'; //Hello World!\n a.download = name + '.txt';\n a.onclick = function (e) {console.log('[TEST] ' + name);return true;};\n a.click();\n}\nwindow.onload = function() {\n fileTest('test1');\n fileTest('test12');\n fileTest('test123');\n}\n\n\nonly the first file \"test1.txt\" is saved to the disk, although the output of the console shows that there was 3 clicks\n\n\n [TEST] test1\n \n [TEST] test12\n \n [TEST] test123\n\n\nIs this an intentional limitation by the browser ? or there's something wrong with the code ?"
] | [
"google-chrome",
"google-chrome-extension",
"download",
"anchor"
] |
[
"How do I pass struts2 with a Map",
"I have an bean placed on my action Event.java, the action is Called ManageEvents. I would like the user to be able to add to a struts2 multiple select form field and create a list or map of items (in this case Map where the data would be . \n\n<struts2:select name=\"event.dj_map\" label=\"Add DJs To Your Event\" list=\"event.dj_map\" listsize=\"5\" multiple=\"true\" headerKey=\"headerKey\" required=\"true\" headerValue=\"--- Please Select ---\">\n\n\nSo ultimately I would like to know how to pass a mult. select field (e.g. Events.dj_map) as a map of name,value pairs to an object (e.g. Event.java) set on the action (e.g. ManageEvents.java)."
] | [
"select",
"map",
"struts2"
] |
[
"Ansible cannot skip pause on first host from inventory group",
"I have a playbook where I have to run a delay of 30 seconds because of a slow starting java application but I want to skip that delay in the first host from the group.\n\n[jetty]\nhost1\nhost2\nhost3\n\n\nI have tried to add a pause and skip the first host from group but it did not worked.\n\n---\n- setup:\n\n- name: adding pause before running the playbook\n pause: seconds=30\n when: inventory_hostname != groups.jetty[0]\n\n\nThat should skip the delay from the first host but apply it on the second and third hosts, but it does not skip any hosts and applies the pause on all hosts from group.\n\nAny idea how can I make this work?"
] | [
"ansible",
"pause"
] |
[
"Why I am not getting any output when I run the program?",
"This is a small vaccation trip calculator program. I am here using function so anyone help me out to get the output. I don't understand where i am getting stuck. \n\nHotel Cost Per nights :\n\n> def hotel_cost(days): return 140 * days Flight cost for different\n> cities: def plane_ride_cost(city): if city == \"Charlotte\":\n> return 183 elif city == \"Tampa\":\n> return 220 elif city == \"Pittsburgh\":\n> return 222 elif city == \"Los Angeles\":\n> return 475\n> \n# Per Day Car Ride cost: \n> def rental_car_cost(days): \n> per_day_cost = 40 * days \n> if days >= 7:\n> per_day_cost = per_day_cost - 50\n> return per_day_cost elif days >=3:\n> per_day_cost = per_day_cost - 20\n> return per_day_cost else:\n> return per_day_cost\n> \n#Total trip Cost: \n> def trip_cost(city,days): \n> total = rental_car_cost(days)+hotel_cost(days - 1)+\n> plane_ride_cost(city)"
] | [
"python",
"python-2.7",
"function",
"python-3.6"
] |
[
"Android webview height not updated if last content was bigger",
"I searched a lot for my question, but I didn't find exactly answer. I want my webview to load different urls each time. When previous html content is bigger than last content, the webview is not updating its height. \nThe bigger content:\n\n\nAfter loading smaller html content, webview height not updating:\n\n\nI called webview's invalidate method, but not working. Any idea?"
] | [
"android",
"webview"
] |
[
"Can Reminder be updated for windows phone",
"Would appreciate you help for the following. \nI have created a reminder but I want to update it before or after the reminder nofiticaton has activated. here the code.\nProblem : it wont work even if there is no compilation error for this code. \n\n\n\nvar Myreminders = ScheduledActionService.GetActions()\n .Where(a => a.BeginTime.Month == month);\n\n\n foreach (Reminder r in Myreminders)\n {\n string strMyRmd;\n\n strMyRmd = r.Name.ToString();\n\n if ( strMyRmd == \"MyName1\" )\n {\n r.Title = \"Today Shopping\";\n } \n\n }\n\n\n\nThanks"
] | [
"windows-phone-7"
] |
[
"Stored procedure calling error on python3",
"Python script\n\ncursor = self.cursor\ndata = cursor.execute(\"call tests('test_site_name',@result);SELECT @result\")\nprint(data) // return 1\nrow = cursor.fetchone()\nprint(row) // None\n\n\nI use import MySQLdb library. Does MySQLdb not support stored procedures? It works on myphpadmin but it is not work on python 3. Please on my code.\n\nDELIMITER $$\nCREATE DEFINER=`root`@`localhost` PROCEDURE `tests`(IN `sitename` VARCHAR(100), OUT `_group_id` VARCHAR(100))\n NO SQL\nBEGIN\n SELECT sitename INTO _group_id ;\n\nEND$$\nDELIMITER ;"
] | [
"mysql",
"python-3.x",
"stored-procedures",
"mysql-python"
] |
[
"Namespace exists but still getting declaration conflicts?",
"I am working with the HDFql C++ wrapper library and trying to integrate it with R via Rcpp. I'm an experienced coder in general, but not in C++ specifically. I made another post about trying to resolve an issue with declaration conflicts. The compiler error message is copied below:\n\n../inst/include/HDFql/H5public.h:156:19: error: conflicting declaration βtypedef long long int ssize_tβ typedef long long ssize_t;\n\n\n(Link to the actual declaration in the header file)\n\nBasically, both HDFql and Rcpp have typedefs for long long and they conflict. However, the HDFql wrapper defines it's own namespace on this line right here, so I don't understand why I'm getting this conflict in the first place (I thought that's what namespaces are for!). I'm hoping a C++ guru can help me with two questions:\n\n\nWhy is this conflict happening even though the library is using a namespace? (EDIT: @Igor answered this in comment)\nPretend I'm the developer of the HDFql C++ wrapper (I'm not). How would I change the wrapper library or namespace structure so that these types of conflict can't occur? (Edit: maybe write a second wrapper for HDFql as per this answer?)\n\n\nI'd appreciate any insights you have!"
] | [
"c++",
"namespaces",
"hdfql"
] |
[
"Removing Ionic slider pager when only one slide",
"I am looking to hide the Ionic slider pager when there is only one slide within the slider. I found this thread at the Ionic forums https://forum.ionicframework.com/t/how-to-hide-slide-pager-slide-box-when-item-only-has-1-image-and-show-when-has-more/49886/2 and I tried it out but I think it must be for Ionic v1 or v2 as it through up an error for me in Ionic v3.\n\nIs there any particular conditional or method I can use to hide pagination if there is only one image slide?"
] | [
"angular",
"ionic-framework",
"ionic3"
] |
[
"How to convert a long string to a list of words in Python",
"I am doing a Python exercise where I need to remove all duplicated and sort a sentence into alphabetical order. Here is my code:\n\ndef removeDupsAndSort(string):\n newList= []\n string = (list(string))\n for item in string:\n if item not in newList:\n newList.append(item)\n newList.sort()\n print(\"\".join(newList))\n\nremoveDupsAndSort(\"hello world and practice makes perfect and hello world again\")\n\n\nWhen I run the program however, when it coverts the string into a list at the beginning, it converts it into a list of a bunch of single characters. Is there any way to convert the string into a list of words?"
] | [
"python",
"list"
] |
[
"operating with big.matrix",
"I have to work with big.matrix objects and I canβt compute some functions. Let's consider the following big.matrix:\n\n# create big.matrix object\nx <- as.big.matrix(\n matrix( sample(1:10, 20, replace=TRUE), 5, 4,\n dimnames=list( NULL, c(\"a\", \"b\", \"c\", \"d\")) ) )\n\n> x\nAn object of class \"big.matrix\"\nSlot \"address\":\n<pointer: 0x00000000141beee0>\n\n\nThe corresponding matrix object is:\n\n# create matrix object\n\nx2<-x[,]\n\n> x2\n a b c d\n[1,] 6 9 5 3\n[2,] 3 6 10 8\n[3,] 7 1 2 8\n[4,] 7 8 4 10\n[5,] 6 3 6 4\n\n\nIf I compute this operations with the matrix object, it works:\n\nsqrt(slam::col_sums(x2*x2))\n\n> sqrt(slam::col_sums(x2*x2))\n a b c d \n13.37909 13.82027 13.45362 15.90597 \n\n\nWhile if I use the big.matrix object (in fact what I have to use), it doesnβt work:\n\nsqrt(biganalytics::colsum(x*x))\n\n\nThe problems are 2 : the * operation (to create the square of each element of the matrix), which produces the error:\n\n\n Error in x * x : non-numeric argument transformed into binary operator\n\n\nand the sqrt function, which produces the error :\n\n\n Error in sqrt(x) : non-numeric argument to mathematical function.\n\n\nHow can I compute this operations with big.matrix objects?"
] | [
"r",
"r-bigmemory",
"bigdata"
] |
[
"Not able to add active class in React.js",
"I'm trying to add an active class only on click event but it's adding in all events I have three texts each should have active class when it's clicked please see what's wrong in my below code,\n\n class CategoryList extends React.Component {\n state = {\n productlist: [],\n isActive: false\n };\n comingSoon(e) {\n this.setState(activate => {\n return { productlist: data.comingsoon, isActive: !activate.isActive };\n });\n }\n boxOffice(e) {\n this.setState(activate => {\n return { productlist: data.boxoffice, isActive: !activate.isActive };\n });\n }\n newRelease(e) {\n this.setState(activate => {\n return { productlist: data.newrelease, isActive: !activate.isActive };\n });\n }\n render() {\n return (\n <div className=\"categoryList-container\">\n <div className=\"categoryList-text-wrapper\">\n <h5\n className={this.state.isActive ? \"active\" : \"\"}\n onClick={() => this.comingSoon(this)}\n >\n COMING SOON\n </h5>\n <h5\n className={this.state.isActive ? \"active\" : \"\"}\n onClick={() => this.boxOffice(this)}\n >\n BOX OFFICE\n </h5>\n <h5\n className={this.state.isActive ? \"active\" : \"\"}\n onClick={() => this.newRelease(this)}\n >\n NEW RELEASE\n </h5>\n </div>"
] | [
"reactjs",
"toggle"
] |
[
"Android - Fragment MyFragment not attached to an activity",
"I'm seeing a crash that I am unable to reproduce myself. This crash happens in the splash screen of the app. requireActivity() is returning null.\nI am using Navigation component. MainActivity is the first activity started and it's startDestination is the splash fragment.\nMain activity is pretty much empty since navigation component handles the first fragment transaction.\nclass MainActivity : Activity() {\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n }\n}\n\nHere is my SplashScreenFragment:\nclass SplashFragment : Fragment() {\n\n private val isFirstLaunch get() = PreferenceHelper.getObject<Boolean>(PREF_FIRST_LAUNCH) ?: true\n private lateinit var binding: FragmentSplashBinding\n\n override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {\n binding = FragmentSplashBinding.inflate(inflater, container, false)\n return binding.root\n }\n\n override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n super.onViewCreated(view, savedInstanceState)\n\n // Show loading animation\n }\n\n override fun onResume() {\n super.onResume()\n\n Log.d("TAG", "isFirstLaunch: $isFirstLaunch")\n\n Handler().postDelayed({\n\n Log.d("TAG", "postDelayed finished")\n\n if (isFirstLaunch){\n navigateToA()\n } else {\n navigateToB()\n }\n }, DELAY_COUNT)\n }\n\n\n private fun navigateToA(){\n startActivity(Intent(requireActivity(), ActivityA::class.java))\n requireActivity().overridePendingTransition(0, 0)\n requireActivity().finish()\n }\n\n private fun navigateToB(){\n startActivity(Intent(requireActivity(), ActivityB::class.java))\n requireActivity().overridePendingTransition(0, 0)\n requireActivity().finish()\n }\n\n companion object {\n const val PREF_FIRST_LAUNCH = "PREF_FIRST_LAUNCH"\n const val DELAY_COUNT = 4000L\n }\n}\n\nI heavily logged the flow of trying to pin down the problem. This is one instance of the crash.\nMainActivity : onCreate\nSplashFragment : onAttach\nSplashFragment : onViewCreated\nMainActivity : onResume\nSplashFragment : onResume\nSplashFragment : isFirstLaunch: true\nSplashFragment : onPause\nMainActivity : onPause\nSplashFragment : onDetach\nMainActivity : onDestroy\nMainActivity : onCreate\nSplashFragment : onAttach\nSplashFragment : onViewCreated\nMainActivity : onResume\nSplashFragment : onResume\nSplashFragment : isFirstLaunch: true\nSplashFragment : postDelayed finished\nSplashFragment : Navigating to ActivtityA\nCRASH\n\nAm I missing something obvious that would cause this to happen?\nThanks in advance.\n[EDIT]\nFatal Exception: java.lang.IllegalStateException: Fragment SplashFragment not attached to an activity.\n at androidx.fragment.app.Fragment.requireActivity(Fragment.java:833)\n at com.package.SplashFragment.navigateToA(SplashFragment.java:80)\n at com.package.SplashFragment.access$navigateToB(SplashFragment.java:25)\n at com.package.SplashFragment$onResume$1.run(SplashFragment.java:54)\n at android.os.Handler.handleCallback(Handler.java:883)\n at android.os.Handler.dispatchMessage(Handler.java:100)\n at android.os.Looper.loop(Looper.java:214)\n at android.app.ActivityThread.main(ActivityThread.java:7356)\n at java.lang.reflect.Method.invoke(Method.java)\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)"
] | [
"android",
"android-activity",
"crash",
"fragment"
] |
[
"Pickling Error while using Stopwords from NLTK in pyspark (databricks)",
"I found the following function online:\n\ndef RemoveStops(data_str): \n #nltk.download('stopwords')\n english_stopwords = stopwords.words(\"english\")\n broadcast(english_stopwords)\n # expects a string\n stops = set(english_stopwords)\n list_pos = 0\n cleaned_str = ''\n text = data_str.split()\n for word in text:\n if word not in stops:\n # rebuild cleaned_str\n if list_pos == 0:\n cleaned_str = word\n else:\n cleaned_str = cleaned_str + ' ' + word\n list_pos += 1\n return cleaned_str\n\n\nand then I am doing the following:\n\nColumntoClean = udf(lambda x: RemoveStops(x), StringType())\ndata = data.withColumn(\"CleanedText\", ColumntoClean(data[TextColumn]))\n\n\nThe error I am getting is the following:\n\n\n PicklingError: args[0] from newobj args has the wrong class\n\n\nFunny thing is if I rerun the same set of code, it runs and throws no pickling error. Can someone help me resolve this issue? Thank you!"
] | [
"pyspark",
"nltk",
"stop-words"
] |
[
"handle success/error responses http request angularjs",
"I have in my app.js a factory called UserService that does all the user HTTP requests for me. \n\nWhen I try to create a user I have the following method. \n\nfunction create(user) {\n return $http.post(envService.read('apiUrl') + '/auth/register', user).then(handleSuccess, handleError('Error creating user'));\n}\n\n\nThen In my controller I do something like this:\n\nfunction register() {\n vm.dataLoading = true;\n UserService.create(vm.user).then(function successCallback(response) {\n $location.path('/');\n Flash.create('success', response.message);\n }, function errorCallback(error) {\n Flash.create('danger', error);\n vm.dataLoading = false;\n });\n}\n\n\nfunctions to handle success and error\n\n // private functions\n\n function handleSuccess(res) {\n return res.data;\n }\n\n function handleError(error) {\n return function () {\n return { success: false, message: error };\n };\n }\n\n\nHowever, it always goes into the success callback even though the response code is a 403 or anything else that results in an error. Am I doing something wrong here?"
] | [
"javascript",
"angularjs"
] |
[
"How can I load historic data into a hypertable, and have the aggregate views pick it up",
"I have a hypertable (Event) and an associated continuous aggregate view (Daily Events)\n\nIn my testing I want to load a years worth of data historically, and have the aggregate view be refreshed to have that data.\n\nWhat is the right incantation to be able to achieve that.\n\nHere is the view and the settings ...\n\n\n\n\nNote: On Timescale 1.7, on PG 12"
] | [
"timescaledb"
] |
[
"Excel \"IF\" function.",
"If I want to only ask excel to calculate in a cell if TWO other cells have values in them, what is the code? I know that for it to calculate only if a single cell has a value is =if(A1=0,\"\",B1-B2)....but how do you add criteria that two cells have a value in them?"
] | [
"excel",
"if-statement"
] |
[
"Email showing arrow symbols",
"We are using Joomla and when it sends emails out it works fine except that in place of doing line feeds we are getting the arrow symbol (β).\nWithin the email we have \\n\\n - how would we get rid of the symbols.\n\nCheers\nRich"
] | [
"email",
"joomla"
] |
[
"Calendar Not return correct .weekday swift 3.1",
"I'm trying to get weekday of given Date Object. But it always returns +1 value.\nexample : If I gave a date as : 2017-06-01 18:30:00 +0000 \n\nit returns weekday 6 -> Friday\nIt should bee weekday 5 -> Thursday\n\nMy code :\n\nlet calendar = Calendar.current\n let day: Int = calendar.component(.weekday, from: self.month!)\n print (\"---------\")\n print(self.month!)\n print (day)\n switch day {\n case 1:print(\"Sunday\")\n case 2:print(\"Monday\")\n case 3:print(\"Tuesday\")\n case 4:print(\"Wednesday\")\n case 5:print(\"Thursday\")\n case 6:print(\"Friday\")\n case 7:print(\"Saturday\")\n default:\n break\n }\n\n\nOutput on the Console : (I have given 2 dates both of them ar wrong)\n\n---------\n2016-01-01 18:30:00 +0000\n7\nSaturday\n---------\n2017-06-01 18:30:00 +0000\n6\nFriday\n\n\nWhere I did the mistake...\nThank you."
] | [
"swift",
"swift3"
] |
[
"what is difference between setVariable and setVariableLocal in activiti?",
"What is the difference between setVariable and setVariableLocal methods in activiti? and when will use these methods."
] | [
"activiti",
"bpmn"
] |
[
"rails activeadmin select input gives wrong number of arguments (given 1, expected 0)",
"message.rb\n\n has_many :message_users\n has_many :users, through: :message_users\n accepts_nested_attributes_for :message_users\n\n\nin activeadmin form \n\npermit_params :description,:file, message_user_attributes: [:id, :user_id, :_destroy]\n\nform do |f|\nf.inputs \"Message\" do\n f.input :description\n f.input :file\nend\n\nf.has_many :message_users do |message_user|\n message_user.inputs \"\" do\n message_user.input :user_id, :as => :select, collection: User.all.map {|u| [ \"#{u.name} #{u.phone}\", u.id] }\n end\nend\n\nf.actions\n\n\nIt gives an error message_user.input :user_id line that ActionView::Template::Error (wrong number of arguments (given 1, expected 0)):\n\nI cant understand why it gives this error and how to fix it"
] | [
"ruby-on-rails",
"ruby",
"activeadmin",
"has-many-through"
] |
[
"Looping through an array of hashes in Perl",
"I'm a total Perl newbie, so forgive me if this is really stupid, but I can't figure this out. If I have an array like this:\n\nmy @array = (\n {username => 'user1', email => 'user1@email' },\n {username => 'user2', email => 'user2@email' },\n {username => 'user2', email => 'user3@email' }\n);\n\nWhat's the most simple way to loop through this array? I thought something like this would work:\n\nprint \"$_{username} : $_{email}\\n\" foreach (@array);\n\nBut it doesn't. I guess I'm too stuck with a PHP mindset where I could just do something like: foreach ($array as $user) { echo \"$user['username'] : $user['email']\\n\"; }"
] | [
"perl"
] |
[
"Mailchimp API v3.0 add subscriber to segment, not displaying in admin",
"I am trying to add a user that is in the list to a segment using drewm's Mailchimp php API wrapper \n\nCreating the segment if it doesn't exist works fine, and it displays in the MailChimp environment. If I then try to add a subscriber using POST /lists/{list_id}/segments/{segment_id}, the API responds like it should, stating that the subscriber has been added to the segment, or telling me the subscriber hasn't been added if the subscriber is already in the segment. But in the MailChimp admin, the segment still displays as empty. Here is my code, I have no idea where I'm going wrong: \n\n// Segmentation\n// Check if event has segment linked, if not, create segment and add to post meta\n$event_segment = get_post_meta($event->post_id, 'byron_mailchimp_segment', true);\n\nif (empty($event_segment)) {\n // Create new segment,\n $create_segment_response = $MailChimp->post('/lists/' . $event_list . '/segments/', [\n 'name' => 'Aangemeld',\n 'static_segment' => [],\n ]);\n\n $event_segment = $create_segment_response['id'];\n // Save segment ID to post meta\n add_post_meta($event->post_id, 'byron_mailchimp_segment', $event_segment);\n}\n\n$add_to_segment_response = $MailChimp->post('/lists/' . $event_list . '/segments/' . $event_segment, [\n 'members_to_add' => [$member['user_email']],\n]);\n\necho \"<pre>\";\nvar_dump($add_to_segment_response);\necho \"</pre>\";\n\n\nI've already checked if the $event_segment contains the right ID, and it does."
] | [
"php",
"mailchimp-api-v3.0"
] |
[
"Storage classes in C++ - misleading name?",
"Are storage classes in C++ (auto, register, static, extern and mutable) classes with the meaning of 'blueprints for objects' or is the name 'classes' somewhat misleading in this context?"
] | [
"c++"
] |
[
"How is POPCNT implemented in hardware?",
"According to http://www.agner.org/optimize/instruction_tables.pdf, the POPCNT instruction (which returns the number of set bits in a 32-bit or 64-bit register) has a throughput of 1 instruction per clock cycle on modern Intel and AMD processors. This is much faster than any software implementation which needs multiple instructions (How to count the number of set bits in a 32-bit integer?). \n\nHow is POPCNT implemented so efficiently in hardware?"
] | [
"assembly",
"x86",
"hardware"
] |
[
"using multiple joins codeigniter",
"I'm working on an academic CMS where I have to display query result being pulled from 5 tables using multiple joins. I am not getting the required results. Here are the table schemas:\n\nclass\n\nclass_id class_year class_semester class_course class_status\n1 2014 6 5 1\n2 2014 6 3 1\n3 2014 6 1 1\n4 2014 6 2 1\n5 2014 6 6 1\n\n\nHere, class_course is a foreign key in the course table as course_id\n\nclass_student\n\nclass_student_id class_id student_id class_marks\n 1 1 s-14-1 5\n 2 2 s-14-1 2\n 3 2 s-14-2 0\n\n\ncourse\n\ncourse_id course_code course_name course_credit\n 1 MT-001 Calculus I 3\n 2 MT-002 Calculus II 3\n 3 CS-001 Computer Programming 4\n 4 CS-002 Computer Fundamental 4\n 5 MG-001 Fundamental of Management 3\n 6 CS-098 Advance Programming 4\n\n\ncourse_offer\n\nco_id co_semester course_code\n 1 1 MT-001\n 2 1 CS-002\n 3 1 MG-001\n 4 1 CS-001\n 5 2 CS-098\n 6 2 MT-002\n\n\nHere, co_semester shows that this course is offered for students of which semester suppose 1, 2 3 4 etc.\n\ncourse_prerequisite\n\ncp_id course_id prereq_id\n 1 6 3\n 2 2 1\n\n\nHere, course_id and prereq_id are foreign keys in the course table as course_id\n\nNow, the desired query output required is based on these terms/conditions:\n\nShow all classes which are active (class_status=1) and...\n\n\nwhich do not have any pre-requisite course (class_course to be compared with course_prerequisite table) and was never studied before (class_student.class_id should not be available)\nwhich do not have pre-requisite course but was studied and failed, now the class is again scheduled to study\nwhich have prerequisite course but the prerequisite course has been passed by the student (class_student.class_marks > 50)\n\n\nhere is sample of desired output\n\nyear semester course_code course_name course_credit\n2014 6 MG-001 Fundamental of Management 3\n2014 6 CS-001 Computer Programming 4\n2014 6 MT-001 Calculus I 3\n\n\nHere MG-001, CS-001 and MT-001 does not have prerequisite and was not studied before, so must be shown to student.\n\nfrom class table \n\nCS-0098 has a prerequisite class, CS-001 Computer Programming, which was not studied before so do not show CS-0098 and instead show CS-001 Computer Programming\n\nsimilarly:\n\nMT-002 has the prerequisite class MT-001 which was studied but was failed. So, do not show MT-002 but MT-001.\n\nHere is the query I used to generate the result but produces wrong result:\n\nSELECT \n cl.class_id,cr.course_id,cr.course_code,cr.course_name,cr.course_credit \nFROM class cl \nLEFT JOIN course cr \n ON cl.class_course=cr.course_id \nLEFT JOIN course_offer co \n ON co.course_code=cr.course_code \nLEFT JOIN class_student cs \n ON cl.class_id=cs.class_id \n AND cs.student_id='S-14-1' \n AND cl.class_status=1 \n AND co.co_semester<=2 \nWHERE \n cs.class_id IS NULL\n\n\nHere is the query output:\n\nclass_id course_id course_code course_name course_credit\n 3 1 MT-001 Calculust 1 3\n 4 2 MT-002 Calculus 2 3\n 5 6 CS-098 Advance Programming 4\n\n\nHere, Calculus I and Calculus II Both are displayed which should not be the case for a student in a semester, as a student can study only one class at a time."
] | [
"php",
"mysql",
"codeigniter",
"join"
] |
[
"LWP::UserAgent and HTTP::Request for a POST request",
"In a certain script I tried to write this:\n\nmy $ua = LWP::UserAgent->new;\nmy $res = $ua->post($url, Content => $data);\n\n\nand got \"400 Bad Request\".\nAfter some reading I tried this:\n\nmy $ua = LWP::UserAgent->new;\nmy $req = HTTP::Request->new( 'POST', $url );\n$req->content( $data );\nmy $res = $ua->request( $req );\n\n\nand it worked, but I thought these two should do the same. What am I missing here?\nAm I misunderstanding something in the documentation of HTTP::Request and LWP::UserAgent?\n\nIs there a way to ask LWP::UserAgent to print what it is doing?"
] | [
"perl",
"http-request",
"lwp-useragent"
] |
[
"How to get the correct result when I use re.compile(pattern), if the pattern contains some special characters, like, (),?",
"I am trying to replace a string in a file using python re lib. But I failed on replacing some texts with some special characters, like, (), ?, etc. Can anyone help me look at this issue?\n\nI attached my code in here.:\n\nfilterText = '\\\"' + sheet.row_values(row)[1] + '\\\"';\nprint \"filterText = %s\"%filterText;\npattern = re.compile(filterText, re.S);\nreplacedText = '\\\"' + sheet.row_values(row)[2] + '\\\"';\nprint \"replacedText = %s\"%replacedText;\n\nif filterText == \"English (UK)\":\n print \"replacedText = %s\"%replacedText;\n\nfileContent = re.sub(pattern, replacedText, fileContent);"
] | [
"python",
"regex"
] |
[
"ORC files with Hive: java.io.IOException: Two readers",
"I have an ACID hive table, with files in ORC format. When attempting a compaction, I end up with the following error: Task: ... exited : java.io.IOException: Two readers for ... The full error is as follow:\n\n2019-06-03 07:01:05,357 ERROR [IPC Server handler 2 on 41085] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Task: attempt_1558939181485_29861_m_000001_0 - exited : java.io.IOException: Two readers for {originalWriteId: 143, bucket: 536870912(1.0.0), row: 3386, currentWriteId 210}: new [key={originalWriteId: 143, bucket: 536870912(1.0.0), row: 3386, currentWriteId 210}, nextRecord={2, 143, 536870912, 3386, 210, null}, reader=Hive ORC Reader(hdfs://HdfsNameService/tbl/delete_delta_0000209_0000214/bucket_00001, 9223372036854775807)], old [key={originalWriteId: 143, bucket: 536870912(1.0.0), row: 3386, currentWriteId 210}, nextRecord={2, 143, 536870912, 3386, 210, null}, reader=Hive ORC Reader(hdfs://HdfsNameService/tbl/delete_delta_0000209_0000214/bucket_00000, 9223372036854775807)]\n at org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ensurePutReader(OrcRawRecordMerger.java:1171)\n at org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.<init>(OrcRawRecordMerger.java:1126)\n at org.apache.hadoop.hive.ql.io.orc.OrcInputFormat.getRawReader(OrcInputFormat.java:2402)\n at org.apache.hadoop.hive.ql.txn.compactor.CompactorMR$CompactorMap.map(CompactorMR.java:964)\n at org.apache.hadoop.hive.ql.txn.compactor.CompactorMR$CompactorMap.map(CompactorMR.java:941)\n at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)\n at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:465)\n at org.apache.hadoop.mapred.MapTask.run(MapTask.java:349)\n at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:174)\n at java.security.AccessController.doPrivileged(Native Method)\n at javax.security.auth.Subject.doAs(Subject.java:422)\n at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)\n at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:168)\n\n\nThis table is created and updated by merge'ing avro files into an orc table, hence the bunch of deltas, both delete_delta and delta.\n\nI have many other such tables, which do not have this issue. This table has nothing out of the ordinary and is actually quite small (<100k rows, 2.5M on disk) and was in the last month updated 100 times (20k rows updated, 5M update data). The DDL is:\n\nCREATE TABLE `contact_group`(\n `id` bigint,\n `license_name` string,\n `campaign_id` bigint,\n `name` string,\n `is_system` boolean,\n `is_test` boolean,\n `is_active` boolean,\n `remarks` string,\n `updated_on_utc` timestamp,\n `created_on_utc` timestamp,\n `deleted_on_utc` timestamp,\n `sys_schema_version` int,\n `sys_server_ipv4` bigint,\n `sys_server_name` string,\n `load_ts` timestamp)\nROW FORMAT SERDE\n 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'\nSTORED AS INPUTFORMAT\n 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'\nOUTPUTFORMAT\n 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'\nLOCATION\n 'hdfs://HdfsNameService/dwh/vault/contact_group'\nTBLPROPERTIES (\n 'bucketing_version'='2',\n 'last_modified_by'='hive',\n 'last_modified_time'='1553512639',\n 'transactional'='true',\n 'transactional_properties'='default',\n 'transient_lastDdlTime'='1559522011')\n\n\nThis happens every few months. As everything else (select, merge) works, the fix is usually to create a second table (create table t as select * from contact_group) and switch the tables, but I would like to find the real underlying reason.\n\nThe only reference I found about my error is in the code itself, which does not help me much.\n\nThis is on hdp3.1, with Hive 3."
] | [
"hive",
"orc",
"hdp"
] |
[
"I need the data ,according to the type I send",
"My view blade that displays the data of all types but I need the specific type only, where i send it by ajax: \"{{ route('taxonomies.json',type) }}\".How do I send the type that I want from the given type?\n\n<div class=\"table\">\n <table id=\"taxonomyTable\">\n <thead>\n <tr>\n <th>SN</th>\n <th>Title</th>\n <th>Parent</th>\n <th>Status</th>\n <th>Action</th>\n </tr>\n </thead>\n </table>\n</div>\n<div class=\"modal fade\" id=\"quickModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"quickModal\" aria-hidden=\"true\">\n</div> \n<input type=\"hidden\" id=\"type\" value=\"{{ $type }}\" />\n\n\nand the js is:\n\n<script>\n $(document).ready(function () {\n\n var type = $('#type').val();\n\n $('#taxonomyTable').DataTable({\n processing: true,\n serverSide: true,\n ajax: \"{{ route('taxonomies.json') }}\",\n columns: [\n {\n data: 'id',\n render: function (data, type, row) {\n return '<strong> #' + data + '</strong>';\n }\n },\n {\n data: 'title', name: 'title',\n render: function (data, type, row) {\n return '<strong>' + data + '</strong>';\n }\n },\n {\n data: 'parent', name: 'parent',\n render: function (data, type, row) {\n return '<strong>' + data.title + '</strong>';\n }\n },\n {\n data: 'type', name: 'type',\n render: function (data, type, row) {\n return '<strong>' + data.type+ '</strong>';\n }\n },\n {\n data: 'status',\n render: function (data, type, row) {\n return data === 'Active' ? '<button class=\"btn btn-outline-success btn-update-status\" data-id=\"' + row.id + '\">Active</button>' : '<button class=\"btn btn-xs btn-outline-danger btn-update-status\" data-id=\"' + row.id + '\">Inactive</button>';\n }\n },\n {data: 'action', name: 'action', orderable: false, searchable: false}\n ]\n });\n });\n</script>\n\n\nand my route is:\n\n Route::get('/taxonomies/taxonomy-json/{type}', 'Admin\\TaxonomyController@taxonomyJson')->name('taxonomies.json');\n\n\nand my TaxonomyController has:\n\n public function taxonomyJson()\n{\n $taxonomy = Taxonomy::with('parent')->toJson();\n return DataTables::of($taxonomy)\n ->addIndexColumn()\n ->addColumn('action', function ($taxonomy) {\n return '<div class=\"table-actions float-left\">\n <a href=\"javascript:void(0);\" class=\"btn-edit-taxonomy\" data-id=\"' . $taxonomy->id . '\"><i class=\"ik ik-edit-2 green\"></i></a>\n <a href=\"javascript:void(0);\" class=\"btn-delete-taxonomy\" data-id=\"' . $taxonomy->id . '\"><i class=\"ik ik-trash-2 red\"></i></a>\n </div>';\n })->make();\n}\n\n\nThe code mentioned above displays all of the types in the data but I only need the data of given type.Like my types are category, tag, videos,slider,etc and I need the data of types category only.\nHow can I fetch it?"
] | [
"ajax",
"datatable",
"laravel-5.8"
] |
[
"How to find the minimum by group based on a condition using dplyr?",
"So I have a random data frame that can be created with this code\n\nlibrary(dplyr)\ndates <- seq(as.Date(\"2015-01-01\"),as.Date(\"2015-12-31\"),1)\nweekdays <- weekdays(dates)\n\nres <- data.frame(dates,weekdays)\n\nres$customer <- ifelse(dates > as.Date(\"2015-02-05\"), \"Google\", \"Apple\")\n\nres$order_flag <- ifelse(weekdays == \"Wednesday\", 1, 0)\n\n\nI am trying to create a flag that equates to one for the first time that order_flag==1 for each customer. The end result here would only have two instances where this new flag = 1. I tried to do this in dplyr this way:\n\nnew_data <- res %>% group_by(customer) %>% mutate(min_date = which.min(order_flag ==1)) \n\n\nbut that didn't seem to work."
] | [
"r",
"dplyr"
] |
[
"Google+ JavaScript API: How to detect user sign in status?",
"I have deployed Google+ Sign-in Button, now I have to provide Sign-Out Button, before that, I need to know whether the user is still signed in, by which I can then show or hide this button.\n\nI found this documentation: gapi.auth.checkSessionState(sessionParams, callback):\nhttps://developers.google.com/+/web/api/javascript?hl=en#gapiauthchecksessionstatesessionparams_callback\n\nCould someone demo how to use it ?\n\nMany thanks."
] | [
"google-plus",
"google-api-client"
] |
[
"Creating Dynamic Object Keys After mapping on an Array",
"So I want to create a quite complex data structure that looks like the following:\n\nslots: {\n 'slot_1': {\n id: 'slot_1',\n associatedCard: {}\n },\n 'slot_2': {\n id: 'slot_2',\n associatedCard: {}\n },\n 'slot_3': {\n id: 'slot_3',\n associatedCard: {}\n }\n}\n\n\nI have 10 slots that I want to populate with cards (each slot can contain one card) so I am actually looping over the cards, creating the slots and I tried to dynamically generate the above data structure. Here is my code:\n\n slots: (() => {\n return {\n ...cards.map((card, index) => {\n return {\n [`slot_${index + 1}`]: {\n id: `slot_${index + 1}`,\n ownedCard: {}\n }\n };\n })\n };\n })(),\n\n\nHowever, I am not getting what I desire. This is what I get:\n\n\nHow can I fix this so that I have slot_1 instead of 0 as key, slot_2 instead of 1 as key, etc..?"
] | [
"javascript",
"reactjs",
"algorithm",
"data-structures",
"jsx"
] |
[
"Adding TOC to PDFDocument in Swift/Cocoa using PDFOutline",
"I'm working on a small routine that takes a number of single page PDFs and merges them together into one multi-page PDF. I'm working in Swift4/MacOS/Cocoa and can not for the life of me find any kind of example in Swift for creating an outline / only traversing an existing one (which I'm well familiar with).\n\nUsing best guess on the documentation I came up with the following which I've been twiddling w/a bit but no luck at all. The PDF comes out fine but there is never an outline/TOC in it. It might be as simple as a missing assignment or something... any leads would be greatly appreciated. \n\nBTW, the reason it's in two loops rather than one was because I thought maybe I needed to add all pages first - but trying that didn't make a difference. Ultimately will just have one loop if possible.\n\nstatic func mergePagesIntoSinglePDF(streamId: String, numPages: Int)\n {\n let newPDF = PDFDocument()\n var directoryURLStr = \"\"\n\n for pageNum in 1...numPages {\n\n let directoryUrl = getFileURL(streamId: streamId, recNum: pageNum)\n directoryURLStr = directoryUrl!.absoluteString\n\n if let pdfDocument = PDFDocument(url: directoryUrl!),\n let pdfPage = pdfDocument.page(at: 0)\n {\n newPDF.insert(pdfPage, at: newPDF.pageCount) \n }\n }\n\n for pageNum in 1...numPages {\n\n let newDest:PDFDestination = PDFDestination.init(page: newPDF.page(at: pageNum-1)!, at:NSPoint(x:1,y:1))\n let newTOCEntry:PDFOutline = PDFOutline.init()\n\n newTOCEntry.destination = newDest\n newTOCEntry.label = \"This is page: \\(pageNum)\"\n newPDF.outlineRoot?.insertChild(newTOCEntry, at: pageNum-1)\n }\n\n directoryURLStr = (getFileURL(streamId: streamId)?.absoluteString)!\n let fileURL = URL(string: directoryURLStr)\n\n newPDF.write(to: fileURL!)\n }"
] | [
"swift",
"cocoa",
"pdf-generation"
] |
[
"How to optimize UIImage scaling for fast scaling",
"People, i need your help.\n\nNeed optimizing scaling images on flow. I try two methods for scale image with save proportions, please inspect this code and say, how i can it optimize if you want/can:\n\n// Draw image in rect (PNG 1000ms, JPG 834ms for 8 pictures)\n+ (UIImage *)imageWithImage:(UIImage *)sourceImage\n scaledToSizeWithSameAspectRatio:(CGSize)targetSize\n withInterpolationQuality:(CGInterpolationQuality)quality\n{\n CGSize imageSize = sourceImage.size;\n\n CGFloat width = imageSize.width;\n CGFloat height = imageSize.height;\n\n CGFloat targetWidth = targetSize.width;\n CGFloat targetHeight = targetSize.height;\n\n CGFloat scaledWidth = targetWidth;\n CGFloat scaledHeight = targetHeight;\n\n CGPoint thumbnailPoint = (CGPoint){0.0, 0.0};\n\n if (CGSizeEqualToSize(imageSize, targetSize) == NO) {\n\n CGFloat widthFactor = targetWidth / width;\n CGFloat heightFactor = targetHeight / height;\n\n if (widthFactor > heightFactor) {\n\n scaledWidth = width * widthFactor;\n scaledHeight = height * widthFactor;\n\n thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;\n }\n else {\n\n scaledWidth = width * heightFactor;\n scaledHeight = height * heightFactor;\n\n thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;\n }\n\n }\n\n UIGraphicsBeginImageContextWithOptions(targetSize, YES, 1.0);\n\n dispatch_sync(dispatch_queue_create(\"pro.idev.itux.projectNameHere\", DISPATCH_QUEUE_SERIAL), ^{\n CGContextRef ctx = UIGraphicsGetCurrentContext();\n CGContextSetInterpolationQuality(ctx, quality);\n [sourceImage drawInRect:(CGRect){thumbnailPoint, {scaledWidth, scaledHeight}}];\n });\n\n UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n\n return newImage;\n}\n\n// Draw CGImage in rect (PNG 1326ms, JPG 1026ms for 8 pictures)\n+ (UIImage *)imageWithCGImage:(CGImageRef)sourceImage\nscaledToSizeWithSameAspectRatio:(CGSize)targetSize\n withInterpolationQuality:(CGInterpolationQuality)quality\n{\n\n CGFloat width = CGImageGetWidth(sourceImage);\n CGFloat height = CGImageGetHeight(sourceImage);\n\n CGFloat targetWidth = targetSize.width;\n CGFloat targetHeight = targetSize.height;\n\n CGFloat scaledWidth = targetWidth;\n CGFloat scaledHeight = targetHeight;\n\n CGPoint thumbnailPoint = (CGPoint){0.0, 0.0};\n\n if (CGSizeEqualToSize((CGSize){width, height}, targetSize) == NO) {\n\n CGFloat widthFactor = targetWidth / width;\n CGFloat heightFactor = targetHeight / height;\n\n if (widthFactor > heightFactor) {\n\n scaledWidth = width * widthFactor;\n scaledHeight = height * widthFactor;\n\n thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;\n }\n else {\n\n scaledWidth = width * heightFactor;\n scaledHeight = height * heightFactor;\n\n thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;\n }\n\n }\n\n UIGraphicsBeginImageContextWithOptions(targetSize, YES, 1.0);\n\n dispatch_sync(dispatch_queue_create(\"pro.idev.itux.projectNameHere\", DISPATCH_QUEUE_SERIAL), ^{\n CGContextRef ctx = UIGraphicsGetCurrentContext();\n CGContextTranslateCTM(ctx, 0, targetHeight);\n CGContextScaleCTM(ctx, 1.0, -1.0);\n CGContextSetInterpolationQuality(ctx, quality);\n CGContextDrawImage(ctx, (CGRect){thumbnailPoint, {scaledWidth, scaledHeight}}, sourceImage);\n });\n\n UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n\n return newImage;\n}"
] | [
"objective-c",
"uiimage",
"core-graphics"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.