texts
sequence
tags
sequence
[ "Put tmp files in an external dir with Ember?", "In Ember.js projects I always find it so disruptive that ember server creates such a massive dump of rapidly changing files to the tmp folder in my project directory. \n\nI often create projects in a cloud-synced folder, so these files tend to hit my daemon over the head with a mallet. \n\nAlso, it messes up my IDE's indexing and I have to manually exclude it every time. \n\nIs there a way to configure to run ember s to put tmp outside of my project directory? Putting it into /tmp or ~/.tmp would be great." ]
[ "ember.js", "ember-cli" ]
[ "Magento 2: Add Image to the Customer Account Navigation Menu", "I hope everyone is doing well!\n\nI am new to Magento 2. I would like to add Image for all the menus in "Customer Account Navigation Menu" at the top of each link.\nI am able to change the text of the Link but don't know how to add Image.\nI request you all, please take a look at the highlighted part where I would like to add images for each link and properly guide me through this.\nThank you in advance.\nStay Home Stay Safe!" ]
[ "php", "magento", "magento-2.0", "magento-2.3", "magento2.2" ]
[ "Fetch multiple Record Types from CloudKit", "I have a segmented control with four different segments and would like to fetch multiple record types at once. Have only managed to fetch one at a time. Would like to fetch all the 4 record types, use segmented control to display them in their corresponding tableviews. Is there anyway way. I'm fairly new to Swift and iOS. \n\n@IBOutlet weak var segmentControl: UISegmentedControl!\n\nlet recordType = \"WebBooks\"\n\nvar web = [CKRecord]()\nvar mobile = [CKRecord]()\nvar windows = [CKRecord]()\nvar databases = [CKRecord]()\n\nfunc fetchBooksFromCloud() {\n let cloudContainer = CKContainer.default()\n let publicDatabase = cloudContainer.publicCloudDatabase\n let predicate = NSPredicate(value: true)\n let query = CKQuery(recordType: recordType, predicate: predicate)\n}\n\nfunc tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n\n var returnValue = 0\n\n switch segmentControl.selectedSegmentIndex {\n case 0:\n returnValue = web.count \n default:\n break\n }\n return returnValue\n}\n\nfunc tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n let cell = tableView.dequeueReusableCell(withIdentifier: \n \"CategoriesCell\", for: indexPath) as! HomeTableViewCell\n\n switch segmentControl.selectedSegmentIndex {\n case 0:\n\n let webBooks = web[indexPath.row]\n\n cell.bookName.text = web.object(forKey: \"name\") as? String\n cell.authorName.text = web.object(forKey: \"author\") as? String\n\n if let image = web.object(forKey: \"image\") {\n let imageAsset = image as! CKAsset\n\n if let imageData = try? Data.init(contentsOf: imageAsset.fileURL) {\n cell.bookImageName.image = UIImage(data: imageData)\n }\n }\n default:\n break\n }\n return cell\n}" ]
[ "ios", "swift", "uitableview", "uisegmentedcontrol", "cloudkit" ]
[ "Excel not properly generate in angularjs", "i am using angularjs and generate excel-sheet using blob with the help of filesaver.js i am getting my properly but excel will not open correctly in Micrsoft Excel it's working but i am not getting the cells it's shows black white page but content is there .help how to solve \n\nhere i attached my fiddle:https://jsfiddle.net/x30v0bym/3/" ]
[ "angularjs", "excel", "blob", "filesaver.js" ]
[ "Why does UIView.StringSize need to run on the UI thread?", "If I run UIView.StringSize from within some async code like a Task.ContinueWith, it will blow up with a UIKitThreadAccessException because that method starts with a call to UIApplication.EnsureUIThread ("Go to declaration" in MonoDevelop; I'm not sure the license allows me to post it here).\nTask.Factory.StartNew(() => {\n // Blows up discretely...nothing written to application output.\n // Also blows up for UIViews that exist only in code (not rendered).\n SizeF textSize = someView.StringSize(someString, someFont, new SizeF(someView.Bounds.Width, float.MaxValue), UILineBreakMode.WordWrap);\n Console.WriteLine(textSize);\n});\n\nIf I wrap this simplified version in InvokeOnMainThread, all is well, but I definitely have times when I want to measure some text without that call. As well, I fully understand the exception's purpose and it has saved me a bunch of hassle when called something deep within async code before, but in this case the use of EnsureUIThread here seems unnecessary. If I simply restate that call as a hit on the NSString class, it will happily run outside the UI thread.\nTask.Factory.StartNew(() => {\n // Outputs expected size data: "{Width=##, Height=##}".\n using (NSString nssSomeString = new NSString(someString)) {\n SizeF textSize = nssSomeString.StringSize(someFont, new SizeF(someView.Bounds.Width, float.MaxValue), UILineBreakMode.WordWrap);\n Console.WriteLine(textSize);\n }\n});\n\nThe code for UIView.StringSize appears to do roughly the same NSString work and there doesn't appear to be anything blatantly UI-thread-oriented. Is there something I am missing that would require this version of the method to be called from the UI thread?\nEdit (2013-01-17):\nI filed a bug with Xamarin just to see their response. It sounds like they are looking into marking this method as ThreadSafe." ]
[ "xamarin.ios" ]
[ "I have two network cards, the SMTP sends from working network card", "I have two network cards in my server, and both of them are connected, one is connected local and other one internet, \n\nI have created a SMTP service, the problem is that the smtp only tries sending emails from the local network card. \n\nI want it to try send emails from the internet network card, how can this be solved?" ]
[ "networking", "routing", "smtp" ]
[ "add creation/modified time to python template in vim script", "I wrote a simple python template in ~/.vim/template/pythontmp.txt, \n\nand use \n\n$> autocmd bufnewfile *.py :0r ~/.vim/template/pythontmp.txt\n\n\nto load the template when i create a new python script.\n\nThe problem is that i'd like to add creation time to the comment of the document.\n\nHow can I do this? Thanks!" ]
[ "python", "vim" ]
[ "Show a button when scrolls the map using Google maps v2", "I am using a Google Maps v2 to show the locations plotted on it. I unhide a refresh button when scrolls on the map. I just used CameraChange method to get the callback, but it is getting called when I search for a location using the Edit text or fetch current location. How to limit this to get callback when I manually scroll on the Map." ]
[ "android", "google-maps" ]
[ "Php url handling -urlencode not working -Stirng to url -special charater handling", "String = \"KOA Axial Carbon Film Resistor 3.3k? ±5% 0.25W -450 ? +350ppm/°C\"\n\n\nError link after encode \n\nhttp://www.api.simplyduty.com/api/Classification/get-hscode?APIKey=A36AFAA1-A570-4279-84CC-ECE4B9EB76F6&fullDescription=KOA+Axial+Carbon+Film+Resistor+3.3k%CE%A9+%C2%B15%25+0.25W+-450+%E2%86%92+%2B350ppm%2F%C2%B0C&originCountry=AM&destinationCountry=AW\n\n\nbut i want this type of conversion as browser do conversion \n\nhttp://www.api.simplyduty.com/api/Classification/get-hscode?APIKey=A36AFAA1-A570-4279-84CC-ECE4B9EB76F6&fullDescription=KOA%20Axial%20Carbon%20Film%20Resistor%203.3k?%20%C2%B15%%200.25W%20-450%20?%20+350ppm/%C2%B0C&originCountry=AM&destinationCountry=AW\n\n\ncorrect string how can i get this\n\n\"KOA%20Axial%20Carbon%20Film%20Resistor%203.3k?%20%C2%B15%%200.25W%20-450%20?%20+350ppm/%C2%B0C\"" ]
[ "php", "string", "url", "encoding" ]
[ "how to access a member/element of an stdClass Object?", "I need to access the member/element of an stdClass Object, my response is in json_decode I need to access some specific element from the result here is my response\n\nstdClass Object\n(\n [status] => 200\n [result] => Array\n (\n [0] => stdClass Object\n (\n [postcode] => AB10 1XG\n [quality] => 1\n [eastings] => 393149\n [northings] => 805924\n [country] => Scotland\n [nhs_ha] => Grampian\n [longitude] => -2.1148480012509\n [latitude] => 57.14416009476\n [parliamentary_constituency] => Aberdeen South\n [european_electoral_region] => Scotland\n [primary_care_trust] => Aberdeen City Community Health Partnership\n [region] => \n [lsoa] => West End North - 01\n [msoa] => West End North\n [nuts] => Gilcomston\n [incode] => 1XG\n [outcode] => AB10\n [distance] => 0.564254268\n [admin_district] => Aberdeen City\n [parish] => \n [admin_county] => \n [admin_ward] => Midstocket/Rosemount\n [ccg] => Aberdeen City Community Health Partnership\n [codes] => stdClass Object\n (\n [admin_district] => S12000033\n [admin_county] => S99999999\n [admin_ward] => S13002482\n [parish] => S99999999\n [ccg] => S03000012\n )\n\n )\n\n\nNow I need postcode in a variable" ]
[ "php", "json" ]
[ "How to include a file from subdomain in PHP", "i'm trying to include a file from my subdomain into a file located in the main domain...\n\nSo for example: \n\nsub.domain.com/inc/template/file.php <--- (I need to include THIS file)\n\ndomain.com/index.php <----- (INTO this file)\n\nso far i've tried:\n\ninclude('http://sub.domain.com/inc/template/file.php')\n\n\nbut this is not safe because i would need to enable url_fopen with php... so i'm trying to find an alternate way to do this...\n\nAlso i'd like to know if when i include a file, can i for example echo a variable once the file it's included.\n\nThanks in advance." ]
[ "php", "include" ]
[ "jQuery UI Draggable, Sortable - Disallow dragging element", "this is the script I'm using:\n\n $(\".nav .row\").draggable({\n connectToSortable: \".demo\",\n helper: \"clone\",\n handle: \".drag\",\n drag: function (e, t) {\n t.helper.width(400)\n },\n stop: function (e, t) {\n $(\".demo .column\").sortable({\n opacity: .35,\n connectWith: \".column\"\n })\n }\n});\n\n\nBasically what it does is that it allows dragging new rows and allows dragging elements inside columns inside these rows.\n\nHere is an example output:\n\n<div class='demo'>\n <div class='row'>\n <div class='column'>\n </div>\n </div>\n</div>\n\n\nThe problem with it is that it allows dragging another row inside that column class, I want to prevent this from happening, this is what happens:\n\n<div class='demo'>\n <div class='row'>\n <div class='column'>\n <div class='row'>\n <div class='column'>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\nCan anyone give me some suggestions how I could prevent this from happening?" ]
[ "javascript", "jquery", "jquery-ui", "draggable", "jquery-ui-sortable" ]
[ "Ways to download multiple patches in Android Application?", "I'm pretty new to Android so excuse me for uncertainty.\n\nI have been reading quite a lot about Android lately and have come across the idea of using expansion files with them (.obb) and their use as patches. But I guess there is only one patch file which can be uploaded with any Android Application on the Play Store. (Correct me if I'm wrong)\n\nI have an idea which can help minimise the app size and give users full flexibility to control what they need. When you first install my app, it will have all the basic functions required for the app to work (example: code for performing a specific function) Then if the user tries to perform another option, the app will connect online and will know how to handle the event. (This will be worked out later)\n\nBut, in the settings menu I want to give users a choice. They can check all the modules they want offline, so that my app doesn't need to connect online for those particular modules. If they check, for example, two modules, then their .java files will be downloaded and their data will be used next time instead of the app going online.\n\nI want to know if this is possible or not. If yes, how and where do I make my app download the additional .java files and how do I implement their inclusion in the current app. Is there a workaround for this flexibility?\n\nComment if you need more details." ]
[ "java", "android", "android-download-manager", "apk-expansion-files" ]
[ "How to commit my files in a git bare repo", "So I'm trying to learn git and I'm trying to make a git repo on my Debian virtual machine and play around with some files in order to learn the git commands. I've installed git core files, then I did the steps from this tutorial\nSo i created the git user, created a /home/git/mydir.git and in it I executed\ngit --bare init\nThis is the step I'm stuck at. From what I've read so far, I need to go in the folder where my project files are at, and run:\ngit remote add central git@debianvm:myrepo.git\nto add a central repo, but it doesn't work, it says not a git repository.\nWhat am I missing? are there any steps or something that I need to perform? I'm a little confused about git bare repo and central repo concepts. Any advices or links on starting with git repositories would be appreciated." ]
[ "git", "repository" ]
[ "Simple use of variable with select * in Oracle", "I know MSSQL very well. But when trying some basic things of SQL in Oracle I am getting in trouble. Tried to search on other sites but didn't found proper + simple example. \nSuppose I have SQL statements as follows\n\nDeclare @mID int = 45\nSelect * from MyTable where id= @mID\n\n\nI tried to write same code in Oracle (SQL Developer). But it didn't worked.\n\nDeclare \nmID number := 45\nBegin\nSelect * from MyTable where id= mID\nEnd;\n\n\nActually, I tried some more statements but didn't executed. All I got was ERRORS.\nCan anyone come up with simple & correct solution?" ]
[ "oracle", "variables", "oracle-sqldeveloper" ]
[ "Multiple File Handles for the Same File", "So this question got me thinking. I did some testing with multiple file handles for the same file, and found some odd results that I was hoping someone could explain.\n\n>>> f1 = open(\"test.txt\",'w')\n>>> f1.close()\n>>> f1, f2 = open(\"test.txt\", 'w'), open(\"test.txt\", 'w')\n>>> f1 == f2\nFalse\n>>> f1, f2 = open(\"test.txt\", 'r'), open(\"test.txt\", 'r')\n>>> f1 == f2\nFalse\n\n\nWhy do these tests not return True? Surely assigning a handle to the same file should have the same value. \n\nWhat's the underlying mechanism for these comparisons to return False and what is the rationale for creating this behavior?" ]
[ "python", "python-2.7" ]
[ "how to Write in MATLAB one function, Its inputs are : • Array of only 4 elements (4 pixels)", "How to write in MATLAB one function, its inputs are:\n\n\nArray of only 4 elements (4 pixels) \nThe location (x,y) of the\ninterpolated pixel relatively to the pixel (0,0)\n\n\nIts out put is the new intensity of the interpolated pixel. \nBilinear interpolation." ]
[ "arrays", "matlab" ]
[ "remove favicon white background", "I need to remove white background from a favicon at www.webwoods.co.uk/lsss/index.html (the black and red star)\n\nis there a way of doing this with the commonly used graphic editors (Adobe CC, Paint, etc.)?\n\nI have created a favicon online, but it doesn't remove the background; also, I used a PNG with transparent background.\n\nThanks!" ]
[ "transparency", "favicon" ]
[ "Are there other people that are having issues with iOS entitlements with iOS version 13.1.2?", "iOS Universal links (generated by branch.io) are working inconsistently across different devices.\n\nWe are using branch.io to generate links to send users to our app when it is installed, and to the App Store when the app is not installed. We have tested branch.io links on eight iOS devices. Seven devices are running 13.1.2 and one device is running 13.1. All of the devices have our app installed. When clicking on the branch.io link, five of the devices open the app directly and three of the devices incorrectly go to the App Store (one of which is running 13.1).\n\nI have checked the apple-app-site-association file to make sure that it is correct - https://link.insponetwork.com/apple-app-site-association by using the aasa validator - https://branch.io/resources/aasa-validator/.\n\nI'm wondering if others have noticed issues with entitlements not working as they should with their app since the 13.1.2 update came out. If so, has anyone found a workaround or any other information about this issue." ]
[ "ios", "branch.io", "entitlements" ]
[ "mysql script bash loop", "I have a csv file contains list of numbers, \n\n479856252|1329148400996|1329148405406|1329148412444|0|6042292534|6042292534|14016487697|0|6\n479856262|1329148401487|1329148405287|1329148412444|0|6136992594|6136992594|14016487697|0|6\n479856272|1329148405124|1329148405124|1329148412470|0|8883398128||4016487697|0||P|0|7\n479856282|1329148114930|1329148117966|1329148412502|0|8006564132|8779918502|7657954163|2609\n\n\nwhen I do awk -F'|' '{print $1;}' file.csv > file2.csv\n\nI get the following table IDs\n\n12345\n67891\n32234\n22345\n12345\n\n\nI have a for loop which works like this \n\nfor i in `cat file2.cvs`\ndo \nDELETE FROM TABLE1 WHERE ID = $i\ndone \n\n\nhowever this creates high load on my box, I'm hoping that I could split the operation (for each 100 records from file2.csv) perform the deletion and then sleep for 1 seconds the proceeds with remaining values till the end of file.\n\nYour help is highly appreciated. \n\nThank you" ]
[ "mysql", "bash" ]
[ "How to run SQL query with inside a javascript loop(map)?", "what I'm trying to do is:\n\nloop through array of objects using map function\nrun multiple SQL queries according to object\nappend result of queries with object\n\nI'm looping through offers which is array of object.I get free_item and buy_item which are associated with offer.I am using knexjs for postgresql database with nodejs\nHere's actual code:\noffers = await Promise.all(offers.map(async offer => {\n free_item_id = await db("offer_free_items").where({"offer_free_items.offer_id":offer.id}).select(["item_id"]).first()\n console.log("-----------------debug line 1------------------")\n\n buy_item_id = await db("offer_buy_items").where({"offer_buy_items.offer_id":offer.id}).select(["item_id"]).first()\n console.log("-----------------debug line 2-------------------")\n\n offer["free_item_id"] = get_item_id\n offer["buy_item_id"] = buy_item_id\n return offer\n}))\n\nThe Problem is it is not running in correct sequence.The sequence of the output is\n\ndebug line 1\ndebug line 1\ndebug line 2\ndebug line 2\n\nThe correct order should be like this:\n\ndebug line 1\ndebug line 2\ndebug line 1\ndebug line 2" ]
[ "sql", "node.js", "postgresql", "async-await" ]
[ "Log to Aptana console when debugging JavaScript", "I'm using Aptana Studio 3 to debug JavaScript code. It is a simple HTML page which is displayed in Internet Explorer.\n\nI want to write log messages to the Aptana Console view. I have tried to use the following log function:\n\nfunction log(message) {\n setTimeout(function() { throw new Error(message);}, 0);\n}\n\n\nThis works, but when debugging the page, Aptana stops because of the throw. I have two questions:\n\n\nIs there a built-in function to write log messages to the console?\nIf not, is there a way to tell the Aptana debugger to ignore the specific throw in my log function above?\n\n\nSolutions should work in IE8 and above. Switching to another browser is not possible." ]
[ "javascript", "internet-explorer", "aptana" ]
[ "Change file extensions of multiple files in a directory with terminal/bash?", "I'm developing a simple launchdaemon that copies files from one directory to another. I've gotten the files to transfer over fine.\n\nI just want the files in the directory to be .mp3's instead of .dat's\n\nSome of the files look like this: \n\n\n 6546785.8786.dat\n 3678685.9834.dat\n 4658679.4375.dat \n\n\nI want them to look like this: \n\n\n 6546785.8786.mp3\n 3678685.9834.mp3\n 4658679.4375.mp3 \n\n\nThis is what I have at the end of the bash script to rename the file extensions.\n\ncd $mp3_dir\nmv *.dat *.mp3\nexit 0\n\n\nProblem is the file comes out as *.mp3 instead of 6546785.8786.mp3\n\nand when another 6546785.8786.dat file is imported to $mp3_dir, the *.mp3 is overwritten with the new .mp3\n\nI need to rename just the .dat file extensions to .mp3 and keep the filename. \n\nIdeas? Suggestions?" ]
[ "iphone", "bash", "terminal", "file-extension", "launch-daemon" ]
[ "What is the size in pixels of 1 space", "I am creating a cipher converter, where I am having trouble adiconar the figures because of the size of the spaces:\n\nEx: if I give 10 spaces with the keyboard, how many px or Pt have ??\n\nBy default my css looks like this:\n\ndisplay: block;\np - block user agent stylesheet\nfont-family: arial;\n.word - arial\nfont-size: 13.3333330154419px;\n.word - 10pt\nheight: 15px;\nmargin-bottom: 0px;\n* - 0px\nmargin-left: 0px;\n* - 0px\nmargin-right: 0px;\n* - 0px\nmargin-top: 0px;\n* - 0px\npadding-bottom: 0px;\n* - 0px\npadding-left: 0px;\n* - 0px\npadding-right: 0px;\n* - 0px\npadding-top: 0px;\n* - 0px\ntext-transform: uppercase;\n.word - uppercase\nwidth: 1663px;\nrendered Fonts\nArial-27 glyphs\n\n\nIn the tests we do here, font Arial 10pt, is giving 4px each space ... is it?\n\n function getTextWidth(text, font) {\n // if given, use cached canvas for better performance\n // else, create new canvas\n var canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement(\"canvas\"));\n var context = canvas.getContext(\"2d\");\n context.font = font;\n var metrics = context.measureText(text);\n return metrics.width;\n };\n\n\n/console.log(getTextWidth(' ', \"normal 10pt arial\"));" ]
[ "html", "css" ]
[ "app freezes when i try to get data from string stuct?", "i just recently asked a question and got help but i have another problem with my custom c string. everything compiles fine but when i try to get something it freezes, or it could be when i delete it. what am i doing wrong? heres my code:\n\nmain.c\n\n#include <stdio.h>\n#include \"String.h\"\n\nint main(int argc, char *argv[]) {\n String *some_string = String_New(\"hello\");\n printf(\"%s\\n\", String_CharPtr(some_string));\n String_Delete(some_string);\n return 0;\n}\n\n\nString.h\n\n#ifndef _STRING_H\n#define _STRING_H\n\ntypedef struct String String;\n\nextern String *String_New(char */*basic_string*/);\nextern void String_Delete(String */*string*/);\nextern char *String_CharPtr(String */*string*/);\nextern unsigned int String_GetLength(String */*string*/);\nextern unsigned int String_GetSize(String */*string*/);\n\n#endif\n\n\nand finally:\n\nString.c\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <malloc.h>\n\n#include \"String.h\"\n\nstruct String {\n char *basic_string;\n unsigned int length;\n};\n\nString *String_New(char *basic_string) {\n String *temp = NULL;\n temp->length = strlen(basic_string);\n temp->basic_string = (char *) malloc(temp->length + 1);\n strcpy(temp->basic_string, basic_string);\n return temp;\n}\n\nvoid String_Delete(String *string) {\n free(string->basic_string);\n string->basic_string = NULL;\n}\n\nchar *String_CharPtr(String *string) {\n return string->basic_string;\n}\n\nunsigned int String_GetLength(String *string) {\n return string->length;\n}\n\nunsigned int String_GetSize(String *string) {\n return string->length + 1;\n}" ]
[ "c", "string" ]
[ "Issues to copy and paste from a workbook (loop error)", "I'm trying to loop through a folder of excel files (around 6 files or so), copy data from a named table and paste values into a master. I've tried using the DataBodyRange instead of standard range but i'm having problems with it pasting into ThisWorkbook (where the master will live). The paste destination is the same size as source and should be pasted on next empty row,so on and so forth. I'm two days into banging my head on the wall and can't figure this out.Any help or insight would be amazing.\n\nSub SalesTrackerCompiler()\n\nDim Myfile As String, str As String, mydir As String, wb As Workbook\n\n Set wb = ThisWorkbook\n mydir = \"C:\\Users\\$$$$$$$$$$$$\\\"\n Myfile = Dir(mydir & \"*.xlsm\")\n ChDir mydir\n Application.ScreenUpdating = 0\n Dim erow As Long\n\n\n Do While Myfile <> \"\"\n Workbooks.Open (Myfile)\n With Worksheets(\"Data Input Table\")\n Worksheets(\"data input table\").ListObjects(\"DataInputSource\").AutoFilter.ShowAllData\n Set rng = ListObjects.Item(1).DataBodyRange.Select\n rng.Copy wb.Worksheets(\"regional source data\").Cells(Rows.Count, \"a\").End(xlUp).Offset(1, 0)\n\n\n ActiveWorkbook.Close True\n\n End With\n Myfile = Dir()\n\n Loop\n\nEnd Sub" ]
[ "excel", "vba" ]
[ "Why not validate a Camel Uri using java.net.URI", "I had a colleague ask me, why I don't create the uris for a camel component (consumer/producer) using javas URI class:\n\nfrom(java.net.URI.create(someUriString).toString())\n\n\nThe reason this might make sense is, that there is automatic validation for the given uri, before it is interpreted by camel (when the uri is in part loaded from a configuration file, some validation could be useful).\n\nThe thing is, that I have never seen anybody create a camel uri like this, everybody just uses plain Strings.\nIs there a reason, why we never use java.net.URI to validate a uri for camel, or is there even a drawback in doing it?" ]
[ "java", "apache-camel" ]
[ "How to access elements inside MLMultiArray in CoreML", "I have initialized MLMultiArray using initWithDataPointer as shown in the code below:\n\nfloat count = 512 * 384;\n double *tempBuffer = malloc(count * sizeof(double));\n NSError *error = NULL;\n NSArray *shape = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:512],[NSNumber numberWithInt:384], nil];\n NSArray *stride = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:1],[NSNumber numberWithInt:1], nil];\n\n MLMultiArray *mlMultiArray = [[MLMultiArray alloc] initWithDataPointer:tempBuffer\n shape:shape\n dataType:MLMultiArrayDataTypeDouble\n strides:stride\n deallocator:^(void * _Nonnull bytes) { free(bytes); }\n error:&error];\n\n\nBased on the MLMultiArray documentation mentioned in this link, subscript needs to be used for accessing elements.\n\nIf I access the elements in the way shown, is it correct?\n\nNSNumber *val = [mlMultiArray objectForKeyedSubscript:[NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:1],[NSNumber numberWithInt:1], nil]];" ]
[ "ios", "objective-c", "multidimensional-array", "machine-learning", "coreml" ]
[ "Android - What's a good strategy to get the CPU usage of a given package?", "I am trying to get the CPU usage of a given package. After some research, I found a way to get the CPU usage of a process (reading /proc/[PID]/stat/ information) but I couldn't find a way to go to the package level (a process can run many packages).\n\nI'd say it's impossible to do given that the SDK doesn't offer such APIs to monitor CPU usage (as it does with memory usage) but I'd rather know what you think about this.\n\nThank you!" ]
[ "android", "process", "monitoring" ]
[ "Difference between using > and nothing CSS", "Well, this is a really simple question.\n\nI really can't understand what's the real difference between using > and nothing in CSS.\n\nHTML\n\n<p>\n Some text <h3>here</h3>\n</p>\n\n\nCSS\n\np > h3{\n text-transform: uppercase;\n}\n\np h3{\n text-transform: lowercase;\n}\n\n\nCan someone explain me this?\n\nThank you." ]
[ "css", "nested" ]
[ "Android - create notifications", "I have question about notifications. I want to build an app with one buttons called (add notification) when I press add notification a notification is created Then, if I press the notification it takes me back to the activity.\n\nI managed to create a notification but when i press on it, it makes nothing. What do I have to add so the notification sends me back to the activity?\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n}\n\nNotificationManager nmanger;\nstatic int id=1;\n\npublic void buclick(View view) {\n NotificationCompat.Builder nbuild= (NotificationCompat.Builder) new NotificationCompat.Builder(this)\n .setContentTitle(\"Danger\")\n .setContentText(\"the raining is comming soon\")\n .setSmallIcon(R.drawable.amule);\n\n nmanger =(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);\n nmanger.notify(id,nbuild.build());\n id++;\n}" ]
[ "android", "notifications" ]
[ "PHP socket_connect() Permission Denied", "Ok, so I've got a nice php server running that has opened an AF_UNIX socet using this little function I written. Which gets called like so \n\n$IPC_connector = socket_create_IPC('/tmp/connection');\n\n\nfunction socket_create_IPC($FILE)\n{\n #Create a AF_UNIX socket\n if(!($socket = socket_create(AF_UNIX, SOCK_STREAM, 0)))\n {\n $errorcode = socket_last_error();\n $errormsg = socket_strerror($errorcode);\n\n die(\"Couldn't create socket: [$errorcode] $errormsg \\n\");\n }\n\n #Bind\n if( !socket_bind($socket, $FILE) )\n {\n $errorcode = socket_last_error();\n $errormsg = socket_strerror($errorcode);\n\n die(\"Could not bind socket : [$errorcode] $errormsg \\n\");\n }\n\n if(socket_listen($socket) === false) \n {\n die(\"socket_listen() failed: reason: \" . socket_strerror(socket_last_error($socket)) . \"\\n\");\n }\n\n socket_set_nonblock($socket);\n\n return $socket;\n}\n\n\nThen I wrote a client that connected to this server like this \n\nif(!($IPC = socket_create(AF_UNIX, SOCK_STREAM, 0)))\n{\n $errorcode = socket_last_error();\n $errormsg = socket_strerror($errorcode);\n\n die(\"Error:Couldn't create socket - [$errorcode] $errormsg \\n\");\n}\necho \"socket_create(): \".socket_strerror(socket_last_error($IPC)).\"\\n\";\n\nif(!(socket_connect($IPC, '/tmp/connection')))\n echo \"socket_connect() failed, reason: \".socket_strerror(socket_last_error($IPC)).\"\\n\";\n\n\nThe Client actually get's called from an AJAX request from a webpage in which it should connect to the server, grab some data, and then return that data back to the webpage. The ajax request is made in javascript. I've tested the client/server connection without the AJAX request and it works, but as soon as I attempt it with AJAX through the webpage the client returns \"socket_connect() failed, reason: Permission denied\" from the echo statement in the script. Maybe there is some little oversight I'm missing? I assume that Ajax is being called through httpd (apache). I'm sure it's probably some type of file permission thing but I can't figure out exactly what is causing it.\n\nThings I've tried thus far,\n\nMade sure safe_mode was off in php.ini,\ntried \"setsebool -P httpd_can_network_connect on\" to attempt to thwart SElinux,\nalso tried \"setenforce 0\" which made no difference either.\nI tried changing the file permissions of /tmp and all subdirectories to 777 to no avail.\nI'm running out of ideas and thought maybe somebody had seen this issue before,\nI also looked at this, which is the file that my server is creating ->\n\n[root@ip-000-000-000-000 tmp]# ls -lZa connection\nsrwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 connection\n\n\nIf anybody is interested in the AJAX call I use this\n\nfunction communication (IP, MechanismID, CommandName) {\n $.post('php/connectDisconnect.php', {\n IP : IP,\n MechanismID : MechanismID,\n CommandName : CommandName\n }, \n function(data) {\n if(data.search(\"Error\") != -1)\n alert(data);\n });\n}\n\n\nwhere connectDisconnect.php is the client from above." ]
[ "php", "ajax", "sockets", "ipc", "selinux" ]
[ "I can not get data from jQuery muscles", "I am learning tutorial, but I understand that the author made a mistake / mistakes.\nThe data is sent via GET in php and write, but do not turn back.\n\nJavaScript:\n\n function loadAllPost() {\n var divs = $(\"#posts\");\n\n $.get(\"twitor.php?action=last\", function() {\n var posts = [];\n for(var i = 0; i < posts.length; i++) {\n var newPost = addNewPost(posts[i].name, posts[i].text, posts[i].date);\n posts.push(newPost);\n }\n divs.children().remove();\n divs.append(posts);\n });\n\n }\n\n\n $(function() {\n loadAllPost();\n setInterval(loadAllPost, 5000);\n $(\"#submit\").click(function() {\n var newPostName = $(\"#name\").val();\n var newPostText = $(\"#text\").val();\n var newPostDate = (new Date()).toLocaleString();\n var newPost = addNewPost(newPostName, newPostText, newPostDate);\n newPost.hide();\n $(\"#posts\").append(newPost);\n newPost.slideToggle();\n\n $(\"name\").val(\"\");\n $(\"text\").val(\"\");\n\n $.post(\"twitor.php?action=new\", {\n text: newPostText,\n name: newPostName\n });\n });\n });\n\n\nIe like php sends data, but does not have JS embeds them in HTML.\n\nPHP:\n\nif ($_GET['action'] == 'new') {\n addNewPost();\n}\nelseif ($_GET['action'] == 'last') {\n getLastPosts();\n}\n\nfunction getPDO(){\n $db_host = \"****\";\n $db_name = \"****\";\n $db_user = \"****\";\n $db_pass = \"****\";\n $PDO = new PDO(\"mysql:host=$db_host;dbname=$db_name\", $db_user, $db_pass);\n //$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);\n return $PDO;\n}\n\nfunction addNewPost(){\n $params = [];\n $params['name'] = $_POST['name'];\n $params['text'] = htmlspecialchars($_POST['text']);\n $PDO = getPDO();\n $Statement = $PDO->prepare(\"INSERT INTO posts(`name`, `text`, `date`) VALUES (:name, :text, NOW());\");\n $Statement->execute($params);\n}\n\nfunction getLastPosts() {\n $PDO = getPDO();\n $Statement = $PDO->query(\"SELECT * FROM posts ORDER BY date DESC LIMIT 15\");\n if(!$Statement) return;\n $posts = $Statement->fetchAll(PDO::FETCH_ASSOC);\n echo json_encode($posts);\n}" ]
[ "javascript", "php", "jquery", "mysql" ]
[ "React Router DOM using separate files for routes", "Basically I want to seperate the public and private routes in two different files for simplicity, however it seems like the first component put inside the Switch in App.js is being hit and not the other, thus if and routes are being hit in the second component in Switch it would render a blank page as the route is being looked from the first component in the Switch.\nApp.js\n<Switch>\n <UnAuthenticatedRoutes />\n <AuthenticatedRoutes />\n </Switch>\n\nUnAuthenticatedRoutes.jsx\n <Route path="/" exact component={HomePage}/>\n <Route path="/about" component={AboutPage}/>\n \n\nAuthenticatedRoutes.jsx\n <ProtectedRoute path="/profile" component={ProfilePage}/>\n <ProtectedRoute path="/documents" component={DocumentsPage}/>\n\nSo the problem is if I put "/about" in the URL it hits to the first component (UnAuthenticatedRoutes) and renders the page correctly, however, if I try to go to "/profile" (after being authenticated) it renders nothing because it is looking up the "/profile" in the UnAuthenticatedRoutes file (since it comes before the AuthenticatedRoutes in the App.js). I was expecting it to look it up in the AuthenticatedRoutes after it fails to find it in UnAuthenticatedRoutes which is not the case. How can I overcome this issue? Thanks in advance." ]
[ "javascript", "reactjs", "react-router-dom" ]
[ "pyparsing - defining keywords - compare Literal, Word, Keyword and Combine", "I have problem the same as here (nested function calls)\n\nI want also limit functor to be only one of many given words (a, b, c)\n\nso legal is:\n\na(dd, ee)\nb(a(1)) \n\n\nbut not:\n\naa(b(9)) - aa is invalid functor here\n\n\nI can achieve that using one of:\n\nfunctor1 = Literal('a') | Literal('b') | Literal('c')\nfunctor2 = Word('a') | Word('b') | Word('c')\nfunctor3 = Keyword('a') | Keyword('b') | Keyword('c')\nfunctor4 = Combine(Keyword('a') | Keyword('b') | Keyword('c'))\n\n\nfirst is easy, but rest is too ambiguous for me (especially when Word has param asKeyword, but its code do not use Keyword class and vice-versa).\n\nplease compare it.\n\nare the OR-list work as Combine ?" ]
[ "python", "pyparsing" ]
[ "Finding used functions from php source file", "Basically I want to find a function from a php string source content. I'm trying to parse a php file and read its content into string. I want to find something like:\n\nfunction_name(paras) or function_name() or function_name(params, params)\n\nfor example if source contains:\n\necho 'Greetings'.greet(\"I'm Johan\");\n$age = date_of_birth(date());\necho 'I am ' .$age . 'years old';\n\n\nit would then find greet, date_of_birth, date because these are the functions used." ]
[ "php", "regex", "preg-match", "preg-match-all" ]
[ "How to output a variable value in HTML or JavaScript?", "How could I output values of some variables in HTML or JavaScript?\n\nI have this html file on my cellphone:\n\n\n\n\r\n\r\n text = \"\";\r\n function Show(x)\r\n {\r\n text = text + \" \" + x;\r\n document.getElementById(\"Line\").innerHTML = text;\r\n }\r\n \r\n .GoToPanelButtons {\r\n color: maroon;\r\n background:pink;\r\n font-size:72px;\r\n }\r\n <div>Click randomly on any of these buttons:</div>\r\n <button class=\"GoToPanelButtons\" onclick=\"Show('cat')\">cat</button>\r\n <button class=\"GoToPanelButtons\" onclick=\"Show('dog')\">dog</button>\r\n <button class=\"GoToPanelButtons\" onclick=\"Show('rat')\">rat</button>\r\n <br>\r\n <br>\r\n <div>Here is what you've clicked on:</div>\r\n <br>\r\n <div id=\"Line\">---</div>\r\n\r\n\r\n\n\nand I want to be able to return to what I have typed here - that is the contents of variable x in the code - after I turn my cellphone off. However, if I turn it off and then turn it on again the variable is blank and whatever I have typed is gone.\n\nI've looked through similar questions here on StackOverflow, but it seems that \"outputting\" there means simply displaying. \n\nIs outputting that I am talking about possible in HTML or JavaScript at all?" ]
[ "javascript", "html" ]
[ "Creating tables with circular reference", "How can I create multiple tables with circular references. I have this data that I'd like to create all in one shot:\n\nDROP TABLE employee CASCADE CONSTRAINTS;\nCREATE TABLE employee (\n fname varchar2(15) not null, \n minit varchar2(1),\n lname varchar2(15) not null,\n ssn char(9),\n bdate date,\n address varchar2(30),\n sex char,\n salary number(10,2),\n superssn char(9),\n dno number(4),\n primary key (ssn),\n foreign key (superssn) references employee(ssn),\n foreign key (dno) references department(dnumber)\n);\n\nDROP TABLE department CASCADE CONSTRAINTS;\nCREATE TABLE department (\n dname varchar2(15) not null,\n dnumber number(4),\n mgrssn char(9) not null, \n mgrstartdate date,\n primary key (dnumber),\n unique (dname),\n foreign key (mgrssn) references employee(ssn)\n);\n\nDROP TABLE dept_locations CASCADE CONSTRAINTS;\nCREATE TABLE dept_locations (\n dnumber number(4),\n dlocation varchar2(15), \n primary key (dnumber,dlocation),\n foreign key (dnumber) references department(dnumber)\n);\n\nDROP TABLE project CASCADE CONSTRAINTS;\nCREATE TABLE project (\n pname varchar2(15) not null,\n pnumber number(4),\n plocation varchar2(15),\n dnum number(4) not null,\n primary key (pnumber),\n unique (pname),\n foreign key (dnum) references department(dnumber)\n);\n\nDROP TABLE works_on CASCADE CONSTRAINTS;\nCREATE TABLE works_on (\n essn char(9),\n pno number(4),\n hours number(4,1),\n primary key (essn,pno),\n foreign key (essn) references employee(ssn),\n foreign key (pno) references project(pnumber)\n);\n\nDROP TABLE dependent CASCADE CONSTRAINTS;\nCREATE TABLE dependent (\n essn char(9),\n dependent_name varchar2(15),\n sex char,\n bdate date,\n relationship varchar2(8),\n primary key (essn,dependent_name),\n foreign key (essn) references employee(ssn)\n);\n\n\nPlease help!!" ]
[ "sql", "oracle", "circular-reference" ]
[ "How to compare strings based on caracters similarity in SQL?", "I'm working on redirecting people if they type a \"not really wrong url\".\n\nFor example I have a good URL http://www.website.com/category/foo-bar-if-bar-foo/.\nThis one works so if a user enter to my website with it, I can retrieve the article corresponding.\n\nBut if someone enter to my website with a not really wrong url like http://www.website.com/category/foo-bar-foo/ because an another website has referenced a wrong url, I should redirect him to the right one instead of having a 404 status code...\n\nSo how should I do this? and Most important, should I do this ?\n\nI actually use Eloquent with Laravel 4.2.\n\nThank you in advance.\n\nEDIT\n\nI was wrong about stackoverflow, thanks for your comment. It uses the unique ID of a post.\n\nEDIT 2\n\nI Looked at SOUNDEX function in SQL, it's really good if there is a small difference like a character or two missing. But if my url is as broken as my example, it's not working anymore obviously. But thanks it's gonna be usefull." ]
[ "php", "regex", "redirect", "laravel", "eloquent" ]
[ "Windows base dot net framework sdk", "I am new in docker and I would like to create a Windows base (not core) and dot net framework SDK image.\nI see this one\nARG REPO=mcr.microsoft.com/dotnet/framework/runtime\nFROM $REPO:4.7.2-windowsservercore-ltsc2019\n\nbut I tried that way and cant work.\nARG REPO=mcr.microsoft.com/dotnet/framework/runtime\nFROM $REPO:4.7.2-windows-1903-amd64\n\nI also try that way\n FROM mcr.microsoft.com/windows:1903-amd64\n FROM mcr.microsoft.com/dotnet/framework/sdk:4.7.2\n\nAnd I would like to ask I try like that\nFROM mcr.microsoft.com/windows:1903-amd64\nRUN @powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:ChocolateyUseWindowsCompression='false'; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin"\nRUN powershell choco install dotnet4.7.2 -y\n\nIt's the same?" ]
[ "docker", ".net-framework-version" ]
[ "MySQL : Comparing two tables and modifying data into one", "I have two tables into my database :\n\nTable 1 : hussainalotcallplan1\n\nField Type Null Key Default Extra \n------- ------------ ------ ------ ------- --------\nconcode varchar(20) NO PRI (NULL) \nrate double YES (NULL) \nvendor varchar(100) YES (NULL)\ndiff varchar(20) YES 'NEW'\n\n\nTable 2 : tempratediff\n\nField Type Null Key Default Extra \n------ ----------- ------ ------ ------- --------\nid varchar(20) NO PRI (NULL) \nrate double YES (NULL) \n\n\nI want to compare the rates of two tables for each id and put the results under diff column in hussainalotcallplan1 table.\n\nThe two tables are related as hussainalotcallplan1.concode = tempratediff.id.\n\nSample Data: hussainalotcallplan1\n\nconcode rate vendor diff\n 91 0.05 gbm new\n\ntempratediff\n\nid rate\n 91 0.04\n\nI've to calculate the difference between two rates and insert the difference between them into hussainalotcallplan1.diff\n\nI've Tried this : update hussainalotcallplan1 set diff = SELECT CASE WHEN (SELECT c.concode FROM hussainalotcallplan1 ) IN (SELECT t.id FROM tempratediff) THEN (c.rate-t.rate) END AS diff FROM hussainalotcallplan1 c, tempratediff t WHERE c.concode = t.id; \n\nCan anyone give me a clue about that? Thanks in Advance." ]
[ "mysql" ]
[ "Decode HTML content of a cloned div", "I'm trying to find a way to decode the HTML code of a div cloned using jQuery.\nThe original div is dynamically generated by AngularJS variables, and I would like to display its cloned version in a <pre> element in order to display the DOM obtained as a result of user input. \n\n\r\n\r\n$(document).ready(function() {\r\n $('#cloneIt').on('click', function() {\r\n $('#clone').children().clone().appendTo(\"pre\");\r\n });\r\n});\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<div id=\"clone\" class=\"hidden\">\r\n <table>\r\n <tbody>\r\n <tr ng-repeat=\"language in languages\">\r\n <td class=\"ico\"><img src=\"assets/images/ico/audio.png\"></td>\r\n <td class=\"r-text\"><a href=\"assets/audio/{{ language.audio }}.mp3\" target=\"_blank\">Ascolta la sintesi in <strong>{{ language.name }}</strong></a></td>\r\n <td class=\"ico\"><img src=\"assets/images/ico/pdf.png\"></td>\r\n <td class=\"r-text\"><a href=\"assets/pdf/{{ language.pdf }}.pdf\" target=\"_blank\">Leggi la sintesi in <strong>{{ language.name }}</strong></a></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n<pre class=\"prettyprint\"></pre>\r\n\r\n<p>\r\n <button id=\"cloneIt\" class=\"btn btn-warning\">Generate source code</button>\r\n</p>\r\n\r\n\r\n\n\nBy pressing the button my desired output (after AngularJS has done its work) should be:\n\n<table> \n <tbody>\n <tr>\n <td class="ico"><img src="assets/images/ico/audio.png"></td>\n <td class="r-text"><a href="assets/audio/Audio-link_01.mp3" target="_blank">Listen to <strong>Italian</strong> track</a></td>\n <td class="ico"><img src="assets/images/ico/pdf.png"></td>\n <td class="r-text"><a href="assets/pdf/Pdf-link_01.pdf" target="_blank">Read <strong>Italian</strong> transcript</a></td>\n </tr>\n [and so on...]\n </tbody>\n</table> \n\n\nHow can I decode the HTML content of a cloned div? \n\nI am pleased if you can help me in this case. Thank you all." ]
[ "javascript", "jquery", "html", "clone", "decode" ]
[ "Create dict try comprehension", "This: \n\nindex ={}\nfor item in args:\n for array in item:\n for k,v in json.loads(array).iteritems():\n for value in v:\n index.setdefault(k,[]).append({'values':value['id']})\n\n\nWorks\n\nBut, when I try this:\n\nindex ={}\nfilt = {index.setdefault(k,[]).append(value['id']) for item in args for array in item for (k,v) in json.loads(array).iteritems() for value in v}\nprint filt\n\n\nOutput:\n\nresult set([None])\n\n\nWhats wrong?" ]
[ "python-2.7", "dictionary", "dictionary-comprehension" ]
[ "Recursive Searching Category and Their Children", "I have the following class:\n\npublic class Category {\n public string Name { get; set; }\n public Category Parent { get; set; }\n public string Url { get; set; }\n public List<Category> Children { get; set; }\n}\n\n\nNow given an instance of a Category and url. I wish to get the Category where the url matches the category or any of it's children (or their children etc).\n\nTherefore my function would have the following signature:\n\npublic Category FindCategory(Category category, string url);\n\n\nI know recursion is the way to go and i have managed to come up with a solution. However i've definitely seen it done better but i can't find where. I'd appreciate it if someone could show me the easiest and cleanest way to achieve this.\n\nThanks" ]
[ "c#", "recursion" ]
[ "HTML Multiselect to choose more than 50000 values using javascript and ajax", "In my project we have multiselect option which contains more than 50000 records, using ajax based upon search fetch data from server and shown to user(no problem).There is an option to select all records called check all if user selects check all option then browser getting hanged because in hidden i post all the values which are selected ,(ie) reason for browser hang so please suggest me how to get all selected values without any problem" ]
[ "javascript", "jquery", "html", "ajax" ]
[ "Tensorflow 2.2.0 gather maximum elements over one dimension", "I have the following problem:\n\nI have a tensor of shape (1600, 29) and I want to obtain the maximum of axis 1. The result should be a (1600, 1) tensor. For simplification I will use a (5,3) tensor to demonstrate my problem:\n\nB = tf.constant([[2, 20, 30],\n [2, 7, 6],\n [3, 11, 16],\n [19, 1, 8],\n [14, 45, 23]])\n\nx = x = tf.math.argmax(B, 1) --> 5 Values [2 1 2 0 1]\nz = tf.gather(B, x, axis=1) --> Shape: (5,5) [[30 20 30 2 20]\n [ 6 7 6 2 7]\n [16 11 16 3 11]\n [ 8 1 8 19 1]\n [23 45 23 14 45]]\n\n\nOkay, now, x gives me the maximum element over my axis, however, tf.gather does not return [30, 7, 16, 19, 45], but some weird tensor. How do I \"reduce\" the dimension properly?\n\nMy \"rather\" dirty way is this:\n\neye_z = tf.eye(5, 5)\n\nintermed_result = z*eye_z\n\nresult = tf.linalg.matvec(intermed_result,tf.transpose(tf.constant([1,1,1,1,1], dtype=tf.float32)))\n\n\nWhich results in the correct tensor: [30. 7. 16. 19. 45.]" ]
[ "python", "tensorflow" ]
[ "Effective debugging Ionic in the browser", "As an Ionic Developer, how do you proceed with browser debugging?\n\nI have been working with Ionic for a few weeks now, and although I am getting around its design, I am still struggling when it comes to debugging.\n\nIn most cases, a very generic, non-verbosed error is returned from the ionic framework, and none of the information provided in the stacktrace ever points to my own source code (see example below). I don't even know where to start.\n\n\n Error: node is undefined\n compile/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:20673:1\n forEach@http://localhost:8100/lib/ionic/js/ionic.bundle.js:13648:11\n compile@http://localhost:8100/lib/ionic/js/ionic.bundle.js:20672:7\n generateNavBarItem@http://localhost:8100/lib/ionic/js/ionic.bundle.js:58872:14\n self.beforeEnter@http://localhost:8100/lib/ionic/js/ionic.bundle.js:58811:26\n $RootScopeProvider/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.js:29404:15\n ionicViewSwitcher.create/switcher.emit@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55182:13\n ionicViewSwitcher.create/switcher.transition@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55038:13\n self.render/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:56749:7\n ionicViewSwitcher.create/switcher.init/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:54916:25\n ionicViewSwitcher.create/switcher.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55005:23\n ionicViewSwitcher.create/switcher.init@http://localhost:8100/lib/ionic/js/ionic.bundle.js:54915:11\n self.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:56743:5\n self.register@http://localhost:8100/lib/ionic/js/ionic.bundle.js:56701:5\n updateView@http://localhost:8100/lib/ionic/js/ionic.bundle.js:62357:11\n .compile/http://localhost:8100/lib/ionic/js/ionic.bundle.js:62334:11\n $RootScopeProvider/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.js:29477:15\n transitionTo/$state.transition<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:49321:11\n processQueue@http://localhost:8100/lib/ionic/js/ionic.bundle.js:27879:28\n scheduleProcessQueue/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:27895:27\n $RootScopeProvider/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:16\n $RootScopeProvider/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.js:28969:15\n $RootScopeProvider/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.js:29263:13\n timeout/timeoutId<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:31030:25\n completeOutstandingRequest@http://localhost:8100/lib/ionic/js/ionic.bundle.js:18706:7\n Browser/self.defer/timeoutId<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:18978:7" ]
[ "ionic-framework", "ionic-view" ]
[ "Range Validator Working Strangely", "I am having a strange issue with a validator that is built up in the code behind. I am using it to restrict the entry of the text box when a product has a minium order qty.\n\nDim oQtyBoxValidation As RangeValidator\noQtyBoxValidation = New WebControls.RangeValidator\noQtyBoxValidation.ID = \"qtyBoxValidation_\" & Trim(oDataRow(\"pno\"))\noQtyBoxValidation.ControlToValidate = Trim(oDataRow(\"pno\"))\noQtyBoxValidation.ValidationGroup = \"vg_\" & Trim(oDataRow(\"pno))\n\n'if min_order_qty set \nIf Convert.ToDouble(Trim(oDataRow(\"min_order\"))) > 1 Then\n oQtyBoxValidation.MinimumValue = Convert.ToDouble(Trim(oDataRow(\"min_order\")))\n oQtyBoxValidation.Text = \"Quantity must be \" & Convert.ToDouble(Trim(oDataRow(\"min_order\"))) & \" to 9999\"\nElse\n oQtyBoxValidation.MinimumValue = \"1\"\n oQtyBoxValidation.Text = \"Quantity must be 1 to 9999\"\nEnd If\n\n\nHowever if I enter the qtys 23 ,2 , 11-22 numbers in the validtor it works but if i enter 3-9 the validation message will not display." ]
[ "asp.net", "vb.net" ]
[ "Is it possible to store HBase data on AWS S3 for online application? How?", "I am pretty new in AWS. I am planning to use HBase as a database for my system and going to install it on EC2 and its actual data files on S3 because of lower storage cost and having good integration with EMR. I don't want to use Amazon EMR for mere HBase which would available for 24/7 and avoid extra cost. But going to use it for some analytics later. Any idea how to configure HBase for such setup?" ]
[ "amazon-web-services", "amazon-s3", "hbase", "amazon-emr" ]
[ "Ribbon button still visible after hide from code", "I try to hide a button after click on it, i try following code : \n\nbtnEdit.Visible = false;\n\n\nbut the button still visible, it hide once i click on it \n\nfull code : \n\n void SwitchMenu(bool showEdit)\n {\n boxEdit.Visible = showEdit; \n foreach (var item in boxEdit.Items)\n {\n item.Visible = showEdit;\n }\n boxCreate.Visible = !showEdit;\n foreach (var item in boxCreate.Items)\n {\n item.Visible = !showEdit;\n } \n }" ]
[ "c#", "outlook", "ms-office", "vsto" ]
[ "AngularJS - Detailed explanation on $resource actions", "I am not able to understand how to use $resource actions argument. \n\nCan you please explain with example about $resource actions argument especially how \"timeout\" works etc." ]
[ "angularjs" ]
[ "Oracle XE on AWS License for Test Instance", "Can I install Oracle XE on EC2 instance for internal Test Server? I need to setup one web application for internal testing before I deploy to Production RDS instance.\n\nDoes license permit to use it on cloud for internal testing? I have already purchased Oracle RDS instance for production.\n\nHere is what I understand is that - it can be used as production but limitation will enforced at XE Database that it will not use more than 1 CPU and 11GB of user data.\n\nOracle Database XE can be installed on any size host machine with any number of CPUs (one database per machine), but XE will store up to 11GB of user data, use up to 1GB of memory, and use one CPU on the host machine." ]
[ "oracle", "amazon-web-services", "amazon-ec2", "oracle-xe" ]
[ "What happens to the thread when reaching 'await' on 'async' method?", "My question as the title suggest is about the background of 'async' and 'await'.\n\nIs it true to say that what the current thread reaches 'await' keyword, it goes to \"sleep\",\nand wakes up when the await method is done?\n\nThanks!\n\nGuy" ]
[ "c#", "multithreading", "asynchronous", "async-await", "ctp" ]
[ "Semantic Zoom, zoomed in view items from API", "I'm implementing the semantic zoom control in Windows 8.1 Xaml. I have a list of top level category items. When a user clicks one of those items, I'd like to load the zoomed in level items from an API. Is this possible? I've tried handling the click event of the zoomed out view Gridview, but there is no information about the item that is clicked" ]
[ "c#", "xaml", "windows-8.1", "semantic-zoom" ]
[ "paper.js won't paint if mouse is not moving", "I have a strange situation with a very simple paper.js script. If I don't move mouse, the script will not draw the text, after 5 seconds. As soon as I do the move, it is being displayed. Can someone please explain to me this strange behaviour?\n\n<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <title>Simplify</title>\n <script type=\"text/javascript\" src=\"http://paperjs.org/assets/js/paper.js\"></script> \n <script type=\"text/paperscript\" canvas=\"canvas\">\n setTimeout(function () {\n var textItem = new PointText({\n content: 'Click and drag to draw a line.',\n point: new Point(20, 30),\n fillColor: 'black',\n });\n }, 5000);\n </script>\n</head>\n<body>\n <canvas id=\"canvas\" resize></canvas> \n</body>\n</html>" ]
[ "javascript", "html", "canvas" ]
[ "Apple HLSCatelog could not download (Offline) live video - Swift", "I am trying to save(offline download) the streaming video to device.\nFor streaming using Wowza Streaming engine I could stream and download offline a vod (video on demand mp4 using m3u8 url).\nBut, I failed to save the live streaming. I am able to stream the live video but, download not happening.\nHere the app code Apple HLS Catalog App could not download live video.\n\nAny help, highly appreciated." ]
[ "ios", "swift", "video-streaming", "offline", "wowza" ]
[ "How do we make RDF schema compatible with OWL?", "I have been trying to research making rdf schema compatible with web ontology language but I am still new and still getting mixed up. any help with this is highly appreciated.\nI need to know if there is anything I should remove or omit from rdfs to make it compatible with the owl." ]
[ "owl", "rdfs" ]
[ "SWF loading and flash player upgrade", "I am currently working on a Flash game. In order to ensure the user experience is consistent, I tried to specify the swfVersion and called \"swfobject.embedSWF()\" using the following code segment.\n\nPD.prototype.loadGame=function(){\nvar flashvars=this.bootData;\nvar swfVersion = \"11.0.1.152\";\nvar xiSwfUrl = \"playerProductInstall.swf\";\nvar params = {\n quality: 'high',\n bgcolor: '#ffffff',\n allowscriptaccess: 'always',\n allowfullscreen: 'true',\n wmode:'opaque'\n};\nvar attributes = {\n id:'Main',\n name:'Main',\n align:'middle'\n};\n\nvar ref=this;\nvar mainUrl=this.main+this.version+'&t='+(new Date()).getTime();\nswfobject.embedSWF(mainUrl, \"flashContent\", \"100%\", \"590\", swfVersion, this.staticPath+xiSwfUrl, flashvars, params, attributes, function(obj){\n if(obj.success){\n ref.swf=obj.ref;\n $(window).resize(function(){\n var width=$('div#flashContentDiv').width();\n ref.swf.setSize(width,590);\n });\n }else{\n $('div#flashContentDiv').css('background','#ffffff');\n $('div#flashContentDiv').html('<div style=\"padding-top:250px\">Please download the latest version of Flash Player from <a target=\"_blank\" href=\"http://get.adobe.com/flashplayer/\">here</a></div>');\n }\n});\n};\n\n\nHowever I still get users reporting their cases of failing to load the SWF after upgrading. Should I specify only the major version?" ]
[ "javascript", "dom", "flash", "swfobject" ]
[ "shiny - sidebar subtitles and div()", "I added a "reset all" button to my shiny app, following the second answer to this question. However, the reset action button only seems to work when it's wrapped in div() (which the original answer didn't have), but when the code has the div() wrap, my sidebar titles (orange text) disappear. Sample code is below, and any help would be appreciated!\nlibrary(ggplot2)\nlibrary(shiny)\nlibrary(shinydashboard)\nlibrary(shinyjs)\n\nsidebar <- dashboardSidebar(\n useShinyjs(), \n div(\n id = "form",\n subtitle = h5("Subtitle 1", style="color:orange"),\n textInput(inputId = "Init1", label = NULL, value = "1"),\n subtitle = h5("Subtitle 2", style="color:orange"),\n textInput(inputId = "Init2", label = "Lab1", value = "2"),\n \n actionButton("resetAll", "Reset all")))\n\nserver <- function(input, output, session) {\nobserveEvent(input$resetAll, {\n reset("form")}) \n\ndf <- reactive({\n data.frame(Nums = as.numeric(c(input$Init1, input$Init2)), y = 0)\n }) \n \noutput$plot2 <- renderPlot({\n dat <- df()\n \n ggplot(dat) +\n geom_point(aes(x = Nums, y = y))\n })} \n\nui <- dashboardPage(header = dashboardHeader(), \nsidebar = sidebar,\nbody = dashboardBody(\n mainPanel(plotOutput("plot2"))))\n \nshinyApp(ui, server)" ]
[ "r", "shiny", "shinyjs" ]
[ "Remove All Pandas Rows Except Each Column Closest The The Start of Hour", "I have a frame, df:\n\nDate A B C \nx 1 1 1\ny 1 1 1\nz 1 1 1\n\n\nThe \"Date\" column is my index, and all timestamps are random times down to the second level. I want to remove all rows in the dataframe, except for the row that is the closest to the start of a new hour. \n\nFor example, if 12/15/16 15:16:12 is the earliest row in hour 15 of that date, I want every other row with a time stamp greater than that stamp to be deleted. I then want the process repeated for the next hour, and so on.\n\nIs this possible in a fast manner in pandas?\n\nThanks" ]
[ "pandas" ]
[ "MongoDB: How to get data from linked collection based on condition", "I have a type collection that stores field informations. Each field has a type: Input, SelectBox, MultiSelect. Some field types have predefined options with key and label.\n\nHere is an example of a type document:\n\n{\n id: 't-123'\n attributes: [\n {\n id: 'a-1',\n type: 'INPUT'\n },\n {\n id: 'a-2',\n type: 'SELECT',\n option: [\n {key: 'DE', label: 'Germany'},\n {key: 'US', label: 'United States'}\n ]\n }\n ]\n}\n\n\nAdditionally, I have a form collection that references the type collection and stores all filled fields from a user.\n\nHere is an example of a form document: \n\n{\n id: 'f-1',\n type: 't-123',\n values: [\n {attribute: 'a-1', value: 'my random string'},\n {attribute: 'a-2', value: 'DE'} \n ]\n}\n\n\nNow, I am trying to query the form collection and automatically add the choosen key/label object from the type collection for fields with type: SELECT. I am wondering if I can do this in mongoDB or only in node.js.\n\nHere is my desired result:\n\n{\n id: 'f-1',\n type: 't-123',\n values: [\n {attribute: 'a-1', value: 'my random string'},\n {attribute: 'a-2', value: {key:'DE', label:'Germany'}} \n ]\n}\n\n\nSo the query needs to check if the attribute.type is equal to 'SELECT', and find the related object from the options array, based on the key stored in the form. Else it takes the value stored in the form document.\n\nCan I do anything like this within my MongoDB query or do I have to loop through my database results and manipulate the data manually ? THX!!" ]
[ "mongodb" ]
[ "How to open contacts and let user decide if he/she want to create or select one contact", "I'm trying to open contacts and let user decide if he/she want to create or select a contact to use it on my app.\n\nI need something like this:\n\n\nWhere on the first option the user can add a new contact.\n\nI tried the following code:\n\nIntent i = new Intent(Intent.ACTION_INSERT_OR_EDIT);\ni.setType(ContactsContract.Contacts.CONTENT_TYPE);\ni.putExtra(\"finishActivityOnSaveCompleted\", true); // Fix for 4.0.3 +\nstartActivityForResult(i, CARREGA_CONTATOS);\n\n\nBut a got this error on Logcat (right after startActivityForResult):\n\n\n android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT_OR_EDIT typ=vnd.android.cursor.dir/contact (has extras) }\n\n\nWhat I'm doing wrong?\n\nEDIT:\n\nI tried this code also with similar result:\n\nIntent intent = new Intent(\n Intent.ACTION_INSERT_OR_EDIT,\n ContactsContract.Contacts.CONTENT_URI\n);\nstartActivityForResult(intent, CARREGA_CONTATOS);\n\n\n\n android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT_OR_EDIT dat=content://com.android.contacts/contacts }\n\n\nEDIT 2:\nAlmost what I need:\n\nIntent i = new Intent(Intent.ACTION_GET_CONTENT);\ni.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);\ni.putExtra(\"finishActivityOnSaveCompleted\", true); // Fix for 4.0.3 +\nstartActivityForResult(i, CARREGA_CONTATOS);\n\n\nBut this code opens this image, and the user must select \"Contacts\" before it goes to where I want." ]
[ "android", "android-intent", "android-contacts" ]
[ "Parsing Json (list within dictionaries) in Python", "I want to get sum of count\nBelow is my json:\n\njson_data={\n\"note\":abbcccc,\n\"comments\":\n [{\"count\":100,\"name\"=leven},{\"count\":120,\"name\"=sam}]\n}\n\n\nHow do I get the sum of all counts (100+120)\n\nI can get indivdual like this:\n\ndata=json.loads(json_data)\ncount=data[\"comments\"][0][\"count\"]\n\n\nBut stuck on \"How to loop though it\"" ]
[ "python", "json" ]
[ "Selenium: Opening a Downloaded File in Java", "I need to open and read a downloaded file using selenium and I'm not quite sure how to do it. I see answers that suggests to download the file in a selected location. Does my code really need to start from downloading the file to selected location or can it start directly after downloading?\n\nAfter opening the file I must also read it. Can anyone give me an idea on how to do this? Thank you!" ]
[ "java", "file", "selenium", "download" ]
[ "javascript inside php - failing", "Here's my code in side of my php file:\n\n echo '<script type=\"text/javascript\">';\n echo '<audio id=\"player\" src=\"../cdh/ba1.mp3\"></audio>';\n echo '<a onclick=\"document.getElementById('player').play()\"><i class='fa fa-lg fa-volume-up'>';\n echo '</script>';\n\n\nI was basing this off of Ionuț G. Stan's answer on How to output JavaScript with PHP and Sykox's answer on Single icon sound player in html using font awesome. I just took out the divs changed the src & i class. \n\nThe line giving me issues has got to be:\n\necho '<a onclick=\"document.getElementById('player').play()\"><i class='fa fa-lg fa-volume-up'>';\n\n\nwhich gives the error:\n\n\n Parse error: parse error, expecting ','' or';''\n\n\nWhat am I doing wrong?!" ]
[ "javascript", "php", "html", "css" ]
[ "Facebook release key_hash", "I have problem with generate key hash.\nI make 2 key:\n\nC:\\openssl\\bin>\"C:\\Program Files\\Java\\jre7\\bin\\keytool.exe\" -exportcert -alias forumurology -keystore uroweb7228.keystore | openssl sha1 -binary | openssl base64\nEnter keystore password: *******\nc/6e5fY8Rg3Gshn1TKucia***/A=\n\nC:\\openssl\\bin>\"C:\\Program Files\\Java\\jre7\\bin\\keytool.exe\" -exportcert -alias a\nndroiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64\nEnter keystore password: android\n3L0oeMh7uk9YWE0sYavUuT***yU=\n\n\nthen save it to my facebook application settings.\nWhen i run release .apk, i have error:\n\n10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097): Exception during service\n10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097): com.facebook.http.protocol.ApiException: Key hash ypC1--aybTSQXdzXGLtM-_nXydI does not match any stored key hashes.\n10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:83)" ]
[ "android", "facebook", "facebook-android-sdk" ]
[ "R : changing date scale of x axis in month name", "covid_data_tbl%>%\n ggplot(aes(date, Cumulative_cases, color = countriesAndTerritories)) +\n geom_line(size=1, linetype = 1) +\n xlab("Year 2020")+\n scale_x_date(date_labels = "%b")+\n scale_y_continuous(labels = unit_format(unit = "M", scale = 1e-6))\n\nI really do not understand why this code does not show greek month names. FYI : I loaded tidyverse, dplyr, scales packages. I set the class of column "date" as date(dmy()). Do you guys notice?" ]
[ "r" ]
[ "Python OSC installation using pip", "I am trying to install the Python package OSC using pip. It keeps showing up errors of:\n\n\n Could not find a version that satisfies the requirement osc\n\n\nI have pip 9.0.1. Do you know this error? How can I install OSC?\n\nThanks,\nMiya" ]
[ "pip", "installation", "osc" ]
[ "Predicate builder not working", "I'm not exactly sure why this code wont compile. Any help would be greatly appreciated. I'm trying to follow this SO thread\n\nList<AgeRange> ageRanges = new List<AgeRange>();\nList<Person> people = new List<Person>(); \n\nprotected void Page_Load(object sender, EventArgs e)\n{\n ageRanges.Add( new AgeRange {Min = 10, Max = 15 });\n ageRanges.Add( new AgeRange {Min = 20, Max = 25 });\n\n for (var i = 1; i <= 25; i++)\n {\n people.Add(new Person { Age = i });\n }\n\n var agePredicate = BuildAgePredicate(ageRanges);\n var result = people.Where(agePredicate);\n}\n\nstatic Expression<Func<Person, bool>> BuildAgePredicate(IEnumerable<AgeRange> ranges)\n{\n var predicate = PredicateBuilder.False<Person>();\n foreach (var r in ranges)\n {\n // To avoid capturing the loop variable\n var r2 = r;\n predicate = predicate.Or(p => p.Age >= r2.Min && p.Age <= r2.Max);\n }\n return predicate;\n}" ]
[ "c#", "asp.net", "predicatebuilder" ]
[ "signal R and windows azure", "So I created a service bus queue and the client puts message in this queue and the bus listener gets it and does the work.All this is written in asp.net C#.\nWhat i want to do is notify the client when the work is done and for this I want to use signalR. But the signalR clients are usually written in javascript. How can I do this. Use signalr and the bus service queue" ]
[ "c#", "asp.net", "azure", "signalr" ]
[ "How to programmatically send command", "I have the following ICommand in my main window ViewModel.\n\nRelayCommand busyIndicatorCommand;\n\npublic ICommand BusyIndicatorCommand\n{\n get\n {\n if (busyIndicatorCommand == null)\n busyIndicatorCommand = new RelayCommand(BusyIndicatorCommandExecute, CanBusyIndicatorCommand);\n return busyIndicatorCommand;\n }\n}\n\n\nTo call something like this from a child view is a simple process when in XAML and you have a button.\n\n<Button Content=\"Press Me\" \n Command=\"{Binding DataContext.BusyIndicatorCommand, RelativeSource={RelativeSource AncestorType=Window}}\"\n CommandParameter=\"{Binding EnableIndicator}\"/>\n\n\nI would like to do the same thing, except from my ViewModel and there is no button. How would I do this?\n\n[EDIT] Final Solution\n\nCreated a new class project\n\nnamespace Libs_SharedCommands\n{ public class Commands\n {\n public enum CommandType\n {\n BusyIndicator\n }\n public static RoutedCommand cmd_BusyIndicator = new RoutedCommand();\n }\n}\n\n\nAdded reference to it in my user control view model and execute it like so.\n\nnamespace UserControls\n{\n class UserControlViewModel\n {\n\n public UserControlViewModel()\n {\n setBusyIndicator(true);\n Task.Factory.StartNew(() =>\n {\n //Do stuff here\n })\n .ContinueWith(t =>\n {\n Application.Current.Dispatcher.Invoke(new Action(() => setBusyIndicator(false)));\n });\n }\n\n private void setBusyIndicator(bool enable)\n {\n Libs_SharedCommands.Commands.cmd_BusyIndicator.Execute(enable, null);\n }\n\n }\n}\n\n\nAnd finally added the RoutedCommand handlers into my main window View which in turn calls the main window ViewModel. Fairly happy with this and MVVM is still intact.\n\nnamespace Application\n{\n public partial class MainView\n {\n public MainView()\n {\n InitializeComponent();\n\n CommandBinding cbBusyIndicator = new CommandBinding(Libs_SharedCommands.Commands.cmd_BusyIndicator, BusyIndicator_MainNavCmdExecute, MainNavCmdCanExecute);\n this.CommandBindings.Add(cbBusyIndicator);\n }\n\n private void BusyIndicator_MainNavCmdExecute(object sender, ExecutedRoutedEventArgs e)\n {\n setCommand(Libs_SharedCommands.Commands.CommandType.BusyIndicator, e.Parameter);\n }\n private void MainNavCmdCanExecute(object sender, CanExecuteRoutedEventArgs e)\n {\n e.CanExecute = true;\n }\n\n private void setCommand(Libs_SharedCommands.Commands.CommandType view_type, object parameter)\n {\n var viewModel = (MainViewModel)DataContext;\n if (viewModel != null)\n {\n switch (view_type)\n {\n case Libs_SharedCommands.Commands.CommandType.BusyIndicator:\n viewModel.ShowBusyIndicator = Convert.ToBoolean(parameter);\n break;\n default:\n break;\n }\n }\n }\n }\n}" ]
[ "c#", "wpf" ]
[ "SML - unzip using map", "Given a list of tuples, \n\n[(1,2),(3,4),(5,6)]\n\n\nI need to unzip it to look like this \n\n [[1,3,5],[2,4,6]]\n\n\nunzip needs to be of type ('a * 'a) list -> 'a list list.\n\nSo far, I have this as my unzip function but my input is incorrect, and I am not sure how to access pass through ('a * 'a).\n\nval rec last =\n fn (h::nil) => h\n |(h::list) => last (list)\n | (nil) => raise Empty;\n\nfun unzip [] = []\n | unzip L = [(map hd L), (map last L)]; \n\n\nthis returns 'a list list -> 'a list list" ]
[ "sml", "smlnj" ]
[ "How to have a getStringExtra message before onCreate method?", "I have two activities which in the first one I make a message and by putExtra I move it to next activity. But as you know to get the message in the secind activity I need to have getStringExtra in onCreate method. In the other hand I really need to have that message before onCreate starts. So how can I have that.\n\npublic class Result extends Activity {\nString url; // <<< I need the message to put it here\n\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_single_result);\n\n Intent intent = getIntent();\n String mainURL = intent.getStringExtra(SingleSearchPage.EXTRA_MESSAGE); // Here is the message\n\n url = mainURL; //Tried to change the value of URL but did not work\n\n new GetJSONTask().execute(url);\n\n}\nclass GetJSONTask extends AsyncTask<String, Void, JSONObject> {\n\n\n protected JSONObject doInBackground(String... urls) {\n // Creating new JSON Parser\n JSONParser jParser = new JSONParser();\n\n // Getting JSON from URL\n JSONObject json = jParser.getJSONFromUrl(url);\n\n return json;\n }\n\n\nLOG:\n\n 11-26 03:56:00.666: D/URL(777): url =http://api.worldbank.org/countries/CA/indicators/SP.POP.TOTL?date=1980:2013&format=json\n11-26 03:56:00.796: I/Choreographer(777): Skipped 62 frames! The application may be doing too much work on its main thread.\n11-26 03:56:01.045: I/Choreographer(777): Skipped 57 frames! The application may be doing too much work on its main thread.\n11-26 03:56:01.316: W/dalvikvm(777): threadid=12: thread exiting with uncaught exception (group=0x414c4700)\n11-26 03:56:01.536: E/AndroidRuntime(777): FATAL EXCEPTION: AsyncTask #2\n11-26 03:56:01.536: E/AndroidRuntime(777): java.lang.RuntimeException: An error occured while executing doInBackground()\n11-26 03:56:01.536: E/AndroidRuntime(777): at android.os.AsyncTask$3.done(AsyncTask.java:299)\n11-26 03:56:01.536: E/AndroidRuntime(777): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)\n\n\nAny idea to have the value of intent message before the onCreate?" ]
[ "java", "android", "json", "methods", "oncreate" ]
[ "mvc google map in bootstrap partial view modal does not work", "Iam doing an MVC Bootstrap Google Map V3 application.\n\nWhen user enter a Full Address it is shown in a Google Map. If the div when it is shown is in a Partial View. It looks fine. \n\nBut, when that Partial View is in a Bootstrap Modal View. It does not show anything.\n\nThis is the case when it Works..\n\n\r\n\r\n <script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?key=MyKey&sensor=false\"></script>\r\n <script type=\"text/javascript\">\r\n var geocoder;\r\n var map;\r\n var address = \"Full Address \";\r\n function initialize() {\r\n \r\n geocoder = new google.maps.Geocoder();\r\n var latlng = new google.maps.LatLng(-34.397, 150.644);\r\n var myOptions = {\r\n zoom: 14,\r\n center: latlng,\r\n // mapTypeControl: true,\r\n // mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},\r\n // navigationControl: true,\r\n mapTypeId: google.maps.MapTypeId.ROADMAP\r\n };\r\n map = new google.maps.Map(document.getElementById(\"dvMap\"), myOptions);\r\n if (geocoder) {\r\n geocoder.geocode( { 'address': address}, function(results, status) {\r\n if (status == google.maps.GeocoderStatus.OK) {\r\n if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {\r\n map.setCenter(results[0].geometry.location);\r\n\r\n var infowindow = new google.maps.InfoWindow(\r\n { content: '<b>'+address+'</b>',\r\n size: new google.maps.Size(150,50)\r\n });\r\n\r\n var marker = new google.maps.Marker({\r\n position: results[0].geometry.location,\r\n map: map, \r\n title:address\r\n }); \r\n google.maps.event.addListener(marker, 'click', function() {\r\n infowindow.open(map,marker);\r\n });\r\n\r\n } else {\r\n alert(\"No results found\");\r\n }\r\n } else {\r\n alert(\"Geocode was not successful for the following reason: \" + status);\r\n }\r\n });\r\n }\r\n \r\n }\r\n\r\n\r\n</script>\r\n\r\n<div style=\"width: 600px; height:400px\">\r\n @Html.Partial(\"~/Views/Shared/_ShowMap.cshtml\")\r\n \r\n</div>\r\n\r\n\r\n\n\nthis is the call to my Partial View\n\n\n\nMy partial View in this case is simple\n\n\n\nThe case that does not work is like this.\n\nI add this line at bootom of JavaScript function...\n\n $(\"#myModalMapa\").modal();\n\n\nHTML Div is like this.\n\n \n\nAnd my partial view looks like this." ]
[ "javascript", "jquery", "asp.net-mvc", "google-maps-api-3", "bootstrap-modal" ]
[ "Magnolia CMS: inherited component customisation", "Is there any possible solution to customise the inherited component in magnolia? Where in if the child page inherits a component, the child component has the capability of editing it?" ]
[ "magnolia" ]
[ "A conceptual question about tf-idf using pyspark", "In the official documentation of pyspark, they have an example of tf-idf.\n\nhashingTF = HashingTF()\ntf = hashingTF.transform(documents)\ntf.cache()\nidf = IDF().fit(tf)\ntfidf = idf.transform(tf)\n\n\nI'm also ready in other sources a code similar to that. Question is: Why the name of that dataframe is tfidf? Does the result equals to tf * idf or will it stores only the idf? If so, how to calculate the tf*idf?" ]
[ "pyspark", "tf-idf" ]
[ "Understanding Ruby - undefined local variable", "I've been playing around with Ruby and have come across this weird behavior. Could anyone please tell me why this is happening?\n\nif I run:\n\ndef my_fn\n if false then\n a = {:a=>10, :b=>20}\n end\n puts a.class\n a || {}\nend\n\n\nand print the result the code compiles successfully and returns {}.\nBut if I change the code to: \n\ndef my_fn\n puts a.class\n a || {}\nend\n\n\nit doesn't return {} but throws an Error. \"'my_fn': undefined local variable or method 'a' for main:Object (NameError)\"\n\nShouldn't a just be nil and not cause an error?" ]
[ "ruby", "variables" ]
[ "How to move prefixes using cut command", "Cant seem to finish my command\n\nThe following command cuts first 10 charqacters in all filenames:\n\nls | cut -c11-\n\n\nHow do i incorporate it in a loop to rename all channels removing first 10 characters.\n\nfor i in *; do mv \"$i\" <stuck here> \"$i\"; done" ]
[ "linux", "rename" ]
[ "Javascript inheritence without prototype", "Please refer - http://jsfiddle.net/sf4oaxun/\n\nfunction a() {\n this.say = function () {\n alert(\"hello\");\n };\n}\n\na.prototype.what = function () {\n alert(\"234234\");\n};\n\nfunction b() {}\n\n//b.prototype = Object.create(a);\n//b.prototype = a;\n\nvar b1 = new b();\n\nb1.say();\n\n\n\nThe 2 commented lines, are they different?\nWhy does say not get invoked, and errors out when using either of the commented lines(please uncomment it)\n\nb.prototype = Object.create(a);\nb.prototype = a;\n\nQuick question added - If 'b' is inheriting from 'a' using b.prototype = Object.create(a.prototype), then would instances of b not be able to call any method of a which is not defined on a's prototype? Please refer - jsfiddle.net/sf4oaxun/3" ]
[ "javascript", "inheritance" ]
[ "Getting 'divide by zero' error when numerator, not denominator is 0", "I have a 'Divide by 0' mystery in Redshift that is NOT coming from the denominator being 0. \n \nI have two columns that are both decimals:Sales is always > 0, and it's my denominator. \"Flagged Sales\" is between 0 and up to the value of Sales. \n\n\nWhen I run the code below (using Postico to query Redshift) I get the correct results, except that when \"Flagged Sales\"=0 I would like the result to be 0, not NULL. \n\nSELECT \n NULLIF(\"Flagged Sales\") / NULLIF(Sales,0)::decimal AS \"% of Sales Flagged\"\nFROM Table1;\n\n\nThe following attempts to get 0 when the numerator is 0 have resulted in the 'Divide by zero' error: \n\nCASE \n WHEN (NULLIF(\"Flagged Sales\",0) / NULLIF(Sales,0)::decimal) IS NULL THEN 0\n ELSE (NULLIF(\"Flagged Sales\",0) / NULLIF(Sales,0)::decimal)\n END AS \"% of Sales Flagged\"\n\n\nSame with: \n\nCOALESCE((NULLIF(\"Flagged Sales\") / NULLIF(Sales,0)::decimal)) AS \"% of Sales Flagged\"\n\n\nAny ideas why this is happening?" ]
[ "sql", "postgresql", "null", "amazon-redshift", "divide-by-zero" ]
[ "Liquid template logic to check if a date has no time component? String comparison fails", "I'm trying to get a Liquid condition to run only if page.date has a defined time.\n\nLet's say page.date is \"2019-07-17 00:00:00 -0700\".\n\nI found out that the 12-hour (%r) time is 12am by default, so I tried this hack (I'm not too worried about a time actually being set by the user to 12:00:00 sharp, causing false positives):\n\n{% if page.date | date: \"%r\" != \"12:00:00 AM\" %}\n <p>The page's date has a time.</p>\n{% else %}\n <p>The page's date has no time.</p>\n\n\nThe above block outputs \"The page's date has a time.\", which is untrue according to my condition (that 12am = \"no time\").\n\nI also tried the following, with and without | json pipes to the right of the date formatter:\n\n\n{% if page.date | date: \"%T\" != \"00:00:00\" %}\n{% if page.date | date: \"%R\" != \"00:00\" %}\n\n\nRendering all these formats to a page validates the values I've put in these conditionals, but my string comparisons are still incorrect. Is there a way to do this in Liquid?" ]
[ "date", "datetime", "if-statement", "jekyll", "liquid" ]
[ "Number of ways to fill a nxm grid", "I encountered the following problem in my programming book which I could not solve:\n\nGiven a nxm grid, write a recursive algorithm to find the number of ways that this grid could be filled by 3x1 and 1x3 blocks.\n\nMy logic for 3 x M grids:\n\nFind the number of block combinations that could be used to fill side M of the grid.\n\nI do not know how to change the logic to solve the question above.\n\nCould someone please advise? Thanks." ]
[ "java", "algorithm", "recursion", "combinations" ]
[ "Build to deploy guest on KVM hangs", "I'm using Jenkins to automate the deploy of a virtual appliance. The first step is to build a standard CentOS 7 minimal vm in KVM. I wrote a short bash script to do this task which works when running locally on the KVM machine:\n\n#!/bin/bash\n\n#Variables\ndiskpath=\"/var/lib/libvirt/images/\"\nbuildname=$(date +\"%m-%d-%y-%H-%M\")\nvmextension=\".dsk\"\n\n#Change to images directory\ncd /var/lib/libvirt/images/\n\n#Deploy VM with with kickstart file\nsudo virt-install \\\n--name=$buildname \\\n--nographics \\\n--hvm \\\n--virt-type=kvm \\\n--file=$diskpath$buildname$vmextension \\\n--file-size=20 \\\n--nonsparse \\\n--vcpu=2 \\\n--ram=2048 \\\n--network bridge=br0 \\\n--os-type=linux \\\n--os-variant=generic \\\n--location=http://0.0.0.0/iso/ \\\n--initrd-inject /var/lib/libvirt/images/autobuild-ks.cfg \\\n--extra-args=\"ks=http://0.0.0.0/ks/autobuild-ks.cfg console=ttyS0\"\n\n\n(IP address i have changed for the purposes of security)\n\nThe ISO and the kickstart file are stored on another server and they can both be accessed via http for the purposes of making this script work. To be clear, the script does work.\n\nThe problem I have is, when I put this script into Jenkins as a build step, the script works; however, it hangs at the end after the OS has been installed and the kvm guest begins the shutdown process.\n\nhere is the kickstart file:\n\n#version=DEVEL\n# System authorization information\nauth --enableshadow --passalgo=sha512\n# Use Network installation media\nurl --url=http://0.0.0.0/iso\n# Use graphical install\n#graphical\n# Run the Setup Agent on first boot\nfirstboot --enable\nignoredisk --only-use=sda\n# Keyboard layouts\nkeyboard --vckeymap=gb --xlayouts='gb'\n# System language\nlang en_GB.UTF-8\n\n# Network information\nnetwork --bootproto=dhcp --device=ens160 --ipv6=auto --activate\nnetwork --hostname=hostname.domain.com\n\n# Root password\nrootpw --iscrypted \ntaken_encryption_output_out_for_the_purposes_of_security\n#Shutdown after installation\nshutdown\n# System services\nservices --enabled=\"chronyd\"\n# System timezone\ntimezone Europe/London --isUtc\n# System bootloader configuration\nbootloader --append=\" crashkernel=auto\" --location=mbr --boot-\ndrive=sda\nautopart --type=lvm\n# Partition clearing information\nclearpart --none --initlabel\n\n%packages\n@^minimal\n@core\nchrony\nkexec-tools\n\n%end\n\n%addon com_redhat_kdump --enable --reserve-mb='auto'\n\n%end\n\n%anaconda\npwpolicy root --minlen=6 --minquality=50 --notstrict --nochanges --\nnotempty\npwpolicy user --minlen=6 --minquality=50 --notstrict --nochanges --\nnotempty\npwpolicy luks --minlen=6 --minquality=50 --notstrict --nochanges --\nnotempty\n%end\n\n\nI suspect it's something to do with the shutdown option in the Kickstart file but unsure. When I ssh to the kvm server, I can see my newly created vm so the script does work but Jenkins hangs.\n\n[root@sut-kvm01 ~]# virsh list --all\n Id Name State\n----------------------------------------------------\n - 09-22-17-16-21 shut off\n\n\nSo far I have tried shutdown, reboot and obviously halt is default in the kickstart file and they have not worked for me either.\n\nAny ideas how I can get the build to complete successfully? If it hangs, I can't move on to what will be build step number 2.\n\nHelp please :-)" ]
[ "bash", "jenkins", "centos7", "kvm" ]
[ "Binding this for function called by event listener", "I have the below code (simplified from what I am actually doing). Essentially, I have a class instance with some state and a method that is called by an event listener, which gets a file from the user and uploads it. I have have out how to bind this from within the method to the upload callback, but I can't work out how I would bind the state to the method for when it is called by the event listener. I would like to do this without using ES6 class syntax, because I want to learn prototypes properly before moving on to class syntax.\n\nexport default function State() {\n this.message = \"hello\";\n}\nState.prototype.uploadMethod = function (e) {\n var reader = new FileReader();\n reader.onload = upload.bind(this);\n function upload() {\n var base64image = reader.result;\n fetch(\"/api\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ message: this.message, image: base64image }),\n });\n }\n reader.readAsDataURL(e.target.files[0]);\n};\nconst state = new State();\nconst button = document.querySelector(\"button\");\nbutton.addEventListener(\"click\", uploadMethod);" ]
[ "javascript", "oop", "prototype" ]
[ "Reset form on submit", "I am submitting a form and then making all the field empty but it's not working. Form is getting submitted successfully but the fields are not getting reset. I am using angular-material for styling. Updated controller.\n\n Html\n\n <form name=\"myform\">\n <md-input-container>\n <label for=\"name\">Contact Name</label>\n <input type=\"text\" md-maxlength=\"20\" required=\"\" md-no-asterisk name=\"name\" ng-model=\"info.name\" md-autofoucs>\n <div ng-messages=\"myform.name.$error\" role=\"alert\">\n <div ng-message=\"required\">This is required.</div>\n <div ng-message=\"md-maxlength\">The name has to be less than 20 characters long.</div>\n </div>\n </md-input-container>\n <md-input-container>\n <label for=\"phone\">Phone Number</label>\n <input type=\"text\" name=\"phone\" required md-no-asterisk ng-model=\"info.phone\">\n <div ng-messages=\"myform.phone.$error\">\n <div ng-message=\"required\">This is required.</div>\n </div>\n </md-input-container>\n <md-input-container>\n <label for=\"email\">Email</label>\n <input type=\"text\" name=\"email\" ng-model=\"info.email\">\n </md-input-container>\n <md-input-container>\n <md-button class=\"md-primary\" ng-click=\"saveit(info)\">Save</md-button>\n <md-button class=\"md-primary\">Cancel</md-button>\n </md-input-container>\n\n</form>\n\n\n **Function in Controller**\n angular.module('contact', ['ui.router', 'ngMaterial', 'templates','ngMessages'])\n .config(['$mdThemingProvider', '$stateProvider', function ($mdThemingProvider, $stateProvider) {\n\n $mdThemingProvider.theme('default')\n.primaryPalette('blue')\n.accentPalette('orange');\n\n$stateProvider\n .state('home', {\n url: '',\n templateUrl: 'templates/home.html',\n controller: 'MainCtrl as vm'\n\n });\n\n }]).controller('MainCtrl', function ($scope, $mdSidenav,$mdDialog,$mdToast, contacts) {\n\n var vm = this;\n $scope.searchText =\"\";\n\n $scope.toggleSidenav = function(){\n $mdSidenav('left').open();\n };\n\n contacts.getall().then(function(response){\n console.log(response.data);\n $scope.people = response.data;\n });\n\n $scope.saveit = function(detail, myform){\n\n if (!detail.name || !detail.phone) { return ;}\n\n contacts.add({\n name: detail.name,\n phone: detail.phone,\n email: detail.email\n });\n $mdToast.show( \n $mdToast.simple()\n .content(\"ContactAdded!\")\n .position('top, right')\n .hideDelay(2000)\n );\n $scope.people.push(detail);\n $scope.info = {};\n $scope.myform.$setPristine();\n $scope.myform.$setUntouched();\n\n };\n\n $scope.showConfirm = function(ev, person) {\n var confirm = $mdDialog.confirm()\n .title('Are you sure?')\n .ariaLabel('Lucky day')\n .targetEvent(ev)\n .ok('Please delete it!')\n .cancel('I want to keep it.');\n $mdDialog.show(confirm).then(function() {\n contacts.deletethis(person.id).then(function(){\n $mdToast.show( \n $mdToast.simple()\n .content(\"Deleted!\")\n .position('top, right')\n .hideDelay(2000)\n );\n\n });\n var index = $scope.people.indexOf(person);\n $scope.people.splice(index,1);\n }, function() {\n $scope.status = 'You decided to keep your debt.';\n });\n }; });" ]
[ "angularjs", "forms", "angular-material" ]
[ "C# WinApi Without StringBuilder?", "Can I use WinApi functions that have out string-parameter without StringBuilder ? If yes, how ? Or is that the easiest way to retrieve strings from WinApi ?\n\n[DllImport(\"kernel32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\nstatic extern uint FormatMessage(uint flags, IntPtr source, uint messageID, int languageID, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer, int bufferSize, string[] arguments);\n\n// I wished I could use it with just a string\n[DllImport(\"kernel32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\nstatic extern uint FormatMessage(uint flags, IntPtr source, uint messageID, int languageID, ref [MarshalAs(UnmanagedType.LPWStr)] string buffer, int bufferSize, string[] arguments);\n\n\n(My function is probably buggy. I'm not sure)" ]
[ "c#", "winapi", "marshalling", "stringbuilder" ]
[ "Open an authenticated image served by django from java using Apache http client", "I Am serving an authenticated image using django. The image is behind a view which require login, and in the end I have to check more things than just the authentication.\nBecause of a reason to complicated to explain here, I cannot use the real url to the image, but I Am serving it with a custom url leading to the authenticated view.\n\nFrom java the image must be reachable, to save or display. For this part I use Apache httpclient.\n\nIn Apacahe I tried a lot of things (every example and combination of examples...) but can't seem to get it working.\nFor other parts of the webapp I use django-rest-framwork, which I succesfully connected to from java (and c and curl).\n\nI use the login_reuired decorator in django, which makes the attempt to get to the url redirect to a login page first.\n\nTrying the link and the login in a webviewer, I see the 200 code (OK) in the server console.\nTrying the link with the httpclient, I get a 302 Found in the console.... (looking up 302, it means a redirect..)\n\nthis is what I do in django:\n\nin urls.py:\n\nurl(r'^photolink/(?P<filename>.*)$', 'myapp.views.photolink',name='photolink'),\n\n\nin views.py:\n\nimport mimetypes\nimport os\n\n@login_required\ndef photolink(request, filename):\n # from the filename I get the image object, for this question not interesting\n # there is a good reason for this complicated way to reach a photo, but not the point here\n filename_photo = some_image_object.url\n base_filename=os.path.basename(filename_photo)\n # than this is the real path and filename to the photo:\n path_filename=os.path.join(settings.MEDIA_ROOT,'photos',mac,base_filename)\n mime = mimetypes.guess_type(filename_photot)[0]\n logger.debug(\"mimetype response = %s\" % mime)\n image_data = open(path_filename, 'rb').read()\n return HttpResponse(image_data, mimetype=mime)\n\n\nby the way, if i get this working i need another decorator to pass some other tests....\nbut i first need to get this thing working....\n\nfor now it's not a secured url.... plain http.\n\nin java i tried a lot of things... using apache's httpclient 4.2.1\nproxy, cookies, authentication negociation, with follow redirects... and so on...\n\nAm I overlooking some basic thing here?...\nit seems the login of the website client is not suitable for automated login...\n\nso the problem can be in my code in django....or in the java code...." ]
[ "java", "django", "authentication", "apache-httpclient-4.x" ]
[ "Play swf file using flex like Virtual Girl", "I am working on Flex 4.6 Air application in which there is a list and the data is transparent background swf file. My problem is that when i double click on the list item the respected swf file should be play in the background or we can say on desktop like virtual girl application. if we minimize the main application, swf should be play on desktop like virtual girl application.\n\nIf anybody have any idea please tell me.\n\nThnank You so much." ]
[ "apache-flex", "air", "flex4.6" ]
[ "PHP [Img] BBCode, but display only if the image is a real image?", "On my website, I have BBCode enabled on my forum, however, some of my users have been exploiting this, and have been making the source of the image a page that gives the user \"Respect Points\". I was wondering if there could be a way to check if the URL that is inside of the [ img ] tag is a real image, and not just a web page. I was thinking the \"getimagesize\" function could be useful here, but I can't find a proper way to check if it is a real image AND be able to parse it with regular expression afterwards. I'd prefer not just checking file extensions, because some images don't have file extensions on my website. Any insight on this?" ]
[ "php", "regex", "image", "bbcode", "verify" ]
[ "jquery toggle disappear quickly after clicking button", "this is my code..\n\n<div id=\"hint-toggle\" class=\"ui-body ui-body-e\" style=\"display: none\">\n <p>No Hints available right now,check it later</p>\n</div>\n\n<button id=\"show-hint\" onclick=\"showHint();\"type=\"submit\" data-inline=\"true\" data-theme=\"c\">Show Hint</button>\n\n<script type=\"text/javascript\">\n function showHint(event){\n $(\"#hint-toggle\").toggle();\n }\n</script>\n\n\nAfter clicking show hint button it appear but within 2 sec it'll disappear.. did i miss anything in my code?? please help me.i want to show hint-toggle till i again press show hint button.\n\nFYI: http://jsfiddle.net/shreeramns/rUKbh/" ]
[ "javascript", "jquery", "jquery-mobile", "toggle" ]
[ "How to differ sessions in browser-tabs?", "In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs? \nIn this example: \n\n<%@page language=\"java\"%>\n<%\nString user = request.getParameter(\"user\");\nuser = (user == null ? (String)session.getAttribute(\"SESSIONS_USER\") : user);\nsession.setAttribute(\"SESSIONS_USER\",user);\n%>\n<html><head></head><body>\n<%=user %>\n<form method=\"post\">\nUser:<input name=\"user\" value=\"\">\n<input type=\"submit\" value=\"send\">\n</form>\n</body></html>\n\n\nCopy this code in a jsp page (testpage.jsp), deploy this file in an existing context of a web application on the server (I use Apache Tomcat), then open a browser (FF, IE7 or Opera) using the correct URL (localhost/context1/testpage.jsp), type your name in the input and submit the form. Then open a new tab in the same browser, and then you can see your name (get from the session) on the new tab. Be careful with the browser-cache, sometimes seems that it doesn't happen, but it's in the cache, refresh the second tab.\n\nThanks." ]
[ "jsp", "servlets", "browser", "web-applications", "sessionid" ]
[ "Port Codeigniter App to PyroCMS", "I'm working on a web application in Codeigniter. I'd like to integrate the functionality of my application with a CMS so that site admins can easily update the site (about pages, blog, etc). Is this easily done with PyroCMS or another Codeigniter-based CMS? Will I need to drastically restructure my existing app?" ]
[ "php", "codeigniter", "content-management-system", "pyrocms" ]
[ "Android webview not scrolling", "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout\nxmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:orientation=\"vertical\" >\n <android.support.v7.widget.Toolbar\n android:id=\"@+id/toolbar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"@color/purple2\" app:layout_scrollFlags=\"scroll|enterAlways\"\n android:minHeight=\"56dp\"\n app:popupTheme=\"@style/ThemeOverlay.AppCompat.Light\"\n android:theme=\"@style/ThemeOverlay.AppCompat.Dark.ActionBar\"\n app:titleTextAppearance=\"@style/ToolbarTitle\" />\n<LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:layout_below=\"@id/toolbar\"\n android:orientation=\"vertical\" >\n <WebView\n android:id=\"@+id/text98\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:paddingBottom=\"10dp\"\n android:paddingLeft=\"10dp\"\n android:paddingRight=\"10dp\"\n android:paddingTop=\"10dp\" />\n</LinearLayout>\n\n\n\n\nJAVA Code: \n\nmWebView = (WebView) findViewById(R.id.text98);\n// mWebView.setMinimumHeight(height);\n// mWebView.setMinimumWidth(width);\nWebSettings webSettings = mWebView.getSettings();\nwebSettings.setSavePassword(true);\nwebSettings.setSaveFormData(true);\nwebSettings.setJavaScriptEnabled(true);\nwebSettings.setSupportZoom(true);\nwebSettings.setDomStorageEnabled(true);\nwebSettings.setAllowContentAccess(true);\nwebSettings.setAllowFileAccess(true);\nwebSettings.setPluginState(WebSettings.PluginState.ON);\nmWebView.setWebViewClient(new DefaultWebViewClient() );\nmWebView.setWebChromeClient(new WebChromeClient(){});\nmWebView.setHorizontalScrollBarEnabled(true);\nmWebView.setVerticalScrollBarEnabled(true);\nmWebView.loadUrl(url);\nmWebView.setHorizontalScrollBarEnabled(true);\nmWebView.setVerticalScrollBarEnabled(true);\n\n\nWhat could the reason be? Why is scrolling not working? it works at times, but at certain other times no? Thank you for all the hellp, appreciated.Adding more lines because i am not able to get past by more code lines then post." ]
[ "android", "webview" ]
[ "How to use Wicket's DownloadLink with a file generated on the fly?", "DownloadLink is nice and handy for creating a button/link for downloading a file, along these lines:\n\nadd(new DownloadLink(\"downloadButton\", getReportFile(), \"report.pdf\"));\n\n\nand\n\n<input type=\"button\" wicket:id=\"downloadButton\" value=\"Download\" />\n\n\nHowever, I would like to trigger the generation of the file to download only when the button/link is clicked. In other words, upon click, I'd call a method that generates the file (a Pentaho report in our case), puts it in a temp place and returns a File pointing to it. Then I'd tell the DownloadLink to use that File. Question is, is this possible somehow? \n\nCurrently we have something like the code below, which works, but I'm interested in whether DownloadLink could be used instead.\n\nadd(new Link<Void>(\"downloadButton\") {\n @Override\n public void onClick() {\n IResourceStream resourceStream = new AbstractResourceStreamWriter() {\n @Override \n public void write(OutputStream output) {\n try {\n reportService.generateReport(output, report);\n } catch (IOException e) {\n // ...\n }\n }\n\n @Override\n public String getContentType() { \n return CONTENT_TYPE_PDF;\n }\n };\n\n getRequestCycle()\n .setRequestTarget(new ResourceStreamRequestTarget(resourceStream)\n .setFileName(\"report.pdf\"));\n }\n});\n\n\n(Wicket 1.4.18, if it makes a difference.)" ]
[ "java", "download", "wicket" ]
[ "How can I make textarea border the same as text input border?", "I would like to have the textarea fields in my form appear the same as the text input fields, cross-browser. And I don't want to be forcing a custom style - I would like to just use whatever the standard style is within the user's browser.\n\nSo I know I could use\n\ntextarea {\n border-style: inset;\n border-width: 2px;\n}\n\n\nand then they would match in Chrom[e,ium], but then they don't match on Firefox/Iceweasel, for example.\n\nSo is there a straightforward way to say to the browser \"please render textarea elements with whatever border you are using for input[type=\"text\"]\"?" ]
[ "html", "css" ]
[ "copy and paste over flash instances", "I have two swf files created using flex. Both swf file have some labels, textboxes and checkboxes. I want to be able to modify the second swf file by copying the labels and textboxes from swf file 1 and pasting them to swf file 2. I do not want to loose the formatting on labels or textboxes when pasting.\n\nAny help/suggestions would be appreciated. Thanks in advance. :)" ]
[ "apache-flex", "copy-paste" ]
[ "Java to Javascript/HTML5 Canvas", "I was wondering what the java to javascript/HTML5 translations were for these things:\n1. Switching Activities/Layouts\n2. Methods\n3. Scanner Method (input via text box)\n\nI am writing a game basically that is written in javascript and HTML5. HTML5 is being purely used to display the graphics via canvas. I am trying to create a menu for my game, but I was wondering how I would switch to another layout once I click the play button." ]
[ "java", "javascript", "html", "canvas" ]
[ "Upload file - Protractor", "I fight with protractor because for some tests I need to UPLOAD file. My HTML looks like:\n\n<div class=\"panel-footer\">\n <ul class=\"list-unstyled\">\n <!-- ngRepeat: file in imagesToUpload --> \n </ul>\n <button class=\"btn btn-sm btn-success pull-right ng-binding ng-hide\" ng-show=\"imagesToUpload.length\" ng-click=\"uploadImages()\">Nahrát na server</button>\n <button class=\"btn btn-sm btn-primary ng-binding\" ng-file-select=\"onImageSelect($files)\" data-multiple=\"true\" style=\"overflow: hidden;\">Vybrat soubory<input type=\"file\" class=\"btn btn-sm btn-primary ng-binding\" ng-file-select=\"onImageSelect($files)\" data-multiple=\"true\" multiple=\"multiple\" __wrapper_for_parent_=\"true\" style=\"width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;\"></button>\n </div>\n\n\nINPUT HTML:\n\n<input type=\"file\" class=\"btn btn-sm btn-primary ng-binding\" ng-file-select=\"onImageSelect($files)\" data-multiple=\"true\" multiple=\"multiple\" __wrapper_for_parent_=\"true\" style=\"width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;\">\n\n\nI search a lot about this issue in protractor. And basicly people advise was to COPY / PASTE path to file to input and then click \"UPLOAD\"\n\nIn my case there is a problem becuase input is here but it store some object not PATH\n\nIf I pick file manualy it store in HTML like:\n\n<li ng-repeat=\"file in imagesToUpload\" class=\"ng-binding ng-scope\">\n FileName.png <span title=\"remove\" class=\"btn btn-flat glyphicon glyphicon-remove\" ng-click=\"imagesToUpload.splice($index, 1)\"></span>\n </li>\n\n\nMaybe this is really stupid but I am thinking if there isnt some other way how to do this? Maybe create object and send it there or something else?\n\nAny advice is welcome." ]
[ "javascript", "selenium", "testing", "protractor", "end-to-end" ]
[ "What's the best way to extract text from pdf in python without changing the layout and format?", "I want text with exact format and layout from pdf.\nIf pdf to text is not the direct choice, is it possible to do pdf -> xml -> text? \nI have already tried PyPDF2, pdfminer and pdftotxt. Even I've tried using AWS textract and got incorrect layout.\nBasically if I can construct sentence from the text extracted from pdf, that's enough.\nI used Zamzar API which gives exact output but they're quiet expensive. \nAny possible solution?" ]
[ "pdf", "text", "pypdf2", "pdfminer", "pdftotext" ]
[ "Decrypt data within a node/express.js Route", "I have an app where I am trying to encrypt the userID before sending it to the client side. The reason for doing this is because I am using EJS as a tempting engine which means I have code where I am using the userID like so:\n\n<body ng-init=\"getAllPosts('<%= user._id' %>)\"></body>\n\n\nThe issue with this is that when someone does \"inspect element\" on any browser they can clearly see their userID. See image below for example:\n\n\n\nTo fix this issue I started Encrypting my userID before I sent to the client, like s0:\n\napp.get('/profile',isLoggedIn,function(req, res) {\n\n var user = req.user;\n var uid = encrypt(JSON.stringify(user._id));\n\n res.render('profile.ejs', {\n userID: uid\n }); \n});\n\n\nThis Encrypts the ID successfully as you can see in the image below:\n\n\n\nThe Issue:\n\nThe issue is that I can successfully Decrypt the ID but even after decrypted it I can't get the data from the database. I have tried copy pasting the decrypted ID into my route and that gets the data successfully. Its like it does not read the decrypted ID from the variable but works when copy paste it myself.\n\nHeres the code:\n\napp.get('/user/posts/:id', isLoggedIn, function(req, res){\n\n var x = decrypt(req.params.id)\n\n Posts.findOne({userID:x}, function(err, post){\n if(err)\n console.log(err);\n else if(post){\n res.json(post);\n } else if(!post){\n res.json({message: \"No Posts document exists for this user\"});\n } \n });\n });\n\n\nThing to note is that the variable x contains decrypted ID is text form!\n\nJust for more info here are my Encrypting & Decrypting functions:\n\n//Encrypt Data\n function encrypt(text){\n\n var cipher = crypto.createCipher(algorithm,key)\n var crypted = cipher.update(text, 'utf8', 'base64')\n crypted += cipher.final('base64');\n\n console.log(\"CRYPTED \" + crypted);\n return crypted;\n }\n\n//Decrypt Data\nfunction decrypt(text){\n\n var decipher = crypto.createDecipher(algorithm,key)\n var dec = decipher.update(text, 'base64', 'utf8')\n dec += decipher.final('utf8');\n\n console.log(\"DECRYPTED \" + dec);\n return dec;\n}\n\n\nOutput of Decrypt Function:" ]
[ "javascript", "node.js", "express", "mongoose", "cryptography" ]