texts
sequence | tags
sequence |
---|---|
[
"php exec doesn't work for ping on server",
"I'm trying to ping an IP with exec function to know if IP gets pinged or not, it works totally fine on localhost and returns the output array, but when I run it on the server it returns an empty output array.\n\nwhen exec works it returns an array as $output and return variable as $return_var.\n\nif ping's unsuccessful, so when IP can't be pinged, it returns:\n\n\n array: with 9 elements\n \n return_var: 1\n\n\nif IP is pinged it returns:\n\n\n array: with more than 9 elements\n \n return_var: 0\n\n\non server it returns:\n\n\n empty array \n \n return_var: 2\n\n\nas I searched and found out when return_var is 2, it means that exec doesn't work and there's an error.\n\nthis is my code:\n\n <?php\n exec('ping -n 4 '.$ip, $output, $return_var);\n\n echo \"<pre>\";\n var_dump($output);\n ?>\n\n\nexec() isn't disabled on server, I tried this:\n\n<?php\n$disabled = explode(',', ini_get('disable_functions'));\n\necho \"<pre>\";\nvar_dump($disabled);\n?>\n\n\nand this is a disabled functions list I got:\n\n array(8) {\n [0]=>\n string(7) \"symlink\"\n [1]=>\n string(10) \"proc_close\"\n [2]=>\n string(9) \"proc_open\"\n [3]=>\n string(5) \"popen\"\n [4]=>\n string(6) \"system\"\n [5]=>\n string(2) \"dl\"\n [6]=>\n string(8) \"passthru\"\n [7]=>\n string(14) \"escapeshellcmd\"\n }\n\n\nis there any chance any of these blocked functions causing problems of exec() functionality ?\n\nalso safe mode is OFF on server and it runs php version 5.3.29"
] | [
"php",
"arrays",
"server",
"exec",
"ping"
] |
[
"jquery ajax character encoding for json",
"This is my ajax call:\n\n$.ajax({\n url: 'js/questions.json',\n type: 'POST',\n dataType: 'json',\n encoding: 'UTF-8'\n })\n .done(function(result) {\n console.log(result)\n }) \n .error(function(jqXHR, textStatus, errorThrown) {\n do_sliding(false, '#start', false, true);\n });\n\n\nThe questions.json file looks like this:\n\n {\n \"questions\": [\n {\n \"question\":\"Er du forpliktet til å lese \\\"Code of conduct\\\"-dokumentet?\",\n \"choice_1\":\"Alle nyansatte skal lese det, men ikke de som har jobbet i Infratek i over to år\",\n \"choice_2\":\"Bare ledere med personalansvar\",\n \"choice_3\":\"Alle ansatte\",\n \"answer\":\"3\"\n },\n {\n \"question\":\"Hvor ofte må man lese igjennom \\\"Code of Conduct\\\"?\",\n \"choice_1\":\"Når man blir ansatt, deretter ved endringer\",\n \"choice_2\":\"En gang i året i forbindelse med Energisamtalen\",\n \"choice_3\":\"Det er tilstrekkelig å lese en gang, deretter er det sjefens ansvar å informere om endringer\",\n \"answer\":\"2\"\n }\n ]\n}\n\n\nAs you can see i have some regional characters like: åøåæ and so on. But these characters are not encoded properly. I get this kinda things: �. Character encoding also set in my html page <meta charset=\"UTF-8\">."
] | [
"javascript",
"jquery",
"json",
"utf-8",
"character-encoding"
] |
[
"Operations With Android LiveData in EditText?",
"I have 3 editext and I have to multiply the numbers written in the first two, and make the result appear live on the third using Android Livedata.\nviewModel.num1.observe(this,\n Observer { newNum1-> binding.ediText1.text = newNum1.toString() }\n\nviewModel.num2.observe(this,\n Observer { newNum2-> binding.ediText2.text = newNum2.toString() }\n\nviewModel.num3.observe(this,\n Observer { newNum3-> binding.ediText3.text = newNum3.toString() }\n\nI tried something like this, with 2 MutableLiveData and one MediatorLivedata, but i did something wrong because it didn't update live the third EditText. Could someone help me?\nclass MyViewModel : ViewModel() {\n private var num1 = MutableLiveData<Int>();\n private var num2 = MutableLiveData<Double>();\n private var mun3 = MediatorLiveData<Double>();\n\n num3.addSource(num1, this::onChanged);\n num3.addSource(num2, this::onChanged);\n \n \n private fun onChanged(x : Double) {\n var a = num1.value\n var b = num2.value\n\n if (a== null)\n a= 0;\n if (b== null)\n b= 0.0;\n \n num3.setValue(a * b);\n }\n}\n\nI'm using Kotlin but i accept any kind of code, even in java.\nThank you for your patience and help!\nBest regards, Mark."
] | [
"android",
"kotlin",
"viewmodel",
"android-livedata",
"observers"
] |
[
"Debugging javascript 'unspecified error' in IE7",
"I have my application in Visual Studio 2008, .net 3.5 running under IE7.\nIt's running fine in Firefox, however getting 'unspecified error' in IE7 -\n\nError - \nLine: 28\nChar: 56\nError: Unspecified error.\nCode:0\nURL: ***.aspx\n\n\nAs there are around 15 .js file that are being loaded on this page, I am not able to have any information even to locate the error code.\n\nCould anyone please guide me the way to debug this error.\n\nThank you!"
] | [
"javascript"
] |
[
"How to cURL loop and download all the pages",
"I'm trying to cURL an API and able to get the data, and when I've checked through the API I was only able to get 1 page of data out of 30 pages. I'm using the command as\n\nCommand used:\n\ncurl --insecure --header '-token-' -H \"Accept: application/csv\" -H \"Content-Type: application/csv\" https://example/api/views/ > data.csv\n\n\nI tried the pages command as:\n\ncurl --insecure --header '-token-' -H \"Accept: application/csv\" -H \"Content-Type: application/csv\" https://example/api/views?PageIndex=2&PageSize=30 > data_all_pages.csv\n\n\nHow could we able to execute it through shell? For pagination or call the cURL command by running one time."
] | [
"shell",
"api",
"csv",
"curl",
"pagination"
] |
[
"Groovy String Concatenation",
"Current code:\n\nrow.column.each(){column ->\n println column.attributes()['name']\n println column.value()\n}\n\n\nColumn is a Node that has a single attribute and a single value. I am parsing an xml to input create insert statements into access. Is there a Groovy way to create the following structured statement:\n\nInsert INTO tablename (col1, col2, col3) VALUES (1,2,3)\n\n\nI am currently storing the attribute and value to separate arrays then popping them into the correct order."
] | [
"string",
"groovy"
] |
[
"Is APN name case sensitive?",
"Is every APN name case sensitive? Also, how important is APN name? When I use airtel SIM, every APN name seems to work, (sim is 64K type). But if apn name is airtelgprs.com and I use SIM idea it does not work."
] | [
"gsm",
"apn"
] |
[
"VisualStudioVersion property requires v11 folder to contain SQLDB/DAC folder which is missing",
"I am building a deployment script that should use the version of files available on the host machine to run the contained tasks/targets. My local Machine(Windows 7 64-bit) has Visual Studio 10, 2013 and 2014 installed on it and so when I explore to the C:\\Program Files (x86)\\ , I see that Microsoft Visual Studio 10.0,Microsoft Visual Studio v11.0,Microsoft Visual Studio v12.0, Microsoft Visual Studio v14.0 but missing from the contents of Microsoft Visual Studio C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\Extensions\\Microsoft is ...SQLDB\\Dac\\120\\Microsoft.Data.Tools.Schema.Tasks.Sql.dll which MSbuild expects to exist in order to property run my db deployment script. \n\nC:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v11.0\\SSDT\\Microsoft.Da\nta.Tools.Schema.SqlTasks.targets(469,5): error MSB4062: The \"SqlModelResolutionTask\" task could not be loaded from the assembly C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\Extensions\\Microsoft\\SQLDB\\Dac\\120\\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. \nCould not load file or assembly 'file:///C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\Extensions\\Microsoft\\SQLDB\\Dac\\120\\Microsoft.Data.Tools.Schema.Tasks.Sql.dll' or one of its dependencies. The system cannot find the file specified.\n Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.\n\nWhat Software pack/SDK do I need to install on my machine to get ..SQLDB\\Dac\\120\\Microsoft.Data.Tools.Schema.Tasks.Sql.dll, and other service packs needed for successful build in my case?"
] | [
"visual-studio-2010",
"visual-studio",
"msbuild",
"msbuildcommunitytasks",
"msbuildextensionpack"
] |
[
"How do I fix this random number generation code in C for my class?",
"I'm a beginner in C programming and i would appreciate if i could get some tips on how to set a program to restart? I'm currently building a guessing game, where the user has 4 attempts to guess the secret number which is provided randomly. I have almost completed the code, but it does not run correctly and some of the things it returns are incorrect. Please help.\n#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\nint main() {\n int a, Thenumber, GuessNumber, NumberofTries = 4, theAnswer;\n time_t ti;\n printf("Welcome to the game. \\nI am going to choose any number between 10 and 30");\n printf("\\nYou must try to guess the number. If you guess incorrect, I will tell you if you were too high or too low");\n printf("\\nYou will have 4 attempts to guess the number.\\n"); \n\n srand((unsigned)time(&ti));\n Thenumber = rand() % 1 + 3 + 1;//10+20+1;4\n\n for (NumberofTries = 0; NumberofTries < 4; NumberofTries++) {\n printf("\\n \\nPlease enter a number:");\n scanf("%d", &GuessNumber);\n if (GuessNumber > 30) {\n printf("That is illegal. Your number can only be between 10 and 30. Please enter a number between those numbers:/n");\n\n }\n else if (GuessNumber > Thenumber) {\n printf("I'm sorry, that is too high. \\n");\n }\n }\n\n if (GuessNumber < Thenumber) {\n printf("I'm sorry, that is too low. \\n");\n }\n\n else if (GuessNumber == Thenumber) {\n printf("You are correct. Do you want to continue playing? y-yes n-no: \\n");\n return 0;\n }\n\n printf("\\n \\nI'm sorry, you have no more attempts.\\n \\nDo you want to play again? y-yes n-no: \\n");\n scanf("%d", &theAnswer);\n\n if ((theAnswer = 'n')) {\n printf("Goodbye, thank you for playing. Please play again soon.");\n }\n return 0;\n}"
] | [
"c"
] |
[
"Performing the KS-test on a scaled distribution in python",
"I want to perform the KS-test on my data by comparing it to a uniform distribution that has been scaled. \n\nHow do I pass just a scale parameter to the args in scipy.stats.kstest (without passing any other argument to it)? I want it to take the default value for the other arguments (egs:loc) \n\nSee:\n1. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.uniform.html\n2. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kstest.html \n\nI tried the following but it did not work (invalid syntax)\n\nstats.kstest(data, 'uniform',args=(scale=15.0))"
] | [
"python",
"scipy",
"statistics",
"kolmogorov-smirnov"
] |
[
"Displaying duplicate string on index only once in Dataframe",
"I have a dataframe \n\nimport pandas as pd\n\ndf=pd.DataFrame({\n'Foo': ['John','John','John','Steve','Steve','Ted'],\n'Score': [4.1,6,5,7,6,0],\n'Picotee':[0,1,0,1,0,0]\n})\n\ndf = df.set_index('Foo', append=True)\n\nprint(df)\n\n\nThat prints to:\n\n>>> \n Picotee Score\n Foo \nJohn 0 4.1\nJohn 1 6.0\nJohn 0 5.0\nSteve 1 7.0\nSteve 0 6.0\nTed 0 0.0\n\n\nIs it possible to have the output only display the duplicate entries once in the index column 'Foo' so it looks like\n\n>>> \n Picotee Score\n Foo \nJohn 0 4.1\n 1 6.0\n 0 5.0\nSteve 1 7.0\n 0 6.0\nTed 0 0.0"
] | [
"python",
"pandas",
"dataframe"
] |
[
"Converting a d3.map quickly to an array of values",
"I have a d3.map (Hash) called data. \n\nAUT: Object\nBEL: Object\nCHE: Object\nCZE: Object\nDEU: Object\n\n\nI want to access a specific value (specificValue) of each object and put it in a simple array var values = [2,3,335,2,...] in order to dynamically compute a color scale.\n\nI came up with the below solution but don't it's elegant because I have to traverse the whole hash. Isn't there a shortcut function or something for doing this? \n\n var values = [];\n data.forEach(function(k,v){\n values.push(v.specificValue);\n }); \n\n\nvar quantize = d3.scale.quantile()\n .domain(values)\n .range(colorbrewer[COLORSCHEME][COLORCLASSES].slice(1));"
] | [
"javascript",
"arrays",
"d3.js"
] |
[
"glob function won't find file with wildcard",
"I have a piece of code that displays files in my directory like this:\n\nlstFiles = os.listdir(dir) \nnPathLen = len(dir)\n\nfor filename in lstFiles:\n print(filename)\n\n\nThis results in:\n\ngraph.png\ntest.jdx\n\n\nThen i am trying to use a wildcard to limit the results like so:\n\nimport glob \n\ndirlist = glob.glob(dir + \"*.jdx\")\nprint(dirlist)\nfor pathname in dirlist:\n filename = pathname[nPathLen:]\n print(filename)\n\n\nAll i get for output is:\n\n[]\n\n\nAm i missing something here? Is there some situations where glob won't work ?"
] | [
"python"
] |
[
"Difference between merge and join in mssql",
"I want to update a table t1 with data from t2. I can do in two ways. Can you tell me the difference in terms of accuracy and performance.\n\n1.\n\nmerge into t1 using t2 on t1.id = t2.id and t1.name <> t2.name\nwhen matched then update set t1.name=t2.name\n\n\n2.\n\n update t1 set t1.name=t2.name from t1, \n inner join t2 on t1.id = t2.id \n where t1.name <> t2.name"
] | [
"sql-server",
"merge",
"inner-join"
] |
[
"Generic Extension - Service does not implement interface member",
"Could someone help me figure out where I'm going wrong here.\n\nI'm trying to implement a generic extension method for a service in .Net Core.\n\nHere's my interface -\n\npublic interface IContactService : IAddable<Contact>\n{\n Task<List<Contact>> GetAll();\n}\n\n\nMy model - \n\npublic partial class Contact : IBaseEntity\n{\n public int Id { get; set; }\n public string Name { get; set; }\n public string Email { get; set; }\n public string Phone { get; set; }\n}\n\n\nAnd the interface for the model -\n\npublic interface IBaseEntity { }\n\n\nThen I have my generic extension -\n\npublic interface IAddable<T>\n{\n AppContext Context { get; }\n}\n\npublic static class IAddableExentions\n{\n public static async Task<T> Add<T>(this IAddable<T> addable, T entity) where T : class, IBaseEntity\n {\n await addable.Context.Set<T>().AddAsync(entity);\n await addable.Context.SaveChangesAsync();\n\n return entity;\n }\n}\n\n\nAnd my service - \n\npublic class ContactService : IContactService\n{\n public AppContext Context;\n\n public ContactService(AppContext context)\n {\n Context = context;\n }\n\n public async Task<List<Contact>> GetAll()\n {\n var contacts = await Context\n .Contacts\n .ToListAsync();\n\n return contacts;\n }\n}\n\n\nNow the compiler is complaining that -\n\n\n 'ContactService' does not implement interface member\n 'IAddable.Context'\n\n\nAnd when I try to call service.Add(contact) I'm getting -\n\n\n IContactService does not contain a definition for Add and no\n accessable extension method accepting the first argument of type\n IContactService could be found.\n\n\nI've got this working in another project but for the life of me I can't figure out why it's not working here..."
] | [
"c#",
".net-core",
"entity-framework-core"
] |
[
"Accessing object properties with JSTL - Spring and hibernate",
"I have Persons(id, name,..), Division(id, name, parentId, level...), and PersonDivisoin (id, personId, divisionId....) tables. Application uses hibernate framework to map relations with onetoone mapping between Person and Person Division, onetomany mappings between Division and PersonDivision.. below is an example data from Division table..\n\n _ _ _ _ _ _ __ _ _ _ _ _ _ _ \n| id | name | parentId| level|\n -----------------------------\n 1 XYZ dept\n 2 ZYW 1 team\n\n\nand PersonDivision table is...\n\n_ _ _ _ _ _ _ _ _ _ _ _ __ _ _\n| id | personid | divisionId| \n------------------------------\n 1 1 2\n\n\nSo I am having trouble getting the value of parent division name on the front end side if I have a person object..\n\nPerson class looks something like this..\n\n class Person{\n String name;\n int id;\n PersonDivision personDivision;\n }\n\n\nPersonDivision class..\n\n class PersonDivision\n {\n int id;\n @OneToOne Person person;\n @ManytoOne Division division;\n}\n\n\non the front page(jsp), if have to access a Person's team, I can do something like, ${person.personDivisoin.divsion.name}\n\nbut how would I access Person's \"department\"? Ideally it should take the parentid from \"Division\" table and get the name from it.. ${person.personDivisoin.divsion.parentId} gives Parent Division id but I am not sure how to retrieve its name with using JSTL.. the best I could think of is that, sending a list of all the divisions as a 2-D array with id and name and on the view, retreieve name from id..\n\nI would like to know if there are any better/simpler methods to do this.. thanks in advance!"
] | [
"hibernate",
"jstl"
] |
[
"Get only one paragraph from post through RSS",
"I googled and googled try to find something relevant but no luck.\n\nI'm setting up a 'daily tips' campaign for a client and I have to use RSS to do it.\n\nIn more detail I use MailChimp and I create a RSS-Driven campaign.\nOn the other side in the blog of the website there are daily scheduled posts.\n\nI'm trying to find a way to only get the first paragraph of the each post to give it to MailChimp and include it in the email.\n\nSo that the structure ends up like this:\nPost title\nPost's first paragraph\nRead more link\n\nAny ideas?"
] | [
"rss",
"mailchimp"
] |
[
"Debugging on real Apple Watch",
"I updated my app for Apple Watch, but I should have weighed it too much and now it's definitely slow. \nI can't understand the reasons of this slowdown so I would like to debug app but I don't know how to do that because in the simulator app works normally, slowdowns manifest only on the device.\n\nI tried running app directly from xCode on Watch but once xCode launched the installation of the app on the Watch, it stops the run so I can't see what happens while running (for instance when run certain breakpoint or otherwise do us debug).\n\nDoes anyone have an idea of what's the right way to debug on a physical Apple Watch?\n\nP.S.: For instance, this code:\n\nfunc clearScreen() {\n firstPicker.setSelectedItemIndex(0)\n secondPicker.setSelectedItemIndex(0)\n\n defaultLabels()\n}\n\nfunc defaultLabels() {\n feesLabel.setText(NSLocalizedString (\"FEES\", comment: \"Commissioni\"))\n\n clearAllMenuItems()\n addMenuItemWithItemIcon(.Decline, title: NSLocalizedString(\"CAN_CEL\", comment: \"\"), action: \"clearScreen\")\n if DefaultParameter.sharedInstance.wishMode == true {\n addMenuItemWithImage(UIImage(named: \"will\")! , title: NSLocalizedString(\"WILL_RECEIVE\", comment: \"\"), action: \"willWishButtonPressed\")\n receivedLabel.setText(NSLocalizedString (\"DESIRED_AMOUNT\", comment: \"\"))\n } else {\n addMenuItemWithImage(UIImage(named: \"wish\")! , title: NSLocalizedString(\"WISH_RECEIVE\", comment: \"\"), action: \"willWishButtonPressed\")\n receivedLabel.setText(NSLocalizedString (\"RECEIVED_AMOUNT\", comment: \"\"))\n }\n}\n\n\ntakes around 7 seconds to run..."
] | [
"ios",
"xcode",
"debugging",
"watchkit",
"apple-watch"
] |
[
"What is the time complexity of Kafka consume",
"What is the time complexity of Kafka consumer in big O. Is the offset metadata that Kafka maintains allows for O(1) complexity for reads"
] | [
"kafka-consumer-api"
] |
[
"Plotly PyQt: Get camera view properties",
"I have created a dummy example below and would like to know the following.\n\nIs there a way to:\n\n\nLoad the graph in the PyQt5 WebEngineView - Done as below code. \nIf the user interacts with the graph and changes the view angle from the initial.\nCall a function which then retrieves the \"current camera view\" from the fig displayed in the WebEngineView.\nUpdate the figure camera position to the one retrieved in (3).\n\n\nI have attempted to generate a psudo code of the functionality I would like to add to the code below - I hope this is clear.\n\nIf anyone has any experience with this it would be much appreciated. I have little experience with Javascript so a detailed example would be useful.\n\nimport sys\nfrom PyQt5.QtWidgets import QApplication\nfrom PyQt5.QtWebEngineWidgets import QWebEngineView\nimport plotly\nimport plotly.graph_objs as go\nimport numpy as np\n\napp = QApplication(sys.argv)\n\n# Helix equation\nt = np.linspace(0, 10, 50)\nx, y, z = np.cos(t), np.sin(t), t\n\n#PseudoCallbackFunction\n#Getcamera properties from the camera in plotly.\n#Print the camera properties here within the python console.\n\nfig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,\n mode='markers')])\n\nraw_html = '<html><head><meta charset=\"utf-8\" />'\nraw_html += '<script src=\"https://cdn.plot.ly/plotly-latest.min.js\"></script></head>'\n#I anticipate some type of javascript code that extracts the current camera configuration. \n#I found an example here: https://codepen.io/etpinard/pen/YedPjy?editors=0011. \n#The key information I would like signalled/pinged back to my python script is \"gd.layout.scene.camera\". \n#Perhaps the javascript can send the camera information back to the pseudo callback function above? An similar example here: https://community.plot.ly/t/synchronize-camera-across-3d-subplots/22236/4\nraw_html += '<body>'\nraw_html += plotly.offline.plot(fig, include_plotlyjs=False, output_type='div')\nraw_html += '</body></html>'\n\nview = QWebEngineView()\nview.setHtml(raw_html)\nview.show()\n\nsys.exit(app.exec_())"
] | [
"javascript",
"python",
"pyqt5",
"plotly"
] |
[
"testServer in prod mode",
"is it possible to start app in junit in production mode for play framework?\n\nex\n\nrunning(testServer(port,app), HTMLUNIT, browser -> {\n\n});\n\nhere app.isDev shall return true\n\nhow to make this?"
] | [
"java",
"playback"
] |
[
"Laravel - Undefined variable: vendedor (View: C:\\wamp64\\www\\oficina2.0\\oficina2.0\\oficina\\resources\\views\\index.blade.php)",
"I'm using Laravel and I get this error Undefined variable in my view, I send 3 variables to the view and say this one is not deaclared\nthis is my view\n@extends('templates.template')\n@section('content')\n\n@csrf\n<table class="table table-striped table-dark">\n<h2 class="text-center font-weight-bold mb-4">Orçamentos</h2>\n<br>\n <tr>\n <td>\n <select data-column="0" class="form-control filter-input">\n <option value="">Vendedores</option>\n @foreach($vendedor as $obj)\n <option value="{{$obj}}">{{$obj}}</option>\n @endforeach\n </select>\n </td>\n <td>\n <input type="text" class="form-control filter-input" placeholder="Procurar pelo cliente" data-column="8">\n </td>\n <td>\n <input type="date" class='form-control filter-input' placeholder="Procurar pelo cliente" data-column="2">\n </td>\n </tr>\n <thead>\n <tr>\n <th scope="col">Vendedor</span></th>\n <th scope="col">Cliente</span></th>\n <th scope="col">Data </span></th>\n <th scope="col">Valor</th>\n <th scope="col">\n <a href="{{url('orcamentos/create')}}">\n <button type="button" class="btn btn-light mb-2"><i class="fas fa-plus"></i> Adicionar </button>\n </a>\n </th>\n </tr>\n </thead>\n <tbody>\n \n\nand this is the controller function where i send the data sorted by the function in the view\n public function index()\n {\n $orcamentos = ModelsOrcamentoModel::get();\n $vendedores = ModelsOrcamentoModel::sortBy('vendedor')->pluck('vendedor')->unique();\n $clientes = ModelsOrcamentoModel::sortBy('cliente')->pluck('cliente')->unique();\n $data = ModelsOrcamentoModel::sortBy('created_at');\n\n return view('index')->with('orcamento',$orcamentos,'vendedor',$vendedores,'cliente',$clientes,'data',$data);\n }"
] | [
"php",
"laravel",
"undefined-variable"
] |
[
"Trying to install Ruby 1.8.7-p249 on Ubuntu 16 results in an SSL error",
"There's a lot of questions regarding this on Stackoverflow, but the answers appear to be out of date or not applicable to my situation.\n\nI've followed the instructions in this answer - https://stackoverflow.com/a/9440944/1446264\n\nAnd after running\n\nrvm pkg install openssl\nrvm install ruby-1.8.7-p249 --with-openssl-dir=/usr/share/rvm/usr\n\n\nI'm still left with the following error on the server.\n\nmake[1]: *** [ossl.o] Error 1\nmake[1]: Leaving directory `/usr/share/rvm/src/ruby-1.8.7-\np249/ext/openssl'\nmake: *** [all] Error 1`\n\n\nI think the reason must be because the version of openssl installed after running rvm pkg install openssl is too new.\n\nopenssl version gives me 1.0.1f\n\nand\n\nrvm pkg install openssl installed openssl-1.0.1i\n\nOn my development machine, I'm running openssl-0.9.8zh without any issues, so ideally I'd like to be able to use this version of openssl.\n\nIs there any way of specifying a version number when running rvm pkg install openssl? so I could do something like rvm pkg install openssl -v 0.9.8zh. I've not come across any such syntax.\n\nDoes anyone have any ideas as to how I can resolve this? I've been battling for hours. I've tried installing Ruby from source as well as with RVM and Rbenv but the openssl issue persists."
] | [
"ruby",
"ubuntu",
"openssl",
"rvm",
"ruby-1.8.7"
] |
[
"After update classpath 3.0.0 GreenDao not working",
"Yesterday I update my Android Studio. After updating if I run GreenDao application I am getting error.\n\n Exception in thread \"main\" java.lang.NoClassDefFoundError: org/greenrobot/greendao/generator/Schema\n at com.example.ApplicationDaoGenerator.main(ApplicationDaoGenerator.java:11)\nCaused by: java.lang.ClassNotFoundException: org.greenrobot.greendao.generator.Schema\n at java.net.URLClassLoader.findClass(URLClassLoader.java:381)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n ... 1 more\n\nProcess finished with exit code 1\n\n\nI tried with this solution. But no luck. And also I tried with this link. This is also not help to me. Please let me any idea to resolve this issue.\n\nI am using compile 'org.greenrobot:greendao-generator:3.2.2'. \n\nMy application generator:\n\npublic static void main(String[] args) {\n Schema schema = new Schema(1, \"com.bla.bla.dao\"); \n schema.enableKeepSectionsByDefault(); \n createTables(schema);\n\n try {\n new DaoGenerator().generateAll(schema,\"./app/src/main/java\");\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n\nI tried the following too. But no luck\n\napply plugin: 'java'\napply plugin: 'application'\nmainClassName = \"com.example.ApplicationDaoGenerator\"\n\n\ndependencies {\n compile fileTree(dir: 'libs', include: ['*.jar'])\n compile 'org.greenrobot:greendao-generator:3.2.0'\n}\n\nsourceCompatibility = \"1.7\"\ntargetCompatibility = \"1.7\""
] | [
"android",
"build.gradle",
"greendao"
] |
[
"how can I use the dir created by withTempDir in a rule?",
"I need to refer to the directory created by withTempDir by name in the Actions. I am guessing that the current working directory is changed by withTempDir, and that would likely work in the simple case. However some of the Actions must do their own (Cwd somewhere).\n\nIs there a way inside an Action to get the full path name of the created temp dir?"
] | [
"shake-build-system"
] |
[
"I want to mount a file from windows to docker image using Docker Compose Yaml file",
"volumes:\n - /fullpath/directory_name:/directory_name\n\nwhile running docker-compose i got the directory but there is a file in the directory that i want to access. But when done ls on the directory that directory is empty means file is not mounted.\nPlease suggest best possible solution if any.\nThanks"
] | [
"docker",
"docker-compose",
"dockerfile"
] |
[
"Rails asset pipeline compiled js error",
"When I'm in development mode, everything works and I have the following .js import order:\n\n<!-- Scripts -->\n<script src=\"/assets/jquery/jquery.min.js?body=1\"></script>\n<script src=\"/assets/jquery-ujs/src/rails.js?body=1\"></script>\n<script src=\"/assets/1modernizr.custom.js?body=1\"></script>\n<script src=\"/assets/2rainyday.0.1.2.min.js?body=1\"></script>\n<script src=\"/assets/3xrain_init_youtube.js?body=1\"></script>\n<script src=\"/assets/3xxbootstrap.min.js?body=1\"></script>\n<script src=\"/assets/4classie.js?body=1\"></script>\n<script src=\"/assets/5modalEffects.js?body=1\"></script>\n<script src=\"/assets/6jquery.placeholder.js?body=1\"></script>\n<script src=\"/assets/7jquery.custom.js?body=1\"></script>\n<script src=\"/assets/8script.js?body=1\"></script>\n<script src=\"/assets/application.js?body=1\"></script>\n<script>\n\n $(document).ready(function(){\n $(\"#countdown\").countdown({\n date: \"3 march 2014 12:00:00\",\n format: \"on\"\n },\n\n function() {\n // callback function\n });\n });\n\n</script>\n\n\nAnd in production, it's like the following:\n\n<!-- Scripts -->\n<script src=\"/assets/application-afbc85ff07d9057a50dee5713b8bccdf.js\"></script>\n<script>\n\n $(document).ready(function(){\n $(\"#countdown\").countdown({\n date: \"3 march 2014 12:00:00\",\n format: \"on\"\n },\n\n function() {\n // callback function\n });\n });\n\n</script>\n\n\nThe problem is I'm getting some erros in production mode that I can't understand. The First error is: \n\nUncaught TypeError: Object [object Object] has no method 'countdown'\n\n\nThe call to countdown is after the import of the application.js, so why is it happening? Is it possible that the inline script is being executed before application.js? If so, why that does not happen in development with separated files?? \n\nThe second error is:\n\nUncaught TypeError: Cannot call method 'addEventListener' of null \n\n\nUpdate:\n\nIf I put a setInterval I solve the first error, like this:\n\n<script>\n $(document).ready(function(){\n setInterval(1000, function(){\n $(\"#countdown\").countdown({\n date: \"3 march 2014 12:00:00\",\n format: \"on\"\n },\n\n function() {\n // callback function\n }\n );\n\n });\n });\n\n</script>\n\n\nSo I think the inline script is being executed first. That's very weird."
] | [
"javascript",
"ruby-on-rails",
"asset-pipeline",
"production"
] |
[
"Mono problems with cert and mozroots",
"I am using this command on my mono VM\n\nsudo mozroots --import --sync\n\n\nIt appears to be getting the cert from this site. \n\nI then try to connect to my ssl site and i get the exception that the cert is invalid. I use firefox and see the cert was issued in 2010. I looked at that file and see the last time its been updated was 2009-05-21 12:50\n\nWhen using firefox on the same machine i can navigate to the same url i am trying to connect to and i get no ssl issues. (no alert nor asking me to add it to an exception).\n\nI am confused here. How do i update mono to use the latest certs?\n\n-edit- I checked who signed the cert of the site i want to visit and their name is in certdata. I wonder why mono says the cert is not valid.\n\n\n\nI tried writing this and i hit yes to the 3 cert it asked me to import\n\ncertmgr -ssl https://www.site.com/users/login --machine\n\n\nI ran my application again and got this error. Googling the error code 0xffffffff80092012 i found this. \n\nLooks like a fixed bug that hasnt been applied to 2.6.4. Or i could be doing it wrong. I do set the ServerCertificateValidationCallback to my own thing and return true for this application as a fix for mono.\n\n\n System.Net.WebException: Error getting\n response stream (Write: The\n authentication or decryption has\n failed.): SendFailure --->\n System.IO.IOException: The\n authentication or decryption has\n failed. --->\n Mono.Security.Protocol.Tls.TlsException:\n Invalid certificate received from\n server. Error code: 0xffffffff80092012"
] | [
".net",
"security",
"firefox",
"mono",
"ssl-certificate"
] |
[
"MySql Cursor FETCH not returning Primary Key fields",
"I have a simple cursor that fetches the primary key of a table. Looking through the results, every value of the primary key column that is fetched is null. If I run the cursor's query as a standalone query, it properly returns the results. This table references my Account table with it's primary key value. If I change \"SELECT PrimaryKeyId\" to \"SELECT AccountId\", it properly fetches the field's value.\n\nWhat am I missing here?\n\nDECLARE testtableid INT UNSIGNED;\nDECLARE accountid INT UNSIGNED DEFAULT getAccountId(inUserLoginId);\nDECLARE cur CURSOR FOR SELECT TestTableId\n FROM testtable\n WHERE AccountId = accountId;\nDECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;\n\nOPEN cur; \n\nnamed_loop: LOOP\n\n FETCH cur INTO testtableid ;\n\n IF done\n THEN\n LEAVE named_loop;\n END IF;\nEND named_loop;\n\nCLOSE cur;"
] | [
"mysql",
"null",
"cursor",
"primary-key"
] |
[
"Load log data in hive table using serde regex is null",
"I want to parse this log sample\n\n\n May 3 11:52:54 cdh-dn03 init: tty (/dev/tty6) main process (1208)\n killed by TERM signal\n \n May 3 11:53:31 cdh-dn03 kernel: registered taskstats version 1\n \n May 3 11:53:31 cdh-dn03 kernel: sr0: scsi3-mmc drive: 32x/32x\n xa/form2 tray\n \n May 3 11:53:31 cdh-dn03 kernel: piix4_smbus 0000:00:07.0: SMBus base\n address uninitialized - upgrade BIOS or use force_addr=0xaddr\n \n May 3 11:53:31 cdh-dn03 kernel: nf_conntrack version 0.5.0 (7972\n buckets, 31888 max)\n \n May 3 11:53:57 cdh-dn03 kernel: hrtimer: interrupt took 11250457 ns\n \n May 3 11:53:59 cdh-dn03 ntpd_initres[1705]: host name not found:\n 0.rhel.pool.ntp.org\n\n\nThis is how I'm creating table and loading the data into it\n\nCREATE TABLE LogParserSample(\n\n month_name STRING, day STRING, time STRING, host STRING, event STRING, log STRING)\n\n ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' \n\n WITH SERDEPROPERTIES (\n\n 'input.regex' = '(^(\\S+))\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+((\\S+.)*)')\n\n stored as textfile;\n\n\nI'm using these websites to generate regex\n\nhttp://www.regexe.com/\n\nhttp://rubular.com/\n\nThese two are the regexes I'm using\n\n(\\w{3})\\s+(\\w{1})\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+((\\S+.)*)\n\n(^(\\S+))\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+((\\S+.)*)\n\nLoading data and selecting\n\nload data local inpath '/home/programmeur_v/serde_dataset.txt' into table LogParserSample;\n\nselect * from LogParserSample;\n\n\nOutput as null\n\n\n hive> select * from LogParserSample; \n \n OK \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n NULL NULL NULL NULL NULL NULL \n \n Time taken: 0.094 seconds, Fetched: 7 row(s)\n\n\nJust new to the hive so don't know what exactly is the problem"
] | [
"regex",
"hive",
"hiveql",
"hive-serde"
] |
[
".Net Core 2.0 Web API using Identity / JWT and having user manager work with DI",
"I have the same problem as this:\n\n.Net Core 2.0 Web API using JWT - Adding Identity breaks the JWT authentication\n\nIf you don't add:\n\n services.AddIdentity<ApplicationUser, IdentityRole>()\n .AddEntityFrameworkStores<IdentityDb>()\n .AddDefaultTokenProviders();\n\n\nYou can't Dependency inject the user manager, and sign in manager, to the Token Controller or other controllers.\nAny ideas how you fix that?"
] | [
"jwt",
"asp.net-identity-2",
"asp.net-core-webapi"
] |
[
"Close HTML tags in truncated string",
"I have an ASP.NET page that displays a number of blog posts one after another. I don’t want to print the whole blog posts but only a set number of characters with a Read More link. Every post is saved as html in database from where it gets loaded. I currently strip all the html tags off from the post and display the set number of characters (e.g first 300) but I eventually lose all the styling. If I don’t strip the tags off then the truncated post gets various unclosed html tags which break the page especially on IE. The blog posts are entered through a different system of which I don’t have any control over. To overcome this issue, I have written a method that takes the html in a string adds all opening tags to an array list and as soon as a tag is closed removes it from the end of the array list so at the end the array list is only left with opening tags that have not closed. I check for those tags and replace each tag with its closing tag. Then I add all these closing tags to a string and append the string to the actual html string. When adding opening tags to the string I ignore all tags that include /> to avoid self closing tags. This is doing the job for me but my method is prone to bugs as html string is not predictable. Is there a better way around this issue ?"
] | [
"c#",
"jquery",
"asp.net",
"vb.net"
] |
[
"Clang AST: get CXXCtorInitializer list for for constructors that their declaration is not also a definition",
"I'm confrunting with the following issue. The inits from CXXConstructorDecl returns an empty list in the following scenario:\n\nclass Test3 {\n int a = 2;\n int b;\n Test3();\n};\n\nTest3::Test3() : b(0) {\n}\n\n\nNow if i change the definition of the Test3 constructor and i make it inline as:\n\nclass Test3 {\n int a = 2;\n int b;\n Test3()\n : a(2)\n , b(2){\n\n }\n};\n\n\nEverything works fine and function inits returns a list of 2 items for a and b."
] | [
"c++",
"clang",
"abstract-syntax-tree",
"matcher"
] |
[
"Allow external contractor to access the apache webfolder only. Option: SFTP Jailing",
"Following Problem: We run a CentOS webserver and would like to grant access for an external contractor which only needs to access our webfolder ''/var/www' to Modify/Upload files.\n\nWhat I tried was setting up SFTP jailing (according to the following documentation: http://www.thegeekstuff.com/2012/03/chroot-sftp-setup/), but I can't make it work because of the following reason: The whole webfolder has assigned the Apache User apache:apache as usual in CentOS. But SFTP needs to have root:root ownership otherwise following error appears:\n\n\n fatal: bad ownership or modes for chroot directory component \"/var/www/\" [postauth]\n\n\nSo how can I setup SFTP or an other solution in order to keep the \"www\" folder apache:apache owned and allow an other user to access it?\n\nAre there other options to solve this problem then SFTP or is SFTP the right thing to do?\n\nThank you in advance for your help!"
] | [
"apache",
"ftp",
"centos",
"sftp"
] |
[
"Why isn't SparseArray in Android JFC compatible?",
"So, I'm supposed to use SparseArray instead of HashMap for the sake of performance:\n\nHowever, SparseArray isn't a part of JCF and does not implement Collection nor List nor Map. HashMap, on the other hand, implements Map and provides values() that I can work with when needing JCF-compatible behavior. For example, using it in an ArrayAdapter and various custom sorting (for values).\n\nMy question is three-fold:\n\n\nWhy doesn't SparseArray implement JCF interfaces? I mean,\nwhat is the motivation for not implementing these interfaces in\nlight of the fact that most of the methods are already there?\nAre there alternatives to SparseArray that implement JCF interfaces\nor can easily be converted and retain the SparseArray performance?\nAre HashMaps with a few hundred elements really that much\nslower? Are my users really going to notice?\n\n\nI'm looking for answers with depth and I prefer to have references to authoritative sites. If you think you know why SparseArray was not implemented with JCF interfaces, show some support, help me understand. If you think I should be using SparseArray, show me how to use it with ArrayAdapter and custom sorting (Comparator-esque solutions preferred). If there are better alternatives, links to the API doc, library or tutorial would be helpful. If you think I should stick with HashMaps, explain why the performance benefit of SparseArray is outweighed by the needs of the interfaces."
] | [
"android",
"collections",
"sparse-array"
] |
[
"How to get line without header from dataframe into list with pyspark",
"I get this data from CSV file and i need to send this data to Server. But i need just value from this list. \n\n{1: Row(Moid=1, Tripid='1', Tstart='2007-05-27', Tend='2007-05-27 08:36:47.846', Xstart='12785', Ystart='1308', Xend='12785', Yend='1308'), 2: Row(Moid=2, Tripid='10', Tstart='2007-05-27', Tend='2007-05-28 08:52:53.673', Xstart='9716', Ystart='-55', Xend='9716', Yend='-55')}\n\n\ni want to get this\n\n{ (1, 1, 2007-05-27, 2007-05-2708:36:47.846 , 12785, 1308, 12785, 1308)\n (2, 10, 2007-05-27, 2007-05-2808:52:53.673 , 9716, -55, 9716, -55)"
] | [
"python",
"dataframe",
"multidimensional-array",
"pyspark"
] |
[
"Checkbox inside ion-slides with loop enabled",
"I have a page which contains ion-slides with loop enabled. Each slide is generated with *ngFor and each one contains a checkbox. The problem I am facing is that the checkbox is not getting checked on first and last slides. I have found that its because there are duplicate slides for the first slide and last slide so clicking on the checkbox is not triggering it since there are duplicates for the same. I have tried giving Id to checkbox to make it unique but since the slides are generated dynamically whatever change I give is also getting replicated. Is there any workaround for this? Any help is much appreciated.\nThank you\n\nHere is my code \n\nHTML part\n\n<ion-slides pager='true' loop=\"true\">\n <ion-slide *ngFor=\"let slide of demoData\">\n <ion-card>\n <ion-card-header>{{slide}}</ion-card-header>\n <ion-card-content>\n <ion-checkbox></ion-checkbox>\n </ion-card-content>\n </ion-card>\n </ion-slide>\n</ion-slides>\n\n\nTs Part\n\ndemoData = ['1', '2', '3'];"
] | [
"ionic-framework",
"ion-slides",
"ion-checkbox"
] |
[
"AWS CLI Rename API Gateway model",
"I'm trying to do something I expected to be really simple.\n\nI'd like to simply rename a model created on my API Gateway through the AWS CLI scripting tool (using powershell).\n\nI have had a look at lots of documentation, including this aws document, with which I can do pretty much anything on the model, except rename it.\n\nI expected it to be something like:\n\naws apigateway update-model --rest-api-id RESTID --model-name 'ModelName' --\npatch-operations op=replace,path=/name,value='NewModelName' --region \nAWSREGION\n\n\nWhich is almost identical to how to update a model description:\n\naws apigateway update-model --rest-api-id RESTID --model-name 'MDescription' \n--patch-operations op=replace,path=/description,value='NewDescription' \n--region ap-southeast-2\n\n\nIs there a particular reason why we cannot rename these models, or have I just missed something?"
] | [
"powershell",
"amazon-web-services",
"aws-api-gateway",
"aws-cli"
] |
[
"How To Create A High Performance Selectors [no jquery please]",
"I m a JavaScript pure developer i design my own framework when i tested my selectors module i found a very big issue which is performance \n\nin the selectors module i don't do a very complex selector like jquery i do a simple one \nmy big cause here when i run my selectors in some cases i have to get all elements on the body of the page and have to loop over them to get a specific kind of elements like TD elements for instance , note >>>> dont tell me use getElementsByTagName('TD') cause in my selectors i can make the developer select more than 1 tagName like \n\ngetElementsByTagNames('td,tr')\n\n\nso in that case i have to get all and then loop over and pic only the needed items \n\ni found that way is very performance eater in the other hand jquery have a hilarious speed to select items doesn't jquery do loops also or what so my main question here \n\nhow to do a high performed selectors using JavaScript \n:) \n\nthanks"
] | [
"javascript",
"javascript-framework",
"unobtrusive-javascript"
] |
[
"Firebase Admob not displaying ads on Real Device in Flutter",
"My ads shows correctly on emulator, but when i test it on real devices, it doesnt show ads. here is my code below:\n=>lib/main.dart;\nimport 'package:firebase_core/firebase_core.dart';\nimport 'package:firebase_admob/firebase_admob.dart';\n\nconst String testDevice = 'ca-app-pub-366*******150~415*****06';\nconst String DWWCBannerAdUnit = "ca-app-pub-3666******50/910*****770";\nconst String DWWCAppId = "ca-app-pub-366*******150~415*****06";\n\nFuture<void> main() async{\n WidgetsFlutterBinding.ensureInitialized();\n BannerAd createBannerAd() {\n return BannerAd(\n adUnitId: DWWCBannerAdUnit,\n size: AdSize.banner,\n listener: (MobileAdEvent event) {\n print("BannerAd event $event");\n },\n );\n }\n await Firebase.initializeApp();\n FirebaseAdMob.instance.initialize(appId: DWWCAppId,);\n createBannerAd()\n ..load()\n ..show();\n runApp(dwwc());\n}"
] | [
"firebase",
"flutter",
"dart",
"admob"
] |
[
"Check if a JSON array is empty",
"I know from the first look it sounds like duplicate question but i don't think it is...\n\nI am receiving back a JSON array as:\n\nvar test1 = [] ;\n\n\nor\n\nvar test2 = [{},{},{}] ; //This is empty\n\n\nI have no problem finding out if test1 is empty.\n\njQuery.isEmptyObject(test1)\n\n\nMy problem is with the test2... \nPlease note that in some cases the test2 might return something like:\n\nvar test2 = [{\"a\":1},{},{}] ; //All these are not empty\nvar test2 = [{},{\"a\":1},{}] ; //All these are not empty\nvar test2 = [{},{},{\"a\":1}] ; //All these are not empty\n\n\nThe above scenarios shouldn't be counted as empty.I've tried to use .length but it's not helping as the length is always 3... Any ideas?\n\nCheers."
] | [
"javascript",
"jquery"
] |
[
"can I monitor changes on an HTML DIV?",
"I am working on a complex web app.\n\nIn it, there is a div which gets updated.\nIt prints something like \n\n[1/4]\n[2/4]\n[3/4]\n[4/4]\n\n\nProbably some javascript somewhere is updating with something like: \n\ndiv.innerHTML = \"[2/4]\"; \n\n\nMy question is:\n\ncan I somehow intercept/(listen to) innerHTML changes so that I could monitor how long they take. \n\nI am in a position where I could inject any javascript and I would like to collect something like\n\nconsole.log(\"1/4 has been called at timestamp\");\nconsole.log(\"2/4 has been called at timestamp\");\nconsole.log(\"3/4 has been called at timestamp\");\n..."
] | [
"javascript",
"dom",
"javascript-events"
] |
[
"Whats the correct way use PHP cURL for a GET request with query parameters and alternate port number? (for SOLR)",
"I'm trying to use PHP cURL to send a GET request to Apache Solr to receive search results, and I'm running into some trouble. This is more to do with PHP cURL I think than Solr...but i digress...here's what I have so far.\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"http://example.com/solr/example/select?\".$this->query);\ncurl_setopt($ch, CURLOPT_PORT, 8983);\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\ncurl_setopt($ch, CURLOPT_TIMEOUT, '4');\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n\n$data = json_decode(curl_exec($ch), TRUE);\n\ncurl_close($ch);\n\n\nCurrently, the request times out at 4 seconds...so I'm wondering if maybe the port# isn't being set properly...I also tried to include it in the URL itself with no luck. The weird part is that I can echo the constructed URL, add the port# manually, copy/paste into the browser and it works! But, for some reason it doesn't with the code above. \n\nAny help would be greatly appreciated! Thanks in advance!"
] | [
"php",
"curl",
"solr"
] |
[
"Background-position not working with CSS animation and linear gradient",
"I'm attempting to use CSS3 (gradients and animations) to make an animation similar to the iphone slide to unlock gradient. However, for some reason, the background-position only works when I use static pixel numbers and not when I use percentages. Ideally, I'd be able to apply this class to any element, and have the animation work, without needing to code for specific widths. Can somebody point me in the right direction?\n\nJSFiddle:\nhttps://jsfiddle.net/ekLamtbL/\n\n.slideToUnlock {\n background: linear-gradient(-90deg, black 0%, gray 40%, white 45%, gray 55%, black 60%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n color: transparent;\n -webkit-animation: slidetounlock 5s infinite;\n animation: slidetounlock 5s infinite;\n -webkit-animation-direction: normal;\n animation-direction: normal;\n}\n\n@-webkit-keyframes slidetounlock {\n 0% {\n background-position: -100% 0;\n }\n 100% {\n background-position: 100% 0;\n }\n}"
] | [
"css",
"animation",
"css-animations"
] |
[
"Why use model.matrix to build design?",
"I am a bit confused about the use that we sometimes do of model.matrix. I understand that it is meant to build a design matrix ( https://en.wikipedia.org/wiki/Design_matrix ) but why don't we just stick to passing the columns straight to glm?\n\nI've built a little example to try to find any difference but both seem equivalent. Could anyone explain?\n\nThanks!\n\n## Data prep\nrequire(data.table)\nrequire(ggplot2)\n\nset.seed(200)\ns = 204\ndt = data.table(x1=seq(1,s), \n x2=c(-3,0,3,9), \n switch = c(\"Low\",\"Zero\",\"High\",\"VHigh\"),\n e = rnorm(s,mean =0, sd=5))\n\ndt[, y_real := x1^2+x2*e]\n\n\n# Regression without explicit design matrix\nr = lm(y_real~I(x1^2)+switch,data=dt)\nsummary(r)\ndt[, y_fitted := r$fitted.values]\n\n# Regression with explicit design matrix\nmod = model.matrix(~I(x1^2)+switch+0, data=dt)\nr2 = lm(dt$y_real~mod)\nsummary(r2)\ndt[, y_model := r2$fitted.values]\n\nidentical(dt$y_fitted, dt$y_model) # => FALSE, but errors ~ 1e-14\n\nggplot(dt[1:20])+\n aes(x=x1)+\n geom_line(aes(y = y_real, colour = \"Y real\"))+\n geom_point(aes(y = y_fitted, colour = \"Y fitted\"))+\n geom_line(aes(y = y_model, colour = \"Y model\"))\n # => perfectly aligned"
] | [
"r"
] |
[
"pandas dataframe groupby and get arbitrary member of each group",
"This question is similar to this other question.\n\nI have a pandas dataframe. I want to split it into groups, and select an arbitrary member of each group, defined elsewhere.\n\nExample: I have a dataframe that can be divided in 6 groups of 4 observations each. I want to extract the observations according to:\n\nselected = [0,3,2,3,1,3]\n\n\nThis is very similar to\n\ndf.groupy('groupvar').nth(n)\n\n\nBut, crucially, n varies for each group according to the selected list.\n\nThanks!"
] | [
"python",
"pandas",
"group-by"
] |
[
"How to pass a function in a render inside a column (problem with scope)",
"I'm having a problem with scope, how can I access showModal function in my header? In this header I have a column called lastWinners which renders a button and in this button I want to show a modal when I press but I'm getting an typeError: Cannot read property 'showModal' of undefined.\nexport class EventsList extends React.Component {\n constructor(props) {\n super(props)\n }\n\n state = { visible: false };\n\n showModal = () => {\n this.setState({\n visible: true,\n });\n };\n\n handleOk = e => {\n console.log(e);\n this.setState({\n visible: false,\n });\n };\n\n handleCancel = e => {\n console.log(e);\n this.setState({\n visible: false,\n });\n };\n\n render() {\n const { schema, loadEvents, match } = this.props\n return (\n <Card title='Eventos' bordered={false}>\n <DataTable\n dataLoader={loadEvents}\n header={header}\n \n />\n <Modal\n title="Basic Modal"\n visible={this.state.visible}\n onOk={this.handleOk}\n onCancel={this.handleCancel}\n ></Modal>\n </Card>\n )\n }\n}\n\nconst header = {\n id: { title: 'ID' },\n winnersQuantity: { title: 'Quantidade de vencedores' },\n lastWinners: {\n title: 'Ganhadores',\n render: () => (\n <Button\n onClick={this.showModal} <--------- typeError: Cannot read property 'showModal' of undefined\n >\n <Icon type='trophy' />\n </Button>\n ),\n },\n}"
] | [
"reactjs",
"antd"
] |
[
"Library Function for logx(n)",
"I want to calculate the value of log x(n) where x is base and n is any integer. Is there any library function in c++ to do the operation? Or i need to do it manually? If I need to do it manually how can i do that?\nI have tried to do like that but it says \"log x was not declared\".\n\nint x,n;\ncin>>x>>n;\ncout<<logx(n);\n\n\n\n\nx=1,2,3,4,5,6,7,8........ and\nn= Any positive integer."
] | [
"c++"
] |
[
"uglifyjs on client-side javascript ? (or an alternative parser)",
"I need to parse (and possibly modify) a js expression from within javascript\n(Specifically i want to markup some eval() expressions before the actual eval)\n\nI really like the UglifyJS README examples, but alas, it needs node.js\nIs there any way to get this to run on clientside browser?!\n\n(i am not really a js expert so if i am completely misunderstanding this\nplatform thingy please let me know)\n\nFailing that, is there an alternative js parser ? \nCurrently i am looking LintJS or esprima or something like that"
] | [
"javascript",
"client-side",
"uglifyjs"
] |
[
"Python error OpenCV2 [ WARN:1] global Motion tracking",
"I am not really sure why it doesn't work..\nI have tried some debugging from Visual Studio Code for python.\nI have the logs and here.\n\nThe script is a motion Tracker.\nIt does this ..And closes the program to run.\n> Traceback (most recent call last):\n> \n> \n> File\n> "c:\\Users\\Οδυσσέας\\Desktop\\Python-Motion-Detection-system-master\\motion_detection.py",\n> line 16, in <module>\n> faces = face_cascade.detectMultiScale(gray, 1.3, 5) cv2.error: OpenCV(4.3.0)\n> C:\\projects\\opencv-python\\opencv\\modules\\objdetect\\src\\cascadedetect.cpp:1689:\n> error: (-215:Assertion failed) !empty() in function\n> 'cv::CascadeClassifier::detectMultiScale'\n> \n> [ WARN:1] global\n> C:\\projects\\opencv-python\\opencv\\modules\\videoio\\src\\cap_msmf.cpp\n> (436) `anonymous- PS\n> C:\\Users\\Οδυσσέας\\Desktop\\Python-Motion-Detection-system-master>\n\nThe script source link"
] | [
"python",
"opencv"
] |
[
"Need help with simple MySQL query",
"I have a table with 4 values, meta_id, post_id, meta_key and meta_value, and I want to change all meta_values found as \"yes\" to \"si\" when the meta_key is stock_available... how do I do this?. I cannot even retrieve the rows at this point...I'm trying with something like this.\n\nSELECT `meta_value` FROM `wp_postmeta` WHERE `meta_key` AND `meta_value` = 'yes'\n\n\nCould I have some help?\n\nEDIT: I had forgotten the meta_key...\n\nSELECT * FROM `wp_postmeta` WHERE `meta_key` = 'stock_available' AND `meta_value` = yes'\n\n\nSo I retrieve these... btu how do I update them?"
] | [
"mysql"
] |
[
"Calculating block/face camera/cursor has focus on in 3d block world",
"Been teaching myself 3d programming with a minecraft-clone game. I have an infinite map, loaded in chunks of 16x16x64 blocks. \n\nAs the player (the camera) walks around, the center of the camera (the game cursor) points at a block. I'm trying to figure out how to determine which block the user is pointing at.\n\nI have a camera with a 3d coordinate, yaw, pitch, so I know where the user is looking.\n\nI've tried finding coordinates that would be on a \"line\" drawn from that origin point but that doesn't account for when the camera points at the edges/corners of a block, the system won't know.\n\nI've tried looking for examples online but I'm not finding anything useful, a few examples but they're extremely buggy and poorly documented.\n\nHow can I properly convert where the center of the camera is looking into which block/face it's looking at?"
] | [
"java",
"3d"
] |
[
"Scrolling just one div with the main scroll bar",
"I've tried what seems like 100 different things and I've hunted all over this board and others so I'm not even sure if what I am trying to do is possible. But here goes...\n\nI am trying to make just one internal div on the whole page scroll, and it is now with a scrollbar on the div itself. But I want to make it scroll using the main browser scrollbar. This is the page: http://www.vqinteractive.net/temp/example.php I want the div to scroll exactly as it does now, just using the main browser scrollbar.\n\nThanks in advance for any advice!"
] | [
"html",
"scrollbar"
] |
[
"Send binary data from nodejs (request) to java (ZipInputStream)",
"For some reason zip files produced on nodeJS gets rejected on a Java server where you can only use \"binary\" data upload. \n\nIf I post the file with Postman using binary it works fine, but when sending through nodeJS (request/request-promise/http ...etc) it does not work. \n\nIt gives: \n\njava.util.zip.ZipException: only DEFLATED entries can have EXT descriptor\n at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:310)\n at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:122)\n at com.ws...\n\n\nThe files are valid (it accepts via postman!)"
] | [
"java",
"node.js",
"upload",
"binary"
] |
[
"How to check checkbox multiple to give checked attribute in angular 6?",
"I want to checked checkbox if user has permission i want checkbox is checked.\n\n\n HTML\n\n\n <div class=\"col-md-3\" *ngFor=\"let permission of permissions\">\n <div class=\"checkbox\">\n <input id=\"checkout-{{permission.id}}\"\n name=\"permissions[]\"\n (change)=\"selectedChange(permission.id)\"\n [(ngModel)]=\"selected[permission.id]\"\n type=\"checkbox\"\n value=\"{{permission.id}}\">\n <label for=\"checkout-{{permission.id}}\">{{permission.name}}</label>\n </div>\n </div>\n\n\n\n UserGroup\n\n\nexport class UserGroup {\n id: number;\n name: string;\n description?: string;\n permissions = [];\n created_at?: Date;\n updated_at?: Date;\n}\n\n\n\n Permission\n\n\nexport class Permission {\n id: number;\n name: string;\n description: string;\n}\n\n\nIn the Html how to give checked attribute to input when userGroup.permissions = Permission.id\n\nI have try this in component.ts but is not working is checked all checkbox.\n\nfor (let permission of response.permissions){\n this.selected[permission.id] = true;\n}\n\n\nCan anyone fixed it? or It have other way?\nThank for help.\n\n\n\n[ {id: 11, name: \"create-customer\", display_name: \"Create Customer\"},\n { id: 12, name: \"edit-customer\", display_name: \"Edit Customer\"},\n { id: 13, name: \"list-customer\", display_name: \"List Customer\"},\n { id: 14, name: \"delete-customer\", display_name: \"Delete Customer\"},\n]"
] | [
"html",
"angular",
"typescript"
] |
[
"Splitting a comma separated string and discarding some values in the string",
"Given the following string:\n\n423545(50),[7568787(50)],53654656,2021947(50),[021947],2021947(50),[8021947(50)]\n\n\nI would like to split it and put the contents in a array excluding the square brackets and the numbers in the brackets - i.e the result should be an array that contains the following.\n\n{423545,7568787,53654656,2021947,021947,2021947,8021947}\n\n\nMy attempt so far only works if there are no square brackets:\n\nString str = \"342398789, [233434],423545(50),[7568787(500)],53654656,2021947(50),[021947],2021947(150),[8021947(50)]\";\nString[] listItems = str.split(\"(\\\\(\\\\d+\\\\))?(?:,|$)\")\n\n\nHow can I update the above regex to also extract the numbers that wrapped in square brackets?\n\nThe strings I am trying to extract are identifiers for database rows so i need to extract them to retrieve the database row."
] | [
"java",
"regex",
"string"
] |
[
"Replacing a section fragment of a ViewPager",
"I use a ViewPager with a FragmentPagerAdapter for main navigation. Now inside one fragment/tab, I want a button which would transition to a new fragment. I'm struggling with the first argument of the replace method. Which id do I need to put in there? I've tried the view id of the ViewGroup, but that didn't work.\n\n public static class SectionFragment extends Fragment {\n public static final String ARG_SECTION_NUMBER = \"section_number\";\n\n public SectionFragment() {\n }\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n\n int sectionNr = getArguments().getInt(ARG_SECTION_NUMBER);\n String url = \"http://www.google.com\";\n if (sectionNr == 2) {\n url = \"http://www.yahoo.com\";\n } else if (sectionNr == 3) {\n final View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false);\n final ViewGroup groupContainer = container;\n Button btn = (Button)rootView.findViewById(R.id.lowerLevelBtn);\n btn.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n FragmentTransaction ft = getFragmentManager().beginTransaction();\n ft.addToBackStack(null);\n\n DetailFragment fr = new DetailFragment();\n\n ft.replace(<<<Which id do I need to place here?>>>, fr, \"detailFragment\");\n\n ft.commit();\n }\n });\n\n return rootView;\n }\n\n WebView wv = new WebView(getActivity());\n wv.setWebViewClient(new WebViewClient());\n wv.loadUrl(url);\n\n return wv;\n }\n}"
] | [
"android",
"android-fragments",
"android-tabhost",
"android-tabs"
] |
[
"table disappears when more layers are added to a leaflet map",
"I created an interactive map along with reactable which I use to show points on the map and the other way round (user can select area on the map using button on the left to filter corresponding data in a table). The issue is that when I want to add more than 1 layer (another addCircleMarkers) then the whole table disappears when I select any row. So, it all works fine with one layer, doesn't work with more than 1. Is it possible to add additional layers in this case?\nHere is reproducible code (please uncomment 2-nd addCircleMarkers layer to see disappearing table):\nlibrary(crosstalk)\nlibrary(leaflet)\nlibrary(dplyr)\nlibrary(reactable)\n\n\nui <- fluidPage(\n \n sidebarLayout(\n sidebarPanel(\n ),\n mainPanel(\n tagList(\n leaflet::leafletOutput("map"),\n reactable::reactableOutput("table") \n ))\n )\n \n)\n\nserver <- function(input, output) {\n \n # data to render in a table\n data_all <- quakes %>%\n dplyr::select(depth, mag, stations) %>%\n crosstalk::SharedData$new(group = "volcano")\n \n \n # data to render on a map\n df_sf <- quakes %>%\n sf::st_as_sf(coords = c("long","lat"), crs = 4326)\n \n df_sf_ALL <- crosstalk::SharedData$new(df_sf, group = "volcano")\n \n df_less_20 <- quakes %>%\n dplyr::filter(stations<20) %>% \n sf::st_as_sf(coords = c("long","lat"), crs = 4326) \n \n df_more_20 <- quakes %>%\n dplyr::filter(stations>20) %>% \n sf::st_as_sf(coords = c("long","lat"), crs = 4326) \n \n df_sf_less_20 <- crosstalk::SharedData$new(df_less_20, group = "volcano")\n df_sf_more_20 <- crosstalk::SharedData$new(df_more_20, group = "volcano")\n \n\n\n output$map <- leaflet::renderLeaflet({\n leaflet::leaflet(df_sf_ALL) %>%\n leaflet::addTiles() %>%\n #leaflet::addCircleMarkers(data = df_sf_less_20, fillColor = "red", stroke = FALSE) %>% \n leaflet::addCircleMarkers(data = df_sf_more_20, fillColor = "green", stroke = FALSE)\n})\n\n output$table <- reactable::renderReactable({\n reactable::reactable(\n data_all,\n selection = "multiple",\n onClick = "select",\n rowStyle = list(cursor = "pointer"),\n minRows = 10\n )\n })\n \n}\n\nshinyApp(ui = ui, server = server)"
] | [
"r",
"shiny",
"leaflet",
"reactable"
] |
[
"C++ - OOP implementation of linked list, I not sure why adding to end is not working for me, please advise",
"I am refreshing my knowledge of C++ OOP but not sure why I can get this traversal and adding to end of list up and running. Any advice on this context would be highly appreciated. \n\n #include \"stdafx.h\"\n #include \"LinkedList.h\"\n\n LinkedList::LinkedList(void)\n {\n }\n\n\n LinkedList::~LinkedList(void)\n {\n }\n\n void LinkedList::add(Node* node)\n {\n Node* root = this->getRoot();\n if(root !=NULL)\n {\n//with two nodes the commented code worked \n //while(root->getNextNode() != NULL){}\n //root->setNextNode(node);\n//this part is culprit\n Node* newNode = root->getNextNode();\n while(newNode!=NULL)\n {\n newNode = newNode->getNextNode();\n }\n//I was thinking I am reaching to last node using this traversal\n newNode = new Node(node->getData(),node->getNextNode());\n }else\n {\n this->setRoot(node);\n }\n\n };\n\n void LinkedList::traverseNodes()\n {\n Node* node = this->getRoot();\n printf(\"\\ntraversing the nodes:\");\n while(node != NULL){\n printf(\"%d\", node->getData());\n node = node->getNextNode();\n }\n }"
] | [
"c++",
"oop",
"data-structures"
] |
[
"Can I filter/query a replicated map in hazelcast?",
"Can i filter my replicated map with predicates like IMap?\n\nexample: \n\nreplicatedMap.values(Predicates.equal(\"id\", \"123\"))\n\n\nThanks."
] | [
"hazelcast"
] |
[
"How do I use @types/three for ts with webpack?",
"I have a NodeJS project I want to compile using webpack for a client side web app, for browsers.\nI have installed webpack, and ts-loader.\nI was able to compile my project, but I am getting errors in my ts file that the class types of THREEjs are not recognized.\nI have the @types/three package installed but I can't figure how to make ts-loader use that.\nHere are my config files:\npackage.json\n{\n "name": "Lib",\n "version": "1.0.0",\n "description": "",\n "main": "distribute/Lib.js",\n "scripts": {\n "test": "echo \\"Error: no test specified\\" && exit 1",\n "start": "parcel src/index.html --port 5000"\n },\n "keywords": [],\n "author": "",\n "license": "ISC",\n "devDependencies": {\n "@types/three": "^0.103.2",\n "browserify": "^17.0.0",\n "javascript-obfuscator": "^2.10.4",\n "parcel": "^2.0.0-nightly.610",\n "parcel-plugin-static-files-copy": "^2.5.1",\n "ts-loader": "^8.0.17",\n "typescript": "^3.9.9",\n "webpack": "^5.24.2",\n "webpack-cli": "^4.5.0"\n },\n "dependencies": {\n "@types/node": "^14.14.31",\n "express": "^4.17.1",\n "node-fetch": "^3.0.0-beta.9",\n "save": "^2.4.0",\n "three": "^0.118.3",\n "three-orbitcontrols": "^2.110.3"\n }\n}\n\nwebpack.config.js\nconst path = require('path');\n\nmodule.exports = {\n entry: './src/Lib.js',\n module: {\n rules: [\n {\n test: /\\.tsx?$/,\n use: 'ts-loader',\n exclude: /node_modules/,\n },\n ],\n },\n resolve: {\n extensions: ['.tsx', '.ts', '.js'],\n },\n output: {\n filename: 'bundle.js',\n path: path.resolve(__dirname, 'dist'),\n },\n};\n\ntsconfig.json\n{\n "compilerOptions": {\n "outDir": "./dist/",\n "noImplicitAny": true,\n "module": "es6",\n "target": "es5",\n "jsx": "react",\n "types": [\n "three"\n ],\n "allowJs": true\n }\n}\n\nThis is an example of the THREE.js types error I get\nTS2694: Namespace '"I:\\NodeJs\\Project\\node_modules\\three\\build\\three"' has no exported member 'DataTexture'."
] | [
"node.js",
"typescript",
"webpack",
"three.js"
] |
[
"In Enzyme, how to get a function from the props of a functional component?",
"I am writing unit tests for my react project using Jest and Enzyme.\nAs shown below, I passed a function named updateUser to the to-be-tested component EditCard via props.\ndescribe('The EditCard screen', () => {\n let wrapper;\n\n beforeEach(() => {\n const defaultProps: Partial<EditCardProps> = {\n toggleEditing: jest.fn(),\n user: mockUsers[0],\n updateUser: jest.fn(), // passes this function to the "EditCard" component via props\n showSnackbar: jest.fn(),\n };\n wrapper = shallow(<EditCard {...(defaultProps as EditCardProps)} />);\n });\n\nThen I want to test how many times it was called after simulating a click on a button.\n it('should match the snapshot when the "Name" textfield is not filled and the "submit" button is clicked', () => {\n wrapper.find('#Name').simulate('change', { target: { value: null } });\n wrapper.find('#submit').simulate('click');\n \n // Try to get the "updateUser" function from the props, but get "undefined". \n expect(wrapper.prop('updateUser')).toHaveBeenCalledTimes(0);\n });\n\nBut I got the error shown below:\n Matcher error: received value must be a mock or spy function\n\n Received has value: undefined\n\n 24 | wrapper.find('#Name').simulate('change', { target: { value: null } });\n 25 | wrapper.find('#submit').simulate('click');\n > 26 | expect(wrapper.prop('updateUser')).toHaveBeenCalledTimes(0);\n\nCould someone tell me where I did wrong? Why I cannot get the function from the props and undefined was returned?\nThanks in advance!"
] | [
"javascript",
"reactjs",
"jestjs",
"enzyme"
] |
[
"CakePHP Error: Call to a member function parseAccept() on a non-object",
"I have just upgraded from CakePHP 1.3 to cakePHP 2.4.5.\n\nI am getting the following error:\n\nFatal Error\nError: Call to a member function parseAccept() on a non-object \nFile: /myapp/lib/Cake/Controller/Component/RequestHandlerComponent.php \nLine: 157\n\n\nI'm not calling the function parseAccept() anywhere within my controller, and so don't understand why I am getting this error."
] | [
"php",
"cakephp",
"cakephp-1.3"
] |
[
"How can I read an embedded class with Jackson",
"I have the following JSON, which is a generic wrapper for Messages. From the subject I can determine what the contents are.\n\n{\n \"subject\" : \"P:WORKSPACE:ADDED\",\n \"msgType\" : \"FileInfo[]\",\n \"contents\" : [ {\n \"lastModified\" : 1380552566000,\n \"name\" : \"genSPI.vhd.pshdl\",\n \"size\" : 630,\n \"syntax\" : \"unknown\",\n \"type\" : \"pshdl\"\n } ]\n}\n\n\nNow when I read the Object with an objectReader, the contents will be a generic ArrayList with embedded Maps as the objectReader does not know what to do with the contents. That is ok for me. But how can I create a class from the contents later on? I don't want to use the polymorphic feature of Jackson as the classes that Message can contain are not known statically.\n\nThe solution I found so far appears rather clumsy to me:\n\nfinal Object json = message.getContents();\nfinal String jsonString = writer.writeValueAsString(json);\nfinal FileInfo[] readValues = mapper.readValue(jsonString, FileInfo[].class);"
] | [
"java",
"json",
"jackson"
] |
[
"why webform (asp.net-3.5)appears excluded after copying it to local system from the production server?",
"I have jsut copied one web apllication (web project) developed in asp.net 3.5 with c# and working fine now, from the live server to my local host. My question is The form which is avialble in live server is not avialble when executed from local host. then i found that form was excluded from project, viewed in solution explorer. i got erros after including that form in project and compiled, those errors are \n\n\n Error 1 :frmUpdateNCR.aspx.cs 'EAudit.AUDIT_BAL.AuditRoleSubmit' does\n not contain a definition for 'Afpf_Editedby' and no extension method\n 'Afpf_Editedby' accepting a first argument of type\n 'EAudit.AUDIT_BAL.AuditRoleSubmit' could be found (are you missing a\n using directive or an assembly reference?) 142 26 EAudit\n \n Error 2:frmUpdateNCR.aspx.cs 'EAudit.AUDIT_BAL.AuditRoleSubmit' does\n not contain a definition for 'UpdateNCRAfterEditing' and no extension\n method 'UpdateNCRAfterEditing' accepting a first argument of type\n 'EAudit.AUDIT_BAL.AuditRoleSubmit' could be found (are you missing a\n using directive or an assembly reference?) 146 35 EAudit.\n\n\nThe parameter and function are already added in class file when uploaded into production server but same are not available in the applicaiton which is in local host. \n\nI am sure i copied correct file but i dont know why this happened, could any one give me solution. sorry if this question is not to be here.."
] | [
"c#",
"asp.net",
"web"
] |
[
"RegEx for replacing a JavaScript pattern",
"I have tons of html files with expression like this:\n\neval('enterData.style.pixelTop=' + y);\n\n\nand I want to eliminate the eval expression and just execute the code, in other words change it to:\n\nenterData.style.pixelTop = y;\n\n\nCan anybody help me with this. Im breaking my head trying to get a solution but i only know how to eliminate the eval with:\n\nRegex: eval\\('(.*)'\\)\nReplace: $1\n\n\nIm using java for regex."
] | [
"javascript",
"java",
"regex",
"regex-lookarounds",
"regex-group"
] |
[
"Twitter button failed to load resource file://platform.twitter.com/widgets.js",
"When copying and pasting the following code for a Twitter button into a text file:\n\n<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"jpkcambridge\">Tweet</a>\n<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>\n\n\nI get a javascript error saying 'failed to load resource file://platform.twitter.com/widgets.js'\n\nWhat could be causing this? Thought I should be able to just copy and paste the code from Twitter."
] | [
"javascript",
"html",
"twitter",
"twitter-button"
] |
[
"How do you reference another one of your classes in java?",
"in Class1 I have a private float float1\n\nI have two public methods to access this variable.\n\npublic float getFloat1(){\n return float1;\n }\n\npublic void setFloat1(float f){\n float1 = f;\n }\n\n\nHow do I use these methods in Class2?"
] | [
"java"
] |
[
"Why GTK stops running of the rest of program?",
"I have a C++ program that I used this simple gtk code at first of my main() function, and my goal is my app shows an image when it started and keeping showing the image and keep the rest of program. \n\n GtkWidget* window;\n GtkWidget* image1;\n GtkWidget* image2;\n\n gtk_init (NULL,NULL);\n\n\n window = gtk_window_new(GTK_WINDOW_TOPLEVEL);\n image1 = gtk_image_new_from_file(\"1.jpg\");\n image2 = gtk_image_new_from_file(\"2.jpg\");\n\n window = gtk_window_new(GTK_WINDOW_TOPLEVEL);\n\n\n g_signal_connect(G_OBJECT (window), \"destroy\",\n G_CALLBACK (destroy), NULL);\n\n gtk_container_add(GTK_CONTAINER (window), image1);\n\n gtk_widget_show_all(window);\n\n gtk_main();\n\nTHE REST OF PROGRAM THAT WONT EXECUTE!\n\n\nBut when it opens a window and shows the image, it stuck there and doesn't execute the rest of code! Why this happens?"
] | [
"error-handling",
"gtk"
] |
[
"Syntax Highlightable UITextView on iOS",
"Possible Duplicate:\n UITextView with Syntax Highlighting \n\n\n\n\nI'm working on a source code editor for the iPad, but I'm stuck on square one: syntax highlighting. I'm planning on using libclang to do the heavy lifting, but there doesn't seem to be a good way to show rich text on iOS. I think the best solution would be to have a subclass of UITextView that supports NSAttributedString drawing, but I'm not sure how to do that. I've seen things like Omni's text editor, but it doesn't look very good. I only need multiple colors of a monospaced font. Is there a framework or library that would help draw attributed strings in a UITextView subclass?\n\nThanks in advance."
] | [
"ios",
"objective-c",
"uitextview",
"nsattributedstring"
] |
[
"JQuery function to click button causes maximum stack size",
"I have created this function to click a button based on its ID.\n\nfunction clickBtn(button_id) {\n console.log(button_id);\n $(button_id).click();\n}\n\n\nI added in the console.log and when i check it, it adds the same ID (from the arguement) over 805 times to the console then returns the maximum stack size exceeded error.\n\nI am calling the function like this:\n\n<div class=\"col-md-6 price-boxes\" onclick=\"clickBtn('#btn_book_20');\">\n <?php echo $twenty_hours; ?>\n\n <div style=\"position:absolute; bottom:10px; width:100%;\">\n <input type=\"hidden\" name=\"price_20\" value=\"<?php echo $twenty_hours_price; ?>\" readonly=\"readonly\" />\n <button type=\"submit\" name=\"book\" id=\"btn_book_20\" value=\"20\">Book Now</button>\n </div>\n </div><!-- /.col -->\n\n\nif the button itself is clicked, it works fine and doesnt exceed the stack size"
] | [
"jquery"
] |
[
"I am getting AUDIO/VIDEO: Unknown MIME type. in video tag mp4 in IE 11",
"My code is\n\n <video width=\"300\" preload=\"auto\" height=\"200\" autoplay=\"autoplay\" loop>\n <source src=\"https://pulseway.s3-accelerate.amazonaws.com/website/Mobile.mp4\" type=\"video/mp4\"/> \n </video>\n\nI am getting AUDIO/VIDEO: Unknown MIME type. in video tag mp4.Can anyone help me fix this problem IN IE 11\n\n\nhttps://jsfiddle.net/zLdf9acy/"
] | [
"javascript",
"angularjs",
"html",
"html5-video"
] |
[
"Conditional properties for include paths break IntelliSense editing?",
"I have a build where some include and library paths must differ based on whether the build is 32-bit or 64-bit, and must be parameterised for easy editing by the user. I'm using property sheets to deal with that requirement.\n\nAfter learning of conditional properties I thought I'd try to get rid of the hack of using per-platform property sheets to set macros based on values from the master property sheet (e.g. set PGBASEDIR from $(PGBASEDIR_x64) on x64, and $(PGBASEDIR_x86) on x86; for details see the answer to the question linked above). \n\nI switched to using conditional properties in my msbuild target file instead, but found that while the build its self worked, VS's editor couldn't find the include files whose path is specified by the conditional properties. The same is true if I set the properties in a conditional property group in the property sheet .props file, or add individual conditional properties to the main property group.\n\nSo I've tried this in both the msbuild target file:\n\n<PropertyGroup Condition=\"'$(Platform)' == 'x64'\">\n <PGBASEDIR>$(PGBASEDIR_x64)</PGBASEDIR>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Platform)' == 'Win32'\">\n <PGBASEDIR>$(PGBASEDIR_x86)</PGBASEDIR>\n</PropertyGroup>\n\n\nand have also tried adding the same to the property sheet file that's included in all build configurations/platforms. Same result. I also tried using individual conditional properties within the main <PropertyGroup Label=\"UserMacros\"> block for the property sheet; again, same effect.\n\nWhen I examine the macros list in a Visual Studio by going to a project property, editing it, and tabbing open the MACROS> list in the UI, I see the macros that're defined statically in the property sheet, but not the conditional macros.\n\nI tried adding <BuildMacro> entries to the master property sheet's <ItemGroup> in case that was the issue, e.g.:\n\n<BuildMacro Include=\"PGBASEDIR\">\n <Value>$(PGBASEDIR)</Value>\n</BuildMacro>\n\n\n\n\n... but saw no change.\n\nIn all cases the build its self runs fine, but Visual Studio's editor complains that it can't find the headers (and therefore anything defined within them).\n\nIf I stick with stacked property sheets it works, e.g.:\n\n\npg_sysdatetime project\n\n\nRelease | win32\npg_sysdatetime.props\n\n <PropertyGroup Label=\"UserMacros\">\n <PGMAJORVERSION>9.2</PGMAJORVERSION>\n <PGBASEDIR_x64>$(PROGRAMW6432)\\PostgreSQL\\$(PGMAJORVERSION)</PGBASEDIR_x64>\n <PGBASEDIR_x86>$(MSBUILDPROGRAMFILES32)\\PostgreSQL\\$(PGMAJORVERSION)</PGBASEDIR_x86>\n </PropertyGroup>\n <PropertyGroup />\n <ItemDefinitionGroup />\n <ItemGroup>\n <BuildMacro Include=\"PGMAJORVERSION\">\n <Value>$(PGMAJORVERSION)</Value>\n </BuildMacro>\n <BuildMacro Include=\"PGBASEDIR_x64\">\n <Value>$(PGBASEDIR_x64)</Value>\n </BuildMacro>\n <BuildMacro Include=\"PGBASEDIR_x86\">\n <Value>$(PGBASEDIR_x86)</Value>\n </BuildMacro>\n </ItemGroup>\n\npg_sysdatetime_x86.props\n\n\ndefines <PGBASEDIR>$(PGBASEDIR_x86)</PGBASEDIR>\n\nRelease | x64\npg_sysdatetime.props\n\n\n... same as above ...\n\npg_sysdatetime_x64.props\n\n\ndefines <PGBASEDIR>$(PGBASEDIR_x64)</PGBASEDIR>\n\n\n\n\nI'm using Visual Studio 2012 Express."
] | [
"visual-studio-2012",
"msbuild",
"conditional-statements",
"msbuild-propertygroup"
] |
[
"Top 50 records by DATALENGTH of a field in SQL Server",
"Azure SQL Server 2016 - I'm having trouble with the syntax to combine TOP, MAX and DATALENGTH to get a list of the Top 50 records from a table by DATALENGTH of a specific field.\n\nThe field I need to do the DATALENGTH on is called Text. I don't actually want the Text field returned in the results - What I want returned are fields called CaptureId and TaskSourceId from the 50 records with the largest DATALENGTH in the Text field, as well as the DATALENGTH amount.\n\nI tried this, but it did not work, with an error about CaptureId not being contained in an aggregate function or GROUP BY clause.\n\nSELECT TOP 50 \n CaptureId, \n TaskSourceId, \n MAX(DATALENGTH([Text]))\nFROM \n Data.Capture\n\n\nCan someone please help me correct this query?"
] | [
"sql-server",
"sql-limit"
] |
[
"Passing XML element to JavaScript function",
"I am trying to pass on an xml element variable to a JS function and I end up with Uncaught SyntaxError: Unexpected identifier on client-side when pressing the button. The error goes away when I pass other simple variable like integer to the function. Does that mean that it is impossible to pass an XML object to a function?\nHere's the code.\n\n function loadXMLDoc() {\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function() {\n if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n myFunction(xmlhttp);\n }\n };\n xmlhttp.open(\"GET\", \"/static/egais_files/ReplyRests.xml\", true);\n xmlhttp.send();\n}\nfunction myFunction(xml) {\n var i;\n var xmlDoc = xml.responseXML;\n var table=\"<tr><th></th><th>Alco-code</th></tr>\";\n var x = xmlDoc.getElementsByTagName(\"StockPosition\");\n for (i = 0; i <x.length; i++) { \n table += \"<tr>\" +\n \"<td>\" + x[i].getElementsByTagName(\"AlcCode\")[0].childNodes[0].nodeValue + \"</td>\" + \n \"<td><button onclick = 'populate_ttn1_xml(\" + x[i] + \")' type='button' class='btn btn-primary'>OK</button></td>\" + \n \"</tr>\";\n }\n document.getElementById(\"egaisResultTable\").innerHTML = table;\n};\nvar populate_ttn1_xml = function(x)\n{ \n result = 1\n}\n\n\nEDIT: Some more code added. The problem arises when pressing the OK button (function populate_ttn1_xml"
] | [
"javascript",
"jquery",
"xml"
] |
[
"Polymer.Dart's floating label for PaperInput not visible",
"I have the example code in my Angular.Dart component:\n\n<paper-input bind-value=\"value\" label=\"MyLabel\" floatingLabel></paper-input>\n\nThe paper input shows the value that is in my Angular.Dart component, but the floatingLabel does not appear. However, upon clicking the input, the label appears with the standard animation as if it was hidden. It seems as though this is a bug with the \"constructor\" of the paper-input element. I expected the floating label to appear above the input field when text is in the input field regardless if it was newly created or not. Is there a way to fix this glitch?\n\n\n\nProgress: (github.com/Polymer/paper-input/issues/117)\n\nI am looking intensively at the issue listed above, however implementing the fix accordingly is not as easy. As suggested by @GünterZöchbauer, I can use the dart:js library. However it appears that the solution was designed specifically for PolymerJs and not particularly for PolymerDart. Maybe I am overthinking things, but I am unable to perform a simple port. \n\nBut the issue does bring up a good point. The element is unable to detect the change (for what ever reason). So something needs to poke it to trigger an update. I currently have the dart context to the Element, however the class (paper-input is the class) does not contain the method inputAction upon inspection with WebStorm. However assuming that the inputAction method was firing an event, I can simply use the dispatchEvent method. However which event will trigger the event without modifying the object itself? And not crashing the browser would be great (I have been crashing the webpage with Chrome's Aw, snap! blue screen of death with some event tests)."
] | [
"dart",
"dart-polymer",
"polymer-elements"
] |
[
"controller not a function AngularJS",
"I have a problem. my routes do not find my controllers except /vehicules\napp.js\n\nangular.module('myApp', ['ngRoute', 'ui.grid']);\n angular.module('myApp').config(function($routeProvider) {\n $routeProvider\n // route for the home page\n .when('/', {\n templateUrl: 'views/main.html',\n controller: ''\n })\n\n\n .when('/vehicules', {\n templateUrl: 'views/vehicules.html',\n controller: 'VehiculeCtrl'\n })\n\n\n .when('/vehicule/:id', {\n templateUrl: 'views/vehicule.html',\n controller: 'VoirVehiculeCtrl'\n })\n\n\n .when('/agents', {\n templateUrl: 'views/agents.html',\n controller: 'AgentsCtrl'\n })\n\n\n .when('/agences', {\n templateUrl: 'views/agences.html',\n controller: 'AgencesCtrl'\n })\n\n\n .when('/status', {\n templateUrl: 'views/status.html',\n controller: 'StatusCtrl'\n })\n\n .otherwise({\n redirectTo: '/'\n });\n});\n\n\nVoirVehiculeCtrl.js\n\nangular.module('myApp').controller('VoirVehiculeCtrl', function($scope) {});\n\n\nmy tree:\n\n\nJavascript\n\n\ncontrollers\n\n\nVehiculeCtrl.js\nVoirVehiculeCtrl.js\n\nApp.js\n\nViews\n\n\nplease help me !! and sorry for my english xD"
] | [
"javascript",
"angularjs",
"routes"
] |
[
"How to keep two version of an android application in the same device",
"Whenever I try to install the 2nd version, it says that it is going to replace all data from the previous version. I did the following things to avoid such situations:\n\n\napp names are different so .apk file name is also different\npackage names are different\n\n\nMy app has a database. Do I need to have different database name for these two version ?\n\nSo, I would like to know, what I am doing wrong and what more should be done? I am using eclipse simulator at the moment."
] | [
"android",
"eclipse",
"apk"
] |
[
"How to give dependecies in multiproject in Gradle and what is the structure?",
"I have a multi project to be built using Gradle which has a java Project and it'll be dependancy for web Project. When I build with eclipse i have given depencies of javaProj and webProj to webprojectEAR and it works(after deployed). \n\n.ear file needs to be created using single build run whcih has the following content.\n\n- lib\n javaProj.jar\n- META-INF\n- webProj.war\n\n\nmy project structure as follows\n\n- javaProj\n build.gradle\n- webProj\n build.gradle\n- webProjEAR\n build.gradle\n- settings.gradle\n\n\nI'm trying to run the webProjEAR/build.gradle file and given as dependency as follows in it.\n\nproject(':webProjEAR') {\n dependencies { \n compile project(':javaProj')\n compile project(':webProj')\n }\n}\n\n\nit failed with error \"Could not resolve all dependencies for configuration 'webProjEAR:testRuntime' .when I run build files separatly I am able to create jar and war files. \n\nPlease can anyone help me how dependencies should be mentioned in the build files. And, where are the madatory locations to have a build.gradle file. \n\n=== More Information added to the original question from here ===\n\nMy build files are as below. I have made the changes Igor Popov had mentioned.\n\n// javaProj/build.gradle\n\napply plugin: 'java'\n\nrepositories {\nflatDir { dirs \"../local-repo\" } \n}\n\nsourceSets {\n main {\n java.srcDir \"$projectDir/src\" \n resources.srcDir \"$projectDir/XML\" \n }\n}\n\njar {\n from ('classes/com/nyl/xsl') { \n into 'com/nyl/xsl' \n }\n}\n\ndependencies {\n compile group: 'slf4j-api' , name: 'slf4j-api' , version: '1.5.6'\n compile group: 'slf4j-jdk14' , name: 'slf4j-jdk14' , version: '1.5.6' \n compile group: 'com.ibm.xml.thinclient_1.0.0' , name: 'com.ibm.xml.thinclient_1.0.0' , version: '1.0.0'\n compile group: 'junit', name: 'junit', version: '4.11'\n compile group: 'saxon9' , name: 'saxon9'\n compile group: 'saxon9-dom' , name: 'saxon9-dom'\n compile group: 'xmlunit' , name: 'xmlunit' , version: '1.4'\n}\n\n==============================================\n\n// webProj/build.gradle\n\napply plugin: 'war'\n\nrepositories {\n flatDir { dirs \"../local-repo\" } \n}\n\nwebAppDirName = 'WebContent' \n\ndependencies {\n providedCompile group: 'com.ibm.xml' , name: 'com.ibm.xml' \n providedCompile group: 'com.ibm.ws.prereq.xdi2' , name: 'com.ibm.ws.prereq.xdi2' \n providedCompile group: 'com.ibm.ws.xml.admin.metadata' , name: 'com.ibm.ws.xml.admin.metadata' \n providedCompile group: 'guava' , name: 'guava' , version: '11.0.2'\n providedCompile group: 'j2ee' , name: 'j2ee' \n providedCompile group: 'slf4j-api' , name: 'slf4j-api' , version: '1.5.6'\n providedCompile group: 'slf4j-log4j12' , name: 'slf4j-log4j12' , version: '1.5.6' \n}\n\n====================================================\n\n// webProjEAR/build.gradle\n\napply plugin: 'java'\napply plugin: 'ear'\n\nrepositories {\n flatDir { dirs \"../local-repo\" }\n}\n\ndependencies {\n compile project(':javaProj')\ncompile project(':webProj')\n}\n\near {\n appDirName 'src/main/app' \n libDirName 'APP-INF/lib' \n\n from ('../javaProj/build/libs') {\n into 'lib'\n } \n from ('../webProj/build/libs') {\n into '/'\n }\n} \n\n\nI would like to know what should contain in the roojProj/build.gradle file. Also like to know anything needs to be changed in the above files. Thanks"
] | [
"gradle",
"build.gradle"
] |
[
"Resources.LoadAssetAtPath() not working in Unity3D WebBuild",
"I'm using the following loop to grab files for an animation. This method makes it really easy for our artists to export animations from flash as PNG sequences. It works perfectly fine when run from within the unity editor. The files load and the animations play at the right time; however, when we build the project for the Web Player (this game will only be playable through a browser) the animations don't happen and I'm sure it's because of the LoadAssetAtPath function.\n\nAny Ideas?\n\n while (true)\n {\n string tempPath = PATH + mName + intToPaddedString(currentFrame, 4) + \".png\";\n\n tempTexture = null;\n tempTexture = Resources.LoadAssetAtPath(tempPath, typeof(Texture2D));\n if (tempTexture == null)\n return;\n\n mTextures.Add(tempTexture as Texture2D);\n\n currentFrame++;\n }"
] | [
"c#",
"animation",
"web",
"textures",
"unity3d"
] |
[
"Write depth buffer from Cg and then read it from OpenGL",
"I'd like to create a shadow map with cg. I have written an opengl program and 2 pixel shaders (with 2 vertex shader). In the first pixel shader, I write the DEPTH register, and in the OpenGL program I read this to a texture. In the second pixel shader I'd like to read from this texture, however it seems to contain only 0 values. There is another texture in both shaders, I don't know if that van be a problem, but I don't think so.\n\nThe first shader is like this:\n\nvoid main( in float3 point : TEXCOORD0,\n out float3 color : COLOR,\n out float depth : DEPTH)\n {\n // here I calculate the distances (c)\n color = float3(c, c, c);\n depth = c;\n }\n\n\nIn the OpenGL program I created a texture for the depth component:\n\n glGenTextures(1, &shadowtex_id);\n glBindTexture(GL_TEXTURE_2D, shadowtex_id);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, RES, RES, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);\n\n\nEnabled the GL_DEPTH_TEST, then after displaying the objects:\n\nglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, RES, RES);\n\n\nthen in the second shader:\n\nfloat depth = tex2D(shadow_array, depthcoord);\n// depthcoord is the actual point's coordinate's in the light's coordinate system\n// epsilon is a very small number\nif (this_depth < depth + epsilon) {\n color = float3(depth, depth, depth);\n}\n\n\nAnd all I'm getting is an all black screen. I tried various things, and I've come to that conclusion, that it seems like my \n\nuniform sample2D shadow_array\n\n\nis containing only 0 values. Because if I change depth's value for example to 0.2, then it's working, so I think the problem is either with the reading from the z-buffer, or reading the shadow map's texture. So how can I save the z-buffer's content to a texture in opengl?"
] | [
"opengl",
"textures",
"shader",
"cg",
"zbuffer"
] |
[
"404 being returned by urllib2.urlopen(req) even though HTTP 200 being sent",
"I have the below python script that is making a successful rest web service request but then throwing a 404 after the server sends a HTTP 200 back. I can see the rest web service web app log returning the below JSON response successfully. Any ideas on how to further troubleshoot this or what could be causing the below error?\n\nLast Python line executed:\n\nresult = urllib2.urlopen(req)\n\n\nJSON response from Rest API Endpoint:\n\nresponse{\"status\":\"SUCCESS\",\"reason\":null,\"location\":null,\"details\":null,\"errorDetails\":{}}\n\n\nPython Script:\n\n#!/home/user/activepython-2.7.2.5_x86_64/bin/python\n\nimport sys\nimport os\nimport logging\nimport subprocess\nimport tempfile\nimport json\nimport urllib2\n\n# define SVN\nsvn_repo = sys.argv[1]\nsvn_txn = sys.argv[2]\nsvn_opt = '-t'\n\n# handle temp file\ntmp_file = tempfile.NamedTemporaryFile(prefix=\"app_\",\n suffix=\".tmp\", dir=\"/tmp\", delete=False)\ndelete_file = True\n\nrest_url = 'https://host/rest/api/endpoint'\n\n# setup logging\nlog_level = logging.DEBUG\nlogger = logging.getLogger(\"myapp\")\nlogger.setLevel(log_level)\nhandler = logging.StreamHandler(sys.stderr)\nhandler.setLevel(log_level)\nlogger.addHandler(handler)\n\ndef get_svn_changes():\n cmd = \"/home/user/bin/svnlook changed --copy-info %s %s %s\" % (svn_opt, svn_txn, svn_repo)\n output, return_code = command_output(cmd)\n return output\n\ndef get_author():\n cmd = \"/home/csvn/bin/svnlook author %s %s %s\" % (svn_opt, svn_txn, svn_repo)\n author, return_code = command_output(cmd)\n return author.strip()\n\ndef call_webservice():\n req = urllib2.Request(rest_url)\n req.add_header('Accept', 'arpplication/json')\n req.add_header('Content-Type', 'application/json')\n logger.debug(\"file=\" + tmp_file.name)\n data = json.dumps({\"name\" : \"file\", \"value\" : tmp_file.name})\n logger.debug(\"data=\" + data)\n req.add_data(data)\n\n logger.debug(\"request\")\n result = urllib2.urlopen(req)\n logger.debug(\"result\")\n json_result = json.load(result)\n logger.debug(\"json_result\")\n result_data = json.loads(json_result['response'])\n logger.debug(\"result_data\")\n return result_data\n\nif __name__ == \"__main__\":\n\n exit_code = 0;\n out_message = ''\n author = get_author()\n\n try:\n tmp_file.write(\"author=%s\\n\" % author)\n output = get_svn_changes()\n tmp_file.write(output)\n tmp_file.close()\n output = call_webservice()\n\n if (output['status'] == 'ERROR'):\n out_message = output['reason']\n exit_code = 1\n\n except Exception, ex:\n out_message = str(ex)\n exit_code = 1\n\n finally:\n if (exit_code == 1):\n sys.stderr.write(\"Error: %s\" % out_message)\n if delete_file:\n os.remove(tmp_file.name)\n sys.exit(exit_code)\n\n\nTraceback Exception:\n\n//startlogger output\nfile=/tmp/app_rrOgN0.tmp\ndata={\"name\": \"file\", \"value\": \"/tmp/app_rrOgN0.tmp\"}\nrequest\n//stop logger output\nTraceback (most recent call last):\n File \"/home/csvn/data/repositories/repo/hooks/pre-commit\", line 85, in <module>\n output = call_webservice()\n File \"/home/csvn/data/repositories/repo/hooks/pre-commit\", line 59, in call_webservice\n result = urllib2.urlopen(req)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 126, in urlopen\n return _opener.open(url, data, timeout)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 400, in open\n response = meth(req, response)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 513, in http_response\n 'http', request, response, code, msg, hdrs)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 438, in error\n return self._call_chain(*args)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 372, in _call_chain\n result = func(*args)\n File \"/home/activepython-2.7.2.5_x86_64/lib/python2.7/urllib2.py\", line 521, in http_error_default\n raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)\nHTTPError: HTTP Error 404: Not Found\nError: HTTP Error 404: Not Found"
] | [
"python",
"urllib2"
] |
[
"Terraform Combine Variable and String",
"I'm trying to do a rather simple task in Terraform and it's not working:\n\ntfvars:\n\nhosted_zone = \"example.com\"\ndomain = \"my.${var.hosted_zone}\"\n\n\nroute_53_record:\n\nresource \"aws_route53_record\" \"regional\" {\n zone_id = \"${data.aws_route53_zone.selected.zone_id}\"\n name = \"${var.domain}\"\n type = \"A\"\n ttl = \"300\"\n records = [\"4.4.4.4\"]\n}\n\n\nWhen I run terraform plan I'm getting this:\n\n+ aws_route53_record.regional\n id: <computed>\n allow_overwrite: \"true\"\n fqdn: <computed>\n name: \"my.${var.hosted_zone}\"\n records.#: \"1\"\n records.3178571330: \"4.4.4.4\"\n ttl: \"300\"\n type: \"A\"\n zone_id: \"REDACTED\"\n\n\ndomain should be my.example.com. How do I join the variable hosted_zoned and a string to form domain?"
] | [
"terraform"
] |
[
"Spring custom autowiring",
"I have a project where I use heavily autowiring, e.g.\n\n@Component(\"componentA\")\npublic class ComponentAImpl implements ComponentA\n\n@Component(\"componentB\")\npublic class ComponentBImpl implements ComponentB {\n @Autowired\n private ComponentA componentA;\n}\n\n\nBut I want customer to extend all the classes, so ideally they would just add a single jar into the classpath the the extended class should be used instead of the original one.\nWhat I think would be great if they could just set a different name for the bean, e.g. \n\n@component(\"componentA-custom)\n\n\nI just need some way to customize the autowire process to look for a bean with \"-custom\" at the end and load it instead of the original bean.\nIs there any way to do that?\n\nAny help appreciated.\nThank you,\nMariusz"
] | [
"java",
"spring",
"dependency-injection",
"autowired"
] |
[
"Copying files from multiple (specified) folder paths to another directory while maintaining file structure",
"I am trying to copy multiple files from one directory to another with PowerShell.\nI would like to:\n\n\nMaintain the folder/file structure. \nCopy all files within specific folders.\n\n\nHypothetical structure:\n\n\nSource Folder\n \\User 1\n \\Folder 1\n \\Files\n \\Folder 2\n \\Files\n \\Folder 3\n \\Files\n \\User 2\n \\Folder 3\n \\Files\n \\User 3\n \\Folder 2\n \\Files\n \\User 4\n \\Folder 3\n \\Files\n \\Folder 4\n \\Files\n\n\nPossible Scenario:\n\n\nI want to copy files where users have a Folder 1 and Folder 2.\n\n\nExpected Result:\n\n\nDestination Folder\n \\User 1\n \\Folder 1\n \\Files\n \\Folder 2\n \\Files\n \\User 3\n \\Folder 2\n \\Files\n\n\nThis is the code I have so far:\n\n$FolderName = '\\\\Folder 1\\\\'\n$source = 'C:\\CDPTest\\Live'\n$target = 'C:\\CDPTest\\DevTest'\n$source_regex = [regex]::Escape($source)\n\n(gci $source -Recurse | where {-not ($_.PSIsContainer)} | select -Expand FullName) -match $FolderName |\n foreach {\n $file_dest = ($_ | Split-Path -Parent) -replace $source_regex, $target\n if (-not (Test-Path $file_dest)) {mkdir $file_dest}\n }\n\n\nAs you can see the match is only going to return one file path based on the current code, what I am trying to do is extend this to match several folder names.\n\nWhat I have tried:\n\n\nRunning this code with a different FolderName in a separate PowerShell file with no success.\nUsing an array of folder names for matching.\nUsing the -and/-or operators to extend the match function."
] | [
"powershell",
"directory",
"data-migration",
"file-copying"
] |
[
"Get Wordpress to alternate displaying 2 and 1 posts in a row",
"I am trying to code my homepage to have 2 posts in a row, and then the next row have one post, next row 2 posts, and so on.\n\nI have tried using this article, however every time I try I just get glitches.\n\nhttps://perishablepress.com/two-column-horizontal-sequence-wordpress-post-order/\n\nIf anyone has any coding solutions I would really appreciate it.\n\nThis is my current index.php file\n\n\r\n\r\n<?php\r\n\r\nget_header();\r\n\r\nif (have_posts()) :\r\nwhile (have_posts()) :\r\n$i++; if(($i % 2) == 0) : $wp_query->next_post(); else :\r\nthe_post(); ?>\r\n<article class=\"post\">\r\n <div id=\"left-column\">\r\n<h2><a href=\"<?php the_permalink(); ?>\"><?php the_title(); ?></a></h2>\r\n<p>\r\n <?php echo get_the_excerpt(); ?>\r\n <a class=\"moretext\" href=\"<?php the_permalink(); ?>\">Read more</a>\r\n </p>\r\n </div>\r\n</article>\r\n\r\n<?php endif; endwhile; else: ?>\r\n<div>Alternate content</div>\r\n<?php endif; ?>\r\n\r\n\r\n<?php $i = 0; rewind_posts(); ?>\r\n\r\n<?php if (have_posts()) :\r\nwhile (have_posts()) :\r\n$i++; if(($i % 2) !== 0) : $wp_query->next_post(); else :\r\nthe_post(); ?>\r\n<article class=\"post\">\r\n <div id=\"right-column\">\r\n<h2><a href=\"<?php the_permalink(); ?>\"><?php the_title(); ?></a></h2>\r\n<p>\r\n <?php echo get_the_excerpt(); ?>\r\n <a class=\"moretext\" href=\"<?php the_permalink(); ?>\">Read more</a>\r\n </p>\r\n </div>\r\n</article>\r\n\r\n\r\n<?php endif; endwhile; else: ?>\r\n<div>Alternate content</div>\r\n<?php endif; \r\n\r\nget_footer();\r\n\r\n?>"
] | [
"wordpress",
"wordpress-theming"
] |
[
"Can't delete the HATBM relationship in ruby on rails",
"Not sure how to delete the associate between 'fly' and 'invoice'. What I've tried so far deletes the fly from the database\n\n<table class=\"table table-condensed\">\n <thead>\n <tr>\n <th>Invoice Flies</th>\n </thead>\n <tbody>\n <% @invoice.flies.each do |fly| %>\n <tr>\n <td><%= fly.name %></td>\n <td><%= link_to \"delete\", ??????, method: :delete,\n data: { confirm: \"You sure?\" } %></td>\n </tr>\n <% end %>\n </tbody>\n </table>\n\n\nInvoice Model:\n\nclass Invoice < ActiveRecord::Base\n attr_accessible :active\n validates :user_id, presence: true\n belongs_to :user\n\n has_many :categorizations\n has_many :flies, through: :categorizations\nend\n\n\nInvoice migration:\n\nclass CreateInvoices < ActiveRecord::Migration\n def change\n create_table :invoices do |t|\n t.boolean :active\n t.integer :user_id\n\n t.timestamps\n end\n add_index :invoices, :user_id\n end\n\nend\n\n\nCategorization Model:\n\nclass Categorization < ActiveRecord::Base\n attr_accessible :fly_id, :user_id\n\n belongs_to :invoice\n belongs_to :fly\nend\n\n\nCategorization migration:\n\nclass CreateCategorizations < ActiveRecord::Migration\n def change\n create_table :categorizations do |t|\n t.integer :user_id\n t.integer :fly_id\n\n t.timestamps\n\n add_index :categorizations, :user_id\n add_index :categorizations, :fly_id\n end\n end\nend\n\n\nFly Model:\n\nclass Fly < ActiveRecord::Base\n attr_accessible :description, :name\n validates :description, :name, presence: true\n\n has_many :categorizations\n has_many :invoices, through: :categorizations\nend\n\n\nFly migration:\n\nclass CreateFlies < ActiveRecord::Migration\n def change\n create_table :flies do |t|\n t.string :name\n t.string :description\n\n t.timestamps\n end\n end\nend"
] | [
"ruby-on-rails"
] |
[
"How to distinguish long and double-values when deserializing with moshi?",
"My goal is to synchronize abitrary rows of data by using the JSON-Format.\nAs I do not know the exact scheme for the rows (it is a general sync method), my datamodel apparently has to rely on \"Object\". So in Java I will have an array of Map<String,Object> to be synchronized with the server.\n\nTranslating such a row into JSON would give something like\n\n{{\"string\":\"stringvalue\"},{\"double1\":1234.567},{\"double2\":1234.0},{\"long\":1234}}\n\n\nso far, so good - no problem with moshi - everything works as expected.\n\nNow the Problem: When I try to deserialize that JSON with moshi, I get back a double-value for the \"long\" member. Moshi converts all numbers to Doubles. But unfortunately not all numbers can be safely converted to doubles. Very big integers (aka longs) have a problem with the limited precision of doubles. And rounding-effects also might exist.\n\nI opened an issue with moshi, but unfortunately that was closed. Maybe I wasn't clear enough. (Issue 192)\n\nJSON has no concept of integer - only numbers and Strings. But the subtle detail from \"double2\" from the example above might lead to a solution for my problem:\nIf a number does not contain a decimal-point, it is an integer and should be converted to a long.\n\nAs longs can not be losslessly converted to doubles, I need a method to intercept the parser before the value is converted to double. But how to do that?\n\nMoshi has this handy concept of JsonAdapters - but unfortunately I currently do not see how I can use them in this case:\nThe input-type of such an JsonAdapter would have to be Object because I can not cast a generated double to long. So I have to intercept the parser before he converts any value.\nBut how to return more than one type from there? (I would have to return String, Double or Long from there - or if I can limit the inputs to only numbers I would at least have to return Longs or Doubles.)\n\n(My backend is written in PHP and automatically produces the desired output: Integers are written without a decimal-point.)"
] | [
"java",
"json",
"moshi"
] |
[
"Black Screen came when app start in phonegap in android before the splash screen?",
"Black screen came for 2 seconds when starting app in phonegap in android before the splash screen came. How to resolve this problem? I need splash screen immediately."
] | [
"android",
"cordova"
] |
[
"Custom pop up or spinner for android",
"i found a design in IOS that i really like but i cant figure out how to do it in android i have tried doing a custom spinner and am having a hard time with it and i thought of using a pop up but i need to be able to put clickable button in the pop up, so i think a spinner is my best change. I am going to post a picture of what i am trying to accomplish, specifically on the little half box on the top of the drop down! Thanks would really Appreciate some help thanks!!!! ![enter image description here][1] Also i have seen this in Android as well so i know it can be done. http://i.imgur.com/L1ftrSU.png"
] | [
"android"
] |
[
"No opacity IF element is visible",
"How do I get this effect that if the error message is displayed the form should not lose its opacity, but if the error message is hidden, opacity should be applied only when the form is hovered on?\n\nHTML:\n\n<section>\n <form id=\"form\" name=\"form\" action=\"login.php\" method=\"post\"> \n\n <ul>\n <li>\n <span class=\"er\" style=\"display:none;\">&nbsp;</span>\n </li> <br />\n\n <li>\n <label for=\"name\">Name</label> \n <input type=\"text\" name=\"name\" id=\"name\" /> \n </li>\n\n <li> \n <label for=\"pass\">Password</label> \n <input type=\"password\" name=\"pass\" id=\"pass\" /> \n </li>\n\n </ul>\n <input type=\"submit\" value=\"Log In\" /> \n\n</form> \n</section>\n\n\nCSS:\n\nsection { \n opacity: 0.5;\n transition: all 1s ease-in-out;\n -webkit-transition: all 1s ease-in-out;\n -moz-transition: all 1s ease-in-out;\n -o-transition: all 1s ease-in-out; \n}\n\nsection:hover{\n opacity: 100;\n transition: all 1s ease-in-out;\n -webkit-transition: all 1s ease-in-out;\n -moz-transition: all 1 ease-in-out;\n -o-transition: all 1s ease-in-out;\n}\n\n\njQuery:\n\n$('#form').bind('submit', function (e) {\n var self = $(this);\n\n jQuery.post(self.attr('action'), self.serialize(), function (response) {\n if ($(\"#name\").val() == \"\" || $(\"#pass\").val() == \"\") {\n $(\"span.er\").text('Field cannot be blank!');\n $(\"span.er\").show(); \n }\n else if (response.success) {\n window.location.href='home.php';\n } else {\n $(\"span.er\").text('Invalid username or password! Please try again.');\n $(\"span.er\").show();\n }\n }, 'json');\n\n e.preventDefault(); //prevent the form being posted \n });\n\n\nI tried adding this line to above jQuery function wherever the span.er is set to show():\n\n$(\"section\").css('opacity', '100');\n\n\n^This setting should be applied only when span.er is visible. However the problem with this is that once the error message is displayed, the opacity setting is applied regardless of whether span.er is visible or hidden."
] | [
"jquery",
"css",
"opacity"
] |
[
"When the entire stack is displayed, only the last elements of the stack are displayed. Why?",
"I need to add new items to the end of the list, delete the last one and display the entire list.\nWhen displaying the entire list, for some reason, only the last elements of the stack are displayed, by the number of elements in the list.\nWhy?\n\n#include <iostream>\n#include <stdio.h>\n#include <stack>\n\nusing namespace std;\n\nstruct Node\n{\n char* name = new char[6];\n float sumary;\n int amount;\n Node(char* name, float sumary, int amount) :name(name), sumary(sumary), amount(amount)\n {\n }\n Node() {}\n};\n\nint main()\n{\n int command;\n stack<Node> node;\n for (;;)\n {\n printf(\"Input command:\\n 1 - add,\\n 2 - delete last,\\n 3 - show all,\\n 4 - exit\\n\");\n scanf(\"%d\", &command);\n switch (command)\n {\n case 1:\n char name[6];\n float sumary;\n int amount;\n printf(\"Enter name: \");\n scanf(\"%s\", &name);\n printf(\"Enter sumary: \");\n scanf(\"%f\", &sumary);\n printf(\"Enter amount: \");\n scanf(\"%d\", &amount);\n node.push(Node(name, sumary, amount));\n break;\n case 2:\n node.pop();\n printf(\"The last have been deleted\");\n break;\n case 3:\n while (!node.empty())\n {\n Node temp = node.top();\n node.pop();\n cout << temp.name << \" \" << temp.sumary << \" \" << temp.amount << endl;\n }\n break;\n case 4:\n return 0;\n default:\n printf(\"Wrong command...\");\n break;\n }\n }\n}"
] | [
"c++",
"class",
"dynamic-memory-allocation",
"construct",
"ctor-initializer"
] |
[
"Jquery waypoints with smooth scroll",
"I am having a little trouble with JQuery waypoints here. Im using it for my auto scroll navigation on my one page site:\n\nsignaturestories.eu\n\nIt works fine when i use my scroll wheel. I need it to change the color of my nav items whenever a certain element reaches top of the screen. The problem is when you press sign up --> about --> sign up, then is doesnt change the color that third time.\n\nscript.js:\n\n $('a[href^=\"#\"]').bind('click.smoothscroll',function (e) {\n e.preventDefault();\n\n var target = this.hash,\n $target = $(target);\n\n $('html, body').stop().animate({\n 'scrollTop': $target.offset().top-40\n }, 900, 'swing', function () {\n window.location.hash = target;\n });\n });\n\n\nvar currentMenuObject = '';\n\n$('#wrapper').waypoint(function() {\n $(currentMenuObject).css('color', '#f2e0bd');\n currentMenuObject = '#top';\n $(currentMenuObject).css('color', 'black');\n}, { offset: '55'});\n\n$('#introarticle').waypoint(function() {\n $(currentMenuObject).css('color', '#f2e0bd');\n currentMenuObject = '#top';\n $(currentMenuObject).css('color', 'black');\n}, { offset: '55'});\n\n$('#signsection').waypoint(function() {\n $(currentMenuObject).css('color', '#f2e0bd');\n currentMenuObject = '#signup';\n $(currentMenuObject).css('color', 'black');\n}, { offset: '55'});\n\n$('#storyarticle').waypoint(function() {\n $(currentMenuObject).css('color', '#f2e0bd');\n currentMenuObject = '#about';\n $(currentMenuObject).css('color', 'black');\n}, { offset: '55'});"
] | [
"javascript",
"jquery",
"html",
"css",
"jquery-waypoints"
] |
[
"Simple android app to print text",
"I recently started watching youtube videos about android development. I watched a few and tried to write my own app. Basically what it does is, the user enters a text in the text field and when the user presses the click button, the entered value is displayed on a text view. \n\nI am very confused as to where I should define variables and how to retrieve values and how to show values on a specific item. I want to know this stuff so I can correctly begin developing android apps. This is the code that I currently have:\n\npackage com.abihnav.numdisplayer;\n\nimport android.os.Bundle;\nimport android.app.Activity;\nimport android.view.Menu;\nimport android.widget.EditText;\nimport android.widget.TextView;\n\npublic class MainActivity extends Activity {\n\npublic String YOUR_NUM = \"YOUR_NUM\";\n\nEditText numEditText;\nTextView textView;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n EditText numEditText = (EditText) findViewById(R.id.numEditText);\n TextView textView = (TextView) findViewById(R.id.textView1);\n}\n\npublic void printNum(){\n YOUR_NUM = numEditText.getText().toString();\n textView.setText(YOUR_NUM);\n\n\n}\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.main, menu);\n return true;\n}\n\n}\n\n\nWhenever I enter text or a number, the app force closes. HELP?!"
] | [
"java",
"android"
] |
[
"Can I change what the back arrow at the bottom of the screen does?",
"Can I change what that button does. I tried just using it but when the user changes something and goes back, the changes aren't applied"
] | [
"java",
"android",
"android-studio",
"back"
] |
[
"How to implement an async method for Design Time service",
"I have an IMyService interface which has this method:\n\npublic Task<IList<int>> GetNumbers();\n\n\nI have an implementation of IMyService which fetches the list of number from Server. Hence it is an async method.\n\nMy question is I need to do the same for a DesignTimeService. So I did:\n\npublic Task<IList<int>> GetNumbers()\n{\n var lists = new ObservableCollection<int>();\n System.Threading.Thread.Sleep(2000);\n for (int i = 0; i < 5; i++)\n lists.Add(i);\n\n return lists;\n}\n\n\nBut it won't compile. How can I return a Task<IList<int>>? If i am emulating getting the list of a number I generated locally?\n\nThank you."
] | [
"c#",
"wcf",
"asynchronous"
] |
[
"Novice to JS: How to properly call a recursive function in an HTML document?",
"I'm a bit confused on calling the function correctly in this HTML doc. What am I doing wrong? The function should return the sum of all numbers between 1 and whatever number entered on the input field but is returning NaN instead.\nHow do I assign and display the returned value from the function to the disabled input field? \n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Recursion</title>\n <script>\n let recursiveSum = (num) => {\n if (num === 1) {\n return 1;\n } else {\n return num + recursiveSum(num-1);\n }\n }\n </script>\n</head>\n<body>\n <h1>Find the sum of 1 to some number!</h1>\n<form id=\"myForm\" name=\"myForm\">\n <input type=\"number\" id=\"numInput\" name=\"numInput\" placeholder=\"Enter a positive number here\" autofocus>\n <input type=\"text\" id=\"sum\" name=\"sum\" disabled>\n <button type=\"button\" onclick=\"recursiveSum(this.form.numInput.value);\">Calculate! </button>\n</form>\n</body>\n</html>"
] | [
"javascript",
"recursion"
] |
[
"React - Reset css animation in progress",
"In React, if I have an animation that starts based on a button click, how do I restart that animation?\n\njsx\n\nconst animationStyle = `countdown ${this.props.duration}s linear infinite forwards`;\n\n\n<svg id=\"svg1\">\n <circle\n id=\"c1\"\n style={{animation: animationStyle }}\n cx=\"100\"\n cy=\"100\"\n r=\"80\"\n ></circle>\n</svg>\n\n\n.css file\n\n@keyframes countdown {\n from {\n stroke-dashoffset: 0px;\n }\n to {\n stroke-dashoffset: 500px;\n }\n}\n\n\nIf I pass down a new duration, it won't immediately start the new animation."
] | [
"css",
"reactjs",
"animation"
] |
[
"Shortcut for pushing local branch to a new remote branch with the same name",
"My workflow with new branches is: \n\ngit checkout -b <new branch name>\n// making changes, commit the changes\ngit push -u origin <new branch name>\n\n\nIs there any way to push the local branch to a new remote branch without writing the name of the branch again (local and remote branch will have the same name)? Everyday I make at least 1 feature branch with really long name and at the end of the day I have to go back to JIRA board to get project IDs and other things required for the convention. I'm just curious if there is some hack to get the local branch name and pass it directly to git push -u origin <local branch name>"
] | [
"git"
] |
[
"Using PHP to echo specific data from MySQL rows?",
"Here's an example of my MySQL table:\n\nid, type, value\n1, total_clicks, 15\n2, total_revenue, 32.42\n3, conversion_rate, 1.432\n\n\nI'm using this command to get all of those rows:\n\nSELECT * FROM statistics\n\n\nHow can I use PHP to echo the value column based upon what's in the type column?\n\nFor example, how would I do something like this:\n\necho \"We found that $total_clicks generated $total_revenue in revenue.\";\n\n\nNormally I would have each of these as a column and use fetch_assoc to echo the value of each column, but for some reason the decided to break this data up into rows..."
] | [
"php",
"mysql",
"sql"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.