texts
sequence
tags
sequence
[ "How to define similar class-functions related to different class-properties inside __init__", "I have a class like this:\n\nclass MyClass(object):\n\n def f_1(self,x):\n return foo(x, self.property_1)\n\n def f_2(self,x):\n return foo(x, self.property_2)\n\n\nThe idea is that multiple functions f_n have a common structure, but depend on different properties property_n of the class.\n\nI look for a more compact way to define those f_n in the __init__? I think of something like\n\nclass MyClass(object):\n\n def __init__(self):\n self.f_1 = self.construct_function(self.property_1)\n self.f_2 = self.construct_function(self.property_2)\n\n def construct_function(self, property):\n # ??? \n\n\nThat is what I have in mind, but I dont know how to define this construct_function. It is important that 'property' is of a point-by-value type.\n\nEdit:\n\nI simplified Martijn's very good answer to this solution, which works fine:\n\ndef construct_function(property_name):\n def f_n(self, x):\n return foo(x, getattr(self, property_name))\n\n return f_n\n\nclass MyClass2(object):\n\n f_1 = construct_function('property_1')\n f_2 = construct_function('property_2')\n\n\nJust wanted to mention it here, as multiline comments are not allowed..." ]
[ "python", "class" ]
[ "Moving android studio project from mac to windows", "I just got an android studio project folder from a mac laptop and am currently trying to open it in windows android studio. I'm not quite sure but it doesn't seem to be detecting any of the files. I'm not really familiar with android studio at this point any suggestions on how to build this project in windows would be much appreciated.\n\nall the best" ]
[ "java", "ios", "windows", "android-studio" ]
[ "How can I convert \"year-month-day\" string of date, to day as a string in user local language", "I'm working with a String of date such as:\n val date = "2021-01-24"\n\nhow can I convert that string in order to get "Sunday" (user local english) or "Domingo" (user local spanish)?\n// Error I get using Dai answer\njava.lang.IllegalArgumentException: Cannot format given Object as a Date\n\nI'm using this code:\n// Step 1: Parse the string with a defined format:\n\nval tomorrowDateString = body.forecast.forecastday[1].date // -> "2021-01-24"\nval parseTomorrow = LocalDate.parse(tomorrowDateString, DateTimeFormatter.ofPattern( "yyyy-MM-dd" ))\n\n// Step 2: Format using the user's culture/locale settings:\n\nval userFormat = java.text.DateFormat.getDateInstance( DateFormat.SHORT )\nval tomorrow = userFormat.format(parseTomorrow)" ]
[ "android-studio", "kotlin" ]
[ "Flutter DropdownMenuItem: how to iterate", "folks.\nConsider the DropdownMenuItem items:\n"USA, India, Germany, Brazil"\nI have a json with a value (for ex: Brazil). When the user open the screen, I'd like to iterate the DropdownMenuItem and show the "Brazil" item as the selected item.\nVery simple :))\nTks." ]
[ "loops", "flutter" ]
[ "Uniquely identifying individual views in CardView-RecyclerView", "An interesting scenario: I need to uniquely identify a View (EditText to be precise) in a RecyclerView that has CardViews. \n\nI have a RecyclerView with a variable number of CardViews. Each CardView has an EditText (R.id.etCodeBox). When the user scrolls the RecyclerView and enters something in an EditText of his choice and clicks a Button, I read the value of R.id.etCodeBox, and it always returns a blank value (\"\"). Only on the first CardView, I can read back the entered value correctly. \n\nRelevant code snippet\n\npublic boolean verifyCode(Context context, View rootView, int dID, int drID, int userCount)\n{\n EditText codeBox = (EditText) rootView.findViewById(R.id.etCodeBox);\n\n String enteredCode = codeBox.getText().toString();\n long nowInMillis = Calendar.getInstance().getTimeInMillis();\n\n TextView tvDCount, tvDDate;\n tvDCount = (TextView) rootView.findViewById(R.id.tvDCount);\n tvDDate = (TextView) rootView.findViewById(R.id.tvDDate);\n codeBox.setText(\"\");\n if (enteredCode.equals(String.valueOf(dID)))\n {\n :\n :\n\n\nRelevant Layout snippet\n\n <android.support.v7.widget.CardView\n android:id=\"@+id/cvDBack\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n card_view:cardBackgroundColor=\"@color/commonMainListsBackground\"\n card_view:cardCornerRadius=\"10dp\"\n card_view:cardElevation=\"12dp\"\n card_view:contentPadding=\"2dp\">\n\n :\n :\n :\n\n <EditText\n android:id=\"@+id/etCodeBox\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:alpha=\"0.5\"\n android:hint=\"Code\"\n android:inputType=\"numberPassword|none\"\n android:focusable=\"true\"/>\n\n <Button\n android:id=\"@+id/btClaim\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_below=\"@+id/etCodeBox\"\n android:text=\"Claim!\"/>\n :\n :\n :\n\n\nSo, how can I read the correct value from the EditText irrespective of the CardView's position? In other words, how do I point uniquely to the 'selected' or 'focused' CardView's R.id.etCodeBox?" ]
[ "android-recyclerview", "android-cardview" ]
[ "Is it possible to create a single executable file of a Ruby on Rails project?", "How to create a single executable file for any rails project." ]
[ "ruby-on-rails", "ruby" ]
[ "dispatchEvent from react js component", "I try to dispatch an event within a react component but It throw me this error:\n\"Uncaught DOMException: Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched\"\n\nMy global event:\n\nvar event = new Event('myevent');\n\nwindow.addEventListener('myevent', () => {\n console.log(\"test\");\n}) \n\n\nAnd from my react component I want to fire it:\n\nwindow.dispatchEvent(event);\n\n\nAny help?\nThanks!" ]
[ "reactjs", "dispatchevent" ]
[ "How to add new line to itab with VALUE expression", "ABAP 7.40 brought us new syntax, I am still figuring it out.\nI want to add a new line to the existing table lt_itab. I found a workaround by adding an empty line and figuring out the current length of the table for an update by index, but is there an easier way?\nSELECT spfli~carrid, carrname, connid, cityfrom, cityto\n FROM scarr\n INNER JOIN spfli\n ON scarr~carrid = spfli~carrid\n WHERE scarr~carrid = @carrier\n ORDER BY scarr~carrid\n INTO TABLE @DATA(lt_itab).\n\n"How can I simplify the following code part?" \nDATA(lv_idx) = lines( lt_itab ).\nAPPEND INITIAL LINE TO lt_itab.\nlt_itab[ lv_idx + 1 ] = VALUE #( carrid = 'UA'\n carrname = 'United Airlines'\n connid = 941\n cityfrom = 'Frankfurt'\n cityto = 'San Francisco' )." ]
[ "abap" ]
[ "Overwrite return address In C with a unsigned long variable using buffer overflow", "I am trying to overwrite the data using strcpy() function with that stack protection off. The problem I encounter here is that using strcpy() to write an unsigned long variable(address) would change the value because of little-endian(?). I want to know if there is any way to copy the exact value of unsigned long into the stack using strcpy() or I should use another function instead.\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n// some shellcode in format like "\\x31\\xc0"\nconst char shellcode[] = ...;\n\n// vulnerable function bof\nvoid bof(char *str){\n char buffer[12];\n printf("Come into function bof\\n");\n strcpy(buffer, str);\n}\n\nint main(int argc, char **argv){\n char buffer[517];\n //random filling of buffer that may not be necessary\n strcpy(buffer,"abcdefghijkl1234");\n\n //I believe buffer[16] is the location of return addr when the program goes in bof()\n //I write the shell code into buffer[20] first\n strcpy(&buffer[20],shellcode);\n\n //Trying to make value of location buffer[16] into address of buffer[20]\n strcpy(&buffer[16],&buffer[20]);\n\n\n // bof is called here\n bof(buffer);\n printf("Exit from function bof\\n");\n}" ]
[ "c", "buffer-overflow" ]
[ "str.encode() changes UTF-8 characters", "it has been suggested that this question is a duplicate of 6269765. I did not use any b'' literals in either the original code or the minimal. see the embeDded edits below:\n\nI have reduced a problem I have been having today down to this minimal Python 3 code:\n\nx='\\xc3\\xb3'\nprint(''.join([hex(ord(c))[2:] for c in x]))\nprint(''.join([hex(c)[2:] for c in x.encode()]))\n\n\nWhen I run this code I get:\n\nc3b3\nc383c2b3\n\n\nIs str.encode() really supposed to change UTF-8 character ó (LATIN SMALL LETTER O WITH ACUTE) to two characters ó (LATIN CAPITAL LETTER A WITH CIRCUMFLEX and SUPERSCRIPT THREE)?\n\n\n\nedit:\n\nNo ó was entered as one commenter suggested. Only ó was entered in some cases and was read in from a text file in others. The text file involved was in the original problem. It was the system dictionary file of the current version of Ubuntu. The file is dated 23 Oct 2011 and has a filesystem path as seen in command examples of the original question.\n\nThe original problem involved encountering the word Asunción at line 1053 of that file. The ó character in Asunción has the byte sequence C3B3 which is described in the FileFormat.Info UTF-8 lookup table as LATIN SMALL LETTER O WITH ACUTE (described here for readers unable to properly read Unicode text.\n\nNo b'' literals were used in any code, neither the original, nor the minimal.\n\nThe nature of the problem was discovered as UTF characters being changed from the ó character to ó. This involved changing c3b3 to c383c2b3. The dictionary file literally contained the two bytes c3b3 which display ó as expected and as described in that UTF-8 table. The original problem was an exception being raised due to the change in length.\n\nThe use of str.encode() was made to try to solve the problem and to discover its source. It is believed that something, somewhere, did something similar to str.encode().\n\nThe minimal code to show this problem at first was:\n\nx='Asunción'\nprint(' '.join([hex(ord(c))[2:] for c in x]))\nprint(' '.join([hex(c)[2:] for c in x.encode()]))\n\n\nbut I found that many people were unable to see the lower case acute o so I changed it to hexadecimal codes (\\x) which had the same hexadecimal verification output both before and after the str.encode() as the first minimal example just above with the literal full word Asunción.\n\nThen I decided it would be more minimal to use the affected character alone and no spaces in the hexadecimal output.\n\nend of edit, back to original post:\n\n\n\nThis UTF-8 character was encountered in the American English dictionary file on the latest American English Ubuntu edition named /usr/share/dict/american-english. You can see the first word in that file with this sequence with the command:\n\nhead -1053 /usr/share/dict/american-english|tail -1\n\n\nYou can see it in hexadecimal with the command:\n\nhead -1053 /usr/share/dict/american-english|tail -1|od -Ad -tx1\n\n\nCharacter descriptions were obtained from here. I am running Python 3.5.2 compiled on GCC 5.4.0 on Ubuntu 16.04.1 LTS updated 2 days ago.\n\nedit:\n\nis the correct answer here to avoid bytes totally and not use str.encode()? or is there a better answer?" ]
[ "python-3.x", "utf-8", "character-encoding" ]
[ "Send and receive data in controller from Static files without binding to model", "I need to send/receive data to/from C# API without using a model.\n\nI've for testing purposes, the below JS:\n\nfetch('/login', {\n method: 'post',\n body: JSON.stringify({\n email: '[email protected]', //document.getElementById('email').value\n pswd: '1234' //document.getElementById('answer').value\n })\n})\n.then(function(response) {\n return response.text();\n // return response.json();\n}).then(function(text) { \n // console.log(text); \n});\n\n\nwhere I need to send the username and password, and need the server to send back some confirmations.\n\nThe Controller used in C# is:\n\n[Route(\"/login\")]\npublic class FetchController\n{\n [HttpPost]\n public async Task Post(String loginParam)\n {\n if (loginParam != null)\n {\n Console.WriteLine(\"Login Data Recieved\");\n }\n else\n {\n Console.WriteLine(\"Login Data is NULL\");\n }\n Console.WriteLine(loginParam);\n var response = _httpContextAccessor.HttpContext.Response;\n response.Headers.Add(\"Content-Type\", \"text/event-stream\");\n response.StatusCode = 200;\n await response\n .WriteAsync($\"user logged in at {DateTime.Now}\\r\\r\"); \n response.Body.Flush();\n }\n}\n\n\nHere I keep getting the Login data is NULL, I know this is as I did not bind the login data to Model class, so how can I make the above working WITHOUT using MODEL binding" ]
[ "c#", "asp.net-core-mvc", "model-binding", ".net-core" ]
[ "Mongoose script to seed database hangs", "I have the following script:\n\nconst db = require('../db')\nconst User = require('../models/user')\n\ndb.on('error', console.error.bind(console, 'MongoDB connection error:'))\n\nconst main = async () => {\n const users = [\n new User({ name: 'Benny', age: 28, status: 'active' }),\n new User({ name: 'Claire', age: 28, status: 'active' })\n ]\n const newUsers = async () => {\n await users.forEach(async user => await user.save())\n }\n await newUsers()\n console.log(\"Created users!\")\n}\n\nconst run = async () => {\n await main()\n process.exit(0)\n}\n\nrun()\n\n\nFor some reason process.exit() executes before main() resolves and therefore I get no users created.\n\nIf I remove process.exit() my script works but hangs.\n\nHow do I get my script to work and exit once done executing?" ]
[ "javascript", "mongodb", "mongoose" ]
[ "I have error when I used php yii migrate command?", "I am trying to Creating new migrations in my Database but this error in the command happened after writing php yii migrate in toggle terminal\n\r\n\r\nAbdul-fattahs-MacBook-Pro:cust abdul-fattah$ php yii migrate\nYii Migration Tool (based on Yii v2.0.36)\n\nException 'yii\\db\\Exception' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away'\n\nin /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Connection.php:637\n\nStack trace:\n#0 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Connection.php(1025): yii\\db\\Connection->open()\n#1 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Connection.php(1012): yii\\db\\Connection->getMasterPdo()\n#2 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Command.php(255): yii\\db\\Connection->getSlavePdo()\n#3 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Command.php(1154): yii\\db\\Command->prepare(true)\n#4 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Command.php(401): yii\\db\\Command->queryInternal('fetchAll', NULL)\n#5 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/mysql/Schema.php(319): yii\\db\\Command->queryAll()\n#6 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/mysql/Schema.php(125): yii\\db\\mysql\\Schema->findColumns(Object(yii\\db\\TableSchema))\n#7 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Schema.php(757): yii\\db\\mysql\\Schema->loadTableSchema('migration')\n#8 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/db/Schema.php(193): yii\\db\\Schema->getTableMetadata('{{%migration}}', 'schema', true)\n#9 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/controllers/MigrateController.php(211): yii\\db\\Schema->getTableSchema('{{%migration}}', true)\n#10 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(877): yii\\console\\controllers\\MigrateController->getMigrationHistory(NULL)\n#11 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(169): yii\\console\\controllers\\BaseMigrateController->getNewMigrations()\n#12 [internal function]: yii\\console\\controllers\\BaseMigrateController->actionUp(0)\n#13 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)\n#14 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/base/Controller.php(180): yii\\base\\InlineAction->runWithParams(Array)\n#15 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/Controller.php(181): yii\\base\\Controller->runAction('', Array)\n#16 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/base/Module.php(528): yii\\console\\Controller->runAction('', Array)\n#17 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/Application.php(180): yii\\base\\Module->runAction('migrate', Array)\n#18 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/console/Application.php(147): yii\\console\\Application->runAction('migrate', Array)\n#19 /Applications/MAMP/htdocs/cust/vendor/yiisoft/yii2/base/Application.php(386): yii\\console\\Application->handleRequest(Object(yii\\console\\Request))\n#20 /Applications/MAMP/htdocs/cust/yii(20): yii\\base\\Application->run()\n#21 {main}\r\n\r\n\r\n\nand this is my code in config/db.php and I can't fiend my problem .......\n\r\n\r\n<?php\n\nreturn [\n 'class' => 'yii\\db\\Connection',\n 'dsn' => 'mysql:host=127.0.0.1;dbname=cust',\n 'username' => 'root',\n 'password' => 'root',\n 'charset' => 'utf8',\n\n];" ]
[ "php", "mysql", "yii2", "yii2-basic-app" ]
[ "Incorrect Test cases count for skipped tests in testng", "I used the following code to get the count of the skipped Test cases count \n\npublic void onFinish(ITestContext context) {\n skippedTests =context.getSkippedTests().getAllResults();\n\n for (ITestResult temp : skippedTests) {\n ITestNGMethod method = temp.getMethod();\n if (context.getSkippedTests().getResults(method).size() > 1) {\n skippedTests.remove(temp);} else {\n if (context.getPassedTests().getResults(method).size() > 0) {\n skippedTests.remove(temp);\n }\n else{if(context.getFailedTests().getResults(method).size() > 0){\n skippedTests.remove(temp);\n }\n }\n }\n }\n\n\nBut many of the times when suite executes completely the skipped test case count gives count of all skipped methods (i.e including beforeclass skipped , before method skipped..etc) rather than just the count of skipped Test cases.\n\nPlease let me know what I am missing." ]
[ "java", "testng" ]
[ "OWASP Zap Fuzz parameter modified by javascript", "Hello I am using OWASP ZAP 2.41 (last version currently) and I want to fuzz a parameter in a JSON based POST.\n\nThis field is first inserted in a HTML form, but it is encrypted with a javascript, and what I can alter with ZAP as far as the request is concerned, is the encrypted field.\n\nWhat I want is brute force with the non-encrypted values.\n\nI have to say that I have access to the javascript that encrypt the field.\n\nDoes anyone know how to carry this out¿? Thank you very much." ]
[ "javascript", "encryption", "fuzzing", "zap" ]
[ "How to set iOS app to use usb audio for input and output to internal speakers", "I have 2 different makes of guitar adapters that connect to my iphone using the lightning connector\n\nWhen adapter 1 is plugged in, the device becomes a usb audio mic and it plays the sound through my iPhone's speakers as the adapter does not contain a headphone socket\n\nWhen adapter 2 is plugged in, the device becomes a usb audio mic but plays the sound through the headphone socket on the adapter.\n\nI'm trying to write an app that work with adapter 2, but rather than output the sound to the adapter's headphone socket, I want to route it through the iPhone's speakers.\n\nThe code below should work, but what i'm finding is that calling AVAudioSessionPortOverride with the AVAudioSessionPortOverrideSpeaker option and the audio session’s category is AVAudioSessionCategoryPlayAndRecord causes audio to use the built-in speaker and microphone regardless of other settings, basically ignoring setPreferredInput\n\nI can't quite understand how adapter 1 manages to take input from usb audio and output to speaker but my app can't because of the restrictions above. Anyone know of a solution?\n\nAVAudioSession* session = [AVAudioSession sharedInstance];\n//Set the audioSession category. Needs to be Record or PlayAndRecord to use audioRouteOverride:\n[session setCategory:AVAudioSessionCategoryPlayAndRecord \n withOptions:AVAudioSessionCategoryOptionMixWithOthers \n error:nil];\n\n//set the audioSession override\n[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker \nerror:nil];\n\n//activate the audio session\n[session setActive:YES error:nil];\n\n//set input to usb\nfor (AVAudioSessionPortDescription *destPort in session.availableInputs){\n if ([destPort.portType isEqualToString:AVAudioSessionPortUSBAudio]) {\n [setPreferredInput:(AVAudioSessionPortDescription *)inPort\n error:(nil)outError\n session setPreferredInput:destPort error:nil];\n }\n}" ]
[ "ios", "iphone", "objective-c", "avfoundation", "avaudiosession" ]
[ "How to convert a textbox's text into a value?", "I have this expression in my code\n\nlabel3.Text = (((2 * 4.1) * 2) + (2 * textBox1.Text) + 31.6).ToString();\n\n\nBut I need the textBox1.Text value to evaluate the expression and the answer to be stored in the text of label3. So I should be able to change the textBox1 text to anything like 2, 3, etc and it should evaluate the expression and place the answer into label3.Text.\n\nHow can I do this?" ]
[ "c#" ]
[ "Symfony: How to save data from sfWidgetFormDoctrineChoice with multiple checkboxes", "I have problem with save data from choices widget.\nHere is part of schema:\n\nClient:\n columns:\n id:\n type: integer\n primary: true\n autoincrement: true\n grupy:\n type: array\n options:\n collate: utf8_unicode_ci\n charset: utf8 \n relations:\n Grupy:\n type: many\n local: grupy\n foreign: id\n class: KlientGrupy\n\nKlientGrupy:\n options:\n collate: utf8_unicode_ci\n charset: utf8\n columns:\n id:\n type: integer\n primary: true\n autoincrement: true\n item:\n type: string(255)\n relations:\n Klienci:\n type: many\n local: id\n foreign: grupy\n\n\nClientForm class:\n\nclass ClientForm extends BaseClientForm\n{\n\n public function configure()\n {\n $this->widgetSchema['grupy']->setOption('multiple', true);\n $this->widgetSchema['grupy']->setOption('expanded', true);\n $this->widgetSchema['grupy']->setOption('add_empty', false);\n $this->widgetSchema['grupy']->setAttribute('class', 'checkBoxLabel');\n\n }\n\n}\n\n\nBaseClientForm class:\n\n$this->setWidgets(array(\n 'id' => new sfWidgetFormInputHidden(),\n 'grupy' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Grupy'), 'add_empty' => true)),\n));\n\n\nWhen i save with one checkbox then all is ok, but when i try do it for more than one i get that problem:\n\nSQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens" ]
[ "symfony1", "doctrine" ]
[ "Crystal Report using local database", "I m creating crystal report in C# by using local database. I have done all connections. When i run my application, datas r inserted in the table. But table Data is not binded in the CrystalReportView. Thanks in advance..." ]
[ "c#", "visual-studio-2008", "crystal-reports" ]
[ "How to close a progressive web app", "Once a pwa is installed a mobile device, how do I close the application like a native app without having the user click the back button multiple times.\n\nI understand it's a bad idea to window.close on a web page but this a pwa on a mobile device.\n\nIn Cordova you will use navigator.app.exitApp, this is of course not available on pwa." ]
[ "javascript", "progressive-web-apps" ]
[ "Control Audio with main view controller from UITableViewController using @protocol?", "Ok here's the scenario:\n\nI am using AVAudioPlayer.\n\nI am trying to select and play a song from UITableView which appears as a popover.\n\nThe mp3 assets are located in my documents directory.\n\nI can populate the table view and when I select a row, play that specific asset.\n\nWhat I can not do is control the audio once the popover has disappeared with the controls that are on my main view controller. (play/stop/volume)\n\nI have @protocol which makes the popover a delegate, can any one help me with the syntax of the method that would go in my protocol?\n\n@protocol SongChooserDelegate\n\n-(void) didTap:(NSData *) data; <------------ I'm guessing here\n\n@end\n\nIf this won't work - what will?\n\nThank you, any help would be greatly appreciated.... this is my last step in building my app for my senior thesis due Friday!!!!! eeeek." ]
[ "protocols", "uitableview", "avaudioplayer", "popover" ]
[ "Excel formula to average selected cells based on certain criteria", "I am using Excel 2003.\nI have a table:\n\nDate - Column X - Column Y - Column Z - Age \n\nI want to find the AVERAGE for the numbers in the Age Column where the Date in the Date colum = cell A1\nThere are hundreds of records - I have tried using INDEX and MATCH but cant get it to work. I only end up with the first matching record.\n\nAny help would be appreciated.\n\nThanks.\n\nTom" ]
[ "excel", "excel-formula", "excel-2003", "formulas" ]
[ "Magento cant make an order", "I have an installation of Magento 1.9.2. I am using a custom theme, and anytime I try and place an order it kicks off the ajax on the page and then stops with no error messages, but does leave a log:\n\nERR (3): User Error: Some transactions have not been committed or rolled back in /html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 4039\n\n\nI have spent 2 days trying to get to the bottom of this with no joy. It doesnt matter what payment method I use its always the same.\n\nAny help would be gratefully appreciated" ]
[ "magento", "magento-1.9.2.1", "onestepcheckout" ]
[ "ZMQ 1-n queued vs multithreading", "Im interested in the conceptual efficencies of 1-n vs multithreading in ZMQ.\n\nlet me start by giving a conseptual problem:\n\nI have 20 clients and one server. (I'll use push and pull sockets for ease but im interested if the answer changes with rep, req, dealer, router as well). \n\nIf the clients have push sockets and the server a pull, then all the messages come into the single pull on the server. ZMQ will fair queue the push messages to the server and the context can be given an initialisation argument for the number of threads to use.\n\nBut what is happening under the hood? is it polling the inputs or multithreading comunications between them. Would any performance benifits be gained from multithreading them yourself?\n\nI can see three ways to make the system described above (20 clients one server).\n\n1) use one pull socket on the server and pushes on each client.\n\n2) use 20 pull sockets on the server, using zmq poll to select ones with activity. clients still each have a push socket.\n\n3) use 20 pull socets on the server each within its own thread (e.g. 20 threads). Clients have the same 20 push sockets (1 each).\n\ni understand that not using option 1 im loosing the dynamic nature of newly joined clients and option 2 removes the fair queueing, but im just interested in efficency.\n\nThis is my question, thread the clients? or just use zmq 1-n?" ]
[ "c++", "multithreading", "sockets", "zeromq" ]
[ "How to Use an Internal Style Sheet in The Page Where The TinyMCE Editor Is Embedded?", "Want to modify the tinymce editor through embedded style within the html. Do not wanna use an separat .css file. Have no access to the configuration of the editor, no tinmce.init(). Weirdly, cannot access the tinymce editor with style. \n\n<!DOCTYPE html>\n<html>\n<head>\n<script src='https://cloud.tinymce.com/stable/tinymce.min.js'></script>\n<style>\n body#tinymce.mce-content-body {\n background-color:red !important;\n }\n</style>\n<script>\n tinymce.init({\n selector: '#mytextarea'\n });\n</script>\n</head>\n\n<body>\n <h1>TinyMCE Quick Start Guide</h1>\n <form method=\"post\">\n <textarea id=\"mytextarea\">Hello, World!</textarea>\n </form>\n</body>\n</html>\n\n\nAny ideas?" ]
[ "html", "css", "tinymce" ]
[ "Is there a way to configure Libreoffice so that a cell referring to an empty cell also displays an empty cell?", "Suppose a Libreoffice spreadsheet involving just two cells, namely A1 and A2, has the string "abc" in cell A1 and "=A1" in cell A2.\n\n |---+------+\n | | A | (Showing formulas)\n |---+------+\n | 1 | abc |\n | 2 | =A1 |\n |---+------+\n\nEvidently cell A2 will then display the same content of cell A1, namely "abc", as below.\n\n |---+------+\n | | A | (Showing values)\n |---+------+\n | 1 | abc |\n | 2 | abc |\n |---+------+\n\nAt this point suppose that you delete the content of cell A1, so that A1 becomes empty. What happens to A2? Answer: A2 displays the number zero.\n\n |---+------+\n | | A | (Showing values)\n |---+------+\n | 1 | |\n | 2 | 0 |\n |---+------+\n\nI think this behaviour is unreasonable. I think A2 should also display nothing!\nI thought I could change this by tweaking some configuration and I got as far as the somewhat obscure "Tools - Options - Formula - Details", but it doesn't quite do the job.\nHere is a concrete example to support my argument that the standard behavior is indeed unreasonable. Given the spreadsheet:\n\n |---+------+------+------------------|\n | | A | B | C | (Showing formulas)\n |---+------+------+------------------|\n | 1 | 2 | 4 | =average(A1:B1) |\n | 2 | =A1 | =B1 | =average(A2:B2) |\n |---+------+------+------------------|\n\nwhich displays as\n\n |---+---+---+---|\n | | A | B | C | (Showing values)\n |---+---+---+---|\n | 1 | 2 | 4 | 3 |\n | 2 | 2 | 4 | 3 |\n |---+---+---+---|\n\nsuppose that we delete A1. The table will then display\n\n |---+---+---+---|\n | | A | B | C | (Showing values)\n |---+---+---+---|\n | 1 | | 4 | 4 |\n | 2 | 0 | 4 | 2 |\n |---+---+---+---|\n\nand I think there is no reason why C2 should display 2, as it does. I think it should have the same value as C1, namely 4. After all, line 2 is essentially trying to replicate line 1.\n\nQuestion: Is there a way to configure Libreoffice so that a cell\nreferring to an empty cell also displays an empty cell?" ]
[ "libreoffice-calc" ]
[ "Show html tags on the page with ng-bind-html", "Please see below given code:\n\n <div ng-app=\"myApp\" ng-controller=\"myCtrl\"> \n <p ng-bind-html=\"myText\"></p> \n </div>\n\n <script>\n var app = angular.module(\"myApp\", ['ngSanitize']);\n app.controller(\"myCtrl\", function($scope) {\n $scope.myText = \"My name is: <h1>John Doe</h1>\";\n });\n </script>\n\n\nThe output is: My Name is: \n John Doe\n\nHow can i show the text as it is. For example: My Name is : <h1>John Doe</h1>\nI want to show the HTML tags on the page." ]
[ "javascript", "html", "angularjs" ]
[ "Rails: Devise with 2 models, logout logs out both", "I am trying to implement a second devise resource of users to my Rails app. Log in works, but currently when logging out in one section, logs out both.\n\nHow can I set up my application in order to be able to keep both separated?\n\nroutes.rb:\n\ndevise_for :users, :path => 'users'\ndevise_for :admins, :path => 'admins'\n\n\napplication_controller.rb:\n\nprivate\n\n# Overwriting the sign_out redirect path method\ndef after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :user\n collection_path\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\nend\n\n# Overwriting the sign_in redirect path method\ndef after_sign_in_path_for(resource)\nstored_location_for(resource) ||\n if resource.is_a?(User)\n collection_opac_path\n elsif resource.is_a?(Admin)\n admin_root_path\n else\n super\n end\nend\n\n\n1.html\n\n<%= link_to 'Log out', destroy_admin_session_path, :method => :delete %>\n\n\n2.html\n\n<%= link_to 'Log out', destroy_user_session_path, :method => :delete %>\n\n\nLOG upon logging out user:\n\nStarted DELETE \"/users/sign_out\" for 127.0.0.1 at Fri Feb 08 18:28:11 +0100 2019\nProcessing by Devise::SessionsController#destroy as HTML\n Parameters: {\"authenticity_token\"=>\"somestring\"}\n User Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1\n Admin Load (0.4ms) SELECT `admins`.* FROM `admins` WHERE `admins`.`id` = 1 LIMIT 1\n SQL (0.1ms) BEGIN\n (0.4ms) UPDATE `users` SET `updated_at` = '2019-02-08 17:28:11', `remember_created_at` = NULL WHERE `users`.`id` = 1\n (0.8ms) COMMIT\n SQL (0.1ms) BEGIN\n (0.2ms) UPDATE `admins` SET `remember_created_at` = NULL, `updated_at` = '2019-02-08 17:28:11' WHERE `admins`.`id` = 1\n (0.3ms) COMMIT\nRedirected to http://localhost:3000/collection\nCompleted 302 Found in 10ms (ActiveRecord: 2.9ms)" ]
[ "ruby-on-rails", "ruby-on-rails-3", "devise" ]
[ "RabbitMQ on Ubuntu 16.04 on Windows Subsystem for Linux", "I am running RabbitMQ on Ubuntu 16.04 under the Windows 10 "windows on linux" installation.\nI cannot connect using rabbitmqctl. I used su to run as root and also tried to run it under my username with sudo, but everytime I run the command I get:\nDiagnostic log\nattempted to contact: ['rabbit@SJDEV-JWRIGHT3']\n\nrabbit@SJDEV-JWRIGHT3: \n* connected to epmd (port 4369) on SJDEV-JWRIGHT3 \n* epmd reports node 'rabbit' running on port 25672 \n* TCP connection succeeded but Erlang distribution failed \n* suggestion: hostname mismatch? \n* suggestion: is the cookie set correctly? \n* suggestion: is the Erlang distribution using TLS?\n\ncurrent node details:\n- node name: 'rabbitmq-cli-133@SJDEV-JWRIGHT3'\n- home dir: /var/lib/rabbitmq\n- cookie hash: iLmkDqwKzDZPxk8ynhqsVw==\n\nI have uninstall and re-installed both Erlang and RabbitMQ. I changed the host names as suggested by someone else, and I still cannot figure out this problem.\nI have rebooted the system, and when I tried to run rabbitmq-server restart and got:\nERROR: node with name "rabbit" already running on "SJDEV-[NODE]"\n\nI am new to linux and have been digging in to this for a week and hit my breaking point." ]
[ "rabbitmq", "ubuntu-16.04", "windows-subsystem-for-linux" ]
[ "jQuery Popup to open a new tab in the main browser window", "I'm opening a popup window using\n\nwindow.open(url, title, 'width=1055,height=750,scrollbar=yes');\n\n\nWhen clicking something on that popup, I want to close the popup and then redirect the browser tab that opened the popup. I achieve this by doing\n\nwindow.opener.location.href = 'newurl.php';\nwindow.close();\n\n\nI'm now adding some validation to check whether the browser tab that opened the popup is still available or if it's been closed. Now I'm doing this:\n\nif(window.opener) {\n window.opener.location.href = 'newurl.php';\n window.close();\n} else {\n window.location.href = 'newurl.php';\n}\n\n\nWhat I want to do now is on the else portion, instead of using the popup window, I'd like to open a new tab on the main browser window. I hope I was clear on what I wanted help with. Let me know if you need more information.\n\nNote\n\nI am aware that using a modal is probably a better approach but this decision is not for me to make." ]
[ "javascript", "jquery", "browser", "popup" ]
[ "Image icon not showing in Ribbon Command using officejs Exceladd-in", "Excel online version\n\nWe are trying to set images (.PNG files) in Ribbon commands. When we trying to set images through manifest file, image icons on commands (Login button) are being displayed correctly for single line ribbon. But images are hiding when set to multi line ribbon. Please find Attached screen shot for both scenarios. Kindly advise to show images all the time for Ribbon commands.\n\nDesktop version\n\nFor Desktop version it is showing like pentagon icon instead of imported images.\n\nDesktopLogin\n\nSingleLineRibbon\n\nMultiLineRibbon" ]
[ "office-js" ]
[ "Assignment expression in while condition is a bad practice?", "This article explains why I have a warning if I use a code like this:\n\nvar htmlCollection = document.getElementsByClassName(\"class-name\"),\n i = htmlCollection.length,\n htmlElement;\n\n// Because htmlCollection is Live, we use a reverse iteration.\nwhile (htmlElement = htmlCollection[--i]) { // **Warning?! Why?!**\n htmlElement.classList.remove(\"class-name\");\n}\n\n\nBut this no explaination about « why is a bad practice to assignment expression in a while condition? ».\n\nI also read this stackoverflow answers that point this practice as good. So...\n\nThere is a performance problem with while (element = element.parentNode) syntax-like or is just a style-code recommandation?\n\n\n\nBy the way, seems the « --i » operator is also a bad practice. I read in this article : \n\n\n The ++ (increment) and -- (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness.\n\n\nIt's some sort of joke?" ]
[ "javascript", "while-loop", "assignment-operator" ]
[ "Check embed's content if it is at the top of its own area", "I have an iframe (in the middle of page) with auto scroll rule and I want to check if the scroll bar (of iframe) is at the top of its own area (not in viewport). \n\nI'm not an expert in JQuery.. I tried to do something like this (changing the window to iframe) but with no luck.\n\n$('iframe').scroll(function (event) {\n var scroll = $('iframe').scrollTop();\n // Do something\n if (scroll > 0) {\n $('body').addClass('small');\n }\n else {\n $('body').removeClass('small');\n }\n});\n\n\nAny advice?" ]
[ "jquery" ]
[ "How can I either reset the coordinates of this Buffered Image or put this Buffered Image in the rectangle?", "I imported this \"troll face\" into my code as my enemy which rains from top of the screen to the bottom. But before doing so I created the pink rectangles so that I can overlay the troll face image on top of the rectangles. However, when I set the coordinates of the image equal to the rectangle, you can see that it did not center. I then set one troll face image's coordinate equal to (0,0) and you can see that it is clearly far away from the origin.\n\nI tried to import a different PNG image but in vain and it did not work.\n\nimport java.util.LinkedList;\nimport java.util.concurrent.TimeUnit;\nimport java.awt.Graphics2D;\nimport java.awt.Rectangle;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.MouseEvent;\nimport java.awt.image.BufferedImage;\nimport java.util.ArrayList;\npublic class magazinerain extends GameDriverV4{\n LinkedList<rainingenemies> r = new LinkedList<rainingenemies>();\n rainingenemies variable;\n BufferedImage trollface;\n\n public magazinerain() {\n trollface = this.addImage(\"minion.png\");\n }\n public void faller(Graphics2D win) {\n for (int i = 0; i<r.size(); i++) {\n variable=r.get(i);\n variable.fall(win);\n if (variable.getY()>=800) {\n delete(variable);\n }\n\n }\n }\n\n public void draw(Graphics2D win) {\n int count = 0;\n win.drawImage(trollface, 0, 0,null);\n for (int i = 0; i < r.size(); i++) {\n variable = r.get(i);\n variable.fall(win);\n //win.drawImage(trollface, (int) variable.getX(), (int) variable.getY(),null);\n //the images are not correctly centered on the screen\n //win.drawImage(trollface, 400, 400,null);\n }\n }\n public void memorymanagement() {\n for (int i = 0; i < r.size(); i++) {\n variable = r.get(i);\n //System.out.println(variable.getY());\n if (variable.getY()>=800) {\n r.remove(i);\n //System.out.println(\"Removed\");\n }\n\n }\n }\n\n public void checkintersects(int a, int b) {\n int buffer = 10;\n int buffery = 15;\n for (int i = 0; i< r.size(); i++) {\n variable = r.get(i);\n //if (a>(variable.getX()-buffer) && (a<variable.getX()+buffer)) {\n if ((variable.getX()>a-buffer-10)&& (variable.getX()<a+buffer+30)) {\n //if ((b>variable.getY()-buffery) && (b<variable.getX()+buffery)) {\n if ((variable.getY()>b-buffery) && (variable.getY()<b+buffery)){\n r.remove(i);\n System.out.println(\"spacex=\"+a+\"getx=\"+variable.getX());\n System.out.println(\"spacey=\"+b+\"gety=\"+variable.getY());\n\n }\n }\n\n }\n }\n\n public void delete(rainingenemies a) {\n r.remove(a);\n }\n public void insert(rainingenemies a) {\n r.add(a);\n }\n @Override\n public void actionPerformed(ActionEvent e) {\n // TODO Auto-generated method stub\n\n }\n @Override\n public void mouseClicked(MouseEvent e) {\n // TODO Auto-generated method stub\n\n }\n @Override\n public void mousePressed(MouseEvent e) {\n // TODO Auto-generated method stub\n\n }\n @Override\n public void mouseReleased(MouseEvent e) {\n // TODO Auto-generated method stub\n\n }\n @Override\n public void mouseEntered(MouseEvent e) {\n // TODO Auto-generated method stub\n\n }\n @Override\n public void mouseExited(MouseEvent e) {\n // TODO Auto-generated method stub\n\n }\n\n}\n\n\nSpecifically in this code, I expected the troll face to be at (0,0) but it is not there as shown in the screenshot" ]
[ "java" ]
[ "Authentication system for ASP.NET web applications?", "I have some question:\n\nHow to make a role based web application? Such as in forum sites, there is many user types, admin, moderator etc... is the roles of these user types stored in database or web.config? And when a user login to our site, how to control this users roles? In short I want to learn about authorization and authentication. \n\nThanks.." ]
[ "asp.net", "authentication", "authorization" ]
[ "Laravel 5.6 Reverse HasManyThrough", "I have the following table structure in my database:\n\nproducts\n\n\nid\n\n\nproduct_formats\n\n\nid\nproduct_id\n\n\nproduct_prices\n\n\nid\nproduct_format_id\n\n\nWhen I'm trying to do $this->format->product; inside my ProductPrice class, I get an error:\n\n\n LogicException: App\\ProductPrice::product must return a relationship instance.\n\n\nWhen I perform a dd inside my function:\n\ndd($this->format()->first()->product);\n\n\nI get the instance of the product. However, removing the dd would still throw the exception.\n\nWhy am I getting the LogicException?\n\n\n\nProductPrice\n\nclass ProductPrice extends Model\n{\n public function format()\n {\n return $this->belongsTo(ProductFormat::class, 'product_format_id');\n }\n\n public function product()\n {\n return $this->format->product;\n }\n}\n\n\nProductFormat\n\nclass ProductFormat extends Model\n{\n public function product()\n {\n return $this->belongsTo(Product::class);\n }\n}\n\n\n\n\nUpdate\n\nThe result of dd($this->format); returns an instance of ProductFormat." ]
[ "php", "laravel" ]
[ "Django rest framework: how to look up UUIDs properly and (with slugs?)", "I'm struggling to figure out how to use uuids properly. I'm following Daniel Feldroys Two Scoops of Django, but I'm finding uuids difficult. My app was working before using sequential user ids, now I want to change it to a uuid to make the API more secure.\nBut my question is: How to I actually look up the unique user ID? None of the views (http://127.0.0.1:8000/api/) seem to be displaying any data, despite that I can see data in Admin. I'm guessing I need to supply the unique user ID (http://127.0.0.1:8000/api/), but since this is autogenerated when I post objects to the database, how do you obtain the uuid? Is it only when you create the objects in the first place, for extra security?\nBut if I have existing objects that I migrate over from another API, can I run python manage.py shell and look up the uuids of existing objects some how?\n\nI'm also conceptually struggling with the roles of slugs. how do I use them to find the correct web url?\n\nThis is my models.py\nimport uuid as uuid_lib\nfrom django.db import models\nfrom django.urls import reverse\n\nfrom .rewards import REWARDS\n\nclass TimeStampedModel(models.Model):\n """\n An abstract base class model that provides self- updating ``created`` and ``modified`` fields.\n """\n created = models.DateTimeField(auto_now_add=True)\n modified = models.DateTimeField(auto_now=True)\n\n class Meta:\n abstract = True\n\nclass User(TimeStampedModel):\n """\n A model for the users of our ticketing app which contains the reward_recommendation method.\n """\n\n name = models.CharField(max_length=255)\n slug = models.SlugField(unique=True) # Used to find the web URL\n uuid = models.UUIDField( #Used by the API to look up the record\n db_index = True,\n default=uuid_lib.uuid4,\n editable=False)\n points = models.IntegerField(default=0)\n\n def get_absolute_url(self):\n return reverse('users:detail', kwargs={'slug':self.slug})\n\nMy views.py\nfrom rest_framework.generics import (\n ListCreateAPIView,\n RetrieveUpdateDestroyAPIView\n)\n\nfrom rest_framework.permissions import IsAuthenticated\nfrom .models import User\nfrom .serializers import UserSerializer\n\n\nclass UserListCreateAPIView(ListCreateAPIView):\n queryset = User.objects.all()\n permission_classes = (IsAuthenticated, )\n serializer_class = UserSerializer\n lookup_field = 'uuid' # Don't use Flavor.id!\n\nclass UserRetrieveUpdateDestroyAPIView(RetrieveUpdateDestroyAPIView):\n queryset = User.objects.all()\n permission_classes = (IsAuthenticated, )\n serializer_class = UserSerializer\n lookup_field = 'uuid' # Don't use Flavor.id!\n\nand my urls.py\n\nfrom django.urls import path\n\nfrom . import views\n\n\nurlpatterns = [\n # /users/api/\n path(\n route='api/',\n view=views.UserListCreateAPIView.as_view(),\n name='user_rest_api'\n ),\n # /users/api/:uuid/\n path(\n route='api/<uuid:uuid>/',\n view=views.UserRetrieveUpdateDestroyAPIView.as_view(),\n name='user_rest_api'\n )\n]" ]
[ "python", "django", "django-rest-framework" ]
[ "How to render class from different JS? ERROR: expecting a string", "When I run this I get an error saying: Element type is invalid: expected a string (built in components) or a class/function but got undefined, check the render method for LOGIN.\n\nI just want to display login on main screen from other JS file\n\nThis is the LOGIN.JS <--- Where I call in the index\n\n'use strict';\nimport React, { Component, Image} from 'react';\nimport {View, Text, StyleSheet} from 'react-native';\n\nvar Login = React.createClass({\n render: function() {\n return (\n <View style={styles.container}>\n <Image style={styles.logo}\n source={require('image!lock')} />\n <Text>HI</Text>\n </View>\n );\n }\n});\n\n\nINDEX.IOS.JS <-- Where I am calling Login to show on page\n\nimport React, { Component, Image } from 'react';\nimport {\n AppRegistry,\n StyleSheet,\n Text,\n View\n} from 'react-native';\n\nvar Login = require('./Login');\n\nexport default class AwesomeProject extends Component {\n render() {\n return (\n\n <View style={styles.container} >\n <Text style={styles.welcome}>\n Welcome!\n </Text>\n <Text style={styles.logins}>\n </Text> \n\n <Login />\n </View>\n ); \n }\n}" ]
[ "react-native" ]
[ "How to get a list of available vm sizes in an azure location", "I want to deploy a VM in microsoft's azure with a new size.\nUsually I use a json template for the vm with size 'Standard_DS3'\nNow I would like to have another one with size a3 'A3', but this causes an error\n\nstatusMessage:{\"error\":{\"code\":\"InvalidParameter\",\"target\":\"vmSize\",\"message\":\"The value of parameter vmSize is invalid.\"}}\n\n\nSo I was wondering where can I find valid vm sizes for deployments in a location and the correct name for the deployment with a template file?" ]
[ "azure" ]
[ "getRealPath(\"/\")- How does the result of this method differ in Tomcat and WebSphere", "Using the method\n\ngetServletContext().getRealPath(\"/\") \n\n\nreturns a \"\\\" in the end of the path in Tomcat (eg. C:\\testfolder\\myapp) whereas in Websphere it doesn't (eg. C:\\testfolder\\myapp) . \nWhat is the reason for this ? What is the relevance of (\"/\") in getRealPath(\"/\") ?" ]
[ "websphere" ]
[ "Run gitlab-ci.yml on merge request / nothing happen", "I have a gitlab.ci.yml to check json files:\n\ntest:\n stage: test\n image: darrylb/jsonlint\n script:\n - for jsonfile in json/*.json; do jsonlint \"$jsonfile\"; done;\n only:\n changes:\n - json/*\n only:\n - merge_requests\n\n\nI want to run it automatically on every merge request to my master branch.\nBut nothing happens, no pipeline is started, when I create a merge request.\nWhat did I miss?" ]
[ "gitlab", "gitlab-ci" ]
[ "Eclipse won't open after Installing Windows Builder", "I downloaded Eclipse's Windows Builder through this link which is from Eclipse org itself. After the installation was complete, my Eclipse just won't open anymore. There's no errors log, it will appear the loading screen and close. as you can see on this video. \n\nHow can I fix this problem? Thanks\n\nEDIT: The last session was 2015-07-04 at 11:45. This was when I tried to download and install Windows Builder. It is filled with a bunch of \"(something) will be ignored because a newer version is already installed\" and at the very bottom this is the last thing that it shows \n\n!MESSAGE Cannot complete the install because some dependencies are not satisfiable\n!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2015-07-04 11:54:38.763\n!MESSAGE org.eclipse.actf.visualization.feature.group [1.2.0.R201406111357] cannot be installed in this environment because its filter is not applicable.\n!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2015-07-04 12:14:26.294\n!MESSAGE Connection to http://ftp.osuosl.org/pub/eclipse/releases/luna/201409261001/plugins/org.eclipse.sphinx.emf.workspace.ui.source_0.8.1.201409171422.jar failed on Connection timed out: connect. Retry attempt 0 started\n!STACK 0\n\njava.net.ConnectException: Connection timed out: connect\nat java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)\nat java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)\nat java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)\nat java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)\nat java.net.AbstractPlainSocketImpl.connect(Unknown Source)\nat java.net.PlainSocketImpl.connect(Unknown Source)\nat java.net.SocksSocketImpl.connect(Unknown Source)\nat java.net.Socket.connect(Unknown Source)\nat org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ECFHttpClientProtocolSocketFactory.connectSocket(ECFHttpClientProtocolSocketFactory.java:84)\nat org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)\nat org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)\nat org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)\nat org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)\nat org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)\nat org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)\nat org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)\nat org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer.performConnect(HttpClientRetrieveFileTransfer.java:1077)\nat org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer.access$0(HttpClientRetrieveFileTransfer.java:1068)\nat org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer$1.performFileTransfer(HttpClientRetrieveFileTransfer.java:1064)\nat org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:73)\nat org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)\n\n\nSorry if it's disorganized" ]
[ "java", "eclipse" ]
[ "How to merge two pom.xml by dom4j", "I have two pom.xml come from two similar project. I have to merge these two pom.xml into one and replace the original pom files with it.\nThe first pom.xml:\n...\n<dependencies>\n <dependency>xxx</dependency>\n</dependencies>\n\n<build>\n <plugins>\n <plugin>\n <groupId>zzz</groupId>\n <artifactId>zzz</artifactId>\n <executions>\n <execution>...</execution>\n </executions>\n <configuration>\n <source>${java.version}</source>\n <target>${java.version}</target>\n </configuration>\n </plugin>\n </plugins>\n</build>\n...\n\nThe other one:\n...\n<dependencies>\n <dependency>yyy</dependency>\n</dependencies>\n\n<build>\n <plugins>\n <plugin>\n <groupId>zzz</groupId>\n <artifactId>zzz</artifactId>\n <configuration>\n <annotationProcessorPaths>...</annotationProcessorPaths>\n </configuration>\n </plugin>\n </plugins>\n</build>\n...\n\nDesired output:\n...\n<dependencies>\n <dependency>xxx</dependency>\n <dependency>yyy</dependency>\n</dependencies>\n\n<build>\n <plugins>\n <plugin>\n <groupId>zzz</groupId>\n <artifactId>zzz</artifactId>\n <executions>\n <execution>...</execution>\n </executions>\n <configuration>\n <source>${java.version}</source>\n <target>${java.version}</target>\n <annotationProcessorPaths>...</annotationProcessorPaths>\n </configuration>\n </plugin>\n </plugins>\n</build>\n...\n\nI've tried to code with Dom4j, it only work with "dependencies". I dont know how to merge "plugins". This is my code:\n Document docOfTarget = readXml(outPutFile);\n Document docOfSource = readXml(request.getSrcTemplateFile());\n Element dependenciesOfTarget = docOfTarget.getRootElement().element("dependencies");\n Element dependenciesOfSource = docOfSource.getRootElement().element("dependencies");\n\n List<Node> targetContents = dependenciesOfTarget.content();\n List<Node> addContents = new LinkedList<>();\n for (Node addContent : dependenciesOfSource.content()) {\n if (includeNode(targetContents, addContent)) {\n continue;\n }\n addContents.add(addContent);\n }\n targetContents.addAll(addContents);\n\n protected final boolean includeNode(List<Node> contents, Node comparatorNode) {\n NodeComparator nodeComparator = new NodeComparator();\n for (Node content : contents) {\n if (nodeComparator.compare(content, comparatorNode) == 0) {\n return true;\n }\n }\n return false;\n }\n\nHow should I do next?\nThanks for your help!" ]
[ "java", "xml", "maven" ]
[ "How to loop through a class member vector's elements in the best way in C++?", "I have a class A with a member vector<class B>. I would like to loop through this vector from outside class A in a clean way. I need to do operations on B using its public functions.\n\nTo do so, I thought of having a function int get_next_element(B * in_B), where I can return 0 if I have correctly loaded the next element and -1 otherwise.\n\nI thought of doing this by using an iterator, but I found two issues with this. First of all, I wasn't able to find a neat way to convert an iterator to a pointer (it seems I could use an iterator just like a pointer, but I'm unsure that's a good solution). Secondly, I would need to check if there's a value referenced by my iterator, and since the closest thing to a \"null iterator\" is the .end() element I can't figure out how I would then initialise it. If I initialise it (empty) and have the reference .end(), it wont refer to anything comparable if I add something to it.\n\nI could have an extra int that keeps track of which element I'm at, but then I'd have to manage that int whenever I add elements, etc.\n\nI considered placing the iteration code outside of class A, but I may need to change or access individual elements during the loop, so that would make a complex/big iteration block.\n\nHow would I solve this problem in a clean way (such as int get_next_element(B * in_b))?\n\nEDIT:\nHere's some code:\nHeader:\n\nclass B {\n public:\n B();\n void set_size(int in_size);\n int get_size();\n protected:\n int mSize;\n};\n\nclass A {\n public:\n A();\n void add_B(B in_B);\n int get_next_element(B * in_B);\n protected:\n std::vector<B> mObjects;\n};\n\n\ncpp file:\n\nB::B() {\n // Stuff\n}\nvoid B::set_size(int in_size) {\n mSize = in_size;\n}\nint B::get_size() {\n return mSize;\n}\n\nA::A() {\n // Stuff\n}\nvoid A::add_B(B in_B) {\n mObjects.push_back(in_B);\n}\nint A::get_next_element(B * in_B) {\n // ToDo : handle elements\n}\n\n\nAnd main:\n\nint main() {\n A test_a;\n for (int i = 0; i < 5; i++) {\n B tmp_b;\n tmp_b.set_size(i);\n test_a.add_B(tmp_b);\n }\n B iterator_b;\n while (0 == get_next_element(& iterator_b)) {\n if (iterator_b.get_size > 2) {\n B tmp_b;\n tmp_b.set_size(iterator_b.get_size - 2);\n test_a.add_B(tmp_b);\n iterator_b.set_size(2);\n }\n }\n}\n\n\nSo, basically A holds a bunch of Bs and can help the main iterate through them and (in this example) cut them into smaller pieces while not having too much code in the main. There's quite a few dimensions/ways this will be done, which is partially why I'd like to \"hide\" as much of the code in A.\n\n(This is a bit simplified, like the Bs may have to have internal relations, but basically that's the idea)" ]
[ "c++", "class", "vector", "element" ]
[ "Any fix for chrome and it's timeupdate event bug on audio/video tags?", "Just stumbled upon a huge bug in Chrome (looks like it is fixed in coming Chrome 5): http://code.google.com/p/chromium/issues/detail?id=25185, basically it stops throwing timeupdate events after two or three seconds of playing, hence no way to update player interface.\n\nIs there any established javascript level fix for this?" ]
[ "audio", "google-chrome" ]
[ "Extension PHP5 does not parse in XAMPP", "I've installed XAMPP Apache server and put my website into htdocs. I've started Apache server. On my website I've got files with extension PHP and with extension PHP5.The difference is that when I type in into browser localhost/file.php - I see a parsed website.\n\nBut when I type localhost/file.php5 (i have this file on server), than browser asks me if I want to download or open this file. And if I choose open than I see PHP code of file.php5!\n\nI've looked into configuration, so:\n\n\nI dont have htaccess file\nPHPINFO() shows PHP 5\nc:\\xampp\\apache\\conf\\extra\\httpd-xampp is included into configuration and has this on the beginning:\n\nAddType application/x-httpd-php-source .phps\n\nAddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt\n\n\nI've tried also to put:\n\nAddHandler php5-script .php5\nAddType text/html .php5\n\n\nInto httpd.conf, but it does not work for me (no changes).\n\nCould you please help me fixing it? I would like to have php5 and php extension files to be opened with php5 parser." ]
[ "php", "apache", "xampp" ]
[ "Redux form: fields not updated after first submit", "I'm using redux-form with mongodb and I can't manage to make a second submission works due to the following error:\n\n{\"message\":\"No matching document found for id \\\"590b02068012fb3f83e5da9d\\\"\",\"name\":\"VersionError\"}\n\n\nwhich is due to the fact that the version of the document is not updated in the form. \n\nThe first submission works and data is upated; I get a new object from the REST endpoint and I set it into the state. Anyway the version value submitted by the form is not updated and this causes the error. Do I need to trigger this update manually on onSubmitSuccess callback? \n\nHere's my form:\n\nRegionEdit = reduxForm({\n form: 'RegionEdit', // a unique identifier for this form\n})(RegionEdit);\n\nconst mapStateToProps = createStructuredSelector({\n initialValues: makeSelectRegion(),\n});\n\nfunction mapDispatchToProps(dispatch) {\n return {\n dispatch,\n };\n}\n\nexport default connect(mapStateToProps, mapDispatchToProps)(RegionEdit);\n\n\nThis is how I submit the form:\n\nsubmit(values) {\n return new Promise((resolve, reject) => {\n this.props.dispatch(saveRegion({ values, resolve, reject }));\n });\n }\n\n\nthe following saga is executed:\n\nexport function* saveRegion(data) {\n const payload = data.payload.values.toJS();\n const reject = data.payload.reject;\n const resolve = data.payload.resolve;\n const requestURL = `${ENDPOINT_URL}/${payload._id}`;\n try {\n const region = yield call(request, requestURL, {\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(payload),\n method: 'PUT' });\n yield put(regionSaved(region));\n resolve(region);\n } catch (err) {\n yield put(regionSavingError(err));\n reject(err);\n }\n}\n\n\nand regionSaved triggers SAVE_REGION_SUCCESS action which causes this code to execute in the reducer:\n\n case SAVE_REGION_SUCCESS:\n return state\n .set('region', fromJS(action.region));\n\n\nI attach some screenshot\n state field version is updated from 5 to 6 after the first successful submission1\n\nthe payload of the second call has still old/initial version number (5)2" ]
[ "redux", "redux-form", "redux-saga" ]
[ "Pygame screen won't blit", "I have an Agar.io like test game where the square player touches the \"bit\"s and grows. The problem is the bit generation. The bit generates every second and has its own surface. But, the program will not blit the bit (no pun intended) into the initial surface.\n\nHere is the code:\n\nimport pygame\nimport random\npygame.init()\nclock = pygame.time.Clock()\ndisplay = pygame.display\nscreen = display.set_mode([640,480])\nrect_x = 295\nrect_y = 215\ndisplay.set_caption(\"Agar\")\nd = False\nbits = []\nsize = 50\nsteps = 0\nclass Bit:\n cscreen = display.set_mode([640,480])\n circ = pygame.draw.circle(cscreen, (65, 76, 150), (random.randrange(40, 600), random.randrange(40, 440)), 5)\nwhile True:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n d = True\n if d == True:\n break\n\n # Fill background\n screen.fill((5, 58, 0))\n\n # Create player object\n player = pygame.draw.rect(screen, (250, 197, 255), [rect_x, rect_y, size, size])\n\n # Moving\n if pygame.key.get_pressed()[pygame.K_UP]:\n rect_y -= 2\n if pygame.key.get_pressed()[pygame.K_DOWN]:\n rect_y += 2\n if pygame.key.get_pressed()[pygame.K_RIGHT]:\n rect_x += 2\n if pygame.key.get_pressed()[pygame.K_LEFT]:\n rect_x -= 2\n\n # Bit generation\n if steps == 60:\n new_bit = Bit()\n bits.append(new_bit.circ)\n screen.blit(new_bit.cscreen, (0,0))\n steps = 0\n steps += 1\n\n # Collision detection\n collision = player.collidelist(bits)\n if collision != -1:\n bits[collision].cscreen.fill((0,0,0,0))\n # Make player larger\n size += 10\n\n # FPS limit\n clock.tick(60)\n\n # Refresh\n display.flip()\n\n\nP.S. There is no error message.\n\nThanks in advance." ]
[ "python", "pygame", "blit" ]
[ "Why does Python's set difference method take time with an empty set?", "Here is what I mean:\n\n> python -m timeit \"set().difference(xrange(0,10))\" \n1000000 loops, best of 3: 0.624 usec per loop\n\n> python -m timeit \"set().difference(xrange(0,10**4))\"\n10000 loops, best of 3: 170 usec per loop\n\n\nApparently python iterates through the whole argument, even if the result is known to be the empty set beforehand. Is there any good reason for this? The code was run in python 2.7.6.\n\n(Even for nonempty sets, if you find that you've removed all of the first set's elements midway through the iteration, it makes sense to stop right away.)" ]
[ "python", "performance", "set", "operators" ]
[ "RxJS Filtering and selecting/deselecting list of checkbox", "I have a list of checkboxes, and I need to be able to select them ( check them) and I should also be able to filter them and check them while they are filtered. I am able to select the item, filter the item, but as soon as I filter them and then check any value it unchecks the previously selected value. I know the reason why it unchecks because every time user checks/unchecks the value I start with the original checkbox value set. So when I check/uncheck a value in filtered set, it starts again with default set where checkbox value is set to false.\n\nAny suggestions on how to make it work? That is works seamlessly with filtering and checking/unchecking the values.\n\nIt looks like a really simple issue but i am stuck with it from past few days. Replicated the issue here. Please take a look. Any suggestions are appreciated .\n\nhttps://stackblitz.com/edit/angular-wmyxtd\n\nvariables = [\n{\n\"label\": \"Phone\",\n\"value\": \"phone\",\nchecked: false\n},\n{\n\"label\": \"Machine Id\",\n\"value\": \"machine_id\",\nchecked: false\n},\n{\n\"label\": \"Address\",\n\"value\": \"address\",\nchecked: false\n},\n{\n \"label\": \"Store\",\n \"value\": \"store\",\n checked: false\n},\n{\n \"label\": \"Email\",\n \"value\": \"email\",\n checked: false\n},\n{\n \"label\": \"Name\",\n \"value\": \"name\",\n checked: false\n },\n{\n \"label\": \"Credit Card\",\n \"value\": \"credit_Card\",\n checked: false\n },\n {\n \"label\": \"Bank Account\",\n \"value\": \"bank_account\",\n checked: false\n }\n]\nvariables$ = of(this.variables).pipe(shareReplay(1),delay(1000));\n\nfilteredFlexibleVariables$ = combineLatest(this.variables$, this.filterBy$).pipe(\n map(([variables, filterBy]) => {\n return variables.filter((item) => item.value.indexOf(filterBy) !== -1);\n })\n);\n\ntoggleStateSelectedVariables$ = combineLatest(\n this.variables$,\n this.toggleFlexibleVariableBy$\n).pipe(\n map(([availableVariables, clickedVariable]) => {\n const clickedVariableValues = clickedVariable.map((item) => item.value);\n if (clickedVariable.length) {\n // If condition just to save availableVariables iteration for no reason if there is no clicked variables\n return availableVariables.map((variable) => {\n const checked = clickedVariableValues.indexOf(variable.value) !== -1;\n return {\n ...variable,\n checked\n };\n });\n }\n return availableVariables;\n }),\n);\n\nflexibleVariables$ = merge(\n this.filteredFlexibleVariables$,\n this.toggleStateSelectedVariables$\n );" ]
[ "rxjs", "observable" ]
[ "ng-model and ng-options not matching up?", "I have a method in my resources object that comes in as: \n\nresources.type \n\notherstuff: 'more strings'\ntype:'specifictype'\nmorestuff: 'morestuff'\n\n\nThe user can change this type with a dropdown / through another call that gets a list of all possible types which looks like resourceList.types which has a list of objects like this json \n\ntypes:\n [\n {name:'resourcetype1'}, \n {name:'resourcetype2'},\n etc...\n ],\n\n\nmy html looks like:\n\n<select ng-model=\"resources.type\" ng-options=\"name.name for name in resourceList.types\">\n</select>\n\n\nThe select/drop down box populates with my resourceList.type stuff but when the page loads the ng-model doesn't set to the already selected resource type. It actually selects a blank entry at the top of the drop down when you click. Is angular picky about this? How can I get the ng-model to behave the way I want it to?\n\nI tried messing around with ng-options with the different ways of getting the repeat but I feel like this is more how angular connects the model. Does it just match the string to the ng-options list?\n\nHere's the plnkr as you can see it's not defaulting to type1 \n\nhttp://plnkr.co/edit/NyWACtFQuyndR6CG8lpN?p=info" ]
[ "angularjs", "ng-options" ]
[ "Position items in a grid area", "I'm making an editor app with a layout like google sheet or any simple web app with a thin, screenwide toolbar in the top and other stuff below. But... I'm having problem to position items in the toolbar. I plan to place:\n\n\na logo in the left corner\nsomething in the middle\ntwo buttons on the right side with specific order (like button A and B where B is closer to the right edge of the screen)\n\n\nAnd most importantly i want to position these items inside the toolbar to be vertically in the center.\n\nI tried so many things, but nothing really worked, except the very basic grid system below in which i want to place the items:\n\n.layout {\n height: 100vh;\n display: grid;\n grid-template-columns: 34% 33% auto;\n grid-template-rows: 50px auto;\n grid-template-areas:\n \"toolbar toolbar toolbar\"\n \"searchbox resultbox editorbox\";\n}\n\n.toolbar {\n grid-area: toolbar;\n}\n\n.searchbox {\n grid-area: searchbox;\n}\n\n.resultbox {\n grid-area: resultbox;\n}\n\n.manju-editor {\n grid-area: editorbox;\n}\n\n\nCan you pls tell me how could i position items the above described way?\n\nEdit: per request the HTML also added, the app is created with create-react-app, so the html is its standard index.html and app is \"assigned\" to the root:\n\nindex.html:\n\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n <meta name=\"theme-color\" content=\"#000000\">\n <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\">\n <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n <title>React App</title>\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n</html>\n\n\nrender method from app.js:\n\n <div className={userSession.layout.name}>\n {userSession.layout.toolbar.active && <div className=\"toolbar\">\n {this.generateComponents(\"toolbar\")}\n </div>}\n {userSession.layout.search.active && <div className=\"searchbox\">\n search\n </div>}\n {userSession.layout.results.active && <div className=\"resultbox\">\n result\n </div>}\n {userSession.layout.editor.active && <div className=\"editor\">\n editor\n </div>}\n </div>" ]
[ "css", "css-grid" ]
[ "Python, \"print\" and \"return\" resulted in different boolean logic", "I recently started learning python through Sololearn and got to Recursion. To get better understanding of the code, I simplified it to:\ndef is_even(x):\n return x\ndef is_odd(x):\n return not is_even(x)\nprint(is_odd(2))\n\nThe return not is_even(x) is boolean and will resulted it as False and when it passed to the def is_even(x): it still would return as False.\nHowever, when I change the return x to print(x)\ndef is_even(x):\n print (x)\ndef is_odd(x):\n return not is_even(x)\nprint(is_odd(2))\n\nThe result would be:\n2\nTrue\n\nHow did this happen? What is going on between the return not is_even(x) and print (x).\nThank you" ]
[ "python" ]
[ "jni SAMPLETYPE to jbyteArray", "I get an error at the return line. My code:\n\nextern \"C\" DLL_PUBLIC jbyteArray Java_com_ngochoang_playerdemo_AudioNativeLib_navProcessBytes(JNIEnv *env, jobject thiz, jbyteArray data, jint size)\n{\n LOGV(\"JNI call soundtouch.navProcessBytes\");\n int bufferSize = size*5;\n SAMPLETYPE sampleBuffer[bufferSize];\n pSoundTouch.putSamples((SAMPLETYPE*)data, size);\n TotalNSamples = pSoundTouch.receiveSamples(sampleBuffer, bufferSize);\n LOGV(\"JNI call soundtouch.navProcessBytes END\");\n return (jbyteArray)sampleBuffer;\n}\n\n\nError:\n\n\n Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 5980 (Thread-753)\n\n\nThanks" ]
[ "java", "c++", "java-native-interface", "soundtouch" ]
[ "Variable declared as const within page.evaluate() is not being used in PhantomJS", "I've got a function which works great on a standard browser (ie, firefox, chrome,...) but some part of it doesn't with PhantomJS.\n\nSo, I have a file - let name it script1.js - which looks like this :\n\nconst CONST1 = 1;\n\nfunction f1()\n{\n //...\n myVar = (typeof myVar === \"undefined\") ? CONST1 : myVar;\n //...\n}\n\n\nAnd here is a sample of the script run by PhantomJS:\n\nvar page = webPage.create();\n\npage.open(url,function(status){ \n if (page.injectJs('script1.js')) {\n page.evaluate(function(){\n //...\n f1();\n //...\n });\n }\n});\n\n\nUsing PhantomJS, if myVar is not set, it doesn't takes the value of CONST1 and still undefined. Indeed, CONST1's value is undefined. If I change for :\n\nmyVar = (typeof myVar == \"undefined\") ? \"value\" : myVar;\n\n\nmyVar will be \"value\".\n\nIs there a way to use constants with PhantomJS?" ]
[ "javascript", "phantomjs", "constants" ]
[ "Xamarin Forms shared project new content page cs file not coupled", "Visual Studio 2017 Professional. \n\nXamarin Cross Platform App, Blank App, Xamarin.Forms, Shared Project.\n\nWithin the shared project, if I add a new Xamarin.Forms Content Page (Page1), the .xaml and xaml.cs files are not coupled like you would expect.\n\n\n\nI found a work around by manually editing the .projitems file as you'd expect to (replacing the SubType tag with the DependentUpon tag):\n\n> <Compile Include=\"$(MSBuildThisFileDirectory)MainPage.xaml.cs\">\n <DependentUpon>MainPage.xaml</DependentUpon>\n </Compile>\n <Compile Include=\"$(MSBuildThisFileDirectory)Page1.xaml.cs\">\n <SubType>Code</SubType>\n </Compile>\n\n\nSeems this is a bug? Anyway to not have to do this manual edit to get the desire result?" ]
[ "xamarin.forms" ]
[ "Checking if a record exists in Sinatra/DataMapper", "I currently generate a user's profile page using their serial ID, like so: \n\nget '/users/:id' do\n @user = User.get(params[:id])\nend\n\n\nThis works great, until a number is entered that doesn't exist in the database.\n\nI'm aware I can change User.get to User.get! to return an ObjectNotFoundError error if the record isn't found, but I'm not sure how I can use this to my aid. \n\nI used to use .exists? when using RoR.\n\nAny suggestions? \n\nThanks in advance!\n\nEdit: I'm going to leave the question unanswered, as I haven't actually found a solution to what I asked in the title; however, I did manage to solve my own problem by checking to see if the :id entered is higher than the amount of users that exist in the database, like so:\n\nif params[:id].to_i > User.count\n \"This user does not exist.\"\nelse\n @users_id = User.get(params[:id])\n erb(:'users/id')\nend" ]
[ "ruby", "sinatra", "datamapper" ]
[ "Extracting the title from a html page from certain sites", "I am trying to extract title of a web page from a particular site http://www.justdial.com with jsoup as follows:\n\n Document doc=jsoup.connect(\"http://www.justdial.com/Mumbai/Satkar-Veg-Restaurant-%3Cnear%3E-Sahakar-Nagar-Next-To-Talwalkars-Gym-Wadala/022P5318248_TXVtYmFpIFJlc3RhdXJhbnRz_BZDET\").get();\n String title=doc.title();\n System.out.println(\"Title=\"+title);\n\n\nIt is giving me a title string which is even not anywhere in the source of that page but viewable in the browser. But for all the pages from different sites it is working properly.\nSo can anyone give what is the reason behind that and how to get the desired result in such cases. Thank you." ]
[ "java", "html", "jsoup" ]
[ "Do you cache the LoadLibrary HINSTANCE?", "Here is sample code:\n\nCString CMeetingScheduleAssistantApp::GetStudyPointDescriptionEx(bool b2019Format, const int iStudyPoint, const bool bFormatText /*false*/)\n{\n CString strDescription = _T(\"<ERROR>\");\n LANGUAGE_E eForeignLanguage = GetForeignLanguageGroupLanguageID();\n\n if (iStudyPoint == 0)\n strDescription = _T(\"\");\n else\n {\n if (UseTranslationINI(eForeignLanguage))\n {\n // Snipped\n }\n else\n {\n HINSTANCE hInst = nullptr;\n\n if (eForeignLanguage != LANGUAGE_ENGLISH)\n hInst = LoadLibrary(theApp.GetForeignLanguageGroupSatelliteDLLPath());\n else\n hInst = AfxGetInstanceHandle();\n\n if (b2019Format)\n strDescription.LoadString(hInst, IDS_STR_NEW_STUDY_POINT_01 + (iStudyPoint - 1));\n else\n strDescription.LoadString(hInst, + (iStudyPoint - 1));\n\n if (eForeignLanguage != LANGUAGE_ENGLISH)\n FreeLibrary(hInst);\n }\n\n if (bFormatText) // AJT v16.0.9\n {\n CString strFormattedText;\n\n strFormattedText.Format(_T(\"%d - %s\"), iStudyPoint, (LPCTSTR)strDescription);\n strDescription = strFormattedText;\n }\n }\n\n return strDescription;\n}\n\n\nNotice the function calls to load the DLL resource file?\n\nIt works fine. My question:\n\nShould I load this DLL file once and cache the HINSTANCE in the application class until the user changes their mind, or should I constantly load and unload as I need to extract a custom resource value?" ]
[ "c++", "mfc" ]
[ "how to access custom classes in symfony2?", "I have created a custom class with few method in it. e.g.\n\n class MyClass{\n\n method1 ();\n\n method2();\n}\n\n\nNow I want to create object of this class and use it inside a controller method\n\nclass DefaultController{\n\npublic function myAction()\n{\n //here I want to able to create object of MyClass, is it possible? \n}\n\n\n}\n\nQ1. where should I store this class in symfony2 structuere e.g. inside src dir?\n\nQ2. How can I use this class method inside the controller of a bundle?" ]
[ "php", "symfony" ]
[ "Decrypt Flash SSL SSLKEYLOGFILE", "I was finding a way to decrypt SSL connection from a flash application (.swf). While reading and learning more about SSL and the way it encrypts and decrypts data I stumbled upon this website: https://isc.sans.edu/forums/diary/Psst+Your+Browser+Knows+All+Your+Secrets+/16415\n\nI am wondering if this file also stores the RSA key of the Flash ( AS3 ) websocket ? Or only communication in Firefox/Chrome?\n\nRegards" ]
[ "c++", "actionscript-3", "flash", "ssl", "encryption" ]
[ "PHP ecommerce system: which one is easiest to modify", "I will have to set up ecommerce application. It will be ecommerce with high traffic (thousands views per day, few thousands orders per day, 30000+ products). I’m looking for ecommerce software written in PHP. I have checked:\n\n\nOscommerce\nzencart\nMagento (http://www.magentocommerce.com/)\nPrestaShop (http://www.prestashop.com/) +\nOpenCart (http://opencart.com) +\nCubecart (http://www.cubecart.com)\nagoracart (http://www.agoracart.com/)\nstoresprite (http://www.storesprite.com/)\noptioncart (www.optioncart.com)\ninterspire (http://www.interspire.com/) ~$300 + 12months support +\nx-cart (http://www.xcart.com/)\n\n\nand my favorites are:\n\n\nPrestaShop\nOpenCart\ninterspire\nsomething own.\n\n\nAfter few hours spend with each I dont know if it fill my needs. Maybe you have some experience. The project im working on have many very \"special\" requirements so I need something that will be very extensible (eg. add new payments types, new promotions, add functionality to have custom view for every category and by \"custom view\" i don’t mind different category name color only). But for me \"easy extensible\" means not only well written code but also well documented with good support. As you see this doesn't have to be free/opensource but licence have to allow to modify source code. It also cannot be very expensive (less than $5000). Also it has to be fast. It must support few thousand orders/per day. I don’t care if output is based on divs, tables or HTML5 section/srticle. We gonna rewrite it anyway, but build in seo support (meta tags, urls) for category/product is must. It also should allow to have unlimited category depth. It will be nice to have built in CMS but I am not interested in cart extension to jomla/drupal. It have to be standalone ecommerce application.\n\nI'm not interested in java/python because there is lack of developers so only PHP solutions are taken into consideration.\n\nWhy not Magento: it looks good ad have awesome admin panel, but i heard that it is very slow. Also \"super admin panel\" means that there is a lot of javascript/functions/classes and it probably will be harder to extend. Also heard bad opinions about support.\n\nWhy not oscommerce/zencart: worked with oscommerce and it was hell. Zencart is based on oscommerce and i suppose that not many things changed.\n\nOthers from my list looks the same. I can’t see bi difference in functionality. My choice of presta, opencart, interspire is based on user opinions found on the Internet.\n\nWhich one you can you can recommend me? Maybe something totally different?" ]
[ "php", "e-commerce" ]
[ "Cycle in the struct layout that doesn't exist", "This is a simplified version of some of my code:\n\npublic struct info\n{\n public float a, b;\n public info? c;\n\n public info(float a, float b, info? c = null)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n}\n\n\nThe problem is the error Struct member 'info' causes a cycle in the struct layout. I'm after struct like value type behaviour. I could simulate this using a class and a clone member function, but I don't see why I should need to.\n\nHow is this error true? Recursion could perhaps cause construction forever in some similar situations, but I can't think of any way that it could in this case. Below are examples that ought to be fine if the program would compile.\n\nnew info(1, 2);\nnew info(1, 2, null);\nnew info(1, 2, new info(3, 4));\n\n\nedit:\n\nThe solution I used was to make \"info\" a class instead of a struct and giving it a member function to returned a copy that I used when passing it. In effect simulating the same behaviour as a struct but with a class.\n\nI also created the following question while looking for an answer.\n\nValue type class definition in C#?" ]
[ "c#", "constructor", "struct", "member", "cyclic-reference" ]
[ "How to use OrientDB ETL to create edges only", "I have two CSV files:\n\nFirst containing ~ 500M records in the following format \n\n\n id,name\n 10000023432,Tom User\n 13943423235,Blah Person \n\n\nSecond containing ~ 1.5B friend relationships in the following format \n\n\n fromId,toId\n 10000023432,13943423235\n\n\nI used OrientDB ETL tool to create vertices from the first CSV file. Now, I just need to create edges to establish friendship connection between them.\n\nI have tried multiple configuration of the ETL json file so far, the latest being this one:\n\n{\n \"config\": {\"parallel\": true},\n \"source\": { \"file\": { \"path\": \"path_to_file\" } },\n \"extractor\": { \"csv\": {} },\n \"transformers\": [\n { \"vertex\": {\"class\": \"Person\", \"skipDuplicates\": true} },\n { \"edge\": { \"class\": \"FriendsWith\",\n \"joinFieldName\": \"from\",\n \"lookup\": \"Person.id\",\n \"unresolvedLinkAction\": \"SKIP\",\n \"targetVertexFields\":{\n \"id\": \"${input.to}\"\n },\n \"direction\": \"out\"\n }\n },\n { \"code\": { \"language\": \"Javascript\",\n \"code\": \"print('Current record: ' + record); record;\"}\n }\n ],\n \"loader\": {\n \"orientdb\": {\n \"dbURL\": \"remote:<DB connection string>\",\n \"dbType\": \"graph\",\n \"classes\": [\n {\"name\": \"FriendsWith\", \"extends\": \"E\"}\n ], \"indexes\": [\n {\"class\":\"Person\", \"fields\":[\"id:long\"], \"type\":\"UNIQUE\" }\n ]\n }\n }\n}\n\n\nBut unfortunately, this also creates the vertex with \"from\" and \"to\" property, in addition to creating the edge.\n\nWhen I try removing the vertex transformer, ETL process throws an error:\n\nError in Pipeline execution: com.orientechnologies.orient.etl.transformer.OTransformException: edge: input type 'com.orientechnologies.orient.core.record.impl.ODocument$1$1@40d13\n6a8' is not supported\nException in thread \"OrientDB ETL pipeline-0\" com.orientechnologies.orient.etl.OETLProcessHaltedException: Halt\n at com.orientechnologies.orient.etl.OETLPipeline.execute(OETLPipeline.java:149)\n at com.orientechnologies.orient.etl.OETLProcessor$2.run(OETLProcessor.java:341)\n at java.lang.Thread.run(Thread.java:745)\nCaused by: com.orientechnologies.orient.etl.transformer.OTransformException: edge: input type 'com.orientechnologies.orient.core.record.impl.ODocument$1$1@40d136a8' is not suppor\nted\n at com.orientechnologies.orient.etl.transformer.OEdgeTransformer.executeTransform(OEdgeTransformer.java:107)\n at com.orientechnologies.orient.etl.transformer.OAbstractTransformer.transform(OAbstractTransformer.java:37)\n at com.orientechnologies.orient.etl.OETLPipeline.execute(OETLPipeline.java:115)\n ... 2 more\n\n\nWhat am I missing here?" ]
[ "etl", "orientdb", "graph-databases" ]
[ "Question about bluetooth on Android", "Hi I just read your post Bluetooth RFCOMM / SDP connection to a RS232 adapter in android and I think you probably can help me figure out my little problem.\n\nI have this BT module connected to a MCU via serial port UART. Im trying to connect to the bluetooth via my android phone. I managed to use my app and scan BT devices. The scanner (based on BTchat) gives me the MAC. How can I know my device UUID ? It is SPP device also. \n\nThank you" ]
[ "android", "macos", "bluetooth", "uuid", "ssp" ]
[ "Golang MGO Group By multiple params and grab last by datetime", "I am using Golang and the MGO library\n\nI have some test records where I want to GROUP BY the serial number, stage, stage order and grab the last record by the datetime field. Most instances there is 1 record that per serial/stage/stage order but there can also be instances where there are multiple tests and I would like to grab the last test completed, not all of them for that combination.\n\nSo, in short, there are records in my table that will have the same serial, stage, and stage order but different timestamps, I want to grab the last or only record for the entire data set so that I have a single record for every (serial, stage, stage order) combination and if there were duplicate tests I always grab the last record in that group.\n\n\n\nWith the above example I ONLY want to get the 2nd record back for that serial.\n\nMy Code:\nI was trying to create a pipeline but can't seem to get it setup correctly:\n\npipeline := []bson.M{\n bson.M{\n \"$match\": bson.M{\"workorder\": i},\n },\n bson.M{\n \"$group\": bson.M{\n \"_id\": \"id\",\n \"serial\": bson.M{\"$match\": \"$serial\"},\n \"stage\": bson.M{\"$match\": \"$stage\"},\n \"order\": bson.M{\"$match\": \"$order\"},\n \"date\": bson.M{\"$last\": \"$date_timestamp\"},\n },\n },\n}" ]
[ "mongodb", "go", "mongodb-query", "aggregation-framework", "mgo" ]
[ "javascript SDK suddenly stopped working without showing any error #linkedin", "I have create an app to achieve login-with-linked-in functionality. Previously it worked fine, but all of a sudden it stopped working.\n\nPreviously if user already logged-in to LinkedIn, clicking the login-in-with-linkedIn button will lead user to there corresponding dashboard, otherwise login-popup open and user details get saved in db and user redirects to corresponding dashboard,But now nothing happening.\n\nNote:- I have used my custom button to use this functionality. not the linked-in provided button code.\n\nHere is my code and app creation steps:-\n\nButton code:-\n\n<a href=\"javascript:void(0);\" onclick=\"doLinkedInLoginForBuyer()\" class=\"btn btn--social-li\"><?php echo Labels::getLabel('LBL_Linkedin',$siteLangId);?></a>\n\n\nJavascript sdk code:-\n\n<script type=\"text/javascript\" src=\"//platform.linkedin.com/in.js\">\n api_key:*********\n authorize:true\n</script>\n<script>\n function doLinkedInLoginForBuyer(){\n IN.User.authorize(function(){\n onLinkedInAuth();\n });\n }\n function onLinkedInAuth() {\n IN.API.Profile(\"me\").fields(\"email-address\",\"first-name\",\"id\").result(function (data) {\n processLinkedInUserDetails(data);\n }).error(function (data) {\n $.systemMessage('There was some problem in authenticating your account with LinkedIn,Please try with different login option','alert alert--danger'); \n });\n }\n processLinkedInUserDetails = function(data){\n data = data.values[0];\n fcom.ajax(fcom.makeUrl('LinkedIn', 'loginLinkedIn'), data, function(t) {\n var response = JSON.parse(t);\n if(response.status ==0){\n $.systemMessage(response.msg,'alert alert--danger'); \n }\n if(response.status ==1){\n location.href = response.msg;\n }\n });\n };\n</script>\n\n\nNote:- It seems that onLinkedInAuth() as well as processLinkedInUserDetails() functions are not called at all now. Previously they worked fine.\n\nLet me know if any other details are required. Thanks!" ]
[ "linkedin", "linkedin-api", "linkedin-jsapi" ]
[ "Where to change the datetime display format in Dexterity-generated fields?", "Dexterity does not use the usual Plone i18n machinery, at least not to display dates in a specific locale. So where to change that if you want, for instance, an ISO-compliant format in an English locale?" ]
[ "plone", "zope", "dexterity" ]
[ "UMReactNativeAdapter not found in an ios build", "trying to run ios build for a project written in react-native and ran into some issued. was trying to fix this \"UMReactNativeAdapter not found\" problem, read some solutions here but nothing worked, any suggestions?\n\ni am using react-native-cli: 2.0.1, and in my podFile i added: \n\nrequire_relative '../node_modules/react-native-unimodules/cocoapods'\nrequire_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'\nrequire_relative '../node_modules/react-native-unimodules/cocoapods.rb'\n\n\nthanks." ]
[ "ios", "react-native", "podfile" ]
[ "AngularJS - is it possible to have underscore in directive's name?", "I have problem with angular directive's naming convention and the way angular normalize my directives names.\nIn order to follow some naming conventions in an existing project, to which I want to add angular, I need to name my custom directive with \"_\" in such manner:\n\napp.directive(\"directive_name\", function(...) {...});\n\n\nSadly doing so seems to contradict with Angular's way of normalization of directive's name and as a result such directives are ignored, not compiled and hence not shown on the screen.\n\n[Question]\nIs it possible to name a directive in such way that later we can use it in the HTML as follows:\n\n<body>\n ...\n <my_directive></my_directive>\n</body>\n\n\nThank you for your time and help!" ]
[ "angularjs", "angularjs-directive", "naming-conventions" ]
[ "PowerShell: $PSBoundParameters not available in Debug context", "If I attempt to examine the PowerShell $PSBoundParameters automatic variable during a PowerShell debugging session (eg. PowerShell ISE or Quest PowerGUI Script Editor), I cannot retrieve its value. However, if I simply allow the function to echo the $PSBoundParameters object to the pipeline, it renders as expected.\n\nDoes anyone know why this is? I would expect to be able to examine all in-scope variable during a debugging session, whether they are automatic, or user-defined." ]
[ "debugging", "powershell", "scripting" ]
[ "jQuery mouse scroll script speed will not change", "had a google....\n\nTried changing my website scroll settings & nothing is happening.\n\nAnyone have a write up or table on mouse scroll jQuery scripts and functions?\n\n(Caches were cleared, cross browser test etc.)\n\njQuery(window).load(function(){ \n\n if(checkBrowser() == 'Google Chrome' && device.windows()){\n\n if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);\n\n window.onmousewheel = document.onmousewheel = wheel;\n\n\n\n var time = 330;\n\n var distance = 300;\n\n\n function wheel(event) {\n\n if (event.wheelDelta) delta = event.wheelDelta / 90;\n\n else if (event.detail) delta = -event.detail / 3;\n\n handle();\n\n if (event.preventDefault) event.preventDefault();\n\n event.returnValue = false;\n\n }\n\n\n\n function handle() {\n\n jQuery('html, body').stop().animate({\n\n scrollTop: jQuery(window).scrollTop() - (distance * delta)\n\n }, time);\n\n }\n\n }\n\n});\n\nfunction checkBrowser(){\n\n var ua = navigator.userAgent;\n\n\n\n if (ua.search(/MSIE/) > 0) return 'Internet Explorer';\n\n if (ua.search(/Firefox/) > 0) return 'Firefox';\n\n if (ua.search(/Opera/) > 0) return 'Opera';\n\n if (ua.search(/Chrome/) > 0) return 'Google Chrome';\n\n if (ua.search(/Safari/) > 0) return 'Safari';\n\n if (ua.search(/Konqueror/) > 0) return 'Konqueror';\n\n if (ua.search(/Iceweasel/) > 0) return 'Debian Iceweasel';\n\n if (ua.search(/SeaMonkey/) > 0) return 'SeaMonkey';\n\n if (ua.search(/Gecko/) > 0) return 'Gecko';\n\n return 'Search Bot';\n\n}" ]
[ "javascript", "jquery", "css", "html" ]
[ "How to change MahApps.Metro dialog style?", "I would like to change the style of a message dialog. I used this: How to change MahApps.Metro dialog content template width?\n\nI want different styles for some dialogues. How can I change the style of a single dialog? I tried to do it with the CustomResourceDictionary property. But this has no effect. \n\nvar Style = (Style) Application.Current.Resources[\"NewCustomDialogStyle\"];\nvar mySettings = new MetroDialogSettings()\n {\n CustomResourceDictionary = Style.Resources\n };\n\n\nWhen I override the MessageDialog style everything is fine\n\n<Style TargetType=\"{x:Type Dialog:MessageDialog}\" BasedOn=\"{StaticResource NewCustomDialogStyle}\" />" ]
[ "wpf", "xaml", "modal-dialog", "controltemplate", "mahapps.metro" ]
[ "Why can I use 'delete' on a pointer that points to an already deleted object?", "In the following code, I have an execution error, which I expect since I initialized ptr1 with NEW and after deleting it, I try to access the deleted object with another pointer.\n\n#include <iostream>\n#include <string>\n\nclass MyClass\n{\npublic:\n std::string name{ "Unknown" };\n MyClass(){ std::cout << "Constructor" << std::endl; }\n ~MyClass(){ std::cout << "Destructor" << std::endl; }\n void printName() { std::cout << this->name << std::endl; }\n};\n\nint main()\n{\n\n MyClass* ptr1 = new MyClass();\n MyClass* ptr2 = ptr1;\n \n delete ptr2;\n ptr1->printName();\n delete ptr1;\n\n return 0;\n}\n\nIn the next code, after the first delete I don't expect to be able to call the second one because I'm trying to delete an already deleted object...Could someone help me understand what's going on?\nMy understanding is that with NEW I have created an object in memory and that I have 2 pointers 'ptr1' and 'ptr2' that point to the same memory space.\nI don't understand why the following code doesn't crash? And why the destructor can be called twice?\n\n#include <iostream>\n#include <string>\n\nclass MyClass\n{\npublic:\n std::string name{ "Unknown" };\n MyClass(){ std::cout << "Constructor" << std::endl; }\n ~MyClass(){ std::cout << "Destructor" << std::endl; }\n void printName() { std::cout << this->name << std::endl; }\n};\n\nint main()\n{\n\n MyClass* ptr1 = new MyClass();\n MyClass* ptr2 = ptr1;\n \n delete ptr1;\n delete ptr2;\n\n return 0;\n}\n\nOutput\nConstructor\nDestructor\nDestructor" ]
[ "c++", "c++11" ]
[ "No such file or directory React Native ImgToBase64", "I used the ImgToBase64 class to convert a jpg file to base64, but I am getting an error because I could not give the path correctly.\nNo such file or directory React Native\n\nImgToBase64.getBase64String('file://app/src/main/assets/img/aircraftimages/WingDown_Taildragger_FirewallRef.jpg')\n .then(base64String => console.log(base64String))\n .catch(err => console.log(err));" ]
[ "reactjs", "react-native" ]
[ "Javascript tooltip not working, no idea why", "Within a slider I have created images that expand and have a tooltip appear, however for some reason my previously functioning code is no longer working. The exact same code works on JSFiddle but not online or locally. I have no idea why.\n\nHTML\n\n<ul class=\"thumb\">\n<li> <img src=\"imagewithtooltip.png\" width=\"200\" height=\"229\" title=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt rhoncus risus sed rhoncus.\" /> </li>\n</ul>\n\n\nCSS\n\nul.thumb {\nfloat: none;\nlist-style: none;\nmargin: 0;\npadding: 10px;\nwidth: 360px;\nbottom: 5px;\n}\nul.thumb li {\nmargin: 0;\npadding: 5px;\nfloat: right;\nposition: absolute; /* Set the absolute positioning base coordinate */\nwidth: 200px;\nheight: 200px;\nbottom: 5px;\nright: 40%;\n}\nul.thumb li img {\nwidth: 200px;\nheight: 200px; /* Set the small thumbnail size */\n-ms-interpolation-mode: bicubic;\npadding: 5px;\nposition: relative;\nleft: 0;\ntop: 0;\n}\n\n.hover {\nbackground:url(thumb_bg.png) no-repeat center center;\n}\n\n.caption {\nbackground:#ffcc00;\nposition: absolute;\ntop: 100%;\nleft: 0px;\n}\n\n\nJavascript\n\n<script type=\"text/javascript\">\n$(\"ul.thumb li\").hover(function() {\n\n $(this)\n .css('z-index', '10')\n .find('img').addClass(\"hover\")\n .stop()\n .animate({\n\n marginTop: '-150px',\n marginLeft: '-150px',\n top: '50%',\n left: '50%',\n width: '300px',\n height: '300px',\n padding: '20px'\n\n }, 200, function() {\n\n var $this = $(this),\n h = $this.height();\n $caption = $('<div class=\"caption\">' + this.title + '</div>')\n .css('top', h.toString() + 'px');\n\n $this.after($caption);\n\n }); \n\n}, function() {\n\n $('.caption').remove();\n $(this)\n .css('z-index', '0')\n .find('img').removeClass(\"hover\")\n .stop()\n .animate({\n\n marginTop: '0',\n marginLeft: '0',\n top: '0',\n left: '0',\n width: '200px',\n height: '200px',\n padding: '5px'\n\n }, 400);\n});\n\n\n</script>\n\n\nLIVE LINK OF WEB PAGE IS HERE I HAVE JUST FINISHED GRAPHIC DESIGN COURSE WITH A FRIEND, WHO IS A WEB DESIGNER HAHA!" ]
[ "javascript", "jquery", "html", "css", "tooltip" ]
[ "Check RPC Encrypted Data in motion on HDFS/YARN/Spark/Hbase", "We have specific requirement to check/validate data in motion when RPC encrypted data flows for all communication with client as well as within big data components like HBase/Phoenix/HDFS/YARN/Hive processes.\n\nPlease suggest ideas to do validation for data in motion or \nIs there readily available solution to make sure motion of data on ports and RPC communication are encrypted." ]
[ "apache-spark", "encryption", "hdfs", "hbase", "rpc" ]
[ "How can I correctly align cards for different screens?", "I have a problem and is that my cards are not aligned correctly, I mean I get this\n\nWhat I've tried was to get the position of the cards and then add the height of the card I want to move but it fails. I still get big white gaps.\n\nHere is some of my code: \n\nThis code is in order to get the height:\n\n$(\".cardItem\").each(function(i, item) {\n // when index is 0 then top position is 0 and left position is 0\n if (i == 0) {\n $('.mainCardHolder' + i).css('left', 0);\n $('.mainCardHolder' + i).css('position', 'static');\n }\n\n // when index is 1 then top position is 0 and left position is the half of the screen\n if(i == 1) {\n $('.mainCardHolder'+i).css('position', 'static');\n $('.mainCardHolder'+i).css('left', window.screen.width / 2);\n }\n\n // if is greater than 1 then goes the magic\n if(i > 1) {\n // Getting the final position using the top of the two previous cards and adding the height of the card I want to move\n var finalPos = $('.mainCardHolder' + (i-2)).offset().top + ($('.mainCardHolder' + (i-2)).height());\n console.log(finalPos);\n\n // Setting the final position to the card I move\n $('.mainCardHolder'+i).css('top', finalPos);\n\n // If is unpair then the left position is the half screen \n if(i % 2 != 0) {\n var widthDividedBy2 = window.screen.width / 2;\n $('.mainCardHolder'+i).css('left', widthDividedBy2);\n $('.mainCardHolder'+i).css('position', 'static');\n }\n\n // If is pair then the left pos is 0\n if(i % 2 == 0) {\n $('.mainCardHolder'+i).css('left', 0);\n $('.mainCardHolder'+i).css('position', 'static');\n }\n }\n});\n\n\nThe cards are added dynamically, I use materializecss for front-end and I use firebase as backend.\n\nEDIT1: This is what i want to achieve: Wallapop" ]
[ "jquery", "html", "css", "phonegap" ]
[ "People search under a Windows Store Application", "I want to do a people search inside my Windows Store Application by accessing contacts in people app in Windows 8 Start.\n\nDo you have any ideas?\n\nRegards,\nSiva" ]
[ "windows-8", "windows-store-apps", "windows-store" ]
[ "How to avoid memory referencing to lists in python during continuous concatenation?", "My requirement is , i want a final list as output which should\n\nparticipate in loop during concatenation with other list (i got as an output of some other computation),but with below\n\nimplementation its not working due to memory referencing ,how can i avoid this. IN PYTHON \n\nPlease excuse me for my grammar \n\ntest_list=[[0,1],[2,3]]\nresult_list=[]\nfor i in range(3):\n result_list=list(result_list)+list(test_list)\n test_list.pop()\n //this below line is affecting the result_list also,how to avoid this\n test_list[0][1]+=1" ]
[ "python", "list" ]
[ "Using ggplot2 to plot predicted values with robust standard errors", "I am trying to use ggplot2 to plot the predicted values of negative binomial regression, one with a binary variable turned on, and another with it turned off. So there will be two two plots that can be compared.\n\nThe link here demonstrates how to do it at the bottom of the page, but I want to be able to create shading around the plot of the predicted values using robust standard errors. I don't see how to get this from the predict() function. Is there any work around from this code example to get robust standard errors to shade around the plotted lines?\n\nI use the code here from this site to generate robust standard errors:\n\nrequire(sandwich)\ncov.nb1 <- vcovHC(nb1, type = \"HC0\")\nstd.err <- sqrt(diag(cov.nb1))\nr.est <- cbind(Estimate = coef(nb1), `Robust SE` = std.err, `Pr(>|z|)` = 2 *\n pnorm(abs(coef(nb1)/std.err), lower.tail = FALSE), LL = coef(nb1) - 1.96 *\n std.err, UL = coef(nb1) + 1.96 * std.err)\n\nr.est\n\n\nthe model I am using is this:\n\nnb1 <- glm.nb(citecount ~ expbin*novcr + expbin*I(novcr^2) + disease + length +\nas.factor(year), data = nov4d.dt)\n\n\nAnd a sample of the data I am using is this:\n\nnov4d.dt <-\n structure(list(PMID = c(1279136L, 1279186L, 1279186L, 1279187L, \n 1279187L, 1279190L, 1279257L, 1279317L, 1279332L, 1279523L), \n min = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), max = c(32L, \n 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L), mean = c(11L, \n 13L, 13L, 19L, 19L, 16L, 24L, 15L, 8L, 19L), length = c(45L, \n 120L, 120L, 78L, 78L, 136L, 45L, 36L, 171L, 78L), threslength = c(13L, \n 20L, 20L, 7L, 7L, 26L, 4L, 6L, 77L, 14L), novlength = c(5L, \n 6L, 6L, 3L, 3L, 6L, 3L, 3L, 36L, 5L), novind = c(\"TRUE\", \n \"TRUE\", \"TRUE\", \"TRUE\", \"TRUE\", \"TRUE\", \"TRUE\", \"TRUE\", \"TRUE\", \n \"TRUE\"), novcr = c(0.111111, 0.05, 0.05, 0.0384615, 0.0384615, \n 0.0441176, 0.0666667, 0.0833333, 0.210526, 0.0641026), novcrt = c(0.288889, \n 0.166667, 0.166667, 0.0897436, 0.0897436, 0.191176, 0.0888889, \n 0.166667, 0.450292, 0.179487), year = c(1991L, 1991L, 1992L, \n 1992L, 1992L, 1992L, 1992L, 1992L, 1991L, 1992L), disease = structure(c(1L, \n 4L, 2L, 4L, 2L, 1L, 4L, 4L, 2L, 4L), .Label = c(\"alz\", \"bc\", \n \"cl\", \"lc\"), class = \"factor\"), citecount = c(5L, 8L, 8L, \n 12L, 12L, 0L, 1L, 0L, 92L, 0L), novind2 = c(TRUE, TRUE, TRUE, \n TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), rad = c(FALSE, \n FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE\n ), exp = c(260, 351, 351, 65, 65, 480, 104, 273, 223, 0), \n novind4 = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, \n FALSE, TRUE, FALSE), novind5 = c(FALSE, FALSE, FALSE, FALSE, \n FALSE, FALSE, FALSE, FALSE, TRUE, FALSE), novind6 = c(FALSE, \n FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE\n ), expbin = c(TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, \n TRUE, TRUE, FALSE), expbin2 = c(TRUE, TRUE, TRUE, FALSE, \n FALSE, TRUE, FALSE, TRUE, TRUE, FALSE)), .Names = c(\"PMID\", \n \"min\", \"max\", \"mean\", \"length\", \"threslength\", \"novlength\", \"novind\", \n \"novcr\", \"novcrt\", \"year\", \"disease\", \"citecount\", \"novind2\", \n \"rad\", \"exp\", \"novind4\", \"novind5\", \"novind6\", \"expbin\", \"expbin2\"\n ), sorted = \"PMID\", class = c(\"data.frame\"), row.names = c(NA, \n -10L))" ]
[ "r", "ggplot2", "robust" ]
[ "PHP Make an Array from a Text Pattern (cfg file)", "so i have a couple of Nagios CFG files, for Services,Hosts,Contacts,etc\n\nI want to parse these CFG files with PHP to handle data.\n\nContactGroups.CFG\n\ndefine contactgroup {\n contactgroup_name VAP3\n alias VAP3_PRE\n members userz, userw }\n\ndefine contactgroup {\n contactgroup_name VAP4\n alias VAP4_PUSH\n members userx, usery }\n\n\nServices.CFG\n\ndefine service {\n host_name HostA\n service_description HostA_HD\n contact_groups VAP2,VAP3 }\n\ndefine service {\n host_name HostB\n service_description HostB_HD\n contact_groups VAP3,VAP4 }\n\n\nSo i want to parse it like:\n\ncontactgroup_name[0] = \"VAP3\";\nalias[0] = \"VAP3_PRE\";\nmembers [0] = \"userz,userw\";\n\ncontactgroup_name[1] = \"VAP4\";\nalias[1] = \"VAP4_PUSH\";\nmembers [1] = \"userx, usery\";\n\n\nAnd for services file:\n\nhost_name [0] = \"HostA\";\nservice_description [0] = \"HostA_HD\";\ncontact_groups [0] = \"VAP2,VAP3\";\n\nhost_name [1] = \"HostB\";\nservice_description [1] = \"HostB_HD\";\ncontact_groups [1] = \"VAP3,VAP4\";\n\n\nSo i can handle it in my PHP script easily like arrays, these are just an example of the CFG files, they contains more than these three definitions...Maybe with a regex or preg_match...?" ]
[ "php", "parsing", "nagios" ]
[ "How to join 100 random rows from table 1 multiple other tables in oracle", "I have scrapped my previous question as I did not do a good job explaining. Maybe this will be simpler.\n\nI have the following query.\n\nSelect * from comp_eval_hdr, comp_eval_pi_xref, core_pi, comp_eval_dtl\nwhere comp_eval_hdr.START_DATE between TO_DATE('01-JAN-16' , 'DD-MON-YY') \nand TO_DATE('12-DEC-17' , 'DD-MON-YY')\nand comp_eval_hdr.COMP_EVAL_ID = comp_eval_dtl.COMP_EVAL_ID\nand comp_eval_hdr.COMP_EVAL_ID = comp_eval_pi_xref.COMP_EVAL_ID\nand core_pi.PI_ID = comp_eval_pi_xref.PI_ID\nand core_pi.PROGRAM_CODE = 'PS'\n\n\nNow if I only want a random 100 rows from the comp_eval_hdr table to join with the other tables how would I go about it? If it makes it easier you can disregard the comp_eval_dtl table." ]
[ "sql", "oracle" ]
[ "XAMPP or any other service tool in /opt? Security", "I am developing with Xampp for Linux and Tomcat (similar to Xampp on Windows). Many programs like /IDEA, Tomcat and Xampp are recommended to be installed under /opt Now I have heard that it is not recommended to run services as root, but on Ubuntu (I am using this) unpacking any directory to /opt implies that it belongs to root owner and root group. This may be specific to Xampp as per the instructions on their Linux page: \n\n\n \n Step 2: Installation After downloading simply type in the following commands:\n \n Go to a Linux shell and login as the system administrator root:\n \n su\n \n Extract the downloaded archive file to /opt:\n \n\n\ntar xvfz xampp-linux-1.8.1.tar.gz -C /opt\n\n\n\nWarning: Please use only this command to install XAMPP. DON'T use any Microsoft Windows tools to extract the archive, it won't work.\n\nWarning 2: already installed XAMPP versions get overwritten by this command.\n\n \n That's all. XAMPP is now installed below the /opt/lampp directory.\n * Step 3: Start To start XAMPP simply call this command:\n \n /opt/lampp/lampp start\n\n\nPlacing it here implies that Apache must be run as root as one is only able to run it with sudo on Ubuntu.\n\nThis may be an issue specific to Ubuntu. Is it? Because Xampp is a development tool I posted this here as I am more likely to find an appropriate answer here from developers who use it on Ubuntu (and other Linux systems). I would appreciate any information on if the same problem occurs on other systems, I notice my production environment has Tomcat installed in /opt too, but belongs to tomcat: tomcat\n\nThe question here is how to get around this for all tools under /opt, because even though Xampp may not be the tool for my needs, I still want to place Tomcat under /opt to replicate my production environment and the same thing will surely happen unless this is just a Ubuntu issue?" ]
[ "linux", "tomcat", "ubuntu", "xampp" ]
[ "Active Record Error messages form_tag Rails 3", "I have a validation in my model like so\n\nclass Prediction < ActiveRecord::Base\nattr_accessible :home_team, :away_team, :home_score, :away_score, :fixture_date, :fixture_id, :user_id\n\nhas_one :fixture\n\nvalidates :fixture_id, :uniqueness => { :scope => :user_id, :message => \"only one prediction per game is allowed, for each user\" }\n\nend\n\n\nThe idea being a user can only make one prediction per fixture, and if they try and submit another prediction for the same fixture then they get a message stating they cant as already submitted..\n\nI am using form_tag like so\n\n<%= form_tag controller: 'predictions', action: 'create', method: 'post' do %>\n <%= error_messages_for :prediction %><!-- Just added this -->\n\n<% @fixture_date.sort.each do |date, fixture| %>\n<%= date_format(date) %>\n <% fixture.each do |fixture|%>\n <%= fixture.home_team %>\n <%= text_field_tag \"predictions[][home_score]\" %> \n <%= text_field_tag \"predictions[][away_score]\" %>\n\n <%= fixture.away_team %> \n <%= hidden_field_tag \"predictions[][home_team]\", fixture.home_team %>\n <%= hidden_field_tag \"predictions[][away_team]\", fixture.away_team %>\n <%= hidden_field_tag \"predictions[][fixture_date]\", fixture.fixture_date %>\n <%= hidden_field_tag \"predictions[][fixture_id]\", fixture.id %>\n <%= hidden_field_tag \"predictions[][user_id]\", current_user.id %>\n <% end %>\n\n\nController\n\ndef create\nbegin\n params[:predictions].each do |prediction|\n Prediction.new(prediction).save!\n end\n redirect_to root_path, :notice => 'Predictions Submitted Successfully'\nend\nend\n\n\nat the moment im getting the rather ugly and not practical\n\nActiveRecord::RecordInvalid in PredictionsController#create\n\nValidation failed: Fixture only one prediction per game is allowed, for each user\n\n\nHow do i get the error message to display on the page\n\nI thought that this would work\n\n<%= error_messages_for :prediction %>\n\n\nas above but it doesnt\n\nAny help appreciated" ]
[ "ruby-on-rails", "ruby-on-rails-3", "validation", "error-handling", "rails-activerecord" ]
[ "What are the rules I should follow to ensure GetHashCode() method returns unique value for an object?", "What are the rules I should follow to ensure GetHashCode() method returns unique value for an object?\n\nFor example: \n\n\nShould I include some prive members for the calculation? \nShould I multiply instead of sum? \nCan I be sure that I am generating a uniqe hash code for a particular object graph? etc." ]
[ "c#", ".net", "gethashcode" ]
[ "Image Processing of Function Graph", "I would like to detect these points in this graph , also I wanted to detect the lines , \n\n\nI searched for edge detection and corner detection (such as Harris Corner Detector ), but I don't know how to handle such graph , I only need to know a sudo algorithm , or steps of going through such problem" ]
[ "opencv", "image-processing", "computer-vision" ]
[ "Indoor positioning system in android", "I would like to ask a question regarding redpin indoor positioning system on android. I read somewhere stackoverflow about redpin and visited their website. From there i followed their instructions on how to set up redpin on android, but i only get a red dot pointing on the top left corner of the map i uploaded. I would like to know if anyone has successfully gotten redpin to work for android and assist me in doing so?....or maybe can tell me what am I doing wrong. Sorry to ask, I am very new at this, thank you." ]
[ "android", "redpin" ]
[ "Fetching mysqli data and security", "I am using prepared statements to enter data into the database, but I am not using prepared statements to fetch data. The reason is that the code is a little smaller and from what I read, its a little faster. Are there any security issues with this?\n\nExample:\n\nto insert data;\n\n$stmt = mysqli_prepare($con, \"INSERT USERS (userFname) ( VALUES (?)\");\nmysqli_stmt_bind_param($stmt, 's', $userFname); \nmysqli_stmt_execute($stmt); \nmysqli_stmt_close($stmt);\n\n\nto fetch data;\n\n$query = mysqli_query($con,\"SELECT * FROM users WHERE userEmail = '$userEmail'\");\n\n\nis this method as safe as using prepared statements to fetch data?" ]
[ "mysqli" ]
[ "Calling \".class\" on Typed class (e.g. MyClass.class)", "I am trying to use a function in GreenRobot's EventBus class: \n\npublic <T> T removeStickyEvent(@NotNull Class<T> tClass);\n\n\nThis works with normal classes such as:\n\nMyEvent myEvent = eventbus.removeStickyEvent(MyEvent.class);\n\n\n\n\nNow, I would like to get away from defining classes that just hold a single object (e.g. MyStringEvent, MyIntegerEvent) and use generics (e.g. MyEvent<String>, MyEvent<Integer>). However, the following code no longer works:\n\n// Error: 'Cannot select from parameterized type'\nMyEvent<String> myStringEvent = eventBus.removeStickyEvent(MyEvent<String>.class);\n\n\n\n\nIs there a proper way to handle this use case?" ]
[ "java", "android", "greenrobot-eventbus" ]
[ "Returning more than 1000 rows in classic asp adodb.recordset", "My code in asp classic, doing a mssql database query:\n\n rs.pagesize = 1000 ' this should enable paging\n rs.maxrecords = 0 ' 0 = unlimited maxrecords \n\n response.write \"hello world 1<br>\"\n rs.open strSql, conn \n\n response.write \"hello world 2<br>\"\n\n\nMy output when there are fewer than 1000 rows returned is good. More than 1000 rows and I don't get the \"hello world 2\".\n\nI thought that setting pagesize sets up paging and thus allows all rows to be returned regardless of how many rows there are. Without setting pagesize, paging is not enable and the limit is 1000 rows. However my page is acting as if pagesize is not working at all.\n\nPlease advise." ]
[ "asp-classic", "ado", "recordset" ]
[ "Python sorting dictionary according to value? Please review my algorithm", "I have some files to parse. It has time info followed by label and value if it has been modified on that time frame. A very simple example is like: \n\nTime 1:00\na 1\nb 1\nc 2\nd 4\nTime 2:00\nd 2\na 4\nc 5\ne 7\nTime 3:00\nc 3\nTime 4:00\ne 3\na 2\nb 5\n\n\nI need to put this into CSV file so I will plot afterwards. The CSV file should look like\n\nTime, a, b, c, d, e\n1:00, 1, 1, 2, 4, 0\n2:00, 4, 1, 5, 4, 7\n3:00, 4, 1, 3, 4, 7\n4:00, 2, 5, 3, 4, 3\n\n\nAlso I need to find the max value of each labels so I can sort my graphs.\nSince max values are a:4, b:5, c:5, d:4, e:7, I like to have list such as:\n['e', 'b', 'c', 'a', 'd' ]\n\nWhat I am doing is going through the log once and reading all labels since I don't know what labels can it be. \n\nThen going through second time in the whole file to parse. My algorithm is simply:\n\nfor label in labelList: \n currentValues[label] = 0 \n maxValues[item] = 0\n\nfor line in content:\n if endOfCurrentTimeStamp:\n put_current_values_to_CSV()\n else:\n label = line.split()[0]\n value = line.split()[1]\n currentValues[label] = value\n if maxValues[label] < value:\n maxValues[label] = value\n\n\nI got the maxValues of each label in the dictionary. Then what should I do to have a list of sorted from max to min values as said above?\n\nAlso let me know if you think an easier way to do the whole thing?\n\nBy the way my data is big. I am talking about this input file can easily be hundreds of megabytes with thousands of different labels. So every time I finish a time frame, I put data to CSV. \n\nRegards" ]
[ "python", "dictionary" ]
[ "IJobDetail job = JobBuilder.Create in same instance. Quartz.NET", "If I will not create empty constructor my Execute will not work. \n\nMy Code \n\n\r\n\r\n public class CalculateManager : ICalculateManager, IJob\r\n {\r\n static IStrongDataRepository _strongDataRepository;\r\n private readonly ICalculateProtocolOne _calculateOne;\r\n private Dictionary<string, CalculateModel> _resultDictionary;\r\n \r\n public CalculateManager(IStrongDataRepository strongDataRepository,\r\n ICalculateOne calculateOne)\r\n {\r\n _calculateOne = calculateOne;\r\n _resultDictionary = new Dictionary<string, CalculateModel>();\r\n\r\n this.Start();\r\n }\r\n \r\n \r\n \r\n \r\n public async Task Execute(IJobExecutionContext context)\r\n {\r\n Console.WriteLine(\"Here\");\r\n var x = _resultDictionary;\r\n }\r\n \r\n public CalculateManager()\r\n {\r\n\r\n }\r\n \r\n \r\n public async void Start()\r\n {\r\n TimeSpan startTime = new TimeSpan(16, 36, 0);\r\n DateTime now = DateTime.Today.Add(startTime);\r\n\r\n IScheduler scheduler = await StdSchedulerFactory.GetDefaultScheduler();\r\n await scheduler.Start();\r\n\r\n IJobDetail job = JobBuilder.Create<CalculateManager>().Build();\r\n\r\n ITrigger trigger = TriggerBuilder.Create()\r\n .WithIdentity(\"trigger1\", \"group1\")\r\n .StartAt(now)\r\n .WithSimpleSchedule(x => x\r\n .WithIntervalInMinutes(2)\r\n .RepeatForever())\r\n .Build();\r\n\r\n await scheduler.ScheduleJob(job, trigger);\r\n }\r\n\r\n\r\n\n\nIf I will not create empty constructor. My quarz build will not work. But in this way I have two different instance. In this var x = _resultDictionary; I have null. But in real when it create with all necessary interfaces in first instance thre are in _resultDictionary a lot off results from calculate. How I need to create IJobDetail job that it use the same instance." ]
[ "c#", "quartz-scheduler" ]
[ "Python List as variable name", "I've been playing with Python and I have this list that I need worked out. Basically I type a list of games into the multidimensional array and then for each one, it will make 3 variables based on that first entry.\n\nArray that is made: \n\nApplist = [\n['Apple', 'red', 'circle'],\n['Banana', 'yellow', 'abnormal'],\n['Pear', 'green', 'abnormal']\n]\n\n\nFor loop to assign each fruit a name, colour and shape.\n\nfor i in Applist:\n i[0] + \"_n\" = i[0]\n i[0] + \"_c\" = i[1]\n i[0] + \"_s\" = i[2]\n\n\nWhen doing this though, I get a cannot assign to operator message. How do I combat this?\n\nThe expected result would be:\n\nApple_n == \"Apple\"\nApple_c == \"red\"\nApple_s == \"circle\"\n\n\nEtc for each fruit." ]
[ "python", "arrays", "list", "variables", "multidimensional-array" ]
[ "Speed of paged queries in Oracle", "This is a never-ending topic for me and I'm wondering if I might be overlooking something. Essentially I use two types of SQL statements in an application:\n\n\nRegular queries with a \"fallback\" limit\nSorted and paged queries\n\n\nNow, we're talking about some queries against tables with several million records, joined to 5 more tables with several million records. Clearly, we hardly want to fetch all of them, that's why we have the above two methods to limit user queries.\n\nCase 1 is really simple. We just add an additional ROWNUM filter:\n\nWHERE ...\n AND ROWNUM < ?\n\n\nThat's quite fast, as Oracle's CBO will take this filter into consideration for its execution plan and probably apply a FIRST_ROWS operation (similar to the one enforced by the /*+FIRST_ROWS*/ hint.\n\nCase 2, however is a bit more tricky with Oracle, as there is no LIMIT ... OFFSET clause as in other RDBMS. So we nest our \"business\" query in a technical wrapper as such:\n\nSELECT outer.* FROM (\n SELECT * FROM (\n SELECT inner.*, ROWNUM as RNUM, MAX(ROWNUM) OVER(PARTITION BY 1) as TOTAL_ROWS\n FROM (\n [... USER SORTED business query ...]\n ) inner\n ) \n WHERE ROWNUM < ?\n) outer\nWHERE outer.RNUM > ?\n\n\nNote that the TOTAL_ROWS field is calculated to know how many pages we will have even without fetching all data. Now this paging query is usually quite satisfying. But every now and then (as I said, when querying 5M+ records, possibly including non-indexed searches), this runs for 2-3minutes.\n\nEDIT: Please note, that a potential bottleneck is not so easy to circumvent, because of sorting that has to be applied before paging!\n\nI'm wondering, is that state-of-the-art simulation of LIMIT ... OFFSET, including TOTAL_ROWS in Oracle, or is there a better solution that will be faster by design, e.g. by using the ROW_NUMBER() window function instead of the ROWNUM pseudo-column?" ]
[ "sql", "performance", "oracle11g", "rownum", "window-functions" ]
[ "Creating and Using Global Object in Expo", "I have an authentication object that I instantiate when the life cycle of my app begins and I need to access this object from multiple places.\nIn my previous bare React Native project, I simply declared my object as global.auth in the index.js file and was able to access it anywhere in my app by referencing it as global.auth.\nI just started a new managed Expo project with the latest SDK and when I used this approach, I get the following error message:\n\nYour project is accessing the following APIs from a deprecated global\nrather than a module import: Constants (expo-constants).\n\nHow do I instantiate and use a global object in my Expo app?\nHere's what I do in my bare React Native project. This is the index.js file:\nimport Auth from 'my-auth-package';\n\nglobal.auth = new Auth();\n\nThen in any component or util file, I can simply access it with global.auth.\nExpo doesn't seem to like this. What's the correct way of handling this in a new Expo project -- with SDK 40?" ]
[ "react-native", "expo" ]
[ "How to have if, else nested tree continue working through the remaining else if’s…", "I have a mini program I’m working on for class. The program is of correct syntax. Logically I cannot get the program to compute the remaining data after it completes the first else if statement that it matches.\nI am subtracting numbers from each (a >= b) at each else if, the remaining value I am then assigning to a variable temp and using (temp >= c), rinse and repeat till value is zero. Each else if, will assign a char ‘A’ – ‘Z’ depending on the scenario. The problem I am having is it will meet one of the first else if’s but will not continue working the remaining else-ifs. I know this is standard of how if, else works. My question is how would I go about getting the remaining else ifs examined after the first one checks out. Is the only solution to use a switch function? Is there no way I can use if else and have each else checked/passed till my value = 0?" ]
[ "c++" ]
[ "Python multiprocessing is sharing cores", "I'm using miltiprocessing to read a lot of chunks of a huge file and then process it, but I'm loosing something because sometimes when I launch some process, some of them share a core. Example: system with 12 cores, I run 10 process and 6 are en 6 cores (one with each) and other 4 are en 2 cores (2 in each core)... but other times, it works fine using 10 cores for 10 process...\n\nCode:\n\nfrom multiprocessing import Process\n[...]\nprocess1=Process(target=run_thread, args=(\"./splited/\"+file,result,))\nprocess2=Process(target=run_thread, args=(\"./splited/\"+file,result,))\nprocess3=Process(target=run_thread, args=(\"./splited/\"+file,result,))\nprocess1.start() \nprocess2.start()\nprocess3.start()\n[...]\nprocess1.join()\nprocess2.join()\nprocess3.join()\n\n\nThis is an example of my code, I was trying with 10 when I saw the issue.\n\nThanks.\n\nEDITED:\n\n\nThis machine works without multithread, so it has 12 cores with a maximum of 12 parallel threads.\nSometimes there are more than 2 sharing a core.\nThe neck of bottle is not the IO on this program it's process each line of the file." ]
[ "python", "multiprocessing" ]
[ "Keep SVG centred while using media queries", "I have a page where I've drawn several SVGs using d3.js. While building up the SVG graphics, I specified fixed heights & widths (which represent the max heights/widths that I wanted). This worked fine and with the CSS, everything was centred on the page, as I wanted. However, I also wanted the SVGs to scale when the screen width was below the fixed width. \n\nTo tackle the scaling issue, I removed the height and width attributes from the SVG and instead used viewBox (giving 0 0 <width> <height>, and preserveAspectRatio. Cool - now everything scales to the full width of the page, i.e. like width = 100% in CSS. \n\nSo then I added my media queries. And they work - the max width of the SVGs is preserved, and below that they scale.\nBut: as soon as the MQs are active, the SVGs and their containing divs are aligned left. I've spent a long time fiddling with the CSS and also googling around and I didn't manage to solve it. \n\nHere's my code (some things slightly simplified). Can anyone help? \n\nHTML: \n\n<div class=\"overall-container\">\n\n<div class=\"svg-container\">\n <h2>Smaller SVG</h2>\n <svg id=\"ebu-cb\"\n version=\"1.1\"\n baseProfile=\"full\"\n viewBox=\"0 0 768 576\"\n preserveAspectRatio=\"xMinYMin meet\"\n xmlns=\"http://www.w3.org/2000/svg\">\n </svg>\n</div> \n\n<div class=\"lg-svg-container\">\n <h2>Larger SVG</h2>\n <svg id=\"smpte-cb-hd\"\n version=\"1.1\"\n baseProfile=\"full\"\n viewBox=\"0 0 1280 720\"\n preserveAspectRatio=\"xMinYMin meet\"\n shape-rendering=\"crispEdges\"\n xmlns=\"http://www.w3.org/2000/svg\">\n </svg>\n</div>\n\n</div>\n\n\nCSS: \n\nbody {\n text-align: center;\n}\n\nsvg {\n border: 2px solid black;\n margin: 0 auto;\n}\n\ndiv {\n margin-bottom: 3rem;\n}\n\n\nMedia query: (works, but suddenly the divs with the SVGs are left aligned??? No difference if I add the media query inline of the SVG.)\n\n@media only screen and (min-width: 750px) {\n .svg-container {\n max-width: 768px;\n }\n .lg-svg-container {\n max-width: 1280px;\n }\n\n\nI added all sorts of CSS options for central alignment, but I couldn't budge the placement :( I feel that I'm missing the obvious here (or maybe I should have a slightly different setup?) and I would really appreciate some help. \n\nNote: the SVGs are generated in my JS file. I'm drawing them with the widths and heights specified in the viewBox attributes for each." ]
[ "css", "d3.js", "svg", "media-queries" ]
[ "Build process logic for Angular application", "So I have been developing in Angular for a while now and am wondering what would be a good build process for it as well as how can I implement it?\n\nAt the moment I have my project structure in the following way\n\napp\n compontents\n component-one\n component-one.ts\n component-one.html\n component-one.scss\n services\n typings\n pages\n page-one\n page-one.ts\n page-one.html\n page-one.scss\n app.ts (contains bootstrap)\nbuild\nindex.html\n\n\nI saw many people use src folder instead of app, as well as have dist folder for what I assume is a build of application, hence am wondering what would be my next steps to implement this in a way where when I work all my files like .ts or .scss compile to .js and .css respectively in a nice way (at the moment I'm using gulp to compile these into a build folder that index.htlm accesses) and .ts files are transpiled to .js files in the same folder, so I have both .ts and .js files in the same place, I'm not sure where to move these.\n\nAlso when I look into console I see message saying that Angular is in developer mode, so I assume there is production mode? How to take advantage of this.\n\nIn general I want to have two folders src and dist where everything that needs transpiring and compiling goes into dist, so essentially have an application there that can be deployed to production server.\n\nAs a side note: I am currently compiling all sass files into one big file, where styles are applied to id's or classes etc. I know in Angular there is a styles option that can be added to @Component similarly to template, I am using templateUrl instead to target related html class, can I do something similar for a scss file or better leave it as is due to it not being css?" ]
[ "angular", "build" ]