texts
list | tags
list |
---|---|
[
"Create-react-app SASS source maps not working",
"SASS source map fails to output on create-react-app 2 (reported bug), been trying to find a workaround to this while an official fix is being considered.\n\nAnother user suggested adding the below to scripts: \n\n\"scripts\": {\n \"build-css\": \"node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css\",\n \"watch-css\": \"npm run build-css && node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css --watch --recursive\"\n\n\nThis does the trick but generating another CSS which would get picked up outside of webpack, also breaking CSS injection (hot loading).\n\nThis is how the CSS is being included (via import on the index.js file). Ideally this should remain as is.\n\nimport \"styles/main.scss\";\n\n\nBelow the package.json (react-scripts v2.1.1):\n\n\"scripts\": {\n \"start\": \"react-scripts start\",\n \"build\": \"react-scripts build\",\n \"test\": \"react-scripts test\",\n \"lint\": \"NODE_ENV=production eslint src --ext '.js,.jsx'\",\n \"lint-fix\": \"yarn lint --fix\",\n \"lint-check\": \"NODE_ENV=production eslint --print-config . | eslint-config-prettier-check\",\n \"prepare-mobile\": \"node prepare-mobile.js\",\n \"release-mobile\": \"node prepare-mobile-release.js\",\n \"postbuild\": \"yarn prepare-mobile\",\n \"precommit\": \"pretty-quick --staged\"\n }\n\n\nIs there any way to output the SASS source map other than the above approach and without having to eject webpack?"
]
| [
"reactjs",
"webpack",
"create-react-app",
"package.json"
]
|
[
"Hide alert dialog in android",
"I have a simple alert dialog, it ll display when a button click is occurs.\nand hide automatically after receiving data from web service (On Button click ) .\n\nThe code below is showing the alert dialog, but i cant hide it after receiving data also.\n\nalertDialog1.setTitle(\"Please Wait\");\n alertDialog1.setCancelable(false);\n alertDialog1.setMessage(\"Fetching Info\");\n alertDialog1.show();`"
]
| [
"android",
"android-alertdialog",
"show-hide",
"builder"
]
|
[
"Pulling data from one table, modifying the data, and inserting it into two others?",
"I'm trying to figure out how to modify data I copy from one table into another two.\n\nCurrently I have it working so my form submits it pulls the data from 'prices' and puts it into 'pricestwo' and 'pricesthree'.\n\nHowever I need to modify the data before hand to make one 10% less on price, and one 20% less on price.\n\n<?php\n$priceid = $_POST['priceid'] ; \n$name = $_POST['productname'] ;\n$weight = $_POST['productweight'];\n$price = $_POST['productprice'];\nif(isset($_POST['updateprices'])) { \n\nfor($i=0;$i<$count;$i++){\n\n$sql1= mysqli_query($myConnection, \"UPDATE pricestwo SET productname='$name[$i]', productweight='$weight[$i]', productprice='$pricetwo[$i]' WHERE priceid='$priceid[$i]'\");\n\n$sql2= mysqli_query($myConnection, \"UPDATE pricesthree SET productname='$name[$i]', productweight='$weight[$i]', productprice='$price[$i]' WHERE priceid='$priceid[$i]'\");\n}\necho \"<meta http-equiv=\\\"refresh\\\" content=\\\"0;URL=edit_product_prices.php\\\">\";\n} \n?>\n\n\nThis currently works to copy just the data, I've tried something like:\n\n $pricetwo = $price - ($price * 0.15);\n\n\nto modify the data, but there are multiple rows been transferred so this just returns a 0.00 value. \n\nAnyone have any ideas on how to do this?"
]
| [
"php",
"mysql",
"updates"
]
|
[
"WSO2 Share same user between two tenants",
"I have a user in tenant1 and i want the same user with same password in tenant2 also. How to achieve this in WSO2.\n\nI did some workaround by creating same username and password in multiple tenants but this would break if any one of the tenant's password changed\n\nBasically how to share same user between multiple tenants in WSO2 Identity Server? I am using wso2is 5.1.0"
]
| [
"wso2",
"wso2is"
]
|
[
"Avoid download popup in Internet Explorer when loading file with new format in Rails",
"In my rails app, I've defined a new format called 'extension'. My extension format is responsible for rendering views for an external web browser extension that I've developed. So I can call\n\n/messages/new.extension\n\nand have code specific to my web browser extension rendered.\n\nThis strategy works great until IE comes into play. On any IE version before 9, the browser doesn't know what to do with .extension files, and so IE defaults to a download popup like so:\n\n\n\nAny thoughts on how avoid this download popup? Is there maybe another format I can use instead?"
]
| [
"ruby-on-rails",
"internet-explorer"
]
|
[
"Getting tag of object from UITapGestureRecognizer",
"I have a UIScrollView used inside a custom class that subclasses UIView. Within that scrollview, I have added several other custom objects (all subclassing UIView as well) like so:\n\nUITapGestureRecognizer *tap;\n\n for (int count = 0; count < ColorSchemeCount; count++) {\n //Check for next page first\n [self managePageAdditions];\n\n //Set up the scheme\n ColorScheme *scheme = [[ColorScheme alloc]\n initWithFrame:[self determineSchemeCircleFrameFromCount:pageCheck]\n title:[self getColorSchemeTitleFromIndex:pageCheck]\n colors:[self getColorSchemeFromIndex:pageCheck]];\n scheme.tag = pageCheck;\n tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(schemeTouchedAtIndex:)];\n tap.cancelsTouchesInView = NO;\n [scheme addGestureRecognizer:tap];\n [self.scrollView addSubview:scheme];\n\n //See if next pass requires a new page or not\n if(pageCheck > 0) needsNextPage = (pageCheck % kSchemesPerPage == 0);\n needsNextPage ? pageCheck = 0 : pageCheck++;\n }\n\n\nAnd then I try to see the ColorScheme's tag to respond accordingly:\n\n- (void)schemeTouchedAtIndex:(UITapGestureRecognizer *)gesture{\n CGPoint touchPointInSuperview = [gesture locationInView:self.scrollView];\n ColorScheme *touchedView = (ColorScheme *)[self.scrollView hitTest:touchPointInSuperview withEvent:nil];\n\n NSLog(@\"%li\", (long)touchedView.tag);\n}\n\n\nAnd no matter what I seem to do, it always logs the tag as zero.\n\nA couple of observations:\n\n\nI can confirm the tags are being set properly, and all the ColorScheme are being added just fine.\nI also have the tap.cancelsTouchesInView = NO so the UIScrollView won't swallow all the touches.\nIn the locationInView I have tried using self instead of self.scrollView to no luck. Again, the code where this resides is in a class subclassing UIView.\n\n\nStumped on this one, any help is much appreciated."
]
| [
"ios",
"objective-c",
"uiscrollview"
]
|
[
"Consume web service from same web application",
"I seem to have struck a complete blank and will most likely have a homer moment when someone points me in the right direction.\n\nI have a WCF Web Service which is consumed happily across asp.net, windows phone, windows services, etc, etc. I'm adding a page to the same application in which the service resides, basically a \"test\" page that the user can go to and it'll do a quick call to the service to see if the server is up.\n\nNow normally, you'd just throw in a Service Reference and bobs your uncle, but for the life of me, I just can't seem to click what I'm supposed to do when I'm accessing the service from within the same application, do I still add a service reference or is there a quicker way to do it?\n\nThanks!"
]
| [
"asp.net",
"wcf"
]
|
[
"Retrieving accelerometer data from Mavic Air using Windows SDK",
"I would like to retrieve the accelerometer data at a very high sampling rate using the Windows SDK. The API reference does mention the struct IMUState which contains the accelerometer values, but I haven't found an example code that actually returns these values. Additionally, I am scared that the firmware blocks access to the IMUState.\nDoes anyone know if it is possible to retrieve the accelerometer data using the Windows SDK?"
]
| [
"accelerometer",
"dji-sdk",
"imu"
]
|
[
"How to add a WHERE statement correctly to a complex MySQL query?",
"I have a quite complex query to get some data from the database, sort them and rank them accordingly.\n\nHere is the SQL fiddle for it: SQL Fiddle\n\nNow what I want to do is, to add a WHERE statement to this query, so only limited users will be selected (3 users above and 3 users below, the id = 8).\n\nWHERE sort BETWEEN @userpos - 3 AND @userpos + 3\n\n\nSo it should look something like this, but with the first example:\n\nSQL Fiddle\n\nI have already tried to implement this WHERE statement to this query, but I couldn't figure it out where should I add, as I've always received error (that the column cannot be found).\n\nAny suggestion and / or solution for my problem? Should I rewrite the whole query for this?"
]
| [
"mysql",
"sql"
]
|
[
"Deny access to url/views to unauthorized users",
"Is there a way to deny certain users (for example, allow admin and deny normal users) to access to specific url/views?\n\nI'm doing this:\n\n<?php if($this->session->userdata('level')==='1'):?>\n <h1>Hi!!!!</h1>\n <p>You can access!!</p>\n <?php elseif($this->session->userdata('level')==='2'):?>\n <h1>Level 2, access denied</h1>\n <?php else:?>\n <h1>Level 3, access denied</h1>\n <?php endif;?>\n\n\nBut I prefer not allowing to load the page, for example, not allowing them to access this url: http://localhost/login/page/posts"
]
| [
"php",
"codeigniter",
"authentication",
"access-control"
]
|
[
"RichTextBox EnableAutoDragDrop=true requires CTRL key pressed when dropping a ListBox item?",
"Not sure how to get around a problem of having to use the CTRL key when dropping a ListBox item into a RichTextBox with EnableAutoDragDrop=true...\n\nDropping into a TextBox with AllowDrop=true works without the CTRL key.\n\nUsing VS2008 .net framework 3.5"
]
| [
"richtextbox"
]
|
[
"Better way to convert NSArray of NSString to NSArray of NSNumber",
"Is there is a better way to convert NSArray of NSString into NSArray of NSNumber than the following code:\n\n-(NSArray*) convertStringArrayToNumberArray:(NSArray *)strings {\n NSMutableArray *numbers = [[NSMutableArray alloc] initWithCapacity:strings.count];\n for (NSString *string in strings) {\n [numbers addObject:[NSNumber numberWithInteger:[string integerValue]]];\n }\n return numbers;\n}"
]
| [
"ios",
"objective-c",
"nsstring",
"nsarray",
"nsnumber"
]
|
[
"How to read all the records in a Kafka topic",
"I am using kafka : kafka_2.12-2.1.0, spring kafka on client side and have got stuck with an issue.\n\nI need to load an in-memory map by reading all the existing messages within a kafka topic. I did this by starting a new consumer (with a unique consumer group id and setting the offset to earliest). Then I iterate over the consumer (poll method) to get all messages and stop when the consumer records become empty.\n\nBut I noticed that, when I start polling, the first few iterations return consumer records as empty and then it starts returning the actual records. Now this breaks my logic as our code thinks there are no records in the topic.\n\nI have tried few other ways (like using offsets number) but haven't been able to come up with any solution, apart from keeping another record somewhere which tells me how many messages there are in the topic which needs to be read before I stop.\n\nAny idea's please ?"
]
| [
"apache-kafka",
"kafka-consumer-api",
"spring-kafka"
]
|
[
"How to access other controllers methods in emberjs",
"Is there a way to access other controller's action methods from controller?\n\nI've tried something @get('controllers.user').stopEditing() like below but it doesn't seem to be working:\n\nuser_edit_controller.js.coffee\n\nApp.UserEditController = Ember.ObjectController.extend\n needs: ['user']\n title_options: [\"Mr\", \"Mrs\", \"Dr\", \"Miss\", \"Ms\"]\n\n startEditing: ->\n user = @get 'model'\n transaction = user.get('store').transaction()\n transaction.add user\n @transaction = transaction\n\n stopEditing: ->\n transaction = @transaction\n if(@transaction)\n @transaction.rollback()\n @transaction = undefined\n\n actions:\n save: ->\n @transaction.commit()\n @transaction = undefined\n @get('controllers.user').stopEditing()\n\n cancel: ->\n @get('controllers.user').stopEditing()\n\n\nuser_controller.js.coffee\n\nApp.UserController = Ember.ObjectController.extend\n isEditing: false\n needs: ['userEdit']\n\n actions:\n startEditing: ->\n userEditController = @get 'controllers.userEdit'\n userEditController.set 'model', @get 'model'\n userEditController.startEditing()\n @set 'isEditing', true\n\n stopEditing: ->\n userEditController = @get 'controllers.userEdit'\n userEditController.stopEditing()\n @set 'isEditing', false\n\n destroyRecord: ->\n if window.confirm \"Are you sure you want to delete this contact?\"\n @get('model').deleteRecord()\n @get('store').commit()\n\n # return to the main contacts listing page\n @get('target.router').transitionTo 'users.index'"
]
| [
"javascript",
"ember.js"
]
|
[
"java function to read a folder of files",
"I have a program that currently reads in a file, looks for keywords, and outputs the number of occurrences of the keywords. I need to write a function that reads in all the files and I need to insert this function in a spot so that the total number of occurrences is displayed. \n\nI am currently reading in 1 file like this\n\ntry (BufferedReader br = new BufferedReader(new FileReader(\"C:\\\\P4logs\\\\out.log.2012-12-26\")))\n {"
]
| [
"java",
"function",
"bufferedreader"
]
|
[
"How to pass a 1D array of 500 pointers to a function in C",
"The programm is compiling ok but once the user inputs something to the array it crashes. Any help will be appreciated :)\n\n#include <stdio.h>\n#include <stdlib.h>\n\nvoid Register(char *arr[],char arr2[]);\nint main() {\n char *Username[500];\n char table1[20];\n Register(Username,table1);\n return 0;\n} \nvoid Register(char *Username[],char table1[]){\n int i;\n for(i = 0; i < 500; i++){\n scanf(\"%s\",&table1);\n Username[i] = table1;\n printf(\"for i = %d username[%d] is %s\\n\\n\",i,i,Username[i]);\n }\n}"
]
| [
"c",
"arrays",
"memory-management",
"c-strings"
]
|
[
"How to quote this raw command in Ansible YAML?",
"I am using Ansible to manage the configurations of a bunch of Windows clients. For the record, Ansible playbooks (i.e. recipes) are written in YAML.\n\nI need to run this command on every client, and I could test it successfully in a Powershell prompt on a client machine:\n\n> CMD /C 'control intl.cpl,, /f:\"C:\\Temp\\intlsettings.xml\"'\n\n\n(note the single quotes, required because of the double quotes around the filename)\n\nNow I \"just\" need to write a YAML playbook and use the raw module from Ansible to send this command to a remote Powershell session. And this is where I am stuck. My command contains :, ' and \" symbols so I have no idea how to quote it properly.\n\nI have tried a million variations, with no success so far:\n\nCMD /C 'control intl.cpl,, /f:\"C:\\Temp\\intlsettings.xml\"'\n\"CMD /C 'control intl.cpl,, /f:\"C:\\\\Temp\\\\intlsettings.xml\"'\"\n\"CMD /C 'control intl.cpl,, /f:\\\"C:\\\\Temp\\\\intlsettings.xml\\\"'\"\n\"CMD /C 'control intl.cpl,, /f\\:\\\"C\\:\\\\Temp\\\\intlsettings.xml\\\"'\"\n\n\nFor information, the final playbook will look something like:\n\n---\n- name: Configure keyboard mappings\n hosts: windows\n\n tasks:\n - name: apply keyboard mappings config\n raw: CMD /C 'control intl.cpl,, /f:\"C:\\Temp\\intlsettings.xml\"'"
]
| [
"string",
"powershell",
"yaml",
"quoting"
]
|
[
"How to get attributes from multiple levels of XML doc using R script",
"I am looking for a way to use xpath to extract attributes from nodes and their children (potentially multiple levels down the hierarchy) into a table-like structure.\n\nBelow code shows an example document and the desired result.\n\nAll details are in the code below.\n\nrequire(XML)\n\n# Generating example file\nxmlstring <- \"<CATALOG>\n <CD title='Great hooks' id='1'>\n <ARTISTS>\n <ARTIST type='composer' name='Peter Pan' id='11'>\n <INFO age='118'/>\n </ARTIST>\n <ARTIST type='singer' name='Tinkerbelle' id='12'>\n <INFO age='118'/>\n </ARTIST>\n </ARTISTS>\n </CD>\n <CD title='The Planets' id='2'>\n <ARTISTS>\n <ARTIST type='composer' name='Clyde Tombaugh' id='21'>\n <INFO age='91'/>\n </ARTIST>\n <ARTIST type='singer' name='Johann Galle' id='22'>\n <INFO age='207'/>\n </ARTIST>\n <ARTIST type='singer' name='Urbain Le Verrier' id='23'>\n <INFO age='208'/>\n </ARTIST>\n </ARTISTS>\n </CD>\n <CD title='45 Minutes Silence' id='3'>\n <ARTISTS>\n <ARTIST type='composer' name='John Cale' id='31'>\n <INFO age='77'/>\n </ARTIST>\n </ARTISTS>\n </CD>\n</CATALOG>\"\n\nfile.name <- \"testxmlfile.xml\"\n\nwriteChar(xmlstring, file.name)\n\n# Reading example file using XML::xmlParse\ndoc <- xmlParse(file.name)\n\n# I need a data frame or similar table structure with columns CD.title, Singer.name\n# and Singer.age where 'Singer' is any artist with @type='singer'\n\n# I can get the CD titles like this:\nCD.titles <- xpathSApply(doc, \"/CATALOG/CD\", xmlGetAttr, \"title\")\n# Singer names like this:\nSinger.names <- xpathSApply(doc, \"/CATALOG/CD/ARTISTS/ARTIST[@type='singer']\", xmlGetAttr, \"name\")\n# Singer ages like this:\nSinger.ages <- xpathSApply(doc, \"/CATALOG/CD/ARTISTS/ARTIST[@type='singer']/INFO\", xmlGetAttr, \"age\")\n\n# But how do I put them all together, taking into account the number of singers\n# per CD is variable (and may be 0)?\n\n# I am not interested in CDs without singer, so if there is no singer either the\n# CD may be entirely omitted or Singer.name/Singer.age may be NA\n\n# Desired result:\n# CD.title | Singer.name | Singer.age\n# ===========================| ====================| ==========\n# Great hooks | Tinkerbelle | 118\n# The Planets | Johann Galle | 207\n# The Planets | Urbain Le Verrier | 208\n\n# Thanks in advance for suggestions.\n\n\nTotally unnecessary spam because I apparently can't post this without typing enough outside the code box regardless of the fact that it contains all the necessary details."
]
| [
"r",
"xml",
"xpath"
]
|
[
"select * FROM ALL_OBJECTS not showing me all packages but DBMS_METADATA.GET_DDL will show me the DDL for missing objects",
"I am writing a program that populates a series of drill down combo boxes to allow me to drill into objects of an oracle schema.\nThe combo box levels are:\n\nSCHEMA\nObject TYPE\nObject Name\n\nselect * FROM ALL_OBJECTS O WHERE O.OWNER = :SELECTED_SCHEMA and O.OBJECT_TYPE = :SELECTED_OBJECT_TYPE order by OBJECT_NAME\nWhen Packages is the selected OBJECT_TYPE I am not getting all of the packages that are in the selected schema. However, TOAD for Oracle IS displaying all of the objects when I connect to the database.\nGiven that I connected within my program using the same ID as I connected to TOAD, I would expect TROAD to be using my credentials when querying the system tables.\nWhat could TOAD be doing differently that might allow it to retrieve the full list of packages?\nWhen I connect using a privileged account that has write access (this is for prod), the above query does return all of the packages and when I examine the GRANTS for the PACKAGE I see that my privileged account does has been granted EXECUTE rights.\nI don't really understand why EXECUTE rights would need to be granted in order for me to be able to see that the package exists. In other vendor databases, I would expect there to be a privilege such as VIEW_SCHEMA that is granted to a user for an object. I would have expected d that I would have complete visibility to all objects in that schema. I belong to an APP_DBA_ROLE that has a lot of access associated.\nWould I be able to modify my query to target a different view that might return a complete list of package objects? If not, is there a minimal access level that I can request that would give me the ability to see this package without also having to be granted access to execute it, too?"
]
| [
"oracle"
]
|
[
"are there potential pitfalls to using static methods in a web application (.net)?",
"From the web app, calls are made to a web service that in turn makes calls to a few static helper classes for filtering and sorting data - trying to think ahead if I will have unexpected behavior with multiple users"
]
| [
"c#",
"asp.net",
"static-methods"
]
|
[
"Ignore New Page Before if following page only has 2 records",
"Here is my formula from Section3 Details > Details > Paging > New Page Before - The rowcount is the Item Description:\n\nIF {@RowCount} > 23 AND {@RowCount} < 45 THEN\n IF Remainder (RecordNumber, {@RowCount} - 2) = 0 THEN\n TRUE\n ELSE FALSE\n\nELSE IF {@RowCount} > 68 AND {@RowCount} < 87 THEN\n\n IF Remainder (RecordNumber, {@RowCount} - 2) = 0 THEN\n TRUE\n ELSE FALSE\n\nELSE IF {@RowCount} > 110 AND {@RowCount} < 131 THEN\n\n IF Remainder (RecordNumber, {@RowCount} - 2) = 0 THEN\n TRUE\n ELSE FALSE\n\n\n\n\n\n\nThe first picture has a white space below it. And I need the whole second page to look like the second image. (For example, I have 50 records. I want the last page to be like that, it has 2 remaining data)`. If the data has 2 records only, it should display all in the first page. How can I accomplish this?"
]
| [
"crystal-reports",
"sap"
]
|
[
"Automatically scroll to anchor at end of animation",
"I've created an 8 second animation (.oam) in Edge Animate for a website made with Adobe Muse. When the animation finishes I want the page to automatically scroll down to an anchor I've placed like it would if I clicked an object with a hyperlink.\n\nI've inserted a Trigger @ 8000 ms with the following code; \n\nwindow.open(\"#about\", \"_parent\")\n\nWhen I preview my website the animation works perfectly but at the end of the 8 seconds instead of scrolling down to the anchor, it reloads the entire page at the anchor instead. \n\nWhat is the correct code for the trigger? \n\nThanks"
]
| [
"javascript",
"animation",
"adobe-edge",
"muse"
]
|
[
"Simulating drag and drop with applescript",
"How can I simulate drag and drop with applescript? I'm creating a script that finds the newest image in the screenshot folder and drag and drops it to the slack window so it gets sent to the person I'm having a conversation with."
]
| [
"applescript"
]
|
[
"(31,16): error CS1525: Unexpected symbol `(', expecting `)', `,', `;', `[', or `='",
"The script I have is for to pause and unpause the gameobject . I have two of the same errors (31,16): error CS1525: Unexpected symbol (', expecting)', ,',;', [', or='\n\nI am just trying to pause and unpause the gameobject . Maybe pause and unpause more in my scene . I need the gameobject pause for a couple of seconds and unpause . Dont what to pause the gameobject by a key. Here is my script :\n\n using UnityEngine;\nusing System.Collections;\n\npublic class star : MonoBehaviour {\nGameObject[] pauseObjects;\n\n\n void Start () {\n pauseObjects = GameObject.FindGameObjectsWithTag(\"Player\");\n }\n\nvoid Pause(){\n StartCoroutine(waitToUnpause);\n}\n\nIENumerator waitToUnpause(){\n //do the thing to pause game\n Time.timeScale = 7f;//or some other method\n yield return new WaitForSeconds(7);///or any duration you want\n Time.timeScale = 1f;//or some other method\n}\n\nvoid pauseGameobject()\n\n{\n timeLeft -= Time.deltaTime;\nif(timeLeft < 0)\ngameObject.SetActive(false);\n{\n\nstart coroutine(\"wait\");\n\n}\n\n}\n\npublic ienumenator wait()\n\n{\n\ntime.timescale = 0;\n\nyield return new waitforsceonds(7);\n\ntime.timesale = 1;\n\n}\nvoid pauseGameobject()\n\n{\n\nif(timerleft < 0)\n\n{\n\nstart coroutine(\"wait\");\n\n}\n\n}\n\npublic ienumenator wait()\n\n{\n\ntime.timescale = 0;\n\nyield return new waitforsceonds(7);\n\ntime.timesale = 1;\n\n}\n\n}"
]
| [
"android",
"css",
"unity3d",
"compiler-errors",
"unityscript"
]
|
[
"How do I calculate the sine and cosine of a double in Java?",
"I'm trying to convert the sine of an angle from radians to degrees and I keep getting inaccurate numbers. My code looks like this:\n\npublic class PhysicsSolverAttempt2 {\n public static void main(String[] args) {\n double[] numbers = {60, 30, 0};\n double launchAngle = Double.parseDouble(numbers[0]);\n double iV = Double.parseDouble(numbers[1]);\n System.out.println(launchAngle);\n double iVV = iV * Math.toDegrees(Math.sin(launchAngle));\n System.out.println(Math.toDegrees(Math.sin(launchAngle)));\n }\n}\n\n\nWhen I use Math.sin(launchAngle), it gives me a perfect output in radians. However, when I convert the radians to degrees using the Math.toDegrees() function at the end, it gives me -17.464362139918286, though performing the same calculation with a calculator yields the number 0.86602540378. Am I using Math.toDegrees() incorrectly, or do I need to perform extra steps to get an accurate result?"
]
| [
"java",
"double",
"trigonometry",
"degrees"
]
|
[
"ATOM/apm: can't find module \"npm\"",
"In Windows 10: \n\n C:\\Users\\broven>apm\n\nmodule.js:340\n throw err;\n ^\nError: Cannot find module 'npm'\n at Function.Module._resolveFilename (module.js:338:15)\n at Function.Module._load (module.js:280:25)\n at Module.require (module.js:364:17)\n at require (module.js:380:17)\n at Object.<anonymous> (E:\\Program Files (x86)\\atom\\app-1.8.0\\resources\\app\\apm\\lib\\apm-cli.js:12:9)\n at Object.<anonymous> (E:\\Program Files (x86)\\atom\\app-1.8.0\\resources\\app\\apm\\lib\\apm-cli.js:237:4)\n at Module._compile (module.js:456:26)\n at Object.Module._extensions..js (module.js:474:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n\n\nError tell me that i don't have npm , but I insatll it,and up to date.\nwhat's the problem?\n\nC:\\Users\\broven>npm\n\nUsage: npm <command> \[email protected] D:\\Program Files\\nodejs\\node_modules\\npm"
]
| [
"node.js",
"windows",
"npm",
"atom-editor"
]
|
[
"Finding similarity between multiple images",
"I have a black-and-white shape form, like the ones presented below, and wish to compare it and find the closest match in a database of similar images. I looked into Perceptual Hashing but that doesn't seem to work for low-resolution and mono-coloured images.\n\n(1) (2) \n\nWhat other methods are applicable in order to make such comparisons?"
]
| [
"image",
"image-processing"
]
|
[
"Function metadata not getting refreshed after table changes",
"I am facing frequent issue while trying to fetch the data from functions which contains the latest data for a given join criteria instead of all historical data. Recently we added new columns to these tables based on business requirement but the functions are not getting updated as per the latest table changes. Is there any way to refresh the function metadata. In case of view we have sp_refreshview, do we have any such in functions as well. \n\nFor Ex: \n\nCREATE function [dbo].[Value](@Code varchar(15))\nreturns table\nreturn (\n select top 1 *\n from table with (nolock)\n where Code = @Code order by Date desc\n)\n\n\nNow the table has been modified to have a new column. But the function is not reflecting that value."
]
| [
"sql",
"sql-server-2008"
]
|
[
"Do I need to be in the iOS Developer Program to send my app builds through TestFlight?",
"A quick question:\n\nDo I need to buy an Apple Developer Program membership/certification ($99/yr) for testing via TestFlight?"
]
| [
"iphone",
"ios",
"ios4",
"testflight"
]
|
[
"SQLAlchemy and Elixir?",
"I have been using django ORM, it's nice and very easy, but this time I'm doing a desktop app and I found SQLAlchemy, but I'm not sure to use it with Elixir. What do you think? is it really useful?"
]
| [
"python",
"sqlalchemy",
"python-elixir"
]
|
[
"powershell invoke-restmethod multipart/form-data",
"I'm currently trying to upload a file to a Webserver by using a REST API. And as mentioned I'm using PowerShell for this. With curl this is no problem. The call looks like this:\n\ncurl -H \"Auth_token:\"$AUTH_TOKEN -H \"Content-Type:multipart/form-data\" -X POST -F appInfo='{\"name\": \"test\",\"description\": \"test\"}' -F uploadFile=@/test/test.test https://server/api/\n\n\nBut I'm completely helpless when it comes to exporting this to powershell with a Invoke-Restmethod command. As far as I searched it is not possible to use the Invoke-Restmethod for this. https://www.snip2code.com/Snippet/396726/PowerShell-V3-Multipart-formdata-example\nBut even with that Snipped I'm not smart enough to get this working since I don´t want to upload two files but instead one file and some arguments. \n\nI would be very thankful if someone could get me back on the track with this :o\nThanks!"
]
| [
"rest",
"powershell",
"curl"
]
|
[
"How do you find a parameterised overridden method with reflection?",
"Given a situation like the following:\n\ninterface A<T>{\n default void foo(T t){\n System.err.println(new Exception().getStackTrace()[0] + \" \" + t);\n }\n}\n\ninterface B<T extends SomeConcreteType> extends A<T>{\n @Override\n default void foo(T t){\n System.err.println(new Exception().getStackTrace()[0] + \" \" + t);\n }\n}\n\n\nI'm trying to use reflection to go from a B's foo method to A's foo method.\nGiven that the post erasure parameter types of the two methods are different, how can I do this?"
]
| [
"java",
"generics",
"reflection"
]
|
[
"custom class init issue",
"Hi I've made my own custom class:\n\nwith this init method:\n\n-(id)init:(NSString*) strFilename withImageData:(NSData*) objImageData withUploadTaskDelegate:(id<NSURLSessionTaskDelegate>) objUploadTaskDelegate\n{\n filename = strFilename;\n uploadTaskDelegate = objUploadTaskDelegate;\n imageData = objImageData;\n return self;\n}\n\n\nI've made sure that the .h file also have the definition of this init file:\n\n-(id)init:(NSString*) strFilename withImageData:(NSData*) objImageData withUploadTaskDelegate:(id<NSURLSessionTaskDelegate>) objUploadTaskDelegate;\n\n\nhowever when I try to use it like this:\n\nUploadQueueCellData *objTest =[UploadQueueCellData init:strImageName withImageData:objData withUploadTaskDelegate:objUploadDelegate];\n\n\nit gives this error: \n\n\n No known class method for selector\n 'init:withImageData:withUploadTaskDelegate:'\n\n\nthis is my 3th day trying to develop in objective c code so I'm sure I'm missing something but I do not seem to be able to spot what I'm doing wrong ?"
]
| [
"ios",
"objective-c"
]
|
[
"How does one configure DataGrip to connect to Redshift with SSL?",
"I am able to connect to Redshift with SSL through SQLWorkbench with the latest driver. When I try to connect using DataGrip and select \"Use SSL\" with the latest driver, there is a failure. \n\nHas anyone had issues with this? I have also tried adding query parameters to the URL after searching through other posts \n\n?ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory"
]
| [
"amazon-redshift",
"datagrip"
]
|
[
"Concatenating 2 bytes in one short in java",
"How can I concatenate 2 byte values into a short value in java?\n\nThis:\n\nbyte b1 = 0xAC;\nbyte b2 = 0xAD;\nshort pixelShort = (short) (b1<<8 | b2);\n\n\ndoes not work, as the result is 0xFFAD. Why is this?"
]
| [
"java"
]
|
[
"In iteration, need to store line in a variable",
"so, first of all my scenario: Have a file, my script reads that file, counts the number of lines and reads the content line by line.\n\nMy script:\n\n$lines = Get-Content C:\\RDS\\snaps.txt | Measure-Object -Line\n$line = $lines.Lines\nfor($i=1; $i -le ($line-1); $i++)\n{\n #Need to store a line in a variable\n}\n\n\nI need to be in this way:\nFor every \"i\" value which is less than or equal to ($line-1), I need to read the specific line.\n\nExample: if i=1, means first line, I need to read the first line and store it in a variable. if i=($line-1), means the line above the last line, need to store that specific line and store it in the same variable.\n\nHow can this be done? I can't predict how many lines it will be there in the file. What change do I need to do in my script for this? Any help would be really appreciated."
]
| [
"powershell"
]
|
[
"Rounding to different decimal places using a GUI output box",
"I know this is a simple task, but I think I'm just having trouble with the formatting. I can get the GUI input box to ask for a number with 8 decimal places, but for the output box I can't figure out how to round the number the user input to 5 and 3 decimal places. This is what I'm stuck on:\n\nimport javax.swing.JOptionPane;\n\npublic class Ch3Assignment6 {\n\n public static void main(String[] args) {\n\n String Decimal_Eight = JOptionPane.showInputDialog (\"Enter a decimal number with eight decimal places\"); \n\n\n JOptionPane.showMessageDialog (null, \n \"The number you entered is: \" + Decimal_Eight + \"\\n\" + \n \"The number rounded to 5 decimal places is: \" + String.format(\"%.5f\", Decimal_Eight) + \"\\n\" + \n \"The number rounded to 3 decimal places is: \" + String.format(\"%.3f\", Decimal_Eight));\n\n }\n\n}\n\n\nIt shows an error message/no output message box but i don't know how i'm entering the rounding part incorrectly. Thanks!"
]
| [
"java",
"user-interface",
"rounding"
]
|
[
"How do remote repositories in Maven work?",
"Just started learning Maven in 15 minutes ago! and have a silly question:\n\nIf we want to pull from a remote repo, are there TWO places in POM.XML that we need to change?\nMy understanding is that we should do two things:\n\n1: Define the remote repo location in REPOSITORIES tag and then,\n\n2: Define the specific dependency in Dependencies tag\n\nDid I understand it correct? Is it a good practice ?\n\nI was following these tutorials: http://www.mkyong.com/maven/how-do-download-from-remote-repository-maven/"
]
| [
"maven"
]
|
[
"How do I enlarge a graph a Masterpane using Zedgraph?",
"I would like, if I click on any graph, so that the selected chart increased or switched to a new window.\n\nI tried to use the code of this answer to the question How to select and enlarge a Masterpane in Zedgraph\n\nBut I get an error:\n\n//Zedgraph control \nvar zgc = Apprefs.Zedgraph;\n\n\nError 1 The name 'Apprefs' does not exist in the current context\n\nMore in FIG.\n\nI used ZedGraph chart."
]
| [
"c#",
"graph",
"zedgraph"
]
|
[
"Not able to create an array of buttons in javafx in controller",
"I am creating a grid of 4x4 buttons. I am trying to do this is in the controller. This is my code in initialize method.\n\n Button[][] gridButtons = new Button[4][4];\n for(int i=0; i<4; i++) {\n for (int j = 0; j<4; j++) {\n mainGrid.add(gridButtons[i][j], i, j);\n gridButtons[i][j].setText(\"1\");\n gridButtons[i][j].minWidth(34.0);\n gridButtons[i][j].setMnemonicParsing(false);\n gridButtons[i][j].prefHeight(38.0);\n gridButtons[i][j].prefWidth(41.0);\n gridButtons[i][j].setTextAlignment(TextAlignment.CENTER);\n }\n }\n\n\nThe above code throws a NullPointerException at mainGrid.add(gridButtons[i][j], i, j);. But when I try to do the following, it works.\n\n Button gridButtons = new Button();\n gridButtons.setText(\"1\");\n gridButtons.minWidth(34.0);\n gridButtons.setMnemonicParsing(false);\n gridButtons.prefHeight(38.0);\n gridButtons.prefWidth(41.0);\n gridButtons.setTextAlignment(TextAlignment.CENTER);\n mainGrid.add(gridButtons, 1, 1);\n\n\nI'm not knowing what exactly is causing this issue."
]
| [
"java",
"javafx",
"javafx-2"
]
|
[
"Do free hosted blogs/websites on Joomla.com get adds?",
"I am creating a free-hosted website on Joomla.com. This is similar to free blogs/websites on wordpress.com. However, on wordpress.com, wordpress inserts adds on free blogs. I am wondering if the same happens on Joomla.com?"
]
| [
"joomla"
]
|
[
"Type Parameter Constraint is a Class",
"I've noticed other developers using this technique, but it always confused me. I decided to investigate this morning and came across the following on MSDN (from http://msdn.microsoft.com/en-us/library/d5x73970(v=vs.100).aspx):\n\npublic class GenericList<T> where T : Employee\n{\n...\n}\n\n\nWhy would we want to use this method instead of replacing all instances of T with Employee in the class? To me, this seems like a win on maintainability. I can understand restricting to an interface as a means of including classes from different inheritance hierarchies, but inheritance already solves the problem above in a more obvious way, doesn't it?\n\nCould this be considered a mistake, or would it be a mistake to 'fix' code like this?"
]
| [
"c#",
"generics",
"inheritance",
"interface",
"covariance"
]
|
[
"DCC GARCH in R: Number of Observations",
"I am running a DCC GARCH model in R. The codes are attached below. \n\ndfm3dr<-data.frame(lnm3dr,lnreer)\n\nug_spec<-ugarchspec(mean.model = list(armaOrder=c(0,0)), variance.model = \nlist(model=\"sGARCH\",garchOrder=c(1,1)), distribution.model = \"sstd\")\nugm3dr<-ugarchfit(spec=ug_spec,data=dfm3dr$lnm3dr)\nugm3dreer<-ugarchfit(spec=ug_spec,data=dfm3dr$lnreer)\n\n\nuspec.m3dr<-multispec(replicate(2,ugarchspec(mean.model = \nlist(armaOrder=c(0,0)), variance.model = \nlist(model=\"sGARCH\",garchOrder=c(1,1)))))\nmultif.m3dr<-multifit(uspec.m3dr,dfm3dr)\n\nspecm3dr<-dccspec(uspec = uspec.m3dr, robust=TRUE, lag.criterion=\"SC\", \nmodel=\"DCC\",dccOrder = c(1,1),distribution = \"mvnorm\")\nfitm3dr<-dccfit(specm3dr,data=dfm3dr, solver=\"lbfgs\", fit.control = \nlist(eval.se=TRUE), fit=multif.m3dr)\n\ncovm3dr_1<-rcov(fitm3dr)\ncorm3dr_1<-rcor(fitm3dr)\ncor_m3dr__reer<-corm3dr_1[2,1,]\ncor_lnm3d__lnreer<-ts(data=cor_m3d__reer, start = 1994, frequency = 4,end = \n2017, deltat = 1/12)\n\nplot(cor_lnm3d__lnreer)\n\n\nThe codes are running perfectly for 200 observations. But when I run them for less than 100 observations, I face the following errors\n\n ugm3dr<-ugarchfit(spec=ug_spec,data=dfm3dr$lnm3dr)\n **Warning message:\n In .sgarchfit(spec = spec, data = data, out.sample = out.sample, : \n ugarchfit-->waring: using less than 100 data\n points for estimation**\n\n\nWarning messages:\n 1: In .sgarchfit(spec = spec, data = data, out.sample = out.sample, : \nugarchfit-->waring: using less than 100 data\n points for estimation\n\n2: In .sgarchfit(spec = spec, data = data, out.sample = out.sample, : \nugarchfit-->waring: using less than 100 data\npoints for estimation\n\n\nError in .dccfit(spec = spec, data = data, out.sample = out.sample, solver = solver, : \n\ndccfit-->error: function requires at least 100 data\n points to run\n\nI would like to know how can I tackle this issue of limited availability of data points. \nThanks in advance,\n\nPrashant"
]
| [
"r"
]
|
[
"How to set SimpleMembershipProvider to require unique email?",
"I started a new MVC 4 application using VS 2012 and I noticed it is recommending the use of SimpleMembershipProvider.\n\nI like the idea and all the goodies of the WebSecurity class (which helps a lot).\n\nI'd like to be able to set the RequiresUniqueEmail property to true the documentation doesn't have a suggestion on how to accomplish that."
]
| [
"asp.net-mvc",
"asp.net-membership"
]
|
[
"Sql bulk copy memory issue",
"We are using SqlBulk Copy class in C#. To insert Bulk data in sql. We have a table with 10 million records in it. \n\nWe are inserting data in a batch of 10,000 in a loop\n\nWe are facing physical memory issue.The memory gets increased and do not get reduced. \n\nBelow is our code . How we can release memory when sql bulk copy is used or is there any another way to do bulk insert.\n\nusing (System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(SQlConn,SqlBulkCopyOptions.TableLock,null))\n{\n //bulkCopy = new System.Data.SqlClient.SqlBulkCopy(SQlConn);\n bulkCopy.DestinationTableName = DestinationTable;\n bulkCopy.BulkCopyTimeout = 0;\n bulkCopy.BatchSize = dt1.Rows.Count;\n Logger.Log(\"DATATABLE FINAL :\" + dt1.Rows.Count.ToString(), Logger.LogType.Info);\n if (SQlConn.State == ConnectionState.Closed || SQlConn.State == ConnectionState.Broken)\n SQlConn.Open();\n bulkCopy.WriteToServer(dt1); //DataTable\n SQlConn.Close();\n SQlConn.Dispose();\n bulkCopy.Close();\n if (bulkCopy != null)\n {\n ((IDisposable)bulkCopy).Dispose();\n } \n}\n\n\nHere updating the complete code.\n\ntry\n {\n\n using (SqlConnection SQlConn = new SqlConnection(Common.SQLConnectionString))\n {\n\n\n DataTable dt1 = FillEmptyDateFields(dtDestination);\n\n //SqlTableCreator ObjTbl = new SqlTableCreator(SQlConn);\n\n //ObjTbl.DestinationTableName = DestinationTable;\n using (System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(SQlConn,SqlBulkCopyOptions.TableLock,null))\n {\n\n //bulkCopy = new System.Data.SqlClient.SqlBulkCopy(SQlConn);\n bulkCopy.DestinationTableName = DestinationTable;\n bulkCopy.BulkCopyTimeout = 0;\n bulkCopy.BatchSize = dt1.Rows.Count;\n Logger.Log(\"DATATABLE FINAL :\" + dt1.Rows.Count.ToString(), Logger.LogType.Info);\n if (SQlConn.State == ConnectionState.Closed || SQlConn.State == ConnectionState.Broken)\n SQlConn.Open();\n bulkCopy.WriteToServer(dt1);\n SQlConn.Close();\n SQlConn.Dispose();\n bulkCopy.Close();\n if (bulkCopy != null)\n {\n ((IDisposable)bulkCopy).Dispose();\n } \n }\n\n }\n\n dtDestination.Dispose();\n System.GC.Collect();\n dtDestination = null;\n }\n catch (Exception ex)\n {\n Logger.Log(ex, Logger.LogType.Error);\n throw ex;\n\n }"
]
| [
"c#",
"sql",
"sql-server"
]
|
[
"What's the difference between ClassLoader.load(name) and Class.forName(name)",
"Possible Duplicate:\n Difference betweeen Loading a class using ClassLoader and Class.forName \n\n\n\n\nAFAIK, two ways are provided in java to init a class from its name.\n\n\nClass\npublic static Class forName(String\nclassName) throws\nClassNotFoundException\npublic static Class forName(String\nname, boolean initialize, ClassLoader\nloader) throws ClassNotFoundException\nClassLoader:\n\npublic Class loadClass(String\nname) throws ClassNotFoundException {\nreturn loadClass(name, false);\n }\n\n\nThe known thing is in forName method, we can specify the flag of initialize to be false ,this will skip some static things to be initialized for this class. But what's else? \nAnd how should I use them correctly? \n\nIt's better you can show some good examples.\n\nThanks!\n\nUPDATE:\n\nAfter raised question,I made some simple classLoader test.\n\nClassLoader cls = ClassLoader.getSystemClassLoader(); \n Class someClass = cls.loadClass(\"Test\"); \n Class someClass0= Class.forName(\"Test\"); \n Class someClass1= Class.forName(\"Test\",false,cls);\n\n\n URL[] urls = new URL[] {new File(\"bin/\").toURL()}; \n ClassLoader cls2 = new URLClassLoader(urls, null); \n Class someClass2 = cls2.loadClass(\"Test\"); \n\n ClassLoader cls3 = new URLClassLoader(urls, cls); \n Class someClass3 = cls3.loadClass(\"Test\"); \n\n System.out.println(someClass.equals(someClass0)); \n System.out.println(someClass.equals(someClass1));\n System.out.println(someClass.equals(someClass2)); \n System.out.println(someClass.equals(someClass3));\n\n\nThe result is \n\ntrue,true,false,true\n\nUPDATE\n\nHere is my answer about \nDifference between loadClass(String name) and loadClass(String name, boolean resolve)"
]
| [
"java",
"classloader"
]
|
[
"How to restart ADB manually from Android Studio",
"I previously developped Android apps on Android Studio . Everything works fine.\n\nI work on real device, and Android Studio recognize it without issue.\n\nSuddenly when I exit android studio and disconnect and reconnect my device, it doesn't recognize my device anymore, I have to exit and restart Android Studio.\n\nI can't find a way to \"Reset adb\" like Android Studio.\n\nI follow the below instruction(Tools->Android->Enable ADB Integration) and enabled ADB,but still below error occurred.\n\nError:-\n\n\n\nI using windows system.\n\nAny help great appreciation."
]
| [
"android",
"android-studio"
]
|
[
"Created dynamically combobox not working",
"I create combobox dynamically using javascript.\n\nHere the code(or here!!!):\n\nfunction CreateComboBox() {\n\n var selectElem = document.createElement('select'); \n var optionElem0 = document.createElement('option');\n var optionElem1 = document.createElement('option');\n var optionElem2 = document.createElement('option');\n var optionElem3 = document.createElement('option');\n var optionElem4 = document.createElement('option');\n\n selectElem.onchange = 'myFunction()';\n\n optionElem0.value=10;\n optionElem0.innerHTML=\"10\";\n\n optionElem1.value=15;\n optionElem1.innerHTML=\"15\";\n\n optionElem2.value=20;\n optionElem2.innerHTML=\"20\";\n\n optionElem3.value=25;\n optionElem3.innerHTML=\"25\";\n\n optionElem4.value=50;\n optionElem4.innerHTML=\"50\";\n\n selectElem.appendChild(optionElem0);\n selectElem.appendChild(optionElem1);\n selectElem.appendChild(optionElem2);\n selectElem.appendChild(optionElem3);\n selectElem.appendChild(optionElem4);\n\n document.getElementById('ComboArea').appendChild(selectElem); \n}\n\nfunction myFunction() {alert('HELLO!');}\n\n\nAfter combobox is created if I select a element from the created combo I want the myFunction()\nto be fired.But it not work, the function myFunction() not fired any idea why?What I'm doing wrong?"
]
| [
"javascript"
]
|
[
"Python Requests get cookies values after authentication",
"in Python Requests \nHow to get cookies values after authentication, the server must gave you a valid cookies after the authentication, in my case I can't see the cookies, even if I tried to look in .cookies or .headers"
]
| [
"python",
"cookies",
"python-requests"
]
|
[
"Add a list of empty columns with specific names to a list of df in R",
"I have a list of 10 df in R with 2 columns and I want to add 5 empty columns to each df in the list. The columns have specific names. I imported the df as a list using a for loop.\ntemp_file = list.files(pattern="*.csv")\nmy_data <- list()\nfor (i in seq_along(temp_file)) {\nmy_data[[i]] <- read.csv(file = temp_file[i])}\n\nSo now I have a list of df with 2 columns as below\n\n\n\n\ncol_A\ncol_B\n\n\n\n\n10\nabc\n\n\n16\n78\n\n\nxyz\n295\n\n\n\n\nI have a string called new_columns\nnew_columns <- c("col_C", "col_D", "col_E", "col_xg", "col_W93")\nI want to add these 5 empty columns to all the 10 data frames in the list my_data\nI tried a for loop and rbind but nothing seems to work"
]
| [
"r"
]
|
[
"Swift arc4random_uniform(max) in Linux",
"I'm working with Swift in Ubuntu, and I am getting an error that arc4random is an unresolved identifier. More information on this known bug here. Basically, the function only exists in BSD distros. I've tried module mapping header files, apt-getting packages, and I get more and more errors, which is not worth pursuing since this one function is not used very often.\n\nAre there any functions to get pseudo random numbers with an upper-bound parameter that is compatible with Swift in Linux?"
]
| [
"swift",
"swift3",
"ubuntu-16.04"
]
|
[
"how to get POST values in perl",
"I am trying to customize a script and need to get a POST value from a form using perl. \nI have no background of perl but this is a fairly simple thing so I guess it should not be hard.\n\nThis is the php version of the code I would like to have in PERL:\n\n<?php\n$download = ($_POST['dl']) ? '1' : '0';\n?>\n\n\nI know this may not be at all related to the PERL version but it could help I guess clarifying what exactly I am looking to do."
]
| [
"perl",
"cgi"
]
|
[
"how to iterate through an image array with 3 images?",
"how to iterate through an image array with 3 images?. The loop should be continuous (i.e. image1, image2, image3,image1, image2,image3) over and over non-stop.\n\npublic int currentimageindex = 0;\nprivate int[] imagesArray = {R.drawable.alpha_c, R.drawable.alpha_b, R.drawable.alpha_a}; \npublic void Score_one(){\n final ImageView imageView = (ImageView)findViewById(R.id.image_c);\n imageView.setImageResource(R.drawable.alpha_c);\n imageView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if ((imagesArray.length) > currentimageindex) {\n imageView.setImageResource(imagesArray[currentimageindex]);\n currentimageindex++;\n\n }\n }\n });\n\n}"
]
| [
"android",
"arrays",
"imageview"
]
|
[
"Strange Regex Capture Group behavior returning \"or\" pipes into result",
"I am trying to make a capture group to find/replace suffixes.\n\nPlease see the example here: \n\nhttps://www.myregextester.com/?r=b23e74dc \n\nand my summary below:\n\nRegex:\n\n(\\b(.*?)(logical|logic))\n\n\nRequested Ouput:\n\n\n0=\\0\n1=\\1\n2=\\2\n\n\nhowever the output of the capture groups I test return the \"|\" into the result with it seems some redundancy\n\nOutput:\n\n\n0=Meteorologic\n1=Meteorologic\n2=Meteoro0=|Meteorological\n1=|Meteorological\n2=|Meteoro\n\n\nClearly I have introduced some error into the regex since I do NOT want the \"|\" in the output but I am unclear what it could be."
]
| [
"regex",
"regex-group"
]
|
[
"Audio/Video live streaming between two browsers, which technologies?",
"I'm searching for the best open source technologies to use to implement a bidirectional audio/video communication between two browsers.\nFor now I have unearthed these tracks:\n\n\nWebRTC W3C spec and an Ericsson's implementation\nRed5 and the BigBlueButton implementation as an example\nCumulus A Red5 implementation of Cirrus\nHTML5 and his many new features (but not before 2014-2015 aparently)\nMaybe some Jabber/Speex kind of implementation that I'm missing\n\n\nIs there something I'm missing ?\nWhat can be the best solution to use ?\n\nAlso (to be more precise), I'd like to implement this feature in my application developped using Django/Python."
]
| [
"javascript",
"python",
"html",
"open-source",
"streaming"
]
|
[
"Extjs notification popup with Sencha Architect",
"I want to create a notification drop down menu like the one on Facebook. I'm getting data using signalR. \n\nFor the design, I couldn't find a perfect control. I tried using menu dropdown but it does not look good. Can anyone suggest or give me a sample code for notification drop down using Sencha Architect?\n\nI want it to look similar to this:"
]
| [
"extjs",
"notifications",
"popup",
"sencha-architect"
]
|
[
"Collection as a metaphor for real world containers",
"I find modeling physical containers using collections very intuitive. I override/delegate add methods with added capacity constraints based on physical attributes such as volume of added elements, sort based on physical attributes, locate elements by using maps of position to element and so on.\n\nHowever, when I read the documentation of collection classes, I get the impression that it's not the intended use, that it's just a mathematical construct and a bounded queue is just meant to be constrained by the number of elements and so forth.\n\nIndeed I think that I unless I'm able to model this collection coherently, I should perhaps not expose this class as a collection but only delegate to it internally. Opinions?"
]
| [
"java",
"collections",
"dns",
"data-modeling"
]
|
[
"Detect Back Button in Navigation Guards of Vue-Router",
"How the route is changed, matters for my case.\nSo, I want to catch when the route is changed by a back button of browser or gsm.\n\nThis is what I have:\n\nrouter.beforeEach((to, from, next) => {\n if ( /* IsItABackButton && */ from.meta.someLogica) {\n next(false) \n return ''\n }\n next()\n})\n\n\nIs there some built-in solutions that I can use instead of IsItABackButton comment? Vue-router itself hasn't I guess but any workaround could also work here. Or would there be another way preferred to recognize it?"
]
| [
"javascript",
"cordova",
"vue.js",
"vuejs2",
"vue-router"
]
|
[
"Advice about inversion of large sparse matrices",
"Just got a Windows box set up with two 64 bit Intel Xeon X5680 3.33 GHz processors (6 cores each) and 12 GB of RAM. I've been using SAS on some large data sets, but it's just too slow, so I want to set up R to do parallel processing. I want to be able to carry out matrix operations, e.g., multiplication and inversion. Most of my data are not huge, 3-4 GB range, but one file is around 50 GB. It's been a while since I used R, so I looked around on the web, including the CRAN HPC, to see what was available. I think a foreach loop and the bigmemory package will be applicable. I came across this post: Is there a package for parallel matrix inversion in R that had some interesting suggestions. I was wondering if anyone has experience with the HIPLAR packages. Looks like hiparlm adds functionality to the matrix package and hiplarb add new functions altogether. Which of these would be recommended for my application? Furthermore, there is a reference to the PLASMA library. Is this of any help? My matrices have a lot of zeros, so I think they could be considered sparse. I didn't see any examples of how to pass data fro R to PLASMA, and looking at the PLASMA docs, it says it does not support sparse matrices, so I'm thinking that I don't need this library. Am I on the right track here? Any suggestions on other approaches?\n\nEDIT: It looks like HIPLAR and package pbdr will not be helpful. I'm leaning more toward bigmemory, although it looks like I/O may be a problem: http://files.meetup.com/1781511/bigmemoryRandLinearAlgebra_BryanLewis.pdf. This article talks about a package vam for virtual associative matrices, but it must be proprietary. Would package ff be of any help here? My R skills are just not current enough to know what direction to pursue. Pretty sure I can read this using bigmemory, but not sure the processing will be very fast."
]
| [
"r",
"matrix"
]
|
[
"How do I import PEAK's PCAN-Basic dll functions into my java program?",
"I am currently making a program that will interface CAN device using the PCAN-Basic API. I am working in Eclipse Oxygen and have included both PCANBasic.dll and PCANBasi_JNI.dll in my build path libraries, I have even followed these instructions from the developers, but with no consequence.\nI am pretty well versed in Java, but have never really worked with native interfaces like this and I cannot seem to import the API correctly.\nHere is my existing code:\npackage application;\n\nimport peak.can.basic.*;\n\npublic class CanInterface {\n static {\n System.loadLibrary("PCANBasic_JNI");\n }\n\n public CanInterface() {\n PCANBasic can = new PCANBasic();\n can.initializeAPI();\n }\n}\n\nI get these basic errors:\nLine 3: The import peak cannot be resolved.\nLine 11: PCANBasic cannot be resolves to a type.\nAny help would be appreciated. Let me know if I can give you anything else."
]
| [
"java",
"dll",
"import",
"java-native-interface"
]
|
[
"Response not added to the DOM structure after calling rails helper method render in the controller",
"So I'm displaying some details that I require to be rendered inside a template once the user clicks on a link like this one -\n\n<%= link_to \"show user\", show_user_path(user.id), method: :get, remote: true %>\n\nMy controller looks like this -\n\ndef show\n @user = User.find(params[:id])\n render :partial => \"userprofile\", :locals => { :user => @user }\nend\n\n\nAfter clicking on the link the request works just fine. I obtain a response of the template code as shown in the Chrome debugging tool's Network Tab and there are no errors in the console.\n\nThe HTML of the response is not appended to the DOM structure of the page, so I am unable to view the details sent. Please, help me I'm still new to the RoR framework.\nThanks!!!\n\nEdit - Partial File: userprofile.html.erb\n\n<h1><%= user.name %></h1>\n<p><%= user.bio %></p>\n\n\nThe fields are complete and no errors were thrown by the server. It returned -\n\nRendered _userprofile.html.erb <3.0ms>\nCompleted 200 OK in 18ms <Views: 13ms | ActiveRecord: 1.0ms>"
]
| [
"ruby-on-rails",
"ruby",
"ajax",
"ruby-on-rails-4"
]
|
[
"Need to break down a IP subnet",
"I am trying to write a script which breaks down subnets larger(not greater than /16) than /24 to a /24 subnet.\nEg : 10.10.10.0/23 should give me 10.10.10.0/24 and 10.10.11.0/24\n\nMy logic is to first scan for the CIDR mask. if smaller than 24, then subtract that from 24 and that number(lets say x) gives the total number of /24s and then 1 to third octet of the IP x times and /24.\n\neg: 10.10.8.0/22 \n\nif 22 < 24 \nx = 24-22 = 2\ntotal # of /24s = 2^x = 4\nSo output :\n10.10.8.0/24\n10.10.9.0/24 \n10.10.10.0/24\n10.10.11.0/24\n\n\nI am not sure how to code/modify the string for the third octet only and add 1 to the third octet only. \n\nI am thinking of creating a list of all the third octet values and re constructing the IPs. But if there is a simpler way out there, that would help me a lot !! \n\nThanks !"
]
| [
"python",
"python-2.x",
"netmask"
]
|
[
"RealmRecyclerViewAdapter 2.0.0 autoUpdate",
"I don't want to [Added fine grained notification support to RealmRecyclerViewAdapter.] How to do it ?\n\nI used onBindViewHolder(DataViewHolder holder, int position)\n\nposition --- > Serial number\n\nnot work."
]
| [
"realm"
]
|
[
"Changing a Dataset for a visual in AWS Quick Sight",
"I am new to Quicksight and trying to change the dataset for a cloned visual.\nI have created one analysis in AWS Quicksight which contains 6 different datasets from the same Datasource. See below:\n\nThere are two tabs (report 1 / report 2) in the analysis. I have cloned the below visual with Dataset: "Arora Waterfalls Website..." from Report 2 to Report 1.\n\nBut when I try to change the dataset from "Arora Waterfalls Website..." to "Arora All Webinar..." for the cloned visual in Report 1, the visual gets unselected and when I click on it shows the same dataset again: "Arora - Waterfalls Website...":\n\n\nTo conclude, is there any way that we can change the dataset for a cloned visual in QuickSight?"
]
| [
"dataset",
"data-visualization",
"bar-chart",
"analysis",
"amazon-quicksight"
]
|
[
"ember 'if' tag causes elements to dissapear",
"I have a view template 'person' defined as: \n\n....\n{{input type=\"checkbox\" checked=isEditing}}\n<table><tbody>\n {{#if 'isEditing'}}\n <tr><td><strong>Id</strong></td>{{id}}</td></tr>\n <tr><td><strong>number</strong></td><td>{{repNumber}}</td></tr>\n <tr><td><strong>First Name</strong></td><td>{{firstName}}</td></tr>\n <tr><td><strong>Middle Name</strong></td><td>{{middleName}}</td></tr>\n <tr><td><strong>Last Name</strong></td><td>{{lastName}}</td></tr>\n <tr><td><strong>alias 1</strong></td><td>{{alias1}}</td></tr>\n <tr><td><strong>alias 2</strong></td><td>{{alias2}}</td></tr>\n {{else}}\n <tr><td><strong>Id</strong></td>{{id}}</td></tr>\n <tr><td><strong>number</strong></td><td>{{repNumber}}</td></tr>\n <tr><td><strong>First Name</strong></td><td>{{input type=\"text\" value=firstName</td></tr>\n <!-- input counterparts etc -->\n {{/if}}\n</tbody></table>\n....\n\n\nAnd a PersonController defined as such:\n\nApp.Editable = Em.Mixin.create({\n isEditing: false,\n actions: {\n edit: function() {\n this.toggleProperty('isEditing');\n }\n }\n});\n\nApp.PersonController = Em.ObjectController.extend(SS7.Editable);\n\n\nThe route is defined like so:\n\nApp.Router.map(function(){\n ...\n this.resource('person', { path: '/person/:person_id'}, function(){});\n});\n\n\nNow every time I first toggle the isEditing value using the checkbox, all of my elements suddenly disappear off the screen. The Ember inspector shows that the viewTree is currently on the person route with the PersonController and the model contains the correct person. however i can now no longer see any of the two outputs (tr,tds) until i hard refresh the page.\n\nCan anyone help to explain this behaviour. I'm unsure how this could be happening."
]
| [
"ember.js",
"handlebars.js"
]
|
[
"Sharing variables across multi level scopes in Tensorflow",
"Currently I am building a couple of neural networks in a scope and I want to access those networks from another scope. \n\nI have tried passing the scopes but as mentioned in few other answers on stack overflow but none of that works. For example \n\ndef mlp_model(input, num_outputs, scope, reuse=False, num_units=64, rnn_cell=None):\n # This model takes as input an observation and returns values of all actions\n with tf.variable_scope(scope, reuse=reuse):\n out = input\n out = layers.dense(out, units=num_units, activation=tf.nn.relu)\n out = layers.dense(out, units=num_units, activation=tf.nn.relu)\n out = layers.dense(out, units=num_outputs, activation=None)\n return out\n\ninput_placeholder = tf.placeholder(tf.float32, shape=(None, 64), name=\"input\")\n\nwith tf.variable_scope(\"agent_0\") as agent_scope:\n q_func= mlp_model(input_placeholder, 2, \"q_func\", num_units=64)\n\nwith tf.variable_scope(\"agent_1\"):\n with tf.variable_scope(agent_scope, reuse=True):\n q_func_2=mlp_model(input_placeholder, 2, \"q_func\", num_units=64, reuse=True)\n\n\n\nwhen I see the name of q_func it says \"agent_0/q_func/dense_2/BiasAdd:0\"\nand when I see the name of q_func_2 it says \"agent_1/agent_0/q_func/dense_2/BiasAdd:0\"\n\nI want to figure out how to do q_func == q_func_2"
]
| [
"python",
"tensorflow"
]
|
[
"Post a message to friends inbox in facebook",
"How can i post a message to friends inbox in facebook. I know Facebook does not permit you to send messages to a user's inbox. As a result, there is a read_messages permission, but some application provide a functionality to invite friend, this invitaton send in friends inbox and notification email also send in frinds email ID, so have any possibility to send message in friend inbox on facebook.\n\nThanks"
]
| [
"facebook",
"api"
]
|
[
"Need to pass multiple (20+) parameters in a Java method. Any efficient way of doing this?",
"I have multiple methods in a Java class where every method has 20+ parameters. I will create an object for this class in another class and call each and every method. Typically I'm using the POM (Page Object Model) in Selenium Java.\nSo in every Page object class, there are multiple(20+) parameters in every method, which I will call in the Test Class.\n\nPage Object Class :\n\npublic void enterShipInfo(String IMO,String Vstat,String Vcode,String Vname,\n String Vtype,String Officialno,String Buildyr,String Shipyard,String Hullno,String Layingdate,\n String Launcheddate,String Deliverdate,String Reportinclude,String Portregistry,String VFlag,\n String Vstatus,String Classification,String Classid,String Classnotation,String PI,String HM,\n String Regowner,String Shipmanager,String Comoperator,String Callsign,String SSR,String Factor,\n String ELOG,String Vcomments,String VsisIMO,String Chartertype,String Showonweb){ \n\n}\n\n.... Other Methods with similar long list of parameters\n\n\nThen in Test Class, again I'm creating parameters for these:\n\npublic class VesTest {\n\n@Test(dataProvider=\"Ves\",priority=1)\npublic void createVesTest(String IMO,String Vstat,String Vcode,String Vname,\n String Vtype,String Officialno,String Buildyr,String Shipyard,String Hullno,String Layingdate,\n String Launcheddate,String Deliverdate,String Reportinclude,String Portregistry,String VFlag,\n String Vstatus,String Classification,String Classid,String Classnotation,String PI,String HM,\n String Regowner,String Shipmanager,String Comoperator,String Callsign,String SSR,String Factor,\n String ELOG,String Vcomments,String VsisIMO,String Chartertype,String Showonweb \n\nMdr_Vessel obj_Mdr_Vessel = page(Mdr_Vessel.class);\n\n obj_Mdr_Vessel.clickSubmenu();\n.....\n\n}\n\n\nAny efficient way to reduce typing the parameters again in Test Class???\nI don't want to break the method into multiple methods. So please suggest me a way of passing parameters in an efficient way"
]
| [
"java",
"selenium",
"automated-tests",
"selenide"
]
|
[
"inline-block displays centered in firefox",
"I have a h2 and h3 elements that I want to display as inline-block. Here is the markup:\n\n<div id=\"content\" class=\"content-width\">\n <h2 class=\"headline\"> My Headline </h2>\n <h3 class=\"subheadline\"> My Subheadline </h3>\n <table id=\"actions\">\n ... some table content\n </table>\n <div> more content... </div>\n</div>\n\n\nAnd here is the css:\n\ndiv.content-width {\n width: 90%;\n margin: 0 auto;\n min-width: 900px;\n}\n\nh2.headline {\n margin: 30px 0 0 0;\n padding: 0;\n display: inline-block;\n font-size: 30px;\n}\n\nh3.subheadline {\n padding: 30px 0 0 0;\n display: inline-block;\n font-size: 16px;\n margin: 0 0 0 8px;\n color: #b3b3b3;\n}\n\ntable#actions {\n float: right;\n padding: 0;\n margin: 34px 0 0 0;\n}\n\n\nI thought this would display the h2 and h3 to the left, instead, the h2 is placed right in the center, h3 is next to it and the table floats under both h2 and h3 elements, as if both h2 and h3 were a block. This displays as I expect it in chrome."
]
| [
"html",
"css"
]
|
[
"what is the less.js complete event callback?",
"I'm building a simple web application that needs to compile a LESS file into CSS file on the fly. \nI want to call few javascript functions after less.js complete the render of style.less file.\nSearched following code in a thread but nothing working for me.\n\n<link rel=\"stylesheet/less\" type=\"text/css\" href=\"less/style.less\">\n<script type=\"text/javascript\" src=\"js/less.min.js\"></script>\n<script>\nless.hasFinished.then(\n function() {\n console.log('completed');\n }\n);\n</script>\n\n\nAlso tried few other things:\n\n<link rel=\"stylesheet/less\" type=\"text/css\" href=\"less/style.less\">\n<script type=\"text/javascript\" src=\"js/less.min.js\"></script>\n<script>\nless = {\n postProcessor: function(css) {\n console.log('complete');\n }\n};\n</script>\n\n\nIs there any less.onComplete() callback function or something similar??"
]
| [
"javascript",
"less.js"
]
|
[
"Is there a way to set/Change CMIS repository's capabilities?",
"I am using CMIS services for accessing a document repository using JAVA. \nI would like to know, if there is a way in which I can change the capabilities of the repo? Example, I would like to change the Query Capabilities from \"MetadataOnly\" to \"BothCombined\". How is this possible programatically?\nThere are no setters for these. There is only one getRepositoyCapabilities()."
]
| [
"java",
"apache",
"cmis",
"document-repository"
]
|
[
"how do I break infinite while loop with user input",
"I'm very new to Python. \n\nI made a math program that keeps generating a new math problem every time you get the last one right. however I don't know how to exit/break the while True loop and switch from addition to subtraction. \n\nimport random\n\nwhile True:\n\n question = input(\"press 1 for addition, press 2 for subtraction.\")\n if question == \"1\":\n print(\"Try your skill at these problems.\")\n number1 = random.randint(0, 9)\n number2 = random.randint(0, 9)\n\n while True:\n print(number1, \"+\", number2, \"=\")\n number3 = number1+number2\n answer = int(input())\n if answer == number3:\n print(\"Great Job, Try this one.\")\n number1 = random.randint(0, 9)\n number2 = random.randint(0, 9)\n else:\n print(\"Have another go\")\n #I want to push space to break this while loop\n #and be able to switch to subtraction problems \n if question == \"2\":\n print(\"Try your skill at these problems.\")\n number1 = random.randint(0, 9)\n number2 = random.randint(0, 9)\n\n while True:\n print(number1, \"-\", number2, \"=\")\n number3 = number1-number2\n answer = int(input())\n if answer == number3:\n print(\"Great Job, Try this one.\")\n number1 = random.randint(0, 9)\n number2 = random.randint(0, 9)\n else:\n print(\"Have another go\")\n #I want to push space to break this while loop\n #and be able to switch to addition problems\n\n\nhow do I specify a user input (e.g. space bar) to brake the while True: loop. I've looked at other answers posted to similar questions but when I try them they all stop my code from generating more than a set number of problems. \n\nIs there a way to do this. or do I need to find a way to run this math game without a while True loop?"
]
| [
"python-3.x",
"while-loop",
"infinite-loop"
]
|
[
"batch file to open tabs with some time difference in between them",
"I've written a batch file that opens multiple tabs at once, however, just because of running issues and just because I'm curious to see how it can run faster, I'd like to try out having the files open one by one on their own with maybe a 15 sec difference between them. How can I do this? Using sleep1 maybe? \n\n@echo off\nstart chrome \"http://someurl.com/\"\nstart chrome \"http://someurl.com/\"\netc..."
]
| [
"batch-file"
]
|
[
"Command line \"no matches found: connexion[swagger-ui]\"",
"Able to install connexion, but cannot install swagger-ui. How can I fix this?"
]
| [
"swagger-ui"
]
|
[
"String replacing with regexp",
"I have a regexp that sets $1 : it corresponds to the text between ( and ) in : the_beginning(.*)the_end. \n\nI want to replace the value corresponding to $1 with somethingelse, not all the regexp.\n\nIn real context :\n\nmy_string contains :\n\n/* MyKey */ = { [code_missing]; MY_VALUE = \"123456789\"; [code_missing]; }\n\nI want to replace \"123456789\" ( with \"987654321\" for example ).\nAnd this is my regexp : \n\n\"/\\\\* MyKey \\\\*/ = {[^}]*MY_VALUE = \\\"(.*)\\\";\""
]
| [
"ruby",
"regex",
"replace"
]
|
[
"Google, Facebook Sign in support with Flutter",
"I am new to Flutter, Is there any way that i can provide Sign in using GOOGLE/FACEBOOK with Flutter.\n\nThanks"
]
| [
"facebook",
"dart",
"google-signin",
"flutter"
]
|
[
"Confused at updating content",
"I use CakePHP 1.3.10, jQuery for the JsHelper and jQueryUI. On my page there's a link called \"Login\" and when a user clicks on it, a dialog opens with the loginform inside. Everything works fine but the CakePHP part by submitting the form is totally screwed.\n\nI have two login templates \"login.ctp\" and \"ajax_login.ctp\". So when the dialog opens the first time, \"Login.ctp\" is shown and by submitting wrong login data, \"ajax_login.ctp\" comes as \"update\". Everything works fine, but when I submit the form in \"ajax_login.ctp\" - it redirects me to http://localhost/project/login - which obviously shouldnt.\n\nAfter searching for the bug, I found out, that the html is all correct. The error is that the id-attribut from the submit button of the \"ajax_login.ctp\" is another one than in the javascript codeblock. Yes, I know I could use a fix id, but I guess this is not correct solution because I think CakePHP is working correct, only me is doing a mistake(?).\n\nHere is an example:\nusers/login.ctp\n\n<div id=\"login-dialog\" title=\"Login\">\n <?php\n echo $this->Session->flash('auth');\n echo $this->Form->create('User', array('controller' => 'users', 'action' => 'login'));\n echo $this->Form->input('email');\n echo $this->Form->input('password');\n echo $this->Js->submit(\n 'Login', \n array(\n 'type' => 'html', \n 'url' => array('controller' => 'users', 'action' => 'login'),\n 'update' => '#login-dialog'\n )\n );\n echo $this->Form->end();\n ?>\n</div>\n\n\n*users/ajax_login.ctp*\n\n<?php\necho $this->Session->flash('auth');\necho $this->Form->create('User', array('controller' => 'users', 'action' => 'login'));\necho $this->Form->input('email');\necho $this->Form->input('password');\necho $this->Js->submit(\n 'Login', \n array(\n 'type' => 'html', \n 'url' => array('controller' => 'users', 'action' => 'login'),\n 'update' => '#login-dialog'\n )\n);\necho $this->Form->end();\n?>\n\n\n*users_controller.php* - The login() function\n\npublic function login() {\n if($this->RequestHandler->isAjax() == true) {\n $this->layout = 'ajax';\n if($this->Auth->login() === 1) {\n $this->redirect(array('action' => 'account'));\n }\n $this->render('ajax_login');\n }\n return $this->Auth->login();\n }\n\n\nSubmitbutton Id at the first time I open the login-dialog: #submit-1033269670\nSubmitbutton Id after the first login failed (wrong data): #submit-2037877124\n\nAs you can see, at the second time, the Id is another one, but the javascript havent changed it. The javascript event refers to the first id #submit-1033269670\n\nI hope my explaination isnt too confusing ^^. Looking forward to your help!"
]
| [
"javascript",
"jquery",
"ajax",
"cakephp"
]
|
[
"rabbitmq-stomp - java client publisher, javascript(web) listener",
"i am trying to simpley send message via java client and get it on the server side using stomp .\ni enabled the stomp plugin and it does work but there seems to be no communication , what am i doing wrong ?....\n\nthe java client \n\n public class ServerToStomp {\n\nprivate static final String EXCHANGE_NAME = \"test1\";\n\npublic static void main(String[] argv) throws Exception {\n\n ConnectionFactory factory = new ConnectionFactory();\n factory.setHost(\"localhost\");\n Connection connection = factory.newConnection();\n Channel channel = connection.createChannel();\n\n channel.exchangeDeclare(EXCHANGE_NAME, \"topic\");\n\n String routingKey = \"test1\";\n String message = \"hello\";\n channel.basicPublish(EXCHANGE_NAME, routingKey, null, message.getBytes());\n System.out.println(\" [x] Sent '\" + routingKey + \"':'\" + message + \"'\" + channel.getConnection().getPort());\n\n connection.close();\n}\n// ...\n}\n\n\nand the stomp client:\n\n <!DOCTYPE html>\n<html><head>\n <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\"></script>\n <script src=\"http://cdn.sockjs.org/sockjs-0.3.min.js\"></script>\n <script src=\"stomp.js\"></script>\n\n</head><body lang=\"en\">\n\n\n<div id=\"first\" class=\"box\">\n <h2>Received</h2>\n <div></div>\n <form><input autocomplete=\"off\" value=\"Type here...\"></input></form>\n</div>\n\n<div id=\"second\" class=\"box\">\n <h2>Logs</h2>\n <div></div>\n</div>\n\n<script>\n var has_had_focus = false;\n var pipe = function(el_name, send) {\n var div = $(el_name + ' div');\n var inp = $(el_name + ' input');\n var form = $(el_name + ' form');\n\n var print = function(m, p) {\n p = (p === undefined) ? '' : JSON.stringify(p);\n div.append($(\"<code>\").text(m + ' ' + p));\n div.scrollTop(div.scrollTop() + 10000);\n };\n\n if (send) {\n form.submit(function() {\n send(inp.val());\n inp.val('');\n return false;\n });\n }\n return print;\n };\n\n // Stomp.js boilerplate\n var ws = new SockJS('http://' + window.location.hostname + ':15674/stomp');\n var client = Stomp.over(ws);\n\n // SockJS does not support heart-beat: disable heart-beats\n client.heartbeat.outgoing = 0;\n client.heartbeat.incoming = 0;\n client.debug = pipe('#second');\n\n var print_first = pipe('#first', function(data) {\n client.send('/topic/test1', {\"content-type\":\"text/plain\"}, data);\n });\n var on_connect = function(x) {\n id = client.subscribe(\"/topic/test1\", function(d) {\n debugger;\n print_first(d.body);\n });\n };\n var on_error = function() {\n console.log('error');\n };\n client.connect('guest', 'guest', on_connect, on_error, '/');\n\n $('#first input').focus(function() {\n if (!has_had_focus) {\n has_had_focus = true;\n $(this).val(\"\");\n }\n });\n</script>"
]
| [
"java",
"javascript",
"rabbitmq",
"stomp"
]
|
[
"Javascript player for managing playlist of vimeo *and* youtube videos?",
"I'm a little curious. I have a list of vimeo videos which I play through an API, and I also have a list of youtube videos which I play via an API.\n\nThey are on my website.\n\nWhat I'm trying to do is create a universal player which will combine vimeo and youtube videos into a single loop. Say when all vimeo videos have finished, continue and play the youtube videos.\n\nI have literally no idea where to start other than it will require javascript.\n\nAny ideas? Appreciate the help."
]
| [
"javascript",
"api",
"youtube",
"vimeo"
]
|
[
"Adding custom methods to core data classes",
"What is the best way to add custom methods to my core data generated classes?\n\nFor example, say I have a \"Person\" entity with properties \"firstname\" and \"lastname\". I wish to add a \"fullname\" method, which returns a concatenation of the firstname and lastname properties.\n\nI could add the method to the generated .h and .m files, but this would be difficult to maintain during development when my entities may still change. Recreating the .h and .m file would overwrite these changes. Another idea is to subclass the generated class and add the methods there.\n\nIs there a better way?"
]
| [
"iphone",
"objective-c",
"core-data"
]
|
[
"Add CORS header to an http request using Ajax",
"I have developed a Restfull application and I'd like to add another web application to consume its services so I make this Ajax call :\n\n $.ajax({\n type: \"Post\",\n async: false,\n url: \"ip_adress/Inviter/api/Account/Register\",\n data: donne,\n headers: { \"Access-Control-Allow-Origin:\": \"*\"},\n success: function (data) {\n console.log(data);\n var tab = [];\n tab[\"username\"] = username;\n tab[\"password\"] = pwd;\n var isLogged = Login.CheckCredential(tab, username);\n return isLogged;\n },\n error: function (xhr, status, error) {\n console.log(xhr);\n console.log(status);\n console.log(error);\n }\n\n });\n\n\nI get this exception :\n\n\n Object {readyState: 0, status: 0, statusText: \"SyntaxError: Failed to\n execute 'setRequestHeader' …-Origin:' is not a valid HTTP header\n field name.\"} error DOMException: Failed to execute 'setRequestHeader'\n on 'XMLHttpRequest': 'Access-Control-Allow-Origin:' is not a valid\n HTTP header field name.\n\n\nSo I need to know :\n\n\nHow can I enable the CORS in this situation?\nHow can I fix my code?"
]
| [
"javascript",
"jquery",
"ajax",
"rest",
"http"
]
|
[
"How to resolve injected instances in Vue.js using TypeScript",
"According to the official document, it seems that we can use dependency injection feature as long as we stay on object-based structure.\n\nHere's my question. I'm using TypeScript to achieve this goal (class-based). I'm going to use Inversify as an IoC container. My initial idea was something like:\n\nDependencyConfig.ts:\n\nimport { Container } from \"inversify\";\nimport \"reflect-metadata\";\nimport Warrior from \"./interfaces/Warrior\";\nimport { Ninja } from \"./models/Warrior\";\n\nlet container = new Container();\n\ncontainer.bind<Warrior>(Symbol(\"Warrior\")).to(Ninja);\n\nexport default container;\n\n\nApp.ts:\n\nimport container from \"./DependencyConfig\";\n\n@Component({\n name: \"App\",\n provide: container\n})\nexport default class App extends Vue {\n}\n\n\nWhen I checked in my browser's dev console, I was able to see the container has been set to the _provided field. Here's Hello.ts, the child component of App.ts:\n\nHello.ts:\n\n@Component({\n name: \"Hello\",\n inject: [ \"container\" ]\n})\nexport default class Hello extends Vue {\n created (): void {\n console.log(this);\n }\n}\n\n\nAs App.ts could access to Hello.ts through vue-router, it didn't register Hello.ts as a child component. I was expecting the injected container should appear on _injected or something similar. However, I couldn't find it. I changed the inject property value from \"container\" to { \"container\": Symbol(\"Container\") } but I couldn't still find it.\n\nService Locator:\n\nIt works fine to use a service locator instead of the provide/inject pair:\n\n// App.ts\n@Component({\n name: \"App\"\n})\nexport default class App extends Vue {\n}\n\n// Hello.ts\nimport container from \"./DependencyConfig\";\n\n@Component({\n name: \"Hello\"\n})\nexport default class Hello extends Vue {\n created (): void {\n var ninja = container.get<Ninja>(Symbol(\"Warrior\"));\n console.log(ninja.name);\n }\n}\n\n\nHowever, I want to avoid using the service locator pattern here. Did I miss something while using the provide/inject pair for dependency injection?"
]
| [
"typescript",
"dependency-injection",
"vue.js"
]
|
[
"differential equation representation",
"I'm trying to manipulate with differential equation system using sympy:\n\nfrom sympy import symbols, Function\nt = symbols('t')\n\nx_2 = Function('x_2')\nx_3 = Function('x_3')\n\neq = x_3(t).diff(t) + x_2(t).diff(t)\neq1 = eq.subs(x_2(t), x_3(t) + x_3(t).diff(t))\n\n\nand the answer is:\n\n\n\nbut I need result in form:\n\n\n\nI try to use \n\neq1.simplify()\n\n\nbut result is same.\n\nHow can i get this? Thanks."
]
| [
"python",
"sympy"
]
|
[
"Virtual's value won't work when populating /mongoose/. How to fix?",
"I've got a quick question regarding mongoose virtuals. I have a "price" virtual, here's the code:\nbuildingElementSchema.virtual('price')\n .get(function () {\n if (!this.productResults) return 0;\n let total = 0;\n this.productResults.forEach((item, index) => {\n if (item.productResultId && typeof item.productResultId.price !== 'undefined') {\n total += (item.productResultId.price * this.productResults[index].count);\n }\n });\n return Math.round(total);\n });\n\nAlso in the same collection, where the virtual is located, I have the following field which is a reference on the same collection:\notherBEId: {\n type: ObjectId,\n ref: 'BuildingElement',\n required: false,\n }\n\nWhen I populate with the very field, I don't get virtual calculation value. I understand it's related with This value. What are some ways I could make the virtual's value work? I've actually come up with an alternative that seems too long /with two DB requests and 2 Arrays' merge/. However, I'm looking for a faster solution, which I am trying to find it through mongoose populate function."
]
| [
"javascript",
"node.js",
"mongodb",
"mongoose"
]
|
[
"Create DTO with reference to domain object in NHibernate",
"I'm writing a summary query with grouping and counting in my NHibernate 3.3.3.4000 project. I have domain objects Position and Tag, with a many-to-many relationship. One Position will have a handful of Tags, but over time there will be a large number of Positions for each tag. So the relationship is one-directional, where Position has a collection of Tags, but not vice-versa.\n\nMy query will count up the number of Positions with each Tag, for Positions connected to a certain AcademicTerm (a scalar reference in Position). The query below works:\n\n public IPartialResult<TagSummary> GetTagSummaries(string termCode, int skip, int take)\n {\n Tag tagAlias = null;\n AcademicTerm termAlias = null;\n TagSummary summary = null;\n\n var tagQuery = Session.QueryOver<Position>()\n .JoinAlias(p => p.Term, () => termAlias)\n .Where(() => termAlias.TermCode == termCode)\n .JoinQueryOver<Tag>(t => t.Tags, () => tagAlias)\n .SelectList(projections => projections\n .SelectGroup(p => tagAlias).WithAlias(() => summary.Tag)\n .SelectCount(p => p.ID).WithAlias(() => summary.PositionCount)) \n .TransformUsing(Transformers.AliasToBean<TagSummary>());\n\n var countQuery = tagQuery.ToRowCountQuery().FutureValue<int>();\n\n var resultQuery = tagQuery\n .OrderBy(t => t.Name).Asc\n .Skip(skip)\n .Take(take)\n .Future<TagSummary>();\n\n return new PartialResult<TagSummary>(resultQuery, countQuery.Value);\n\n\nThe result type is TagSummary:\n\npublic class TagSummary\n{\n public string TagName { get; set; }\n public int PositionCount { get; set; }\n}\n\n\nWhat's in there is the Tag's Name property, but what I really want is the Tag itself. I can't figure out how to do that. I've got the tagAlias right there, but I don't know how to get it into my TagSummary. Do I have to select each individual property of Tag? I could select the Tag's ID value, and then perform another query, but that doesn't seem very good.\n\nUpdate\nI just discovered that the count query won't work, because ToRowCountQuery will strip out the grouping. Now I'm trying to solve that one."
]
| [
"nhibernate"
]
|
[
"Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font width unknown for character 0x20",
"I would like to use the free font Lato in ggplot2 graphs since the remainder of my R markdown document is set in this font.\n\nThe font is installed on my system and available in the Font Book (once only).\n\nAll available fonts are loaded with the extrafont package and registered in the extrafontdb.\n\nWhen I knit my markdown document as PDF, all text is correctly typeset in Lato. However, the plot labels of my ggPlots are not shown.\n\nI also receive the following warning message:\n\nWarning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font width unknown for character 0x20\n\nAfter embedding the fonts contained in the document with extrafont::embed_fonts the plot labels are shown for all figures using Lato as font, but\n\n\nthe plot labels do not contain any spaces between words,\nany references (internal links, URLs, citations) do not work anymore.\n\n\nAn MWE including ggPlot figures with and without Lato as the font is provided below (Lato is freely available here)\nTo embed the fonts afterwards one needs to run embed_fonts(\"TestRmd.pdf\", outfile=\"TestRmd_embedded.pdf\")\n\nAny help is greatly appreciated!\n\nMWE:\n\n---\ntitle: \"Embedding Fonts in PDF\"\noutput: pdf_document\nurlcolor: blue\n---\n\n```{r echo=FALSE}\nlibrary(ggplot2)\n```\n\n### Plot with standard font {#standard}\n```{r echo=FALSE, out.width = '30%'}\nggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() + \n ggtitle(\"Fuel Efficiency of 32 Cars\") +\n xlab(\"Weight (x1000 lb)\") + ylab(\"Miles per Gallon\")\n```\n\n### Load fonts and set font for ggplots globally\n```{r include=FALSE}\n# install.packages(\"extrafont\") # see https://github.com/wch/extrafont/\nlibrary(extrafont)\n# font_import() # run once\nloadfonts() # loadfonts\n\n# globally set ggplot2 theme and font (\"Lato Light\")\ntheme_set(theme_minimal(base_size=12, base_family=\"Lato Light\"))\n```\n\n### Plot with newly set standard font (= Lato) {#lato}\n```{r echo=FALSE, out.width = '30%'}\nggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() + \n ggtitle(\"Fuel Efficiency of 32 Cars\") +\n xlab(\"Weight (x1000 lb)\") + ylab(\"Miles per Gallon\")\n```\n\n### Plot with Impact font {#impact}\n```{r echo=FALSE, out.width = '30%'}\nggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +\n ggtitle(\"Fuel Efficiency of 32 Cars\") +\n xlab(\"Weight (x1000 lb)\") + ylab(\"Miles per Gallon\") +\n theme(text=element_text(size=16, family=\"Impact\"))\n```\n\n### Run to embed fonts\n```{r eval=FALSE, include=TRUE}\nembed_fonts(\"TestRmd.pdf\", outfile=\"TestRmd_embedded.pdf\")\n```\n\n### Links test\n\nLinks test 1 (internal reference): [Headline standard](#standard)\n\nLinks test 2 (URL): [RStudio has become a Public Benefit Corporation](https://blog.rstudio.com/2020/01/29/rstudio-pbc)\n\n\nAddOn:\n\nAn even simpler problem but likely related to the same issue:\n\nlibrary(extrafont)\nextrafont::font_import()\np <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point() + theme_minimal(base_size=10, base_family=\"Lato Light\")\nggsave(p, filename = \"iris.pdf\")\n\n\nThe plot in the saved pdf does not contain any labels. Using cairo_pdf as recommend on several SO (e.g. 1, 2) sites does not help and results in the following error:\n\nggsave(p, filename = \"iris.pdf\", device = cairo_pdf)\n# In dev(filename = filename, width = dim[1], height = dim[2], ...) :\n# failed to load cairo DLL"
]
| [
"r",
"ggplot2",
"r-markdown",
"markdown",
"extrafont"
]
|
[
"How do I customize the helper using draggable in jQuery-UI",
"I want to make a custom element with text taken from the element \"being dragged\" using a helper function. My problem is that ui is undefined, so I don't know how to get a hold of the source of the drag.\n\n$('.draggable').draggable({\n helper: function(event, ui) {\n var foo = $('<span style=\"white-space:nowrap;\">DRAG TEST</span>'); \n return foo;\n }\n});"
]
| [
"jquery",
"jquery-ui"
]
|
[
"R - Vertex attributes - 'Inappropriate value given in set.vertex.attribute.'",
"I have a data.frame containing values I want to use as attributes in a network file.\n\nWhen I try to assign the values as attributes manually half of them work but the other half show this error. I have looked closely at the data and I cannot see anything intrinsic that should be causing this.\n\nFormat vector input (this one works)\n\nvisitgo2n%v%\"hhid\" <- attr2$hhid\n\n\nHere is the error:\n\n\"Error in set.vertex.attribute(x, attrname = attrname, value = value) : \n Inappropriate value given in set.vertex.attribute.\"\n\n\nI have tried removing white space but this does not work.\n\nI have also tried entering the vectors in this way but I get the same error:\n\nfor (n in names(attr2)) {\n visitgo2n %v% n <- attr2[[n]]\n}\n\n\nWhat could be causing half the vectors to be 'inappropriate', what values are appropriate?"
]
| [
"r",
"networking",
"igraph",
"sna"
]
|
[
"How to implement custom soft constraints in OR-Tools Routing Solver?",
"I've been working with the OR-Tools routing solver in Python for a couple of months and I still not understand how to implement custom soft constraints or even if it's possible in the routing solver.\n\nI know that the following methods add penalties to the cumulative values:\n\nSetCumulVarSoftUpperBound(self, index: int64, upper_bound: int64, coefficient: int64)\nSetCumulVarSoftLowerBound(self, index: int64, upper_bound: int64, coefficient: int64)\n\n\nOne of the constraint I'm not able to implement is the following:\n\n\nI want to penalize the distance/time consumed by empty vehicles. For instance, in a pickup and delivery scenario if the vehicle does a delivery and becomes empty, I want to penalize the distance traveled while empty until the vehicle reaches a pickup node (next node) or ends the route. \n\n\nWith the above methods I can only penalize with a fixed value when a bound is exceeded, but I would like to penalize the consumed distance or time to transit to the next node.\n\nMeanwhile, is there any way to implement custom soft constraints with an explicit penalty value considering the state of the solution found (e.g., the next node and cumulative amount of the dimensions)?"
]
| [
"or-tools",
"vehicle-routing"
]
|
[
"n.getFullYear is not a function error when passing an array with react-google-charts",
"I'm trying to view date data in a react-google-chart Calendar chart. I have an array of habits and each habit has an array of completion days. I'm trying to map these completion days in to the Chart component but get an error on the DOM n.getFullYear is not a function The problem might be that I don't know how to pass the data to the Chart component the right way, mapping from an array. How should I do this?\n\nHere is my code:\n\n//example of dateObj:\nhabit.completions[0] = { thisYear: 2020, thisDay: 3, thisMonth: 2 }\n\n\nimport React from 'react';\nimport Chart from 'react-google-charts';\n\nconst Habit = ({ habit, handleRemove }) => {\n if (!habit) {\n return null;\n }\n\n\n const completionDays = habit.completions.map(dateObj => {\n return [new Date(dateObj.thisYear, dateObj.thisDay, dateObj.thisMonth), 1]\n })\n\n const dataNotWork = [\n [\n { type: 'date', id: 'Date' },\n { type: 'number', id: 'Completions'}\n ],\n completionDays\n ]\n\n const dataThatWorks = [\n [{ type: 'date', id: 'Date' }, { type: 'number', id: 'Completions' }],\n [new Date(2012, 3, 13), 1],\n [new Date(2012, 3, 14), 1],\n [new Date(2012, 3, 15), 1],\n [new Date(2013, 2, 10), 1]\n ]\n\n console.log('completionDays', completionDays)\n\n return (\n <div>\n <Chart\n width={750}\n height={350}\n chartType=\"Calendar\"\n loader={<div>Loading Chart</div>}\n data={dataNotWork}\n options={{\n title: habit.name\n }}\n rootProps={{ 'data-testid': '1' }}\n />\n <div>\n <button onClick={() => handleRemove(habit)}>Delete</button>\n </div>\n </div>\n );\n};\n\nexport default Habit \n\n\nHere is a console.log of completionDays before return\n\ncompletionDays \n(2) [Array(2), Array(2)]\n0: (2) [Wed Apr 01 2020 00:00:00 GMT+0300 (Eastern European Summer Time), 1]\n1: (2) [Wed Apr 01 2020 00:00:00 GMT+0300 (Eastern European Summer Time), 1]\nlength: 2\n__proto__: Array(0)"
]
| [
"arrays",
"reactjs",
"charts",
"google-visualization"
]
|
[
"Difference between executeInternal and execute in quartz scheduler 2.3.3 version",
"I want to schedule my Job using Quartz Scheduler.\nI to do this I am using Quartz Version 2.3.0\n\nEclipse shows error while implementing method:\n\n@Override\n protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {\n....\n}\n\n\nSuggest to implement execute method.\nSo want to know difference between executeInternal and execute.\nAlso want to know difference between QuartzJobBean and Job."
]
| [
"spring"
]
|
[
"Increase distance between axis line and plot lines on ggplot",
"How do I increase the distance between the axis.line.y below and the blue geom_hline below? I want a gap between the two, I don't want them kissing as shown on the plot.\n\nlibrary(tidyverse)\nggplot(mpg, aes(cty, hwy)) + \n geom_point() + \n geom_hline(yintercept = 25, color = \"blue\") + \n theme_minimal() + \n theme(axis.line.y = element_line(color = \"black\"), \n axis.ticks.y.left = element_line(color = \"black\"), \n panel.grid.major = element_blank(), \n panel.grid.minor = element_blank())"
]
| [
"r",
"ggplot2"
]
|
[
"TCP Listener is not shut down completely",
"I have a TCP Listener that initialized as next:\nmyListener := net.Listen("tcp", addr)\n\nThen am able to receive connections and process them. Then I need to close the server in order that I can reuse the same port but this is not happening, this is how am closing the tcp server:\nmyListener.Close()\n\nIn the client side am closing all the existent TCP connections to that server and then from the terminal I see that those connections are being close but the port is still in use by the server and listening (even when is not accepting new connections which is right according to documentation). This is how I check in the terminal:\nnetstat -an | grep 8080 \n\nAnd after close the client side connections I get this and cannot reuse the port:\ntcp46 0 0 *.8080 *.* LISTEN\n\nAfter doing myListener.Close() I waited some time but in the terminal the port is still in use."
]
| [
"go",
"tcp",
"tcpserver"
]
|
[
"Change body class depending on current option in select list",
"Without using jQuery, how can I change the body class based on the currently selected option in a select list?\n\nThanks in advance!"
]
| [
"javascript"
]
|
[
"Create a stored procedure with an IF/Else conditional that inserts into a table",
"I'm given a problem I've never seen before. That asks to create a procedure that Inserts a new book into the Books table. This procedure has to use an If/Else condition where the IF will handle the insert and the ELSE will Raise an error.\n\nI'm having trouble with the If/Else because the way I've always done it in the past has been to use the If to throw an error while the else does the insert. It's unfinished but this is as far as I've gotten.\n\nCREATE PROC spInsertBook\n @BookID INT = NULL,\n @BookISBN VARCHAR(50) = NULL,\n @BookTitle VARCHAR(50) = NULL,\n @BookAuthor VARCHAR(50) = NULL,\n @BookPublisher VARCHAR(50) = NULL,\n @BookGenre VARCHAR(50) = NULL\nAS\nIF NOT EXISTS (SELECT * FROM Books WHERE BookID = @BookID)\n THROW 50001, 'BookID already exists!', 1;\nELSE\n SET BookID = @BookID\nIF EXISTS (SELECT * FROM Books WHERE BookISBN = @BookISBN)\n THROW 50001, 'BookISBN already exists!', 1;\nIF @BookTitle IS NULL\n THROW 50001, 'Enter a book title!', 1;\nIF @BookAuthor IS NULL\n THROW 50001, 'Enter a book author!', 1;\nIF @BookPublisher IS NULL\n THROW 50001, 'Enter a book publisher!', 1;\nIF @BookGenre IS NULL\n THROW 50001, 'Enter a book genre!', 1;\nELSE\n INSERT Books\n VALUES(@BookID, @BookISBN, @BookTitle, @BookAuthor, @BookPublisher, @BookGenre)\n\n\nYou can see I use the If statements to throw the errors and the else to insert the input parameters, but this needs to be reversed, any ideas?"
]
| [
"sql",
"sql-server",
"tsql",
"stored-procedures"
]
|
[
"Why is GitVersion Semver patch number offsetting automatically?",
"Maybe a really silly question, but I'm new to GitVersion and trying to set it up in our repo for the first time. I created a branch off of the master branch feature/playing-with-gitversion, installed GitVersion via chocolatey and ran through the setup gitversion init. Gitflow and Mainline modes are what I configured the repo for. I would like to set the next-version variable to 1.0.30 (we had been doing semver manually and already used 1-29), but it keeps offsetting the patch number +60\n\nHere is my GitVersion.yml file:\n\nassembly-versioning-scheme: MajorMinorPatch\nmode: Mainline\nnext-version: 1.0.30\nbranches:\n feature: {}\nignore:\n sha: []\nmerge-message-formats: {}\n\n\nAnd here is what the semver ends up being:\n\ngitversion /showvariable MajorMinorPatch \n1.0.90\n\n\nI would really like gitversion to just honor the 1.0.30 from GitVersion.yml. I have tried clearing the cache and also trying gitversion /overrideconfig pre-release-weight=0 thinking that variable might be the culprit. What (hopefully) simple thing am I overlooking?"
]
| [
"git",
"semantic-versioning",
"gitversion"
]
|
[
"slow function by groups in data.table r",
"My experimental design has trees measured in various forests, with repeated measurements across years.\n\nDT <- data.table(forest=rep(c(\"a\",\"b\"),each=6),\n year=rep(c(\"2000\",\"2010\"),each=3),\n id=c(\"1\",\"2\",\"3\"),\n size=(1:12))\n\nDT[,id:=paste0(forest,id)]\n\n> DT\n forest year id size\n 1: a 2000 a1 1\n 2: a 2000 a2 2\n 3: a 2000 a3 3\n 4: a 2010 a1 4\n 5: a 2010 a2 5\n 6: a 2010 a3 6\n 7: b 2000 b1 7\n 8: b 2000 b2 8\n 9: b 2000 b3 9\n10: b 2010 b1 10\n11: b 2010 b2 11\n12: b 2010 b3 12\n\n\nFor each tree i, I want to calculate a new variable, equal to the summatory of the size of all the other individuals in the same group/year that are bigger than the tree i.\n\nI have created the following function:\n\nf.new <- function(i,n){ \n DT[forest==DT[id==i, unique(forest)] & year==n # select the same forest & year of the tree i\n & size>DT[id==i & year==n, size], # select the trees larger than the tree i\n sum(size, na.rm=T)] # sum the sizes of all such selected trees\n}\n\n\nWhen applied within the data table, I got the correct results.\n\n DT[,new:=f.new(id,year), by=.(id,year)]\n\n> DT\n forest year id size new\n 1: a 2000 a1 1 5\n 2: a 2000 a2 2 3\n 3: a 2000 a3 3 0\n 4: a 2010 a1 4 11\n 5: a 2010 a2 5 6\n 6: a 2010 a3 6 0\n 7: b 2000 b1 7 17\n 8: b 2000 b2 8 9\n 9: b 2000 b3 9 0\n10: b 2010 b1 10 23\n11: b 2010 b2 11 12\n12: b 2010 b3 12 0\n\n\nNote that I have a large dataset with several forests (40) & repeated years (6) & single individuals (20,000), for a total of almost 50,000 measurements. When I carry out the above function it takes 8-10 minutes (Windows 7, i5-6300U CPU @ 2.40 GHz 2.40 GHz, RAM 8 GB). I need to repeat it often with several small modifications and it takes a lot of time.\n\n\nIs there any faster way to do it? I checked the *apply functions but cannot figure out a solution based on them.\nCan I make a generic function that doesn't rely on the specific structure of the dataset (i.e. I could use as \"size\" different columns)?"
]
| [
"r",
"function",
"data.table"
]
|
[
"TextInputLayout: Different color for hint label when not focused",
"What I want to do:\nWhen using an EditText embedded in a TextInputLayout I want to ...\n\nSet the Color of the label to GREEN when it's de-focused and floating above the EditText because the user has already entered some value\nSet the Color of the label to RED when it's de-focused and located inside the EditText, because the user has not yet entered a value\nI do not want to change the hint text color of all my EditTexts to RED, but only when they're wrapped in a TextInputLayout (I don't need a general approach - a specific approach like setting a theme/style for each TextInputLayout in the layout XML would be fine)\nPreserve (i.e. don't change) the accent color (YELLOW) used to color the floating label when the user has focused the field.\n\nWhat I have tried:\nSetting the below as a theme/style on the TextInputLayout does satisfy 1. but not 2.\n<style name="FloatingLabel" parent="Widget.Design.TextInputLayout">\n <item name="android:textColorHint">@color/red</item>\n</style>\n\nSetting a specific color on my embedded EditText that changes the hint text to another color:\n android:textColorHint="@color/text_placeholder_gray"\n\nactually causes an overlap of hint texts when the label is moved from it's floating position back into the Edittext as a hint (i.e. no text).\nSetting this:\n<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">\n<item name="android:textColor">@color/main_color</item>\n\non the TextInputLayout:\n <android.support.design.widget.TextInputLayout\n ...\n app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout" >\n\nChanges the hint label color but it also does so for the focused state - which means 4 is not satisfied.\nAnd since a picture says more than a tousand words (all fields are in non-focused state):\n\nHow to achieve a setup that satisfies criteria 1-4 ?"
]
| [
"android",
"android-layout",
"android-theme",
"android-styles"
]
|
[
"How to output data at client side? (express+monogdb+jade)",
"I'm trying to displpay the data I retrieved from database(I'm using node.js express and mongodb), however the data I need successfully shows in the console, but I need to output it at the front-end side in Jade.\n\nThe data I retrieve:\n\n{\ndate: Thu, 02 Aug 2012 07:47:19 GMT,\nname: 'user1',\n_id: 501a3087f7dd1e3863000001,\ndesc: { \n age: '2' \n } \n} \n\n\nThe function that retrieves the data above and render to the user page:\n\nfunction(req, res){\n memberModel.findOne({desc: {age: '2'}}, function(err, docs){\n res.render('user.jade', { members: docs });\n console.log(docs);\n });\n};\n\n\nThis is the user.jade file that supossed to display the user whos age is 2:\n\nthead\n tr\n th Name\ntbody\n- members.forEach(function(member){\n tr\n td= member['name']\n- })\n\n\nI get follow error:\n\n500 TypeError:\nth Name 12| tbody > 13| - members.forEach(function(member){ 14| tr 15| td= member['name'] \n16| - }) Object { date: Thu, 02 Aug 2012 07:47:19 GMT, name: 'user1', _id: \n501a3087f7dd1e3863000001, desc: { age: '2' } } has no method 'forEach'\n\n\nSo I can't use forEach to display the data? How should I do in order to display it? Any help is appreciated, thanks in advance!"
]
| [
"javascript",
"node.js",
"mongodb",
"express",
"pug"
]
|
[
"Need to fix JavaScript so that the array begins at the right position",
"Hi I have got a jsFiddle to share but never used it before so I hope I did it right..\nhttp://jsfiddle.net/Mayron/3V62C/\n\nI also have these screen shot to better show what I mean:\nhttp://i.imgur.com/NgQk5P2.jpg\n\nI have a table of images in the gallery page and when you click on an image it opens up a frame that shows a blank but much larger image which gains the source of the smaller image you clicked on. That works fine but I have all the images in the gallery listed in an array and the large frame has three buttons on it: previous, close and next. So far the JavaScript code allows you to click next and previous to go through them but it always begins the journey from array[0] and that is no good if you click to view the 6th one in the list from the gallery page first for example. \n\nI hope that makes sense if not then let me know!\n\nThe issue is with this line that causes it to begin from the first image:\n\ncurrentIndex = 0;\n\n\nHow can I change this so that the currentIndex number is the image that the user first clicks on?"
]
| [
"javascript",
"arrays",
"function"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.