texts
sequence | tags
sequence |
---|---|
[
"finding max value in each column and row",
"Say you have a 2D matrix,Is there a particular algorithm or way to do this in excel or matlab that would find the max of each row and column, such that each column and each row has only one maximal number N, where summing all N would result in the largest possible sum,i.e. is a row or column has a max number that is repeated., as such with the simple example below\n\n1 2 4 \n3 1 4 \n1 2 4 \n\n\nthe out put would be \n\n1 2 4\n\n3 2 4\n\n1 2 4"
] | [
"matlab"
] |
[
"How can I detect the user who makes changes on a shared folder?",
"I have a shared folder in AD environment. The shared folder contain may sub folders. Different Users Groups have different rights on sub-folders. I want to monitor the shared folder for changes (Create, Rename, Change Content, Delete) and log them. Also I want to log even the user who makes the changes.\nHow can I detect the user who makes changes on a shared folder in vb .NET?\n\nSome help please!"
] | [
"vb.net-2010"
] |
[
"LINQ Query for search criteria",
"I have 5-6 textboxes and dropdowns, based on the values I want to fetch the results, \nWith OR condition this query works fine however when I use AND for multiple conditions\nit wont give me any results due to obvious reason. Now My question is that how can\ni change this query to make it working for both AND and OR conditions.\n\nQuery \n\nPublic Sub SerachCriteria()\n Debugger.Break()\n Dim s = New Ex1DataContext(SPContext.Current.Web.Url)\n Dim vendors = s.PurchaseOrderWrite\n Dim query = From vendor In vendors.ToList() _\n Where (Not ddsearchorderVendor.SelectedItem.Text = \"--Select--\" AndAlso vendor.Supplier.Title = ddsearchorderVendor.SelectedItem.Text) _\n Or (Not ddsearchorderStatus.SelectedItem.Text = \"--Select--\" AndAlso vendor.Status = ddsearchorderStatus.SelectedItem.Text) _\n Or (Not txtSearchOrder.Text Is Nothing AndAlso vendor.Purchaseorderno = txtSearchOrder.Text) _\n Or (Not ddsearchorderdate.Text = \"--Select--\" AndAlso vendor.Orderdate = ddsearchorderdate.Date) _\n Select vendor.Purchaseorderno\n For Each a In query\n listpurchaseorder.Items.Add(a)\n listpurchaseorder.DataTextField = \"Purchaseorderno\"\n listpurchaseorder.DataValueField = \"ID\"\n listpurchaseorder.DataBind()\n Next\n SerachCriteriaPartNo()\nEnd Sub \n\n\nThanks"
] | [
"asp.net",
"vb.net",
"linq",
"linq-to-entities"
] |
[
"Quadruple precision float support on Intel C++ compiler 18.0 update 3 in vs 2017",
"I just tried to compile a C++ program with boost::multiprecision::float128 support in Visual Studio 2017 using Intel C++ compiler 18.0 update 3. \n\nI add /Qoption,cpp,--extended_float_type to project C/C++ additional options. \n\nHowever, ICC emit E0020: identifier \"_Quad\" is undefined error message. \n\nI searched the latest ICC 18 Developer Guide and Reference relating to quadruple precision float and _Quad topics and couldn't find anything. \n\nIs _Quad keyword still supported in ICC 18, or I made mistakes in compiler options? \nThanks.\n\n\nOS: Windows 10 x64 1803 \nVisual studio 2017 15.7.3\nIntel C++ compiler 18.0 update 3"
] | [
"c++",
"intel",
"quadruple-precision"
] |
[
"Getting complete URL of User's Google Profile Picture",
"I use Google sign-in in an Android app and save a link to their profile picture URL in the database.\n\nIn the past, I would get the complete URL, starting with this one of these, for example:\n\nhttps://lh3.googleusercontent.com/{random stuff}/photo.jpg\nhttps://lh4.googleusercontent.com/{random stuff}/photo.jpg\nhttps://lh5.googleusercontent.com/{random stuff}/photo.jpg\nhttps://lh6.googleusercontent.com/{random stuff}/photo.jpg\n\n\nEver since Google Play Services updated this (I think in 8.3?) I only get\n\n/{random stuff}/photo.jpg\n\n\nThis obviously won't link to a picture.\n\nHere is my code:\n\n GoogleSignInAccount acct = result.getSignInAccount();\n\n if (acct != null) \n {\n String profilePicPath = \"\";\n if (acct.getPhotoUrl() != null) {\n profilePicPath = acct.getPhotoUrl().getPath();\n }\n }\n\n\nWhat am I doing wrong?\n\nEDIT: I believe what I am doing wrong is I added getPath() after the URL."
] | [
"android",
"user-profile",
"google-signin",
"googlesigninaccount"
] |
[
"how to create Multiple instances on the same page of js function",
"Consider the following code snippet :\n var from,to;\n to = $(".range-to-dt").persianDatepicker({\n inline: true,\n minDate: new persianDate(cleanDate(serverDateTime)),\n altField: '.range-to-dt-alt',\n altFormat: 'YYYY/MM/DD',\n initialValue: false,\n onSelect: function (unix) {\n to.touched = true;\n if (from && from.options && from.options.maxDate != unix) {\n var cachedValue = from.getState().selected.unixDate;\n from.options = { maxDate: unix };\n if (from.touched) {\n from.setDate(cachedValue);\n }\n }\n }\n});\nfrom = $(".range-from-dt").persianDatepicker({\n inline: true,\n observer: true,\n minDate: new persianDate(cleanDate(serverDateTime)),\n altField: '.range-from-dt-alt',\n altFormat: 'YYYY/MM/DD',\n initialValue: false,\n onSelect: function (unix) {\n from.touched = true;\n if (to && to.options && to.options.minDate != unix) {\n var cachedValue = to.getState().selected.unixDate;\n to.options = { minDate: unix };\n if (to.touched) {\n to.setDate(cachedValue);\n }\n }\n }\n});\n\nHow can I use the js function on the same page more than once (in several different forms) to perform correctly?\n<form id="form1" ...>\n <input asp-for="DateTimeRange.StartDate" ltr-input range-from-dt-alt">\n <input asp-for="DateTimeRange.EndDate" ltr-input range-to-dt-alt">\n</form>\n<form id="form2" ...>\n <input asp-for="DateTimeRange.StartDate" ltr-input range-from-dt-alt">\n <input asp-for="DateTimeRange.EndDate" ltr-input range-to-dt-alt">\n</form>\n\nActually how to create Multiple instances on the same page of js function?"
] | [
"javascript",
"jquery"
] |
[
"How to add MediaPlayer controls on lock screen?",
"I want to achieve something like how SoundCloud and Google Play Music display a flippable widget on the lock screen when playing songs. I've tried Google searching this, but can't seem to find anything on the subject matter. Below is a screenshot of what I want...\n\n\n\nThis is of course the flipped view. It seems like this is pretty standard for a lot of apps, so there is probably some type of pre-build Android class to create something like this, but I have no idea where to start to look. Thanks!"
] | [
"java",
"android"
] |
[
"PowerBi-Javascript report embedding cluster details 403 error",
"I'm trying to display a power bi report in a typescript app. \n\nI've successfully obtained an access token from AAD, and can in fact use it via the power bi rest api. I'd like to be able to use PowerBi-Javascript, for cleanliness and being able to apply filters. But I'm receiving a 403 error each time on a call to https://api.powerbi.com/powerbi/globalservice/v201606/clusterdetails, saying 'TokenExpired' - even when the token is freshly generated and should be valid for at least an hour.\n\nThe code to embed the report looks like this:\n\nprivate embedReport(accessToken: string): powerBiClient.Embed {\n const element = this.getDisplayElement();\n const reportId = this.getReportId();\n const config = {\n type: 'report',\n id: reportId,\n tokenType: powerBiClient.models.TokenType.Aad,\n accessToken: accessToken\n };\n return this.powerBiService.embed(element, config);\n\n\ngetDisplayElement returns the appropriate HTMLElement, getReportId the id of the report to display, powerBiClient is the powerbi-javascript import, and powerBiService is an instance of powerBiClient.service.Service.\n\nI've attempted this with reports I own, and with reports in a group (adding the groupId to the config).\n\nHow can I fix this error?"
] | [
"typescript",
"powerbi",
"powerbi-embedded"
] |
[
"Split string on multiple delimiters of any length in Haskell",
"I am attempting a Haskell coding challenge where, given a certain string with a prefix indicating which substrings are delimiting markers, a list needs to be built from the input. \n\nI have already solved the problem for multiple single-length delimiters, but I am stuck with the problem where the delimiters can be any length. I use splitOneOf from Data.List.Split, but this works for character (length 1) delimiters only.\n\nFor example, given\n\ninput \";,\\n1;2,3,4;10\", \n\ndelimiters are ';' and ','\n\nsplitting the input on the above delivers\n\noutput [1,2,3,4,10] \n\nThe problem I'm facing has two parts: \n\nFirstly, a single delimiter of any length, e.g. \n\n\"****\\n1****2****3****4****10\" should result in the list [1,2,3,4,10]. \n\nSecondly, more than one delimiter can be specified, e.g. \n\ninput \"[***][||]\\n1***2||3||4***10\", \n\ndelimiters are \"***\" and \"||\"\n\nsplitting the input on the above delivers\n\noutput [1,2,3,4,10] \n\nMy code for retrieving the delimiter in the case of character delimiters: \n\n--This gives the delimiters as a list of characters, i.e. a String.\ngetDelimiter::String->[Char]\ngetDelimiter text = head . splitOn \"\\n\" $ text\n\n--drop \"[delimiters]\\n\" from the input\nbody::String->String\nbody text = drop ((length . getDelimiter $ text)+1)) $ text \n\n--returns tuple with fst being the delimiters, snd the body of the input\ndoc::String->(String,String) \ndoc text = (getDelimiter text, body text)\n\n--given the delimiters and the body of the input, return a list of strings\nnumbers::(String,String)->[String]\nnumbers (delim, rest) = splitOneOf delim rest\n\n--input \",@#\\n1,2@3#4\" gives output [\"1\",\"2\",\"3\",\"4\"]\ngetList::String->[String]\ngetList text = numbers . doc $ text\n\n\nSo my question is, how do I do the processing for when the delimiters are e.g. \"***\" and \"||\"?\n\nAny hints are welcome, especially in a functional programming context."
] | [
"string",
"haskell",
"split",
"functional-programming"
] |
[
"Call specific PHP function with AJAX",
"I'm trying to retrieve data from another server (testing locally) by calling a specific function within a PHP file. Currently nothing is being returned unless I manually call the function in the PHP file.\n\n $.ajax({\n type: 'POST',\n url: 'http://test.local/php/ajax/json.php',\n dataType: 'jsonp',\n data: {action: 'get_data'},\n success: function(data) {\n $json = $.parseJSON(data);\n [...]\n }\n});\n\n\nMy PHP is as follows, and evidently $_POST is not set as the client application receives no data. Setting $_POST['action'] = 'get_data'; manually or calling get_data() in the PHP file returns all the data fine.\n\nif (isset($_POST['action']) && !empty($_POST['action'])) {\n $action = $_POST['action'];\n switch ($action) {\n case 'get_data': get_data(); break;\n }\n}\n\n\nWhy is $_POST['action'] not being set by the AJAX query? Any help is appreciated."
] | [
"php",
"jquery",
"ajax"
] |
[
"Multiple instances of solution explorer in Visual Studio 2010",
"I have UltraMon installed and quite like it but I would also find it a much better experience if I could also have another instance of Solution Explorer open in the second monitor open on the assembly/namespace/project I have open in that monitor.\n\nHowever Solution Explorer seems to be Singleton component. Any workarounds?"
] | [
"visual-studio-2010",
"solution-explorer"
] |
[
"how to connect teradata using HP UFT",
"I am trying to do feasibility of Teradata SQL Assistant using UFT.\n\nPlease help me to start and understanding this, since i am new to DB Validation.\n\nAlso i checked in internet how to connect DB using UFT i Found below code\n\n'Create ADODB connection object\nSet objConnection = CreateObject(\"ADODB.Connection\")\n\n\n'Create Recordsetobject\nSet objRecordSet = CreateObject(\"ADODB.Recordset\")\n\n\n'Connect to DB using provider and server\nobjConnection.open \"provider=sqloledb;Server=;User Id=; \nPassword=;Database=;Trusted_Connection=Yes\"\n\n'Write the SQL Query\nsqlQuery=\"Select * from emp\"\n\n\n'Execute the query\n objRecordSet.open sqlQuery, objConnection\n\n\n'Display output\n value = objRecordSet.fields.item(0) \n msgbox Value\n\n\nobjRecordSet.Close\nobjConnection.Close\nSet objConnection = Nothing\nSet objRecordSet = Nothing\n\n\nMy team is connecting through Teradata.net not odbc connection, Will this code will work ? if not how to connect and retrieve data from teradata.\n\n\n\nThanks in advance,\nAbu."
] | [
"teradata",
"hp-uft"
] |
[
"GWT converting current date to GMT",
"I am converting the current date to GMT time.\n\nThe result is in-consistent, due to this my date time calculations are going worng.\n\n DateTimeFormat df = DateTimeFormat.getFormat(\"dd MMM yyyy hh:mm:ss\");\n String gmtStr = new Date().toGMTString().replace(\"GMT\", \"\").trim();\n long deptime= depTime - df.parse(gmtStr).getTime();\n deptime = deptime / 1000;\n seconds = (deptime % 60);\n minutes = (deptime % 3600) / 60;\n hours = (deptime / 3600);"
] | [
"gwt",
"gmt",
"datetime-conversion"
] |
[
"What is the jz element in html?",
"On this page, popular ad blocking software removes ads near the top and right of the page as may be expected, but adds a new section of clickbait ads just below the story, above the \"Posted-In\" tags, copyright/disclaimer, and \"Related Articles\" section. An example of what it looks like is shown below. \n\nAfter a div containing five spans with the headline \"Paid Content\" and a float-clearing div, nestled within a few divs with gibberish class names, each clickbait item is in an element like this:\n\n<div class=\"gbcfwaxUasi\" id=\"gbqfwabzip4\">\n <div cls=\"bqfway_avbrott_simule\">\n <jz ci=\"2355\" jjr-target=\"_blank\">\n <div class=\"fa_ew\"></div>\n <div class=\"gbcfwaxUasi_aspect\"></div>\n <span class=\"bweis edlfidr\"></span>\n <span class=\"gbqfway_avbrott gbqfway_avbrott_2355\"></span>\n <span class=\"gbqfway_asg gbqfway_2355\"></span>\n </jz>\n </div>\n <span cls=\"gbqfway_ulv8_box\"><span></span>\n <jz ci=\"2355\" jjr-target=\"_blank\">\n <div class=\"fa_ew\"></div>\n <span class=\"bweis edlfidr\"></span>\n <span class=\"gbqfway_ulv8 gbqfway_frogd\">\n US Store Sells Designer Products For Pennies\n </span>\n <span class=\"gbqfway_asg gbqfway_2355\"></span>\n </jz>\n </span>\n</div>\n\n\nI could not find the \"jz\" element (e.g. line 3) anywhere on this list of HTML elements, nor on other lists. What is it? Is this a custom version of HTML (as possibly hinted at by the \"cls\" attribute in the lines before the jz, which is nonstandard for div and span?) Does the use of these strange elements/ attributes play a causal role in causing ad blockers to run in reverse and effectively add ads? \n\nExample Image (hover to show; spoiler-tagged to make this question less spam-looking by default):"
] | [
"html",
"element"
] |
[
"I deleted my local directory in tf. How to re-get it?",
"I am on linux, command line tf.\n\nI delete my local directory. Now the tf get does not retrieve the files - \n\nHow do I get it back from tfs???"
] | [
"tfs"
] |
[
"error while installing programs from github",
"I am trying to install some programs. I put them all in a text file called requirements.txt.\nI am running this file using the following command on my Ubuntu machine:\n\npip install -r requirements.txt\n\n\nbut it gave this error:\n\nObtaining bx-python from git+git://github.com/eranroz/bx-python#egg=bx-python (from -r requirements.txt (line 7))\n Cloning git://github.com/eranroz/bx-python to ./src/bx-python\nfatal: unable to connect to github.com:\ngithub.com[0: 140.82.118.3]: errno=Connection timed out\ngithub.com[1: 140.82.118.4]: errno=Connection timed out\n\nCommand \"git clone -q git://github.com/eranroz/bx-python /DATA/ali/src/bx-python\" failed with error code 128 in None\n\n\ndo you know how I can fix the problem?\n\nhere is what I have in the requirements.txt:\n\nnumpy==1.13.3\npandas==0.23.4\nscipy==1.0.0\nCython==0.28.5\nscikit-learn==0.19.1\nhmm_kit\n-e git://github.com/eranroz/bx-python#egg=bx-python"
] | [
"python",
"shell",
"ubuntu"
] |
[
"how to output an array from python to be shown by paraview",
"I have a 2d array of my coordinates, and at each coordinate I have values for pressure at that point. I want to export my data and set of coordinates in a way that I can later on open them in techplot or paraview.\n\nI have read a lot on vtk but could not find a solution to my problem. I know it should be very easy but I am new here and in the beginning. \n\nThank you"
] | [
"python",
"vtk",
"paraview"
] |
[
"Set value with result from select statement",
"So I'm not exactly sure what I am doing wrong here, but I am looking to take the value from this SQLite statement and assign it to a value which i can then put into the DB)\n\nString mpg = new String(\"select (\" + gasLog.getOdometer() + \" - y.odometer) / \" + gasLog.getGallons() + \" as mpg from tbl x, tbl y where y.odometer = (select max(z.odometer) from tbl z where z.odometer < \" + gasLog.getOdometer() + \")\");\n values.put(KEY_MPG, mpg);\n\n\nHowever, whenever i run this, it just puts the actual statement into the cell in the database... so it inserts \"select (\" + ...\"\n\nCould someone help me with what I am doing wrong here, what do i need to do in order to get the data from this into the database, rather than the statement itself?\n\nThanks!"
] | [
"android",
"database",
"sqlite"
] |
[
"Android Architecture Patterns",
"Which architecture pattern do you use for Android development? Until now I have been using the MVC pattern with BroadcastReceivers to communicate between layers but there must be something better than this. The Broadcast is killing me with all its registers and unregisters. So any answer will be highly appreciated. \n\nThanks in advance"
] | [
"android",
"architecture",
"broadcastreceiver"
] |
[
"Django: unit testing forms and KeyError",
"I'am unit testing a sign up form in django 1.5b, using the new custom user model. I want to test that my custom clean_email method raises a ValidationError when a new user tries to sign up with an already existing email, here is the clean method i wrote:`\n\ndef clean_email(self):\n\n email = self.cleaned_data[\"email\"]\n try:\n user = MyUser.objects.get(email=email)\n raise forms.ValidationError(\"This email address already exists.\")\n except MyUser.DoesNotExist:\n return email\n\n\nThe test code:\n\ndef test_clean_email(self):\n data = {'email': '[email protected]'}\n form = MyForm(data)\n actual = form.errors['email']\n expected = [u'This email address already exists.']\n self.assertEqual(actual, expected)\n\n\nI get this after running the test:\n\nactual = form.errors['email']\nKeyError: 'email'"
] | [
"django",
"forms",
"unit-testing",
"email"
] |
[
"syntax error instantiating an object in objective-c",
"I'm using the library STPrivilegedTask library, source found at http://www.sveinbjorn.org/STPrivilegedTask to run the NSTask with sudo permissions. \n\nThis is the code I'm using to instantiate an STPrivilegedTask object but I'm getting syntax error:\n\nSTPrivilegedTask *task2 = [[STPrivilegedTask alloc] initWithLaunchPath: launchPath: arguments];\n\nI'm getting \"Receiver type STPrivilegedTask for instance method does not declare a method...\" error. Is the above syntax valid? \n\nThanks,"
] | [
"iphone",
"objective-c",
"cocoa",
"xcode4"
] |
[
"CSS Issue with float:left; and main container",
"I've come across a bit of an issue and was hoping for some advice.\n\nI've always been a bit on-off with laying out websites like this but it's come to the day where I've had enough of fending it off.\n\nSo I have two divs, left and center, both are set to float:left; These are both in a \"main\" section but because the two are floating, the \"main\" section is smaller in height than these two which overlap due to the floating quality. \n\nI've tried display:inline & display:inline-block but the first stacks them one on top of the other whilst the latter completely loses me my CSS for the corresponding div.\n\nWas hoping someone could help me, if so, it'd be greatly appreciated! Here's the code:\n\nHTML:\n\n<div id=\"main_container\">\n <aside id=\"left\">\n <p id=\"settings_header\">\n Account Settings\n </p>\n <hr>\n <img id=\"profile_picture\" src=\"#\" />\n <div id=\"settings_option\">\n <a href=\"#\">\n Settings\n </a>\n </div>\n <div id=\"settings_option\">\n <a href=\"#\">\n Sign Out\n </a>\n </div>\n </aside>\n\n <div id=\"center\">\n <h2> \n Latest & Greatest Topics\n </h2> \n </div>\n </div>\n\n\nCSS:\n\n#main_container {\n width:82%;\n min-width:932px;\n margin-left:auto;\n margin-right:auto;\n padding:10px 10px;\n box-shadow:inset 0 0 10px #000;\n background-color:#ccc;\n}\n\n#left {\n width:26%;\n min-width:176.4px;\n margin-right:5px;\n display:inline-block;\n float:left;\n background-color:#fff;\n border:1px solid #222;\n box-shadow:0 0 5px #000;\n font-family: verdana;\n font-size:12px;\n color: #000;\n}\n\n#center {\n width:68%;\n min-width:670.6px;\n margin-left:5px;\n margin-right:5px;\n display:inline-block;\n float:left;\n background-color:#fff;\n border:1px solid #222;\n box-shadow:0 0 5px #000;\n font-family: verdana;\n font-size:12px;\n color: #333;\n text-align:left;\n}\n\n#center h2 {\n font-family:tahoma;\n font-weight:bold;\n font-size:18px;\n text-decoration:underline;\n text-align:center;\n color:black;\n letter-spacing:1px;\n}\n\n\nThanks for any help in advance!"
] | [
"css"
] |
[
"Installing numpy+MKL on Linux to use cvxopt package",
"In Windows, I have a Python 3.6 script that uses the cvxopt package which needs numpy + MKL for it to work. numpy + MKL was successfully installed using the prebuilt binaries here. \n\nProblem: Now the script also needs to be run in Ubuntu 16.04, but pip install numpy installs the version of numpy without MKL. \n\nHow can I install numpy+MKL on a Linux system to be able to use the cvxopt package?"
] | [
"python",
"python-3.x",
"numpy",
"intel-mkl",
"cvxopt"
] |
[
"Why does a Transform stream stop writing after frist write?",
"In the example below it writes \"foo\" to process.stdout once. Why doesn't it write \"foo\" 10 times?\n\nconst { Transform } = require('stream');\n\nclass Stream extends Transform {\n\n constructor(){\n super({autoDestroy : false, emitClose :false});\n }\n\n _transform(chunk, encoding, callback){\n this.push(chunk);\n }\n}\n\nlet stream = new Stream();\n\nstream.pipe(process.stdout, {end:false});\n\nfor (let i = 0; i < 10; i++) {\n stream.write('foo');\n}"
] | [
"node.js",
"node.js-stream"
] |
[
"List View sometimes do not show data from my DataSource.cs",
"I am newbie in WinRT developing. I'm triing to bind data from my datasource to ListView. But there is problem when I use \n\nvar file = await ApplicationData.Current.LocalFolder.GetFileAsync(\"tasks.xml\");\nvar readStream = await FileIO.ReadTextAsync(file);\n\n\nif I use this code then application sometimes don't show that data in ListView (it is really random, sometimes it show everything OK and sometimes don't show anything in ListView).\n\nWhen I delete this code from datasource then everithing works well.\n\nI have this datasource class (DataSource.cs)\n\npublic class InboxPageViewModel\n{\n public List<Task> Items { get; set; }\n\n public InboxPageViewModel()\n {\n GetTasks();\n }\n\n private async void GetTasks()\n {\n try\n {\n var file = await ApplicationData.Current.LocalFolder.GetFileAsync(\"tasks.xml\");\n var readStream = await FileIO.ReadTextAsync(file);\n\n var tasksList = new List<Task>\n {\n new Task { Name = \"a\", DueDate = \"b\", Project = \"c\", Context = \"d\"},\n };\n\n Items = tasksList;\n }\n catch (Exception ex)\n {\n new MessageDialog(ex.Message).ShowAsync();\n }\n }\n}\n\npublic class Task\n{\n public string Name { get; set; }\n public string Category { get; set; }\n public string DueDate { get; set; }\n public string Project { get; set; }\n public string Context { get; set; }\n public string Note { get; set; }\n public string IsFinished { get; set; }\n}"
] | [
"c#",
"windows-8",
"windows-runtime",
"winrt-xaml",
"async-await"
] |
[
"Bootstrap Media Object Images resizing",
"I am having a problem with my images in my grid layout with Bootstrap. I am trying to replicate the middle section of the home page of http://riotdesign.eu/en/ as an exercise.\n\nMy images will pull left and the height remains fixed at 150px and the width gets cut off so the image looks skinny and not very good. I inspected the other websites code and they somehow have a 150x150 image that is 130X130 in md grid layouts and 108x108 in small grid layout. How can I achieve this? \n\nI am guessing that 130 is the default width for the med container at their specified sm-5 grid selection. so that is why they chose to resize that way, is that correct? I have not been able to replicate this despite my best efforts. Here is my code.\n\n<div class=\"row index-row\">\n\n\n <div class=\"col-sm-4 index-left\">\n <div class=\"media-background\">\n\n <div class=\"row index-row\">\n <div class=\"media col-sm-5 col-md-4\">\n <div class=\"image-overlay\">\n <a class=\"btn btn-default href=\"#\">Open</a>\n <%= image_tag('computer.jpg', class: 'pull-left media-img', alt: 'About') %>\n\n </div>\n </div>\n <div class=\"media-body col-sm-7 col-md-8\">\n <h4>\n <%= link_to 'About', root_path, class: 'media-heading' %>\n </h4>\n <p class=\"heading-text\">\n \"ABOUT What is Riot Design, our our clients and our specialties.\"\n </p>\n </div>\n </div>\n\n </div>\n </div>\n\n\n\n\n <div class=\"col-sm-4 index-middle\">\n <div class=\"media-background\">\n\n <div class=\"row index-row\">\n <div class=\"media col-sm-5 col-md-4\">\n <a class=\"pull-left\" href=\"\">\n <%= image_tag('notebook.jpg', class: 'media-img', alt: 'Portfolio') %>\n </a>\n </div>\n <div class=\"media-body col-sm-7 col-md-8\">\n <h4>\n <%= link_to 'Portfolio', root_path, class: 'media-heading' %>\n </h4>\n <p class=\"heading-text\">\n PORTFOLIO Web design, app design, print works and photography\n </p>\n </div>\n </div>\n\n </div>\n </div>\n\n\n <div class=\"col-sm-4 index-right\">\n <div class=\"media-background\">\n\n <div class=\"row index-row\">\n <div class=\"media col-sm-5 col-md-4\">\n <a class=\"pull-left\" href=\"\">\n <%= image_tag('building.jpg', class: 'media-img', alt: 'Contacts', type: 'button') %>\n </a>\n </div>\n <div class=\"media-body col-sm-7 col-md-8\">\n <h4>\n <%= link_to 'Contacts', root_path, class: 'media-heading' %>\n </h4>\n <p class=\"heading-text\">\n Where to find the \n <strong>Creatives</strong> \n contact module and more.\n </p>\n </div>\n </div>\n\n </div>\n </div>\n\n\n\n </div>\n\n</div>"
] | [
"html",
"css",
"ruby",
"twitter-bootstrap",
"twitter-bootstrap-3"
] |
[
"How to print Hindi charactors in a pdf file using tc pdf",
"I am making html to pdf file using php tcpdf library.\n\nIn my html file there are some words are in Hindi and some are in English. English word showing properly but Hindi showing some '??????'. Please help how to solve this issue."
] | [
"php",
"internationalization",
"tcpdf",
"hindi"
] |
[
"Can I store ASP.NET MVC routes in web.config?",
"I'm looking for a method of storing routing information in my web.config file in addition to the Global.asax class. The routes stored in the configuration file would need to take higher precedence than those added programmatically.\n\nI've done my searching, but the closest I can come up with is the RouteBuilder on Codeplex (http://www.codeplex.com/RouteBuilder), but this doesn't work with the RTM version of MVC. Does a solution out there exist compatible with the final 1.0?"
] | [
"asp.net-mvc",
"routing",
"web-config"
] |
[
"Passing Variable to Partial - Page Displays symbol instead of string",
"Here is the code in my view to call the partial:\n\n<%= render :partial => \"/divbox\", :locals => { :smush => \"Science\" } %>\n\n\nand now here is what's in _divbox.html.erb:\n\n<div>\n<h1> <%= :smush %> </h1>\n</div>\n\n\nI expect HTML output of:\n\n<div>\n<h1> Science </h1>\n</div>\n\n\nBut instead I get:\n\n<div>\n<h1> smush </h1>\n</div>\n\n\nThanks in advance for your time."
] | [
"ruby-on-rails",
"ruby-on-rails-3.2",
"partial-views",
"local-variables",
"partials"
] |
[
"How do you put a User Name/Password in JSON format to be used to set XHR reques header",
"In Below example, if i use username and password, then anyone can see it in page source. Is there any solution to hide the username and password or can we put credentials in json or xml file and access it to set it in header, if yes please let us know the solution.\n\n$.ajax({ type: \"POST\",\n contentType: false,\n data: formData,\n url: \"external domain URL\",\n crossDomain: true,\n cache: false,\n processData: false,\n\n beforeSend: function(xhr) {\n\n xhr.setRequestHeader(\"Authorization\", \"Basic \" + btoa(\"username\" + \":\" + \"Password\"));\n xhr.withCredentials = true;\n\n},"
] | [
"ajax",
"xmlhttprequest",
"request-headers"
] |
[
"Unable to save the fetched values from firebase database to list",
"`\n\nDatabaseReference drivedatabase ;\npublic static List<String> driveTitle = new ArrayList<>();\npublic static List<String> driveLink = new ArrayList<>() ;\nListView listView;\nTextView textView;\nint count = 0 ;\n\nArrayAdapter<String> driveadapter ;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_important_stuffs);\n\n\n listView = findViewById(R.id.drivelistView);\n textView = findViewById(R.id.drivetitle);\n textView.setText(\"Important Stuffs\");\n drivedatabase = FirebaseDatabase.getInstance().getReference(\"Public/IDrive\");\n drivedatabase.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n try {\n count = (int) dataSnapshot.getChildrenCount();\n Log.i(\"COUNT IN TRY \" , String.valueOf(count));\n for (DataSnapshot datas : dataSnapshot.getChildren()) {\n driveTitle.add(datas.getKey());\n driveLink.add(datas.getValue(String.class));\n\n\n }\n } catch (Exception e)\n {\n Toast.makeText(getApplicationContext(),\"An error occurred Please Try Again Later\",Toast.LENGTH_SHORT).show();\n }\n\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n\n }\n });\n\n Log.i(\"Count\",String.valueOf(count)) ;\n Log.i(\"Drive Count \" , String.valueOf(driveTitle.size())) ;\n driveadapter = new ArrayAdapter<>(ImportantStuffs.this,android.R.layout.simple_list_item_1,driveTitle);\n listView.setAdapter(driveadapter);\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n if(NetworkAvailable())\n {\n StorageClass.link = driveLink.get(position);\n Intent intent = new Intent(getApplicationContext(),ShowPdf.class);\n startActivity(intent);\n }\n else\n {\n Toast.makeText(getApplicationContext(),\"Check your internet connection\",Toast.LENGTH_SHORT).show();\n }\n }\n });\n}\n\nprivate boolean NetworkAvailable() {\n ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);\n NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();\n return activeNetworkInfo != null && activeNetworkInfo.isConnected();\n}} \n\n\nHere is my code, I am getting values in Logcat \"COUNT IN TRY\" but not after completion of ValueEvenListener. The List resets to zero after completion of valueeventListener. \nThis is what my Logcat looks like\n\nLogcat.\n\nI tried making another activity and then add the data to listview, it works that way."
] | [
"android",
"listview",
"firebase-realtime-database"
] |
[
"How do I reference a nested key in Ansible?",
"I have a task in ansible that greps a list of emails in a loop. I am trying to get the "stdout_lines" output of this.\nvars:\n emails:\n - [email protected]\ntasks:\n - name: search\n register: found\n shell: "grep -i {{item}} ~/file"\n with_items: "{{emails}}"\ndebug:\n msg: "{{found.results}}"\n\nThe above displays the following:\n"msg": {\n "changed": true, \n "msg": "All items completed", \n "results": [\n {\n "ansible_loop_var": "item", \n "changed": true, \n "cmd": "grep -i [email protected] ~/file", \n "delta": "0:00:00.003060", \n "end": "2020-10-19 12:52:29.930458", \n "failed": false, \n "invocation": {\n "module_args": {\n "_raw_params": "grep -i [email protected] ~/x", \n "_uses_shell": true, \n "argv": null, \n "chdir": null, \n "creates": null, \n "executable": null, \n "removes": null, \n "stdin": null, \n "stdin_add_newline": true, \n "strip_empty_ends": true, \n "warn": true\n }\n }, \n "item": "[email protected]", \n "rc": 0, \n "start": "2020-10-19 12:52:29.927398", \n "stderr": "", \n "stderr_lines": [], \n "stdout": "[email protected] line 1\\[email protected] line2", \n "stdout_lines": [\n "[email protected] line 1", \n "[email protected] line 2"\n ]\n }\n ]\n}\n\nAnd when I try\ndebug:\n msg: "{{found.results.stdout_lines}}"\n\nI get the error\n\nfatal: [127.0.0.1]: FAILED! => {"msg": "The task includes an option\nwith an undefined variable. The error was: 'list object' has no\nattribute 'stdout_lines'\n\nI should also note that I run into issues when I have more than one email in the list, but one problem at at time."
] | [
"ansible",
"yaml"
] |
[
"How do I get return self.func(*args) to work in Tkinter Python?",
"I have just started my first Python project (sorry if this is a dumb question I am just starting out) and am using the Tkinter interface. I seem to keep on receiving this prompt:\n\n\n Exception in Tkinter callback\n Traceback (most recent call last):\n File \"D:\\Apps\\Python\\lib\\tkinter__init__.py\", line 1883, in ____call____\n return self.func(*args)\n File \"c:/Users/noahc/Documents/Programming/AppLauncher/AppLauncher.py\", line 62, in \n resetList = tk.Button(root, text=\"Reset\", padx=10, pady=5, fg=\"white\", bg=\"#263D42\", command=lambda:[removeSave(),resetList()])\n TypeError: 'Button' object is not callable\n\n\nI have provided the code below:\n\n#########################\n# CREATED BY NOZZYPOZZY #\n#########################\nimport tkinter as tk\nfrom tkinter import filedialog, Text\nimport os\n\nroot = tk.Tk()\n\nroot.title(\"App Launcher\")\nroot.iconbitmap('C:/Users/noahc/Documents/Programming/AppLauncher/icon.ico')\nroot.resizable(0,0)\n\napps = []\n\nif os.path.isfile('save.txt'):\n with open('save.txt','r') as f:\n tempApps = f.read()\n tempApps = tempApps.split(',')\n apps = tempApps\n apps = [x for x in tempApps if x.strip()]\n\n\ndef addApp():\n\n for widget in frame.winfo_children():\n widget.destroy()\n\n filename = filedialog.askopenfilename(initialdir=\"/\", title=\"Select File\", filetypes=((\"Executables\",\"*.exe\"), (\"All Files\", \"*.*\")))\\\n\n apps.append(filename)\n print(filename)\n for app in apps:\n label = tk.Label(frame, text=app, bg=\"gray\")\n label.pack()\n\ndef runApps():\n for app in apps:\n os.startfile(app)\n\ndef resetList():\n for widget in frame.winfo_children():\n widget.destroy()\n\ndef removeSave():\n os.remove('save.txt')\n\n\n\ncanvas = tk.Canvas(root, height=700, width=700, bg=\"gray\")\ncanvas.pack()\n\nframe = tk.Frame(root, bg=\"white\")\nframe.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)\n\nopenFile = tk.Button(root, text=\"Open File\", padx=10, pady=5, fg=\"white\", bg=\"#263D42\", command=addApp)\nopenFile.pack()\n\nrunApps = tk.Button(root, text=\"Run Apps\", padx=10, pady=5, fg=\"white\", bg=\"#263D42\", command=runApps)\nrunApps.pack()\n\nresetList = tk.Button(root, text=\"Reset\", padx=10, pady=5, fg=\"white\", bg=\"#263D42\", command=lambda:[removeSave(),resetList()])\nresetList.pack()\n\n\n\n\nfor app in apps:\n label = tk.Label(frame, text=app)\n label.pack()\n\nroot.mainloop()\n\n\nwith open('save.txt', 'w') as f:\n for app in apps:\n f.write(app + ',')\n\n\nThanks,\nnozzypozzy"
] | [
"python",
"tkinter",
"tkinter-canvas"
] |
[
"Explain the meaning of a matlab code involving filters in binary",
"Hi I have a sample code to convert to python. Unfortunately I am very new to Matlab code. Could you please help me to understand the code. I want to write in python. Any leads would be appreciated. Here the filters are considered in binary. This is a neural network code.\n\n%convert the weights to -1 and + 1. Store in single because conv2 requires it\n\n for i = 1:length(Filters)\n Filters{i} = gpuArray(2*(single(sign(Filters{i}))-0.5));\n NumLearntWeightsEachLayer(i) = size(Filters{i},3)*size(Filters{i},4)*4;\n end\n NumLearntWeightsEachLayer(end) = size(Filters{end},3)*size(Filters{end},4);\n NumLearntWeightsEachLayer\n TotalLearntWeights = sum(NumLearntWeightsEachLayer)"
] | [
"matlab",
"deep-learning",
"deep-residual-networks"
] |
[
"How to assign javascript variable value to HTML Attribute?",
"I am having 2 text box.. Value of first text box should been an length of second text box.. Eg: If user gives First text box value as \"10\", then my second text box should not allow user to type more than 10 characters..\n\nHere is my code..\n\n\r\n\r\n function field_length()\r\n {\r\n var fieldValue= document.getElementById('Length').value;\r\n alert(fieldValue);\r\n }\r\n \r\n <input type=\"text\" name=\"Length[]\" maxlength=\"2\" class=\"required\" id=\"Length\" onkeypress=\"return isNumberKey(event);\" placeholder=\"Field length\" class=\"form-control\">\r\n <input type=\"text\" name=\"Label[]\" class=\"required\" id=\"Label\" maxlength=\"\" onClick=\"field_length();\" placeholder=\"Field Label\" class=\"form-control\">\r\n\r\n\r\n\n\nIn this code what i did was.. if user is gives value for first field as \"5\", on tap of second field it will alert the value.. But i want that value to be assigned to Maxlenght attribute. Give me some idea.."
] | [
"javascript",
"html"
] |
[
"how to prevent double time binding data to controls in asp.net with c#",
"i have code to binds data to controls. I prevent them to second time binding when page reloads. It's works with success as ago. but now it's binds double time. i don't know why ?\n\nhere is my code :\n\nDAL_General obj = new DAL_General();\n protected void Page_Load(object sender, EventArgs e)\n {\n if (!Page.IsPostBack)\n {\n Fill_Combo();\n Get_Data();\n }\n }\n protected void Fill_Combo()\n {\n DAL_ComboFill obj_u = new DAL_ComboFill();\n obj_u.Fill_Users_Combo(this, ddl_users, false, true);\n obj_u.Fill_SenderIds_Combo(this, ddl_sender, false, true);\n obj_u.Fill_Status_Combo(this, ddl_delevery, false, true);\n obj_u.Fill_AccountType_Combo(this, ddl_account, false, true);\n }\n\n\nand here is my result :\n\n\nall drop down list and grid view binds double time. and i want to prevent them. please help me..."
] | [
"sql",
"c#-4.0",
"postback",
"asp.net-4.0"
] |
[
"GetRouteUrl returns null and RedirectToRoute throws \"No matching route found for RedirectToRoute.\"",
"Page.GetRouteUrl(\"routename\", new { blah = \"blah\" })\n\n\nReturns null\n\nResponse.RedirectToRoute(\"routename\", new { blah = \"blah\" })\n\n\nthrows InvalidOperationException(\"No matching route found for RedirectToRoute.\")\n\nI put a breakpoint and checked System.Web.Routing.RouteTable.Routes and my routes are there. I can use them without a hitch in my page code. What's the deal?"
] | [
"asp.net-routing"
] |
[
"iOS build error: framework not found FileProvider for architecture x86_64",
"I am trying to build an Ionic 3 app for iOS and I keep getting this error when building both with Xcode and on Ionic Pro.\n\nWhen using Xcode I get:\n\n[x] ld: framework not found FileProvider for architecture x86_64\n\n\nOn Ionic Pro I get:\n\n[x] ld: framework not found FileProvider for architecture armv7\n\n\nThis same project already builds and works on Android."
] | [
"ios",
"xcode",
"ionic2",
"ionic3"
] |
[
"Tabulate With Category as Label",
"I am trying to produce a table which contains totals for each group. \nI have sections, subsections and items. After each subsection \na line with the totals of this subsection should appear and\nafter each section a line with the section total.\n\nI tried using proc tabulate but the subtotals are just called Sum or another fixed label. I would like to use the category name for the subtotals.\n\nExample 1\n\nFirst a small example to illustrate, below I have a complete running example\nwhich shows what I tried with the proc tablulate and what I would like to achieve.\n\nInput Data\n\n==============================\nGroup Group2 Item Weight\n----- ------ ---- ------\nMammals Cats Lion 215\nMammals Cats Cheetah 70\nMammals Dogs Wolf 80\nMammals Dogs Jackal 45\n==============================\n\n\nDesired Result\n\n===================\nGroup/Item Weight\n----------- ------\n Lion 215\n Cheetah 70\n Cats 285\n----------- ------\n Wolf 80\n Jackal 45\n Dogs 125\n----------- ------\nMammals 410\n=================== \n\n\nExample 2\n\nA slighly longer example in SAS code \nwhich also includes missing values\n\ndata animals;\ninput group1 $ group2 $ animal $ weight;\ndatalines;\nMammals Cats Lion 215\nMammals Cats Cheetah 70\nMammals Cats Leopard 65\nMammals Dogs Wolf 80\nMammals Dogs Jackal 45\nBirds Raptors Eagle 6\nBirds Raptors Hawk 5\nBirds . Duck 2\n. . Snake 3\n;\n\n\nMy unsuccessful attempt, the table is too complicated\n\nPROC TABULATE DATA=ANIMALS OUT=ANIMAL_SUMMARY;\n VAR weight;\n\n CLASS group1 / ORDER=DATA MISSING;\n CLASS group2 / ORDER=DATA MISSING;\n CLASS animal / ORDER=DATA MISSING;\n\nTABLE group1*(group2*(animal Sum) Sum) Sum, weight;\nRUN;\n\n\nA form of data close to the desired result\n\ndata target;\ninput group1 $ group2 $ animal $ weight;\ndatalines;\n. . Lion 215\n. . Cheetah 70\n. . Leopard 65\n. Cats . 350\n. . Wolf 80\n. . Jackal 45\n. Dogs . 125\nMammals . . 475 \n. . Eagle 6\n. . Hawk 5\n. Raptors . 11\n. . Duck 2\nBirds . . 13\n. . Snake 3\n. . . 491\n;"
] | [
"sas"
] |
[
"MEAN.JS New Controller Function and Route",
"I'm learning MEAN.JS and having a few issues with routing, just looking to add a new function to the articles project called getSubArticles which calls to the server and does something. \n\n //articles.server.routes.js\n app.route('/articles/:articleId/subarticles')\n .get(articles.read);\n\n //articles.server.controller.js\n exports.read = function(req, res) {\n res.jsonp(\"My Sub articles\");//just using for testing\n };\n\n //articles.client.controller.js\n $scope.getSubArticles = function() {\n // What goes here as everything I've tried has failed, but the route could be constructed incorrectly\n };\n\n//articles.client.view.html\n <section id=\"subarticle-listing\" data-ng-controller=\"ArticlesController\" data-ng-init=\"getSubArticles()\">\n\n\nAny ideas where I'm going wrong? Got a sample MEAN.JS project with non default routes/functions I can look at...\n\nCheers,\nAdrian"
] | [
"angularjs",
"node.js",
"express",
"meanjs"
] |
[
"SQLite simplify union of left outer join",
"I inherited some monster SQL queries and I would like to simplify/ shorten them as much as possible.\nOne of them is:\nSELECT \n * \n FROM \n (\n SELECT \n $columnsFromBothTables\n FROM \n table_abc\n left outer join table_xyz using profile_id \n union \n select \n $columnsFromBothTables\n from \n table_xyz \n left outer join table_abc using profile_id\n ) \n\nIt looks weirdly redundant.\nIs there a way to simplify it to sth like?\nSELECT * FROM (\n SELECT $columns FROM table_abc MAGIC_OPERATION table_xyz\n)\n\nIsn't it a FULL OUTER JOIN?\nUpdates:\nMy understanding is that both tables have M-1 relationship to "profile" table.\nThey do not have direct relationship to each other"
] | [
"sql",
"sqlite"
] |
[
"Calculating rolling sum based on dates being in a range of calendar dates",
"I want to calculate rolling sum based not on ordered date rows but on the condition of dates being in range of calendar dates:\n\nBasically I want to be able to sum values in qty column where date range varies from current date minus 4 calendar days. For example:\n\nAs it can be seen from the picture, I calculate rolling sum but it is based on 4 calendar days back from the current date. And The red arrow shows the case with 16th of February when 4 calendar days must include all Qty-s to 12th of February. In this table I have only 3 records between 16th and 12th of February.\nThis condition does not allow me to use OVER clause since I have no idea how many rows from my table will be included in the range (which is not 4 days, I gave it here as an example and it may vary).\nI would appreciate suggestions."
] | [
"sql",
"sql-server",
"rolling-computation"
] |
[
"Facebook SDK for IOS in FLutter",
"I'm trying to add the Facebook SDK in my flutter project but i don't know the proper Swift code to put in the AppDelegate.swift. Following this guide I should paste this code:\n\n\n// AppDelegate.swift\n\nimport UIKit\nimport FBSDKCoreKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(\n _ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n ) -> Bool {\n\n ApplicationDelegate.shared.application(\n application,\n didFinishLaunchingWithOptions: launchOptions\n )\n\n return true\n }\n\n func application(\n _ app: UIApplication,\n open url: URL,\n options: [UIApplication.OpenURLOptionsKey : Any] = [:]\n ) -> Bool {\n\n ApplicationDelegate.shared.application(\n app,\n open: url,\n sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,\n annotation: options[UIApplication.OpenURLOptionsKey.annotation]\n )\n\n } \n\n}\n\n\nBut the Flutter project has a different default code than the native:\n\nimport UIKit\nimport Flutter\n\n@UIApplicationMain\n@objc class AppDelegate: FlutterAppDelegate {\n override func application(\n _ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n ) -> Bool {\n GeneratedPluginRegistrant.register(with: self)\n return super.application(application, didFinishLaunchingWithOptions: launchOptions)\n }\n}\n\n\n\nDoes anybody knows the proper way to merge them together?"
] | [
"ios",
"swift",
"facebook",
"flutter"
] |
[
"Translate front-end templates in SailsJS",
"I'm no able to translate client-side templates in sails.\nDocs says:\n\nIf you'd prefer not to use an external internationalization library, you can actually reuse Sails' i18n support to help you get your translated templates to the browser. If you want to use Sails to internationalize your client-side templates, put your front-end templates in a subdirectory of your app's /views folder.\n\n\nIn development mode, you should retranslate and precompile your templates each time the relevant stringfile or template changes using grunt-contrib-watch, which is already installed by default in new Sails projects.\nIn production mode, you'll want to translate and precompile all templates on lift(). In loadtime-critical scenarios (e.g. mobile web apps) you can even upload your translated, precompiled, minified templates to a CDN like Cloudfront for further performance gains.\n\n\nbut at the and, when i use client-side template with window.JST global i'm getting:\n\njst.js:82 Uncaught ReferenceError: __ is not defined\n at Object.JST.views/templates/archiveListItemNoResults.ejs (jst.js:82)"
] | [
"internationalization",
"sails.js",
"client-side"
] |
[
"How to migrate ASP.NET Web Forms application from Membership to ASP.NET Identity 2.0?",
"I have an application which is in .NET Framework version 4.5. It uses Web Forms and EntityFramework 6.1.1. \n\nThe EntityFramework's Context object is of type ObjectContext. I'm using ASP.NET Membership(the MembershipProvider is customized i.e Custom Membership) for managing the user account related operations. \n\nI want to migrate my Web Forms application to ASP.NET Identity. \n\n\nAccording to http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity article I think I have to do the following things to migrate to the ASP.NET Identity:\n\n\nConvert the ObjectContext to DbContext(and correct the related codes)\nCreate the new tables needed for ASP.NET Identity and do the data migration.\nRedefine the account section codes and other dependent codes as needed to match the business logic.(optional)\n\n\nI have few questions in my mind:\n\n1) I have customized the membership User table and there are several custom foreign keys associated with the User table. Will it still be feasible to migrate to the Identity system without losing any data?\n\n2) As I'm using EntityFramework so DbContext is needed to migrate to Identity system. Can I use ObjectContext for ASP.NET Identity migration?\n\n3) I'm NOT using all the Membership tables as listed at http://i1.asp.net/media/48109/image006.png?cdn_id=2014-11-11-001. (i.e aspnet_Applications, aspnet_Membership, aspnet_Paths, aspnet_PersonalizationAllUsers, aspnet_PersonlizationPerUser, aspnet_Profile, aspnet_Roles, aspnet_SchemaVersions, aspnet_Users, aspnet_UsersInRoles, aspnet_WebEvent_Events)\n\nBut I am using Application, User, Role, UserInRole, Profile tables only. Can I still migrate these table in order to use the ASP.NET Identity?\n\nI'm ready to provide more information you may need to understand my current scenario.\n\nI'm looking for the correct steps to migrate to Identity, any caution I need to take care, any hurdles I will face? Any help is highly appreciated."
] | [
"c#",
"asp.net",
"entity-framework",
"asp.net-identity",
"dbcontext"
] |
[
"Seperate attribute values with comma in xslt 1.0?",
"My source XML:-\n\n<wireframe:xaIDExclusion>\n <widget:xaID id=\"12\"/>\n <widget:xaID id=\"121\"/>\n <widget:xaID id=\"123\"/>\n <widget:xaID id=\"124\"/>\n <widget:xaID id=\"3456\"/>\n</wireframe:xaIDExclusion>\n\n\n\n\nThis is what i tried\n\n<xsl:template match=\"widget:xaID\">\n <xsl:element name=\"xaid\">\n<xsl:variable name =\"value\" select=\"@id\"></xsl:variable> \n<xsl:value-of select=\"concat($value,',')\"></xsl:value-of>\n</xsl:element> \n</xsl:template>\n\n\n\n\nI need output like this,how to do that\n\n12,121,123,124,3456\n\n\n\n\nThanks in advance"
] | [
"xslt",
"xslt-1.0"
] |
[
"Why isn't this statement marked as completely covered by eclemma?",
"I am using EclEmma in Eclipse (more specifically, RSA 8). I have the following statement in my code:\n\npublic static boolean isEmpty(Collection collection) {\n return (collection == null) || collection.isEmpty();\n}\n\n\nand I have the following tests:\n\n@Test public void isEmpty_nullCase() {\n assertTrue(CollectionUtil.isEmpty(null));\n}\n@Test public void isEmpty_listCase() {\n assertTrue(CollectionUtil.isEmpty(new ArrayList()));\n}\n\n\nbut for some reason, the statement is showing up as yellow. What part of it am I not testing?\n\nThanks,\nPeter"
] | [
"java",
"code-coverage",
"emma"
] |
[
"Iframe is not working in firefox",
"http://stg.fanggle.com/analytics/pentaho/pendingtags.html in this link i have iframe ...\n\nIt is loading in chrome and in firefox it is showing error in console as:\n\n\nPermission denied to access property 'mantle_initialized'\nhttp://bi.fanggle.com/pentaho/content/reporting/reportviewer/reportviewer-app.js\nLine 65\nLoad timeout for modules: local!dojo \nhttp://requirejs.org/docs/errors.html#timeout\nhttp://bi.fanggle.com/pentaho/js/require.js\nLine 6\n\n\nCan any one help me to solve this issue and display in all browser"
] | [
"jquery",
"firefox",
"iframe"
] |
[
"How can I run a file that is my master branch?",
"So, I am new to Git. I know how to make repos, commit, push, merge etc.\n\nBut I have a question that might sound silly.\n\nI have a script that runs at a specific time everyday.\n\nWhen I create a new branch to develop new features, how can I continue running the old file?\n\nExample python3 file_v1\n\nIn my pre-Git days, I would have simple creating file_v2 and kept file_v1 running. I know this archaic. But would appreciate a solution."
] | [
"git",
"github"
] |
[
"Mac Catalina / Python 3.8.3 / Speech Recognition / Cannot get mic input to VS Code while the code works fine from Terminal",
"I am trying to work on SpeechRecognition. When I run the code on Visual Stuido Code it doesn't listen, when I run the code from Mac Terminal it receives audio input and works fine... I tired to drag&drop VS to mic permissions. I cannot make it work anyway...\n\ndef get_audio():\nr = sr.Recognizer()\nwith sr.Microphone() as source:\n audio = r.listen(source)\n said = \"\"\n\n try:\n said = r.recognize_google(audio)\n except Exception as e:\n print('Exception', str(e))\n\nreturn said.lower()\n\n\nprint(\"Speak now!\")\nprint(get_audio())"
] | [
"python",
"macos",
"permissions",
"speech-recognition",
"macos-catalina"
] |
[
"Showing a loader while input file uploading",
"I have an HTML form with input file like this:\n\n<form method=\"POST\" enctype=\"multipart/form-data\">\n <input type=\"file\" name=\"pic\" accept=\"image/*\">\n <button type=\"submit\">Salva</button>\n</form>\n\n\nSometimes, specially with large files, upload process goes on for a long time and user doesn't know what is happening.\n\nIs there any jQuery/javascript event that can do stuff when uploading starts and do others when it finishes?"
] | [
"javascript",
"jquery",
"html"
] |
[
"How to create GoogleChart Linechart crossover lines",
"We are trying to create a line chart using Google Charts to display multiple lines that use different x values. You can see the code here - https://jsfiddle.net/V1haR/6nr2zbu4/\n\nIf these lines do not overlap, (e.g. one begins at 400 and ends at 500 and the next line begins at 501) then this is not a problem, however, with lines where the data begins before the previous data point ends, these lines do not show correctly (see link). \n\nFor test 3:\n\nvar google_chart_json = {\n \"test1\": [[285, 1], [353, 100], [405, 1]],\n \"test2\": [[430, 1], [500, 100], [530, 1]],\n \"test3\": [[454, 1], [666, 100], [720, 1]],\n };\n\n\nIf you change 454 to 550 for example, you can see the lines appear. \n\nWe have tried everything for this but cannot find the answer, is it possible?"
] | [
"javascript",
"graph"
] |
[
"Bug when I open a Bluetooth setting",
"I want to get response if user click yes , that he want to get his phone discoverable. When an ansewer is yes I want to start new Activity, but when a user open a setting bluetooth my application is open new activity (and this is a bug)\n\nThis is what I do :\n\n private final BroadcastReceiver mBroadcastReceiver2 = new BroadcastReceiver() {\n\n @Override\n public void onReceive(Context context, Intent intent) {\n final String action = intent.getAction();\n\n if (action.equals(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED)) {\n\n int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.ERROR);\n\n switch (mode) {\n case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE:\n Intent serverIntent = new Intent(MainActivity.this, DeviceListActivity.class);\n// startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);\n// showProgressbar();\n break;\n case BluetoothAdapter.SCAN_MODE_CONNECTABLE:\n break;\n case BluetoothAdapter.SCAN_MODE_NONE:\n break;\n }\n }\n }\n };\n\n\n IntentFilter filter2 = new IntentFilter();\n filter2.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);\n filter2.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);\n filter2.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);\n registerReceiver(mBroadcastReceiver2, filter2);"
] | [
"java",
"android",
"bluetooth"
] |
[
"error: 50 - Local Database Runtime error occurred. Specified LocalDB instance name is invalid ON JETBRAIN RIDER",
"I'm trying to write ASP.NET core on Jetbrain Rider, but I'm stuck on this error though I configure all necessary settings to use SQL Server Express 2014.\n\nHere is my connection string:\n\n\"Server=(localdb)\\\\SQLEXPRESS;Database=Library;Trusted_Connection=True;MultipleActiveResultSets=True\"\n\n\nAnd I successfully connected SQLEXPRESS instance on Microsoft SQL Management Studio\n\nI also passed my connection string to UseSQLServer method in OnConfiguring method of startup.cs\noptionsBuilder.UseSqlServer(@\"Server=(localdb)\\\\SQLEXPRESS;Database=Library;Trusted_Connection=True;MultipleActiveResultSets=True\");\n\n\nI'm stuck for 2 days on this error, I read almost all microsoft and Jetbrain related docs but it couldn't help"
] | [
"c#",
"sql-server",
"asp.net-mvc",
"rider"
] |
[
"Developer Tools - Internet Explorer vs. Chrome - Scraping",
"I am a little new to scraping so pardon if I am not detailed in my question. I have an internal website in my company and I am trying to scrape data from it. The issue that the website is only compatible with IE Explorer and when opening in Chrome, the vast majority of the data is missing and it is not structured correctly. When opening the developer tools in Explorer, the area that I am trying to get data from is like a black box (see below - that is what I get when I select element). On the other hand, when I open it in Chrome, the area that was a black box in Chrome is no longer a black box and I can scrape the data. The issue is that site is not compatible with Chrome and most of the relevant data is not showing up. \n\n\r\n\r\n<FRAME name=HauptFenster src=\"blank.html\" frameborder=\"1\" scrolling=\"auto\"></frame>\r\n\r\n\r\n\n\nI am trying to figure how to scrape it within Explorer if possible. Why would Explorer developer tools show less items than Chrome? Any help or insights would be appreciated."
] | [
"javascript",
"html",
"google-chrome",
"internet-explorer",
"web-scraping"
] |
[
"Python 3.x: alternative pprint implementation",
"Standard pprint module is nice when deals with lists, dicts and so on. But sometimes completely unusable with custom classes:\n\n\nThe only way to make it print usable information about an object of some class is to override __repr__, but what if my class already have nice, eval()'able __repr__ which is not showing the information I want to see in pprint ouput?\nOk, I will write print-oriented __repr__, but in this case it is impossible to pretty-print something inside my class:\n\n\n.\n\nclass Data:\n def __init__(self):\n self.d = {...}\n\n\nI can't pretty-print self.d contents, I can return one-line representation only(at least without playing with stacktraces, etc).\n - Overriding PrettyPrinter is not an option, I dont want to do it every time I want to pretty-print the same class.\n\nSo... Is there any alternatives to pprint which allows to make a custom class pretty-printable?"
] | [
"python",
"python-3.x",
"pprint"
] |
[
"installing tensorflow_transform and apache_beam on Datalab",
"I'm going over these example from google-cloud Coursera courses, and although they worked till a few weeks ago, I can't install tf.transform or apache_beam on Datalab anymore.\n\nhttps://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/courses/machine_learning/feateng/tftransform.ipynb\n\nhttps://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/courses/machine_learning/deepdive/06_structured/4_preproc_tft.ipynb\n\nWhen installing tensorflow_transform I get the following errors:\n\n%bash\npip install --upgrade --force tensorflow_transform==0.6.0 \n\n\ntwisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.\n datalab 1.1.3 has requirement six==1.10.0, but you'll have six 1.11.0 which is incompatible.\n gapic-google-cloud-pubsub-v1 0.15.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.\n proto-google-cloud-pubsub-v1 0.15.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.\n apache-airflow 1.9.0 has requirement bleach==2.1.2, but you'll have bleach 1.5.0 which is incompatible.\n apache-airflow 1.9.0 has requirement funcsigs==1.0.0, but you'll have funcsigs 1.0.2 which is incompatible.\n google-cloud-monitoring 0.28.0 has requirement google-cloud-core<0.29dev,>=0.28.0, but you'll have google-cloud-core 0.25.0 which is incompatible.\n proto-google-cloud-datastore-v1 0.90.4 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.\n pandas-gbq 0.3.0 has requirement google-cloud-bigquery>=0.28.0, but you'll have google-cloud-bigquery 0.25.0 which is incompatible.\n googledatastore 7.0.1 has requirement httplib2<0.10,>=0.9.1, but you'll have httplib2 0.11.3 which is incompatible.\n googledatastore 7.0.1 has requirement oauth2client<4.0.0,>=2.0.1, but you'll have oauth2client 4.1.2 which is incompatible.\n Cannot uninstall 'dill'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall."
] | [
"tensorflow",
"google-cloud-platform",
"apache-beam",
"google-cloud-datalab",
"tensorflow-transform"
] |
[
"Combining multiple MySQL queries into one",
"I am trying to write a query where I can get a count on distinct user_id's in a transactions table of a database every 3 months.\n\nI can achieve the result manually if I do the following\n\nSELECT COUNT(DISTINCT(user_id)) FROM transactions WHERE DATE(created_at) BETWEEN \"2011-01-01\" AND \"2011-03-31\".\n\n\nBut if I want to run this automatically over years of quarterly periods it would take forever.\n\nIs there a way to wrap this sort of thing up in a single query?"
] | [
"mysql"
] |
[
"With vb.net change in excel some cell values with activated filter metod",
"I want to go through all visible (non hidden rows) and change data in cell 4.\nBut the important thing is that there in some cells data already exists and this data should not be changed and not been counted in the input rows. So i have filtered all the rows with 0.00 value in cell 4, and now i want to input from visible rows 2 to 500 the value 70 in cell 4, than from 501 to 1251 value 65 and from 1252 to the last used row value 60.\nUnfortunately, i am lost, completely. Please help\n\nDim numrows As Integer = oBook.Worksheets(1).UsedRange.Rows.Count()\nDim numrows2 As Integer = oBook.Worksheets(2).UsedRange.Rows.Count()\nwsheet2 = oBook.Worksheets(2)\nwsheet = oBook.Worksheets(1)\n\nDim currentRow As Long\noBook.Worksheets(1).Range(\"A11\").AutoFilter(Field:=11, Criteria1:=\"=\", VisibleDropDown:=False)\n\nIf wsheet.Rows().Hidden = False Then\n For currentRow = 2 To numrows Step 1\n If String.IsNullOrEmpty(wsheet2.Cells(currentRow, 11).Value) Then\n If currentRow >= 2 And currentRow <= 501 Then\n wsheet.Cells(currentRow, 11).value = \"70\"\n ElseIf currentRow >= 501 And currentRow <= 1251 Then\n wsheet.Cells(currentRow, 11).value = \"65\"\n ElseIf currentRow >= 1252 Then\n wsheet.Cells(currentRow, 11).value = \"60\"\n End If\n End If\n Next\nEnd If\n\n\nThe point is i.e. from row 2 to 500 there are 10 cells with inserted data \"0.00\", so the correct input would be to row 510 with the value 70, and so on...Thats why i hidded the 0.00 rows, but there are still be filled with the given values 70, 65 and 60"
] | [
"excel",
"vb.net"
] |
[
"How to delete specific map field in an array?",
"I created an firestore collection with users, and in this one I save favourites for an favourite list by an array, and the favourites get created as map fields of this array, and I want to know how I can remove an specific favourite (map field) of my array?\n\nThat is my function to add favourites to my array.\n\naddFav(name, performer, category, room, abstract, begin, dis, color, btn, id`){\ntry{\n this.afs.doc(`users/${this.user.getUID()}`).update({\nfavs: firestore.FieldValue.arrayUnion({\n name,\n performer,\n category,\n room,\n abstract, \n begin, \n dis,\n color,\n btn\n})\n })\n}\n\n\nI need help to delete an specific favourite / map field of my array\n\ndeleteFav()\n{\n try{\nthis.afs.doc(`users/${this.user.getUID()}`).update({\n favs: firestore.FieldValue.delete()\n})\n }\n}\n\n\nfollowing pictures shows my firestore collections with the array and the map fields.\n\nhttps://i.stack.imgur.com/1Y1Xj.png"
] | [
"ionic-framework",
"google-cloud-firestore"
] |
[
"No internet access Nextcloud Connection Assistant",
"I specify that my NextCloud is accessible on all my devices except when I want to use the Nextcloud software for computer, during the connection I have this message: "No access to the Internet".\nWith : ERR_PROXY_CONNECTION_FAILED"
] | [
"nextcloud"
] |
[
"Magento 1.9 - setting different prices for sizes of products in different stores?",
"i want to set different prices for the sizes of my products in different stores. I have a configurable products which has a size-attribute. Now I want to set a price of 10 EUR for the \"10x10\"-option in Store 1 and 20 EUR for the \"10x10\"-option in Store 2. Now we tried the following module: http://bsscommerce.com/magento-multistore-pricing.html but it can only handle the base price of the confiugrable product and not the different attribute prices.\n\nI am just wondering if we are the only ones which faced the same problem. I know that magento has only the website scope option buildin to differentiate the prices in the catalog but is this the correct solution?\n\nDoes someone has a similiar problem or can suggest another module? There is this other module: https://www.magentocommerce.com/magento-connect/store-view-pricing.html but the rating is not that great and the credentials to login in their demo-backend are simply wrong so I can't check my problem in their demo."
] | [
"php",
"magento",
"magento-1.9"
] |
[
"Display array ratings according to user's input in alert",
"I am trying to write a program that allows users to view only hotels with 4 stars ratings. Whenever I run this code, I keep on getting back all of the objects within the array, instead of just 'Hilton' and 'Holiday Inn'. What am I doing wrong? Thanks.\n\n var hotels = ['Marriot', 'Hilton', 'Double Tree', 'Holiday Inn']\n var visitorRating = ['0 starts', '4 stars', '1 star', '4 stars']\n\n var seeHotels = prompt(\"Would you like to see all of the hotels whose ratings are 4 stars?\");\n var fourStars = e;\n\n for(var e = 0; e < visitorRating.length; e++){\nif(visitorRating[e].indexOf(\"4 stars\"))\n document.write( hotels[e] + ' ' + visitorRating[e])\n }\n }"
] | [
"javascript",
"arrays",
"for-loop",
"while-loop"
] |
[
"Using dictionaries in loop",
"I am trying to write a code that replicates greedy algorithm and for that I need to make sure that my calculations use the highest value possible. Potential values are presented in a dictionary and my goal is to use largest value first and then move on to lower values. However since dictionary values are not sequenced, in for loop I am getting unorganized sequences. For example, out put of below code would start from 25. \n\nHow can I make sure that my code is using a dictionary yet following the sequence of (500,100,25,10,5)? \n\na={\"f\":500,\"o\":100,\"q\":25,\"d\":10,\"n\":5} \nfor i in a:\n print a[i]"
] | [
"python",
"dictionary"
] |
[
"Background music in thymeleaf",
"Hi how can I play background music in thymeleaf? Basic ways lose\n\n<audio controls>\n <source src=\"/static/hikariare.mp3\" type=\"audio/mpeg\">\n</audio>\n\n\nAnd I get something like this:\n\norg.xml.sax.SAXParseException: Attribute name \"controls\" associated with an element type \"audio\" must be followed by the ' = ' character."
] | [
"html",
"thymeleaf"
] |
[
"c# - can you make a \"weak\" assembly reference to a strong named assembly",
"For various reasons i would rather not use strong named (signed) assemblies in my project. however, one of the projects is referenced by a sharepoint web part which means it must be signed.\n\nis it possible to have this assembly signed but when I reference it from other projects, to do so using a non-strong reference. this would give me the advantages of having a non-signed assembly for the rest of my code but still allow it to be loaded by sharepoint."
] | [
"c#",
"assemblies",
"assembly-signing",
"signed-assembly"
] |
[
"Multiple One-to-One Relationships of the Same Type on Entity in Entity Framework",
"I have a model:\n\npublic class Foo\n{\n public virtual Bar Bar1 { get; set; }\n public virtual Bar Bar2 { get; set; }\n}\n\npublic class Bar\n{\n public virtual Foo Foo { get; set; }\n}\n\n\nBar1 and Bar2 are optional but Foo is required for all Bars. There is a Bar1_Id column and Bar2_Id column on the Foos table.\n\nI tried this configuration:\n\nmodelBuilder\n .Entity<Foo>()\n .HasOptional(x => x.Bar1);\n\nmodelBuilder\n .Entity<Foo>()\n .HasOptional(x => x.Bar2);\n\nmodelBuilder\n .Entity<Bar>()\n .HasRequired(x => x.Foo);\n\n\nWhich generated a migration that tried to add a Foo_Id to the Bars table:\n\nAddColumn(\"dbo.Bars\", \"Foo_Id\", c => c.Guid(nullable: false));\nCreateIndex(\"dbo.Bars\", \"Foo_Id\");\nAddForeignKey(\"dbo.Bars\", \"Foo_Id\", \"dbo.Foos\", \"Id\", cascadeDelete: true);\n\n\nWhich isn't what I wanted, so I tried removing those lines from the migration and running the code which of course produced the error when trying to load a Bar:\n\n\n Invalid column name 'Foo_Id'.\n\n\nI then tried this configuration:\n\nmodelBuilder\n .Entity<Foo>()\n .HasOptional(x => x.Bar1)\n .WithRequired(x => x.Foo);\n\nmodelBuilder\n .Entity<Foo>()\n .HasOptional(x => x.Bar2)\n .WithRequired(x => x.Foo);\n\n\nWhich produced this error when migrating:\n\n\n System.Data.Entity.Core.MetadataException: Schema specified is not\n valid. Errors: The relationship 'Test.Foo_Bar1' was not loaded because\n the type 'Test.Bars' is not available.\n\n\nI have this sort of relationship elsewhere, but not where there are two of the same type on the entity. Is this a known limitation of EF6?"
] | [
"c#",
"entity-framework",
"fluent-entity-framework"
] |
[
"MongoDB multiple fields lookup",
"I'm trying to perform a $lookup using two fields on MongoDB 3.6. I've already read the docs and similar questions here, but I was unable to find what's wrong.\n\nCollection acls:\n\n[ { _id: 1, FolderId: 4, Sid: 'S-123-456' }\n { _id: 2, FolderId: 5, Sid: 'S-234-567' }\n { _id: 3, FolderId: 6, Sid: 'S-345-678' } ]\n\n\nCollection groups:\n\n[ { _id: 1, ProcessId: 10, Sid: 'S-123-456', Users: [ 'user1', 'user2'] }\n { _id: 2, ProcessId: 10, Sid: 'S-234-567', Users: [ 'user1'] }\n { _id: 3, ProcessId: 20, Sid: 'S-123-456', Users: [ 'user2'] } ]\n\n\nQuery:\n\ndb.acls.aggregate({\n $lookup: \n { \n from: 'groups',\n let: { 'ProcessId': 10, 'GroupSid': '$Sid' },\n pipeline: [{\n $match: {\n $expr: {\n $and: [\n {\n $eq: [ '$ProcessId', '$$ProcessId' ]\n },\n {\n $eq: [ '$Sid', '$$GroupSid' ]\n }\n ]\n }\n }\n }],\n as: 'grouplist'\n }\n})\n\n\nI was expecting to return something like:\n\n{ _id: 1, FolderId: 4, Sid: 'S-123-456', \n grouplist: [ { _id: 1, ProcessId: 10, Sid: 'S-123-456', Users: [ 'user1', 'user2'] }] }\n\n\nbut instead I'm getting 'Script executed successfully, but there are no results to show', on Robo 3T."
] | [
"mongodb",
"mongodb-query",
"aggregation-framework"
] |
[
"Used of Delegates in .Net",
"Possible Duplicate:\n The purpose of delegates \n\n\n\n\nWhat is actual use of Delegate in .Net"
] | [
"c#"
] |
[
"Make custom intellij theme apply to UI",
"I downloaded a custom intellij theme and imported it into my project with file > import settings then went to file > settings > Editor > colors & fonts and chose my color scheme name. This applied well to the code editor, but the UI (such as the project navigation pane) did not change. Do I need to apply the settings to the UI in another manner?"
] | [
"intellij-idea",
"settings"
] |
[
"WeakEventHandler with LINQ and delegate constraint",
"How can a C# generic weak event handler be made for predefined system events using LINQ?\nSolution 4 of Daniel Grunwald's article on Weak Events in C# shows a reusable wrapper, i.e.\n\neventWrapper = WeakEventHandler.Register(\n eventSource,\n (s, eh) => s.Event += eh, // registering code\n (s, eh) => s.Event -= eh, // deregistering code\n this, // event listener\n (me, sender, args) => me.OnEvent(sender, args) // forwarding code\n);\n\n\nHowever, an attempt to apply this to a generic event such as the UnhandledExceptionHandler results in a compile error: Cannot implicitly convert type 'System.EventHandler' to 'System.UnhandledExceptionEventHandler'.\n\n WeakEventHandler.Register(AppDomain.CurrentDomain, \n (s, eh) => s.UnhandledException += eh, \n (s, eh) => s.UnhandledException -= eh, \n this, \n (me, sender, ea) => me.UnhandledExceptionHandler(sender, ea));\n\n\nConvertTo in Jacob Carpenter's article on Delegate Conversion may provide a clue, but I currently do not see how to use that with Daniel Grunwald's code."
] | [
"c#",
"linq",
"generics",
"delegates"
] |
[
"Error retrieving parent for item: No resource found that matches the given name 'AppTheme'",
"I am migrating from command line compiling (yikes!) using Ant to Android Studio. I am seeing the error listed in the Title/Subject line and am not sure on how to proceed. The error comes from a reference to AppTheme.NoActionBar in v21/values-21.xml. My build.gradle file shows: \n\nandroid {\n compileSdkVersion 25\n buildToolsVersion \"25.0.2\"\n defaultConfig {\n applicationId \"arl.weather.mobile\"\n minSdkVersion 15\n targetSdkVersion 25\n\n\nDo I need to alter something here/or is the issue elsewhere?\n\nTIA,\nsteve\n\nMy edit-It is dying at the AppTheme reference below (part of v21/values-v21.xml file). I wanted to paste the entire file but when I did the formatting went crazy and was unreadable. I hope this portion helps.\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"notification_action_color_filter\">@color/secondary_text_default_material_light</color>\n <dimen name=\"notification_content_margin_start\">0dp</dimen>\n <dimen name=\"notification_main_column_padding_top\">0dp</dimen>\n <dimen name=\"notification_media_narrow_margin\">12dp</dimen>\n <style name=\"AppTheme.NoActionBar\">\n <item name=\"windowActionBar\">false</item>\n <item name=\"windowNoTitle\">true</item>\n <item name=\"android:windowDrawsSystemBarBackgrounds\">true</item>\n <item name=\"android:statusBarColor\">@android:color/transparent</item>\n </style>"
] | [
"android",
"android-studio-2.3"
] |
[
"Is there a way to unit test an anonymous function saved in a class variable in isolation?",
"I have code resembling this:\n\nclass FirstClass\n{\n public $postProcessor;\n\n public function __construct()\n {\n $this->postProcessor = function ($x) {return $x;};\n }\n\n public function get()\n {\n $number = 2 // I want this line to not run when doing unit tests\n // (It sends an HTTP request in the actual code)\n $this->postProcessor($number);\n // This above line will most likely not work, I had to resort to all\n // sorts of hack to get the function to be actually called.\n }\n}\n\nclass SecondClass\n{\n public function firstMethod()\n {\n $instance = new FirstClass();\n $instance->postProcessor = function ($x) {return $x * 2;};\n return $instance->get();\n }\n\n public function secondMethod()\n {\n $instance = new FirstClass();\n $instance->postProcessor = function ($x) {return $x / 2;};\n return $instance->get();\n }\n}\n\n\nSo, I'd like to be able to test if those anonymous functions work correctly, without running the line that I placed that comment in.\n\nIn case I can't use anonymous functions to do this (or if it's too impractical): is it preferable to define all those postprocessors as methods of a class over just defining them as a bunch of functions? If so, why?"
] | [
"php",
"unit-testing",
"phpunit",
"anonymous-function"
] |
[
"python: using threading , apply thread timeout",
"I'm using threading library in a multithreading script. I want to implement a timeout on the thread. Thus, if the thread hasn't returned task_done after a specified amount of time, it should come out of the function and return task_done\n\nHere is my code:\n\ndef create_workers():\n for _ in range(NUMBER_OF_THREADS):\n t = threading.Thread(target=work)\n t.daemon = True\n t.start()\n\n\ndef create_jobs():\n for d in Date_set :\n queue.put(d)\n queue.join()\n scrape()\n\n\ndef scrape_page(thread_name, page_url):\n print(thread_name + ' now working on ' + page_url)\n get_active_urls_perDay(session=s,Date=page_url,County=Cty, courtSystem=CS, PT=P)\n\n\ndef work():\n while True:\n url = queue.get()\n scrape_page(threading.current_thread().name, url)\n Date_set.remove(url)\n print str(len(Date_set)) + \" days more to go!\"\n print \"Number of threads active\", threading.activeCount()\n queue.task_done()\n\n\ndef scrape():\n queued_links = Date_set\n if len(queued_links) > 0:\n print(str(len(queued_links)) + ' days in the queue')\n create_jobs()\n\n\nIn the work function, I want to implement a timeout on the thread.\nOtherwise the code runs fine, but the threads which haven't returned task_done halt the code and it keeps waiting for them to return."
] | [
"python",
"multithreading",
"timeout",
"python-multithreading"
] |
[
"Strategy for reusing GWT DatePicker in Javascript algorithm",
"in my GWT application I use a Javascript library to provide users with a SQL Where string builder capability - used to support 'advanced search'.\n\nThe javascript sources currently just provide a plain html text field for the date. If I was in pure JS I'd incorporate one of the many 3rd party date selector libraries.\n\nBut, I've already got the GWT date-editor there in the client (to support other UI capabilities).\n\nCan anyone recommend a strategy for incorporating the GWT popup editor in my legacy javascript? Because of GWT compiler obfuscation I don't think I can reliably predict the name of the GWT date editor component classes.\n\nI suppose it's a balance between pushing the config from GWT, or pulling from the javascript sources.\n\ncheers,\nIan"
] | [
"javascript",
"gwt"
] |
[
"How to select from WebMatrix-database in Visual Studio with Linq",
"How we select data from SDF (webmatrix) database in visual studio with Linq just like we can with northwind, like this:?\n\n// Northwnd inherits from System.Data.Linq.DataContext.\nNorthwnd nw = new Northwnd(@\"northwnd.mdf\");\n// or, if you are not using SQL Server Express\n// Northwnd nw = new Northwnd(\"Database=Northwind;Server=server_name;Integrated Security=SSPI\");\n\nvar companyNameQuery =\n from cust in nw.Customers\n where cust.City == \"London\"\n select cust.CompanyName;\n\nforeach (var customer in companyNameQuery)\n{\n Console.WriteLine(customer);\n}\n\n\nRef: http://msdn.microsoft.com/en-us/library/bb399398.aspx\n\nplease thank you for your help."
] | [
"c#",
".net",
"visual-studio-2010",
"razor",
"webmatrix"
] |
[
"React js Objects are not valid as a React child",
"I am trying to make a socket connection to my backend through my front end, but sme successfully\n\nI declared my socket in my state and then opened the connection, but I don't know why this error:\n\ncode:\n\nclass App extends Component {\n constructor(props, context){\n super(props, context);\n this.state = {\n queue: '',\n socket: null\n };\n }\n componentDidMount() {\n // io() not io.connect()\n this.state.socket = io('http://localhost:9000');\n\n this.state.socket.on('queue', (queue) => {\n this.setState({\n queue\n })\n });\n\n this.state.socket.open();\n }\n\n componentWillUnmount() {\n this.state.socket.close();\n }\n render() {\n return (\n <div>\n <p> Queue: {this.state.queue} </p>\n </div>\n )\n }\n}"
] | [
"javascript",
"reactjs"
] |
[
"cannot parse a file in flutter/dart",
"Need some help to get the file content.\n\nI using the flutter file-picker plugin to get a file. The plugin returns the path . \n\n'/Users//Library/Developer/CoreSimulator/Devices/A509517C-AC3F-4F87-856A-145F61075E8B/data/Containers/Data/Application/FC2B634B-F7BD-48EB-9B80-920476E20DE8/tmp/com.xyx-Inbox/myfile.doc'\n\nWhen I tried to read the content in Dart, I get the error\n\nflutter: FileSystemException: Failed to decode data using encoding 'utf-8'\n\nHere my code\n\nFuture<int> readFileStream(String path) async {\n print(path);\n File file = await new File(path);\n file.length().then((len) {\n print(len);\n });\n try {\n // Read the file\n String contents = await file.readAsString();\n return int.parse(contents);\n } catch (e) {\n print(e);\n // If encountering an error, return 0\n return 0;\n }\n }\n\n\nHow do I read the content?\n\nThanks for your help"
] | [
"flutter",
"dart"
] |
[
"Why override is not working?",
"I have a footer and I set all margin and padding to be zero at the start. When I want to set my footer to text-align: center , nothing changed formy .footer p. \nHowever the padding is still 0 horizontally, not 9px vertically.\n\n .footer{\n background-image: url(\"../img/naviga.png\");\n width: 1000px;\n height: 30px;\n /* my div settings */\n background-repeat: repeat-y;\n font-weight: bold;\n text-align: center;\n /* my div settings */\n font-family: verdana, arial, sans-serif;\n font-size: 10px;\n }\n\n /* p tag is my footer text */\n.footer p{\n padding: 9px auto 9px auto;\n }\n\n[have a look plz][1]\n[1]: http://i.stack.imgur.com/D77IT.png */\n\n\nWhy this override is not working? I also tried with !important."
] | [
"html",
"css"
] |
[
"XCode Swift iOS 8 - Lighting Torch in Background",
"Is there a way to stay the LED on, even when the app is in the background?\n\nThe code for the torch works fine but only in the foreground."
] | [
"ios",
"xcode",
"swift",
"background",
"flashlight"
] |
[
"Set property inside custom target",
"I have a solution I want to build on a CI server containing projects with a custom target like this:\n\n<Target Name=\"CustomTarget\">\n <PropertyGroup>\n <PackageOutputDir>C:\\Repos\\$(Configuration)</PackageOutputDir>\n </PropertyGroup>\n</Target>\n\n\nUnfortunately the <PackageOutputDir> is specified in different locations for some projects so I want to set it twice.\n\nOn the CI server I want to set this to another directory using /property: from msbuild binary like this:\n\nmsbuild my.sln /property:PackageOutputDir=$buildPath\\ci-output;CustomTarget.PackageOutputDir=$buildPath\\ci-output' does not set the value insideCustomTarget`. As I do not control the source, I have to pass the values using the commandline."
] | [
".net",
"msbuild",
"continuous-integration"
] |
[
"Can't pass data from controller to blade template laravel",
"In my page controller I have \n\n$this->layout->content = View::make('authentication/login')->with('page_title','title');\n\n\nI am using a blade file for my template. In the head of the html, I have \n\n<title>{{$page_title}}</title>\n\n\nI get an error that $page_title is undefined. \n\nWhat I want ideally is a $data=array('page_title'=>'Login','second_item'=>'value').... But as I cannot get the basic passing of a variable to a view working, I am sticking with that first of all."
] | [
"php",
"laravel",
"laravel-4"
] |
[
"Is it possible that accept return a value same as sockfd?",
"Is it possible that accept() return a value same as sockfd?\n\nfor example\n\nint newfd = accept(sockfd, NULL, NULL);\n\n\nIs it possible newfd == sockfd ?"
] | [
"c",
"linux",
"sockets"
] |
[
"GET request Angular+Spring not working. Why?",
"I'm trying to implement a simple GET request to send an Object of type SearchMessage from my Spring Boot server to my Angular client application. I run my server application and check if the relative JSON is correctly viewed on localhost:8080/greeting and it works.\nHere's what I see:\n\n{\n \"id\": 1,\n \"inputText\": \"Hello, World!\",\n \"targetSite\": \"Amazon\",\n \"searchLimit\": 10,\n \"numberOfProxies\": 10,\n \"details\": false\n}\n\n\nI then run my client accessing to the component (http://localhost:4200/data) that is supposed to print in the log the content of that JSON, but instead I get in the console the following error. What am I doing wrong?\n\n\n ERROR\n \n \n Object { headers: {…}, status: 0, statusText: \"Unknown Error\",\n url: \"localhost:8080/greeting\", ok: false, name: \"HttpErrorResponse\",\n message: \"Http failure response for localhost:8080/greeting: 0 Unknown\n Error\", error: error } core.js:6014:19\n \n\n\nSpring application\n\nContent of SearchMessage.java:\n\n@Entity\npublic class SearchMessage {\n\n private long id;\n private String inputText;\n private String targetSite;\n private int searchLimit;\n private int numberOfProxies;\n private boolean details;\n\n // Getters, setters and constructors...\n}\n\n\nContent of GreetingController.java:\n\n@RestController\npublic class GreetingController {\n\n private static final String template = \"Hello, %s!\";\n private final AtomicLong counter = new AtomicLong();\n\n @GetMapping(\"/greeting\")\n public SearchMessage greeting(@RequestParam(value = \"name\", defaultValue = \"World\") String name) {\n return new SearchMessage(counter.incrementAndGet(), String.format(template, name), \"Amazon\", 10, 10, false);\n }\n}\n\n\nRaw data displayed at localhost:8080/greeting:\n\n{\"id\":3,\"inputText\":\"Hello, World!\",\"targetSite\":\"Amazon\",\"searchLimit\":10,\"numberOfProxies\":10,\"details\":false}\n\n\nAngular application\n\nContent of my http.service.ts:\n\nimport { Injectable } from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\n\n@Injectable({\n providedIn: 'root'\n})\n\nexport class HttpService {\n\n constructor(private http: HttpClient) { }\n\n getGreeting() {\n return this.http.get('localhost:8080/greeting');\n }\n}\n\n\nContent of data.component.ts:\n\nimport {Component, OnInit} from '@angular/core';\nimport {HttpService} from '../http.service';\n\n@Component({\n selector: 'app-data',\n templateUrl: './data.component.html',\n styleUrls: ['./data.component.scss']\n})\n\nexport class DataComponent implements OnInit {\n greeting: Object;\n\n constructor(private _http: HttpService) {\n }\n\n ngOnInit() {\n this._http.getGreeting().subscribe(data => {\n this.greeting = data;\n console.log(this.greeting);\n });\n }\n}\n\n\nContent of search-message.ts:\n\nexport class SearchMessage {\n\n constructor(\n public id: number,\n public inputText: string,\n public targetSite: string,\n public searchLimit: number,\n public numberOfProxies: number,\n public details: boolean\n ) { }\n}"
] | [
"angular",
"spring-boot",
"http",
"get"
] |
[
"Trouble with Dynamic Menu on Codeigniter, using Array and MySQL",
"I try to implements @Tomas answer on this question > PHP foreach create menu from array\n\nI have Model below:\n\n<?php\nclass Menu_model extends CI_Model{\n function __construct(){\n parent::__construct();\n $this->load->database();\n }\n\n function getCategory($lang){\n $sql = \"SELECT * FROM category WHERE category.lang='\".mysql_real_escape_string($lang).\"'\";\n $result = $this->db->query($sql);\n return $result;\n }\n\n function getSubCategory($lang){\n $sql = \"SELECT * FROM subcategory WHERE subcategory.lang='\".mysql_real_escape_string($lang).\"'\";\n $result = $this->db->query($sql);\n return $result;\n }\n\n}\n?>\n\n\nThen I use this Controller to throw the data:\n\n<?php\n$_SESSION['lang'] = 'EN';\n\nclass Home extends CI_Controller {\n function __construct(){\n parent::__construct();\n $this->load->database();\n $this->load->model(\"menu_model\");\n }\n\n public function index()\n {\n $data[\"category\"] = $this->menu_model->getCategory($_SESSION['lang']);\n $data[\"subcategory\"] = $this->menu_model->getSubCategory($_SESSION['lang']);\n\n $this->load->view('leftmenu_view',$data);//Left Menu\n }\n}\n\n\nThis is my view to display the menu:\n\n<?php\n foreach($category->result() as $menu){\n echo \"<li><a class=\\\"sf-with-ul\\\" href=\\\"category/\".$menu->urlcategory.\"\\\">\".$menu->namecategory.\"</a></li>\";\n foreach($subcategory->result() as $key=>$submenu){\n if ($menu->idcategory == $submenu->idcategory){\n if ($key > 0){\n echo \"</li>\";\n }\n echo \"<ul class=\\\"sub-menu\\\"><a href=\\\"category/\".$submenu->urlsubcategory.\"\\\">\".$submenu->namesubcategory.\"</a><li>\";\n }\n }\n }\n ?>\n\n\nThe single menu works good on loops, but when the menu have submenu, the loops become false in structure.\n\nul\n li-a--Single Menu--/a-/li ->Have no SubMenu, Works Good\n li-a--Single Menu--/a-/li ->Have no SubMenu, Works Good\n li-a--Single Menu--/a-/li ->Have SubMenu, False Structure\n ul-class=submenu\n a-Sub Menu-/a\n li--/li\n ul-class=submenu\n a-Sub Menu-/a\n li--/li\n /ul\nul\n\n\nThe menu structure should become like this:\n\nul\n li-a--Single Menu--/a-/li\n li-a--Single Menu--/a-/li\n li-a-Single Menu With Sub Menu-/a-/li\n ul-class=submenu\n li-a-Sub Menu-/a-/li\n li-a-Sub Menu-/a-/li\n li-a-Sub Menu-/a-/li\n /ul\n li-a--Single Menu--/a-/li\n li-a--Single Menu--/a-/li\nul"
] | [
"mysql",
"codeigniter",
"drop-down-menu",
"submenu"
] |
[
"Why parent task finishes before his children tasks?",
"In my code parent task finishes before his children tasks.\nWhy does it happen?\n\nI thought parent task shouldn't finish before child task finishes. \n\nMy code:\n\nvar parent = Task.Run(() =>\n{\n int[] tab = new int[3];\n\n new Task(() =>\n {\n tab[0] = 9;\n Thread.Sleep(4000);\n Console.WriteLine(\"Child1\");\n }, TaskCreationOptions.AttachedToParent).Start();\n\n new Task(() =>\n {\n tab[1] = 2;\n Thread.Sleep(2000);\n Console.WriteLine(\"Child2\");\n }, TaskCreationOptions.AttachedToParent).Start();\n\n new Task(() =>\n {\n tab[2] = 3;\n Thread.Sleep(1000);\n Console.WriteLine(\"Child3\");\n }, TaskCreationOptions.AttachedToParent).Start();\n\n Console.WriteLine(\"I am here\");\n return tab;\n});\n\nvar finalTask = parent.ContinueWith((a) =>\n{\n a.Result.ToList().ForEach(Console.WriteLine); \n});\n\nfinalTask.Wait();\nConsole.WriteLine(\"Out of threads\");\nConsole.ReadLine();\n\n\nResults:\n\n\n I am here 9 2 3 Out of threads Child3 Child2 Child1"
] | [
"c#"
] |
[
"Understanding python code?",
"I need some help understanding the start of this code:\n\ndef get_int_input(prompt=''):\n\n\nI know what the int_input does but i need some help understanding the other parts of the line to finish my code."
] | [
"python"
] |
[
"ICollectionView within CompositeCollection",
"I using a CompositeCollection defined in my ViewModel to render shapes (of various types) to a Canvas. I've created several ICollectionView's from my underlying data.\n\n// ViewModel\nICollectionView view1 = new CollectionViewSource() { Source = ObservableCollectionA }.View;\nview1.Filter = ...\n\n\nI then create a CompositeCollection to bind in xaml:\n\n_CompositeCollection = new CompositeCollection();\nvar container = new CollectionContainer() { Collection = viewModel.view1 };\n_CompositeCollection.Add(container);\n\n\nIn the view, I bind _CompositeCollection container to an ItemsControl with an ItemsPanelTemplate of Canvas.\n\nNothing is added to the Canvas. If I remove the ICollectionView layer from the ViewModel and just use the ObservableCollection directly in the CollectionContainer.Collection it works fine:\n\nvar container = new CollectionContainer() { Collection = viewModel.ObservableCollectionA };\n\n\nI don't want to expose the ObservableCollection directly, which I think is consistent with the whole MVVM paradigm.\n\nIts seems like CompositeCollection isn't working correctly; how do I merge several ICollectionViews into one collection for binding to a single ItemsControl? Or perhaps there is a better structure to use?\n\nI am using C# 4.0."
] | [
"c#",
"wpf",
"c#-4.0"
] |
[
"extract information from MS SQL database",
"My database has a table called \"SerialKey\" 3 columns id which is PK Email & Serial.\n\nI have a windows form in VB.NET, the form has 1 label, 1 TextBox, 1 Button, \nThe text in the label displays an email address, this email address will vary. When I click the button on the form I want the database to be searched for the email address and find the serial in the database. I have shown the code below but it gives me an error saying\n\"Object reference not set to an instance of an object\" it highlights the line below.\n\nDim reader As SqlDataReader = command.ExecuteReader()\n\nCan someone help me out here because I'm truly stuck and truly new :)\nAny help appreciated.\n\ncon = New SqlConnection(\"Data Source= My connection string here; Password='my password here'; \")\n cmd.Connection = con\n cmd.CommandText = \"SELECT Serial FROM SerialKey Where Serial= ?\"\n cmd.Parameters.AddWithValue(\"?\", LblName.Text)\n con.Open()\n Dim lrd As SqlDataReader = cmd.ExecuteReader()\n While lrd.Read()\n 'Do something\n If lrd.HasRows Then\n lrd.Read()\n UsersKey.Text = lrd.GetString(1) \n TextBox2.Text = lrd.GetString(2)\n End If\n End While\n Catch ex As Exception\n MessageBox.Show(\"Error while retrieving records on table...\" & ex.Message, \"Load Records\")\n Finally\n con.Close()\n End Try"
] | [
"sql-server",
"database",
"vb.net"
] |
[
"Laravel Auth::attempt alway return false",
"I don't know why Auth:attempt alway return false.\nHere is my controller:\n public function login(Request $request)\n{\n $this->validate($request, [\n 'email' => 'required|email',\n 'password' => 'required|min:6'\n ]);\n\n $user = [\n 'email' => $request['email'],\n 'password' => bcrypt($request['password']),\n ];\n\n if (Auth::guard('admin')->attempt($user)) {\n return redirect()->intended(route('admin.dashboard'));\n }\n return back()->withInput($request->only('email', 'remember'));\n}\n\nHere is my Model:\n use Notifiable;\n\n/**\n * The attributes that are mass assignable.\n *\n * @var array\n */\nprotected $fillable = [\n 'name', 'email', 'password',\n];\n\n/**\n * The attributes that should be hidden for arrays.\n *\n * @var array\n */\nprotected $hidden = [\n 'password', 'remember_token',\n];\n\n/**\n * The attributes that should be cast to native types.\n *\n * @var array\n */\nprotected $casts = [\n 'email_verified_at' => 'datetime',\n];\n\npublic function setPasswordAttribute($value) {\n $this->attributes['password'] = bcrypt($value);\n}\n\nHere is my route:\nRoute::group(['prefix' => 'admin'], function () {\nRoute::get('login', 'Admin\\LoginController@showLoginForm')->name('admin.login');\nRoute::post('login', 'Admin\\LoginController@login')->name('admin.login.post');\nRoute::get('logout', 'Admin\\LoginController@logout')->name('admin.logout');\n\nRoute::group(['middleware' => ['auth:admin']], function () {\n Route::get('/', function () {\n return view('admin.dashboard.index');\n })->name('admin.dashboard');\n\n });\n});\n\nIn controller i get array from html to send. But when in if (Auth::guard('admin')->attempt($user)) is alway false. I don't know why.\nPlease help me.\nThank so much."
] | [
"laravel"
] |
[
"Add cocos2D file into UIViewcontroller",
"I have created a game with 'cocos2D', and some menus etc in \"classic\" 'objective-C'.\nSo, as you could understand, I must create only one project. I have integrated the Cocos2D library without problem, but now when i want to run my cocos2D file into my 'UIViewcontroller', I have some troubles :\n\n#import \"ViewController.h\"\n\n@interface ViewController ()\n\n@end\n\n#import \"HelloWorldLayer.h\"\n\n@implementation ViewController\n\n+(CCScene *) scene\n{\n // 'scene' is an autorelease object.\n CCScene *scene = [CCScene node];\n\n // 'layer' is an autorelease object.\n HelloWorldLayer *layer = [HelloWorldLayer node];\n\n // add layer as a child to scene\n [scene addChild: layer];\n\n // return the scene\n return scene;\n}\n\n- (void)viewDidLoad\n{\n self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];\n\n [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.\n\n CCDirector *director = [CCDirector sharedDirector];\n CCGLView *glView = [CCGLView viewWithFrame:CGRectMake(-100, -50, 480, 480)\n pixelFormat:kEAGLColorFormatRGBA8\n depthFormat:0];\n glView.opaque = NO;\n [director setView:glView];\n [director runWithScene:[HelloWorldLayer scene]];\n\n}\n\n- (void)didReceiveMemoryWarning\n{\n [super didReceiveMemoryWarning];\n // Dispose of any resources that can be recreated.\n}\n\n@end\n\n\nAs you could see, my 'UIViewcontroller' is named ViewController, and my cocos2D file, HelloWorldLayer.\n\nI have seen that in the Introlayer file of a cocos2D project, there is no initialization for HelloWorldLayer. I try to do the same code to run my scene but it don't work and gives me the errors :\n\nAssertion failure in -[HelloWorldLayer addChild:], /Users/jerry-fr/Desktop/TestCocos2DIntegration/TestCocos2DIntegration/libs/cocos2d/CCNode.m:382\n\n2014-01-10 23:59:50.647 TestCocos2DIntegration[30030:15203] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'\n\n\nHow could I fix this sort of error please ?\n\nThank you for your help."
] | [
"ios",
"objective-c",
"uiviewcontroller",
"cocos2d-iphone"
] |
[
"In Symfony2, is there a way to pretty-print JSON responses?",
"I am writing a REST API in Symfony2, and I have my controller outputting JSON responses using the provided JsonResponse class:\n\n$response = new JsonResponse(null, $status);\n$response->setData($node['Content']);\nreturn $response;\n\n\nHowever, for debugging purposes, it would be nice to be able to pretty print the output. Is there an argument I can pass to the JsonResponse object to enable pretty-printing of the output?"
] | [
"json",
"symfony"
] |
[
"how to remove duplicate rows",
"I have the following query to retrieve bunch of data but somehow it creates duplicate rows for certain records.I tried distinct but no use\n\nWhat i am doing wrong here\n\n SELECT Distinct dbo.tblAssessmentEcosystemCredit.ManagementZoneID, AssessmentEcosystemCreditID,dbo.tblAssessmentEcosystemCredit.AssessmentVersionID , \n(COALESCE(dbo.tblManagementZone.SiteValueCurrentScore,0) \n-COALESCE(dbo.tblManagementZone.SiteValueFutureScore,0)) AS LossinSiteValueScore, \n5 AS SaveType, dbo.ufn_varbintohexstr(dbo.tblAssessmentEcosystemCredit.RowTimestamp) AS RowTimestamp, \ndbo.tblVegetationZone.EECID, \nCASE WHEN dbo.tblVegetationZone.EECID > 0 THEN 3.0 \nELSE 1.0 \nEND AS EECOffSetMultiplier \nFROM dbo.tblAssessmentEcosystemCredit \nINNER JOIN dbo.tblVegetationType \nON dbo.tblAssessmentEcosystemCredit.VegTypeID = dbo.tblVegetationType.VegTypeID \nINNER JOIN dbo.tblManagementZone \nON dbo.tblAssessmentEcosystemCredit.ManagementZoneID = dbo.tblManagementZone.ManagementZoneID \nINNER JOIN dbo.tblVegetationZone \nON dbo.tblVegetationZone.VegetationZoneID = dbo.tblManagementZone.VegetationZoneID \nINNER JOIN dbo.tblAssessmentVersion AV ON \nAV.AssessmentVersionID = dbo.tblAssessmentEcosystemCredit.AssessmentVersionID \nINNER JOIN tblAssessment TBA ON \nTBA.AssessmentID = AV.AssessmentID \nWHERE dbo.tblAssessmentEcosystemCredit.AssessmentVersionID= @AssessmentVersionID"
] | [
"sql",
"sql-server"
] |
[
"Figure out if web page is the only tab in a window?",
"Is there a way to figure out if the tab your web page is running in, is the only tab in the window or not? I've been looking on google for about 20 mins now and couldnt find anything even similar to this. I'd prefer to do it without any add-ons/plugins/etc. but if i have to use a plugin the only one I can use is Java."
] | [
"javascript",
"html",
"browser"
] |
[
"mac, trying to install tomcat server on netbeans, keep getting error \"The specified Server Location (Catalina Home) folder is not valid.\"",
"I'm trying to install Tomcat server on NetBeans. I have downloaded the Tomcat files and placed it in.\n\n\n\nBut I am keeping getting error: \"The specified Server Location (Catalina Home) folder is not valid.\"\n\n\n\nWhy is this happening, and how to solve it?"
] | [
"tomcat",
"netbeans",
"server"
] |
[
"preg_match or eregi questions",
"i have two questions.\n\n1, i have a input\n\n<input name=\"fruit\" type=\"text\" />\n\n\ni only want to text field to allow 3 kinds of inputs with formats like no space, space and & for example \"apple\", \"apple juice\" or \"apple_juice\". how can i achieve this in javascript or php? sorry i am very bad at regex\n\n2, i want to convert the follow string to some formatted string\n\nfor example\n\napple converted to apple\napple juice converted to apple_juice\napple & juice converted to apple_juice\napple&juice converted to apple_juice\napple_juice converted to apple_juice \n\nhow can i do this in php?\n\nThanks for helping me"
] | [
"php",
"javascript",
"regex"
] |
[
"Is it possible to have two footer in one page in Excel?",
"Is it possible to have two footer in one page in Excel? \n\nI'm trying to create a template.\n\nMy template must includes 2 footer. \nBut I don't know if it is possible \nto create two footer in one page. \nThank you very much!"
] | [
"excel"
] |
[
"Materialize Preloader",
"I'm new to web designing and I found MaterializeCSS framework (same purpose as Bootstrap).\n\nSo I found the pre-loaders code but unfortunately I don't know where to place it exactly. \n\nI want this circular loader appear when the carousel is loading. This is my Carousel code: \n\n<div class=\"carousel\">\n<a class=\"carousel-item\" href=\"#one!\"><img src=\"http://lorempixel.com/250/250/nature/1\"></a>\n<a class=\"carousel-item\" href=\"#two!\"><img src=\"http://lorempixel.com/250/250/nature/2\"></a>\n<a class=\"carousel-item\" href=\"#three!\"><img src=\"http://lorempixel.com/250/250/nature/3\"></a>\n<a class=\"carousel-item\" href=\"#four!\"><img src=\"http://lorempixel.com/250/250/nature/4\"></a>\n<a class=\"carousel-item\" href=\"#five!\"><img src=\"http://lorempixel.com/250/250/nature/5\"></a>\n\n\n\n\nWhere I'm supposed to put the pre-loader code ?\n\n<div class=\"preloader-wrapper active\">\n<div class=\"spinner-layer spinner-red-only\">\n <div class=\"circle-clipper left\">\n <div class=\"circle\"></div>\n </div><div class=\"gap-patch\">\n <div class=\"circle\"></div>\n </div><div class=\"circle-clipper right\">\n <div class=\"circle\"></div>\n </div>\n</div>\n\n\n\n\nthe Preloader Code link:\nhttp://materializecss.com/preloader.html\n\nthe Carousel Code link:\nhttp://materializecss.com/carousel.html\n\nThanks and I hope my question is clear enough."
] | [
"html",
"css",
"materialize"
] |
[
"Differences between Screenlog and Hardcopy on GNU Screen",
"Introduction\nI'm new using GNU screen, and I'm using it mostly because I don't want to lose my work if unexpectedly my SSH connection closes, and also because I want to keep a logfile of every output printed on my terminal (at least some recent tracks)\nFor SSH stuff, I guess Ctrl+a d to detach and screen -r or screen -r session_name to re-attach to some session solve all my problems, now I'm trying to understand logging.\nI found screenlog and hardcopy on this link, which basically says:\n\nhardcopy Ctrl+a h Writes out the current display contents to the file hardcopy.n in the window's default directory, where n is the number of the current window. This either appends or overwrites the file if it exists, as determined by the hardcopy_append command.\nlog Ctrl+a H Begins/ends logging of the current window to the file screenlog.n in the window's default directory, where n is the number of the current window. If no parameter is given, the logging state is toggled. The session log is appended to the previous contents of the file if it already exists. The current contents and the contents of the scrollback history are not included in the session log. Default is off.\n\n\nObserved Behavior\nSo, as far as I understood by this and trying to use them, after enabling screenlog, it keeps logging everything I write and all the outputs of terminal in that file (which happens to go $HOME for me) including those characters to change color like \\033[1;31mm. If I do cat screenlog.0, it crashes sometimes printing the file indefinitely, but ok, I can open it with an editor or in another session...\nAs for hardcopy, apparently it doesn't keep tracking commands, nor colors of outputs, and I don't know if it takes only those few lines that are visible in terminal or everything that happened on that session, could someone clarify this to me?\nFinally, I'm opening screen on Terminator instead of the classical terminal, and even if I open different screen sessions on different windows of Terminator, all logs go to screenlog.0 or hardcopy.0. In the case of screenlog, will it conflict with another process that's being output on other sessions or overwrite it? How can I create different screenlog.n files and put them in a directory other than $HOME?\n\nFurther Considerations\nJust to conclude, which one is recommended?\nSorry for this huge question, but I'm trying to write it in a way that it can be useful to clarify details of these logs that I'm having a hard time to find in other places. Feel free to correct me if I said something wrong :)"
] | [
"logging",
"terminal",
"gnu-screen"
] |
[
"Difference between Mongoose array and Javascript Array",
"Recently, I got a quite wired question on Mongoose, It's about the using of array. There is different use experience but I cannot find out any discussion or issue on this, so I tried to explain here, and ask someone know what's happened.\n\nIn javascript, Object is added as reference to array\n\n let existed;\n let company = { _id: \"87\" };\n let post = { evaluations: [] };\n let cost = 5;\n let predictDays = 1;\n let content = \"8\";\n if(!existed)\n {\n existed = {};\n existed.company = company._id;\n post.evaluations.push(existed);\n }\n\n existed.cost = cost || 99999999;\n existed.predictDays = predictDays || 100;\n existed.content = content || \"\";\n console.log(existed);\n console.log(post.evaluations);\n\n\nOutput:\n\n{company: \"87\", cost: 5, predictDays: 1, content: \"8\"}\n[{company: \"87\", cost: 5, predictDays: 1, content: \"8\"}]\n\n\nIn nodejs + mongoose, I got the totally different experience.\n\npost is Document from findById.\n\n let existed;\n if(!existed)\n {\n existed = {};\n existed.company = company._id;\n post.evaluations.push(existed);\n /* existed = post.evaluations.find((evaluation) => {\n return evaluation.company.toString() === company._id.toString();\n });*/ // Uncomments this would make existed get the working reference as javascript\n }\n existed.cost = cost || 99999999;\n existed.predictDays = predictDays || 100;\n existed.content = content || \"\";\n console.log(existed);\n console.log(post.evaluations);\n\n\nOutput:\n\n{\n company: 5d655f7743e25137f8501c38,\n cost: 50,\n predictDays: 3,\n content: '123321'\n}\n[{\"company\":\"5d6562bfef7d771e4815dd4f\"}]\n\n\nI cannot figure out why It's not working, but If I uncomment the code, that findagain in array, I could get the expected result as below:\n\n{\n company: 5d655f7743e25137f8501c38,\n cost: 50,\n predictDays: 3,\n content: '123321'\n}\n[{\"company\":\"5d6563391fc9b65250e83988\",\"cost\":50,\"predictDays\":3,\"content\":\"123321\"}]\n\n\nDid mongoose change the push behavior secretly? Hope It's enough infomation to point out my issue, any information is greatly appreciated."
] | [
"javascript",
"node.js",
"mongoose"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.