texts
list | tags
list |
---|---|
[
"How to list out all the files in the public directory in a Play Framework 2.X Scala application?",
"Here is my controller\n\nclass Proguard extends Controller {\n\n val proguardFolder = \"/public/proguards/\"\n val proguardFolderFix = \"/public/proguards\"\n val proguardSuffix = \"proguard-\"\n val proguardExtension = \".pro\"\n val title = \"# Created by https://www.proguard.io/api/%s\\n\\n%s\"\n\n def proguard(libraryName: String) = Action {\n val libraries = libraryName.split(',')\n\n val availableLibs = listInDir(proguardFolderFix)\n val result = availableLibs.filter(libraries.contains).map(readFile).mkString\n Ok(title.format(libraryName, result))\n }\n\n\n def list() = Action {\n Ok(Json.toJson(listInDir(proguardFolder)))\n }\n\n private def listInDir(filePath: String): List[String] = {\n getListOfFiles(Play.getFile(filePath)).map(_.getName.replace(proguardExtension, \"\").replace(proguardSuffix, \"\"))\n }\n\n def getListOfFiles(dir: File): List[File] = {\n dir.listFiles.toList\n }\n\n def readFile(string: String): String = {\n val source = scala.io.Source.fromFile(Play.getFile(s\"$proguardFolder$proguardSuffix$string$proguardExtension\"))\n val lines = try source.mkString finally source.close()\n lines\n }\n\n}\n\n\nIt worked totally okay in debug mode, but in production at Heroku dir.listFiles. is giving me NPE\n\nI've tried different ways, but looks like only solution is move my files to s3 or database."
] | [
"scala",
"heroku",
"playframework",
"playframework-2.0"
] |
[
"How to receive image file from android in django?",
"I haven't been able to receive and save a file sent from Android in Django.\n\nThe file is being sent using retrofit and the following code:\n\n@Multipart\n@PUT(\"/users/{id}\")\n void modifyPic(\n @Header(\"auth_token\") String token,\n @Path(\"id\") int userid,\n @Part(\"request[data][param][title]\") String title,\n @Part(\"request[data][param][Photo]\") TypedFile avatar,\n Callback<User> cb\n);\n\n\nHowever I have no idea how to receive and save the file in django.\n\nCould someone help me by giving some pointers how to achieve that?"
] | [
"android",
"python",
"django"
] |
[
"Drop DB on AWS RDS instance - Postgres",
"Trying to drop a db from AWS RDS (postgres) is blocked only for superuser (which is reserved to AWS only).\n\ntrying to run this command on my instance:\n\nDROP DATABASE \"dbname\"\n\n\nresults in error:\n\npsycopg2.InternalError: DROP DATABASE cannot run inside a transaction block\n\n\nI saw this issue in AWS forums, which seems to have been active by a lot of people, but no AWS representative giving a valid solution. \n\nHow can I drop my db without taking down the whole instance and raising it again?"
] | [
"postgresql",
"amazon-web-services",
"amazon-rds"
] |
[
"What are the differences between WebView.Source and WebView.Navigate?",
"In documentation it is stated that we should use WebView.Navigate from code, but I want to understand why. What are the differences?"
] | [
"webview",
"uwp"
] |
[
"How to change default colors used in VBA code/Macro result (Red, Green)",
"I am using the following VBA code to change the color of the rows in my spreadsheet every time the value in Column A changes (So that all entries with the same value in column A will be grouped by color. The spreadsheet is sorted by column A already so the items are already grouped, I just needed them colored). \n\nAnyway, when I run this macro the rows are colored red & green (which are very bright and overwhelming colors for this purpose). I need something more subtle.. \n\nHow do I change this? Or can I specify in my VBA code for it to use certain colors by rgb or color index? {I am using Excel 2007}\n\nSub colorize() \n\nDim r As Long, val As Long, c As Long \n\nr = 1 \nval = ActiveSheet.Cells(r, 1).Value \nc = 4 \n\nFor r = 1 To ActiveSheet.Rows.Count \n If IsEmpty(ActiveSheet.Cells(r, 1).Value) Then \n Exit For \n End If \n\n If ActiveSheet.Cells(r, 1).Value <> val Then \n If c = 3 Then \n c = 4 \n Else \n c = 3 \n End If \n End If \n\n ActiveSheet.Rows(r).Select \n With Selection.Interior \n .ColorIndex = c \n .Pattern = xlSolid \n End With \n\n val = ActiveSheet.Cells(r, 1).Value \nNext \n\nEnd Sub"
] | [
"vba",
"excel",
"background-color"
] |
[
"How can I configure my windows service in the code to access the desktop?",
"I have created an windows service. I want to open some windows based application from this service.\n\nBut my windows service is unable to start desktop applications. To enable the access I had to do the following steps:\n\n\nOpened the administrative tool \"Services\"\nRight clicked on my service and had to select \"properties\"\nThen in the \"Log On\" tab, selected \"Allow service to interact with desktop\".\n\n\nAfter that my service can open desired windows based processes.\n\nCan I configure my windows service in the code (C#) to access the desktop so that I won't have to change the access permission manually after installation?"
] | [
"c#",
"windows-services",
"permissions"
] |
[
"How can I convert '2020-09-30 23:45:27+0000' to date object?",
"I'm trying\ndate_st = '2020-09-30 23:45:27+0000'\ndaate_ob= datetime.strptime(date_st,"%Y-%m-%d %H:%M:%S.%f%z" )\n\nbut it returned ValueError: time data '2020-09-30 23:4527+0000' does not match format '%Y-%m-%d %H:%M:%S.%f%z"
] | [
"python",
"python-3.x",
"python-datetime"
] |
[
"moving rows into different sections",
"Hey guys I have two sections on my tableview and I have a mutable array that updates only one section. I would like to move the cells from the section with an array into the blank section. I tried creating another array for the blank section itself but I wasn't able to get it working. Here is my moveRowAtIndexPath method.\n\n- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath\n{\n\nid objectToMove = [myArray1 objectAtIndex:fromIndexPath.row];\nid objectToMove2 = [myArray2 objectAtIndex:fromIndexPath.row];\n\n//move objects between main section\n[myArray1 removeObjectAtIndex:fromIndexPath.row];\n[myArray1 insertObject:objectToMove atIndex:toIndexPath.row];\n\n\n//move object from main section to blank section\n [myArray1 removeObjectAtIndex:fromIndexPath.row];\n [myArray2 insertObject:objectToMove atIndex:toIndexPath.row];\n\n\nI have my numberOfRowsInSection returning the appropriate arrays count for each section but still no luck. When I enter editing mode and I try to move the cell it disappears."
] | [
"uitableview",
"nsmutablearray",
"tableview"
] |
[
"TestNG Re run test on failure, not running BeforeClass AfterClass methods",
"I implemented logic that re runs a failed TestNG test class from the following link:\n\nhttps://martinholladay.wordpress.com/2013/11/17/webdriver-2-0-automatically-retry-failed-tests/\n\nUnfortunately, it runs the method with the \"Test\" annotation, and not running the BeforeClass (@BeforeClass) and AfterClass (@AfterClass) methods. I tried looking into setDependsOnMethods and getDependsOnMethods methods of ITestAnnotations to no avail. \n\nDoes anybody know how to get the listener class to run BeforeClass and AfterClass methods as well?\n\npublic class RetryListener implements IAnnotationTransformer {\n public void transform(ITestAnnotation annotation, Class testClass,\n Constructor testConstructor, Method testMethod) {\n IRetryAnalyzer retry = annotation.getRetryAnalyzer();\n if (retry == null) {\n annotation.setRetryAnalyzer(Retry.class);\n }\n }\n}\n\n//The test begins here....\n\n@BeforeClass(alwaysRun = true)\n@Parameters(\"Environment\")\npublic void BeforeClass(String sEnv) throws Exception {\n WebDriver driver = new FirefoxDriver();\n driver.get(\"www.google.com\");\n\n}\n\n@Test\npublic void TestMethod() {\n //Some test...\n}\n\n@AfterClass(alwaysRun = true)\npublic void AfterClass() {\n driver.quit();\n}"
] | [
"java",
"selenium-webdriver",
"annotations",
"testng"
] |
[
"Entity Framework exclude subclasses in query",
"I have a base class Nurse and an inherited class NurseDuplicate which I have mapped using TPC\n\n Map(m =>\n {\n m.ToTable(NURSES_TABLE);\n })\n .Map<NurseDuplicate>(m =>\n {\n m.ToTable(NURSEDUPLICATES_TABLE);\n m.MapInheritedProperties();\n });\n\n\nEverything works fine when entering data. i.e. they both end up in their separate tables.\nHowever when I query the database with \n\ndestinationDB.Nurses\n\n\nI get both types returned, not just Nurses.\n\nIs there any way to query the database so it only returns Nurses without NurseDuplicates?"
] | [
"c#",
"entity-framework-6"
] |
[
"Getting the same range value in a function",
"I've been trying to do my assignment but I've run into an logic error.I'm using Python 3.\n\nprint(\"Car Service Cost\")\ndef main():\n loan=int(input(\"What is your loan cost?:\\t\"))\n maintenance=int(input(\"What is your maintenance cost?:\\t\"))\n total= loan + maintenance\n for rank in range(1,10000000):\n print(\"Total cost of Customer #\",rank, \"is:\\t\", total)\n checker()\ndef checker():\n choice=input(\"Do you want to proceed with the next customer?(Y/N):\\t\")\n if choice not in [\"y\",\"Y\",\"n\",\"N\"]:\n print(\"Invalid Choice!\")\n else:\n main()\nmain()\n\n\nAnd im getting this output:\n\nCar Service Cost\nWhat is your loan cost?: 45\nWhat is your maintenance cost?: 50\nTotal cost of Customer # 1 is: 95\nDo you want to proceed with the next customer?(Y/N): y\nWhat is your loan cost?: 70\nWhat is your maintenance cost?: 12\nTotal cost of Customer # 1 is: 82\nDo you want to proceed with the next customer?(Y/N): y\nWhat is your loan cost?: 45\nWhat is your maintenance cost?: 74\nTotal cost of Customer # 1 is: 119\nDo you want to proceed with the next customer?(Y/N): here\n\n\nI'm having my rank as 1 every time. What am I doing wrong?"
] | [
"python",
"python-3.x",
"for-loop",
"range"
] |
[
".NET 3.5CF WebRequest to Slim Framework",
"I'm writing a mobile application in .NET 3.5 Compact Framework and am trying to make a GET request to a PHP Slim Framework page. If I try to access the page from a web browser on the local machine it works, but if I try to access it from the mobile device C# application or the mobile device's web browser I get a HTTP 404. I made a standard PHP page to display the current time and that works on all three of the above, so isolating the problem specifically to Slim pages. I also took a look at the access.log in xampp which looks like this:\n\n[20/Mar/2013:17:07:38 +0000] \"GET /SlimTest/ HTTP/1.1\" 200 21 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)\"\n[20/Mar/2013:17:09:37 +0000] \"GET http://10.0.2.15/SlimTest/ HTTP/1.1\" 404 523 \"-\" \"-\"\n\n\nThe first is from the local machine and the second is from the handheld device and, as you can see, the first request is completed successfully and the latter has a 404 returned to it.\n\nThe Slim PHP code looks like this:\n\n$app->get('/', function () {\n echo \"This is the get route\"; \n});\n\n\nAnd the C# looks like this:\n\nstring webResponse = \"\";\ntry\n{\n HttpWebRequest request = (HttpWebRequest)WebRequest.Create(\"http://10.0.2.15/SlimTest/\");\n WebResponse response = request.GetResponse();\n using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))\n {\n webResponse = streamReader.ReadToEnd();\n }\n}\ncatch (Exception ex)\n{\n MessageBox.Show(ex.Message);\n}\n\n\nIt is important to note that I am not a web developer so I do apologise if it is something glaringly obvious.\n\nSpeed is also of the essence with this project so even if someone could suggest an alternative RESTful PHP framework which has proven to be useful to them, then I'd very much appreciate it.\n\nFinally, just for a quick insight, this project will have a web based application and a handheld mobile application that will communicate with a web service. I'm trying to get the web service written in PHP using slim so that it can be hosted on a Linux box to cut costs. Again, if anyone has any suggestions/alternatives then I'd be equally as grateful.\n\nThanks"
] | [
"c#",
"php",
"rest",
".net-3.5",
"slim"
] |
[
"What is the 3rd argument type for getSupportLoaderManager(id, args, ??)",
"I've an AsyncTaskLoader method which restarts the current Loader,\n\nIt's for school purpose,\n\nprivate void startAsyncTaskLoader() \n{\n getSupportLoaderManager().restartLoader(TASK_ID, null, this);\n}\n\n\nI can check the solution online on the school github but this is the good one, \nBut in my android studio \"this\" (3rd argument) is incorrect type...\n\n--> \nWrong 3rd argument type. Found: 'com.openclassrooms.freezap.Controllers.MainActivity', required: 'android.support.v4.app.LoaderManager.LoaderCallbacks<java.lang.Object>'\n\n\nI understand I placed a context argument (MainActivity) but I don't have an instance of LoaderManager."
] | [
"java",
"android",
"android-asynctask",
"android-loadermanager"
] |
[
"Android - Calculate deciBel from sound volume",
"Is it possible to calculate the decibel value from the sound volume level?\nSuppose a sound is playing, (it could be any track, but I'm using a generated sound with AudioTrack). While the sound is playing, the volume of the sound is increased from 0 (mute) to 99 (maximum).\nNow I want to retrieve the decibel value, when the volume level is 50, for example.\nIs it possible?\n\nI found how to calculate decibel value in this thread: Calculate Decibel from amplitude - Android media recorder \n\npower_db = 20 * log10(amp / amp_ref);\n\n\nbut here it uses the amplitude, not sound volume."
] | [
"java",
"android",
"audio",
"android-emulator",
"android-ndk"
] |
[
"Simple REST app working in local but not in heroku",
"I'm creating a REST app that posts 2 images (base64 strings) for comparing using Resemble js. In my local, when I spin up the server and test using postman, it works fine. I deployed the same code to Heroku and test the heroku endpoint with the same data, it is throwing me an error.\nHere is my code.\nconst express = require('express');\nconst app = express();\nlet port = process.env.PORT || 3000;\nconst bodyParser = require('body-parser');\nconst resemble = require("resemblejs");\n\napp.use(bodyParser.json());\n\napp.get('/', (req, res) => {\n res.send('Hello World!!');\n})\n\napp.post('/', (req, res) => {\n console.log(req.body);\n var src = req.body.src;\n var dest = req.body.dest;\n\n resemble(src).compareTo(\n dest\n ).ignoreColors().onComplete(data => {\n console.log(JSON.stringify(data));\n res.send(JSON.stringify(data));\n }).catch(err => {\n console.log(err);\n });\n\n})\n\n\napp.listen(port, () => {\n console.log(`Listening on port ${port}`);\n})\n\nYou can test the api here.\nThe error I get when I looked at the heroku logs by using the command heroku logs --tail --app resemble-js-sf\n2021-01-24T09:11:37.128025+00:00 heroku[web.1]: State changed from crashed to starting\n2021-01-24T09:11:41.023786+00:00 heroku[web.1]: Starting process with command `node index.js`\n2021-01-24T09:11:43.522499+00:00 app[web.1]: internal/modules/cjs/loader.js:1057\n2021-01-24T09:11:43.522520+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));\n2021-01-24T09:11:43.522521+00:00 app[web.1]: ^\n2021-01-24T09:11:43.522521+00:00 app[web.1]: \n2021-01-24T09:11:43.522522+00:00 app[web.1]: Error: /app/node_modules/canvas/build/Release/canvas.node: invalid ELF header\n2021-01-24T09:11:43.522522+00:00 app[web.1]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)\n2021-01-24T09:11:43.522522+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)\n2021-01-24T09:11:43.522523+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)\n2021-01-24T09:11:43.522523+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)\n2021-01-24T09:11:43.522523+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)\n2021-01-24T09:11:43.522524+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/canvas/lib/bindings.js:3:18)\n2021-01-24T09:11:43.522524+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:999:30)\n2021-01-24T09:11:43.522524+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)\n2021-01-24T09:11:43.522525+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)\n2021-01-24T09:11:43.522525+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)\n2021-01-24T09:11:43.574021+00:00 heroku[web.1]: Process exited with status 1\n2021-01-24T09:11:43.616109+00:00 heroku[web.1]: State changed from starting to crashed\n2021-01-24T10:12:33.734281+00:00 heroku[web.1]: State changed from crashed to starting\n2021-01-24T10:12:36.481044+00:00 heroku[web.1]: Starting process with command `node index.js`\n2021-01-24T10:12:39.939626+00:00 app[web.1]: internal/modules/cjs/loader.js:1057\n2021-01-24T10:12:39.939641+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));\n\nPlease let me know where am I going wrong and how can I fix it?"
] | [
"node.js",
"api",
"heroku"
] |
[
"what is the proublem ? ':app:javaPreCompileDebug'",
"FAILURE: Build failed with an exception.\n\n\nWhat went wrong:\nExecution failed for task ':app:javaPreCompileDebug'.\n\n\n Could not resolve all files for configuration ':app:debugCompileClasspath'.\n Failed to transform artifact 'x86_debug.jar (io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695)' to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.\n Execution failed for JetifyTransform: C:\\Users\\USER.gradle\\caches\\modules-2\\files-2.1\\io.flutter\\x86_debug\\1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695\\b6634f91d3c77e2c3ec9b53abd9c0203a18a3d25\\x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.jar.\n Failed to transform 'C:\\Users\\USER.gradle\\caches\\modules-2\\files-2.1\\io.flutter\\x86_debug\\1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695\\b6634f91d3c77e2c3ec9b53abd9c0203a18a3d25\\x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.jar' using Jetifier. Reason: invalid entry size (expected 27689296 but got 27687917 bytes). (Run with --stacktrace for more details.)\n Failed to transform artifact 'x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695)' to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.\n Execution failed for JetifyTransform: C:\\Users\\USER.gradle\\caches\\modules-2\\files-2.1\\io.flutter\\x86_64_debug\\1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695\\40b4f81a66d09624710dd7fff2bd600092231ead\\x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.jar.\n Failed to transform 'C:\\Users\\USER.gradle\\caches\\modules-2\\files-2.1\\io.flutter\\x86_64_debug\\1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695\\40b4f81a66d09624710dd7fff2bd600092231ead\\x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.jar' using Jetifier. Reason: invalid entry size (expected 28517464 but got 28517372 bytes). (Run with --stacktrace for more details.)\n\nTry:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.\nGet more help at https://help.gradle.org\n\n\nBUILD FAILED in 2s\nFinished with error: Gradle task assembleDebug failed with exit code 1"
] | [
"android",
"flutter",
"android-studio-2.1"
] |
[
"jQuery previous button show",
"I'm very new with jQuery and I use this jQuery carousel. I don't want to use any plugin. But I want to ask how can I show previous button in the beginning of carousel and it must be also red in the beginning/first slide \n\nhere is demo\n\nhttp://jsfiddle.net/rGLsG/94/\n\n $(function(){\nvar carousel = $('.carousel ul');\nvar carouselChild = carousel.find('li');\nvar clickCount = 0;\nvar canClick = true;\n\nitemWidth = carousel.find('li:first').width()+1; //Including margin\n\n//Set Carousel width so it won't wrap\ncarousel.width(itemWidth*carouselChild.length);\n\n//Place the child elements to their original locations.\nrefreshChildPosition();\n\n//Set the event handlers for buttons.\n$('.btnNext').click(function(e){ \n if($(\".carousel\").find(\"li:eq(6)\").text()!='14' ) {\n $('.btnPrevious').show();\n $(\".btnPrevious\").css('color', '');\n if(canClick) {\n canClick = false;\n clickCount++;\n //Animate the slider to left as item width \n carousel.stop(false, true).animate({\n left : '-='+itemWidth\n },300, function(){\n //Find the first item and append it as the last item.\n lastItem = carousel.find('li:first');\n lastItem.remove().appendTo(carousel);\n lastItem.css('left', ((carouselChild.length-1)*(itemWidth))+(clickCount*itemWidth));\n canClick = true;\n });\n if ($(\".carousel\").find(\"li:eq(7)\").text()=='14'){\n $(\".btnNext\").css('color', 'red');\n }\n }\n } \n});\n\n$('.btnPrevious').click(function(){\n\n if($(\".carousel\").find(\"li:eq(0)\").text()!=1) {\n $(\".btnNext\").css('color', '');\n if(canClick){\n canClick = false;\n clickCount--;\n //Find the first item and append it as the last item.\n lastItem = carousel.find('li:last');\n lastItem.remove().prependTo(carousel);\n\n lastItem.css('left', itemWidth*clickCount); \n //Animate the slider to right as item width \n carousel.finish(true).animate({\n left: '+='+itemWidth\n },300, function(){\n canClick = true;\n });\n if ($(\".carousel\").find(\"li:eq(0)\").text()=='1'){\n $(\".btnPrevious\").css('color', 'red');\n }\n }\n } \n});\n\nfunction refreshChildPosition(){\n carouselChild.each(function(){\n $(this).css('left', itemWidth*carouselChild.index($(this)));\n });\n}\n });"
] | [
"jquery",
"button",
"carousel"
] |
[
"How to pull out mysql column values and put it in a in the same page?",
"Sorry if the question isn't clear what i am trying to do is something like this:\n\nSay i have a table that consist of these rows:\n\n//filename: stock.php\n<?php\n$result = mysqli_query($db, \"SELECT item_id item_name, item_price, item_desc FROM items\");\nwhile($show = mysqli_fetch_array('$result')){\n $item_id = ($show['item_id']);\n $item_name = ($show['item_name']);\n $item_price = ($show['item_price']);\n $item_desc = ($show['item_desc']);\n?>\n\n<tr>\n<td class=\"item_id\"><?php echo\"$item_id\"; ?></td>\n<td class=\"item_name\"><?php echo\"$item_name\"; ?></td>\n<td class=\"item_price\"><?php echo\"$item_price\"; ?></td>\n<td class=\"item_desc\"><?php echo\"$item_desc\"; ?></td>\n<td><a href=\"#editItem\" class=\"edit_item\">Edit Item</a></td>\n</tr>\n<?php\n}\n?>\n\n\nWhat i want to do is that when i click on that edit item link, i will go to the div, and on that div, all the data from the mysql database that has the same item id will be pulled out, putted in textboxes in the pop-up div that is on the same web page(no need to refresh the page, and the data listed in the table is not all of them, so i can't just pull it from there since it doesn't have infos like arrival date, and the quantity of the item, and other stuffs), so how do i achieve that?"
] | [
"javascript",
"php",
"html",
"mysql"
] |
[
"How should i add the values present in onActivityResult to the child views of ExpandableListView?",
"I have expandableListView consists of GroupViews & childViews. MyActivity is extending Activity. Now I want to add all the data present in for loop of onActivityResult to childViews of ExpandableListView. How should I do this..?\n\nPlease help me...\n\nAnyone can plz help me...."
] | [
"android",
"expandablelistview"
] |
[
"angular4 mention input tag not working properly",
"i am working with angular 4 mention tag input. I have created a api that is getting me all users list but i am not able to show it in angular mention list. I am confused what to do. Need help.\n\nHTML\n\n<input contenteditable=\"true\" class=\"publisher-input\" type=\"text\" \n id=\"comment\" formControlName=\"comment\" \n placeholder=\"Add Your Comment\" [mention]=\"userList\" \n [mentionConfig]=\"{triggerChar:'@',maxItems:10}\" (searchTerm)=\"showUsers()\">\n\n\nTS\n\nuserList: String[] = [];\n\nngOnInit() {\n this.loadUsers();\n}\n\nloadUsers() {\n this.asd.getUsers().subscribe(results => {\n results['success'].forEach(element => {\n if (element.firstName && element.middleName && element.lastName) {\n // tslint:disable-next-line:no-construct\n this.userList.push(element.firstName + ' ' + element.middleName \n + ' ' + element.lastName);\n }\n if (!element.firstName) {\n // tslint:disable-next-line:no-construct\n this.userList.push(element.middleName + ' ' + element.lastName);\n }\n if (!element.middleName) {\n // tslint:disable-next-line:no-construct\n this.userList.push(element.firstName + ' ' + element.lastName);\n }\n if (!element.lastName) {\n // tslint:disable-next-line:no-construct\n this.userList.push(element.firstName + ' ' + element.middleName);\n }\n });\n });\n}\n\nshowUsers() {\n this.loadUsers();\n}\n\n\nI have used this package https://github.com/dmacfarlane/angular-mentions. But not getting the data properly."
] | [
"angular",
"tags",
"mention",
"mentionsinput.js"
] |
[
"How to implement weighted cross entropy loss in Keras?",
"I would like to know how to add in custom weights for the loss function in a binary or multiclass classifier in Keras. I am using binary_crossentropy or sparse_categorical_crossentropy as the baseline and I want to be able to choose what weight to give incorrect predictions for each class."
] | [
"keras",
"loss-function"
] |
[
"Python dictionary creation through comprehension",
"For some reason a dictionary I am producing from a list doesnt seem to be adding a new key pair each time but instead just overwritting the same pair. Im pretty sure it probably obvious to many whats wrong here but Im just not seeing it, any help pointed would be appreciated.\n\nBelow is the data and code snippets\n\nforest_root = 'domain4.co.uk'\n\ndomains = ['domain:domain1.co.uk', 'domain:domain2.co.uk', 'domain:domain3.co.uk', 'domain:domain4.co.uk']\n\ndict1 = {forest_root: [dict(domain.split(\":\", 1) for domain in domains)] }\n\nprint dict1\n\n\nOUTPUT\n\n{\"domain4.co.uk\": [{\"domain\": \"domain4.co.uk\"}]}\n\n\nExpected OutPut\n\n{\"domain4.co.uk\": \n [\n \"domain\": \"domain4.co.uk\",\n \"domain\": \"domain1.co.uk\",\n \"domain\": \"domain2.co.uk\",\n \"domain\": \"domain3.co.uk\",\n ]\n}\n\n\nPost Answer\n\nThanks all, I can now see what I was doing wrong and understand how to achieve my expected outcome."
] | [
"python",
"dictionary"
] |
[
"What is timeline_like_chaining in the Facebook Graph API?",
"Here is part of the json I get back:\n\n \"value\": {\n \"page_suggestions_on_liking\": 2,\n \"engagement_pyml\": 44,\n \"page_browser\": 30,\n \"outbound_click_chaining\": 18,\n \"feed_story\": 11,\n \"mobile_page_browser\": 56,\n \"wap\": 1,\n \"comment_chaining\": 71,\n \"mobile\": 25,\n \"page_finch_related_pages\": 1,\n \"feed_pyml\": 121,\n \"page_timeline\": 2,\n \"search\": 5,\n \"page_profile\": 24,\n \"pagelike_adder_for_reactivated_users\": 18,\n \"timeline_collection\": 6,\n \"launch_point_home_pyml\": 5,\n \"sponsored_story\": 2,\n \"feed_chaining\": 57,\n \"mobile_page_suggestions_on_liking\": 8,\n \"timeline_like_chaining\": 135,\n \"api\": 14,\n \"all_category_pyml\": 38,\n \"launch_point_discover_pyml\": 13\n },\n\n\nWhat is timeline_like_chaining and how is it different from feed_chaining?"
] | [
"facebook-graph-api",
"facebook-insights"
] |
[
"How to get text from text field in tkinter and use hashlib to create a hash?",
"I have been troubled for days, I want to get text from a text field in tkinter and pass it through a hashlib function and get an output on the GUI in the second text field.\nI want to create a SHA-256 one way hash.\nA link to a screenshot\nhttps://i.stack.imgur.com/5uq5K.png\nfrom tkinter import *\nfrom hashlib import sha256\n\nroot = Tk()\nroot.geometry("500x500")\n\none = Label(text="Hash Calculator", fg="Red")\none.pack()\n\nlabel_1 = Label(root, text="Enter the text")\nlabel_2 = Label(root, text="The output text is")\n\nentry1 = Entry(root)\nentry2 = Entry(root)\n\nbutton_1 = Button(root, text="Submit")\n\none.grid(row=0, column=1)\nlabel_1.grid(row=1)\nentry1.grid(row=1, column=1)\nlabel_2.grid(row=5,column=1)\nentry2.grid(row=6, column=1)\nbutton_1.grid(row=4, column=1)\n\nh = sha256()\nh.update(b'python1990K00L')\nhash_1 = h.hexdigest()\nprint(hash_1)\n\nroot.mainloop()\n\nI have just started learning python."
] | [
"python",
"tkinter",
"hash"
] |
[
"request a URL and parse the response in Python",
"I'm migrating a utility tool from Java to Python and I'm new to Python. I want to know the best way to do these simple and common tasks in Python:\n\n\nBuild a URL with all parameters encoded correctly(using UTF8). \nRequest the URL and parse the XML response. \nFind any node with a tag name \"Foo\" \nFind any node with a attribute Foo=\"Bar\"\n\n\nI need to do all these things using Python 2.7.3 API only (without any third-party module or library)."
] | [
"python"
] |
[
"Confused about drawable sizes",
"To my understanding, I need to create several different versions of my image drawables, varying by size so that devices load the appropriate one.\n\nIn my Photoshop mockup of my app, I have an icon image that is 12px x 12px on my monitor.\n\n\nWhat various sizes/dimensions do I have to make of the icon?\nShould the icon stretch to the sides of the drawable's dimensions or should there be some padding?\n\n\nThanks."
] | [
"android",
"android-layout",
"android-xml",
"android-drawable"
] |
[
"PDF file that generated by itext is corrupted if the PDF file is generated by a jar extension application",
"I'm newbie in Java and I desperately need your help.\n\nCurrently I'm working on my project which requires me to generate PDF file from certain user inputs. My output PDF file is expected to contain images in several cells. Everything seems okay if I run the application in Netbeans IDE. I try to open the generated PDF file and it's nice. No problem at all.\n\nThen I do the 'Clean and Build' thing so I'll have an application with jar extension. This where the problem is. If I generate the PDF file from this jar-extension-application, the PDF file is corrupted. It says that 'An error occured'. I see the size of the file is (always) 0 bytes. But if I remove the codes for 'adding-images-in-cells' in my source code, the PDF file is not corrupted. It can be opened, but the consequence is my file doesn't contain any image.\n\nMy questions are:\n\n\nAm I possibly doing something wrong in the code so that the error occurs? Or is it natural that I can not generated PDF file using the 'jar-extension-application' if that file contains any image?\nHow come the file is generated nicely if run directly in Netbeans IDE, but get the opposite after if run in jar extension?\n\n\nThanks for any answer."
] | [
"java",
"pdf",
"jar",
"itext"
] |
[
"Why might a Web Serial API app work in Windows and Linux but not macOS?",
"I'm trying to develop an web-page which can talk to an STM Nucleo board attached to a USB port on the computer. The Nucleo board communicates using a serial port connection over USB, and I can happily talk to it using a serial terminal program (CoolTerm in my case). The browser app works fine in Windows and Linux, but not in macOS. macOS reports that the serial connection is available, appears to connect and open the port correctly, and starts working, but after sending a few dozen bytes the serial port in the mac appears to freeze, and it doesn't transmit anything more to the Nucleo board.\nThe Web serial app reports all the flags (CTS, DCD, DSR and RI) to be false, both before and after the transmitter stops sending data, but the port is opened with flowControl set to the default "none").\nDoes anyone have any idea why this might be happening and how to get the mac serial port to transmit more than a few dozen bytes?\n(I've observed exactly the same behaviour trying to use python and pyserial: it works in Windows and Linux, but doesn't work in macOS, so I am assuming this is something to do with the macOS serial ports.)\nThe code to open the port and send the data looks like this:\nasync function _serialNewClickConnect() {\n\n // Select the serial port. Note: can add filters here, see web.dev/serial\n _serialPort = await navigator.serial.requestPort();\n\n // Open the serial port.\n await _serialPort.open({ baudRate: 115200, bufferSize: 64 });\n\n // Set up to allow data to be written:\n _serialWriter = _serialPort.writable.getWriter();\n\n // Listen to data coming from the serial device.\n while (_serialPort.readable) {\n\n _serialReader = _serialPort.readable.getReader();\n try {\n while (true) {\n const { value, done } = await _serialReader.read();\n if (done) {\n // To allow the serial port to be closed later:\n _serialReader.releaseLock();\n break;\n }\n if (value) {\n // Something has arrived. This will be stored in value as a uint8 array.\n for (let x = 0; x < value.byteLength; x++) {\n _serialRxData.push(value[x]);\n }\n }\n }\n } catch (error) {\n // TODO: Handle non-fatal read error.\n }\n }\n}\n\nasync function sendString(string) {\n // Sends a string over the serial port.\n const data = new TextEncoder().encode(string);\n await _serialWriter.write(data);\n}"
] | [
"macos",
"google-chrome",
"serial-port",
"pyserial"
] |
[
"Finding asp.net webform methods through reflection",
"I am trying to find a method in a asp.net code behind class through reflection through the following code placed on the same page I querying.\n\nMethodInfo MyMethod = this.GetType().GetMethod(\"Create\", BindingFlags.Static);\n\n\nBut this always returns null, what is more strange is that at runtime the type of this is not MyAssembly.MyPage that type shows as ASP.MyPage_aspx. What is this type? and why am I not seeing the original code behind class type? and where do I find it?\n\nAny idea how to solve this problem?"
] | [
"c#",
"asp.net",
"reflection",
"webforms"
] |
[
"Stored procedure with nodes specification",
"Declare @Xmlresponse as XML\nSet @Xmlresponse = CAST (@response as xml);\n\n---- Check the response\nDeclare @Status as int\n\nSet @Status = @Xmlresponse.exist('declare namespace ns1=\"https://adweaintsrv.adweag.ae/\";\ndeclare namespace ns=\"http://AADC_GETCUSTOMERFULLDETAIL/\";\n/ns:UserDetail/ns1:AccountTypeEng')\n\n---SELECT @Status [Status]\n\n------ Shred the XML response and extract the status description value\n IF (@Status = 1) \n --// BillID node exists so the transaction was successful and we can extract the Status Description for example\n\n BEGIN\n\n ---- Extract StatusCode\n ;with xmlnamespaces('https://adweaintsrv.adweag.ae/' as ns, default 'http://AADC_GETCUSTOMERFULLDETAIL/')\n Select T.X.value('(ns:StatusCode/text())[1]', 'varchar(10)') as StatusCode\n from @Xmlresponse.nodes('/UserDetail') as T(X);\n ---- Insert into tracker table\n --INSERT INTO [dbo].[IVR_CCB_Webservices_Tracker] ([WS_Desc], [Date], [Result], [xmlResult])\n --VALUES\n -- ('CreateBillRouteFaxService', Getdate() ,'Success', @response)\n ----Insert Response WS in Table BillFax_log\n ;with xmlnamespaces('https://adweaintsrv.adweag.ae/' as ns, default 'http://AADC_GETCUSTOMERFULLDETAIL/')"
] | [
"xml",
"sql-server-2008"
] |
[
"How can I run 2 asynchrones code in one function and escape them?",
"I want to run 2 pieces of asynchronous code in one function and escape them. I want first to download the Reciter information and then download with these information the images that is associated with the Reciter. I'm using Firestore. I tried to work with DispatchQueue and DispatchGroup but I couldn't figure something out. I hope someone can help me :)\n\nfunc getReciters(completion: @escaping (Bool) -> Void) {\n var reciters = [Reciter]()\n self.BASE_URL.collection(REF_RECITERS).getDocuments { (snapchot, error) in\n if let error = error {\n debugPrint(error)\n completion(false)\n // TODO ADD UIALTERCONTROLLER MESSAGE\n return\n }\n\n guard let snapchot = snapchot else { debugPrint(\"NO SNAPSHOT\"); completion(false); return }\n\n for reciter in snapchot.documents {\n let data = reciter.data()\n let reciterName = data[REF_RECITER_NAME] as? String ?? \"ERROR\"\n let numberOfSurahs = data[REF_NUMBER_OF_SURAHS] as? Int ?? 0\n\n// **HERE I WANT TO DOWNLOAD THE IMAGES**\n self.downloadImage(forDocumentID: reciter.documentID, completion: { (image) in\n let reciter = Reciter(name: reciterName, image: nil, surahCount: numberOfSurahs, documentID: reciter.documentID)\n reciters.append(reciter)\n })\n }\n }\n UserDefaults.standard.saveReciters(reciters)\n completion(true)\n }"
] | [
"ios",
"google-cloud-firestore",
"swift4.2"
] |
[
"Multiplying transformation matrix to a vector",
"I have done a series of transformations using glMultMatrix. How do I multiply a vector (nX, nY, nZ, 1) to the matrix I have from the transformation? How do I get that matrix to multiply with a vector?\n\npyglet.gl.lib.GLException: invalid operation\n\n\nI am getting above error if I use glMultMatrix. I need to call this multiplication between glBegin and glEnd."
] | [
"python",
"opengl"
] |
[
"How to store a very large integer in java",
"My input is of 10^19 ; How can i store this number.\n\nint input ; // Of order 10^19;\nint answer = input%(10^10+3)\n\n\nHow to perform above operations and what if i want to have an array\n\nA[input][input] // showing me an error"
] | [
"java"
] |
[
"Adding to end of Vagrant path",
"I would like to create a generic dev Vagrant environment that I can vagrant up from anywhere on my system. I know that Vagrant searches for a Vagrantfile starting with CWD, then in each parent directory. I also know that setting the VAGRANT_CWD environment variable allows you to tell Vagrant to start searching in a given directory.\n\nSo, I could do something like this: export VAGRANT_CWD=~/.dotfiles/vdevbox, where vdevbox contains the Vagrantfile and other relevant stuff for my dev environment. This allows me me to vagrant up from anywhere, but it takes precedence over Vagrantfiles in my CWD, which makes it impossible to use other Vagrant environments (clearly a fail).\n\nSo, basically I need the Vagrant equivalent of Bash's PATH=$PATH:~/some/path. Is this supported, or is there a better way of meeting this use-case?\n\nEdit to address @arturhoo's answer\n\nThe same help page linked above mentions merging settings via a ~/.vagrant.d/Vagrantfile. I think that this is a different thing than Vagrant's search of dirs for a Vagrantfile to start an env from. I think it's strictly limited to merging settings, and Vagrant must additionally find a Vagrantfile via the search method described above. I tried it, and the results seem to support my hypothesis.\n\n[~/.vagrant.d]$ ls -rc | tail -n 2\nVagrantfile\nbootstrap.sh\n[~/test]$ ls\n[~/test]$ vagrant up\n# Error message about missing Vagrantfile"
] | [
"vagrant",
"vagrantfile"
] |
[
"Comparing string read from csv file",
"I'm trying to compare string read from csv file in if condition. Below is the sample code I have written:\n\nexport IFS=\"~\"\nwhile read a b c\ndo\n echo \"line Num:$a\"\n if [ \"$b\"==\"sat\" ];then\n echo \"Its saturday\"\n echo $c\n elif [ \"$b\"==\"sun\" ];then\n echo \"Its sunday\"\n echo $c\n else\n echo \"Its weekday\"\n echo $c\n fi\ndone < \"$1\"\n\n\nBelow is the csv file:\n\n1~sat~enjoy\n2~sun~enjoy\n3~mon~work\n4~tue~work\n5~sun~enjoy\n\n\nBelow is the output I'm getting:\n\nline Num:1\nIts saturday\nenjoy\nline Num:2\nIts saturday\nenjoy\nline Num:3\nIts saturday\nenjoy\nline Num:4\nIts saturday\nenjoy\nline Num:5\nIts saturday\nenjoy\n\n\nNeeded the below output instead:\n\nline Num:1\nIts saturday\nenjoy\nline Num:2\nIts sunday\nenjoy\nline Num:3\nIts weekday\nwork\nline Num:4\nIts weekday\nwork\nline Num:5\nIts sunday\nenjoy\n\n\nAny idea how to achieve this?"
] | [
"shell",
"unix"
] |
[
"How to iterate over long path names with any form of the Windows API",
"I have some files on a server that exceed the MAX_PATH limit.\nI've repeatedly heard that you can list those files by pre-pending \\\\?\\ to the path. However, that doesn't solve the problem with FindFirstFile[Ex] and its partners as they use a data structure that limits file name length to MAX_PATH.\n\nIs there any other way to iterate over the directory structure to find the files that have a name that is too long? I've seen utilities that do it but none of them are available in source form.\n\nNote that I have seen the blog entries from the .NET BCL folks and followed the links they provide.\n\nI'd prefer to do this in C or C++ for simplicity but any freely available language will do for now.\n\nPointers to code, docs or anything useful are appreciated."
] | [
"c",
"windows",
"winapi",
"ntfs"
] |
[
"Including .init_array section to Linker script produces unusable output",
"I try to port a c++ project to RISC-V. The project was already successfully compiled for ARM using IAR Toolchain and for Windows.\n\nFor the RISC-V port I have written my own CRT0.S file which does all the initialization and also my own linker script.\n\nWith some small demo projects everything is working perfectly.\nI can also successfully compile and link the project. The problem is when I add the .init_array section to the linker script the output file increases from about 4k to more than 100k. I added these sections to the linker script:\n\n.preinit_array :\n{\n PROVIDE_HIDDEN (__preinit_array_start = .);\n KEEP (*(.preinit_array))\n PROVIDE_HIDDEN (__preinit_array_end = .);\n} > ram\n\n.init_array :\n{\n PROVIDE_HIDDEN (__init_array_start = .);\n KEEP (*(SORT(.init_array.*)))\n KEEP (*(.init_array ))\n PROVIDE_HIDDEN (__init_array_end = .);\n} > ram\n\n.fini_array :\n{\n PROVIDE_HIDDEN (__fini_array_start = .);\n KEEP (*(SORT(.fini_array.*)))\n KEEP (*(.fini_array ))\n PROVIDE_HIDDEN (__fini_array_end = .);\n} > ram\n\n\nWhen I now try to load this ELF file to GDB I just get the error No Registers. When I remove the sections from the linker I can successfully run the code as far as i don't use static objects which are not loaded.\n\nIs there any explanation for this behavior?"
] | [
"c++",
"riscv",
"linker-scripts"
] |
[
"Python pandas dataframe \"Don't want to trim values\"",
"When making a data frame that contains person location coordinates as latitude and longitude (eg, lat: 51.7122369865437 and long: 9.24231274054315) the panda's data frame is trimming the value of latitude and both longitude. How to stop it and store original coordinates."
] | [
"python",
"pandas",
"dataframe"
] |
[
"One domain, one codebase, unlimited sub-domains and databases",
"I want to host a marketing site and a demo app using GAE.\n\nhttp://mysite.com => Marketing site\nhttp://demo.mysite.com => Demo site\n\nhttp://client.mysite.com => Client site\n...\n\nEach time a client signs up I need to be able to dynamically add a datastore for said client.\n\nIs this something doable using GAE??? Do the Cloud SQL instances have an API I can call to add a DB and beging installing a client account???\n\nRegards,\nAlex"
] | [
"google-app-engine"
] |
[
"RSA encryption: negative d solution seems too big to be usable",
"I've implemented a mostly-functional RSA encryption. It randomly generates 2048 bit primes p and q (n = pq) and most of the time I get a relatively small value d as expected. The value d is used in the encryption M^d mod n.\n\nHowever, sometimes the value for d I get is negative, which is usually frowned upon in RSA. After some research, I found that a common solution is to simply add phi (phi = (p-1)(q-1)) in this case.\n\nd = d % phi;\nif(d < 0)\n d += phi;\n\n\nBut when I do this, I end up with d that's as large as n (over 2048 bits). That seems far too large to be useful. Is there something I'm missing, or is a value for d that large actually acceptable?"
] | [
"encryption",
"cryptography",
"rsa"
] |
[
"use my own database for segnet tensorflow",
"i' m trying to implement this segnet_tensorflow with my own database\ni have the following error in this line.\ni tried to train the model with CamVid dataset and it works fine.\n image_batch, label_batch = self.sess.run([self.images_tr, self.labels_tr])\n\nINFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.NotFoundError'>, ./SegNet/CamVid/test/00_08.png; No such file or directory\n [[{{node ReadFile}}]]\n---------------------------------------------------------------------------\nOutOfRangeError Traceback (most recent call last)\n/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py in _do_call(self, fn, *args)\n 1364 try:\n-> 1365 return fn(*args)\n 1366 except errors.OpError as e:\n\n7 frames\nOutOfRangeError: RandomShuffleQueue '_9_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 3, current size 0)\n [[{{node shuffle_batch}}]]\n\nDuring handling of the above exception, another exception occurred:\n\nOutOfRangeError Traceback (most recent call last)\n/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py in _do_call(self, fn, *args)\n 1382 '\\nsession_config.graph_options.rewrite_options.'\n 1383 'disable_meta_optimizer = True')\n-> 1384 raise type(e)(node_def, op, message)\n 1385 \n 1386 def _extend_graph(self):\n\nOutOfRangeError: RandomShuffleQueue '_9_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 3, current size 0)\n [[node shuffle_batch (defined at /tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py:1748) ]]"
] | [
"python",
"tensorflow"
] |
[
"Setting ComboBox.SeletectedItem VB.NET",
"I know this is an easy task, but I'm having trouble setting ComboBox.SelectedItem.Let's say i have the following code....\n\nClass InnerClass\n Public InnerProperty As String\nEnd Class\n\nClass [Class]\n Public [Property] As String\n Public InnerClass As InnerClass\nEnd Class\n\nPrivate Sub Form_Load(ByVal sender As Object,ByVal e as EventArgs)\n Dim cls as New [Class]\n Dim innerCls as New InnerClass\n Dim list as New BindingList(Of InnerClass)\n\n list.Add(New InnerClass)\n list.Add(New InnerClass)\n list.Add(New InnerClass) \n cls.InnerClass=list.Items(2)\n ComboBox1.DataSource=list \n ComboBox1.DisplayMember=\"InnerProperty\"\n ComboBox1.DisplayValue=\"InnerProperty\"\n ComboBox1.DataBindings.Add(\"SelectedItem\",cls,\"InnerClass\") 'always displays 1st item\n list.Add(innerCls)\n ComboBox1.SelectedItem=innerCls 'No effect\nEnd Sub\n\n\nHow do I make ComboBox1.SelectedItem bind to [Class].InnerProperty correctly?\nHow do I set ComboBox1.SelectedItem manually?"
] | [
"vb.net",
"data-binding",
"combobox"
] |
[
"Detect whether all database-held resources are present in ASP.NET",
"I currently hold my resources in a database instead of resx files. I would like to be able to test whether all keys used in the application are held in the database to avoid runtime errors.\n\nI have a custom ResourceProviderFactory to accomplish retrieving the resources.\n\nResources could be in aspx view pages - GetLocalResourceObject(\"ResourceKey\") or GetGlobalResourceObject(\"ResourceClass\", \"ResourceKey\").\n\nThey could be in a controller - HttpContext.GetGlobalResourceObject(\"ResourceClass\", \"ResourceKey\").\n\nI also call the resources from the core assemblies of my application without using the ASP.NET resource factory (using a singleton instead) - CoreResources.Current.GetResource(\"ResourceClass\", \"ResourceKey\")\n\nWhat would be the best way for me to ensure that all resources are in the database without having to waiting for a runtime exception?"
] | [
"asp.net",
"asp.net-mvc",
"unit-testing",
"resources"
] |
[
"How to automatically reorder named function arguments with Resharper?",
"When reordering arguments in a function signature, callers do not get updated (unless specifically using the Change signature method in Resharper) and continue to compile fine with the old order. This is not a problem semantically but may look a bit messy when many callers end up having different argument orders.\n\nIs there any way with Resharper - or any other tool - to automatically reorder named parameters solutionwide so that they can perfectly match the function signature?\n\nThis seems like a nice refactoring function that would make the code look more consistent, and to which I don't see any possible side effect or negative aspect, much like standardizing other cosmetic aspects across a solutions."
] | [
"c#",
"visual-studio",
"refactoring",
"resharper"
] |
[
"find specific array value C# using user input microsoft.visualbasic.interaction.inputbox",
"Hi Guys looking for a solution to make a method that uses user input to find a specific array value based on users input for week and day input this is my code for my user input and array which is a 2d array:\n\n public int[,] ToysMade = new int[4, 5];\n public String[] days = new String[] { \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\" };\n\n //retrieve method based from user input\n public void retrieveDay()\n {\n String input1;\n String input2;\n int num;\n\n input1 = Microsoft.VisualBasic.Interaction.InputBox(\"Please enter week number: \", \"Enter Value\");\n input2 = Microsoft.VisualBasic.Interaction.InputBox(\"Please enter day number: \", \"Enter Value\");\n\n try\n {\n while (!(int.TryParse(input1, out num)))\n {\n\n }\n }\n catch(Exception e)\n {\n\n }\n txtOutput.Text += \"\\r\\nRetrieve products completed on a specific day \\r\\nProducts Completed on that day are: \" + \" \\r\\n\";\n }\n\n //Get user input method via microsoft.vb inputbox \n public void UserInput()\n {\n String value;\n int numCount;\n\n\n //retrieveing length of ToysMade array dimensions if less than 0 repeat untill last dimension filled\n for (int i = 0; i < ToysMade.GetLength(0); i++)\n {\n for (int j = 0; j < ToysMade.GetLength(1); j++)\n {\n //taking user input for array dimension 0 \"first dimension\" then increment it by 1 after input ready for next dimension \"i + 1\"\n value = Microsoft.VisualBasic.Interaction.InputBox(\"Enter Value For \" + days[j] + \" of week \" + (i + 1).ToString() + \" Enter Value\");\n\n try\n {\n //making sure for only int past through \n while (!(int.TryParse(value, out numCount)))\n {\n MessageBox.Show(\"Not a valid number, please try again.\");\n value = Microsoft.VisualBasic.Interaction.InputBox(\"Enter Value for \" + days[i] + \" of week \" + (i + 1).ToString() + \" Enter Value\");\n }\n // taking values enterd from user and set next dimension for next input by incrementing it\n ToysMade[i, j] = numCount;\n\n }\n catch (Exception e)\n {\n MessageBox.Show(\"Value enterd is not in a valid format\");\n }\n }\n }\n }"
] | [
"c#",
"multidimensional-array",
"user-input"
] |
[
"multiple war files in single ear with different context roots",
"I have one ear file and two war files\napplication.xml file is configured like \n\n<module id=\"myeclipse.1312xxxxxxx\">\n <web>\n <web-uri>first.war</web-uri>\n <context-root>/first</context-root>\n </web>\n </module>\n <module id=\"myeclipse.134xxxxxxxxx\">\n <web>\n <web-uri>second.war</web-uri>\n <context-root>/second</context-root>\n </web>\n </module>\n\n\nwhen i'm deploying it in local weblogic server it's working fine, but when i deployed it in the server, first.war is working fine but second.war is not. when i tried to access some pages from second.war file like \n\n\n \"http://host:port/second/somepage.html\"\n\n\n, i'm getting Error 404-Object Not Found Exception."
] | [
"java",
"jakarta-ee",
"web-applications",
"servlets",
"weblogic"
] |
[
"Can one think of \"let\" and other Rust idioms in terms of assembly?",
"When writing in C, it's straightforward to reason about how assignments will look like after compilation. I know Rust is a higher level language that uses functional features, but since it's referred to as a \"system language\" I wonder if that's possible in Rust too.\n\nFor example, I want to loop through an array of integers and calculate the biggest product of 3 adjacent numbers:\n\nunsigned int a[10] = {4, 2, 3, 8, 1, 0, 7, 4, 9, 2};\nunsigned int i, p=1, max=0;\nfor(i=0; i<8; i++, p=1) {\n p = a[i] * a[i+1] * a[i+2];\n if(p>max) max = p;\n}\n\n\nThe equivalent Rust code could look like this (not sure if this is the idiomatic way):\n\nlet a = [4, 2, 3, 8, 1, 0, 7, 4, 9, 2];\nlet mut max = 0;\nfor i in 0..8 {\n let p = a[i] * a[i + 1] * a[i + 2];\n if p > max {\n max = p;\n }\n}\n\n\nIn C, p is a variable that is defined before the loop and is assigned a new value every time; in Rust on the other hand, let p is used within the loop, which is confusing to think about in a procedural way.\n\nIs C closer to assembly code? Or is it possible to reason about Rust just as well?"
] | [
"rust"
] |
[
"How to using randomize and then ORDER BY?",
"I want to first randomize and then order by a field my query.\nI used this code but it doesn't order by based on \"ad_type\" priority and only randomize the query. \nHow can I solve my problem?\n\n SELECT ROW_NUMBER() OVER \n ( \n ORDER BY a.ad_type ASC,NEWID()\n )AS RowNumber \n ,a.Id\n ,a.ad_title\n ,b.Name a_state\n ,a.ad_brief \n ,a.ad_pic \n INTO #Results \n FROM [tbl_ads] a LEFT JOIN tbl_state b ON a.ad_state=b.Id"
] | [
"sql",
"tsql"
] |
[
"Where to find android achartengine source code?",
"I'm not able to find achartengine source code. I just find the demo source code but there is no way of getting into the library code there!\n\nI'm trying to dowload from here:\n\nhttp://code.google.com/p/achartengine/downloads/list\n\nAny ideas?\n\nThank you!"
] | [
"android",
"achartengine"
] |
[
"Calendar cuts when i open it in a modal popup",
"I am facing an issue when I open a bootstrap datepicker in a modal pop-up it cuts off. Please have a look and provide me some suggestion or solutions if available.\n\n<input id=\"doohMediaStartDate\" name=\"startDate\" class=\"form-control input-sm\" \nautocomplete=\"off\" ng-model=\"slot.startDate\" placeholder=\"Start Date\" />"
] | [
"html",
"css",
"angularjs",
"twitter-bootstrap",
"datepicker"
] |
[
"Read a file in a jtable",
"I have a code like this : \n\nprivate void jTable4MouseClicked(java.awt.event.MouseEvent evt) { \n if (evt.getClickCount() == 1) {\n System.out.println(\"clicked\");\n int row = jTable4.getSelectedRow();\n if (row != -1) {\n String firstColumnValue = jTable4.getModel().getValueAt(row, 0).toString();\n String secondColumnValue = jTable4.getModel().getValueAt(row, 1).toString();\n jTextAreaMainFileHighlight.setText(firstColumnValue); // just show name of a file\n jTextAreaComparingFileHighlighter.setText(secondColumnValue); // just show name of a file\n\n }\n\n\nYou know, the jtabel is contains a name of file. How to read that file to and then show in jTextArea"
] | [
"java",
"swing",
"file-io",
"jtable",
"jtextarea"
] |
[
"Make all TabBarItems initially unselected",
"In TabBar first TabBarItem is default selected.\n But is there any possibility to keep unselected all tab initially?\n\nYou can see the below image first TabItem is default selected\n\nTab Bar Image"
] | [
"swift",
"storyboard",
"uitabbarcontroller",
"tabbar"
] |
[
"ionic.bundle.js break down into separate imports",
"We are gradually rewriting mobile html5 with Angular.js into Ionic framework. So we have got dozens of functions calling angular.js directly.\n\nIonic provides a bundle, which combined angular and ionic. We don't want use this bundled one.\n\nAs the Ionic CDN docs stated, http://code.ionicframework.com/, we can break down the bundle into separated files.\n\nBut no luck to get this work. I tried this on Ionic codepen demos, http://codepen.io/ionic/pen/tfAzj\n\ni.e. I replaced \n\n<script src=\"//code.ionicframework.com/nightly/js/ionic.bundle.js\"></script>\n\n\nby using:\n\n<script src=\"//code.ionicframework.com/1.3.1/js/ionic-angular.js\"></script>\n\n<script src=\"//code.ionicframework.com/1.3.1/js/ionic.js\"></script>\n\n\nhow to fix it? thanks."
] | [
"javascript",
"angularjs",
"ionic-framework"
] |
[
"Logging into vbullentin using curl . Need some javascript work",
"EDIT: solved. I missed a '&'.\nTrying to log into http://www.techenclave.com/forums/ using curl.\nThis is the form:\n\n <form action=\"http://www.techenclave.com/login.php?do=login\" method=\"post\" onsubmit=\"md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)\">\n <input type=\"text\" class=\"form-field\" name=\"vb_login_username\" accesskey=\"u\" tabindex=\"101\" value=\"User Name\" onfocus=\"if(this.value == 'User Name') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = 'User Name';}\" /> \n<More inpUT FIELDS HEre>\n.\n.\n.\n<input type=\"hidden\" name=\"vb_login_md5password_utf\" /> </form>\n\n\nI got this so far:\n\n$ref = \"http://www.techenclave.com\" ;\n\n define(\"WEBBOT_NAME\", \"Mozilla/5.0 (Windows; U; Windows NT\n5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\");\n define(\"CURL_TIMEOUT\", 25);\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"http://www.techenclave.com/login.php?do=login\") ; // Target site\n curl_setopt ($ch, CURLOPT_COOKIEFILE, \"C:/cookie-techenclave.txt\"); \n\n curl_setopt($ch, CURLOPT_COOKIEJAR, \"C:/cookie-techenclave.txt\");\n curl_setopt($ch, CURLOPT_REFERER, $ref); \n curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT); // Timeout\n curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME); \n curl_setopt ($ch, CURLOPT_POST, 1);\n curl_setopt ($ch, CURLOPT_POSTFIELDS, \"vb_login_username=cute.bandar&vb_login_password=\".md5(\"mypass)\"\n .\"securitytoken=guest&cookieuser=1&do=login&vb_login_md5password=&vb_login_md5password_utf=\");\n\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects\n curl_setopt($ch, CURLOPT_MAXREDIRS, 4); // Limit redirections to four\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return in string \n\n $webpage['FILE'] = curl_exec($ch);\n curl_close($ch);\n echo $webpage['FILE'] ;\n\n\nThis doesn't work. Wrong username/password error. MY password is fine, me thinks the problem iscaused by this piece of javascript:\n\n onsubmit=\"md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)\n\n\nDefinition of md5hash from the javascript file:\n\nfunction md5hash(B,A,E,C){\nif(navigator.userAgent.indexOf(\"Mozilla/\")==0&&parseInt(navigator.appVersion)>=4){\nvar D=hex_md5(str_to_ent(trim(B.value)));\nA.value=D;if(E){D=hex_md5(trim(B.value));\nE.value=D\n} if(!C){B.value=\"\"}}return true};\n\n\nSo basically the function md5hash is setting 3/4 vars before they are posted. Do I have to emulate this function is php ? Or is there some other thing that I am over looking ?\n\nThanks"
] | [
"php",
"javascript",
"curl"
] |
[
"How can I perform a \"match or create\" operation in py2neo v3?",
"I want to create a Node/Relationship only if a Node/Relationship with the same attributes doesn't already exist in the graph. If they do, I would like to fetch the relevant item.\n\nRight now I am doing something that I suppose is both unidiomatic and inefficient. Assuming each Person node has a unique pair (name, age), I do something like this:\n\ntry:\n node = graph.data('MATCH (n:Person) WHERE n.name = {name} AND'\n 'n.age = {age} RETURN n LIMIT 1',\n name=my_name, age=my_age)[0]['n']\nexcept IndexError:\n node = Node('Person', name=my_name, age=my_age)\n\n\nTo my understanding find_one() works only if you have just one property to search for, and match_one() allows no properties for relationships."
] | [
"python",
"database",
"neo4j",
"py2neo"
] |
[
"Solr Query Syntax conversion from boolean expression",
"I'm attempting to query solr for documents, given a basic schema with the following field names, data types irrelevant:\n\nI'm attempting to match documents that match at least one of the following:\noccupation, name, age, gender but i want to OR them together\n\nHow do you OR together many terms, and enforce the document to match at least one?\n\nThis seems to be failing: +(name:Sarah age:24 occupation:doctor gender:male)\n\nHow do you convert a boolean expression into solr query syntax? I can't figure out the syntax with + and - and the default operator for OR."
] | [
"solr",
"lucene"
] |
[
"How to add a column that contains the corresponding column name with the largest number in Python?",
"I have a data frame like this:\n\nA1 A2 A3 ...A99 largest\n0 3 4 6 11 11\n1 1 8 2 ... 1 8\n.\n.\n.\n\n\nI created the column which contains the largest value in each row by using:\n\ndata['largest']=data.max(axis=1)\n\n\nbut I also want to get a column which contains the corresponding column name with the largest number, something like this:\n\n A1 A2 A3 ...A99 largest name\n0 3 4 6 11 11 A99\n1 1 8 2 ... 1 8 A2\n. .\n. .\n. .\n\n\nI tried '.idxmax' but gave me an error'reduction operation 'argmax' not allowed for this dtype', can someone help me? Many thanks."
] | [
"python",
"pandas",
"dataframe",
"max",
"data-science"
] |
[
"Reading output of git push from PHP exec() function",
"I'm writing a deployment command for my framework's command line tool. It uses git to deploy.\n\nI have a line where I do this:\n\nexec(\"git push {$remote} {$branch}:{$branch}\", $shell_output, $status);\n\n\nI would like to have the output of the push inside $shell_output, but its not happening (The output just shows up on terminal). I think because git is an external program and therefore creates a new output stream?\n\nI've tried using an output buffer described here to no avail. I'm sure theres something on SO that can answer this, but haven't been able to find it after much digging..\n\nSo any help will be much appreciated :)"
] | [
"php",
"git",
"bash",
"operating-system"
] |
[
"Migrate huge cassandra table to another cluster using spark",
"I want to migrate our old Cassandra cluster to a new one. \n\nRequirements:-\n\nI have a cassandra cluster of 10 nodes and the table i want to migrate is ~100GB. I am using spark for migrating the data. My spark cluster has 10 nodes and each node has around 16GB memory.\nIn the table we have some junk data which i don't want to migrate to the new table. eg:- Let's say i don't want to transfer the rows which has the cid = 1234. So, what is the best way to migrate this using spark job ? I can't put a where filtering on the cassandraRdd directly as the cid is not the only column included in partitioned key. \n\nCassandra Table:-\n\ntest_table (\n cid text,\n uid text,\n key text,\n value map<text, timestamp>,\n PRIMARY KEY ((cid, uid), key)\n) \n\n\nSample Data:- \n\ncid | uid | key | value\n------+--------------------+-----------+-------------------------------------------------------------------------\n 1234 | 899800070709709707 | testkey1 | {'8888': '2017-10-22 03:26:09+0000'}\n 6543 | 097079707970709770 | testkey2 | {'9999': '2017-10-20 11:08:45+0000', '1111': '2017-10-20 15:31:46+0000'}\n\n\nI am thinking of something like below. But i guess this is not the best efficient approach.\n\nval filteredRdd = rdd.filter { row => row.getString(\"cid\") != \"1234\" }\nfilteredRdd.saveToCassandra(KEYSPACE_NAME,NEW_TABLE_NAME) \n\n\nWhat will be the best possible approach here ?"
] | [
"apache-spark",
"cassandra",
"spark-cassandra-connector"
] |
[
"GetStream / Stream Chat - Detect when a user rejects a channel invite",
"When a user gets invited to a stream channel -\nconst data = {\n members: [createdBy, ...invites],\n invites,\n created_by: { id: createdBy },\n};\nawait this.client.channel(CustomChannelTypes.call, channelId, data).create();\n\nI am watching for events -\nclient.on((event) => {\n console.log(event)\n})\n\nan event is fired - event.type is notification.invited and similarly when the invitation has been accepted - notification.invite_accepted, however there is no specific event for when rejecting an invite, when I do -\nchannel.rejectInvite()\n\ninstead, two events are fired - channel.updated and member.updated. Both of these event contain data about the fact that a user has an invite_rejected_at timestamp, however I believe so will any subsequent channel.updated and member.updated events, that were not caused by rejecting an invite. Therefore simply checking if an update event contains details of a user having an invite_rejected_at timestamp wouldn't be enough, as it may of happened in a previous channel.updated / member.updated event that was not when the user rejected. I'd prefer not to do a time comparison between now and invite_rejected_at as that could lead to me treated a single invite reject multiple times if I get multiple channel.updated within say a 500ms timespan.\nWithout a notification.invite_rejected, how can I detect when an invite has been rejected straight away?"
] | [
"javascript",
"getstream-io"
] |
[
"How to get name rather than id by using session variables in Yii2",
"I am saving a form by using submit button. On creating it I am redirecting it to another view. In this view I am passing the id of the model and then from that model I am setting the variables that I can use further. \n\npublic function actionViewpdf($id)\n{\n $model=$this->findModel($id);\n /*print_r($model);\n exit();*/\n $id = $model->id;\n $created_by = $model->created_by;\n $issuer = $model->issuer;\n $store = $model->store_id;\n $admin = $model->admin_incharge;\n $pm = $model->project_manager;\n\n\n $session = Yii::$app->session;\n $session ->set('id',$id);\n\n $session = Yii::$app->session;\n $session ->set('created_by', $created_by);\n\n $session = Yii::$app->session;\n $session ->set('user',$issuer);\n\n $session = Yii::$app->session;\n $session ->set('store', $store);\n\n $session = Yii::$app->session;\n $session->set('admin',$admin);\n\n $session = Yii::$app->session;\n $session ->set('pm',$pm);\n\n}\n\n\nIn my view I am showing these variables\n\n<h5>OGP Serial# : <?php echo Yii::$app->session['id']; ?></h5><br/>\n <h5>Created By: <?php echo Yii::$app->session['created_by']; ?></h5><br/>\n <h5>Issued To: <?php echo Yii::$app->session['user']; ?></h5><br/>\n <h5>Store: <?php echo Yii::$app->session['store']; ?></h5><br/>\n <h5>Admin In-Charge: <?php echo Yii::$app->session['admin']; ?></h5><br/>\n <h5>Project Manager: <?php echo Yii::$app->session['pm']; ?></h5><br/>\n\n\nThe output I am getting is \n\nOGP Serial# : 28\n\n\nCreated By: 12\n\n\nIssued To: 88\n\n\nStore: 10\n\n\nAdmin In-Charge: Faisal\n\n\nProject Manager: Ali\n\n\nNow in Created By, Store and Issued to I want to show the name instead of the ID\n\nI have searched for it but couldn't find the answers\n\nAny help would be highly appreciated."
] | [
"php",
"yii2",
"session-variables"
] |
[
"Torque/PBS can not find munge.socket.2",
"I am trying to create a virtual cluster for my MPI classes so i can work at home and not be at the university labs the whole day. I can not figure out for 2 days now how to fix this problem with munge.\n\nThe output of the problem i have is this\n\n[root@localhost lumx]# qmgr -c \"set server acl_hosts = mars\"\nmunge_encode failed: Failed to access \"/var/run/munge/munge.socket.2\": No such file or directory (6)\nUnable to communicate with localhost(127.0.0.1)\nCommunication failure.\nqmgr: cannot connect to server (errno=15009) munge executable not found, unable to authenticate\n\n\nMy hosts file looks like this\n\n127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 \n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n127.0.0.1 mpimaster localhost.localdomain localhost\n\n\nI am tried to read as much as I could and I ended up with these guides,Getting started with Open MPI on Fedora, Installing Torque/PBS job scheduler on Ubuntu 14.04 LTS,TORQUE Arch Linux, http://juanjose.garciaripoll.com/fedora-cluster/5-torque-pbs-queue"
] | [
"cluster-computing",
"virtual",
"fedora",
"pbs",
"torque"
] |
[
"Creating Ruby on Rails cloud hosting",
"There is a lot of demand in my country for rails and hosting, yet there is not one provider that does this. Are there packaged solutions, or at least guides, out there that can help me get started with providing hosting to people?\n\nYou can think of it as a local Heroku.com"
] | [
"ruby-on-rails",
"ruby",
"hosting",
"cloud"
] |
[
"How do I make the fill darker in a PCA plot from ggfortify::autoplot()?",
"I am making a PCA in ggplot, using ggfortify and need to fill to be darker, as it seems to default to semi-transparent. Example code:\nlibrary(ggfortify)\ndf <- iris[1:4]\n\npca_res <- prcomp(df, scale. = TRUE)\n\nautoplot(pca_res, data = iris, colour = 'Species', loadings = F, label = F, \n loadings.label = F, frame = T, main = "Iris", loadings.colour = "black", scale = 1,\n loadings.label.colour = "black") +\n theme_classic() +\n scale_color_manual(values = c("black", "black", "black")) +\n scale_fill_manual(values = c("blue", "red", "green"))\n\nthis figure looks like:\n\nI want the fill of the bounding area to be a much darker shade of color, like the "blue" or "red" would be if not semi-transparent."
] | [
"r",
"ggplot2",
"ggfortify"
] |
[
"Firebase to HTML page: how to not print 'undefined' when there is no value in the database",
"I hope I 'm providing all that is needed to explain my issue. I'm totally not good at scripts so forgive me my stupidity ... teach me to get better please. ˆˆ\n\nSo you will find my script here. \n\nI want to show all the records that meet the 'today or in the future' date. \nGoing well so far.\n\nNow some records do not have the field artists. And then the output is 'undefined'. Is there a way to cover this... just not print anything when the value and the field is not present?\n\n <script src=\"https://www.gstatic.com/firebasejs/7.2.0/firebase.js\"></script>\n\n\n <script>\n // Set the configuration for your app\n\n var config = {\n apiKey: \"xxx\",\n authDomain: \"xxx\",\n databaseURL: \"xxx\",\n storageBucket: \"xxx\"\n };\n firebase.initializeApp(config);\n\n // Get a reference to the database service\n\n //var db = firebase.database();\n const preObject = document.getElementById('Agenda');\n const ulList = document.getElementById('AgendaList');\n\n // Create references\n\n const dbRefObject = firebase.database().ref().child('Event');\n\n // Synch object changes\n\n dbRefObject.orderByChild(\"Date\").startAt(new Date().toISOString().slice(0,10)).on('child_added', snap => {\n\n var data = [];\n const li = document.createElement('li');\n var JSONValue = snap.val();\n\n // create a variable that checks wheater or not there is a picture. If there is a picture print the picture if not do not print anything\n var photo = \"\";\n if (JSONValue['Photo']!==undefined) {\n photo='<img class=\"photo\" src=\"'+JSONValue['Photo']+'\">'; \n }\n\n // check the value of the status field. If the status is Cancelled, print the status. else do not print anything\n var status = \"\"; \n if (JSONValue['Status']==='Geannuleerd') {\n status='<span class=\"status\">'+JSONValue['Status']+'</span>';\n }\n\n // check the value of the message field. If the message is nieuwsbericht then do not print the date. Else print the date.\n var date = \"\";\n if (JSONValue['Message']==='Concert') {\n date=JSONValue['FullDate'] + '-' + JSONValue['ShortTime']; \n }\n\n // check the value of the message field. If the message is nieuwsbericht then do not print the date. Else print the date.\n var title = \"\";\n if (JSONValue['Message']==='Concert') {\n title=JSONValue['Concert']; \n } \n\n li.innerHTML = '<div class=\"event\">'+photo+'<h3>' +date+ '</h3>' + '<h1>' +title+ '</h1>' + JSONValue['Artists'] + '</div>';\n li.id = snap.key;\n ulList.appendChild(li);\n\n });\n </script>\n\n\nenter image description here"
] | [
"javascript",
"html",
"firebase"
] |
[
"Core data fetch request with GROUP BY",
"I have a table in my application which consists of some names and phone numbers and orderIDs and dates (4 columns).\nI want to get an array of all distinct phone numbers (Note that someone with a phone number may have several orderIDs).\n\nTest case: suppose that this is the current records of my table.\n\nName phoneNumber orderID date\nJohn 1234 101 2014-12-12\nSusan 9876 102 2014-12-08\nJohn 1234 103 2014-12-17\n\n\nI want an array of distinct phone numbers only, something like: {1234, 9876}\nHow can I perform such a fetch in core data?\n\nAny help would be much appreciated. Thank you.\n\nP.S: As I knew in SQL I could do something like:\n\nSELECT phoneNumber FROM orders\n GROUP BY phoneNumber"
] | [
"ios",
"objective-c",
"sqlite",
"core-data"
] |
[
"Why am I getting a warning when using express app.param to pre-load object with sequelize?",
"I'm using express app.param to load objects from db (app.param('userId', users.userById);):\n\nexports.userById = function (req, res, next, id) {\n return user.findOne({\n where: { id: id }\n }).then(function (result) {\n req.user = result;\n next();\n }).catch(function (error) {\n next(error);\n });\n};\n\n\nAfter that I update the loaded object with the following code.\n\nexports.update = function (req, res) {\n var user = req.user;\n return user.update({\n //update properties\n }).then(function () {\n res.end();\n }).catch(function (error) {\n //error handling\n });\n};\n\n\nFor some reason I get the warning that \"a promise was created in a handler but was not returned from it\". \n\nI can't see why, but that always happen when I use a routing parameter that uses sequelize before making the actual changes to the database. \n\nWhat is the correct way to do this?\n\nI'm using sequelize v3.23.3 with Postgres.\n\nEDIT\n\nI changed the code to a more simple example that throws the same warning."
] | [
"node.js",
"sequelize.js"
] |
[
"Scheme implementations - what does it mean?",
"I'm a beginning student in CS, and my classes are mostly in Java. I'm currently going through \"Little Schemer\" as a self study, and in the process of finding out how to do that I have found numerous references to \"implementations\" of Scheme. My question is, what are implementations?\n\nAre they sub-dialects of Scheme, or is that something else (DrScheme seem to allow for different \"flavors\" of the language)? Is it just the name given to any given ecosystem incorporating an IDE, interpreter, interactive tool and the like?\n\nDo all other languages (e.g., Java) also have a variety of \"implementations\", or is it something reserved to \"open\" languages?\n\nThank you,\n\nJoss Delage"
] | [
"scheme",
"the-little-schemer"
] |
[
"Apache Open meetings run locally for development",
"I am aiming to use Open meetings in my project. Before doing that, I was starting with some UI colour changes and check the system on my local machine. For doing this, I cloned the Git repository https://github.com/apache/openmeetings .\n\nAfter this, executed the command: mvn clean install -PallModules\n*Working with Java version 11 and mvn version 3.6.3\n\nAfter the execution, build generates successfully:\n\n\n\nAfter this, as mentioned in git, I followed following steps:\n\n\ngo to openmeetings-server/target directory\nextract apache-openmeetings-x.x.x.tar.gz (or apache-openmeetings-x.x.x.zip for windows) to new directory\nenter to this new directory and execute ./bin/startup.sh (./bin/startup.bat for Windows)\n\n\nResults says, Tomcat started. Also with command netstat -lntp, I can see port 5080 is occupied by a java jar. \n\nBut, the problem is when i open http://localhost:5080, it successfully redirects me to http://localhost:5080/openmeetings/ but shows site can't be reached. \n\n\nThis is very weird, please help!"
] | [
"java",
"openmeetings"
] |
[
"Difference between CLR 2.0 and CLR 4.0",
"I have read countless blogs, posts and StackOverflow questions about the new features of C# 4.0. Even new WPF 4.0 features have started to come out in the open. What I could not find and will like to know:\n\n\nWhat are the major changes to CLR 4.0 from a C#/WPF developer perspective?\nWhat are the major changes to CLR 4.0 as a whole?\n\n\nI think, internally, most changes are for the new dynamic languages and parallel programming. But are there any other major improvements? Because language improvements are just that, language improvements. You just need the new compiler and those features can be used with a lower version of .Net, apart from version 1.0/1.1 (at least most of them can be used).\n\nAnd if the above features are the only ones, only for these features the version is changed to 4.0, which I think is 4.0 because of being based on .Net 4.0 version (i.e. after 1.0/1.1, 2.0 & 3.0/3.5). Is the version increment justified?\n\nEdited:\n\nAs Pavel Minaev pointed out in the comments, even those two features are CLR independent. There were speed and other improvements in 3.0 and 3.5 also. So why the version increment?"
] | [
"clr",
".net-4.0",
"c#-4.0"
] |
[
"Do you write your unit tests before or after coding a piece of functionality?",
"I was wondering when most people wrote their unit tests, if at all. I usually write tests after writing my initial code to make sure it works like its supposed to. I then fix what is broken. \n\nI have been pretty successful with this method but have been wondering if maybe switching to writing the test first would be advantageous?"
] | [
"unit-testing",
"testing",
"tdd"
] |
[
"How can we run the node-cron job in every 12 hours interval?",
"I want to schedule the email after every 12 hrs , For that I have used node-cron.\n\nI have used the following code but its not giving me actual result, so please help me to resolve this issue,\n\nvar job = new CronJob('0 0 */12 * * *', function(){\n //email send code ..\n});"
] | [
"node.js",
"cron",
"node-cron"
] |
[
"REPL.IT: Python Pygame: How do you fix \"pygame.error: No available audio device\" Error?",
"I am attempting to use Sounds with my Python Pygame Game and it threw me this error:\n\nTraceback (most recent call last):\n File \"main.py\", line 5, in <module>\n pygame.mixer.init()\npygame.error: No available audio device\n\n\nHow would I go about fixing this?\n\n*Thanks in advance for the help!"
] | [
"python",
"pygame",
"repl.it"
] |
[
"Fetching data from sql table and displaying on screen with react native and js",
"i just started learning about react native and apk development and i am making an application that is displaying the number of student that are present in a class. currently the text is some random letters where the quantity should be, but i want to fetch the number of records from the table and display it\n <ScrollView\n style={styles.mainView}\n contentContainerStyle={styles.mainCont}>\n <View style={{flex: 3}}>\n <Button\n title={(props) => (\n <View style={styles.textView}>\n <Text style={styles.titleStyle}>\n MATH CLASS STUDENTS\n </Text> \n <Text style={styles.subtitle}>SAMPLE</Text>\n </View>\n )}\n // title="MATH CLASS"\n onPress={this.mathObservation}\n buttonStyle={styles.buttonStyle}\n titleStyle={styles.titleStyle}\n />"
] | [
"javascript",
"sql",
"reactjs",
"react-native"
] |
[
"WPF DataGridComboBoxColumn does not work",
"I have a class called Person and a List called People, show below:\n\nnamespace WpfApplication1\n{\n public partial class MainWindow : Window\n {\n public List<Person> People;\n\n public MainWindow()\n {\n InitializeComponent();\n\n People = new List<Person>();\n People.Add(new Person() { ID = 1, Name = \"John\" });\n People.Add(new Person() { ID = 2, Name = \"Mike\" });\n }\n }\n\n public class Person\n {\n public int ID { get; set; }\n public string Name { get; set; }\n }\n}\n\n\nAnd I want to display the 2 Person in People to an DataGrid, using a combobox to choose between the 2 Person.\n\n<DataGrid x:Name=\"dataGrid1\" Height=\"300\">\n <DataGridComboBoxColumn Header=\"Name\" DisplayMemberPath=\"Name\" SelectedItemBinding=\"{Binding Path=Name}\">\n <DataGridComboBoxColumn.EditingElementStyle>\n <Style TargetType=\"ComboBox\">\n <Setter Property=\"ItemsSource\" Value=\"{Binding Path=People}\"/>\n </Style>\n </DataGridComboBoxColumn.EditingElementStyle>\n <DataGridComboBoxColumn.ElementStyle>\n <Style TargetType=\"ComboBox\">\n <Setter Property=\"ItemsSource\" Value=\"{Binding Path=People}\"/>\n </Style>\n </DataGridComboBoxColumn.ElementStyle>\n </DataGridComboBoxColumn>\n</DataGrid>\n\n\nBut the DataGrid just display nothing at all. What's the problem?"
] | [
"c#",
"wpf",
"datagrid",
"datagridcomboboxcolumn"
] |
[
"How do I reverse all Strings in my array?",
"How do I reverse my array output? Like \"peter\" to \"retep\" or \"max\" to \"xam\"\n\nI tried to use collections but it's not working\n\nThis is my code:\n\nimport java.util.Scanner;\nimport java.util.Collections;\n\npublic class sdf {\n\n public static void main (String[] args) {\n Scanner input = new Scanner(System.in);\n String[] my_friend_names = new String[10];\n\n for (int i = 0; i < my_friend_names.length; i++) {\n my_friend_names[i] = input.nextLine();\n }\n for(int i = 0; i < my_friend_names.length; i++) {\n System.out.println(\"Name: \" + my_friend_names[i]);\n }\n\n Collections.reverse(input);\n System.out.println(\"After Reverse order: \" +input);\n }\n\n}"
] | [
"java",
"java.util.scanner",
"reverse"
] |
[
"How to detect if an intent comes from parse?",
"i'm looking for a cleaner way to check if an intent comes from parse, right now this is my code\n\nprivate void intentIsFromParse() {\n Bundle bundle = getIntent().getExtras();\n if (bundle != null) {\n if (bundle.getString(\"com.parse.Data\") != null)\n Toast.makeText(MainActivity.this, bundle.getString(\"com.parse.Data\"), Toast.LENGTH_LONG).show();\n else\n Toast.makeText(MainActivity.this, \"Not parse\", Toast.LENGTH_LONG).show();\n }\n}\n\n\nThanks!"
] | [
"android",
"parse-platform"
] |
[
"c++ destruct staic variable in function with memory allocation",
"I have little question about c++\n\nhow can I destruct this code without memory leak?\n\nvoid classA::funcA()\n{\n static char* cArr = new char[10];\n}\n\n\njust don't write like this style?"
] | [
"c++",
"memory-management",
"memory-leaks",
"static",
"destructor"
] |
[
"jest/enzyme mock function in functional component",
"I have a functional component and I wanted to test it with mock function \n(simplified demonstration)\n\nconst remove = () => {\n ... do something\n}\n\nconst removeButton = (props) => (\n <Button onClick={() => remove()}>\n Remove\n </Button>\n);\n\n\nI tried with this test case\n\nit('test remove button', () => {\n const test = shallow(<removeButton/>)\n const mockFunction = jest.fn()\n test.instance().remove = mockFunction\n test.find('Button').simulate('click')\n expect(mockFunction).toHaveBeenCalled()\n})\n\n\n.instance().remove could not mock the function because it is out of scope.\nHow would I mock the function remove ?"
] | [
"reactjs",
"mocking",
"jestjs",
"enzyme"
] |
[
"How to dynamically compare same period based on a slicer",
"I would like to compare the same period of sessions per day. If i'm looking at Oct 10th 2018 to Oct. 16th 2018 (Wednesday to Tuesday), I would like to compare it to the same day range of last week:\n\n+------+-------+-----+----------+-------------+--+\n| year | month | day | sessions | last_period | |\n+------+-------+-----+----------+-------------+--+\n| 2018 | oct | 10 | 2000 | 2500 | |\n| 2018 | oct | 11 | 2500 | 2400 | |\n| 2018 | oct | 12 | 2600 | 2300 | |\n| 2018 | oct | 13 | 2700 | 2450 | |\n| 2018 | oct | 14 | 2400 | 2500 | |\n| 2018 | oct | 15 | 2300 | 2200 | |\n| 2018 | oct | 16 | 2000 | 1150 | |\n+------+-------+-----+----------+-------------+--+\n\n\nA simple formula can make it work based on the 7-day interval:\n\nsame_last_period = CALCULATE(SUM(table[Sessions]),DATEADD(table[Date],-7,DAY))\n\n\nbut I would like the formula to depend on a date slicer. Say if i wanted to look at the Oct 1-Oct 20. I would like my formula to change and look at the same period right before with the same amount of day intervals. Ultimately this would be graphed as well."
] | [
"powerbi",
"dax"
] |
[
"Can't find Single View Application on XCode",
"I just started learning Swift for school projects, I installed XCode 12 on the App Store but now on the tutorials I'm trying to follow they tell me to create a "Single View Application" but on the different templates I have there is no Single View Application.\nI tried to chose other templates but when I do that I don't have the same files as the one in the tutorial.\nI've tried to look on Internet about single view application for XCode 12 and Swift 5 but didn't find anything.\nHow can I create a Single View Application with this configuration ?"
] | [
"ios",
"swift",
"xcode",
"mobile"
] |
[
"UICollectionView reload only first cell",
"I have a collectionView in my app and i want to reload only first cell of collection view.\nHow can i reload only first cell of UICollectionView?"
] | [
"ios",
"objective-c",
"uicollectionview",
"uicollectionviewcell"
] |
[
"Get items form a Table",
"I Have this table:\n\n<table class=\"table table-hover\">\n <thead>\n <tr>\n <th>No.</th>\n <th>Name</th>\n <th>Type</th>\n <th>Phone</th>\n <th>S.N.</th>\n <th>Date</th>\n </tr>\n </thead>\n <tbody>\n <tr style=\"cursor:pointer\" onclick=\"mandaDetalle(this.id)\">\n <td>PE-6</td>\n <td>John Smith</td>\n <td>GT5</td>\n <td>845254585</td>\n <td>56456456456</td>\n <td>14/07/2017</td>\n </tr>\n </tbody>\n </table>\n\n\nHow Can I send onclick that <tr> element with the items into a javascript (or jquery) function, I already sending the id of that one <tr> but I need to send the items as well, because I need to manipulate them, I need to store each <th> into a variable, so I can use them later."
] | [
"javascript",
"html"
] |
[
"Passing string/path arguments on my main program to open image files",
"I'm trying to make a program similar to Windows Photo Viewer, the program that pops up usually if you double-click an image in Windows. I've already made my own program, however it uses a JFileChooser associated with a button to bring up images to open inside the application itself (Windows photo app doesn't seem to do this). \n\nQuestion:\n\nHow can I make my application handle certain file types when its double-clicked from Windows? My guess would be something along the lines of my main class having a Path/String type argument of the file I want to open, but I'm not sure how to exactly implement that.\n\nWhat type does Windows pass to a program whenever we open a file? String? \n\nOnce my first question is fixed, is there anything special I would need to do to associate my program to image files (when making .exe file or installer)?"
] | [
"java",
"swing",
"arguments",
"file-association"
] |
[
"i am using angularjs and django-cors-headers then give \"which is disallowed for cross-origin requests that require preflight.\"",
"I have a Django local sever that refer to 8000 port number, And a local nginx that load 2080 port number html page.\n\nI install django-cross-header package for resolving cross-domain error.\n\ndjango-cross-header config in settings.py:\n\nCORS_ALLOW_CREDENTIALS = True\n\n\nCORS_ORIGIN_ALLOW_ALL = True\n\n CORS_ALLOW_HEADERS = (\n 'x-requested-with',\n 'content-type',\n 'accept',\n 'origin',\n 'authorization',\n 'x-csrftoken'\n )\n\n CORS_ORIGIN_WHITELIST = (\n '127.0.0.1:2080',\n 'localhost:2080'\n )\n\n\nConfig angularjs is like this:\n\nportman.config(function ($routeProvider, $interpolateProvider, $httpProvider) {\n $routeProvider.otherwise('/');\n $httpProvider.defaults.headers.common['X-CSRFToken'] = csrftoken;\n $interpolateProvider.startSymbol('{$').endSymbol('$}');\n delete $httpProvider.defaults.headers.common['X-Requested-With'];\n\n });\n portman.constant('ip','http://127.0.0.1:8000/');\n\n\nGet method code in angularjs is:\n\n$http({\n method: 'GET',\n url: ip+'api/v1/dslam/events',\n }).then(function (result) {\n $scope.dslam_events = result.data;\n }, function (err) {\n\n });\n\n\nrequest header is :\nProvisional headers are shown\n\nAccept:application/json, text/plain, */*\nOrigin:http://127.0.0.1:2080\nReferer:http://127.0.0.1:2080/\nUser-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36\nX-CSRFToken:ztouFO8vldho97bWzY9mHQioFk3j6h5V\n\n\nAfter loading the page I see this error:\n\nXMLHttpRequest cannot load http://127.0.0.1:8000/api/v1/dslam/events.The request was redirected to 'http://127.0.0.1:8000/api/v1/dslam/events/', which is disallowed for cross-origin requests that require preflight.\n\n\nBut when i send request from console it will corectly response from django server, my jquery code :\n\n$.ajax({\n type: 'GET',\n url: \"http://5.202.129.160:8020/api/v1/dslam/events/\",\n success:function(data){\n console.log(data);\n }\n });\n\n\nrequest header is:\n\nAccept:*/*\nAccept-Encoding:gzip, deflate, sdch\nAccept-Language:en-US,en;q=0.8,fa;q=0.6,pt;q=0.4\nConnection:keep-alive\nHost:127.0.0.1:8000\nOrigin:http://127.0.0.1:2080\nReferer:http://127.0.0.1:2080/\nUser-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36\n\n\nplease help me."
] | [
"python",
"angularjs",
"django",
"django-cors-headers"
] |
[
"Moving multiple objects simultaneously in createJS/easelJS",
"I've been using easelJS within the createJS framework for a project and have enjoyed it a lot until recently hitting a roadblock. I have multiple objects that I'd like to move simultaneously when one of the group is dragged. Here is my current situation:\n\n\n\nWhat I'd like to do is when the red circle is moved, the red crosshairs would also move so that they appear to be \"locked\" to the circle. The same with the green circle.\n\nI have been able to accomplish something very close to this by adding the circles and crosshairs to a container, as mentioned in the answers to this question:\n\nEaseljs Scrollable Container\n\nBut the issue I encounter is that the container is actually a rectangle, such that I can click anywhere between the circle and crosshairs to move the various objects contained within the container. Instead I would like for the objects to be moved only when I click on a circle.\n\nDoes anyone have any idea how to accomplish this? Am I correct in thinking this can be accomplished somehow with easelJS containers?"
] | [
"javascript",
"createjs",
"easeljs"
] |
[
"The import javax.servlet cannot be resolved (only in runtime)",
"Maven build is completing successfully, but when the war is run in Apache tomcat 7, it gives the following error:\n\njava.lang.Error: Unresolved compilation problems:\n\nThe import javax.servlet.ServletOutputStream cannot be resolved"
] | [
"java",
"spring",
"jsp",
"spring-mvc",
"servlets"
] |
[
"How to place code snippets within Visual Studio 2010 Toolbox window?",
"I've really enjoyed Anders Hejlsberg presentation at BUILD 2011 and it's not the first time that I notice someone having a collection of code snippets available within Visual Studio's Toolbox window, so given that all the searches I've performed so far pointed me to how to deal with IntelliSense snippets, I was wondering if anyone knows how to achieve this?"
] | [
"visual-studio",
"visual-studio-2010",
"code-snippets"
] |
[
"Implement a dynamic dropdown menu based on on the number of lines of text file",
"I am trying to achieve a dropdown which changes dynamically based on the number of lines of text file.\nI can find the number of lines using:\n\nwith open('Cipher 3.5 Output.txt') as f:\n Line_Count = (sum(1 for _ in f))\n\n\nWhat I am then trying to do is make the dropdown have an option for each line in the file, for example if the file has three lines the dropdown will have the options 1, 2 and 3.\n\nI am trying to achieve this so that in my encryption program the user can choose which line of their encrypted text file to read and decrypt.\n\nCurrently my interface looks like this:\n\n\nI am planning to add a label between Key2 and Output which reads 'Choose line' or something to that effect, and then a dropdown box between the two Entry boxes. Finally I will add a button between the Random Key and Clear buttons which will set the line number to 'all' and read the whole file.\n\nSo, how can I implement the dynamically changing dropdown? Your help is appreciated.\n\nI very much doubt you'll need it but see Here for the rest of my code."
] | [
"python",
"dynamic",
"drop-down-menu",
"tkinter"
] |
[
"No Android Kit in Qt 5.2 for Android",
"My OS is Debian Wheezy, I downloaded and installed the Qt 5.2.0 for Android (Linux 64-bit, 488 MB) installer.\n\nThis installer, I assume, is meant to work out of the box. When I create a new project, however, there are no Android Kits, only the Desktop kit. This is how the dialog looks like:\n\n\n\nHas anyone else had the same problem? How did you solve it?"
] | [
"android",
"c++",
"linux",
"qt"
] |
[
"Python, Pandas. Converting from cumulative values to deltas",
"I have a pandas series of dates and cumulative values like this:\n\n'2015-01-01': 1\n'2015-01-02': 3\n'2015-01-03': 7\n'2015-01-04': 8\n\n\nCan I use pandas to convert them in \"deltas\" like this?\n\n'2015-01-01': 0 \n'2015-01-02': 2\n'2015-01-03': 4\n'2015-01-04': 1\n\n\nOr should I just do it manually?"
] | [
"python",
"pandas",
"time-series"
] |
[
"Newline not working with lists in embedded messages - Discord.py",
"I have a list with newlines as variable called result \n\n['**Status: **Enabled\\n**Q: **What is 2 + 2?\\n **\\\\ A: **4\\n\\n**Author: **UltimateDucc#9121\\n\\n\\n', '**Status: **Enabled\\n**Q: **Where is Ethiopia?\\n **\\\\ A: **Africa\\n\\n**Author: **BigSnacc#2466\\n\\n\\n']\n\n\nWhen I send it as an embedded message through discord:\n\n l_msg = discord.Embed(\n title = f'Page {list_msg}',\n description = str(result), \n colour = discord.Colour.blue()\n ) \n await message.channel.send(embed = l_msg)\n\n\nIt comes out as this with every \\n being ignored for whatever reason.\n\n\n\nAny help is appreciated."
] | [
"list",
"newline",
"discord.py"
] |
[
"Update changes made in datagridview into Access 2016",
"I made a connection with an Access database (Access 2016) using dataset, bindingsource, tableadapter, bindingnavigator, and datagridview.\n\nIt works, I can navigate in the datagridview, make changes, add and delete records in the datagridview, but these changes don't appear in the Access DB.\n\nData is loaded with:\n\nPrivate Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load\n 'TODO: This line of code loads data into the 'FacturatieDataSet.Catalogus' table. You can move, or remove it, as needed.\n CatalogusTableAdapter.Fill(FacturatieDataSet.Catalogus\nEnd Sub\n\n\nFor deleting I use:\n\nPrivate Sub BindingNavigatorDeleteItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorDeleteItem.Click\n CatalogusBindingSource.RemoveCurrent()\n CatalogusTableAdapter.Update(FacturatieDataSet.Catalogus)\nEnd Sub\n\n\nI'm new with VB 2015, I'm not a programmer, I do this for personnal study.\n\nWhat is an (easy) solution to my problem?"
] | [
"vb.net",
"ms-access",
"datagridview"
] |
[
"how can i calculate total hrs in between logged in and logout with php",
"It is an attendance management system. \nOne user' s working time schedule like this \n\nSection 1\nFrom: 10:00 To: 13:00\n\nSection 2 \nFrom 14:00 To 17:00\nBreak time 13 to 14 (1 hr) \n\nUser can multiple times logged and logout\nIf he/she logged and logout like this ( it is saved in two array variable)\n\nLogged: 10:00. logout 12:00\nLogged: 12:30. logout 13:30\nLogged: 13:45. logout 17:00\ntotal hrs worked = 6 hrs 15 minutes \n\nbut i want to deduct user worked in between 13 to 14 ( break hrs)\nso actual he worked total hrs - worked in between break hrs(ie 45 minutes) \nso how can solve this puzzle programmatically"
] | [
"javascript",
"php",
"codeigniter",
"mysqli"
] |
[
"PSQL query to create table of relationships given purchases and churn tables",
"my SQL-fu isn't what it used to be, so I thought I'd ask you wizards this.\n\nThe (simplified) tables in question are:\n\nPurchases\n- customer_id int\n- purchase_date timestamp\n\nChurns\n- customer_id int\n- churn_date timestamp\n\nCustomers\n- id int\n\n\nWhat I would like to end up with is a result set that looks like this:\n\ncustomer_id | first_purchase_in_relationship | churn_date (if applicable)\n\nThe trick here is that customers can churn and then \"reactivate\" and make more purchases, so there may be multiple entries for a customer."
] | [
"sql",
"psql"
] |
[
"Unable to get repr for when query'ing python 2 class",
"Django has following build in class:\n@python_2_unicode_compatible\nclass ResetPasswordToken(models.Model):\n\nI'm writing a test and want to check if there is a reset password token in db for a specific user. So I do:\ntoken = ResetPasswordToken.objects.filter().all()\n\nHower python has problems with this:\nUnable to get repr for <class 'django.db.models.query.QuerySet'>\n\nI think this is because I am using python 3 and above the model there is a '@python_2_unicode_compatible'?\nHow can I do this correctly? Thanks"
] | [
"python",
"django"
] |
[
"Why setting $window.location.href does not work when set inside a promise?",
"I send request to the server and want conditionally redirect to another page (not angular) after response is received. Thus navigation happens inside then part of a promise.\n\nI tried: \n\n$location.path(url)\n\n\nand \n\n$window.location.href = url;\n$windo.location.reload();\n\n\nnothing works.\n\nBut if I wrap either of these two calls with setTimeout(navigate,0) redirection occurs.\nSeems like Angular guards url during digest cycle.\n\nCan anyone clarify or share the links explaining what really happens."
] | [
"angularjs",
"angular-routing"
] |
[
"php correctly convert between encodings",
"I've just spent the last 3 hours tracking down a display problem on one of my pages. The text was a garbled mess. The problem turned out to be the use of utf8_encode on an existing utf8 string. As noted in the docs it can only convert ISO-8859-1. Why does it have such a misleading name? /rant.\n\nWhat is the proper, less error prone, way of detecting and converting encodings in PHP?"
] | [
"php",
"unicode"
] |
[
"ORM relationships in Kohana",
"I have the following tables:\n\nusers { id, name }\nevents { id, name }\nuser_events { id, date, user_id, event_id }\nuser_summaries { id, user_id, event_id, qty }\n\n\nTable user_events stores all user events (there are many of the same types at different times) and user_summaries stores how many of each type of events occured to each user. The former gets only INSERT queries and the latter mostly UPDATE ones.\n\nOf course both user_events and user_summaries have foreign keys to link with users and events tables.\nI want to represent this relation in my Models in Kohana. I have experience with foreign keys, but it's my first approach to both Kohana and ORM and I'm not sure really how to define my models there to represent these relations.\n\nWhat I want to be able to do is basically this:\n\n// I'm able to do this.\n$user = ORM::factory('user', 1);\n$user_events = $user->events->find_all();\n$user_summaries = $user->usersummaries->find_all();\n\n// I'm able to do this, too.\n$event = ORM::factory('event', 1);\n$event_users = $event->users->get_all();\n\n// I don't know how to be able to do this:\n$user_event = ORM::factory('userevent', 1);\n$user_details = $user_event->user->find();\n$event_details = $user_event->event->find();\n\n\nMy current models look like this:\n\n# classes/model/user.php\nclass Model_User extends ORM\n{\n protected $_has_many = array(\n 'scores' => array(),\n 'usersummaries' => array(),\n );\n}\n\n# classes/model/event.php\nclass Model_Event extends ORM\n{\n protected $_has_many = array(\n 'scores' => array(),\n 'usersummaries' => array(),\n );\n}\n\n# classes/model/userevent.php\nclass Model_Userevent extends ORM\n{\n protected $_belongs_to = array(\n 'user' => array(),\n 'event' => array(),\n );\n}\n\n# classes/model/usersummary.php\nclass Model_Usersummary extends ORM\n{\n protected $_belongs_to = array(\n 'user' => array(),\n 'event' => array(),\n );\n}\n\n\nCurrently calling:\n\n$user_event = ORM::factory('userevent', 1);\n$user_details = $user_event->user->find();\n\n\nreturns always the first user from users table, even though userevent has different user_id.\nI presume I need to change something in Model_userevent but I'd use with some help.\n\nNB. I'm using Kohana 3.0.8."
] | [
"orm",
"kohana-3",
"kohana-orm"
] |
[
"Error importing scalding in sbt project",
"I got this error why importing the scalding sbt in my project build.sbt(ref:\nHow to declare dependency on Scalding in sbt project?). Kindly help me out. \n\nlazy val scaldingCore = ProjectRef(uri(\"https://github.com/twitter/scalding.git\"), \"scalding-core\")\nlazy val myProject = project in file(\".\") dependsOn scaldingCore\n\n\n\n Error:Error while importing SBT project:...[warn] ====\n public: tried [warn]\n https://repo1.maven.org/maven2/com/twitter/scalding-core_2.10/0.16.0-SNAPSHOT/scalding-core_2.10-0.16.0-SNAPSHOT.pom\n [info] Resolving org.scala-lang#scala-compiler;2.10.4 ... [info]\n Resolving org.scala-lang#scala-reflect;2.10.4 ... [info] Resolving\n org.scala-lang#jline;2.10.4 ... [info] Resolving\n org.fusesource.jansi#jansi;1.4 ... [warn]\n :::::::::::::::::::::::::::::::::::::::::::::: [warn] ::\n UNRESOLVED DEPENDENCIES :: [warn]\n :::::::::::::::::::::::::::::::::::::::::::::: [warn] ::\n com.twitter#scalding-core_2.10;0.16.0-SNAPSHOT: not found [warn]\n :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note:\n Unresolved dependencies path: [warn]\n com.twitter:scalding-core_2.10:0.16.0-SNAPSHOT [warn] +-\n myproject:myproject_2.10:0.1-SNAPSHOT [trace] Stack trace suppressed:\n run 'last myProject/:update' for the full output. [trace] Stack trace\n suppressed: run 'last myProject/:ssExtractDependencies' for the full\n output. [error] (myProject/:update) sbt.ResolveException: unresolved\n dependency: com.twitter#scalding-core_2.10;0.16.0-SNAPSHOT: not found\n [error] (myProject/:ssExtractDependencies) sbt.ResolveException:\n unresolved dependency: com.twitter#scalding-core_2.10;0.16.0-SNAPSHOT:\n not found"
] | [
"scala",
"twitter",
"sbt",
"scalding"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.